diff --git a/.env.sample b/.env.sample index 6af188a4..b3f6111e 100644 --- a/.env.sample +++ b/.env.sample @@ -14,13 +14,14 @@ # ENVIRONMENT #-------------------------------------------------------------------- -CI_ENVIRONMENT = development +# CI_ENVIRONMENT = development #-------------------------------------------------------------------- # APP #-------------------------------------------------------------------- -app.baseURL = 'http://localhost/nhance/' +app.baseURL = 'http://localhost/client_changes/nhance/' +app.appTimezone = 'Asia/Kolkata' # If you have trouble with `.`, you could also use `_`. # app_baseURL = '' # app.forceGlobalSecureRequests = false @@ -31,19 +32,74 @@ app.baseURL = 'http://localhost/nhance/' #-------------------------------------------------------------------- +# Dev DB Connection database.default.hostname = 119.18.54.85 database.default.database = venbaehn_nhance database.default.username = venbaehn_nhance_user1 database.default.password = 'iM~X7(cR+}A-' +database.default.DBDriver = MySQLi +database.default.DBPrefix = +database.default.port = 3306 + +database.tests.hostname = 119.18.54.85 +database.tests.database = venbaehn_nhance +database.tests.username = venbaehn_nhance_user1 +database.tests.password = 'iM~X7(cR+}A-' +database.tests.DBDriver = MySQLi +database.tests.DBPrefix = +database.tests.port = 3306 + +# Test DB Connection + +# database.default.hostname = 119.18.54.85 +# database.default.database = venbaehn_nhance_test +# database.default.username = venbaehn_nhance_user1 +# database.default.password = 'iM~X7(cR+}A-' # database.default.DBDriver = MySQLi # database.default.DBPrefix = # database.default.port = 3306 -database.default.hostname = 119.18.54.85 -database.default.database = venbaehn_nhance -database.default.username = venbaehn_nhance_user1 -database.default.password = 'iM~X7(cR+}A-' +# database.tests.hostname = 119.18.54.85 +# database.tests.database = venbaehn_nhance_test +# database.tests.username = venbaehn_nhance_user1 +# database.tests.password = 'iM~X7(cR+}A-' +# database.tests.DBDriver = MySQLi +# database.tests.DBPrefix = +# database.tests.port = 3306 + +# UAT DB Connection + +# database.default.hostname = 119.18.54.85 +# database.default.database = venbaehn_nhance_uat +# database.default.username = venbaehn_nhance_user1 +# database.default.password = 'iM~X7(cR+}A-' +# database.default.DBDriver = MySQLi +# database.default.DBPrefix = +# database.default.port = 3306 + +# database.tests.hostname = 119.18.54.85 +# database.tests.database = venbaehn_nhance_uat +# database.tests.username = venbaehn_nhance_user1 +# database.tests.password = 'iM~X7(cR+}A-' +# database.tests.DBDriver = MySQLi +# database.tests.DBPrefix = +# database.tests.port = 3306 + +# Local PhpMyAdmin DB Connection + +# database.default.hostname = localhost +# database.default.database = nhance +# database.default.username = root +# database.default.password = '' +# database.default.DBDriver = MySQLi +# database.default.DBPrefix = +# database.default.port = 3306 + +# database.tests.hostname = localhost +# database.tests.database = nhance +# database.tests.username = root +# database.tests.password = '' # database.tests.DBDriver = MySQLi # database.tests.DBPrefix = # database.tests.port = 3306 @@ -125,12 +181,12 @@ database.default.password = 'iM~X7(cR+}A-' #-------------------------------------------------------------------- # session.driver = 'CodeIgniter\Session\Handlers\FileHandler' -# session.cookieName = 'ci_session' -# session.expiration = 7200 +session.cookieName = 'ci_session_dev' +session.expiration = 86400 # session.savePath = null # session.matchIP = false -# session.timeToUpdate = 300 -# session.regenerateDestroy = false +session.timeToUpdate = 300 +session.regenerateDestroy = true #-------------------------------------------------------------------- # LOGGER @@ -151,5 +207,10 @@ database.default.password = 'iM~X7(cR+}A-' GOOGLE_OAUTH_APP_NAME = 'OAuth' GOOGLE_OAUTH_CLIENT_ID = '696241936560-m2mr272ge7vr2n4q36c22l3d2gdgi90l.apps.googleusercontent.com' GOOGLE_OAUTH_CLIENT_SECRET = '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' -GOOGLE_OAUTH_REDIRECT_URI = 'http://localhost/nhance/oauth2callback' +GOOGLE_OAUTH_REDIRECT_URI = 'http://localhost/client_changes/nhance/oauth2callback' GOOGLE_OAUTH_SCOPES = "https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/userinfo.profile" + + +App_Url = https://venbait.in/nhance/app/dev/ +POST_ENROLLMENT_APP_LINK = https://venbait.in/nhance/employee/dev/ +NHANCE_LOGO = https://venbait.in/nhance/dev/public/assets/images/Nhance_Favi.png \ No newline at end of file diff --git a/app/Config/Routes.php b/app/Config/Routes.php index a0106507..3e79d7a7 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -49,7 +49,7 @@ $routes->group("/user", ["filter" => "authMVC"], function ($routes) { $routes->group("/dashboard", ["filter" => "authMVC"], function ($routes) { - $routes->get("view", "DashboardController::dashboard"); + $routes->match(['get','post'],'view','DashboardController::dashboard'); $routes->get('get-notification', 'DashboardController::getDashboardNotifications'); $routes->get('acknowledge-notification/(:segment)', 'DashboardController::acknowledgeMessage/$1'); $routes->get('get-pending-action', 'PendingActionsController::getPendingActions'); @@ -272,11 +272,12 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) { $routes->get("get_policy_type_for_base_policy/(:any)", "ClientController::getPolicyTypeForBasePolicy/$1"); $routes->get("get_client_details/(:any)", "ClientController::getClientDetails/$1"); $routes->get("featch_dashboard_data/(:any)", "DashboardController::featch_dashboard_data/$1"); + $routes->get("remove_rack_rate/(:any)", "ClientController::removeRackRate/$1"); }); $routes->cli('cli/processjob', 'JobWorker::processJob'); $routes->cli('cli/processjobs', 'JobWorker::processJobs'); -$routes->cli('cli/enrollment_status', 'JobWorker::enrollment_status'); +$routes->cli('cli/enrollment_status', 'DashboardController::enrollment_status'); $routes->get("processjob", "JobWorker::processJob"); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 77bd79e8..2c6111af 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -415,7 +415,9 @@ class ClientController extends AdminController foreach ($clientPoliceData as $key => $value) { $clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date)); + $clientPoliceData[$key]->open_date = date('d-M-Y', strtotime($value->open_date)); $clientPoliceData[$key]->policy_end_date = date('d-M-Y', strtotime($value->policy_end_date)); + $clientPoliceData[$key]->close_date = date('d-M-Y', strtotime($value->close_date)); } $editData['client_policy'] = $clientPoliceData; @@ -766,8 +768,8 @@ class ClientController extends AdminController $data['no_of_lives'] = $this->request->getPost('no_of_lives'); $data['policy_status'] = $this->request->getPost('policy_status'); $data['no_of_employees'] = $this->request->getPost('no_of_employees'); - $data['earned_premium_date'] = change_date_format($this->request->getPost('earned_premium_date'), 'd-m-Y', 'Y-m-d'); - $data['claims_incurred_date'] = change_date_format($this->request->getPost('claims_incurred_date'), 'd-m-Y', 'Y-m-d'); + $data['earned_premium_date'] = change_date_format($this->request->getPost('earned_premium_date'), 'd-m-Y', 'Y-m-d') ?? null; + $data['claims_incurred_date'] = change_date_format($this->request->getPost('claims_incurred_date'), 'd-m-Y', 'Y-m-d') ?? null; $data['incurred_claims_ratio'] = $this->request->getPost('incurred_claims_ratio'); $data['no_lives_at_inception'] = $this->request->getPost('no_lives_at_inception'); $data['premium_paid_at_inception'] = $this->request->getPost('premium_paid_at_inception'); @@ -823,16 +825,17 @@ class ClientController extends AdminController // } // } - + $data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d'); + $data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d'); $data['policy_no'] = $this->request->getPost('policy_no'); if($data['inception_type'] == 2){ - $data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d'); - $data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d'); + $data['open_date'] = change_date_format($this->request->getPost('open_date'), 'd-m-Y', 'Y-m-d'); + $data['close_date'] = change_date_format($this->request->getPost('close_date'), 'd-m-Y', 'Y-m-d'); $data['reminder_date'] = change_date_format($this->request->getPost('reminder_date'), 'd-m-Y', 'Y-m-d'); }else{ - $data['policy_start_date'] = null; - $data['policy_end_date'] = null; + $data['open_date'] = null; + $data['closedate'] = null; $data['reminder_date'] = null; } @@ -879,8 +882,8 @@ class ClientController extends AdminController $data['no_of_lives'] = $this->request->getPost('no_of_lives'); $data['policy_status'] = $this->request->getPost('policy_status'); $data['no_of_employees'] = $this->request->getPost('no_of_employees'); - $data['earned_premium_date'] = change_date_format($this->request->getPost('earned_premium_date'), 'd-m-Y', 'Y-m-d'); - $data['claims_incurred_date'] = change_date_format($this->request->getPost('claims_incurred_date'), 'd-m-Y', 'Y-m-d'); + $data['earned_premium_date'] = change_date_format($this->request->getPost('earned_premium_date'), 'd-m-Y', 'Y-m-d') ?? null; + $data['claims_incurred_date'] = change_date_format($this->request->getPost('claims_incurred_date'), 'd-m-Y', 'Y-m-d') ?? null; $data['incurred_claims_ratio'] = $this->request->getPost('incurred_claims_ratio'); $data['no_lives_at_inception'] = $this->request->getPost('no_lives_at_inception'); $data['premium_paid_at_inception'] = $this->request->getPost('premium_paid_at_inception'); @@ -894,14 +897,16 @@ class ClientController extends AdminController $data['client_branch_id'] = $this->request->getPost('client_branch_id'); $data['cd_ac_no'] = $this->request->getPost('cd_ac_no'); $data['gst'] = $this->request->getPost('gst'); - + $data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d'); + $data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d'); + if($data['inception_type'] == 2){ - $data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d'); - $data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d'); + $data['open_date'] = change_date_format($this->request->getPost('open_date'), 'd-m-Y', 'Y-m-d'); + $data['close_date'] = change_date_format($this->request->getPost('close_date'), 'd-m-Y', 'Y-m-d'); $data['reminder_date'] = change_date_format($this->request->getPost('reminder_date'), 'd-m-Y', 'Y-m-d'); }else{ - $data['policy_start_date'] = null; - $data['policy_end_date'] = null; + $data['open_date'] = null; + $data['close_date'] = null; $data['reminder_date'] = null; } @@ -944,7 +949,7 @@ class ClientController extends AdminController // dd($data); $data['updated_by'] = get_session_userid(); - // print_r($data);die; + // print_r(json_encode($data));die; $insert = $this->clientPolicyModel->update($id,$data); $lastQuery = $this->clientPolicyModel->getLastQuery(); @@ -1021,28 +1026,28 @@ class ClientController extends AdminController $policy_grid_id = $this->request->getPost('policy_grid_id'); $rack_rate_name = $this->request->getPost('rack_rate_name'); - $self = $this->request->getPost('self') ? 1 : 0; - $spouse = $this->request->getPost('spouse'); - $childrens = $this->request->getPost('childrens'); - $parents = $this->request->getPost('parents'); - $parents_in_law = $this->request->getPost('parents-in-law'); + $relation_data = [ + 'self' => $this->request->getPost('self'), + 'spouse' => $this->request->getPost('spouse'), + 'childrens' => $this->request->getPost('childrens'), + 'parents' => $this->request->getPost('parents'), + 'parents-in-law'=> $this->request->getPost('parents-in-law'), + ]; - if($policy_grid_id == 1 || $policy_grid_id == 2){ - $self = 1; - $spouse = 'NA'; - $childrens = 'NA'; - $parents = 'NA'; - $parents_in_law = 'NA'; + if ($policy_grid_id == 1 || $policy_grid_id == 2 || $policy_grid_id == 6 || $policy_grid_id == 7) { + $relation_data = [ + 'self' => 1, + 'spouse' => 'NA', + 'childrens' => 'NA', + 'parents' => 'NA', + 'parents-in-law'=> 'NA', + ]; } - $relation_data['self'] = $self; - $relation_data['spouse'] = $spouse; - $relation_data['childrens'] = $childrens; - $relation_data['parents'] = $parents; - $relation_data['parents-in-law'] = $parents_in_law; - + // Convert to JSON $jsonDataForRelation = json_encode($relation_data); + $si_or_bp = $this->request->getPost('si_or_bp'); $basic_multiplier = str_replace(',', '', $this->request->getPost('basic_multiplier')); $premium_multiplier = str_replace(',', '', $this->request->getPost('premium_multiplier')); @@ -2161,7 +2166,8 @@ class ClientController extends AdminController } } - public function getClientBranch($client_id){ + public function getClientBranch($client_id) + { $branchs = $this->clientBranchModel ->select('*') @@ -2822,4 +2828,38 @@ class ClientController extends AdminController } + + public function removeRackRate($rack_rate_name = null, $client_policy_id = null) + { + $this->myLogger->logme('error', 'Rack Rate Remove function called'); + + $data = [ + 'updated_by' => get_session_userid(), + 'is_active' => 0 + ]; + + $rackRateData = $this->policyPremium2Model + ->where('rack_rate_name', $rack_rate_name) + ->where('client_policy_id', $client_policy_id) + ->where('is_active',1) + ->countAllResults(); + + if($rackRateData > 0){ + $update = $this->policyPremium2Model + ->where('rack_rate_name', $rack_rate_name) + ->where('client_policy_id', $client_policy_id) + ->set($data)->update(); + + if ($update) { + return $this->respond(['status' => true, 'code' => 200, 'message' => 'Rack Rate removed successfully', 'rr_count' => $rackRateData], 200); + } else { + return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to remove policy', 'rr_count' => $rackRateData], 200); + } + }else{ + + return $this->respond(['status' => false, 'code' => 404, 'message' => 'Rack Rate not available', 'rr_count' => $rackRateData], 200); + } + + } + } \ No newline at end of file diff --git a/app/Controllers/DashboardController.php b/app/Controllers/DashboardController.php index 16a4d50f..220c7468 100644 --- a/app/Controllers/DashboardController.php +++ b/app/Controllers/DashboardController.php @@ -6,6 +6,7 @@ use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; +use App\Helpers\sendMailNotification; use CodeIgniter\API\ResponseTrait; @@ -13,6 +14,10 @@ use App\Models\MessageModel; use App\Models\UserMessageModel; use App\Models\ClientModel; +use App\Models\JobModel; +use App\Models\ClientPolicyModel; +use App\Models\NotificationModel; +use App\Models\EmployeePolicyModel; use App\Controllers\PendingActionsContrller; class DashboardController extends AdminController @@ -35,23 +40,26 @@ class DashboardController extends AdminController public function dashboard() { - $data = []; + $data = []; + + $results = $this->clientModel->select('clients.id as client_id, clients.client_name, clients.short_name, + client_branch.id as client_branch_id, client_branch.branch_name, + client_branch.branch_code, employees.id as employee_id, + employees.name as employee_name, employees.relationship, + employees.emp_code, employees.emp_status, auth_history.user_type, client_policy.policy_type_id, client_policy.id as client_policy_id') + ->join('client_branch', 'clients.id = client_branch.client_id', 'left') + ->join('client_policy', 'client_branch.id = client_policy.client_branch_id', 'left') + ->join('employees', 'client_branch.id = employees.client_branch_id', 'left') + ->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left') + ->findAll(); + $pendingActionsController = new PendingActionsController; $pendingActionsData = $pendingActionsController->getPendingActionsForDashBoard(); - $results = $this->clientModel->select('clients.id as client_id, clients.client_name, clients.short_name, - client_branch.id as client_branch_id, client_branch.branch_name, - client_branch.branch_code, employees.id as employee_id, - employees.name as employee_name, employees.relationship, - employees.emp_code, employees.emp_status, auth_history.user_type') - ->join('client_branch', 'clients.id = client_branch.client_id', 'left') - ->join('employees', 'client_branch.id = employees.client_branch_id', 'left') - ->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left') - ->findAll(); $groupedData = []; - $employeeId = ''; + foreach ($results as $row) { $clientId = $row['client_id']; $clientName = $row['client_name']; @@ -59,6 +67,10 @@ class DashboardController extends AdminController $branchId = $row['client_branch_id']; $branchName = $row['branch_name']; $branchCode = $row['branch_code']; + + $clientPolicyId = $row['client_policy_id']; + $policyTypeId = $row['policy_type_id']; + $employeeId =''; if ($employeeId != $row['employee_id']) { $employeeId = $row['employee_id']; } else { @@ -88,12 +100,23 @@ class DashboardController extends AdminController 'branch_code' => $branchCode, 'emp_login' => 0, 'emp_enroll' => 0, + 'client_policies' => [], 'employees' => [] ]; } - if ($employeeId !== null && $employeeRelationship == 'Self') { - // Append employee info to the branch's employees list - $groupedData[$clientId]['branches'][$branchId]['employees'][] = [ + + // Add the client policy to the branch's policies list if it exists, not already added, and policyTypeId is not equal to 1 + if ($clientPolicyId !== null && $policyTypeId != 1 && !in_array(['client_policy_id' => $clientPolicyId, 'policy_type_id' => $policyTypeId], $groupedData[$clientId]['branches'][$branchId]['client_policies'])) { + $groupedData[$clientId]['branches'][$branchId]['client_policies'][] = [ + 'client_policy_id' => $clientPolicyId, + 'policy_type_id' => $policyTypeId + ]; + } + + // Append employee info to the branch's employees list if relationship is 'Self' and not already added + $employeeKey = $employeeId . '-' . $employeeName; // unique key to identify an employee + if ($employeeId !== null && $employeeRelationship == 'Self' && !isset($groupedData[$clientId]['branches'][$branchId]['employees'][$employeeKey])) { + $groupedData[$clientId]['branches'][$branchId]['employees'][$employeeKey] = [ 'employee_id' => $employeeId, 'employee_name' => $employeeName, 'relationship' => $employeeRelationship, @@ -110,22 +133,32 @@ class DashboardController extends AdminController $groupedData[$clientId]['branches'][$branchId]['emp_enroll']++; } } - $employeeId = $row['employee_id']; } // Re-index the arrays to match the expected structure foreach ($groupedData as &$client) { + foreach ($client['branches'] as &$branch) { + $branch['employees'] = array_values($branch['employees']); + } $client['branches'] = array_values($client['branches']); } - // echo "
";
+    
         $data['client_branch_emp_list'] = $groupedData;
