Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
bitbucket 2024-04-18 10:13:41 +05:30
commit 0096c9f171
6 changed files with 378 additions and 92 deletions

View File

@ -921,6 +921,39 @@ class ClientController extends AdminController
} }
$data = $this->request->getPost(); $data = $this->request->getPost();
$insert = true; $insert = true;
}else if($policy_grid_id == '12'){
$premium=$this->request->getPost('12_premium[]');
$sum_insure =$this->request->getPost('12_si[]');
$relationship =$this->request->getPost('12_relationship[]');
for ($i=0; $i < count($premium) ; $i++) {
$data['premium'] = str_replace(',', '',$premium[$i]);
$data['si'] = str_replace(',', '', $sum_insure[$i]);
$data['relationship'] = $relationship[$i];
$dataa= $this->policyPremium2Model->insert($data);
}
$data = $this->request->getPost();
$insert = true;
}else if($policy_grid_id == '13'){
$premium=$this->request->getPost('13_premium[]');
$sum_insure =$this->request->getPost('13_si[]');
$age_from =$this->request->getPost('13_age_from[]');
$age_to =$this->request->getPost('13_age_to[]');
$relationship =$this->request->getPost('13_relationship[]');
for ($i=0; $i < count($premium) ; $i++) {
$data['premium'] = str_replace(',', '',$premium[$i]);
$data['si'] = str_replace(',', '', $sum_insure[$i]);
$data['age_from'] = $age_from[$i];
$data['age_to'] = $age_to[$i];
$data['relationship'] = $relationship[$i];
$dataa= $this->policyPremium2Model->insert($data);
}
$data = $this->request->getPost();
$insert = true;
} }
if($insert){ if($insert){
@ -1003,6 +1036,12 @@ class ClientController extends AdminController
$family_floater=json_decode($record['policy_terms'])->family_floater; $family_floater=json_decode($record['policy_terms'])->family_floater;
} }
$policy_terms_data = json_decode($record['policy_terms']);
$self = "";
if ($policy_terms_data !== null && isset($policy_terms_data->family_floaters)) {
$self = $policy_terms_data->family_floaters;
}
$emp_count = $this->employeeModel ->join('client_policy cp',"employees.client_id = cp.client_id") $emp_count = $this->employeeModel ->join('client_policy cp',"employees.client_id = cp.client_id")
->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id") ->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
->where("employees.client_id",$record['client_id']) ->where("employees.client_id",$record['client_id'])
@ -1054,26 +1093,25 @@ class ClientController extends AdminController
if($search_term === 'GMC'){ if($search_term === 'GMC'){
$resultss = []; $resultss = [];
if ($family_floater == 1) {
try {
foreach ($results as $index => $record) { foreach ($results as $index => $record) {
if ($index == '8' || $index == '7') { if ($self->self == 1 && $self->spouse == 0 && $self->childrens == 0 && $self->parents == 0 && $self->{'parents-in-law'} == 0 && $self->{'either-parents-pil'} == 0) {
// Clearing the $results array if ($index == '0' || $index == '1' || $index == '2') {
$resultss[$index] = $record; $resultss[$index] = $record;
} }
}
}else if($family_floater == 0){
foreach ($results as $index => $record) {
if ($index == '0' || $index == '1' || $index == '2' || $index == '3' || $index == '4' || $index == '5' || $index == '6') {
// Clearing the $results array
$resultss[$index] = $record;
}
}
} else { } else {
foreach ($results as $index => $record) { if ($index == '0' || $index == '1' || $index == '2' || $index == '3' || $index == '4' || $index == '5' || $index == '6' || $index == '8' || $index == '7' || $index == '9' || $index == '10') {
$resultss[$index] = $record; $resultss[$index] = $record;
} }
} }
}
} catch (\Exception $e) {
$resultss = $results; // Reset $resultss to an empty array if an exception occurs
}
$premiumDataa =''; $premiumDataa ='';
if ($family_floater == 0) { if ($family_floater == 0) {
// print_r($premiumData);die; // print_r($premiumData);die;
@ -1103,15 +1141,15 @@ class ClientController extends AdminController
// echo "hello"; // echo "hello";
// return json_encode($premiumData); // return json_encode($premiumData);
return $this->respond(['status' => true,'code' => 200,'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name,], 200); 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], 200);
}else if($search_term === 'GPA'){ }else if($search_term === 'GPA'){
return $this->respond(['status' => true,'code' => 200,'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name,], 200); 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], 200);
}else{ }else{
return $this->respond(['status' => false,'code' => 200,'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name,], 200); return $this->respond(['status' => false,'code' => 200,'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
} }
} }

View File

@ -490,10 +490,21 @@ class EmpDataServiceController extends BaseController
try { try {
if ($value[15] === null || $value[16] === null) {
if($import_data['insurer_or_tpa'] == 'tpa'){
if ($value[15] === null) {
$missing_id[] = $key + 1; $missing_id[] = $key + 1;
} }
}else if($import_data['insurer_or_tpa'] == 'insurer'){
if ( $value[16] === null) {
$missing_id[] = $key + 1;
}
}
$emp_code = $value[2]; $emp_code = $value[2];
$name = $value[1]; $name = $value[1];
$totals += $value[20]; $totals += $value[20];
@ -501,26 +512,32 @@ class EmpDataServiceController extends BaseController
$db = \Config\Database::connect(); $db = \Config\Database::connect();
// Execute the query // Execute the query
$query = $db->table('employee_polices') $query = $db->table('employee_polices');
->select('employee_polices.id') $query->select('employee_polices.id');
->join('employees', 'employees.id = employee_polices.employee_id') $query->join('employees', 'employees.id = employee_polices.employee_id');
->where('employee_polices.client_policy_id', $client_policy_id) $query->where('employee_polices.client_policy_id', $client_policy_id);
->where('employees.client_id', $client_id) $query->where('employees.client_id', $client_id);
->where('employees.name', $name) $query->where('employees.name', $name);
->where('employees.emp_code', $emp_code) $query->where('employees.emp_code', $emp_code);
->where('(employee_polices.tpa_id IS NULL OR employee_polices.tpa_id = "")') if($import_data['insurer_or_tpa'] == 'tpa'){
->where('(employee_polices.uhid IS NULL OR employee_polices.uhid = "")')
->where('employee_polices.is_active', 1) $query->where('(employee_polices.tpa_id IS NULL OR employee_polices.tpa_id = "")');
->limit(1)
->get(); }else if($import_data['insurer_or_tpa'] == 'insurer'){
$query->where('(employee_polices.uhid IS NULL OR employee_polices.uhid = "")');
}
$query->where('employee_polices.is_active', 1);
$query->limit(1);
// Get the result // Get the result
$result = $query->getRowArray(); $result = $query->get()->getRowArray();
if (isset($result['id']) && $result['id'] !== null) { if (isset($result['id']) && $result['id'] !== null) {
$empty_emp_tpa_uh_ids[] = $result['id']; $empty_emp_tpa_uh_ids[] = $result['id'];
} }
} catch (\Exception $e) { } catch (\Exception $e) {
// Handle the exception here
return 0; return 0;
} }
} }
@ -529,18 +546,47 @@ class EmpDataServiceController extends BaseController
$missing_id_count = count($missing_id); $missing_id_count = count($missing_id);
$empty_id_count = count($empty_emp_tpa_uh_ids); $empty_id_count = count($empty_emp_tpa_uh_ids);
// dd($count, $missing_id_count, $empty_id_count, $data, $empty_emp_tpa_uh_ids);
if ($missing_id_count != $count && $missing_id_count != 0) { if($import_data['insurer_or_tpa'] == 'tpa'){
if ($empty_id_count == 0) {
return 3;
}
if ($missing_id_count != 0) {
return 2; return 2;
} }
if ($empty_emp_tpa_uh_ids != $count && $empty_id_count == 0) {
return 3; }else if($import_data['insurer_or_tpa'] == 'insurer'){
if ($empty_id_count == 0) {
return 5;
} }
if ($missing_id_count != 0) {
return 4;
}
}
// if ($missing_id_count != $count) {
// return 2;
// }
// if ($empty_emp_tpa_uh_ids != $count) {
// return 3;
// }
// dd($empty_emp_tpa_uh_ids); // dd($empty_emp_tpa_uh_ids);
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel'); $is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
@ -559,18 +605,28 @@ class EmpDataServiceController extends BaseController
foreach ($data as $key => $value) { foreach ($data as $key => $value) {
if (!empty($value) && (isset($value[15]) || isset($value[16]))) { if (!empty($value)) {
if($import_data['insurer_or_tpa'] == 'tpa'){
$tpa_id = $value[15] !== null ? $value[15] : ''; $tpa_id = $value[15] !== null ? $value[15] : '';
$uhid = $value[16] !== null ? $value[16] : ''; $uhid = $value[16] !== null ? $value[16] : '';
foreach ($empty_emp_tpa_uh_ids as $id) { $data = ['tpa_id' => $tpa_id, 'uhid' => $uhid];
// Update employee policies based on the ID
$this->employeePolicyModel->where('id', $id)->set(['tpa_id' => $tpa_id, 'uhid' => $uhid])->update(); }else if($import_data['insurer_or_tpa'] == 'insurer'){
$tpa_id = $value[15] !== null ? $value[15] : '';
$uhid = $value[16] !== null ? $value[16] : '';
$data = ['tpa_id' => $tpa_id, 'uhid' => $uhid];
}
foreach ($empty_emp_tpa_uh_ids as $id) {
$this->employeePolicyModel->where('id', $id)->set($data)->update();
} }
// $query = $this->employeePolicyModel->getLastQuery();
// echo $query . "<br>";
} else { } else {
@ -580,6 +636,8 @@ class EmpDataServiceController extends BaseController
if($import_data['insurer_or_tpa'] == 'tpa'){
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id); $policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
$depositeData = [ $depositeData = [
'employeeIds' => $empty_emp_tpa_uh_ids, 'employeeIds' => $empty_emp_tpa_uh_ids,
@ -591,6 +649,10 @@ class EmpDataServiceController extends BaseController
]; ];
$this->cashDepositCalculationForInception($depositeData); $this->cashDepositCalculationForInception($depositeData);
}
return 1; return 1;
} }

View File

@ -401,16 +401,28 @@ class EmployeeController extends AdminController
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 2){ }else if($return == 2){
session()->setFlashdata('error', 'The TPA ID or UHID columns are empty.'); session()->setFlashdata('error', 'The TPA ID column is either partially or entirely empty.');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 0){ }else if($return == 0){
session()->setFlashdata('error', 'Please upload the correct file, something went wrong.'); session()->setFlashdata('error', 'Please upload the correct file.');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 3){ }else if($return == 3){
session()->setFlashdata('error', 'File already uploaded'); session()->setFlashdata('error', 'The following list of employees has already been updated with the TPA ID.');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
} }else if($event_type == 'correction'){
}else if($return == 4){
session()->setFlashdata('error', 'The UHID column is either partially or entirely empty.');
return redirect()->to(base_url('employee/upload'));
}else if($return == 5){
session()->setFlashdata('error', 'The following list of employees has already been updated with the UHID.');
return redirect()->to(base_url('employee/upload'));
}
}else if($event_type == 'correction'){
$return = $empDataServiceController->importExcelDataForCorrection($batch_data); $return = $empDataServiceController->importExcelDataForCorrection($batch_data);
if($return == 1){ if($return == 1){
@ -422,7 +434,7 @@ class EmployeeController extends AdminController
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 0){ }else if($return == 0){
session()->setFlashdata('error', 'Please upload the correct file, something went wrong.'); session()->setFlashdata('error', 'Please upload the correct file');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 3){ }else if($return == 3){
session()->setFlashdata('error', 'File already uploaded'); session()->setFlashdata('error', 'File already uploaded');
@ -441,7 +453,7 @@ class EmployeeController extends AdminController
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 0){ }else if($return == 0){
session()->setFlashdata('error', 'Please upload the correct file, something went wrong.'); session()->setFlashdata('error', 'Please upload the correct file');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 3){ }else if($return == 3){
session()->setFlashdata('error', 'File already uploaded'); session()->setFlashdata('error', 'File already uploaded');
@ -460,7 +472,7 @@ class EmployeeController extends AdminController
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 0){ }else if($return == 0){
session()->setFlashdata('error', 'Please upload the correct file, something went wrong.'); session()->setFlashdata('error', 'Please upload the correct file');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 3){ }else if($return == 3){
session()->setFlashdata('error', 'File already uploaded'); session()->setFlashdata('error', 'File already uploaded');

View File

@ -107,6 +107,15 @@ class EmployeePolicyModel extends Model
$client_policy_id = $ref_data['client_policy_id']; $client_policy_id = $ref_data['client_policy_id'];
$insurer_or_tpa = $ref_data['insurer_or_tpa']; $insurer_or_tpa = $ref_data['insurer_or_tpa'];
if($insurer_or_tpa == 'tpa'){
$id = 'tpa_id';
}else if($insurer_or_tpa == 'insurer'){
$id = 'uhid';
}
$sql = " $sql = "
SELECT SELECT
employees.name AS emp_name, employees.name AS emp_name,
@ -148,8 +157,7 @@ class EmployeePolicyModel extends Model
WHERE batch_data.bf IS NULL WHERE batch_data.bf IS NULL
AND batch_data.bl IS NULL AND batch_data.bl IS NULL
AND employee_polices.client_policy_id = '{$client_policy_id}' AND employee_polices.client_policy_id = '{$client_policy_id}'
AND (employee_polices.tpa_id IS NULL OR employee_polices.tpa_id = '') AND (employee_polices.{$id} IS NULL OR employee_polices.{$id} = '')
AND (employee_polices.uhid IS NULL OR employee_polices.uhid = '')
AND employee_polices.is_active = 1"; AND employee_polices.is_active = 1";
// Get the result set // Get the result set

View File

@ -24,6 +24,7 @@ class PolicyPremium2Model extends Model
"updated_by", "updated_by",
'is_active', 'is_active',
'premium_type', 'premium_type',
'relationship',
]; ];

View File

@ -27,12 +27,13 @@
</select> </select>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4" style="position: relative; left: 45px;display:none"
id="premium_type">
<label for="css"> Premium Calculation </label> <label for="css"> Premium Calculation </label>
<input type="radio" id="individual" name="premium_type" value="2"> <input type="radio" id="individual" name="premium_type" value="2">
<label for="html" style="position: absolute;bottom: 2px;">Individual </label>&nbsp; <label for="html" style="position: absolute;bottom: 2px;">Individual </label>&nbsp;
<input type="radio" id="single" name="premium_type" value="1" <input type="radio" id="single" name="premium_type" value="1"
style="margin-left: 85px;" checked> style="margin-left: 85px;">
<label for="css" style="position: absolute;left: 134px;bottom: 2px;"> Single Insurance <label for="css" style="position: absolute;left: 134px;bottom: 2px;"> Single Insurance
</label> </label>
</div> </div>
@ -66,7 +67,7 @@ $('#btnGridSubmit').hide();
$('.close').click(function() { $('.close').click(function() {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 13; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
} }
@ -92,7 +93,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
if (dataIdValue == '1') { if (dataIdValue == '1') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 13; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
} }
@ -164,7 +165,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
</div>`; </div>`;
} else if (dataIdValue == '2') { } else if (dataIdValue == '2') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 13; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
} }
@ -186,7 +187,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
} else if (dataIdValue == '3') { } else if (dataIdValue == '3') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 13; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
} }
@ -211,7 +212,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
} else if (dataIdValue == '4') { } else if (dataIdValue == '4') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 13; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
} }
grid_html = ` grid_html = `
@ -245,7 +246,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
} else if (dataIdValue == '5') { } else if (dataIdValue == '5') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 13; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
} }
@ -278,7 +279,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
} else if (dataIdValue == '6') { } else if (dataIdValue == '6') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 13; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
} }
@ -313,7 +314,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
} else if (dataIdValue == '7') { } else if (dataIdValue == '7') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 13; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
} }
@ -346,7 +347,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
} else if (dataIdValue == '8') { } else if (dataIdValue == '8') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 13; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
} }
@ -376,7 +377,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
} else if (dataIdValue == '9') { } else if (dataIdValue == '9') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 13; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
} }
@ -406,7 +407,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
} else if (dataIdValue == '10') { } else if (dataIdValue == '10') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 13; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
} }
@ -438,7 +439,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
} else if (dataIdValue == '11') { } else if (dataIdValue == '11') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 13; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
} }
@ -469,8 +470,91 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
</div> </div>
</div>`; </div>`;
} else if (dataIdValue == '12') {
for (var i = 1; i <= 13; i++) {
$('#grid_' + i).remove();
}
grid_html = `
<div class="form-row" id="grid_12" style="width:84%">
<div class="form-group col-md-2">
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="12_si[]" id="12_si" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
<div id='sum_insured_number_word' class="text-danger-2" ></div>
</div>
<div class="form-group col-md-3">
<label for="mobile">Releationship<span class="text-danger">*</span></label>
<select class="form-control" name="12_relationship[]" id="12_relationship" required>
<option value="self" ${data !== false && data !== undefined && data !== '' && data.relationship === 'self' ? 'selected' : ''}>Self</option>
<option value="spouse" ${data !== false && data !== undefined && data !== '' && data.relationship === 'spouse' ? 'selected' : ''}>Spouse</option>
<option value="father" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father' ? 'selected' : ''}>Father</option>
<option value="mother" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother' ? 'selected' : ''}>Mother</option>
<option value="father-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father-in-law' ? 'selected' : ''}>Father in Law</option>
<option value="mother-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother-in-law' ? 'selected' : ''}>Mother in Law</option>
<option value="child" ${data !== false && data !== undefined && data !== '' && data.relationship === 'child' ? 'selected' : ''}>Child</option>
</select>
</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.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="12_premium[]" id="12_premium" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
<div id='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(0,12)">x</button>
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(12)">+</button>
</div>
</div>`;
} else if (dataIdValue == '13') {
for (var i = 1; i <= 13; i++) {
$('#grid_' + i).remove();
}
grid_html = `
<div class="form-row" id="grid_13" style="width:84%">
<div class="form-group col-md-2">
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="13_si[]" id="13_si" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
<div id='sum_insured_number_word' class="text-danger-2" ></div>
</div>
<div class="form-group col-md-2">
<label for="mobile">From Age<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Enter From Age" name="13_age_from[]" id="13_age_from" required>
</div>
<div class="form-group col-md-2">
<label for="mobile">To Age<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Enter TO Age" name="13_age_to[]" id="13_age_to" required>
</div>
<div class="form-group col-md-2">
<label for="mobile">Relationship<span class="text-danger">*</span></label>
<select class="form-control" name="13_relationship[]" id="13_relationship" required>
<option value="">Select Relation</option>
<option value="self" ${data !== false && data !== undefined && data !== '' && data.relationship === 'self' ? 'selected' : ''}>Self</option>
<option value="spouse" ${data !== false && data !== undefined && data !== '' && data.relationship === 'spouse' ? 'selected' : ''}>Spouse</option>
<option value="father" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father' ? 'selected' : ''}>Father</option>
<option value="mother" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother' ? 'selected' : ''}>Mother</option>
<option value="father-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father-in-law' ? 'selected' : ''}>Father in Law</option>
<option value="mother-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother-in-law' ? 'selected' : ''}>Mother in Law</option>
<option value="child" ${data !== false && data !== undefined && data !== '' && data.relationship === 'child' ? 'selected' : ''}>Child</option>
</select>
</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.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="13_premium[]" id="13_premium" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
<div id='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(0,13)">x</button>
<button style="margin-top: 44px;position: absolute;margin-left: 5px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(13)">+</button>
</div>
</div>`;
} else { } else {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 13; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
} }
grid_html = ''; grid_html = '';
@ -597,6 +681,7 @@ $('body').on('click', '.btnPolicyModel', function() {
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
$.ajax({ $.ajax({
url: '<?= base_url("util/policy-premium") ?>', url: '<?= base_url("util/policy-premium") ?>',
type: "GET", type: "GET",
@ -608,6 +693,12 @@ $('body').on('click', '.btnPolicyModel', function() {
$('#GridForm')[0].reset(); $('#GridForm')[0].reset();
if(res.family_floater == 1){
$('#premium_type').show();
}else{
$('#premium_type').hide();
}
setTimeout(function() { setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
@ -634,7 +725,8 @@ $('body').on('click', '.btnPolicyModel', function() {
} }
var policy_grid_id_value = ''; var policy_grid_id_value = '';
if (res.premiumData && res.premiumData.length > 0 && res.premiumData[0].policy_grid_id) { if (res.premiumData && res.premiumData.length > 0 && res.premiumData[0]
.policy_grid_id) {
policy_grid_id_value = res.premiumData[0].policy_grid_id; policy_grid_id_value = res.premiumData[0].policy_grid_id;
} }
@ -660,12 +752,15 @@ $('body').on('click', '.btnPolicyModel', function() {
$('#single').prop('checked', true) $('#single').prop('checked', true)
$('#individual').prop('checked', false) $('#individual').prop('checked', false)
} else {
$('#single').prop('checked', false)
$('#individual').prop('checked', false)
} }
} }
var si_or_bp_value = ''; var si_or_bp_value = '';
if (res.premiumData && res.premiumData.length > 0) { if (res.premiumData && res.premiumData.length > 0) {
@ -1101,6 +1196,78 @@ function appendGridtHtml(ui_type = false, data = false, ) {
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(11)">+</button> <button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(11)">+</button>
</div> </div>
</div>`; </div>`;
} else if (ui_type == '12') {
html = `
<div class="form-row" id="removeChild_${Count}" style="width:84%">
<div class="form-group col-md-2">
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="12_si[]" id="12_si_${Count}" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
</div>
<div class="form-group col-md-3">
<label for="mobile">Relationship<span class="text-danger">*</span></label>
<select class="form-control" name="12_relationship[]" id="12_relationship" required>
<option value="">Select Relation</option>
<option value="self" ${data !== false && data !== undefined && data !== '' && data.relationship === 'self' ? 'selected' : ''}>Self</option>
<option value="spouse" ${data !== false && data !== undefined && data !== '' && data.relationship === 'spouse' ? 'selected' : ''}>Spouse</option>
<option value="father" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father' ? 'selected' : ''}>Father</option>
<option value="mother" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother' ? 'selected' : ''}>Mother</option>
<option value="father-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father-in-law' ? 'selected' : ''}>Father in Law</option>
<option value="mother-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother-in-law' ? 'selected' : ''}>Mother in Law</option>
<option value="child" ${data !== false && data !== undefined && data !== '' && data.relationship === 'child' ? 'selected' : ''}>Child</option>
</select>
</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.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="12_premium[]" id="12_premium_${Count}" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
<div id='premium_number_word_${Count}' 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(12)">+</button>
</div>
</div>`;
} else if (ui_type == '13') {
html = `
<div class="form-row" id="removeChild_${Count}" style="width:84%">
<div class="form-group col-md-2">
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="13_si[]" id="13_si_${Count}" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
</div>
<div class="form-group col-md-2">
<label for="mobile">From Age<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Enter From Age" name="13_age_from[]" id="13_age_from" required>
</div>
<div class="form-group col-md-2">
<label for="mobile">To Age<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Enter TO Age" name="13_age_to[]" id="13_age_to" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Relationship<span class="text-danger">*</span></label>
<select class="form-control" name="13_relationship[]" id="13_relationship" required>
<option value="">Select Relation</option>
<option value="self" ${data !== false && data !== undefined && data !== '' && data.relationship === 'self' ? 'selected' : ''}>Self</option>
<option value="spouse" ${data !== false && data !== undefined && data !== '' && data.relationship === 'spouse' ? 'selected' : ''}>Spouse</option>
<option value="father" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father' ? 'selected' : ''}>Father</option>
<option value="mother" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother' ? 'selected' : ''}>Mother</option>
<option value="father-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father-in-law' ? 'selected' : ''}>Father in Law</option>
<option value="mother-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother-in-law' ? 'selected' : ''}>Mother in Law</option>
<option value="child" ${data !== false && data !== undefined && data !== '' && data.relationship === 'child' ? 'selected' : ''}>Child</option>
</select>
</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.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="13_premium[]" id="13_premium_${Count}" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
<div id='premium_number_word_${Count}' 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;position: absolute;margin-left: 5px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(13)">+</button>
</div>
</div>`;
} }
@ -1113,8 +1280,6 @@ function appendGridtHtml(ui_type = false, data = false, ) {
Count++ Count++
// Number to word // Number to word
$(document).keyup(function(event) { $(document).keyup(function(event) {
if (event.target) { if (event.target) {