FIX_ISSUE

This commit is contained in:
VENKATESHWARAN 2026-01-06 10:52:13 +05:30
parent 16af60619c
commit 71acec9060
2 changed files with 43 additions and 2 deletions

View File

@ -1124,6 +1124,43 @@ class TicketController extends BaseController
// $ticket_data = $this->getLastMatchedStatus($ticket_data, );
// print_rr($ticket_data); die;
$isduplicate = checkDuplicateClaim([
'doa' => change_date_format($ticket_data['doa'] ?? '') ?? null,
'emp_code' => $ticket_data['emp_code'] ?? null,
'claim_amount' => $ticket_data['claim_amount'] ?? null,
'policy_no' => $ticket_data['policy_no'] ?? null
]);
if ($isduplicate) {
$errorDetails = [];
if (!empty($ticket_data['doa'])) {
$errorDetails[] = 'DOA: ' . change_date_format($ticket_data['doa']);
}
if (!empty($ticket_data['claim_amount'])) {
$errorDetails[] = 'Claim Amount: ₹' . number_format($ticket_data['claim_amount'], 2);
}
if (!empty($ticket_data['emp_code'])) {
$errorDetails[] = 'Emp Code: ' . $ticket_data['emp_code'];
}
if (!empty($ticket_data['policy_no'])) {
$errorDetails[] = 'Policy No: ' . $ticket_data['policy_no'];
}
$response = [
'status' => false,
'code' => 409,
'message' => 'Duplicate claim found for ' . implode(', ', $errorDetails)
];
return $this->respond($response, 200);
}
if ($ticket_data) {
$return_value = $this->ticketMasterModel->insert($ticket_data);
if ($return_value) {

View File

@ -770,11 +770,15 @@
if (response.status === true) {
toastr.success(response.message, 'SUCCESS');
window.location.href = '<?= base_url('ticket/list') ?>';
} else {
toastr.error(response.message, 'ERROR');
if(response.code == 409){
toastr.warning(response.message, 'WARNING');
}else{
toastr.error(response.message, 'ERROR');
}
}
window.location.href = '<?= base_url('ticket/list') ?>';
},
error: function(xhr, status, error) {
console.error(xhr.responseText);