MERGE_UAT_OPD_ECARD_TO_S3_TPA_BDS
This commit is contained in:
commit
0149efa29e
@ -134,6 +134,10 @@ class Database extends Config
|
|||||||
'ssl_ca' => ROOTPATH . 'ca.pem',
|
'ssl_ca' => ROOTPATH . 'ca.pem',
|
||||||
'ssl_verify' => true,
|
'ssl_verify' => true,
|
||||||
];
|
];
|
||||||
|
$this->preDB['encrypt'] = [
|
||||||
|
'ssl_ca' => ROOTPATH . 'ca.pem',
|
||||||
|
'ssl_verify' => true,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -213,6 +213,8 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->post('get_emp_history','EmployeeController::getEmpHistory');
|
$routes->post('get_emp_history','EmployeeController::getEmpHistory');
|
||||||
$routes->get("retail-endorsement-list", "EmployeeController::retailendorsementlist");
|
$routes->get("retail-endorsement-list", "EmployeeController::retailendorsementlist");
|
||||||
$routes->post("retail-endorsement-save", "EmployeeController::retailendorsementsave");
|
$routes->post("retail-endorsement-save", "EmployeeController::retailendorsementsave");
|
||||||
|
$routes->get("getTPADataVariationReport/(:num)", "EmployeeController::getTPADataVariationReport/$1");
|
||||||
|
$routes->get("bulkGenerateEcardAndStoreinS3", "EmployeeController::bulkGenerateEcardAndStoreinS3");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -508,6 +510,8 @@ $routes->get('cli/sendZeptoMail', 'MasterController::testZeptoSMTP');
|
|||||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||||
$routes->cli('cli/processjobs', 'JobWorker::processJobs');
|
$routes->cli('cli/processjobs', 'JobWorker::processJobs');
|
||||||
|
|
||||||
|
$routes->cli('cli/bulkGenerateEcardAndStoreinS3', 'EmployeeController::bulkGenerateEcardAndStoreinS3');
|
||||||
|
|
||||||
$routes->get("processjob", "JobWorker::processJob");
|
$routes->get("processjob", "JobWorker::processJob");
|
||||||
$routes->cli('cli/new_gmail_token', 'MasterController::generateNewGmailAPIToken');
|
$routes->cli('cli/new_gmail_token', 'MasterController::generateNewGmailAPIToken');
|
||||||
$routes->cli('cli/send_mail_cli', 'MasterController::testGmailAPIViaCLI');
|
$routes->cli('cli/send_mail_cli', 'MasterController::testGmailAPIViaCLI');
|
||||||
@ -766,11 +770,12 @@ $routes->get('claimStatus','VidalApiController::claimStatus');
|
|||||||
$routes->get('EcardRequest','MediAssistApiController::EcardRequest');
|
$routes->get('EcardRequest','MediAssistApiController::EcardRequest');
|
||||||
$routes->get('HospitalNetwork','MediAssistApiController::HospitalNetwork');
|
$routes->get('HospitalNetwork','MediAssistApiController::HospitalNetwork');
|
||||||
$routes->get('GetBenefDetails','MediAssistApiController::GetBenefDetails');
|
$routes->get('GetBenefDetails','MediAssistApiController::GetBenefDetails');
|
||||||
$routes->get('ClaimDetail','VidalApiController::ClaimDetail');
|
$routes->get('ClaimDetail','MediAssistApiController::ClaimDetail');
|
||||||
$routes->get('SubmitClaim','MediAssistApiController::SubmitClaim');
|
$routes->get('SubmitClaim','MediAssistApiController::SubmitClaim');
|
||||||
$routes->get('IntimateClaim','MediAssistApiController::IntimateClaim');
|
$routes->get('IntimateClaim','MediAssistApiController::IntimateClaim');
|
||||||
$routes->get('IRSubmission','MediAssistApiController::IRSubmission');
|
$routes->get('IRSubmission','MediAssistApiController::IRSubmission');
|
||||||
$routes->get('ClaimStatusUpdate','MediAssistApiController::ClaimStatusUpdate');
|
$routes->get('ClaimStatusUpdate','MediAssistApiController::ClaimStatusUpdate');
|
||||||
|
$routes->get('syncTpaClaimToNhance','MediAssistApiController::syncTpaClaimToNhance');
|
||||||
|
|
||||||
|
|
||||||
// API service
|
// API service
|
||||||
|
|||||||
@ -9,6 +9,7 @@ use App\Libraries\GmailAPI;
|
|||||||
use App\Libraries\MyGoogleDrive;
|
use App\Libraries\MyGoogleDrive;
|
||||||
use App\Libraries\RuleImportService;
|
use App\Libraries\RuleImportService;
|
||||||
use App\Libraries\DataServiceSqlite;
|
use App\Libraries\DataServiceSqlite;
|
||||||
|
use App\Libraries\S3Service;
|
||||||
use App\Controllers\Home;
|
use App\Controllers\Home;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,4 +92,13 @@ class Services extends BaseService
|
|||||||
return new RuleImportService();
|
return new RuleImportService();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getS3Service($getShared = true)
|
||||||
|
{
|
||||||
|
if ($getShared) {
|
||||||
|
return static::getSharedInstance('getS3Service');
|
||||||
|
}
|
||||||
|
|
||||||
|
return new S3Service();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,13 +92,25 @@ class ApiServiceController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// $employee_policy = $this->employeePolicyModel
|
||||||
|
// ->select('employees.*, employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid , client_policy.tpa_id as tpa_primary_id ')
|
||||||
|
// ->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||||
|
// ->join('client_policy', 'employee_polices.client_policy_id = client_policy.id', 'left')
|
||||||
|
// ->where('employee_polices.employee_id',$id)
|
||||||
|
// ->where('employee_polices.client_policy_id',$client_policy_id)
|
||||||
|
// ->where('employee_polices.is_active', 1 )->findAll();
|
||||||
|
|
||||||
$employee_policy = $this->employeePolicyModel
|
$employee_policy = $this->employeePolicyModel
|
||||||
->select('employees.*, employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid , client_policy.tpa_id as tpa_primary_id ')
|
->select('employees.*, employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid , client_policy.tpa_id as tpa_primary_id ')
|
||||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||||
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id', 'left')
|
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id', 'left')
|
||||||
->where('employee_polices.employee_id',$id)
|
->where('employees.emp_code', $emp_code)
|
||||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
->where('employee_polices.is_active', 1 )->findAll();
|
->where('employee_polices.is_active', 1)
|
||||||
|
->where('employees.is_active', 1)
|
||||||
|
->where('employee_polices.status', 'active')
|
||||||
|
->where('employees.emp_status', 'active')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
|
||||||
if(count($employee_policy) > 0)
|
if(count($employee_policy) > 0)
|
||||||
|
|||||||
@ -2726,6 +2726,8 @@ class ClientController extends AdminController
|
|||||||
$search_term = 'GMC';
|
$search_term = 'GMC';
|
||||||
} else if (preg_match($gpa_pattern, $subject) || $policy_type_id == 6 || $policy_type_id == 7) {
|
} else if (preg_match($gpa_pattern, $subject) || $policy_type_id == 6 || $policy_type_id == 7) {
|
||||||
$search_term = 'GPA';
|
$search_term = 'GPA';
|
||||||
|
} else if($policy_type_id == 72){
|
||||||
|
$search_term = 'GMC';
|
||||||
}else {
|
}else {
|
||||||
$search_term = "";
|
$search_term = "";
|
||||||
}
|
}
|
||||||
@ -2736,7 +2738,7 @@ class ClientController extends AdminController
|
|||||||
if ($search_term === 'GPA' || $policy_type_id == 6 || $policy_type_id == 7) {
|
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();
|
$premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
||||||
} else if ($search_term === 'GMC') {
|
} else if ($search_term === 'GMC' || $policy_type_id == 72) {
|
||||||
|
|
||||||
$premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
$premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
||||||
|
|
||||||
@ -2766,7 +2768,7 @@ class ClientController extends AdminController
|
|||||||
// echo '<pre>';
|
// echo '<pre>';
|
||||||
// echo $family_floater;
|
// echo $family_floater;
|
||||||
|
|
||||||
if ($search_term === 'GMC') {
|
if ($search_term === 'GMC' || $policy_type_id == 72 ) {
|
||||||
|
|
||||||
// $resultss = [];
|
// $resultss = [];
|
||||||
$resultss = $results;
|
$resultss = $results;
|
||||||
@ -3400,6 +3402,7 @@ class ClientController extends AdminController
|
|||||||
[
|
[
|
||||||
'Status' => true,
|
'Status' => true,
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
|
'policy_type_id' => $record['policy_type_id'],
|
||||||
'data' => $record['policy_terms'],
|
'data' => $record['policy_terms'],
|
||||||
'policy_addon' => $record['is_addon'],
|
'policy_addon' => $record['is_addon'],
|
||||||
'emp_count_by_policy' => $emp_count_by_policy
|
'emp_count_by_policy' => $emp_count_by_policy
|
||||||
@ -4225,9 +4228,108 @@ class ClientController extends AdminController
|
|||||||
$client_policy_id = $this->request->getPost("client_policy_id");
|
$client_policy_id = $this->request->getPost("client_policy_id");
|
||||||
$policy_terms = $this->request->getPost("policy_terms");
|
$policy_terms = $this->request->getPost("policy_terms");
|
||||||
$policy_terms = json_decode($policy_terms, true);
|
$policy_terms = json_decode($policy_terms, true);
|
||||||
|
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||||
|
// print_r($policy_terms); die;
|
||||||
|
|
||||||
|
if (empty($policy_terms)) {
|
||||||
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Policy terms data could not be empty', 'formdata' => $this->request->getPost()], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($record) {
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
|
if ($record['policy_type_id'] == 72) {
|
||||||
|
|
||||||
|
$data['sum_insured'] = $policy_terms['sum_insured'] ?? 0;
|
||||||
|
$data['multiple_sum_insured'] = $policy_terms['multiple_sum_insured'] ?? [];
|
||||||
|
$data['family_floater'] = $policy_terms['family_floater'] ?? 0;
|
||||||
|
$data['family_floaters'] = $policy_terms["family_floaters"] ?? [];
|
||||||
|
|
||||||
|
$data['age_ratio']['self']['min'] = $policy_terms["self_min_age"] ?? 0;
|
||||||
|
$data['age_ratio']['self']['max'] = $policy_terms["self_max_age"] ?? 0;
|
||||||
|
$data['age_ratio']['spouse']['min'] = $policy_terms["spouse_min_age"] ?? 0;
|
||||||
|
$data['age_ratio']['spouse']['max'] = $policy_terms["spouse_max_age"] ?? 0;
|
||||||
|
$data['age_ratio']['child']['min'] = $policy_terms["child_min_age"] ?? 0;
|
||||||
|
$data['age_ratio']['child']['max'] = $policy_terms["child_max_age"] ?? 0;
|
||||||
|
$data['age_ratio']['elders']['min'] = $policy_terms["other_member_min_age"] ?? 0;
|
||||||
|
$data['age_ratio']['elders']['max'] = $policy_terms["other_member_max_age"] ?? 0;
|
||||||
|
|
||||||
|
$temp_family_floaters = $data['family_floaters'];
|
||||||
|
$data['family_floaters'] = [];
|
||||||
|
|
||||||
|
if (in_array("self", $temp_family_floaters) == 1) {
|
||||||
|
$data['family_floaters']['self'] = 1;
|
||||||
|
} else {
|
||||||
|
$data['family_floaters']['self'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array("spouse", $temp_family_floaters) == 1) {
|
||||||
|
$data['family_floaters']['spouse'] = 1;
|
||||||
|
} else {
|
||||||
|
$data['family_floaters']['spouse'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($temp_family_floaters)) {
|
||||||
|
|
||||||
|
$children_value = 0;
|
||||||
|
$value = 0;
|
||||||
|
|
||||||
|
if (count($temp_family_floaters) == 2) {
|
||||||
|
$children_value = 0;
|
||||||
|
$value = 1;
|
||||||
|
} else if (count($temp_family_floaters) == 3) {
|
||||||
|
$children_value = 1;
|
||||||
|
$value = 2;
|
||||||
|
} else {
|
||||||
|
$children_value = 2;
|
||||||
|
$value = 3;
|
||||||
|
}
|
||||||
|
$data['family_floaters']['childrens'] = (int)$temp_family_floaters[$children_value];
|
||||||
|
|
||||||
|
if ($temp_family_floaters[$value] == '1P') {
|
||||||
|
$data['family_floaters']['parents'] = 1;
|
||||||
|
$data['family_floaters']['parents-in-law'] = 0;
|
||||||
|
$data['family_floaters']['either-parents-pil'] = 0;
|
||||||
|
} else if ($temp_family_floaters[$value] == '2P') {
|
||||||
|
$data['family_floaters']['parents'] = 2;
|
||||||
|
$data['family_floaters']['parents-in-law'] = 0;
|
||||||
|
$data['family_floaters']['either-parents-pil'] = 0;
|
||||||
|
} else if ($temp_family_floaters[$value] == '1PIL') {
|
||||||
|
$data['family_floaters']['parents'] = 0;
|
||||||
|
$data['family_floaters']['parents-in-law'] = 1;
|
||||||
|
$data['family_floaters']['either-parents-pil'] = 0;
|
||||||
|
} else if ($temp_family_floaters[$value] == '2PIL') {
|
||||||
|
$data['family_floaters']['parents'] = 0;
|
||||||
|
$data['family_floaters']['parents-in-law'] = 2;
|
||||||
|
$data['family_floaters']['either-parents-pil'] = 0;
|
||||||
|
} else if ($temp_family_floaters[$value] == '2EPORPIL') {
|
||||||
|
//Parents or PIL (Any two of Father, Mother, MIl, FIL)
|
||||||
|
$data['family_floaters']['parents'] = 0;
|
||||||
|
$data['family_floaters']['parents-in-law'] = 0;
|
||||||
|
$data['family_floaters']['either-parents-pil'] = 2;
|
||||||
|
} else if ($temp_family_floaters[$value] == 'EPORPIL') {
|
||||||
|
//Either Parents or PIL (Parents or Parents In Law)
|
||||||
|
$data['family_floaters']['parents'] = 0;
|
||||||
|
$data['family_floaters']['parents-in-law'] = 0;
|
||||||
|
$data['family_floaters']['either-parents-pil'] = 1;
|
||||||
|
} else if ($temp_family_floaters[$value] == '4EPORPIL') {
|
||||||
|
$data['family_floaters']['parents'] = 2;
|
||||||
|
$data['family_floaters']['parents-in-law'] = 2;
|
||||||
|
$data['family_floaters']['either-parents-pil'] = 0;
|
||||||
|
} else {
|
||||||
|
$data['family_floaters']['parents'] = 0;
|
||||||
|
$data['family_floaters']['parents-in-law'] = 0;
|
||||||
|
$data['family_floaters']['either-parents-pil'] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['family_floaters']['elders_count'] = $this->request->getPost("elder_member_count") ? $this->request->getPost("elder_member_count") : 0;
|
||||||
|
$data['special_condition_label'] = $policy_terms['special_condition_label'] ?? [];
|
||||||
|
$data['special_condition_input'] = $policy_terms["special_condition_input"] ?? [];
|
||||||
|
|
||||||
|
$data['enrollment_display_key'] = $this->otherPolicyTermsDisplayKeyConstruct($policy_terms);
|
||||||
|
} else {
|
||||||
foreach ($policy_terms as $key => $value) {
|
foreach ($policy_terms as $key => $value) {
|
||||||
|
|
||||||
if (str_ends_with($key, '_display')) {
|
if (str_ends_with($key, '_display')) {
|
||||||
@ -4242,16 +4344,20 @@ class ClientController extends AdminController
|
|||||||
$data[$key] = $value;
|
$data[$key] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($data)) {
|
|
||||||
$policy_terms['is_payable_employee']['self'] = 0;
|
|
||||||
$policy_terms = json_encode($data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($data)) {
|
||||||
|
|
||||||
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
if ($record['policy_type_id'] == 72) {
|
||||||
|
$policy_terms['is_payable_employee']['self'] = 0;
|
||||||
|
$policy_terms['is_payable_employee']['spouse'] = 0;
|
||||||
|
$policy_terms['is_payable_employee']['childern'] = 0;
|
||||||
|
$policy_terms['is_payable_employee']['elders'] = 0;
|
||||||
|
} else {
|
||||||
|
$policy_terms['is_payable_employee']['self'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ($record) {
|
$policy_terms = json_encode($data);
|
||||||
|
|
||||||
$update = $this->clientPolicyModel->where('id', $client_policy_id)->set('policy_terms', $policy_terms)->update();
|
$update = $this->clientPolicyModel->where('id', $client_policy_id)->set('policy_terms', $policy_terms)->update();
|
||||||
|
|
||||||
@ -4260,12 +4366,37 @@ class ClientController extends AdminController
|
|||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update data', 'formdata' => $this->request->getPost()], 200);
|
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 policy therms.', 'formdata' => $this->request->getPost()], 200);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to store data. The client policy does not exist', 'formdata' => $this->request->getPost()], 200);
|
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 otherPolicyTermsDisplayKeyConstruct($data)
|
||||||
|
{
|
||||||
|
$labels = $data['special_condition_label'] ?? [];
|
||||||
|
$values = $data['special_condition_input'] ?? [];
|
||||||
|
|
||||||
|
$special_conditions = [];
|
||||||
|
|
||||||
|
foreach ($labels as $i => $label) {
|
||||||
|
$value = $values[$i] ?? '';
|
||||||
|
|
||||||
|
// skip if label or value is empty
|
||||||
|
if (trim($label) === '' || trim($value) === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$special_conditions[$label] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $special_conditions;
|
||||||
|
}
|
||||||
|
|
||||||
public function checkPolicyType($policy_type_id, $client_branch_id, $client_id)
|
public function checkPolicyType($policy_type_id, $client_branch_id, $client_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -5971,8 +6102,8 @@ class ClientController extends AdminController
|
|||||||
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
|
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
|
||||||
|
|
||||||
$empServiceController = new EmployeeServiceController();
|
$empServiceController = new EmployeeServiceController();
|
||||||
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '1126']);
|
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '1248']);
|
||||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '865']);
|
// $res = $empServiceController->excelFileDataValidation(['file_id' => '1248']);
|
||||||
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1183]);
|
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1183]);
|
||||||
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1169]);
|
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1169]);
|
||||||
// $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]);
|
// $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]);
|
||||||
|
|||||||
@ -238,7 +238,7 @@ class DashboardController extends AdminController
|
|||||||
|
|
||||||
$data['client_branch_emp_list'] = $results;
|
$data['client_branch_emp_list'] = $results;
|
||||||
$session = \Config\Services::session();
|
$session = \Config\Services::session();
|
||||||
$session->set('enrollment_data', json_encode($data));
|
// $session->set('enrollment_data', json_encode($data));
|
||||||
|
|
||||||
$data['pendingActionsData'] = $pendingActionsData;
|
$data['pendingActionsData'] = $pendingActionsData;
|
||||||
$data['businessTeamCount'] = count($businessTeamData) ?? 0;
|
$data['businessTeamCount'] = count($businessTeamData) ?? 0;
|
||||||
|
|||||||
@ -28,6 +28,7 @@ use App\Models\PolicyPremium2Model;
|
|||||||
use App\Models\AuditHistoryModel;
|
use App\Models\AuditHistoryModel;
|
||||||
use App\Models\UserModel;
|
use App\Models\UserModel;
|
||||||
use App\Models\PartnerEndorsementRequestModel;
|
use App\Models\PartnerEndorsementRequestModel;
|
||||||
|
use App\Models\TpaApiDataModel;
|
||||||
|
|
||||||
|
|
||||||
use App\Controllers\Jobs;
|
use App\Controllers\Jobs;
|
||||||
@ -42,6 +43,8 @@ use CodeIgniter\API\ResponseTrait;
|
|||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Style\Fill;
|
||||||
|
|
||||||
use Dompdf\Dompdf;
|
use Dompdf\Dompdf;
|
||||||
use Dompdf\Options;
|
use Dompdf\Options;
|
||||||
@ -98,6 +101,14 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
public function list()
|
public function list()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// $s3 = \Config\Services::getS3Service();
|
||||||
|
// $file = WRITEPATH.'uploads/excel/inception.ods';
|
||||||
|
// print_rr($s3->exists('inception_1766475604.ods'));
|
||||||
|
// print_rr($s3->getPresignedUrl('inception_1766.ods'));
|
||||||
|
// print_rr($s3->upload($file));
|
||||||
|
// print_rr($s3->download('inception_1766475604.ods',__DIR__));
|
||||||
|
// die();
|
||||||
// $model = new UserModel();
|
// $model = new UserModel();
|
||||||
$data = [];
|
$data = [];
|
||||||
$data['status'] = ['draft' => 'Draft', 'enrolled' => 'Enrolled', 'active' => 'Active', 'inactive' => 'In-Active', 'pending' => 'Pending'];
|
$data['status'] = ['draft' => 'Draft', 'enrolled' => 'Enrolled', 'active' => 'Active', 'inactive' => 'In-Active', 'pending' => 'Pending'];
|
||||||
@ -1426,7 +1437,10 @@ class EmployeeController extends AdminController
|
|||||||
//E-CARD DOWNLOAD FUNCTION USING DOM PDF ( CURRENTLY USING THIS ) Dompdf
|
//E-CARD DOWNLOAD FUNCTION USING DOM PDF ( CURRENTLY USING THIS ) Dompdf
|
||||||
public function generateIDCardForEmployee($rand_string, $people = 0, $mode = 0)
|
public function generateIDCardForEmployee($rand_string, $people = 0, $mode = 0)
|
||||||
{
|
{
|
||||||
// dd($rand_string, $people);
|
$mode = (int)$mode;
|
||||||
|
|
||||||
|
|
||||||
|
// dd($rand_string, $people,$mode);
|
||||||
$this->myLogger->logme('error', 'generateIDCardForEmployee params .' . json_encode(["rand_string" => $rand_string, "people" => $people, "mode" => $mode]));
|
$this->myLogger->logme('error', 'generateIDCardForEmployee params .' . json_encode(["rand_string" => $rand_string, "people" => $people, "mode" => $mode]));
|
||||||
try {
|
try {
|
||||||
$this->myLogger->logme('error', 'generateIDCardForEmployee function started.');
|
$this->myLogger->logme('error', 'generateIDCardForEmployee function started.');
|
||||||
@ -1435,7 +1449,7 @@ class EmployeeController extends AdminController
|
|||||||
$this->myLogger->logme('error', 'Fetching employee code and client policy ID.');
|
$this->myLogger->logme('error', 'Fetching employee code and client policy ID.');
|
||||||
|
|
||||||
$get_emp_code_and_client_policy_id = $this->employeePolicyModel
|
$get_emp_code_and_client_policy_id = $this->employeePolicyModel
|
||||||
->select('employee_polices.client_policy_id, employees.emp_code, tpa.short_name,employees.client_id')
|
->select('employee_polices.client_policy_id, employees.emp_code,employees.name, employee_polices.tpa_id,tpa.short_name,employees.client_id')
|
||||||
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
||||||
->join('employees', 'employees.id = employee_polices.employee_id')
|
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||||
->join('tpa', 'tpa.id = client_policy.tpa_id')
|
->join('tpa', 'tpa.id = client_policy.tpa_id')
|
||||||
@ -1463,6 +1477,43 @@ class EmployeeController extends AdminController
|
|||||||
$emp_code = $get_emp_code_and_client_policy_id['emp_code'];
|
$emp_code = $get_emp_code_and_client_policy_id['emp_code'];
|
||||||
$client_id = $get_emp_code_and_client_policy_id['client_id'];
|
$client_id = $get_emp_code_and_client_policy_id['client_id'];
|
||||||
|
|
||||||
|
//new step check in S3 if yes then fetch from S3 bucket
|
||||||
|
$s3_key = 'ecard_'.$get_emp_code_and_client_policy_id['name'].'('.$get_emp_code_and_client_policy_id['emp_code'].')'.'_'.$get_emp_code_and_client_policy_id['tpa_id'].'.pdf';
|
||||||
|
// echo $s3_key;die();
|
||||||
|
$s3 = \Config\Services::getS3Service();
|
||||||
|
if($s3->exists($s3_key) && $mode != 2) //2 => for bulk generate so skip s3 check and generate PDF
|
||||||
|
{
|
||||||
|
//get pre signed url & make it download
|
||||||
|
$s3_url = $s3->getPresignedUrl($s3_key );
|
||||||
|
|
||||||
|
$pdf = file_get_contents($s3_url['url']);
|
||||||
|
if ($mode == 1) {
|
||||||
|
// Inline view
|
||||||
|
return $this->response
|
||||||
|
->setHeader('Content-Type', 'application/pdf')
|
||||||
|
->setHeader('Content-Disposition', 'inline; filename="' . $s3_key . '"')
|
||||||
|
->setBody($pdf);
|
||||||
|
} else if($mode == 0){
|
||||||
|
// echo 'Force download';//die();
|
||||||
|
return $this->response
|
||||||
|
->setHeader('Content-Type', 'application/pdf')
|
||||||
|
->setHeader('Content-Disposition', 'attachment; filename="' . $s3_key . '"')
|
||||||
|
->setBody($pdf);
|
||||||
|
}
|
||||||
|
// exit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if($mode !== 2)
|
||||||
|
{
|
||||||
|
$data['message'] = 'Inprogress... Comeback later! or Contact support';
|
||||||
|
return view('errors/404', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//in else generate PDF and upload it in s3
|
||||||
|
// echo 'else';
|
||||||
|
// exit();
|
||||||
// Step 2: Fetch ECard data
|
// Step 2: Fetch ECard data
|
||||||
$this->myLogger->logme('error', 'Fetching ECard data using client_policy_id: ' . $client_policy_id . ' and emp_code: ' . $emp_code);
|
$this->myLogger->logme('error', 'Fetching ECard data using client_policy_id: ' . $client_policy_id . ' and emp_code: ' . $emp_code);
|
||||||
$data = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code,$client_id);
|
$data = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code,$client_id);
|
||||||
@ -1559,6 +1610,7 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// return $html;
|
// return $html;
|
||||||
|
// echo $html;die();
|
||||||
// DomPdf
|
// DomPdf
|
||||||
$options = new Options();
|
$options = new Options();
|
||||||
$options->set('isRemoteEnabled', true);
|
$options->set('isRemoteEnabled', true);
|
||||||
@ -1582,28 +1634,34 @@ class EmployeeController extends AdminController
|
|||||||
$dompdf->addInfo("Title", "E-Card");
|
$dompdf->addInfo("Title", "E-Card");
|
||||||
|
|
||||||
$filename = 'ecard_' . date('Y-m-d_H-i-s') . '.pdf';
|
$filename = 'ecard_' . date('Y-m-d_H-i-s') . '.pdf';
|
||||||
|
$temp_local_path = WRITEPATH.'/tmp/'.$s3_key;
|
||||||
|
file_put_contents(($temp_local_path),$dompdf->output());
|
||||||
// if($mode == 1){
|
// if($mode == 1){
|
||||||
// $dompdf->stream($filename, ['Attachment' => false]); // Inline view
|
// $dompdf->stream($filename, ['Attachment' => false]); // Inline view
|
||||||
// }else{
|
// }else{
|
||||||
// $dompdf->stream($filename, ['Attachment' => true]); // Force download
|
// $dompdf->stream($filename, ['Attachment' => true]); // Force download
|
||||||
// }
|
// }
|
||||||
|
$aws_upload_res = $s3->upload(($temp_local_path));
|
||||||
|
// print_rr($aws_upload_res);
|
||||||
|
// echo '<br>PDF generated and uploaded to S3 successfully.<br>';
|
||||||
|
unlink($temp_local_path);
|
||||||
|
|
||||||
if ($mode == 1) {
|
// exit();
|
||||||
// Inline view
|
// if ($mode == 1) {
|
||||||
return $this->response
|
// // Inline view
|
||||||
->setHeader('Content-Type', 'application/pdf')
|
// return $this->response
|
||||||
->setHeader('Content-Disposition', 'inline; filename="' . $filename . '"')
|
// ->setHeader('Content-Type', 'application/pdf')
|
||||||
->setBody($dompdf->output());
|
// ->setHeader('Content-Disposition', 'inline; filename="' . $filename . '"')
|
||||||
} else {
|
// ->setBody($dompdf->output());
|
||||||
// Force download
|
// } else {
|
||||||
return $this->response
|
// // Force download
|
||||||
->setHeader('Content-Type', 'application/pdf')
|
// return $this->response
|
||||||
->setHeader('Content-Disposition', 'attachment; filename="' . $filename . '"')
|
// ->setHeader('Content-Type', 'application/pdf')
|
||||||
->setBody($dompdf->output());
|
// ->setHeader('Content-Disposition', 'attachment; filename="' . $filename . '"')
|
||||||
}
|
// ->setBody($dompdf->output());
|
||||||
|
// }
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'generateIDCardForEmployee function completed successfully.');
|
// $this->myLogger->logme('error', 'generateIDCardForEmployee function completed successfully.');
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->myLogger->logme('error', 'Exception occurred: ' . $e->getMessage());
|
$this->myLogger->logme('error', 'Exception occurred: ' . $e->getMessage());
|
||||||
@ -3579,5 +3637,571 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTPADataVariationReport($file_id)
|
||||||
|
{
|
||||||
|
$file_info = $this->batchFileModel->where('id', $file_id)->find();
|
||||||
|
$client_id = $file_info[0]['client_id'];
|
||||||
|
$client_policy_id = $file_info[0]['client_policy_id'];
|
||||||
|
$TpaApiDataModel = new TpaApiDataModel();
|
||||||
|
$emp_data_wo_tpa_id = $this->employeePolicyModel->getTPADataVariationReport($client_id, $client_policy_id, $file_id);
|
||||||
|
|
||||||
|
|
||||||
|
//loop emp data with TPA data for matches
|
||||||
|
foreach ($emp_data_wo_tpa_id as $db_key => $db_row)
|
||||||
|
{
|
||||||
|
//get TPA API data from table for current DB ep code
|
||||||
|
$tpa_temp_data = $TpaApiDataModel->select('*')
|
||||||
|
->where('emp_code', $db_row['emp_code'])
|
||||||
|
->where('file_id', $file_id)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->findAll();
|
||||||
|
$match= $this->reconcileDbWithTpa($db_row,$tpa_temp_data);
|
||||||
|
$emp_data_wo_tpa_id[$db_key]['match'] = $match;
|
||||||
|
}
|
||||||
|
|
||||||
|
// d($emp_data_wo_tpa_id);
|
||||||
|
|
||||||
|
// die();
|
||||||
|
//not_in_tpa
|
||||||
|
$tpa_emp_codes = $TpaApiDataModel->select('emp_code')
|
||||||
|
->where('file_id', $file_id)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->groupBy('emp_code')
|
||||||
|
->findAll();
|
||||||
|
$tpa_emp_codes = array_column($tpa_emp_codes, 'emp_code');
|
||||||
|
|
||||||
|
$not_in_tpa = $this->employeePolicyModel->getTPADataVariationReport($client_id, $client_policy_id, $file_id,$tpa_emp_codes);
|
||||||
|
// d($not_in_tpa);die();
|
||||||
|
|
||||||
|
// not_in_nhance
|
||||||
|
$master_emp_codes = $this->employeePolicyModel->getTPADataVariationReport($client_id, $client_policy_id, $file_id,[],true);
|
||||||
|
$master_emp_codes = array_column($master_emp_codes, 'emp_code');
|
||||||
|
|
||||||
|
$not_in_nhance = $TpaApiDataModel->select('*')
|
||||||
|
->where('is_active',1)
|
||||||
|
->where('file_id',$file_id)
|
||||||
|
->whereNotIn('emp_code',$master_emp_codes)
|
||||||
|
->findAll();
|
||||||
|
// d($not_in_nhance);die();
|
||||||
|
|
||||||
|
if( !empty($not_in_tpa) || !empty($not_in_nhance) || !empty($emp_data_wo_tpa_id) )
|
||||||
|
{
|
||||||
|
$this->exportVariationReportExcel($not_in_tpa,$not_in_nhance,$emp_data_wo_tpa_id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// $this->exportVariationReportExcel([],[],[]);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// not in use once all functionality workes well in this funciton then remvoe this function
|
||||||
|
function compareDbWithTpa(array $db, array $tpaRows): array
|
||||||
|
{
|
||||||
|
$partialMatches = [];
|
||||||
|
|
||||||
|
// Normalize helper
|
||||||
|
$normalizeName = function ($name) {
|
||||||
|
return strtolower(
|
||||||
|
preg_replace('/[.\s_]+/', '', trim($name))
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach ($tpaRows as $tpa) {
|
||||||
|
|
||||||
|
// 0️⃣ emp_code must match
|
||||||
|
if (($db['emp_code'] ?? '') !== ($tpa['emp_code'] ?? '')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$relationMatch = strtolower($db['relation'] ?? '') === strtolower($tpa['relation'] ?? '');
|
||||||
|
$genderMatch = strtoupper($db['gender'] ?? '') === strtoupper($tpa['gender'] ?? '');
|
||||||
|
$dobMatch = ($db['dob'] ?? '') === ($tpa['dob'] ?? '');
|
||||||
|
|
||||||
|
$nameMatch = $normalizeName($db['name'] ?? '') ===
|
||||||
|
$normalizeName($tpa['name'] ?? '');
|
||||||
|
|
||||||
|
// ✅ FULL MATCH
|
||||||
|
if ($nameMatch && $relationMatch && $genderMatch && $dobMatch) {
|
||||||
|
return [
|
||||||
|
'match' => 'full_match',
|
||||||
|
'record'=> $tpa
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// ⚠️ PARTIAL MATCH
|
||||||
|
if ($relationMatch || $genderMatch || $dobMatch) {
|
||||||
|
$partialMatches[] = [
|
||||||
|
'record' => $tpa,
|
||||||
|
'matched_on' => [
|
||||||
|
'relation' => $relationMatch,
|
||||||
|
'gender' => $genderMatch,
|
||||||
|
'dob' => $dobMatch
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no full match but partial exists
|
||||||
|
if (!empty($partialMatches)) {
|
||||||
|
return [
|
||||||
|
'match' => 'partial_match',
|
||||||
|
'candidates' => $partialMatches
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nothing matched
|
||||||
|
return [
|
||||||
|
'match' => 'no_match'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function reconcileDbWithTpa(array $db, array $tpaRows): array
|
||||||
|
{
|
||||||
|
// Name normalization
|
||||||
|
$normalizeName = function ($name) {
|
||||||
|
return strtolower(
|
||||||
|
preg_replace('/[.\s_]+/', '', trim($name))
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach ($tpaRows as $tpa) {
|
||||||
|
|
||||||
|
// 1️⃣ emp_code + relation must match
|
||||||
|
if (
|
||||||
|
// ($db['emp_code'] ?? '') !== ($tpa['emp_code'] ?? '') ||
|
||||||
|
strtolower($db['relationship']) !== strtolower($tpa['relation'])
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2️⃣ Field comparison
|
||||||
|
$diff = [];
|
||||||
|
|
||||||
|
if (
|
||||||
|
($db['name'] ?? '') !==
|
||||||
|
($tpa['name'] ?? '')
|
||||||
|
) {
|
||||||
|
$diff[] = 'name';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($db['dob'] ?? '') !== ($tpa['dob'] ?? '')) {
|
||||||
|
$diff[] = 'dob';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
strtoupper($db['gender'] ?? '') !==
|
||||||
|
strtoupper($tpa['gender'] ?? '')
|
||||||
|
) {
|
||||||
|
$diff[] = 'gender';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3️⃣ Match found
|
||||||
|
return [
|
||||||
|
'status' => 'matched',
|
||||||
|
'tpa_record' => $tpa,
|
||||||
|
'not_matching' => $diff // empty = perfect match
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4️⃣ No match found
|
||||||
|
return [
|
||||||
|
'status' => 'no_match'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function exportVariationReportExcel(
|
||||||
|
array $notInTPA,
|
||||||
|
array $notInNhance,
|
||||||
|
array $reviewNeeded,
|
||||||
|
string $filename = 'employee_review.xlsx')
|
||||||
|
{
|
||||||
|
|
||||||
|
function setCell($sheet, int $col, int $row, $value)
|
||||||
|
{
|
||||||
|
$cell = Coordinate::stringFromColumnIndex($col) . $row;
|
||||||
|
$sheet->setCellValue($cell, $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
$EXPORT_COLUMNS = [
|
||||||
|
|
||||||
|
// Sheet 1 — Not in TPA
|
||||||
|
'not_in_tpa' => [
|
||||||
|
'emp_code' => 'Employee Code',
|
||||||
|
'name' => 'Employee Name',
|
||||||
|
'relationship' => 'Relation',
|
||||||
|
'dob' => 'Date of Birth',
|
||||||
|
'gender' => 'Gender',
|
||||||
|
'mobile' => 'Mobile No',
|
||||||
|
'email_corporate' => 'Corporate Email',
|
||||||
|
'policy_no' => 'Policy No',
|
||||||
|
'tpa_name' => 'TPA Name',
|
||||||
|
'change_event' => 'Change Event',
|
||||||
|
],
|
||||||
|
|
||||||
|
// Sheet 2 — Not in Nhance
|
||||||
|
'not_in_nhance' => [
|
||||||
|
'emp_code' => 'Employee Code',
|
||||||
|
'name' => 'Employee Name',
|
||||||
|
'relation' => 'Relation',
|
||||||
|
'dob' => 'Date of Birth',
|
||||||
|
'gender' => 'Gender',
|
||||||
|
'age' => 'Age',
|
||||||
|
'tpa_id' => 'TPA Member ID',
|
||||||
|
],
|
||||||
|
|
||||||
|
// Sheet 3 — Review Needed (DB side)
|
||||||
|
'review_main' => [
|
||||||
|
'emp_code' => 'Employee Code',
|
||||||
|
'name' => 'Employee Name',
|
||||||
|
'relationship' => 'Relation',
|
||||||
|
'dob' => 'Date of Birth',
|
||||||
|
'gender' => 'Gender',
|
||||||
|
'policy_no' => 'Policy No',
|
||||||
|
'uhid' => 'UHID',
|
||||||
|
'change_event' => 'Change event'
|
||||||
|
],
|
||||||
|
|
||||||
|
// Sheet 3 — Review Needed (TPA side)
|
||||||
|
'review_tpa' => [
|
||||||
|
'emp_code' => 'TPA Employee Code',
|
||||||
|
'name' => 'TPA Name',
|
||||||
|
'relation' => 'TPA Relation',
|
||||||
|
'dob' => 'TPA DOB',
|
||||||
|
'gender' => 'TPA Gender',
|
||||||
|
'tpa_id' => 'TPA Member ID',
|
||||||
|
'age' => 'TPA Age',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
$spreadsheet = new Spreadsheet();
|
||||||
|
|
||||||
|
/* =========================================================
|
||||||
|
* SHEET 1 — NOT IN TPA
|
||||||
|
* ========================================================= */
|
||||||
|
$sheet1 = $spreadsheet->getActiveSheet();
|
||||||
|
$sheet1->setTitle('Not in TPA');
|
||||||
|
|
||||||
|
$cols = $EXPORT_COLUMNS['not_in_tpa'];
|
||||||
|
|
||||||
|
$colNo = 1;
|
||||||
|
foreach ($cols as $label) {
|
||||||
|
setCell($sheet1, $colNo++, 1, $label);
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowNo = 2;
|
||||||
|
foreach ($notInTPA as $row) {
|
||||||
|
$colNo = 1;
|
||||||
|
foreach ($cols as $key => $label) {
|
||||||
|
setCell($sheet1, $colNo++, $rowNo, $row[$key] ?? '');
|
||||||
|
}
|
||||||
|
$rowNo++;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (range(1, count($cols)) as $c) {
|
||||||
|
$sheet1->getColumnDimension(Coordinate::stringFromColumnIndex($c))->setAutoSize(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* =========================================================
|
||||||
|
* SHEET 2 — NOT IN NHANCE
|
||||||
|
* ========================================================= */
|
||||||
|
$sheet2 = $spreadsheet->createSheet();
|
||||||
|
$sheet2->setTitle('Not in Nhance');
|
||||||
|
|
||||||
|
$cols = $EXPORT_COLUMNS['not_in_nhance'];
|
||||||
|
|
||||||
|
$colNo = 1;
|
||||||
|
foreach ($cols as $label) {
|
||||||
|
setCell($sheet2, $colNo++, 1, $label);
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowNo = 2;
|
||||||
|
foreach ($notInNhance as $row) {
|
||||||
|
$colNo = 1;
|
||||||
|
foreach ($cols as $key => $label) {
|
||||||
|
setCell($sheet2, $colNo++, $rowNo, $row[$key] ?? '');
|
||||||
|
}
|
||||||
|
$rowNo++;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (range(1, count($cols)) as $c) {
|
||||||
|
$sheet2->getColumnDimension(Coordinate::stringFromColumnIndex($c))->setAutoSize(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* =========================================================
|
||||||
|
* SHEET 3 — REVIEW NEEDED
|
||||||
|
* ========================================================= */
|
||||||
|
$sheet3 = $spreadsheet->createSheet();
|
||||||
|
$sheet3->setTitle('Review Needed');
|
||||||
|
|
||||||
|
$mainCols = $EXPORT_COLUMNS['review_main'];
|
||||||
|
$tpaCols = $EXPORT_COLUMNS['review_tpa'];
|
||||||
|
|
||||||
|
// headers
|
||||||
|
$colNo = 1;
|
||||||
|
foreach ($mainCols as $label) {
|
||||||
|
setCell($sheet3, $colNo++, 1, $label);
|
||||||
|
}
|
||||||
|
foreach ($tpaCols as $label) {
|
||||||
|
setCell($sheet3, $colNo++, 1, $label);
|
||||||
|
}
|
||||||
|
|
||||||
|
// rows
|
||||||
|
$rowNo = 2;
|
||||||
|
foreach ($reviewNeeded as $row) {
|
||||||
|
|
||||||
|
// main (DB)
|
||||||
|
$colNo = 1;
|
||||||
|
foreach ($mainCols as $key => $label) {
|
||||||
|
setCell($sheet3, $colNo++, $rowNo, $row[$key] ?? '');
|
||||||
|
}
|
||||||
|
|
||||||
|
$tpaData = [];
|
||||||
|
$notMatching = [];
|
||||||
|
|
||||||
|
if (($row['match']['status'] ?? '') === 'matched') {
|
||||||
|
$tpaData = $row['match']['tpa_record'] ?? [];
|
||||||
|
$notMatching = $row['match']['not_matching'] ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// TPA
|
||||||
|
foreach ($tpaCols as $key => $label) {
|
||||||
|
setCell($sheet3, $colNo++, $rowNo, $tpaData[$key] ?? '');
|
||||||
|
}
|
||||||
|
|
||||||
|
// highlight mismatches
|
||||||
|
foreach ($notMatching as $field) {
|
||||||
|
|
||||||
|
if (isset($mainCols[$field])) {
|
||||||
|
$idx = array_keys($mainCols);
|
||||||
|
$pos = array_search($field, $idx);
|
||||||
|
$cell = Coordinate::stringFromColumnIndex($pos + 1) . $rowNo;
|
||||||
|
$sheet3->getStyle($cell)->getFill()
|
||||||
|
->setFillType(Fill::FILL_SOLID)
|
||||||
|
->getStartColor()->setARGB('FFFFFF00');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($tpaCols[$field])) {
|
||||||
|
$idx = array_keys($tpaCols);
|
||||||
|
$pos = array_search($field, $idx);
|
||||||
|
$cell = Coordinate::stringFromColumnIndex(count($mainCols) + $pos + 1) . $rowNo;
|
||||||
|
$sheet3->getStyle($cell)->getFill()
|
||||||
|
->setFillType(Fill::FILL_SOLID)
|
||||||
|
->getStartColor()->setARGB('FFFFFF00');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowNo++;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (range(1, count($mainCols) + count($tpaCols)) as $c) {
|
||||||
|
$sheet3->getColumnDimension(Coordinate::stringFromColumnIndex($c))->setAutoSize(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* =========================================================
|
||||||
|
* OUTPUT
|
||||||
|
* ========================================================= */
|
||||||
|
$writer = new Xlsx($spreadsheet);
|
||||||
|
|
||||||
|
if (ob_get_length()) ob_end_clean();
|
||||||
|
|
||||||
|
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||||
|
header('Content-Disposition: attachment; filename="' . $filename . '"');
|
||||||
|
header('Cache-Control: max-age=0');
|
||||||
|
|
||||||
|
$writer->save('php://output');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bulkGenerateEcardAndStoreinS3(array $params = [])
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* ---------------------------
|
||||||
|
* 1. Detect mode + collect inputs
|
||||||
|
* ---------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$client_policy_id = $params['client_policy_id'] ?? null;
|
||||||
|
$emp_code = $params['emp_code'] ?? null;
|
||||||
|
$emp_pk = $params['emp_pk'] ?? null;
|
||||||
|
$batch_size = $params['batch_size'] ?? null;
|
||||||
|
$batch_no = $params['batch_no'] ?? null;
|
||||||
|
$execution_mode = $params['execution_mode'] ?? 'sequential';//parallel
|
||||||
|
$total_batches = $params['total_batches'] ?? 0;//parallel
|
||||||
|
|
||||||
|
if (is_cli()) {
|
||||||
|
$mode = 'CLI';
|
||||||
|
|
||||||
|
|
||||||
|
} elseif (empty($params) && $this->request->getMethod() === 'get') {
|
||||||
|
$mode = 'WEB';
|
||||||
|
|
||||||
|
$client_policy_id = $this->request->getGet('client_policy_id');
|
||||||
|
$emp_code = $this->request->getGet('emp_code');
|
||||||
|
$emp_pk = $this->request->getGet('emp_pk');
|
||||||
|
$execution_mode = $this->request->getGet('execution_mode') ?? 'sequential';
|
||||||
|
$batch_size = (int) ($this->request->getGet('batch_size') ?? 100);
|
||||||
|
if($client_policy_id == null || empty($client_policy_id) || $client_policy_id == '')
|
||||||
|
{
|
||||||
|
return $this->respond(['status' => false, 'code' => 200, 'message' => 'client_policy_id is necessary'], 200);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ---------------------------
|
||||||
|
* 2. Calculate total records
|
||||||
|
* ---------------------------
|
||||||
|
*/
|
||||||
|
$total = $this->employeePolicyModel
|
||||||
|
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||||
|
->where('employees.emp_status', 'active')
|
||||||
|
->where('employees.is_active', '1')
|
||||||
|
->where("employee_polices.tpa_id IS NOT NULL AND employee_polices.tpa_id <> ''")
|
||||||
|
->where('employee_polices.status', 'active')
|
||||||
|
->where('employee_polices.is_active', '1')
|
||||||
|
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
|
->countAllResults();
|
||||||
|
|
||||||
|
$total_batches = (int) ceil($total / $batch_size);
|
||||||
|
// echo $total_batches;die();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ---------------------------
|
||||||
|
* 3. Push JOB per batch
|
||||||
|
* ---------------------------
|
||||||
|
*/
|
||||||
|
if ($execution_mode === 'parallel') {
|
||||||
|
for ($batch_no = 1; $batch_no <= $total_batches; $batch_no++) {
|
||||||
|
Jobs::addJob([
|
||||||
|
'job_name' => 'bulkGenerateEcardAndStoreinS3',
|
||||||
|
'payload' => [
|
||||||
|
'client_policy_id' => $client_policy_id,
|
||||||
|
'emp_code' => $emp_code,
|
||||||
|
'emp_pk' => $emp_pk,
|
||||||
|
'batch_size' => $batch_size,
|
||||||
|
'batch_no' => $batch_no,
|
||||||
|
'total_batches' => $total_batches,
|
||||||
|
'execution_mode' => 'parallel',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($execution_mode === 'sequential') {
|
||||||
|
Jobs::addJob([
|
||||||
|
'job_name' => 'bulkGenerateEcardAndStoreinS3',
|
||||||
|
'payload' => [
|
||||||
|
'client_policy_id' => $client_policy_id,
|
||||||
|
'batch_size' => $batch_size,
|
||||||
|
'batch_no' => $batch_no ?? 1,
|
||||||
|
'total_batches' => $total_batches,
|
||||||
|
'execution_mode' => 'sequential',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => true, 'code' => 200, 'message' => 'E-card generation started',
|
||||||
|
'total' => $total,
|
||||||
|
'batches' => $total_batches,], 200);
|
||||||
|
// return [
|
||||||
|
// 'status' => true,
|
||||||
|
// 'message' => 'E-card generation started',
|
||||||
|
// 'total' => $total,
|
||||||
|
// 'batches' => $total_batches,
|
||||||
|
// ];
|
||||||
|
}
|
||||||
|
//else {
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ---------------------------
|
||||||
|
* 4. Build query (CLI execution)
|
||||||
|
* ---------------------------
|
||||||
|
*/
|
||||||
|
$builder = $this->employeePolicyModel
|
||||||
|
->select('
|
||||||
|
employee_polices.client_policy_id,
|
||||||
|
employees.emp_code,
|
||||||
|
tpa.short_name,
|
||||||
|
employees.client_id,
|
||||||
|
employee_polices.rand_string,
|
||||||
|
employees.id as emp_id
|
||||||
|
')
|
||||||
|
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
||||||
|
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||||
|
->join('tpa', 'tpa.id = client_policy.tpa_id')
|
||||||
|
->where('employees.emp_status', 'active')
|
||||||
|
->where('employees.is_active', '1')
|
||||||
|
->where("employee_polices.tpa_id IS NOT NULL AND employee_polices.tpa_id <> ''")
|
||||||
|
->where('employee_polices.status', 'active')
|
||||||
|
->where('employee_polices.is_active', '1')
|
||||||
|
->where('employee_polices.client_policy_id', $client_policy_id);
|
||||||
|
|
||||||
|
if (!empty($emp_code)) {
|
||||||
|
$builder->where('employees.emp_code', $emp_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($emp_pk)) {
|
||||||
|
$builder->where('employees.id', $emp_pk);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ---------------------------
|
||||||
|
* 5. Apply batching (only if provided)
|
||||||
|
* ---------------------------
|
||||||
|
*/
|
||||||
|
if (!empty($batch_size) && !empty($batch_no)) {
|
||||||
|
$offset = ($batch_no - 1) * $batch_size;
|
||||||
|
$builder->limit($batch_size, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = $builder->findAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ---------------------------
|
||||||
|
* 6. Process batch
|
||||||
|
* ---------------------------
|
||||||
|
*/
|
||||||
|
foreach ($res as $row) {
|
||||||
|
$ecard_gen_res = $this->generateIDCardForEmployee(
|
||||||
|
$row['rand_string'],
|
||||||
|
0,
|
||||||
|
2 // skip S3 check, force regenerate
|
||||||
|
);
|
||||||
|
|
||||||
|
// print_rr([
|
||||||
|
// 'batch' => $batch_no,
|
||||||
|
// 'emp' => $row['emp_code'],
|
||||||
|
// 'res' => $ecard_gen_res,
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// echo date('Y-m-d H:i:s') . PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($execution_mode === 'sequential' && $batch_no < $total_batches) {
|
||||||
|
Jobs::addJob([
|
||||||
|
'job_name' => 'bulkGenerateEcardAndStoreinS3',
|
||||||
|
'payload' => [
|
||||||
|
'client_policy_id' => $client_policy_id,
|
||||||
|
'batch_size' => $batch_size,
|
||||||
|
'batch_no' => ($batch_no + 1),
|
||||||
|
'total_batches' => $total_batches,
|
||||||
|
'execution_mode' => 'sequential',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// echo "BATCH {$batch_no} COMPLETED @ " . date('Y-m-d H:i:s') . PHP_EOL;
|
||||||
|
return array($batch_no);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1029,7 +1029,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
|||||||
//check physical file
|
//check physical file
|
||||||
if (!file_exists($file_name_with_path)) {
|
if (!file_exists($file_name_with_path)) {
|
||||||
//file not found update status and reason
|
//file not found update status and reason
|
||||||
$message = "Physcial file not found";
|
$message = "Physcial file not found - " . $file_name_with_path;
|
||||||
// echo $message;
|
// echo $message;
|
||||||
$this->myLogger->logme('error', ($message . ' for file id ' . $file_id));
|
$this->myLogger->logme('error', ($message . ' for file id ' . $file_id));
|
||||||
$this->fileModel->where('id', $file_id)->set(['status' => 'failed', 'reason' => json_encode(['error_summary' => array_count_values([5]), 'error_data' => $message])])->update();
|
$this->fileModel->where('id', $file_id)->set(['status' => 'failed', 'reason' => json_encode(['error_summary' => array_count_values([5]), 'error_data' => $message])])->update();
|
||||||
@ -1402,7 +1402,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
|||||||
//check physical file
|
//check physical file
|
||||||
if (!file_exists($file_name_with_path)) {
|
if (!file_exists($file_name_with_path)) {
|
||||||
//file not found update status and reason
|
//file not found update status and reason
|
||||||
$message = "Physcial file not found";
|
$message = "Physcial file not found - " . $file_name_with_path;
|
||||||
$this->myLogger->logme('error', ($message . ' for file id ' . $file_id));
|
$this->myLogger->logme('error', ($message . ' for file id ' . $file_id));
|
||||||
$this->fileModel->where('id', $file_id)->set(['status' => 'failed', 'reason' => json_encode(['error_summary' => array_count_values([5]), 'error_data' => $message])])->update();
|
$this->fileModel->where('id', $file_id)->set(['status' => 'failed', 'reason' => json_encode(['error_summary' => array_count_values([5]), 'error_data' => $message])])->update();
|
||||||
return array('error_summary' => [5], 'error_data' => $message);
|
return array('error_summary' => [5], 'error_data' => $message);
|
||||||
|
|||||||
@ -194,6 +194,10 @@ class JobWorker extends AdminController
|
|||||||
'type' => 'CC', // Handler Category
|
'type' => 'CC', // Handler Category
|
||||||
'handler' => 'App\Controllers\MediAssistApiController',
|
'handler' => 'App\Controllers\MediAssistApiController',
|
||||||
],
|
],
|
||||||
|
'bulkGenerateEcardAndStoreinS3' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmployeeController',
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@ -253,6 +257,8 @@ class JobWorker extends AdminController
|
|||||||
// print_r($jobdata);
|
// print_r($jobdata);
|
||||||
// echo 'listen';
|
// echo 'listen';
|
||||||
// die();
|
// die();
|
||||||
|
// $jobdata = ['id' => 11954,'uuid' => '001700c2-8127-4d02-80b3-ea26e7603ccf'];
|
||||||
|
// dd($job);
|
||||||
$query = "
|
$query = "
|
||||||
SELECT id, name, payload, uuid
|
SELECT id, name, payload, uuid
|
||||||
FROM jobs
|
FROM jobs
|
||||||
|
|||||||
@ -6,6 +6,7 @@ use App\Controllers\BaseController;
|
|||||||
use App\Models\BatchFileModel;
|
use App\Models\BatchFileModel;
|
||||||
use App\Models\EmployeePolicyModel;
|
use App\Models\EmployeePolicyModel;
|
||||||
use App\Models\TpaApiDataModel;
|
use App\Models\TpaApiDataModel;
|
||||||
|
use App\Models\ClientPolicyModel;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use CodeIgniter\HTTP\IncomingRequest;
|
use CodeIgniter\HTTP\IncomingRequest;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
@ -25,6 +26,7 @@ class MediAssistApiController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function SubmitClaim ($claimId = null)
|
public function SubmitClaim ($claimId = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -353,6 +355,7 @@ class MediAssistApiController extends BaseController
|
|||||||
|
|
||||||
|
|
||||||
// now update DB
|
// now update DB
|
||||||
|
$batch_file_success = 'success';
|
||||||
$updated = 0;
|
$updated = 0;
|
||||||
$employee_policy_ids = [];
|
$employee_policy_ids = [];
|
||||||
foreach ($employeePolicyData as $policy_data) {
|
foreach ($employeePolicyData as $policy_data) {
|
||||||
@ -403,6 +406,7 @@ class MediAssistApiController extends BaseController
|
|||||||
'gender' => $policy_data['gender'] ?? null,
|
'gender' => $policy_data['gender'] ?? null,
|
||||||
'dob' => $policy_data['dob'] ?? null,
|
'dob' => $policy_data['dob'] ?? null,
|
||||||
];
|
];
|
||||||
|
$batch_file_success = 'partially success';
|
||||||
|
|
||||||
log_message(
|
log_message(
|
||||||
'error',
|
'error',
|
||||||
@ -423,7 +427,8 @@ class MediAssistApiController extends BaseController
|
|||||||
// update file table status after the tpa id successfully updated
|
// update file table status after the tpa id successfully updated
|
||||||
if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
|
if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
|
||||||
$file_model = new BatchFileModel();
|
$file_model = new BatchFileModel();
|
||||||
$file_model->where('id', $requestData['file_id'])->set('status', 'success')->update();
|
|
||||||
|
$file_model->where('id', $requestData['file_id'])->set('status', $batch_file_success)->update();
|
||||||
log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
|
log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
|
||||||
} else {
|
} else {
|
||||||
log_message('error', "Failed to update file table status.");
|
log_message('error', "Failed to update file table status.");
|
||||||
@ -540,21 +545,23 @@ class MediAssistApiController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// dd($body);
|
|
||||||
|
|
||||||
// $body = [
|
// $body = [
|
||||||
// "policyNo" => "97000063250400000031",
|
// "policyNo" => "97000063250400000031",
|
||||||
// "startDate" => "31/08/2025",
|
// "startDate" => "01/11/2025",
|
||||||
// "endDate" => "01/09/2025",
|
// "endDate" => "05/11/2025",
|
||||||
// "employeeCode" => "CITPL120193",
|
// "employeeCode" => "",
|
||||||
// "memberID" => "",
|
// "memberID" => "",
|
||||||
// "claimNo" => "",
|
// "claimNo" => "",
|
||||||
// "claimRefNo" => "HOSP4078102577_16092025111030"
|
// "claimRefNo" => ""
|
||||||
// ];
|
// ];
|
||||||
|
|
||||||
// CALL API
|
// CALL API
|
||||||
$response = call_third_party_api($url, $method, $headers, $body);
|
$response = call_third_party_api($url, $method, $headers, $body);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($response['status'] != true || empty($response['data']['claimsData'][0])) {
|
if ($response['status'] != true || empty($response['data']['claimsData'][0])) {
|
||||||
log_message('error', 'CLAIM STATUS FAILED | for ticket ID: ' . $claimId.' | response: '.json_encode($response));
|
log_message('error', 'CLAIM STATUS FAILED | for ticket ID: ' . $claimId.' | response: '.json_encode($response));
|
||||||
|
|
||||||
@ -613,9 +620,9 @@ class MediAssistApiController extends BaseController
|
|||||||
// Maping tpa claim status with local claim Status
|
// Maping tpa claim status with local claim Status
|
||||||
if (isset($validStatuses[$currentStatus]))
|
if (isset($validStatuses[$currentStatus]))
|
||||||
{
|
{
|
||||||
$updateArray = ['claim_status_id' => $validStatuses[$currentStatus] , 'tpa_claim_status' => $currentStatus , 'tpa_claim_id' => $tpa_claim_no , 'updated_at' => date('Y-m-d H:i:s')];
|
$updateArray = ['claim_status_id' => $validStatuses[$currentStatus] , 'tpa_claim_status' => $currentStatus , 'tpa_claim_id' => $tpa_claim_no, 'claim_number' => $tpa_claim_no, 'updated_at' => date('Y-m-d H:i:s')];
|
||||||
}else{
|
}else{
|
||||||
$updateArray = ['tpa_claim_status' => $currentStatus , 'tpa_claim_id' => $tpa_claim_no , 'updated_at' => date('Y-m-d H:i:s')];
|
$updateArray = ['tpa_claim_status' => $currentStatus , 'tpa_claim_id' => $tpa_claim_no, 'claim_number' => $tpa_claim_no , 'updated_at' => date('Y-m-d H:i:s')];
|
||||||
}
|
}
|
||||||
|
|
||||||
// UPDATE ticket_master
|
// UPDATE ticket_master
|
||||||
@ -794,7 +801,6 @@ class MediAssistApiController extends BaseController
|
|||||||
// unlink($file_array['json_file_path']); // delete temp json file
|
// unlink($file_array['json_file_path']); // delete temp json file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function ClaimStatusUpdate()
|
public function ClaimStatusUpdate()
|
||||||
{
|
{
|
||||||
helper('api');
|
helper('api');
|
||||||
@ -925,9 +931,9 @@ class MediAssistApiController extends BaseController
|
|||||||
// Maping tpa claim status with local claim Status
|
// Maping tpa claim status with local claim Status
|
||||||
if (isset($validStatuses[$currentStatus]))
|
if (isset($validStatuses[$currentStatus]))
|
||||||
{
|
{
|
||||||
$updateArray = ['claim_status_id' => $validStatuses[$currentStatus] , 'tpa_claim_status' => $currentStatus , 'tpa_claim_id' => $tpa_claim_no , 'updated_at' => date('Y-m-d H:i:s')];
|
$updateArray = ['claim_status_id' => $validStatuses[$currentStatus] , 'tpa_claim_status' => $currentStatus , 'tpa_claim_id' => $tpa_claim_no , 'claim_number' => $tpa_claim_no , 'updated_at' => date('Y-m-d H:i:s')];
|
||||||
}else{
|
}else{
|
||||||
$updateArray = ['tpa_claim_status' => $currentStatus , 'tpa_claim_id' => $tpa_claim_no , 'updated_at' => date('Y-m-d H:i:s')];
|
$updateArray = ['tpa_claim_status' => $currentStatus , 'tpa_claim_id' => $tpa_claim_no , 'claim_number' => $tpa_claim_no, 'updated_at' => date('Y-m-d H:i:s')];
|
||||||
}
|
}
|
||||||
|
|
||||||
// UPDATE ticket_master
|
// UPDATE ticket_master
|
||||||
@ -949,6 +955,328 @@ class MediAssistApiController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function syncTpaClaimToNhance()
|
||||||
|
{
|
||||||
|
helper(['api', 'date']);
|
||||||
|
|
||||||
|
$url = getenv('MEDI_ASSIST_API_BASE_URL_CLAIMSTATUS');
|
||||||
|
$method = 'POST';
|
||||||
|
|
||||||
|
$headers = [
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Username:' . getenv('MEDI_ASSIST_API_USERNAME'),
|
||||||
|
'Password:' . getenv('MEDI_ASSIST_API_PASSWORD'),
|
||||||
|
];
|
||||||
|
|
||||||
|
// REQUEST DATES
|
||||||
|
$reqStartDate = $this->request->getGet('start_date');
|
||||||
|
$reqEndDate = $this->request->getGet('end_date');
|
||||||
|
|
||||||
|
// If start_date OR end_date is missing → last 7 days
|
||||||
|
if (empty($reqStartDate) || empty($reqEndDate)) {
|
||||||
|
|
||||||
|
$endDateObj = new \DateTime(); // today
|
||||||
|
$startDateObj = (clone $endDateObj)->modify('-6 days');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$startDateObj = new \DateTime($reqStartDate);
|
||||||
|
$endDateObj = new \DateTime($reqEndDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Final usable variables
|
||||||
|
$reqStartDate = $startDateObj->format('Y-m-d');
|
||||||
|
$reqEndDate = $endDateObj->format('Y-m-d');
|
||||||
|
|
||||||
|
// Final usable variables
|
||||||
|
$reqStartDate = new \DateTime($reqStartDate);
|
||||||
|
$reqEndDate = new \DateTime($reqEndDate);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// FETCH POLICY DATA
|
||||||
|
$policies = $this->db->table('client_policy cp')
|
||||||
|
->select("
|
||||||
|
cp.policy_no AS policyNo,
|
||||||
|
cp.policy_start_date AS policyStartDate,
|
||||||
|
cp.policy_end_date AS policyEndDate
|
||||||
|
")
|
||||||
|
->where('cp.is_active', 1)
|
||||||
|
->where('cp.policy_type_id', 2)
|
||||||
|
->where('cp.policy_status', 1)
|
||||||
|
// ->where('cp.policy_no', '97000063250400000031')
|
||||||
|
->where('cp.tpa_id', $this->mediAssistTpaId)
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
|
if (empty($policies)) {
|
||||||
|
log_message('error', 'No policies found for claim sync');
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Policies not found'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$finalResult = [];
|
||||||
|
$errorData = [];
|
||||||
|
|
||||||
|
|
||||||
|
// LOOP POLICIES
|
||||||
|
|
||||||
|
foreach ($policies as $policy) {
|
||||||
|
|
||||||
|
$policyStart = new \DateTime($policy['policyStartDate']);
|
||||||
|
$policyEnd = new \DateTime($policy['policyEndDate']);
|
||||||
|
|
||||||
|
|
||||||
|
// ADJUST DATE RANGE (inside policy period)
|
||||||
|
|
||||||
|
$startDate = max($reqStartDate, $policyStart);
|
||||||
|
$endDate = min($reqEndDate, $policyEnd);
|
||||||
|
|
||||||
|
|
||||||
|
if ($startDate > $endDate) {
|
||||||
|
continue; // No valid range for this policy
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// SPLIT INTO 7-DAY CHUNKS
|
||||||
|
|
||||||
|
$chunkStart = clone $startDate;
|
||||||
|
|
||||||
|
while ($chunkStart <= $endDate) {
|
||||||
|
|
||||||
|
$chunkEnd = clone $chunkStart;
|
||||||
|
$chunkEnd->modify('+6 days');
|
||||||
|
|
||||||
|
if ($chunkEnd > $endDate) {
|
||||||
|
$chunkEnd = clone $endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// PREPARE BODY
|
||||||
|
|
||||||
|
$body = [
|
||||||
|
"policyNo" => $policy['policyNo'],
|
||||||
|
"startDate" => $chunkStart->format('d/m/Y'),
|
||||||
|
"endDate" => $chunkEnd->format('d/m/Y'),
|
||||||
|
"employeeCode" => "",
|
||||||
|
"memberID" => "",
|
||||||
|
"claimNo" => "",
|
||||||
|
"claimRefNo" => "",
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
// CALL TPA API
|
||||||
|
|
||||||
|
$response = call_third_party_api($url, $method, $headers, $body);
|
||||||
|
|
||||||
|
if (empty($response['status']) || empty($response['data']['claimsData'])) {
|
||||||
|
|
||||||
|
log_message('error','CLAIM STATUS FAILED | ' .'policyNo: ' . $policy['policyNo'] .' | ' . $chunkStart->format('Y-m-d') .' to ' . $chunkEnd->format('Y-m-d') .' | response: ' . json_encode($response) );
|
||||||
|
|
||||||
|
$errorData[] = [
|
||||||
|
'policy_no' => $policy['policyNo'],
|
||||||
|
'start' => $chunkStart->format('Y-m-d'),
|
||||||
|
'end' => $chunkEnd->format('Y-m-d'),
|
||||||
|
];
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$finalResult = array_merge($finalResult,$response['data']['claimsData']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move to next chunk
|
||||||
|
$chunkStart->modify('+7 days');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 5️⃣ FINAL RESPONSE
|
||||||
|
foreach ($finalResult as $key => $value) {
|
||||||
|
|
||||||
|
$relationship = strtolower(trim($value['relation'] ?? ''));
|
||||||
|
|
||||||
|
if ($relationship === 'employee') {
|
||||||
|
$relationship = 'self';
|
||||||
|
}
|
||||||
|
|
||||||
|
$ticket = $this->db->table('ticket_master tm')->select("tm.id")
|
||||||
|
->where('tm.policy_no', $value['policY_NUMBER'])
|
||||||
|
->where('tm.emp_code', $value['employeE_NO'])
|
||||||
|
->where('tm.claim_number', $value['tpA_CLAIM_NO'])
|
||||||
|
->get()
|
||||||
|
->getRowArray();
|
||||||
|
|
||||||
|
if(!$ticket)
|
||||||
|
{
|
||||||
|
|
||||||
|
// VALID STATUS LIST
|
||||||
|
$validStatuses = [
|
||||||
|
|
||||||
|
"Claim Received" => 1,
|
||||||
|
"In Progress" => 5,
|
||||||
|
"Processed" => 11,
|
||||||
|
"Claim Paid" => 11,
|
||||||
|
"Denied" => 13,
|
||||||
|
"Cancelled" => 13,
|
||||||
|
|
||||||
|
"Information Awaited" => 4,
|
||||||
|
"Confirmation Awaited" => 4,
|
||||||
|
"Information Awaited Reminder" => 4,
|
||||||
|
"Information Awaited Final Reminder" => 4,
|
||||||
|
"Insurer Concurrence Awaited" => 6,
|
||||||
|
"Closed" => 12,
|
||||||
|
|
||||||
|
"Physical Documents Awaited" => 9,
|
||||||
|
"Processed - Payment Initiated" => 10,
|
||||||
|
"Processed - Transaction Failed" => 10,
|
||||||
|
"Processed - Account Details Updated" => 10,
|
||||||
|
"Processed - Debit Note Raised With Insurer for Payment"=> 10,
|
||||||
|
"Processed - Payment Initiated by Insurer" => 10,
|
||||||
|
"Payment - Refunded to Insurer" => 14,
|
||||||
|
"Processed - Processing Payment" => 10,
|
||||||
|
"Processed - Physical Documents Awaited" => 9,
|
||||||
|
|
||||||
|
// Extra Mappings (based on your DB list)
|
||||||
|
"NON ID" => 1,
|
||||||
|
"ID NOT GENERATED" => 2,
|
||||||
|
"CDA" => 3,
|
||||||
|
"REJECTED" => 8,
|
||||||
|
"APPROVED" => 9,
|
||||||
|
"PAYMENT INITIATED" => 10,
|
||||||
|
"SETTLED" => 11,
|
||||||
|
"RETURNED" => 14,
|
||||||
|
"UNDER PROCESS - TPA" => 61,
|
||||||
|
"DENIAL REVIEW AWAITED" => 66,
|
||||||
|
];
|
||||||
|
|
||||||
|
$currentStatus = trim($value['claim_Current_Status'] ?? '');
|
||||||
|
|
||||||
|
$claimStatusId = $validStatuses[$currentStatus] ?? null;
|
||||||
|
|
||||||
|
if (!$claimStatusId) {
|
||||||
|
log_message('error', 'Unknown claim status: '.$currentStatus);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$clientpolicy = $this->db->table('client_policy cp')
|
||||||
|
->select("
|
||||||
|
cp.id as client_policy_id,
|
||||||
|
cp.client_id ,
|
||||||
|
cp.insurer_id ,
|
||||||
|
cp.tpa_id ,
|
||||||
|
client_rm.id as acm_id
|
||||||
|
")
|
||||||
|
->join('client_rm', 'client_rm.client_id = cp.client_id AND client_rm.level = 3', 'left')
|
||||||
|
->where('cp.policy_no', $value['policY_NUMBER'])
|
||||||
|
->get()
|
||||||
|
->getRowArray();
|
||||||
|
|
||||||
|
$employee = $this->db->table('employees e')
|
||||||
|
->select("
|
||||||
|
e.id as emp_id,
|
||||||
|
e.emp_code ,
|
||||||
|
e2.id as insured_emp_id,
|
||||||
|
")
|
||||||
|
->join(
|
||||||
|
'employees e2',
|
||||||
|
"e2.emp_code = e.emp_code AND e2.relationship = ".$this->db->escape($relationship),
|
||||||
|
'left'
|
||||||
|
)
|
||||||
|
->where('e.emp_code', $value['employeE_NO'])
|
||||||
|
->where('e.relationship', 'self')
|
||||||
|
->get()
|
||||||
|
->getRowArray();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$claimData = [
|
||||||
|
// Core
|
||||||
|
'ticket_type_id' => 1,
|
||||||
|
'claim_status_id' => $claimStatusId,
|
||||||
|
'policy_no' => $value['policY_NUMBER'] ?? null,
|
||||||
|
'claim_number' => $value['tpA_CLAIM_NO'] ?? null,
|
||||||
|
'tpa_claim_id' => $value['tpA_CLAIM_NO'] ?? null,
|
||||||
|
|
||||||
|
// local promary id
|
||||||
|
'tpa_id' => $clientpolicy['tpa_id'] ?? null,
|
||||||
|
'insurer_id' => $clientpolicy['insurer_id'] ?? null,
|
||||||
|
'client_policy_id' => $clientpolicy['client_policy_id'] ?? null,
|
||||||
|
'client_id' => $clientpolicy['client_id'] ?? null,
|
||||||
|
'acm_id' => $clientpolicy['acm_id'] ?? null,
|
||||||
|
|
||||||
|
// Employee / Insured
|
||||||
|
'emp_id' => $employee['emp_id'] ?? null,
|
||||||
|
'insured_emp_id' => $employee['insured_emp_id'] ?? null,
|
||||||
|
'emp_code' => $value['employeE_NO'] ?? null,
|
||||||
|
'emp_name' => $value['employeE_NAME'] ?? null,
|
||||||
|
'insured_name' => $value['beneficiarY_NAME'] ?? null,
|
||||||
|
'relationship' => $relationship,
|
||||||
|
'emp_mobile' => $value['mobile'] ?? null,
|
||||||
|
'emp_mail' => $value['email'] ?? null,
|
||||||
|
|
||||||
|
// Claim info
|
||||||
|
'claim_type' => 1,
|
||||||
|
'mode_of_intimation' => 5,
|
||||||
|
'claim_amount' => $value['estimateD_CLAIM_AMOUNT']
|
||||||
|
?? $value['finaL_BILL_AMOUNT']
|
||||||
|
?? null,
|
||||||
|
'approved_amount' => $value['claiM_APPROVED_AMOUNT'] ?? null,
|
||||||
|
|
||||||
|
// Dates
|
||||||
|
'dob' => $this->mediDate($value['datE_OF_BIRTH'] ?? null),
|
||||||
|
'doa' => $this->mediDate($value['datE_OF_ADMISSION'] ?? null),
|
||||||
|
'dod' => $this->mediDate($value['datE_OF_DISCHARGE'] ?? null),
|
||||||
|
'raised_date' => $this->mediDate($value['claiM_REGISTERED_DATE'] ?? null),
|
||||||
|
'approved_date' => $this->mediDate($value['approved_Date'] ?? null),
|
||||||
|
'settled_date' => $this->mediDate($value['paiD_DATE'] ?? null),
|
||||||
|
|
||||||
|
// Hospital
|
||||||
|
'hospital_name' => $value['hospitaL_NAME'] ?? null,
|
||||||
|
'hospital_address' => $value['hospitaL_ADDRESS'] ?? null,
|
||||||
|
'hospital_state' => $value['hospitaL_STATE'] ?? null,
|
||||||
|
'hospital_city' => $value['hospitaL_CITY'] ?? null,
|
||||||
|
'hospital_pin_code'=> $value['hosP_PINCODE'] ?? null,
|
||||||
|
|
||||||
|
// Payment
|
||||||
|
'utr_details' => $value['banK_CHEQUE_NO'] ?? null,
|
||||||
|
'settle_letter' => $value['settlement_LetterLink'] ?? null,
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->db->table('ticket_master')->insert($claimData);
|
||||||
|
|
||||||
|
log_message(
|
||||||
|
'info',
|
||||||
|
'New claim created | Policy: '.$claimData['policy_no'].
|
||||||
|
' | Claim: '.$claimData['claim_number']
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'TPA claim status sync completed',
|
||||||
|
'total_records' => count($finalResult),
|
||||||
|
'result' => $finalResult,
|
||||||
|
'errors' => $errorData
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function mediDate($date)
|
||||||
|
{
|
||||||
|
if (empty($date)) return null;
|
||||||
|
$dt = \DateTime::createFromFormat('d/m/Y H:i:s', $date);
|
||||||
|
return $dt ? $dt->format('Y-m-d') : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -732,6 +732,11 @@
|
|||||||
|
|
||||||
|
|
||||||
// dd($data);
|
// dd($data);
|
||||||
|
//Fetch POS
|
||||||
|
$data['pos_data'] = db_connect()->table('partner_pos')
|
||||||
|
->where('is_active', 1)
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
// Load view
|
// Load view
|
||||||
$this->loadLayout('policy_transaction_inception_list', $data);
|
$this->loadLayout('policy_transaction_inception_list', $data);
|
||||||
@ -985,11 +990,11 @@
|
|||||||
$data['co_share'] = 1;
|
$data['co_share'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($data['bro_payable_by'])) {
|
// if (!isset($data['bro_payable_by'])) {
|
||||||
$data['bro_payable_by'] = 0;
|
// $data['bro_payable_by'] = 0;
|
||||||
} elseif ($data['bro_payable_by']) {
|
// } elseif ($data['bro_payable_by']) {
|
||||||
$data['bro_payable_by'] = 1;
|
// $data['bro_payable_by'] = 1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (!isset($data['same_as_proposer'])) {
|
if (!isset($data['same_as_proposer'])) {
|
||||||
$data['same_as_proposer'] = 0;
|
$data['same_as_proposer'] = 0;
|
||||||
@ -2382,6 +2387,7 @@
|
|||||||
'service_person_branch_id' => $issue_type['service_person_branch_id'] ?? null,
|
'service_person_branch_id' => $issue_type['service_person_branch_id'] ?? null,
|
||||||
'agent_id' => $issue_type['agent_id'] ?? null,
|
'agent_id' => $issue_type['agent_id'] ?? null,
|
||||||
'agent_code' => $issue_type['agent_code'] ?? null,
|
'agent_code' => $issue_type['agent_code'] ?? null,
|
||||||
|
'pos_id' => $issue_type['pos_id'] ?? null,
|
||||||
];
|
];
|
||||||
|
|
||||||
$data['client_branch_id'] = $client_branch_id;
|
$data['client_branch_id'] = $client_branch_id;
|
||||||
|
|||||||
@ -238,7 +238,7 @@ if (!function_exists('generate_download_link')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('generate_random_alphanumeric')) {
|
if (!function_exists('generate_random_alphanumeric')) {
|
||||||
function generate_random_alphanumeric($length = 6) {
|
function generate_random_alphanumeric($length = 12) {
|
||||||
$random_string = '';
|
$random_string = '';
|
||||||
for ($i = 0; $i < $length; $i++) {
|
for ($i = 0; $i < $length; $i++) {
|
||||||
$random_ascii = rand(0, 61);
|
$random_ascii = rand(0, 61);
|
||||||
|
|||||||
268
app/Libraries/S3Service.php
Normal file
268
app/Libraries/S3Service.php
Normal file
@ -0,0 +1,268 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Libraries;
|
||||||
|
|
||||||
|
use Aws\S3\S3Client;
|
||||||
|
use Aws\Exception\AwsException;
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
|
||||||
|
class S3Service
|
||||||
|
{
|
||||||
|
protected $s3Client;
|
||||||
|
protected $bucket;
|
||||||
|
protected $region;
|
||||||
|
protected $baseUrl;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->bucket = getenv('AWS_BUCKET');
|
||||||
|
$this->region = getenv('AWS_DEFAULT_REGION');
|
||||||
|
|
||||||
|
$this->s3Client = new S3Client([
|
||||||
|
'version' => 'latest',
|
||||||
|
'region' => $this->region,
|
||||||
|
'credentials' => [
|
||||||
|
'key' => getenv('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => getenv('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->baseUrl = "https://{$this->bucket}.s3.{$this->region}.amazonaws.com/";
|
||||||
|
// echo $this->baseUrl;die();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload file to S3
|
||||||
|
*
|
||||||
|
* @param mixed $file File object or file path
|
||||||
|
* @param string $folder Folder path in S3 bucket (optional)
|
||||||
|
* @param string $fileName Custom file name (optional)
|
||||||
|
* @return array ['success' => bool, 'url' => string, 'key' => string, 'message' => string]
|
||||||
|
*/
|
||||||
|
public function upload($file, string $folder = '', string $fileName = null): array
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// Handle CodeIgniter file upload object
|
||||||
|
if (is_object($file) && method_exists($file, 'isValid')) {
|
||||||
|
if (!$file->isValid()) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'message' => 'Invalid file upload',
|
||||||
|
'url' => null,
|
||||||
|
'key' => null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$filePath = $file->getTempName();
|
||||||
|
$originalName = $fileName ?? $file->getClientName();
|
||||||
|
} else {
|
||||||
|
// Handle file path string
|
||||||
|
$filePath = $file;
|
||||||
|
$originalName = $fileName ?? basename($file);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate unique file name
|
||||||
|
$extension = pathinfo($originalName, PATHINFO_EXTENSION);
|
||||||
|
// $uniqueName = pathinfo($originalName, PATHINFO_FILENAME) . '_' . time() . '.' . $extension;
|
||||||
|
$uniqueName = pathinfo($originalName, PATHINFO_FILENAME) . '.' . $extension;
|
||||||
|
|
||||||
|
// Build S3 key (path)
|
||||||
|
$key = $folder ? rtrim($folder, '/') . '/' . $uniqueName : $uniqueName;
|
||||||
|
|
||||||
|
// Upload to S3
|
||||||
|
// NEW - Faster with streaming and proper content type
|
||||||
|
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||||
|
$mimeType = finfo_file($finfo, $filePath);
|
||||||
|
finfo_close($finfo);
|
||||||
|
|
||||||
|
$result = $this->s3Client->putObject([
|
||||||
|
'Bucket' => $this->bucket,
|
||||||
|
'Key' => $key,
|
||||||
|
'Body' => fopen($filePath, 'rb'), // Stream instead of loading into memory
|
||||||
|
'ContentType' => $mimeType,
|
||||||
|
// 'ACL' => 'public-read',
|
||||||
|
]);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'success' => true,
|
||||||
|
'url' => $this->baseUrl . $key,
|
||||||
|
'key' => $key,
|
||||||
|
'message' => 'File uploaded successfully'
|
||||||
|
];
|
||||||
|
|
||||||
|
} catch (AwsException $e) {
|
||||||
|
log_message('error', 'S3 Upload Error: ' . $e->getMessage());
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'message' => 'Upload failed: ' . $e->getMessage(),
|
||||||
|
'url' => null,
|
||||||
|
'key' => null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Download file from S3
|
||||||
|
*
|
||||||
|
* @param string $key S3 object key (file path in bucket)
|
||||||
|
* @param string $savePath Local path to save the file (optional)
|
||||||
|
* @return array ['success' => bool, 'path' => string, 'content' => string, 'message' => string]
|
||||||
|
*/
|
||||||
|
public function download(string $key, string $savePath = null): array
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$result = $this->s3Client->getObject([
|
||||||
|
'Bucket' => $this->bucket,
|
||||||
|
'Key' => $key,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$content = (string) $result['Body'];
|
||||||
|
|
||||||
|
// If save path is provided, save to local file
|
||||||
|
if ($savePath) {
|
||||||
|
$directory = dirname($savePath);
|
||||||
|
if (!is_dir($directory)) {
|
||||||
|
mkdir($directory, 0755, true);
|
||||||
|
}
|
||||||
|
file_put_contents($savePath, $content);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'success' => true,
|
||||||
|
'path' => $savePath,
|
||||||
|
'content' => $content,
|
||||||
|
'message' => 'File downloaded successfully'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'success' => true,
|
||||||
|
'path' => null,
|
||||||
|
'content' => $content,
|
||||||
|
'message' => 'File content retrieved successfully'
|
||||||
|
];
|
||||||
|
|
||||||
|
} catch (AwsException $e) {
|
||||||
|
log_message('error', 'S3 Download Error: ' . $e->getMessage());
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'path' => null,
|
||||||
|
'content' => null,
|
||||||
|
'message' => 'Download failed: ' . $e->getMessage()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a pre-signed URL for temporary access to a private file
|
||||||
|
*
|
||||||
|
* @param string $key S3 object key
|
||||||
|
* @param int $expiration Expiration time in minutes (default: 60)
|
||||||
|
* @return array ['success' => bool, 'url' => string, 'message' => string]
|
||||||
|
*/
|
||||||
|
public function getPresignedUrl(string $key, int $expiration = 60): array
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$cmd = $this->s3Client->getCommand('GetObject', [
|
||||||
|
'Bucket' => $this->bucket,
|
||||||
|
'Key' => $key
|
||||||
|
]);
|
||||||
|
|
||||||
|
$request = $this->s3Client->createPresignedRequest($cmd, "+{$expiration} minutes");
|
||||||
|
$presignedUrl = (string) $request->getUri();
|
||||||
|
|
||||||
|
return [
|
||||||
|
'success' => true,
|
||||||
|
'url' => $presignedUrl,
|
||||||
|
'message' => 'Pre-signed URL generated successfully'
|
||||||
|
];
|
||||||
|
|
||||||
|
} catch (AwsException $e) {
|
||||||
|
log_message('error', 'S3 Presigned URL Error: ' . $e->getMessage());
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'url' => null,
|
||||||
|
'message' => 'Failed to generate URL: ' . $e->getMessage()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete file from S3
|
||||||
|
*
|
||||||
|
* @param string $key S3 object key
|
||||||
|
* @return array ['success' => bool, 'message' => string]
|
||||||
|
*/
|
||||||
|
public function delete(string $key): array
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->s3Client->deleteObject([
|
||||||
|
'Bucket' => $this->bucket,
|
||||||
|
'Key' => $key,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'success' => true,
|
||||||
|
'message' => 'File deleted successfully'
|
||||||
|
];
|
||||||
|
|
||||||
|
} catch (AwsException $e) {
|
||||||
|
log_message('error', 'S3 Delete Error: ' . $e->getMessage());
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'message' => 'Delete failed: ' . $e->getMessage()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if file exists in S3
|
||||||
|
*
|
||||||
|
* @param string $key S3 object key
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function exists(string $key): bool
|
||||||
|
{
|
||||||
|
return $this->s3Client->doesObjectExist($this->bucket, $key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List files in S3 bucket
|
||||||
|
*
|
||||||
|
* @param string $prefix Folder prefix (optional)
|
||||||
|
* @return array ['success' => bool, 'files' => array, 'message' => string]
|
||||||
|
*/
|
||||||
|
public function listFiles(string $prefix = ''): array
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$result = $this->s3Client->listObjectsV2([
|
||||||
|
'Bucket' => $this->bucket,
|
||||||
|
'Prefix' => $prefix,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$files = [];
|
||||||
|
if (isset($result['Contents'])) {
|
||||||
|
foreach ($result['Contents'] as $object) {
|
||||||
|
$files[] = [
|
||||||
|
'key' => $object['Key'],
|
||||||
|
'size' => $object['Size'],
|
||||||
|
'last_modified' => $object['LastModified']->format('Y-m-d H:i:s'),
|
||||||
|
'url' => $this->baseUrl . $object['Key']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'success' => true,
|
||||||
|
'files' => $files,
|
||||||
|
'message' => 'Files retrieved successfully'
|
||||||
|
];
|
||||||
|
|
||||||
|
} catch (AwsException $e) {
|
||||||
|
log_message('error', 'S3 List Error: ' . $e->getMessage());
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'files' => [],
|
||||||
|
'message' => 'Failed to list files: ' . $e->getMessage()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2139,5 +2139,60 @@ class EmployeePolicyModel extends Model
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTPADataVariationReport($client_id, $client_policy_id, $file_id,$emp_codes = [],$all = false)
|
||||||
|
{
|
||||||
|
$result = $this->select([
|
||||||
|
'employee_polices.*',
|
||||||
|
'tpam.name as tpa_name',
|
||||||
|
'tpam.short_name as tpa_short_name',
|
||||||
|
'emp.relationship',
|
||||||
|
'emp.relationship_code',
|
||||||
|
'emp.change_event',
|
||||||
|
'emp.emp_code',
|
||||||
|
'emp.name',
|
||||||
|
'emp.email_corporate',
|
||||||
|
'emp.dob',
|
||||||
|
'emp.gender',
|
||||||
|
'emp.emp_status',
|
||||||
|
'emp.is_active as emp_is_active',
|
||||||
|
'emp.mobile as mobile',
|
||||||
|
'emp.doj',
|
||||||
|
'emp.basic_pay',
|
||||||
|
'emp.band as grade',
|
||||||
|
'cp.policy_no',
|
||||||
|
'cp.policy_type_id',
|
||||||
|
|
||||||
|
])
|
||||||
|
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||||
|
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id')
|
||||||
|
->join('tpa tpam', 'cp.tpa_id = tpam.id', 'left') //tpam - tpa master
|
||||||
|
// ->orderBy('emp.emp_code', 'ASC')
|
||||||
|
// ->orderBy('employee_polices.employee_id', 'ASC');
|
||||||
|
->where('employee_polices.status', 'active')
|
||||||
|
->where('employee_polices.is_active', 1)
|
||||||
|
->where('emp.is_active', 1)
|
||||||
|
->where('employee_polices.status !=', 'inactive')
|
||||||
|
->where('cp.id', $client_policy_id)
|
||||||
|
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
|
->where('emp.client_id', $client_id);
|
||||||
|
|
||||||
|
if(count($emp_codes) == 0 && $all == false)
|
||||||
|
{
|
||||||
|
$result->where('employee_polices.tpa_id IS NULL');
|
||||||
|
}
|
||||||
|
else if(count($emp_codes) > 0 && $all == false)
|
||||||
|
{
|
||||||
|
$result->whereNotIn('emp.emp_code',$emp_codes);
|
||||||
|
}
|
||||||
|
else if(count($emp_codes) == 0 && $all == true)
|
||||||
|
{
|
||||||
|
$result->groupBy('emp.emp_code');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result->findAll();
|
||||||
|
// print_r($result);
|
||||||
|
// return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -88,6 +88,7 @@
|
|||||||
'salse_person_manager_id',
|
'salse_person_manager_id',
|
||||||
'service_person_manager_id',
|
'service_person_manager_id',
|
||||||
'service_person_branch_id',
|
'service_person_branch_id',
|
||||||
|
'pos_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@ -616,9 +617,9 @@
|
|||||||
policy_transaction.*,
|
policy_transaction.*,
|
||||||
DATE_FORMAT(policy_transaction.policy_issue_date, '%d %b %Y') AS policy_issue_date,
|
DATE_FORMAT(policy_transaction.policy_issue_date, '%d %b %Y') AS policy_issue_date,
|
||||||
DATE_FORMAT(
|
DATE_FORMAT(
|
||||||
IF(policy_transaction.month IS NULL,
|
IF(pt_co_share_details.pt_policy_issue_date IS NULL,
|
||||||
policy_transaction.policy_issue_date,
|
policy_transaction.policy_issue_date,
|
||||||
policy_transaction.month),
|
pt_co_share_details.pt_policy_issue_date),
|
||||||
'%b %Y') AS policy_issue_month,
|
'%b %Y') AS policy_issue_month,
|
||||||
CASE
|
CASE
|
||||||
WHEN clients.client_type = 1 THEN 'Group'
|
WHEN clients.client_type = 1 THEN 'Group'
|
||||||
|
|||||||
@ -176,6 +176,12 @@
|
|||||||
<a href="<?= base_url('/util/download_import_file/') . $file['id'] ?>" class="dropdown-item" style="color: #000;" aria-hidden="true" target="_blank" ><i class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download</a>
|
<a href="<?= base_url('/util/download_import_file/') . $file['id'] ?>" class="dropdown-item" style="color: #000;" aria-hidden="true" target="_blank" ><i class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($file['actions'] == "fetch" && $file['status'] == 'partially success') { ?>
|
||||||
|
<a href="<?= base_url('employee/getTPADataVariationReport/') . $file['id'] ?>" class="dropdown-item" style="color: #000;" aria-hidden="true" target="_blank" ><i class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download TPA Variation report</a>
|
||||||
|
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -355,11 +355,54 @@
|
|||||||
// }
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var client_list = ''; // local variable for storing the client branch list
|
||||||
|
var branch_list = ''; // local variable for storing the client branch list
|
||||||
|
var policy_list = ''; // local variable for storing the client policy list
|
||||||
|
var branch_policy = '';
|
||||||
|
var policy_list_by_client = '';
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
getClientAndBranchAndPolicy();
|
||||||
|
})
|
||||||
|
|
||||||
|
//featch client and branch and policy
|
||||||
|
function getClientAndBranchAndPolicy() {
|
||||||
|
$.ajax({
|
||||||
|
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(res) {
|
||||||
|
|
||||||
|
console.log('getClientAndBranchAndPolicy', res);
|
||||||
|
if (res.status == true) {
|
||||||
|
|
||||||
|
client_list = res.client_data;
|
||||||
|
branch_list = res.branch_data;
|
||||||
|
policy_list = res.policy_data;
|
||||||
|
policy_list_by_client = res.policyListByClient;
|
||||||
|
|
||||||
|
appendClients(client_list);
|
||||||
|
// appendBranch(branch_list);
|
||||||
|
// appendPolicies(policy_list);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.log('No data found');
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Declare a global variable to store API response data
|
// Declare a global variable to store API response data
|
||||||
var clientPolicies = [];
|
// var clientPolicies = [];
|
||||||
var clientPoliciesWithBranch = {
|
// var clientPoliciesWithBranch = {
|
||||||
policies: []
|
// policies: []
|
||||||
};
|
// };
|
||||||
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||||
var client_branch_id = '<?= isset($getData) ? $getData['branch_id'] : '0' ?>';
|
var client_branch_id = '<?= isset($getData) ? $getData['branch_id'] : '0' ?>';
|
||||||
|
|
||||||
@ -376,91 +419,91 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
// $(document).ready(function() {
|
||||||
console.log("document loaded");
|
// console.log("document loaded");
|
||||||
|
// //fetchClientPolicies();
|
||||||
|
// });
|
||||||
|
|
||||||
|
// $(window).on("load", function() {
|
||||||
|
// console.log("window loaded");
|
||||||
// fetchClientPolicies();
|
// fetchClientPolicies();
|
||||||
});
|
// });
|
||||||
|
|
||||||
$(window).on("load", function() {
|
// function fetchClientPolicies() {
|
||||||
console.log("window loaded");
|
// $('#loader').show();
|
||||||
fetchClientPolicies();
|
// var apiURL = '<?php echo base_url(); ?>' + 'util/clients-with-policies';
|
||||||
});
|
// console.log('fetchClientPolicies');
|
||||||
|
// // console.log(apiURL);
|
||||||
|
// $.ajax({
|
||||||
|
// url: apiURL,
|
||||||
|
// method: 'GET',
|
||||||
|
// headers: {
|
||||||
|
// "Content-Type": "application/json",
|
||||||
|
// "X-Requested-With": "XMLHttpRequest"
|
||||||
|
// },
|
||||||
|
// success: function(response) {
|
||||||
|
// // console.log(response.code);
|
||||||
|
// // console.log(response.dataStatus);
|
||||||
|
// // console.log(response.data);
|
||||||
|
// if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||||
|
// try {
|
||||||
|
// clientPolicies = (response.data);
|
||||||
|
|
||||||
function fetchClientPolicies() {
|
// response.data.forEach(policy => {
|
||||||
$('#loader').show();
|
// // console.log('policies', policy.policies);
|
||||||
var apiURL = '<?php echo base_url(); ?>' + 'util/clients-with-policies';
|
// policy.policies.forEach(p => {
|
||||||
console.log('fetchClientPolicies');
|
// clientPoliciesWithBranch.policies.push(p);
|
||||||
// console.log(apiURL);
|
// });
|
||||||
$.ajax({
|
// });
|
||||||
url: apiURL,
|
|
||||||
method: 'GET',
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"X-Requested-With": "XMLHttpRequest"
|
|
||||||
},
|
|
||||||
success: function(response) {
|
|
||||||
// console.log(response.code);
|
|
||||||
// console.log(response.dataStatus);
|
|
||||||
// console.log(response.data);
|
|
||||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
|
||||||
try {
|
|
||||||
clientPolicies = (response.data);
|
|
||||||
|
|
||||||
response.data.forEach(policy => {
|
// // console.log('1',clientPolicies);
|
||||||
// console.log('policies', policy.policies);
|
// appendClients(clientPolicies);
|
||||||
policy.policies.forEach(p => {
|
|
||||||
clientPoliciesWithBranch.policies.push(p);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// console.log('1',clientPolicies);
|
// //this function for reselect the policy
|
||||||
appendClients(clientPolicies);
|
// setTimeout(function() {
|
||||||
|
// if (client_id != 0) {
|
||||||
|
// var foundPolicies = clientPolicies.find(function(item) {
|
||||||
|
// // console.log(typeof item.id)
|
||||||
|
// return item.id == client_id;
|
||||||
|
// });
|
||||||
|
// appendBranch(foundPolicies.branchs);
|
||||||
|
// }
|
||||||
|
// }, 500);
|
||||||
|
|
||||||
//this function for reselect the policy
|
// setTimeout(function() {
|
||||||
setTimeout(function() {
|
// if (client_branch_id != 0) {
|
||||||
if (client_id != 0) {
|
|
||||||
var foundPolicies = clientPolicies.find(function(item) {
|
|
||||||
// console.log(typeof item.id)
|
|
||||||
return item.id == client_id;
|
|
||||||
});
|
|
||||||
appendBranch(foundPolicies.branchs);
|
|
||||||
}
|
|
||||||
}, 500);
|
|
||||||
|
|
||||||
setTimeout(function() {
|
// var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||||
if (client_branch_id != 0) {
|
// // console.log('item', item);
|
||||||
|
// return item.branch_id === client_branch_id;
|
||||||
|
// });
|
||||||
|
|
||||||
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
// if (foundPolicies) {
|
||||||
// console.log('item', item);
|
// // console.log('foundPolicies', foundPolicies);
|
||||||
return item.branch_id === client_branch_id;
|
// appendPolicies(foundPolicies);
|
||||||
});
|
// } else {
|
||||||
|
// console.log('No policies found for the selected client');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }, 500);
|
||||||
|
// //end
|
||||||
|
|
||||||
if (foundPolicies) {
|
// } catch (error) {
|
||||||
// console.log('foundPolicies', foundPolicies);
|
// console.error('Error parsing API response data:', error);
|
||||||
appendPolicies(foundPolicies);
|
// }
|
||||||
} else {
|
// } else if (response.code === 404 && response.dataStatus === false) {
|
||||||
console.log('No policies found for the selected client');
|
// console.error('no data found', response);
|
||||||
}
|
// } else {
|
||||||
}
|
// console.error('Something went wrong!');
|
||||||
}, 500);
|
// }
|
||||||
//end
|
// },
|
||||||
|
// error: function(xhr, status, error) {
|
||||||
|
// console.error('Error fetching data from API:', error);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
} catch (error) {
|
// $('#loader').hide();
|
||||||
console.error('Error parsing API response data:', error);
|
// }
|
||||||
}
|
|
||||||
} else if (response.code === 404 && response.dataStatus === false) {
|
|
||||||
console.error('no data found', response);
|
|
||||||
} else {
|
|
||||||
console.error('Something went wrong!');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
console.error('Error fetching data from API:', error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#loader').hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
function appendClients(data) {
|
function appendClients(data) {
|
||||||
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
||||||
@ -507,8 +550,9 @@
|
|||||||
// console.log(PolicyID)
|
// console.log(PolicyID)
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
var option = $('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.client_policy_id,
|
// value: item.client_policy_id,
|
||||||
// text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
// text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
||||||
|
value: item.id,
|
||||||
text: `${item.policy_type ?? ''} - ${item.policy_no ?? ''}`
|
text: `${item.policy_type ?? ''} - ${item.policy_no ?? ''}`
|
||||||
});
|
});
|
||||||
if (PolicyID == item.client_policy_id) {
|
if (PolicyID == item.client_policy_id) {
|
||||||
@ -522,6 +566,9 @@
|
|||||||
|
|
||||||
$('#clients').on('change', function() {
|
$('#clients').on('change', function() {
|
||||||
|
|
||||||
|
$('#branch_id').empty();
|
||||||
|
$('#branch_id').append($('<option>', { value: '0', text: 'Select'}));
|
||||||
|
|
||||||
$('#policies').empty();
|
$('#policies').empty();
|
||||||
$('#policies').append($('<option>', {
|
$('#policies').append($('<option>', {
|
||||||
value: '0',
|
value: '0',
|
||||||
@ -529,15 +576,16 @@
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
var selectedClient = $(this).val();
|
var selectedClient = $(this).val();
|
||||||
// console.log('selectedClient', selectedClient);
|
// alert(selectedClient);
|
||||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
// console.log(branch_list);
|
||||||
|
var filteredBranch = branch_list[selectedClient];
|
||||||
|
|
||||||
// Check if the selected option exists in apiData
|
if (filteredBranch) {
|
||||||
var foundPolicies = clientPolicies.find(function(item) {
|
console.log("Found Data for Client " + selectedClient, filteredBranch);
|
||||||
return item.id === selectedClient;
|
appendBranch(filteredBranch);
|
||||||
});
|
} else {
|
||||||
// console.log(foundPolicies.branchs);
|
console.warn("No data found for client ID: " + selectedClient);
|
||||||
appendBranch(foundPolicies.branchs);
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -545,26 +593,23 @@
|
|||||||
|
|
||||||
$('#branch_id').on('change', function() {
|
$('#branch_id').on('change', function() {
|
||||||
|
|
||||||
var selectedClient = $(this).val();
|
var selectedBranch = $(this).val();
|
||||||
|
var selectedClient = $('#clients').val();
|
||||||
|
var filteredPoliciesByClient = policy_list_by_client[selectedClient];
|
||||||
|
|
||||||
// console.log('selectedBranch', selectedClient);
|
var filteredPoliciesByBranch = filteredPoliciesByClient.filter(function(item) {
|
||||||
// console.log('clientPolicies', clientPoliciesWithBranch);
|
|
||||||
|
|
||||||
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
|
||||||
// console.log('item', item);
|
// console.log('item', item);
|
||||||
return item.branch_id === selectedClient;
|
return item.client_branch_id === selectedBranch;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("filteredPoliciesByClient => ",filteredPoliciesByClient);
|
||||||
|
console.log("filteredPoliciesByBranch => ",filteredPoliciesByBranch);
|
||||||
|
|
||||||
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
|
if (Array.isArray(filteredPoliciesByBranch) && filteredPoliciesByBranch.length === 0) {
|
||||||
|
appendPolicies(filteredPoliciesByBranch);
|
||||||
appendPolicies(foundPolicies);
|
|
||||||
toastr.warning('No policies found for the selected client branch.');
|
toastr.warning('No policies found for the selected client branch.');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
appendPolicies(filteredPoliciesByBranch);
|
||||||
// console.log('foundPolicies', foundPolicies);
|
|
||||||
appendPolicies(foundPolicies);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,33 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
.dataTables_length label {height: 21px !important;}
|
.dataTables_length label {height: 21px !important;}
|
||||||
|
|
||||||
|
.custom-dropdown-menu {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
background-color: #ffffff !important;
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
padding: 0.5rem 0;
|
||||||
|
min-width: 10rem;
|
||||||
|
z-index: 9999;
|
||||||
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-dropdown-menu .dropdown-item {
|
||||||
|
display: block !important;
|
||||||
|
width: 100% !important;
|
||||||
|
padding: 0.5rem 1rem !important;
|
||||||
|
color: #212529 !important;
|
||||||
|
text-decoration: none !important;
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-dropdown-menu .dropdown-item:hover {
|
||||||
|
background-color: #f8f9fa !important;
|
||||||
|
color: #16181b !important;
|
||||||
|
cursor: pointer !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- End ADD and EDIT Page HTML -->
|
<!-- End ADD and EDIT Page HTML -->
|
||||||
@ -16,13 +43,15 @@
|
|||||||
<th class="font-weight-medium">S.No.</th>
|
<th class="font-weight-medium">S.No.</th>
|
||||||
<th class="font-weight-medium">Category</th>
|
<th class="font-weight-medium">Category</th>
|
||||||
<th class="font-weight-medium">Question</th>
|
<th class="font-weight-medium">Question</th>
|
||||||
<th class="font-weight-medium">Answer</th>
|
<!-- <th class="font-weight-medium">Answer</th> -->
|
||||||
<th class="font-weight-medium">Status</th>
|
<th class="font-weight-medium">Status</th>
|
||||||
<th class="font-weight-medium">Action</th>
|
<th class="font-weight-medium">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php if(isset($faq_list)) { $slno = 1; ?>
|
<?php if(!empty($faq_list)) {
|
||||||
|
// <?php if(isset($faq_list)) {
|
||||||
|
$slno = 1; ?>
|
||||||
<?php foreach($faq_list as $index => $row) { ?>
|
<?php foreach($faq_list as $index => $row) { ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-center"><?= $slno++; ?></td>
|
<td class="text-center"><?= $slno++; ?></td>
|
||||||
@ -36,11 +65,11 @@
|
|||||||
? htmlspecialchars(substr($question, 0, 50)) . "..."
|
? htmlspecialchars(substr($question, 0, 50)) . "..."
|
||||||
: htmlspecialchars($question);
|
: htmlspecialchars($question);
|
||||||
?></td>
|
?></td>
|
||||||
<td><?php $answer = $row['answer'] ? $row['answer'] : 'N/A';
|
<!-- <td><?php $answer = $row['answer'] ? $row['answer'] : 'N/A';
|
||||||
echo (strlen($answer) > 50)
|
echo (strlen($answer) > 50)
|
||||||
? htmlspecialchars(substr($answer, 0, 50)) . "..."
|
? htmlspecialchars(substr($answer, 0, 50)) . "..."
|
||||||
: htmlspecialchars($answer);
|
: htmlspecialchars($answer);
|
||||||
?></td>
|
?></td> -->
|
||||||
<td>
|
<td>
|
||||||
<span class="<?php if($row['is_active'] == 1){ echo 'badge badge-primary'; }else{ echo 'badge badge-danger'; } ?>">
|
<span class="<?php if($row['is_active'] == 1){ echo 'badge badge-primary'; }else{ echo 'badge badge-danger'; } ?>">
|
||||||
<?php if($row['is_active'] == 1){ echo 'Active'; }else{ echo 'In-Active'; } ?>
|
<?php if($row['is_active'] == 1){ echo 'Active'; }else{ echo 'In-Active'; } ?>
|
||||||
@ -62,12 +91,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } } ?>
|
||||||
<?php } else { ?>
|
|
||||||
<!-- <tr>
|
|
||||||
<td colspan="6" class="text-center">No data available</td>
|
|
||||||
</tr> -->
|
|
||||||
<?php } ?>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
@ -353,4 +377,93 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
<script>
|
||||||
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
const table = document.getElementById("user-table");
|
||||||
|
|
||||||
|
// Create custom dropdown
|
||||||
|
function createCustomDropdown(row) {
|
||||||
|
// Get the original dropdown items
|
||||||
|
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||||
|
if (!originalDropdown) return null;
|
||||||
|
|
||||||
|
// Create new dropdown with proper background and spacing
|
||||||
|
const customDropdown = document.createElement('div');
|
||||||
|
customDropdown.className = 'custom-dropdown-menu';
|
||||||
|
|
||||||
|
// Copy inner content while maintaining icon alignment
|
||||||
|
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||||
|
|
||||||
|
return customDropdown;
|
||||||
|
}
|
||||||
|
|
||||||
|
let activeDropdown = null;
|
||||||
|
|
||||||
|
// Add click event listener to rows
|
||||||
|
table.querySelectorAll("tbody tr").forEach(row => {
|
||||||
|
const customDropdown = createCustomDropdown(row);
|
||||||
|
if (!customDropdown) return;
|
||||||
|
|
||||||
|
// Append the custom dropdown to the body
|
||||||
|
document.body.appendChild(customDropdown);
|
||||||
|
|
||||||
|
row.addEventListener("click", function(event) {
|
||||||
|
// Ignore clicks on the action column
|
||||||
|
if (event.target.closest('td:last-child')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide any active dropdown
|
||||||
|
if (activeDropdown) {
|
||||||
|
activeDropdown.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get click position
|
||||||
|
const rect = event.target.getBoundingClientRect();
|
||||||
|
|
||||||
|
// Position the dropdown with some offset
|
||||||
|
customDropdown.style.display = 'block';
|
||||||
|
customDropdown.style.position = 'fixed';
|
||||||
|
customDropdown.style.left = `${rect.left}px`;
|
||||||
|
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||||
|
|
||||||
|
// Set as active dropdown
|
||||||
|
activeDropdown = customDropdown;
|
||||||
|
|
||||||
|
event.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Preserve click handlers and add auto-close
|
||||||
|
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||||
|
item.addEventListener('click', function(e) {
|
||||||
|
const onclickAttr = this.getAttribute('onclick');
|
||||||
|
if (onclickAttr) {
|
||||||
|
eval(onclickAttr);
|
||||||
|
}
|
||||||
|
|
||||||
|
const href = this.getAttribute('href');
|
||||||
|
if (href && href !== '#') {
|
||||||
|
window.location.href = href;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the dropdown after handling the click
|
||||||
|
if (activeDropdown) {
|
||||||
|
activeDropdown.style.display = 'none';
|
||||||
|
activeDropdown = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Close dropdown when clicking outside
|
||||||
|
document.addEventListener("click", function() {
|
||||||
|
if (activeDropdown) {
|
||||||
|
activeDropdown.style.display = 'none';
|
||||||
|
activeDropdown = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,32 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
.dataTables_length label {height: 21px !important;}
|
.dataTables_length label {height: 21px !important;}
|
||||||
|
.custom-dropdown-menu {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
background-color: #ffffff !important;
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
padding: 0.5rem 0;
|
||||||
|
min-width: 10rem;
|
||||||
|
z-index: 9999;
|
||||||
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-dropdown-menu .dropdown-item {
|
||||||
|
display: block !important;
|
||||||
|
width: 100% !important;
|
||||||
|
padding: 0.5rem 1rem !important;
|
||||||
|
color: #212529 !important;
|
||||||
|
text-decoration: none !important;
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-dropdown-menu .dropdown-item:hover {
|
||||||
|
background-color: #f8f9fa !important;
|
||||||
|
color: #16181b !important;
|
||||||
|
cursor: pointer !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- End ADD and EDIT Page HTML -->
|
<!-- End ADD and EDIT Page HTML -->
|
||||||
@ -23,7 +49,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php if(isset($data['fe_list'])) { $slno = 1; ?>
|
<?php if(!empty($data['fe_list'])) { $slno = 1; ?>
|
||||||
<?php foreach($data['fe_list'] as $index => $row) { ?>
|
<?php foreach($data['fe_list'] as $index => $row) { ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-center"><?= $slno++; ?></td>
|
<td class="text-center"><?= $slno++; ?></td>
|
||||||
@ -51,12 +77,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } } ?>
|
||||||
<?php } else { ?>
|
|
||||||
<!-- <tr>
|
|
||||||
<td colspan="6" class="text-center">No data available</td>
|
|
||||||
</tr> -->
|
|
||||||
<?php } ?>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
@ -503,4 +524,93 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
<script>
|
||||||
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
const table = document.getElementById("user-table");
|
||||||
|
|
||||||
|
// Create custom dropdown
|
||||||
|
function createCustomDropdown(row) {
|
||||||
|
// Get the original dropdown items
|
||||||
|
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||||
|
if (!originalDropdown) return null;
|
||||||
|
|
||||||
|
// Create new dropdown with proper background and spacing
|
||||||
|
const customDropdown = document.createElement('div');
|
||||||
|
customDropdown.className = 'custom-dropdown-menu';
|
||||||
|
|
||||||
|
// Copy inner content while maintaining icon alignment
|
||||||
|
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||||
|
|
||||||
|
return customDropdown;
|
||||||
|
}
|
||||||
|
|
||||||
|
let activeDropdown = null;
|
||||||
|
|
||||||
|
// Add click event listener to rows
|
||||||
|
table.querySelectorAll("tbody tr").forEach(row => {
|
||||||
|
const customDropdown = createCustomDropdown(row);
|
||||||
|
if (!customDropdown) return;
|
||||||
|
|
||||||
|
// Append the custom dropdown to the body
|
||||||
|
document.body.appendChild(customDropdown);
|
||||||
|
|
||||||
|
row.addEventListener("click", function(event) {
|
||||||
|
// Ignore clicks on the action column
|
||||||
|
if (event.target.closest('td:last-child')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide any active dropdown
|
||||||
|
if (activeDropdown) {
|
||||||
|
activeDropdown.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get click position
|
||||||
|
const rect = event.target.getBoundingClientRect();
|
||||||
|
|
||||||
|
// Position the dropdown with some offset
|
||||||
|
customDropdown.style.display = 'block';
|
||||||
|
customDropdown.style.position = 'fixed';
|
||||||
|
customDropdown.style.left = `${rect.left}px`;
|
||||||
|
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||||
|
|
||||||
|
// Set as active dropdown
|
||||||
|
activeDropdown = customDropdown;
|
||||||
|
|
||||||
|
event.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Preserve click handlers and add auto-close
|
||||||
|
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||||
|
item.addEventListener('click', function(e) {
|
||||||
|
const onclickAttr = this.getAttribute('onclick');
|
||||||
|
if (onclickAttr) {
|
||||||
|
eval(onclickAttr);
|
||||||
|
}
|
||||||
|
|
||||||
|
const href = this.getAttribute('href');
|
||||||
|
if (href && href !== '#') {
|
||||||
|
window.location.href = href;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the dropdown after handling the click
|
||||||
|
if (activeDropdown) {
|
||||||
|
activeDropdown.style.display = 'none';
|
||||||
|
activeDropdown = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Close dropdown when clicking outside
|
||||||
|
document.addEventListener("click", function() {
|
||||||
|
if (activeDropdown) {
|
||||||
|
activeDropdown.style.display = 'none';
|
||||||
|
activeDropdown = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -813,6 +813,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function fetchTpaIdFromTpa(){
|
function fetchTpaIdFromTpa(){
|
||||||
|
let user_confirm = confirm('Are you sure you want to initiate the TPA fetch? This may take a while.');
|
||||||
|
if(!user_confirm)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
let event = $('#event_type').val();
|
let event = $('#event_type').val();
|
||||||
let client_id = $('#client').val();
|
let client_id = $('#client').val();
|
||||||
|
|||||||
@ -72,6 +72,11 @@
|
|||||||
margin-left: 30px;
|
margin-left: 30px;
|
||||||
width: 689px;
|
width: 689px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.other-speciial-condition{
|
||||||
|
margin-left: 150px;
|
||||||
|
width: 564px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div id="OtherPolicyTermsForm" style="display:none">
|
<div id="OtherPolicyTermsForm" style="display:none">
|
||||||
@ -109,9 +114,290 @@
|
|||||||
<div style="margin-top: 10px;margin-bottom:15px;" id="sum_insured_add_more"></div>
|
<div style="margin-top: 10px;margin-bottom:15px;" id="sum_insured_add_more"></div>
|
||||||
<div id="append_html_for_other_policy_terms"></div>
|
<div id="append_html_for_other_policy_terms"></div>
|
||||||
|
|
||||||
<hr>
|
<div id="familyFloaterDiv_others" class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label">Family Floater</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input class="form-check-input" type="radio" id="familyFloaterYes_others" name="family_floater" value="1">
|
||||||
|
<label class="form-check-label" for="familyFloaterYes_others" style="width: 52px !important">Yes</label>
|
||||||
|
|
||||||
|
<input class="form-check-input" type="radio" id="familyFloaterNo_others" name="family_floater" value="0">
|
||||||
|
<label class="form-check-label" for="familyFloaterNo_others">No</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <div id="familyFloaterDiv_others_two" class="row" style="margin-bottom: 10px;">
|
||||||
|
|
||||||
|
<div class="col" style="background-color:#F5FFFF;border-radius:10px;box-shadow:0px 2px 2px 0px #00000040;padding:20px;">
|
||||||
|
|
||||||
|
<div class="d-flex align-items-center policy-base-info">
|
||||||
|
<input type="checkbox" name="family_floaters[]" value="self" id="self_others" checked>
|
||||||
|
|
||||||
|
<span style="margin-right:150px;color:black;">Self:</span>
|
||||||
|
|
||||||
|
<div class="self-age">
|
||||||
|
<span style="margin-right:10px;color:black;">Min Age:</span>
|
||||||
|
<input class="underline-input min_age"
|
||||||
|
type="number"
|
||||||
|
name="self_min_age"
|
||||||
|
id="self_min_age_others"
|
||||||
|
value="<?= isset($self_min_age) && $self_min_age > 0 ? $self_min_age : '18'; ?>"
|
||||||
|
onchange="lowerIsEighteenOthers(this)">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="self-age">
|
||||||
|
<span style="margin-right:10px;color:black;">Max Age:</span>
|
||||||
|
<input class="underline-input max_age"
|
||||||
|
type="number"
|
||||||
|
name="self_max_age"
|
||||||
|
id="self_max_age_others"
|
||||||
|
value="<?= isset($self_max_age) ? $self_max_age : '60'; ?>"
|
||||||
|
onchange="lowerIsEighteenOthers(this)">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex align-items-center policy-base-info">
|
||||||
|
<input type="checkbox" name="family_floaters[]" value="spouse" id="spouse_others">
|
||||||
|
|
||||||
|
<span style="margin-right:125px;color:black;">Spouse:</span>
|
||||||
|
|
||||||
|
<div class="spouse-age">
|
||||||
|
<span style="margin-right:10px;color:black;">Min Age:</span>
|
||||||
|
<input class="underline-input min_age"
|
||||||
|
type="number"
|
||||||
|
name="spouse_min_age"
|
||||||
|
id="spouse_min_age_others"
|
||||||
|
value="<?= isset($spouse_min_age) ? $spouse_min_age : '18'; ?>"
|
||||||
|
onchange="lowerIsEighteenOthers(this)">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="spouse-age">
|
||||||
|
<span style="margin-right:10px;color:black;">Max Age:</span>
|
||||||
|
<input class="underline-input max_age"
|
||||||
|
type="number"
|
||||||
|
name="spouse_max_age"
|
||||||
|
id="spouse_max_age_others"
|
||||||
|
value="<?= isset($spouse_max_age) ? $spouse_max_age : '60'; ?>"
|
||||||
|
onchange="lowerIsEighteenOthers(this)">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex align-items-center policy-base-info">
|
||||||
|
<span style="color:black;" class="mr-2">Children:</span>
|
||||||
|
|
||||||
|
<select name="family_floaters[]" id="children_others" class="px-1" style="margin-right:60px;">
|
||||||
|
<option value="0">None</option>
|
||||||
|
<option value="1">1</option>
|
||||||
|
<option value="2">2</option>
|
||||||
|
<option value="3">3</option>
|
||||||
|
<option value="4">4</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<div class="child-age">
|
||||||
|
<span style="margin-right:10px;color:black;">Min Age:</span>
|
||||||
|
<input class="underline-input min_age"
|
||||||
|
type="number"
|
||||||
|
name="child_min_age"
|
||||||
|
id="child_min_age_others"
|
||||||
|
value="<?= isset($child_min_age) ? $child_min_age : '0'; ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="child-age">
|
||||||
|
<span style="margin-right:10px;color:black;">Max Age:</span>
|
||||||
|
<input class="underline-input max_age"
|
||||||
|
type="number"
|
||||||
|
name="child_max_age"
|
||||||
|
id="child_max_age_others"
|
||||||
|
value="<?= isset($child_max_age) ? $child_max_age : '25'; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex align-items-center policy-base-info flex-nowrap">
|
||||||
|
|
||||||
|
<span class="fw-bold text-dark mr-3"><b>Select Other Members:</b></span>
|
||||||
|
|
||||||
|
<select name="family_floaters[]" id="family_floaters_others" class="form-select mr-3 px-1">
|
||||||
|
<option value="0">None</option>
|
||||||
|
<option value="1P">Only one parent (Either Father / Mother)</option>
|
||||||
|
<option value="2P">Only two parents (Father+Mother)</option>
|
||||||
|
<option value="1PIL">Only one parent in law (Either MIL / FIL)</option>
|
||||||
|
<option value="2PIL">Only two parents in law (FIL + MIL)</option>
|
||||||
|
<option value="2EPORPIL">Parents or PIL (Any two of Father, Mother, MIL, FIL)</option>
|
||||||
|
<option value="EPORPIL">Either Parents or PIL (Parents or Parents In Law)</option>
|
||||||
|
<option value="4EPORPIL">Parents + PIL (Father + Mother + MIL + FIL)</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<span class="text-dark mr-2">Elders Count:</span>
|
||||||
|
<input class="underline-input"
|
||||||
|
type="number"
|
||||||
|
name="elder_member_count"
|
||||||
|
id="member_count_others"
|
||||||
|
readonly>
|
||||||
|
|
||||||
|
<span class="text-dark mr-2">Min Age:</span>
|
||||||
|
<input class="underline-input"
|
||||||
|
type="number"
|
||||||
|
name="other_member_min_age"
|
||||||
|
id="other_member_min_age_others"
|
||||||
|
value="<?= isset($other_member_min_age) ? $other_member_min_age : '18'; ?>">
|
||||||
|
|
||||||
|
<span class="text-dark mr-2">Max Age:</span>
|
||||||
|
<input class="underline-input"
|
||||||
|
type="number"
|
||||||
|
name="other_member_max_age"
|
||||||
|
id="other_member_max_age_others"
|
||||||
|
value="<?= isset($other_member_max_age) ? $other_member_max_age : '60'; ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div id="familyFloaterDiv_others_two" class="row mb-3">
|
||||||
|
<div class="col" style="background-color:#F5FFFF;border-radius:10px;box-shadow:0px 2px 2px 0px #00000040;padding:20px;">
|
||||||
|
|
||||||
|
<!-- SELF -->
|
||||||
|
<div class="row align-items-center mb-2">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="checkbox" name="family_floaters[]" value="self" id="self_others" checked>
|
||||||
|
<span class="text-dark ms-2">Self</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3 d-flex align-items-center">
|
||||||
|
<span class="me-2 text-dark">Min Age</span>
|
||||||
|
<input class="underline-input min_age w-50"
|
||||||
|
type="number"
|
||||||
|
name="self_min_age"
|
||||||
|
id="self_min_age_others"
|
||||||
|
value="<?= isset($self_min_age) && $self_min_age > 0 ? $self_min_age : '18'; ?>"
|
||||||
|
onchange="lowerIsEighteenOthers(this)">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3 d-flex align-items-center">
|
||||||
|
<span class="me-2 text-dark">Max Age</span>
|
||||||
|
<input class="underline-input max_age w-50"
|
||||||
|
type="number"
|
||||||
|
name="self_max_age"
|
||||||
|
id="self_max_age_others"
|
||||||
|
value="<?= isset($self_max_age) ? $self_max_age : '60'; ?>"
|
||||||
|
onchange="lowerIsEighteenOthers(this)">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- SPOUSE -->
|
||||||
|
<div class="row align-items-center mb-2">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="checkbox" name="family_floaters[]" value="spouse" id="spouse_others">
|
||||||
|
<span class="text-dark ms-2">Spouse</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3 d-flex align-items-center">
|
||||||
|
<span class="me-2 text-dark">Min Age</span>
|
||||||
|
<input class="underline-input min_age w-50"
|
||||||
|
type="number"
|
||||||
|
name="spouse_min_age"
|
||||||
|
id="spouse_min_age_others"
|
||||||
|
value="<?= isset($spouse_min_age) ? $spouse_min_age : '18'; ?>"
|
||||||
|
onchange="lowerIsEighteenOthers(this)">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3 d-flex align-items-center">
|
||||||
|
<span class="me-2 text-dark">Max Age</span>
|
||||||
|
<input class="underline-input max_age w-50"
|
||||||
|
type="number"
|
||||||
|
name="spouse_max_age"
|
||||||
|
id="spouse_max_age_others"
|
||||||
|
value="<?= isset($spouse_max_age) ? $spouse_max_age : '60'; ?>"
|
||||||
|
onchange="lowerIsEighteenOthers(this)">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- CHILDREN -->
|
||||||
|
<div class="row align-items-center mb-2">
|
||||||
|
<div class="col-md-2 text-dark">Children</div>
|
||||||
|
|
||||||
|
<div class="col-md-4">
|
||||||
|
<select name="family_floaters[]" id="children_others" class="form-select form-control">
|
||||||
|
<option value="0">None</option>
|
||||||
|
<option value="1">1</option>
|
||||||
|
<option value="2">2</option>
|
||||||
|
<option value="3">3</option>
|
||||||
|
<option value="4">4</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3 d-flex align-items-center">
|
||||||
|
<span class="me-2 text-dark">Min Age</span>
|
||||||
|
<input class="underline-input min_age w-50"
|
||||||
|
type="number"
|
||||||
|
name="child_min_age"
|
||||||
|
id="child_min_age_others"
|
||||||
|
value="<?= isset($child_min_age) ? $child_min_age : '0'; ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3 d-flex align-items-center">
|
||||||
|
<span class="me-2 text-dark">Max Age</span>
|
||||||
|
<input class="underline-input max_age w-50"
|
||||||
|
type="number"
|
||||||
|
name="child_max_age"
|
||||||
|
id="child_max_age_others"
|
||||||
|
value="<?= isset($child_max_age) ? $child_max_age : '25'; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- OTHER MEMBERS -->
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-md-2 fw-bold text-dark">
|
||||||
|
Other Members
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4">
|
||||||
|
<select name="family_floaters[]" id="family_floaters_others" class="form-select form-control">
|
||||||
|
<option value="0">None</option>
|
||||||
|
<option value="1P">Only one parent (Either Father / Mother)</option>
|
||||||
|
<option value="2P">Only two parents (Father+Mother)</option>
|
||||||
|
<option value="1PIL">Only one parent in law (Either MIL / FIL)</option>
|
||||||
|
<option value="2PIL">Only two parents in law (FIL + MIL)</option>
|
||||||
|
<option value="2EPORPIL">Parents or PIL (Any two of Father, Mother, MIL, FIL)</option>
|
||||||
|
<option value="EPORPIL">Either Parents or PIL (Parents or Parents In Law)</option>
|
||||||
|
<option value="4EPORPIL">Parents + PIL (Father + Mother + MIL + FIL)</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-2">
|
||||||
|
<input class="underline-input w-100"
|
||||||
|
type="number"
|
||||||
|
name="elder_member_count"
|
||||||
|
id="member_count_others"
|
||||||
|
readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-2">
|
||||||
|
<input class="underline-input w-100"
|
||||||
|
type="number"
|
||||||
|
name="other_member_min_age"
|
||||||
|
id="other_member_min_age_others"
|
||||||
|
value="<?= isset($other_member_min_age) ? $other_member_min_age : '18'; ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-2">
|
||||||
|
<input class="underline-input w-100"
|
||||||
|
type="number"
|
||||||
|
name="other_member_max_age"
|
||||||
|
id="other_member_max_age_others"
|
||||||
|
value="<?= isset($other_member_max_age) ? $other_member_max_age : '60'; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="other_special_condition" style="margin-top: 10px;">
|
||||||
|
|
||||||
<div class="other_special_condition">
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
@ -126,7 +412,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$("#otherPolicyTerms").submit(function(event) {
|
$("#otherPolicyTerms").submit(function(event) {
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@ -164,8 +449,7 @@
|
|||||||
formObject[baseKey].push(value.replace(/,/g, ''));
|
formObject[baseKey].push(value.replace(/,/g, ''));
|
||||||
} else if (key == 'sum_insureds') {
|
} else if (key == 'sum_insureds') {
|
||||||
formObject['sum_insured'] = value.replace(/,/g, '');
|
formObject['sum_insured'] = value.replace(/,/g, '');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
formObject[key] = value;
|
formObject[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -215,7 +499,10 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
window.scrollTo({
|
||||||
|
top: 0,
|
||||||
|
behavior: 'smooth'
|
||||||
|
});
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
@ -286,14 +573,14 @@
|
|||||||
other_auto_save_enable = true;
|
other_auto_save_enable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
|
|
||||||
//special conditions fields
|
//special conditions fields
|
||||||
let otherTermsJsonObjectSpecialCondition = JSON.parse(res.data);
|
let otherTermsJsonObjectSpecialCondition = JSON.parse(res.data);
|
||||||
Object.keys(otherTermsJsonObjectSpecialCondition).forEach(function(key) {
|
Object.keys(otherTermsJsonObjectSpecialCondition).forEach(function(key) {
|
||||||
if (key.includes("special_condition_label") || key.includes(
|
|
||||||
"special_condition_input")) {
|
if (key.includes("special_condition_label") || key.includes("special_condition_input")) {
|
||||||
|
|
||||||
if (key.includes("special_condition_label")) {
|
if (key.includes("special_condition_label")) {
|
||||||
|
|
||||||
for (let index = 0; index <
|
for (let index = 0; index <
|
||||||
@ -301,6 +588,7 @@
|
|||||||
specialConditionForOthers();
|
specialConditionForOthers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let elements = document.getElementsByName(`${key}[]`);
|
let elements = document.getElementsByName(`${key}[]`);
|
||||||
|
|
||||||
if (elements) {
|
if (elements) {
|
||||||
@ -319,10 +607,9 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!key.startsWith("special_condition") && !key.startsWith('multiple_sum_insured') && !key.startsWith("sum_insured") && !key.startsWith("enrollment_display_key") ) {
|
if (policy_type_id != 72 && !key.startsWith("special_condition") && !key.startsWith('multiple_sum_insured') && !key.startsWith("sum_insured") && !key.startsWith("enrollment_display_key")) {
|
||||||
|
|
||||||
termsHTML = `
|
termsHTML = `
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
@ -359,7 +646,6 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//normal terms fields
|
//normal terms fields
|
||||||
let jsonObject = JSON.parse(res.data);
|
let jsonObject = JSON.parse(res.data);
|
||||||
Object.keys(jsonObject).forEach(function(key) {
|
Object.keys(jsonObject).forEach(function(key) {
|
||||||
@ -400,17 +686,134 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(policy_type_id == 72){
|
||||||
|
|
||||||
|
if(key == "family_floater"){
|
||||||
|
if(jsonObject[key] == 1){
|
||||||
|
$('#familyFloaterYes_others').prop('checked', true);
|
||||||
|
} else {
|
||||||
|
$('#familyFloaterNo_others').prop('checked', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key.includes("family_floaters")) {
|
||||||
|
|
||||||
|
let checkboxes = document.querySelectorAll(`input[name="${key}[]"]`);
|
||||||
|
if (jsonObject[key]) {
|
||||||
|
|
||||||
|
console.log(jsonObject[key]);
|
||||||
|
if (jsonObject[key].childrens) {
|
||||||
|
$('#children_others').val(jsonObject[key].childrens);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonObject[key].self == 0) {
|
||||||
|
$('#self_others').prop('checked', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonObject[key].spouse == 0) {
|
||||||
|
$('#spouse_others').prop('checked', false);
|
||||||
|
} else {
|
||||||
|
$('#spouse_others').prop('checked', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (jsonObject[key]['either-parents-pil'] == 1) {
|
||||||
|
$('#family_floaters_others').val('EPORPIL');
|
||||||
|
} else if (jsonObject[key].parents == 1 && jsonObject[key][
|
||||||
|
'parents-in-law'
|
||||||
|
] == 1) {
|
||||||
|
$('#family_floaters_others').val('2EPORPIL');
|
||||||
|
} else if (jsonObject[key].parents == 2 && jsonObject[key][
|
||||||
|
'parents-in-law'
|
||||||
|
] == 2) {
|
||||||
|
$('#family_floaters_others').val('4EPORPIL');
|
||||||
|
} else if (jsonObject[key].parents == 1) {
|
||||||
|
$('#family_floaters_others').val('1P');
|
||||||
|
} else if (jsonObject[key].parents == 2) {
|
||||||
|
$('#family_floaters_others').val('2P');
|
||||||
|
} else if (jsonObject[key]['parents-in-law'] == 1) {
|
||||||
|
$('#family_floaters_others').val('1PIL');
|
||||||
|
} else if (jsonObject[key]['parents-in-law'] == 2) {
|
||||||
|
$('#family_floaters_others').val('2PIL');
|
||||||
|
} else if (jsonObject[key]['either-parents-pil'] == 2) {
|
||||||
|
$('#family_floaters_others').val('2EPORPIL');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key.includes("age_ratio")) {
|
||||||
|
|
||||||
|
$('#self_min_age_others').val(jsonObject[key].self.min);
|
||||||
|
$('#self_max_age_others').val(jsonObject[key].self.max);
|
||||||
|
|
||||||
|
$('#spouse_min_age_others').val(jsonObject[key].spouse.min);
|
||||||
|
$('#spouse_max_age_others').val(jsonObject[key].spouse.max);
|
||||||
|
|
||||||
|
$('#child_min_age_others').val(jsonObject[key].child.min);
|
||||||
|
$('#child_max_age_others').val(jsonObject[key].child.max);
|
||||||
|
|
||||||
|
$('#other_member_min_age_others').val(jsonObject[key].elders.min);
|
||||||
|
$('#other_member_max_age_others').val(jsonObject[key].elders.max);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
appendPolicyTermsHTML(policy_type_id);
|
appendPolicyTermsHTML(policy_type_id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#sum_insured_others').trigger('keyup');
|
$('#sum_insured_others').trigger('keyup');
|
||||||
$(".multiple_sum_insured").trigger("keyup");
|
$(".multiple_sum_insured").trigger("keyup");
|
||||||
|
|
||||||
|
if(policy_type_id == 72) {
|
||||||
|
|
||||||
|
if ($('#self_others').prop('checked')) {
|
||||||
|
$('.self-age').css('display', '');
|
||||||
|
} else {
|
||||||
|
$('.self-age').css('display', 'none');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($('#spouse_others').prop('checked')) {
|
||||||
|
$('.spouse-age').css('display', '');
|
||||||
|
} else {
|
||||||
|
$('.spouse-age').css('display', 'none');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($('#children_others').val() != 0) {
|
||||||
|
$('.child-age').css('display', '');
|
||||||
|
} else {
|
||||||
|
$('.child-age').css('display', 'none');
|
||||||
|
}
|
||||||
|
|
||||||
|
var family_floaters = $('#family_floaters_others').val();
|
||||||
|
console.log("family_floaters_others", family_floaters);
|
||||||
|
|
||||||
|
if (family_floaters != 0) {
|
||||||
|
$('.other-member-age').css('display', '');
|
||||||
|
} else {
|
||||||
|
$('.other-member-age').css('display', 'none');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (family_floaters == '1P') {
|
||||||
|
$('#member_count_others').val(1);
|
||||||
|
} else if (family_floaters == '2P') {
|
||||||
|
$('#member_count_others').val(2);
|
||||||
|
} else if (family_floaters == '1PIL') {
|
||||||
|
$('#member_count_others').val(1);
|
||||||
|
} else if (family_floaters == '2PIL') {
|
||||||
|
$('#member_count_others').val(2);
|
||||||
|
} else if (family_floaters == '2EPORPIL') {
|
||||||
|
$('#member_count_others').val(2);
|
||||||
|
} else if (family_floaters == 'EPORPIL') {
|
||||||
|
$('#member_count_others').val(2);
|
||||||
|
} else if (family_floaters == '4EPORPIL') {
|
||||||
|
$('#member_count_others').val(4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
@ -424,17 +827,19 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(policy_type_id > 7) {
|
if (policy_type_id > 7 && policy_type_id != 72) {
|
||||||
|
|
||||||
$("#sumInsuredDiv").empty();
|
$("#sumInsuredDiv").empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
if(policy_type_id != 72){
|
||||||
|
$("#familyFloaterDiv_others").empty();
|
||||||
|
$("#familyFloaterDiv_others_two").empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
document.getElementById('otherButtonSpecialCondition').addEventListener('click', function(event) {
|
document.getElementById('otherButtonSpecialCondition').addEventListener('click', function(event) {
|
||||||
|
|
||||||
console.log('specialConditionForOthers callback clicked')
|
console.log('specialConditionForOthers callback clicked')
|
||||||
@ -461,7 +866,7 @@
|
|||||||
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
|
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input type="text" name="special_condition_input[]" id="special_condition_input[]" class="form-control s special_condition_input[]">
|
<input type="text" name="special_condition_input[]" id="special_condition_input[]" class="form-control other-speciial-condition special_condition_input[]">
|
||||||
</div>`;
|
</div>`;
|
||||||
console.log($(this));
|
console.log($(this));
|
||||||
$('.other_special_condition').each(function() {
|
$('.other_special_condition').each(function() {
|
||||||
@ -822,8 +1227,7 @@
|
|||||||
formObject[baseKey].push(value.replace(/,/g, ''));
|
formObject[baseKey].push(value.replace(/,/g, ''));
|
||||||
} else if (key == 'sum_insureds') {
|
} else if (key == 'sum_insureds') {
|
||||||
formObject['sum_insured'] = value.replace(/,/g, '');
|
formObject['sum_insured'] = value.replace(/,/g, '');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
formObject[key] = value;
|
formObject[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -890,7 +1294,10 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
observer.observe(form, { childList: true, subtree: true });
|
observer.observe(form, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
|
||||||
// Bind for existing fields (only if enabled)
|
// Bind for existing fields (only if enabled)
|
||||||
if (other_auto_save_enable) {
|
if (other_auto_save_enable) {
|
||||||
@ -904,4 +1311,86 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#self_others').change(function() {
|
||||||
|
if ($(this).prop('checked')) {
|
||||||
|
$('.self-age').css('display', '');
|
||||||
|
} else {
|
||||||
|
$('.self-age').css('display', 'none');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#spouse_others').change(function() {
|
||||||
|
console.log('spouse changed')
|
||||||
|
if ($(this).prop('checked')) {
|
||||||
|
$('.spouse-age').css('display', '');
|
||||||
|
if ($('#spouse_min_age_others').val() < 17 || $('#spouse_min_age_others').val() == '') {
|
||||||
|
$('#spouse_min_age_others').val(18);
|
||||||
|
}
|
||||||
|
if ($('#spouse_max_age_others').val() < 17 || $('#spouse_max_age_others').val() == '') {
|
||||||
|
$('#spouse_max_age_others').val(60);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('.spouse-age').css('display', 'none');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#children_others').change(function() {
|
||||||
|
if ($(this).val() != 0) {
|
||||||
|
$('.child-age').css('display', '');
|
||||||
|
|
||||||
|
if ($('#child_min_age_others').val() < 0 || $('#child_min_age_others').val() == '') {
|
||||||
|
$('#child_min_age_others').val(0);
|
||||||
|
}
|
||||||
|
if ($('#child_max_age_others').val() < 24 || $('#child_max_age_others').val() == '') {
|
||||||
|
$('#child_max_age_others').val(25);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('.child-age').css('display', 'none');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#family_floaters_others').change(function() {
|
||||||
|
|
||||||
|
checkAdditionPremiumJSON()
|
||||||
|
|
||||||
|
var family_floaters = $(this).val();
|
||||||
|
if ($('#family_floaters').val() != 0) {
|
||||||
|
$('.other-member-age').css('display', '');
|
||||||
|
if ($('#other_member_min_age_others').val() < 17 || $('#other_member_min_age_others').val() == '') {
|
||||||
|
$('#other_member_min_age_others').val(18);
|
||||||
|
}
|
||||||
|
if ($('#other_member_max_age_others').val() < 79 || $('#other_member_max_age_others').val() == '') {
|
||||||
|
$('#other_member_max_age_others').val(60);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('.other-member-age').css('display', 'none');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (family_floaters == '1P') {
|
||||||
|
$('#member_count_others').val(1);
|
||||||
|
} else if (family_floaters == '2P') {
|
||||||
|
$('#member_count_others').val(2);
|
||||||
|
} else if (family_floaters == '1PIL') {
|
||||||
|
$('#member_count_others').val(1);
|
||||||
|
} else if (family_floaters == '2PIL') {
|
||||||
|
$('#member_count_others').val(2);
|
||||||
|
} else if (family_floaters == '2EPORPIL') {
|
||||||
|
$('#member_count_others').val(2);
|
||||||
|
} else if (family_floaters == 'EPORPIL') {
|
||||||
|
$('#member_count_others').val(2);
|
||||||
|
} else if (family_floaters == '4EPORPIL') {
|
||||||
|
$('#member_count_others').val(4);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function lowerIsEighteenOthers(params) {
|
||||||
|
var value = $(params).val();
|
||||||
|
|
||||||
|
if (value < 18) {
|
||||||
|
$(params).val(18);
|
||||||
|
} else if (value > 99) {
|
||||||
|
$(params).val(99);
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -3522,7 +3522,7 @@ function hideShowPolicyPremium(policy_type_string, unique_id = null)
|
|||||||
individual = $('#individual_' + unique_id);
|
individual = $('#individual_' + unique_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (policy_type_string == 'GMC') {
|
if (policy_type_string == 'GMC' || policy_type_string == 'OPD') {
|
||||||
premium_type.show();
|
premium_type.show();
|
||||||
individual.prop('checked', true)
|
individual.prop('checked', true)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -447,7 +447,7 @@
|
|||||||
<td>Co-Share %</td>
|
<td>Co-Share %</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="table_tr_36">
|
<tr id="table_tr_36">
|
||||||
<td>Non Commissional <br> Premium Amount</td>
|
<td>Non-Commissionable<br> Premium Amount</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="table_tr_4">
|
<tr id="table_tr_4">
|
||||||
<td>Base Premium</td>
|
<td>Base Premium</td>
|
||||||
@ -1580,6 +1580,16 @@
|
|||||||
let terrisom_premium = ($('#bro_payable_by').val() == 1) ? tep : cotep;
|
let terrisom_premium = ($('#bro_payable_by').val() == 1) ? tep : cotep;
|
||||||
let tpTotal = base_premium + third_part_premium + terrisom_premium;
|
let tpTotal = base_premium + third_part_premium + terrisom_premium;
|
||||||
|
|
||||||
|
if($('#bro_payable_by').val() == 2){
|
||||||
|
|
||||||
|
if($('#co_share_type_' + input).val() == 1){
|
||||||
|
base_premium = bp;
|
||||||
|
third_part_premium = tp;
|
||||||
|
terrisom_premium = tep;
|
||||||
|
tpTotal = base_premium + third_part_premium + terrisom_premium;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Co-premium defaults
|
// Co-premium defaults
|
||||||
if ($('#cop_yes').val() == 0) {
|
if ($('#cop_yes').val() == 0) {
|
||||||
if (!rawVal('co_premium')) $('#co_premium_' + input).val(bp);
|
if (!rawVal('co_premium')) $('#co_premium_' + input).val(bp);
|
||||||
|
|||||||
@ -790,7 +790,7 @@
|
|||||||
</div> -->
|
</div> -->
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-3">
|
||||||
<label class="switch" style="position: relative;top: 30px;left: 4px;">
|
<label class="switch" style="position: relative;top: 30px;left: 4px;">
|
||||||
<input id="cop_yes" type="checkbox" name="co_share">
|
<input id="cop_yes" type="checkbox" name="co_share">
|
||||||
<span class="slider round" style="height: 27px;"></span>
|
<span class="slider round" style="height: 27px;"></span>
|
||||||
@ -800,13 +800,22 @@
|
|||||||
style="position: relative;top: 31px;left: 17px;">CoP Yes</label>
|
style="position: relative;top: 31px;left: 17px;">CoP Yes</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4 payby d-none">
|
<!-- <div class="form-group col-md-4 payby d-none">
|
||||||
<label class="switch" style="position: relative;top: 30px;left: 4px;">
|
<label class="switch" style="position: relative;top: 30px;left: 4px;">
|
||||||
<input id="bro_payable_by" type="checkbox" name="bro_payable_by" checked>
|
<input id="bro_payable_by" type="checkbox" name="bro_payable_by" checked>
|
||||||
<span class="slider round" style="height: 27px;"></span>
|
<span class="slider round" style="height: 27px;"></span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label for="inception_type" style="position: relative;top: 31px;left: 17px;">Remuneration Pay By Leader</label>
|
<label for="inception_type" style="position: relative;top: 31px;left: 17px;">Remuneration Pay By Leader</label>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div class="form-group col-md-3 payby d-none">
|
||||||
|
<label for="remuneration_pay_by" class="mb-1">Remuneration Pay By</label>
|
||||||
|
<select id="bro_payable_by"name="bro_payable_by"class="form-control">
|
||||||
|
<option value="1">Pay By Leader</option>
|
||||||
|
<option value="0">Pay By Co-Insurers</option>
|
||||||
|
<option value="2">Pay By MIX</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -912,6 +921,20 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="POS">POS</label>
|
||||||
|
<select class="form-control" id="pos_id" name="pos_id">
|
||||||
|
<option value="">Select POS</option>
|
||||||
|
<?php if (isset($pos_data)) { ?>
|
||||||
|
<?php foreach ($pos_data as $value) { ?>
|
||||||
|
<option value="<?= $value['id'];?>">
|
||||||
|
<?= $value['name']." - ". $value['pos_code'];?>
|
||||||
|
</option>
|
||||||
|
<?php } ?>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -977,7 +1000,7 @@
|
|||||||
<td>Co-Share %</td>
|
<td>Co-Share %</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="table_tr_36">
|
<tr id="table_tr_36">
|
||||||
<td>Non Commissional <br> Premium Amount</td>
|
<td>Non-Commissionable <br> Premium Amount</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="table_tr_4">
|
<tr id="table_tr_4">
|
||||||
<td>Base Premium</td>
|
<td>Base Premium</td>
|
||||||
@ -1594,6 +1617,7 @@
|
|||||||
$('#owner').select2();
|
$('#owner').select2();
|
||||||
$('#owner_branch').select2();
|
$('#owner_branch').select2();
|
||||||
$('#vehicle_no').select2();
|
$('#vehicle_no').select2();
|
||||||
|
$('#pos_id').select2();
|
||||||
var today = new Date();
|
var today = new Date();
|
||||||
|
|
||||||
var dob = flatpickr("#dob", {
|
var dob = flatpickr("#dob", {
|
||||||
@ -1671,7 +1695,7 @@
|
|||||||
|
|
||||||
$('#table_tr_34').show();
|
$('#table_tr_34').show();
|
||||||
$('#table_tr_37').show();
|
$('#table_tr_37').show();
|
||||||
$("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
// $("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
@ -1680,7 +1704,7 @@
|
|||||||
|
|
||||||
$('#table_tr_34').hide();
|
$('#table_tr_34').hide();
|
||||||
$('#table_tr_37').hide();
|
$('#table_tr_37').hide();
|
||||||
$("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
// $("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2010,7 +2034,7 @@
|
|||||||
|
|
||||||
$('#table_tr_34').hide();
|
$('#table_tr_34').hide();
|
||||||
$('#table_tr_37').hide();
|
$('#table_tr_37').hide();
|
||||||
$("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
// $("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
@ -2018,7 +2042,7 @@
|
|||||||
|
|
||||||
$('#table_tr_34').show();
|
$('#table_tr_34').show();
|
||||||
$('#table_tr_37').show();
|
$('#table_tr_37').show();
|
||||||
$("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
// $("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(value == 8){
|
if(value == 8){
|
||||||
@ -2049,6 +2073,8 @@
|
|||||||
let val = $(this).val();
|
let val = $(this).val();
|
||||||
let uniqueid = $(this).data('id');
|
let uniqueid = $(this).data('id');
|
||||||
let insurer = $('#follow_insurer_id_'+uniqueid).val()
|
let insurer = $('#follow_insurer_id_'+uniqueid).val()
|
||||||
|
let policy_type_id = $('#policy_type_id').val();
|
||||||
|
let client_type = $('#client_type').val();
|
||||||
|
|
||||||
var client_id = $('#client_id').val()
|
var client_id = $('#client_id').val()
|
||||||
var insurer_id = $('#follow_insurer_id_'+uniqueid).find('option:selected').attr('data-id');
|
var insurer_id = $('#follow_insurer_id_'+uniqueid).find('option:selected').attr('data-id');
|
||||||
@ -2099,6 +2125,27 @@
|
|||||||
$('[id^="cd_current_balance_"]').show();
|
$('[id^="cd_current_balance_"]').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(policy_type_id > 7 || client_type == 1){
|
||||||
|
$('[name="cd_ac_no_for_child[]"]').removeAttr('onchange');
|
||||||
|
$('#cd_ac_no_' + uniqueid).attr('onchange', 'addCDAccountNumber(this); restrictCDACNO(this);');
|
||||||
|
|
||||||
|
if ($(this).is(':checked')) {
|
||||||
|
|
||||||
|
$('[name="cd_ac_no_for_child[]"]').each(function () {
|
||||||
|
$(this).prop('required', false).parsley().reset();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#cd_ac_no_' + uniqueid).prop('required', true).parsley().reset();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$('[name="cd_ac_no_for_child[]"]').each(function () {
|
||||||
|
$(this).prop('required', false).parsley().reset();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('change', 'select[name="relationship[]"]', function() {
|
$(document).on('change', 'select[name="relationship[]"]', function() {
|
||||||
@ -2141,6 +2188,7 @@
|
|||||||
|
|
||||||
$(document).on('change', '[name="follow_insurer_id[]"]', function() {
|
$(document).on('change', '[name="follow_insurer_id[]"]', function() {
|
||||||
|
|
||||||
|
let currentSelect = $(this);
|
||||||
let insurer = $(this).val();
|
let insurer = $(this).val();
|
||||||
let unique_id = $(this).data('count');
|
let unique_id = $(this).data('count');
|
||||||
let client_id = $('#client_id').val();
|
let client_id = $('#client_id').val();
|
||||||
@ -2156,6 +2204,22 @@
|
|||||||
if (!policy_type_id || !client_id) {
|
if (!policy_type_id || !client_id) {
|
||||||
$(this).val('').select2();
|
$(this).val('').select2();
|
||||||
toastr.warning(!policy_type_id ? 'Please select the Policy Type' : 'Please select the Client', 'WARNING');
|
toastr.warning(!policy_type_id ? 'Please select the Policy Type' : 'Please select the Client', 'WARNING');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let isDuplicate = false;
|
||||||
|
|
||||||
|
$('[name="follow_insurer_id[]"]').not(currentSelect).each(function () {
|
||||||
|
if ($(this).val() === insurer) {
|
||||||
|
isDuplicate = true;
|
||||||
|
return false; // break loop
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isDuplicate) {
|
||||||
|
$(this).val('').select2();
|
||||||
|
toastr.warning('Do not select the same insurer and branch again');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -2352,8 +2416,7 @@
|
|||||||
$('#serviced_by').val(res.data.serviced_by ?? '').change();
|
$('#serviced_by').val(res.data.serviced_by ?? '').change();
|
||||||
$('#base_cd_amount').val(res.data.base_cd_amount);
|
$('#base_cd_amount').val(res.data.base_cd_amount);
|
||||||
$('#issuer_branch').val(res.data.issuer_branch);
|
$('#issuer_branch').val(res.data.issuer_branch);
|
||||||
console.log('res.data.base_cd_amount', res.data.base_cd_amount);
|
$('#pos_id').val(res.data.pos_id ?? '').change();
|
||||||
console.log('res.data.issuer_branch', res.data.issuer_branch);
|
|
||||||
|
|
||||||
|
|
||||||
// Additional form handling logic
|
// Additional form handling logic
|
||||||
@ -2417,11 +2480,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle brokerage pay by
|
// Handle brokerage pay by
|
||||||
if (res.data.bro_payable_by == 1) {
|
// if (res.data.bro_payable_by == 1) {
|
||||||
$('#bro_payable_by').prop('checked', true);
|
// $('#bro_payable_by').prop('checked', true);
|
||||||
} else {
|
// } else {
|
||||||
$('#bro_payable_by').prop('checked', false);
|
// $('#bro_payable_by').prop('checked', false);
|
||||||
}
|
// }
|
||||||
|
$('#bro_payable_by').val(res.data.bro_payable_by);
|
||||||
|
|
||||||
// Policy transaction status handling
|
// Policy transaction status handling
|
||||||
if (res.data.status == "completed") {
|
if (res.data.status == "completed") {
|
||||||
@ -2457,7 +2521,7 @@
|
|||||||
$('#client_branch_id').prop('required', false);
|
$('#client_branch_id').prop('required', false);
|
||||||
$('#table_tr_34').hide();
|
$('#table_tr_34').hide();
|
||||||
$('#table_tr_37').hide();
|
$('#table_tr_37').hide();
|
||||||
$("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
// $("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$('#policyholdernamediv').hide();
|
$('#policyholdernamediv').hide();
|
||||||
@ -2465,7 +2529,7 @@
|
|||||||
$('#client_branch_id').prop('required', true);
|
$('#client_branch_id').prop('required', true);
|
||||||
$('#table_tr_34').show();
|
$('#table_tr_34').show();
|
||||||
$('#table_tr_37').show();
|
$('#table_tr_37').show();
|
||||||
$("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
// $("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
||||||
}
|
}
|
||||||
|
|
||||||
//Vehicle File Upload Tab Hide And show
|
//Vehicle File Upload Tab Hide And show
|
||||||
@ -2711,7 +2775,8 @@
|
|||||||
let terrisom_premium = cotep;
|
let terrisom_premium = cotep;
|
||||||
|
|
||||||
let tpTotal = cop + cotp + cotep;
|
let tpTotal = cop + cotp + cotep;
|
||||||
if($('#bro_payable_by').is(':checked')){
|
// if($('#bro_payable_by').is(':checked')){
|
||||||
|
if($('#bro_payable_by').val() == 1){
|
||||||
|
|
||||||
tpTotal = bp + tp + tep;
|
tpTotal = bp + tp + tep;
|
||||||
|
|
||||||
@ -2719,6 +2784,19 @@
|
|||||||
third_part_premium = tp;
|
third_part_premium = tp;
|
||||||
terrisom_premium = tep;
|
terrisom_premium = tep;
|
||||||
|
|
||||||
|
}else if($('#bro_payable_by').val() == 2){
|
||||||
|
|
||||||
|
console.log("$('#bro_payable_by').val()", $('#bro_payable_by').val());
|
||||||
|
console.log("$('#co_share_type_' + input).is(':checked')", $('co_share_type_' + input).is(':checked'))
|
||||||
|
|
||||||
|
if($('#co_share_type_' + input).is(':checked')){
|
||||||
|
|
||||||
|
tpTotal = bp + tp + tep;
|
||||||
|
|
||||||
|
base_premium = bp;
|
||||||
|
third_part_premium = tp;
|
||||||
|
terrisom_premium = tep;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$('#cop_yes').is(':checked')) {
|
if (!$('#cop_yes').is(':checked')) {
|
||||||
@ -2812,7 +2890,7 @@
|
|||||||
let policy_type_id = $('#policy_type_id').val();
|
let policy_type_id = $('#policy_type_id').val();
|
||||||
|
|
||||||
if(policy_type_id > 7 && name == "base_premium[]"){
|
if(policy_type_id > 7 && name == "base_premium[]"){
|
||||||
checkCDAmountForBasePremium(input);
|
// checkCDAmountForBasePremium(input);
|
||||||
}else{
|
}else{
|
||||||
console.log("First Skip the Ajax Call these are group policies");
|
console.log("First Skip the Ajax Call these are group policies");
|
||||||
}
|
}
|
||||||
@ -3372,7 +3450,6 @@
|
|||||||
$('input[name="co_ter_premium[]"]').addClass('readonly-select');
|
$('input[name="co_ter_premium[]"]').addClass('readonly-select');
|
||||||
$('#co_ter_premium_' + value).removeClass('readonly-select');
|
$('#co_ter_premium_' + value).removeClass('readonly-select');
|
||||||
|
|
||||||
|
|
||||||
$('[name="cd_ac_no_for_child[]"]').hide();
|
$('[name="cd_ac_no_for_child[]"]').hide();
|
||||||
$('[id^="cd_current_balance_"]').hide();
|
$('[id^="cd_current_balance_"]').hide();
|
||||||
|
|
||||||
@ -3382,7 +3459,6 @@
|
|||||||
|
|
||||||
// $('input[name="cd_ac_no_for_child[]"]').addClass('readonly-select');
|
// $('input[name="cd_ac_no_for_child[]"]').addClass('readonly-select');
|
||||||
// $('#cd_ac_no_' + value).removeClass('readonly-select');
|
// $('#cd_ac_no_' + value).removeClass('readonly-select');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -4386,11 +4462,11 @@
|
|||||||
if(policy_type_id == 1 || policy_type_id == 2 || policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5 || policy_type_id == 6 || policy_type_id == 7){
|
if(policy_type_id == 1 || policy_type_id == 2 || policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5 || policy_type_id == 6 || policy_type_id == 7){
|
||||||
$('#table_tr_34').hide();
|
$('#table_tr_34').hide();
|
||||||
$('#table_tr_37').hide();
|
$('#table_tr_37').hide();
|
||||||
$("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
// $("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
||||||
}else{
|
}else{
|
||||||
$('#table_tr_34').show();
|
$('#table_tr_34').show();
|
||||||
$('#table_tr_37').show();
|
$('#table_tr_37').show();
|
||||||
$("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
// $("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4468,13 +4544,13 @@
|
|||||||
$('#owner_branch').prop('required', false);
|
$('#owner_branch').prop('required', false);
|
||||||
$('#table_tr_34').hide();
|
$('#table_tr_34').hide();
|
||||||
$('#table_tr_37').hide();
|
$('#table_tr_37').hide();
|
||||||
$("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
// $("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
||||||
} else {
|
} else {
|
||||||
$('.ownerbranchdiv').show();
|
$('.ownerbranchdiv').show();
|
||||||
$('#owner_branch').prop('required', true);
|
$('#owner_branch').prop('required', true);
|
||||||
$('#table_tr_34').show();
|
$('#table_tr_34').show();
|
||||||
$('#table_tr_37').show();
|
$('#table_tr_37').show();
|
||||||
$("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
// $("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log('selected Owner type', selectedClientType);
|
// console.log('selected Owner type', selectedClientType);
|
||||||
@ -4767,7 +4843,7 @@
|
|||||||
newCell = `<td><input type="text" class="right-align-input" id="non_comm_per_amt_${insurerCount}" name="non_comm_per_amt[]" oninput="" onkeypress="return onlyNumbers(event)"></td>`;
|
newCell = `<td><input type="text" class="right-align-input" id="non_comm_per_amt_${insurerCount}" name="non_comm_per_amt[]" oninput="" onkeypress="return onlyNumbers(event)"></td>`;
|
||||||
break;
|
break;
|
||||||
case 8: // Base Premium
|
case 8: // Base Premium
|
||||||
newCell = `<td><input type="text" class="right-align-input" id="base_premium_${insurerCount}" name="base_premium[]" oninput="" onkeypress="return onlyNumbers(event)"></td>`;
|
newCell = `<td><input type="text" class="right-align-input" id="base_premium_${insurerCount}" name="base_premium[]" onchange="checkCDAmountForBasePremium(${insurerCount})" onkeypress="return onlyNumbers(event)"></td>`;
|
||||||
break;
|
break;
|
||||||
case 9: // TP Premium
|
case 9: // TP Premium
|
||||||
newCell = `<td><input type="text" class="right-align-input" id="tp_premium_${insurerCount}" name="tp_premium[]" oninput="" onkeypress="return onlyNumbers(event)"></td>`;
|
newCell = `<td><input type="text" class="right-align-input" id="tp_premium_${insurerCount}" name="tp_premium[]" oninput="" onkeypress="return onlyNumbers(event)"></td>`;
|
||||||
@ -4912,7 +4988,7 @@
|
|||||||
newCell = `<td><input type="text" class="right-align-input" id="non_comm_per_amt_${insurerCount}" name="non_comm_per_amt[]" oninput="" onkeypress="return onlyNumbers(event)"></td>`;
|
newCell = `<td><input type="text" class="right-align-input" id="non_comm_per_amt_${insurerCount}" name="non_comm_per_amt[]" oninput="" onkeypress="return onlyNumbers(event)"></td>`;
|
||||||
break;
|
break;
|
||||||
case 8: // Base Premium
|
case 8: // Base Premium
|
||||||
newCell = `<td><input type="text" class="right-align-input" id="base_premium_${insurerCount}" name="base_premium[]" oninput="" onkeypress="return onlyNumbers(event)"></td>`;
|
newCell = `<td><input type="text" class="right-align-input" id="base_premium_${insurerCount}" name="base_premium[]" onchange="checkCDAmountForBasePremium(${insurerCount})" onkeypress="return onlyNumbers(event)"></td>`;
|
||||||
break;
|
break;
|
||||||
case 9: // TP Premium
|
case 9: // TP Premium
|
||||||
newCell = `<td><input type="text" class="right-align-input" id="tp_premium_${insurerCount}" name="tp_premium[]" oninput="" onkeypress="return onlyNumbers(event)"></td>`;
|
newCell = `<td><input type="text" class="right-align-input" id="tp_premium_${insurerCount}" name="tp_premium[]" oninput="" onkeypress="return onlyNumbers(event)"></td>`;
|
||||||
@ -5458,10 +5534,12 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
if(index != 0){
|
if(index != 0){
|
||||||
if(data.co_share_type != 0 && data.co_share_type != 1){
|
// if(data.co_share_type != 0 && data.co_share_type != 1){
|
||||||
let co_share_index = index + 1;
|
// let co_share_index = index + 1;
|
||||||
select_leader_disable_premium_amt_in_edit(co_share_index);
|
// select_leader_disable_premium_amt_in_edit(co_share_index);
|
||||||
}
|
// }
|
||||||
|
select_leader_disable_premium_amt_in_edit();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,32 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
.dataTables_length label {height: 21px !important;}
|
.dataTables_length label {height: 21px !important;}
|
||||||
|
.custom-dropdown-menu {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
background-color: #ffffff !important;
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
padding: 0.5rem 0;
|
||||||
|
min-width: 10rem;
|
||||||
|
z-index: 9999;
|
||||||
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-dropdown-menu .dropdown-item {
|
||||||
|
display: block !important;
|
||||||
|
width: 100% !important;
|
||||||
|
padding: 0.5rem 1rem !important;
|
||||||
|
color: #212529 !important;
|
||||||
|
text-decoration: none !important;
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-dropdown-menu .dropdown-item:hover {
|
||||||
|
background-color: #f8f9fa !important;
|
||||||
|
color: #16181b !important;
|
||||||
|
cursor: pointer !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- End ADD and EDIT Page HTML -->
|
<!-- End ADD and EDIT Page HTML -->
|
||||||
@ -24,7 +50,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php if(isset($data['pos_list'])) { $slno = 1; ?>
|
<?php if(!empty($data['pos_list'])) { $slno = 1; ?>
|
||||||
<?php foreach($data['pos_list'] as $index => $row) { ?>
|
<?php foreach($data['pos_list'] as $index => $row) { ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-center"><?= $slno++; ?></td>
|
<td class="text-center"><?= $slno++; ?></td>
|
||||||
@ -54,12 +80,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } } ?>
|
||||||
<?php } else { ?>
|
|
||||||
<tr>
|
|
||||||
<td colspan="3" class="text-center">No data available</td>
|
|
||||||
</tr>
|
|
||||||
<?php } ?>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
@ -480,5 +501,94 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
const table = document.getElementById("user-table");
|
||||||
|
|
||||||
|
// Create custom dropdown
|
||||||
|
function createCustomDropdown(row) {
|
||||||
|
// Get the original dropdown items
|
||||||
|
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||||
|
if (!originalDropdown) return null;
|
||||||
|
|
||||||
|
// Create new dropdown with proper background and spacing
|
||||||
|
const customDropdown = document.createElement('div');
|
||||||
|
customDropdown.className = 'custom-dropdown-menu';
|
||||||
|
|
||||||
|
// Copy inner content while maintaining icon alignment
|
||||||
|
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||||
|
|
||||||
|
return customDropdown;
|
||||||
|
}
|
||||||
|
|
||||||
|
let activeDropdown = null;
|
||||||
|
|
||||||
|
// Add click event listener to rows
|
||||||
|
table.querySelectorAll("tbody tr").forEach(row => {
|
||||||
|
const customDropdown = createCustomDropdown(row);
|
||||||
|
if (!customDropdown) return;
|
||||||
|
|
||||||
|
// Append the custom dropdown to the body
|
||||||
|
document.body.appendChild(customDropdown);
|
||||||
|
|
||||||
|
row.addEventListener("click", function(event) {
|
||||||
|
// Ignore clicks on the action column
|
||||||
|
if (event.target.closest('td:last-child')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide any active dropdown
|
||||||
|
if (activeDropdown) {
|
||||||
|
activeDropdown.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get click position
|
||||||
|
const rect = event.target.getBoundingClientRect();
|
||||||
|
|
||||||
|
// Position the dropdown with some offset
|
||||||
|
customDropdown.style.display = 'block';
|
||||||
|
customDropdown.style.position = 'fixed';
|
||||||
|
customDropdown.style.left = `${rect.left}px`;
|
||||||
|
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||||
|
|
||||||
|
// Set as active dropdown
|
||||||
|
activeDropdown = customDropdown;
|
||||||
|
|
||||||
|
event.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Preserve click handlers and add auto-close
|
||||||
|
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||||
|
item.addEventListener('click', function(e) {
|
||||||
|
const onclickAttr = this.getAttribute('onclick');
|
||||||
|
if (onclickAttr) {
|
||||||
|
eval(onclickAttr);
|
||||||
|
}
|
||||||
|
|
||||||
|
const href = this.getAttribute('href');
|
||||||
|
if (href && href !== '#') {
|
||||||
|
window.location.href = href;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the dropdown after handling the click
|
||||||
|
if (activeDropdown) {
|
||||||
|
activeDropdown.style.display = 'none';
|
||||||
|
activeDropdown = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Close dropdown when clicking outside
|
||||||
|
document.addEventListener("click", function() {
|
||||||
|
if (activeDropdown) {
|
||||||
|
activeDropdown.style.display = 'none';
|
||||||
|
activeDropdown = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -685,13 +685,16 @@ $(document).ready(function() {
|
|||||||
var totalRewards = getTotal(24);
|
var totalRewards = getTotal(24);
|
||||||
var totalIrda = getTotal(25);
|
var totalIrda = getTotal(25);
|
||||||
var totalBilled = getTotal(26);
|
var totalBilled = getTotal(26);
|
||||||
var totalRevenue = parseFloat(totalIrda) + parseFloat(totalRewards);
|
|
||||||
var totalUnbilled = getTotal(27);
|
var totalUnbilled = getTotal(27);
|
||||||
|
|
||||||
|
var totalIrdaAmt = parseFloat(totalBilled) - parseFloat(totalRewards);
|
||||||
|
var totalRevenue = parseFloat(totalIrdaAmt) + parseFloat(totalRewards);
|
||||||
|
|
||||||
// Update the totals section above the table
|
// Update the totals section above the table
|
||||||
$('#total_premium').text(totalPremium.toFixed(2));
|
$('#total_premium').text(totalPremium.toFixed(2));
|
||||||
$('#total_rewards').text(totalRewards.toFixed(2));
|
$('#total_rewards').text(totalRewards.toFixed(2));
|
||||||
$('#total_irda').text(totalIrda.toFixed(2));
|
// $('#total_irda').text(totalIrda.toFixed(2));
|
||||||
|
$('#total_irda').text(totalIrdaAmt.toFixed(2));
|
||||||
$('#total_revenue').text(totalRevenue.toFixed(2));
|
$('#total_revenue').text(totalRevenue.toFixed(2));
|
||||||
// $('#total_revenue').text(totalIrda.toFixed(2));
|
// $('#total_revenue').text(totalIrda.toFixed(2));
|
||||||
$('#total_billed').text(totalBilled.toFixed(2));
|
$('#total_billed').text(totalBilled.toFixed(2));
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
"ext-intl": "*",
|
"ext-intl": "*",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-mbstring": "*",
|
"ext-mbstring": "*",
|
||||||
|
"aws/aws-sdk-php": "^3.369",
|
||||||
"botman/botman": "^2.8",
|
"botman/botman": "^2.8",
|
||||||
"botman/driver-web": "^1.5",
|
"botman/driver-web": "^1.5",
|
||||||
"dompdf/dompdf": "^2.0",
|
"dompdf/dompdf": "^2.0",
|
||||||
@ -72,7 +73,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"optimize-autoloader": true,
|
"optimize-autoloader": false,
|
||||||
"preferred-install": "dist",
|
"preferred-install": "dist",
|
||||||
"sort-packages": true,
|
"sort-packages": true,
|
||||||
"process-timeout": 900
|
"process-timeout": 900
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user