Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
5115cfcb7b
@ -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");
|
||||
});
|
||||
});
|
||||
|
||||
@ -206,6 +207,14 @@ $routes->group("/master", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("remove/(:any)", "MasterController::removePolicyPolicies/$1");
|
||||
});
|
||||
});
|
||||
|
||||
$routes->group("cash_deposite", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("list", "MasterController::CDMasterList");
|
||||
$routes->post("create", "MasterController::createCDMasterData");
|
||||
$routes->post("edit", "MasterController::editCDMasterData");
|
||||
$routes->get("list/(:any)", "MasterController::getCDMasterDataByID/$1");
|
||||
// $routes->get("remove/(:any)", "MasterController::policyTypeRemove/$1");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -234,6 +243,11 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("get-client-branch/(:any)", "ClientController::getClientBranch/$1");
|
||||
$routes->get("get-client-details/(:any)", "ClientController::getClientAllDetailsByUsingClientID/$1");
|
||||
$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->cli('cli/processjob', 'JobWorker::processJob');
|
||||
|
||||
@ -31,6 +31,10 @@ use App\Models\PolicyPremium2Model;
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Models\NotificationModel;
|
||||
use App\Models\CDMasterModel;
|
||||
use App\Models\PolicyTypeModel;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -62,12 +66,15 @@ class ClientController extends AdminController
|
||||
protected $employeeModel;
|
||||
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();
|
||||
@ -89,7 +96,11 @@ class ClientController extends AdminController
|
||||
$this->policyPremium2Model = new PolicyPremium2Model();
|
||||
$this->employeeModel = new EmployeeModel();
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
$this->notificationModel = new NotificationModel();
|
||||
$this->notificationModel = new NotificationModel();
|
||||
$this->CDMasterModel = new CDMasterModel();
|
||||
$this->policyTypeModel = new PolicyTypeModel();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -200,13 +211,19 @@ class ClientController extends AdminController
|
||||
public function view_Deposit($insurerId)
|
||||
{
|
||||
// Load your model to fetch data based on $clientId and $insurerId
|
||||
// $subTypeOptions = [
|
||||
// 1 => 'Deposit',
|
||||
// 2 => 'Adjustment',
|
||||
// 3 => 'Refund',
|
||||
// 4 => 'Debit',
|
||||
// ];
|
||||
$subTypeOptions = [
|
||||
1 => 'Deposit',
|
||||
1 => 'Replenishment',
|
||||
2 => 'Adjustment',
|
||||
3 => 'Refund',
|
||||
3 => 'Refund From Deletion',
|
||||
4 => 'Debit',
|
||||
// Add more options as needed
|
||||
];
|
||||
|
||||
$data['subTypeOptions'] = $subTypeOptions;
|
||||
$headerData['page_name'] = 'Client Deposit';
|
||||
$data['insurerName']= $this->insurerModel->getInsurerName($insurerId);
|
||||
@ -231,20 +248,33 @@ class ClientController extends AdminController
|
||||
// Retrieve form data from POST request
|
||||
$loggedInUserID = get_session_userid();
|
||||
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$insurer_id = $this->request->getPost('insurer_id');
|
||||
|
||||
$CD_Account_Number = $this->CDMasterModel
|
||||
->where('client_id', $client_id)
|
||||
->where('insurer_id', $insurer_id)
|
||||
->first();
|
||||
|
||||
// Prepare the array with data
|
||||
$data = [
|
||||
'amount' => $this->request->getPost('amount'),
|
||||
'sub_type_id' => $this->request->getPost('sub_type_id'),
|
||||
'client_id' => $this->request->getPost('client_id'),
|
||||
'client_policy_id' => null,
|
||||
'cd_ac_no' => $CD_Account_Number['cd_ac_no'] ?? null,
|
||||
'endorsement_no' => null,
|
||||
'insurer_id' => $this->request->getPost('insurer_id'),
|
||||
'description' => $this->request->getPost('description'),
|
||||
'transaction_type' => $this->request->getPost('transaction_type') ?: 'Credit',
|
||||
'updated_by' => 1, // You need to set the correct value for updated_by
|
||||
'updated_by' => 1,
|
||||
];
|
||||
|
||||
|
||||
// Call the saveDeposit function from DepositHelper
|
||||
$response = DepositHelper::saveDeposit($data, $loggedInUserID);
|
||||
|
||||
|
||||
// Return a boolean value based on success
|
||||
return $this->response->setJSON(['success' => $response['success']]);
|
||||
}
|
||||
@ -588,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;
|
||||
|
||||
@ -638,7 +659,8 @@ class ClientController extends AdminController
|
||||
$data['base_policy'] = $this->request->getPost('base_policy');
|
||||
$data['policy_status'] = 1;
|
||||
$data['inception_type'] = $this->request->getPost('inception_type') ? 2 : 1;
|
||||
$data['client_branch_id'] = $this->request->getPost('client_branch_id');
|
||||
$data['client_branch_id'] = $this->request->getPost('client_branch_id');
|
||||
$data['cd_ac_no'] = $this->request->getPost('cd_ac_no');
|
||||
|
||||
|
||||
|
||||
@ -733,7 +755,8 @@ class ClientController extends AdminController
|
||||
$data['base_policy'] = $this->request->getPost('base_policy');
|
||||
$data['policy_status'] = 1;
|
||||
$data['inception_type'] = $this->request->getPost('inception_type') ? 2 : 1;
|
||||
$data['client_branch_id'] = $this->request->getPost('client_branch_id');
|
||||
$data['client_branch_id'] = $this->request->getPost('client_branch_id');
|
||||
$data['cd_ac_no'] = $this->request->getPost('cd_ac_no');
|
||||
|
||||
|
||||
|
||||
@ -884,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'));
|
||||
@ -1140,9 +1181,10 @@ class ClientController extends AdminController
|
||||
$client_id = $client_policy_data['client_id'];
|
||||
$polices = $this->policesModel->where(['insurer_id' => $insurer_id, 'is_active' => 1])->findAll();
|
||||
$client_policy_list = $this->clientPolicyModel->getpolicyWithPattern( $client_id );
|
||||
$cd_data = $this->CDMasterModel->where('client_id', $client_id)->where('insurer_id', $insurer_id)->findAll();
|
||||
|
||||
|
||||
return $this->respond(['status' => true,'code' => 200, 'client_policy_list' => $client_policy_list, 'data' => $client_policy_data, "insurer_id" => $client_policy_data['insurer_id'], 'policy' => $polices], 200);
|
||||
return $this->respond(['status' => true,'code' => 200, 'client_policy_list' => $client_policy_list, 'data' => $client_policy_data, 'cd_data' => $cd_data, "insurer_id" => $client_policy_data['insurer_id'], 'policy' => $polices], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
|
||||
}
|
||||
@ -1177,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']);
|
||||
@ -1197,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 = "";
|
||||
@ -1207,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') {
|
||||
@ -1218,9 +1254,6 @@ class ClientController extends AdminController
|
||||
$premiumData = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($premiumData); die;
|
||||
@ -1294,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 {
|
||||
@ -1315,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 +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"));
|
||||
@ -1435,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{
|
||||
@ -1455,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"));
|
||||
|
||||
@ -1509,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);
|
||||
}
|
||||
@ -1584,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);
|
||||
@ -1942,10 +1990,6 @@ class ClientController extends AdminController
|
||||
|
||||
|
||||
$data['client_policy'] = $client_policy;
|
||||
|
||||
|
||||
|
||||
|
||||
$data['client_branch'] = $this->clientModel
|
||||
|
||||
->select('
|
||||
@ -2120,5 +2164,83 @@ class ClientController extends AdminController
|
||||
|
||||
|
||||
|
||||
public function get_cd_ac($client_id, $insurer_id){
|
||||
|
||||
$cd_data = $this->CDMasterModel->where('client_id', $client_id)->where('insurer_id', $insurer_id)->findAll();
|
||||
|
||||
if($cd_data){
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $cd_data], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'code' => 404, 'insurer_id' => $insurer_id, 'client_id' => $client_id], 200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
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(isset($policy_terms['policy_terms']) && $policy_terms['policy_terms'] != null){
|
||||
|
||||
$JSON = json_decode($policy_terms['policy_terms']);
|
||||
$si = $JSON->sum_insured ?? $JSON->sumInsured2;
|
||||
$multi_si = $JSON->multiple_sum_insured;
|
||||
$multi_si[] = $si;
|
||||
}else{
|
||||
$$multi_si = [];
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -24,6 +24,7 @@ use App\Models\ClientDepositModel;
|
||||
use App\Models\NotificationModel;
|
||||
use App\Models\MessageModel;
|
||||
use App\Models\UserMessageModel;
|
||||
use App\Models\CDMasterModel;
|
||||
|
||||
use App\Controllers\Jobs;
|
||||
use App\Controllers\JobWorker;
|
||||
@ -52,6 +53,8 @@ class EmpDataServiceController extends BaseController
|
||||
protected $notificationModel;
|
||||
protected $messageModel;
|
||||
protected $userMessageModel;
|
||||
protected $CDMasterModel;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -70,6 +73,8 @@ class EmpDataServiceController extends BaseController
|
||||
$this->notificationModel = new NotificationModel();
|
||||
$this->messageModel = new MessageModel();
|
||||
$this->userMessageModel = new UserMessageModel();
|
||||
$this->CDMasterModel = new CDMasterModel();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -138,6 +143,12 @@ class EmpDataServiceController extends BaseController
|
||||
$insurer_id = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
|
||||
$cash_balance = $this->clientDepositModel->where('client_id', $export_data['client_id'])->where('insurer_id', $insurer_id['insurer_id'])->orderBy('id', 'DESC')->first();
|
||||
|
||||
if($cash_balance == null){
|
||||
|
||||
$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'];
|
||||
}
|
||||
|
||||
|
||||
// Calculate the total amount from the objects
|
||||
$totals = array_reduce($objects, function ($carry, $item) {
|
||||
@ -188,7 +199,7 @@ class EmpDataServiceController extends BaseController
|
||||
'NAME OF EMP/DEP',
|
||||
'EMP ID',
|
||||
'EMP/DEP TYPE',
|
||||
'RELATION',
|
||||
'RELATIONSHIP CODE',
|
||||
'DOB',
|
||||
'GENDER',
|
||||
'PRE EXISTING AILMENTS',
|
||||
@ -673,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){
|
||||
@ -1083,6 +1094,13 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_code = $file['batch_code'];
|
||||
$user_id = $file['created_by'];
|
||||
|
||||
$insurer_id = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
|
||||
$CD_Account_Number = $this->CDMasterModel
|
||||
->where('client_id', $client_id)
|
||||
->where('insurer_id', $insurer_id['insurer_id'])
|
||||
->first();
|
||||
|
||||
|
||||
$get_policy_type = $this->clientPolicyModel
|
||||
->select('policy_type.policy_type, policies.policy_type_id as policy_type_id')
|
||||
@ -1192,6 +1210,8 @@ class EmpDataServiceController extends BaseController
|
||||
'employeeIds' => $emp_policy_ids,
|
||||
'client_id' => $client_id,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'cd_ac_no' => $CD_Account_Number['cd_ac_no'] ?? null,
|
||||
'endorsement_no' => null,
|
||||
'client_branch_id' => $client_branch_id,
|
||||
'count' => $emp_count,
|
||||
'event' => $file['event_type'],
|
||||
@ -2095,6 +2115,13 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_code = $file['batch_code'];
|
||||
$user_id = $file['created_by'];
|
||||
|
||||
$insurer_id = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
|
||||
$CD_Account_Number = $this->CDMasterModel
|
||||
->where('client_id', $client_id)
|
||||
->where('insurer_id', $insurer_id['insurer_id'])
|
||||
->first();
|
||||
|
||||
|
||||
$status_val = 'success';
|
||||
if ($status == 'in-progress-partially') {
|
||||
@ -2113,7 +2140,7 @@ class EmpDataServiceController extends BaseController
|
||||
$emp_policy_ids = [];
|
||||
$employeeIds = [];
|
||||
$emp_details = [];
|
||||
$endorsement_id = [];
|
||||
$endorsement_id = '';
|
||||
$endorsement_details = [];
|
||||
$totals = 0;
|
||||
|
||||
@ -2121,7 +2148,7 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$emp_name = $value[1];
|
||||
$emp_code = $value[2];
|
||||
$endorsement_id[] = $value[19];
|
||||
$endorsement_id = $value[19];
|
||||
$totals += $value[18];
|
||||
|
||||
|
||||
@ -2229,6 +2256,8 @@ class EmpDataServiceController extends BaseController
|
||||
'client_id' => $client_id,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'client_branch_id' => $client_branch_id,
|
||||
'cd_ac_no' => $CD_Account_Number['cd_ac_no'] ?? null,
|
||||
'endorsement_no' => $endorsement_id ?? null,
|
||||
'count' => $emp_count,
|
||||
'event' => $file['event_type'],
|
||||
'policy_name' => $policy_name['policy_name'],
|
||||
@ -2633,6 +2662,13 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_code = $file['batch_code'];
|
||||
$user_id = $file['created_by'];
|
||||
|
||||
$insurer_id = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
|
||||
$CD_Account_Number = $this->CDMasterModel
|
||||
->where('client_id', $client_id)
|
||||
->where('insurer_id', $insurer_id['insurer_id'])
|
||||
->first();
|
||||
|
||||
|
||||
$status_val = 'success';
|
||||
if ($status == 'in-progress-partially') {
|
||||
@ -2653,6 +2689,7 @@ class EmpDataServiceController extends BaseController
|
||||
$emp_endorsement_table_data = [];
|
||||
$employee_policy_table_data = [];
|
||||
$employee_policy_table_primaryKey = [];
|
||||
$endorsement_id = '';
|
||||
|
||||
$totals = 0;
|
||||
|
||||
@ -2662,6 +2699,7 @@ class EmpDataServiceController extends BaseController
|
||||
$emp_name = $value[2]; //employee name
|
||||
$emp_code = $value[1]; //employee code
|
||||
$totals = $totals + $value[13];
|
||||
$endorsement_id = $value[15];
|
||||
|
||||
|
||||
$fetch_data = [
|
||||
@ -2733,6 +2771,8 @@ class EmpDataServiceController extends BaseController
|
||||
'client_id' => $client_id,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'client_branch_id' => $client_branch_id,
|
||||
'cd_ac_no' => $CD_Account_Number['cd_ac_no'] ?? null,
|
||||
'endorsement_no' => $endorsement_id ?? null,
|
||||
'count' => $emp_count,
|
||||
'event' => $file['event_type'],
|
||||
'policy_name' => $policy_name['policy_name'],
|
||||
@ -3176,6 +3216,9 @@ class EmpDataServiceController extends BaseController
|
||||
'amount' => $amount->total_sum ?? 0,
|
||||
'sub_type_id' => 4,
|
||||
'client_id' => $arrayData['client_id'],
|
||||
'client_policy_id' => $arrayData['client_policy_id'],
|
||||
'endorsement_no' => $arrayData['endorsement_no'] ?? null,
|
||||
'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
|
||||
'insurer_id' => $insurer_id['insurer_id'],
|
||||
'description' => $description,
|
||||
'transaction_type' => 'Debit',
|
||||
@ -3214,6 +3257,9 @@ class EmpDataServiceController extends BaseController
|
||||
'amount' => $amount->total_sum,
|
||||
'sub_type_id' => 4,
|
||||
'client_id' => $arrayData['client_id'],
|
||||
'client_policy_id' => $arrayData['client_policy_id'],
|
||||
'endorsement_no' => $arrayData['endorsement_no'] ?? null,
|
||||
'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
|
||||
'insurer_id' => $insurer_id['insurer_id'],
|
||||
'description' => $description,
|
||||
'transaction_type' => 'Debit',
|
||||
@ -3254,6 +3300,9 @@ class EmpDataServiceController extends BaseController
|
||||
'amount' => $amount->total_sum,
|
||||
'sub_type_id' => 3,
|
||||
'client_id' => $arrayData['client_id'],
|
||||
'client_policy_id' => $arrayData['client_policy_id'],
|
||||
'endorsement_no' => $arrayData['endorsement_no'] ?? null,
|
||||
'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
|
||||
'insurer_id' => $insurer_id['insurer_id'],
|
||||
'description' => $description,
|
||||
'transaction_type' => 'Credit',
|
||||
|
||||
@ -772,13 +772,9 @@ class EmployeeController extends AdminController
|
||||
->findAll();
|
||||
|
||||
$emp_count = count($data);
|
||||
|
||||
if ($data) {
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'emp_count' => $emp_count], 200);
|
||||
} else {
|
||||
|
||||
return $this->respond(['dataStatus' => false, 'code' => 404], 404);
|
||||
}
|
||||
$events = ['inception' => 'Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'emp_count' => $emp_count, 'events' => $events, 'client_policy_id' => $id], 200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -487,7 +487,7 @@ class EmployeeRestController extends AdminController
|
||||
{
|
||||
try {
|
||||
$empData = $this->employeePolicyModel->getEmployeePolicy( client_id:$this->request->getGet('client_id'),policy_id: $this->request->getGet('client_policy_id'),status:0,branch_id:$this->request->getGet('client_branch_id'));
|
||||
|
||||
|
||||
if ($empData) {
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 200);
|
||||
} else {
|
||||
|
||||
@ -25,6 +25,7 @@ use App\Models\TPABranchModel;
|
||||
use App\Models\TPAModel;
|
||||
use App\Models\StateModel;
|
||||
use App\Models\PolicyTypeModel;
|
||||
use App\Models\CDMasterModel;
|
||||
|
||||
class MasterController extends AdminController
|
||||
{
|
||||
@ -45,6 +46,9 @@ class MasterController extends AdminController
|
||||
protected $tpaModel;
|
||||
protected $stateModel;
|
||||
protected $policyTypeModel;
|
||||
protected $CDMasterModel;
|
||||
protected $clientModel;
|
||||
|
||||
|
||||
|
||||
public function __construct()
|
||||
@ -68,6 +72,9 @@ class MasterController extends AdminController
|
||||
$this->tpaModel = new TPAModel();
|
||||
$this->stateModel = new StateModel();
|
||||
$this->policyTypeModel = new PolicyTypeModel();
|
||||
$this->CDMasterModel = new CDMasterModel();
|
||||
$this->clientModel = new ClientModel();
|
||||
|
||||
}
|
||||
|
||||
public function insurerList()
|
||||
@ -1111,4 +1118,103 @@ class MasterController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function CDMasterList()
|
||||
{
|
||||
|
||||
$data['CD_Master_Data'] = $this->CDMasterModel
|
||||
->select('cd_master.*, clients.client_name, clients.short_name, insurers.name as insurer_name, user_profiles.first_name as user_name')
|
||||
->join('clients', 'clients.id = cd_master.client_id')
|
||||
->join('insurers', 'insurers.id = cd_master.insurer_id')
|
||||
->join('user_profiles', 'user_profiles.id = cd_master.created_by')
|
||||
->where('cd_master.is_active', 1)
|
||||
->findAll();
|
||||
$data['insurers'] = $this->insurerModel->findAll();
|
||||
$data['clients'] = $this->clientModel->findAll();
|
||||
$this->loadLayout('cd_master_list', $data);
|
||||
}
|
||||
|
||||
|
||||
public function createCDMasterData()
|
||||
{
|
||||
|
||||
$data = $this->request->getPost();
|
||||
$date = (string) $this->request->getPost('opening_date');
|
||||
$data['opening_date'] = date('Y-m-d', strtotime($date));
|
||||
|
||||
|
||||
if ($data) {
|
||||
|
||||
$insert = $this->CDMasterModel->insert($data);
|
||||
|
||||
if ($insert) {
|
||||
|
||||
session()->setFlashdata('success', "Cash Deposite Master Added Successfully");
|
||||
return redirect()->to(base_url('/master/cash_deposite/list'));
|
||||
} else {
|
||||
|
||||
session()->setFlashdata('error', "Cash Deposite Master Added Failed");
|
||||
return redirect()->to(base_url('/master/cash_deposite/list'));
|
||||
}
|
||||
} else {
|
||||
|
||||
session()->setFlashdata('error', "Cash Deposite Master Added Failed. Data Not Found");
|
||||
return redirect()->to(base_url('/master/cash_deposite/list'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function editCDMasterData($id = null)
|
||||
{
|
||||
|
||||
$id = $this->request->getPost('PrimaryKey');
|
||||
$date = (string) $this->request->getPost('opening_date');
|
||||
$data = $this->request->getPost();
|
||||
$data['opening_date'] = date('Y-m-d', strtotime($date));
|
||||
|
||||
if ($data) {
|
||||
|
||||
$insert = $this->CDMasterModel->where('id', $id)->set($data)->update();
|
||||
|
||||
if ($insert) {
|
||||
|
||||
session()->setFlashdata('success', "Cash Deposite Master Updated Successfully");
|
||||
return redirect()->to(base_url('/master/cash_deposite/list'));
|
||||
} else {
|
||||
|
||||
session()->setFlashdata('error', "Cash Deposite Master Update Failed");
|
||||
return redirect()->to(base_url('/master/cash_deposite/list'));
|
||||
}
|
||||
} else {
|
||||
|
||||
session()->setFlashdata('error', "Cash Deposite Master Update Failed. Data Not Found");
|
||||
return redirect()->to(base_url('/master/cash_deposite/list'));
|
||||
}
|
||||
}
|
||||
|
||||
public function getCDMasterDataByID($id = null)
|
||||
{
|
||||
|
||||
$cd_data = $this->CDMasterModel->where('id', $id)->first();
|
||||
$cd_data['opening_date'] = date('d-m-Y', strtotime($cd_data['opening_date']));
|
||||
|
||||
if ($cd_data) {
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $cd_data], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404], 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function checkUniqueCDAccountNumber($AccountNumber)
|
||||
{
|
||||
$uniqueAC = $this->CDMasterModel->where('cd_ac_no', $AccountNumber)->findAll();
|
||||
|
||||
if($uniqueAC != null){
|
||||
return $this->respond(['status' => true, 'message' => 'The CD Account Number is Already Exist', 'code' => 200], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'code' => 404], 200);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -4,6 +4,7 @@
|
||||
namespace App\Helpers;
|
||||
|
||||
use App\Models\ClientDepositModel;
|
||||
use App\Models\CDMasterModel;
|
||||
|
||||
class DepositHelper
|
||||
{
|
||||
@ -49,6 +50,9 @@ class DepositHelper
|
||||
'amount' => $data['amount'],
|
||||
'sub_type' => $data['sub_type_id'],
|
||||
'client_id' => $data['client_id'],
|
||||
'client_policy_id' => $data['client_policy_id'],
|
||||
'cd_ac_no' => $data['cd_ac_no'],
|
||||
'endorsement_no' => $data['endorsement_no'],
|
||||
'insurer_id' => $data['insurer_id'],
|
||||
'description' => $data['description'],
|
||||
'transaction_type' => $data['transaction_type'],
|
||||
@ -90,7 +94,18 @@ class DepositHelper
|
||||
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE client_id = ? AND insurer_id = ? ORDER BY created_at DESC LIMIT 1";
|
||||
$getLastBalanceParams = [$clientId, $insurerId];
|
||||
|
||||
$lastBalance = $model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->balance ?? 0;
|
||||
$lastBalance = $model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->balance;
|
||||
|
||||
if(!$lastBalance){
|
||||
|
||||
$cd_model = new ClientDepositModel();
|
||||
|
||||
$getLastBalanceQuery = "SELECT opening_bal FROM cd_master WHERE client_id = ? AND insurer_id = ? ORDER BY created_at DESC LIMIT 1";
|
||||
$getLastBalanceParams = [$clientId, $insurerId];
|
||||
|
||||
$lastBalance = $cd_model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->opening_bal ?? 0;
|
||||
|
||||
}
|
||||
|
||||
return $lastBalance;
|
||||
}
|
||||
|
||||
64
app/Models/CDMasterModel.php
Normal file
64
app/Models/CDMasterModel.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class CDMasterModel extends Model
|
||||
{
|
||||
protected $table = 'cd_master';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [
|
||||
|
||||
'id',
|
||||
'client_id',
|
||||
'insurer_id',
|
||||
'cd_ac_no',
|
||||
'opening_bal',
|
||||
'opening_date',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'is_active',
|
||||
|
||||
];
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -22,6 +22,9 @@ class ClientDepositModel extends Model
|
||||
"updated_at",
|
||||
"description",
|
||||
"balance",
|
||||
"client_policy_id",
|
||||
"cd_ac_no",
|
||||
"endorsement_no",
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -42,7 +42,8 @@ class ClientPolicyModel extends Model
|
||||
"date_of_exit",
|
||||
"reason_for_exit",
|
||||
"policy_no",
|
||||
"client_branch_id"
|
||||
"client_branch_id",
|
||||
"cd_ac_no"
|
||||
];
|
||||
|
||||
public function getClientPolicyById($id){
|
||||
@ -182,18 +183,21 @@ class ClientPolicyModel extends Model
|
||||
->select('cash_deposit.*')
|
||||
->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
||||
->select('clients.client_name as clientname, clients.short_name as clientshort')
|
||||
->select('policies.name as policy_name')
|
||||
->select('user_profiles.first_name as username')
|
||||
->join('user_profiles','user_profiles.id=cash_deposit.created_by')
|
||||
->join('insurers', 'insurers.id = cash_deposit.insurer_id')
|
||||
->join('clients', 'clients.id = cash_deposit.client_id')
|
||||
|
||||
->join('user_profiles', 'user_profiles.id = cash_deposit.created_by', 'left')
|
||||
->join('insurers', 'insurers.id = cash_deposit.insurer_id', 'left')
|
||||
->join('clients', 'clients.id = cash_deposit.client_id', 'left')
|
||||
->join('client_policy', 'client_policy.id = cash_deposit.client_policy_id', 'left')
|
||||
->join('policies', 'policies.id = client_policy.policy_id', 'left')
|
||||
->where('cash_deposit.client_id', $clientId)
|
||||
->where('cash_deposit.insurer_id', $insurerId) // Add this line to filter by insurer_id
|
||||
->where('cash_deposit.insurer_id', $insurerId)
|
||||
->orderBy('cash_deposit.id', 'DESC')
|
||||
->get()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
|
||||
public function getDepositSummary($clientId, $insurerId)
|
||||
{
|
||||
// Fetch the sum of credit and debit transactions and calculate the balance
|
||||
|
||||
@ -84,8 +84,8 @@ class EmployeePolicyModel extends Model
|
||||
->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('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)
|
||||
|
||||
293
app/Views/cd_master_list.php
Normal file
293
app/Views/cd_master_list.php
Normal file
@ -0,0 +1,293 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
table.dataTable thead th {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.col-12 {
|
||||
|
||||
max-width: 98% !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="client_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">CD Master List</h4>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 56px;">
|
||||
<button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light"
|
||||
data-toggle="modal" data-target="#con-close-modal" data-placement="top" title="Add"
|
||||
data-trigger="hover">ADD</button>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-sm table-hover m-0 table-centered dt-responsive w-100" cellspacing="0"
|
||||
id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">Client Name</th>
|
||||
<th class="font-weight-medium">Insurer Name</th>
|
||||
<th class="font-weight-medium">Opening Date</th>
|
||||
<th class="font-weight-medium">CD Account No</th>
|
||||
<th class="font-weight-medium">Deposite Amount</th>
|
||||
<th class="font-weight-medium">Date/User</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php foreach($CD_Master_Data as $row){ ?>
|
||||
<tr>
|
||||
<td><?php echo $row['client_name']; ?>( <?= $row['short_name'] ?> )</td>
|
||||
<td><?php echo $row['insurer_name']; ?></td>
|
||||
<td><?php echo date('d-m-Y', strtotime($row['opening_date'])); ?></td>
|
||||
<td><?php echo $row['cd_ac_no']; ?></td>
|
||||
<td><?php echo $row['opening_bal']; ?></td>
|
||||
<td><?php echo date('d-M-Y h:i A', strtotime($row['created_at'])) ?> by
|
||||
<?php echo $row['user_name']; ?></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 btnEdit" data-id="<?= $row['id'];?>" data-toggle="modal" data-target="#con-close-modal"> <i
|
||||
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
|
||||
<!-- modal content -->
|
||||
|
||||
<div id="con-close-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
|
||||
aria-hidden="true" data-backdrop="static" style="display: none;">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="title">Add Cash Deposite</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body p-4">
|
||||
<div class="">
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="CDMasterForm" action=""
|
||||
enctype="multipart/form-data">
|
||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="CD_Master_ID" />
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="emp_code">Client<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_id" name="client_id" required>
|
||||
<option value="">Select Client</option>
|
||||
<?php foreach($clients as $value) { ?>
|
||||
<option value="<?= $value['id'] ?>"><?= $value['client_name'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="profile">Insurer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="insurer_id" name="insurer_id" required>
|
||||
<option value="">Select Insurer</option>
|
||||
<?php foreach($insurers as $value) { ?>
|
||||
<option value="<?= $value['id'] ?>"><?= $value['name'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="email">Opening Date<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="opening_date" id="opening_date" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="mobile">CD Account Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="cd_ac_no" name="cd_ac_no" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="mobile">Deposite Amount<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="opening_bal" name="opening_bal" required>
|
||||
</div>
|
||||
</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>
|
||||
<!-- <button type="button" class="btn btn-secondry waves-effect waves-light mr-1" data-dismiss="modal" aria-hidden="true">Close</button> -->
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#tickets-table').DataTable({
|
||||
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: 'CD-Master-List',
|
||||
className: 'my_class',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
},
|
||||
}],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true,
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
<?php if (session()->has('error')) : ?>
|
||||
toastr.error('<?= session()->getFlashdata('error') ?>', 'Failed');
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (session()->has('success')) : ?>
|
||||
toastr.success('<?= session()->getFlashdata('success') ?>', 'success');
|
||||
<?php endif; ?>
|
||||
|
||||
var endDatePicker = flatpickr("#opening_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
// defaultDate: endDate,
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
$('#client_id').select2();
|
||||
$('#insurer_id').select2();
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('#btnAdd').click(function(){
|
||||
$('#client_id').val('');
|
||||
$('#insurer_id').val('');
|
||||
$('#opening_date').val('');
|
||||
$('#cd_ac_no').val('');
|
||||
$('#opening_bal').val('');
|
||||
$('#CDMasterForm').attr('action', '<?php echo base_url('master/cash_deposite/create');?>');
|
||||
$('#title').html('Add Cash Deposite');
|
||||
$('#btnSubmit').html('Submit');
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('.close').click(function(){
|
||||
$('#CD_Master_ID').val('');
|
||||
$('#client_id').val('').change();
|
||||
$('#insurer_id').val('').change();
|
||||
$('#opening_date').val('');
|
||||
$('#cd_ac_no').val('');
|
||||
$('#opening_bal').val('');
|
||||
$('#CDMasterForm')[0].reset();
|
||||
$('#CDMasterForm').parsley().reset();
|
||||
})
|
||||
|
||||
|
||||
$('body').on('click', '.btnEdit', function () {
|
||||
|
||||
var cd_id = $(this).attr('data-id');
|
||||
$('#title').html('Update Cash Deposite');
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('master/cash_deposite/list/');?>'+cd_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
|
||||
console.log(res)
|
||||
|
||||
$('#updateModal').modal('show');
|
||||
$('#CDMasterForm').attr('action', '<?php echo base_url('master/cash_deposite/edit');?>');
|
||||
$('#CD_Master_ID').val(res.data.id);
|
||||
$('#client_id').val(res.data.client_id).change();
|
||||
$('#insurer_id').val(res.data.insurer_id).change();
|
||||
$('#opening_date').val(res.data.opening_date);
|
||||
$('#cd_ac_no').val(res.data.cd_ac_no);
|
||||
$('#opening_bal').val(res.data.opening_bal);
|
||||
$('#btnSubmit').html('Update');
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#cd_ac_no').change(function(){
|
||||
|
||||
var cd_ac_no = $(this).val();
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('util/check_cd_ac_no/');?>'+cd_ac_no,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
|
||||
console.log(res)
|
||||
if(res.status == true){
|
||||
toastr.warning(res.message, 'warning');
|
||||
$('#cd_ac_no').val('');
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
</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>
|
||||
@ -121,13 +121,22 @@
|
||||
|
||||
<div class="form-row" id="third" style="display: none; position: relative;top: 22px;">
|
||||
|
||||
<label class="switch">
|
||||
<input id="inception_type" type="checkbox" name="inception_type">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mobile">CD Account Number<span id="tpa_danger" class="text-danger">*</span></label>
|
||||
<select class="form-control" id="cd_ac_no" name="cd_ac_no" required>
|
||||
<option value="">Select CD Account Number</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<label for="inception_type" style="position: relative;bottom: 5px;left: 10px;">Enable
|
||||
Employee Enrolment Process</label>
|
||||
<div class="form-group col-md-4">
|
||||
<label class="switch" style="position: relative;top: 43px;left: 20px;">
|
||||
<input id="inception_type" type="checkbox" name="inception_type">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
|
||||
<label for="inception_type" style="position: relative;bottom: 5px;left: 85px;">Enable
|
||||
Employee Enrolment Process</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="policy_fields"></div>
|
||||
@ -148,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();
|
||||
@ -201,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)) {
|
||||
@ -215,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) {
|
||||
@ -260,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>
|
||||
@ -270,12 +282,14 @@
|
||||
});
|
||||
|
||||
$('#policy_table').append(policyTable);
|
||||
// console.log(policyTable);
|
||||
}
|
||||
|
||||
|
||||
$('#table-client-policy').DataTable({
|
||||
paging: true,
|
||||
searching: false
|
||||
searching: false,
|
||||
// ordering: false
|
||||
});
|
||||
|
||||
});
|
||||
@ -330,7 +344,6 @@
|
||||
|
||||
})
|
||||
|
||||
|
||||
/******** for form submit using AJAX *******/
|
||||
$("#policy_form").submit(function(event) {
|
||||
|
||||
@ -342,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');
|
||||
@ -371,7 +384,7 @@
|
||||
|
||||
var isValid = $('#policy_form').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
//console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -390,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() {
|
||||
|
||||
@ -435,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) {
|
||||
@ -482,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>
|
||||
@ -491,6 +499,8 @@
|
||||
`;
|
||||
});
|
||||
$('#policy_table').append(policyTable);
|
||||
console.log(policyTable);
|
||||
|
||||
|
||||
$('#insurer').val('');
|
||||
$('#tpa').val('');
|
||||
@ -506,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);
|
||||
}
|
||||
@ -521,19 +531,22 @@
|
||||
$(document).ready(function() {
|
||||
/********* To get the POLICY base on Insurer *******/
|
||||
$('#insurer').change(function() {
|
||||
|
||||
var id = $(this).val();
|
||||
var client_id = $('#client_id_policy').val()
|
||||
var parts = id.split('-');
|
||||
var secondPart = parts[1];
|
||||
var url = "<?= base_url("util/police-by-insurer/") ?>" + secondPart;
|
||||
var url_for_cd = "<?= base_url("util/get_cd_ac/") ?>" + client_id + '/' + secondPart;
|
||||
|
||||
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();
|
||||
@ -575,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 {
|
||||
|
||||
@ -597,6 +611,26 @@
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
});
|
||||
|
||||
|
||||
$.get(url_for_cd, function(response){
|
||||
|
||||
//console.log(response)
|
||||
//console.log(response.data)
|
||||
|
||||
if(response.status == false && response.insurer_id != 'undefined'){
|
||||
toastr.warning('The CD Account Number not found.', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
appendCDACNO(response.data)
|
||||
|
||||
}).fail(function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@ -606,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()
|
||||
@ -617,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();
|
||||
@ -646,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();
|
||||
}
|
||||
@ -655,7 +703,7 @@
|
||||
|
||||
} else {
|
||||
|
||||
// console.log('step 3')
|
||||
// //console.log('step 3')
|
||||
|
||||
var displayStatus = $('#base_policy_id').css('display');
|
||||
$('#base_policy_id').hide();
|
||||
@ -663,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();
|
||||
}
|
||||
@ -690,7 +738,7 @@
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('client_policy_res', res)
|
||||
//console.log('client_policy_res', res)
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
@ -720,7 +768,6 @@
|
||||
// $('#policy').val(res.data.policy_id).change();
|
||||
$('#policy_type').val(res.data.is_addon).change();
|
||||
$('#base_policy').val(res.data.base_policy);
|
||||
$('#client_branch').val(res.data.client_branch_id).change();
|
||||
|
||||
$('#policy_type_id').val(res.data.policy_type_id);
|
||||
$('#policy_PrimaryKey').val(res.data.id);
|
||||
@ -730,6 +777,7 @@
|
||||
$('#policy_status').val(checkDateStatus(res.data.policy_end_date));
|
||||
$('#policy_status_field').show();
|
||||
|
||||
|
||||
if (res.data.inception_type == 2) {
|
||||
$('#inception_type').prop('checked', true);
|
||||
} else {
|
||||
@ -841,6 +889,12 @@
|
||||
}, 3000);
|
||||
|
||||
|
||||
setTimeout(function(){
|
||||
appendCDACNO(res.cd_data, res.data.cd_ac_no)
|
||||
}, 3000)
|
||||
|
||||
$('#client_branch').val(res.data.client_branch_id).change();
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
@ -848,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({
|
||||
@ -938,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);
|
||||
}
|
||||
@ -1086,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 `;
|
||||
@ -1110,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
|
||||
@ -1128,7 +1183,7 @@
|
||||
maximumFractionDigits: 2
|
||||
});
|
||||
|
||||
console.log('formetted value', value);
|
||||
//console.log('formetted value', value);
|
||||
|
||||
input.value = (value);
|
||||
|
||||
@ -1195,7 +1250,7 @@
|
||||
|
||||
|
||||
function removeClientPolicy(element) {
|
||||
// console.log(element);
|
||||
// //console.log(element);
|
||||
}
|
||||
|
||||
|
||||
@ -1286,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,
|
||||
@ -1294,7 +1349,7 @@
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('one', res)
|
||||
//console.log('one', res)
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
@ -1308,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) {
|
||||
@ -1316,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>';
|
||||
@ -1338,7 +1393,7 @@
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log('Something Wrong!', 'warning');
|
||||
//console.log('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
@ -1350,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,
|
||||
@ -1368,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();
|
||||
@ -1382,7 +1437,7 @@
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log(res)
|
||||
//console.log(res)
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
@ -1401,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
|
||||
@ -1415,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');
|
||||
@ -1439,7 +1494,7 @@
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log('Something Wrong!', 'warning');
|
||||
//console.log('Something Wrong!', 'warning');
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
@ -1454,7 +1509,7 @@
|
||||
|
||||
function fetchClientBranch() {
|
||||
|
||||
console.log('function called');
|
||||
//console.log('function called');
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
@ -1478,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');
|
||||
@ -1523,9 +1578,37 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#client_branch").on('change', function() {
|
||||
// console.log('fetchClientPolicyList change')
|
||||
// //console.log('fetchClientPolicyList change')
|
||||
fetchClientPolicyList();
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
|
||||
function appendCDACNO(data, select = null) {
|
||||
|
||||
//console.log('appendCDACNO', data);
|
||||
//console.log('appendCDACNO', select);
|
||||
|
||||
$('#cd_ac_no').empty();
|
||||
$('#cd_ac_no').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select CD Account Number'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
const option = $('<option>', {
|
||||
value: item.cd_ac_no,
|
||||
text: item.cd_ac_no
|
||||
});
|
||||
|
||||
if (select === item.cd_ac_no) {
|
||||
//console.log('selected');
|
||||
option.attr('selected', true);
|
||||
}
|
||||
|
||||
$('#cd_ac_no').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -869,7 +869,7 @@ $(document).ready(function() {
|
||||
$('#policy_id').change(function(){
|
||||
|
||||
var selectedpolicy = $(this).val();
|
||||
// console.log('selectedpolicy',selectedpolicy)
|
||||
console.log('selectedpolicy',selectedpolicy)
|
||||
$('#upload-action-type').val('').change();
|
||||
$('#file_upload').hide();
|
||||
$('#excel_download').removeAttr('href');
|
||||
@ -885,27 +885,31 @@ $(document).ready(function() {
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
// console.log('responce data emp_count', response);
|
||||
console.log('responce data emp_count', response);
|
||||
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
// console.log(response.emp_count.length)
|
||||
console.log(response.emp_count.length)
|
||||
if(response.emp_count > 0){
|
||||
|
||||
var select = document.getElementById("upload-action-type");
|
||||
for (var i = 0; i < select.options.length; i++) {
|
||||
select.options[i].disabled = false;
|
||||
if (select.options[i].value === "inception") {
|
||||
select.options[i].disabled = true;
|
||||
break;
|
||||
// break;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
}else {
|
||||
|
||||
var select = document.getElementById("upload-action-type");
|
||||
for (var i = 0; i < select.options.length; i++) {
|
||||
select.options[i].disabled = true;
|
||||
if (select.options[i].value === "inception") {
|
||||
select.options[i].disabled = false;
|
||||
break;
|
||||
}
|
||||
if (select.options[i].value === "") {
|
||||
select.options[i].disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -933,6 +937,16 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
if($('#policy_id').val() == 0){
|
||||
|
||||
var select = document.getElementById("upload-action-type");
|
||||
console.log('select', select)
|
||||
for (var i = 0; i < select.options.length; i++) {
|
||||
select.options[i].disabled = false;
|
||||
console.log(select.options[i])
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
@ -159,7 +159,7 @@
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
|
||||
console.log('responce', response)
|
||||
// console.log('responce', response)
|
||||
|
||||
if(response.status == false){
|
||||
$('#notification_count').html('0')
|
||||
|
||||
@ -543,16 +543,17 @@
|
||||
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
||||
<i class="fas fa-user-tie"></i>
|
||||
<span class="badge badge-success badge-pill float-right">2</span>
|
||||
<span> Employees </span>
|
||||
<span> Members </span>
|
||||
</a>
|
||||
<div class="collapse" id="sidebarDashboards">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/list') ?>">List</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/upload') ?>">Upload</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/list') ?>">List</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/endorsement-list') ?>">Endorsement List</a>
|
||||
</li>
|
||||
@ -580,6 +581,9 @@
|
||||
<li>
|
||||
<a href="<?= base_url('/master/policy/list') ?>">Policy</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
619
app/Views/other_policy_terms.php
Normal file
619
app/Views/other_policy_terms.php
Normal file
@ -0,0 +1,619 @@
|
||||
<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);
|
||||
} else {
|
||||
formObject[key] = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
console.log(formObject);
|
||||
|
||||
|
||||
const jsonString = JSON.stringify(formObject);
|
||||
console.log(jsonString);
|
||||
|
||||
// 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
|
||||
];
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//normal terms fields
|
||||
let jsonObject = JSON.parse(res.data);
|
||||
Object.keys(jsonObject).forEach(function(key) {
|
||||
|
||||
let elements = document.getElementsByName(key);
|
||||
|
||||
// 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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
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('');
|
||||
});
|
||||
|
||||
|
||||
$("#sumInsured2").on("keyup", function() {
|
||||
var inputNumber = $(this).val();
|
||||
if (inputNumber) {
|
||||
var result = convertCommaNumberToWords(inputNumber);
|
||||
$("#numberToWordSumInsured").text(result);
|
||||
} else {
|
||||
$("#numberToWordSumInsured").text("");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#totalSumInsured").on("keyup", function() {
|
||||
var inputNumber = $(this).val();
|
||||
if (inputNumber) {
|
||||
var result = convertCommaNumberToWords(inputNumber);
|
||||
$("#numberToWordTotalSumInsured").text(result);
|
||||
} else {
|
||||
$("#numberToWordTotalSumInsured").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="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="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 appendOtherTermsSIAddMore(data = null){
|
||||
|
||||
console.log('function called')
|
||||
|
||||
var html = `
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="sumInsured">Additional Sum Insured</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input value="${data == null || data == undefined || data == "" ? '' : data}" type="text" name="multiple_sum_insured[]" class="form-control multiple_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<button type="button" class="btn btn-danger si-remove-multi" onclick="removeGMCAdditionalSI(this)">x</button>
|
||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="text-danger-2 numberToWordSumInsured"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
$('#other_si_add_more').append(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 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">
|
||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGMCSIAddMore()">+</button>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
@ -120,6 +123,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="gmc_si_add_more"></div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Family Floater</label>
|
||||
@ -136,14 +141,14 @@
|
||||
<tr>
|
||||
<td style="width: 11%;"><span style="margin-right: 20px;">Self:</span></td>
|
||||
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked> </td>
|
||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo (isset($self_min_age) && $self_min_age > 0) ? $self_min_age : '18'; ?>" style="width: 25%;;" type="number" name="self_min_age" id="self_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 25%;;" type="number" name="self_max_age" id="self_max_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo (isset($self_min_age) && $self_min_age > 0) ? $self_min_age : '18'; ?>" style="width: 35%;;" type="number" name="self_min_age" id="self_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 35%;;" type="number" name="self_max_age" id="self_max_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||
<tr>
|
||||
<td style="width: 11%;"><span style="margin-right: 20px;">Spouse:</span></td>
|
||||
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;"name="family_floaters[]" value="spouse" id="spouse"></td>
|
||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($spouse_min_age) ? $spouse_min_age : '18'; ?>" style="width: 25%;;" type="number" name="spouse_min_age" id="spouse_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($spouse_max_age) ? $spouse_max_age : '60'; ?>" style="width: 25%;;" type="number" name="spouse_max_age" id="spouse_max_age" ></div></td>
|
||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($spouse_min_age) ? $spouse_min_age : '18'; ?>" style="width: 35%;;" type="number" name="spouse_min_age" id="spouse_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($spouse_max_age) ? $spouse_max_age : '60'; ?>" style="width: 35%;;" type="number" name="spouse_max_age" id="spouse_max_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||
<tr>
|
||||
<td style="width: 11%;"><span for="children">Children:</span></td>
|
||||
@ -155,8 +160,8 @@
|
||||
<option value="4">4</option>
|
||||
</select>
|
||||
</td>
|
||||
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($child_min_age) ? $child_min_age : '0'; ?>" style="width: 25%;;" type="number" name="child_min_age" id="child_min_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($child_max_age) ? $child_max_age : '25'; ?>" style="width: 25%;;" type="number" name="child_max_age" id="child_max_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($child_min_age) ? $child_min_age : '0'; ?>" style="width: 35%;;" type="number" name="child_min_age" id="child_min_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($child_max_age) ? $child_max_age : '25'; ?>" style="width: 35%;;" type="number" name="child_max_age" id="child_max_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -184,21 +189,19 @@
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 22%;" ><div class="other-member-age"><span style="margin-right: 20px;">Elders Count:</span><input class="underline-input" id="member_count" style="width: 25%;;" type="number" name="member_count" disabled id="member_count"></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($other_member_min_age) ? $other_member_min_age : '18'; ?>" style="width: 25%;;" type="number" class="underline-input min_age" name="other_member_min_age" id="other_member_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($other_member_max_age) ? $other_member_max_age : '60'; ?>" style="width: 25%;;" type="number" class="underline-input max_age" name="other_member_max_age" id="other_member_max_age" ></div></td>
|
||||
<td style="width: 22%;" ><div class="other-member-age"><span style="margin-right: 20px;">Elders Count:</span><input class="underline-input" id="member_count" style="width: 30%;;" type="number" name="member_count" disabled id="member_count"></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age" style="margin-left: 32px;"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($other_member_min_age) ? $other_member_min_age : '18'; ?>" style="width: 35%;;" type="number" class="underline-input min_age" name="other_member_min_age" id="other_member_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age" style="margin-left: 17px;"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($other_member_max_age) ? $other_member_max_age : '60'; ?>" style="width: 35%;;" type="number" class="underline-input max_age" name="other_member_max_age" id="other_member_max_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<!-- <div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Corporate Buffer</label>
|
||||
</div>
|
||||
@ -206,7 +209,7 @@
|
||||
<input type="radio" name="corporatebuffer" value="1"> Yes
|
||||
<input type="radio" name="corporatebuffer" value="0" style="margin-left:10px"> No
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
@ -305,6 +308,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Post Hospitalization Cover</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="posthospitalizationcover" id="posthospitalizationcover" class="form-control ">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Congenital Diseases - Internal</label>
|
||||
@ -315,6 +327,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Congenital Diseases - External</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="congenitaldiseasesexternal" id="congenitaldiseasesexternal" class="form-control ">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Co-Pay/Zone wise Co Pay</label>
|
||||
@ -323,6 +344,29 @@
|
||||
<select name="copayzonewisecopay" id="copayzonewisecopay" class="form-control ">
|
||||
<option value="">Select an option</option>
|
||||
<option value="Nil">Nil</option>
|
||||
<option value="5%">5%</option>
|
||||
<option value="10%">10%</option>
|
||||
<option value="15%">15%</option>
|
||||
<option value="20%">20%</option>
|
||||
<option value="25%">25%</option>
|
||||
<option value="30%">30%</option>
|
||||
<option value="35%">35%</option>
|
||||
<option value="40%">40%</option>
|
||||
<option value="45%">45%</option>
|
||||
<option value="50%">50%</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Optional Parental Co-Pay</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<select name="optionalparentalcopay" id="optionalparentalcopay" class="form-control ">
|
||||
<option value="">Select an option</option>
|
||||
<option value="Nil">Nil</option>
|
||||
<option value="5%">5%</option>
|
||||
<option value="10%">10%</option>
|
||||
<option value="15%">15%</option>
|
||||
<option value="20%">20%</option>
|
||||
@ -367,14 +411,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<!-- <div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Nursing Allowance</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="nursingallowance" id="nursingallowance" class="form-control ">
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
@ -386,6 +430,24 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Corporate Buffer</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="corporatebuffer" id="corporatebuffer" class="form-control ">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Sublimit of Corporate Buffer</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="sublimitofcorporatebuffer" id="sublimitofcorporatebuffer" class="form-control ">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Ambulance Charges</label>
|
||||
@ -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,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (key.includes("multiple_sum_insured")) {
|
||||
jsonObject[key].forEach((value, index) => {
|
||||
appendGMCSIAddMore(value);
|
||||
});
|
||||
}
|
||||
|
||||
if (key.includes("family_floaters")) {
|
||||
let checkboxes = document.querySelectorAll(`input[name="${key}[]"]`);
|
||||
if (jsonObject[key]) {
|
||||
|
||||
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 +986,11 @@
|
||||
$('.waiverof1234thyearexclusions').prop('disabled', true);
|
||||
$('.waiverof30dayswaitingperiod').prop('disabled', true);
|
||||
$('#prehospitalizationcover').prop('disabled', true);
|
||||
$('#posthospitalizationcover').prop('disabled', true);
|
||||
$('.congenitaldiseasesinternal').prop('disabled', true);
|
||||
$('#congenitaldiseasesexternal').prop('disabled', true);
|
||||
$('#copayzonewisecopay').prop('disabled', true);
|
||||
$('#optionalparentalcopay').prop('disabled', true);
|
||||
$('#bioabsorbablestenttoriclensmultifocallens').prop('disabled', true);
|
||||
$('#roomrentlimit').prop('disabled', true);
|
||||
$('#proportionatedeductionclause').prop('disabled', true);
|
||||
@ -939,6 +1012,8 @@
|
||||
$('#moderntreatmentsasperirdai').prop('disabled', true);
|
||||
$('#days_of_discharge').prop('disabled', true);
|
||||
$('#days_from_dod').prop('disabled', true);
|
||||
$('#corporatebuffer').prop('disabled', true);
|
||||
$('#sublimitofcorporatebuffer').prop('disabled', true);
|
||||
|
||||
setTimeout(function() {
|
||||
var editor1 = new Jodit('#additionalsicknessbenefit');
|
||||
@ -998,7 +1073,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 +1102,8 @@
|
||||
});
|
||||
}
|
||||
$("#sum_insured").trigger("keyup");
|
||||
|
||||
$(".multiple_sum_insured").trigger("keyup");
|
||||
|
||||
$('.jodit-wysiwyg').each(function() {
|
||||
$(this).click();
|
||||
});
|
||||
@ -1047,8 +1123,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 +1163,7 @@
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log('Something Wrong!', 'warning');
|
||||
//console.log('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
@ -1109,8 +1185,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 +1221,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 +1233,7 @@
|
||||
} else {
|
||||
$("#numberToWordGMC").text("");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
@ -1179,7 +1258,7 @@
|
||||
<script>
|
||||
document.getElementById('myButtonSpecialCondition').addEventListener('click', function(event) {
|
||||
|
||||
console.log('specialCondition callback clicked')
|
||||
//console.log('specialCondition callback clicked')
|
||||
event.preventDefault();
|
||||
specialCondition();
|
||||
|
||||
@ -1188,13 +1267,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 +1283,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 +1398,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 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">
|
||||
<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">
|
||||
<div class="col-md-4">
|
||||
<input class="form-control" type="text" name="sumInsured2" id="sumInsured2" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" style="width: 100% !important;">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-2">
|
||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div id='numberToWordSumInsured' class="text-danger-2" ></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="gpa_si_add_more"></div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Total Sum Assured</label>
|
||||
@ -132,13 +137,13 @@
|
||||
<td style="width: 20%;">
|
||||
<div class="self-age">
|
||||
<span style="margin-right: 20px;">Min Age:</span>
|
||||
<input class="underline-input min_age" value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>" style="width: 44%;" type="number" name="self_min_age" id="self_min_age_gpa" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)">
|
||||
<input class="underline-input min_age" value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>" style="width: 65%;" type="number" name="self_min_age" id="self_min_age_gpa" oninput="lowerIsEighteen(this)">
|
||||
</div>
|
||||
</td>
|
||||
<td style="width: 20%;">
|
||||
<div class="self-age">
|
||||
<span style="margin-right: 20px;">Max Age:</span>
|
||||
<input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 44%;" type="number" name="self_max_age" id="self_max_age_gpa" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)">
|
||||
<input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 65%;" type="number" name="self_max_age" id="self_max_age_gpa" oninput="lowerIsEighteen(this)">
|
||||
</div>
|
||||
</td>
|
||||
<td ></td>
|
||||
@ -569,6 +574,12 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (key.includes("multiple_sum_insured")) {
|
||||
gpaJsonObjectForSpecialCondition[key].forEach((value, index) => {
|
||||
appendGPASIAddMore(value);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
let jsonObject = JSON.parse(res.data);
|
||||
@ -634,6 +645,7 @@
|
||||
|
||||
}
|
||||
$("#sumInsured2").trigger("keyup");
|
||||
$('.multiple_sum_insured').trigger("keyup");
|
||||
$("#totalSumInsured").trigger("keyup");
|
||||
|
||||
|
||||
@ -651,7 +663,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 +735,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 +782,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 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">
|
||||
<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,540 @@ th {
|
||||
|
||||
|
||||
<script>
|
||||
const formatType = 0; // Specify the format type here
|
||||
const excel_headers = {
|
||||
const formatType = 0; // Specify the format type here
|
||||
const excel_headers = {
|
||||
|
||||
1: {
|
||||
|
||||
1: {
|
||||
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
2: {
|
||||
"basic_pay": "Basic Pay",
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
3: {
|
||||
"band_or_grade": "Band or Grade",
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
4: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
5: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
6: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
7: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
8: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"grade": "Grade",
|
||||
"premium": "Premium"
|
||||
},
|
||||
9: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
10: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
11: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"grade": "Grade",
|
||||
"premium": "Premium",
|
||||
"max_si": "Max Si"
|
||||
},
|
||||
12: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"relationship": "Relationship",
|
||||
"premium": "Premium"
|
||||
},
|
||||
13: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"relationship": "Relationship",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function slugify(text) {
|
||||
return text.toString().toLowerCase().replace(/\s+/g, '_').replace(/[^\w\-]+/g, '').replace(/\-\-+/g, '_')
|
||||
.replace(/^-+/, '').replace(/-+$/, '');
|
||||
},
|
||||
2: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
3: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
4: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
5: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
6: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
7: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
8: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"grade": "Grade",
|
||||
"premium": "Premium"
|
||||
},
|
||||
9: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
10: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
11: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"grade": "Grade",
|
||||
"premium": "Premium",
|
||||
"max_si": "Max Si"
|
||||
},
|
||||
12: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"relationship": "Relationship",
|
||||
"premium": "Premium"
|
||||
},
|
||||
13: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"relationship": "Relationship",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
}
|
||||
|
||||
function copyHeaders(rack_rate_type) {
|
||||
};
|
||||
|
||||
let formatType = $('#grid').val();
|
||||
var obj = $('#grid');
|
||||
if(rack_rate_type == 1){
|
||||
formatType = $('#additional_grid').val();
|
||||
obj = $('#additional_grid');
|
||||
}
|
||||
function slugify(text) {
|
||||
return text.toString().toLowerCase().replace(/\s+/g, '_').replace(/[^\w\-]+/g, '').replace(/\-\-+/g, '_')
|
||||
.replace(/^-+/, '').replace(/-+$/, '');
|
||||
}
|
||||
|
||||
console.log(obj)
|
||||
console.log(formatType)
|
||||
function copyHeaders(rack_rate_type) {
|
||||
|
||||
if(!formatType && formatType == ""){
|
||||
toastr.warning('Please select the Policy Premium Type', 'Warning');
|
||||
return;
|
||||
}
|
||||
const headerString = Object.values(excel_headers[formatType]).join("\t"); // Using specified format type for copying headers
|
||||
navigator.clipboard.writeText(headerString).then(function() {
|
||||
toastr.success('Headers copied to clipboard', 'success');
|
||||
}, function(err) {
|
||||
toastr.error(err, 'Could not copy headers:');
|
||||
});
|
||||
let formatType = $('#grid').val();
|
||||
var secondKey = $('#si_or_bp').val();
|
||||
var obj = $('#grid');
|
||||
|
||||
if (rack_rate_type == 1) {
|
||||
formatType = $('#additional_grid').val();
|
||||
obj = $('#additional_grid');
|
||||
}
|
||||
|
||||
function generateTable(rack_rate_type) {
|
||||
|
||||
var data = $('#copied_excel_data').val();
|
||||
let formatType = $('#grid').val();
|
||||
var obj = $('#grid');
|
||||
|
||||
if (rack_rate_type == 1) {
|
||||
data = $('#additional_copied_excel_data').val();
|
||||
formatType = $('#additional_grid').val();
|
||||
obj = $('#additional_grid');
|
||||
}
|
||||
|
||||
console.log(obj);
|
||||
console.log(formatType);
|
||||
console.log(data);
|
||||
|
||||
if (!formatType || formatType == "") {
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
toastr.warning('Please select the Policy Premium Type', 'Warning');
|
||||
if (formatType == 1) {
|
||||
if (secondKey == "") {
|
||||
toastr.warning('Please select the Basic Pay, Sum Insured or Band/Grade', 'Warning');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if Excel data is empty
|
||||
if (!data.trim()) {
|
||||
toastr.warning('Excel data is empty.', 'Warning');
|
||||
return;
|
||||
// //console.log(obj)
|
||||
// //console.log(formatType)
|
||||
// //console.log(rack_rate_type)
|
||||
|
||||
if (!formatType && formatType == "") {
|
||||
toastr.warning('Please select the Policy Premium Type', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
// //console.log('after toastr')
|
||||
// //console.log('excel_headers[formatType]', excel_headers[formatType])
|
||||
// //console.log('excel_headers[formatType]', typeof excel_headers[formatType])
|
||||
|
||||
if (excel_headers[formatType] == undefined) {
|
||||
toastr.error('Headers not found', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
var headerString = Object.values(excel_headers[formatType]).join(
|
||||
"\t"); // Using specified format type for copying headers
|
||||
if (formatType == 1) {
|
||||
var headerString = Object.values(excel_headers[formatType][secondKey]).join(
|
||||
"\t"); // Using specified format type for copying headers
|
||||
}
|
||||
//console.log('headerString', headerString);
|
||||
navigator.clipboard.writeText(headerString).then(function() {
|
||||
toastr.success('Headers copied to clipboard', 'success');
|
||||
}, function(err) {
|
||||
toastr.error(err, 'Could not copy headers:');
|
||||
});
|
||||
}
|
||||
|
||||
function generateTable(rack_rate_type) {
|
||||
|
||||
var data = $('#copied_excel_data').val();
|
||||
let formatType = $('#grid').val();
|
||||
var obj = $('#grid');
|
||||
var secondKey = $('#si_or_bp').val();
|
||||
|
||||
|
||||
if (rack_rate_type == 1) {
|
||||
data = $('#additional_copied_excel_data').val();
|
||||
formatType = $('#additional_grid').val();
|
||||
obj = $('#additional_grid');
|
||||
}
|
||||
|
||||
//console.log(obj);
|
||||
//console.log(formatType);
|
||||
//console.log(data);
|
||||
console.log(secondKey);
|
||||
|
||||
if (!formatType || formatType == "") {
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
toastr.warning('Please select the Policy Premium Type', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if Excel data is empty
|
||||
if (!data.trim()) {
|
||||
toastr.warning('Excel data is empty.', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
var rows = data.split("\n");
|
||||
|
||||
//console.log('rows', rows)
|
||||
|
||||
// Filter out empty rows
|
||||
rows = rows.filter(rowText => rowText.split("\t").some(cell => cell.trim()));
|
||||
|
||||
//console.log('rows', rows)
|
||||
|
||||
if (rows.length === 0) {
|
||||
toastr.warning('All rows are empty after filtering.', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
var header = rows[0].split("\t");
|
||||
|
||||
console
|
||||
|
||||
// Determine the columns to keep (non-empty columns)
|
||||
var columnsToKeep = [];
|
||||
for (let i = 0; i < header.length; i++) {
|
||||
if (rows.some(rowText => rowText.split("\t")[i].trim())) {
|
||||
columnsToKeep.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
var rows = data.split("\n");
|
||||
// Filter header based on columns to keep
|
||||
header = columnsToKeep.map(i => slugify(header[i]));
|
||||
|
||||
// Filter out empty rows
|
||||
rows = rows.filter(rowText => rowText.split("\t").some(cell => cell.trim()));
|
||||
if (!excel_headers[formatType]) {
|
||||
toastr.warning("Unknown format type. Please check the header columns.", 'Warning');
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
return;
|
||||
}
|
||||
|
||||
if (rows.length === 0) {
|
||||
toastr.warning('All rows are empty after filtering.', 'Warning');
|
||||
return;
|
||||
}
|
||||
var expectedHeader = Object.keys(excel_headers[formatType]);
|
||||
//console.log('expectedHeader 1st', expectedHeader);
|
||||
|
||||
var header = rows[0].split("\t");
|
||||
|
||||
// Determine the columns to keep (non-empty columns)
|
||||
var columnsToKeep = [];
|
||||
for (let i = 0; i < header.length; i++) {
|
||||
if (rows.some(rowText => rowText.split("\t")[i].trim())) {
|
||||
columnsToKeep.push(i);
|
||||
}
|
||||
}
|
||||
if (formatType == 1) {
|
||||
|
||||
// Filter header based on columns to keep
|
||||
header = columnsToKeep.map(i => slugify(header[i]));
|
||||
//console.log('si_or_bp secondKey', secondKey)
|
||||
expectedHeader = Object.keys(excel_headers[formatType][secondKey]);
|
||||
}
|
||||
|
||||
if (!excel_headers[formatType]) {
|
||||
toastr.warning("Unknown format type. Please check the header columns.", 'Warning');
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
return;
|
||||
}
|
||||
//console.log('expectedHeader', expectedHeader);
|
||||
//console.log('HEADERS' , JSON.stringify(header))
|
||||
//console.log('Excepted HEADERS' , JSON.stringify(expectedHeader))
|
||||
|
||||
var expectedHeader = Object.keys(excel_headers[formatType]);
|
||||
|
||||
if (JSON.stringify(header) !== JSON.stringify(expectedHeader)) {
|
||||
const expectedHeaders = JSON.stringify(Object.values(excel_headers[formatType]));
|
||||
const receivedHeaders = JSON.stringify(columnsToKeep.map(i => rows[0].split("\t")[i]));
|
||||
if (secondKey != 2) {
|
||||
|
||||
Swal.fire({
|
||||
title: "Header Mismatch",
|
||||
html: `
|
||||
if (JSON.stringify(header) !== JSON.stringify(expectedHeader)) {
|
||||
const expectedHeaders = JSON.stringify(Object.values(excel_headers[formatType][secondKey]));
|
||||
const receivedHeaders = JSON.stringify(columnsToKeep.map(i => rows[0].split("\t")[i]));
|
||||
|
||||
Swal.fire({
|
||||
title: "Header Mismatch",
|
||||
html: `
|
||||
<p>Header columns do not match expected format:</p>
|
||||
<p><strong>Expected:</strong> ${expectedHeaders}</p>
|
||||
<p><strong>Received:</strong> ${receivedHeaders}</p>
|
||||
`,
|
||||
icon: "error"
|
||||
});
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
icon: "error"
|
||||
});
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var table = $('<table class="table table-striped compact-table" />');
|
||||
var uniqueRows = new Set();
|
||||
var emptyCellCount = 0;
|
||||
|
||||
rows.forEach((rowText, y) => {
|
||||
var cells = rowText.split("\t").filter((_, i) => columnsToKeep.includes(i));
|
||||
var row = $('<tr />');
|
||||
|
||||
// Skip empty rows after filtering columns
|
||||
if (cells.every(cell => !cell.trim())) {
|
||||
return;
|
||||
}
|
||||
|
||||
var table = $('<table class="table table-striped compact-table" />');
|
||||
var uniqueRows = new Set();
|
||||
var emptyCellCount = 0;
|
||||
|
||||
rows.forEach((rowText, y) => {
|
||||
var cells = rowText.split("\t").filter((_, i) => columnsToKeep.includes(i));
|
||||
var row = $('<tr />');
|
||||
|
||||
// Skip empty rows after filtering columns
|
||||
if (cells.every(cell => !cell.trim())) {
|
||||
return;
|
||||
cells.forEach(cellText => {
|
||||
row.append('<td>' + cellText + '</td>');
|
||||
if (!cellText.trim()) {
|
||||
emptyCellCount++;
|
||||
}
|
||||
});
|
||||
|
||||
cells.forEach(cellText => {
|
||||
row.append('<td>' + cellText + '</td>');
|
||||
if (!cellText.trim()) {
|
||||
emptyCellCount++;
|
||||
}
|
||||
});
|
||||
var si_or_bp = $('#si_or_bp').val();
|
||||
var key;
|
||||
switch (formatType) {
|
||||
|
||||
var key;
|
||||
switch (formatType) {
|
||||
case 3:
|
||||
case 1:
|
||||
if (si_or_bp == 1) {
|
||||
key = cells[0] + "|" + cells[1] // Sum Insured, Premium
|
||||
break;
|
||||
case 4:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 5:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 6:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 7:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 8:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Grade, Premium
|
||||
break;
|
||||
case 9:
|
||||
key = cells[0] + "|" + cells[1]; // Sum Insured, Premium
|
||||
break;
|
||||
case 10:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 11:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, Grade, Premium, Max SI
|
||||
break;
|
||||
case 12:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Relationship, Premium
|
||||
break;
|
||||
case 13:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3] + "|" + cells[4]; // Sum Insured, Relationship, From Age, To Age, Premium
|
||||
break;
|
||||
default:
|
||||
key = cells.join("|");
|
||||
} else if (si_or_bp == 2) {
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] //Basic Pay, Sum Insured, Premium
|
||||
} else if (si_or_bp == 3) {
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] //Band or Grade, Sum Insured, Premium
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
key = cells[0] + "|" + cells[1] // Sum Insured, Premium
|
||||
break;
|
||||
case 3:
|
||||
key = cells[0] + "|" + cells[1] // Sum Insured, Premium
|
||||
break;
|
||||
case 4:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
||||
3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 5:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
||||
3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 6:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
||||
3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 7:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
||||
3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 8:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Grade, Premium
|
||||
break;
|
||||
case 9:
|
||||
key = cells[0] + "|" + cells[1]; // Sum Insured, Premium
|
||||
break;
|
||||
case 10:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
||||
3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 11:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
||||
3]; // Sum Insured, Grade, Premium, Max SI
|
||||
break;
|
||||
case 12:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Relationship, Premium
|
||||
break;
|
||||
case 13:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3] + "|" + cells[
|
||||
4]; // Sum Insured, Relationship, From Age, To Age, Premium
|
||||
break;
|
||||
default:
|
||||
key = cells.join("|");
|
||||
|
||||
}
|
||||
|
||||
if (y > 0 && uniqueRows.has(key)) {
|
||||
row.addClass('duplicate');
|
||||
} else {
|
||||
uniqueRows.add(key);
|
||||
}
|
||||
table.append(row);
|
||||
});
|
||||
|
||||
if (rack_rate_type == 1) {
|
||||
$('#additional_excel_table').empty();
|
||||
$('#additional_excel_table').html(table);
|
||||
} else if (rack_rate_type == 0) {
|
||||
$('#excel_table').empty();
|
||||
$('#excel_table').html(table);
|
||||
}
|
||||
|
||||
if ($('.duplicate').length > 0) {
|
||||
console.log('test');
|
||||
toastr.warning("Duplicates found!", "warning");
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
if (y > 0 && uniqueRows.has(key)) {
|
||||
row.addClass('duplicate');
|
||||
} else {
|
||||
uniqueRows.add(key);
|
||||
}
|
||||
table.append(row);
|
||||
});
|
||||
|
||||
if (emptyCellCount > 0) {
|
||||
toastr.warning('Number of empty cells: ' + emptyCellCount);
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
}
|
||||
submitData(rack_rate_type);
|
||||
if (rack_rate_type == 1) {
|
||||
$('#additional_excel_table').empty();
|
||||
$('#additional_excel_table').html(table);
|
||||
} else if (rack_rate_type == 0) {
|
||||
$('#excel_table').empty();
|
||||
$('#excel_table').html(table);
|
||||
}
|
||||
|
||||
if ($('.duplicate').length > 0) {
|
||||
//console.log('test');
|
||||
toastr.warning("Duplicates found!", "warning");
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
}
|
||||
|
||||
if (emptyCellCount > 0) {
|
||||
toastr.warning('Number of empty cells: ' + emptyCellCount);
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
}
|
||||
submitData(rack_rate_type);
|
||||
}
|
||||
|
||||
function submitData(rack_rate_type) {
|
||||
|
||||
let formatType = $('#grid').val();
|
||||
var table = $('#excel_table table');
|
||||
var obj = $('#grid');
|
||||
|
||||
var si_or_bp = $('#si_or_bp').val();
|
||||
var basic_multiplier = $('#basic_multiplier').val();
|
||||
var premium_multiplier = $('#premium_multiplier').val();
|
||||
|
||||
var gpa_sum_multiplier2 = $('#gpa_sum_multiplier2').val();
|
||||
var gpa_sum_multiplier = $('#gpa_sum_multiplier').val();
|
||||
|
||||
|
||||
|
||||
if (rack_rate_type == 1) {
|
||||
|
||||
formatType = $('#additional_grid').val();
|
||||
table = $('#additional_excel_table table');
|
||||
obj = $('#additional_grid');
|
||||
}
|
||||
|
||||
|
||||
function submitData(rack_rate_type) {
|
||||
var headers = $(table).find('tr').first().find('td').map(function() {
|
||||
return slugify($(this).text());
|
||||
}).get();
|
||||
|
||||
let formatType = $('#grid').val();
|
||||
var table = $('#excel_table table');
|
||||
var obj = $('#grid');
|
||||
var rows = $(table).find('tr:gt(0)').map(function() {
|
||||
return $(this).find('td').map(function() {
|
||||
return $(this).text();
|
||||
}).get();
|
||||
}).get();
|
||||
|
||||
if(rack_rate_type == 1){
|
||||
var jsonData = [];
|
||||
|
||||
formatType = $('#additional_grid').val();
|
||||
table = $('#additional_excel_table table');
|
||||
obj = $('#additional_grid');
|
||||
$(table).find('tr:gt(0)').each(function(idx) {
|
||||
var row = $(this).find('td').map(function() {
|
||||
return $(this).text();
|
||||
}).get();
|
||||
var rowData = {};
|
||||
row.forEach((cell, colIdx) => {
|
||||
rowData[headers[colIdx]] = cell;
|
||||
});
|
||||
jsonData.push(rowData);
|
||||
});
|
||||
|
||||
//console.log(jsonData);
|
||||
|
||||
jsonData.forEach(obj => {
|
||||
|
||||
// console.log('obj', obj)
|
||||
// console.log('length of the obj', obj.length)
|
||||
|
||||
|
||||
if ('sum_insured' in obj) {
|
||||
obj.si = obj.sum_insured;
|
||||
delete obj.sum_insured;
|
||||
}
|
||||
|
||||
|
||||
var headers = $(table).find('tr').first().find('td').map(function() {
|
||||
return slugify($(this).text());
|
||||
}).get();
|
||||
|
||||
var rows = $(table).find('tr:gt(0)').map(function() {
|
||||
return $(this).find('td').map(function() {
|
||||
return $(this).text();
|
||||
}).get();
|
||||
}).get();
|
||||
|
||||
var jsonData = [];
|
||||
|
||||
$(table).find('tr:gt(0)').each(function(idx) {
|
||||
var row = $(this).find('td').map(function() {
|
||||
return $(this).text();
|
||||
}).get();
|
||||
var rowData = {};
|
||||
row.forEach((cell, colIdx) => {
|
||||
rowData[headers[colIdx]] = cell;
|
||||
});
|
||||
jsonData.push(rowData);
|
||||
});
|
||||
|
||||
console.log(jsonData);
|
||||
|
||||
jsonData.forEach(obj => {
|
||||
|
||||
if ('sum_insured' in obj) {
|
||||
obj.si = obj.sum_insured;
|
||||
delete obj.sum_insured;
|
||||
}
|
||||
|
||||
if ('from_age' in obj) {
|
||||
obj.age_from = obj.from_age;
|
||||
delete obj.from_age;
|
||||
}
|
||||
|
||||
if ('to_age' in obj) {
|
||||
obj.age_to = obj.to_age;
|
||||
delete obj.to_age;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(jsonData);
|
||||
|
||||
|
||||
if(rack_rate_type == 1){
|
||||
|
||||
$('#additional_grid_content_input').empty()
|
||||
|
||||
if ($('#copyfromexcelforadditional').text() == "Manual entry") {
|
||||
$('#copyfromexcelforadditional').text("Copy from excel")
|
||||
} else {
|
||||
$('#copyfromexcelforadditional').text("Copy from excel");
|
||||
}
|
||||
|
||||
$('#additional_grid_content_input').toggle();
|
||||
$('#additional_grid_content_from_excel').toggle();
|
||||
|
||||
}else{
|
||||
|
||||
$('#grid_content_input').empty()
|
||||
|
||||
if ($('#copyfromexcel').text() == "Manual entry") {
|
||||
$('#copyfromexcel').text("Copy from excel")
|
||||
} else {
|
||||
$('#copyfromexcel').text("Copy from excel");
|
||||
}
|
||||
|
||||
$('#grid_content_input').toggle();
|
||||
$('#grid_content_from_excel').toggle();
|
||||
|
||||
|
||||
if ('from_age' in obj) {
|
||||
obj.age_from = obj.from_age;
|
||||
delete obj.from_age;
|
||||
}
|
||||
|
||||
$.each(jsonData, function(index, item) {
|
||||
appendGridtHtml(formatType, rack_rate_type, item)
|
||||
});
|
||||
if ('to_age' in obj) {
|
||||
obj.age_to = obj.to_age;
|
||||
delete obj.to_age;
|
||||
}
|
||||
|
||||
if ('band_or_grade' in obj) {
|
||||
obj.grade = obj.band_or_grade;
|
||||
delete obj.band_or_grade;
|
||||
}
|
||||
|
||||
$('input[name="11_max_si[]"]').each(function() {
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
if (formatType == 1) {
|
||||
|
||||
if (si_or_bp == 1) {
|
||||
|
||||
$(`input[name="${formatType}_si[]"]`).each(function() {
|
||||
// console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
obj.si_or_bp = si_or_bp;
|
||||
obj.multiplier = gpa_sum_multiplier ? gpa_sum_multiplier : 0;
|
||||
|
||||
$(`input[name="${formatType}_premium[]"]`).each(function() {
|
||||
// console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
} else if (si_or_bp == 2) {
|
||||
|
||||
obj.si_or_bp = si_or_bp;
|
||||
obj.basic_multiplier = basic_multiplier ? basic_multiplier : 0;
|
||||
obj.multiplier = premium_multiplier ? premium_multiplier : 0;
|
||||
obj.si = obj.basic_pay * obj.basic_multiplier
|
||||
obj.premium = obj.si * obj.multiplier / 1000
|
||||
|
||||
} else if (si_or_bp == 3) {
|
||||
|
||||
obj.si_or_bp = si_or_bp;
|
||||
obj.multiplier = gpa_sum_multiplier2 ? gpa_sum_multiplier2 : 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
console.log(jsonData);
|
||||
|
||||
if (rack_rate_type == 1) {
|
||||
|
||||
$('#additional_grid_content_input').empty()
|
||||
|
||||
if ($('#copyfromexcelforadditional').text() == "Manual entry") {
|
||||
$('#copyfromexcelforadditional').text("Copy from excel")
|
||||
} else {
|
||||
$('#copyfromexcelforadditional').text("Copy from excel");
|
||||
}
|
||||
|
||||
$('#additional_grid_content_input').toggle();
|
||||
$('#additional_grid_content_from_excel').toggle();
|
||||
|
||||
} else {
|
||||
|
||||
$('#grid_content_input').empty()
|
||||
|
||||
if ($('#copyfromexcel').text() == "Manual entry") {
|
||||
$('#copyfromexcel').text("Copy from excel")
|
||||
} else {
|
||||
$('#copyfromexcel').text("Copy from excel");
|
||||
}
|
||||
|
||||
$('#grid_content_input').toggle();
|
||||
$('#grid_content_from_excel').toggle();
|
||||
|
||||
}
|
||||
|
||||
if (formatType == 1 || formatType == 2) {
|
||||
var FirstIndex = jsonData[0]
|
||||
addGridHTML(false, FirstIndex, formatType, si_or_bp, 0)
|
||||
jsonData.shift();
|
||||
}
|
||||
|
||||
$.each(jsonData, function(index, item) {
|
||||
appendGridtHtml(formatType, rack_rate_type, item)
|
||||
});
|
||||
|
||||
|
||||
$('input[name="11_max_si[]"]').each(function() {
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
$(`input[name="${formatType}_si[]"]`).each(function() {
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
$(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>
|
||||
@ -76,11 +76,12 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12" style="text-align: right;">
|
||||
<a href="<?= base_url("client/deposit/$clientData->id"); ?>"><i class="fas fa-arrow-left" style="font-size: 17px;"></i></a>
|
||||
<div class="row">
|
||||
<div class="col-12" style="text-align: right;">
|
||||
<a href="<?= base_url("client/deposit/$clientData->id"); ?>"><i class="fas fa-arrow-left"
|
||||
style="font-size: 17px;"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
@ -97,27 +98,31 @@
|
||||
id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
|
||||
<th class="font-weight-medium">Date</th>
|
||||
<th class="font-weight-medium">User</th>
|
||||
<th class="font-weight-medium">Description</th>
|
||||
<th class="font-weight-medium">CD Account No</th>
|
||||
<th class="font-weight-medium">Policy Name</th>
|
||||
<th class="font-weight-medium">Endorsement No</th>
|
||||
<th class="font-weight-medium">Sub Type</th>
|
||||
<th class="font-weight-medium">Credit</th>
|
||||
<th class="font-weight-medium">Debit</th>
|
||||
<th class="font-weight-medium">Balance</th>
|
||||
|
||||
<th class="font-weight-medium">Description</th>
|
||||
<th class="font-weight-medium">Date/User</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($depositdata as $row) { ?>
|
||||
<tr id="<?php echo $row->id;?>">
|
||||
<td><?php echo date('d-M-Y h:i A', strtotime($row->created_at)); ?></td>
|
||||
<td><?php echo $row->username; ?></td>
|
||||
<td><?php echo $row->description; ?></td>
|
||||
<td><?php echo isset($subTypeOptions[$row->sub_type]) ? $subTypeOptions[$row->sub_type] : ''; ?></td>
|
||||
<td><?php echo $row->cd_ac_no; ?></td>
|
||||
<td><?php echo $row->policy_name; ?></td>
|
||||
<td><?php echo $row->endorsement_no; ?></td>
|
||||
<td><?php echo isset($subTypeOptions[$row->sub_type]) ? $subTypeOptions[$row->sub_type] : ''; ?>
|
||||
</td>
|
||||
<td><?php echo ($row->transaction_type == 'Credit') ? $row->amount : ''; ?></td>
|
||||
<td><?php echo ($row->transaction_type == 'Debit') ? $row->amount : ''; ?></td>
|
||||
<td><?php echo $row->balance; ?></td>
|
||||
<td><?php echo $row->description; ?></td>
|
||||
<td><?php echo date('d-M-Y h:i A', strtotime($row->created_at)); ?> by
|
||||
<?php echo $row->username; ?> </td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
@ -151,7 +156,7 @@
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="transactionMode" id="addMode"
|
||||
value="add" checked>
|
||||
<label class="form-check-label" for="addMode">Deposit</label>
|
||||
<label class="form-check-label" for="addMode">Replenishment</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="transactionMode" id="adjustmentMode"
|
||||
@ -191,7 +196,7 @@
|
||||
<div class="form-group">
|
||||
<label for="subType" class="control-label" style="display: none;">Transaction Sub Type</label>
|
||||
<select class="form-control" id="subType" name="sub_type" style="display: none;">
|
||||
<option value="Deposit" hidden>Deposit</option>
|
||||
<option value="Deposit" hidden>Replenishment</option>
|
||||
<option value="Adjustment" hidden>Adjustment</option>
|
||||
<!-- Add more options as needed -->
|
||||
</select>
|
||||
@ -222,22 +227,22 @@ $(document).ready(function() {
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>",
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'TransactionDetails',
|
||||
exportOptions: {
|
||||
columns: ''
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'TransactionDetails',
|
||||
exportOptions: {
|
||||
columns: ''
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'pdf',
|
||||
text: 'PDF',
|
||||
title: 'TransactionDetails',
|
||||
exportOptions: {
|
||||
columns: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'pdf',
|
||||
text: 'PDF',
|
||||
title: 'TransactionDetails',
|
||||
exportOptions: {
|
||||
columns: ''
|
||||
}
|
||||
}
|
||||
],
|
||||
],
|
||||
|
||||
|
||||
language: {
|
||||
@ -288,15 +293,25 @@ $(document).ready(function() {
|
||||
// Add more options as needed
|
||||
};
|
||||
|
||||
|
||||
var subType = $('#subType').val();
|
||||
var subTypeId = subTypeOptions[subType] || null;
|
||||
|
||||
if (subTypeId === null) {
|
||||
// Handle the case where sub_type is not found in the options
|
||||
alert('Invalid sub_type selected.');
|
||||
toastr.warning('Invalid sub_type selected.', "Warning");
|
||||
return;
|
||||
}
|
||||
|
||||
// console.log('transactionType ', transactionType)
|
||||
// console.log('description ', description)
|
||||
// console.log('amount ', amount)
|
||||
// console.log('subType ', subType)
|
||||
// console.log('sub_type_id ', sub_type_id)
|
||||
// console.log('clientId ', clientId)
|
||||
// console.log('insurerId ', insurerId)
|
||||
|
||||
|
||||
// Send data to the server using Ajax
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
@ -312,15 +327,18 @@ $(document).ready(function() {
|
||||
},
|
||||
success: function(response) {
|
||||
// Handle success response
|
||||
console.log("Transaction saved successfully");
|
||||
toastr.success("Transaction saved successfully", "Success");
|
||||
// Reload the page or perform other actions as needed
|
||||
location.reload();
|
||||
},
|
||||
error: function(error) {
|
||||
// Handle error response
|
||||
console.error(error);
|
||||
error: function(xhr, status, error) {
|
||||
toastr.error("Transaction save failed", "Error");
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
location.reload(); // Uncomment if you need to reload the page on error
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user