diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index ed26bc95..5b091387 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -5680,8 +5680,8 @@ class ClientController extends AdminController $EmployeeMultiEventServiceController = new EmployeeMultiEventServiceController(); // $res = $EmployeeMultiEventServiceController->constructMultiEventData(['file_id' => '1069']); - // $res = $EmployeeMultiEventServiceController->excelMultieventFileFormateValidation(['file_id' => '1084']); - // $res = $EmployeeMultiEventServiceController->excelMultieventFileDataValidation(['file_id' => '1069']); + // $res = $EmployeeMultiEventServiceController->excelMultieventFileFormateValidation(['file_id' => '2373']); + // $res = $EmployeeMultiEventServiceController->excelMultieventFileDataValidation(['file_id' => '2373']); // $res = $EmployeeMultiEventServiceController->excelMultieventFileOnBoard(['file_id' => '1069']); // dd($res); diff --git a/app/Controllers/EmployeeMultiEventServiceController.php b/app/Controllers/EmployeeMultiEventServiceController.php index 78216f37..782a189b 100644 --- a/app/Controllers/EmployeeMultiEventServiceController.php +++ b/app/Controllers/EmployeeMultiEventServiceController.php @@ -1015,6 +1015,7 @@ class EmployeeMultiEventServiceController extends BaseController public function excelMultieventFileFormateValidation($params) { + $this->myLogger->logme('error', 'Excel Multievent File Formate Validation function START: ' . json_encode(['params' => $params])); helper('excel_util_helper'); $file_id = $params['file_id']; $file = $this->fileModel->find($file_id); @@ -1092,51 +1093,59 @@ class EmployeeMultiEventServiceController extends BaseController $params["action"] = "inception"; $params["file_path"] = $file_paths['inception']; $error[] = $this->excelFileFormatValidation($params); + $this->myLogger->logme('error', 'Inception file formate validation result: ' . json_encode(['params' => $params])); if (isset($error['error_data']) && count($error['error_data']) == 0) { $error[] = $this->compareMemberDataAndInceptionData($params); + $this->myLogger->logme('error', 'compare Member Data And Inception Data file validation result: ' . json_encode(['params' => $params])); } } //addition if(isset($file_paths['addition']) && $file_paths['addition'] != "" && $file_paths['addition'] != null){ - $params["action"] = "addition"; - $params["file_path"] = $file_paths['addition']; - $error[] = $this->excelFileFormatValidation($params); + $params["action"] = "addition"; + $params["file_path"] = $file_paths['addition']; + $error[] = $this->excelFileFormatValidation($params); + $this->myLogger->logme('error', 'Addition file formate validation result: ' . json_encode(['params' => $params])); } //dependent_addition if(isset($file_paths['dependent_addition']) && $file_paths['dependent_addition'] != "" && $file_paths['dependent_addition'] != null){ - $params["action"] = "dependent_addition"; - $params["file_path"] = $file_paths['dependent_addition']; - $error[] = $this->excelFileFormatValidation($params); + $params["action"] = "dependent_addition"; + $params["file_path"] = $file_paths['dependent_addition']; + $error[] = $this->excelFileFormatValidation($params); + $this->myLogger->logme('error', 'Dependent Addition file formate validation result: ' . json_encode(['params' => $params])); } //deletion if(isset($file_paths['deletion']) && $file_paths['deletion'] != "" && $file_paths['deletion'] != null){ - $params["action"] = "deletion"; - $params["file_path"] = $file_paths['deletion']; - $error[] = $this->excelFileFormatValidation($params); + $params["action"] = "deletion"; + $params["file_path"] = $file_paths['deletion']; + $error[] = $this->excelFileFormatValidation($params); + $this->myLogger->logme('error', 'Deletion file formate validation result: ' . json_encode(['params' => $params])); } //correction if(isset($file_paths['correction']) && $file_paths['correction'] != "" && $file_paths['correction'] != null){ - $params["action"] = "correction"; - $params["file_path"] = $file_paths['correction']; - $error[] = $this->excelFileFormatValidation($params); + $params["action"] = "correction"; + $params["file_path"] = $file_paths['correction']; + $error[] = $this->excelFileFormatValidation($params); + $this->myLogger->logme('error', 'Correction file formate validation result: ' . json_encode(['params' => $params])); } //si_enhancement if(isset($file_paths['si_enhancement']) && $file_paths['si_enhancement'] != "" && $file_paths['si_enhancement'] != null){ - $params["action"] = "si_enhancement"; - $params["file_path"] = $file_paths['si_enhancement']; - $error[] = $this->excelFileFormatValidation($params); + $params["action"] = "si_enhancement"; + $params["file_path"] = $file_paths['si_enhancement']; + $error[] = $this->excelFileFormatValidation($params); + $this->myLogger->logme('error', 'SI Enhancement file formate validation result: ' . json_encode(['params' => $params])); } //missed_inception if(isset($file_paths['missed_inception']) && $file_paths['missed_inception'] != "" && $file_paths['missed_inception'] != null){ - $params["action"] = "missed_inception"; - $params["file_path"] = $file_paths['missed_inception']; - $error[] = $this->excelFileFormatValidation($params); + $params["action"] = "missed_inception"; + $params["file_path"] = $file_paths['missed_inception']; + $error[] = $this->excelFileFormatValidation($params); + $this->myLogger->logme('error', 'Missed Inception file formate validation result: ' . json_encode(['params' => $params])); } $error_type = 1; @@ -1145,6 +1154,7 @@ class EmployeeMultiEventServiceController extends BaseController if (isset($error['error_data']) && count($error['error_data']) == 0) { $r = Jobs::addJob(['job_name' => 'excelMultieventFileDataValidation', 'payload' => $params]); + $this->myLogger->logme('error', 'excelMultieventFileDataValidation job pushed'); } else { // $error['error_summary'] = array_count_values($error['error_summary']); @@ -1160,12 +1170,16 @@ class EmployeeMultiEventServiceController extends BaseController $this->unlinkFiles($file_paths); } + $this->myLogger->logme('error', 'Excel Multievent File Formate Validation function END'); + return ($error); } public function excelMultieventFileDataValidation($params) { + $this->myLogger->logme('error', 'Excel Multievent File Data Validation function START: ' . json_encode(['params' => $params])); + helper('excel_util_helper'); $file_id = $params['file_id']; $file = $this->fileModel->find($file_id); @@ -1195,6 +1209,7 @@ class EmployeeMultiEventServiceController extends BaseController $params["action"] = "inception"; $params["file_path"] = $file_paths['inception']; $error[] = $this->excelFileDataValidation($params); + $this->myLogger->logme('error', 'Inception file Data validation result: ' . json_encode(['params' => $params])); } //addition @@ -1202,6 +1217,7 @@ class EmployeeMultiEventServiceController extends BaseController $params["action"] = "addition"; $params["file_path"] = $file_paths['addition']; $error[] = $this->excelFileDataValidation($params); + $this->myLogger->logme('error', 'Addition file validation result: ' . json_encode(['params' => $params])); } //dependent_addition @@ -1209,6 +1225,7 @@ class EmployeeMultiEventServiceController extends BaseController $params["action"] = "dependent_addition"; $params["file_path"] = $file_paths['dependent_addition']; $error[] = $this->excelFileDataValidation($params); + $this->myLogger->logme('error', 'Dependent Addition file Data validation result: ' . json_encode(['params' => $params])); } //deletion @@ -1216,6 +1233,7 @@ class EmployeeMultiEventServiceController extends BaseController $params["action"] = "deletion"; $params["file_path"] = $file_paths['deletion']; $error[] = $this->excelFileDataValidation($params); + $this->myLogger->logme('error', 'Deletion file Data validation result: ' . json_encode(['params' => $params])); } //correction @@ -1223,6 +1241,7 @@ class EmployeeMultiEventServiceController extends BaseController $params["action"] = "correction"; $params["file_path"] = $file_paths['correction']; $error[] = $this->excelFileDataValidation($params); + $this->myLogger->logme('error', 'Correction file Data validation result: ' . json_encode(['params' => $params])); } //si_enhancement @@ -1230,6 +1249,7 @@ class EmployeeMultiEventServiceController extends BaseController $params["action"] = "si_enhancement"; $params["file_path"] = $file_paths['si_enhancement']; $error[] = $this->excelFileDataValidation($params); + $this->myLogger->logme('error', 'SI Enhancement file Data validation result: ' . json_encode(['params' => $params])); } //missed_inception @@ -1237,6 +1257,7 @@ class EmployeeMultiEventServiceController extends BaseController $params["action"] = "missed_inception"; $params["file_path"] = $file_paths['missed_inception']; $error[] = $this->excelFileDataValidation($params); + $this->myLogger->logme('error', 'Missed Inception file Data validation result: ' . json_encode(['params' => $params])); } $error_type = 2; @@ -1245,6 +1266,7 @@ class EmployeeMultiEventServiceController extends BaseController if (isset($error['error_data']) && count($error['error_data']) == 0) { $r = Jobs::addJob(['job_name' => 'excelMultieventFileOnBoard', 'payload' => $params]); + $this->myLogger->logme('error', 'excelMultieventFileOnBoard job pushed'); } else { // $error['error_summary'] = array_count_values($error['error_summary']); @@ -1257,11 +1279,15 @@ class EmployeeMultiEventServiceController extends BaseController $this->setPullNotification($this->getFileMetaDataByFileId($file_id, 'failure')); } + $this->myLogger->logme('error', 'Excel Multievent File Data Validation function END'); + return ($error); } public function excelMultieventFileOnBoard($params) { + $this->myLogger->logme('error', 'Excel Multievent File Onboard function START: ' . json_encode(['params' => $params])); + helper('excel_util_helper'); $file_id = $params['file_id']; @@ -1291,6 +1317,7 @@ class EmployeeMultiEventServiceController extends BaseController $params["action"] = "inception"; $params["file_path"] = $file_paths['inception']; $error['inception'] = $this->employeesOnboardPreprocess($params); + $this->myLogger->logme('error', 'Inception file Onboard Process result: ' . json_encode(['params' => $params])); } //addition @@ -1298,6 +1325,7 @@ class EmployeeMultiEventServiceController extends BaseController $params["action"] = "addition"; $params["file_path"] = $file_paths['addition']; $error['addition'] = $this->employeesOnboardPreprocess($params); + $this->myLogger->logme('error', 'Addition file Onboard Process result: ' . json_encode(['params' => $params])); } //dependent_addition @@ -1305,6 +1333,7 @@ class EmployeeMultiEventServiceController extends BaseController $params["action"] = "dependent_addition"; $params["file_path"] = $file_paths['dependent_addition']; $error['dependent_addition'] = $this->employeesOnboardPreprocess($params); + $this->myLogger->logme('error', 'Dependent Addition file Onboard Process result: ' . json_encode(['params' => $params])); } //missed_inception @@ -1312,6 +1341,7 @@ class EmployeeMultiEventServiceController extends BaseController $params["action"] = "missed_inception"; $params["file_path"] = $file_paths['missed_inception']; $error['missed_inception'] = $this->employeesOnboardPreprocess($params); + $this->myLogger->logme('error', 'Missed Inception file Onboard Process result: ' . json_encode(['params' => $params])); } //deletion @@ -1319,6 +1349,7 @@ class EmployeeMultiEventServiceController extends BaseController $params["action"] = "deletion"; $params["file_path"] = $file_paths['deletion']; $error['deletion'] = $this->employeeDisembark($params); + $this->myLogger->logme('error', 'Deletion file Onboard Process result: ' . json_encode(['params' => $params])); } //correction @@ -1326,6 +1357,7 @@ class EmployeeMultiEventServiceController extends BaseController $params["action"] = "correction"; $params["file_path"] = $file_paths['correction']; $error['correction'] = $this->employeesCorrectionProcess($params); + $this->myLogger->logme('error', 'Correction file Onboard Process result: ' . json_encode(['params' => $params])); } //si_enhancement @@ -1333,11 +1365,13 @@ class EmployeeMultiEventServiceController extends BaseController $params["action"] = "si_enhancement"; $params["file_path"] = $file_paths['si_enhancement']; $error['si_enhancement'] = $this->employeesSIEnhanceProcess($params); + $this->myLogger->logme('error', 'SI Enhancement file Onboard Process result: ' . json_encode(['params' => $params])); } $this->fileModel->where('id', $file_id)->set(['status' => 'success', 'reason' => ''])->update(); $this->myLogger->logme("error", $file['action'].': {file_id} uploaded success', ['file_id' => $file_id]); $this->setPullNotification($this->getFileMetaDataByFileId($file_id, 'success')); + $this->myLogger->logme('error', 'Excel Multievent File Onboard function END'); //After insert the success than remove the TEMP JSON files // $this->unlinkFiles($params['multi_event_file_paths']); @@ -2912,9 +2946,13 @@ class EmployeeMultiEventServiceController extends BaseController // Save JSON file in writable/tmp/ $savedFiles = []; foreach ($finalData as $key => $data) { - $filePath = WRITEPATH . 'tmp/' . $key . '_' . time() . '.json'; - file_put_contents($filePath, json_encode($data, JSON_PRETTY_PRINT)); - $savedFiles[$key] = $filePath; + if(!empty($data)){ + $filePath = WRITEPATH . 'tmp/' . $key . '_' . time() . '.json'; + file_put_contents($filePath, json_encode($data, JSON_PRETTY_PRINT)); + $savedFiles[$key] = $filePath; + }else{ + $savedFiles[$key] = ""; + } } return $savedFiles; diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 080c1e87..7d4c6f17 100755 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -345,7 +345,8 @@ input:checked + .slider_blue::before { - + + diff --git a/app/Views/policy_transaction_inception_form.php b/app/Views/policy_transaction_inception_form.php index 75a0376d..41df9fe9 100644 --- a/app/Views/policy_transaction_inception_form.php +++ b/app/Views/policy_transaction_inception_form.php @@ -1339,6 +1339,7 @@ let isVehicleFormSubmitting = false; var insurer_count_array = []; var redirect_url = ''; + let insurer_data = ; $(document).ready(function(){ @@ -1668,6 +1669,19 @@ var value = $(this).val(); var selectedOption = $(this).find('option:selected'); + let category = insurer_category[value] ?? null; + console.log('insurer_category', category); + // console.log('insurer_data', insurer_data); + + // loop through all select fields + $('[name="follow_insurer_id[]"]').each(function () { + let select = $(this); + if(select){ + appendInsurerByCategory(insurer_data, select, category); + } + }); + + var ebp = selectedOption.data('ebp'); var etp = selectedOption.data('etp'); var etep = selectedOption.data('etep'); @@ -1924,17 +1938,19 @@ let insurer = $(this).val(); let unique_id = $(this).data('count'); let client_id = $('#client_id').val(); + let policy_type_id = $('#policy_type_id').val(); console.log('insurer', insurer); + console.log('policy_type_id', policy_type_id); console.log('follow_insurer_id client_id', client_id); console.log('follow_insurer_id unique_id', unique_id); $('#insurer_id').val(insurer) - if(!client_id){ - $(this).val('').select2(); - toastr.warning('Please select the Client', 'WARNING'); - } + if (!policy_type_id || !client_id) { + $(this).val('').select2(); + toastr.warning(!policy_type_id ? 'Please select the Policy Type' : 'Please select the Client', 'WARNING'); + } }); @@ -4379,7 +4395,7 @@ - @@ -4620,7 +4636,16 @@ $(this).append(newCell); - $('#follow_insurer_id_' + insurerCount).select2() + let select = $('#follow_insurer_id_' + insurerCount); + let add_insurer_policy_type_id = $('#policy_type_id').val(); + let category = insurer_category[add_insurer_policy_type_id] ?? null; + + if(select && category){ + appendInsurerByCategory(insurer_data, select, category); + } + + $('#follow_insurer_id_' + insurerCount).select2(); + var selectedOption = $('#policy_type_id').find('option:selected');