From c509399f919c0f822d458d10b61fcbe818d54f10 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Wed, 15 May 2024 16:28:22 +0530 Subject: [PATCH 1/7] CHANGE_NOTIFICATION_CHECKS_GMS_EDIT_AGE_ISSUE : AADHAVAN --- app/Controllers/ClientController.php | 24 +++++----- app/Controllers/EmpDataServiceController.php | 47 ++++++++++---------- app/Controllers/EmployeeRestController.php | 42 +++++++++-------- app/Helpers/MailHelper.php | 2 - app/Views/client_onboarding.php | 14 +++--- app/Views/notification.php | 26 ++++++----- app/Views/policy_gmc_terms.php | 24 ++++++++-- 7 files changed, 102 insertions(+), 77 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index a6cd25ce..8b0c17ee 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -168,6 +168,8 @@ class ClientController extends AdminController // echo "
";
         // print_r($data); die;
+        $data['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'client_name'];
+
 
         echo view('layout/header', $headerData);
         echo view('client_onboarding', $data);
@@ -1241,19 +1243,19 @@ class ClientController extends AdminController
             $client_policy_id = $this->request->getPost("client_policy_id");
 
             $data['sum_insured']   =str_replace(',', '',$this->request->getPost("sum_insured"));
-            $data['family_floater']   =$this->request->getPost("family_floater");
-            $data['corporatebuffer'] = $this->request->getPost("corporatebuffer");
+            $data['family_floater']   =$this->request->getPost("family_floater") ? $this->request->getPost("family_floater") : 0;
+            $data['corporatebuffer'] = $this->request->getPost("corporatebuffer") ? $this->request->getPost("corporatebuffer") : 0;
             $data['family_floaters'] = $this->request->getPost("family_floaters") ?? [];        
             
             // print_r($this->request->getPost());die;
-            $data['age_ratio']['self']['min'] = $this->request->getPost("self_min_age");
-            $data['age_ratio']['self']['max'] = $this->request->getPost("self_max_age");
-            $data['age_ratio']['spouse']['min'] = $this->request->getPost("spouse_min_age");
-            $data['age_ratio']['spouse']['max'] = $this->request->getPost("spouse_max_age");
-            $data['age_ratio']['child']['min'] = $this->request->getPost("child_min_age");
-            $data['age_ratio']['child']['max'] = $this->request->getPost("child_max_age");
-            $data['age_ratio']['elders']['min'] = $this->request->getPost("other_member_min_age");
-            $data['age_ratio']['elders']['max'] = $this->request->getPost("other_member_max_age");
+            $data['age_ratio']['self']['min'] =  $this->request->getPost("self_min_age") ? $this->request->getPost("self_min_age") :0;
+            $data['age_ratio']['self']['max'] = $this->request->getPost("self_max_age") ? $this->request->getPost("self_max_age") : 0;
+            $data['age_ratio']['spouse']['min'] = $this->request->getPost("spouse_min_age") ? $this->request->getPost("spouse_min_age") : 0;
+            $data['age_ratio']['spouse']['max'] = $this->request->getPost("spouse_max_age") ? $this->request->getPost("spouse_max_age") : 0;
+            $data['age_ratio']['child']['min'] = $this->request->getPost("child_min_age") ? $this->request->getPost("child_min_age") : 0;
+            $data['age_ratio']['child']['max'] = $this->request->getPost("child_max_age") ? $this->request->getPost("child_max_age") : 0;
+            $data['age_ratio']['elders']['min'] = $this->request->getPost("other_member_min_age") ? $this->request->getPost("other_member_min_age") :0;
+            $data['age_ratio']['elders']['max'] = $this->request->getPost("other_member_min_age") ? $this->request->getPost("other_member_min_age") : 0;
 
 
 
@@ -1327,7 +1329,7 @@ class ClientController extends AdminController
                         }
                     }
 
