diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 139b63e1..0ad9b2ab 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -50,6 +50,7 @@ class TicketController extends BaseController protected $employeeModel; protected $clientPolicyModel; protected $employeePolicyModel; + protected $extraFieldsDisplayForFrontend; public function __construct() { @@ -128,6 +129,7 @@ class TicketController extends BaseController '((APPROVED_DESCRIBTION))' => 'approved_description', ]; $this->extraFields = [ + 1 => ['non_id_reason'], 10 => ['pay_initiate_date'], 3 => ['raised_date'], @@ -151,87 +153,124 @@ class TicketController extends BaseController 47 => ['cancel_remark'], 53 => ['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 = [ - 1 => [ 'non_id_reason' => 'Non ID Reason' ], - 10 => [ 'pay_initiate_date' => 'Payment Initiated Date' ], - 3 => [ 'raised_date' => 'Raised Date' ], - 4 => [ 'raised_date' => 'Raised Date' ], - 5 => [ - 'claim_number' => 'Claim Number', - 'registration_date' => 'Registration Date' - ], - 7 => [ 'query_received_date' => 'Query Received Date' ], - 8 => [ - 'denial_reason' => 'Denial Reason', - 'denial_date' => 'Denial Date' - ], - 9 => [ - 'approved_amount' => 'Approved Amount', - 'approved_date' => 'Approved Date', - 'approved_letter' => 'Approved Letter', - 'approved_description' => 'Approved Description' - ], - 11 => [ - 'utr_details' => 'UTR Details', - 'settled_date' => 'Settled Date', - 'settle_letter' => 'Settle Letter' - ], - 40 => [ - 'approved_amount' => 'Approved Amount', - 'approved_date' => 'Approved Date', - 'approved_letter' => 'Approved Letter', - 'approved_description' => 'Approved Description' - ], - 44 => [ - 'utr_details' => 'UTR Details', - 'settled_date' => 'Settled Date', - 'settle_letter' => 'Settle Letter' - ], - 30 => [ - 'approved_amount' => 'Approved Amount', - 'approved_date' => 'Approved Date', - 'approved_letter' => 'Approved Letter', - 'approved_description' => 'Approved Description' - ], - 34 => [ - 'utr_details' => 'UTR Details', - 'settled_date' => 'Settled Date', - 'settle_letter' => 'Settle Letter' - ], - 20 => [ - 'approved_amount' => 'Approved Amount', - 'approved_date' => 'Approved Date', - 'approved_letter' => 'Approved Letter', - 'approved_description' => 'Approved Description' - ], - 24 => [ - 'utr_details' => 'UTR Details', - 'settled_date' => 'Settled Date', - 'settle_letter' => 'Settle Letter' - ], - 14 => [ - 'return_remark' => 'Return Remark', - 'awb_no_courier_name' => 'AWB No Courier Name' - ], - 48 => [ - 'return_remark' => 'Return Remark', - 'awb_no_courier_name' => 'AWB No Courier Name' - ], - 59 => [ - 'return_remark' => 'Return Remark', - 'awb_no_courier_name' => 'AWB No Courier Name' - ], - 54 => [ - 'return_remark' => 'Return Remark', - 'awb_no_courier_name' => 'AWB No Courier Name' - ], - 13 => [ 'cancel_remark' => 'Cancel Remark' ], - 47 => [ 'cancel_remark' => 'Cancel Remark' ], - 53 => [ 'cancel_remark' => 'Cancel Remark' ], - 58 => [ 'cancel_remark' => 'Cancel Remark' ] -]; + 1 => ['non_id_reason' => 'Non ID Reason'], + 10 => ['pay_initiate_date' => 'Payment Initiated Date'], + 3 => ['raised_date' => 'Raised Date'], + 4 => ['raised_date' => 'Raised Date'], + 5 => [ + 'claim_number' => 'Claim Number', + 'registration_date' => 'Registration Date' + ], + 7 => ['query_received_date' => 'Query Received Date'], + 8 => [ + 'denial_reason' => 'Denial Reason', + 'denial_date' => 'Denial Date' + ], + 9 => [ + 'approved_amount' => 'Approved Amount', + 'approved_date' => 'Approved Date', + 'approved_letter' => 'Approved Letter', + 'approved_description' => 'Approved Description' + ], + 11 => [ + 'utr_details' => 'UTR Details', + 'settled_date' => 'Settled Date', + 'settle_letter' => 'Settle Letter' + ], + 40 => [ + 'approved_amount' => 'Approved Amount', + 'approved_date' => 'Approved Date', + 'approved_letter' => 'Approved Letter', + 'approved_description' => 'Approved Description' + ], + 44 => [ + 'utr_details' => 'UTR Details', + 'settled_date' => 'Settled Date', + 'settle_letter' => 'Settle Letter' + ], + 30 => [ + 'approved_amount' => 'Approved Amount', + 'approved_date' => 'Approved Date', + 'approved_letter' => 'Approved Letter', + 'approved_description' => 'Approved Description' + ], + 34 => [ + 'utr_details' => 'UTR Details', + 'settled_date' => 'Settled Date', + 'settle_letter' => 'Settle Letter' + ], + 20 => [ + 'approved_amount' => 'Approved Amount', + 'approved_date' => 'Approved Date', + 'approved_letter' => 'Approved Letter', + 'approved_description' => 'Approved Description' + ], + 24 => [ + 'utr_details' => 'UTR Details', + 'settled_date' => 'Settled Date', + 'settle_letter' => 'Settle Letter' + ], + 14 => [ + 'return_remark' => 'Return Remark', + 'awb_no_courier_name' => 'AWB No Courier Name' + ], + 48 => [ + 'return_remark' => 'Return Remark', + 'awb_no_courier_name' => 'AWB No Courier Name' + ], + 59 => [ + 'return_remark' => 'Return Remark', + 'awb_no_courier_name' => 'AWB No Courier Name' + ], + 54 => [ + 'return_remark' => 'Return Remark', + 'awb_no_courier_name' => 'AWB No Courier Name' + ], + 13 => ['cancel_remark' => 'Cancel Remark'], + 47 => ['cancel_remark' => 'Cancel Remark'], + 53 => ['cancel_remark' => 'Cancel Remark'], + 58 => ['cancel_remark' => 'Cancel Remark'] + ]; $this->nonIDReason = [ @@ -1997,11 +2036,11 @@ class TicketController extends BaseController } else { // If field is not an array, handle it as a single field // 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 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])); diff --git a/app/Views/ticket_form_gmc.php b/app/Views/ticket_form_gmc.php index b27cd4ee..265091e2 100644 --- a/app/Views/ticket_form_gmc.php +++ b/app/Views/ticket_form_gmc.php @@ -1168,7 +1168,7 @@ $("#infoIcon").click(function() { var ticket_id = $('#ticket_master_id').val(); getDataForInfo(ticket_id, function(data) { - console.log("data: ", data); + console.log("claims history data response : ", data); if (data && Object.keys(data).length) { // openModal(); var myModal = new bootstrap.Modal(document.getElementById('moreInfoModal')); @@ -1214,7 +1214,7 @@ // Iterate over each status in the data for (let status in data) { - if (data.hasOwnProperty(status)) { + if (data.hasOwnProperty(status) && status.length > 0) { // Create the status subheading var statusHeading = document.createElement('h5'); statusHeading.textContent = status; @@ -1233,7 +1233,8 @@ // Create a label for the field 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); // Create either an input field or a textarea based on the field name @@ -1242,13 +1243,13 @@ // Create a textarea for 'approved_letter' fieldInput = document.createElement('textarea'); 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 { // Create an input field for other fields fieldInput = document.createElement('input'); fieldInput.type = 'text'; 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 diff --git a/app/Views/ticket_form_gpa.php b/app/Views/ticket_form_gpa.php index 6aa32e3f..7a28da2b 100644 --- a/app/Views/ticket_form_gpa.php +++ b/app/Views/ticket_form_gpa.php @@ -932,7 +932,7 @@ // Iterate over each status in the data for (let status in data) { - if (data.hasOwnProperty(status)) { + if (data.hasOwnProperty(status) && status.length > 0) { // Create the status subheading var statusHeading = document.createElement('h5'); statusHeading.textContent = status; @@ -951,7 +951,8 @@ // Create a label for the field 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); // Create either an input field or a textarea based on the field name @@ -960,13 +961,13 @@ // Create a textarea for 'approved_letter' fieldInput = document.createElement('textarea'); 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 { // Create an input field for other fields fieldInput = document.createElement('input'); fieldInput.type = 'text'; 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