+        $session = \Config\Services::session();
+        $session->set('enrollment_data', json_encode($data));
+        // echo "
";
         $data['pendingActionsData'] = $pendingActionsData;
         // print_r($data);die;
 
+        
         echo view('layout/header');
         echo view('DashBoard', $data);
         echo view('layout/footer');
     }
+    
+    
+    
+    
 
     public function getDashboardNotifications()
     {
@@ -154,6 +187,89 @@ class DashboardController extends AdminController
     }
 
 
+    public static function enrollment_status() {
+        $clientModel = new ClientModel();
+        $clientPolicyModel = new ClientPolicyModel();
+        $notificationModel = new NotificationModel();
+        $employeePolicyModel = new EmployeePolicyModel();
+        $myLogger = \Config\Services::mylogger();
+    
+        $client_policy_data = $clientPolicyModel
+                                                ->where('id', 21)
+                                                ->findAll();
+        $currentDate = date('Y-m-d');
+    
+        // Update policy status based on start and end dates
+        foreach ($client_policy_data as $client_policy) {
+            $id = $client_policy['id'];
+            
+            if ($currentDate == $client_policy['open_date']) {
+                $clientPolicyModel->update($id, ['open_for_enrollment' => 1]);
+            } 
+            
+            if ($client_policy['close_date'] < $currentDate) {
+                $clientPolicyModel->update($id, ['open_for_enrollment' => 0]);
+            }
+        }
+    
+        $reminder_whole_mail = [];
+
+        foreach ($client_policy_data as $client_policy) {
+            // Fetch client data
+            $client_data = $clientModel->find($client_policy['client_id']);
+            
+            // Fetch notification settings
+            $notification_data = $notificationModel->where('client_id', $client_policy['client_id'])
+                                                   ->where('template_name', 'member_reminder_mail')
+                                                   ->first();
+            
+            // Check if notification should be sent
+            if ($notification_data && $notification_data['enabled'] == 1 && $currentDate == $client_policy['reminder_date']) {
+                // Fetch all employees related to the client policy
+                $employees = $employeePolicyModel->select('employees.*')
+                                                 ->join('employees', 'employee_polices.employee_id = employees.id', 'left')
+                                                 ->where('employee_polices.client_policy_id', $client_policy['id'])
+                                                 ->findAll();
+        
+                // Process each employee
+                foreach ($employees as $employee) {
+                    if($employee['emp_status'] == 'draft' && $employee['relationship'] == 'Self'){
+                        $params['emp_data'] = $employee;
+                        $params['client_data'] = $client_data;
+                        $params['notification_data'] = $notification_data;
+                        
+                        // Send the mail notification
+                        $reminder_whole_mail[] = sendMailNotification::sendMailNotification('member_reminder_mail', $params);
+                    }
+                }
+            }
+        }
+        
+        // Process and queue bulk emails
+        $temp_whole_data = [];
+        $count = 0;
+
+        foreach ($reminder_whole_mail as $whole_index => $values) {
+            foreach ($values as $index => $value) {
+                $temp_whole_data[] = $value;
+                $count++;
+                
+                if ($count == 20 || ($whole_index == count($reminder_whole_mail) - 1 && $index == count($values) - 1)) {
+                    if (!empty($temp_whole_data)) {
+                        Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $temp_whole_data]);
+                        $temp_whole_data = [];
+                        $count = 0;
+                    }
+                }
+            }
+        }
+        if(count($temp_whole_data) > 0){
+            Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $temp_whole_data]);
+        }
+    
+        return json_encode(true);
+    }
+
     public function featch_dashboard_data($type)
     {
         $pendingActionsController = new PendingActionsController;
diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
index 2b2e017c..01735912 100644
--- a/app/Controllers/EmployeeRestController.php
+++ b/app/Controllers/EmployeeRestController.php
@@ -954,7 +954,7 @@ class EmployeeRestController extends AdminController
 
     public function getEmployeePolicy()
     {            
-        // try {
+        try {
 
             $id = $this->request->getGet('id');
             $emp_code = $this->request->getGet('emp_code');
@@ -1114,21 +1114,21 @@ class EmployeeRestController extends AdminController
 
                         // Add family floter buttons placement data for FE validation
                         if(count($floters)){
-                        foreach ($floters as $familyFloatesValue) {
+                            foreach ($floters as $familyFloatesValue) {
 
-                            $temp2['is_value_exist'] = false;
-                            $temp2['data']['family_floater_key'] = $familyFloatesValue;
-                            $temp2['data']['client_policy_id'] = $array->ClientPolicyId; 
-                            $temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue))); 
-                            $temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue);
-                        
-            
-                            $temp2['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue);   
+                                $temp2['is_value_exist'] = false;
+                                $temp2['data']['family_floater_key'] = $familyFloatesValue;
+                                $temp2['data']['client_policy_id'] = $array->ClientPolicyId; 
+                                $temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue))); 
+                                $temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue);
+                            
+                
+                                $temp2['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue);   
 
-                            array_push($data,$temp2);
+                                array_push($data,$temp2);
 
+                            }
                         }
