fix(pemohon/survey): penambahan resedule di awal pemohon dan resedule suveyor, dan perbaikkan tolak paparan, dan perbaikkan struktur foto
This commit is contained in:
@@ -206,24 +206,32 @@
|
||||
|
||||
if (data.status === 'proses-survey' || data.status == 'rejected-reschedule') {
|
||||
actionHtml += `
|
||||
<a
|
||||
title="Reschedule Jadwal Survey"
|
||||
data-permohonan-id="${data.id}"
|
||||
data-id-penilaian="${data.penilaian.id}"
|
||||
data-no-reg="${data.nomor_registrasi}"
|
||||
data-debitur="${data.debiture ? data.debiture.name.replace(/'/g, "\\'") : ""}"
|
||||
data-waktu-penilaian="${data.penilaian.waktu_penilaian}"
|
||||
data-rejected-note="${data.penilaian.rejected_note ? JSON.stringify(data.penilaian.rejected_note).replace(/'/g, "\\'").replace(/"/g, '"') : '{}'}"
|
||||
onclick="surveyorRescheduleJadwalSurvey(this)"
|
||||
class="delete btn btn-sm btn-outline btn-light">
|
||||
<i class="ki-filled ki-calendar-remove"></i>
|
||||
</a>`;
|
||||
<a
|
||||
title="Reschedule Jadwal Survey"
|
||||
data-permohonan-id="${data.id}"
|
||||
data-id-penilaian="${data.penilaian.id}"
|
||||
data-no-reg="${data.nomor_registrasi}"
|
||||
data-debitur="${data.debiture ? data.debiture.name.replace(/'/g, "\\'") : ""}"
|
||||
data-waktu-penilaian="${data.penilaian.waktu_penilaian}"
|
||||
data-rejected-note="${data.penilaian.rejected_note ? JSON.stringify(data.penilaian.rejected_note).replace(/'/g, "\\'").replace(/"/g, '"') : '{}'}"
|
||||
onclick="surveyorRescheduleJadwalSurvey(this)"
|
||||
class="delete btn btn-sm btn-outline btn-light">
|
||||
<i class="ki-filled ki-calendar-remove"></i>
|
||||
</a>`;
|
||||
}
|
||||
|
||||
if (data && data.penilaian && data.penilaian.waktu_penilaian !== null && data.status !==
|
||||
'done' && data.penilaian.authorized_status == null || data.status === 'approved-reschedule') {
|
||||
'done' && data.penilaian.authorized_status == null || data.status ===
|
||||
'approved-reschedule') {
|
||||
actionHtml += `
|
||||
<a class="btn btn-sm btn-outline btn-primary" href="javascript:void(0)" onclick="surveyorApproveKunjungan(${data.id},${data.penilaian.id},'${data.nomor_registrasi}', '${data.debiture?.name}', '${data.penilaian.waktu_penilaian}')" title="Approve Jadwal Kunjungan No Reg ${data.nomor_registrasi}" >
|
||||
<a class="btn btn-sm btn-outline btn-primary"
|
||||
title="Approve Jadwal Kunjungan No Reg ${data.nomor_registrasi}"
|
||||
data-permohonan-id="${data.id}"
|
||||
data-id-penilaian="${data.penilaian.id}"
|
||||
data-no-reg="${data.nomor_registrasi}"
|
||||
data-debitur="${data.debiture ? data.debiture.name.replace(/'/g, "\\'") : ""}"
|
||||
data-waktu-penilaian="${data.penilaian.waktu_penilaian}"
|
||||
onclick="surveyorApproveKunjungan(this)" >
|
||||
<i class="ki-filled ki-calendar-edit"></i>
|
||||
</a>
|
||||
`;
|
||||
@@ -267,16 +275,26 @@
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
function surveyorApproveKunjungan(permohonanId, idPenilaian, noReg, debitur, waktuPenilaian) {
|
||||
function surveyorApproveKunjungan(element) {
|
||||
const permohonanId = element.getAttribute('data-permohonan-id');
|
||||
const idPenilaian = element.getAttribute('data-id-penilaian');
|
||||
const noReg = element.getAttribute('data-no-reg');
|
||||
const debitur = element.getAttribute('data-debitur');
|
||||
const waktuPenilaian = element.getAttribute('data-waktu-penilaian');
|
||||
|
||||
Swal.fire({
|
||||
title: ' ',
|
||||
text: "Yakin akan Menyetujui Jadwal Kunjungan " + noReg + " untuk Debitur " + debitur +
|
||||
" pada waktu " + window.formatTanggalWaktuIndonesia(waktuPenilaian) + "?",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Yes',
|
||||
cancelButtonText: 'Cancel',
|
||||
showDenyButton: true,
|
||||
denyButtonText: 'Reschedule',
|
||||
confirmButtonColor: '#3085d6',
|
||||
denyButtonColor: '#f4b400',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
//define variable
|
||||
@@ -314,6 +332,94 @@
|
||||
|
||||
}
|
||||
});
|
||||
} else if (result.isDenied) {
|
||||
Swal.fire({
|
||||
title: 'Reschedule Jadwal Kunjungan',
|
||||
html: `
|
||||
<div class="text-left space-y-4">
|
||||
|
||||
<p class="text-gray-700">
|
||||
Yakin akan Reschedule Jadwal Kunjungan
|
||||
<span class="font-semibold text-blue-600">${noReg}</span>
|
||||
untuk Debitur
|
||||
<span class="font-semibold text-blue-600">${debitur}</span>
|
||||
pada waktu
|
||||
<span class="font-semibold">${window.formatTanggalWaktuIndonesia(waktuPenilaian)}</span>?
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<label for="reschedule_date" class="block text-sm font-medium text-gray-700 mb-1">Tanggal Baru</label>
|
||||
<input type="datetime-local" id="reschedule_date"
|
||||
class="block w-full px-4 py-2 border border-gray-300 rounded-lg shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="reschedule_note" class="block text-sm font-medium text-gray-700 mb-1">Catatan</label>
|
||||
<textarea id="reschedule_note"
|
||||
class="block w-full px-4 py-2 border border-gray-300 rounded-lg shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm"
|
||||
placeholder="Masukkan alasan reschedule..."></textarea>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
`,
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Reschedule',
|
||||
cancelButtonText: 'Batal',
|
||||
preConfirm: () => {
|
||||
const rescheduleDate = document.getElementById('reschedule_date').value;
|
||||
const rescheduleNote = document.getElementById('reschedule_note').value;
|
||||
|
||||
if (!rescheduleDate || !rescheduleNote) {
|
||||
Swal.showValidationMessage('Semua input wajib diisi!');
|
||||
return false;
|
||||
}
|
||||
|
||||
return {
|
||||
rescheduleDate,
|
||||
rescheduleNote
|
||||
};
|
||||
}
|
||||
}).then((rescheduleResult) => {
|
||||
if (rescheduleResult.isConfirmed) {
|
||||
const {
|
||||
rescheduleDate,
|
||||
rescheduleNote
|
||||
} = rescheduleResult.value;
|
||||
|
||||
const data = {
|
||||
_token: "{{ csrf_token() }}",
|
||||
penilaian_id: idPenilaian,
|
||||
nomor_registrasi: noReg,
|
||||
permohonan_id: permohonanId,
|
||||
reschedule_date: rescheduleDate,
|
||||
reschedule_note: rescheduleNote,
|
||||
keterangan: rescheduleNote
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: `{{ URL::to('/permohonan/store-reschedule-survey') }}/${idPenilaian}`,
|
||||
type: "PUT",
|
||||
cache: false,
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
if (response.status === 'success') {
|
||||
Swal.fire('Sukses Reschedule!', response.message,
|
||||
'success').then(() => {
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
Swal.fire('Error!', response.message, 'error');
|
||||
}
|
||||
},
|
||||
error: function(response) {
|
||||
console.log(response);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
@@ -333,11 +439,12 @@
|
||||
console.warn('Failed to parse rejectedNote:', e);
|
||||
rejectedNote = null;
|
||||
}
|
||||
const note = rejectedNote && typeof rejectedNote === 'string' && rejectedNote.trim() ? String(rejectedNote).trim() : '';
|
||||
const note = rejectedNote && typeof rejectedNote === 'string' && rejectedNote.trim() ? String(rejectedNote)
|
||||
.trim() : '';
|
||||
|
||||
Swal.fire({
|
||||
title: 'Reschedule Jadwal Kunjungan',
|
||||
html: `
|
||||
Swal.fire({
|
||||
title: 'Reschedule Jadwal Kunjungan',
|
||||
html: `
|
||||
<div class="text-left space-y-4">
|
||||
|
||||
<p class="text-gray-700">
|
||||
@@ -362,65 +469,73 @@
|
||||
placeholder="Masukkan alasan reschedule..."></textarea>
|
||||
</div>
|
||||
${note ? `
|
||||
<p class="text-gray-700"><strong>Catatan Reject:</strong> ${note}</p>
|
||||
` : ''}
|
||||
<p class="text-gray-700"><strong>Catatan Reject:</strong> ${note}</p>
|
||||
` : ''}
|
||||
|
||||
</div>
|
||||
`,
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Reschedule',
|
||||
preConfirm: () => {
|
||||
const rescheduleDate = document.getElementById('reschedule_date').value;
|
||||
const rescheduleNote = document.getElementById('reschedule_note').value;
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Reschedule',
|
||||
preConfirm: () => {
|
||||
const rescheduleDate = document.getElementById('reschedule_date').value;
|
||||
const rescheduleNote = document.getElementById('reschedule_note').value;
|
||||
|
||||
if (!rescheduleDate || !rescheduleNote) {
|
||||
Swal.showValidationMessage('Semua inputan wajib diisi!');
|
||||
return false;
|
||||
}
|
||||
|
||||
return { rescheduleDate, rescheduleNote };
|
||||
}
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
const { rescheduleDate, rescheduleNote } = result.value;
|
||||
|
||||
// Data to send
|
||||
const data = {
|
||||
_token: "{{ csrf_token() }}",
|
||||
penilaian_id: idPenilaian,
|
||||
nomor_registrasi: noReg,
|
||||
permohonan_id: permohonanId,
|
||||
reschedule_date: rescheduleDate,
|
||||
reschedule_note: rescheduleNote,
|
||||
keterangan: rescheduleNote
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: `{{ URL::to('/permohonan/store-reschedule-survey') }}/${idPenilaian}`,
|
||||
type: "PUT",
|
||||
cache: false,
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
if (response.status === 'success') {
|
||||
Swal.fire('Sukses Reschedule!', response.message, 'success').then(() => {
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
Swal.fire('Error!', response.message, 'error');
|
||||
if (!rescheduleDate || !rescheduleNote) {
|
||||
Swal.showValidationMessage('Semua inputan wajib diisi!');
|
||||
return false;
|
||||
}
|
||||
},
|
||||
error: function(response) {
|
||||
const errorMessage = response.responseJSON?.message || 'Terjadi kesalahan saat memproses data.';
|
||||
Swal.fire('Error!', errorMessage, 'error');
|
||||
|
||||
return {
|
||||
rescheduleDate,
|
||||
rescheduleNote
|
||||
};
|
||||
}
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
const {
|
||||
rescheduleDate,
|
||||
rescheduleNote
|
||||
} = result.value;
|
||||
|
||||
// Data to send
|
||||
const data = {
|
||||
_token: "{{ csrf_token() }}",
|
||||
penilaian_id: idPenilaian,
|
||||
nomor_registrasi: noReg,
|
||||
permohonan_id: permohonanId,
|
||||
reschedule_date: rescheduleDate,
|
||||
reschedule_note: rescheduleNote,
|
||||
keterangan: rescheduleNote
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: `{{ URL::to('/permohonan/store-reschedule-survey') }}/${idPenilaian}`,
|
||||
type: "PUT",
|
||||
cache: false,
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
if (response.status === 'success') {
|
||||
Swal.fire('Sukses Reschedule!', response.message, 'success').then(
|
||||
() => {
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
Swal.fire('Error!', response.message, 'error');
|
||||
}
|
||||
},
|
||||
error: function(response) {
|
||||
const errorMessage = response.responseJSON?.message ||
|
||||
'Terjadi kesalahan saat memproses data.';
|
||||
Swal.fire('Error!', errorMessage, 'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// window.formatTanggalIndonesia(date)
|
||||
|
||||
Reference in New Issue
Block a user