From 367d035629e59576a7bcb98c0d755cdf6ce9907c Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 20 Feb 2025 10:06:34 +0530 Subject: [PATCH 01/21] FIX_BDS : RV --- app/Controllers/MasterController.php | 4 +++- app/Controllers/PolicyTransactionController.php | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 9cf89d53..9202c85e 100755 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -1723,7 +1723,8 @@ class MasterController extends AdminController 'excel' => WRITEPATH . 'uploads/excel/', 'statements' => WRITEPATH . 'uploads/statements/', 'import_excel' => WRITEPATH . 'uploads/import_excel/', - 'logs' => WRITEPATH . 'uploads/logs/', + 'logs' => WRITEPATH . 'logs', + 'session' => WRITEPATH . 'session', 'client_kyc_documents' => WRITEPATH . 'uploads/client_kyc_documents/', 'tmp' => WRITEPATH . 'tmp/', 'e_card_imgs' => ROOTPATH . 'public/e_card_imgs', @@ -1732,6 +1733,7 @@ class MasterController extends AdminController 'logo' => ROOTPATH . 'public/uploads/logo/', 'template_bg' => ROOTPATH . 'public/uploads/template_bg/', 'attachments' => WRITEPATH . 'uploads/attachments/', + 'cache' => WRITEPATH . 'cache', 'sample_import_excel' => ROOTPATH . 'public/sample_import_excel', 'lead_files' => WRITEPATH . 'uploads/lead_files/', ]; diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 69852bca..41c1c8c7 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -274,7 +274,7 @@ class PolicyTransactionController extends BaseController // Separate Insurer and TPA Branch IDs and IDs if(isset($data['insurer_id']) && !empty($data['insurer_id'])){ list($data['insurer_branch_id'], $data['insurer_id']) = explode('-', $data['insurer_id']); - if (isset($data['tpa'])) { + if (isset($data['tpa']) && !empty($data['tpa'])) { list($data['tpa_branch_id'], $data['tpa_id']) = explode('-', $data['tpa']); } } @@ -1117,7 +1117,7 @@ class PolicyTransactionController extends BaseController // Separate Insurer and TPA Branch IDs and IDs if(isset($data['insurer_id']) && !empty($data['insurer_id'])){ list($data['insurer_branch_id'], $data['insurer_id']) = explode('-', $data['insurer_id']); - if (isset($data['tpa'])) { + if (isset($data['tpa']) && !empty($data['tpa'])) { list($data['tpa_branch_id'], $data['tpa_id']) = explode('-', $data['tpa']); } } From e19cc5d69540d63a74c32b0a5185244cbbd46a49 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 21 Feb 2025 09:38:33 +0530 Subject: [PATCH 02/21] CHANGE_CLAIM_API : RV --- app/Config/Routes.php | 9 +- app/Controllers/ClientController.php | 91 +++++++++++++- app/Controllers/EmployeeRestController.php | 140 +++++++++++++++++---- app/Controllers/TicketController.php | 16 +-- app/Models/ClientPolicyModel.php | 1 + app/Models/TicketMasterModel.php | 21 ++++ 6 files changed, 243 insertions(+), 35 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index c5111235..b77e8f5e 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -31,6 +31,7 @@ $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderM $routes->get("sendextraparam", "ClientController::sendextraparam"); $routes->get("updateRenewalData", "ClientController::updateRenewalData"); $routes->get("updateRenewalDataNotExistingClient", "ClientController::updateRenewalDataNotExistingClient"); +$routes->get("updateRenewalInsurerData", "ClientController::updateRenewalInsurerData"); // $routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn"); // $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail"); // $routes->post("employeeUpload", "EmployeeRestController::employeeUpload"); @@ -441,13 +442,19 @@ $routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController:: // Test initiate Claim $routes->post('initiateClaim',"EmployeeRestController::initiateClaim"); +$routes->get('departments',"EmployeeRestController::get_ticket_type"); +$routes->get('get_ticket_data',"EmployeeRestController::get_ticket_data"); + +//api $routes->group("/api", ["filter" => "authJWT"], function ($routes) { $routes->post("logined", "RestAuthenticationController::logined"); $routes->post("getId", "RestAuthenticationController::getUserIdFromToken"); $routes->post('initiateClaim',"EmployeeRestController::initiateClaim"); - + $routes->get('get_ticket_type',"EmployeeRestController::get_ticket_type"); + $routes->get('get_ticket_data',"EmployeeRestController::get_ticket_data"); }); + $routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy"); $routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy"); $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) { diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index ad575e27..b2111b27 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -4589,6 +4589,50 @@ class ClientController extends AdminController kint::dump($successData); } + public function updateRenewalInsurerData() + { + $db = db_connect(); + $renewalData = $db->table('old_renewal_data_copy') + ->where('insurer_id IS NULL') + ->get() + ->getResultArray(); + // dd($renewalData); + + $successData = []; + foreach ($renewalData as $key => $value) { + + $insurer_data = $this->insurerModel->where('name', $value['insurer_name'])->where('is_active', 1)->first(); + + if(!empty($insurer_data)){ + + $insurer_branch_data = $this->insurerBranchModel->where('branch_name', $value['insurer_branch'])->first(); + if(!empty($insurer_branch_data)){ + $branch = $this->insurerBranchModel->where('insurer_id', $insurer_data['id'] ?? 0)->first(); + $value['insurer_id'] = $insurer_data['id'] ?? null; + $value['insurer_branch_id'] = $branch['id'] ?? null; + }else{ + $value['insurer_id'] = $insurer_data['id'] ?? null; + $value['insurer_branch_id'] = $this->prepareInsurerBranch($value); + } + }else{ + $value['insurer_id'] = $this->prepareinsurer($value); + $value['insurer_branch_id'] = $this->prepareInsurerBranch($value); + } + + // Update is_inserted field in DB + $db->table('old_renewal_data_copy') + ->where('id', $value['id']) + ->set([ + 'insurer_id' => $value['insurer_id'], + 'insurer_branch_id' => $value['insurer_branch_id'], + ]) + ->update(); + + $successData[] = ['id' => $value['id'], 'insurer' => $value['insurer_name'], 'insurer_id' => $value['insurer_id'], 'insurer_branch_id' => $value['insurer_branch_id'], ]; + } + + kint::dump($successData); + } public function updateRenewalDataNotExistingClient() { @@ -4920,6 +4964,51 @@ class ClientController extends AdminController $id = $ClientModel->insert($clientData); return $id; } - + private function prepareInsurerBranch($renewalData) + { + + $insurerBranchData = [ + 'insurer_id' => $renewalData['insurer_id'], + 'branch_name' => $renewalData['insurer_branch'], + 'branch_code' => $renewalData['insurer_branch'], + 'address1' => null, + 'address2' => null, + 'city' => null, + 'district' => null, + 'state' => null, + 'pincode' => null, + ]; + + + + $InsurerBranchModel = new InsurerBranchModel(); + $id = $InsurerBranchModel->insert($insurerBranchData); + return $id; + } + + private function prepareinsurer($renewalData) + { + + $short_name1 = explode(" ", $renewalData['insurer_name'])[0]; + $short_name2 = explode(" ", $renewalData['insurer_name'])[1]; + $short_name = $short_name1 . ' ' . $short_name2; + + $insurerData = [ + 'type' => "pvt", + 'category' => "general", + 'addition_add_day' => 0, + 'deletion_add_day' => 0, + 'name' => $renewalData['insurer_name'], + 'short_name' => $short_name, + 'insurer_logo' => null, + 'is_multi_event' => 0, // Default is 0 + ]; + + $InsurerModel = new InsurerModel(); + $id = $InsurerModel->insert($insurerData); + return $id; + } + + } diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 40e85cd0..a0f5a49f 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -3108,48 +3108,78 @@ class EmployeeRestController extends AdminController { $received_data = $this->request->getPost(); + // print_r($received_data); die; $employee_id = $received_data['emp_id']; $client_policy_id = $received_data['client_policy_id']; $insured_emp_id = $received_data['insured_emp_id']; - $sql = "select cp.policy_type_id as ticket_type_id, - cl_rm.user_id as acm_id, - cp.insurer_id as insurer_id, - cp.tpa_id as tpa_id, - emp.client_id , - emp.id as emp_id, - emp_pol.uhid as policy_no, - emp.emp_code, - emp_pol.tpa_id as tpa_no, - emp.name as emp_name, - emp.email_corporate as emp_mail, - emp.mobile as emp_mobile, - empl.id as insured_emp_id, - empl.name as insured_name, - empl.relationship + $sql = " + select + cp.policy_type_id, + cl_rm.user_id as acm_id, + cp.insurer_id as insurer_id, + cp.tpa_id as tpa_id, + emp.client_id , + emp.id as emp_id, + emp_pol.uhid as policy_no, + emp.emp_code, + emp_pol.tpa_id as tpa_no, + emp.name as emp_name, + emp.email_corporate as emp_mail, + emp.mobile as emp_mobile, + empl.id as insured_emp_id, + empl.name as insured_name, + empl.relationship, + + CASE + WHEN cp.policy_type_id IN (2, 3, 4, 5) THEN 1 + WHEN cp.policy_type_id = 1 THEN 2 + WHEN cp.policy_type_id = 6 THEN 3 + WHEN cp.policy_type_id = 7 THEN 4 + ELSE NULL + END AS ticket_type_id + from employees emp - - from employees emp - - left join employees empl on empl.id = $insured_emp_id and empl.is_active = 1 and empl.emp_status = 'active' - left join employee_polices emp_pol on empl.id = emp_pol.employee_id and emp_pol.client_policy_id = $client_policy_id and emp_pol.is_active = 1 - left join client_policy cp on cp.id = emp_pol.client_policy_id and cp.is_active = 1 - left join client_rm cl_rm on cl_rm.client_id = empl.client_id and cl_rm.is_active = 1 and cl_rm.level = 3 + left join employees empl on empl.id = $insured_emp_id and empl.is_active = 1 and empl.emp_status = 'active' + left join employee_polices emp_pol on empl.id = emp_pol.employee_id and emp_pol.client_policy_id = $client_policy_id and emp_pol.is_active = 1 + left join client_policy cp on cp.id = emp_pol.client_policy_id and cp.is_active = 1 + left join client_rm cl_rm on cl_rm.client_id = empl.client_id and cl_rm.is_active = 1 and cl_rm.level = 3 where emp.id = $employee_id and emp.is_active = 1 and emp.emp_status = 'active' limit 1 "; $fetchData = $this->employeeModel->query($sql)->getResultArray()[0]; - $fetchData['claim_status_id'] = $this->claimStatusModel->select('id')->where('ticket_type', $fetchData['ticket_type_id'])->first()['id']; + $fetchData['claim_status_id'] = $this->claimStatusModel + ->select('id') + ->where('ticket_type', $fetchData['ticket_type_id']) + ->orderBy('id', 'asc') + ->first()['id']; + $fetchData['priority'] = 1; $fetchData['mode_of_intimation'] = 1; - $fetchData['hospital_name'] = $received_data['hospital_name']; + $fetchData = array_merge($fetchData, $received_data); + // print_r($fetchData); die; $insert_status = $this->ticketMaster->insert($fetchData); $ticket_id = $this->ticketMaster->insertID(); if ($insert_status && !empty($ticket_id)) { + + $messagesData = [ + 'ticket_id' => $ticket_id ?? null, + 'sender' => 'user', + 'claim_status' => $fetchData['claim_status_id'] ?? null, + 'emp_mail' => $fetchData['emp_mail'] ?? null, + 'mail_subject' => $fetchData['subject'] ?? null, + 'mail_content' => $fetchData['message'] ?? null, + ]; + + if (!empty($messagesData['ticket_id'])) { + $TicketMessageModel = new TicketMessageModel(); + $TicketMessageModel->insert($messagesData); + } + $mail_sent_status = ($this->ticketController->sendAutoMailTrigger($ticket_id)); if (gettype($mail_sent_status) == 'array') { $message = 'Claim Iniated Successfully'; @@ -3187,6 +3217,66 @@ class EmployeeRestController extends AdminController return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200); } } - + + //department + public function get_ticket_type() + { + $ticket_type = $this->ticketController->ticketType; + $ticket_type = array_map(fn($value, $key) => (object) ['id' => $key, 'name' => $value], array_values($ticket_type), array_keys($ticket_type)); + // print_r($ticket_type); die; + return $ticket_type; + } + + //ticket data + public function get_ticket_data() + { + $priorityType = $this->ticketController->priorityType; + $modeOFIntimate = $this->ticketController->modeOFIntimate; + $claimType = $this->ticketController->claimType; + $relationshipType = $this->ticketController->relationshipType; + + $emp_id = $this->request->getGet('emp_id'); + // dd($emp_id); + + if (empty($emp_id)) { + return $this->response->setJSON(['error' => 'emp_id is required'])->setStatusCode(404); + } + + $TicketMasterModel = new TicketMasterModel(); + $ticket_data = $TicketMasterModel->get_ticket_data($emp_id); + + if (!empty($ticket_data)) { + + $client_claim_status = [ + 'Received' => [1, 2, 3, 4, 15, 16, 17, 18, 25, 26, 27, 28, 35, 36, 37, 38], + 'Rejected' => [8, 49, 55, 60], + 'Cancelled' => [13, 47, 53, 58], + 'Returned' => [14, 48, 54, 59], + 'Closed' => [12, 22, 32, 42], + 'Approved' => [9, 20, 30, 40], + 'Settled' => [11, 24, 34], + 'Under Process' => [5, 6, 7, 10, 19, 23, 45, 50, 29, 33, 51, 39, 43, 56], + ]; + + foreach ($ticket_data as $key => $value) { + foreach ($client_claim_status as $claim_key => $claim_value) { + if (in_array($value['claim_status_id'], $claim_value)) { // Corrected argument order + $ticket_data[$key]['claim_status'] = $claim_key ?? null; // Assign back to the main array + } + } + $ticket_data[$key]['priority_type'] = $priorityType[$value['priority']] ?? null; + $ticket_data[$key]['mode_of_intimate_type'] = $modeOFIntimate[$value['mode_of_intimation']] ?? null; + $ticket_data[$key]['relationship_type'] = ucfirst($value['relationship']) ?? null; + $claimPrimaryTypey = "1"; + if (in_array($value['claim_type'], [2, 3, 4])) { + $claimPrimaryTypey = "2"; + } + $ticket_data[$key]['claim_type_value'] = $claimType[$claimPrimaryTypey][$value['claim_type']] ?? null; + } + } + + // print_rr($ticket_data); die; + return $ticket_data; + } } \ No newline at end of file diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index e1302f55..f4cc3bd6 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -26,14 +26,14 @@ class TicketController extends BaseController use ResponseTrait; protected $myLogger; - protected $ticketType; - protected $priorityType; - protected $relationshipType; - protected $modeOFIntimate; - protected $claimType; - protected $claimStatus; - protected $placeHolders; - protected $extraFields; + public $ticketType; + public $priorityType; + public $relationshipType; + public $modeOFIntimate; + public $claimType; + public $claimStatus; + public $placeHolders; + public $extraFields; protected $clientModel; protected $ticketMasterModel; diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php index 3f0d7a43..c8fcb855 100755 --- a/app/Models/ClientPolicyModel.php +++ b/app/Models/ClientPolicyModel.php @@ -259,6 +259,7 @@ class ClientPolicyModel extends Model ->select('SUM(CASE WHEN sub_type = 3 THEN amount ELSE 0 END) AS total_refund') ->where('client_id', $clientId) ->where('insurer_id', $insurerId) + ->where('cash_deposit.is_active', 1) ->get() ->getRow(); } diff --git a/app/Models/TicketMasterModel.php b/app/Models/TicketMasterModel.php index 4cb59773..01d90b17 100644 --- a/app/Models/TicketMasterModel.php +++ b/app/Models/TicketMasterModel.php @@ -676,5 +676,26 @@ class TicketMasterModel extends Model return $result; } } + + //api + public function get_ticket_data($emp_id, $ticket_type = null, $ticket_id = null) + { + $query = $this->select('*') + ->where('is_active', 1) + ->where('emp_id', $emp_id); + + if (!empty($ticket_id)) { + $query->where('id', $ticket_id); + } + + if (!empty($ticket_type)) { + $query->where('ticket_type_id', $ticket_type); + } + + $data = $query->findAll(); + // dd($data, db_connect()->getLastQuery()); + return $data; + } + } From 13c5279fe16901c4733c15a2f7eb6bcb41de97c9 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 21 Feb 2025 10:53:16 +0530 Subject: [PATCH 03/21] FIX_CLAIM_API : RV --- app/Controllers/EmployeeRestController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index a0f5a49f..c885edf2 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -3103,6 +3103,7 @@ class EmployeeRestController extends AdminController return false; } + //Get Data from post for inserting ticket and message public function initiateClaim() { @@ -3224,7 +3225,7 @@ class EmployeeRestController extends AdminController $ticket_type = $this->ticketController->ticketType; $ticket_type = array_map(fn($value, $key) => (object) ['id' => $key, 'name' => $value], array_values($ticket_type), array_keys($ticket_type)); // print_r($ticket_type); die; - return $ticket_type; + return $this->response->setJSON(['ticket_type' => $ticket_type])->setStatusCode(200); } //ticket data @@ -3236,6 +3237,8 @@ class EmployeeRestController extends AdminController $relationshipType = $this->ticketController->relationshipType; $emp_id = $this->request->getGet('emp_id'); + $ticket_type = $this->request->getGet('ticket_type') ?? null; + $ticket_id = $this->request->getGet('ticket_id') ?? null; // dd($emp_id); if (empty($emp_id)) { @@ -3243,7 +3246,7 @@ class EmployeeRestController extends AdminController } $TicketMasterModel = new TicketMasterModel(); - $ticket_data = $TicketMasterModel->get_ticket_data($emp_id); + $ticket_data = $TicketMasterModel->get_ticket_data($emp_id, $ticket_type, $ticket_id); if (!empty($ticket_data)) { @@ -3275,8 +3278,7 @@ class EmployeeRestController extends AdminController } } - // print_rr($ticket_data); die; - return $ticket_data; + return $this->response->setJSON(['ticket_data' => $ticket_data])->setStatusCode(200); } } \ No newline at end of file From 42fbc1ec4301b5b0329b87ea585de0088402e1ca Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 21 Feb 2025 11:58:39 +0530 Subject: [PATCH 04/21] FIX_CLAIMS_API : RV --- app/Controllers/ClientController.php | 825 +++++++++++++++------ app/Controllers/EmployeeRestController.php | 13 +- 2 files changed, 603 insertions(+), 235 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index b2111b27..e625fb84 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -2216,6 +2216,7 @@ class ClientController extends AdminController public function policyGMCTerms() { try { + // echo "
";
             // print_r($this->request->getPost());die;
             $this->myLogger->logme('error', 'Terms CREATE function called');
