|
|
@ -752,68 +752,6 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function submitRdoDecision(status) { |
|
|
|
|
|
|
|
|
|
|
|
let date = ($("#date").val() || "").trim(); |
|
|
|
|
|
let = $("#detailsModal").data("refid"); |
|
|
|
|
|
let approvedBy = $("#userName").val(); // 🔥 FROM HIDDEN INPUT |
|
|
|
|
|
|
|
|
|
|
|
if (!remarks) { |
|
|
|
|
|
Swal.fire({ |
|
|
|
|
|
icon: 'warning', |
|
|
|
|
|
title: 'Remarks Required', |
|
|
|
|
|
text: 'Please enter remarks before submitting' |
|
|
|
|
|
}); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Swal.fire({ |
|
|
|
|
|
title: `Are you sure?`, |
|
|
|
|
|
text: `You want to ${status.toLowerCase()} this request`, |
|
|
|
|
|
icon: status === 'APPROVED' ? 'success' : 'error', |
|
|
|
|
|
showCancelButton: true, |
|
|
|
|
|
confirmButtonColor: status === 'APPROVED' ? '#28a745' : '#dc3545', |
|
|
|
|
|
cancelButtonColor: '#6c757d', |
|
|
|
|
|
confirmButtonText: `Yes, ${status}` |
|
|
|
|
|
}).then((result) => { |
|
|
|
|
|
|
|
|
|
|
|
if (!result.isConfirmed) return; |
|
|
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
|
|
url: "/gcc/api/flagpoleregistration/rdo/updateDecision", |
|
|
|
|
|
type: "POST", |
|
|
|
|
|
data: { |
|
|
|
|
|
refid: refid, |
|
|
|
|
|
status: status, |
|
|
|
|
|
remarks: remarks, |
|
|
|
|
|
approvedBy: approvedBy // 🔥 PASS TO BACKEND |
|
|
|
|
|
}, |
|
|
|
|
|
success: function (res) { |
|
|
|
|
|
|
|
|
|
|
|
Swal.fire({ |
|
|
|
|
|
icon: 'success', |
|
|
|
|
|
title: status === 'APPROVED' ? 'Approved!' : 'Rejected!', |
|
|
|
|
|
text: res.message || `Request has been ${status.toLowerCase()}`, |
|
|
|
|
|
timer: 2000, |
|
|
|
|
|
showConfirmButton: false |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$("#detailsModal").modal("hide"); |
|
|
|
|
|
$("#QaqcDatatable").DataTable().ajax.reload(null, false); |
|
|
|
|
|
}, |
|
|
|
|
|
error: function () { |
|
|
|
|
|
Swal.fire({ |
|
|
|
|
|
icon: 'error', |
|
|
|
|
|
title: 'Error', |
|
|
|
|
|
text: 'Failed to update decision' |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script> |
|
|
</script> |
|
|
</body> |
|
|
</body> |
|
|
|
|
|
|