Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
6f564858ce
@ -114,6 +114,7 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->group("terms", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("gpa_create", "ClientController::policyGPATerms");
|
||||
$routes->post("edit", "ClientController::editClientPolicyPremium");
|
||||
$routes->post("other_terms", "ClientController::otherPolicyTermsFormSubmit");
|
||||
});
|
||||
});
|
||||
|
||||
@ -244,6 +245,10 @@ $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->get("getPolicyTerms/(:any)", "ClientController::getPolicyTerms/$1");
|
||||
$routes->get("getPolicyTermsFormJson/(:any)", "ClientController::getPolicyTermsFormJson/$1");
|
||||
$routes->get("checkHRNumber/(:any)", "ClientController::checkHRNumber/$1");
|
||||
});
|
||||
|
||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||
|
||||
@ -32,6 +32,8 @@ use App\Models\EmployeeModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Models\NotificationModel;
|
||||
use App\Models\CDMasterModel;
|
||||
use App\Models\PolicyTypeModel;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -65,13 +67,14 @@ class ClientController extends AdminController
|
||||
protected $employeePolicyModel;
|
||||
protected $notificationModel;
|
||||
protected $CDMasterModel;
|
||||
protected $policyTypeModel;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
set_session_context('Client');
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
|
||||
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->userModel = new UserModel();
|
||||
$this->clientBranchModel = new ClientBranchModel();
|
||||
@ -93,8 +96,10 @@ class ClientController extends AdminController
|
||||
$this->policyPremium2Model = new PolicyPremium2Model();
|
||||
$this->employeeModel = new EmployeeModel();
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
$this->notificationModel = new NotificationModel();
|
||||
$this->CDMasterModel = new CDMasterModel();
|
||||
$this->notificationModel = new NotificationModel();
|
||||
$this->CDMasterModel = new CDMasterModel();
|
||||
$this->policyTypeModel = new PolicyTypeModel();
|
||||
|
||||
|
||||
|
||||
|
||||
@ -613,22 +618,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 +907,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 +1219,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 +1231,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 +1243,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 +1254,6 @@ class ClientController extends AdminController
|
||||
$premiumData = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($premiumData); die;
|
||||
@ -1322,7 +1327,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 +1348,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;
|
||||
@ -1427,7 +1432,7 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
$data['family_floaters']['elders_count'] =$this->request->getPost("member_count") ? $this->request->getPost("member_count") : 0;
|
||||
$data['family_floaters']['elders_count'] =$this->request->getPost("elder_member_count") ? $this->request->getPost("elder_member_count") : 0;
|
||||
|
||||
// print_r($data);die;
|
||||
|
||||
@ -1455,7 +1460,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 +1468,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 +1494,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 +1549,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 +1630,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);
|
||||
@ -1887,7 +1907,7 @@ class ClientController extends AdminController
|
||||
"sum_insured" => "Sum Insured",
|
||||
"family_floater" => "Family Floater",
|
||||
"family_floaters" => "Family Floaters",
|
||||
"member_count" => "Elders Count:",
|
||||
"elders_count" => "Elders Count:",
|
||||
"other_member_min_age" => "Min Age:",
|
||||
"other_member_max_age" => "Min Age:",
|
||||
"waiverofpreexistingdiseases" => "Waiver of Pre-existing Diseases",
|
||||
@ -1952,8 +1972,6 @@ class ClientController extends AdminController
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
foreach ($client_policy as $key => $value) {
|
||||
|
||||
$policy_terms = json_decode($value['policy_terms'], true);
|
||||
@ -2049,19 +2067,27 @@ class ClientController extends AdminController
|
||||
} else if (array_key_exists($key, $mapping)) {
|
||||
$transformedData[$mapping[$key]] = $value;
|
||||
} else if ($key == 'special_condition_label') {
|
||||
|
||||
foreach ($value as $key => $value) {
|
||||
$transformedData[$value] = $data['special_condition_input'][$key];
|
||||
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $key => $value) {
|
||||
$transformedData[$value] = $data['special_condition_input'][$key];
|
||||
}
|
||||
}
|
||||
} else if ($key == 'gpa_special_condition_label') {
|
||||
|
||||
foreach ($value as $key => $value) {
|
||||
$transformedData[$value] = $data['gpa_special_condition_input'][$key];
|
||||
} else if ($key == 'gpa_special_condition_label') {
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $key => $value) {
|
||||
$transformedData[$value] = $data['gpa_special_condition_input'][$key];
|
||||
}
|
||||
}
|
||||
} else if ($key == 'other_special_condition_label') {
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $key => $value) {
|
||||
$transformedData[$value] = $data['other_special_condition_label'][$key];
|
||||
}
|
||||
}
|
||||
} else if ($key == 'age_ratio') {
|
||||
|
||||
if (isset($data['sumInsured2'])) {
|
||||
|
||||
$transformedData['Self'] = "(Min: " . $data['age_ratio']['self']['min'] . ", Max: " . $data['age_ratio']['self']['max'] . ")";
|
||||
}
|
||||
} else {
|
||||
@ -2157,4 +2183,124 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function otherPolicyTermsFormSubmit()
|
||||
{
|
||||
|
||||
$client_policy_id = $this->request->getPost("client_policy_id");
|
||||
$policy_terms = $this->request->getPost("policy_terms");
|
||||
|
||||
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
|
||||
if ($record) {
|
||||
|
||||
$update = $this->clientPolicyModel->where('id', $client_policy_id)->set('policy_terms', $policy_terms)->update();
|
||||
|
||||
if ($update) {
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Data updated successfully', 'client_policy_id' => $client_policy_id], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update data', 'formdata' => $this->request->getPost()], 200);
|
||||
}
|
||||
} else {
|
||||
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to store data. The client policy does not exist', 'formdata' => $this->request->getPost()], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getPolicyTerms($client_policy_id)
|
||||
{
|
||||
$policy_terms = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
|
||||
if (!$policy_terms) {
|
||||
return $this->respond(['status' => false, 'error' => 'Policy not found'], 404);
|
||||
}
|
||||
|
||||
if (is_array($policy_terms)) {
|
||||
if (!isset($policy_terms['policy_terms'])) {
|
||||
return $this->respond(['status' => false, 'error' => 'Policy terms not found in array'], 500);
|
||||
}
|
||||
$JSON = json_decode($policy_terms['policy_terms']);
|
||||
} elseif (is_object($policy_terms)) {
|
||||
if (!isset($policy_terms->policy_terms)) {
|
||||
return $this->respond(['status' => false, 'error' => 'Policy terms not found in object'], 500);
|
||||
}
|
||||
$JSON = json_decode($policy_terms->policy_terms);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'error' => 'Unexpected data type for policy terms'], 500);
|
||||
}
|
||||
|
||||
if (!$JSON) {
|
||||
return $this->respond(['status' => false, 'error' => 'Invalid JSON format in policy terms'], 500);
|
||||
}
|
||||
|
||||
$multi_si = [];
|
||||
|
||||
if (isset($JSON->sum_insured) && !empty($JSON->sum_insured)) {
|
||||
$multi_si[] = $JSON->sum_insured;
|
||||
} elseif (isset($JSON->sumInsured2) && !empty($JSON->sumInsured2)) {
|
||||
$multi_si[] = $JSON->sumInsured2;
|
||||
}
|
||||
|
||||
if (isset($JSON->multiple_sum_insured) && is_array($JSON->multiple_sum_insured)) {
|
||||
foreach ($JSON->multiple_sum_insured as $msi) {
|
||||
if (!empty($msi)) {
|
||||
$multi_si[] = $msi;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->respond(['status' => true, 'data' => $multi_si], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getPolicyTermsFormJson($policy_type_id){
|
||||
|
||||
$JSON = $this->policyTypeModel->where('id', $policy_type_id)->first();
|
||||
return $this->respond(['status' => true, 'data' => $JSON], 200);
|
||||
}
|
||||
|
||||
public function createPolicyTermsHtmlAsJSON(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function checkHRNumber($mobileNumber)
|
||||
{
|
||||
try {
|
||||
$mobileNumberCount = $this->levelContactModel
|
||||
->join('client_branch', 'client_branch.id = level_contacts.ref_id')
|
||||
->join('clients', 'clients.id = client_branch.client_id')
|
||||
->where('clients.is_active', 1)
|
||||
->where('client_branch.is_active', 1)
|
||||
->where('level_contacts.is_active', 1)
|
||||
->where('level_contacts.contact_type', 'client')
|
||||
->where('level_contacts.mobile', $mobileNumber)
|
||||
->countAllResults();
|
||||
return $this->respond(['status' => true, 'data' => $mobileNumberCount, 'message' => "try"], 200);
|
||||
} catch (\Exception $e) {
|
||||
log_message('error', 'Error checking mobile number: ' . $e->getMessage());
|
||||
return $this->respond(['status' => false, 'data' => 0, 'message' => 'An error occurred while checking the mobile number. Please try again later.'], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -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){
|
||||
|
||||
@ -79,13 +79,16 @@ class EmployeeController extends AdminController
|
||||
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(
|
||||
client_id: $filterData['client_id'],
|
||||
policy_id: $filterData['policy_id'],
|
||||
status: $filterData['status'],
|
||||
branch_id: $filterData['branch_id']
|
||||
branch_id: $filterData['branch_id'],
|
||||
emp_code : $filterData['emp_code'],
|
||||
emp_name : $filterData['emp_name'],
|
||||
status : $filterData['status'],
|
||||
);
|
||||
|
||||
$data['getData'] = $filterData;
|
||||
}
|
||||
|
||||
// dd($this->request->getGet());
|
||||
$this->myLogger->logme('error', 'list called');
|
||||
$this->loadLayout('employee_list', $data);
|
||||
}
|
||||
@ -772,13 +775,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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ class EmployeeServiceController extends AdminController
|
||||
protected $empEndorsementModel;
|
||||
protected $messageModel;
|
||||
protected $general_relationships = ['self' => ['name' => 'Self', 'gender' => 'M','age_min' => 18,'age_max' => null], 'spouse' => ['name' => 'Spouse', 'gender' => 'F','age_min' => 18,'age_max' => null], 'son' => ['name' => 'Son', 'gender' => 'M','age_min' => null,'age_max' => 25], 'daughter' => ['name' => 'Daughter', 'gender' => 'F','age_min' => null,'age_max' => 25], 'father' => ['name' => 'Father', 'gender' => 'M','age_min' => 18,'age_max' => null], 'mother' => ['name' => 'Mother', 'gender' => 'F','age_min' => 18,'age_max' => null], 'father-in-law' => ['name' => 'Father in Law', 'gender' => 'M','age_min' => 18,'age_max' => null], 'mother-in-law' => ['name' => 'Mother in Law', 'gender' => 'F','age_min' => 18,'age_max' => null]];
|
||||
protected $inception_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'dob'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'DOB','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_dob_diff','params'=>['row','relationship','default_age_ratio']],'gender'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Gender','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['M','F']],'relationship'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'RELATIONSHIP','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_relationship','params'=>['row','relationship','policy_terms']],'basic_cover_si'=>['col_idx'=>6,'col_cell_name'=>'G','col_name'=>'BASIC COVER SI','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_si','params' => ['row','policy_terms','slab_details']],'doc'=>['col_idx'=>7,'col_cell_name'=>'H','col_name'=>'Date of Coverage','is_mandatory'=>['A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'params'=>['row']],'doj'=>['col_idx'=>8,'col_cell_name'=>'I','col_name'=>'DOJ','is_mandatory'=>false,'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_doj','params'=>['row']],'basic_pay'=>['col_idx'=>9,'col_cell_name'=>'J','col_name'=>'Basic Pay','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_basic_pay','params'=>['row','policy_terms','slab_details']],'band_grade'=>['col_idx'=>10,'col_cell_name'=>'K','col_name'=>'Band/Grade','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_employee_band','params'=>['row','policy_terms','slab_details']],'designation'=>['col_idx'=>11,'col_cell_name'=>'L','col_name'=>'Designation','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'phone'=>['col_idx'=>12,'col_cell_name'=>'M','col_name'=>'Phone','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_dup_mobileno','params' => ['row','existing_mobilenos']],'email'=>['col_idx'=>13,'col_cell_name'=>'N','col_name'=>'Email','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'pre_existing_ailments'=>['col_idx'=>14,'col_cell_name'=>'O','col_name'=>'PRE EXISTING AILMENTS','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['0','1']],'change_event'=>['col_idx'=>15,'col_cell_name'=>'P','col_name'=>'Change event','is_mandatory'=>['A','DA','D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>16,'col_cell_name'=>'Q','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>17,'col_cell_name'=>'R','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
protected $inception_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'dob'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'DOB','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_dob_diff','params'=>['row','relationship','default_age_ratio']],'gender'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Gender','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['M','F']],'relationship'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'RELATIONSHIP','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_relationship','params'=>['row','relationship','policy_terms']],'basic_cover_si'=>['col_idx'=>6,'col_cell_name'=>'G','col_name'=>'BASIC COVER SI','is_mandatory'=>null,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_si','params' => ['row','policy_terms','slab_details']],'doc'=>['col_idx'=>7,'col_cell_name'=>'H','col_name'=>'Date of Coverage','is_mandatory'=>['A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom' => 'check_doc','params' => ['row','policy_details']],'doj'=>['col_idx'=>8,'col_cell_name'=>'I','col_name'=>'DOJ','is_mandatory'=>false,'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_doj','params'=>['row']],'basic_pay'=>['col_idx'=>9,'col_cell_name'=>'J','col_name'=>'Basic Pay','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_basic_pay','params'=>['row','policy_terms','slab_details']],'band_grade'=>['col_idx'=>10,'col_cell_name'=>'K','col_name'=>'Band/Grade','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_employee_band','params'=>['row','policy_terms','slab_details']],'designation'=>['col_idx'=>11,'col_cell_name'=>'L','col_name'=>'Designation','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'phone'=>['col_idx'=>12,'col_cell_name'=>'M','col_name'=>'Phone','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_dup_mobileno','params' => ['row','existing_mobilenos']],'email'=>['col_idx'=>13,'col_cell_name'=>'N','col_name'=>'Email','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'pre_existing_ailments'=>['col_idx'=>14,'col_cell_name'=>'O','col_name'=>'PRE EXISTING AILMENTS','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['0','1']],'change_event'=>['col_idx'=>15,'col_cell_name'=>'P','col_name'=>'Change event','is_mandatory'=>['A','DA','D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>16,'col_cell_name'=>'Q','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>17,'col_cell_name'=>'R','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
|
||||
protected $deletion_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'change_event'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'Change event','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
|
||||
@ -350,7 +350,7 @@ class EmployeeServiceController extends AdminController
|
||||
$relationship = $this->general_relationships;
|
||||
|
||||
|
||||
if(in_array($file['action'],['inception','addition','dependent_addition']))// the below funcitons are only for I,DA,A
|
||||
if(in_array($file['action'],['inception','addition','dependent_addition','deletion','correction','si_enhancement']))// the below funcitons are only for I,DA,A
|
||||
{
|
||||
$employee_data_group_by_family = data_group_by_family($excel_data);
|
||||
|
||||
@ -359,7 +359,10 @@ class EmployeeServiceController extends AdminController
|
||||
{
|
||||
$temp = $policy_terms['family_floaters'];
|
||||
$temp = is_array($temp) ? $temp : (is_object($temp) ? (array)$temp : []);
|
||||
$is_self_available_in_policy_terms = isset($temp['self']) ? true : false;
|
||||
|
||||
$is_self_available_in_policy_terms = isset($temp['self']) && $temp['self'] == 1 ? true : false;
|
||||
// Kint::dump($temp['self']);
|
||||
// dd($is_self_available_in_policy_terms);
|
||||
}
|
||||
// dd($employee_data_group_by_family);
|
||||
foreach ($employee_data_group_by_family as $emp_id => $family)
|
||||
@ -415,7 +418,7 @@ class EmployeeServiceController extends AdminController
|
||||
if(!count($self_details))
|
||||
{
|
||||
array_push($result['error_summary'],14); // Self not found
|
||||
$result['error_data'][ $family[0][0] ]['sno']['error'][] = "Self not found in System";
|
||||
$result['error_data'][ $family[0][0] ]['sno']['error'][] = "Self not found in Database";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -143,6 +143,28 @@ if(!function_exists('check_doj'))
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('check_doc'))
|
||||
{
|
||||
|
||||
function check_doc($row,$policy_details)
|
||||
{
|
||||
if($row['current_action'] != null && $row[7] != null && $row[7] != '' && in_array(strtoupper($row['current_action']), ['A','DA']))// check rule only of action column data available
|
||||
{
|
||||
// dd($policy_details);
|
||||
$date = new DateTime($row[7]);
|
||||
$startDate = new DateTime($policy_details[0]->policy_start_date);
|
||||
$endDate = new DateTime($policy_details[0]->policy_end_date);
|
||||
|
||||
if ($date >= $startDate && $date <= $endDate) {
|
||||
return array('status' => true);
|
||||
} else {
|
||||
return array('status' => false,'error' => 'the given date of coverage is not between policy start/end date');
|
||||
}
|
||||
}
|
||||
else { return array('status' => true); } // in else condition no need to check rule, just return true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!function_exists('check_employee_band'))
|
||||
{
|
||||
@ -206,7 +228,7 @@ if(!function_exists('check_si'))
|
||||
}
|
||||
|
||||
// check age slab
|
||||
if(in_array(strtoupper($row['current_action']), ['I','A','DA']))
|
||||
if(in_array(strtoupper($row['current_action']), ['I','A','DA']) && strtolower($row['5']) == 'self')
|
||||
{
|
||||
if($row[3] != null && DateTime::createFromFormat('d-M-Y', $row[3]) !== false)// dob
|
||||
{
|
||||
@ -236,6 +258,7 @@ if(!function_exists('check_si'))
|
||||
else
|
||||
{
|
||||
$is_age_slab_found = true;// send true if age conditin is not applicable
|
||||
$is_si_found = true;
|
||||
}//end of check age slab
|
||||
}// end of for loop
|
||||
|
||||
@ -252,6 +275,12 @@ if(!function_exists('check_si'))
|
||||
$return_array['error'] = !empty($return_array['error']) ? ($return_array['error'].', '.'Sum insured not configured for this age slab') : 'Sum insured not configured for this age slab';
|
||||
}
|
||||
|
||||
if(empty($received_si))
|
||||
{
|
||||
$return_array['status'] = false;
|
||||
$return_array['error'] = "Sum insured value mandantory";
|
||||
}
|
||||
|
||||
return $return_array;
|
||||
}
|
||||
}
|
||||
@ -417,6 +446,7 @@ if (!function_exists('name_and_empid_check_in_db'))
|
||||
$result = ['del' => [],'i' => []];
|
||||
$client_id = $actionArr['client_id'];
|
||||
$policy_id = $actionArr['policy_id'];
|
||||
$client_branch_id = $actionArr['client_branch_id'];
|
||||
$current_action = $actionArr['action'];
|
||||
|
||||
foreach ($family_data as $rkey => $row)
|
||||
@ -428,6 +458,7 @@ if (!function_exists('name_and_empid_check_in_db'))
|
||||
->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
||||
->where("cp.id",$policy_id)
|
||||
->where("employees.client_id",$client_id)
|
||||
->where("employees.client_branch_id",$client_branch_id)
|
||||
->where("employees.is_active",1)
|
||||
->where("employees.emp_status",'active')
|
||||
->where("ep.is_active",1)
|
||||
@ -572,10 +603,8 @@ if (!function_exists('check_dependent_conflict'))
|
||||
$result['error_data'][] = ['code' => 12,'col_name' => 'sno','msg' => 'Rule conflict: As per policy, count of dependents has exceeded configured count','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])];//dependent count mismatch
|
||||
}
|
||||
}
|
||||
|
||||
// var_dump($allowed_adults == 0);
|
||||
// dd($allowed_adults == 0 && (($allowed_parents_count < $received_parents_count) || ($allowed_parent_in_laws_count < $received_parent_in_laws_count)));
|
||||
if($allowed_adults == 0 && (($allowed_parents_count < $received_parents_count) || ($allowed_parent_in_laws_count < $received_parent_in_laws_count) ))
|
||||
//check for any cross parents but not more than two
|
||||
if($allowed_adults == 0 && $allowed_parents_count == 1 && $allowed_parent_in_laws_count == 1 && (2 < ($received_parents_count + $received_parent_in_laws_count)))
|
||||
{
|
||||
// dd($allowed_adults);
|
||||
$result['status'] = false;
|
||||
@ -956,7 +985,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||
{
|
||||
if($slab_value['si'] == $employee_received_si)
|
||||
if($slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||
{
|
||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
@ -979,7 +1008,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||
{
|
||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age))
|
||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||
{
|
||||
// dd($slab_value);
|
||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||
@ -1000,7 +1029,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||
{
|
||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age))
|
||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||
{
|
||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
|
||||
@ -76,31 +76,68 @@ class EmployeePolicyModel extends Model
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
public function getEmployeePolicy($client_id,$policy_id,$status, $branch_id)
|
||||
public function getEmployeePolicy($client_id = 0, $policy_id=0, $status=0, $branch_id=0, $emp_code="", $emp_name="")
|
||||
{
|
||||
$result = $this->select(['employee_polices.*','pm.name as policy_name','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active','emp.mobile as mobile'])
|
||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
|
||||
->join('policies pm', 'cp.policy_id = pm.id') //pm - policy master
|
||||
->join('insurers im', 'cp.insurer_id = im.id') //im - insurar master
|
||||
->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id') //ib - insurar branch
|
||||
->join('tpa tpam', 'cp.tpa_id = tpam.id','left') //tpam - tpa master
|
||||
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id','left') //tpab - tpa brach
|
||||
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
||||
->where('emp.client_id',$client_id)
|
||||
->where('emp.client_branch_id',$branch_id)
|
||||
->where('employee_polices.is_active',1)
|
||||
->where('emp.is_active',1)
|
||||
->where('employee_polices.client_policy_id',$policy_id)
|
||||
->orderBy('emp.emp_code','ASC')->orderBy('employee_polices.employee_id','ASC');
|
||||
|
||||
|
||||
if($status != 0 && !empty($status)){
|
||||
|
||||
$result = $this->select([
|
||||
'employee_polices.*',
|
||||
'pm.name as policy_name',
|
||||
'im.short_name as insurer_short_name',
|
||||
'ib.branch_name as insurer_branch_name',
|
||||
'ib.branch_code as insurer_branch_code',
|
||||
'tpam.name as tpa_name',
|
||||
'tpam.short_name as tpa_short_name',
|
||||
'tpab.branch_code as tpa_branch_code',
|
||||
'cm.client_name',
|
||||
'cm.short_name as client_short_name',
|
||||
'emp.relationship',
|
||||
'emp.relationship_code',
|
||||
'emp.change_event',
|
||||
'emp.emp_code',
|
||||
'emp.name',
|
||||
'emp.email_corporate',
|
||||
'emp.dob',
|
||||
'emp.gender',
|
||||
'emp.emp_status',
|
||||
'emp.is_active as emp_is_active',
|
||||
'emp.mobile as mobile'
|
||||
])
|
||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
|
||||
->join('policies pm', 'cp.policy_id = pm.id') //pm - policy master
|
||||
->join('insurers im', 'cp.insurer_id = im.id') //im - insurer master
|
||||
->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id') //ib - insurer branch
|
||||
->join('tpa tpam', 'cp.tpa_id = tpam.id', 'left') //tpam - tpa master
|
||||
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id', 'left') //tpab - tpa branch
|
||||
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
||||
->orderBy('emp.emp_code', 'ASC')
|
||||
->orderBy('employee_polices.employee_id', 'ASC');
|
||||
|
||||
// Conditionally add where clauses
|
||||
if ($client_id !=0 && !empty($client_id)) {
|
||||
$result->where('emp.client_id', $client_id);
|
||||
}
|
||||
if ($branch_id !=0 && !empty($branch_id)) {
|
||||
$result->where('emp.client_branch_id', $branch_id);
|
||||
}
|
||||
if ($policy_id !=0 && !empty($policy_id)) {
|
||||
$result->where('employee_polices.client_policy_id', $policy_id);
|
||||
}
|
||||
if ($status !=0 && !empty($status)) {
|
||||
$result->where('employee_polices.status', $status);
|
||||
}
|
||||
if (!empty($emp_code)) {
|
||||
$result->where('emp.emp_code', $emp_code);
|
||||
}
|
||||
if (!empty($emp_name)) {
|
||||
$result->like('emp.name', $emp_name);
|
||||
}
|
||||
|
||||
$result = $result->findAll();
|
||||
return ($result);
|
||||
// Always check these conditions
|
||||
$result->where('employee_polices.is_active', 1)
|
||||
->where('emp.is_active', 1);
|
||||
|
||||
return $result->findAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile">Mobile<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" minlength="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="mobile" onchange="checkMobileNumber(this)" onkeypress = "return onlyNumbers(event)" maxlength="10" minlength="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="designation">Designation<span class="text-danger">*</span></label>
|
||||
@ -423,7 +423,7 @@ $(document).ready(function () {
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" min="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" onchange="checkMobileNumber(this)" onkeypress = "return onlyNumbers(event)" maxlength="10" min="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
|
||||
@ -563,6 +563,33 @@ $(document).ready(function () {
|
||||
|
||||
|
||||
|
||||
function checkMobileNumber(input){
|
||||
|
||||
console.log('function called')
|
||||
console.log(input);
|
||||
console.log('Input Value', input.value);
|
||||
|
||||
var mobileNumber = input.value;
|
||||
var url = '<?php echo base_url('util/checkHRNumber/') ?>' + mobileNumber;
|
||||
|
||||
$.get(url, function(response){
|
||||
|
||||
console.log(response)
|
||||
console.log(response.data)
|
||||
|
||||
if(response.data > 0){
|
||||
toastr.warning('The Mobile Number Already Exist.', 'Warning');
|
||||
input.value = "";
|
||||
return;
|
||||
}
|
||||
|
||||
}).fail(function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@ -16,7 +16,8 @@
|
||||
<div class="row">
|
||||
|
||||
<div class="col-6" style="position: relative;left: 455px;">
|
||||
<button id="close_btn" class="btn btn-primary waves-effect waves-light client_info_close">Close</button>
|
||||
<button id="close_btn"
|
||||
class="btn btn-primary waves-effect waves-light client_info_close">Close</button>
|
||||
</div>
|
||||
<div class="col-1 float-right" style="position: relative;left: 255px;">
|
||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse"
|
||||
@ -33,7 +34,7 @@
|
||||
|
||||
<div class="card-body" style="position: relative;bottom: 25px;">
|
||||
|
||||
<div class="row" >
|
||||
<div class="row">
|
||||
|
||||
<div class="col-6">
|
||||
|
||||
@ -204,7 +205,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="collapseThree" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body" style="position: relative;bottom: 25px;">
|
||||
<div class="card-body" style="position: relative;bottom: 25px;">
|
||||
<div class="row">
|
||||
<table id="tb1" class="table table-hover m-0 table-centered dt-responsive nowrap w-100"
|
||||
cellspacing="0">
|
||||
@ -253,7 +254,7 @@
|
||||
</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body" id="modal_body" >
|
||||
<div class="modal-body" id="modal_body">
|
||||
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
@ -270,50 +271,71 @@ $(document).ready(function() {
|
||||
$(document).on('click', '.policy_terms', function() {
|
||||
var terms = $(this).data('id');
|
||||
console.log(terms);
|
||||
console.log(terms.length);
|
||||
console.log(JSON.stringify(terms));
|
||||
|
||||
|
||||
|
||||
// terms = JSON.parse(terms);
|
||||
|
||||
$('#modal_body').empty();
|
||||
|
||||
function createListItems(obj) {
|
||||
|
||||
if (obj.length == 0) {
|
||||
const message = document.createElement('div');
|
||||
message.textContent = 'Policy Terms Not Available';
|
||||
message.style.display = 'flex';
|
||||
message.style.justifyContent = 'center';
|
||||
message.style.alignItems = 'center';
|
||||
message.style.height = '100%'; // Adjust as necessary to fit the context
|
||||
message.style.textAlign = 'center';
|
||||
return message;
|
||||
}
|
||||
|
||||
const fragment = document.createDocumentFragment();
|
||||
for (const key in obj) {
|
||||
if (obj.hasOwnProperty(key) && obj[key] !== null && obj[key] !== '' && key !=
|
||||
'family_floater' && key != 'gpa_special_condition_input' && key !=
|
||||
'gpa_special_condition_label' && key != 'special_condition_label' && key !=
|
||||
'special_condition_input' && key != 'age_ratio') {
|
||||
|
||||
if (
|
||||
obj.hasOwnProperty(key) &&
|
||||
obj[key] !== null &&
|
||||
obj[key] !== '' &&
|
||||
key !== 'family_floater' &&
|
||||
key !== 'gpa_special_condition_input' &&
|
||||
key !== 'gpa_special_condition_label' &&
|
||||
key !== 'special_condition_label' &&
|
||||
key !== 'special_condition_input' &&
|
||||
key !== 'age_ratio' &&
|
||||
key !== 'multiple_sum_insured' &&
|
||||
key !== 'other_special_condition_label' &&
|
||||
key !== 'other_special_condition_input'
|
||||
) {
|
||||
const listItem = document.createElement('li');
|
||||
let formattedKey = key.replace(/_/g, ' ');
|
||||
|
||||
var formattedKey = '';
|
||||
formattedKey = key.replace(/_/g, ' ');
|
||||
obj[key] = obj[key].replace(/<\/?[^>]+>/gi, '');
|
||||
console.log('type', typeof obj[key])
|
||||
|
||||
// Strip HTML tags from values
|
||||
if (typeof obj[key] === 'string') {
|
||||
console.log('before', obj[key])
|
||||
obj[key] = obj[key].replace(/<\/?[^>]+>/gi, '');
|
||||
console.log('after', obj[key])
|
||||
}
|
||||
|
||||
// Convert 0 and 1 to 'No' and 'Yes'
|
||||
if (obj[key] == 0) {
|
||||
obj[key] = 'No';
|
||||
}
|
||||
|
||||
if (obj[key] == 1) {
|
||||
obj[key] = 'Yes';
|
||||
}
|
||||
|
||||
console.log(formattedKey)
|
||||
|
||||
if (key == 'burnExpenses' && obj[key] == 'Yes') {
|
||||
|
||||
listItem.innerHTML =
|
||||
`<strong>${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:</strong> ${obj['burnExpensesData']}`;
|
||||
|
||||
} else if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) {
|
||||
|
||||
// Handle nested objects
|
||||
if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) {
|
||||
listItem.innerHTML =
|
||||
`<strong>${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:</strong>`;
|
||||
const nestedList = document.createElement('ul');
|
||||
|
||||
nestedList.appendChild(createListItems(obj[key]));
|
||||
|
||||
listItem.appendChild(nestedList);
|
||||
|
||||
} else {
|
||||
listItem.innerHTML =
|
||||
`<strong>${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:</strong> ${Array.isArray(obj[key]) ? JSON.stringify(obj[key]) : obj[key]}`;
|
||||
@ -325,7 +347,8 @@ $(document).on('click', '.policy_terms', function() {
|
||||
return fragment;
|
||||
}
|
||||
|
||||
$('#modal_body').append(createListItems(terms));
|
||||
});
|
||||
|
||||
$('#modal_body').append(createListItems(terms));
|
||||
|
||||
});
|
||||
</script>
|
||||
@ -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>
|
||||
@ -157,6 +157,7 @@
|
||||
<?php include('policy_grid.php'); ?>
|
||||
<?php include('policy_gmc_terms.php'); ?>
|
||||
<?php include('policy_gpa_terms.php'); ?>
|
||||
<?php include('other_policy_terms.php'); ?>
|
||||
|
||||
<script>
|
||||
var policy_PrimaryKey = $('#client_id_policy').val();
|
||||
@ -210,13 +211,15 @@
|
||||
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);
|
||||
|
||||
if (patternGMC.test(subject)) {
|
||||
search_term = 'GMC';
|
||||
} else if (patternGPA.test(subject)) {
|
||||
@ -224,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) {
|
||||
@ -269,8 +272,8 @@
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<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}" 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 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}" 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>
|
||||
@ -279,12 +282,14 @@
|
||||
});
|
||||
|
||||
$('#policy_table').append(policyTable);
|
||||
// console.log(policyTable);
|
||||
}
|
||||
|
||||
|
||||
$('#table-client-policy').DataTable({
|
||||
paging: true,
|
||||
searching: false
|
||||
searching: false,
|
||||
// ordering: false
|
||||
});
|
||||
|
||||
});
|
||||
@ -339,7 +344,6 @@
|
||||
|
||||
})
|
||||
|
||||
|
||||
/******** for form submit using AJAX *******/
|
||||
$("#policy_form").submit(function(event) {
|
||||
|
||||
@ -351,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');
|
||||
@ -380,7 +384,7 @@
|
||||
|
||||
var isValid = $('#policy_form').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
//console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -399,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() {
|
||||
|
||||
@ -444,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) {
|
||||
@ -491,8 +490,8 @@
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<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}" 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 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}" 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>
|
||||
@ -500,6 +499,8 @@
|
||||
`;
|
||||
});
|
||||
$('#policy_table').append(policyTable);
|
||||
console.log(policyTable);
|
||||
|
||||
|
||||
$('#insurer').val('');
|
||||
$('#tpa').val('');
|
||||
@ -515,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);
|
||||
}
|
||||
@ -540,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(res)
|
||||
//console.log('polices', res)
|
||||
var OptionsHTML = '';
|
||||
OptionsHTML += '<option value="" selected>Select Policy</option>';
|
||||
$policy_type_value = $('#policy_type').val();
|
||||
@ -587,13 +588,14 @@
|
||||
}
|
||||
} else if ($policy_type_value == 1) {
|
||||
|
||||
if (item.policy_type_id == 1 || item.policy_type_id == 2 || item
|
||||
.policy_type_id == 3) {
|
||||
// const policyTypeId = Number(item.policy_type_id);
|
||||
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id +
|
||||
'" value="' +
|
||||
item.id +
|
||||
'">' + item.name + '( ' + item.policy_type + ' )</option>';
|
||||
// if ([1, 2, 3, 6, 7,].includes(policyTypeId))
|
||||
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)
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id + '">' + item.name + '( ' + item.policy_type + ' )</option>';
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -613,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');
|
||||
@ -638,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()
|
||||
@ -649,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();
|
||||
@ -678,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();
|
||||
}
|
||||
@ -687,7 +703,7 @@
|
||||
|
||||
} else {
|
||||
|
||||
// console.log('step 3')
|
||||
// //console.log('step 3')
|
||||
|
||||
var displayStatus = $('#base_policy_id').css('display');
|
||||
$('#base_policy_id').hide();
|
||||
@ -695,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();
|
||||
}
|
||||
@ -722,7 +738,7 @@
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('client_policy_res', res)
|
||||
//console.log('client_policy_res', res)
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
@ -886,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({
|
||||
@ -976,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);
|
||||
}
|
||||
@ -1124,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 `;
|
||||
@ -1148,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
|
||||
@ -1166,7 +1183,7 @@
|
||||
maximumFractionDigits: 2
|
||||
});
|
||||
|
||||
console.log('formetted value', value);
|
||||
//console.log('formetted value', value);
|
||||
|
||||
input.value = (value);
|
||||
|
||||
@ -1233,7 +1250,7 @@
|
||||
|
||||
|
||||
function removeClientPolicy(element) {
|
||||
// console.log(element);
|
||||
// //console.log(element);
|
||||
}
|
||||
|
||||
|
||||
@ -1324,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,
|
||||
@ -1332,7 +1349,7 @@
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('one', res)
|
||||
//console.log('one', res)
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
@ -1346,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) {
|
||||
@ -1354,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>';
|
||||
@ -1376,7 +1393,7 @@
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log('Something Wrong!', 'warning');
|
||||
//console.log('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
@ -1388,15 +1405,15 @@
|
||||
|
||||
$('#base_policy').change(function() {
|
||||
|
||||
var client_policy_id = $(this).val()
|
||||
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,
|
||||
@ -1406,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();
|
||||
@ -1420,7 +1437,7 @@
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log(res)
|
||||
//console.log(res)
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
@ -1439,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
|
||||
@ -1453,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');
|
||||
@ -1477,7 +1494,7 @@
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log('Something Wrong!', 'warning');
|
||||
//console.log('Something Wrong!', 'warning');
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
@ -1492,7 +1509,7 @@
|
||||
|
||||
function fetchClientBranch() {
|
||||
|
||||
console.log('function called');
|
||||
//console.log('function called');
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
@ -1516,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');
|
||||
@ -1561,7 +1578,7 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#client_branch").on('change', function() {
|
||||
// console.log('fetchClientPolicyList change')
|
||||
// //console.log('fetchClientPolicyList change')
|
||||
fetchClientPolicyList();
|
||||
});
|
||||
|
||||
@ -1570,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>', {
|
||||
@ -1586,7 +1603,7 @@
|
||||
});
|
||||
|
||||
if (select === item.cd_ac_no) {
|
||||
console.log('selected');
|
||||
//console.log('selected');
|
||||
option.attr('selected', true);
|
||||
}
|
||||
|
||||
|
||||
@ -59,6 +59,16 @@ table.dataTable tbody td {
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Employee Code</label> <br />
|
||||
<input type="text" class="form-control" id="emp_code" name="emp_code" value="<?= isset($getData['emp_code']) && !empty($getData['emp_code']) ? $getData['emp_code'] : '' ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Employee Name</label> <br />
|
||||
<input type="text" class="form-control" id="emp_name" name="emp_name" value="<?= isset($getData['emp_name']) && !empty($getData['emp_name']) ? $getData['emp_name'] : '' ?>">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12" style="text-align: right;">
|
||||
@ -318,18 +328,22 @@ function fetchEmpolyeeList(event) {
|
||||
var policy_id = $('#policies').val();
|
||||
var status = $('#status2').val();
|
||||
var branch_id = $('#branch_id').val();
|
||||
var emp_code = $('#emp_code').val();
|
||||
var emp_name = $('#emp_name').val();
|
||||
|
||||
// console.log(client_id + '-' + policy_id);
|
||||
if (client_id == '0' || policy_id == '0') {
|
||||
alert('Please select values in both dropdowns.');
|
||||
return;
|
||||
}
|
||||
// if (client_id == '0' || policy_id == '0') {
|
||||
// alert('Please select values in both dropdowns.');
|
||||
// return;
|
||||
// }
|
||||
|
||||
var queryParams = {
|
||||
|
||||
client_id: client_id,
|
||||
policy_id: policy_id,
|
||||
branch_id: branch_id,
|
||||
emp_code : emp_code,
|
||||
emp_name : emp_name,
|
||||
status : status,
|
||||
};
|
||||
|
||||
|
||||
@ -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])
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
@ -587,16 +587,25 @@
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||
"buttons": [{
|
||||
"extend": 'csv',
|
||||
"text": 'CSV',
|
||||
"title": 'Endorsement-List',
|
||||
"className": 'my_class',
|
||||
"exportOptions": {
|
||||
"columns": ':not(:last-child)'
|
||||
},
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Endorsement-List',
|
||||
className: 'my_class',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)',
|
||||
format: {
|
||||
body: function (data, row, column, node) {
|
||||
// Convert data to string to avoid scientific notation in CSV
|
||||
if (!isNaN(data) && parseFloat(data) > 1e20) {
|
||||
return `'${data}`;
|
||||
}
|
||||
return data.toString();// Ensures all data is treated as strings
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
"initComplete": function(settings, json) {
|
||||
initComplete: function(settings, json) {
|
||||
$('.my_class').css({
|
||||
"position": "relative",
|
||||
"left": "79px"
|
||||
@ -608,7 +617,12 @@
|
||||
},
|
||||
paging: true,
|
||||
// pagingType: 'full_numbers'
|
||||
columnDefs: [
|
||||
{ type: 'scientific', targets: 0 } // Apply custom sorting type to the first column
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
@ -136,6 +136,7 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
|
||||
|
||||
<script src="https://cdn.datatables.net/plug-ins/2.0.8/sorting/scientific.js"></script>
|
||||
|
||||
<script>
|
||||
toastr.options = {
|
||||
@ -159,7 +160,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>
|
||||
|
||||
702
app/Views/other_policy_terms.php
Normal file
702
app/Views/other_policy_terms.php
Normal file
@ -0,0 +1,702 @@
|
||||
<style>
|
||||
.button-like {
|
||||
display: inline-block;
|
||||
padding: 8px 15px;
|
||||
background-color: #02a8b5;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
border-radius: 2px;
|
||||
cursor: pointer;
|
||||
margin-right: -85px;
|
||||
}
|
||||
|
||||
.radiobuttondiv {
|
||||
margin-left: 32px;
|
||||
}
|
||||
|
||||
.form-control-client-policy-master {
|
||||
width: 62% !important;
|
||||
margin-left: 30px;
|
||||
margin-top: 3px
|
||||
}
|
||||
|
||||
/* .form-group.col-md-6 */
|
||||
.form-group-client-policy-master {
|
||||
display: -webkit-box;
|
||||
max-width: 100% !important;
|
||||
/* border:1px solid; */
|
||||
/* background-color: #0001; */
|
||||
}
|
||||
|
||||
.form-group-client-policy-masters {
|
||||
display: -webkit-box;
|
||||
max-width: 100% !important;
|
||||
}
|
||||
|
||||
.flex-container {
|
||||
display: block;
|
||||
/* flex-wrap: wrap; */
|
||||
/* align-items: center; Align items vertically center */
|
||||
}
|
||||
|
||||
.flex-container>div {
|
||||
flex: 1;
|
||||
/* Each div takes equal space */
|
||||
}
|
||||
|
||||
label {
|
||||
padding-top: 7px;
|
||||
width: 400px;
|
||||
/* background-color: #0001; */
|
||||
height: 36px;
|
||||
/* text-align: center; */
|
||||
}
|
||||
|
||||
.jodit-status-bar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.input-group {
|
||||
width: 64.5% !important;
|
||||
}
|
||||
|
||||
.input-group-append-client-policy-master {
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.jodit-wysiwyg {
|
||||
margin-bottom: 162px;
|
||||
}
|
||||
|
||||
.form-control-client-policy-masters {
|
||||
margin-left: 30px;
|
||||
width: 689px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="OtherPolicyTermsForm" style="display:none">
|
||||
|
||||
<span id="otherPolicyTermsClose"
|
||||
style="float: right;font-size: 26px;color: red;margin-top: -42px;margin-left: 3px;margin-right: 7px;">x</span>
|
||||
<h5><label for="gpaTerms" style="margin-bottom: 20px;">Policy Terms <span
|
||||
id="nameOfThePolicyOnOther"></span></label>
|
||||
</h5>
|
||||
<form role="form" class="parsley-examples" method="post" id="otherPolicyTerms" enctype="multipart/form-data">
|
||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="client_id" id="Client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
||||
<input type="hidden" name="client_policy_id" id="other_client_policy_id" />
|
||||
<input type="hidden" name="policy_id" id="gpa_policy_id" />
|
||||
<input type="hidden" id="emp_count" />
|
||||
|
||||
<div id="append_html_for_other_policy_terms"></div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="other_special_condition">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="form-group text-right m-b-0" style="margin-top: -49px;">
|
||||
<a href="#" class="button-like" id="otherButtonSpecialCondition" title="Special Condition">Special
|
||||
Condition</a>
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnOtherTermsSubmit"
|
||||
style="margin-top: 100px;">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
$("#otherPolicyTerms").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var isValid = $('#otherPolicyTerms').parsley().validate();
|
||||
console.log('isvalid', isValid);
|
||||
|
||||
if ($('#emp_count').val() == true) {
|
||||
toastr.warning('Client has active employees', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var formData = new FormData($('#otherPolicyTerms')[0]);
|
||||
var policy_form_action = '<?= base_url("client/terms/other_terms") ?>';
|
||||
|
||||
// Convert the FormData object to a JSON object
|
||||
const formObject = {};
|
||||
formData.forEach((value, key) => {
|
||||
if (key != 'csrf_test_name' && key != 'client_policy_id' && key != 'policy_id' && key !=
|
||||
'client_id') {
|
||||
|
||||
if (key.endsWith('[]')) {
|
||||
const baseKey = key.slice(0, -2);
|
||||
if (!formObject[baseKey]) {
|
||||
formObject[baseKey] = [];
|
||||
}
|
||||
formObject[baseKey].push(value.replace(/,/g, ''));
|
||||
} else if(key == 'sum_insureds'){
|
||||
formObject['sum_insured'] = value.replace(/,/g, '');
|
||||
}
|
||||
else {
|
||||
formObject[key] = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
console.log(formObject);
|
||||
|
||||
|
||||
const jsonString = JSON.stringify(formObject);
|
||||
console.log(jsonString);
|
||||
|
||||
// return;
|
||||
|
||||
// Append the JSON string to the FormData object
|
||||
formData.append('policy_terms', jsonString);
|
||||
|
||||
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: policy_form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
$('#otherPolicyTerms')[0].reset();
|
||||
$('.text-danger-2').html('');
|
||||
console.log(res);
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error(res.message, 'Error');
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$('#OtherPolicyTermsForm').css('display', 'none');
|
||||
$('#police-tab').css('display', '');
|
||||
$('.nav.nav-pills.navtab-bg').css('display', '');
|
||||
$('.nav.nav-pills.navtab-bg').prev().css('display', '');
|
||||
var message = 'Policy Terms Updated successfully';
|
||||
toastr.success(message, 'Success');
|
||||
}, 1000);
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '.btnPolicyMaster', function() {
|
||||
|
||||
var client_policy_id = $(this).data('id');
|
||||
var policy_type_id = $(this).data('typeid');
|
||||
console.log('policy_type_id', policy_type_id);
|
||||
console.log('client_policy_id :', client_policy_id);
|
||||
|
||||
$('#other_client_policy_id').val(client_policy_id);
|
||||
|
||||
appendPolicyTermsHTML(policy_type_id);
|
||||
|
||||
var gpa_policy_type_id = $(this).attr('id');
|
||||
// console.log('gpa_policy_type_id', gpa_policy_type_id)
|
||||
|
||||
if (policy_type_id > 5) {
|
||||
|
||||
$('#OtherPolicyTermsForm').css('display', '');
|
||||
$('#police-tab').css('display', 'none');
|
||||
$('.nav.nav-pills.navtab-bg').css('display', 'none');
|
||||
$('.nav.nav-pills.navtab-bg').prev().css('display', 'none');
|
||||
$('.removeDom').remove()
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/policy/getterms") ?>',
|
||||
method: 'GET',
|
||||
data: {
|
||||
client_policy_id: client_policy_id
|
||||
},
|
||||
success: function(res) {
|
||||
|
||||
console.log('response of the other policy terms', res);
|
||||
console.log('employee count', res.emp_count_by_policy);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 500);
|
||||
|
||||
$('#nameOfThePolicyOnOther').html(' - ' + res.policy_name.name);
|
||||
|
||||
|
||||
$('#emp_count').val(res.count)
|
||||
if (res.emp_count_by_policy != 0) {
|
||||
$("#btnOtherTermsSubmit").hide();
|
||||
$("#otherButtonSpecialCondition").hide();
|
||||
} else {
|
||||
$("#btnOtherTermsSubmit").show();
|
||||
$("#otherButtonSpecialCondition").show();
|
||||
}
|
||||
|
||||
|
||||
if (res) {
|
||||
|
||||
//special conditions fields
|
||||
let gpaJsonObjectForSpecialCondition = JSON.parse(res.data);
|
||||
Object.keys(gpaJsonObjectForSpecialCondition).forEach(function(key) {
|
||||
if (key.includes("other_special_condition_label") || key.includes(
|
||||
"other_special_condition_input")) {
|
||||
if (key.includes("other_special_condition_label")) {
|
||||
for (let index = 0; index <
|
||||
gpaJsonObjectForSpecialCondition[key].length; index++) {
|
||||
specialConditionForOthers();
|
||||
}
|
||||
}
|
||||
let elements = document.getElementsByName(`${key}[]`);
|
||||
|
||||
if (elements) {
|
||||
elements.forEach((element, index) => {
|
||||
|
||||
if (gpaJsonObjectForSpecialCondition[key][
|
||||
index
|
||||
] == undefined) {
|
||||
element.value = " ";
|
||||
} else {
|
||||
element.value =
|
||||
gpaJsonObjectForSpecialCondition[key][
|
||||
index
|
||||
];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (key.includes("multiple_sum_insured")) {
|
||||
gpaJsonObjectForSpecialCondition[key].forEach((value, index) => {
|
||||
appendOtherSIAddMore(value);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
//normal terms fields
|
||||
let jsonObject = JSON.parse(res.data);
|
||||
Object.keys(jsonObject).forEach(function(key) {
|
||||
|
||||
console.log(key)
|
||||
|
||||
let elements = document.getElementsByName(key);
|
||||
|
||||
if(key == 'sum_insured'){
|
||||
elements = document.getElementsByName('sum_insureds')
|
||||
}
|
||||
|
||||
console.log(elements)
|
||||
|
||||
if (elements && elements.length > 0) {
|
||||
let element = elements[0];
|
||||
|
||||
if (element.tagName === 'INPUT' && (element.type ===
|
||||
'checkbox' || element.type === 'radio')) {
|
||||
|
||||
if (element.type === 'checkbox') {
|
||||
element.checked = jsonObject[key] === '1';
|
||||
} else if (element.type === 'radio') {
|
||||
element.checked = element.value === jsonObject[key];
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (jsonObject[key] == undefined) {
|
||||
element.value = " ";
|
||||
} else {
|
||||
|
||||
element.value = jsonObject[key];
|
||||
console.log(element);
|
||||
console.log(jsonObject[key]);
|
||||
console.log(element.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
$('#sum_insured_others').trigger('keyup');
|
||||
$(".multiple_sum_insured").trigger("keyup");
|
||||
|
||||
|
||||
},
|
||||
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log('Something Wrong!', 'warning');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
document.getElementById('otherButtonSpecialCondition').addEventListener('click', function(event) {
|
||||
|
||||
console.log('specialConditionForOthers callback clicked')
|
||||
event.preventDefault();
|
||||
specialConditionForOthers();
|
||||
|
||||
});
|
||||
|
||||
|
||||
function specialConditionForOthers(count = 0) {
|
||||
|
||||
console.log('specialConditionForOthers function called')
|
||||
|
||||
console.log('before if count', count)
|
||||
|
||||
if (count === 0) {
|
||||
|
||||
console.log('after if count', count)
|
||||
|
||||
var index = $('.modifyclassinput').length;
|
||||
var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
|
||||
|
||||
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;position: relative;bottom: 6px;">
|
||||
<input class="form-control" name="other_special_condition_label[]" id="other_special_condition_label[]" style="position: relative;right: 15px;">
|
||||
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
|
||||
</label>
|
||||
|
||||
<input type="text" name="other_special_condition_input[]" id="other_special_condition_input[]" class="form-control s special_condition_input[]">
|
||||
</div>`;
|
||||
console.log($(this));
|
||||
$('.other_special_condition').each(function() {
|
||||
$(this).append(appendElement);
|
||||
});
|
||||
} else {
|
||||
|
||||
console.log('else')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(document).on('click', '#otherPolicyTermsClose', function() {
|
||||
$('#OtherPolicyTermsForm').css('display', 'none');
|
||||
$('#police-tab').css('display', '');
|
||||
$('.nav.nav-pills.navtab-bg').css('display', '');
|
||||
$('.nav.nav-pills.navtab-bg').prev().css('display', '');
|
||||
$('#otherPolicyTerms')[0].reset();
|
||||
$('.text-danger-2').html('');
|
||||
});
|
||||
|
||||
|
||||
$("#sum_insured_others").on("keyup", function() {
|
||||
var inputNumber = $(this).val();
|
||||
console.log('sum_insured_others keyup', inputNumber)
|
||||
if (inputNumber) {
|
||||
var result = convertCommaNumberToWords(inputNumber);
|
||||
$("#numberToWordOthers").text(result);
|
||||
} else {
|
||||
$("#numberToWordOthers").text("");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#totalSumInsured").on("keyup", function() {
|
||||
var inputNumber = $(this).val();
|
||||
if (inputNumber) {
|
||||
var result = convertCommaNumberToWords(inputNumber);
|
||||
$("#numberToWordTotalSumInsured").text(result);
|
||||
} else {
|
||||
$("#numberToWordTotalSumInsured").text("");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function si_keup_num_to_word2(input) {
|
||||
|
||||
console.log('keyup sum insured');
|
||||
var inputNumber = $(input).val();
|
||||
console.log(inputNumber)
|
||||
if (inputNumber) {
|
||||
var result = convertCommaNumberToWords(inputNumber);
|
||||
|
||||
$("#numberToWordOthers").text(result);
|
||||
} else {
|
||||
$("#numberToWordOthers").text("");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function appendPolicyTermsHTML(policy_type) {
|
||||
|
||||
var termsHTML = ""
|
||||
$('#append_html_for_other_policy_terms').empty();
|
||||
|
||||
if (policy_type == 7) {
|
||||
|
||||
termsHTML = `
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="sumInsured">Sum Insured</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
|
||||
</div>
|
||||
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div id='numberToWordOthers' class="text-danger-2" ></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="sum_insured_add_more" ></div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Policy Type</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="policy_type" id="policy_type" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Existing Insurer</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="existing_insurer" id="existing_insurer" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="renewal_lives">Renewal Lives</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="renewal_lives" id="renewal_lives" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Total Sum Assured</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" style="width: 100% !important;" class="form-control" name="total_sum_insured"
|
||||
id="total_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div id='numberToWordTotalSumInsured' class="text-danger-2"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="lives_at_inception">Lives at Inception</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="lives_at_inception" id="lives_at_inception" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Total Sum Insured at Inception</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="total_sum_insured_at_inception" id="total_sum_insured_at_inception"
|
||||
class="form-control" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Premium at Inception (Excl GST)</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="premium_at_inception" id="premium_at_inception" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="coverage">Coverage</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="coverage " id="coverage" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="free_cover_limit">Free Cover Limit</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="free_cover_limit" id="free_cover_limit" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
`
|
||||
|
||||
} else if (policy_type == 6) {
|
||||
|
||||
termsHTML = `
|
||||
|
||||
<div class="form-group EDLI">
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="sumInsured">Sum Insured</label>
|
||||
</div>
|
||||
<div class="col-md-4" >
|
||||
<input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
|
||||
</div>
|
||||
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div id='numberToWordOthers' class="text-danger-2" ></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="sum_insured_add_more" ></div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Existing Insurer</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="existing_insurer" id="existing_insurer" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="renewal_lives">Renewal Lives</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="renewal_lives" id="renewal_lives" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="lives_at_inception">Lives at Inception</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="lives_at_inception" id="lives_at_inception" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Total Sum Insured at Inception</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="total_sum_insured_at_inception" id="total_sum_insured_at_inception"
|
||||
class="form-control" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="coverage">Coverage</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="coverage " id="coverage" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="free_cover_limit">Free Cover Limit for Base Cover</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="free_cover_limit_for_base_cover" id="free_cover_limit_for_base_cover" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
`
|
||||
}
|
||||
|
||||
$('#append_html_for_other_policy_terms').append(termsHTML);
|
||||
}
|
||||
|
||||
|
||||
function appendOtherSIAddMore(data = null) {
|
||||
|
||||
const addMoreContainer = document.getElementById('sum_insured_add_more');
|
||||
|
||||
console.log(addMoreContainer)
|
||||
|
||||
const 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 style="width: 128%;" value="${data ? data : ''}" type="text" name="multiple_sum_insured[]" class="form-control multiple_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this); numtowordinkeyup(this)">
|
||||
</div>
|
||||
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||
<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="appendOtherSIAddMore()">+</button>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="text-danger-2 numberToWordSumInsured"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
addMoreContainer.insertAdjacentHTML('beforeend', html);
|
||||
}
|
||||
</script>
|
||||
@ -110,9 +110,12 @@
|
||||
<div class="col-md-6">
|
||||
<label for="sumInsured">Sum Insured</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="sum_insured" id="sum_insured" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this)">
|
||||
<div class="col-md-4">
|
||||
<input style="width: 128%;" type="text" name="sum_insured" id="sum_insured" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word(this)">
|
||||
</div>
|
||||
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||
<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" onchange="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" onchange="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" onchange="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" onchange="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%; width: 30%;background: lightgray;" type="number" name="elder_member_count" id="member_count" readonly></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" onchange="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" onchange="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>
|
||||
@ -445,7 +507,7 @@
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">AYUSH treatment cover Data</label>
|
||||
<label for="totalSumInsured">AYUSH treatment cover Limit</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="ayushTreatmentCoverData" id="ayushTreatmentCoverData" class="form-control">
|
||||
@ -575,7 +637,7 @@
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Cataract Data</label>
|
||||
<label for="totalSumInsured">Cataract Limit</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="cataractData" id="cataractData" class="form-control">
|
||||
@ -615,7 +677,7 @@
|
||||
|
||||
|
||||
// $('input[name="family_floater"]').change(function() {
|
||||
// console.log($(this).val());
|
||||
// //console.log($(this).val());
|
||||
// if ($(this).val() == '1') {
|
||||
// var element = $(this).parent().next()[0];
|
||||
// $(element).css("display", "block");
|
||||
@ -631,7 +693,7 @@
|
||||
|
||||
$('input[name="ayudhtreatmentcover"]').change(function() {
|
||||
|
||||
console.log($(this).val());
|
||||
////console.log($(this).val());
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
@ -645,7 +707,7 @@
|
||||
|
||||
$('input[name="cataract"]').change(function() {
|
||||
|
||||
console.log($(this).val());
|
||||
//console.log($(this).val());
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
@ -715,7 +777,7 @@
|
||||
}
|
||||
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
//console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -751,7 +813,7 @@
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log('Something Wrong!', 'warning');
|
||||
//console.log('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
@ -773,14 +835,15 @@
|
||||
$('body').on('click', '.btnPolicyMaster', function() {
|
||||
|
||||
var client_policy_id = $(this).data('id');
|
||||
console.log('gmc_client_policy_id :', client_policy_id);
|
||||
//console.log('gmc_client_policy_id :', client_policy_id);
|
||||
|
||||
$('#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)
|
||||
// //console.log(gmc_policy_type_id)
|
||||
|
||||
if (gmc_policy_type_id == 'GMC') {
|
||||
|
||||
@ -798,10 +861,10 @@
|
||||
client_policy_id: client_policy_id
|
||||
},
|
||||
success: function(response) {
|
||||
console.log('response', response);
|
||||
//console.log('response', response);
|
||||
|
||||
|
||||
// console.log('count', response.count);
|
||||
// //console.log('count', response.count);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
@ -809,18 +872,18 @@
|
||||
$('#nameOfThePolicyInGMC').html(' - ' + response.policy_name.name);
|
||||
$('gmc_emp_count').val(response.count);
|
||||
|
||||
// console.log('count--1', response.count);
|
||||
// //console.log('count--1', response.count);
|
||||
// $('emp_count').val(response.count)
|
||||
// if (response && response.hasOwnProperty('count')) {
|
||||
// if (response.count === false) {
|
||||
// console.log('count -- 2', response.count);
|
||||
// console.log(document.getElementById('btnGridSubmit1'))
|
||||
// //console.log('count -- 2', response.count);
|
||||
// //console.log(document.getElementById('btnGridSubmit1'))
|
||||
// $("#btnGridSubmit1").hide();
|
||||
// $("#myButtonSpecialCondition").hide();
|
||||
// } else {
|
||||
// $("#btnGridSubmit1").show();
|
||||
// $("#myButtonSpecialCondition").show();
|
||||
// console.log('count -- ', response.count);
|
||||
// //console.log('count -- ', response.count);
|
||||
// }
|
||||
// } else {
|
||||
// console.error('Response object does not have a "count" property or is invalid.');
|
||||
@ -849,13 +912,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
console.log('key', key)
|
||||
//console.log('key', key)
|
||||
let elements = document.getElementsByName(`${key}[]`);
|
||||
console.log(elements)
|
||||
//console.log(elements)
|
||||
|
||||
if (elements) {
|
||||
elements.forEach((element, index) => {
|
||||
console.log()
|
||||
//console.log()
|
||||
if(jsonObject[key][index] == undefined){
|
||||
element.value = " ";
|
||||
}else{
|
||||
@ -865,12 +928,30 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (key.includes("multiple_sum_insured")) {
|
||||
// jsonObject[key].forEach((value, index) => {
|
||||
// appendGMCSIAddMore(value);
|
||||
// });
|
||||
// }
|
||||
|
||||
if (key.includes("multiple_sum_insured") && key != "") {
|
||||
|
||||
if (Array.isArray(jsonObject[key])) {
|
||||
jsonObject[key].forEach((value, index) => {
|
||||
appendGMCSIAddMore(value);
|
||||
});
|
||||
} else {
|
||||
console.error(`${key} is not an array.`);
|
||||
}
|
||||
}
|
||||
|
||||
if (key.includes("family_floaters")) {
|
||||
let checkboxes = document.querySelectorAll(`input[name="${key}[]"]`);
|
||||
if (jsonObject[key]) {
|
||||
|
||||
console.log(jsonObject[key]);
|
||||
// console.log(jsonObject[key]);
|
||||
//console.log(jsonObject[key]);
|
||||
// //console.log(jsonObject[key]);
|
||||
if (jsonObject[key].childrens) {
|
||||
$('#children').val(jsonObject[key].childrens);
|
||||
}
|
||||
@ -916,8 +997,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 +1023,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');
|
||||
@ -998,7 +1084,7 @@
|
||||
pTag.innerHTML = jsonObject[key]; // Add your new content inside the <p> tag
|
||||
}
|
||||
}
|
||||
// console.log(jsonObject[key]);
|
||||
// //console.log(jsonObject[key]);
|
||||
} else {
|
||||
|
||||
if(jsonObject[key] == undefined){
|
||||
@ -1027,7 +1113,8 @@
|
||||
});
|
||||
}
|
||||
$("#sum_insured").trigger("keyup");
|
||||
|
||||
$(".multiple_sum_insured").trigger("keyup");
|
||||
|
||||
$('.jodit-wysiwyg').each(function() {
|
||||
$(this).click();
|
||||
});
|
||||
@ -1047,8 +1134,8 @@
|
||||
$('.spouse-age').css('display','none');
|
||||
}
|
||||
|
||||
console.log("child ");
|
||||
console.log($('#children').val());
|
||||
//console.log("child ");
|
||||
//console.log($('#children').val());
|
||||
|
||||
if($('#children').val() != 0){
|
||||
$('.child-age').css('display','');
|
||||
@ -1087,7 +1174,7 @@
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log('Something Wrong!', 'warning');
|
||||
//console.log('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
@ -1109,8 +1196,8 @@
|
||||
$('.spouse-age').css('display','none');
|
||||
}
|
||||
|
||||
console.log("child ");
|
||||
console.log($('#children').val());
|
||||
//console.log("child ");
|
||||
//console.log($('#children').val());
|
||||
|
||||
if($('#children').val() != 0){
|
||||
$('.child-age').css('display','');
|
||||
@ -1145,8 +1232,11 @@
|
||||
|
||||
});
|
||||
|
||||
$("#sum_insured").on("keyup", function() {
|
||||
var inputNumber = $(this).val();
|
||||
function si_keup_num_to_word(input) {
|
||||
|
||||
console.log('keyup sum insured');
|
||||
var inputNumber = $(input).val();
|
||||
console.log(inputNumber)
|
||||
if (inputNumber) {
|
||||
var result = convertCommaNumberToWords(inputNumber);
|
||||
|
||||
@ -1154,7 +1244,7 @@
|
||||
} else {
|
||||
$("#numberToWordGMC").text("");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
@ -1179,7 +1269,7 @@
|
||||
<script>
|
||||
document.getElementById('myButtonSpecialCondition').addEventListener('click', function(event) {
|
||||
|
||||
console.log('specialCondition callback clicked')
|
||||
//console.log('specialCondition callback clicked')
|
||||
event.preventDefault();
|
||||
specialCondition();
|
||||
|
||||
@ -1188,13 +1278,13 @@
|
||||
|
||||
function specialCondition(count = 0) {
|
||||
|
||||
console.log('specialCondition function called')
|
||||
//console.log('specialCondition function called')
|
||||
|
||||
console.log('before if count', count)
|
||||
//console.log('before if count', count)
|
||||
|
||||
if (count === 0) {
|
||||
|
||||
console.log('after if count', count)
|
||||
//console.log('after if count', count)
|
||||
|
||||
var index = $('.modifyclassinput').length;
|
||||
var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
|
||||
@ -1204,13 +1294,13 @@
|
||||
</label>
|
||||
<input type="text" name="special_condition_input[]" id="special_condition_input[]" class="form-control s special_condition_input[]">
|
||||
</div>`;
|
||||
console.log($(this));
|
||||
//console.log($(this));
|
||||
$('.form-column').each(function() {
|
||||
$(this).append(appendElement);
|
||||
});
|
||||
} else {
|
||||
|
||||
console.log('else')
|
||||
//console.log('else')
|
||||
}
|
||||
}
|
||||
|
||||
@ -1319,12 +1409,45 @@
|
||||
|
||||
|
||||
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 style="width: 128%;" 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); numtowordinkeyup(this)">
|
||||
</div>
|
||||
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||
<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>
|
||||
<div class="col-md-6">
|
||||
<div class="text-danger-2 numberToWordSumInsured"></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">
|
||||
<input class="form-control" type="text" name="sumInsured2" id="sumInsured2" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" style="width: 100% !important;">
|
||||
<div class="col-md-4">
|
||||
<input style="width: 128%;" 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" style="position: relative;left: 88px;">
|
||||
<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" onchange="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" onchange="lowerIsEighteen(this)">
|
||||
</div>
|
||||
</td>
|
||||
<td ></td>
|
||||
@ -569,6 +574,18 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (key.includes("multiple_sum_insured") && key != "") {
|
||||
|
||||
if (Array.isArray(gpaJsonObjectForSpecialCondition[key])) {
|
||||
gpaJsonObjectForSpecialCondition[key].forEach((value, index) => {
|
||||
appendGPASIAddMore(value);
|
||||
});
|
||||
} else {
|
||||
console.error(`${key} is not an array.`);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
let jsonObject = JSON.parse(res.data);
|
||||
@ -634,6 +651,7 @@
|
||||
|
||||
}
|
||||
$("#sumInsured2").trigger("keyup");
|
||||
$('.multiple_sum_insured').trigger("keyup");
|
||||
$("#totalSumInsured").trigger("keyup");
|
||||
|
||||
|
||||
@ -651,7 +669,7 @@
|
||||
});
|
||||
|
||||
} else if (gpa_policy_type_id != 'GPA' && gpa_policy_type_id != 'GMC') {
|
||||
toastr.warning("This policy has no policy terms.", 'warning');
|
||||
// toastr.warning("This policy has no policy terms.", 'warning');
|
||||
}
|
||||
|
||||
});
|
||||
@ -723,6 +741,41 @@
|
||||
}
|
||||
});
|
||||
|
||||
$(".multiple_sum_insured").on("keyup", function() {
|
||||
|
||||
console.log('multiple_sum_insured key up')
|
||||
|
||||
var inputNumber = $(this).val();
|
||||
console.log('inputNumber', inputNumber);
|
||||
if (inputNumber) {
|
||||
var result = convertCommaNumberToWords(inputNumber);
|
||||
console.log(result);
|
||||
$(".numberToWordSumInsured").text(result);
|
||||
} else {
|
||||
$(".numberToWordSumInsured").text("");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function numtowordinkeyup(input){
|
||||
console.log('testing......')
|
||||
console.log(input);
|
||||
|
||||
var inputNumber = $(input).val();
|
||||
console.log('inputNumber', inputNumber);
|
||||
|
||||
if (inputNumber) {
|
||||
var result = convertCommaNumberToWords(inputNumber);
|
||||
console.log(result);
|
||||
var $parentRow = $(input).closest('.row');
|
||||
console.log('$parentRow', $parentRow)
|
||||
var $targetDiv = $parentRow.find('.numberToWordSumInsured');
|
||||
$targetDiv.text(result)
|
||||
console.log('$targetDiv', $targetDiv)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$("#totalSumInsured").on("keyup", function() {
|
||||
var inputNumber = $(this).val();
|
||||
@ -735,16 +788,29 @@
|
||||
});
|
||||
|
||||
|
||||
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 style="width: 128%;" 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); numtowordinkeyup(this)">
|
||||
</div>
|
||||
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||
<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>
|
||||
<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>
|
||||
File diff suppressed because it is too large
Load Diff
@ -30,383 +30,546 @@ 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 key;
|
||||
switch (formatType) {
|
||||
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);
|
||||
var si_or_bp = $('#si_or_bp').val();
|
||||
var key;
|
||||
switch (formatType) {
|
||||
|
||||
case 1:
|
||||
if (si_or_bp == 1) {
|
||||
key = cells[0] + "|" + cells[1] // Sum Insured, Premium
|
||||
} 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(secondKey != 2){
|
||||
console.log(secondKey)
|
||||
if ($('.duplicate').length > 0) {
|
||||
console.log('test');
|
||||
//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) {
|
||||
if (emptyCellCount > 0) {
|
||||
toastr.warning('Number of empty cells: ' + emptyCellCount);
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
}
|
||||
submitData(rack_rate_type);
|
||||
}
|
||||
|
||||
let formatType = $('#grid').val();
|
||||
var table = $('#excel_table table');
|
||||
var obj = $('#grid');
|
||||
function submitData(rack_rate_type) {
|
||||
|
||||
if(rack_rate_type == 1){
|
||||
let formatType = $('#grid').val();
|
||||
var table = $('#excel_table table');
|
||||
var obj = $('#grid');
|
||||
|
||||
formatType = $('#additional_grid').val();
|
||||
table = $('#additional_excel_table table');
|
||||
obj = $('#additional_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');
|
||||
}
|
||||
|
||||
|
||||
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 => {
|
||||
|
||||
// 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');
|
||||
$(this).trigger('change').keyup();
|
||||
});
|
||||
|
||||
$(`input[name="${formatType}_premium[]"]`).each(function() {
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
$(this).trigger('change').keyup();
|
||||
});
|
||||
|
||||
$(`input[name="basic_pay[]"]`).each(function() {
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
$(this).trigger('change').keyup();
|
||||
});
|
||||
|
||||
$(`input[name="gpa_basic_si[]"]`).each(function() {
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
$(this).trigger('change').keyup();
|
||||
});
|
||||
|
||||
$(`input[name="gpa_basic_premium[]"]`).each(function() {
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
$(this).trigger('change').keyup();
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user