@@ -2225,7 +2226,6 @@ class ClientController extends AdminController
 
             $data['sum_insured']   = str_replace(',', '', $this->request->getPost("sum_insured"));
             $data['family_floater']   = $this->request->getPost("family_floater") ? $this->request->getPost("family_floater") : 0;
-            // $data['corporatebuffer'] = $this->request->getPost("corporatebuffer") ? $this->request->getPost("corporatebuffer") : 0;
             $data['family_floaters'] = $this->request->getPost("family_floaters") ?? [];
 
             $data['age_ratio']['self']['min'] =  $this->request->getPost("self_min_age") ? $this->request->getPost("self_min_age") : 0;
@@ -2243,12 +2243,9 @@ class ClientController extends AdminController
             $data['is_payable_employee']['elders'] = $this->request->getPost("is_payable_employee_for_elders") ? 1 : 0;
 
 
-
-            // if (!in_array("self", $data['family_floaters'])) {
-            //     array_unshift($data['family_floaters'], "self");
-            // }
             $temp_family_floaters = $data['family_floaters'];
             $data['family_floaters'] = [];
+
             if (in_array("self", $temp_family_floaters) == 1) {
                 $data['family_floaters']['self'] = 1;
             } else {
@@ -2261,8 +2258,6 @@ class ClientController extends AdminController
                 $data['family_floaters']['spouse'] = 0;
             }
 
