FIX_ISSUE
This commit is contained in:
parent
16af60619c
commit
71acec9060
@ -1124,6 +1124,43 @@ class TicketController extends BaseController
|
|||||||
// $ticket_data = $this->getLastMatchedStatus($ticket_data, );
|
// $ticket_data = $this->getLastMatchedStatus($ticket_data, );
|
||||||
// print_rr($ticket_data); die;
|
// 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) {
|
if ($ticket_data) {
|
||||||
$return_value = $this->ticketMasterModel->insert($ticket_data);
|
$return_value = $this->ticketMasterModel->insert($ticket_data);
|
||||||
if ($return_value) {
|
if ($return_value) {
|
||||||
|
|||||||
@ -770,11 +770,15 @@
|
|||||||
|
|
||||||
if (response.status === true) {
|
if (response.status === true) {
|
||||||
toastr.success(response.message, 'SUCCESS');
|
toastr.success(response.message, 'SUCCESS');
|
||||||
|
window.location.href = '<?= base_url('ticket/list') ?>';
|
||||||
} else {
|
} else {
|
||||||
|
if(response.code == 409){
|
||||||
|
toastr.warning(response.message, 'WARNING');
|
||||||
|
}else{
|
||||||
toastr.error(response.message, 'ERROR');
|
toastr.error(response.message, 'ERROR');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
window.location.href = '<?= base_url('ticket/list') ?>';
|
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user