-                    }
 
                         $array->mapped_family_floaters = $data;
                         $array->type = "Group Medical Coverage";
@@ -1164,9 +1164,9 @@ class EmployeeRestController extends AdminController
             }else{
                 return $this->respond(['status' => 'failed','code' => 404,'data' => []], 200);
             }
-        // } catch (\Exception $e) {
-        //     return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
-        // }
+        } catch (\Exception $e) {
+            return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
+        }
     }
 
 
@@ -1178,6 +1178,7 @@ class EmployeeRestController extends AdminController
                                             ->where('client_branch_id',$client_branch_id)
                                             ->where('is_active', 1 )
                                             ->where('is_addon_value',0)->findAll();
+        // return  $employeeData;
         foreach ($GmcParrentsPolicy as $key => $array) {
 
         
@@ -1241,6 +1242,7 @@ class EmployeeRestController extends AdminController
 
             // Convert familyFloaters terms data to plain array 
             $floters = $this->FloterConvertion($familyFloates);
+            
             $data = [];
             foreach ($floters as $familyFloatesValue) { 
                 $dependent =   preg_replace('/\d/', '', $familyFloatesValue);
@@ -1386,8 +1388,18 @@ class EmployeeRestController extends AdminController
                 
             }
         }
+
+        $first_two_chars = substr($result, 0, 3);
+       
+        if($first_two_chars == "  +"){
+            $modified_string = substr($result, 3);
+            return "Can Add ".$modified_string;
+        }else{
+            return $result;
+        }
+           return substr($result, 0, 2) !== " +";
         
