Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
971c61371f
@ -737,13 +737,13 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
public function createClientPolicyPremium()
|
||||
{
|
||||
try {
|
||||
{
|
||||
try {
|
||||
$policy_type = $this->request->getPost('policy_type');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$client_policy_id = $this->request->getPost('client_policy_id');
|
||||
$premium_type = $this->request->getPost('premium_type');
|
||||
if(!empty($client_id) && $client_id != null){
|
||||
if (!empty($client_id) && $client_id != null) {
|
||||
$client_policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
$client_id = $client_policy_data['client_id'];
|
||||
}
|
||||
@ -753,13 +753,13 @@ class ClientController extends AdminController
|
||||
$premium_multiplier = str_replace(',', '', $this->request->getPost('premium_multiplier'));
|
||||
$multiplier = str_replace(',', '', $this->request->getPost('multiplier'));
|
||||
$basic_pay = str_replace(',', '', $this->request->getPost('basic_pay'));
|
||||
|
||||
$data=[];
|
||||
|
||||
$data = [];
|
||||
$data['client_id'] = $client_id;
|
||||
$data['client_policy_id'] = $client_policy_id;
|
||||
$data['policy_grid_id'] = $policy_grid_id;
|
||||
$data['premium_type'] = $premium_type;
|
||||
|
||||
|
||||
|
||||
$premium = [];
|
||||
|
||||
@ -768,20 +768,20 @@ class ClientController extends AdminController
|
||||
} else {
|
||||
$this->policyPremium2Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update();
|
||||
}
|
||||
|
||||
|
||||
if($policy_grid_id == '1'){
|
||||
if ($si_or_bp == '1') {
|
||||
$premium=str_replace(',', '', $this->request->getPost('gpa_sum_premium[]'));
|
||||
$sum_insure=str_replace(',', '', $this->request->getPost('gpa_sum_si[]'));
|
||||
$multiplier=$this->request->getPost('gpa_sum_multiplier');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
|
||||
if ($policy_grid_id == '1') {
|
||||
if ($si_or_bp == '1') {
|
||||
$premium = str_replace(',', '', $this->request->getPost('gpa_sum_premium[]'));
|
||||
$sum_insure = str_replace(',', '', $this->request->getPost('gpa_sum_si[]'));
|
||||
$multiplier = $this->request->getPost('gpa_sum_multiplier');
|
||||
for ($i = 0; $i < count($premium); $i++) {
|
||||
$data['si'] = $sum_insure[$i];
|
||||
$data['premium'] = $premium[$i];
|
||||
$data['multiplier'] = $multiplier;
|
||||
$data['si_or_bp'] = $this->request->getPost('si_or_bp');
|
||||
|
||||
$policyPremium= $this->policyPremium1Model->insert($data);
|
||||
$policyPremium = $this->policyPremium1Model->insert($data);
|
||||
}
|
||||
} else {
|
||||
$data['premium'] = str_replace(',', '', $this->request->getPost('gpa_basic_premium'));
|
||||
@ -791,176 +791,181 @@ class ClientController extends AdminController
|
||||
$data['basic_pay'] = str_replace(',', '', $this->request->getPost('basic_pay'));
|
||||
$data['si_or_bp'] = $this->request->getPost('si_or_bp');
|
||||
|
||||
$policyPremium= $this->policyPremium1Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$policyPremium = $this->policyPremium1Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '2'){
|
||||
} else if ($policy_grid_id == '2') {
|
||||
$data['premium'] = str_replace(',', '', $this->request->getPost('gpa_premium'));
|
||||
$data['si'] = str_replace(',', '', $this->request->getPost('gpa_si'));
|
||||
|
||||
$policyPremium= $this->policyPremium1Model->insert($data);
|
||||
$policyPremium = $this->policyPremium1Model->insert($data);
|
||||
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '3'){
|
||||
$premium=$this->request->getPost('3_premium[]');
|
||||
$sum_insure =$this->request->getPost('3_si[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$insert = true;
|
||||
} else if ($policy_grid_id == '3') {
|
||||
$premium = $this->request->getPost('3_premium[]');
|
||||
$sum_insure = $this->request->getPost('3_si[]');
|
||||
for ($i = 0; $i < count($premium); $i++) {
|
||||
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
$dataa = $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '4'){
|
||||
$premium=$this->request->getPost('4_premium[]');
|
||||
$sum_insure =$this->request->getPost('4_si');
|
||||
$age_from =$this->request->getPost('4_age_from[]');
|
||||
$age_to =$this->request->getPost('4_age_to[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
} else if ($policy_grid_id == '4') {
|
||||
$premium = $this->request->getPost('4_premium[]');
|
||||
$sum_insure = $this->request->getPost('4_si');
|
||||
$age_from = $this->request->getPost('4_age_from[]');
|
||||
$age_to = $this->request->getPost('4_age_to[]');
|
||||
for ($i = 0; $i < count($premium); $i++) {
|
||||
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure);
|
||||
$data['age_from'] = $age_from[$i];
|
||||
$data['age_to'] = $age_to[$i];
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
$dataa = $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '5'){
|
||||
$premium=$this->request->getPost('5_premium[]');
|
||||
$sum_insure =$this->request->getPost('5_si[]');
|
||||
$age_from =$this->request->getPost('5_age_from[]');
|
||||
$age_to =$this->request->getPost('5_age_to[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
} else if ($policy_grid_id == '5') {
|
||||
$premium = $this->request->getPost('5_premium[]');
|
||||
$sum_insure = $this->request->getPost('5_si[]');
|
||||
$age_from = $this->request->getPost('5_age_from[]');
|
||||
$age_to = $this->request->getPost('5_age_to[]');
|
||||
for ($i = 0; $i < count($premium); $i++) {
|
||||
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['age_from'] = $age_from[$i];
|
||||
$data['age_to'] = $age_to[$i];
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
$dataa = $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '6'){
|
||||
$premium=$this->request->getPost('6_premium[]');
|
||||
$sum_insure =$this->request->getPost('6_si[]');
|
||||
$age_from =$this->request->getPost('6_age_from[]');
|
||||
$age_to =$this->request->getPost('6_age_to[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
} else if ($policy_grid_id == '6') {
|
||||
$premium = $this->request->getPost('6_premium[]');
|
||||
$sum_insure = $this->request->getPost('6_si[]');
|
||||
$age_from = $this->request->getPost('6_age_from[]');
|
||||
$age_to = $this->request->getPost('6_age_to[]');
|
||||
for ($i = 0; $i < count($premium); $i++) {
|
||||
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['age_from'] = $age_from[$i];
|
||||
$data['age_to'] = $age_to[$i];
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
$dataa = $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '7'){
|
||||
$premium=$this->request->getPost('7_premium[]');
|
||||
$sum_insure =$this->request->getPost('7_si[]');
|
||||
$age_from =$this->request->getPost('7_age_from[]');
|
||||
$age_to =$this->request->getPost('7_age_to[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
} else if ($policy_grid_id == '7') {
|
||||
$premium = $this->request->getPost('7_premium[]');
|
||||
$sum_insure = $this->request->getPost('7_si[]');
|
||||
$age_from = $this->request->getPost('7_age_from[]');
|
||||
$age_to = $this->request->getPost('7_age_to[]');
|
||||
for ($i = 0; $i < count($premium); $i++) {
|
||||
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['age_from'] = $age_from[$i];
|
||||
$data['age_to'] = $age_to[$i];
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
$dataa = $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '8'){
|
||||
$premium=$this->request->getPost('8_premium[]');
|
||||
$sum_insure =$this->request->getPost('8_si[]');
|
||||
$grade =$this->request->getPost('8_grade[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
} else if ($policy_grid_id == '8') {
|
||||
$premium = $this->request->getPost('8_premium[]');
|
||||
$sum_insure = $this->request->getPost('8_si[]');
|
||||
$grade = $this->request->getPost('8_grade[]');
|
||||
for ($i = 0; $i < count($premium); $i++) {
|
||||
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['grade'] = $grade[$i];
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
$dataa = $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '9'){
|
||||
$premium=$this->request->getPost('9_premium[]');
|
||||
$sum_insure =$this->request->getPost('9_si[]');
|
||||
$grade =$this->request->getPost('9_grade[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['grade'] = $grade[$i];
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '10'){
|
||||
$premium=$this->request->getPost('10_premium[]');
|
||||
$sum_insure =$this->request->getPost('10_si[]');
|
||||
$age_from =$this->request->getPost('10_age_from[]');
|
||||
$age_to =$this->request->getPost('10_age_to[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
} else if ($policy_grid_id == '9') {
|
||||
|
||||
$data['premium'] = str_replace(',', '', $this->request->getPost('gpa_premium'));
|
||||
$data['si'] = str_replace(',', '', $this->request->getPost('gpa_si'));
|
||||
|
||||
$policyPremium = $this->policyPremium2Model->insert($data);
|
||||
// $premium = $this->request->getPost('9_premium[]');
|
||||
// $sum_insure = $this->request->getPost('9_si[]');
|
||||
// $grade = $this->request->getPost('9_grade[]');
|
||||
// for ($i = 0; $i < count($premium); $i++) {
|
||||
// $data['premium'] = str_replace(',', '', $premium[$i]);
|
||||
// $data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
// // $data['grade'] = $grade[$i];
|
||||
// $dataa = $this->policyPremium2Model->insert($data);
|
||||
// }
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
} else if ($policy_grid_id == '10') {
|
||||
$premium = $this->request->getPost('10_premium[]');
|
||||
$sum_insure = $this->request->getPost('10_si[]');
|
||||
$age_from = $this->request->getPost('10_age_from[]');
|
||||
$age_to = $this->request->getPost('10_age_to[]');
|
||||
for ($i = 0; $i < count($premium); $i++) {
|
||||
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['age_from'] = $age_from[$i];
|
||||
$data['age_to'] = $age_to[$i];
|
||||
$policyPremium= $this->policyPremium2Model->insert($data);
|
||||
$policyPremium = $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '11'){
|
||||
$premium=$this->request->getPost('11_premium[]');
|
||||
$sum_insure =$this->request->getPost('11_si[]');
|
||||
$grade =$this->request->getPost('11_grade[]');
|
||||
$max_sum_insure =$this->request->getPost('11_max_si[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
} else if ($policy_grid_id == '11') {
|
||||
$premium = $this->request->getPost('11_premium[]');
|
||||
$sum_insure = $this->request->getPost('11_si[]');
|
||||
$grade = $this->request->getPost('11_grade[]');
|
||||
$max_sum_insure = $this->request->getPost('11_max_si[]');
|
||||
for ($i = 0; $i < count($premium); $i++) {
|
||||
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['grade'] = $grade[$i];
|
||||
$data['max_si'] = $max_sum_insure[$i];
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
$dataa = $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '12'){
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
} else if ($policy_grid_id == '12') {
|
||||
|
||||
$premium=$this->request->getPost('12_premium[]');
|
||||
$sum_insure =$this->request->getPost('12_si[]');
|
||||
$relationship =$this->request->getPost('12_relationship[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$premium = $this->request->getPost('12_premium[]');
|
||||
$sum_insure = $this->request->getPost('12_si[]');
|
||||
$relationship = $this->request->getPost('12_relationship[]');
|
||||
for ($i = 0; $i < count($premium); $i++) {
|
||||
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['relationship'] = $relationship[$i];
|
||||
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
$dataa = $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '13'){
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
} else if ($policy_grid_id == '13') {
|
||||
|
||||
$premium=$this->request->getPost('13_premium[]');
|
||||
$sum_insure =$this->request->getPost('13_si[]');
|
||||
$age_from =$this->request->getPost('13_age_from[]');
|
||||
$age_to =$this->request->getPost('13_age_to[]');
|
||||
$relationship =$this->request->getPost('13_relationship[]');
|
||||
$premium = $this->request->getPost('13_premium[]');
|
||||
$sum_insure = $this->request->getPost('13_si[]');
|
||||
$age_from = $this->request->getPost('13_age_from[]');
|
||||
$age_to = $this->request->getPost('13_age_to[]');
|
||||
$relationship = $this->request->getPost('13_relationship[]');
|
||||
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
for ($i = 0; $i < count($premium); $i++) {
|
||||
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['age_from'] = $age_from[$i];
|
||||
$data['age_to'] = $age_to[$i];
|
||||
$data['relationship'] = $relationship[$i];
|
||||
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
$dataa = $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}
|
||||
|
||||
if($insert){
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $data], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404, 'data' => $data,'message' => 'no data found'], 200);
|
||||
}
|
||||
if ($insert) {
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $data], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'data' => $data, 'message' => 'no data found'], 200);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// Handle exceptions here
|
||||
echo 'Error: ' . $e->getMessage();
|
||||
@ -1031,9 +1036,9 @@ class ClientController extends AdminController
|
||||
|
||||
$client_policy_id = $this->request->getGet('client_policy_id');
|
||||
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
$family_floater ='';
|
||||
$family_floater = '';
|
||||
if (isset(json_decode($record['policy_terms'])->family_floater)) {
|
||||
$family_floater=json_decode($record['policy_terms'])->family_floater;
|
||||
$family_floater = json_decode($record['policy_terms'])->family_floater;
|
||||
}
|
||||
|
||||
$policy_terms_data = json_decode($record['policy_terms']);
|
||||
@ -1042,19 +1047,19 @@ class ClientController extends AdminController
|
||||
$self = $policy_terms_data->family_floaters;
|
||||
}
|
||||
|
||||
$emp_count = $this->employeeModel ->join('client_policy cp',"employees.client_id = cp.client_id")
|
||||
->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
||||
->where("employees.client_id",$record['client_id'])
|
||||
->where("employees.emp_status",'active')
|
||||
->countAllResults();
|
||||
$emp_count = $this->employeeModel->join('client_policy cp', "employees.client_id = cp.client_id")
|
||||
->join('employee_polices ep', "cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
||||
->where("employees.client_id", $record['client_id'])
|
||||
->where("employees.emp_status", 'active')
|
||||
->countAllResults();
|
||||
|
||||
|
||||
$data = $this->employeePolicyModel->select('employee_polices.id')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
$data = $this->employeePolicyModel->select('employee_polices.id')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
->findAll();
|
||||
|
||||
$emp_count = count($data);
|
||||
$emp_count = count($data);
|
||||
|
||||
// if($emp_count == 0){
|
||||
// $emp_count = true;
|
||||
@ -1065,31 +1070,31 @@ class ClientController extends AdminController
|
||||
|
||||
$data = $this->policesModel->getPolicyPremium($record['policy_id']);
|
||||
$policy_name = $data[0]->policy_name;
|
||||
$gmc_pattern = '/gmc/i';
|
||||
$gpa_pattern = '/gpa/i';
|
||||
$gmc_pattern = '/gmc/i';
|
||||
$gpa_pattern = '/gpa/i';
|
||||
$subject = $data[0]->policy_type;
|
||||
if (preg_match($gmc_pattern, $subject)) {
|
||||
$search_term = 'GMC';
|
||||
} else if (preg_match($gpa_pattern, $subject)){
|
||||
} else if (preg_match($gpa_pattern, $subject)) {
|
||||
$search_term = 'GPA';
|
||||
}else{
|
||||
} else {
|
||||
$search_term = "";
|
||||
}
|
||||
|
||||
$results = $this->policyGridModel->like('policy_type', $search_term)->findAll();
|
||||
|
||||
if($search_term === 'GPA'){
|
||||
if ($search_term === 'GPA') {
|
||||
|
||||
$premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
||||
} else if ($search_term === 'GMC') {
|
||||
|
||||
}else if($search_term === 'GMC'){
|
||||
|
||||
$premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
||||
|
||||
}else{
|
||||
} else {
|
||||
|
||||
$premiumData = "";
|
||||
}
|
||||
// echo '<pre>';
|
||||
// print_r($premiumData); die;
|
||||
|
||||
// echo $record['client_id'];
|
||||
// echo "-----";
|
||||
@ -1097,8 +1102,8 @@ class ClientController extends AdminController
|
||||
// print_r($premiumData);die;
|
||||
// echo '<pre>';
|
||||
// echo $family_floater;
|
||||
|
||||
if($search_term === 'GMC'){
|
||||
|
||||
if ($search_term === 'GMC') {
|
||||
|
||||
$resultss = [];
|
||||
|
||||
@ -1117,48 +1122,44 @@ class ClientController extends AdminController
|
||||
} catch (\Exception $e) {
|
||||
$resultss = $results; // Reset $resultss to an empty array if an exception occurs
|
||||
}
|
||||
|
||||
|
||||
|
||||
$premiumDataa ='';
|
||||
|
||||
|
||||
$premiumDataa = '';
|
||||
if ($family_floater == 0) {
|
||||
// print_r($premiumData);die;
|
||||
if (count($premiumData) == 0) {
|
||||
$premiumDataa = $premiumData;
|
||||
}else if ($premiumData[0]['policy_grid_id'] == '3' || $premiumData[0]['policy_grid_id'] == '4' || $premiumData[0]['policy_grid_id'] == '5' || $premiumData[0]['policy_grid_id'] == '6' || $premiumData[0]['policy_grid_id'] == '7' || $premiumData[0]['policy_grid_id'] == '8' || $premiumData[0]['policy_grid_id'] == '9' ) {
|
||||
} else if ($premiumData[0]['policy_grid_id'] == '3' || $premiumData[0]['policy_grid_id'] == '4' || $premiumData[0]['policy_grid_id'] == '5' || $premiumData[0]['policy_grid_id'] == '6' || $premiumData[0]['policy_grid_id'] == '7' || $premiumData[0]['policy_grid_id'] == '8' || $premiumData[0]['policy_grid_id'] == '9') {
|
||||
$premiumDataa = $premiumData;
|
||||
}
|
||||
}
|
||||
else if($family_floater == 1){
|
||||
if(count($premiumData) == 0){
|
||||
} else if ($family_floater == 1) {
|
||||
if (count($premiumData) == 0) {
|
||||
$premiumDataa = $premiumData;
|
||||
}else if ($premiumData[0]['policy_grid_id'] == '10' || $premiumData[0]['policy_grid_id'] == '11' ) {
|
||||
} else if ($premiumData[0]['policy_grid_id'] == '10' || $premiumData[0]['policy_grid_id'] == '11') {
|
||||
$premiumDataa = $premiumData;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$premiumDataa = $premiumData;
|
||||
}
|
||||
|
||||
if($premiumDataa == ""){
|
||||
if ($premiumDataa == "") {
|
||||
$premiumDataa = $premiumData;
|
||||
}
|
||||
|
||||
|
||||
// print_r($premiumData);die;
|
||||
|
||||
// print_r($data[0]->policy_type); die;
|
||||
// echo "hello";
|
||||
// return json_encode($premiumData);
|
||||
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
||||
// echo "hello";
|
||||
// return json_encode($premiumData);
|
||||
|
||||
}else if($search_term === 'GPA'){
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
||||
} else if ($search_term === 'GPA') {
|
||||
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
||||
|
||||
}else{
|
||||
|
||||
return $this->respond(['status' => false,'code' => 200,'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
||||
} else {
|
||||
|
||||
return $this->respond(['status' => false, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -27,4 +27,39 @@ class PolicyPremium1Model extends Model
|
||||
'premium_type',
|
||||
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
protected function checkAndADDCreatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['created_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['created_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['updated_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -28,4 +28,37 @@ class PolicyPremium2Model extends Model
|
||||
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
protected function checkAndADDCreatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['created_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['created_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['updated_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -382,25 +382,17 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
}
|
||||
|
||||
grid_html = `
|
||||
|
||||
<div class="form-row" id="grid_9" style="width:84%">
|
||||
<div class="form-group col-md-3">
|
||||
<div class="form-row" id="grid_2" style="width:84%">
|
||||
<input value="1" type="hidden" name="policy_type">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="9_si[]" id="9_si" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Grade/Band<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control" placeholder="Enter Grade/Band " name="9_grade[]" id="9_grade" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_si" id="gpa_si" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
|
||||
<div id='gpa_si_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="9_premium[]" id="9_premium" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
|
||||
<div id='premium_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,9)">x</button>
|
||||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(9)">+</button>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="gpa_premium" id="gpa_premium" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
|
||||
<div id='gpa_premium_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
@ -563,8 +555,6 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
grid_container.insertAdjacentHTML('beforeend', grid_html);
|
||||
|
||||
if (dataIdValue == '1') {
|
||||
@ -708,8 +698,10 @@ $('body').on('click', '.btnPolicyModel', function() {
|
||||
}, 1000);
|
||||
console.log('policy grid responce', res);
|
||||
var temp_for_premiumData = JSON.parse(res.premiumData);
|
||||
|
||||
console.log('policy grid responce', temp_for_premiumData);
|
||||
res.premiumData = JSON.parse(res.premiumData);
|
||||
console.log('policy grid responce', res.premiumData);
|
||||
|
||||
|
||||
$('#nameOfThePolicy').html(' - ' + res.policy_name);
|
||||
$('#grid_emp_count').val(res.count);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user