update form inspeksi and basic data inspeksi
This commit is contained in:
@@ -4,25 +4,12 @@
|
||||
{{ Breadcrumbs::render(request()->route()->getName()) }}
|
||||
@endsection
|
||||
|
||||
@push('styles')
|
||||
<style>
|
||||
.modal {
|
||||
width: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
|
||||
|
||||
@section('content')
|
||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||
@include('lpj::component.detail-jaminan',['backLink' => 'penilaian.index'])
|
||||
@include('lpj::component.detail-jaminan', ['backLink' => 'penilaian.index'])
|
||||
|
||||
<div class="card pb-2.5">
|
||||
<div class="card-header" id="basic_settings">
|
||||
@@ -33,9 +20,7 @@
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form
|
||||
action="{{ isset($penilaian->nomor_registrasi) ? route('penilaian.update', $permohonan) : route('penilaian.store') }}"
|
||||
method="POST" class="">
|
||||
<form id="form-assignment" class="">
|
||||
@if (isset($penilaian->nomor_registrasi))
|
||||
@method('PUT')
|
||||
@endif
|
||||
@@ -86,10 +71,8 @@
|
||||
<option value="berbeda">Berbeda</option>
|
||||
</select>
|
||||
</div>
|
||||
<em id="error-surveyor_selection" class="alert text-danger text-sm"></em>
|
||||
|
||||
@error('surveyor_selection')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -108,9 +91,9 @@
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@error('penilai_surveyor_id')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
|
||||
<em id="error-penilai_surveyor_id" class="alert text-danger text-sm"></em>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -141,9 +124,9 @@
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
@error('surveyor_id')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
|
||||
<em id="error-surveyor_id" class="alert text-danger text-sm"></em>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@elseif($penilaianTeam->isEmpty())
|
||||
@@ -166,9 +149,9 @@
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
@error('surveyor_id')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
|
||||
<em id="error-surveyor_id" class="alert text-danger text-sm"></em>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@@ -192,9 +175,9 @@
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
@error('surveyor_region_id')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
|
||||
<em id="error-surveyor_region_id" class="alert text-danger text-sm"></em>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -220,9 +203,7 @@
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
@error('penilai_id')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
<em id="error-penilai_id" class="alert text-danger text-sm"></em>
|
||||
</div>
|
||||
</div>
|
||||
@elseif($penilaianTeam->isEmpty())
|
||||
@@ -244,9 +225,7 @@
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
@error('penilai_id')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
<em id="error-penilai_id" class="alert text-danger text-sm"></em>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@@ -268,9 +247,7 @@
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
@error('penilai_region_id')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
<em id="error-penilai_region_id" class="alert text-danger text-sm"></em>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -285,9 +262,8 @@
|
||||
<input class="input @error('tanggal_kunjungan') border-danger bg-danger-light @enderror"
|
||||
type="datetime-local" name="tanggal_kunjungan"
|
||||
value="{{ isset($penilaian->tanggal_kunjungan) ? \Carbon\Carbon::createFromTimestamp($penilaian->tanggal_kunjungan)->format('Y-m-d\TH:i') : '' }}">
|
||||
@error('tanggal_kunjungan')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
|
||||
<em id="error-tanggal_kunjungan" class="alert text-danger text-sm"></em>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -300,13 +276,13 @@
|
||||
<textarea class="textarea @error('keterangan') border-danger bg-danger-light @enderror" rows="3"
|
||||
type="text" name="keterangan">{{ $penilaian->keterangan ?? '' }}</textarea>
|
||||
</div>
|
||||
@error('keterangan')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
|
||||
<em id="error-keterangan" class="alert text-danger text-sm"></em>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-end card-footer mt-2">
|
||||
<button type="submit" class="btn btn-success">
|
||||
<button type="button" onclick="submitAssignment()" class="btn btn-success">
|
||||
Aprove
|
||||
</button>
|
||||
|
||||
@@ -321,8 +297,8 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade" data-modal="true" id="modal_revisi" data-backdrop="static" data-keyboard="false">
|
||||
<div class="modal-content">
|
||||
<div class="modal" data-modal="true" id="modal_revisi"">
|
||||
<div class="modal-content max-w-[600px] top-[10%]">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">Revisi</h3>
|
||||
<button class="btn btn-xs btn-icon btn-light" data-modal-dismiss="true">
|
||||
@@ -368,13 +344,15 @@
|
||||
<div class="modal-footer justify-end mt-2">
|
||||
<div class="flex gap-4">
|
||||
<button type="button" class="btn btn-light" data-modal-dismiss="true">Cancel</button>
|
||||
<button id="btnSubmit" type="submit" class="btn btn-primary" data-modal-dismiss="true">Submit</button>
|
||||
<button id="btnSubmit" type="submit" class="btn btn-primary"
|
||||
data-modal-dismiss="true">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
@push('scripts')
|
||||
<script>
|
||||
@@ -462,10 +440,57 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function submitAssignment() {
|
||||
const formElement = $('#form-assignment')[0];
|
||||
const formData = new FormData(formElement);
|
||||
|
||||
|
||||
const urlAssignment =
|
||||
"{{ isset($penilaian->nomor_registrasi) ? route('penilaian.update', $permohonan) : route('penilaian.store') }}";
|
||||
|
||||
$.ajax({
|
||||
url: urlAssignment,
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
window.location.href =
|
||||
'{{ route('penilaian.index') }}';
|
||||
} else {
|
||||
|
||||
showErrorMessages(response.errors);
|
||||
}
|
||||
console.log(response);
|
||||
},
|
||||
error: function(xhr) {
|
||||
// Handle errors from the server
|
||||
showErrorMessages(xhr.responseJSON?.errors);
|
||||
console.error('Error occurred:', xhr.statusText);
|
||||
console.log('Response:', xhr.responseText);
|
||||
},
|
||||
complete: function() {
|
||||
// Re-enable the button and hide the spinner
|
||||
$('#saveButton').prop('disabled', false);
|
||||
$('#saveButtonText').show();
|
||||
$('#saveButtonSpinner').hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showErrorMessages(errors) {
|
||||
$('.alert').text('');
|
||||
if (errors) {
|
||||
$.each(errors, function(key, value) {
|
||||
$(`#error-${key}`).text(value[0]);
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
Reference in New Issue
Block a user