fix(surveyor/penilai): perbaikkan data pembanding dan tambah tombol freaze di penilai

This commit is contained in:
majid
2025-03-05 05:15:50 +07:00
parent ad3ef0883b
commit f1f345707a
9 changed files with 117 additions and 109 deletions

View File

@@ -194,9 +194,15 @@
if (data.status === 'survey-completed' || data.status === 'proses-laporan' || data.status === 'paparan' || data.status === 'proses-paparan' || data.status === 'paparan' || data.status == 'revisi-laporan' || data.status === 'done' || data.status === 'revisi-paparan') {
return `
<div class="flex flex-nowrap justify-center gap-1.5">
<a class="btn btn-sm btn-outline btn-info" href="penilai/${data.id}/show">
<a class="btn btn-sm btn-icon btn-clear btn-info" href="penilai/${data.id}/show">
<i class="ki-outline ki-eye"></i>
</a>
<button type="button"
class="btn btn-sm btn-icon btn-clear btn-warning"
onclick="surveyorFreeze('${data.id}', '${data.nomor_registrasi}', '${data.debiture?.name}')"
title="Freeze SLA">
<i class="ki-filled ki-arrow-circle-right"></i>
</button>
</div>`;
} else {
return `<div class="flex flex-nowrap justify-center">
@@ -221,6 +227,57 @@
</script>
<script>
function surveyorFreeze(permohonanId, noReg, debitur) {
Swal.fire({
title: 'Apakah Anda yakin?',
text: "Yakin akan Request Freeze dengan " + noReg + " untuk Debitur " + debitur +
" ?",
icon: 'warning',
input: 'textarea',
inputLabel: 'Keterangan',
inputPlaceholder: 'Masukkan keterangan...',
inputAttributes: {
'aria-label': 'Masukkan keterangan'
},
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ya, Lanjutkan!',
cancelButtonText: 'Batal',
}).then((result) => {
if (result.isConfirmed) {
const userMessage = result.value || ''; // Ambil pesan dari textarea
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
},
});
$.ajax({
url: `/surveyor/storeFreeze/${permohonanId}`,
type: 'POST',
data: {
message: userMessage
},
success: (response) => {
Swal.fire('Berhasil!',
response.message,
'success').then(() => {
window.location.reload();
});
console.log(response);
},
error: (error) => {
console.error('Error:', error);
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan Freeze.',
'error');
}
});
}
});
}
function showLoadingSwal(message, duration = 5000) {
Swal.fire({
title: message,