From b3136b0158bc6a00e913bf9606e26c31cc3c3d4d Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Fri, 16 May 2025 16:02:18 +0530 Subject: [PATCH] FEAT_BDS_INSTALLMENT_MORE_INFO_MODAL --- app/Config/Routes.php | 5 +- .../PolicyTransactionController.php | 51 +++- .../policy_transaction_inception_form.php | 228 +++++++++++++++++- 3 files changed, 280 insertions(+), 4 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index ef4c655c..f11f6451 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -332,7 +332,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) { $routes->get("send_manual_ecard/(:any)", "DashboardController::sendManualEcard/$1"); $routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1"); $routes->get("get_client_branch_data/(:any)", "ClientController::get_client_branch_data/$1"); - $routes->get("getLevelContects", "LeadsController::getLevelContects"); + $routes->get("getLevelContects", "LeadsControllerg::getLevelContects"); $routes->get("get_emp_master_data_for_update/(:any)", "EmployeeController::get_emp_master_data_for_update/$1"); $routes->get("send_mail_for_individual_employee_ecard/(:any)", "EmployeeController::send_mail_for_individual_employee_ecard/$1"); $routes->post("update_emp_data", "EmployeeController::update_emp_data"); @@ -365,6 +365,9 @@ $routes->cli("cli/sendInstallmentRemainderMail","PolicyTransactionController::se $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) { + $routes->post("getMoreInfo","PolicyTransactionController::getMoreInfo"); + $routes->post("saveInstallment","PolicyTransactionController::saveInstallment"); + $routes->group("inception", ["filter" => "authMVC"], function ($routes) { $routes->match(['get', 'post'], 'list', 'PolicyTransactionController::viewInception'); $routes->post("create", "PolicyTransactionController::createInceptionPolicy"); diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index ea4a45de..ee8dfe6c 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -235,8 +235,7 @@ class PolicyTransactionController extends BaseController ->where('role', 3) // Assuming `role` is in `user_profiles` ->where('is_active', 1) ->findAll(); - - // echo '
';
+            // echo '
';
         // print_r($data['ppTeamsData']); die;
 
         // dd($data);
@@ -2905,4 +2904,52 @@ class PolicyTransactionController extends BaseController
             $this->myLogger->logme('error', 'Exception: ' . $e->getMessage() . 'Page: ' . $e->getFile() . ' Line: ' . $e->getLine());
         }
     }
+
+    public function getMoreInfo() {
+
+        $pt_id = $this->request->getPost("pt_id");
+        $data_to_send['bds_data'] = $this->BdsPlacementModel->where("is_active",1)->where("pt_id",$pt_id)->findAll();
+
+        foreach ($data_to_send['bds_data'] as &$data) {
+
+            $data['payment_date'] = (new \DateTime($data['payment_date']))->format('d-m-Y');
+        }
+
+        if (!empty($data_to_send)) {
+
+            return $this->respond(['status' => true , "data" => $data_to_send],200);
+        }else {
+
+            return $this->respond(['status' => false,"No Data Found For the Policy Transaction"],404);
+        }
+
+    }
+
+    public function saveInstallment() {
+    
+        $installments = $this->request->getPost('installments');
+    
+        if (!$installments || !is_array($installments)) {
+            return $this->respond(['status' => false, 'message' => 'No data received'], 400);
+        }
+
+        $this->myLogger->logme("error",json_encode($installments));
+        // die();
+
+        foreach ($installments as &$row) {
+            // Convert date from d-m-Y to Y-m-d
+            if (!empty($row['payment_date'])) {
+                $date = \DateTime::createFromFormat('d-m-Y', $row['payment_date']);
+                if ($date) {
+                    $row['payment_date'] = $date->format('Y-m-d');
+                }
+            }
+            $this->BdsPlacementModel->save($row);
+        }
+
+        return $this->respond(['status' => true, 'message' => 'Data saved successfully'], 200);
+    }
+
+
+
 }
diff --git a/app/Views/policy_transaction_inception_form.php b/app/Views/policy_transaction_inception_form.php
index 3621bd08..e7632e56 100644
--- a/app/Views/policy_transaction_inception_form.php
+++ b/app/Views/policy_transaction_inception_form.php
@@ -129,6 +129,18 @@
        color: #666;
 }
 
+.info-icon {
+        color: #007bff;
+        font-size: 15px;
+        transition: 0.3s ease;
+        cursor: pointer;
+    }
+
+    .info-icon:hover {
+        color: #0056b3;
+        font-size: 24px;
+    }
+
 
 
 
@@ -525,7 +537,9 @@
- +
@@ -933,8 +947,220 @@ + + +