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'); }