Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
9121ece484
@ -112,6 +112,7 @@ $routes->group("/employee", ["filter" => "authMVC"], function($routes){
|
||||
$routes->get("upload", "EmployeeController::employeesUplodWithEvents");
|
||||
$routes->post("upload", "EmployeeController::employeesUplodWithEvents");
|
||||
$routes->get("excel_error/(:any)", "EmployeeController::getExcelFileErrors/$1");
|
||||
$routes->get("endorsement-list", "EmployeeController::endorsementList");
|
||||
});
|
||||
|
||||
|
||||
@ -232,7 +233,6 @@ $routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfi
|
||||
|
||||
|
||||
|
||||
|
||||
$routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
|
||||
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
||||
$routes->get("relationshipList", "EmployeeRestController::relationshipList");
|
||||
|
||||
@ -451,4 +451,17 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
|
||||
public function endorsementList(){
|
||||
$data = [];
|
||||
if(count($this->request->getGet()))
|
||||
{
|
||||
$filterData = $this->request->getGet();
|
||||
$data['employees'] = $this->employeePolicyModel->getEmployeeEndorsementList(client_id: $filterData['client_id'],policy_id: $filterData['policy_id']);
|
||||
$data['getData'] = $filterData;
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error','list called');
|
||||
$this->loadLayout('endorsement_list',$data);
|
||||
}
|
||||
}
|
||||
@ -308,134 +308,134 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function getEmployeePolicy()
|
||||
{
|
||||
try {
|
||||
$id = $this->request->getGet('id');
|
||||
$emp_code = $this->request->getGet('emp_code');
|
||||
// public function getEmployeePolicy()
|
||||
// {
|
||||
// try {
|
||||
// $id = $this->request->getGet('id');
|
||||
// $emp_code = $this->request->getGet('emp_code');
|
||||
|
||||
$keysToRemove = ["removable_keys"];
|
||||
// $keysToRemove = ["removable_keys"];
|
||||
|
||||
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
||||
// $empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
||||
|
||||
$empData = $this->employeeModel->where('emp_code',$emp_code)->findAll();
|
||||
if ($empPolicy) {
|
||||
// $empData = $this->employeeModel->where('emp_code',$emp_code)->findAll();
|
||||
// if ($empPolicy) {
|
||||
|
||||
$result = [];
|
||||
foreach ($empPolicy as $array) {
|
||||
// $result = [];
|
||||
// foreach ($empPolicy as $array) {
|
||||
|
||||
$decodedArray = json_decode($array->Policy_Terms);
|
||||
$refusingData = (object) array_diff_key((array) $decodedArray, array_flip($keysToRemove));
|
||||
// $decodedArray = json_decode($array->Policy_Terms);
|
||||
// $refusingData = (object) array_diff_key((array) $decodedArray, array_flip($keysToRemove));
|
||||
|
||||
|
||||
$array->Policy_Terms = $refusingData;
|
||||
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array->ClientPolicyId,$array->ClientId);
|
||||
$array->SlabRates = $getSlabAndGridData['slab_rates'];
|
||||
$array->GridMaster = $getSlabAndGridData['grid_master'];
|
||||
// $array->Policy_Terms = $refusingData;
|
||||
// $getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array->ClientPolicyId,$array->ClientId);
|
||||
// $array->SlabRates = $getSlabAndGridData['slab_rates'];
|
||||
// $array->GridMaster = $getSlabAndGridData['grid_master'];
|
||||
|
||||
if($getSlabAndGridData['grid_master']['policy_type'] == "GPA"){
|
||||
$default_si = $array->Policy_Terms->sumInsured2;
|
||||
$index = -1;
|
||||
foreach ($array->SlabRates as $key => $value) {
|
||||
if ($value['si'] == $default_si) {
|
||||
$index = $key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($index >= 0) {
|
||||
$element =$array->SlabRates[$index];
|
||||
array_splice($array->SlabRates, $index, 1);
|
||||
array_unshift($array->SlabRates, $element);
|
||||
}
|
||||
// if($getSlabAndGridData['grid_master']['policy_type'] == "GPA"){
|
||||
// $default_si = $array->Policy_Terms->sumInsured2;
|
||||
// $index = -1;
|
||||
// foreach ($array->SlabRates as $key => $value) {
|
||||
// if ($value['si'] == $default_si) {
|
||||
// $index = $key;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if ($index >= 0) {
|
||||
// $element =$array->SlabRates[$index];
|
||||
// array_splice($array->SlabRates, $index, 1);
|
||||
// array_unshift($array->SlabRates, $element);
|
||||
// }
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$id)->where('client_policy_id',$array->ClientPolicyId)->get()->getRow();
|
||||
if($employee_policy){
|
||||
$gpaSI['family_floater_key'] = 'self';
|
||||
$gpaSI['label'] = 'Self';
|
||||
$gpaSI['employee_id'] = $employee_policy->employee_id;
|
||||
$gpaSI['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
|
||||
$gpaSI['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
|
||||
$gpaSI['client_policy_id'] = $array->ClientPolicyId;
|
||||
// $employee_policy = $this->employeePolicyModel->where('employee_id',$id)->where('client_policy_id',$array->ClientPolicyId)->get()->getRow();
|
||||
// if($employee_policy){
|
||||
// $gpaSI['family_floater_key'] = 'self';
|
||||
// $gpaSI['label'] = 'Self';
|
||||
// $gpaSI['employee_id'] = $employee_policy->employee_id;
|
||||
// $gpaSI['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
|
||||
// $gpaSI['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
|
||||
// $gpaSI['client_policy_id'] = $array->ClientPolicyId;
|
||||
|
||||
$array->mapped_family_floaters = $gpaSI;
|
||||
}else{
|
||||
$gpaSI['family_floater_key'] = 'self';
|
||||
$gpaSI['label'] = 'Self';
|
||||
$gpaSI['employee_id'] = $id;
|
||||
$gpaSI['basic_cover_si'] = null;
|
||||
$gpaSI['premium'] = null;
|
||||
$gpaSI['client_policy_id'] = $array->ClientPolicyId;
|
||||
// $array->mapped_family_floaters = $gpaSI;
|
||||
// }else{
|
||||
// $gpaSI['family_floater_key'] = 'self';
|
||||
// $gpaSI['label'] = 'Self';
|
||||
// $gpaSI['employee_id'] = $id;
|
||||
// $gpaSI['basic_cover_si'] = null;
|
||||
// $gpaSI['premium'] = null;
|
||||
// $gpaSI['client_policy_id'] = $array->ClientPolicyId;
|
||||
|
||||
$array->mapped_family_floaters = $gpaSI;
|
||||
}
|
||||
// $array->mapped_family_floaters = $gpaSI;
|
||||
// }
|
||||
|
||||
}else if($getSlabAndGridData['grid_master']['policy_type'] == "GMC"){
|
||||
// }else if($getSlabAndGridData['grid_master']['policy_type'] == "GMC"){
|
||||
|
||||
// re-arranging order of si
|
||||
$default_si = $array->Policy_Terms->sum_insured;
|
||||
// Filter the array using the callback function
|
||||
$getPremium = array_filter($array->SlabRates , function ($value) use ($default_si) { return $value['si'] == $default_si; } );
|
||||
$default_premium = $getPremium[0]['premium'];
|
||||
// // re-arranging order of si
|
||||
// $default_si = $array->Policy_Terms->sum_insured;
|
||||
// // Filter the array using the callback function
|
||||
// $getPremium = array_filter($array->SlabRates , function ($value) use ($default_si) { return $value['si'] == $default_si; } );
|
||||
// $default_premium = $getPremium[0]['premium'];
|
||||
|
||||
$index = -1;
|
||||
foreach ($array->SlabRates as $key => $value) {
|
||||
if ($value['si'] == $default_si) {
|
||||
$index = $key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($index >= 0) {
|
||||
$element =$array->SlabRates[$index];
|
||||
array_splice($array->SlabRates, $index, 1);
|
||||
array_unshift($array->SlabRates, $element);
|
||||
}
|
||||
// $index = -1;
|
||||
// foreach ($array->SlabRates as $key => $value) {
|
||||
// if ($value['si'] == $default_si) {
|
||||
// $index = $key;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if ($index >= 0) {
|
||||
// $element =$array->SlabRates[$index];
|
||||
// array_splice($array->SlabRates, $index, 1);
|
||||
// array_unshift($array->SlabRates, $element);
|
||||
// }
|
||||
|
||||
//map family floates array to employee and dependent
|
||||
$familyFloates = $array->Policy_Terms->family_floaters;
|
||||
$data = [];
|
||||
foreach ($familyFloates as $familyFloatesValue) {
|
||||
$dependent = preg_replace('/\d/', '', $familyFloatesValue);
|
||||
if(count($empData)){
|
||||
foreach ($empData as $key => $value) {
|
||||
if ($value['family_floater_key'] === $dependent) {
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->get()->getRow();
|
||||
$temp['family_floater_key'] = $familyFloatesValue;
|
||||
$temp['label'] = $value['relationship'];
|
||||
$temp['name'] = $value['name'];
|
||||
$temp['employee_id'] = $value['id'];
|
||||
$temp['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
|
||||
$temp['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
|
||||
$temp['client_policy_id'] = $array->ClientPolicyId;
|
||||
array_push($data,$temp);
|
||||
unset($empData[$key]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$array->mapped_family_floaters = $data;
|
||||
// //map family floates array to employee and dependent
|
||||
// $familyFloates = $array->Policy_Terms->family_floaters;
|
||||
// $data = [];
|
||||
// foreach ($familyFloates as $familyFloatesValue) {
|
||||
// $dependent = preg_replace('/\d/', '', $familyFloatesValue);
|
||||
// if(count($empData)){
|
||||
// foreach ($empData as $key => $value) {
|
||||
// if ($value['family_floater_key'] === $dependent) {
|
||||
// $employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->get()->getRow();
|
||||
// $temp['family_floater_key'] = $familyFloatesValue;
|
||||
// $temp['label'] = $value['relationship'];
|
||||
// $temp['name'] = $value['name'];
|
||||
// $temp['employee_id'] = $value['id'];
|
||||
// $temp['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
|
||||
// $temp['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
|
||||
// $temp['client_policy_id'] = $array->ClientPolicyId;
|
||||
// array_push($data,$temp);
|
||||
// unset($empData[$key]);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// $array->mapped_family_floaters = $data;
|
||||
|
||||
$temp2=[];
|
||||
foreach ($array->SlabRates as $key => $value) {
|
||||
$value['additional_premium'] = $value['premium'] - $default_premium;
|
||||
array_push($temp2,$value);
|
||||
}
|
||||
$array->SlabRates = $temp2;
|
||||
// $temp2=[];
|
||||
// foreach ($array->SlabRates as $key => $value) {
|
||||
// $value['additional_premium'] = $value['premium'] - $default_premium;
|
||||
// array_push($temp2,$value);
|
||||
// }
|
||||
// $array->SlabRates = $temp2;
|
||||
|
||||
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
$result[] = $array;
|
||||
}
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
// $result[] = $array;
|
||||
// }
|
||||
// return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
|
||||
// }else{
|
||||
// return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);
|
||||
// }
|
||||
// } catch (\Exception $e) {
|
||||
// return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
// }
|
||||
// }
|
||||
|
||||
// Get the RelationShip list
|
||||
|
||||
@ -451,17 +451,21 @@ class EmployeeRestController extends AdminController
|
||||
$checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id)
|
||||
->where('client_policy_id', $value->client_policy_id)
|
||||
->findAll();
|
||||
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($value->client_policy_id,$value->client_id);
|
||||
$SlabRatesArray = $getSlabAndGridData['slab_rates'];
|
||||
$premium = $this->findPremiumAmount($SlabRatesArray, $value->basic_cover_si);
|
||||
|
||||
// dd($checkIfExist);
|
||||
if ($checkIfExist) {
|
||||
|
||||
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si,$value->premium);
|
||||
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si,$premium);
|
||||
|
||||
}else{
|
||||
|
||||
$data['employee_id']= $value->employee_id;
|
||||
$data['client_policy_id']= $value->client_policy_id;
|
||||
$data['basic_cover_si']= $value->basic_cover_si;
|
||||
$data['premium']= $value->premium;
|
||||
$data['premium']= $premium;
|
||||
|
||||
$this->employeePolicyModel->insert($data);
|
||||
}
|
||||
@ -473,7 +477,15 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function findPremiumAmount($slabArray,$siAmount)
|
||||
{
|
||||
foreach ($slabArray as $key => $value) {
|
||||
if($value['si'] == $siAmount){
|
||||
return $value['premium'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
public function relationshipList()
|
||||
{
|
||||
try {
|
||||
@ -778,6 +790,112 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
public function getEmployeePolicy()
|
||||
{
|
||||
try {
|
||||
$id = $this->request->getGet('id');
|
||||
$emp_code = $this->request->getGet('emp_code');
|
||||
|
||||
$keysToRemove = ["removable_keys"];
|
||||
|
||||
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
||||
|
||||
$empData = $this->employeeModel->where('emp_code',$emp_code)->findAll();
|
||||
// print_r($empData);die;
|
||||
if ($empPolicy) {
|
||||
|
||||
$result = [];
|
||||
foreach ($empPolicy as $array) {
|
||||
|
||||
$decodedArray = json_decode($array->Policy_Terms);
|
||||
$refusingData = (object) array_diff_key((array) $decodedArray, array_flip($keysToRemove));
|
||||
|
||||
|
||||
$array->Policy_Terms = $refusingData;
|
||||
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array->ClientPolicyId,$array->ClientId);
|
||||
$array->SlabRates = $getSlabAndGridData['slab_rates'];
|
||||
$array->GridMaster = $getSlabAndGridData['grid_master'];
|
||||
|
||||
if($getSlabAndGridData['grid_master']['policy_type'] == "GPA"){
|
||||
|
||||
$selfData = array_filter($empData, fn($arr) => $arr['family_floater_key'] === 'self');
|
||||
$self['is_value_exist'] = true;
|
||||
$self['data']['family_floater_key'] = 'self';
|
||||
$self['data']['employee_id'] = $id;
|
||||
$self['data']['relationship'] = 'Self';
|
||||
$self['data']['name'] = $selfData[0]['name'];
|
||||
$self['data']['dob'] = $selfData[0]['dob'];
|
||||
$self['data']['client_policy_id'] = $array->ClientPolicyId;
|
||||
|
||||
$array->mapped_family_floaters = $self;
|
||||
|
||||
|
||||
if($this->request->getGet('policy') == 'GPA'){
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $array], 200);
|
||||
}
|
||||
|
||||
}else if($getSlabAndGridData['grid_master']['policy_type'] == "GMC"){
|
||||
|
||||
|
||||
|
||||
//map family floates array to employee and dependent
|
||||
$familyFloates = $array->Policy_Terms->family_floaters;
|
||||
$data = [];
|
||||
foreach ($familyFloates as $familyFloatesValue) {
|
||||
$dependent = preg_replace('/\d/', '', $familyFloatesValue);
|
||||
if(count($empData)){
|
||||
foreach ($empData as $key => $value) {
|
||||
if ($value['family_floater_key'] === $dependent) {
|
||||
$temp['is_value_exist'] = true;
|
||||
$temp['data']['family_floater_key'] = $familyFloatesValue;
|
||||
$temp['data']['employee_id'] = $value['id'];
|
||||
$temp['data']['relationship'] = $value['relationship'];
|
||||
$temp['data']['name'] = $value['name'];
|
||||
$temp['data']['dob'] = $value['dob'];
|
||||
$temp['data']['client_policy_id'] = $array->ClientPolicyId;
|
||||
array_push($data,$temp);
|
||||
unset($empData[$key]);
|
||||
$familyFloates = array_diff($familyFloates, [$familyFloatesValue]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($familyFloates as $familyFloatesValue) {
|
||||
|
||||
$temp2['is_value_exist'] = false;
|
||||
$temp2['data']['family_floater_key'] = $familyFloatesValue;
|
||||
$temp2['data']['client_policy_id'] = $array->ClientPolicyId;
|
||||
$temp2['data']['button_name'] = 'Add '.ucfirst(preg_replace('/\d/', '', $familyFloatesValue));
|
||||
$temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue);
|
||||
|
||||
array_push($data,$temp2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$array->mapped_family_floaters = $data;
|
||||
|
||||
|
||||
|
||||
if($this->request->getGet('policy') == 'GMC'){
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $array], 200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$result[] = $array;
|
||||
}
|
||||
//return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -71,12 +71,13 @@ class ClientPolicyModel extends Model
|
||||
->select('policy_type.policy_type as policy_type_name')
|
||||
->select('insurer_branch.branch_name as insurer_branch_name, insurer_branch.branch_code as insurer_branch_code')
|
||||
->select('tpa_branch.branch_name as tpa_branch_name, tpa_branch.branch_code as tpa_branch_code')
|
||||
->select('policy_type.policy_type as policy_type_name')
|
||||
->join('insurers', 'insurers.id = client_policy.insurer_id')
|
||||
->join('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id')
|
||||
->join('tpa', 'tpa.id = client_policy.tpa_id')
|
||||
->join('tpa_branch', 'client_policy.tpa_branch_id = tpa_branch.id')
|
||||
->join('policies', 'policies.id = client_policy.policy_id')
|
||||
->join('policy_type', 'policy_type.id = policies.policy_type_id')
|
||||
->join('policy_type', 'policy_type.id = policies.policy_type_id')
|
||||
->where('client_policy.client_id', $client_id)
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
@ -560,6 +560,23 @@ class EmployeePolicyModel extends Model
|
||||
$this->query($query);
|
||||
}
|
||||
|
||||
|
||||
public function getEmployeeEndorsementList($client_id,$policy_id)
|
||||
{
|
||||
$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'])
|
||||
->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') //tpam - tpa master
|
||||
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id') //tpab - tpa brach
|
||||
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
||||
->where('emp.client_id',$client_id)
|
||||
->where('employee_polices.client_policy_id',$policy_id)
|
||||
->findAll();
|
||||
return ($result);
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
|
||||
}
|
||||
|
||||
@ -36,8 +36,8 @@
|
||||
<form role="form" class="parsley-examples" method="post" id="policy_form"
|
||||
enctype="multipart/form-data">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="policy_PrimaryKey" />
|
||||
<input type="hidden" id="policy_form_action" />
|
||||
<input type="hidden" name="PrimaryKey" id="policy_PrimaryKey"/>
|
||||
<input type="hidden" id="policy_form_action"/>
|
||||
<input type="hidden" name="policy_type_id" id="policy_type_id"/>
|
||||
<input type="hidden" name="client_id" id="client_id_policy" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<div class="form-group">
|
||||
@ -94,12 +94,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <hr> -->
|
||||
<div id="policy_fields"></div>
|
||||
|
||||
<div id="policy_fields"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnSubmit">Submit</button>
|
||||
@ -159,6 +157,7 @@
|
||||
|
||||
|
||||
$('.btnAdd').click(function(){
|
||||
$('#policy_form')[0].reset();
|
||||
$('#add_form').show();
|
||||
$('#table_list').hide();
|
||||
$('.btnBack').show();
|
||||
@ -170,12 +169,13 @@
|
||||
$('#policy').html('<option value="" selected>Select Policy</option>');
|
||||
$('#is_addon').prop('checked', false);
|
||||
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
|
||||
$('#policy_status_field').hide()
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('.btnBack').click(function(){
|
||||
|
||||
$('#policy_form')[0].reset();
|
||||
$('#GMC').remove();
|
||||
$('#GPA').remove();
|
||||
$('#add_form').hide();
|
||||
@ -194,10 +194,22 @@
|
||||
if (policy_PrimaryKey !== '') {
|
||||
var policyTable = '';
|
||||
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
||||
console.log('client_policy_data',data)
|
||||
data.forEach(function(item) {
|
||||
// console.log("----------------------------");
|
||||
|
||||
// console.log(item);
|
||||
var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc'
|
||||
var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
|
||||
var subject = item.policy_type_name;
|
||||
|
||||
if (patternGMC.test(subject)) {
|
||||
search_term = 'GMC';
|
||||
} else if (patternGPA.test(subject)) {
|
||||
search_term = 'GPA';
|
||||
} else {
|
||||
search_term = subject; // Set default value if neither 'GMC' nor 'GPA' exists
|
||||
}
|
||||
|
||||
console.log('search_term :', search_term)
|
||||
|
||||
policyTable += `
|
||||
<tr>
|
||||
@ -211,8 +223,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="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal" id="${item.policy_type_id}"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.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>Rac Rate</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>Rac Rate</a>
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a>
|
||||
</div>
|
||||
</div>
|
||||
@ -271,7 +283,7 @@
|
||||
success: function(res) {
|
||||
|
||||
console.log(res);
|
||||
|
||||
$('#policy_form')[0].reset();
|
||||
if (res.status === false) {
|
||||
toastr.error('Policy Dose Not Create', 'Error');
|
||||
return;
|
||||
@ -295,6 +307,21 @@
|
||||
$('#policy_table tr').remove();
|
||||
var policyTable = '';
|
||||
$.each(res.data, function(index, item) {
|
||||
|
||||
var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc'
|
||||
var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
|
||||
var subject = item.policy_type_name;
|
||||
|
||||
if (patternGMC.test(subject)) {
|
||||
search_term = 'GMC';
|
||||
} else if (patternGPA.test(subject)) {
|
||||
search_term = 'GPA';
|
||||
} else {
|
||||
search_term = subject; // Set default value if neither 'GMC' nor 'GPA' exists
|
||||
}
|
||||
|
||||
console.log('search_term :', search_term)
|
||||
|
||||
policyTable += `
|
||||
<tr>
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
@ -307,7 +334,7 @@
|
||||
<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}" class="dropdown-item btnPolicyMaster" data-toggle="modal" id="${item.policy_type_id}"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" class="dropdown-item btnPolicyMaster" data-toggle="modal" id="${search_term}"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.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>Rac Rate</a>
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a>
|
||||
</div>
|
||||
|
||||
@ -75,7 +75,7 @@ table.dataTable tbody td {
|
||||
<!-- <th class="font-weight-medium">Employee code</th> -->
|
||||
<th class="font-weight-medium">Name/code</th>
|
||||
<th class="font-weight-medium">Policy name</th>
|
||||
<th class="font-weight-medium">Insurar name</th>
|
||||
<th class="font-weight-medium">Insurer name</th>
|
||||
<th class="font-weight-medium">TPA ID</th>
|
||||
<th class="font-weight-medium">UHID ID</th>
|
||||
<th class="font-weight-medium">Policy status</th>
|
||||
|
||||
259
app/Views/endorsement_list.php
Normal file
259
app/Views/endorsement_list.php
Normal file
@ -0,0 +1,259 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-6">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card mb-1">
|
||||
<h5 class="m-1">
|
||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
|
||||
aria-expanded="true">
|
||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||
</a>
|
||||
</h5>
|
||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<!-- <div class="text-center"> -->
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Client</label> <br />
|
||||
<select class="form-control" id="clients">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Policy</label> <br />
|
||||
<select class="form-control" id="policies">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12" style="text-align: right;">
|
||||
<a href="<?= base_url("employee/endorsement-list"); ?>"
|
||||
class="btn btn-primary waves-effect waves-light" id="get-emp-list"
|
||||
onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="row" id="client_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">Endorsement List</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
||||
id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">SNO</th>
|
||||
<th class="font-weight-medium">Name/code</th>
|
||||
<th class="font-weight-medium">Policy name</th>
|
||||
<th class="font-weight-medium">Insurar name</th>
|
||||
<th class="font-weight-medium">TPA ID</th>
|
||||
<th class="font-weight-medium">UHID ID</th>
|
||||
<th class="font-weight-medium">Policy status</th>
|
||||
<th class="font-weight-medium">Premium</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="font-12">
|
||||
<?php
|
||||
if(isset($employees))
|
||||
{
|
||||
foreach ($employees as $key => $employee) { ?>
|
||||
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1)?></b></td>
|
||||
<!-- <td><?php echo $employee['emp_code']?></td> -->
|
||||
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> )</td>
|
||||
<td><?php echo $employee['policy_name']?></td>
|
||||
<td><?php echo $employee['insurer_short_name']?></td>
|
||||
<td><?php echo $employee['tpa_id']?></td>
|
||||
<td><?php echo $employee['uhid']?></td>
|
||||
<td><span class="badge badge-success">active</span></td>
|
||||
<td><?php echo $employee['premium']?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<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 class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
Ticket</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-check-all mr-2 text-muted font-18 vertical-middle"></i>Close</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Remove</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-star mr-2 font-18 text-muted vertical-middle"></i>Mark as
|
||||
Unread</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }}?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
<div id="loader" class="loader" style="display:none;">SPINNER</div>
|
||||
|
||||
<script>
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
|
||||
$(document).ready(function() {
|
||||
console.log("document loaded");
|
||||
//fetchClientPolicies();
|
||||
|
||||
});
|
||||
|
||||
$(window).on("load", function() {
|
||||
console.log("window loaded");
|
||||
fetchClientPolicies();
|
||||
|
||||
});
|
||||
|
||||
|
||||
function fetchClientPolicies() {
|
||||
$('#loader').show();
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
||||
console.log('fetchClientPolicies');
|
||||
console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
// console.log(response.code);
|
||||
// console.log(response.dataStatus);
|
||||
// console.log(response.data);
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
clientPolicies = (response.data);
|
||||
// console.log(clientPolicies);
|
||||
appendClients(clientPolicies);
|
||||
} catch (error) {
|
||||
console.error('Error parsing API response data:', error);
|
||||
}
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
}
|
||||
});
|
||||
|
||||
$('#loader').hide();
|
||||
}
|
||||
|
||||
|
||||
function appendClients(data) {
|
||||
$.each(data, function(index, item) {
|
||||
$('#clients').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
function appendPolicies(data) {
|
||||
$('#policies').empty();
|
||||
$('#policies').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
$('#policies').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.name
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
$('#clients').on('change', function() {
|
||||
var selectedClient = $(this).val();
|
||||
console.log(selectedClient);
|
||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||
|
||||
// Check if the selected option exists in apiData
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
return item.id === selectedClient;
|
||||
});
|
||||
console.log(foundPolicies.policies);
|
||||
appendPolicies(foundPolicies.policies);
|
||||
});
|
||||
|
||||
// Function to convert object to query parameters
|
||||
function objectToQueryString(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
|
||||
function fetchEmpolyeeList(event) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
var client_id = $('#clients').val();
|
||||
var policy_id = $('#policies').val();
|
||||
console.log(client_id + '-' + policy_id);
|
||||
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
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
|
||||
}
|
||||
|
||||
document.getElementById('toggleIcon').addEventListener('click', function() {
|
||||
var icon = document.getElementById('icon');
|
||||
icon.classList.toggle('mdi-chevron-down');
|
||||
icon.classList.toggle('mdi-chevron-up');
|
||||
});
|
||||
</script>
|
||||
@ -324,6 +324,7 @@ $(document).ready(function () {
|
||||
|
||||
|
||||
function removeKYCDocs(element) {
|
||||
var kyc_docs_id_for_reload = $('#kyc_type_id').val();
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/kyc/kycdocs/remove/") ?>' + id;
|
||||
$.ajax({
|
||||
@ -338,7 +339,8 @@ $(document).ready(function () {
|
||||
if (res.status == true) {
|
||||
toastr.success('Remove Done!', 'success');
|
||||
|
||||
location.reload();
|
||||
// location.reload();
|
||||
window.location.href = '<?= base_url("master/kyc/list/") ?>' + kyc_docs_id_for_reload;
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
|
||||
@ -340,57 +340,58 @@ $(document).ready(function () {
|
||||
function loadPoliciesList() {
|
||||
var base_url = '<?= base_url("master/policy/policies/list/"); ?>';
|
||||
|
||||
var insurer_branch_action = base_url + policy_type_PrimaryKey;
|
||||
var insurer_branch_action = base_url + policy_type_PrimaryKey;
|
||||
|
||||
if ($('#policy_type_id').val() != '') {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: insurer_branch_action,
|
||||
type: 'GET',
|
||||
success: function(response) {
|
||||
if ($('#policy_type_id').val() != '') {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: insurer_branch_action,
|
||||
type: 'GET',
|
||||
success: function(response) {
|
||||
|
||||
console.log("response", response);
|
||||
console.log("response", response);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
var branchTable = '';
|
||||
$.each(response.policies, function(index, item) {
|
||||
console.log(item);
|
||||
branchTable += `
|
||||
<tr>
|
||||
<td value=''>${item.insurer.name}</td>
|
||||
<td>${item.policy.name}</td>
|
||||
<td>
|
||||
<a class="btnBranchEdit" data-id="${item.policy.id}"><i data-id="${item.policy.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a>
|
||||
<a style="color:#02a8b5" data-id="${item.id}" onclick="removePolicies(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#policies_list').append(branchTable);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
var branchTable = '';
|
||||
$.each(response.policies, function(index, item) {
|
||||
console.log(item);
|
||||
branchTable += `
|
||||
<tr>
|
||||
<td value=''>${item.insurer.name}</td>
|
||||
<td>${item.policy.name}</td>
|
||||
<td>
|
||||
<a class="btnBranchEdit" data-id="${item.policy.id}"><i data-id="${item.policy.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a>
|
||||
<a style="color:#02a8b5" data-id="${item.id}" onclick="removePolicies(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#policies_list').append(branchTable);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
function removePolicies(element) {
|
||||
var policy_id_for_reload = $('#policy_type_id').val()
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/policy/policies/remove/") ?>' + id;
|
||||
$.ajax({
|
||||
@ -407,7 +408,8 @@ function removePolicies(element) {
|
||||
|
||||
// $('#branch_table').empty();
|
||||
|
||||
location.reload();
|
||||
// location.reload();
|
||||
window.location.href = '<?= base_url("master/policy/list/") ?>' + policy_id_for_reload;
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
|
||||
@ -643,9 +643,9 @@ var grid_html = '';
|
||||
|
||||
|
||||
var gmc_policy_type_id = $(this).attr('id');
|
||||
|
||||
console.log(gmc_policy_type_id)
|
||||
|
||||
if(gmc_policy_type_id >= 2){
|
||||
if(gmc_policy_type_id == 'GMC'){
|
||||
|
||||
$('#policyGMCTerms').css('display', '');
|
||||
$('#police-tab').css('display', 'none');
|
||||
@ -802,6 +802,8 @@ var grid_html = '';
|
||||
}
|
||||
});
|
||||
|
||||
}else if(gmc_policy_type_id != 'GPA' && gmc_policy_type_id != 'GMC'){
|
||||
// toastr.warning('The terms has no data ', 'warning');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@ -446,7 +446,7 @@
|
||||
var gpa_policy_type_id = $(this).attr('id');
|
||||
// console.log('gpa_policy_type_id', gpa_policy_type_id)
|
||||
|
||||
if(gpa_policy_type_id == '1'){
|
||||
if(gpa_policy_type_id == 'GPA'){
|
||||
|
||||
$('#policyGPATermsForm').css('display', '');
|
||||
$('#police-tab').css('display', 'none');
|
||||
@ -548,6 +548,8 @@
|
||||
}
|
||||
});
|
||||
|
||||
}else if(gpa_policy_type_id != 'GPA' && gpa_policy_type_id != 'GMC'){
|
||||
toastr.warning("This policy has no policy terms.", 'warning');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@ -7,6 +7,9 @@
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="text-center" id="no_data"></div>
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="GridForm" 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'] : '' ?>"/>
|
||||
@ -14,7 +17,7 @@
|
||||
<input type="hidden" id="grid_emp_count"/>
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="emp_code">Policy Premium Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="grid" name="policy_grid_id" onchange="addGridHTML(event)" required>
|
||||
@ -566,105 +569,123 @@
|
||||
var client_policy_id = $(this).data('id');
|
||||
$('#client_policy_id').val(client_policy_id);
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var policy_type_string = $(this).attr('id');
|
||||
console.log('policy_type_string', policy_type_string)
|
||||
|
||||
if(policy_type_string == 'GPA' || policy_type_string == 'GMC'){
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("util/policy-premium") ?>' ,
|
||||
type: "GET",
|
||||
data: { client_policy_id: client_policy_id},
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log('res',res);
|
||||
var temp_for_premiumData = JSON.parse(res.premiumData);
|
||||
$('#GridForm').show();
|
||||
$('#no_data').html('');
|
||||
|
||||
res.premiumData= JSON.parse(res.premiumData);
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("util/policy-premium") ?>' ,
|
||||
type: "GET",
|
||||
data: { client_policy_id: client_policy_id},
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log('res',res);
|
||||
var temp_for_premiumData = JSON.parse(res.premiumData);
|
||||
|
||||
$('#nameOfThePolicy').html(' - ' + res.policy_name);
|
||||
$('#grid_emp_count').val(res.count);
|
||||
res.premiumData= JSON.parse(res.premiumData);
|
||||
|
||||
$('#nameOfThePolicy').html(' - ' + res.policy_name);
|
||||
$('#grid_emp_count').val(res.count);
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error(res.status);
|
||||
return;
|
||||
}
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error(res.status);
|
||||
return;
|
||||
}
|
||||
|
||||
var policy_grid_id_value = '';
|
||||
if (res.premiumData && res.premiumData.length > 0 && res.premiumData[0].policy_grid_id) {
|
||||
policy_grid_id_value = res.premiumData[0].policy_grid_id;
|
||||
}
|
||||
|
||||
$('#grid_content_input').empty();
|
||||
var policeGridOptionHTML = '';
|
||||
policeGridOptionHTML += ` <option value="">Select Premium Type</option>`;
|
||||
$.each(res.data, function(index, item) {
|
||||
policeGridOptionHTML += '<option data-id="'+ item.ui_type +'" value="' + item.id + '" ' + (policy_grid_id_value === item.id ? 'selected="selected"' : '') + '>' + item.policy_grid_type + '</option>';
|
||||
});
|
||||
$('#grid').html(policeGridOptionHTML);
|
||||
|
||||
var si_or_bp_value = '';
|
||||
if (res.premiumData && res.premiumData.length > 0) {
|
||||
|
||||
if(res.premiumData[0].si_or_bp){
|
||||
si_or_bp_value = res.premiumData[0].si_or_bp;
|
||||
var policy_grid_id_value = '';
|
||||
if (res.premiumData && res.premiumData.length > 0 && res.premiumData[0].policy_grid_id) {
|
||||
policy_grid_id_value = res.premiumData[0].policy_grid_id;
|
||||
}
|
||||
|
||||
addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id, si_or_bp_value);
|
||||
$('#grid_content_input').empty();
|
||||
var policeGridOptionHTML = '';
|
||||
policeGridOptionHTML += ` <option value="">Select Premium Type</option>`;
|
||||
$.each(res.data, function(index, item) {
|
||||
policeGridOptionHTML += '<option data-id="'+ item.ui_type +'" value="' + item.id + '" ' + (policy_grid_id_value === item.id ? 'selected="selected"' : '') + '>' + item.policy_grid_type + '</option>';
|
||||
});
|
||||
$('#grid').html(policeGridOptionHTML);
|
||||
|
||||
var si_or_bp_value = '';
|
||||
if (res.premiumData && res.premiumData.length > 0) {
|
||||
|
||||
res.premiumData.shift();
|
||||
$.each(res.premiumData, function(index, item){
|
||||
if (item.si_or_bp == '1') {
|
||||
appendGridtHtml('1', item);
|
||||
}else{
|
||||
appendGridtHtml(item.policy_grid_id, item);
|
||||
if(res.premiumData[0].si_or_bp){
|
||||
si_or_bp_value = res.premiumData[0].si_or_bp;
|
||||
}
|
||||
|
||||
addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id, si_or_bp_value);
|
||||
|
||||
res.premiumData.shift();
|
||||
$.each(res.premiumData, function(index, item){
|
||||
if (item.si_or_bp == '1') {
|
||||
appendGridtHtml('1', item);
|
||||
}else{
|
||||
appendGridtHtml(item.policy_grid_id, item);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
console.log("res.premiumData is undefined, null, or empty.");
|
||||
}
|
||||
|
||||
$('#bs-example-modal-lg').modal('show');
|
||||
|
||||
|
||||
$("#gpa_si").trigger("keyup");
|
||||
$("#gpa_premium").trigger("keyup");
|
||||
$('#basic_pay').trigger('keyup');
|
||||
$('#4_si').trigger('keyup');
|
||||
|
||||
$('input[name="gpa_sum_si[]"]').each(function() {
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
} else {
|
||||
console.log("res.premiumData is undefined, null, or empty.");
|
||||
}
|
||||
$('input[name="gpa_sum_premium[]"]').each(function() {
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
$('#bs-example-modal-lg').modal('show');
|
||||
var id_for_trigger =temp_for_premiumData[0].policy_grid_id;
|
||||
$(`input[name="${id_for_trigger}_si[]"]`).each(function() {
|
||||
console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
$(`input[name="${id_for_trigger}_premium[]"]`).each(function() {
|
||||
console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
} else{
|
||||
|
||||
$('#grid').empty();
|
||||
$('#nameOfThePolicy').html('');
|
||||
$('#GridForm').hide();
|
||||
$('#no_data').html('The policy has no Policy Rac Rate');
|
||||
toastr.warning("The policy has no Policy Rac Rate", "Warning")
|
||||
}
|
||||
|
||||
|
||||
$("#gpa_si").trigger("keyup");
|
||||
$("#gpa_premium").trigger("keyup");
|
||||
$('#basic_pay').trigger('keyup');
|
||||
$('#4_si').trigger('keyup');
|
||||
|
||||
$('input[name="gpa_sum_si[]"]').each(function() {
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
$('input[name="gpa_sum_premium[]"]').each(function() {
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
var id_for_trigger =temp_for_premiumData[0].policy_grid_id;
|
||||
$(`input[name="${id_for_trigger}_si[]"]`).each(function() {
|
||||
console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
$(`input[name="${id_for_trigger}_premium[]"]`).each(function() {
|
||||
console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -672,7 +693,6 @@
|
||||
var grid_id=$(this)[0].value;
|
||||
var client_policy_id =$('#client_policy_id')[0].value;
|
||||
|
||||
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
@ -1042,6 +1062,7 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
function removebutton(index, type) {
|
||||
|
||||
if(index == 0){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user