Update Hasil PDF & Questionnaire User

-Menambahkan handler ketika terdapat kuesioner yang belum diisi
This commit is contained in:
DimazzP 2023-11-09 11:00:53 +07:00
parent 12979a9e9a
commit 9e74c18f5f
2 changed files with 54 additions and 26 deletions

View File

@ -24,31 +24,30 @@
<body class="bg-white">
<div class="container py-5">
<div class="row pb-1">
<div class="col-4 col-sm-3 col-md-2" style="font-weight: bold;">Tanggal Pengisian</div>
<div class="col-1" style="font-weight: bold">:</div>
<div class="col-7 col-sm-8 col-md-9">{{ $result->formatted_created_at }}</div>
</div>
<div class="row pb-1">
<div class="col-4 col-sm-3 col-md-2" style="font-weight: bold;">Nama</div>
<div class="col-1" style="font-weight: bold">:</div>
<div class="col-7 col-sm-8 col-md-9">{{ $result->user->nama_lengkap }}</div>
</div>
<div class="row pb-1">
<div class="col-4 col-sm-3 col-md-2" style="font-weight: bold;">Nim</div>
<div class="col-1" style="font-weight: bold">:</div>
<div class="col-7 col-sm-8 col-md-9">{{ $result->user->nim }}</div>
</div>
<div class="row pb-1">
<div class="col-4 col-sm-3 col-md-2" style="font-weight: bold;">Golongan</div>
<div class="col-1" style="font-weight: bold">:</div>
<div class="col-7 col-sm-8 col-md-9">{{ $result->user->kelas_user }}</div>
</div>
<div class="row pb-4">
<div class="col-4 col-sm-3 col-md-2" style="font-weight: bold;">Jurusan</div>
<div class="col-1" style="font-weight: bold">:</div>
<div class="col-7 col-sm-8 col-md-9">Teknologi Informasi</div>
</div>
<table class="table table-borderless">
<tbody>
<tr>
<td style="font-weight: bold">Tanggal Pengisian</td>
<td style="font-weight: bold">:</td>
<td>{{ $result->formatted_created_at }}</td>
</tr>
<tr>
<td style="font-weight: bold">Nama</td>
<td style="font-weight: bold">:</td>
<td>{{ $result->user->nama_lengkap }}</td>
</tr>
<tr>
<td style="font-weight: bold">Golongan</td>
<td style="font-weight: bold">:</td>
<td>{{ $result->user->kelas_user }}</td>
</tr>
<tr>
<td style="font-weight: bold">Jurusan</td>
<td style="font-weight: bold">:</td>
<td>Teknologi Informasi</td>
</tr>
</tbody>
</table>
<h5 style="font-weight: bold">Knowledge of Metacognitif(KM)</h5>
<div>
<table class="table table-bordered">

View File

@ -13,7 +13,7 @@
{{--! start fill --}}
<form action="{{ route('userQuestionnaire.store') }}" method="POST" class="needs-validation" novalidate>
<form action="{{ route('userQuestionnaire.store') }}" id="questionnaireForm" method="POST" class="needs-validation" novalidate>
@csrf
@foreach ($kuesioners as $index => $kuesioner)
<div class="mb-3 visually-hidden">
@ -62,6 +62,35 @@
<script>
$(document).ready(function() {
$("#sidebar-questionnaire").removeClass("collapsed");
const form = $("#questionnaireForm");
form.submit(function(event) {
let isValid = true;
form.find("input[type='radio']").each(function() {
const groupName = $(this).attr("name");
if (!form.find(`input[name='${groupName}']:checked`).length) {
isValid = false;
$(this).siblings(".invalid-feedback").show();
}
});
if (!isValid) {
Swal.fire({
icon: "error",
title: "Isi Semua Data",
text: "Terdapat kuesioner yang masih belum diisi",
confirmButtonColor: '#0d6efd',
confirmButtonText: 'Tutup',
});
}
});
// Hide the invalid feedback when a radio button is clicked
form.find("input[type='radio']").change(function() {
$(this).siblings(".invalid-feedback").hide();
});
});
</script>
@endsection