update data pembading surveyor

This commit is contained in:
majid
2024-12-03 15:00:18 +07:00
parent 9502329fef
commit 280ed97a50
15 changed files with 1185 additions and 1034 deletions

View File

@@ -585,8 +585,12 @@
</div>
</form>
</div>
<div id="loadingOverlay" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center z-50">
<div class="bg-white p-4 rounded-lg">
<div class="loader"></div>
<p class="mt-2 text-center">Sedang memproses...</p>
</div>
</div>
<!-- Modal Kamera -->
@@ -598,17 +602,16 @@
@push('scripts')
<script>
function submitFoto() {
const loadingOverlay = document.getElementById('loadingOverlay');
loadingOverlay.classList.remove('hidden');
loadingOverlay.classList.add('flex');
const formElement = $('#formFoto')[0];
const formData = new FormData(formElement);
// for (const [key, value] of formData.entries()) {
// console.log(`Key: ${key}, Value: ${value}`);
// }
// Disable the button and show the spinner
$('#saveButtonFoto').prop('disabled', true);
$('#saveButtonFotoText').hide();
$('#saveButtonSpinner').show();
$.ajax({
url: '{{ route('surveyor.storeFoto') }}',
type: 'POST',
@@ -621,12 +624,27 @@
},
success: function(response) {
if (response.success) {
// window.location.href =
// '{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=foto';
toastrSuccessBuild(response.message);
Swal.fire({
title: 'Berhasil!',
text: response.message,
icon: 'success',
confirmButtonText: 'OK'
}).then((response) => {
if (response.isConfirmed) {
window.location.href =
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
}
});
} else {
Swal.fire({
title: 'Error!',
text: response.message || 'Terjadi kesalahan',
icon: 'error',
confirmButtonText: 'OK'
});
}
console.log(response);
},
error: function(xhr, status, error) {
@@ -645,9 +663,8 @@
},
complete: function() {
// Re-enable the button and hide the spinner
$('#saveButtonFoto').prop('disabled', false);
$('#saveButtonFotoText').show();
$('#saveButtonSpinner').hide();
loadingOverlay.classList.add('hidden');
loadingOverlay.classList.remove('flex');
}
});
}
@@ -655,6 +672,28 @@
@include('lpj::surveyor.js.camera-editor')
@endpush
<style>
.loader {
border: 4px solid #f3f3f3;
border-radius: 50%;
border-top: 4px solid #3498db;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin: 0 auto;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>