feat(validation button): add dialog approval and reason modal

main
Kevin Hendrawan 2025-11-18 19:41:51 +07:00
parent 59fc3d18c9
commit a44a39565e
1 changed files with 61 additions and 0 deletions

View File

@ -200,6 +200,67 @@
});
});
$('#example').on('click', '.btn-circle.btn-success', function (e) {
Swal.fire({
title: 'Validasi Data Bank Sampah',
text: 'Silakan pilih tindakan untuk data bank sampah yang sedang diperiksa.',
icon: 'question',
showCancelButton: true,
showDenyButton: true,
confirmButtonText: 'Setujui Data',
denyButtonText: 'Tolak Data',
cancelButtonText: 'Batal',
buttonsStyling: false,
customClass: {
confirmButton: 'btn bg-bank-sampah-primary-500 rounded-full text-white',
denyButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300'
},
}).then((result) => {
// APPROVE
if (result.isConfirmed) {
Swal.fire({
icon: 'success',
title: 'Sukses!',
text: 'Data berhasil di setujui.',
timer: 1000,
showConfirmButton: false
});
}
// REJECT → open reason form
else if (result.isDenied) {
Swal.fire({
title: 'Alasan Penolakan',
input: 'textarea',
inputPlaceholder: 'Masukkan keterangan mengapa data ditolak...',
inputAttributes: {
'aria-label': 'Reason'
},
showCancelButton: true,
confirmButtonText: 'Ya, Tolak',
cancelButtonText: 'Batal',
buttonsStyling: false,
customClass: {
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
},
}).then((reasonResult) => {
if (reasonResult.isConfirmed) {
Swal.fire({
icon: 'success',
title: 'Sukses!',
text: 'Data berhasil di tolak.',
timer: 1000,
showConfirmButton: false
});
}
});
}
});
});
function closeModal() {
// Reset form
$('#formTambah')[0].reset();