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_data = $this->request->getPost();
|
||||
$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();
|
||||
$ticket_data['claim_status_id'] = $this->getLastMatchedStatus($ticket_data, $old_ticket_data);
|
||||
// print_rr($ticket_data); die;
|
||||
|
||||
|
||||
if ($ticket_data) {
|
||||
$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'])) {
|
||||
return null;
|
||||
@ -1696,37 +1697,40 @@ class TicketController extends BaseController
|
||||
// Use the provided `extra_fields_array_for_validate` from the incoming data
|
||||
$statusMapping = json_decode($incoming_form_values['extra_fields_array_for_validate']);
|
||||
|
||||
foreach ($statusMapping as $status => $requiredFields) {
|
||||
if($incoming_form_values['claim_status_id'] != $old_ticket_data['claim_status_id']){
|
||||
foreach ($statusMapping as $status => $requiredFields) {
|
||||
|
||||
// Ensure requiredFields is an array
|
||||
if (!is_array($requiredFields)) {
|
||||
$requiredFields = [$requiredFields];
|
||||
if(!empty($requiredFields) && $status != $old_ticket_data['claim_status_id']){
|
||||
// Ensure requiredFields is an array
|
||||
if (!is_array($requiredFields)) {
|
||||
$requiredFields = [$requiredFields];
|
||||
}
|
||||
|
||||
// Check if all required fields exist and are not empty in the incoming form values
|
||||
$allFieldsMatched = true;
|
||||
foreach ($requiredFields as $field) {
|
||||
|
||||
}
|
||||
|
||||
// Check if all required fields exist and are not empty in the incoming form values
|
||||
$allFieldsMatched = true;
|
||||
foreach ($requiredFields as $field) {
|
||||
if(in_array($field, ['approved_description'])){
|
||||
continue;
|
||||
}
|
||||
|
||||
if(in_array($field, ['approved_description'])){
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($incoming_form_values[$field]) || empty($incoming_form_values[$field])) {
|
||||
$allFieldsMatched = false;
|
||||
break;
|
||||
if (!isset($incoming_form_values[$field]) || empty($incoming_form_values[$field])) {
|
||||
$allFieldsMatched = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Update the last matched status if all fields are validated
|
||||
if ($allFieldsMatched) {
|
||||
$lastMatchedStatus = $status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update the last matched status if all fields are validated
|
||||
if ($allFieldsMatched) {
|
||||
$lastMatchedStatus = $status;
|
||||
}
|
||||
}
|
||||
|
||||
if($lastMatchedStatus == 1){
|
||||
if(!empty($incoming_form_values['tpa_no'])){
|
||||
$lastMatchedStatus = 2;
|
||||
if($lastMatchedStatus == 1){
|
||||
if(!empty($incoming_form_values['tpa_no'])){
|
||||
$lastMatchedStatus = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1214,7 +1214,11 @@
|
||||
|
||||
// Iterate over each status in the 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
|
||||
var statusHeading = document.createElement('h5');
|
||||
statusHeading.textContent = status;
|
||||
|
||||
@ -932,7 +932,15 @@
|
||||
|
||||
// Iterate over each status in the 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
|
||||
var statusHeading = document.createElement('h5');
|
||||
statusHeading.textContent = status;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user