FIX_CLAIMS_HISTORY : RV
This commit is contained in:
parent
557a254ead
commit
a6884e85cd
@ -904,9 +904,10 @@ class TicketController extends BaseController
|
|||||||
$ticket_id = $this->request->getPost('ticket_master_id');
|
$ticket_id = $this->request->getPost('ticket_master_id');
|
||||||
$ticket_data = $this->request->getPost();
|
$ticket_data = $this->request->getPost();
|
||||||
$ticket_data = $this->formatDateForClaim($ticket_data);
|
$ticket_data = $this->formatDateForClaim($ticket_data);
|
||||||
$ticket_data['claim_status_id'] = $this->getLastMatchedStatus($ticket_data);
|
|
||||||
// print_rr($ticket_data); die;
|
|
||||||
$old_ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first();
|
$old_ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first();
|
||||||
|
$ticket_data['claim_status_id'] = $this->getLastMatchedStatus($ticket_data, $old_ticket_data);
|
||||||
|
// print_rr($ticket_data); die;
|
||||||
|
|
||||||
|
|
||||||
if ($ticket_data) {
|
if ($ticket_data) {
|
||||||
$return_value = $this->ticketMasterModel->where('id', $ticket_id)->set($ticket_data)->update();
|
$return_value = $this->ticketMasterModel->where('id', $ticket_id)->set($ticket_data)->update();
|
||||||
@ -1685,7 +1686,7 @@ class TicketController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLastMatchedStatus($incoming_form_values)
|
public function getLastMatchedStatus($incoming_form_values, $old_ticket_data)
|
||||||
{
|
{
|
||||||
if (empty($incoming_form_values) || !isset($incoming_form_values['claim_status_id']) || !isset($incoming_form_values['extra_fields_array_for_validate'])) {
|
if (empty($incoming_form_values) || !isset($incoming_form_values['claim_status_id']) || !isset($incoming_form_values['extra_fields_array_for_validate'])) {
|
||||||
return null;
|
return null;
|
||||||
@ -1696,12 +1697,13 @@ class TicketController extends BaseController
|
|||||||
// Use the provided `extra_fields_array_for_validate` from the incoming data
|
// Use the provided `extra_fields_array_for_validate` from the incoming data
|
||||||
$statusMapping = json_decode($incoming_form_values['extra_fields_array_for_validate']);
|
$statusMapping = json_decode($incoming_form_values['extra_fields_array_for_validate']);
|
||||||
|
|
||||||
|
if($incoming_form_values['claim_status_id'] != $old_ticket_data['claim_status_id']){
|
||||||
foreach ($statusMapping as $status => $requiredFields) {
|
foreach ($statusMapping as $status => $requiredFields) {
|
||||||
|
|
||||||
|
if(!empty($requiredFields) && $status != $old_ticket_data['claim_status_id']){
|
||||||
// Ensure requiredFields is an array
|
// Ensure requiredFields is an array
|
||||||
if (!is_array($requiredFields)) {
|
if (!is_array($requiredFields)) {
|
||||||
$requiredFields = [$requiredFields];
|
$requiredFields = [$requiredFields];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if all required fields exist and are not empty in the incoming form values
|
// Check if all required fields exist and are not empty in the incoming form values
|
||||||
@ -1723,12 +1725,14 @@ class TicketController extends BaseController
|
|||||||
$lastMatchedStatus = $status;
|
$lastMatchedStatus = $status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($lastMatchedStatus == 1){
|
if($lastMatchedStatus == 1){
|
||||||
if(!empty($incoming_form_values['tpa_no'])){
|
if(!empty($incoming_form_values['tpa_no'])){
|
||||||
$lastMatchedStatus = 2;
|
$lastMatchedStatus = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $lastMatchedStatus;
|
return $lastMatchedStatus;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1214,7 +1214,11 @@
|
|||||||
|
|
||||||
// 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) && status.length > 0) {
|
|
||||||
|
let length = Object.keys(data[status]).length;
|
||||||
|
console.log('length', length);
|
||||||
|
|
||||||
|
if (data.hasOwnProperty(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;
|
||||||
|
|||||||
@ -932,7 +932,15 @@
|
|||||||
|
|
||||||
// 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) && status.length > 0) {
|
console.log('status', status)
|
||||||
|
console.log('data[status]', data[status])
|
||||||
|
console.log('data[status].length', data[status].length)
|
||||||
|
|
||||||
|
let length = Object.keys(data[status]).length;
|
||||||
|
console.log('length', length);
|
||||||
|
|
||||||
|
|
||||||
|
if (data.hasOwnProperty(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;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user