From 369a1f297d4f781dcf35986bdf7e31f7d3685533 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 10 Dec 2025 14:18:57 +0530 Subject: [PATCH 01/16] FEAT_IR_FILE_CLAIM_PUSH --- app/Controllers/EmployeeRestController.php | 5 ++++- app/Models/TicketMasterModel.php | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 0c60223e..2c78d14a 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -3711,6 +3711,7 @@ class EmployeeRestController extends AdminController $claimData = [ 'ticket_type_id' => $data['policy_type_id'], + 'policy_transaction_id' => $data['policy_transaction_id'], 'claim_status_id' => 62, 'policy_no' => $policy['policy_no'], 'client_policy_id' => $policy['client_policy_id'], @@ -5011,7 +5012,9 @@ class EmployeeRestController extends AdminController "UPDATE ticket_master SET required_docs = ? WHERE id = ?", [$required_docs, $ticket_id] ); - return $this->respond(['status' => true, 'code' => 200, 'message' => 'Files uploaded successfully'], 200); + $apiServiceController = new ApiServiceController(); + $tpaIrFilePushResponce = $apiServiceController->pushClaimFiles($ticket_id); + return $this->respond(['status' => true, 'code' => 200, 'message' => 'Files uploaded successfully', 'tpaIrFilePushResponce' => $tpaIrFilePushResponce], 200); }else{ return $this->respond(['status' => false, 'code' => 400, 'message' => 'Failed to upload the file'], 200); } diff --git a/app/Models/TicketMasterModel.php b/app/Models/TicketMasterModel.php index 0236b837..a44286a9 100644 --- a/app/Models/TicketMasterModel.php +++ b/app/Models/TicketMasterModel.php @@ -91,6 +91,7 @@ class TicketMasterModel extends Model 'hospital_phone_no', 'claim_description', 'required_docs', + 'policy_transaction_id', ]; From cb0639fede158a1eda81935105f3fad5eff878e9 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 10 Dec 2025 15:28:46 +0530 Subject: [PATCH 02/16] FIX_ISSUE --- app/Controllers/ApiServiceController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/ApiServiceController.php b/app/Controllers/ApiServiceController.php index 69d789bb..e2d1c5d7 100644 --- a/app/Controllers/ApiServiceController.php +++ b/app/Controllers/ApiServiceController.php @@ -250,7 +250,7 @@ class ApiServiceController extends BaseController public function pushClaimFiles($claimId) { - $claimId = $this->request->getGet('claim_id'); + // $claimId = $this->request->getGet('claim_id'); $data = $this->db->table('ticket_master tm') ->select('tm.id,tm.tpa_id ')->where('tm.id', $claimId)->get()->getRowArray(); // single record From 1db1aec51cda76be51131d8b49c2d5f210bfa5c3 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 10 Dec 2025 16:38:47 +0530 Subject: [PATCH 03/16] CHANGE_CLAIM_VIEW --- app/Controllers/EmployeeRestController.php | 117 ++++++++++++++++++++- 1 file changed, 114 insertions(+), 3 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 2c78d14a..05944b51 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -3911,6 +3911,8 @@ class EmployeeRestController extends AdminController $emp_id = $this->request->getGet('emp_id'); $ticket_type = $this->request->getGet('ticket_type') ?? null; $ticket_id = $this->request->getGet('ticket_id') ?? null; + $mobile_number = $this->request->getGet('mobile_number') ?? null; + $email_id = $this->request->getGet('email_id') ?? null; $request = \Config\Services::request(); $uri = $request->uri->getPath(); $returnType = ""; @@ -3921,6 +3923,11 @@ class EmployeeRestController extends AdminController return $this->response->setJSON(['status' => false, 'code' => 200, 'message' => 'emp_id is required.'])->setStatusCode(404); } + $retail_ticket_data = []; + if(!empty($mobile_number) || !empty($email_id)){ + $retail_ticket_data = $this->getRetailPolicyClaimData($this->request->getGet()); + } + $TicketMasterModel = new TicketMasterModel(); $ticket_data = $TicketMasterModel->get_ticket_data($emp_id, $returnType, $ticket_type, $ticket_id); @@ -3995,9 +4002,108 @@ class EmployeeRestController extends AdminController } } + $ticket_data = array_merge($ticket_data, $retail_ticket_data); + return $this->response->setJSON(['ticket_data' => $ticket_data])->setStatusCode(200); } + public function getRetailPolicyClaimData($receviedPayload) + { + try { + // Create minimal retail user object + $retailUserData = (object) [ + 'id' => null, + 'mobile' => $receviedPayload['mobile_number'] ?? null, + 'email_id' => $receviedPayload['email_id'] ?? null + ]; + + // Get retail policies of user + $empRetailPolicyData = $this->getEmpRetailPolicy($retailUserData); + + if (empty($empRetailPolicyData)) { + return []; + } + + // Fetch ticket data for each policy + $retail_ticket_data = []; + foreach ($empRetailPolicyData as $policy) { + $tickets = $this->ticketMaster + ->select(" + ticket_master.*, + ( + SELECT th1.old_value + FROM ticket_history th1 + JOIN ticket_claim_status tcs ON th1.old_value = tcs.id + WHERE th1.field_name = 'claim_status_id' + AND th1.ticket_id = ticket_master.id + AND th1.id = ( + SELECT MAX(th2.id) + FROM ticket_history th2 + WHERE th2.ticket_id = th1.ticket_id + AND th2.field_name = 'claim_status_id' + ) + ) AS old_status_id + ") + ->where('is_active', 1) + ->where('client_id', $policy['client_id']) + ->where('policy_transaction_id', $policy['policy_transaction_id']) + ->findAll(); + + if (!empty($tickets)) { + $retail_ticket_data = array_merge($retail_ticket_data, $tickets); + } + } + + if (empty($retail_ticket_data)) { + return []; + } + + // Fetch grouped claim statuses + $client_claim_status = $this->getClaimStatusGrouped(); // Format expected: [status => [ids]] + $claim_type = $this->getClaimTypeMaster('internal'); + + // Convert claim type for quick access + $typeMap = array_column($claim_type, 'claim_type', 'id'); + + // Map status name to each ticket + foreach ($retail_ticket_data as &$ticket) { + $ticket['claim_status'] = null; // Default + + $ticket['claim_type_name'] = $typeMap[$ticket['claim_type']] ?? null; + foreach ($client_claim_status as $status_name => $status_list) { + if (in_array($ticket['claim_status_id'], $status_list)) { + $ticket['claim_status'] = $status_name; + break; + } + + if (in_array($ticket['old_status_id'], $status_list)) { + $ticket['claim_status'] = $status_name; + break; + } + } + } + + return $retail_ticket_data; + + }catch (\Throwable $th) { + + $errorData = [ + 'message' => $th->getMessage(), + 'file' => $th->getFile(), + 'line' => $th->getLine(), + 'code' => $th->getCode(), + 'trace' => $th->getTraceAsString(), + 'trace_array' => $th->getTrace(), // full array version (optional) + 'function' => $th->getTrace()[0]['function'] ?? null, + 'class' => $th->getTrace()[0]['class'] ?? null, + ]; + + $this->myLogger->logme("error", "EMPLOYEE-REST-CONTROLLER - getRetailPolicyClaimData: Exception: " . json_encode($errorData ?? [])); + + return []; + } + } + public function getClaimStatusGrouped() { // Fetch active claim statuses @@ -4023,7 +4129,6 @@ class EmployeeRestController extends AdminController return $result; } - // not in use did for testing function encrypt_for_sso(): string { @@ -4779,6 +4884,7 @@ class EmployeeRestController extends AdminController $emp_retail_client_data = $this->clientModel ->select(" '{$emp_id}' AS emp_id, + clients.id as client_id, clients.client_name as insurerd_name, clients.email as insurerd_mail, clients.phone as insurerd_mobile, @@ -4811,6 +4917,7 @@ class EmployeeRestController extends AdminController $emp_retail_client_data = $this->clientModel ->select(" '{$emp_id}' AS emp_id, + clients.id as client_id, clients.client_name as insurerd_name, clients.email as insurerd_mail, clients.phone as insurerd_mobile, @@ -4973,7 +5080,7 @@ class EmployeeRestController extends AdminController ], 200); } - public function getClaimTypeMaster() + public function getClaimTypeMaster($return_type = 'api') { $data = db_connect()->table('partner_claim_type_master')->select('id,claim_type')->where('is_active',1)->get()->getResultArray(); @@ -4981,7 +5088,11 @@ class EmployeeRestController extends AdminController return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 200); } - return $this->respond(['status' => 'success', 'code' => 200, 'data' => $data]); + if($return_type == 'api'){ + return $this->respond(['status' => 'success', 'code' => 200, 'data' => $data]); + }else{ + return $data; + } } public function uploadIRDocs() From 9d18207658b1eefcb9e1c99c6c10889c449ac1aa Mon Sep 17 00:00:00 2001 From: velz Date: Wed, 10 Dec 2025 16:41:26 +0530 Subject: [PATCH 04/16] FIX_MINOR --- app/Config/Database.php | 2 +- app/Filters/CommissionApiFilter.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Config/Database.php b/app/Config/Database.php index 2d388192..dcc1c2dd 100755 --- a/app/Config/Database.php +++ b/app/Config/Database.php @@ -124,7 +124,7 @@ class Database extends Config $this->defaultGroup = 'tests'; } - $this->enableSSL = env('DB_SSL_ENABLE'); + $this->enableSSL = env('DB_SSL_ENABLE') ?? false; if ($this->enableSSL === true || $this->enableSSL === 'true' || $this->enableSSL === 1 || $this->enableSSL === '1') { diff --git a/app/Filters/CommissionApiFilter.php b/app/Filters/CommissionApiFilter.php index d7ae956e..f68e62cd 100644 --- a/app/Filters/CommissionApiFilter.php +++ b/app/Filters/CommissionApiFilter.php @@ -10,7 +10,7 @@ class CommissionApiFilter implements FilterInterface { public function before(RequestInterface $request, $arguments = null) { - + return null; // Read API key from header // $authHeader = $request->getHeaderLine('X'); $authHeader = $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; From 76c160db05eaaa1dff6156e284fe4d00c5b2f4c5 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 10 Dec 2025 16:58:10 +0530 Subject: [PATCH 05/16] FIX_TICKET_TYPE --- app/Controllers/EmployeeRestController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 05944b51..38d99e3d 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -4070,6 +4070,9 @@ class EmployeeRestController extends AdminController $ticket['claim_status'] = null; // Default $ticket['claim_type_name'] = $typeMap[$ticket['claim_type']] ?? null; + if($ticket['ticket_type_id'] == 8){ + $ticket['ticket_policy_type'] = 'Motor'; + } foreach ($client_claim_status as $status_name => $status_list) { if (in_array($ticket['claim_status_id'], $status_list)) { $ticket['claim_status'] = $status_name; From 86b34f77cf5b7b8893f872383792563c4363abc2 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 10 Dec 2025 17:09:29 +0530 Subject: [PATCH 06/16] FIX_VEHICLE_NO --- app/Controllers/EmployeeRestController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 38d99e3d..622036d1 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -4030,6 +4030,7 @@ class EmployeeRestController extends AdminController $tickets = $this->ticketMaster ->select(" ticket_master.*, + vehicle.vehicle_no, ( SELECT th1.old_value FROM ticket_history th1 @@ -4044,9 +4045,10 @@ class EmployeeRestController extends AdminController ) ) AS old_status_id ") - ->where('is_active', 1) - ->where('client_id', $policy['client_id']) - ->where('policy_transaction_id', $policy['policy_transaction_id']) + ->join("vehicle", "ticket_master.vehicle_id = vehicle.id", "left") + ->where('ticket_master.is_active', 1) + ->where('ticket_master.client_id', $policy['client_id']) + ->where('ticket_master.policy_transaction_id', $policy['policy_transaction_id']) ->findAll(); if (!empty($tickets)) { From 014def6daeab222971ecc5b688e1df301332ae09 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 10 Dec 2025 18:57:45 +0530 Subject: [PATCH 07/16] FEAT_GET_DRAFT_EMP_COUNT --- app/Controllers/ClientController.php | 3 +- app/Controllers/EmployeeRestController.php | 47 +++++++++++++++------- app/Controllers/TicketController.php | 2 +- 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index b67ae501..07243340 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -5890,10 +5890,11 @@ class ClientController extends AdminController // $response = $ticketServiceController->extractExcelData("claims_dump_form_client.xlsx"); // dd($response); - // ---------- TICKET SERVICE CONTROLLER -------------------------------------------------------------------------------- + // ---------- TICKET CONTROLLER -------------------------------------------------------------------------------- $TicketController = new TicketController(); // $response = $TicketController->getMoreInfo($requestFrom = 'rest', $ticket_id = 70); + // $response = $TicketController->sendAutoMailTrigger($ticket_id = 602); // dd($response); // ---------- EMP SERVICE CONTROLLER -------------------------------------------------------------------------------- diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 622036d1..ff1dab39 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -2888,9 +2888,13 @@ class EmployeeRestController extends AdminController $clientId = $this->request->getGet('client_id'); if (!empty($employeeSelfData) && isset($employeeSelfData->email_corporate)) { - $prePolicyCount = $this->getPreEmployeePolicyCount($empMobileNo, $clientId, $employeeSelfData->email_corporate); + $prePolicyCountData = $this->getPreEmployeePolicyCount($empMobileNo, $clientId, $employeeSelfData->email_corporate); + $prePolicyCount = $prePolicyCountData['pre_policy_count'] ?? 0; + $empNotEnrolledCount = $prePolicyCountData['emp_not_enrolled_count'] ?? 0; } else { - $prePolicyCount = $this->getPreEmployeePolicyCount($empMobileNo, $clientId); + $prePolicyCountData = $this->getPreEmployeePolicyCount($empMobileNo, $clientId); + $prePolicyCount = $prePolicyCountData['emp_not_enrolled_count'] ?? 0; + $empNotEnrolledCount = $prePolicyCountData['emp_not_enrolled_count'] ?? 0; } $whereArrayForId = []; @@ -2950,6 +2954,7 @@ class EmployeeRestController extends AdminController $data['claims_grace_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['claims_grace_date']); $data['policy_status'] = $policy_status_key; $data['pre_policy_count'] = $prePolicyCount; + $data['emp_not_enrolled_count'] = $empNotEnrolledCount; // $data['policy_terms'] = $terms; // if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else @@ -3020,13 +3025,12 @@ class EmployeeRestController extends AdminController array_push($result, $data); } - } $emp_reatail_policy_data = $this->getEmpRetailPolicy($employeeSelfData); $emp_wellness_data = $this->getWellnessUrl($employeeSelfData->id ?? null); - return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result, 'emp_name' => $employeeName, 'pre_policy_count' => $prePolicyCount, 'retail_policy_data' => $emp_reatail_policy_data, 'wellness_data' => $emp_wellness_data], 200); + return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result, 'emp_name' => $employeeName, 'pre_policy_count' => $prePolicyCount, 'emp_not_enrolled_count' => $empNotEnrolledCount, 'retail_policy_data' => $emp_reatail_policy_data, 'wellness_data' => $emp_wellness_data], 200); } else { return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 200); } @@ -3732,7 +3736,26 @@ class EmployeeRestController extends AdminController $ticket_id = $this->ticketMaster->insert($claimData); - if($ticket_id){ + if ($ticket_id) { + + $mail_sent_status = ($this->ticketController->sendAutoMailTrigger($ticket_id)); + + if (gettype($mail_sent_status) == 'array') { + $message = 'Claim Iniated Successfully'; + return ['status' => true, 'code' => 200, 'message' => $message]; + } else { + $mail_sent_status_object = json_decode($mail_sent_status); + } + + if ($mail_sent_status_object->status == 'success') { + $message = 'Claim Initiated Successfully'; + return ['status' => true, 'code' => 200, 'data' => $ticket_id, 'message' => $message]; + } else { + $message = 'Claim Initiated, Failed to send Mail '; + $this->myLogger->logme('error', "Claim initiated, Failed to send Mail :$ticket_id "); + return ['status' => false, 'code' => 400, 'message' => $message]; + } + $message = 'Claim Initiated Successfully'; return ['status' => true, 'code' => 200, 'data' => $ticket_id, 'message' => $message]; }else{ @@ -3746,7 +3769,6 @@ class EmployeeRestController extends AdminController }else{ $message = 'Claim Initiation failed'; return ['status' => false, 'code' => 404, 'message' => $message]; - } } @@ -4341,17 +4363,12 @@ class EmployeeRestController extends AdminController try { $response = $this->callThirdPartyAPI($post_data, 'getPreEmployeePolicyCount'); - log_message('error', 'STEP 6: API raw response: ' . $response); + log_message('error', 'STEP 6: API raw response: ' . json_encode($response ?? [])); - $response = json_decode($response, true); + $response = json_decode($response ?? '{}', true); - if (json_last_error() !== JSON_ERROR_NONE) { - log_message('error', 'STEP 7: JSON decoding failed: ' . json_last_error_msg()); - return 0; - } - - $count = $response['data'] ?? 0; - log_message('error', 'STEP 8: Final count extracted: ' . $count); + $count = $response ?? []; + log_message('error', 'STEP 8: Final count extracted: ' . json_encode($count ?? [])); return $count; } catch (\Throwable $e) { diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index e2ba20fe..ac104bf3 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -910,7 +910,7 @@ class TicketController extends BaseController $data['ticket_history'] = $this->ticketHistory($ticket_id); $data['ticket_check_list'] = db_connect()->table('ticket_check_list')->where('is_active', 1)->where('ticket_type_id', $ticket_data['ticket_type_id'])->get()->getResultArray(); if (!empty($ticket_data['client_policy_id'])){ - $ticket_data['client_policy_id_text'] = $this->clientPolicyModel->select('concat(policy_type.policy_type,"-",client_policy.policy_no) as client_policy_name')->join('policy_type','policy_type.id = client_policy.policy_type_id and policy_type.is_active = 1')->where('client_policy.id',$ticket_data['client_policy_id'])->first()['client_policy_name']; + $ticket_data['client_policy_id_text'] = $this->clientPolicyModel->select('concat(policy_type.policy_type,"-",client_policy.policy_no) as client_policy_name')->join('policy_type','policy_type.id = client_policy.policy_type_id and policy_type.is_active = 1')->where('client_policy.id',$ticket_data['client_policy_id'])->first()['client_policy_name'] ?? "N/A"; } // dd($data); $data['ticket_data'] = $ticket_data; From 2dbbba4c907975cb712ff474af1adf6b13676fa6 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 11 Dec 2025 10:33:51 +0530 Subject: [PATCH 08/16] FIX_DATE_ISSUE --- app/Controllers/EmployeeRestController.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index ff1dab39..ba55137d 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -4834,6 +4834,18 @@ class EmployeeRestController extends AdminController return $this->respond(['status' => 'failed','code' => 400,'message' => 'emp_id is required' ], 200); } + if(isset($payload['policy_end_date']) && !empty($payload['policy_end_date'])){ + $payload['policy_end_date'] = change_date_format($payload['policy_end_date'], 'd M Y', 'Y-m-d'); + }else{ + $payload['policy_end_date'] = null; + } + + if(isset($payload['policy_start_date']) && !empty($payload['policy_start_date'])){ + $payload['policy_start_date'] = change_date_format($payload['policy_start_date'], 'd M Y', 'Y-m-d'); + }else{ + $payload['policy_start_date'] = null; + } + if(empty($pk)){ $payload['created_by'] = $emp_id; $emp_retail_policy_id = $this->employeeRetailPolicy->insert($payload); From 0c3d6b22d7f99f9564c87cca7a3e60e990566953 Mon Sep 17 00:00:00 2001 From: "sanjeev.p" Date: Thu, 11 Dec 2025 10:42:53 +0530 Subject: [PATCH 09/16] FIX_Endorsement 2 - card design --- app/Config/Routes.php | 2 + .../PolicyTransactionController.php | 308 ++ app/Views/layout/header.php | 6 + .../policy_transaction_endorsement_form_2.php | 2995 +++++++++++++++++ .../policy_transaction_endorsement_list_2.php | 1036 ++++++ .../policy_transaction_inception_form_2.php | 204 +- 6 files changed, 4408 insertions(+), 143 deletions(-) create mode 100644 app/Views/policy_transaction_endorsement_form_2.php create mode 100644 app/Views/policy_transaction_endorsement_list_2.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index a3a3f7ec..bd9feb09 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -448,6 +448,8 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) { $routes->post("create", "PolicyTransactionController::createEndorsementPolicy"); $routes->get("list/(:any)", "PolicyTransactionController::getEndorsementDataForEdit/$1"); $routes->get("remove/(:any)", "PolicyTransactionController::removeCDMaster/$1"); + $routes->get("list2", "PolicyTransactionController::viewEndorsement2"); + $routes->get("list2/(:any)", "PolicyTransactionController::getEndorsementDataForEdit2/$1"); }); $routes->group("report", ["filter" => "authMVC"], function ($routes) { diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 2708abc4..7e154d64 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -2078,6 +2078,100 @@ $this->loadLayout('policy_transaction_endorsement_list', $data); } + public function viewEndorsement2() + { + // echo '
';
+            // !dd($this->getEndorsementDataForEdit(17));
+            $bds_edit_pt_id = $this->request->getGet('pt_id') ?? null;
+            $data['tab_name'] = 'Endorsements';
+            $data['page_name'] = 'Endorsements';
+            $data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
+            $data['issuer_branch'] = $this->nhanceBranchModel->where('is_active', 1)->findAll();
+            $data['client_type'] = [1 => 'Group', 2 => 'Individual'];
+
+            $data['policy_status'] = [
+                'under_process' => 'Under Process',
+                'client_pending' => 'Client Pending',
+                'insurer_pending' => 'Insurer Pending',
+                'co_insurer_pending' => 'Co-Insurer Pending',
+                'tpa_pending' => 'TPA Pending',
+                'validated' => 'Validated',
+                'cancelled' => 'Cancelled',
+                'instalment_pending' => 'Instalment Pending',
+                'completed' => 'Completed',
+            ];
+
+            $data['invoice_status'] = [
+                'yet_to_generate' => 'Pending',
+                'generated' => 'Generated',
+                'send' => 'Sent',
+                'recived' => 'Payment Received',
+            ];
+
+            $data['action_type'] = [
+                'addition' => 'Addition',
+                'deletion' => 'Deletion',
+                'addition_deletion' => 'Addition & Deletion',
+                'si_enhancement' => 'SI Enhancement',
+                'combo_a_d_si' => 'Combo A, D & SI',
+                'correction' => 'Correction',
+                'baby_addition' => 'Baby Addition',
+                'policy_instalment' => 'Policy Instalment',
+                'addition_inception' => 'Addition-Inception',
+                'bds_correction' => 'BDS Correction',
+                'policy_correction' => 'Policy Correction',
+                'policy_cancellation' => 'Policy Cancellation',
+            ];
+
+            $data['date_type'] = [
+                'policy_issue_date' => 'Policy Issue Date',
+                'policy_start_date' => 'Policy Start Date',
+                'policy_end_date' => 'Policy End Date',
+            ];
+
+            //filter datas
+            $start_date = $this->request->getGet('start_date');
+            $end_date = $this->request->getGet('end_date');
+            $client_id = $this->request->getGet('client_id');
+            $insurer_id = $this->request->getGet('insurer_id');
+            $policy_type_id = $this->request->getGet('policy_type_id');
+            $date_type = $this->request->getGet('date_type');
+            $issuer = $this->request->getGet('issuer');
+            $status = $this->request->getGet('status');
+
+            $start_date = (!isset($start_date) || $start_date === '' || $start_date === null) ? 0 : $start_date;
+            $end_date = (!isset($end_date) || $end_date === '' || $end_date === null) ? 0 : $end_date;
+
+            $client_id = (!isset($client_id) || $client_id === '' || $client_id === null) ? 0 : $client_id;
+            $insurer_id = (!isset($insurer_id) || $insurer_id === '' || $insurer_id === null) ? 0 : $insurer_id;
+            $policy_type_id = (!isset($policy_type_id) || $policy_type_id === '' || $policy_type_id === null) ? 0 : $policy_type_id;
+            $date_type = (!isset($date_type) || $date_type === '' || $date_type === null) ? 0 : $date_type;
+            $issuer = (!isset($issuer) || $issuer === '' || $issuer === null) ? 0 : $issuer;
+            $status = (!isset($issuer) || $status === '' || $status === null) ? 0 : $status;
+
+            if($bds_edit_pt_id == null){
+                $data['endorsement_data_list'] = $this->policyTransactionModel->getEndorsementTranctionListData($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status);
+            }else{
+                $data['endorsement_data_list'] = [];
+            }
+            $data['client'] = $this->clientModel->where('is_active', 1)->findAll();
+            $data['policy_types'] = $this->policyTypeModel->where('is_active', 1)->findAll();
+
+            $data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll();
+            // $data['tpa']           = $this->tpaModel->where('is_active', 1)->findAll();
+            $data['insurer_branch']      = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
+            $data['tpa']           = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
+            list($policyList, $policyListByClient) = $this->getPolicyForEndorsment();
+
+            $data['endorsementPolicies'] = $policyList;
+            $data['endorsementPolicyListByClient'] = $policyListByClient;
+
+            // dd($data);
+            // print_r($data['endorsementPolicies']);die();
+
+            $this->loadLayout('policy_transaction_endorsement_list_2', $data);
+        }
+
         public function createEndorsementPolicy()
         {
             $id = $this->request->getPost('id');
@@ -2515,6 +2609,220 @@
             }
         }
 
