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', '= base_url('download-kyc-docs/') ?>' + 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 = `