@@ -348,63 +349,71 @@
Catatan Reject: ${rejectedNote}
- ` : ''} +Catatan Reject: ${rejectedNote}
+ ` : ''} `, - 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 - }; - - $.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 + }; + + $.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)