FIX_CLAIMS_API : RV

This commit is contained in:
VENKATESHWARAN 2025-07-15 17:01:19 +05:30
parent 27637db9a1
commit 4c95db69ea
3 changed files with 131 additions and 90 deletions

View File

@ -50,6 +50,7 @@ class TicketController extends BaseController
protected $employeeModel; protected $employeeModel;
protected $clientPolicyModel; protected $clientPolicyModel;
protected $employeePolicyModel; protected $employeePolicyModel;
protected $extraFieldsDisplayForFrontend;
public function __construct() public function __construct()
{ {
@ -128,6 +129,7 @@ class TicketController extends BaseController
'((APPROVED_DESCRIBTION))' => 'approved_description', '((APPROVED_DESCRIBTION))' => 'approved_description',
]; ];
$this->extraFields = [ $this->extraFields = [
1 => ['non_id_reason'], 1 => ['non_id_reason'],
10 => ['pay_initiate_date'], 10 => ['pay_initiate_date'],
3 => ['raised_date'], 3 => ['raised_date'],
@ -151,87 +153,124 @@ class TicketController extends BaseController
47 => ['cancel_remark'], 47 => ['cancel_remark'],
53 => ['cancel_remark'], 53 => ['cancel_remark'],
58 => ['cancel_remark'], 58 => ['cancel_remark'],
];
2 => [],
6 => [],
12 => [],
15 => [],
16 => [],
17 => [],
18 => [],
19 => [],
21 => [],
22 => [],
23 => [],
25 => [],
26 => [],
27 => [],
28 => [],
29 => [],
31 => [],
32 => [],
33 => [],
35 => [],
36 => [],
37 => [],
38 => [],
39 => [],
41 => [],
42 => [],
43 => [],
45 => [],
46 => [],
49 => [],
50 => [],
51 => [],
52 => [],
55 => [],
56 => [],
57 => [],
60 => []
];
$this->extraFieldsDisplayForFrontend = [ $this->extraFieldsDisplayForFrontend = [
1 => [ 'non_id_reason' => 'Non ID Reason' ], 1 => ['non_id_reason' => 'Non ID Reason'],
10 => [ 'pay_initiate_date' => 'Payment Initiated Date' ], 10 => ['pay_initiate_date' => 'Payment Initiated Date'],
3 => [ 'raised_date' => 'Raised Date' ], 3 => ['raised_date' => 'Raised Date'],
4 => [ 'raised_date' => 'Raised Date' ], 4 => ['raised_date' => 'Raised Date'],
5 => [ 5 => [
'claim_number' => 'Claim Number', 'claim_number' => 'Claim Number',
'registration_date' => 'Registration Date' 'registration_date' => 'Registration Date'
], ],
7 => [ 'query_received_date' => 'Query Received Date' ], 7 => ['query_received_date' => 'Query Received Date'],
8 => [ 8 => [
'denial_reason' => 'Denial Reason', 'denial_reason' => 'Denial Reason',
'denial_date' => 'Denial Date' 'denial_date' => 'Denial Date'
], ],
9 => [ 9 => [
'approved_amount' => 'Approved Amount', 'approved_amount' => 'Approved Amount',
'approved_date' => 'Approved Date', 'approved_date' => 'Approved Date',
'approved_letter' => 'Approved Letter', 'approved_letter' => 'Approved Letter',
'approved_description' => 'Approved Description' 'approved_description' => 'Approved Description'
], ],
11 => [ 11 => [
'utr_details' => 'UTR Details', 'utr_details' => 'UTR Details',
'settled_date' => 'Settled Date', 'settled_date' => 'Settled Date',
'settle_letter' => 'Settle Letter' 'settle_letter' => 'Settle Letter'
], ],
40 => [ 40 => [
'approved_amount' => 'Approved Amount', 'approved_amount' => 'Approved Amount',
'approved_date' => 'Approved Date', 'approved_date' => 'Approved Date',
'approved_letter' => 'Approved Letter', 'approved_letter' => 'Approved Letter',
'approved_description' => 'Approved Description' 'approved_description' => 'Approved Description'
], ],
44 => [ 44 => [
'utr_details' => 'UTR Details', 'utr_details' => 'UTR Details',
'settled_date' => 'Settled Date', 'settled_date' => 'Settled Date',
'settle_letter' => 'Settle Letter' 'settle_letter' => 'Settle Letter'
], ],
30 => [ 30 => [
'approved_amount' => 'Approved Amount', 'approved_amount' => 'Approved Amount',
'approved_date' => 'Approved Date', 'approved_date' => 'Approved Date',
'approved_letter' => 'Approved Letter', 'approved_letter' => 'Approved Letter',
'approved_description' => 'Approved Description' 'approved_description' => 'Approved Description'
], ],
34 => [ 34 => [
'utr_details' => 'UTR Details', 'utr_details' => 'UTR Details',
'settled_date' => 'Settled Date', 'settled_date' => 'Settled Date',
'settle_letter' => 'Settle Letter' 'settle_letter' => 'Settle Letter'
], ],
20 => [ 20 => [
'approved_amount' => 'Approved Amount', 'approved_amount' => 'Approved Amount',
'approved_date' => 'Approved Date', 'approved_date' => 'Approved Date',
'approved_letter' => 'Approved Letter', 'approved_letter' => 'Approved Letter',
'approved_description' => 'Approved Description' 'approved_description' => 'Approved Description'
], ],
24 => [ 24 => [
'utr_details' => 'UTR Details', 'utr_details' => 'UTR Details',
'settled_date' => 'Settled Date', 'settled_date' => 'Settled Date',
'settle_letter' => 'Settle Letter' 'settle_letter' => 'Settle Letter'
], ],
14 => [ 14 => [
'return_remark' => 'Return Remark', 'return_remark' => 'Return Remark',
'awb_no_courier_name' => 'AWB No Courier Name' 'awb_no_courier_name' => 'AWB No Courier Name'
], ],
48 => [ 48 => [
'return_remark' => 'Return Remark', 'return_remark' => 'Return Remark',
'awb_no_courier_name' => 'AWB No Courier Name' 'awb_no_courier_name' => 'AWB No Courier Name'
], ],
59 => [ 59 => [
'return_remark' => 'Return Remark', 'return_remark' => 'Return Remark',
'awb_no_courier_name' => 'AWB No Courier Name' 'awb_no_courier_name' => 'AWB No Courier Name'
], ],
54 => [ 54 => [
'return_remark' => 'Return Remark', 'return_remark' => 'Return Remark',
'awb_no_courier_name' => 'AWB No Courier Name' 'awb_no_courier_name' => 'AWB No Courier Name'
], ],
13 => [ 'cancel_remark' => 'Cancel Remark' ], 13 => ['cancel_remark' => 'Cancel Remark'],
47 => [ 'cancel_remark' => 'Cancel Remark' ], 47 => ['cancel_remark' => 'Cancel Remark'],
53 => [ 'cancel_remark' => 'Cancel Remark' ], 53 => ['cancel_remark' => 'Cancel Remark'],
58 => [ 'cancel_remark' => 'Cancel Remark' ] 58 => ['cancel_remark' => 'Cancel Remark']
]; ];
$this->nonIDReason = [ $this->nonIDReason = [
@ -1997,11 +2036,11 @@ class TicketController extends BaseController
} else { } else {
// If field is not an array, handle it as a single field // If field is not an array, handle it as a single field
// Check if the field exists in the ticket data // Check if the field exists in the ticket data
$data_to_send[$claim_status][$f] = ['display_name' => $displayFields[$status['old_value']][$f] ,'display_value' => isset($ticket_data[$f]) ? $ticket_data[$f] : null]; $data_to_send[$claim_status] = ['display_name' => $displayFields[$status['old_value']] ,'display_value' => isset($ticket_data) ? $ticket_data : null];
// Check if the field contains a date and format it // Check if the field contains a date and format it
if ($this->isDate($data_to_send[$claim_status][$field])) { if ($this->isDate($data_to_send[$claim_status][$field])) {
$data_to_send[$claim_status][$f] = ['display_name' => $displayFields[$status['old_value']][$f] ,'display_value' => date('d-m-Y', strtotime($data_to_send[$claim_status][$f]['display_value']))]; // $data_to_send[$claim_status] = ['display_name' => $displayFields[$status['old_value']] ,'display_value' => date('d-m-Y', strtotime($data_to_send[$claim_status]['display_value']))];
} }
// $this->myLogger->logme("error", "Data for field {$field}: " . json_encode($data_to_send[$claim_status][$field])); // $this->myLogger->logme("error", "Data for field {$field}: " . json_encode($data_to_send[$claim_status][$field]));

View File

@ -1168,7 +1168,7 @@
$("#infoIcon").click(function() { $("#infoIcon").click(function() {
var ticket_id = $('#ticket_master_id').val(); var ticket_id = $('#ticket_master_id').val();
getDataForInfo(ticket_id, function(data) { getDataForInfo(ticket_id, function(data) {
console.log("data: ", data); console.log("claims history data response : ", data);
if (data && Object.keys(data).length) { if (data && Object.keys(data).length) {
// openModal(); // openModal();
var myModal = new bootstrap.Modal(document.getElementById('moreInfoModal')); var myModal = new bootstrap.Modal(document.getElementById('moreInfoModal'));
@ -1214,7 +1214,7 @@
// Iterate over each status in the data // Iterate over each status in the data
for (let status in data) { for (let status in data) {
if (data.hasOwnProperty(status)) { if (data.hasOwnProperty(status) && status.length > 0) {
// Create the status subheading // Create the status subheading
var statusHeading = document.createElement('h5'); var statusHeading = document.createElement('h5');
statusHeading.textContent = status; statusHeading.textContent = status;
@ -1233,7 +1233,8 @@
// Create a label for the field // Create a label for the field
var fieldLabel = document.createElement('label'); var fieldLabel = document.createElement('label');
fieldLabel.textContent = field.replace(/_/g, ' ').toUpperCase(); // Convert underscores to spaces and capitalize // fieldLabel.textContent = field.replace(/_/g, ' ').toUpperCase(); // Convert underscores to spaces and capitalize
fieldLabel.textContent = field.display_name; // Convert underscores to spaces and capitalize
fieldContainer.appendChild(fieldLabel); fieldContainer.appendChild(fieldLabel);
// Create either an input field or a textarea based on the field name // Create either an input field or a textarea based on the field name
@ -1242,13 +1243,13 @@
// Create a textarea for 'approved_letter' // Create a textarea for 'approved_letter'
fieldInput = document.createElement('textarea'); fieldInput = document.createElement('textarea');
fieldInput.classList.add('form-control'); fieldInput.classList.add('form-control');
fieldInput.textContent = data[status][field]; // Set the value to the field content fieldInput.textContent = data[status][field].display_value; // Set the value to the field content
} else { } else {
// Create an input field for other fields // Create an input field for other fields
fieldInput = document.createElement('input'); fieldInput = document.createElement('input');
fieldInput.type = 'text'; fieldInput.type = 'text';
fieldInput.classList.add('form-control'); fieldInput.classList.add('form-control');
fieldInput.value = data[status][field]; fieldInput.value = data[status][field].display_value;
} }
fieldInput.setAttribute('readonly', 'readonly'); // Set field as readonly fieldInput.setAttribute('readonly', 'readonly'); // Set field as readonly

View File

@ -932,7 +932,7 @@
// Iterate over each status in the data // Iterate over each status in the data
for (let status in data) { for (let status in data) {
if (data.hasOwnProperty(status)) { if (data.hasOwnProperty(status) && status.length > 0) {
// Create the status subheading // Create the status subheading
var statusHeading = document.createElement('h5'); var statusHeading = document.createElement('h5');
statusHeading.textContent = status; statusHeading.textContent = status;
@ -951,7 +951,8 @@
// Create a label for the field // Create a label for the field
var fieldLabel = document.createElement('label'); var fieldLabel = document.createElement('label');
fieldLabel.textContent = field.replace(/_/g, ' ').toUpperCase(); // Convert underscores to spaces and capitalize // fieldLabel.textContent = field.replace(/_/g, ' ').toUpperCase(); // Convert underscores to spaces and capitalize
fieldLabel.textContent = field.display_name;
fieldContainer.appendChild(fieldLabel); fieldContainer.appendChild(fieldLabel);
// Create either an input field or a textarea based on the field name // Create either an input field or a textarea based on the field name
@ -960,13 +961,13 @@
// Create a textarea for 'approved_letter' // Create a textarea for 'approved_letter'
fieldInput = document.createElement('textarea'); fieldInput = document.createElement('textarea');
fieldInput.classList.add('form-control'); fieldInput.classList.add('form-control');
fieldInput.textContent = data[status][field]; // Set the value to the field content fieldInput.textContent = data[status][field].display_value; // Set the value to the field content
} else { } else {
// Create an input field for other fields // Create an input field for other fields
fieldInput = document.createElement('input'); fieldInput = document.createElement('input');
fieldInput.type = 'text'; fieldInput.type = 'text';
fieldInput.classList.add('form-control'); fieldInput.classList.add('form-control');
fieldInput.value = data[status][field]; fieldInput.value = data[status][field].display_value;
} }
fieldInput.setAttribute('readonly', 'readonly'); // Set field as readonly fieldInput.setAttribute('readonly', 'readonly'); // Set field as readonly