+        public function getEndorsementDataForEdit2($id)
+        {
+            $data = $this->policyTransactionModel
+                ->select('
+                            policy_transaction.*, 
+                            clients.short_name as client_short_name, 
+                            clients.client_type, 
+                            ( 
+                                select last_action_date
+                                from policy_transaction_status
+                                where policy_tran_id = policy_transaction.id
+                                and status = policy_transaction.status
+                                order by id desc
+                                limit 1
+
+                            ) as last_action_date
+                        ')
+                ->join('clients', 'clients.id = policy_transaction.client_id')
+                ->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
+                ->where('policy_transaction.id', $id)
+                ->where('policy_transaction.is_active', 1)
+                ->orderBy('id', 'asc')
+                ->first();
+
+            $pt_id = null;   
+
+            if(!empty($data)){
+                $inception_data = $this->policyTransactionModel
+                        ->where('policy_no', $data['policy_no'])
+                        ->where('client_id', $data['client_id'])
+                        ->where('action_type', 'inception')
+                        ->first();
+                $pt_id = $inception_data['id'];
+            }    
+
+            if (!empty($data['policy_start_date'])) {
+                $data['policy_start_date'] =  change_date_format($data['policy_start_date'], 'Y-m-d', 'd/m/Y');
+            }
+
+            if (!empty($data['policy_end_date'])) {
+                $data['policy_end_date'] =  change_date_format($data['policy_end_date'], 'Y-m-d', 'd/m/Y');
+            }
+
+            if (!empty($data['data_received_date'])) {
+                $data['data_received_date'] =  change_date_format($data['data_received_date'], 'Y-m-d', 'd/m/Y');
+            }
+
+            if (!empty($data['policy_issue_date'])) {
+                $data['policy_issue_date'] =  change_date_format($data['policy_issue_date'], 'Y-m-d', 'd/m/Y');
+            }
+
+            if (!empty($data['endorse_eff_date'])) {
+                $data['endorse_eff_date'] =  change_date_format($data['endorse_eff_date'], 'Y-m-d', 'd/m/Y');
+            }
+
+            if (!empty($data['install_due_date'])) {
+                $data['install_due_date'] =  change_date_format($data['install_due_date'], 'Y-m-d', 'd/m/Y');
+            }
+
+            if (!empty($data['last_action_date'])) {
+                $data['last_action_date'] =  change_date_format($data['last_action_date'], 'Y-m-d', 'd/m/Y');
+            }
+
+            if (!empty($data['month'])) {
+                $data['month'] =  change_date_format($data['month'], 'Y-m-d', 'M/Y');
+            }
+
+            // print_r($data); die;
+
+            //get PT Co-Share Details
+            $data['pt_co_share_details'] = $this->PTCOShareDetailsModel
+
+                ->select("
+                            pt_co_share_details.*,
+                    
+                            (
+                                SELECT
+                                    COUNT(*)
+                                FROM
+                                    co_share_stmt_details
+                                WHERE
+                                    co_share_stmt_details.co_share_id = pt_co_share_details.id
+                                    AND co_share_stmt_details.is_active = 1
+                            ) AS record_count,
+        
+                                (
+                                    SELECT 
+                                        SUM(actual_bp_amt) 
+                                    FROM 
+                                        co_share_stmt_details 
+                                    WHERE 
+                                        co_share_id = pt_co_share_details.id 
+                                        AND is_active = 1
+                                        
+                                ) AS actual_bp_amount,
+                                
+                                (
+                                    SELECT 
+                                        SUM(actual_tp_amt) 
+                                    FROM 
+                                        co_share_stmt_details 
+                                    WHERE 
+                                        co_share_id = pt_co_share_details.id 
+                                        AND is_active = 1
+                                        
+                                ) AS actual_tp_amount,
+                                
+                                (
+                                    SELECT 
+                                        SUM(actual_tep_amt) 
+                                    FROM 
+                                        co_share_stmt_details 
+                                    WHERE 
+                                        co_share_id = pt_co_share_details.id 
+                                        AND is_active = 1
+                                        
+                                ) AS actual_tep_amount,
+                                
+                                (
+                                    SELECT 
+                                        SUM(actual_bp_per) 
+                                    FROM 
+                                        co_share_stmt_details 
+                                    WHERE 
+                                        co_share_id = pt_co_share_details.id 
+                                        AND is_active = 1
+                                        
+                                ) AS actual_bp_percentage,
+                                
+                                (
+                                    SELECT 
+                                        SUM(actual_tp_per) 
+                                    FROM 
+                                        co_share_stmt_details 
+                                    WHERE 
+                                        co_share_id = pt_co_share_details.id 
+                                        AND is_active = 1
+                                        
+                                ) AS actual_tp_percentage,
+                                
+                                (
+                                    SELECT 
+                                        SUM(actual_tep_per) 
+                                    FROM 
+                                        co_share_stmt_details 
+                                    WHERE 
+                                        co_share_id = pt_co_share_details.id 
+                                        AND is_active = 1
+                                        
+                                ) AS actual_tep_percentage,
+                                
+                                
+                                (
+                                    SELECT 
+                                        SUM(actual_bp_brokerage_amt) 
+                                    FROM 
+                                        co_share_stmt_details 
+                                    WHERE 
+                                        co_share_id = pt_co_share_details.id 
+                                        AND is_active = 1
+                                        
+                                ) AS actual_bp_brokerage_amount,
+                                
+                                
+                                (
+                                    SELECT 
+                                        SUM(actual_tp_brokerage_amt) 
+                                    FROM 
+                                        co_share_stmt_details 
+                                    WHERE 
+                                        co_share_id = pt_co_share_details.id 
+                                        AND is_active = 1
+                                        
+                                ) AS actual_tp_brokerage_amount,
+                                
+                                
+                                (
+                                    SELECT 
+                                        SUM(actual_tep_brokerage_amt) 
+                                    FROM 
+                                        co_share_stmt_details 
+                                    WHERE 
+                                        co_share_id = pt_co_share_details.id 
+                                        AND is_active = 1
+                                        
+                                ) AS actual_tep_brokerage_amount, 
+                                 
+                                DATE_FORMAT(pt_policy_issue_date, '%d/%m/%Y') AS pt_policy_issue_date
+        
+                        ")
+                ->where('pt_id', $id)
+                ->where('is_active', 1)
+                ->orderBy('id', 'asc')
+                ->findAll();
+
+            // print_r($data['endorse_eff_date']); die;
+
+            $pt_bp_amt = $this->PTCOShareDetailsModel
+                ->select('bp_amt, amount')
+                ->where('pt_id', $id)
+                ->where('co_share_type', 1)
+                ->where('is_active', 1)
+                ->first();
+
+            // dd(db_connect()->getLastQuery() ,$pt_bp_amt);
+            $data['base_cd_amount'] = $pt_bp_amt['amount'] ?? null;
+
+            if ($data) {
+                return $this->respond(['status' => true, 'data' => $data, 'pt_id' => $pt_id], 200);
+            } else {
+                return $this->respond(['status' => false], 200);
+            }
+        }
+
         //------------------------------------------------------------------------------------------------
 
         //file upload function 
diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php
index 68950c44..eb8bfea0 100755
--- a/app/Views/layout/header.php
+++ b/app/Views/layout/header.php
@@ -2047,6 +2047,12 @@
                                                      Policy 2
                                                 
                                             
+                                            
  • + + + Endorsement 2 + +
  • diff --git a/app/Views/policy_transaction_endorsement_form_2.php b/app/Views/policy_transaction_endorsement_form_2.php new file mode 100644 index 00000000..94180c52 --- /dev/null +++ b/app/Views/policy_transaction_endorsement_form_2.php @@ -0,0 +1,2995 @@ + + + + + + + + + + + diff --git a/app/Views/policy_transaction_endorsement_list_2.php b/app/Views/policy_transaction_endorsement_list_2.php new file mode 100644 index 00000000..60e37342 --- /dev/null +++ b/app/Views/policy_transaction_endorsement_list_2.php @@ -0,0 +1,1036 @@ + + + + +
    +
    +
    +
    +
    +

    + Filter + + + +

    +
    +
    +
    +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    +
    + +
    + +
    + + +
    + +
    + + +
    + + + +
    + + + +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + $row) { ?> + + + + + + + + + + + + + + + + + + +
    SnoIssuerClientBranchInsurerPolicyEndorsement TypeEndorsement NoData Recived DateNo of InsuredNo of DependencePolicy Issue DateStatusAction
    + +
    +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/app/Views/policy_transaction_inception_form_2.php b/app/Views/policy_transaction_inception_form_2.php index a1db7f44..edbfa453 100644 --- a/app/Views/policy_transaction_inception_form_2.php +++ b/app/Views/policy_transaction_inception_form_2.php @@ -718,10 +718,9 @@ -->
    - - + +
    -
    @@ -1831,11 +1830,6 @@ // $('#cd_ac_no_for_edit').val(res.data.cd_ac_no); $('#cd_ac_pk_for_leader').val(res.data.cd_ac_pk); - - // $('#entity_type_id').val(res.data.entity_type_id); - // getKYCEntityDocument(res.data.entity_type_id, res.data.client_id); - // appendKycTableListData(res.data.client_kyc); - // please don't forgot this ==> look at here please don't don't forgot $('#docs_type_id').empty(); // ✅ clear old options @@ -1843,133 +1837,6 @@ $('#tbody').empty(); $('#tbody').append(res.data.client_kyc_single_table); - - // let tbody = $('#tbody'); - // tbody.empty(); // ✅ Always clear first - - // let ckdlist = res.data.client_kyc_document_list; - - // if (!ckdlist || ckdlist.length === 0) { - - // // ✅ Show single merged row when no data - // let emptyRow = ` - // - // - // No data found - // - // - // `; - - // tbody.append(emptyRow); - // // return; // ✅ Stop further execution - // } - // else{ - // $.each(ckdlist, function (index, value) { - - // let sno = index + 1; - - // // ✅ If kyc_doc_type_id is null → use other_docs_name - // let docName = (value.kyc_doc_type_id === null || value.kyc_doc_type_id === '') - // ? value.other_docs_name - // : value.kyc_doc_type_id; - - // let fileName = value.file_name ? value.file_name : '-'; - - // let downloadBtn = ` - // - // - // `; - - // // Inside your $.each(list, function (index, value) { ... }) loop - // let editBtn = ` - // `; - - // // The edit UI block to be toggled - // let editUI = ` - // - // - //
    - // - // - // - - //
    - - //
    - // - // - //
    - - //
    - // - //
    - - //
    - // - //
    - - //
    - - //
    - // - // - // `; - - - - // let deleteBtn = ` - // - // `; - - // let row = ` - // ${sno} - // ${value.ui_docs_name} - // ${fileName} - // - // ${downloadBtn} - // ${editBtn} - // ${deleteBtn} - // - // - // ${editUI} `; - - // tbody.append(row); - // }); - // } - // // docs_type_id - // // res.data.client_kyc_dd_data // Setting values to correct fields $('#policy_tranction_primarykey').val(res.data.id); @@ -2045,6 +1912,18 @@ setTimeout(function() { // populateTable(res.data.pt_co_share_details, res.data.cd_ac_pk); populateCards(res.data.pt_co_share_details, res.data.cd_ac_pk); + let s = res.data.policy_start_date.split('/'); // ["DD","MM","YYYY"] + let e = res.data.policy_end_date.split('/'); // ["DD","MM","YYYY"] + + let start = new Date(s[2], s[1] - 1, s[0]); // YYYY, MM-1, DD + let end = new Date(e[2], e[1] - 1, e[0]); + let months = (end.getFullYear() - start.getFullYear()) * 12 + (end.getMonth() - start.getMonth()); + if (end.getDate() >= start.getDate()) { months += 1; } + let yearDiff = Math.ceil(months / 12); + // let yearDiff = (parseInt(e[2]) - parseInt(s[2])) + 1; + console.log("yearDiff =", yearDiff); + if (yearDiff > 1) { updateInsurerTitles(yearDiff); } + }, 1000); } @@ -3657,6 +3536,17 @@ co_share_type.forEach((value, index) => { formData.append(`co_share_type[${index}]`, value); }); + + let bp = document.getElementById("base_premium").value; + let tp = document.getElementById("tp_premium").value; + let ter = document.getElementById("ter_premium").value; + + for (let i = 0; i < insurerCount; i++) { + formData.append(`base_premium[${i}]`, bp); + formData.append(`tp_premium[${i}]`, tp); + formData.append(`ter_premium[${i}]`, ter); + } + //covert date to mysql format // alert(formData.get('policy_issue_date')); @@ -4427,7 +4317,7 @@ let cardHTML = `
    -
    Insurer - ${insurerCount}
    +
    Insurer - ${insurerCount}
    ${showAdd} @@ -4492,7 +4382,7 @@
    - +
    @@ -4774,6 +4664,9 @@
    `; $('#allInsurerCards').append(cardHTML); + setBPValue($('#base_premium').val()); + setTEPValue($('#ter_premium').val()); + setTPValue($('#tp_premium').val()); $('#follow_insurer_id_' + insurerCount).select2(); @@ -4891,8 +4784,27 @@ } console.log("UpdatedCa:", insurerCount); + updateInsurerTitles(yearDiff); } + function updateInsurerTitles(yearDiff) { + + $(".insurer-card-title").each(function (index) { + let cardIndex = index + 1; + + // Base title: Insurer - X + let title = `Insurer - ${cardIndex}`; + + // Add "(Year X)" only for the first yearDiff cards + if (cardIndex <= yearDiff) { + title += ` (Year ${cardIndex})`; + } + + $(this).text(title); + }); + } + + function resetInsurerCards() { @@ -6714,9 +6626,11 @@ } function setBPValue(inputValue) { - const bpValueField = document.querySelector('.bp_value'); - if (bpValueField) { - bpValueField.value = inputValue; + let bpValueField = document.querySelectorAll('.bp_value'); + + if(bpValueField){ + bpValueField.forEach((field) => { field.value = inputValue; }); + console.log("Updated", bpValueField.length, "hidden base premiums"); } else { console.error("Error: Element with class '.bp_value' not found."); } @@ -6724,9 +6638,11 @@ } function setTPValue(inputValue) { - const tpValueField = document.querySelector('.tp_value'); + let tpValueField = document.querySelectorAll('.tp_value'); + if (tpValueField) { - tpValueField.value = inputValue; + tpValueField.forEach((field) => { field.value = inputValue; }); + console.log("Updated", tpValueFields.length, "hidden tp premiums"); } else { console.error("Error: Element with class '.tp_value' not found."); } @@ -6734,9 +6650,11 @@ } function setTEPValue(inputValue) { - const tepValueField = document.querySelector('.tep_value'); + let tepValueField = document.querySelectorAll('.ter_value'); + tepValueField.forEach((field) => { field.value = inputValue; }); if (tepValueField) { tepValueField.value = inputValue; + console.log("Updated", tepValueField.length, "hidden tep premiums"); } else { console.error("Error: Element with class '.tep_value' not found."); } From 8fea95d9855d4f882843a45267e439757ea92c84 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 11 Dec 2025 11:44:30 +0530 Subject: [PATCH 10/16] FIX_BDS_NEW_CLIENT_EMAIL_ISSUE --- app/Controllers/ClientController.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 07243340..e42266d2 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -4832,8 +4832,9 @@ class ClientController extends AdminController $client_data = [ 'client_type' => $postData['client_type'], 'client_name' => $postData['client_name'], - 'email' => $postData['short_name'] ?? $postData['client_name'], - 'phone' => $postData['mobile'], + 'short_name' => $postData['short_name'] ?? $postData['client_name'], + 'email' => $postData['email'] ?? null, + 'phone' => $postData['mobile'] ?? null, 'client_code' => generate_client_code() ]; @@ -4844,6 +4845,8 @@ class ClientController extends AdminController 'client_type' => $postData['client_type'], 'client_name' => $postData['client_name'], 'short_name' => $postData['short_name'] ?? $postData['client_name'], + 'email' => $postData['email'] ?? null, + 'phone' => $postData['mobile'] ?? null, 'client_code' => generate_client_code(), 'entity_type_id' => 2 ]; @@ -4958,8 +4961,9 @@ class ClientController extends AdminController $client_data = [ 'client_type' => $data['client_type'], 'client_name' => $data['client_name'], - 'email' => $data['short_name'] ?? $data['client_name'], - 'phone' => $data['mobile'], + 'short_name' => $postData['short_name'] ?? $data['client_name'], + 'email' => $data['email'] ?? null, + 'phone' => $data['mobile'] ?? null, 'client_code' => generate_client_code() ]; @@ -4970,6 +4974,8 @@ class ClientController extends AdminController 'client_type' => $data['client_type'], 'client_name' => $data['client_name'], 'short_name' => $data['short_name'] ?? $data['client_name'], + 'email' => $data['email'] ?? null, + 'phone' => $data['mobile'] ?? null, 'client_code' => generate_client_code(), 'entity_type_id' => 2 ]; From 97a970b3fae1ec54b6c8734c138a08a750944c73 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 11 Dec 2025 12:43:45 +0530 Subject: [PATCH 11/16] FIX_BDS_RENEWAL_REPORT_LOADING_ISSUE --- app/Controllers/BDSReportController.php | 3 +- app/Views/bds_renewal_report_list.php | 6 +- app/Views/renewal_search.php | 140 +++++++++++++----------- 3 files changed, 80 insertions(+), 69 deletions(-) diff --git a/app/Controllers/BDSReportController.php b/app/Controllers/BDSReportController.php index 6a9d90f1..abc1ac14 100644 --- a/app/Controllers/BDSReportController.php +++ b/app/Controllers/BDSReportController.php @@ -928,7 +928,8 @@ class BDSReportController extends AdminController $default_start = new \DateTime(); $data['default_end'] = $default_start->format('d-m-Y'); $data['default_start'] = $default_start->modify('-60 days')->format('d-m-Y'); - $data['issuer_branch'] = $this->nhanceBranchModel->where('is_active', 1)->findAll();; + $data['issuer_branch'] = $this->nhanceBranchModel->where('is_active', 1)->findAll(); + $data['client_list'] = $this->clientModel->where('is_active', 1)->findAll(); $data['tab_name'] = "Renewal Reports"; $data['page_name'] = "Renewal Report"; return $this->loadLayout('renewal_search', $data); diff --git a/app/Views/bds_renewal_report_list.php b/app/Views/bds_renewal_report_list.php index c4873dda..16bb337a 100644 --- a/app/Views/bds_renewal_report_list.php +++ b/app/Views/bds_renewal_report_list.php @@ -20,12 +20,12 @@ table.dataTable tbody td {
    -
    -
    +
    +
    diff --git a/app/Views/renewal_search.php b/app/Views/renewal_search.php index 6cdca11d..f6b8c348 100644 --- a/app/Views/renewal_search.php +++ b/app/Views/renewal_search.php @@ -1,75 +1,80 @@ -
    +
    -
    -
    -
    -

    - Filter - - - -

    -
    -
    - -
    -
    - - -
    - - -
    - > - > +
    +
    +

    + Filter + + + +

    +
    +
    + +
    +
    + + +
    + +
    + > + > +
    -
    - - + + $value) { + echo ""; } - ?> - -
    - - -
    - - -
    - -
    - - -
    - + } + ?> +
    -
    -
    - Submit -
    + +
    + +
    - + +
    + + +
    +
    +
    + +
    + Submit +
    +
    +
    @@ -85,8 +90,9 @@ let client_list = []; $(document).ready(function() { - getClientAndBranchAndPolicy(); + // getClientAndBranchAndPolicy(); $('#client_id').select2(); + $('#issuer_branch').select2(); }) $(function() { @@ -173,9 +179,13 @@ //get client , branch, policy data function getClientAndBranchAndPolicy() { + + return_type = 'client'; + $.ajax({ url: '', type: "GET", + data:{ return_type : return_type}, dataType: 'json', success: function(res) { From 0a6a225f5db378ffbf7451b9314c698416e8693a Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 11 Dec 2025 13:01:10 +0530 Subject: [PATCH 12/16] FIX_DUBLICATE_SALE_AND_SERVICE_USER --- app/Controllers/PolicyTransactionController.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 7e154d64..66798ee5 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -837,6 +837,7 @@ ->where('user_teams.team_id', 5) ->where('user_teams.is_active', 1) ->where('user_profiles.is_active', 1) + ->groupBy('user_profiles.id', 'asc') ->findAll(); // Fetch Partner Agent @@ -858,6 +859,7 @@ ->join('user_profiles AS rm', 'user_profiles.rm_id = rm.id', 'left') ->where('user_profiles.role', 3) ->where('user_profiles.is_active', 1) + ->groupBy('user_profiles.id', 'asc') ->findAll(); // echo '
    ';
    @@ -2308,7 +2310,12 @@
                         'listed_insurers' => $issue_type['listed_insurers'] ?? null,
                         'ppteam' => $issue_type['ppteam'] ?? null,
                         'sales_generated_by' => $issue_type['sales_generated_by'] ?? null,
    -                    'serviced_by' => $issue_type['serviced_by'] ?? null
    +                    'serviced_by' => $issue_type['serviced_by'] ?? null,
    +                    'salse_person_manager_id' => $issue_type['salse_person_manager_id'] ?? null,
    +                    'service_person_manager_id' => $issue_type['service_person_manager_id'] ?? null,
    +                    'service_person_branch_id' => $issue_type['service_person_branch_id'] ?? null,
    +                    'agent_id' => $issue_type['agent_id'] ?? null,
    +                    'agent_code' => $issue_type['agent_code'] ?? null,
                     ];
     
                     $data['client_branch_id'] = $client_branch_id;
    
    From 4cf762ca9c33207fcc09e9da28efd0bd29ed88de Mon Sep 17 00:00:00 2001
    From: "sanjeev.p" 
    Date: Thu, 11 Dec 2025 14:27:53 +0530
    Subject: [PATCH 13/16] FIX_Advertise Image Changes
    
    ---
     app/Config/Routes.php                         |   3 +-
     .../AppContentManagementController.php        |  74 ++-
     app/Views/add_image_list.php                  | 445 +++++++++++-------
     3 files changed, 343 insertions(+), 179 deletions(-)
    
    diff --git a/app/Config/Routes.php b/app/Config/Routes.php
    index bd9feb09..9ce825b5 100755
    --- a/app/Config/Routes.php
    +++ b/app/Config/Routes.php
    @@ -52,10 +52,11 @@ $routes->get("importRules", "RuleImportController::upload");
     // $routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
     
     $routes->post("add_advertise_image", "AppContentManagementController::add_advertise_image");
    +$routes->post('remove_advertise_image', 'AppContentManagementController::remove_advertise_image');
     $routes->get("add_image_index", "AppContentManagementController::add_image_index");
     $routes->get("getAdvertiseImage/(:any)", "AppContentManagementController::getAdvertiseImage/$1");
     $routes->get("frontend_content", "AppContentManagementController::frontend_content");
    -$routes->get('showAdvertiseImage/(:any)', 'AdvertiseController::showAdvertiseImage/$1');
    +$routes->get('showAdvertiseImage/(:any)', 'AppContentManagementController::showAdvertiseImage/$1');
     
     
     // $routes->get('/', 'LoginController::index');
    diff --git a/app/Controllers/AppContentManagementController.php b/app/Controllers/AppContentManagementController.php
    index f9e1d356..83de29b6 100755
    --- a/app/Controllers/AppContentManagementController.php
    +++ b/app/Controllers/AppContentManagementController.php
    @@ -10,6 +10,7 @@ use CodeIgniter\API\ResponseTrait;
     
     use App\Models\AddImgModel;
     use App\Models\FEContentModel;
    +use App\Models\ClientModel;
     
     class AppContentManagementController extends AdminController
     {   
    @@ -17,19 +18,31 @@ class AppContentManagementController extends AdminController
         protected $myLogger;
         protected $addImgModel;
         protected $feContentModel;
    +    protected $clientModel;
    +    
         
         public function __construct()
         {
             $this->myLogger = \Config\Services::mylogger();
    -        $this->addImgModel  = new AddImgModel();                
    +        $this->addImgModel     = new AddImgModel();                
             $this->feContentModel  = new FEContentModel();                
    +        $this->clientModel     = new ClientModel();
         }
         public function add_image_index()
         {   
             $this->myLogger->logme('error','Addvertisement Image list function called');
             $headerData['tab_name'] = 'Addvertisement Images';
             $headerData['page_name'] = 'Addvertisement Images';
    -        $data['addImageList'] = $this->addImgModel->findAll();
    +        // $data['addImageList'] = $this->addImgModel->findAll();
    +        $data['addImageList'] = $this->addImgModel->select('advertisement_images.*, 
    +                                                                clients.client_name,
    +                                                                clients.short_name,
    +                                                                CASE WHEN advertisement_images.is_active = 1 THEN "Active" ELSE "Inactive" END AS status', false)
    +                                ->join('clients', 'advertisement_images.client_id = clients.id', 'left')
    +                                ->where('advertisement_images.is_active', 1)
    +                                ->findAll();
    +
    +        $data['client'] = $this->clientModel->where('is_active', 1)->findAll();
     
             // dd($data);
     
    @@ -40,12 +53,14 @@ class AppContentManagementController extends AdminController
             // $this->loadLayout('client_onboarding', $data);
         }
     
    +    // using add and edit 
         public function add_advertise_image() {
                 try {
                     $file = $this->request->getFile('advertise_image');
    +                $client_id = $this->request->getPost('client_id');
                     //1) original file name for vaildations
                     $fileName = $file->getClientName(); //original file name for vaildations
    -                $existing = $this->addImgModel->where('name', $fileName)->where('is_active', 1)->first();
    +                $existing = $this->addImgModel->where('name', $fileName)->where('client_id', $fileName)->where('is_active', 1)->first();
                     if($existing){ return $this->respond(['status' => false, 'message' => 'This file has already been uploaded in active state.'], 400); }
     
                     //skip 1) and use this 
    @@ -62,7 +77,7 @@ class AppContentManagementController extends AdminController
                     $file->move($uploadPath, $fileName);
     
                     $id = $this->request->getPost('add_image_id');
    -                $data = ['name' => $fileName];
    +                $data = ['name' => $fileName,'client_id'=>$client_id];
     
                     if ($id == 0) {
                         $this->addImgModel->insert($data);
    @@ -76,22 +91,57 @@ class AppContentManagementController extends AdminController
             }
         }
     
    -    public function showAdvertiseImage($fileName)
    +    public function remove_advertise_image()
         {
    +        try {
    +            $id = $this->request->getPost('add_image_id');
     
    -        $filePath = WRITEPATH . 'uploads/advertiseImage/' . $fileName;
    +            if (!$id) {
    +                return $this->respond(['status' => false, 'message' => 'ID missing'], 400);
    +            }
     
    -        if (!file_exists($filePath)) {
    -            return $this->response->setStatusCode(404, 'File not found');
    +            $data = ['is_active' => 0];
    +            $this->addImgModel->update($id, $data);
    +
    +            return $this->respond(['status' => true, 'message' => 'Deleted successfully']);
    +            
    +        } catch (\Exception $e) {
    +            return $this->respond(['status' => false, 'message' => $e->getMessage()], 500);
    +        }
    +    }
    +
    +
    +    // public function showAdvertiseImage($fileName)
    +    // {
    +
    +    //     $filePath = WRITEPATH . 'uploads/advertiseImage/' . $fileName;
    +
    +    //     if (!file_exists($filePath)) {
    +    //         return $this->response->setStatusCode(404, 'File not found');
    +    //     }
    +
    +    //     $mimeType = mime_content_type($filePath);
    +    //     header('Content-Type: ' . $mimeType);
    +    //     readfile($filePath);
    +    //     exit;
    +    // }
    +
    +    // In AppContentManagementController.php (This is what needs to be fixed if the direct path fails)
    +
    +    public function showAdvertiseImage($filename)
    +    {
    +        $path = WRITEPATH . 'uploads/advertiseImage/' . $filename;
    +
    +        if (!file_exists($path)) {
    +            throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
             }
     
    -        $mimeType = mime_content_type($filePath);
    -        header('Content-Type: ' . $mimeType);
    -        readfile($filePath);
    -        exit;
    +        $mime = mime_content_type($path);
    +        return $this->response->setHeader('Content-Type', $mime)->setBody(file_get_contents($path));
         }
     
     
    +
         public function getAdvertiseImage($image_id){
     
             $image_data = $this->addImgModel->select('name')->where(['id' => $image_id])->first();
    diff --git a/app/Views/add_image_list.php b/app/Views/add_image_list.php
    index ff3770a1..a8552d0b 100755
    --- a/app/Views/add_image_list.php
    +++ b/app/Views/add_image_list.php
    @@ -40,6 +40,8 @@ table.dataTable thead th {
                         
    + + @@ -49,19 +51,18 @@ table.dataTable thead th { + + + - - @@ -88,6 +89,7 @@ table.dataTable thead th { + + +
    + +
    + +
    + +
    + + +
    +
    + + +
    + + +
    +
    + + +
    + Preview + + + dimensions - 1640x664 pixels
    size - 200kb +
    +
    + +
    + +
    @@ -116,158 +173,191 @@ table.dataTable thead th { \ No newline at end of file From 5df84786636824d824fed15e6ef708eef49cb511 Mon Sep 17 00:00:00 2001 From: velz Date: Thu, 11 Dec 2025 14:58:41 +0530 Subject: [PATCH 14/16] FIX_COMMISSION_RELRATED --- app/Controllers/DeployController.php | 10 ++++++++-- app/Controllers/InsuranceCommissionController.php | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/Controllers/DeployController.php b/app/Controllers/DeployController.php index de73092a..c763d9a3 100644 --- a/app/Controllers/DeployController.php +++ b/app/Controllers/DeployController.php @@ -176,7 +176,7 @@ class DeployController extends AdminController public function fedeploy() { $request = $this->request; - + echo 'HI';die(); // Single zip file: $file = $request->getFile('zip_file'); @@ -186,7 +186,7 @@ class DeployController extends AdminController 'message' => 'No valid zip file uploaded', ]); } - + echo 'cool';die(); // Read scalar form values $zipFolder = (string) $request->getPost('zip_folder') ?: 'web/'; $s3Bucket = (string) $request->getPost('s3_bucket') ?: ''; @@ -283,4 +283,10 @@ class DeployController extends AdminController $this->loadLayout('fedeploy'); } + public function fetest() + { + echo 'Hello from DeployController fetest!'; + + } + } diff --git a/app/Controllers/InsuranceCommissionController.php b/app/Controllers/InsuranceCommissionController.php index f2907bf6..6f3f60ac 100644 --- a/app/Controllers/InsuranceCommissionController.php +++ b/app/Controllers/InsuranceCommissionController.php @@ -10,6 +10,7 @@ class InsuranceCommissionController extends AdminController use ResponseTrait; private $rules = []; + private $myLogger; public function __construct() { @@ -66,7 +67,7 @@ class InsuranceCommissionController extends AdminController $folderName = $month . $year; // SEP2025 $insurerId = $input['insurer_id']; // 5 - $department = ucfirst(strtolower($input['department'])); // Motor, Health, Fire + $department = (strtolower($input['department'])); // Motor, Health, Fire // Final Path: WRITEPATH/rules/SEP2025/5_Motor.json $rulesPath = WRITEPATH . "uploads/commission/rules/{$folderName}/{$insurerId}_{$department}.json"; @@ -183,6 +184,8 @@ class InsuranceCommissionController extends AdminController private function compareValues($actual, string $operator, $expected): bool { + $actual = strtolower($actual); + $expected = strtolower($expected); switch ($operator) { case '==': return $actual == $expected; From 02ffc0cae96768f596d051beb68887619e172ff3 Mon Sep 17 00:00:00 2001 From: "sanjeev.p" Date: Thu, 11 Dec 2025 15:23:11 +0530 Subject: [PATCH 15/16] FIX_The policy does not have a CD account number --- app/Controllers/AppContentManagementController.php | 2 +- app/Controllers/EmployeeController.php | 4 ++++ app/Views/add_image_list.php | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Controllers/AppContentManagementController.php b/app/Controllers/AppContentManagementController.php index 83de29b6..fcc9a6d6 100755 --- a/app/Controllers/AppContentManagementController.php +++ b/app/Controllers/AppContentManagementController.php @@ -42,7 +42,7 @@ class AppContentManagementController extends AdminController ->where('advertisement_images.is_active', 1) ->findAll(); - $data['client'] = $this->clientModel->where('is_active', 1)->findAll(); + $data['client'] = $this->clientModel->where('is_active', 1)->where('client_type', 1)->findAll(); // dd($data); diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index ca24ec6b..39298198 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -2308,6 +2308,10 @@ class EmployeeController extends AdminController } $message = isset($message) ? ($message . ' not defined for choosed policy') : null; + if ($policy_details['cd_ac_pk'] == null) { + $message = isset($message) ? ($message . ' The policy does not have a CD account number.') : null; + } + return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message, 'si_enhancement' => $si_enhancement_true_or_false, 'insurer_multi_event' => $insurer_details['is_multi_event'], 'tpa_api_service_status' => $tpa_api_service_status], 200); } diff --git a/app/Views/add_image_list.php b/app/Views/add_image_list.php index a8552d0b..e83cc7d7 100755 --- a/app/Views/add_image_list.php +++ b/app/Views/add_image_list.php @@ -294,6 +294,7 @@ table.dataTable thead th { $(document).ready(function() { $('#add_image_id').val(''); $('#client_id').val(''); + $('#client_id').select2(); $('#advertise_image').val(''); table = $('#tickets-table').DataTable({ // dom: "<'row'<'col-sm-1'f><'col-sm-11 text-right'B>>" + // Filter left, button right From 44936c45be9e00fa762e4f1169cb46e4b297a3b1 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 11 Dec 2025 16:00:58 +0530 Subject: [PATCH 16/16] FIX_CLAIM_STATUS --- app/Controllers/EmployeeRestController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index ba55137d..d80f9176 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -2592,7 +2592,7 @@ class EmployeeRestController extends AdminController // print_r($ticketHistory); die; $currentClaimStatus = $this->claimStatusModel->select("claim_status")->where('id', $data['claims_data']['claim_status_id'])->where('is_active', 1)->first(); - $ticketClaimStatus = $this->claimStatusModel->select('claim_status, display_name')->where('display_name is not null')->where('is_active', 1)->findAll(); + $ticketClaimStatus = $this->claimStatusModel->select('claim_status, display_name')->where('display_name is not null')->where('ticket_type', $data['claims_data']['ticket_type_id'])->where('is_active', 1)->findAll(); $status_list = array_column($ticketClaimStatus, 'display_name', 'claim_status'); // print_r($currentClaimStatus); die;
    Advertisement Image Name
    Client Name
    Client Short Name
    Status
    Action
    - - -