-            // $data['family_floaters']['either-parents-pil'] =0;
-
             if (count($temp_family_floaters)) {
                 $children_value = 0;
                 $value = 0;
@@ -2321,79 +2316,55 @@ class ClientController extends AdminController
             // print_r($data);die;
 
             $data['waiverofpreexistingdiseases']   = $this->request->getPost("waiverofpreexistingdiseases");
-            if ($data['waiverofpreexistingdiseases'] == 1) {
-                $data['maternitycoverage']   = str_replace(',', '', $this->request->getPost("maternitycoverage"));
-                $data['twindelivery']   = str_replace(',', '', $this->request->getPost("twindelivery"));
-                $data['preandpostnatal']   = str_replace(',', '', $this->request->getPost("preandpostnatal"));
-                $data['babyday1cover']   = str_replace(',', '', $this->request->getPost("babyday1cover"));
-            } else {
-                $data['maternitycoverage']   = "";
-                $data['twindelivery']   = "";
-                $data['preandpostnatal']   = "";
-                $data['babyday1cover']   = "";
-            }
-
-            $data['9monthwaitingperiodwaived'] = str_replace(',', '', $this->request->getPost("9monthwaitingperiodwaived"));
-            $data['coverfromthedateofjoining'] = str_replace(',', '', $this->request->getPost("coverfromthedateofjoining"));
             $data['waiverof1,2,3&4thyearexclusions'] = $this->request->getPost("waiverof1,2,3&4thyearexclusions");
             $data['waiverof30dayswaitingperiod'] = $this->request->getPost("waiverof30dayswaitingperiod");
+            $data['waiver_of_90_days_waiting_period'] = $this->request->getPost("waiver_of_90_days_waiting_period");
+            $data['waiver_of_other_waiting_periods'] = $this->request->getPost("waiver_of_other_waiting_periods");
+            $data['maternity_benefit'] = $this->request->getPost("maternity_benefit");
+            $data['9monthwaitingperiodwaived'] = str_replace(',', '', $this->request->getPost("9monthwaitingperiodwaived"));
+            $data['maternitycoverage']   = str_replace(',', '', $this->request->getPost("maternitycoverage"));
+            $data['twindelivery']   = str_replace(',', '', $this->request->getPost("twindelivery"));
+            $data['well_baby_well_mother_expenses']   = str_replace(',', '', $this->request->getPost("well_baby_well_mother_expenses"));
+            $data['preandpostnatal']   = str_replace(',', '', $this->request->getPost("preandpostnatal"));
+            $data['infertility_treatment_coverage']   = str_replace(',', '', $this->request->getPost("infertility_treatment_coverage"));
+            $data['babyday1cover']   = str_replace(',', '', $this->request->getPost("babyday1cover"));
+            $data['coverfromthedateofjoining'] = str_replace(',', '', $this->request->getPost("coverfromthedateofjoining"));
+            $data['mid_term_addition_of_new_born_newly_wedded_spouse'] = str_replace(',', '', $this->request->getPost("mid_term_addition_of_new_born_newly_wedded_spouse"));
             $data['prehospitalizationcover'] = str_replace(',', '', $this->request->getPost("prehospitalizationcover"));
-            // $data['posthospitalizationcover'] =$this->request->getPost("posthospitalizationcover");
+            $data['posthospitalizationcover'] =$this->request->getPost("posthospitalizationcover");
             $data['congenitaldiseasesinternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesinternal"));
-            // $data['congenitaldiseasesexternal'] =$this->request->getPost("congenitaldiseasesexternal");
+            $data['congenitaldiseasesexternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesexternal"));
             $data['copayzonewisecopay'] = $this->request->getPost("copayzonewisecopay");
-            $data['co_pay_details'] = str_replace(',', '', $this->request->getPost("co_pay_details"));
-
-            $data['bioabsorbablestenttoriclensmultifocallens'] = $this->request->getPost("bioabsorbablestenttoriclensmultifocallens");
             $data['roomrentlimit'] = str_replace(',', '', $this->request->getPost("roomrentlimit"));
+            $data['icu_limit'] = str_replace(',', '', $this->request->getPost("icu_limit"));
             $data['proportionatedeductionclause'] = str_replace(',', '', $this->request->getPost("proportionatedeductionclause"));
-            // $data['nursingallowance'] =str_replace(',', '',$this->request->getPost("nursingallowance"));
             $data['ailmentcapping'] = $this->request->getPost("ailmentcapping");
             $data['ailment_capping_details'] = str_replace(',', '', $this->request->getPost("ailment_capping_details"));
-
+            $data['corporatebuffer'] = str_replace(',', '', $this->request->getPost("corporatebuffer"));
+            $data['non_admissible_contingency_corporate_buffer'] = str_replace(',', '', $this->request->getPost("non_admissible_contingency_corporate_buffer"));
             $data['ambulancecharges'] = str_replace(',', '', $this->request->getPost("ambulancecharges"));
             $data['airambulance'] = str_replace(',', '', $this->request->getPost("airambulance"));
-            $data['familytransportationbenefit'] = str_replace(',', '', $this->request->getPost("familytransportationbenefit"));
             $data['reasonableandcustomarycharges'] = str_replace(',', '', $this->request->getPost("reasonableandcustomarycharges"));
             $data['daycaretreatment'] = str_replace(',', '', $this->request->getPost("daycaretreatment"));
-            $data['ayudhtreatmentcover'] = str_replace(',', '', $this->request->getPost("ayudhtreatmentcover"));
-
-            $data['congenitaldiseasesexternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesexternal"));
-            // $data['optionalparentalcopay'] = str_replace(',', '', $this->request->getPost("optionalparentalcopay"));
-            $data['posthospitalizationcover'] = str_replace(',', '', $this->request->getPost("posthospitalizationcover"));
-            $data['corporatebuffer'] = str_replace(',', '', $this->request->getPost("corporatebuffer"));
-            $data['sublimitofcorporatebuffer'] = str_replace(',', '', $this->request->getPost("sublimitofcorporatebuffer"));
-
-            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"));
-            $data['additionalsicknessbenefit'] = str_replace(',', '', $this->request->getPost("additionalsicknessbenefit"));
             $data['lasiksurgery'] = str_replace(',', '', $this->request->getPost("lasiksurgery"));
-            $data['midterminclusion'] = str_replace(',', '', $this->request->getPost("midterminclusion"));
-            $data['capd'] = str_replace(',', '', $this->request->getPost("capd"));
-            $data['organdonorexpenses'] = str_replace(',', '', $this->request->getPost("organdonorexpenses"));
+            $data['ayudhtreatmentcover'] = str_replace(',', '', $this->request->getPost("ayudhtreatmentcover"));
             $data['moderntreatmentsasperirdai'] = str_replace(',', '', $this->request->getPost("moderntreatmentsasperirdai"));
-            $data['Wellness'] = str_replace(',', '', $this->request->getPost("Wellness"));
+            $data['opd_treatment'] = str_replace(',', '', $this->request->getPost("opd_treatment"));
             $data['days_of_discharge'] = str_replace(',', '', $this->request->getPost("days_of_discharge"));
             $data['days_from_dod'] = str_replace(',', '', $this->request->getPost("days_from_dod"));
+            $data['terrorism'] = str_replace(',', '', $this->request->getPost("terrorism"));
+            $data['widower_cover'] = str_replace(',', '', $this->request->getPost("widower_cover"));
+            $data['breavement_cover'] = str_replace(',', '', $this->request->getPost("breavement_cover"));
+
+            $data['suminsuredenhancement'] = str_replace(',', '', $this->request->getPost("suminsuredenhancement"));
+
             $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['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? [];
 
-            $data['cataract'] = str_replace(',', '', $this->request->getPost("cataract"));
-
-            if ($data['cataract'] == 1) {
-                $data['cataractData']   = str_replace(',', '', $this->request->getPost("cataractData"));
-            } else {
-                $data['cataractData']   = "";
-            }
+            $data['enrollment_display_key'] = $this->enrollmentGMCDisplayValueTransform();
 
+            // print_r($data);die;
 
             $jsonData = json_encode($data);
             $dataa = array(
@@ -2402,7 +2373,6 @@ class ClientController extends AdminController
 
             $record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
 
-
             // print_r($data);die;
             if ($record) {
                 $update = $this->clientPolicyModel->update($client_policy_id, $dataa);
@@ -2427,6 +2397,178 @@ class ClientController extends AdminController
         }
     }
 
+    public function enrollmentGMCDisplayValueTransform()
+    {
+
+        if ($this->request->getPost("waiverofpreexistingdiseases_display")) {
+            $data['Waiver of Pre-existing Diseases'] = $this->request->getPost("waiverofpreexistingdiseases");
+        }
+        
+        if ($this->request->getPost("waiverof1234thyearexclusions_display")) {
+            $data['Waiver of 1, 2, 3 & 4th year Exclusions'] = $this->request->getPost("waiverof1,2,3&4thyearexclusions");
+        }
+        
+        if ($this->request->getPost("waiverof30dayswaitingperiod_display")) {
+            $data['Waiver of 30 days waiting period'] = $this->request->getPost("waiverof30dayswaitingperiod");
+        }
+        
+        if ($this->request->getPost("waiver_of_90_days_waiting_period_display")) {
+            $data['Waiver of 90 Days Waiting Period'] = $this->request->getPost("waiver_of_90_days_waiting_period");
+        }
+        
+        if ($this->request->getPost("waiver_of_other_waiting_periods_display")) {
+            $data['Waiver of Other Waiting Periods'] = $this->request->getPost("waiver_of_other_waiting_periods");
+        }
+        
+        if ($this->request->getPost("maternity_benefit_display")) {
+            $data['Maternity Benefit'] = $this->request->getPost("maternity_benefit");
+        }
+        
+        if ($this->request->getPost("9monthwaitingperiodwaived_display")) {
+            $data['9-month waiting Period - waived'] = $this->request->getPost("9monthwaitingperiodwaived");
+        }
+        
+        if ($this->request->getPost("maternitycoverage_display")) {
+            $data['Maternity Coverage'] = $this->request->getPost("maternitycoverage");
+        }
+        
+        if ($this->request->getPost("twindelivery_display")) {
+            $data['Twin Delivery'] = $this->request->getPost("twindelivery");
+        }
+        
+        if ($this->request->getPost("well_baby_well_mother_expenses_display")) {
+            $data['Well baby / Well Mother Expenses'] = $this->request->getPost("well_baby_well_mother_expenses");
+        }
+        
+        if ($this->request->getPost("preandpostnatal_display")) {
+            $data['Pre and Post natal'] = $this->request->getPost("preandpostnatal");
+        }
+        
+        if ($this->request->getPost("infertility_treatment_coverage_display")) {
+            $data['Infertility Treatment Coverage'] = $this->request->getPost("infertility_treatment_coverage");
+        }
+        
+        if ($this->request->getPost("babyday1cover_display")) {
+            $data['Baby Day 1 Cover'] = $this->request->getPost("babyday1cover");
+        }
+        
+        if ($this->request->getPost("coverfromthedateofjoining_display")) {
+            $data['Cover from the date of Joining'] = $this->request->getPost("coverfromthedateofjoining");
+        }
+        
+        if ($this->request->getPost("mid_term_addition_of_new_born_newly_wedded_spouse_display")) {
+            $data['Mid Term Addition of New Born / Newly Wedded Spouse'] = $this->request->getPost("mid_term_addition_of_new_born_newly_wedded_spouse");
+        }
+        
+        if ($this->request->getPost("prehospitalizationcover_display")) {
+            $data['Pre Hospitalization Cover'] = $this->request->getPost("prehospitalizationcover");
+        }
+        
+        if ($this->request->getPost("posthospitalizationcover_display")) {
+            $data['Post Hospitalization Cover'] = $this->request->getPost("posthospitalizationcover");
+        }
+        
+        if ($this->request->getPost("congenitaldiseasesinternal_display")) {
+            $data['Congenital Diseases - Internal'] = $this->request->getPost("congenitaldiseasesinternal");
+        }
+        
+        if ($this->request->getPost("congenitaldiseasesexternal_display")) {
+            $data['Congenital Diseases - External'] = $this->request->getPost("congenitaldiseasesexternal");
+        }
+        
+        if ($this->request->getPost("copayzonewisecopay_display")) {
+            $data['Co-Pay/Zone wise Co Pay'] = $this->request->getPost("copayzonewisecopay");
+        }
+        
+        if ($this->request->getPost("roomrentlimit_display")) {
+            $data['Room Rent Limit'] = $this->request->getPost("roomrentlimit");
+        }
+        
+        if ($this->request->getPost("icu_limit_display")) {
+            $data['ICU Limit'] = $this->request->getPost("icu_limit");
+        }
+        
+        if ($this->request->getPost("proportionatedeductionclause_display")) {
+            $data['Proportionate Deduction Clause'] = $this->request->getPost("proportionatedeductionclause");
+        }
+        
+        if ($this->request->getPost("ailmentcapping_display")) {
+            $data['Ailment capping'] = $this->request->getPost("ailmentcapping");
+        }
+        
+        if ($this->request->getPost("ailment_capping_details_display")) {
+            $data['Ailment capping Details'] = $this->request->getPost("ailment_capping_details");
+        }
+        
+        if ($this->request->getPost("corporatebuffer_display")) {
+            $data['Corporate Buffer'] = $this->request->getPost("corporatebuffer");
+        }
+        
+        if ($this->request->getPost("non_admissible_contingency_corporate_buffer_display")) {
+            $data['Non-Admissible / Contingency Corporate Buffer'] = $this->request->getPost("non_admissible_contingency_corporate_buffer");
+        }
+        
+        if ($this->request->getPost("ambulancecharges_display")) {
+            $data['Ambulance Charges'] = $this->request->getPost("ambulancecharges");
+        }
+        
+        if ($this->request->getPost("airambulance_display")) {
+            $data['Air Ambulance'] = $this->request->getPost("airambulance");
+        }
+        
+        if ($this->request->getPost("reasonableandcustomarycharges_display")) {
+            $data['Reasonable and Customary Charges'] = $this->request->getPost("reasonableandcustomarycharges");
+        }
+        
+        if ($this->request->getPost("daycaretreatment_display")) {
+            $data['Day Care Treatment'] = $this->request->getPost("daycaretreatment");
+        }
+        
+        if ($this->request->getPost("lasiksurgery_display")) {
+            $data['Lasik Surgery'] = $this->request->getPost("lasiksurgery");
+        }
+        
+        if ($this->request->getPost("ayushtreatmentcover_display")) {
+            $data['AYUSH treatment cover'] = $this->request->getPost("ayudhtreatmentcover");
+        }
+        
+        if ($this->request->getPost("moderntreatmentsasperirdai_display")) {
+            $data['Modern treatments as per IRDAI'] = $this->request->getPost("moderntreatmentsasperirdai");
+        }
+        
+        if ($this->request->getPost("opd_treatment_display")) {
+            $data['OPD Treatment'] = $this->request->getPost("opd_treatment");
+        }
+        
+        if ($this->request->getPost("days_of_discharge_display")) {
+            $data['Claim Intimation Clause'] = $this->request->getPost("days_of_discharge");
+        }
+        
+        if ($this->request->getPost("days_from_dod_display")) {
+            $data['Claim Submission'] = $this->request->getPost("days_from_dod");
+        }
+        
+        if ($this->request->getPost("terrorism_display")) {
+            $data['Terrorism'] = $this->request->getPost("terrorism");
+        }
+        
+        if ($this->request->getPost("widower_cover_display")) {
+            $data['Widower Cover'] = $this->request->getPost("widower_cover");
+        }
+        
+        if ($this->request->getPost("breavement_cover_display")) {
+            $data['Breavement Cover'] = $this->request->getPost("breavement_cover");
+        }
+
+        if(isset($data) && !empty($data)){
+            return $data;
+        }else{
+            $data = [];
+            return $data;
+        }
+    
+    }
+
     public function getterms()
     {
         $client_policy_id = $this->request->getVar('client_policy_id');
@@ -2479,52 +2621,32 @@ class ClientController extends AdminController
             $data['permanentTotalDisablement'] = str_replace(',', '', $this->request->getPost("permanentTotalDisablement"));
             $data['permanentPartialDisablement'] = $this->request->getPost("permanentPartialDisablement");
             $data['temporaryTotalDisablementBenefit'] = $this->request->getPost("temporaryTotalDisablementBenefit");
-            $data['accidentalHospitalizationExpenses'] = str_replace(',', '', $this->request->getPost("accidentalHospitalizationExpenses"));
-            $data['childrenEducationWelfareFund'] = str_replace(',', '', $this->request->getPost("childrenEducationWelfareFund"));
-
-            $data['compassionateVisitExpenses']   = $this->request->getPost("compassionateVisitExpenses");
-            if ($data['compassionateVisitExpenses'] == 1) {
-                $data['compassionateVisitExpensesData']   = $this->request->getPost("compassionateVisitExpensesData");
-            } else {
-                $data['compassionateVisitExpensesData']   = "";
-            }
-
-            $data['brokenBoneExpenses']   = str_replace(',', '', $this->request->getPost("brokenBoneExpenses"));
-            if ($data['brokenBoneExpenses'] == 1) {
-                $data['brokenBoneExpensesData']   = str_replace(',', '', $this->request->getPost("brokenBoneExpensesData"));
-            } else {
-                $data['brokenBoneExpensesData']   = "";
-            }
-
+            $data['medical_expenses_medical_extension'] = str_replace(',', '', $this->request->getPost("medical_expenses_medical_extension"));
+            $data['opd_treatment_cover'] = str_replace(',', '', $this->request->getPost("opd_treatment_cover"));
             $data['ambulanceCharges']   = str_replace(',', '', $this->request->getPost("ambulanceCharges"));
-            if ($data['ambulanceCharges'] == 1) {
-                $data['ambulanceChargesData']   = str_replace(',', '', $this->request->getPost("ambulanceChargesData"));
-            } else {
-                $data['ambulanceChargesData']   = "";
-            }
-
-            $data['burnExpenses']   = $this->request->getPost("burnExpenses");
-            if ($data['burnExpenses'] == 1) {
-                $data['burnExpensesData']   = $this->request->getPost("burnExpensesData");
-            } else {
-                $data['burnExpensesData']   = "";
-            }
-
-            $data['carriageOfDeadBody']   = $this->request->getPost("carriageOfDeadBody");
-            if ($data['carriageOfDeadBody'] == 1) {
-                $data['carriageOfDeadBodyData']   = $this->request->getPost("carriageOfDeadBodyData");
-            } else {
-                $data['carriageOfDeadBodyData']   = "";
-            }
-
-            $data['animalSnakeInsectBite'] = $this->request->getPost("animalSnakeInsectBite");
+            $data['repatriation_of_mortal_remains']   = str_replace(',', '', $this->request->getPost("repatriation_of_mortal_remains"));
+            $data['childrenEducationWelfareFund'] = str_replace(',', '', $this->request->getPost("childrenEducationWelfareFund"));
             $data['terrorism']             = $this->request->getPost("terrorism");
             $data['worldwideCover']        = $this->request->getPost("worldwideCover");
+            $data['family_transportation_benefits']        = $this->request->getPost("family_transportation_benefits");
+            $data['fractures_dislocation_burns']        = $this->request->getPost("fractures_dislocation_burns");
+            $data['coma']        = $this->request->getPost("coma");
+            $data['carriageOfDeadBody']   = $this->request->getPost("carriageOfDeadBody");
+            $data['compassionateVisitExpenses']   = $this->request->getPost("compassionateVisitExpenses");
+            $data['travel_expenses_for_medical_treatment']        = $this->request->getPost("travel_expenses_for_medical_treatment");
+            $data['daily_cash_allowance']        = $this->request->getPost("daily_cash_allowance");
+            $data['artifical_limb_and_prosthesis']        = $this->request->getPost("artifical_limb_and_prosthesis");
+            $data['animalSnakeInsectBite']        = $this->request->getPost("animalSnakeInsectBite");
+            $data['air_ambulance']        = $this->request->getPost("air_ambulance");
+
+
             $data['gpa_special_condition_label'] = str_replace(',', '', $this->request->getPost("gpa_special_condition_label")) ?? [];
             $data['gpa_special_condition_input'] = str_replace(',', '', $this->request->getPost("gpa_special_condition_input")) ?? [];
             $data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? [];
 
+            $data['enrollment_display_key'] = $this->enrollmentGPADisplayValueTransform();
 
+            // print_r($data); die;
 
             $jsonData = json_encode($data);
             $dataa = array(
@@ -2554,6 +2676,82 @@ class ClientController extends AdminController
         }
     }
 
+    public function enrollmentGPADisplayValueTransform()
+    {
+        if ($this->request->getPost("accidentalDeathBenefit_display")) {
+            $data['Accidental Death Benefit'] = $this->request->getPost("accidentalDeathBenefit");
+        }
+        if ($this->request->getPost("permanentTotalDisablement_display")) {
+            $data['Permanent Total Disablement'] = $this->request->getPost("permanentTotalDisablement");
+        }
+        if ($this->request->getPost("permanentPartialDisablement_display")) {
+            $data['Permanent Partial Disablement'] = $this->request->getPost("permanentPartialDisablement");
+        }
+        if ($this->request->getPost("temporaryTotalDisablementBenefit_display")) {
+            $data['Temporary Total Disablement Benefit'] = $this->request->getPost("temporaryTotalDisablementBenefit");
+        }
+        if ($this->request->getPost("medical_expenses_medical_extension_display")) {
+            $data['Medical Expenses / Medical Extension (IPD)'] = $this->request->getPost("medical_expenses_medical_extension");
+        }
+        if ($this->request->getPost("opd_treatment_cover_display")) {
+            $data['OPD Treatment Cover'] = $this->request->getPost("opd_treatment_cover");
+        }
+        if ($this->request->getPost("ambulanceCharges_display")) {
+            $data['Ambulance Charges'] = $this->request->getPost("ambulanceCharges");
+        }
+        if ($this->request->getPost("repatriation_of_mortal_remains_display")) {
+            $data['Repatriation of Mortal Remains'] = $this->request->getPost("repatriation_of_mortal_remains");
+        }
+        if ($this->request->getPost("childrenEducationWelfareFund_display")) {
+            $data['Children Education Welfare Fund'] = $this->request->getPost("childrenEducationWelfareFund");
+        }
+        if ($this->request->getPost("terrorism_display")) {
+            $data['Terrorism'] = $this->request->getPost("terrorism");
+        }
+        if ($this->request->getPost("worldwideCover_display")) {
+            $data['Worldwide Cover'] = $this->request->getPost("worldwideCover");
+        }
+        if ($this->request->getPost("family_transportation_benefits_display")) {
+            $data['Family Transportation Benefits'] = $this->request->getPost("family_transportation_benefits");
+        }
+        if ($this->request->getPost("fractures_dislocation_burns_display")) {
+            $data['Fractures / Dislocation / Burns'] = $this->request->getPost("fractures_dislocation_burns");
+        }
+        if ($this->request->getPost("coma_display")) {
+            $data['Coma'] = $this->request->getPost("coma");
+        }
+        if ($this->request->getPost("carriageofDeadBody_display")) {
+            $data['Carriage of Dead Body'] = $this->request->getPost("carriageOfDeadBody");
+        }
+        if ($this->request->getPost("compassionateVisitExpenses_display")) {
+            $data['Compassionate Visit Expenses'] = $this->request->getPost("compassionateVisitExpenses");
+        }
+        if ($this->request->getPost("travel_expenses_for_medical_treatment_display")) {
+            $data['Travel expenses for Medical Treatment'] = $this->request->getPost("travel_expenses_for_medical_treatment");
+        }
+        if ($this->request->getPost("daily_cash_allowance_display")) {
+            $data['Daily cash Allowance'] = $this->request->getPost("daily_cash_allowance");
+        }
+        if ($this->request->getPost("artifical_limb_and_prosthesis_display")) {
+            $data['Artifical Limb and Prosthesis'] = $this->request->getPost("artifical_limb_and_prosthesis");
+        }
+        if ($this->request->getPost("animalSnakeInsectBite_display")) {
+            $data['Animal/Snake/Insect Bite'] = $this->request->getPost("animalSnakeInsectBite");
+        }
+        if ($this->request->getPost("air_ambulance_display")) {
+            $data['Air Ambulance'] = $this->request->getPost("air_ambulance");
+        }
+
+        // print_r($data); die;
+
+        if (isset($data) && !empty($data)) {
+            return $data;
+        } else {
+            $data = [];
+            return $data;
+        }
+    }
+
     public function getPolicyGPATerms()
     {
 
@@ -3161,7 +3359,6 @@ class ClientController extends AdminController
 
     public function createPolicyTermsHtmlAsJSON()
     {
-
         echo 'hi';
     }
 
@@ -3823,7 +4020,9 @@ class ClientController extends AdminController
 
         $query = $this->clientPolicyModel
             ->where("policy_terms IS NOT NULL AND policy_terms <> ''")
+            ->where('policy_type_id', 2)
             ->where('is_active', 1);
+
         
         if (!empty($client_id)) {
             $query->where('client_id', $client_id);
@@ -3833,6 +4032,8 @@ class ClientController extends AdminController
         
         for ($i = 0; $i < count($data); $i++) {
 
+            // dd($data[$i]);
+
             if (isset($data[$i]['policy_terms']) && !empty($data[$i]['policy_terms'])) {
                 $policyTerms = json_decode($data[$i]['policy_terms'], true);
             } else {
@@ -3955,6 +4156,14 @@ class ClientController extends AdminController
                 );
             }
 
+            foreach ($policyTerms as $key => $term) {
+                if ($term == "0") {
+                    $policyTerms[$key] = "No";  // Use = for assignment
+                } elseif ($term == "1") {
+                    $policyTerms[$key] = "Yes"; // Use = for assignment
+                }
+            }
+
             if(in_array($data[$i]['policy_type_id'], [2,3,4,5])){
 
                 if (!isset($policyTerms['waiver_of_90_days_waiting_period'])) {
@@ -4002,7 +4211,7 @@ class ClientController extends AdminController
                 }
                 
                 if (!isset($policyTerms['enrollment_display_key'])) {
-                    $policyTerms['enrollment_display_key'] = [];
+                    $policyTerms['enrollment_display_key'] = $this->existingGMCDisplayValueTransform($policyTerms);
                 }
 
             } else if($data[$i]['policy_type_id'] == 1){
@@ -4053,25 +4262,257 @@ class ClientController extends AdminController
                 
             }
 
-            foreach ($policyTerms as $key => $term) {
-                if ($term == "0") {
-                    $policyTerms[$key] = "No";  // Use = for assignment
-                } elseif ($term == "1") {
-                    $policyTerms[$key] = "Yes"; // Use = for assignment
-                }
-            }
+ 
             
 
             // dd($policyTerms);
             // Re-encode the ordered policy terms
             $updatedPolicyTerms = json_encode($policyTerms);
-            // dd($updatedPolicyTerms);
+            dd($updatedPolicyTerms);
 
             // dd($orderedPolicyTerms, $updatedPolicyTerms);
             $this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]);
         }
     }
 
+    public function existingGMCDisplayValueTransform($data)
+    {
+        $transformedData = [];
+
+        if (isset($data["waiverofpreexistingdiseases"])) {
+            $transformedData['Waiver of Pre-existing Diseases'] = $data["waiverofpreexistingdiseases"];
+        }
+
+        if (isset($data["waiverof1,2,3&4thyearexclusions"])) {
+            $transformedData['Waiver of 1, 2, 3 & 4th year Exclusions'] = $data["waiverof1,2,3&4thyearexclusions"];
+        }
+
+        if (isset($data["waiverof30dayswaitingperiod"])) {
+            $transformedData['Waiver of 30 days waiting period'] = $data["waiverof30dayswaitingperiod"];
+        }
+
+        if (isset($data["waiver_of_90_days_waiting_period"])) {
+            $transformedData['Waiver of 90 Days Waiting Period'] = $data["waiver_of_90_days_waiting_period"];
+        }
+
+        if (isset($data["waiver_of_other_waiting_periods"])) {
+            $transformedData['Waiver of Other Waiting Periods'] = $data["waiver_of_other_waiting_periods"];
+        }
+
+        if (isset($data["maternity_benefit"])) {
+            $transformedData['Maternity Benefit'] = $data["maternity_benefit"];
+        }
+
+        if (isset($data["9monthwaitingperiodwaived"])) {
+            $transformedData['9-month waiting Period - waived'] = $data["9monthwaitingperiodwaived"];
+        }
+
+        if (isset($data["maternitycoverage"])) {
+            $transformedData['Maternity Coverage'] = $data["maternitycoverage"];
+        }
+
+        if (isset($data["twindelivery"])) {
+            $transformedData['Twin Delivery'] = $data["twindelivery"];
+        }
+
+        if (isset($data["well_baby_well_mother_expenses"])) {
+            $transformedData['Well baby / Well Mother Expenses'] = $data["well_baby_well_mother_expenses"];
+        }
+
+        if (isset($data["preandpostnatal"])) {
+            $transformedData['Pre and Post natal'] = $data["preandpostnatal"];
+        }
+
+        if (isset($data["infertility_treatment_coverage"])) {
+            $transformedData['Infertility Treatment Coverage'] = $data["infertility_treatment_coverage"];
+        }
+
+        if (isset($data["babyday1cover"])) {
+            $transformedData['Baby Day 1 Cover'] = $data["babyday1cover"];
+        }
+
+        if (isset($data["coverfromthedateofjoining"])) {
+            $transformedData['Cover from the date of Joining'] = $data["coverfromthedateofjoining"];
+        }
+
+        if (isset($data["mid_term_addition_of_new_born_newly_wedded_spouse"])) {
+            $transformedData['Mid Term Addition of New Born / Newly Wedded Spouse'] = $data["mid_term_addition_of_new_born_newly_wedded_spouse"];
+        }
+
+        if (isset($data["prehospitalizationcover"])) {
+            $transformedData['Pre Hospitalization Cover'] = $data["prehospitalizationcover"];
+        }
+
+        if (isset($data["posthospitalizationcover"])) {
+            $transformedData['Post Hospitalization Cover'] = $data["posthospitalizationcover"];
+        }
+
+        if (isset($data["congenitaldiseasesinternal"])) {
+            $transformedData['Congenital Diseases - Internal'] = $data["congenitaldiseasesinternal"];
+        }
+
+        if (isset($data["congenitaldiseasesexternal"])) {
+            $transformedData['Congenital Diseases - External'] = $data["congenitaldiseasesexternal"];
+        }
+
+        if (isset($data["copayzonewisecopay"])) {
+            $transformedData['Co-Pay/Zone wise Co Pay'] = $data["copayzonewisecopay"];
+        }
+
+        if (isset($data["roomrentlimit"])) {
+            $transformedData['Room Rent Limit'] = $data["roomrentlimit"];
+        }
+
+        if (isset($data["icu_limit"])) {
+            $transformedData['ICU Limit'] = $data["icu_limit"];
+        }
+
+        if (isset($data["proportionatedeductionclause"])) {
+            $transformedData['Proportionate Deduction Clause'] = $data["proportionatedeductionclause"];
+        }
+
+        if (isset($data["ailmentcapping"])) {
+            $transformedData['Ailment capping'] = $data["ailmentcapping"];
+        }
+
+        if (isset($data["ailment_capping_details"])) {
+            $transformedData['Ailment capping Details'] = $data["ailment_capping_details"];
+        }
+
+        if (isset($data["corporatebuffer"])) {
+            $transformedData['Corporate Buffer'] = $data["corporatebuffer"];
+        }
+
+        if (isset($data["non_admissible_contingency_corporate_buffer"])) {
+            $transformedData['Non-Admissible / Contingency Corporate Buffer'] = $data["non_admissible_contingency_corporate_buffer"];
+        }
+
+        if (isset($data["ambulancecharges"])) {
+            $transformedData['Ambulance Charges'] = $data["ambulancecharges"];
+        }
+
+        if (isset($data["airambulance"])) {
+            $transformedData['Air Ambulance'] = $data["airambulance"];
+        }
+
+        if (isset($data["reasonableandcustomarycharges"])) {
+            $transformedData['Reasonable and Customary Charges'] = $data["reasonableandcustomarycharges"];
+        }
+
+        if (isset($data["daycaretreatment"])) {
+            $transformedData['Day Care Treatment'] = $data["daycaretreatment"];
+        }
+
+        if (isset($data["lasiksurgery"])) {
+            $transformedData['Lasik Surgery'] = $data["lasiksurgery"];
+        }
+
+        if (isset($data["ayushtreatmentcover"])) {
+            $transformedData['AYUSH treatment cover'] = $data["ayushtreatmentcover"];
+        }
+
+        if (isset($data["moderntreatmentsasperirdai"])) {
+            $transformedData['Modern treatments as per IRDAI'] = $data["moderntreatmentsasperirdai"];
+        }
+
+        if (isset($data["opd_treatment"])) {
+            $transformedData['OPD Treatment'] = $data["opd_treatment"];
+        }
+
+        if (isset($data["days_of_discharge"])) {
+            $transformedData['Claim Intimation Clause'] = $data["days_of_discharge"];
+        }
+
+        if (isset($data["days_from_dod"])) {
+            $transformedData['Claim Submission'] = $data["days_from_dod"];
+        }
+
+        if (isset($data["terrorism"])) {
+            $transformedData['Terrorism'] = $data["terrorism"];
+        }
+
+        if (isset($data["widower_cover"])) {
+            $transformedData['Widower Cover'] = $data["widower_cover"];
+        }
+
+        if (isset($data["breavement_cover"])) {
+            $transformedData['Breavement Cover'] = $data["breavement_cover"];
+        }
+
+        return !empty($transformedData) ? $transformedData : [];
+    }
+
+    public function existingGPADisplayValueTransform($data)
+    {   
+        $transformedData = [];
+
+        if ($data["accidentalDeathBenefit"]) {
+            $transformedData['Accidental Death Benefit'] = $data["accidentalDeathBenefit"];
+        }
+        if ($data["permanentTotalDisablement"]) {
+            $transformedData['Permanent Total Disablement'] = $data["permanentTotalDisablement"];
+        }
+        if ($data["permanentPartialDisablement"]) {
+            $transformedData['Permanent Partial Disablement'] = $data["permanentPartialDisablement"];
+        }
+        if ($data["temporaryTotalDisablementBenefit"]) {
+            $transformedData['Temporary Total Disablement Benefit'] = $data["temporaryTotalDisablementBenefit"];
+        }
+        if ($data["medical_expenses_medical_extension"]) {
+            $transformedData['Medical Expenses / Medical Extension (IPD)'] = $data["medical_expenses_medical_extension"];
+        }
+        if ($data["opd_treatment_cover"]) {
+            $transformedData['OPD Treatment Cover'] = $data["opd_treatment_cover"];
+        }
+        if ($data["ambulanceCharges"]) {
+            $transformedData['Ambulance Charges'] = $data["ambulanceCharges"];
+        }
+        if ($data["repatriation_of_mortal_remains"]) {
+            $transformedData['Repatriation of Mortal Remains'] = $data["repatriation_of_mortal_remains"];
+        }
+        if ($data["childrenEducationWelfareFund"]) {
+            $transformedData['Children Education Welfare Fund'] = $data["childrenEducationWelfareFund"];
+        }
+        if ($data["terrorism"]) {
+            $transformedData['Terrorism'] = $data["terrorism"];
+        }
+        if ($data["worldwideCover"]) {
+            $transformedData['Worldwide Cover'] = $data["worldwideCover"];
+        }
+        if ($data["family_transportation_benefits"]) {
+            $transformedData['Family Transportation Benefits'] = $data["family_transportation_benefits"];
+        }
+        if ($data["fractures_dislocation_burns"]) {
+            $transformedData['Fractures / Dislocation / Burns'] = $data["fractures_dislocation_burns"];
+        }
+        if ($data["coma"]) {
+            $transformedData['Coma'] = $data["coma"];
+        }
+        if ($data["carriageofDeadBody"]) {
+            $transformedData['Carriage of Dead Body'] = $data["carriageofDeadBody"];
+        }
+        if ($data["compassionateVisitExpenses"]) {
+            $transformedData['Compassionate Visit Expenses'] = $data["compassionateVisitExpenses"];
+        }
+        if ($data["travel_expenses_for_medical_treatment"]) {
+            $transformedData['Travel expenses for Medical Treatment'] = $data["travel_expenses_for_medical_treatment"];
+        }
+        if ($data["daily_cash_allowance"]) {
+            $transformedData['Daily cash Allowance'] = $data["daily_cash_allowance"];
+        }
+        if ($data["artifical_limb_and_prosthesis"]) {
+            $transformedData['Artifical Limb and Prosthesis'] = $data["artifical_limb_and_prosthesis"];
+        }
+        if ($data["animalSnakeInsectBite"]) {
+            $transformedData['Animal/Snake/Insect Bite'] = $data["animalSnakeInsectBite"];
+        }
+        if ($data["air_ambulance"]) {
+            $transformedData['Air Ambulance'] = $data["air_ambulance"];
+        }
+
+        return !empty($transformedData) ? $transformedData : [];
+    }
+
     public function updateRemainderDate()
     {
         // Connect to the database and fetch the data
@@ -4471,85 +4912,6 @@ class ClientController extends AdminController
     // -----------------------------------------------------------------------------------------------------
 
 
-
-    // private function preparePolicyData($renewalData)
-    // {   
-    //     $data = [
-    //         'issuer' => $renewalData['issuer_type_id'],
-    //         'client_id' => $renewalData['client_id'],
-    //         'client_branch_id' => $renewalData['branch_id'] ?? null,
-    //         'vehicle_id' => $renewalData['vehicle_id'],
-    //         'insurer_id' => $renewalData['insurer_id'],
-    //         'insurer_branch_id' => $renewalData['insurer_branch_id'],
-    //         'policy_type_id' => $renewalData['policy_type_id'],
-    //         'client_policy_id' => $renewalData['client_policy_id'] ?? null,
-    //         'policy_no' => $renewalData['policy_no'],
-    //         'policy_issue_date' => $renewalData['date_date_of_issue'],
-    //         'policy_start_date' => $renewalData['date_policy_start_date'],
-    //         'policy_end_date' => $renewalData['date_policy_end_date'],
-    //         'policy_holder_name' => $renewalData['insured'],
-    //         'status' => 'completed',
-    //         'is_active' => 1,
-    //         'tsi' => '500000',
-    //         'month' => '2025-02-01',
-    //         'ct_type' => 1,
-    //         'cd_ac_pk' => $renewalData['cd_ac_pk'] ?? null,
-    //     ];
-
-    //     $policyTransactionModel = new PolicyTransactionModel();
-    //     return $policyTransactionModel->insert($data);
-    // }
-
-    // private function prepareVehicleData($renewalData)
-    // {   
-    //     $vehicleData = [
-    //         'vehicle_no' => $renewalData['veh_no'],
-    //         'owner' => $renewalData['client_id'],
-    //         'branch_id' => ($renewalData['client_type_id'] == 1) ? $renewalData['branch_id'] : null,
-    //     ];
-
-    //     $vehicleModel = new VehicleModel();
-    //     return $vehicleModel->insert($vehicleData);
-    // }
-
-    // private function preparePtCoShareDetails($renewalData)
-    // {   
-    //     $ptCoShareDetails = [
-    //         'pt_id' => $renewalData['pt_id'],
-    //         'insurer_id' => $renewalData['insurer_id'],
-    //         'insurer_branch_id' => $renewalData['insurer_branch_id'],
-    //         'co_share_type' => 0,
-    //         'co_share_per' => 0.00,
-    //         'bp_amt' => 0.00,
-    //         'tp_amt' => 0.00,
-    //         'tep_amt' => 0.00,
-    //         'follower_policy_no' => $renewalData['policy_no'],
-    //     ];
-
-    //     $ptCoShareDetailsModel = new PTCOShareDetailsModel();
-    //     return $ptCoShareDetailsModel->insert($ptCoShareDetails);
-    // }
-
-    // private function prepareClientPolicy($renewalData)
-    // {
-    //     $clientPolicy = [
-    //         'client_id' => $renewalData['client_id'],
-    //         'client_branch_id' => $renewalData['branch_id'],
-    //         'policy_type_id' => $renewalData['policy_type_id'],
-    //         'insurer_id' => $renewalData['insurer_id'],
-    //         'insurer_branch_id' => $renewalData['insurer_branch_id'],
-    //         'policy_no' => $renewalData['policy_no'],
-    //         'policy_start_date' => $renewalData['date_policy_start_date'],
-    //         'policy_end_date' => $renewalData['date_policy_end_date'],
-    //         'policy_status' => 1,
-    //         'gst' => 18.00,
-    //         'cd_ac_pk' => $renewalData['cd_ac_pk'],
-    //     ];
-
-    //     $clientPolicyModel = new ClientPolicyModel();
-    //     return $clientPolicyModel->insert($clientPolicy);
-    // }
-
     public function updateRenewalData()
     {
         $db = db_connect();
@@ -4557,7 +4919,7 @@ class ClientController extends AdminController
         ->where('client_id IS NOT NULL')
         ->where('is_inserted != 1')
         ->get()
-        ->getResultArray();
+            ->getResultArray();
         // dd($renewalData);
 
         $successData = [];
@@ -4588,14 +4950,15 @@ class ClientController extends AdminController
         }
 
         kint::dump($successData);
-    }   
+    }
+
     public function updateRenewalInsurerData()
     {
         $db = db_connect();
         $renewalData = $db->table('old_renewal_data_copy')
         ->where('insurer_id IS NULL')
         ->get()
-        ->getResultArray();
+            ->getResultArray();
         // dd($renewalData);
 
         $successData = [];
@@ -4603,39 +4966,39 @@ class ClientController extends AdminController
 
             $insurer_data = $this->insurerModel->where('name', $value['insurer_name'])->where('is_active', 1)->first();
 
-            if(!empty($insurer_data)){
+            if (!empty($insurer_data)) {
 
                 $insurer_branch_data = $this->insurerBranchModel->where('branch_name', $value['insurer_branch'])->first();
-                if(!empty($insurer_branch_data)){
+                if (!empty($insurer_branch_data)) {
                     $branch = $this->insurerBranchModel->where('insurer_id', $insurer_data['id'] ?? 0)->first();
                     $value['insurer_id'] = $insurer_data['id'] ?? null;
                     $value['insurer_branch_id'] = $branch['id'] ?? null;
-                }else{
+                } else {
                     $value['insurer_id'] = $insurer_data['id'] ?? null;
                     $value['insurer_branch_id'] = $this->prepareInsurerBranch($value);
                 }
-            }else{
+            } else {
                 $value['insurer_id'] = $this->prepareinsurer($value);
                 $value['insurer_branch_id'] = $this->prepareInsurerBranch($value);
             }
 
             // Update is_inserted field in DB
             $db->table('old_renewal_data_copy')
-                ->where('id', $value['id'])
-                ->set([
-                    'insurer_id' => $value['insurer_id'],
-                    'insurer_branch_id' => $value['insurer_branch_id'],
-                ])
+            ->where('id', $value['id'])
+            ->set([
+                'insurer_id' => $value['insurer_id'],
+                'insurer_branch_id' => $value['insurer_branch_id'],
+            ])
                 ->update();
 
-            $successData[] = ['id' => $value['id'], 'insurer' => $value['insurer_name'], 'insurer_id' => $value['insurer_id'], 'insurer_branch_id' => $value['insurer_branch_id'], ];
+            $successData[] = ['id' => $value['id'], 'insurer' => $value['insurer_name'], 'insurer_id' => $value['insurer_id'], 'insurer_branch_id' => $value['insurer_branch_id'],];
         }
 
         kint::dump($successData);
-    }   
-    
+    }
+
     public function updateRenewalDataNotExistingClient()
-    {   
+    {
         $limit = $this->request->getGet('limit') ?? 10;
         $group = $this->request->getGet('group') ?? 2;
         $db = db_connect();
@@ -4643,22 +5006,22 @@ class ClientController extends AdminController
         ->where('client_id IS NULL')
         ->where('is_inserted = 0')
         ->where('client_type_id', $group)
-        // ->limit($limit)
-        ->get()
-        ->getResultArray();
+            // ->limit($limit)
+            ->get()
+            ->getResultArray();
         // dd($renewalData);
 
         $successData = [];
         foreach ($renewalData as $key => $value) {
 
             $client_data = $this->clientModel->where('client_name', $value['insured'])->where('is_active', 1)->first();
-            if(!empty($client_data)){
+            if (!empty($client_data)) {
                 $branch = $this->clientBranchModel->where('client_id', $client_data['id'] ?? 0)->first();
                 $value['branch_id'] = $branch['id'] ?? null;
                 $value['client_id'] = $client_data['id'] ?? null;
-            }else{
+            } else {
                 $value['client_id'] = $this->prepareClient($value);
-                if($value['client_type_id'] == 1){
+                if ($value['client_type_id'] == 1) {
                     $value['branch_id'] = $this->prepareClientBranch($value);
                 }
             }
@@ -4666,7 +5029,7 @@ class ClientController extends AdminController
             // Fix vehicle_id key (previously "vehicel_id")
             if ($value['policy_type_id'] == 8 && !empty($value['policy_type_id'])) {
                 $value['vehicle_id'] = $this->prepareVehicleData($value);
-            }else{
+            } else {
                 $value['vehicle_id'] = 0;
             }
 
@@ -4759,7 +5122,7 @@ class ClientController extends AdminController
     }
 
     private function prepareVehicleData($renewalData)
-    {   
+    {
         $VehicleModel = new VehicleModel();
 
         if ($renewalData['client_type_id'] == 1) {
@@ -4767,16 +5130,16 @@ class ClientController extends AdminController
         } else {
             $veh_no = $renewalData['insured'] . "_veh_no";
         }
-        
+
         $vehicleData = $VehicleModel->where('owner', $renewalData['client_id'])
-                                          ->where('is_active', 1)
-                                          ->findAll();
-        
+        ->where('is_active', 1)
+        ->findAll();
+
         if (!empty($vehicleData)) {
             $increment = count($vehicleData);
             $veh_no = $increment . "_" . $veh_no;
         }
-        
+
 
         $vehicleData = [
             'vehicle_no' => $veh_no,
@@ -4889,7 +5252,7 @@ class ClientController extends AdminController
     }
 
     private function prepareClientBranch($renewalData)
-    {   
+    {
         $branch_code = "BRANCH001";
         $short_name = explode(" ", $renewalData['insured'])[0];
         $unit = $short_name . " - " . $branch_code;
@@ -4905,11 +5268,11 @@ class ClientController extends AdminController
             'address1' => null,
             'address2' => null,
             'gst' => null,
-            'sez' => 0, 
-            'is_active' => 1, 
+            'sez' => 0,
+            'is_active' => 1,
             'units' => $unit
         ];
-        
+
 
         $ClientBranchModel = new ClientBranchModel();
         $id = $ClientBranchModel->insert($clientBranchData);
@@ -4917,11 +5280,11 @@ class ClientController extends AdminController
     }
 
     private function prepareClient($renewalData)
-    {   
+    {
 
-        if($renewalData['client_type_id'] == 1){
+        if ($renewalData['client_type_id'] == 1) {
             $short_name = explode(" ", $renewalData['insured'])[0];
-        }else{
+        } else {
             $short_name = $renewalData['insured'];
         }
 
@@ -4957,8 +5320,8 @@ class ClientController extends AdminController
             'email' => null,
             'addon_subheading' => null
         ];
-        
-        
+
+
 
         $ClientModel = new ClientModel();
         $id = $ClientModel->insert($clientData);
@@ -4966,7 +5329,7 @@ class ClientController extends AdminController
     }
 
     private function prepareInsurerBranch($renewalData)
-    {   
+    {
 
         $insurerBranchData = [
             'insurer_id' =>  $renewalData['insurer_id'],
@@ -4979,8 +5342,8 @@ class ClientController extends AdminController
             'state' => null,
             'pincode' => null,
         ];
-        
-        
+
+
 
         $InsurerBranchModel = new InsurerBranchModel();
         $id = $InsurerBranchModel->insert($insurerBranchData);
@@ -4988,7 +5351,7 @@ class ClientController extends AdminController
     }
 
     private function prepareinsurer($renewalData)
-    {   
+    {
 
         $short_name1 = explode(" ", $renewalData['insurer_name'])[0];
         $short_name2 = explode(" ", $renewalData['insurer_name'])[1];
@@ -4997,14 +5360,14 @@ class ClientController extends AdminController
         $insurerData = [
             'type' => "pvt",
             'category' => "general",
-            'addition_add_day' => 0,  
-            'deletion_add_day' => 0, 
+            'addition_add_day' => 0,
+            'deletion_add_day' => 0,
             'name' => $renewalData['insurer_name'],
             'short_name' =>  $short_name,
             'insurer_logo' => null,
             'is_multi_event' => 0, // Default is 0
         ];
-    
+
         $InsurerModel = new InsurerModel();
         $id = $InsurerModel->insert($insurerData);
         return $id;
diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
index c885edf2..8d6b1d3d 100755
--- a/app/Controllers/EmployeeRestController.php
+++ b/app/Controllers/EmployeeRestController.php
@@ -2539,8 +2539,15 @@ class EmployeeRestController extends AdminController
                 if($ClientPolicyValue['policy_type_id'] == 1)
                 { 
                     $data['policy_terms'] =  $this->policyTermsFiter($terms,'gpa'); 
+                    $data['department_id'] = 2;
+
+                }else if($ClientPolicyValue['policy_type_id'] == 2){ 
+                    $data['policy_terms'] =  $this->policyTermsFiter($terms,'gmc'); 
+                    $data['department_id'] = 1;
+                }else if($ClientPolicyValue['policy_type_id'] == 6){ 
+                    $data['policy_terms'] =  $this->policyTermsFiter($terms,'gmc'); 
                     $data['department_id'] = 3;
-                }else{ 
+                }else if($ClientPolicyValue['policy_type_id'] == 7){ 
                     $data['policy_terms'] =  $this->policyTermsFiter($terms,'gmc'); 
                     $data['department_id'] = 4;
                 }
@@ -2720,9 +2727,7 @@ class EmployeeRestController extends AdminController
         }
 
 
-       
-    
-    return $finalarray;
+        return $finalarray;
         
     }
 

From 2f1d0549a55735bfaa06bc431c21caaa376d7c2f Mon Sep 17 00:00:00 2001
From: "venkatesh.r" 
Date: Fri, 21 Feb 2025 12:08:01 +0530
Subject: [PATCH 05/21] FIX_CLAIMS_API : RV

---
 app/Controllers/EmployeeRestController.php | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
index 8d6b1d3d..be1f3532 100755
--- a/app/Controllers/EmployeeRestController.php
+++ b/app/Controllers/EmployeeRestController.php
@@ -2540,16 +2540,18 @@ class EmployeeRestController extends AdminController
                 { 
                     $data['policy_terms'] =  $this->policyTermsFiter($terms,'gpa'); 
                     $data['department_id'] = 2;
-
-                }else if($ClientPolicyValue['policy_type_id'] == 2){ 
+                }else if($ClientPolicyValue['policy_type_id'] == 6)
+                { 
+                    $data['policy_terms'] =  $this->policyTermsFiter($terms,'gpa'); 
+                    $data['department_id'] = 3;
+                }else if($ClientPolicyValue['policy_type_id'] == 7)
+                { 
+                    $data['policy_terms'] =  $this->policyTermsFiter($terms,'gpa'); 
+                    $data['department_id'] = 4;
+                }else
+                {
                     $data['policy_terms'] =  $this->policyTermsFiter($terms,'gmc'); 
                     $data['department_id'] = 1;
-                }else if($ClientPolicyValue['policy_type_id'] == 6){ 
-                    $data['policy_terms'] =  $this->policyTermsFiter($terms,'gmc'); 
-                    $data['department_id'] = 3;
-                }else if($ClientPolicyValue['policy_type_id'] == 7){ 
-                    $data['policy_terms'] =  $this->policyTermsFiter($terms,'gmc'); 
-                    $data['department_id'] = 4;
                 }
             
                 $data['client_id'] = $ClientPolicyValue['client_id'];

From f03377c1968dbbd2de65dfaf251a748dc720b5c7 Mon Sep 17 00:00:00 2001
From: "venkatesh.r" 
Date: Fri, 21 Feb 2025 14:53:06 +0530
Subject: [PATCH 06/21] FIX_CLAIM_API_AND_TERMS_SCRIPT ; RV

---
 app/Controllers/ClientController.php       |  55 +++++-----
 app/Controllers/EmployeeRestController.php | 113 +++++++++++----------
 2 files changed, 89 insertions(+), 79 deletions(-)

diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php
index e625fb84..35983994 100755
--- a/app/Controllers/ClientController.php
+++ b/app/Controllers/ClientController.php
@@ -4017,10 +4017,10 @@ class ClientController extends AdminController
     public function updatePolicyTermsKey()
     {
         $client_id = $this->request->getGet('client_id');
+        $policy_type_id = $this->request->getGet('policy_type_id');
 
         $query = $this->clientPolicyModel
             ->where("policy_terms IS NOT NULL AND policy_terms <> ''")
-            ->where('policy_type_id', 2)
             ->where('is_active', 1);
 
         
@@ -4028,6 +4028,10 @@ class ClientController extends AdminController
             $query->where('client_id', $client_id);
         }
         
+        if (!empty($policy_type_id)) {
+            $query->where('policy_type_id', $policy_type_id);
+        }
+        
         $data = $query->findAll();
         
         for ($i = 0; $i < count($data); $i++) {
@@ -4257,14 +4261,11 @@ class ClientController extends AdminController
                 }
                                 
                 if (!isset($policyTerms['enrollment_display_key'])) {
-                    $policyTerms['enrollment_display_key'] = [];
+                    $policyTerms['enrollment_display_key'] = $this->existingGPADisplayValueTransform($policyTerms);
                 }
                 
             }
 
- 
-            
-
             // dd($policyTerms);
             // Re-encode the ordered policy terms
             $updatedPolicyTerms = json_encode($policyTerms);
@@ -4446,67 +4447,67 @@ class ClientController extends AdminController
     {   
         $transformedData = [];
 
-        if ($data["accidentalDeathBenefit"]) {
+        if (isset($data["accidentalDeathBenefit"])) {
             $transformedData['Accidental Death Benefit'] = $data["accidentalDeathBenefit"];
         }
-        if ($data["permanentTotalDisablement"]) {
+        if (isset($data["permanentTotalDisablement"])) {
             $transformedData['Permanent Total Disablement'] = $data["permanentTotalDisablement"];
         }
-        if ($data["permanentPartialDisablement"]) {
+        if (isset($data["permanentPartialDisablement"])) {
             $transformedData['Permanent Partial Disablement'] = $data["permanentPartialDisablement"];
         }
-        if ($data["temporaryTotalDisablementBenefit"]) {
+        if (isset($data["temporaryTotalDisablementBenefit"])) {
             $transformedData['Temporary Total Disablement Benefit'] = $data["temporaryTotalDisablementBenefit"];
         }
-        if ($data["medical_expenses_medical_extension"]) {
+        if (isset($data["medical_expenses_medical_extension"])) {
             $transformedData['Medical Expenses / Medical Extension (IPD)'] = $data["medical_expenses_medical_extension"];
         }
-        if ($data["opd_treatment_cover"]) {
+        if (isset($data["opd_treatment_cover"])) {
             $transformedData['OPD Treatment Cover'] = $data["opd_treatment_cover"];
         }
-        if ($data["ambulanceCharges"]) {
+        if (isset($data["ambulanceCharges"])) {
             $transformedData['Ambulance Charges'] = $data["ambulanceCharges"];
         }
-        if ($data["repatriation_of_mortal_remains"]) {
+        if (isset($data["repatriation_of_mortal_remains"])) {
             $transformedData['Repatriation of Mortal Remains'] = $data["repatriation_of_mortal_remains"];
         }
-        if ($data["childrenEducationWelfareFund"]) {
+        if (isset($data["childrenEducationWelfareFund"])) {
             $transformedData['Children Education Welfare Fund'] = $data["childrenEducationWelfareFund"];
         }
-        if ($data["terrorism"]) {
+        if (isset($data["terrorism"])) {
             $transformedData['Terrorism'] = $data["terrorism"];
         }
-        if ($data["worldwideCover"]) {
+        if (isset($data["worldwideCover"])) {
             $transformedData['Worldwide Cover'] = $data["worldwideCover"];
         }
-        if ($data["family_transportation_benefits"]) {
+        if (isset($data["family_transportation_benefits"])) {
             $transformedData['Family Transportation Benefits'] = $data["family_transportation_benefits"];
         }
-        if ($data["fractures_dislocation_burns"]) {
+        if (isset($data["fractures_dislocation_burns"])) {
             $transformedData['Fractures / Dislocation / Burns'] = $data["fractures_dislocation_burns"];
         }
-        if ($data["coma"]) {
-            $transformedData['Coma'] = $data["coma"];
+        if (isset($data["coma"])) {
+            $transformedData['Coma'] = $data["coma"]; 
         }
-        if ($data["carriageofDeadBody"]) {
+        if (isset($data["carriageofDeadBody"])) {
             $transformedData['Carriage of Dead Body'] = $data["carriageofDeadBody"];
         }
-        if ($data["compassionateVisitExpenses"]) {
+        if (isset($data["compassionateVisitExpenses"])) {
             $transformedData['Compassionate Visit Expenses'] = $data["compassionateVisitExpenses"];
         }
-        if ($data["travel_expenses_for_medical_treatment"]) {
+        if (isset($data["travel_expenses_for_medical_treatment"])) {
             $transformedData['Travel expenses for Medical Treatment'] = $data["travel_expenses_for_medical_treatment"];
         }
-        if ($data["daily_cash_allowance"]) {
+        if (isset($data["daily_cash_allowance"])) {
             $transformedData['Daily cash Allowance'] = $data["daily_cash_allowance"];
         }
-        if ($data["artifical_limb_and_prosthesis"]) {
+        if (isset($data["artifical_limb_and_prosthesis"])) {
             $transformedData['Artifical Limb and Prosthesis'] = $data["artifical_limb_and_prosthesis"];
         }
-        if ($data["animalSnakeInsectBite"]) {
+        if (isset($data["animalSnakeInsectBite"])) {
             $transformedData['Animal/Snake/Insect Bite'] = $data["animalSnakeInsectBite"];
         }
-        if ($data["air_ambulance"]) {
+        if (isset($data["air_ambulance"])) {
             $transformedData['Air Ambulance'] = $data["air_ambulance"];
         }
 
diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
index be1f3532..52bf789b 100755
--- a/app/Controllers/EmployeeRestController.php
+++ b/app/Controllers/EmployeeRestController.php
@@ -3157,72 +3157,81 @@ class EmployeeRestController extends AdminController
         where emp.id = $employee_id and emp.is_active = 1 and emp.emp_status = 'active'
         limit 1 ";
 
-        $fetchData = $this->employeeModel->query($sql)->getResultArray()[0];
-        $fetchData['claim_status_id'] =  $this->claimStatusModel
-            ->select('id')
-            ->where('ticket_type', $fetchData['ticket_type_id'])
-            ->orderBy('id', 'asc')
-            ->first()['id'];
+        $emp_ticket_data = $this->employeeModel->query($sql)->getResultArray();
+        // print_r(db_connect()->getLastQuery()); die;
 
-        $fetchData['priority'] = 1;
-        $fetchData['mode_of_intimation'] = 1;
-        $fetchData = array_merge($fetchData, $received_data);
+        if(!empty($emp_ticket_data)){
 
-        // print_r($fetchData); die;
-        $insert_status = $this->ticketMaster->insert($fetchData);
-        $ticket_id = $this->ticketMaster->insertID();
+            $fetchData = $emp_ticket_data[0];
+            $fetchData['claim_status_id'] =  $this->claimStatusModel
+                ->select('id')
+                ->where('ticket_type', $fetchData['ticket_type_id'])
+                ->orderBy('id', 'asc')
+                ->first()['id'];
 
-        if ($insert_status && !empty($ticket_id)) {
+            $fetchData['priority'] = 1;
+            $fetchData['mode_of_intimation'] = 1;
+            $fetchData = array_merge($fetchData, $received_data);
 
-            $messagesData = [
-                'ticket_id' => $ticket_id ?? null,
-                'sender' => 'user',
-                'claim_status' => $fetchData['claim_status_id'] ?? null,
-                'emp_mail' => $fetchData['emp_mail'] ?? null,
-                'mail_subject' => $fetchData['subject'] ?? null,
-                'mail_content' => $fetchData['message'] ?? null,
-            ];
+            // print_r($fetchData); die;
+            $insert_status = $this->ticketMaster->insert($fetchData);
+            $ticket_id = $this->ticketMaster->insertID();
 
-            if (!empty($messagesData['ticket_id'])) {
-                $TicketMessageModel = new TicketMessageModel();
-                $TicketMessageModel->insert($messagesData);
-            }
+            if ($insert_status && !empty($ticket_id)) {
 
-            $mail_sent_status = ($this->ticketController->sendAutoMailTrigger($ticket_id));
-            if (gettype($mail_sent_status) == 'array') {
-                $message = 'Claim Iniated Successfully';
-                return $this->respond(['status' => true, 'code' => 200, 'message' => $message], 200);
-            } else {
-                $mail_sent_status = json_decode($mail_sent_status);
-            }
-            // dd(gettype($mail_sent_status));
+                $messagesData = [
+                    'ticket_id' => $ticket_id ?? null,
+                    'sender' => 'user',
+                    'claim_status' => $fetchData['claim_status_id'] ?? null,
+                    'emp_mail' => $fetchData['emp_mail'] ?? null,
+                    'mail_subject' => $fetchData['subject'] ?? null,
+                    'mail_content' => $fetchData['message'] ?? null,
+                ];
 
-            if ($mail_sent_status->status == 'success') {
-                $sent_message_data['ticket_id'] = $ticket_id;
-                $sent_message_data['sender'] = 'staff';
-                $sent_message_data['emp_mail'] = $mail_sent_status->data->params->mail;
-                $sent_message_data['mail_subject'] = $mail_sent_status->data->params->subject;
-                $sent_message_data['mail_content'] = $mail_sent_status->data->params->message;
+                if (!empty($messagesData['ticket_id'])) {
+                    $TicketMessageModel = new TicketMessageModel();
+                    $TicketMessageModel->insert($messagesData);
+                }
 
-                $message_insert_status = $this->ticketMessage->insert($sent_message_data);
-
-                if ($message_insert_status) {
-                    $message = 'Claim Initiated Successfully';
+                $mail_sent_status = ($this->ticketController->sendAutoMailTrigger($ticket_id));
+                if (gettype($mail_sent_status) == 'array') {
+                    $message = 'Claim Iniated Successfully';
                     return $this->respond(['status' => true, 'code' => 200, 'message' => $message], 200);
                 } else {
-                    $message = 'Claim Initiated, Mail Sent Successfully';
-                    $this->myLogger->logme('error', "Claim initiated, Mail sent Successfully, Failed to store message:$ticket_id ");
+                    $mail_sent_status = json_decode($mail_sent_status);
+                }
+                // dd(gettype($mail_sent_status));
+
+                if ($mail_sent_status->status == 'success') {
+                    $sent_message_data['ticket_id'] = $ticket_id;
+                    $sent_message_data['sender'] = 'staff';
+                    $sent_message_data['emp_mail'] = $mail_sent_status->data->params->mail;
+                    $sent_message_data['mail_subject'] = $mail_sent_status->data->params->subject;
+                    $sent_message_data['mail_content'] = $mail_sent_status->data->params->message;
+
+                    $message_insert_status = $this->ticketMessage->insert($sent_message_data);
+
+                    if ($message_insert_status) {
+                        $message = 'Claim Initiated Successfully';
+                        return $this->respond(['status' => true, 'code' => 200, 'message' => $message], 200);
+                    } else {
+                        $message = 'Claim Initiated, Mail Sent Successfully';
+                        $this->myLogger->logme('error', "Claim initiated, Mail sent Successfully, Failed to store message:$ticket_id ");
+                        return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200);
+                    }
+                } else {
+
+                    $message = 'Claim Initiated, Failed to send Mail ';
+                    $this->myLogger->logme('error', "Claim initiated, Failed to send Mail :$ticket_id ");
                     return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200);
                 }
             } else {
-
-                $message = 'Claim Initiated, Failed to send Mail ';
-                $this->myLogger->logme('error', "Claim initiated, Failed to send Mail :$ticket_id ");
+                $message = 'Something Went Wrong';
                 return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200);
             }
-        } else {
-            $message = 'Something Went Wrong';
-            return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200);
+
+        }else{
+            return $this->response->setJSON(['status' => false, 'code' => 200, 'message' => 'The employee is not active.'])->setStatusCode(404);
         }
     }
 
@@ -3249,7 +3258,7 @@ class EmployeeRestController extends AdminController
         // dd($emp_id);
 
         if (empty($emp_id)) {
-            return $this->response->setJSON(['error' => 'emp_id is required'])->setStatusCode(404);
+            return $this->response->setJSON(['status' => false, 'code' => 200, 'message' => 'emp_id is required.'])->setStatusCode(404);
         }
 
         $TicketMasterModel = new TicketMasterModel();

From f1e1223337d1bfbb58b5b4bb2cff49b2909b23bd Mon Sep 17 00:00:00 2001
From: "venkatesh.r" 
Date: Fri, 21 Feb 2025 17:31:20 +0530
Subject: [PATCH 07/21] CHANGE_INSURER_MULTIEVENT : RV

---
 app/Controllers/MasterController.php | 10 ++++++++++
 app/Views/insurer_basic_info.php     | 14 ++++++++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php
index 9202c85e..ef741d21 100755
--- a/app/Controllers/MasterController.php
+++ b/app/Controllers/MasterController.php
@@ -287,6 +287,10 @@ class MasterController extends AdminController
             $data['deletion_add_day'] = 1;
         }
 
+        if($this->request->getPost('is_multi_event')){
+            $data['is_multi_event'] = 1;
+        }
+
         $data['created_by'] = get_session_userid();
         $data['insurer_logo'] = $file_name;
         
@@ -371,6 +375,12 @@ class MasterController extends AdminController
             $data['deletion_add_day'] = 0;
         }
 
+        if($this->request->getPost('is_multi_event')){
+            $data['is_multi_event'] = 1;
+        }else{
+            $data['is_multi_event'] = 0;
+        }
+
         $update             = $this->insurerModel->update($id,$data);
         if($update){
             echo json_encode(array("status" => true , 'data' => $data));
diff --git a/app/Views/insurer_basic_info.php b/app/Views/insurer_basic_info.php
index 80cf1599..524f2604 100755
--- a/app/Views/insurer_basic_info.php
+++ b/app/Views/insurer_basic_info.php
@@ -103,7 +103,8 @@ input:checked + .slider:before {
                         
 
                         
-
+ +

> @@ -112,6 +113,15 @@ input:checked + .slider:before {
+ +
+ + +
+
@@ -133,7 +143,7 @@ input:checked + .slider:before {
-
+
" width="100" height="100" id="uploadPreview" class="avatar img-circle img-thumbnail" alt="avatar" />
From 339518f7602e9b1e1f195fff8fdeffe362ca822a Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Mon, 24 Feb 2025 08:39:47 +0530 Subject: [PATCH 08/21] CHANGE_SCRIPT_TERMS : RV --- app/Controllers/ClientController.php | 26 ++++++++++++- app/Views/policy_gmc_terms.php | 50 +++++++++++++++++++++--- app/Views/policy_gpa_terms.php | 57 +++++++++++++++++++++++----- 3 files changed, 116 insertions(+), 17 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 35983994..2a1cdcfd 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -2399,6 +2399,7 @@ class ClientController extends AdminController public function enrollmentGMCDisplayValueTransform() { + $data = []; if ($this->request->getPost("waiverofpreexistingdiseases_display")) { $data['Waiver of Pre-existing Diseases'] = $this->request->getPost("waiverofpreexistingdiseases"); @@ -2560,6 +2561,17 @@ class ClientController extends AdminController $data['Breavement Cover'] = $this->request->getPost("breavement_cover"); } + if ($this->request->getPost("special_condition_display_value")) { + + $specialConditionKeyValue = $this->request->getPost("special_condition_display_value") ?? []; + $specialConditionKeyValue = json_decode($specialConditionKeyValue, true); + + if (is_array($specialConditionKeyValue) && count($specialConditionKeyValue) > 0) { + $mergedArray = array_merge(...array_map(fn($item) => (array) $item, $specialConditionKeyValue)); + $data = array_merge($data, $mergedArray); + } + } + if(isset($data) && !empty($data)){ return $data; }else{ @@ -2677,7 +2689,9 @@ class ClientController extends AdminController } public function enrollmentGPADisplayValueTransform() - { + { + $data = []; + if ($this->request->getPost("accidentalDeathBenefit_display")) { $data['Accidental Death Benefit'] = $this->request->getPost("accidentalDeathBenefit"); } @@ -2742,6 +2756,16 @@ class ClientController extends AdminController $data['Air Ambulance'] = $this->request->getPost("air_ambulance"); } + if ($this->request->getPost("gpa_special_condition_display_value")) { + + $specialConditionKeyValue = $this->request->getPost("gpa_special_condition_display_value") ?? []; + $specialConditionKeyValue = json_decode($specialConditionKeyValue, true); + + if (is_array($specialConditionKeyValue) && count($specialConditionKeyValue) > 0) { + $mergedArray = array_merge(...array_map(fn($item) => (array) $item, $specialConditionKeyValue)); + $data = array_merge($data, $mergedArray); + } + } // print_r($data); die; if (isset($data) && !empty($data)) { diff --git a/app/Views/policy_gmc_terms.php b/app/Views/policy_gmc_terms.php index 93f24a59..68ae324d 100755 --- a/app/Views/policy_gmc_terms.php +++ b/app/Views/policy_gmc_terms.php @@ -1012,11 +1012,29 @@ $("#policyJsonForm").submit(function(event) { return; } + + var specialConditions = []; + + $(".removeDom").each(function () { + var isChecked = $(this).find("input[name='special_condition_display[]']").is(":checked"); + + if (isChecked) { + var label = $(this).find("input[name='special_condition_label[]']").val(); + var input = $(this).find("input[name='special_condition_input[]']").val(); + + specialConditions.push({ [label]: input }); + } + }); + + console.log("specialConditions", specialConditions); + + $('.loader').fadeIn(); $('.loader-mask').fadeIn(); var formData = new FormData($('#policyJsonForm')[0]); var policy_form_action = ''; + formData.append("special_condition_display_value", JSON.stringify(specialConditions)); $.ajax({ data: formData, @@ -1140,6 +1158,25 @@ $('body').on('click', '.btnPolicyMaster', function() { element.value = " "; } else { element.value = jsonObject[key][index]; + + if (key.includes("special_condition_label")) { + let checkbox = $(element).closest('.form-group').find('input[name="special_condition_display[]"]'); + console.log("First element:", element); + + if (checkbox.length) { + console.log("Checkbox found:", checkbox); + + // Correct way to set the 'id' attribute + let formattedValue = jsonObject[key][index].replace(/[\s\-\/,&]+/g, '').toLowerCase(); + console.log('formattedValue', formattedValue); + checkbox.attr('id', formattedValue + '_display'); + + console.log("Updated Checkbox:", checkbox); + } else { + console.log("Checkbox not found for:", element); + } + } + } }); } @@ -1534,7 +1571,7 @@ function specialCondition(count = 0) { var index = $('.modifyclassinput').length; var appendElement = `
- +
+ + - + +
@@ -363,6 +373,7 @@ $(document).ready(function() { flatpickr("#denial_date", { dateFormat: "d/m/Y", allowInput: false }); flatpickr("#approved_date", { dateFormat: "d/m/Y", allowInput: false }); flatpickr("#settled_date", { dateFormat: "d/m/Y", allowInput: false }); + flatpickr("#pay_initiate_date", { dateFormat: "d/m/Y", allowInput: false }); // updateClaimStatusDisplay("") var extraFields = ; @@ -408,7 +419,7 @@ $(document).ready(function() { function updateClaimStatusDisplay(value) { // Hide all sections and remove required attribute from their inputs and textareas - let sections = $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu, .canceled, .returned'); + let sections = $('.cda_ir, .settled, .approved, .rejected, .up_qdr, .up_cnu, .canceled, .returned, .payment, .non_id'); sections.hide().find('input, textarea').removeAttr('required'); // Determine which section to show @@ -429,11 +440,22 @@ function updateClaimStatusDisplay(value) { showClass = '.canceled'; } else if (value == 14) { // RETURNED showClass = '.returned'; + } else if (value == 1) { // NON ID + showClass = '.non_id'; + } else if (value == 10) { // PAYMENT INITIATED + showClass = '.payment'; } // Show the relevant section and enable required attributes if (showClass) { - $(showClass).show().find('input, textarea').attr('required', true); + // $(showClass).show().find('input, textarea').attr('required', true); + $(showClass).show().find('input, textarea').attr('required', true).each(function() { + var $label = $("label[for='" + $(this).attr('id') + "']"); + if ($label.length && !$label.find('.text-danger').length) { + $label.append(' *'); + } + }); + } } @@ -455,7 +477,7 @@ function claimStatusFieldChanges(fields) { var $label = $parentDiv.find("label[for='" + fieldId + "']"); if ($label.length && !$label.find(".text-danger").length) { - $label.append(' *'); + // $label.append(' *'); } } }); @@ -477,7 +499,7 @@ function claimStatusFieldRemoveREquired(fields, remove_or_add, thirdClass) { var $label = $parentDiv.find("label[for='" + fieldId + "']"); // if(remove_or_add == false){ // $parentDiv.find("label[for='" + fieldId + "'] .text-danger").remove(); - // console.log('one', remove_or_add); + // // console.log('one', remove_or_add); // }else{ // if ($label.length && !$label.find(".text-danger").length) { // $label.append(' *'); @@ -512,10 +534,14 @@ $(document).on("input", function (event) { if (thirdClass) { claimStatusFieldRemoveREquired(fields, false, thirdClass); - let $label = $(thirdClass).find("label"); - if ($label.length && !$label.find(".text-danger").length) { - $label.append(' *'); - } + $(thirdClass).each(function() { + let $label = $(this).find("label"); + $label.each(function() { + if (!$(this).find(".text-danger").length) { + $(this).append(' *'); + } + }); + }); } else { claimStatusFieldRemoveREquired($field, false, ''); } diff --git a/app/Views/ticket_history.php b/app/Views/ticket_history.php index 05534579..7ee087e1 100644 --- a/app/Views/ticket_history.php +++ b/app/Views/ticket_history.php @@ -5,7 +5,7 @@ - + diff --git a/app/Views/ticket_list.php b/app/Views/ticket_list.php index 65885cd1..a51706fd 100644 --- a/app/Views/ticket_list.php +++ b/app/Views/ticket_list.php @@ -74,11 +74,11 @@ table.dataTable tbody td { title=" From 93fc0a23075e00678802abc1a9b519f61e13a304 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Tue, 25 Feb 2025 17:02:20 +0530 Subject: [PATCH 15/21] FEAT_CLAIM_STATUS_FOR_MAIL_TEMPLATE --- app/Controllers/TicketController.php | 26 + app/Views/ticket_mail_template.php | 909 ++++++++++++++------------- 2 files changed, 492 insertions(+), 443 deletions(-) diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 60394874..36007889 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -593,6 +593,17 @@ class TicketController extends BaseController $data['policy_type'] = $this->ticketType; $data['placeHolders'] = $this->placeHolders; $data['ticket_data'] = $this->ticketMailTemplateModel->where('is_active', 1)->findAll(); + + foreach ($data['ticket_data'] as $key => $ticket_data) { + + $tooltip_array = $this->claimStatus->select('claim_status')->where('ticket_type',$data['ticket_data'][$key]['ticket_type'])->where('trigger_type',$data['ticket_data'][$key]['trigger_type'])->where('is_active',1)->first(); + if (isset($tooltip_array) && $tooltip_array != null){ + $data['ticket_data'][$key]['tool_tip'] = $tooltip_array['claim_status']; + }else{ + $data['ticket_data'][$key]['tool_tip'] =$data['ticket_data'][$key]['template_name']; + } + } + // dd($data['ticket_data']); $data['ticket_type'] = $this->ticketType; $data['trigger_type'] = $this->triggerType; return $this->loadLayout('ticket_mail_template', $data); @@ -621,6 +632,21 @@ class TicketController extends BaseController } elseif ($action == 2) { $table_id = (int)$this->request->getPost('id'); $data = $this->ticketMailTemplateModel->where('id', $table_id)->where('is_active', 1)->first(); + if ($data && isset($data['ticket_type']) && isset($data['trigger_type'])) { + $tooltip_array = $this->claimStatus->select('claim_status') + ->where('ticket_type', $data['ticket_type']) + ->where('trigger_type', $data['trigger_type']) + ->where('is_active', 1) + ->first(); + + $data['tool_tip'] = (isset($tooltip_array['claim_status'])) + ? $tooltip_array['claim_status'] + : $data['template_name']; + } else { + // Handle case where $data is null or missing required fields + $data = $data ?: []; // Ensure $data is an array if null + $data['tool_tip'] = $data['template_name']; + } if ($data) { return $this->respond(['status' => true, 'data' => $data], 200); } else { diff --git a/app/Views/ticket_mail_template.php b/app/Views/ticket_mail_template.php index 511cf300..213312b4 100644 --- a/app/Views/ticket_mail_template.php +++ b/app/Views/ticket_mail_template.php @@ -1,56 +1,56 @@
@@ -75,28 +75,37 @@ table.dataTable tbody td {
- $row){ ?> - - - - - - - - + $row) { ?> + + + + + + + + +
FieldLabel Change
- -
  + + + + +
@@ -135,11 +144,11 @@ table.dataTable tbody td {
@@ -149,11 +158,11 @@ table.dataTable tbody td { @@ -171,6 +180,12 @@ table.dataTable tbody td { +
+ + +
+ +
@@ -191,12 +206,15 @@ table.dataTable tbody td {
@@ -216,392 +234,397 @@ table.dataTable tbody td { - + \ No newline at end of file From abe568882c68d7ce3db869dae5a132f939715dd1 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 25 Feb 2025 18:15:17 +0530 Subject: [PATCH 16/21] CHANGE_CLAIM_MODULE : RV --- app/Controllers/ClientController.php | 16 +- app/Controllers/TicketController.php | 17 +- app/Models/EmployeeModel.php | 6 +- app/Views/ticket_form_gmc.php | 199 +++++++++++--------- app/Views/ticket_form_handler.php | 266 ++++++++++++++++----------- 5 files changed, 306 insertions(+), 198 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 023acd31..15533b25 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -4834,7 +4834,7 @@ class ClientController extends AdminController return $this->respond([ 'status' => false, 'code' => 404, - 'message' => 'No data found', + 'message' => 'No Employee found', 'param' => $param, 'type' => $type, 'dataForClientAndInsurer' => $dataForClientAndInsurer, @@ -4843,7 +4843,7 @@ class ClientController extends AdminController } } - public function getTheEmpDataForClaimSearchByMobile($param, $type = 'mobile', $client_policy_id = null) + public function getTheEmpDataForClaimSearchByMobile($param, $type = 'mobile', $client_policy_id = null, $client_id = null) { $field_name = 'employees.' . $type; @@ -4866,8 +4866,8 @@ class ClientController extends AdminController employee_polices.tpa_id AS tpa_no, employee_polices.client_policy_id AS policy_id ") - ->join('clients', 'client_policy.client_id = clients.id', 'left') - ->join('insurers', 'client_policy.insurer_id = insurers.id', 'left') + ->join('clients', 'client_policy.client_id = clients.id') + ->join('insurers', 'client_policy.insurer_id = insurers.id') ->join('tpa', 'client_policy.tpa_id = tpa.id', 'left') ->join('employees', 'clients.id = employees.client_id') ->join('employee_polices', 'employees.id = employee_polices.employee_id') @@ -4879,6 +4879,10 @@ class ClientController extends AdminController ->where('employee_polices.is_active', 1) ->where($field_name, $param); + if (!empty($client_id)) { + $query->where('employees.client_id', $client_id); + } + if (!empty($client_policy_id)) { $query->where('employee_polices.client_policy_id', $client_policy_id); } @@ -4902,7 +4906,7 @@ class ClientController extends AdminController if(!empty($data) && count($data) > 0){ - $memberData = $this->employeeModel->getEmployeeByEmployeeCode($data['emp_code'], $data['policy_id']); + $memberData = $this->employeeModel->getEmployeeByEmployeeCode($data['emp_code'], $data['policy_id'], $client_id); $acms = $this->clientRMModel ->select('user_profiles.id, user_profiles.first_name') @@ -4935,7 +4939,7 @@ class ClientController extends AdminController return $this->respond([ 'status' => false, 'code' => 404, - 'message' => 'No data found', + 'message' => 'No Employee found', 'param' => $param, 'client_policy_id' => $client_policy_id, 'type' => $type, diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 3061f378..55672be7 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -34,6 +34,7 @@ class TicketController extends BaseController public $claimStatus; public $placeHolders; public $extraFields; + public $nonIDReason; protected $clientModel; protected $ticketMasterModel; @@ -138,6 +139,13 @@ class TicketController extends BaseController 53 => ['cancel_remark'], 58 => ['cancel_remark'], ]; + $this->nonIDReason = [ + "Newborn Baby" => "Newborn Baby", + "Newly Wedded Spouse" => "Newly Wedded Spouse", + "Policy Pending" => "Policy Pending", + "New Joinee" => "New Joinee", + "Exceptional Case" => "Exceptional Case" + ]; $this->ticketMasterModel = new TicketMasterModel(); $this->claimStatus = new TicketClaimStatusModel(); @@ -297,7 +305,8 @@ class TicketController extends BaseController 'ticket_type' => $this->ticketType, 'priorityType' => $this->priorityType, 'relationshipType' => $this->relationshipType, - 'modeOFIntimate' => $this->modeOFIntimate + 'modeOFIntimate' => $this->modeOFIntimate, + 'nonIDReason' => $this->nonIDReason ]; switch ($ticket_type) { @@ -529,6 +538,12 @@ class TicketController extends BaseController $ticket_data['settled_date'] = change_date_format($ticket_data['settled_date'], null, $out_put_format); } + if (empty($ticket_data['pay_initiate_date'])) { + $ticket_data['pay_initiate_date'] = null; + } else { + $ticket_data['pay_initiate_date'] = change_date_format($ticket_data['pay_initiate_date'], null, $out_put_format); + } + return $ticket_data; } diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php index 58cf6010..14ec368d 100755 --- a/app/Models/EmployeeModel.php +++ b/app/Models/EmployeeModel.php @@ -240,7 +240,7 @@ class EmployeeModel extends Model return $results; } - public function getEmployeeByEmployeeCode($emp_code, $client_policy_id = null) + public function getEmployeeByEmployeeCode($emp_code, $client_policy_id = null, $client_id = null) { $query = $this->select(" employees.id AS emp_id, @@ -257,6 +257,10 @@ class EmployeeModel extends Model ->where('employee_polices.is_active', 1) ->where('employees.emp_code', $emp_code); + if(!empty($client_id)){ + $query->where('employees.client_id', $client_id); + } + if(!empty($client_policy_id)){ $query->where('employee_polices.client_policy_id', $client_policy_id); } diff --git a/app/Views/ticket_form_gmc.php b/app/Views/ticket_form_gmc.php index 23c8151c..b4fe84be 100644 --- a/app/Views/ticket_form_gmc.php +++ b/app/Views/ticket_form_gmc.php @@ -23,78 +23,13 @@
+ +
Employee Details
+
+ +
-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - - -
- -
- - - -
- -
- - - -
-
-
- - -
-
@@ -140,6 +68,20 @@
+
+ + +
+ +
+ + +
+
+
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + +
+ +
+ + +
Claim Details
+
+ + +
+ +
+ + +
+ +
+ + +
+
@@ -221,6 +235,15 @@ name="pod_no">
+
+ + +
Additional Details
+
+ + +
+ + - + +
@@ -348,7 +384,6 @@ // } // }); - \ No newline at end of file diff --git a/app/Views/ticket_form_gpa.php b/app/Views/ticket_form_gpa.php index 42b916cb..9a546bd4 100644 --- a/app/Views/ticket_form_gpa.php +++ b/app/Views/ticket_form_gpa.php @@ -399,9 +399,10 @@ console.log('fields', fields); console.log('$field id', $field); let $parentDiv = $field.closest("div"); console.log('$parentDiv', $parentDiv); - + // addRequiredFieldSymbol(targetId); if ($parentDiv.length) { let thirdClass = $parentDiv.attr("class").split(" ")[2] || ""; + addRequiredFieldSymbolByClass(thirdClass); console.log('thirdClass', thirdClass); if (thirdClass) { @@ -416,5 +417,61 @@ console.log('fields', fields); } } }); +// function addRequiredFieldSymbol(field_name) { +// // Find the field with the given name +// var $field = $(`[name="${field_name}"]`); + +// if ($field.length) { +// // Find the parent div of this field +// var $parentDiv = $field.closest('div'); + +// if ($parentDiv.length) { +// // Get the classes as an array +// var classes = $parentDiv.attr('class') ? $parentDiv.attr('class').split(/\s+/) : []; + +// if (classes.length > 0) { +// // Get the last class in the array +// var lastClass = classes[classes.length - 1]; + +// // Find all divs with this last class +// var $allDivsWithClass = $(`.${lastClass}`); + +// // Add asterisk to all labels within these divs +// $allDivsWithClass.each(function() { +// var $label = $(this).find('label'); +// if ($label.length && !$label.find('.text-danger').length) { +// $label.append(' *'); +// } +// }); + +// console.log(`Added required symbol to ${$allDivsWithClass.length} labels with class "${lastClass}"`); +// } else { +// console.warn(`Parent div for field "${field_name}" has no classes`); +// } +// } else { +// console.warn(`No parent div found for field name="${field_name}"`); +// } +// } else { +// console.warn(`No field found with name="${field_name}"`); +// } +// } +function addRequiredFieldSymbolByClass(className) { + // Find all divs with the specified class + var $divsWithClass = $(`.${className}`); + + if ($divsWithClass.length) { + // Add asterisk to all labels within these divs + $divsWithClass.each(function() { + var $label = $(this).find('label'); + if ($label.length && !$label.find('.text-danger').length) { + $label.append(' *'); + } + }); + + console.log(`Added required symbol to ${$divsWithClass.length} labels with class "${className}"`); + } else { + console.warn(`No divs found with class="${className}"`); + } +} \ No newline at end of file From 283de4d276ed6e1a4dd39b4da8a4ae37fdd83f3a Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 26 Feb 2025 11:14:01 +0530 Subject: [PATCH 19/21] FIX_CLAIM_ARRAY : RV --- app/Controllers/TicketController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index a1209efc..f98e0192 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -115,7 +115,8 @@ class TicketController extends BaseController '((AUTO_QUERY_CONTENT))' => 'auto_query_content', ]; $this->extraFields = [ - + 1 => ['non_id_reason'], + 10 => ['pay_initiate_date'], 3 => ['raised_date'], 4 => ['raised_date'], 5 => ['claim_number', 'registration_date'], From 042fcc068b5c690d80c82da3e476cc04435b4080 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 26 Feb 2025 11:58:43 +0530 Subject: [PATCH 20/21] CHANGE_TRIGGER_TYPE_8 : RV --- app/Controllers/TicketController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index f98e0192..6da26715 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -99,7 +99,8 @@ class TicketController extends BaseController 4 => "Trigger 4", 5 => "Trigger 5", 6 => "Trigger 6", - 7 => "Trigger 7" + 7 => "Trigger 7", + 8 => "Trigger 8", ]; $this->placeHolders = [ From 2c0f1dabd3036bdcc5fef7e25b70b2910fff7223 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 26 Feb 2025 12:32:21 +0530 Subject: [PATCH 21/21] CHANGE_CLAIM_MAIL_TRIGGER : RV --- app/Views/ticket_mail_template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Views/ticket_mail_template.php b/app/Views/ticket_mail_template.php index 213312b4..00413062 100644 --- a/app/Views/ticket_mail_template.php +++ b/app/Views/ticket_mail_template.php @@ -83,7 +83,7 @@ aria-hidden="true" data-toggle="tooltip" data-placement="top" - title=""> + title="">