-                    $data['family_floaters']['elders_count'] =$this->request->getPost("member_count");
+                    $data['family_floaters']['elders_count'] =$this->request->getPost("member_count") ? $this->request->getPost("member_count") : 0;
 
             $data['waiverofpreexistingdiseases']   =$this->request->getPost("waiverofpreexistingdiseases");
             if ($data['waiverofpreexistingdiseases'] == 1) {
diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php
index 728d81b8..7b5a599f 100644
--- a/app/Controllers/EmpDataServiceController.php
+++ b/app/Controllers/EmpDataServiceController.php
@@ -1954,29 +1954,30 @@ class EmpDataServiceController extends BaseController
                 $client_data = $this->clientModel->where('id',$get_emp_email_and_other_details['client_id'])->first();
                 
                 $notification = $this->notificationModel->where('client_id',$get_emp_email_and_other_details['client_id'])->where('template_name','member_ecard_mail')->first();
-                if ($get_emp_email_and_other_details != null && $get_emp_email_and_other_details != "" && $notification['enabled'] == 1) {
-                    $rand_string =  $get_emp_email_and_other_details['rand_string'];
-                    $tpa_id =  $get_emp_email_and_other_details['tpa_id'];
-                    
-                    $params['rand_string'] = $rand_string;
-                    $params['tpa_id'] = $tpa_id;
-                    $params['notification'] = $notification;
-                    $params['client_data'] = $client_data;
-                    $params['notification'] = $notification;
-                    $params['notification'] = $notification;
-                    $params['get_emp_email_and_other_details'] = $get_emp_email_and_other_details;
-                    $wholeData = sendMailNotification::sendMailNotification('member_ecard_mail', $params);
-                    
-                    $count++;
-
-
-                    if($count == 20 || $count == count($ids)-1){
-                        $job_details  = new Jobs();
-                        $r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $wholeData]); 
-                        $wholeData = [];
-                        $count = 0;
-                    }    
-                }
+                    if ($get_emp_email_and_other_details != null && $get_emp_email_and_other_details != "" && $notification['enabled'] == 1) {
+                        $rand_string =  $get_emp_email_and_other_details['rand_string'];
+                        $tpa_id =  $get_emp_email_and_other_details['tpa_id'];
+                        
+                        $params['rand_string'] = $rand_string;
+                        $params['tpa_id'] = $tpa_id;
+                        $params['notification'] = $notification;
+                        $params['client_data'] = $client_data;
+                        $params['notification'] = $notification;
+                        $params['notification'] = $notification;
+                        $params['get_emp_email_and_other_details'] = $get_emp_email_and_other_details;
+                        $wholeData = sendMailNotification::sendMailNotification('member_ecard_mail', $params);
+                        
+                        $count++;
+    
+    
+                        if($count == 20 || $count == count($ids)-1){
+                            $job_details  = new Jobs();
+                            $r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $wholeData]); 
+                            $wholeData = [];
+                            $count = 0;
+                        }    
+                    }
+                
             }
             return true; // Email(s) sent successfully
         } catch (\Exception $e) {
diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
index 3c8a145d..1fa06237 100644
--- a/app/Controllers/EmployeeRestController.php
+++ b/app/Controllers/EmployeeRestController.php
@@ -618,7 +618,6 @@ class EmployeeRestController extends AdminController
 
             $client_data = $this->clientModel->where('id', $client_id)->first();
 
-            $notification = $this->notificationModel->where('client_id',$client_id)->where('template_name','member_welcome_mail')->first();
 
             $jwt = $this->request->getHeader('Authorization');
             $jwtParts = explode(' ', $jwt);
@@ -874,8 +873,9 @@ class EmployeeRestController extends AdminController
                         $emp_policy = $this->employeePolicyModel->insert($emp_policy_data);
                     }
 
+                    $notification = $this->notificationModel->where('client_id',$client_id)->where('template_name','member_welcome_mail')->first();
 
-                    if ($notification['enabled'] == 1) {
+                    if (isset($notification) && $notification['enabled'] == 1) {
                         //trigger
                         if ($dataToInsert[$a]['relationship'] == 'Self') {
                             
@@ -900,7 +900,6 @@ class EmployeeRestController extends AdminController
                         // if ($dataToInsert[$a]['email_corporate'] != null || $dataToInsert[$a]['email_corporate'] != ''  &&  $dataToInsert[$a]['relationship'] == 'Self') {
                         
                     }
-                
                 }
             return $this->respond(['status' => 'success', 'code' => 200, 'message' => "Success" ], 200);
             }else{
@@ -1650,26 +1649,33 @@ public function iAgreeForAddOn()
             $find = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: $value,emp_code: $emp_code,client_id: $client_id,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
             $array_list[] = $find;
         }
-        $params ['array_list'] = $array_list;
-        $params ['client_policy_id'] = $client_policy_id;
-        $params ['emp_code'] = $emp_code;
-        $params ['client_id'] = $client_id;
-        $wholeData =sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
 
-        MailHelper::send_email($wholeData[0]);
+        $notification = $this->notificationModel->where('client_id' ,$client_id)->where('template_name', 'member_review_and_summary_mail')->first();
 
-        if (isset($wholeData[0])) {
-            
-            $account_manager_wholeData =sendMailNotification::sendMailNotification('account_maneger_summary_mail', $params);
 
-            foreach ($account_manager_wholeData as $key => $value) {
-                MailHelper::send_email($value);
-            }
+        if (isset($notification) && $notification['enabled'] == 1) {
+            $params ['array_list'] = $array_list;
+            $params ['client_policy_id'] = $client_policy_id;
+            $params ['emp_code'] = $emp_code;
+            $params ['client_id'] = $client_id;
+            $params ['notification'] = $notification;
 
-            $client_hr_wholeData =sendMailNotification::sendMailNotification('client_hr_summary_mail', $params);
+            $wholeData =sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
+            MailHelper::send_email($wholeData[0]);
 
-            foreach ($client_hr_wholeData as $key => $value) {
-                MailHelper::send_email($value);
+            if (isset($wholeData[0])) {
+                
+                $account_manager_wholeData =sendMailNotification::sendMailNotification('account_maneger_summary_mail', $params);
+
+                foreach ($account_manager_wholeData as $key => $value) {
+                    MailHelper::send_email($value);
+                }
+
+                $client_hr_wholeData =sendMailNotification::sendMailNotification('client_hr_summary_mail', $params);
+
+                foreach ($client_hr_wholeData as $key => $value) {
+                    MailHelper::send_email($value);
+                }
             }
         }
 
diff --git a/app/Helpers/MailHelper.php b/app/Helpers/MailHelper.php
index 55d17264..da8d2624 100644
--- a/app/Helpers/MailHelper.php
+++ b/app/Helpers/MailHelper.php
@@ -58,7 +58,6 @@ class MailHelper
         }  
     }
 
