From cb5e8eb75f82da3f96a08e614b960c5c91f1dc29 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Sat, 11 May 2024 14:00:20 +0530 Subject: [PATCH] FIX_CLIENT_MODULE_AS_CLIENT_REQUIRED :RV --- app/Config/Routes.php | 1 + app/Controllers/ClientController.php | 49 +++++++++++++-- app/Models/BatchFileModel.php | 2 + app/Models/ClientPolicyModel.php | 4 +- app/Views/client_kyc.php | 77 ++++++++++++++++++++--- app/Views/client_policy.php | 35 +++++++++-- app/Views/policy_gmc_terms.php | 93 +++++++++++++++++++++++++--- app/Views/policy_gpa_terms.php | 30 +++++++-- app/Views/policy_grid.php | 10 ++- 9 files changed, 264 insertions(+), 37 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index fb9a1091..fe10e12f 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -18,6 +18,7 @@ $routes->get('/oauth2callback', 'LoginController::receiveGoogleOAuthResponse'); $routes->get('/auth/google', 'LoginController::initiateGoogleOAuth'); $routes->get('/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus'); $routes->get('download-e-card/(:segment)', 'EmployeeController::generateIDCardForEmployee/$1'); +$routes->get('download-kyc-docs/(:segment)', 'ClientController::downloadKYCDocument/$1'); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 5449dedb..c3b3b4b6 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -267,11 +267,11 @@ class ClientController extends AdminController // dd('Hi'); $clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($id); // dd($this->clientPolicyModel->getLastQuery()); - // foreach ($clientPoliceData as $key => $value) { + foreach ($clientPoliceData as $key => $value) { - // $clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date)); - // $clientPoliceData[$key]->policy_end_date = date('d-M-Y', strtotime($value->policy_end_date)); - // } + $clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date)); + $clientPoliceData[$key]->policy_end_date = date('d-M-Y', strtotime($value->policy_end_date)); + } $editData['client_policy'] = $clientPoliceData; @@ -587,7 +587,14 @@ class ClientController extends AdminController $data['insurer_id'] = $insurerId; $tpaValue = (string) $this->request->getPost('tpa'); - list($tpaBranchId, $tpaId) = explode('-', $tpaValue); + + if ($tpaValue === null || $tpaValue === '') { + $tpaBranchId = null; + $tpaId = null; + } else { + list($tpaBranchId, $tpaId) = explode('-', $tpaValue); + } + $data['client_id'] = $client_id; $data['tpa_branch_id'] = $tpaBranchId; @@ -964,6 +971,7 @@ class ClientController extends AdminController $data = $this->request->getPost(); $insert = true; } else if ($policy_grid_id == '11') { + $premium = $this->request->getPost('11_premium[]'); $sum_insure = $this->request->getPost('11_si[]'); $grade = $this->request->getPost('11_grade[]'); @@ -972,7 +980,7 @@ class ClientController extends AdminController $data['premium'] = str_replace(',', '', $premium[$i]); $data['si'] = str_replace(',', '', $sum_insure[$i]); $data['grade'] = $grade[$i]; - $data['max_si'] = $max_sum_insure[$i]; + $data['max_si'] = str_replace(',', '', $max_sum_insure[$i]); $dataa = $this->policyPremium2Model->insert($data); } $data = $this->request->getPost(); @@ -1348,6 +1356,13 @@ class ClientController extends AdminController $data['familytransportationbenefit'] =str_replace(',', '',$this->request->getPost("familytransportationbenefit")); $data['reasonableandcustomarycharges'] =str_replace(',', '',$this->request->getPost("reasonableandcustomarycharges")); $data['ayudhtreatmentcover'] =str_replace(',', '',$this->request->getPost("ayudhtreatmentcover")); + + if ($data['ayudhtreatmentcover'] == 1) { + $data['ayushTreatmentCoverData'] = str_replace(',', '',$this->request->getPost("ayushTreatmentCoverData")); + }else{ + $data['ayushTreatmentCoverData'] =""; + } + $data['armdcovered'] =str_replace(',', '',$this->request->getPost("armdcovered")); $data['suminsuredenhancement'] =str_replace(',', '',$this->request->getPost("suminsuredenhancement")); $data['automaticsuminsuredreinstatement'] =str_replace(',', '',$this->request->getPost("automaticsuminsuredreinstatement")); @@ -1363,6 +1378,15 @@ class ClientController extends AdminController $data['special_condition_label'] = str_replace(',', '',$this->request->getPost("special_condition_label")) ?? []; $data['special_condition_input'] = str_replace(',', '',$this->request->getPost("special_condition_input")) ?? []; + $data['cataract'] =str_replace(',', '',$this->request->getPost("cataract")); + + if ($data['cataract'] == 1) { + $data['cataractData'] = str_replace(',', '',$this->request->getPost("cataractData")); + }else{ + $data['cataractData'] =""; + } + + $jsonData = json_encode($data); $dataa = array( 'policy_terms' => $jsonData, @@ -1656,4 +1680,17 @@ class ClientController extends AdminController } + + + public function downloadKYCDocument($file_name) + { + + $file = WRITEPATH . 'uploads/client_kyc_documents/' . $file_name; // Example file path + + if (file_exists($file)) { + return $this->response->download($file, null)->setFileName($file_name); + } else { + return "File not found."; + } + } } \ No newline at end of file diff --git a/app/Models/BatchFileModel.php b/app/Models/BatchFileModel.php index 5976d6a2..1d2b4a0d 100644 --- a/app/Models/BatchFileModel.php +++ b/app/Models/BatchFileModel.php @@ -22,6 +22,8 @@ class BatchFileModel extends Model "updated_by", "is_active", "amount", + "status", + "error_data", ]; // Callbacks diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php index 1fc9a45d..291b13f9 100644 --- a/app/Models/ClientPolicyModel.php +++ b/app/Models/ClientPolicyModel.php @@ -76,8 +76,8 @@ class ClientPolicyModel extends Model ->select('policy_type.policy_type as policy_type_name') ->join('insurers', 'insurers.id = client_policy.insurer_id') ->join('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id') - ->join('tpa', 'tpa.id = client_policy.tpa_id') - ->join('tpa_branch', 'client_policy.tpa_branch_id = tpa_branch.id') + ->join('tpa', 'tpa.id = client_policy.tpa_id', 'left') + ->join('tpa_branch', 'client_policy.tpa_branch_id = tpa_branch.id', 'left') ->join('policies', 'policies.id = client_policy.policy_id') ->join('policy_type', 'policy_type.id = policies.policy_type_id') ->where('client_policy.client_id', $client_id) diff --git a/app/Views/client_kyc.php b/app/Views/client_kyc.php index d842b1f4..f53b7c16 100644 --- a/app/Views/client_kyc.php +++ b/app/Views/client_kyc.php @@ -176,6 +176,26 @@ $('#name_'+item.kyc_doc_type_id).html(item.file_name); $('#form_'+item.kyc_doc_type_id).hide(); + console.log('step 1') + + if(item.file_name != null && item.file_name != ""){ + console.log('step 2') + + $('#download_'+item.kyc_doc_type_id).show(); + $('#download_' + item.kyc_doc_type_id).attr('href', '' + item.file_name); + $('#delete_'+item.kyc_doc_type_id).show(); + + } + else{ + console.log('step 3') + + $('#download_'+item.kyc_doc_type_id).hide(); + $('#download_' + item.kyc_doc_type_id).attr('href', '#'); + $('#delete_'+item.kyc_doc_type_id).hide(); + + } + console.log('step 4') + }); }, @@ -212,19 +232,27 @@ var tbody = $('#tbody'); tbody.empty(); - $.each(res.data, function (index, item) { + $.each(res.data, function(index, item) { var row = ` - ${item.file_name} -
- - - -
+ ${item.file_name} + +
+ + + + + +
+ - + + + + `; tbody.append(row); }); + }, error: function (xhr, status, error) { console.error(xhr.responseText); @@ -250,7 +278,10 @@ ${item.other_docs_name} ${item.file_name} - + + + + `; @@ -267,6 +298,29 @@ $('#name_'+item.kyc_doc_type_id).show(); $('#name_'+item.kyc_doc_type_id).html(item.file_name); $('#form_'+item.kyc_doc_type_id).hide(); + + console.log('step 1') + + if(item.file_name != null && item.file_name != ""){ + console.log('step 2') + + $('#download_'+item.kyc_doc_type_id).show(); + $('#download_' + item.kyc_doc_type_id).attr('href', '' + item.file_name); + $('#delete_'+item.kyc_doc_type_id).show(); + + + } + else{ + console.log('step 3') + + $('#download_'+item.kyc_doc_type_id).hide(); + $('#download_' + item.kyc_doc_type_id).attr('href', '#'); + $('#delete_'+item.kyc_doc_type_id).hide(); + + + } + console.log('step 4') + }, 1000); }); @@ -335,7 +389,10 @@ ${item.other_docs_name} ${item.file_name} - + + + + `; } diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 782c000d..8ee76ec5 100644 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -80,7 +80,7 @@
- + - + @@ -441,6 +443,15 @@
+ +
@@ -552,6 +563,25 @@
+
+
+ +
+
+ Yes + No +
+
+ + +
@@ -599,8 +629,37 @@ // } // }); + $('input[name="ayudhtreatmentcover"]').change(function() { + + console.log($(this).val()); + + if ($(this).val() == '1') { + var element = $(this).parent().parent().next()[0]; + $(element).css("display", ""); + + } else { + var element = $(this).parent().parent().next()[0]; + $(element).css("display", "none"); + } + }); + + $('input[name="cataract"]').change(function() { + + console.log($(this).val()); + + if ($(this).val() == '1') { + var element = $(this).parent().parent().next()[0]; + $(element).css("display", ""); + + } else { + var element = $(this).parent().parent().next()[0]; + $(element).css("display", "none"); + } + }); + $('input[name="waiverofpreexistingdiseases"]').change(function() { + if ($(this).val() == '1') { var element = $(this).parent().parent().next()[0]; $(element).css("display", ""); @@ -718,7 +777,7 @@ $('#gmc_client_policy_id').val(client_policy_id) - + $('.removeDom').remove(); var gmc_policy_type_id = $(this).attr('id'); // console.log(gmc_policy_type_id) @@ -789,11 +848,19 @@ specialCondition(); } } + + console.log('key', key) let elements = document.getElementsByName(`${key}[]`); + console.log(elements) if (elements) { elements.forEach((element, index) => { - element.value = jsonObject[key][index]; + console.log() + if(jsonObject[key][index] == undefined){ + element.value = " "; + }else{ + element.value = jsonObject[key][index]; + } }); } } @@ -909,6 +976,10 @@ element.parentElement.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.style.display = ''; element.parentElement.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling.style.display = ''; + }else if(element.name === "ayudhtreatmentcover"){ + element.parentElement.parentElement.nextElementSibling.style.display = ''; + }else if(element.name === "cataract"){ + element.parentElement.parentElement.nextElementSibling.style.display = ''; } @@ -929,7 +1000,12 @@ } // console.log(jsonObject[key]); } else { - element.value = jsonObject[key]; + + if(jsonObject[key] == undefined){ + element.value = " "; + }else{ + element.value = jsonObject[key]; + } } } @@ -1119,7 +1195,10 @@ var index = $('.modifyclassinput').length; var appendElement = `
- +
`; console.log($(this)); diff --git a/app/Views/policy_gpa_terms.php b/app/Views/policy_gpa_terms.php index 94f263d1..d126c6c8 100644 --- a/app/Views/policy_gpa_terms.php +++ b/app/Views/policy_gpa_terms.php @@ -102,7 +102,7 @@
- +
@@ -503,6 +503,8 @@ $('#gpa_client_policy_id').val(client_policy_id); + + var gpa_policy_type_id = $(this).attr('id'); // console.log('gpa_policy_type_id', gpa_policy_type_id) @@ -558,7 +560,12 @@ if (elements) { elements.forEach((element, index) => { - element.value = gpaJsonObjectForSpecialCondition[key][index]; + + if(gpaJsonObjectForSpecialCondition[key][index] == undefined){ + element.value = " "; + }else{ + element.value = gpaJsonObjectForSpecialCondition[key][index]; + } }); } } @@ -605,7 +612,12 @@ } } else { - element.value = jsonObject[key]; + + if(jsonObject[key] == undefined){ + element.value = " "; + }else{ + element.value = jsonObject[key]; + } } } @@ -643,6 +655,7 @@ } }); + @@ -669,9 +682,14 @@ var index = $('.modifyclassinput').length; var appendElement = `
- - -
`; + + + + +
`; console.log($(this)); $('.gpa_special_condition').each(function() { $(this).append(appendElement); diff --git a/app/Views/policy_grid.php b/app/Views/policy_grid.php index 9b52fbbb..4b29adc2 100644 --- a/app/Views/policy_grid.php +++ b/app/Views/policy_grid.php @@ -501,7 +501,8 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
- + +
@@ -851,6 +852,10 @@ $('body').on('click', '.btnPolicyModel', function() { $(this).trigger('keyup'); }); + $('input[name="11_max_si[]"]').each(function() { + $(this).trigger('keyup'); + }); + var id_for_trigger = temp_for_premiumData[0].policy_grid_id; $(`input[name="${id_for_trigger}_si[]"]`).each(function() { console.log($(this)); @@ -1282,7 +1287,8 @@ function appendGridtHtml(ui_type = false, data = false, ) {
- + +