FIX_CLIENT_RAISED_ISSUE_AND_COPY_EXCEL_RACK_RATE_ADD_MORE_BASIC_PAY : RV
This commit is contained in:
parent
1474f21a66
commit
72624f5cdd
@ -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');
|
||||
|
||||
@ -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 '<pre>';
|
||||
// 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -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){
|
||||
|
||||
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
|
||||
<div class="table-responsive" id="table_list">
|
||||
|
||||
<table class="table table-borderless table-nowrap mb-0" id="table-client-policy">
|
||||
<thead class="thead-light">
|
||||
<table class="table table-borderless table-nowrap mb-0" id="table-client-policy">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Insurer</th>
|
||||
<th>Policy</th>
|
||||
@ -211,14 +211,14 @@
|
||||
if (policy_PrimaryKey !== '') {
|
||||
var policyTable = '';
|
||||
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
||||
// 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 @@
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}"class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -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 += '<option value="" selected>Select Policy</option>';
|
||||
$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 += '<option data-id="' + item.policy_type_id + '" value="' + item.id + '">' + item.name + '( ' + item.policy_type + ' )</option>';
|
||||
}
|
||||
} 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 = '<?php echo base_url('util/check_policy_type/') ?>' + 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: '<?= base_url("util/featch-client-policy-list/") ?>' + 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 += '<option value="" selected>Select Base Policy</option>';
|
||||
$.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 += '<option data-id="' + item.policy_type_id + '" value="' +
|
||||
item.id +
|
||||
'">' + item.name + '( ' + item.policy_type + ' )</option>';
|
||||
@ -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 = '<?= base_url('util/fetch-policy-for-policy-type') ?>?' + queryString
|
||||
var uri = '<?= base_url('client/policy/list/') ?>' + 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 += '<option data-id="' + item.policy_type_id +
|
||||
'" value="' + item.id + '" ' + (res.data.policy_id === item
|
||||
@ -1456,16 +1470,16 @@
|
||||
|
||||
if (dataId == 3 || policy_type == 1) {
|
||||
|
||||
// console.log('step 1')
|
||||
// //console.log('step 1')
|
||||
|
||||
setTimeout(function() {
|
||||
// console.log('step 2')
|
||||
// //console.log('step 2')
|
||||
var $option = $('#policy').find('option[data-id="3"]');
|
||||
if ($option.length > 0) {
|
||||
// console.log('step 3')
|
||||
// //console.log('step 3')
|
||||
$option.prop('selected', true).change();
|
||||
} else {
|
||||
// console.log('step 4');
|
||||
// //console.log('step 4');
|
||||
toastr.warning(
|
||||
'The insurer does not have a GMC-Parents policy.',
|
||||
'Warning');
|
||||
@ -1480,7 +1494,7 @@
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log('Something Wrong!', 'warning');
|
||||
//console.log('Something Wrong!', 'warning');
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
@ -1495,7 +1509,7 @@
|
||||
|
||||
function fetchClientBranch() {
|
||||
|
||||
console.log('function called');
|
||||
//console.log('function called');
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
@ -1519,8 +1533,8 @@
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
console.log(res);
|
||||
// console.log(res.data.length);
|
||||
//console.log(res);
|
||||
// //console.log(res.data.length);
|
||||
|
||||
if (res.data.length == 0) {
|
||||
toastr.warning('The client does not have any branches.', 'warning');
|
||||
@ -1564,7 +1578,7 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#client_branch").on('change', function() {
|
||||
// console.log('fetchClientPolicyList change')
|
||||
// //console.log('fetchClientPolicyList change')
|
||||
fetchClientPolicyList();
|
||||
});
|
||||
|
||||
@ -1573,8 +1587,8 @@
|
||||
|
||||
function appendCDACNO(data, select = null) {
|
||||
|
||||
console.log('appendCDACNO', data);
|
||||
console.log('appendCDACNO', select);
|
||||
//console.log('appendCDACNO', data);
|
||||
//console.log('appendCDACNO', select);
|
||||
|
||||
$('#cd_ac_no').empty();
|
||||
$('#cd_ac_no').append($('<option>', {
|
||||
@ -1589,7 +1603,7 @@
|
||||
});
|
||||
|
||||
if (select === item.cd_ac_no) {
|
||||
console.log('selected');
|
||||
//console.log('selected');
|
||||
option.attr('selected', true);
|
||||
}
|
||||
|
||||
|
||||
@ -869,7 +869,7 @@ $(document).ready(function() {
|
||||
$('#policy_id').change(function(){
|
||||
|
||||
var selectedpolicy = $(this).val();
|
||||
// console.log('selectedpolicy',selectedpolicy)
|
||||
console.log('selectedpolicy',selectedpolicy)
|
||||
$('#upload-action-type').val('').change();
|
||||
$('#file_upload').hide();
|
||||
$('#excel_download').removeAttr('href');
|
||||
@ -885,27 +885,31 @@ $(document).ready(function() {
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
// console.log('responce data emp_count', response);
|
||||
console.log('responce data emp_count', response);
|
||||
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
// console.log(response.emp_count.length)
|
||||
console.log(response.emp_count.length)
|
||||
if(response.emp_count > 0){
|
||||
|
||||
var select = document.getElementById("upload-action-type");
|
||||
for (var i = 0; i < select.options.length; i++) {
|
||||
select.options[i].disabled = false;
|
||||
if (select.options[i].value === "inception") {
|
||||
select.options[i].disabled = true;
|
||||
break;
|
||||
// break;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
}else {
|
||||
|
||||
var select = document.getElementById("upload-action-type");
|
||||
for (var i = 0; i < select.options.length; i++) {
|
||||
select.options[i].disabled = true;
|
||||
if (select.options[i].value === "inception") {
|
||||
select.options[i].disabled = false;
|
||||
break;
|
||||
}
|
||||
if (select.options[i].value === "") {
|
||||
select.options[i].disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -933,6 +937,16 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
if($('#policy_id').val() == 0){
|
||||
|
||||
var select = document.getElementById("upload-action-type");
|
||||
console.log('select', select)
|
||||
for (var i = 0; i < select.options.length; i++) {
|
||||
select.options[i].disabled = false;
|
||||
console.log(select.options[i])
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
@ -159,7 +159,7 @@
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
|
||||
console.log('responce', response)
|
||||
// console.log('responce', response)
|
||||
|
||||
if(response.status == false){
|
||||
$('#notification_count').html('0')
|
||||
|
||||
@ -543,16 +543,17 @@
|
||||
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
||||
<i class="fas fa-user-tie"></i>
|
||||
<span class="badge badge-success badge-pill float-right">2</span>
|
||||
<span> Employees </span>
|
||||
<span> Members </span>
|
||||
</a>
|
||||
<div class="collapse" id="sidebarDashboards">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/list') ?>">List</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/upload') ?>">Upload</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/list') ?>">List</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/endorsement-list') ?>">Endorsement List</a>
|
||||
</li>
|
||||
|
||||
@ -110,9 +110,12 @@
|
||||
<div class="col-md-6">
|
||||
<label for="sumInsured">Sum Insured</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-4">
|
||||
<input type="text" name="sum_insured" id="sum_insured" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this)">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGMCSIAddMore()">+</button>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
@ -120,6 +123,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="gmc_si_add_more"></div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Family Floater</label>
|
||||
@ -136,14 +141,14 @@
|
||||
<tr>
|
||||
<td style="width: 11%;"><span style="margin-right: 20px;">Self:</span></td>
|
||||
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked> </td>
|
||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo (isset($self_min_age) && $self_min_age > 0) ? $self_min_age : '18'; ?>" style="width: 25%;;" type="number" name="self_min_age" id="self_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 25%;;" type="number" name="self_max_age" id="self_max_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo (isset($self_min_age) && $self_min_age > 0) ? $self_min_age : '18'; ?>" style="width: 35%;;" type="number" name="self_min_age" id="self_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 35%;;" type="number" name="self_max_age" id="self_max_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||
<tr>
|
||||
<td style="width: 11%;"><span style="margin-right: 20px;">Spouse:</span></td>
|
||||
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;"name="family_floaters[]" value="spouse" id="spouse"></td>
|
||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($spouse_min_age) ? $spouse_min_age : '18'; ?>" style="width: 25%;;" type="number" name="spouse_min_age" id="spouse_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($spouse_max_age) ? $spouse_max_age : '60'; ?>" style="width: 25%;;" type="number" name="spouse_max_age" id="spouse_max_age" ></div></td>
|
||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($spouse_min_age) ? $spouse_min_age : '18'; ?>" style="width: 35%;;" type="number" name="spouse_min_age" id="spouse_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($spouse_max_age) ? $spouse_max_age : '60'; ?>" style="width: 35%;;" type="number" name="spouse_max_age" id="spouse_max_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||
<tr>
|
||||
<td style="width: 11%;"><span for="children">Children:</span></td>
|
||||
@ -155,8 +160,8 @@
|
||||
<option value="4">4</option>
|
||||
</select>
|
||||
</td>
|
||||
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($child_min_age) ? $child_min_age : '0'; ?>" style="width: 25%;;" type="number" name="child_min_age" id="child_min_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($child_max_age) ? $child_max_age : '25'; ?>" style="width: 25%;;" type="number" name="child_max_age" id="child_max_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($child_min_age) ? $child_min_age : '0'; ?>" style="width: 35%;;" type="number" name="child_min_age" id="child_min_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($child_max_age) ? $child_max_age : '25'; ?>" style="width: 35%;;" type="number" name="child_max_age" id="child_max_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -184,21 +189,19 @@
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 22%;" ><div class="other-member-age"><span style="margin-right: 20px;">Elders Count:</span><input class="underline-input" id="member_count" style="width: 25%;;" type="number" name="member_count" disabled id="member_count"></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($other_member_min_age) ? $other_member_min_age : '18'; ?>" style="width: 25%;;" type="number" class="underline-input min_age" name="other_member_min_age" id="other_member_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($other_member_max_age) ? $other_member_max_age : '60'; ?>" style="width: 25%;;" type="number" class="underline-input max_age" name="other_member_max_age" id="other_member_max_age" ></div></td>
|
||||
<td style="width: 22%;" ><div class="other-member-age"><span style="margin-right: 20px;">Elders Count:</span><input class="underline-input" id="member_count" style="width: 30%;;" type="number" name="member_count" disabled id="member_count"></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age" style="margin-left: 32px;"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($other_member_min_age) ? $other_member_min_age : '18'; ?>" style="width: 35%;;" type="number" class="underline-input min_age" name="other_member_min_age" id="other_member_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age" style="margin-left: 17px;"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($other_member_max_age) ? $other_member_max_age : '60'; ?>" style="width: 35%;;" type="number" class="underline-input max_age" name="other_member_max_age" id="other_member_max_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<!-- <div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Corporate Buffer</label>
|
||||
</div>
|
||||
@ -206,7 +209,7 @@
|
||||
<input type="radio" name="corporatebuffer" value="1"> Yes
|
||||
<input type="radio" name="corporatebuffer" value="0" style="margin-left:10px"> No
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
@ -305,6 +308,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Post Hospitalization Cover</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="posthospitalizationcover" id="posthospitalizationcover" class="form-control ">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Congenital Diseases - Internal</label>
|
||||
@ -315,6 +327,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Congenital Diseases - External</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="congenitaldiseasesexternal" id="congenitaldiseasesexternal" class="form-control ">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Co-Pay/Zone wise Co Pay</label>
|
||||
@ -323,6 +344,29 @@
|
||||
<select name="copayzonewisecopay" id="copayzonewisecopay" class="form-control ">
|
||||
<option value="">Select an option</option>
|
||||
<option value="Nil">Nil</option>
|
||||
<option value="5%">5%</option>
|
||||
<option value="10%">10%</option>
|
||||
<option value="15%">15%</option>
|
||||
<option value="20%">20%</option>
|
||||
<option value="25%">25%</option>
|
||||
<option value="30%">30%</option>
|
||||
<option value="35%">35%</option>
|
||||
<option value="40%">40%</option>
|
||||
<option value="45%">45%</option>
|
||||
<option value="50%">50%</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Optional Parental Co-Pay</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<select name="optionalparentalcopay" id="optionalparentalcopay" class="form-control ">
|
||||
<option value="">Select an option</option>
|
||||
<option value="Nil">Nil</option>
|
||||
<option value="5%">5%</option>
|
||||
<option value="10%">10%</option>
|
||||
<option value="15%">15%</option>
|
||||
<option value="20%">20%</option>
|
||||
@ -367,14 +411,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<!-- <div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Nursing Allowance</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="nursingallowance" id="nursingallowance" class="form-control ">
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
@ -386,6 +430,24 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Corporate Buffer</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="corporatebuffer" id="corporatebuffer" class="form-control ">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Sublimit of Corporate Buffer</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="sublimitofcorporatebuffer" id="sublimitofcorporatebuffer" class="form-control ">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Ambulance Charges</label>
|
||||
@ -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 = `
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="sumInsured">Additional Sum Insured</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input value="${data == null || data == undefined || data == "" ? '' : data}" type="text" name="multiple_sum_insured[]" class="form-control multiple_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<button type="button" class="btn btn-danger si-remove-multi" onclick="removeGMCAdditionalSI(this)">x</button>
|
||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGMCSIAddMore()">+</button> </div>
|
||||
<div class="col-md-6">
|
||||
<div class="text-danger-2 number-to-word-gmc"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
$('#gmc_si_add_more').append(html);
|
||||
}
|
||||
|
||||
function removeGMCAdditionalSI(button) {
|
||||
console.log('remove clicked');
|
||||
$(button).closest('.row').remove();
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -90,16 +90,21 @@
|
||||
<div class="col-md-6">
|
||||
<label for="sumInsured">Sum Insured</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-4">
|
||||
<input class="form-control" type="text" name="sumInsured2" id="sumInsured2" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" style="width: 100% !important;">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-2">
|
||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div id='numberToWordSumInsured' class="text-danger-2" ></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="gpa_si_add_more"></div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Total Sum Assured</label>
|
||||
@ -132,13 +137,13 @@
|
||||
<td style="width: 20%;">
|
||||
<div class="self-age">
|
||||
<span style="margin-right: 20px;">Min Age:</span>
|
||||
<input class="underline-input min_age" value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>" style="width: 44%;" type="number" name="self_min_age" id="self_min_age_gpa" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)">
|
||||
<input class="underline-input min_age" value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>" style="width: 65%;" type="number" name="self_min_age" id="self_min_age_gpa" oninput="lowerIsEighteen(this)">
|
||||
</div>
|
||||
</td>
|
||||
<td style="width: 20%;">
|
||||
<div class="self-age">
|
||||
<span style="margin-right: 20px;">Max Age:</span>
|
||||
<input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 44%;" type="number" name="self_max_age" id="self_max_age_gpa" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)">
|
||||
<input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 65%;" type="number" name="self_max_age" id="self_max_age_gpa" oninput="lowerIsEighteen(this)">
|
||||
</div>
|
||||
</td>
|
||||
<td ></td>
|
||||
@ -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 = `
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="sumInsured">Additional Sum Insured</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input value="${data == null || data == undefined || data == "" ? '' : data}" type="text" name="multiple_sum_insured[]" class="form-control multiple_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<button type="button" class="btn btn-danger si-remove-multi" onclick="removeGMCAdditionalSI(this)">x</button>
|
||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="text-danger-2 numberToWordSumInsured"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
// Add commas
|
||||
// value = Number(value).toLocaleString('en-IN');
|
||||
|
||||
// Update the input value
|
||||
// input.value = value;
|
||||
// }
|
||||
$('#gpa_si_add_more').append(html);
|
||||
}
|
||||
</script>
|
||||
@ -6,7 +6,7 @@
|
||||
<div class="modal-dialog modal-full-width">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myLargeModalLabel">Rack Rate <span id="nameOfThePolicy"></span></h4>
|
||||
<h4 class="modal-title" id="myLargeModalLabel">Rack Rate <span id="PolicyNameForTitle"></span></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@ -250,14 +250,14 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
|
||||
|
||||
var secondaryValue = $(event.target).data('secondary');
|
||||
console.log('secondaryValue', secondaryValue)
|
||||
console.log(rr_type);
|
||||
//console.log('secondaryValue', secondaryValue)
|
||||
//console.log(rr_type);
|
||||
|
||||
if (!secondaryValue) {
|
||||
secondaryValue = rr_type
|
||||
}
|
||||
|
||||
console.log('secondaryValue', secondaryValue)
|
||||
//console.log('secondaryValue', secondaryValue)
|
||||
|
||||
|
||||
var grid_container = document.getElementById('grid_content_input');
|
||||
@ -280,10 +280,10 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
var selectElement = event.target;
|
||||
var selectedOption = selectElement.options[selectElement.selectedIndex];
|
||||
dataIdValue = selectedOption.getAttribute('data-id');
|
||||
// console.log('dataIdValue', dataIdValue)
|
||||
// //console.log('dataIdValue', dataIdValue)
|
||||
}
|
||||
|
||||
console.log(grid_container)
|
||||
//console.log(grid_container)
|
||||
|
||||
if (dataIdValue == '1') {
|
||||
for (var i = 1; i <= 13; i++) {
|
||||
@ -368,40 +368,44 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
<div id="si_or_bp_basic_pay" class="form-row">
|
||||
|
||||
<div class="form-row" style="margin-left: 347px;/* margin-bottom: -106px; */margin-top: -97px;">
|
||||
|
||||
<div class="form-col col-md-6">
|
||||
<label for="mobile">Basic Pay<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.basic_pay : '') : ''}" type="text" class="form-control" placeholder="Enter Basic Pay" name="basic_pay" id="basic_pay" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='gpa_basic_pay_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
|
||||
<div class="form-col col-md-6">
|
||||
<label for="mobile">Basic Multiplier<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.basic_multiplier : '') : ''}" type="text" class="form-control" placeholder="Basic Multiplier" name="basic_multiplier" id="basic_multiplier" onchange='basicPayMultiple(this)' required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.basic_multiplier : '') : ''}" type="text" class="form-control" placeholder="Basic Multiplier" name="basic_multiplier" id="basic_multiplier" onchange='basicPayMultipleforfirstone(this)' required>
|
||||
</div>
|
||||
|
||||
<div class="form-col col-md-6">
|
||||
<label for="mobile">Premium Multiplier<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.multiplier : '') : ''}" type="text" class="form-control" placeholder="Premium Multiplier" name="premium_multiplier" id="premium_multiplier" onchange='basicPayMultipleforfirstone(this)'required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row" style="padding: 10px;">
|
||||
|
||||
<div class="form-col col-md-3">
|
||||
<label for="mobile">Basic Pay<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.basic_pay : '') : ''}" type="text" class="form-control basic_pay" placeholder="Enter Basic Pay" name="basic_pay[]" id="basic_pay" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this); basicPayMultipleforfirstone(this)" required>
|
||||
<div id='gpa_basic_pay_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4" id="" style="width:84%">
|
||||
<div class="form-group col-md-3" id="" style="width:84%">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.si : '') : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_basic_si" id="gpa_basic_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.si : '') : ''}" type="text" class="form-control gpa_basic_si" placeholder="Enter Sum Insured" name="gpa_basic_si[]" id="gpa_basic_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='basic_gpa_si_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
|
||||
<div class="form-col col-md-4">
|
||||
<label for="mobile">Premium Multiplier<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.multiplier : '') : ''}" type="text" class="form-control" placeholder="Premium Multiplier" name="premium_multiplier" id="premium_multiplier" onchange='basicPayMultiple(this)'required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.premium : '') : ''}" type="text" class="form-control basic_gpa_premium" placeholder="Enter Premium" name="gpa_basic_premium" id="gpa_basic_premium" onkeypress="return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.premium : '') : ''}" type="text" class="form-control basic_gpa_premium gpa_basic_premium" placeholder="Enter Premium" name="gpa_basic_premium[]" id="gpa_basic_premium" onkeypress="return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='basic_gpa_premium_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3" style="position: relative;right: 6px;">
|
||||
<button style="margin-top: 44px;position: relative;right: 0px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton()">x</button>
|
||||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more3" onclick="appendGridtHtml('1', ${secondaryValue})">+</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -805,7 +809,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
$('#gpa_sum_si').trigger('keyup');
|
||||
$('#gpa_sum_si2').trigger('keyup');
|
||||
// $('input[name="gpa_sum_si[]"]').each(function() {
|
||||
// console.log($(this));
|
||||
// //console.log($(this));
|
||||
// $(this).trigger('keyup');
|
||||
// });
|
||||
}
|
||||
@ -836,7 +840,7 @@ $("#GridForm").submit(function(event) {
|
||||
|
||||
var isValid = $('#GridForm').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
//console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -860,7 +864,7 @@ $("#GridForm").submit(function(event) {
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log("Response", res);
|
||||
//console.log("Response", res);
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error('Policy Dose Not Create', 'Error');
|
||||
@ -907,7 +911,7 @@ $("#AdditionalGridForm").submit(function(event) {
|
||||
|
||||
var isValid = $('#AdditionalGridForm').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
//console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -931,7 +935,7 @@ $("#AdditionalGridForm").submit(function(event) {
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log("Response", res);
|
||||
//console.log("Response", res);
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error('Policy Dose Not Create', 'Error');
|
||||
@ -964,16 +968,19 @@ $("#AdditionalGridForm").submit(function(event) {
|
||||
$('body').on('click', '.btnPolicyModel', function() {
|
||||
|
||||
// $('#grid').empty();
|
||||
|
||||
var client_policy_id = $(this).data('id');
|
||||
var policy_type_id = $(this).data('typeid');
|
||||
|
||||
$('#client_policy_id').val(client_policy_id);
|
||||
$('#client_policy_id_2').val(client_policy_id);
|
||||
// console.log('client_policy_id', client_policy_id)
|
||||
// //console.log('client_policy_id', client_policy_id)
|
||||
|
||||
var policy_type_string = $(this).attr('id');
|
||||
// console.log('policy_type_string', policy_type_string)
|
||||
// //console.log('policy_type_string', policy_type_string)
|
||||
|
||||
// if (policy_type_string == 'GPA' || policy_type_string == 'GMC') {
|
||||
if (policy_type_id) {
|
||||
|
||||
if (policy_type_string == 'GPA' || policy_type_string == 'GMC') {
|
||||
|
||||
$('#GridForm').show();
|
||||
$('#no_data').html('');
|
||||
@ -982,7 +989,7 @@ $('body').on('click', '.btnPolicyModel', function() {
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
|
||||
if (policy_type_string == 'GPA') {
|
||||
if (policy_type_string == 'GPA' || policy_type_id == 6 || policy_type_id == 7) {
|
||||
$('#rack_rate_one').hide()
|
||||
$('#rack_rate_two').hide()
|
||||
$('#AdditionalGridForm').hide()
|
||||
@ -1033,15 +1040,15 @@ $('body').on('click', '.btnPolicyModel', function() {
|
||||
}, 500);
|
||||
|
||||
|
||||
console.log('policy grid responce', res);
|
||||
//console.log('policy grid responce', res);
|
||||
var temp_for_premiumData = JSON.parse(res.premiumData);
|
||||
res.premiumData = JSON.parse(res.premiumData);
|
||||
|
||||
console.log('policy grid responce', res.premiumData);
|
||||
console.log('policy name', res.policy_name);
|
||||
//console.log('policy name', res.policy_name);
|
||||
|
||||
|
||||
$('#nameOfThePolicy').text(' - ' + res.policy_name);
|
||||
$('#PolicyNameForTitle').text(' - ' + res.policy_name);
|
||||
$('#grid_emp_count').val(res.count);
|
||||
|
||||
|
||||
@ -1070,7 +1077,7 @@ $('body').on('click', '.btnPolicyModel', function() {
|
||||
if (res.premiumData && res.premiumData.length > 0) {
|
||||
$.each(res.premiumData, function(index, item) {
|
||||
|
||||
if (item.rack_rate_type == 0 || policy_type_string == 'GPA') {
|
||||
if (item.rack_rate_type == 0 || policy_type_string == 'GPA' || policy_type_id == 6 || policy_type_id == 7) {
|
||||
policy_grid_id_value = item.policy_grid_id;
|
||||
first = item.policy_grid_id;
|
||||
premium_type_for_primary_rr.push(item.premium_type);
|
||||
@ -1086,7 +1093,7 @@ $('body').on('click', '.btnPolicyModel', function() {
|
||||
|
||||
}
|
||||
|
||||
console.log('premium_type_for_sec_rr', premium_type_for_sec_rr)
|
||||
//console.log('premium_type_for_sec_rr', premium_type_for_sec_rr)
|
||||
|
||||
if(premium_type_for_sec_rr.length > 0){
|
||||
$('#del_btn_col').show();
|
||||
@ -1122,8 +1129,8 @@ $('body').on('click', '.btnPolicyModel', function() {
|
||||
createCheckboxes(res.self, additional_relationship);
|
||||
|
||||
|
||||
console.log('policy_grid_id_value', policy_grid_id_value);
|
||||
console.log('secondary_policy_grid_id_value', secondary_policy_grid_id_value);
|
||||
//console.log('policy_grid_id_value', policy_grid_id_value);
|
||||
//console.log('secondary_policy_grid_id_value', secondary_policy_grid_id_value);
|
||||
|
||||
$('#grid_content_input').empty();
|
||||
var policeGridOptionHTML = '';
|
||||
@ -1182,8 +1189,9 @@ $('body').on('click', '.btnPolicyModel', function() {
|
||||
|
||||
res.premiumData.shift();
|
||||
$.each(res.premiumData, function(index, item) {
|
||||
|
||||
|
||||
if (item.si_or_bp == '1') {
|
||||
console.log('gpa basic pay items', item)
|
||||
appendGridtHtml('1', item.rack_rate_type, item);
|
||||
} else {
|
||||
appendGridtHtml(item.policy_grid_id, item.rack_rate_type, item);
|
||||
@ -1224,28 +1232,28 @@ $('body').on('click', '.btnPolicyModel', function() {
|
||||
}
|
||||
|
||||
|
||||
console.log('id_for_trigger', id_for_trigger)
|
||||
console.log('temp_for_premiumData', temp_for_premiumData)
|
||||
console.log('temp_for_premiumData', temp_for_premiumData[0])
|
||||
// //console.log('id_for_trigger', id_for_trigger)
|
||||
// //console.log('temp_for_premiumData', temp_for_premiumData)
|
||||
// //console.log('temp_for_premiumData', temp_for_premiumData[0])
|
||||
|
||||
|
||||
$(`input[name="${first}_si[]"]`).each(function() {
|
||||
// console.log($(this));
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
$(`input[name="${first}_premium[]"]`).each(function() {
|
||||
// console.log($(this));
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
$(`input[name="${secondary}_si[]"]`).each(function() {
|
||||
// console.log($(this));
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
$(`input[name="${secondary}_premium[]"]`).each(function() {
|
||||
// console.log($(this));
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
@ -1265,7 +1273,7 @@ $('body').on('click', '.btnPolicyModel', function() {
|
||||
} else {
|
||||
|
||||
$('#grid').empty();
|
||||
$('#nameOfThePolicy').html('');
|
||||
$('#PolicyNameForTitle').html('');
|
||||
$('#GridForm').hide();
|
||||
$('#no_data').html('The policy has no Policy Rack Rate');
|
||||
toastr.warning("The policy has no Policy Rack Rate", "Warning")
|
||||
@ -1295,7 +1303,7 @@ $('#grid').change(function() {
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('responce :', res);
|
||||
//console.log('responce :', res);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
@ -1303,24 +1311,24 @@ $('#grid').change(function() {
|
||||
}, 1000);
|
||||
|
||||
if (res.count > 0) {
|
||||
// console.log(' hide submit btn count ', res.count);
|
||||
// //console.log(' hide submit btn count ', res.count);
|
||||
$("#hide_smbt_btn").hide();
|
||||
} else {
|
||||
$("#hide_smbt_btn").show();
|
||||
// console.log('show submit btn count ', res.count);
|
||||
// //console.log('show submit btn count ', res.count);
|
||||
}
|
||||
|
||||
if (res.premiumData.length > 0 && res.premiumData[0].policy_grid_id === grid_id) {
|
||||
|
||||
$('#nameOfThePolicy').html(' - ' + res.policy_name);
|
||||
$('#PolicyNameForTitle').html(' - ' + res.policy_name);
|
||||
$('#grid_emp_count').val(res.count);
|
||||
|
||||
if (res.count > 0) {
|
||||
// console.log(' hide submit btn count ', res.count);
|
||||
// //console.log(' hide submit btn count ', res.count);
|
||||
$("#hide_smbt_btn").hide();
|
||||
} else {
|
||||
$("#hide_smbt_btn").show();
|
||||
// console.log('show submit btn count ', res.count);
|
||||
// //console.log('show submit btn count ', res.count);
|
||||
}
|
||||
|
||||
if (res.status === false) {
|
||||
@ -1363,7 +1371,7 @@ $('#grid').change(function() {
|
||||
});
|
||||
|
||||
} else {
|
||||
console.log("res.premiumData is undefined, null, or empty.");
|
||||
//console.log("res.premiumData is undefined, null, or empty.");
|
||||
}
|
||||
} else if (res.data[0].policy_type == "GPA") {
|
||||
$('#si_or_bp').val('2');
|
||||
@ -1406,7 +1414,7 @@ $('#additional_grid').change(function() {
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('responce :', res);
|
||||
//console.log('responce :', res);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
@ -1414,24 +1422,24 @@ $('#additional_grid').change(function() {
|
||||
}, 1000);
|
||||
|
||||
if (res.count > 0) {
|
||||
// console.log(' hide submit btn count ', res.count);
|
||||
// //console.log(' hide submit btn count ', res.count);
|
||||
$("#secondary_rack_rate_btn_grp").hide();
|
||||
} else {
|
||||
$("#secondary_rack_rate_btn_grp").show();
|
||||
// console.log('show submit btn count ', res.count);
|
||||
// //console.log('show submit btn count ', res.count);
|
||||
}
|
||||
|
||||
if (res.premiumData.length > 0 && res.premiumData[0].policy_grid_id === grid_id) {
|
||||
|
||||
$('#nameOfThePolicy').html(' - ' + res.policy_name);
|
||||
$('#PolicyNameForTitle').html(' - ' + res.policy_name);
|
||||
$('#grid_emp_count').val(res.count);
|
||||
|
||||
if (res.count > 0) {
|
||||
// console.log(' hide submit btn count ', res.count);
|
||||
// //console.log(' hide submit btn count ', res.count);
|
||||
$("#secondary_rack_rate_btn_grp").hide();
|
||||
} else {
|
||||
$("#secondary_rack_rate_btn_grp").show();
|
||||
// console.log('show submit btn count ', res.count);
|
||||
// //console.log('show submit btn count ', res.count);
|
||||
}
|
||||
|
||||
if (res.status === false) {
|
||||
@ -1477,7 +1485,7 @@ $('#additional_grid').change(function() {
|
||||
});
|
||||
|
||||
} else {
|
||||
console.log("res.premiumData is undefined, null, or empty.");
|
||||
//console.log("res.premiumData is undefined, null, or empty.");
|
||||
}
|
||||
} else if (res.data[0].policy_type == "GPA") {
|
||||
$('#si_or_bp').val('2');
|
||||
@ -1507,10 +1515,10 @@ function appendGridtHtml(ui_type = false, secondary = 0, data = false) {
|
||||
|
||||
// console.log('appendGridtHtml function called')
|
||||
// console.log(ui_type)
|
||||
// console.log(data)
|
||||
// //console.log(data)
|
||||
|
||||
var html = '';
|
||||
// console.log('Grid Content',data)
|
||||
// //console.log('Grid Content',data)
|
||||
Count++;
|
||||
var container = document.getElementById('grid_content_input');
|
||||
|
||||
@ -1526,7 +1534,7 @@ function appendGridtHtml(ui_type = false, secondary = 0, data = false) {
|
||||
|
||||
if ($("#si_or_bp").val() == 1 || data.si_or_bp == '1') {
|
||||
|
||||
// console.log('step 2')
|
||||
// //console.log('step 2')
|
||||
|
||||
html = `<div class="form-row gpa_sum_insure_remove" style="width:101%" id="removeChild_${Count}">
|
||||
<div class="form-group col-md-4" id="">
|
||||
@ -1548,7 +1556,7 @@ function appendGridtHtml(ui_type = false, secondary = 0, data = false) {
|
||||
|
||||
} else if ($("#si_or_bp").val() == 3 || data.si_or_bp == '3') {
|
||||
|
||||
// console.log('step 3')
|
||||
// //console.log('step 3')
|
||||
|
||||
html = `<div class="form-row gpa_band_remove" style="width:101%" id="removeChild_${Count}">
|
||||
|
||||
@ -1575,9 +1583,37 @@ function appendGridtHtml(ui_type = false, secondary = 0, data = false) {
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
}else if ($("#si_or_bp").val() == 2 || data.si_or_bp == '2') {
|
||||
|
||||
// console.log('step 3')
|
||||
|
||||
html = `
|
||||
<div class="form-row gpa_basic_pay_remove" style="width:101%" id="removeChild_${Count}">
|
||||
<div class="form-col col-md-3">
|
||||
<label for="mobile">Basic Pay<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.basic_pay : '') : ''}" type="text" class="form-control basic_pay" placeholder="Enter Basic Pay" name="basic_pay[]" id="basic_pay_${Count}" onkeypress="return onlyNumbers(event)" onchange="formatNumber(this); basicPayMultiple(this)" required>
|
||||
<div id='gpa_basic_pay_number_word' class="text-danger-2"></div>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.si : '') : ''}" type="text" class="form-control gpa_basic_si" placeholder="Enter Sum Insured" name="gpa_basic_si[]" id="gpa_basic_si_${Count}" onkeypress="return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='basic_gpa_si_number_word' class="text-danger-2"></div>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.premium : '') : ''}" type="text" class="form-control basic_gpa_premium gpa_basic_premium" placeholder="Enter Premium" name="gpa_basic_premium[]" id="gpa_basic_premium_${Count}" onkeypress="return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='basic_gpa_premium_number_word' class="text-danger-2"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml('1', ${secondary})">+</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
}
|
||||
|
||||
// console.log('step 4')
|
||||
console.log('step 4')
|
||||
|
||||
} else if (ui_type == '3') {
|
||||
|
||||
@ -1883,7 +1919,7 @@ function appendGridtHtml(ui_type = false, secondary = 0, data = false) {
|
||||
}
|
||||
|
||||
|
||||
// console.log('html', html)
|
||||
// //console.log('html', html)
|
||||
|
||||
container.insertAdjacentHTML('beforeend', html);
|
||||
|
||||
@ -1949,8 +1985,8 @@ function checkDuplicate(val) {
|
||||
container = $('#grid_content_input');
|
||||
}
|
||||
|
||||
console.log(id);
|
||||
console.log(container);
|
||||
//console.log(id);
|
||||
//console.log(container);
|
||||
|
||||
if (id.value === '3') {
|
||||
|
||||
@ -2255,9 +2291,9 @@ function checkDuplicate(val) {
|
||||
|
||||
for (var i = 0; i < siValues.length; i++) {
|
||||
for (var j = i + 1; j < siValues.length; j++) {
|
||||
// console.log(maxSiValues);
|
||||
// console.log("maxSiValues[i] ", maxSiValues[i] );
|
||||
// console.log("maxSiValues[j]", maxSiValues[j]);
|
||||
// //console.log(maxSiValues);
|
||||
// //console.log("maxSiValues[i] ", maxSiValues[i] );
|
||||
// //console.log("maxSiValues[j]", maxSiValues[j]);
|
||||
if (siValues[i] === siValues[j] && gradeValues[i] === gradeValues[j] && maxSiValues[i] === maxSiValues[
|
||||
j]) {
|
||||
duplicatesFound = true;
|
||||
@ -2301,10 +2337,10 @@ function checkDuplicate(val) {
|
||||
}
|
||||
}
|
||||
|
||||
// console.log('siValues', siValues);
|
||||
// console.log('premiumValues', premiumValues);
|
||||
// console.log('siDuplicates', siDuplicates);
|
||||
// console.log('premiumDuplicates', premiumDuplicates);
|
||||
// //console.log('siValues', siValues);
|
||||
// //console.log('premiumValues', premiumValues);
|
||||
// //console.log('siDuplicates', siDuplicates);
|
||||
// //console.log('premiumDuplicates', premiumDuplicates);
|
||||
|
||||
if (siDuplicates || premiumDuplicates) {
|
||||
toastr.warning('Duplicates found!', 'warning');
|
||||
@ -2355,12 +2391,12 @@ function checkDuplicate(val) {
|
||||
}
|
||||
}
|
||||
|
||||
// console.log('siValues', siValues);
|
||||
// console.log('premiumValues', premiumValues);
|
||||
// console.log('bandValues', bandValues);
|
||||
// console.log('siDuplicates', siDuplicates);
|
||||
// console.log('premiumDuplicates', premiumDuplicates);
|
||||
// console.log('bandDuplicates', bandDuplicates);
|
||||
// //console.log('siValues', siValues);
|
||||
// //console.log('premiumValues', premiumValues);
|
||||
// //console.log('bandValues', bandValues);
|
||||
// //console.log('siDuplicates', siDuplicates);
|
||||
// //console.log('premiumDuplicates', premiumDuplicates);
|
||||
// //console.log('bandDuplicates', bandDuplicates);
|
||||
|
||||
if (siDuplicates || bandDuplicates || premiumDuplicates) {
|
||||
toastr.warning('Duplicates found!', 'warning');
|
||||
@ -2375,42 +2411,72 @@ function checkDuplicate(val) {
|
||||
|
||||
function basicPayMultiple(input) {
|
||||
|
||||
if (input.id == 'basic_pay') {
|
||||
var multi = $('#basic_multiplier')[0].value.replace(/,/g, '') * input.value.replace(/,/g, '');
|
||||
var inputId = input.id;
|
||||
var inputValue = input.value.replace(/,/g, '');
|
||||
var count = inputId.split('_')[2]; // Extract the count from the id
|
||||
console.log('input', input);
|
||||
console.log('input id ', input.id);
|
||||
console.log('input class ', input.className);
|
||||
|
||||
if (input.className.includes('basic_pay')) {
|
||||
// Sum insured
|
||||
var basicMultiplier = $('#basic_multiplier').val().replace(/,/g, '');
|
||||
var multi = basicMultiplier * inputValue;
|
||||
console.log('multi', multi);
|
||||
$('#gpa_basic_si_' + count).val(multi).trigger('keyup');
|
||||
|
||||
$('#gpa_basic_si').val(multi).trigger('keyup');
|
||||
|
||||
var multi_2 = $('#gpa_basic_si')[0].value.replace(/,/g, '') * $('#premium_multiplier')[0].value.replace(/,/g,
|
||||
'');
|
||||
|
||||
$('#gpa_basic_premium').val(multi_2).trigger('keyup');
|
||||
|
||||
} else if (input.id == 'basic_multiplier') {
|
||||
|
||||
var multi = input.value * $('#basic_pay')[0].value.replace(/,/g, '');
|
||||
$('#gpa_basic_si').val(multi).trigger('keyup');
|
||||
|
||||
var multi_2 = $('#gpa_basic_si')[0].value.replace(/,/g, '') * $('#premium_multiplier')[0].value.replace(/,/g,
|
||||
'');
|
||||
$('#gpa_basic_premium').val(multi_2).trigger('keyup');
|
||||
|
||||
} else if (input.id == 'premium_multiplier') {
|
||||
|
||||
var multi = input.value.replace(/,/g, '') / 1000 * $('#gpa_basic_si')[0].value.replace(/,/g, '');
|
||||
$('#gpa_basic_premium').val(multi).trigger('keyup');
|
||||
|
||||
|
||||
} else if (input.id == 'gpa_basic_si') {
|
||||
|
||||
var multi = input.value.replace(/,/g, '') * $('#premium_multiplier')[0].value.replace(/,/g, '');
|
||||
|
||||
$('#gpa_basic_premium').val(multi).trigger('keyup');
|
||||
// Premium
|
||||
var gpaBasicSiValue = multi; // We just calculated this value
|
||||
var premiumMultiplier = $('#premium_multiplier').val().replace(/,/g, '');
|
||||
var multi_2 = gpaBasicSiValue * premiumMultiplier / 1000;
|
||||
console.log('multi_2', multi_2);
|
||||
$('#gpa_basic_premium_' + count).val(multi_2).trigger('keyup');
|
||||
} else if (input.className.includes('basic_multiplier')) {
|
||||
var multi = inputValue * $('#basic_pay_' + count).val().replace(/,/g, '');
|
||||
$('#gpa_basic_si_' + count).val(multi).trigger('keyup');
|
||||
var multi_2 = multi * $('#premium_multiplier').val().replace(/,/g, '') / 1000;
|
||||
$('#gpa_basic_premium_' + count).val(multi_2).trigger('keyup');
|
||||
} else if (input.className.includes('premium_multiplier')) {
|
||||
var multi = inputValue / 1000 * $('#gpa_basic_si_' + count).val().replace(/,/g, '');
|
||||
$('#gpa_basic_premium_' + count).val(multi).trigger('keyup');
|
||||
} else if (input.className.includes('gpa_basic_si')) {
|
||||
var multi = inputValue * $('#premium_multiplier').val().replace(/,/g, '');
|
||||
$('#gpa_basic_premium_' + count).val(multi).trigger('keyup');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function basicPayMultipleforfirstone(input){
|
||||
|
||||
console.log('input', input);
|
||||
console.log('input id ', input.id);
|
||||
console.log('input class ', input.className);
|
||||
|
||||
var basicMultiplier = $('#basic_multiplier').val().replace(/,/g, '');
|
||||
var inputValue = input.value.replace(/,/g, '');
|
||||
var multi = basicMultiplier * inputValue;
|
||||
|
||||
console.log('multi', multi);
|
||||
|
||||
// Find the input element with the class 'gpa_basic_si' within the same form-row and set its value
|
||||
$(input).closest('.form-group').find('.form-row input.gpa_basic_si').val(multi).trigger('keyup');
|
||||
|
||||
// Premium calculation
|
||||
var gpaBasicSiValue = $(input).closest('.form-group').find('.form-row input.gpa_basic_si').val().replace(/,/g, '');
|
||||
var premiumMultiplier = $('#premium_multiplier').val().replace(/,/g, '');
|
||||
var multi_2 = gpaBasicSiValue * premiumMultiplier / 1000;
|
||||
|
||||
console.log('multi_2', multi_2);
|
||||
|
||||
// Find the input element with the class 'gpa_basic_premium' within the same form-row and set its value
|
||||
$(input).closest('.form-group').find('.form-row input.gpa_basic_premium').val(multi_2).trigger('keyup');
|
||||
|
||||
}
|
||||
|
||||
|
||||
function gpaSumInsureMultiplier(element) {
|
||||
|
||||
// console.log(element);
|
||||
// //console.log(element);
|
||||
|
||||
var element = $('#gpa_sum_multiplier')[0];
|
||||
var sumInsured = $('input[name="gpa_sum_si[]"]');
|
||||
@ -2421,7 +2487,7 @@ function gpaSumInsureMultiplier(element) {
|
||||
var sumInsured = $('input[name="gpa_sum_si2[]"]')
|
||||
}
|
||||
|
||||
// console.log('sumInsured', sumInsured);
|
||||
// //console.log('sumInsured', sumInsured);
|
||||
|
||||
if ($('#si_or_bp').val() == 2) {
|
||||
var premium = $('input[name="premium[]"]');
|
||||
@ -2431,18 +2497,18 @@ function gpaSumInsureMultiplier(element) {
|
||||
var premium = $('input[name="gpa_sum_premium[]"]');
|
||||
}
|
||||
|
||||
// console.log(premium);
|
||||
// //console.log(premium);
|
||||
|
||||
sumInsured.each(function(index) {
|
||||
|
||||
var siValue = $(this).val().replace(/,/g, '');
|
||||
// console.log('siValue', siValue);
|
||||
// //console.log('siValue', siValue);
|
||||
|
||||
var premiumValue = (siValue / 1000) * element.value;
|
||||
// console.log('premiumValue', premiumValue);
|
||||
// //console.log('premiumValue', premiumValue);
|
||||
|
||||
var premiumValuedata = premium[index];
|
||||
// console.log('premiumValuedata', premiumValuedata);
|
||||
// //console.log('premiumValuedata', premiumValuedata);
|
||||
|
||||
|
||||
if (premiumValuedata) {
|
||||
@ -2465,6 +2531,7 @@ function si_orbp_change_function() {
|
||||
|
||||
$('.gpa_sum_insure_remove').hide();
|
||||
$('.gpa_band_remove').hide();
|
||||
$('.gpa_basic_pay_remove').show();
|
||||
|
||||
$('#si_or_bp_full_div').css({
|
||||
'display': '',
|
||||
@ -2508,6 +2575,7 @@ function si_orbp_change_function() {
|
||||
|
||||
$('.gpa_sum_insure_remove').show();
|
||||
$('.gpa_band_remove').hide();
|
||||
$('.gpa_basic_pay_remove').hide();
|
||||
|
||||
var count = $("div.form-row.gpa_sum_insure_remove").length;
|
||||
|
||||
@ -2517,14 +2585,14 @@ function si_orbp_change_function() {
|
||||
$('#gmc_add_more').hide();
|
||||
}
|
||||
|
||||
// console.log('gmcBandInput', count)
|
||||
// //console.log('gmcBandInput', count)
|
||||
|
||||
|
||||
var gpaBandRemoveElements = $("#grid_1").nextAll("div").find(".gpa_band_remove").length;
|
||||
console.log("Elements with class 'gpa_band_remove' within next div siblings:", gpaBandRemoveElements);
|
||||
//console.log("Elements with class 'gpa_band_remove' within next div siblings:", gpaBandRemoveElements);
|
||||
|
||||
var gmcBandInput = $("#grid_1").find('input[name="gmc_band[]"]').length
|
||||
console.log('gmcBandInput', gmcBandInput)
|
||||
//console.log('gmcBandInput', gmcBandInput)
|
||||
|
||||
|
||||
$('#si_or_bp_full_div').css({
|
||||
@ -2567,6 +2635,7 @@ function si_orbp_change_function() {
|
||||
|
||||
$('.gpa_sum_insure_remove').hide();
|
||||
$('.gpa_band_remove').show();
|
||||
$('.gpa_basic_pay_remove').hide();
|
||||
|
||||
var count = $("div.form-row.gpa_band_remove").length;
|
||||
|
||||
@ -2576,7 +2645,7 @@ function si_orbp_change_function() {
|
||||
$('#gmc_add_more2').hide();
|
||||
}
|
||||
|
||||
// console.log('gmcBandInput', count)
|
||||
// //console.log('gmcBandInput', count)
|
||||
|
||||
$('#si_or_bp_full_div').css({
|
||||
'display': '',
|
||||
@ -2645,12 +2714,12 @@ function getCurrentTime() {
|
||||
|
||||
|
||||
function createCheckboxes(obj, additional_relationship) {
|
||||
console.log('createCheckboxes function called');
|
||||
//console.log('createCheckboxes function called');
|
||||
|
||||
console.log(additional_relationship);
|
||||
//console.log(additional_relationship);
|
||||
try {
|
||||
additional_relationship = JSON.parse(additional_relationship);
|
||||
console.log(additional_relationship);
|
||||
//console.log(additional_relationship);
|
||||
} catch (error) {
|
||||
console.error("Error parsing additional_relationship:", error);
|
||||
return;
|
||||
@ -2666,13 +2735,13 @@ function createCheckboxes(obj, additional_relationship) {
|
||||
$.each(obj, function(key, value) {
|
||||
if (value > 0 && key != 'either-parents-pil') {
|
||||
const isChecked = additional_relationship && typeof additional_relationship === 'object' && additional_relationship[key] == 1 ? 'checked' : '';
|
||||
console.log('isChecked', isChecked);
|
||||
//console.log('isChecked', isChecked);
|
||||
html += `
|
||||
<div class="col-2">
|
||||
<input class="relation_checkbox" type="checkbox" name="${key}" ${isChecked}>
|
||||
<label style="position: relative;left: 18px;bottom: 30px;">${formatString(key)}</label>
|
||||
</div>`;
|
||||
// console.log(html);
|
||||
// //console.log(html);
|
||||
}
|
||||
});
|
||||
|
||||
@ -2686,7 +2755,7 @@ function formatString(str) {
|
||||
|
||||
|
||||
$('#del_btn').click(function() {
|
||||
console.log('delete btn clicked');
|
||||
//console.log('delete btn clicked');
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
@ -2696,19 +2765,19 @@ $('#del_btn').click(function() {
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
console.log('after then entered');
|
||||
//console.log('after then entered');
|
||||
|
||||
if (result.isConfirmed) {
|
||||
console.log('isConfirmed entered');
|
||||
//console.log('isConfirmed entered');
|
||||
|
||||
var client_policy_id = $('#client_policy_id_2').val();
|
||||
console.log('client_policy_id', client_policy_id)
|
||||
//console.log('client_policy_id', client_policy_id)
|
||||
|
||||
var rack_rate_type = $('#rack_rate_type_2').val();
|
||||
console.log('rack_rate_type', rack_rate_type)
|
||||
//console.log('rack_rate_type', rack_rate_type)
|
||||
|
||||
var client_id = $('#Client_id_2').val();
|
||||
console.log('client_id', client_id)
|
||||
//console.log('client_id', client_id)
|
||||
|
||||
|
||||
$('.loader').fadeIn();
|
||||
@ -2719,8 +2788,8 @@ $('#del_btn').click(function() {
|
||||
type: 'GET',
|
||||
success: function(res) {
|
||||
|
||||
console.log('ajax success entered');
|
||||
console.log(res);
|
||||
//console.log('ajax success entered');
|
||||
//console.log(res);
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
@ -2742,7 +2811,7 @@ $('#del_btn').click(function() {
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log('ajax error entered');
|
||||
//console.log('ajax error entered');
|
||||
console.error(xhr.responseText);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
@ -2752,10 +2821,10 @@ $('#del_btn').click(function() {
|
||||
// Removed the duplicated loader hiding code here
|
||||
}
|
||||
|
||||
console.log('after then entered end or cancel');
|
||||
//console.log('after then entered end or cancel');
|
||||
});
|
||||
|
||||
console.log('delete btn clicked end');
|
||||
//console.log('delete btn clicked end');
|
||||
});
|
||||
|
||||
|
||||
@ -2765,8 +2834,8 @@ function checkCheckboxes() {
|
||||
var checkedCount = checkboxes.filter(':checked').length;
|
||||
var uncheckedCount = checkboxes.not(':checked').length;
|
||||
|
||||
console.log('Checked count:', checkedCount); // Debugging
|
||||
console.log('unchecked Count', uncheckedCount);
|
||||
//console.log('Checked count:', checkedCount); // Debugging
|
||||
//console.log('unchecked Count', uncheckedCount);
|
||||
|
||||
if (checkedCount < 1) {
|
||||
toastr.warning('You must select at least one checkbox.', 'Warning');
|
||||
|
||||
@ -30,383 +30,535 @@ th {
|
||||
|
||||
|
||||
<script>
|
||||
const formatType = 0; // Specify the format type here
|
||||
const excel_headers = {
|
||||
const formatType = 0; // Specify the format type here
|
||||
const excel_headers = {
|
||||
|
||||
1: {
|
||||
|
||||
1: {
|
||||
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
2: {
|
||||
"basic_pay": "Basic Pay",
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
3: {
|
||||
"band_or_grade": "Band or Grade",
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
4: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
5: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
6: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
7: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
8: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"grade": "Grade",
|
||||
"premium": "Premium"
|
||||
},
|
||||
9: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
10: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
11: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"grade": "Grade",
|
||||
"premium": "Premium",
|
||||
"max_si": "Max Si"
|
||||
},
|
||||
12: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"relationship": "Relationship",
|
||||
"premium": "Premium"
|
||||
},
|
||||
13: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"relationship": "Relationship",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function slugify(text) {
|
||||
return text.toString().toLowerCase().replace(/\s+/g, '_').replace(/[^\w\-]+/g, '').replace(/\-\-+/g, '_')
|
||||
.replace(/^-+/, '').replace(/-+$/, '');
|
||||
},
|
||||
2: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
3: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
4: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
5: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
6: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
7: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
8: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"grade": "Grade",
|
||||
"premium": "Premium"
|
||||
},
|
||||
9: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
10: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
11: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"grade": "Grade",
|
||||
"premium": "Premium",
|
||||
"max_si": "Max Si"
|
||||
},
|
||||
12: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"relationship": "Relationship",
|
||||
"premium": "Premium"
|
||||
},
|
||||
13: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"relationship": "Relationship",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
}
|
||||
|
||||
function copyHeaders(rack_rate_type) {
|
||||
};
|
||||
|
||||
let formatType = $('#grid').val();
|
||||
var obj = $('#grid');
|
||||
if(rack_rate_type == 1){
|
||||
formatType = $('#additional_grid').val();
|
||||
obj = $('#additional_grid');
|
||||
}
|
||||
function slugify(text) {
|
||||
return text.toString().toLowerCase().replace(/\s+/g, '_').replace(/[^\w\-]+/g, '').replace(/\-\-+/g, '_')
|
||||
.replace(/^-+/, '').replace(/-+$/, '');
|
||||
}
|
||||
|
||||
console.log(obj)
|
||||
console.log(formatType)
|
||||
function copyHeaders(rack_rate_type) {
|
||||
|
||||
if(!formatType && formatType == ""){
|
||||
toastr.warning('Please select the Policy Premium Type', 'Warning');
|
||||
return;
|
||||
}
|
||||
const headerString = Object.values(excel_headers[formatType]).join("\t"); // Using specified format type for copying headers
|
||||
navigator.clipboard.writeText(headerString).then(function() {
|
||||
toastr.success('Headers copied to clipboard', 'success');
|
||||
}, function(err) {
|
||||
toastr.error(err, 'Could not copy headers:');
|
||||
});
|
||||
let formatType = $('#grid').val();
|
||||
var secondKey = $('#si_or_bp').val();
|
||||
var obj = $('#grid');
|
||||
|
||||
if (rack_rate_type == 1) {
|
||||
formatType = $('#additional_grid').val();
|
||||
obj = $('#additional_grid');
|
||||
}
|
||||
|
||||
function generateTable(rack_rate_type) {
|
||||
|
||||
var data = $('#copied_excel_data').val();
|
||||
let formatType = $('#grid').val();
|
||||
var obj = $('#grid');
|
||||
|
||||
if (rack_rate_type == 1) {
|
||||
data = $('#additional_copied_excel_data').val();
|
||||
formatType = $('#additional_grid').val();
|
||||
obj = $('#additional_grid');
|
||||
}
|
||||
|
||||
console.log(obj);
|
||||
console.log(formatType);
|
||||
console.log(data);
|
||||
|
||||
if (!formatType || formatType == "") {
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
toastr.warning('Please select the Policy Premium Type', 'Warning');
|
||||
if (formatType == 1) {
|
||||
if (secondKey == "") {
|
||||
toastr.warning('Please select the Basic Pay, Sum Insured or Band/Grade', 'Warning');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if Excel data is empty
|
||||
if (!data.trim()) {
|
||||
toastr.warning('Excel data is empty.', 'Warning');
|
||||
return;
|
||||
// //console.log(obj)
|
||||
// //console.log(formatType)
|
||||
// //console.log(rack_rate_type)
|
||||
|
||||
if (!formatType && formatType == "") {
|
||||
toastr.warning('Please select the Policy Premium Type', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
// //console.log('after toastr')
|
||||
// //console.log('excel_headers[formatType]', excel_headers[formatType])
|
||||
// //console.log('excel_headers[formatType]', typeof excel_headers[formatType])
|
||||
|
||||
if (excel_headers[formatType] == undefined) {
|
||||
toastr.error('Headers not found', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
var headerString = Object.values(excel_headers[formatType]).join(
|
||||
"\t"); // Using specified format type for copying headers
|
||||
if (formatType == 1) {
|
||||
var headerString = Object.values(excel_headers[formatType][secondKey]).join(
|
||||
"\t"); // Using specified format type for copying headers
|
||||
}
|
||||
//console.log('headerString', headerString);
|
||||
navigator.clipboard.writeText(headerString).then(function() {
|
||||
toastr.success('Headers copied to clipboard', 'success');
|
||||
}, function(err) {
|
||||
toastr.error(err, 'Could not copy headers:');
|
||||
});
|
||||
}
|
||||
|
||||
function generateTable(rack_rate_type) {
|
||||
|
||||
var data = $('#copied_excel_data').val();
|
||||
let formatType = $('#grid').val();
|
||||
var obj = $('#grid');
|
||||
var secondKey = $('#si_or_bp').val();
|
||||
|
||||
|
||||
if (rack_rate_type == 1) {
|
||||
data = $('#additional_copied_excel_data').val();
|
||||
formatType = $('#additional_grid').val();
|
||||
obj = $('#additional_grid');
|
||||
}
|
||||
|
||||
//console.log(obj);
|
||||
//console.log(formatType);
|
||||
//console.log(data);
|
||||
console.log(secondKey);
|
||||
|
||||
if (!formatType || formatType == "") {
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
toastr.warning('Please select the Policy Premium Type', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if Excel data is empty
|
||||
if (!data.trim()) {
|
||||
toastr.warning('Excel data is empty.', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
var rows = data.split("\n");
|
||||
|
||||
//console.log('rows', rows)
|
||||
|
||||
// Filter out empty rows
|
||||
rows = rows.filter(rowText => rowText.split("\t").some(cell => cell.trim()));
|
||||
|
||||
//console.log('rows', rows)
|
||||
|
||||
if (rows.length === 0) {
|
||||
toastr.warning('All rows are empty after filtering.', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
var header = rows[0].split("\t");
|
||||
|
||||
console
|
||||
|
||||
// Determine the columns to keep (non-empty columns)
|
||||
var columnsToKeep = [];
|
||||
for (let i = 0; i < header.length; i++) {
|
||||
if (rows.some(rowText => rowText.split("\t")[i].trim())) {
|
||||
columnsToKeep.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
var rows = data.split("\n");
|
||||
// Filter header based on columns to keep
|
||||
header = columnsToKeep.map(i => slugify(header[i]));
|
||||
|
||||
// Filter out empty rows
|
||||
rows = rows.filter(rowText => rowText.split("\t").some(cell => cell.trim()));
|
||||
if (!excel_headers[formatType]) {
|
||||
toastr.warning("Unknown format type. Please check the header columns.", 'Warning');
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
return;
|
||||
}
|
||||
|
||||
if (rows.length === 0) {
|
||||
toastr.warning('All rows are empty after filtering.', 'Warning');
|
||||
return;
|
||||
}
|
||||
var expectedHeader = Object.keys(excel_headers[formatType]);
|
||||
//console.log('expectedHeader 1st', expectedHeader);
|
||||
|
||||
var header = rows[0].split("\t");
|
||||
|
||||
// Determine the columns to keep (non-empty columns)
|
||||
var columnsToKeep = [];
|
||||
for (let i = 0; i < header.length; i++) {
|
||||
if (rows.some(rowText => rowText.split("\t")[i].trim())) {
|
||||
columnsToKeep.push(i);
|
||||
}
|
||||
}
|
||||
if (formatType == 1) {
|
||||
|
||||
// Filter header based on columns to keep
|
||||
header = columnsToKeep.map(i => slugify(header[i]));
|
||||
//console.log('si_or_bp secondKey', secondKey)
|
||||
expectedHeader = Object.keys(excel_headers[formatType][secondKey]);
|
||||
}
|
||||
|
||||
if (!excel_headers[formatType]) {
|
||||
toastr.warning("Unknown format type. Please check the header columns.", 'Warning');
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
return;
|
||||
}
|
||||
//console.log('expectedHeader', expectedHeader);
|
||||
//console.log('HEADERS' , JSON.stringify(header))
|
||||
//console.log('Excepted HEADERS' , JSON.stringify(expectedHeader))
|
||||
|
||||
var expectedHeader = Object.keys(excel_headers[formatType]);
|
||||
|
||||
if (JSON.stringify(header) !== JSON.stringify(expectedHeader)) {
|
||||
const expectedHeaders = JSON.stringify(Object.values(excel_headers[formatType]));
|
||||
const receivedHeaders = JSON.stringify(columnsToKeep.map(i => rows[0].split("\t")[i]));
|
||||
if (secondKey != 2) {
|
||||
|
||||
Swal.fire({
|
||||
title: "Header Mismatch",
|
||||
html: `
|
||||
if (JSON.stringify(header) !== JSON.stringify(expectedHeader)) {
|
||||
const expectedHeaders = JSON.stringify(Object.values(excel_headers[formatType][secondKey]));
|
||||
const receivedHeaders = JSON.stringify(columnsToKeep.map(i => rows[0].split("\t")[i]));
|
||||
|
||||
Swal.fire({
|
||||
title: "Header Mismatch",
|
||||
html: `
|
||||
<p>Header columns do not match expected format:</p>
|
||||
<p><strong>Expected:</strong> ${expectedHeaders}</p>
|
||||
<p><strong>Received:</strong> ${receivedHeaders}</p>
|
||||
`,
|
||||
icon: "error"
|
||||
});
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
icon: "error"
|
||||
});
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var table = $('<table class="table table-striped compact-table" />');
|
||||
var uniqueRows = new Set();
|
||||
var emptyCellCount = 0;
|
||||
|
||||
rows.forEach((rowText, y) => {
|
||||
var cells = rowText.split("\t").filter((_, i) => columnsToKeep.includes(i));
|
||||
var row = $('<tr />');
|
||||
|
||||
// Skip empty rows after filtering columns
|
||||
if (cells.every(cell => !cell.trim())) {
|
||||
return;
|
||||
}
|
||||
|
||||
var table = $('<table class="table table-striped compact-table" />');
|
||||
var uniqueRows = new Set();
|
||||
var emptyCellCount = 0;
|
||||
|
||||
rows.forEach((rowText, y) => {
|
||||
var cells = rowText.split("\t").filter((_, i) => columnsToKeep.includes(i));
|
||||
var row = $('<tr />');
|
||||
|
||||
// Skip empty rows after filtering columns
|
||||
if (cells.every(cell => !cell.trim())) {
|
||||
return;
|
||||
cells.forEach(cellText => {
|
||||
row.append('<td>' + cellText + '</td>');
|
||||
if (!cellText.trim()) {
|
||||
emptyCellCount++;
|
||||
}
|
||||
});
|
||||
|
||||
cells.forEach(cellText => {
|
||||
row.append('<td>' + cellText + '</td>');
|
||||
if (!cellText.trim()) {
|
||||
emptyCellCount++;
|
||||
}
|
||||
});
|
||||
var si_or_bp = $('#si_or_bp').val();
|
||||
var key;
|
||||
switch (formatType) {
|
||||
|
||||
var key;
|
||||
switch (formatType) {
|
||||
case 3:
|
||||
case 1:
|
||||
if (si_or_bp == 1) {
|
||||
key = cells[0] + "|" + cells[1] // Sum Insured, Premium
|
||||
break;
|
||||
case 4:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 5:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 6:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 7:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 8:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Grade, Premium
|
||||
break;
|
||||
case 9:
|
||||
key = cells[0] + "|" + cells[1]; // Sum Insured, Premium
|
||||
break;
|
||||
case 10:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 11:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, Grade, Premium, Max SI
|
||||
break;
|
||||
case 12:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Relationship, Premium
|
||||
break;
|
||||
case 13:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3] + "|" + cells[4]; // Sum Insured, Relationship, From Age, To Age, Premium
|
||||
break;
|
||||
default:
|
||||
key = cells.join("|");
|
||||
} else if (si_or_bp == 2) {
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] //Basic Pay, Sum Insured, Premium
|
||||
} else if (si_or_bp == 3) {
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] //Band or Grade, Sum Insured, Premium
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
key = cells[0] + "|" + cells[1] // Sum Insured, Premium
|
||||
break;
|
||||
case 3:
|
||||
key = cells[0] + "|" + cells[1] // Sum Insured, Premium
|
||||
break;
|
||||
case 4:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
||||
3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 5:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
||||
3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 6:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
||||
3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 7:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
||||
3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 8:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Grade, Premium
|
||||
break;
|
||||
case 9:
|
||||
key = cells[0] + "|" + cells[1]; // Sum Insured, Premium
|
||||
break;
|
||||
case 10:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
||||
3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 11:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
||||
3]; // Sum Insured, Grade, Premium, Max SI
|
||||
break;
|
||||
case 12:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Relationship, Premium
|
||||
break;
|
||||
case 13:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3] + "|" + cells[
|
||||
4]; // Sum Insured, Relationship, From Age, To Age, Premium
|
||||
break;
|
||||
default:
|
||||
key = cells.join("|");
|
||||
|
||||
}
|
||||
|
||||
if (y > 0 && uniqueRows.has(key)) {
|
||||
row.addClass('duplicate');
|
||||
} else {
|
||||
uniqueRows.add(key);
|
||||
}
|
||||
table.append(row);
|
||||
});
|
||||
|
||||
if (rack_rate_type == 1) {
|
||||
$('#additional_excel_table').empty();
|
||||
$('#additional_excel_table').html(table);
|
||||
} else if (rack_rate_type == 0) {
|
||||
$('#excel_table').empty();
|
||||
$('#excel_table').html(table);
|
||||
}
|
||||
|
||||
if ($('.duplicate').length > 0) {
|
||||
console.log('test');
|
||||
toastr.warning("Duplicates found!", "warning");
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
if (y > 0 && uniqueRows.has(key)) {
|
||||
row.addClass('duplicate');
|
||||
} else {
|
||||
uniqueRows.add(key);
|
||||
}
|
||||
table.append(row);
|
||||
});
|
||||
|
||||
if (emptyCellCount > 0) {
|
||||
toastr.warning('Number of empty cells: ' + emptyCellCount);
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
}
|
||||
submitData(rack_rate_type);
|
||||
if (rack_rate_type == 1) {
|
||||
$('#additional_excel_table').empty();
|
||||
$('#additional_excel_table').html(table);
|
||||
} else if (rack_rate_type == 0) {
|
||||
$('#excel_table').empty();
|
||||
$('#excel_table').html(table);
|
||||
}
|
||||
|
||||
if ($('.duplicate').length > 0) {
|
||||
//console.log('test');
|
||||
toastr.warning("Duplicates found!", "warning");
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
}
|
||||
|
||||
if (emptyCellCount > 0) {
|
||||
toastr.warning('Number of empty cells: ' + emptyCellCount);
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
}
|
||||
submitData(rack_rate_type);
|
||||
}
|
||||
|
||||
function submitData(rack_rate_type) {
|
||||
|
||||
let formatType = $('#grid').val();
|
||||
var table = $('#excel_table table');
|
||||
var obj = $('#grid');
|
||||
|
||||
var si_or_bp = $('#si_or_bp').val();
|
||||
var basic_multiplier = $('#basic_multiplier').val();
|
||||
var premium_multiplier = $('#premium_multiplier').val();
|
||||
|
||||
var gpa_sum_multiplier2 = $('#gpa_sum_multiplier2').val();
|
||||
var gpa_sum_multiplier = $('#gpa_sum_multiplier').val();
|
||||
|
||||
|
||||
|
||||
if (rack_rate_type == 1) {
|
||||
|
||||
formatType = $('#additional_grid').val();
|
||||
table = $('#additional_excel_table table');
|
||||
obj = $('#additional_grid');
|
||||
}
|
||||
|
||||
|
||||
function submitData(rack_rate_type) {
|
||||
var headers = $(table).find('tr').first().find('td').map(function() {
|
||||
return slugify($(this).text());
|
||||
}).get();
|
||||
|
||||
let formatType = $('#grid').val();
|
||||
var table = $('#excel_table table');
|
||||
var obj = $('#grid');
|
||||
var rows = $(table).find('tr:gt(0)').map(function() {
|
||||
return $(this).find('td').map(function() {
|
||||
return $(this).text();
|
||||
}).get();
|
||||
}).get();
|
||||
|
||||
if(rack_rate_type == 1){
|
||||
var jsonData = [];
|
||||
|
||||
formatType = $('#additional_grid').val();
|
||||
table = $('#additional_excel_table table');
|
||||
obj = $('#additional_grid');
|
||||
$(table).find('tr:gt(0)').each(function(idx) {
|
||||
var row = $(this).find('td').map(function() {
|
||||
return $(this).text();
|
||||
}).get();
|
||||
var rowData = {};
|
||||
row.forEach((cell, colIdx) => {
|
||||
rowData[headers[colIdx]] = cell;
|
||||
});
|
||||
jsonData.push(rowData);
|
||||
});
|
||||
|
||||
//console.log(jsonData);
|
||||
|
||||
jsonData.forEach(obj => {
|
||||
|
||||
// console.log('obj', obj)
|
||||
// console.log('length of the obj', obj.length)
|
||||
|
||||
|
||||
if ('sum_insured' in obj) {
|
||||
obj.si = obj.sum_insured;
|
||||
delete obj.sum_insured;
|
||||
}
|
||||
|
||||
|
||||
var headers = $(table).find('tr').first().find('td').map(function() {
|
||||
return slugify($(this).text());
|
||||
}).get();
|
||||
|
||||
var rows = $(table).find('tr:gt(0)').map(function() {
|
||||
return $(this).find('td').map(function() {
|
||||
return $(this).text();
|
||||
}).get();
|
||||
}).get();
|
||||
|
||||
var jsonData = [];
|
||||
|
||||
$(table).find('tr:gt(0)').each(function(idx) {
|
||||
var row = $(this).find('td').map(function() {
|
||||
return $(this).text();
|
||||
}).get();
|
||||
var rowData = {};
|
||||
row.forEach((cell, colIdx) => {
|
||||
rowData[headers[colIdx]] = cell;
|
||||
});
|
||||
jsonData.push(rowData);
|
||||
});
|
||||
|
||||
console.log(jsonData);
|
||||
|
||||
jsonData.forEach(obj => {
|
||||
|
||||
if ('sum_insured' in obj) {
|
||||
obj.si = obj.sum_insured;
|
||||
delete obj.sum_insured;
|
||||
}
|
||||
|
||||
if ('from_age' in obj) {
|
||||
obj.age_from = obj.from_age;
|
||||
delete obj.from_age;
|
||||
}
|
||||
|
||||
if ('to_age' in obj) {
|
||||
obj.age_to = obj.to_age;
|
||||
delete obj.to_age;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(jsonData);
|
||||
|
||||
|
||||
if(rack_rate_type == 1){
|
||||
|
||||
$('#additional_grid_content_input').empty()
|
||||
|
||||
if ($('#copyfromexcelforadditional').text() == "Manual entry") {
|
||||
$('#copyfromexcelforadditional').text("Copy from excel")
|
||||
} else {
|
||||
$('#copyfromexcelforadditional').text("Copy from excel");
|
||||
}
|
||||
|
||||
$('#additional_grid_content_input').toggle();
|
||||
$('#additional_grid_content_from_excel').toggle();
|
||||
|
||||
}else{
|
||||
|
||||
$('#grid_content_input').empty()
|
||||
|
||||
if ($('#copyfromexcel').text() == "Manual entry") {
|
||||
$('#copyfromexcel').text("Copy from excel")
|
||||
} else {
|
||||
$('#copyfromexcel').text("Copy from excel");
|
||||
}
|
||||
|
||||
$('#grid_content_input').toggle();
|
||||
$('#grid_content_from_excel').toggle();
|
||||
|
||||
|
||||
if ('from_age' in obj) {
|
||||
obj.age_from = obj.from_age;
|
||||
delete obj.from_age;
|
||||
}
|
||||
|
||||
$.each(jsonData, function(index, item) {
|
||||
appendGridtHtml(formatType, rack_rate_type, item)
|
||||
});
|
||||
if ('to_age' in obj) {
|
||||
obj.age_to = obj.to_age;
|
||||
delete obj.to_age;
|
||||
}
|
||||
|
||||
if ('band_or_grade' in obj) {
|
||||
obj.grade = obj.band_or_grade;
|
||||
delete obj.band_or_grade;
|
||||
}
|
||||
|
||||
$('input[name="11_max_si[]"]').each(function() {
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
if (formatType == 1) {
|
||||
|
||||
if (si_or_bp == 1) {
|
||||
|
||||
$(`input[name="${formatType}_si[]"]`).each(function() {
|
||||
// console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
obj.si_or_bp = si_or_bp;
|
||||
obj.multiplier = gpa_sum_multiplier ? gpa_sum_multiplier : 0;
|
||||
|
||||
$(`input[name="${formatType}_premium[]"]`).each(function() {
|
||||
// console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
} else if (si_or_bp == 2) {
|
||||
|
||||
obj.si_or_bp = si_or_bp;
|
||||
obj.basic_multiplier = basic_multiplier ? basic_multiplier : 0;
|
||||
obj.multiplier = premium_multiplier ? premium_multiplier : 0;
|
||||
obj.si = obj.basic_pay * obj.basic_multiplier
|
||||
obj.premium = obj.si * obj.multiplier / 1000
|
||||
|
||||
} else if (si_or_bp == 3) {
|
||||
|
||||
obj.si_or_bp = si_or_bp;
|
||||
obj.multiplier = gpa_sum_multiplier2 ? gpa_sum_multiplier2 : 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
console.log(jsonData);
|
||||
|
||||
if (rack_rate_type == 1) {
|
||||
|
||||
$('#additional_grid_content_input').empty()
|
||||
|
||||
if ($('#copyfromexcelforadditional').text() == "Manual entry") {
|
||||
$('#copyfromexcelforadditional').text("Copy from excel")
|
||||
} else {
|
||||
$('#copyfromexcelforadditional').text("Copy from excel");
|
||||
}
|
||||
|
||||
$('#additional_grid_content_input').toggle();
|
||||
$('#additional_grid_content_from_excel').toggle();
|
||||
|
||||
} else {
|
||||
|
||||
$('#grid_content_input').empty()
|
||||
|
||||
if ($('#copyfromexcel').text() == "Manual entry") {
|
||||
$('#copyfromexcel').text("Copy from excel")
|
||||
} else {
|
||||
$('#copyfromexcel').text("Copy from excel");
|
||||
}
|
||||
|
||||
$('#grid_content_input').toggle();
|
||||
$('#grid_content_from_excel').toggle();
|
||||
|
||||
}
|
||||
|
||||
if (formatType == 1 || formatType == 2) {
|
||||
var FirstIndex = jsonData[0]
|
||||
addGridHTML(false, FirstIndex, formatType, si_or_bp, 0)
|
||||
jsonData.shift();
|
||||
}
|
||||
|
||||
$.each(jsonData, function(index, item) {
|
||||
appendGridtHtml(formatType, rack_rate_type, item)
|
||||
});
|
||||
|
||||
|
||||
$('input[name="11_max_si[]"]').each(function() {
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
$(`input[name="${formatType}_si[]"]`).each(function() {
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
$(`input[name="${formatType}_premium[]"]`).each(function() {
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
$(`input[name="basic_pay[]"]`).each(function() {
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
$(`input[name="gpa_basic_si[]"]`).each(function() {
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
$(`input[name="gpa_basic_premium[]"]`).each(function() {
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user