-
     public static function bulk_mail(array $mails = [])
     {
         // print_r();die;
@@ -78,6 +77,5 @@ class MailHelper
        }
     }
 
-
 }
 ?>
\ No newline at end of file
diff --git a/app/Views/client_onboarding.php b/app/Views/client_onboarding.php
index 5ae22d1a..9ff286b9 100644
--- a/app/Views/client_onboarding.php
+++ b/app/Views/client_onboarding.php
@@ -201,11 +201,11 @@ body {
         
 
         if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){
-            $('#btnBranchAdd').hide();
+            $('#notification-tab').hide();
             toastr.warning('Please Add the Client!', 'warning',{timeOut: 2000});
         }else{
-            if ($('#btnBranchBack')[0].style.display == 'none') {
-                $('#btnBranchAdd').show();
+            if ($('#notification-tab')[0].style.display == 'none') {
+                $('#notification-tab').show();
             }
         }
         
@@ -236,10 +236,10 @@ body {
         client_branch_contact();
     });
 
-    // document.getElementById("notification_tab").addEventListener("click", function(event) {
-    //     event.preventDefault();
-    //     client_notification();
-    // });
+    document.getElementById("notification_tab").addEventListener("click", function(event) {
+        event.preventDefault();
+        client_notification();
+    });
     
 
 
diff --git a/app/Views/notification.php b/app/Views/notification.php
index 99a03358..124094f5 100644
--- a/app/Views/notification.php
+++ b/app/Views/notification.php
@@ -25,6 +25,7 @@
             $member_review_and_summary_mail = 0;
             $account_maneger_summary_mail = 0;
             $client_hr_summary_mail = 0;