-        return $result;
+       
     }
 
     public function getClientDetails()
diff --git a/app/Controllers/JobWorker.php b/app/Controllers/JobWorker.php
index eb9f96e2..f5b40c04 100644
--- a/app/Controllers/JobWorker.php
+++ b/app/Controllers/JobWorker.php
@@ -3,13 +3,8 @@
 namespace App\Controllers;
 
 
-use App\Models\JobModel;
-use App\Models\ClientModel;
-use App\Models\ClientPolicyModel;
-use App\Models\NotificationModel;
-use App\Models\EmployeePolicyModel;
 
-use App\Helpers\sendMailNotification;
+
 
 class JobWorker extends AdminController
 {
@@ -330,70 +325,7 @@ class JobWorker extends AdminController
     }
 
 
-    public static function enrollment_status() {
-        $clientModel = new ClientModel();
-        $clientPolicyModel = new ClientPolicyModel();
-        $notificationModel = new NotificationModel();
-        $employeePolicyModel = new EmployeePolicyModel();
-        $myLogger = \Config\Services::mylogger();
-    
-        $client_policy_data = $clientPolicyModel->where('is_active', 1)
-                                                ->where('policy_status', 1)
-                                                ->where('inception_type', 2)
-                                                ->findAll();
-        $currentDate = date('Y-m-d');
-    
-        // Update policy status based on start and end dates
-        foreach ($client_policy_data as $client_policy) {
-            $id = $client_policy['id'];
-            
-            if ($currentDate == $client_policy['policy_start_date']) {
-                $clientPolicyModel->update($id, ['open_for_enrollment' => 1]);
-            } 
-            if ($client_policy['policy_end_date'] < $currentDate) {
-                $clientPolicyModel->update($id, ['open_for_enrollment' => 0]);
-            }
-        }
-    
-        $reminder_whole_mail = [];
-        foreach ($client_policy_data as $client_policy) {
-            $employee = $employeePolicyModel->select('employees.*')
-                                            ->join('employees', 'employee_polices.employee_id = employees.id', 'left')
-                                            ->where('employee_polices.client_policy_id', $client_policy['id'])
-                                            ->first();
-            $client_data = $clientModel->find($client_policy['client_id']);
-            $notification_data = $notificationModel->where('client_id', $client_policy['client_id'])
-                                                   ->where('template_name', 'member_reminder_mail')
-                                                   ->first();
-            
-            if ($notification_data && $notification_data['enabled'] == 1 && $currentDate == $client_policy['reminder_date']) {
-                $params['emp_data'] = $employee;
-                $params['client_data'] = $client_data;
-                $params['notification_data'] = $notification_data;
-                $reminder_whole_mail[] = sendMailNotification::sendMailNotification('member_reminder_mail', $params);
 
-            }
-        }
-        // Process and queue bulk emails
-        $temp_whole_data = [];
-        $count = 0;
-        foreach ($reminder_whole_mail as $whole_index => $values) {
-            foreach ($values as $index => $value) {
-                $temp_whole_data[] = $value;
-                $count++;
-                
-                if ($count == 20 || ($whole_index == count($reminder_whole_mail) - 1 && $index == count($values) - 1)) {
-                    if (!empty($temp_whole_data)) {
-                        Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $temp_whole_data]);
-                        $temp_whole_data = [];
-                        $count = 0;
-                    }
-                }
-            }
-        }
-    
-        return json_encode(true);
-    }
     
     
 
diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php
index f364d1de..603f9e51 100644
--- a/app/Controllers/MasterController.php
+++ b/app/Controllers/MasterController.php
@@ -1086,6 +1086,7 @@ class MasterController extends AdminController
             'insurer_id' => $data['insurer_id'],
             'description' => 'opening Amount',
             'transaction_type' => 'Credit',
+            'event_name' => null,
             'updated_by' => 1,
         ];
 
diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php
index f6d8b942..29027630 100644
--- a/app/Models/ClientPolicyModel.php
+++ b/app/Models/ClientPolicyModel.php
@@ -20,6 +20,9 @@ class ClientPolicyModel extends Model
         "policy_start_date",
         "policy_end_date",
         "reminder_date",
+        "open_date",
+        "close_date",
+        "close_date",
         "insured",
         "no_of_employees",
         "no_of_lives",
diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php
index 6250897f..1553e365 100644
--- a/app/Views/client_policy.php
+++ b/app/Views/client_policy.php
@@ -112,10 +112,7 @@
                                 
                                 
                             
-                            
- - -
+
@@ -146,7 +143,18 @@
- +
+ + +
+
+ + +
+
+ + +