From 72624f5cddaaae2d66e3f061954d8c6a5947ee93 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Sat, 15 Jun 2024 17:30:03 +0530 Subject: [PATCH] FIX_CLIENT_RAISED_ISSUE_AND_COPY_EXCEL_RACK_RATE_ADD_MORE_BASIC_PAY : RV --- app/Config/Routes.php | 1 + app/Controllers/ClientController.php | 115 ++- app/Controllers/EmpDataServiceController.php | 7 +- app/Controllers/EmployeeController.php | 10 +- app/Views/client_policy.php | 180 +++-- app/Views/employee_upload.php | 26 +- app/Views/layout/footer.php | 2 +- app/Views/layout/header.php | 9 +- app/Views/policy_gmc_terms.php | 143 +++- app/Views/policy_gpa_terms.php | 59 +- app/Views/policy_grid.php | 349 ++++---- app/Views/policy_grid_excel.php | 786 +++++++++++-------- 12 files changed, 1054 insertions(+), 633 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index f8e0756c..38c81300 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -245,6 +245,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) { $routes->get("delete-additional-rack-rate/(:any)", "ClientController::deleteAdditionalRackRate/$1"); $routes->get("check_cd_ac_no/(:any)", "MasterController::checkUniqueCDAccountNumber/$1"); $routes->get("get_cd_ac/(:any)", "ClientController::get_cd_ac/$1"); + $routes->get("check_policy_type/(:any)", "ClientController::checkPolicyType/$1"); }); $routes->cli('cli/processjob', 'JobWorker::processJob'); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index d6b271f7..b7b114be 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -613,22 +613,13 @@ class ClientController extends AdminController $policy_type_id = $this->request->getPost('policy_type_id'); $client_branch_id = $this->request->getPost('client_branch_id'); - - $policyCount = $this->clientPolicyModel - ->where('policy_type_id', $policy_type_id) - ->where('client_branch_id', $client_branch_id) - ->countAllResults(); - - if($policyCount > 0 ){ - $clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($this->request->getPost('client_id')); - return $this->respond(['status' => 'policy_exist','code' => 200,'data' => $clientPoliceData, 'method' => 'CERATE'], 200); - } - - $insurerValue = (string) $this->request->getPost('insurer'); - list($insurerBranchId, $insurerId) = explode('-', $insurerValue); $client_id = $this->request->getPost('client_id'); + $insurerValue = (string) $this->request->getPost('insurer'); + list($insurerBranchId, $insurerId) = explode('-', $insurerValue); + + $data['insurer_branch_id'] = $insurerBranchId; $data['insurer_id'] = $insurerId; @@ -911,6 +902,24 @@ class ClientController extends AdminController $policyPremium = $this->policyPremium1Model->insert($data); } + }else if ($si_or_bp == '2') { + + $premium = str_replace(',', '', $this->request->getPost('gpa_basic_premium[]')); + $sum_insure = str_replace(',', '', $this->request->getPost('gpa_basic_si[]')); + $basic_pay = str_replace(',', '', $this->request->getPost('basic_pay[]')); + + for ($i = 0; $i < count($premium); $i++) { + + $data['si_or_bp'] = $this->request->getPost('si_or_bp'); + $data['basic_multiplier'] = str_replace(',', '', $this->request->getPost('basic_multiplier')); + $data['multiplier'] = $this->request->getPost('premium_multiplier'); + $data['basic_pay'] = $basic_pay[$i]; + $data['si'] = $sum_insure[$i]; + $data['premium'] = $premium[$i]; + + $policyPremium = $this->policyPremium1Model->insert($data); + } + }else { $data['premium'] = str_replace(',', '', $this->request->getPost('gpa_basic_premium')); @@ -1205,19 +1214,11 @@ class ClientController extends AdminController $emp_count = $this->employeePolicyModel - ->join('client_policy cp', "cp.id = employee_polices.client_policy_id") - ->where("employee_polices.client_policy_id", $client_policy_id) - ->where("employee_polices.status", 'active') - ->where("employee_polices.is_active", 1) - ->countAllResults(); - - // $emp_count = count($data); - - // if($emp_count == 0){ - // $emp_count = true; - // }else{ - // $emp_count = false; - // } + ->join('client_policy cp', "cp.id = employee_polices.client_policy_id") + ->where("employee_polices.client_policy_id", $client_policy_id) + ->where("employee_polices.status", 'active') + ->where("employee_polices.is_active", 1) + ->countAllResults(); $data = $this->policesModel->getPolicyPremium($record['policy_id']); @@ -1225,9 +1226,11 @@ class ClientController extends AdminController $gmc_pattern = '/gmc/i'; $gpa_pattern = '/gpa/i'; $subject = $data[0]->policy_type; + $policy_type_id = $data[0]->id; + if (preg_match($gmc_pattern, $subject)) { $search_term = 'GMC'; - } else if (preg_match($gpa_pattern, $subject)) { + } else if (preg_match($gpa_pattern, $subject) || $policy_type_id == 6 || $policy_type_id == 7) { $search_term = 'GPA'; } else { $search_term = ""; @@ -1235,7 +1238,7 @@ class ClientController extends AdminController $results = $this->policyGridModel->like('policy_type', $search_term)->findAll(); - if ($search_term === 'GPA') { + if ($search_term === 'GPA' || $policy_type_id == 6 || $policy_type_id == 7) { $premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll(); } else if ($search_term === 'GMC') { @@ -1246,9 +1249,6 @@ class ClientController extends AdminController $premiumData = ""; } - - - // echo '
';
         // print_r($premiumData); die;
@@ -1322,7 +1322,7 @@ class ClientController extends AdminController
 
             return $this->respond(['status' => true, 'code' => 200, 'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self, 'client_policy_id' => $client_policy_id], 200);
 
-        } else if ($search_term === 'GPA') {
+        } else if ($search_term === 'GPA' || $policy_type_id == 6 || $policy_type_id == 7) {
 
             return $this->respond(['status' => true, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self, 'client_policy_id' => $client_policy_id], 200);
         } else {
@@ -1343,7 +1343,7 @@ class ClientController extends AdminController
 
             $data['sum_insured']   =str_replace(',', '',$this->request->getPost("sum_insured"));
             $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['corporatebuffer'] = $this->request->getPost("corporatebuffer") ? $this->request->getPost("corporatebuffer") : 0;
             $data['family_floaters'] = $this->request->getPost("family_floaters") ?? [];        
             
             $data['age_ratio']['self']['min'] =  $this->request->getPost("self_min_age") ? $this->request->getPost("self_min_age") :0;
@@ -1455,7 +1455,7 @@ class ClientController extends AdminController
             $data['bioabsorbablestenttoriclensmultifocallens'] =$this->request->getPost("bioabsorbablestenttoriclensmultifocallens");
             $data['roomrentlimit'] =str_replace(',', '',$this->request->getPost("roomrentlimit"));
             $data['proportionatedeductionclause'] =str_replace(',', '',$this->request->getPost("proportionatedeductionclause"));
-            $data['nursingallowance'] =str_replace(',', '',$this->request->getPost("nursingallowance"));
+            // $data['nursingallowance'] =str_replace(',', '',$this->request->getPost("nursingallowance"));
             $data['ailmentcapping'] =str_replace(',', '',$this->request->getPost("ailmentcapping"));
             $data['ambulancecharges'] =str_replace(',', '',$this->request->getPost("ambulancecharges"));
             $data['airambulance'] =str_replace(',', '',$this->request->getPost("airambulance"));
@@ -1463,6 +1463,12 @@ class ClientController extends AdminController
             $data['reasonableandcustomarycharges'] =str_replace(',', '',$this->request->getPost("reasonableandcustomarycharges"));
             $data['ayudhtreatmentcover'] =str_replace(',', '',$this->request->getPost("ayudhtreatmentcover"));
 
+            $data['congenitaldiseasesexternal'] =str_replace(',', '',$this->request->getPost("congenitaldiseasesexternal"));
+            $data['optionalparentalcopay'] =str_replace(',', '',$this->request->getPost("optionalparentalcopay"));
+            $data['posthospitalizationcover'] =str_replace(',', '',$this->request->getPost("posthospitalizationcover"));
+            $data['corporatebuffer'] =str_replace(',', '',$this->request->getPost("corporatebuffer"));
+            $data['sublimitofcorporatebuffer'] =str_replace(',', '',$this->request->getPost("sublimitofcorporatebuffer"));
+
             if ($data['ayudhtreatmentcover'] == 1) {
                 $data['ayushTreatmentCoverData']   = str_replace(',', '',$this->request->getPost("ayushTreatmentCoverData"));
             }else{
@@ -1483,6 +1489,7 @@ class ClientController extends AdminController
             $data['days_from_dod'] =str_replace(',', '',$this->request->getPost("days_from_dod"));
             $data['special_condition_label'] = str_replace(',', '',$this->request->getPost("special_condition_label")) ?? [];
             $data['special_condition_input'] = str_replace(',', '',$this->request->getPost("special_condition_input")) ?? [];
+            $data['multiple_sum_insured'] = str_replace(',', '',$this->request->getPost("multiple_sum_insured")) ?? [];
 
             $data['cataract'] =str_replace(',', '',$this->request->getPost("cataract"));
 
@@ -1537,16 +1544,22 @@ class ClientController extends AdminController
         //     ->where("employees.emp_status",'active')
         //     ->countAllResults();
 
-        $emp_count_by_policy = $this->employeePolicyModel->where('client_policy_id',$client_policy_id)->where('is_active',1)->countAllResults();
+        $emp_count_by_policy = $this->employeePolicyModel
+                        ->where('client_policy_id',$client_policy_id)
+                        ->where("status", 'active')
+                        ->where('is_active',1)
+                        ->countAllResults();
         
-        // if($emp_count == 0){
-        //     $emp_count = true;
-        // }else{
-        //     $emp_count = false;
-        // }
 
         if ($record) {
-            return $this->respond(['Status' => true,'code' => 200,'data' => $record['policy_terms'],  'policy_name' => $policy_name,'policy_addon' => $record['is_addon'], 'emp_count_by_policy'=>$emp_count_by_policy], 200);
+            return $this->respond([
+                'Status' => true,
+                'code' => 200,        
+                'data' => $record['policy_terms'],  
+                'policy_name' => $policy_name,
+                'policy_addon' => $record['is_addon'], 
+                'emp_count_by_policy'=>$emp_count_by_policy],
+            200);
         } else {
             return $this->respond(['Status' => false,'code' => 200,'message' => 'Record not found.',  'policy_name' => $policy_name], 200);
         }
@@ -1612,6 +1625,8 @@ class ClientController extends AdminController
             $data['worldwideCover']        = $this->request->getPost("worldwideCover");
             $data['gpa_special_condition_label'] = str_replace(',', '',$this->request->getPost("gpa_special_condition_label")) ?? [];
             $data['gpa_special_condition_input'] = str_replace(',', '',$this->request->getPost("gpa_special_condition_input")) ?? [];
+            $data['multiple_sum_insured'] = str_replace(',', '',$this->request->getPost("multiple_sum_insured")) ?? [];
+
 
 
             $jsonData = json_encode($data);
@@ -2181,4 +2196,22 @@ class ClientController extends AdminController
     }
 
 
+    public function checkPolicyType($client_policy_id, $policy_type_id, $client_branch_id, $client_id){
+
+        $policyCount = $this->clientPolicyModel
+        ->where('policy_type_id', $policy_type_id) 
+        ->where('client_branch_id', $client_branch_id)
+        ->where('client_id', $client_id)
+        ->countAllResults(); 
+
+        if($policyCount > 0 ){
+            $clientPoliceData =  $this->clientPolicyModel->getClientPolicyByClientId($client_id);
+            return $this->respond(['status' => true,'code' => 200, 'count' =>  $policyCount, 'data' => $clientPoliceData, 'method' => 'CERATE' ,'client_id' => $client_id, 'client_branch_id' => $client_branch_id, 'policy_type_id' => $policy_type_id], 200);
+        }else{
+            return $this->respond(['status' => false,'code' => 200,'client_id' => $client_id, 'client_branch_id' => $client_branch_id, 'policy_type_id' => $policy_type_id], 200);
+        }
+
+    }
+
+
 }
\ No newline at end of file
diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php
index 2d0febe4..3cb36091 100644
--- a/app/Controllers/EmpDataServiceController.php
+++ b/app/Controllers/EmpDataServiceController.php
@@ -145,7 +145,8 @@ class EmpDataServiceController extends BaseController
 
         if($cash_balance == null){
 
-            $cash_balance = $this->CDMasterModel->where('client_id', $export_data['client_id'])->where('insurer_id', $insurer_id['insurer_id'])->orderBy('id', 'DESC')->first();
+            $balance = $this->CDMasterModel->where('client_id', $export_data['client_id'])->where('insurer_id', $insurer_id['insurer_id'])->orderBy('id', 'DESC')->first();
+            $cash_balance['balance'] = $balance['opening_bal'];
         }
 
 
@@ -198,7 +199,7 @@ class EmpDataServiceController extends BaseController
             'NAME OF EMP/DEP',
             'EMP ID',
             'EMP/DEP TYPE',
-            'RELATION',
+            'RELATIONSHIP CODE',
             'DOB',
             'GENDER',
             'PRE EXISTING AILMENTS',
@@ -683,7 +684,7 @@ class EmpDataServiceController extends BaseController
         unset($excel_data[0]);
         array_pop($excel_data);
 
-        $inceptionHeader = ['S.No', 'NAME OF EMP/DEP','EMP ID','EMP/DEP TYPE','RELATION','DOB','GENDER','PRE EXISTING AILMENTS','BASIC COVER SI','DATE OF COVERAGE','AGE','RELATIONSHIP','REMARKS','POLICY END DATE','NO OF DAYS','TPA ID','UHID','PREMIUM','PR0 RATA PREMIUM','GST','TOTAL'];
+        $inceptionHeader = ['S.No', 'NAME OF EMP/DEP','EMP ID','EMP/DEP TYPE','RELATIONSHIP CODE','DOB','GENDER','PRE EXISTING AILMENTS','BASIC COVER SI','DATE OF COVERAGE','AGE','RELATIONSHIP','REMARKS','POLICY END DATE','NO OF DAYS','TPA ID','UHID','PREMIUM','PR0 RATA PREMIUM','GST','TOTAL'];
 
         foreach ($inceptionHeader as $key => $value) {
             if($excel_header[$key] != $value){
diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php
index 61c66278..80571810 100644
--- a/app/Controllers/EmployeeController.php
+++ b/app/Controllers/EmployeeController.php
@@ -772,13 +772,9 @@ class EmployeeController extends AdminController
             ->findAll();
 
         $emp_count = count($data);
-
-        if ($data) {
-            return $this->respond(['dataStatus' => true, 'code' => 200, 'emp_count' => $emp_count], 200);
-        } else {
-
-            return $this->respond(['dataStatus' => false, 'code' => 404], 404);
-        }
+        $events = ['inception' => 'Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
+        return $this->respond(['dataStatus' => true, 'code' => 200,  'emp_count' => $emp_count, 'events' => $events, 'client_policy_id' => $id], 200);
+       
     }
 
 
diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php
index 9ccb3996..e5626a3a 100644
--- a/app/Views/client_policy.php
+++ b/app/Views/client_policy.php
@@ -7,8 +7,8 @@
 
     
- - +
+ @@ -211,14 +211,14 @@ if (policy_PrimaryKey !== '') { var policyTable = ''; var data = ; - // console.log('client_policy_data',data) + // //console.log('client_policy_data',data) data.forEach(function(item) { - // console.log(item.open_for_enrollment); + // //console.log(item.open_for_enrollment); var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc' var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa' var subject = item.policy_type_name; - console.log('search terms subject', subject); + //console.log('search terms subject', subject); if (patternGMC.test(subject)) { search_term = 'GMC'; @@ -227,7 +227,7 @@ } else { search_term = subject; // Set default value if neither 'GMC' nor 'GPA' exists } - console.log('search_term :', search_term) + //console.log('search_term :', search_term) var enrollmentStatus = ''; if (item.inception_type == 1) { @@ -282,12 +282,14 @@ }); $('#policy_table').append(policyTable); + // console.log(policyTable); } $('#table-client-policy').DataTable({ paging: true, - searching: false + searching: false, + // ordering: false }); }); @@ -353,8 +355,8 @@ var policyDataId = $('#policy').children('option:selected').attr('data-id'); var basePolicyDataId = $('#base_policy').children('option:selected').attr('data-id'); - // console.log('policyDataId', policyDataId); - // console.log('basePolicyDataId', basePolicyDataId); + // //console.log('policyDataId', policyDataId); + // //console.log('basePolicyDataId', basePolicyDataId); if (policy_PrimaryKey === '' && policy_client === '') { toastr.error('Client is required', 'Error'); @@ -382,7 +384,7 @@ var isValid = $('#policy_form').parsley().validate(); if (!isValid) { - console.log('Form is Empty', 'Warning'); + //console.log('Form is Empty', 'Warning'); return; } @@ -401,18 +403,13 @@ contentType: false, success: function(res) { - console.log(res); + //console.log(res); $('#policy_form')[0].reset(); if (res.status === false) { toastr.error('Policy Dose Not Create', 'Error'); return; } - if (res.staus === 'policy_exist') { - - toastr.error('Policy already exist in the branch', 'Error'); - } - if (res) { setTimeout(function() { @@ -446,7 +443,7 @@ subject; // Set default value if neither 'GMC' nor 'GPA' exists } - // console.log('search_term :', search_term) + // //console.log('search_term :', search_term) var enrollmentStatus = ''; if (item.inception_type == 1) { @@ -494,7 +491,7 @@ @@ -502,6 +499,8 @@ `; }); $('#policy_table').append(policyTable); + console.log(policyTable); + $('#insurer').val(''); $('#tpa').val(''); @@ -517,11 +516,11 @@ $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); if (xhr.status === 404) { - console.log('Resource not found', 'Warning'); + //console.log('Resource not found', 'Warning'); } else if (xhr.status === 500) { - console.log('Internal server error', 'Warning'); + //console.log('Internal server error', 'Warning'); } else { - console.log('Unknown error occurred', 'Warning'); + //console.log('Unknown error occurred', 'Warning'); } }, 1000); } @@ -542,12 +541,12 @@ var selectedOption = $('#base_policy').find(':selected'); var base_policy_data_id = selectedOption.data('id'); - // console.log('base_policy_data_id', base_policy_data_id); + // //console.log('base_policy_data_id', base_policy_data_id); $.get(url, function(res) { // res = JSON.parse(res)// - console.log('polices', res) + //console.log('polices', res) var OptionsHTML = ''; OptionsHTML += ''; $policy_type_value = $('#policy_type').val(); @@ -595,7 +594,7 @@ if (item.policy_type_id == 1 || item.policy_type_id == 2 || item .policy_type_id == 3 || item.policy_type_id == 7 || item.policy_type_id == 6){ - console.log(item.policy_type_id) + //console.log(item.policy_type_id) OptionsHTML += ''; } } else { @@ -616,8 +615,8 @@ $.get(url_for_cd, function(response){ - console.log(response) - console.log(response.data) + //console.log(response) + //console.log(response.data) if(response.status == false && response.insurer_id != 'undefined'){ toastr.warning('The CD Account Number not found.', 'Warning'); @@ -641,9 +640,36 @@ var id = $(this).val(); var dataId = $(this).children('option:selected').attr('data-id'); - // console.log('id', id) + var branch_id = $('#client_branch').val(); + var client_id = $('#client_id_policy').val(); + + console.log('client_id', client_id) + console.log('branch_id', branch_id) + console.log('policy_type_id', dataId) + $('#policy_type_id').val(dataId); + var url = '' + id + '/' + dataId + '/' + branch_id + '/' + client_id + + $.get(url, function(response){ + + console.log(response) + //console.log(response.data) + + if(response.count > 0){ + console.log('Policy already exist in the branch') + toastr.error('Policy already exist in the branch', 'Error'); + $('#policy').val('').change(); + } + console.log('outer') + + + }).fail(function(xhr, status, error) { + console.error(xhr.responseText); + console.error(status, error); + }); + + if (dataId == 1) { $('#tpa').prop('required', false); $('#tpa_danger').hide() @@ -652,28 +678,15 @@ $('#tpa_danger').show() } - var base_policy_dataId = $('#base_policy').children('option:selected').attr('data-id'); + if ($('#policy_type').val() == 1) { - // $('#base_policy option').each(function() { - // var val = $(this).val(); - // if (val == id) { - // $(this) - // .hide(); // Hide the option if its value matches the selected value of #policy - // } else { - // $(this).show(); // Show all other options - // } - // }); - - - if ($('#policy_type').val() == 1) { - - // console.log('step 1') + // //console.log('step 1') if (dataId == 3) { - // console.log('step 2') + // //console.log('step 2') var displayStatus = $('#base_policy_id').css('display'); $('#base_policy_id').show(); @@ -681,7 +694,7 @@ // $('#base_policy').prop('required', true); if (displayStatus === 'none') { - // console.log('step 2.1') + // //console.log('step 2.1') $('#base_policy').val('').change(); } @@ -690,7 +703,7 @@ } else { - // console.log('step 3') + // //console.log('step 3') var displayStatus = $('#base_policy_id').css('display'); $('#base_policy_id').hide(); @@ -698,7 +711,7 @@ // $('#base_policy').prop('required', false); if (displayStatus === 'none') { - // console.log('step 3.1') + // //console.log('step 3.1') $('#base_policy').val('').change(); } @@ -725,7 +738,7 @@ dataType: 'json', success: function(res) { - console.log('client_policy_res', res) + //console.log('client_policy_res', res) setTimeout(function() { $('.loader').fadeOut(); @@ -889,12 +902,13 @@ setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - console.log('Something Wrong!', 'warning'); + //console.log('Something Wrong!', 'warning'); }, 1000); } }); }); + $('body').on('click', '.btnOpenEnroll', function() { Swal.fire({ @@ -979,11 +993,11 @@ $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); if (xhr.status === 404) { - console.log('Resource not found', 'Warning'); + //console.log('Resource not found', 'Warning'); } else if (xhr.status === 500) { - console.log('Internal server error', 'Warning'); + //console.log('Internal server error', 'Warning'); } else { - console.log('Unknown error occurred', 'Warning'); + //console.log('Unknown error occurred', 'Warning'); } }, 1000); } @@ -1127,8 +1141,8 @@ const integerWord = convertNumberToWords(parseInt(integerPart, 10)); let result = `${integerWord}`; - console.log('decimalPart',decimalPart) - console.log('decimalPart',typeof decimalPart) + ////console.log('decimalPart',decimalPart) + //console.log('decimalPart',typeof decimalPart) if (decimalPart != '00' && decimalPart != undefined) { result += ` and `; @@ -1151,17 +1165,17 @@ function formatNumber(input, maxLength) { - console.log("input", input); - console.log("input value", input.value); + //console.log("input", input); + //console.log("input value", input.value); maxLength = 16; let value = input.value.replace(/[^\d.]/g, ''); // Remove non-numeric characters - console.log('Remove non-numeric characters', value) + //console.log('Remove non-numeric characters', value) // Limit the number of digits value = value.slice(0, maxLength); - console.log('Limited value', value); + //console.log('Limited value', value); // Format the number with commas using Indian numbering system @@ -1169,7 +1183,7 @@ maximumFractionDigits: 2 }); - console.log('formetted value', value); + //console.log('formetted value', value); input.value = (value); @@ -1236,7 +1250,7 @@ function removeClientPolicy(element) { - // console.log(element); + // //console.log(element); } @@ -1327,7 +1341,7 @@ var client_id = $('#client_id_policy').val() var client_branch_id = $('#client_branch').val() - // console.log('client_branch_id', client_branch_id) + // //console.log('client_branch_id', client_branch_id) $.ajax({ url: '' + client_id, @@ -1335,7 +1349,7 @@ dataType: 'json', success: function(res) { - console.log('one', res) + //console.log('one', res) $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); @@ -1349,7 +1363,7 @@ OptionsHTML += ''; $.each(res.data, function(index, item) { - // console.log('item.client_branch_id', item.client_branch_id) + // //console.log('item.client_branch_id', item.client_branch_id) if (item.client_branch_id == client_branch_id) { @@ -1357,7 +1371,7 @@ if ($('#policy_type').val() == 1) { if (item.policy_type_id == 1 || item.policy_type_id == 2) { - // console.log('if 2') + // //console.log('if 2') OptionsHTML += ''; @@ -1379,7 +1393,7 @@ setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - console.log('Something Wrong!', 'warning'); + //console.log('Something Wrong!', 'warning'); }, 1000); } }); @@ -1393,13 +1407,13 @@ var client_policy_id = $(this).val() ? $(this).val() : 0; var policy_type = $('#policy_type').val() - // console.log(client_policy_id); + // //console.log(client_policy_id); dataId = $('#policy').children('option:selected').attr('data-id'); - // console.log('dataId', dataId) + // //console.log('dataId', dataId) base_policy_data_id = $(this).children('option:selected').attr('data-id'); - // console.log('base_policy_data_id', base_policy_data_id); + // //console.log('base_policy_data_id', base_policy_data_id); var queryParams = { client_policy_id: client_policy_id, @@ -1409,8 +1423,8 @@ const queryString = objectToQueryString(queryParams); // var uri = '?' + queryString var uri = '' + client_policy_id - // console.log('uri', uri) - // console.log('queryString', queryString) + // //console.log('uri', uri) + // //console.log('queryString', queryString) $('.loader').fadeIn(); $('.loader-mask').fadeIn(); @@ -1423,7 +1437,7 @@ contentType: false, success: function(res) { - console.log(res) + //console.log(res) setTimeout(function() { $('.loader').fadeOut(); @@ -1442,7 +1456,7 @@ $policy_type_value = $('#policy_type').val(); $.each(res.policy, function(index, item) { - // console.log(item); + // //console.log(item); policeOptionHTML += ' - - + + - - + + @@ -155,8 +160,8 @@ - - + +
Insurer Policy
Self:
Min Age:
Max Age:
Min Age:
Max Age:
Spouse:
Min Age:
Max Age:
Min Age:
Max Age:
Children:
Min Age:
Max Age:
Min Age:
Max Age:
@@ -184,21 +189,19 @@ - - - + + + -
Elders Count:
Min Age:
Max Age:
Elders Count:
Min Age:
Max Age:
-

- +
+
+ +
+
+ +
+
+
@@ -315,6 +327,15 @@
+
+
+ +
+
+ +
+
+
@@ -323,6 +344,29 @@ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
@@ -778,6 +840,7 @@ $('#gmc_client_policy_id').val(client_policy_id) $('.removeDom').remove(); + $('#gmc_si_add_more').empty(); var gmc_policy_type_id = $(this).attr('id'); // //console.log(gmc_policy_type_id) @@ -865,6 +928,13 @@ } } + + if (key.includes("multiple_sum_insured")) { + jsonObject[key].forEach((value, index) => { + appendGMCSIAddMore(value); + }); + } + if (key.includes("family_floaters")) { let checkboxes = document.querySelectorAll(`input[name="${key}[]"]`); if (jsonObject[key]) { @@ -916,8 +986,11 @@ $('.waiverof1234thyearexclusions').prop('disabled', true); $('.waiverof30dayswaitingperiod').prop('disabled', true); $('#prehospitalizationcover').prop('disabled', true); + $('#posthospitalizationcover').prop('disabled', true); $('.congenitaldiseasesinternal').prop('disabled', true); + $('#congenitaldiseasesexternal').prop('disabled', true); $('#copayzonewisecopay').prop('disabled', true); + $('#optionalparentalcopay').prop('disabled', true); $('#bioabsorbablestenttoriclensmultifocallens').prop('disabled', true); $('#roomrentlimit').prop('disabled', true); $('#proportionatedeductionclause').prop('disabled', true); @@ -939,6 +1012,8 @@ $('#moderntreatmentsasperirdai').prop('disabled', true); $('#days_of_discharge').prop('disabled', true); $('#days_from_dod').prop('disabled', true); + $('#corporatebuffer').prop('disabled', true); + $('#sublimitofcorporatebuffer').prop('disabled', true); setTimeout(function() { var editor1 = new Jodit('#additionalsicknessbenefit'); @@ -1027,6 +1102,7 @@ }); } $("#sum_insured").trigger("keyup"); + $(".multiple_sum_insured").trigger("keyup"); $('.jodit-wysiwyg').each(function() { $(this).click(); @@ -1146,6 +1222,7 @@ }); $("#sum_insured").on("keyup", function() { + console.log('keyup sum insured'); var inputNumber = $(this).val(); if (inputNumber) { var result = convertCommaNumberToWords(inputNumber); @@ -1319,12 +1396,42 @@ function lowerIsEighteen(params) { + var value = $(params).val(); - - if($(params).val() < 18){ + if (value < 18) { $(params).val(18); + } else if (value > 99) { + $(params).val(99); } + } + + function appendGMCSIAddMore(data = null){ + + console.log('function called') + + var html = ` +
+
+ +
+
+ +
+
+ +
+
+
+
+
`; + + $('#gmc_si_add_more').append(html); + } + + function removeGMCAdditionalSI(button) { + console.log('remove clicked'); + $(button).closest('.row').remove(); } \ No newline at end of file diff --git a/app/Views/policy_gpa_terms.php b/app/Views/policy_gpa_terms.php index 4d0b9882..3cc25545 100644 --- a/app/Views/policy_gpa_terms.php +++ b/app/Views/policy_gpa_terms.php @@ -90,16 +90,21 @@
-
+
-
+
+
+
+
+
+
@@ -132,13 +137,13 @@
Min Age: - +
Max Age: - +
@@ -569,6 +574,12 @@ }); } } + + if (key.includes("multiple_sum_insured")) { + gpaJsonObjectForSpecialCondition[key].forEach((value, index) => { + appendGPASIAddMore(value); + }); + } }); let jsonObject = JSON.parse(res.data); @@ -634,6 +645,7 @@ } $("#sumInsured2").trigger("keyup"); + $('.multiple_sum_insured').trigger("keyup"); $("#totalSumInsured").trigger("keyup"); @@ -723,6 +735,16 @@ } }); + $(".multiple_sum_insured").on("keyup", function() { + var inputNumber = $(this).val(); + if (inputNumber) { + var result = convertCommaNumberToWords(inputNumber); + $(".numberToWordSumInsured").text(result); + } else { + $(".numberToWordSumInsured").text(""); + } + }); + $("#totalSumInsured").on("keyup", function() { var inputNumber = $(this).val(); @@ -735,16 +757,27 @@ }); + function appendGPASIAddMore(data = null){ + console.log('function called') - // function formatNumber(input) { - // Remove non-numeric characters - // let value = input.value.replace(/\D/g, ''); + var html = ` +
+
+ +
+
+ +
+
+ + +
+
+
+
+
`; - // Add commas - // value = Number(value).toLocaleString('en-IN'); - - // Update the input value - // input.value = value; - // } + $('#gpa_si_add_more').append(html); + } \ No newline at end of file diff --git a/app/Views/policy_grid.php b/app/Views/policy_grid.php index f69a7648..6f3a858a 100644 --- a/app/Views/policy_grid.php +++ b/app/Views/policy_grid.php @@ -6,7 +6,7 @@