+            if(isset($notification)){
             foreach($notification as $value){
                 
                 if ($value['template_name'] == 'member_welcome_mail') {
@@ -50,6 +51,7 @@
                 if ($value['template_name'] == 'client_hr_summary_mail') {
                     $client_hr_summary_mail = $value['enabled'];
                 }
+            }
             }
              ?>

@@ -57,15 +59,15 @@
- +
- +
-
+
-
- +
+
-
+
-
+
-
+
-
+
@@ -293,7 +295,7 @@
-
Min Age:
+
Min Age:
Max Age:
Spouse: -
Min Age:
+
Min Age:
Max Age:
@@ -686,8 +686,8 @@ if (!$('#self').prop('checked')) { - $('#self_min_age').removeAttr('name') - $('#self_max_age').removeAttr('name') + $('#self_min_age').removeAttr('name'); + $('#self_max_age').removeAttr('name'); } if (!$('#spouse').prop('checked')) { @@ -1040,6 +1040,9 @@ if ($('#spouse').prop('checked')) { $('.spouse-age').css('display',''); + $('#spouse_min_age').val(18); + $('#spouse_max_age').val(60); + } else { $('.spouse-age').css('display','none'); } @@ -1253,6 +1256,12 @@ $('#spouse').change(function () { if ($(this).prop('checked')) { $('.spouse-age').css('display',''); + if($('#spouse_min_age').val() < 0 || $('#spouse_min_age').val() == '' ){ + $('#spouse_min_age').val(18); + } + if($('#spouse_max_age').val() < 0 || $('#spouse_max_age').val() == '' ){ + $('#spouse_max_age').val(60); + } }else{ $('.spouse-age').css('display','none'); } @@ -1262,6 +1271,13 @@ $('#children').change(function () { if ($(this).val() != 0) { $('.child-age').css('display',''); + + if($('#child_min_age').val() < 0 || $('#child_min_age').val() == '' ){ + $('#child_min_age').val(0); + } + if($('#child_max_age').val() < 0 || $('#child_max_age').val() == '' ){ + $('#child_max_age').val(25); + } }else{ $('.child-age').css('display','none'); } From 34bd649827497d849df54a1e82cd4bf1597e2c4f Mon Sep 17 00:00:00 2001 From: bitbucket Date: Wed, 15 May 2024 16:40:13 +0530 Subject: [PATCH 2/7] CHANGE_ default age ratio : GWM --- app/Controllers/EmployeeRestController.php | 43 ++++++++++++++-------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index b49b37d6..ae82f257 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -917,7 +917,19 @@ class EmployeeRestController extends AdminController //------------------------------------- +public function getAgeRange($terms,$familyFloatesValue) +{ + $ageRangeArray = ['self' => ['min' => 18, 'max' => 60] , 'spouse' => ['min' => 18, 'max' => 60] , 'child' => ['min' => 0, 'max' => 25] , 'elders' => ['min' => 18, 'max' => 60] ]; + $ageKey = (preg_replace('/\d/', '', $familyFloatesValue) == 'parent' || preg_replace('/\d/', '', $familyFloatesValue) == 'parent_in_law') ? 'elders' : preg_replace('/\d/', '', $familyFloatesValue); + if(isset($terms->age_ratio)){ + return $terms->age_ratio->$ageKey; + }else{ + return $ageRangeArray[$ageKey]; + } + + +} public function getEmployeePolicy() { try { @@ -1022,10 +1034,10 @@ public function getEmployeePolicy() $temp['data']['dob'] = $this->convertDateFormatDMY($value['dob']); $temp['data']['client_policy_id'] = $array->ClientPolicyId; $temp['data']['form_type'] = $dependent; - $temp['data']['basic_cover_si'] = $employee_policy->basic_cover_si; - $ageKey = ($dependent == 'parent' || $dependent == 'parent_in_law') ? 'elders' : $dependent; - - $temp['data']['age_validation'] = $decodedArray->age_ratio->$ageKey; + $temp['data']['basic_cover_si'] = $employee_policy->basic_cover_si; + + + $temp['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue); array_push($data,$temp); unset($empData[$key]); @@ -1064,9 +1076,9 @@ public function getEmployeePolicy() $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); - $ageKey = (preg_replace('/\d/', '', $familyFloatesValue) == 'parent' || preg_replace('/\d/', '', $familyFloatesValue) == 'parent_in_law') ? 'elders' : preg_replace('/\d/', '', $familyFloatesValue); - - $temp2['data']['age_validation'] = $decodedArray->age_ratio->$ageKey; + + + $temp2['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue); array_push($data,$temp2); @@ -1194,8 +1206,8 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id) $temp['data']['client_policy_id'] = $array->ClientPolicyId; $temp['data']['form_type'] = $dependent; $temp['data']['basic_cover_si'] = $employee_policy->basic_cover_si; - $ageKey = ($dependent == 'parent' || $dependent == 'parent_in_law') ? 'elders' : $dependent; - $temp['data']['age_validation'] = $array->Policy_Terms->age_ratio->$ageKey; + $temp['data']['age_validation'] = $this->getAgeRange($array->Policy_Terms,$familyFloatesValue); + array_push($data,$temp); unset($empData[$key]); @@ -1232,9 +1244,7 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id) $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); - $ageKey = (preg_replace('/\d/', '', $familyFloatesValue) == 'parent' || preg_replace('/\d/', '', $familyFloatesValue) == 'parent_in_law') ? 'elders' : preg_replace('/\d/', '', $familyFloatesValue); - - $temp2['data']['age_validation'] = $array->Policy_Terms->age_ratio->$ageKey; + $temp2['data']['age_validation'] = $this->getAgeRange($array->Policy_Terms,$familyFloatesValue); array_push($data,$temp2); } @@ -1435,7 +1445,9 @@ public function getAddOnPolicy() $temp['data']['client_policy_id'] = $array['id']; $temp['data']['form_type'] = $dependent; $temp['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null; - $temp['data']['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null; + $temp['data']['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null; + $temp['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue); + array_push($data,$temp); unset($addOnEmployeeData[$key]); $floters = array_diff($floters, [$familyFloatesValue]); @@ -1492,9 +1504,8 @@ public function getAddOnPolicy() $temp2['data']['client_policy_id'] = $array['id']; $temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue))); $temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue); - $ageKey = (preg_replace('/\d/', '', $familyFloatesValue) == 'parent' || preg_replace('/\d/', '', $familyFloatesValue) == 'parent_in_law') ? 'elders' : preg_replace('/\d/', '', $familyFloatesValue); - - $temp2['data']['age_validation'] = $decodedArray->age_ratio->$ageKey; + + $temp2['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue); array_push($data,$temp2); From 76ed242ff65681d5ecc5b72d44a1ae13eca0fd45 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Wed, 15 May 2024 16:54:57 +0530 Subject: [PATCH 3/7] FEAT_ new getEmployeeActiveOrInactivePolicy api : GWM --- app/Config/Routes.php | 1 + app/Controllers/EmployeeRestController.php | 77 ++++++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index c757962c..429d8707 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -284,6 +284,7 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) { $routes->post("calculatePremium", "EmployeeRestController::calculatePremium"); $routes->get("getEmployeeOldPolicy", "EmployeeRestController::getEmployeeOldPolicy"); + $routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy"); }); $routes->post("sendEmail", "EmployeeRestController::send_email"); diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 85b5c50b..79069da8 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -2048,6 +2048,83 @@ function getEmployeeOldPolicy() } +function getEmployeeActiveOrInactivePolicy() +{ + + if($this->request->getGet('type') == 'Active'){ $value = 1; }else{ $value = 0; } + $ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policies.name as policy_name , policy_type.policy_type as policy_type') + ->join('policies', 'client_policy.policy_id = policies.id', 'left') + ->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left') + ->where('client_policy.client_id', $this->request->getGet('client_id') ) + ->where('client_policy.is_active', 1 ) + ->where('client_policy.policy_status', $value) + ->orderby('client_policy.id' , 'ASC') + ->findAll(); + + // Retrieve employee and dependents data by passing the employee code + $employeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code')) + ->where('client_id',$this->request->getGet('client_id')) + ->where('is_active', 1 )->findAll(); + $whereArrayForId = []; + foreach ( $employeeData as $key => $value) { array_push($whereArrayForId, $value['id']); } + + if(count($ClientPolicyData) > 0 && count($employeeData) > 0) + { + $result = []; + foreach ($ClientPolicyData as $key => $ClientPolicyValue) { + + $terms = json_decode($ClientPolicyValue['policy_terms']); + // dd($terms); + $data['client_id'] = $ClientPolicyValue['client_id']; + $data['client_policy_id'] = $ClientPolicyValue['id']; + $data['policy_name'] = $ClientPolicyValue['policy_name']; + $data['policy_type'] = $ClientPolicyValue['policy_type']; + $data['policy_type'] = $ClientPolicyValue['policy_type']; + $data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']); + $data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']); + + if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else + if($ClientPolicyValue['policy_type_id'] == 2){ $data['heading'] = 'Group Medical Coverage'; }else + if($ClientPolicyValue['policy_type_id'] == 3){ $data['heading'] = 'Group Medical Coverage - Parents'; }else + if($ClientPolicyValue['policy_type_id'] == 4){ $data['heading'] = 'Group Medical Coverage - Top Up'; }else + if($ClientPolicyValue['policy_type_id'] == 5){ $data['heading'] = 'Group Medical Coverage - Parents (Top Up)'; } + + if($ClientPolicyValue['policy_type_id'] == 1){ $data['floter_text_heading'] = 'Sum Insured'; } + else + { + if($terms->family_floater == 1){ $data['floter_text_heading'] = 'Floter Sum Insured'; }else{ $data['floter_text_heading'] = 'Sum Insured'; } + } + + $employee_policy = $this->employeePolicyModel->select('employees.*,employee_polices.employee_id , employee_polices.basic_cover_si , employee_polices.premium , employee_polices.gst , employee_polices.tpa_id , employee_polices.rand_string') + ->join('employees', 'employee_polices.employee_id = employees.id', 'left') + ->whereIn('employee_polices.employee_id',$whereArrayForId) + ->where('employee_polices.client_policy_id',$ClientPolicyValue['id']) + ->where('employee_polices.is_active', 1 )->findAll(); + $si_value = 0; + $si_premium_value = 0; + $si_gst_value = 0; + foreach ($employee_policy as $key => $value) { + if(isset($value['basic_cover_si'])){ $si_value = $value['basic_cover_si']; } + if(isset($value['premium'])){ $si_premium_value = $si_premium_value + $value['premium'];} + if(isset($value['gst'])){ $si_gst_value = $si_gst_value + $value['gst'];} + } + + $data['si_value'] = $si_value; + $data['si_premium_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_premium_value; + $data['si_gst_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_gst_value; + + $data['EmployeePolicy'] = $employee_policy; + array_push($result, $data); + } + + return $this->respond(['status' => 'success','code' => 200,'data' => $result ], 200); + + }else{ + return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 200); + } + +} + private function convertDateFormatDisplay($dateString) { From b8863cc564f3fc79f6e660fe690830ba2aea2ef3 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Wed, 15 May 2024 17:05:31 +0530 Subject: [PATCH 4/7] CHANGE_GMC_POLCIY_TERMS_AGE_STORE_NULL_CHANEGE_THE_ISSUE : AADHAVAN --- app/Views/policy_gmc_terms.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/app/Views/policy_gmc_terms.php b/app/Views/policy_gmc_terms.php index 2d100a51..f6c9fa46 100644 --- a/app/Views/policy_gmc_terms.php +++ b/app/Views/policy_gmc_terms.php @@ -142,7 +142,7 @@ Spouse: -
Min Age:
+
Min Age:
Max Age:
@@ -1040,8 +1040,8 @@ if ($('#spouse').prop('checked')) { $('.spouse-age').css('display',''); - $('#spouse_min_age').val(18); - $('#spouse_max_age').val(60); + // $('#spouse_min_age').val(18); + // $('#spouse_max_age').val(60); } else { $('.spouse-age').css('display','none'); @@ -1256,10 +1256,10 @@ $('#spouse').change(function () { if ($(this).prop('checked')) { $('.spouse-age').css('display',''); - if($('#spouse_min_age').val() < 0 || $('#spouse_min_age').val() == '' ){ + if($('#spouse_min_age').val() < 17 || $('#spouse_min_age').val() == '' ){ $('#spouse_min_age').val(18); } - if($('#spouse_max_age').val() < 0 || $('#spouse_max_age').val() == '' ){ + if($('#spouse_max_age').val() < 17 || $('#spouse_max_age').val() == '' ){ $('#spouse_max_age').val(60); } }else{ @@ -1275,7 +1275,7 @@ if($('#child_min_age').val() < 0 || $('#child_min_age').val() == '' ){ $('#child_min_age').val(0); } - if($('#child_max_age').val() < 0 || $('#child_max_age').val() == '' ){ + if($('#child_max_age').val() < 24 || $('#child_max_age').val() == '' ){ $('#child_max_age').val(25); } }else{ @@ -1289,6 +1289,13 @@ var family_floaters = $(this).val(); if($('#family_floaters').val() != 0){ $('.other-member-age').css('display',''); + if($('#other_member_min_age').val() < 17 || $('#other_member_min_age').val() == '' ){ + $('#other_member_min_age').val(18); + } + if($('#other_member_max_age').val() < 79 || $('#other_member_max_age').val() == '' ){ + $('#other_member_max_age').val(60); + } + }else{ $('.other-member-age').css('display','none'); } From 802e993b8e3bf78cec850c420fbb5e4e4759ddfa Mon Sep 17 00:00:00 2001 From: velz Date: Wed, 15 May 2024 17:33:33 +0530 Subject: [PATCH 5/7] CHANGE_ALERT_IF_TERMS&RACK_NOT_DEFINED --- app/Config/Routes.php | 1 + app/Controllers/EmployeeController.php | 28 ++++++++++++ app/Controllers/Jobs/SubJob.php | 2 + app/Models/PolicesModel.php | 13 ++++-- app/Views/employee_upload.php | 62 +++++++++++++++++++++++++- 5 files changed, 101 insertions(+), 5 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index c757962c..a82a9776 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -228,6 +228,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) { $routes->get("id-card", "EmployeeController::viewECard/$1"); $routes->get("preview-card/(:any)", "EmployeeController::previewTemplate/$1"); $routes->get("export-import-error-list/(:any)", "EmployeeController::errorListExportImport/$1"); + $routes->get("has_policy_config_completed/(:any)", "EmployeeController::hasPolicyConfigCompleted/$1"); }); $routes->cli('cli/processjob', 'JobWorker::processJob'); diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 2409f694..0e9b4a3f 100644 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -11,6 +11,7 @@ use Psr\Log\LoggerInterface; use App\Models\EmployeeModel; use App\Models\EmployeePolicyModel; use App\Models\ClientModel; +use App\Models\PolicesModel; use App\Models\FileModel; use App\Models\BatchListModel; use App\Models\BatchFileModel; @@ -49,6 +50,7 @@ class EmployeeController extends AdminController protected $empEndorsementModel; protected $clientPolicyModel; protected $TPAModel; + protected $policiesModel; public function __construct() { @@ -64,6 +66,7 @@ class EmployeeController extends AdminController $this->empEndorsementModel = new EmpEndorsementModel(); $this->clientPolicyModel = new ClientPolicyModel(); $this->TPAModel = new TPAModel(); + $this->policiesModel = new PolicesModel(); } public function list() @@ -1141,4 +1144,29 @@ class EmployeeController extends AdminController echo view('export_import_error_list', $excelErrorData); } + public function hasPolicyConfigCompleted() + { + $client_policy_id = $this->request->uri->getSegment(3); + $policy_details = $this->clientPolicyModel->find($client_policy_id); + // print_r($policy_details);die(); + $policy_terms = isset($policy_details['policy_terms']) ? true : false; + + $slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$policy_details['client_id']); + + $message = null; + + if (!isset($policy_terms)) { + $message .= 'Policy terms'; + } + + if($slab_details['slab_rates'] == null && $slab_details['grid_master'] == null) + { + $message = isset($message) ? ($message . ' and rack rates ') : ($message . ' Rack rates'); + } + $message = isset($message) ? ($message . ' not defined for choosed policy') : null; + + return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message], 200); + + } + } diff --git a/app/Controllers/Jobs/SubJob.php b/app/Controllers/Jobs/SubJob.php index be74f0b8..35d9f8fd 100644 --- a/app/Controllers/Jobs/SubJob.php +++ b/app/Controllers/Jobs/SubJob.php @@ -8,6 +8,8 @@ class SubJob extends PublicController { public function handle($payload) { + $log = \Config\Services::mylogger(); + $log->logme('error', 'handle called'); return $payload['a'] - $payload['b']; } diff --git a/app/Models/PolicesModel.php b/app/Models/PolicesModel.php index d6a8182e..a56af6bc 100644 --- a/app/Models/PolicesModel.php +++ b/app/Models/PolicesModel.php @@ -39,6 +39,7 @@ class PolicesModel extends Model { $premium_slab_data = null; + $grid_type = null; $policyPremium1Model = new PolicyPremium1Model(); $premium_slab_data = $policyPremium1Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll(); @@ -50,9 +51,13 @@ class PolicesModel extends Model $premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll(); } - $grid_id = $premium_slab_data[0]['policy_grid_id']; - $policyGridModel = new PolicyGridModel(); - $results = $policyGridModel->find($grid_id); - return ['slab_rates' => $premium_slab_data,'grid_master' => $results]; + if(isset($premium_slab_data[0]['policy_grid_id'])) + { + $grid_id = $premium_slab_data[0]['policy_grid_id']; + $policyGridModel = new PolicyGridModel(); + $grid_type = $policyGridModel->find($grid_id); + } + + return ['slab_rates' => $premium_slab_data,'grid_master' => $grid_type]; } } diff --git a/app/Views/employee_upload.php b/app/Views/employee_upload.php index d729ab25..64cbca65 100644 --- a/app/Views/employee_upload.php +++ b/app/Views/employee_upload.php @@ -38,7 +38,7 @@ option:disabled {

-
@@ -727,10 +727,70 @@ $(document).ready(function() { } } }); + }) }) +function checkPolicyTermsAndRackRatesHasDefiend(event) +{ + console.log(event.target.id); + var policy_id = (event.target.value); + console.log('checkPolicyTermsAndRackRatesHasDefiend called ' + policy_id); + var apiURL = '' + 'util/has_policy_config_completed/' + policy_id; + console.log(apiURL); + + $('.loader').fadeIn(); + $('.loader-mask').fadeIn(); + + + $.ajax({ + url: apiURL, + method: 'GET', + headers: { + "Content-Type": "application/json", + "X-Requested-With": "XMLHttpRequest" + }, + success: function(response) { + + setTimeout(function() { + $('.loader').fadeOut(); + $('.loader-mask').delay(350).fadeOut('slow'); + }, 1000); + + console.log('check policy responce', response); + + if (response.code === 200 && response.dataStatus === true && response.message !== null) { + toastr.error(response.message, 'Error'); + $('#emp_form_submit_button').prop('disabled', true); + return false; + } + else if(response.code === 200 && response.dataStatus === true && response.message == null) + { + // toastr.error('Policy Terms or rack rate not defined!', 'Error'); + $('#emp_form_submit_button').prop('disabled', false); + return true; + } + else + { + toastr.error('Policy Terms or rack rate not defined!', 'Error'); + return false; + } + }, + error: function(xhr, status, error) { + setTimeout(function() { + $('.loader').fadeOut(); + $('.loader-mask').delay(350).fadeOut('slow'); + }, 1000); + toastr.error('Something went wrong! Try Later', 'Error'); + console.error('Error fetching data from checkPolicyTermsAndRackRatesHasDefiend API:', error); + return false; + } + }); + +} + + //--------------------------------------------------------------------------------------------------------- \ No newline at end of file From 5d20b696e99a10f2747141f920c2cdb159c41f94 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Thu, 16 May 2024 12:25:33 +0530 Subject: [PATCH 6/7] CHANGE_NOTIFICATION_MAIL_ALLOW_NULL_ISSUE : AADHAVAN --- app/Controllers/EmpDataServiceController.php | 29 ++++++++++++++------ app/Controllers/EmployeeRestController.php | 15 +++++----- app/Controllers/NotificationController.php | 11 +++++--- app/Helpers/sendMailNotification.php | 28 +++++++++++++------ 4 files changed, 54 insertions(+), 29 deletions(-) diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index 826c8a6b..fdaae901 100644 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -2063,10 +2063,12 @@ class EmpDataServiceController extends BaseController $this->myLogger->logme('error', 'sendMailForDownloadingECard - inside try'); $count = 0; + $counts = 0; + foreach ($ids as $key => $id) { $get_emp_email_and_other_details = $this->employeePolicyModel - ->select('employee_polices.client_policy_id, employees.emp_code, employees.email_corporate,employees.client_id as client_id, employees.name, employee_polices.rand_string, employee_polices.tpa_id') + ->select('employee_polices.client_policy_id, employees.relationship, employees.emp_code, employees.email_corporate,employees.client_id as client_id, employees.name, employee_polices.rand_string, employee_polices.tpa_id') ->join('employees', 'employees.id = employee_polices.employee_id') ->where('employees.emp_status', 'active') ->where('employees.is_active', '1') @@ -2091,19 +2093,28 @@ class EmpDataServiceController extends BaseController $params['notification'] = $notification; $params['notification'] = $notification; $params['get_emp_email_and_other_details'] = $get_emp_email_and_other_details; - $wholeData[] = sendMailNotification::sendMailNotification('member_ecard_mail', $params); + // $this->myLogger->logme('error', 'sendMailForDownloadingECard - Send Bulk Mail function end ',); - $count++; + if (isset($get_emp_email_and_other_details['email_corporate']) && !empty($get_emp_email_and_other_details['email_corporate']) && $get_emp_email_and_other_details['relationship'] === 'Self') { + $wholeData[] = sendMailNotification::sendMailNotification('member_ecard_mail', $params); + $count++; + } + $counts++; + - if ($count == 20 || $count == count($ids) - 1) { + if ($count == 20 || $counts == count($ids) - 1) { + if(count($wholeData) > 0){ - $this->myLogger->logme('error', 'sendMailForDownloadingECard - create a job to bulk mail',); + $this->myLogger->logme('error', 'sendMailForDownloadingECard - create a job to bulk mail',); + + $job_details = new Jobs(); + $r = Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $wholeData]); + $wholeData = []; + $count = 0; + + } - $job_details = new Jobs(); - $r = Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $wholeData]); - $wholeData = []; - $count = 0; } $this->myLogger->logme('error', 'sendMailForDownloadingECard - Send Bulk Mail function end ',); diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 79069da8..91c4b6b6 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -877,7 +877,7 @@ class EmployeeRestController extends AdminController if (isset($notification) && $notification['enabled'] == 1) { //trigger - if ($dataToInsert[$a]['relationship'] == 'Self') { + if ($dataToInsert[$a]['relationship'] == 'Self' && isset($dataToInsert[$a]['email_corporate']) && !empty($dataToInsert[$a]['email_corporate'])) { $params['dataToInsert'] = $dataToInsert[$a]; $params['notification'] = $notification; @@ -887,13 +887,12 @@ class EmployeeRestController extends AdminController $count++; } if($count == 20 || $a == count($dataToInsert)-1){ - $job_details = new Jobs(); - $r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $wholeData]); - // $wholeData[]= $r; - - // Mailhelper::bulk_mail($wholeData); - $wholeData = []; - $count = 0; + if (count($wholeData) > 0) { + $job_details = new Jobs(); + $r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $wholeData]); + $wholeData = []; + $count = 0; + } } diff --git a/app/Controllers/NotificationController.php b/app/Controllers/NotificationController.php index e0a6280c..2c050523 100644 --- a/app/Controllers/NotificationController.php +++ b/app/Controllers/NotificationController.php @@ -147,11 +147,14 @@ class NotificationController extends AdminController $count++; $temp_whole_data[] = $value; if($count == 20 || $whole_index == count($wholeData)-1 && $index == count($values)-1){ - $job_details = new Jobs(); - $r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $temp_whole_data]); + if (count($temp_whole_data) > 0) { + $job_details = new Jobs(); + $r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $temp_whole_data]); - $temp_whole_data = []; - $count = 0; + $temp_whole_data = []; + $count = 0; + } + } } } diff --git a/app/Helpers/sendMailNotification.php b/app/Helpers/sendMailNotification.php index f93e79f6..cfc96b17 100644 --- a/app/Helpers/sendMailNotification.php +++ b/app/Helpers/sendMailNotification.php @@ -57,21 +57,32 @@ class sendMailNotification if ($value['relationship'] != 'Self') { $emp_data = $EmployeeModel->where('client_id', $client_data['id'])->where('emp_code', $value['emp_code'])->where('is_active',1)->findAll(); - - foreach ($emp_data as $key => $value) { - if ($value['relationship'] == 'Self') { - $employee_name =$value['name']; - $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content); - $mail = $value['email_corporate']; + if(count($emp_data) > 1){ + $mail =''; + foreach ($emp_data as $key => $values) { + if ($value['relationship'] == 'Self') { + $employee_name =$values['name']; + $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content); + + $mail = $values['email_corporate']; + } } + }else{ + $mail =''; } + }else{ $employee_name =$value['name']; $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content); $mail = $value['email_corporate']; } + if (isset($mail) && !empty($mail)) { $wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']]; + } + } + if (count($wholeData) < 1) { + $wholeData = []; } return $wholeData; }else{ @@ -194,8 +205,9 @@ class sendMailNotification $mail_content = str_replace("[[member_summary]]", $table_content , $mail_content); // $mail = "aadhavanvalli@gmail.com"; - - $wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']]; + // if (isset($mail) && !empty($mail)) { + $wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']]; + // } return $wholeData; From 90eaba5b85e174387f6576983ee591b176e5fcd1 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Thu, 16 May 2024 14:33:56 +0530 Subject: [PATCH 7/7] CHANGE_CLIENT_POLICY_POLICY_NO_TPA_NETWORK_HOSPITAL : AADHAVAN --- app/Controllers/ClientController.php | 3 +++ app/Controllers/MasterController.php | 2 ++ app/Models/ClientPolicyModel.php | 3 ++- app/Models/TPAModel.php | 1 + app/Views/client_policy.php | 16 +++++++++++++--- app/Views/tpa_basic_info.php | 21 +++++++++++++-------- writable/e_card_template/md_tpa.html | 0 writable/e_card_template/ttpanh.html | 0 8 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 writable/e_card_template/md_tpa.html create mode 100644 writable/e_card_template/ttpanh.html diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 8b0c17ee..1984e5dc 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -653,6 +653,7 @@ class ClientController extends AdminController } + $data['policy_no'] = $this->request->getPost('policy_no'); $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['created_by'] = get_session_userid(); @@ -696,6 +697,7 @@ class ClientController extends AdminController $data['tpa_id'] = $tpaId; $data['policy_id'] = $this->request->getPost('policy_id'); $data['policy_type_id'] = $this->request->getPost('policy_type_id'); + $data['policy_no'] = $this->request->getPost('policy_no'); $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'); @@ -741,6 +743,7 @@ class ClientController extends AdminController // dd($data); $data['updated_by'] = get_session_userid(); + // print_r($data);die; $insert = $this->clientPolicyModel->update($id,$data); $lastQuery = $this->clientPolicyModel->getLastQuery(); diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index a2c011a2..b652d3eb 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -427,6 +427,7 @@ class MasterController extends AdminController $data['tpa_logo'] = $file_name; $data['front_card'] = $front_card_file_name; $data['back_card'] = $back_card_file_name; + $data['network_hospitals'] = $this->request->getPost('network_hospitals'); $insert = $this->tpaModel->insert($data); @@ -566,6 +567,7 @@ class MasterController extends AdminController $data['back_card'] = $back_card_file_name; } + $data['network_hospitals'] = $this->request->getPost('network_hospitals'); $update = $this->tpaModel->update($id,$data); diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php index 291b13f9..4cdd36b5 100644 --- a/app/Models/ClientPolicyModel.php +++ b/app/Models/ClientPolicyModel.php @@ -40,7 +40,8 @@ class ClientPolicyModel extends Model "updated_by", "Is_active", "date_of_exit", - "reason_for_exit" + "reason_for_exit", + "policy_no" ]; public function getClientPolicyById($id){ diff --git a/app/Models/TPAModel.php b/app/Models/TPAModel.php index 215c734d..fe3f30cd 100644 --- a/app/Models/TPAModel.php +++ b/app/Models/TPAModel.php @@ -15,6 +15,7 @@ class TPAModel extends Model "front_card", "back_card", "tpa_logo", + "network_hospitals", "created_by", "updated_by", "is_active", diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 8ee76ec5..d26b3f20 100644 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -92,15 +92,19 @@