CHANGE_AGE_BAND_LGBTQ_EMAIL_MOBILE_EDIT_: RV
This commit is contained in:
parent
e5dedf86c6
commit
03a00ecccd
@ -14,6 +14,7 @@ $routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']);
|
||||
$routes->get("reminder_mail", "NotificationController::reminder_mail");
|
||||
$routes->get("getClientData", "ClientController::getClientData");
|
||||
$routes->get("testing_for_review_mail/(:any)", "ClientController::testingForReviewMail/$1");
|
||||
$routes->get("sendMemberReviewConfirmationMail/(:any)", "ClientController::sendMemberReviewConfirmationMail/$1");
|
||||
$routes->get("update-policy-terms-for-corrections", "ClientController::updatePolicyTermsForCorrections");
|
||||
$routes->get("update_rack_rate_json", "ClientController::updateRackRateJson");
|
||||
$routes->get("updatajson", "EmpDataServiceController::updatajson");
|
||||
|
||||
@ -44,8 +44,7 @@ use App\Controllers\EmpDataServiceController;
|
||||
use App\Controllers\GoogleDriveController;
|
||||
|
||||
use App\Helpers\sendMailNotification;
|
||||
|
||||
|
||||
use App\Models\RFQModel;
|
||||
|
||||
class ClientController extends AdminController
|
||||
{
|
||||
@ -183,9 +182,12 @@ class ClientController extends AdminController
|
||||
print_rr($attachments);
|
||||
}
|
||||
|
||||
//Function for Testing Member Review and Summery Confirmation Mail
|
||||
public function testingForReviewMail($client_id = 77, $emp_code = 'EMP001-K1', $mail_active = 0) //this function for only tsesting some logics not use for business logic
|
||||
{
|
||||
|
||||
// dd($client_id, $emp_code, $mail_active);
|
||||
|
||||
$client_policy_ids = $this->employeeModel
|
||||
->select('employee_polices.client_policy_id')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
@ -213,7 +215,7 @@ class ClientController extends AdminController
|
||||
{
|
||||
|
||||
$empData = $this->employeeModel->where('emp_code', $emp_code )->where('client_id', $client_id ) ->where('is_active', 1 )->findAll();
|
||||
|
||||
// dd($empData);
|
||||
$filteredEmpData = array_filter($empData, fn($item) => $item['relationship'] === 'Self');
|
||||
|
||||
// dd($filteredEmpData);
|
||||
@ -254,7 +256,7 @@ class ClientController extends AdminController
|
||||
// print_r($wholeData); die;
|
||||
|
||||
if($mail_active > 0){
|
||||
$mail_send_return = MailHelper::send_email($wholeData[0]);
|
||||
// $mail_send_return = MailHelper::send_email($wholeData[0]);
|
||||
$this->myLogger->logme("info", $mail_send_return);
|
||||
}
|
||||
|
||||
@ -269,7 +271,7 @@ class ClientController extends AdminController
|
||||
if($mail_active > 0){
|
||||
|
||||
foreach ($account_manager_wholeData as $key => $value) {
|
||||
$mail_send_return1 = MailHelper::send_email($value);
|
||||
// $mail_send_return1 = MailHelper::send_email($value);
|
||||
$this->myLogger->logme("info", $mail_send_return1);
|
||||
}
|
||||
|
||||
@ -288,7 +290,7 @@ class ClientController extends AdminController
|
||||
if($mail_active > 0){
|
||||
|
||||
foreach ($client_hr_wholeData as $key => $value) {
|
||||
$mail_send_return2 = MailHelper::send_email($value);
|
||||
// $mail_send_return2 = MailHelper::send_email($value);
|
||||
$this->myLogger->logme("info", $mail_send_return2);
|
||||
}
|
||||
}
|
||||
@ -317,6 +319,123 @@ class ClientController extends AdminController
|
||||
// return $this->respond(['status' => 'success','code' => 200,'data' => [] ], 200);
|
||||
}
|
||||
|
||||
//Function for Send Member Review and Summery Confirmation Mail
|
||||
public function sendMemberReviewConfirmationMail($client_id = 77, $emp_code = 'EMP001-K1', $mail_active = 0)
|
||||
{
|
||||
$client_policy_ids = $this->employeeModel
|
||||
->select('employee_polices.client_policy_id')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.client_id', $client_id)
|
||||
->where('employees.emp_code', $emp_code)
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employees.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$client_policy_ids2 = array_column($client_policy_ids, 'client_policy_id');
|
||||
$client_policy_id = array_unique($client_policy_ids2);
|
||||
|
||||
if (!is_null($client_policy_id) && is_array($client_policy_id)) {
|
||||
|
||||
$empData = $this->employeeModel
|
||||
->where('emp_code', $emp_code)
|
||||
->where('client_id', $client_id)
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$filteredEmpData = array_filter($empData, fn($item) => $item['relationship'] === 'Self');
|
||||
|
||||
if (empty($filteredEmpData)) {
|
||||
return $this->respond([
|
||||
'status' => 'error',
|
||||
'code' => 404,
|
||||
'message' => 'No active employee data found for the given criteria.',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$array_list = [];
|
||||
foreach ($client_policy_id as $value) {
|
||||
$find = $this->employeeModel->getEmpFamilybyEmpCode(
|
||||
client_policy_id: $value,
|
||||
emp_code: $emp_code,
|
||||
client_id: $client_id,
|
||||
emp_status: ['draft', 'enrolled'],
|
||||
policy_status: ['draft', 'enrolled']
|
||||
);
|
||||
|
||||
if (count($find) > 0) {
|
||||
$array_list[] = $find;
|
||||
}
|
||||
}
|
||||
|
||||
$notification = $this->notificationModel
|
||||
->where('client_id', $client_id)
|
||||
->where('template_name', 'member_review_and_summary_mail')
|
||||
->first();
|
||||
|
||||
if ($notification && $notification['enabled'] == 1) {
|
||||
|
||||
$params = [
|
||||
'array_list' => $array_list,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'emp_code' => $emp_code,
|
||||
'client_id' => $client_id,
|
||||
'notification' => $notification,
|
||||
'common' => [
|
||||
'client_id' => $filteredEmpData[0]['client_id'],
|
||||
'client_branch_id' => $filteredEmpData[0]['client_branch_id'],
|
||||
'client_policy_id' => null,
|
||||
'employee_policy_id' => null,
|
||||
'employee_id' => $filteredEmpData[0]['id'],
|
||||
'mail_type' => 'member_review_and_summary_mail',
|
||||
],
|
||||
];
|
||||
|
||||
$wholeData = sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
|
||||
|
||||
if ($mail_active > 0) {
|
||||
|
||||
$mail_send_result = MailHelper::send_email($wholeData[0]);
|
||||
|
||||
if ($mail_send_result['status'] === 'success') {
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'code' => 200,
|
||||
'message' => 'Email sent successfully.',
|
||||
'response' => $mail_send_result,
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => 'error',
|
||||
'code' => 500,
|
||||
'message' => 'Failed to send email.',
|
||||
'details' => $mail_send_result,
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'code' => 200,
|
||||
'message' => 'Notification prepared but email not sent as mail_active is 0.',
|
||||
'data' => $wholeData,
|
||||
], 200);
|
||||
}
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'error',
|
||||
'code' => 400,
|
||||
'message' => 'Member Review Mail configuration is not enabled for this client.',
|
||||
], 400);
|
||||
}
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'error',
|
||||
'code' => 404,
|
||||
'message' => 'No active client policy IDs found.',
|
||||
], 404);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
public function index()
|
||||
@ -1056,6 +1175,7 @@ class ClientController extends AdminController
|
||||
$data['disclaimer'] = $this->request->getPost('disclaimer');
|
||||
$data['is_member_modify_allowed'] = $this->request->getPost('is_member_modify_allowed') ? 1 : 0;
|
||||
$data['enrolment_visibility'] = $this->request->getPost('enrolment_visibility') ? 1 : 0;
|
||||
$data['is_lgbtq'] = $this->request->getPost('is_lgbtq') ? 1 : 0;
|
||||
|
||||
|
||||
|
||||
@ -1188,6 +1308,7 @@ class ClientController extends AdminController
|
||||
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['is_member_modify_allowed'] = $this->request->getPost('is_member_modify_allowed') ? 1 : 0;
|
||||
$data['is_lgbtq'] = $this->request->getPost('is_lgbtq') ? 1 : 0;
|
||||
if ($data['inception_type'] == 2) {
|
||||
$data['open_date'] = change_date_format($this->request->getPost('open_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['close_date'] = change_date_format($this->request->getPost('close_date'), 'd-m-Y', 'Y-m-d');
|
||||
@ -3831,24 +3952,27 @@ class ClientController extends AdminController
|
||||
|
||||
public function sendextraparam()
|
||||
{
|
||||
$batch_data = [
|
||||
'client_id' => 17,
|
||||
'client_policy_id' => 30,
|
||||
'client_branch_id' => 18,
|
||||
'event_type' => "inception",
|
||||
];
|
||||
|
||||
// $batch_data['insurer_or_tpa'] = 'insurer';
|
||||
$batch_data['insurer_or_tpa'] = 'tpa';
|
||||
|
||||
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
|
||||
|
||||
// dd($this->request);
|
||||
// $employeeRestController = new EmployeeServiceController();
|
||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 721]);
|
||||
|
||||
$employeeRestController = new EmployeeServiceController();
|
||||
// $employeeRestController->excelFileDataValidation(['file_id' => 823]);
|
||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 823]);
|
||||
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
|
||||
|
||||
|
||||
// ----------EMP DATA SERVICE CONTROLLER--------------------------------------------------------------------------------
|
||||
|
||||
// $batch_data = [
|
||||
// 'client_id' => 17,
|
||||
// 'client_policy_id' => 30,
|
||||
// 'client_branch_id' => 18,
|
||||
// 'event_type' => "inception",
|
||||
// ];
|
||||
|
||||
// $batch_data['insurer_or_tpa'] = 'insurer';
|
||||
// $batch_data['insurer_or_tpa'] = 'tpa';
|
||||
|
||||
// $dashBoardController = new DashboardController();
|
||||
// $client_policy_data = $this->clientPolicyModel->getPolicyDetailsForRemainder($client_id=159, $client_branch_id=126);
|
||||
// $dashBoardController->sendRemainderMail($client_policy_data);
|
||||
@ -3877,33 +4001,47 @@ class ClientController extends AdminController
|
||||
// $EmpDataServiceController = new EmpDataServiceController();
|
||||
// $EmpDataServiceController->importInceptionFileValidation(['file_id' => 160]);
|
||||
|
||||
$EmpDataServiceController = new EmpDataServiceController();
|
||||
// $EmpDataServiceController = new EmpDataServiceController();
|
||||
// $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 162]);
|
||||
// $EmpDataServiceController->importInceptionFileValidation(['file_id' => 162]);
|
||||
// $EmpDataServiceController->importDeletionValidation(['file_id' => 171]);
|
||||
// $EmpDataServiceController->importDeletionUpdateEndorsementID(['file_id' => 171]);
|
||||
// $EmpDataServiceController->importCorrectionUpdateEndorsementID(['file_id' => 188]);
|
||||
$array = [
|
||||
"employeeIds" => ["12800", "12798", "12797", "12799"],
|
||||
"client_id" => "159",
|
||||
"client_policy_id" => "336",
|
||||
"client_branch_id" => "126",
|
||||
"cd_ac_no" => "Apple_123",
|
||||
"endorsement_no" => "ENDORSEMENT_ID",
|
||||
"count" => 4,
|
||||
"event_name" => "deletion",
|
||||
"policy_name" => "GMC",
|
||||
"user_id" => "1"
|
||||
];
|
||||
|
||||
// $array = [
|
||||
// "employeeIds" => ["12800", "12798", "12797", "12799"],
|
||||
// "client_id" => "159",
|
||||
// "client_policy_id" => "336",
|
||||
// "client_branch_id" => "126",
|
||||
// "cd_ac_no" => "Apple_123",
|
||||
// "endorsement_no" => "ENDORSEMENT_ID",
|
||||
// "count" => 4,
|
||||
// "event_name" => "deletion",
|
||||
// "policy_name" => "GMC",
|
||||
// "user_id" => "1"
|
||||
// ];
|
||||
|
||||
// $EmpDataServiceController->cashDepositCalculationForDeletion($array);
|
||||
|
||||
// $employeeRestController = new EmployeeServiceController();
|
||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 757]);
|
||||
|
||||
// $result = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($batch_data);
|
||||
// dd(db_connect()->getLastQuery());
|
||||
|
||||
// ------------- LEADS CONTROLLER ----------------------------------------------------------
|
||||
|
||||
// $LeadsController = new LeadsController();
|
||||
// $RFQModel = new RFQModel();
|
||||
|
||||
// $data = $RFQModel->where('is_active', 1)->where('lead_id', 40)->first();
|
||||
// // dd($data);
|
||||
// $policy_type = 2;
|
||||
// $proposel_name = "Proposal 2";
|
||||
// $insurer_name = "ICICI-P-ICICI002-V1";
|
||||
// $jsonArray = json_decode($data['json'], true);
|
||||
// // dd($jsonArray);
|
||||
|
||||
// $returndata = $LeadsController->convertQCRJsonToPolicyTerms($jsonArray, $policy_type, $proposel_name, $insurer_name);
|
||||
// dd($returndata);
|
||||
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -2177,6 +2177,9 @@ class EmployeeController extends AdminController
|
||||
//get policy details
|
||||
$policy_details = $this->clientPolicyModel->getPolicyDetails($client_id,$policy_id);
|
||||
$policy_terms = (array)$policy_details[0];
|
||||
$is_lgbtq = $policy_terms['is_lgbtq'];
|
||||
|
||||
|
||||
// dd($policy_terms);
|
||||
$policy_terms = json_decode($policy_terms['policy_terms']);
|
||||
$policy_terms = (array) $policy_terms;// convert obj to array
|
||||
@ -2184,7 +2187,7 @@ class EmployeeController extends AdminController
|
||||
//get file array or construnct dummy file array here
|
||||
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $policy_id,'action' => 'inception','client_branch_id' => $branch_id,'created_by' => 1];
|
||||
//get familiy details in inception file format array from post method
|
||||
$result = check_dependent_conflict($family_details, $policy_terms, $file['action']);
|
||||
$result = check_dependent_conflict($family_details, $policy_terms, $file['action'],$is_lgbtq);
|
||||
|
||||
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => ['policy_terms' => $policy_terms['family_floaters'],'result' => $result] ], 200);
|
||||
|
||||
@ -977,6 +977,9 @@ class EmployeeServiceController extends AdminController
|
||||
// get policy and rack details
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
$policy_details = (array)$policy_terms[0];
|
||||
$is_lgbtq = $policy_details['is_lgbtq'];
|
||||
|
||||
|
||||
// dd($this->clientPolicyModel->getLastQuery());
|
||||
$policy_terms = json_decode($policy_terms[0]->policy_terms);
|
||||
$policy_terms = (array) $policy_terms;// convert obj to array
|
||||
@ -1071,7 +1074,7 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
if($file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'inception'|| $file['action'] == 'missed_inception' || $file['action'] == 'enrollment')
|
||||
{
|
||||
$res = check_dependent_conflict($family,$policy_terms,$file['action']);
|
||||
$res = check_dependent_conflict($family,$policy_terms,$file['action'],$is_lgbtq);
|
||||
// dd($res);
|
||||
if(!$res['status'])
|
||||
{
|
||||
@ -1159,7 +1162,6 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
// calculate data points and premium
|
||||
public function employeesOnboardPreprocess($params)
|
||||
{
|
||||
@ -1240,8 +1242,9 @@ class EmployeeServiceController extends AdminController
|
||||
// dd($family);
|
||||
}
|
||||
|
||||
// Kint::dump($family);die();
|
||||
// Kint::dump($family);
|
||||
$data = calculate_premium_new(family_data:$family,policy_terms: $policy_terms,slab_details : $slab_details,fileArr: $file, existing_units:$existing_units);
|
||||
// dd($data);
|
||||
$employee_data_group_by_family[$emp_id] = $data;
|
||||
$this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]);
|
||||
}
|
||||
|
||||
@ -461,7 +461,8 @@ class LeadsController extends BaseController
|
||||
$this->loadLayout('view_rfq.php', $data);
|
||||
}
|
||||
|
||||
public function createRFQ(){
|
||||
public function createRFQ()
|
||||
{
|
||||
|
||||
// print_r($this->request->getPost('json')); die();
|
||||
|
||||
@ -1542,7 +1543,8 @@ class LeadsController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function transformProposelData($data, $proposel, $insurer){
|
||||
public function transformProposelData($data, $proposel, $insurer)
|
||||
{
|
||||
|
||||
// print_r($data['premium_data']['data']); die;
|
||||
|
||||
@ -1933,107 +1935,23 @@ class LeadsController extends BaseController
|
||||
return $this->convertQCRJsonToPolicyTerms($converted_json, $data['policy_type_id'], $proposel_data['proposel_name'], $proposel_data['insurer_name']);
|
||||
}
|
||||
|
||||
private function convertQCRJsonToPolicyTerms($data, $policy_type, $proposel_name, $insurer_name)
|
||||
{
|
||||
$GMC_Keys = [
|
||||
"sum_insured",
|
||||
"family_floater",
|
||||
"family_floaters",
|
||||
"age_ratio",
|
||||
"waiverofpreexistingdiseases",
|
||||
"maternitycoverage",
|
||||
"twindelivery",
|
||||
"preandpostnatal",
|
||||
"babyday1cover",
|
||||
"9monthwaitingperiodwaived",
|
||||
"coverfromthedateofjoining",
|
||||
"waiverof1,2,3&4thyearexclusions",
|
||||
"waiverof30dayswaitingperiod",
|
||||
"prehospitalizationcover",
|
||||
"congenitaldiseasesinternal",
|
||||
"copayzonewisecopay",
|
||||
"bioabsorbablestenttoriclensmultifocallens",
|
||||
"roomrentlimit",
|
||||
"proportionatedeductionclause",
|
||||
"ailmentcapping",
|
||||
"ambulancecharges",
|
||||
"airambulance",
|
||||
"familytransportationbenefit",
|
||||
"reasonableandcustomarycharges",
|
||||
"ayudhtreatmentcover",
|
||||
"congenitaldiseasesexternal",
|
||||
"optionalparentalcopay",
|
||||
"posthospitalizationcover",
|
||||
"corporatebuffer",
|
||||
"sublimitofcorporatebuffer",
|
||||
"ayushTreatmentCoverData",
|
||||
"armdcovered",
|
||||
"suminsuredenhancement",
|
||||
"automaticsuminsuredreinstatement",
|
||||
"additionalsicknessbenefit",
|
||||
"lasiksurgery",
|
||||
"midterminclusion",
|
||||
"capd",
|
||||
"organdonorexpenses",
|
||||
"moderntreatmentsasperirdai",
|
||||
"Wellness",
|
||||
"days_of_discharge",
|
||||
"days_from_dod",
|
||||
"special_condition_label",
|
||||
"special_condition_input",
|
||||
"multiple_sum_insured",
|
||||
"cataract",
|
||||
"cataractData"
|
||||
];
|
||||
|
||||
$GPA_Keys = [
|
||||
"sumInsured2",
|
||||
"totalSumInsured",
|
||||
"age_ratio",
|
||||
"accidentalDeathBenefit",
|
||||
"permanentTotalDisablement",
|
||||
"permanentPartialDisablement",
|
||||
"temporaryTotalDisablementBenefit",
|
||||
"accidentalHospitalizationExpenses",
|
||||
"childrenEducationWelfareFund",
|
||||
"compassionateVisitExpenses",
|
||||
"compassionateVisitExpensesData",
|
||||
"brokenBoneExpenses",
|
||||
"brokenBoneExpensesData",
|
||||
"ambulanceCharges",
|
||||
"ambulanceChargesData",
|
||||
"burnExpenses",
|
||||
"burnExpensesData",
|
||||
"carriageOfDeadBody",
|
||||
"carriageOfDeadBodyData",
|
||||
"animalSnakeInsectBite",
|
||||
"terrorism",
|
||||
"worldwideCover",
|
||||
"gpa_special_condition_label",
|
||||
"gpa_special_condition_input",
|
||||
"multiple_sum_insured"
|
||||
];
|
||||
|
||||
// Select keys based on policy type
|
||||
$termsKey = $policy_type == 1 ? $GPA_Keys : $GMC_Keys;
|
||||
|
||||
// Initialize terms_array with default empty values
|
||||
$terms_array = array_fill_keys($termsKey, "");
|
||||
$specialKeys = ['special_condition_label', 'special_condition_input', 'gpa_special_condition_label', 'gpa_special_condition_input', 'multiple_sum_insured'];
|
||||
foreach ($specialKeys as $key) {
|
||||
$terms_array[$key] = [];
|
||||
}
|
||||
//Function for convert the RFQ and QCR Json to Policy Terms Json
|
||||
public function convertQCRJsonToPolicyTerms($data, $policy_type, $proposel_name, $insurer_name)
|
||||
{
|
||||
//transform the data into the currernt proposel and insurere ( get single proposel )
|
||||
$data = $this->transformProposelData($data, $proposel_name, $insurer_name);
|
||||
|
||||
// Initialize age_ratio based on policy type
|
||||
$terms_array['age_ratio'] = $policy_type == 2 ? [
|
||||
"self" => ["min" => "18", "max" => "60"],
|
||||
"spouse" => ["min" => 0, "max" => 0],
|
||||
"child" => ["min" => 0, "max" => "25"],
|
||||
"elders" => ["min" => 0, "max" => 0],
|
||||
] : ["self" => ["min" => "18", "max" => "60"]];
|
||||
$age_ratio = $policy_type == 2 ? [
|
||||
'self' => ['min' => '18', 'max' => '60'],
|
||||
'spouse' => ['min' => 0, 'max' => 0],
|
||||
'child' => ['min' => 0, 'max' => '25'],
|
||||
'elders' => ['min' => 0, 'max' => 0],
|
||||
] : [
|
||||
'self' => ['min' => '18', 'max' => '60']
|
||||
];
|
||||
|
||||
foreach ($data['table_data']['data'] as $dataRow) {
|
||||
|
||||
$item = $dataRow['items'] ?? '';
|
||||
|
||||
foreach ($dataRow['data'] as $cellData) {
|
||||
@ -2043,45 +1961,52 @@ class LeadsController extends BaseController
|
||||
$value = $cellData['value'] ?? '';
|
||||
|
||||
// Skip unwanted keys
|
||||
if (
|
||||
in_array($parentth, ['Sno', 'Item Key', 'Particulars', 'Action']) ||
|
||||
in_array($subth, ['Quote Asked'])
|
||||
) {
|
||||
if (in_array($parentth, ['Sno', 'Item Key', 'Particulars', 'Action']) || in_array($subth, ['Quote Asked'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Handle special conditions
|
||||
if (str_starts_with($item, "special_condition") && $parentth === $proposel_name && $subth === $insurer_name) {
|
||||
switch (true) {
|
||||
|
||||
$parts = explode("-", $input_value);
|
||||
$question = $parts[0] ?? '';
|
||||
$answer = $parts[1] ?? '';
|
||||
$labelKey = $policy_type == 1 ? 'gpa_special_condition_label' : 'special_condition_label';
|
||||
$inputKey = $policy_type == 1 ? 'gpa_special_condition_input' : 'special_condition_input';
|
||||
// CASE 1: Handle special conditions
|
||||
case str_starts_with($item, 'special_condition') && $parentth === $proposel_name && $subth === $insurer_name:
|
||||
$parts = explode('-', $input_value);
|
||||
$labelKey = $policy_type == 1 ? 'gpa_special_condition_label' : 'special_condition_label';
|
||||
$inputKey = $policy_type == 1 ? 'gpa_special_condition_input' : 'special_condition_input';
|
||||
|
||||
$terms_array[$labelKey][] = $question;
|
||||
$terms_array[$inputKey][] = $answer;
|
||||
continue;
|
||||
$terms_array[$labelKey][] = $parts[0] ?? '';
|
||||
$terms_array[$inputKey][] = $parts[1] ?? '';
|
||||
break;
|
||||
|
||||
// CASE 2: Handle sum insured
|
||||
case in_array($item, ['sum_insured', 'sumInsured2']):
|
||||
$si_amt = explode(',', $value);
|
||||
$terms_array[$item] = $si_amt[0] ?? '';
|
||||
$terms_array['multiple_sum_insured'] = array_slice($si_amt, 1);
|
||||
|
||||
// Add age_ratio after Sum insured
|
||||
if ($policy_type == 1) {
|
||||
$terms_array['age_ratio'] = $age_ratio;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// CASE 3: Handle family floaters
|
||||
case $item === 'family_composition':
|
||||
$terms_array['family_floaters'] = isJsonString($input_value) ? json_decode($input_value, true) : $input_value;
|
||||
|
||||
// Add age_ratio after family floaters
|
||||
if ($policy_type == 2) {
|
||||
$terms_array['age_ratio'] = $age_ratio;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// DEFAULT CASE :
|
||||
default:
|
||||
// $terms_array[$item] = isJsonString($input_value) ? (json_decode($input_value, true)['key'] ?? '') : $value;
|
||||
$terms_array[$item] = $value;
|
||||
break;
|
||||
}
|
||||
|
||||
// Handle sum insured
|
||||
if (in_array($item, ['sum_insured', 'sumInsured2'])) {
|
||||
$si_amt = explode(",", $value);
|
||||
$terms_array[$item] = $si_amt[0] ?? "";
|
||||
$terms_array['multiple_sum_insured'] = array_slice($si_amt, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Handle family floaters
|
||||
if ($item === 'family_composition') {
|
||||
$terms_array['family_floaters'] = isJsonString($input_value) ? json_decode($input_value, true) : $input_value;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Decode JSON if valid
|
||||
$terms_array[$item] = isJsonString($input_value) ?
|
||||
(json_decode($input_value, true)['key'] ?? '') :
|
||||
$input_value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -225,6 +225,7 @@ class MasterController extends AdminController
|
||||
'New Basic Cover SI' => 'new_basic_cover_si',
|
||||
'New SI Premium' => 'new_si_premium',
|
||||
'Date of Coverage' => 'date_of_coverage',
|
||||
'Age Band' => 'age_band',
|
||||
|
||||
];
|
||||
|
||||
|
||||
@ -532,8 +532,10 @@ if (!function_exists('name_and_empid_check_in_db'))
|
||||
|
||||
if (!function_exists('check_dependent_conflict'))
|
||||
{
|
||||
function check_dependent_conflict($family_data,$policy_terms,$actionArr)
|
||||
{
|
||||
function check_dependent_conflict($family_data,$policy_terms,$actionArr,$is_lgbtq)
|
||||
{
|
||||
// dd($family_data,$policy_terms,$actionArr,$is_lgbtq);
|
||||
|
||||
$result = ['status' => true];
|
||||
|
||||
$self_gender = null;
|
||||
@ -622,10 +624,14 @@ if (!function_exists('check_dependent_conflict'))
|
||||
// print_r(array_values(array_count_values($overall_famility_relationships)));
|
||||
// print_r(in_array(2,array_values(array_count_values($overall_famility_relationships))));
|
||||
|
||||
if($self_gender && $spouse_gender && $self_gender == $spouse_gender)
|
||||
//check if this policy is allowed LGBTQ
|
||||
if($is_lgbtq == 0)
|
||||
{
|
||||
$result['status'] = false;
|
||||
$result['error_data'][] = ['code' => 4,'col_name' => 'gender','msg' => 'Rule conflict: Self and Spouse cannot be same gender','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])];
|
||||
if($self_gender && $spouse_gender && $self_gender == $spouse_gender)
|
||||
{
|
||||
$result['status'] = false;
|
||||
$result['error_data'][] = ['code' => 4,'col_name' => 'gender','msg' => 'Rule conflict: Self and Spouse cannot be same gender','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])];
|
||||
}
|
||||
}
|
||||
|
||||
if(($allowed_spouse_count < $received_spouse_count) || ($allowed_child_count < $received_child_count) )
|
||||
@ -1072,7 +1078,9 @@ if (!function_exists('transform_excel_data_to_db'))
|
||||
if (!function_exists('premium_calculation_manager'))
|
||||
{
|
||||
function premium_calculation_manager($emp_data,$policy_terms,$slab_details,$default_si = null)
|
||||
{
|
||||
{
|
||||
// dd($emp_data,$policy_terms,$slab_details,$default_si);
|
||||
|
||||
$myLogger = \Config\Services::mylogger();
|
||||
// grid type
|
||||
// 1 = premium => si
|
||||
@ -1238,6 +1246,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
@ -1246,12 +1255,12 @@ if (!function_exists('premium_calculation_manager'))
|
||||
case "5":
|
||||
//GMC - Employees Age + SI
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
$temp_date = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'],to_date: $temp_date)->y;
|
||||
|
||||
$temp_date = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'],to_date: $temp_date)->y;
|
||||
// kint::dump($age);
|
||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||
{
|
||||
|
||||
// dd($slab_value);
|
||||
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null || $slab_value['premium_type'] == 3 ) ))
|
||||
{
|
||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||
@ -1261,6 +1270,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
@ -1276,7 +1286,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
|
||||
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null || $slab_value['premium_type'] == 3) ))
|
||||
{
|
||||
// echo $emp_data['name'];
|
||||
// echo $emp_data['name']; die;
|
||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
@ -1284,6 +1294,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
@ -1307,6 +1318,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
|
||||
|
||||
$is_match_found = true;
|
||||
break;
|
||||
@ -1378,6 +1390,8 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.',''));
|
||||
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
|
||||
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
@ -1459,6 +1473,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days);
|
||||
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.',''));
|
||||
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -52,7 +52,8 @@ class ClientPolicyModel extends Model
|
||||
"disclaimer",
|
||||
"is_active",
|
||||
"is_member_modify_allowed",
|
||||
"cd_ac_pk"
|
||||
"cd_ac_pk",
|
||||
"is_lgbtq",
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
|
||||
@ -35,7 +35,8 @@ class EmployeePolicyModel extends Model
|
||||
"claim_status",
|
||||
'ecard_sent_status',
|
||||
'payable_employee',
|
||||
'file_id'
|
||||
'file_id',
|
||||
"age_band",
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
@ -285,7 +286,10 @@ class EmployeePolicyModel extends Model
|
||||
employee_polices.premium,
|
||||
employee_polices.rata_premimum as pro_rata_premium,
|
||||
employee_polices.gst,
|
||||
employee_polices.age_band,
|
||||
(employee_polices.rata_premimum + employee_polices.gst) AS total,
|
||||
|
||||
|
||||
batch_data.emp_policy_id,
|
||||
batch_data.bl AS batch_list_batch_code,
|
||||
batch_data.bf AS batch_files_batch_code,
|
||||
@ -482,10 +486,13 @@ class EmployeePolicyModel extends Model
|
||||
employee_polices.pre_existing_alignments,
|
||||
employee_polices.policy_end_date,
|
||||
employee_polices.basic_cover_si as old_basic_cover_si,
|
||||
employee_polices.rata_premimum as old_si_premium,
|
||||
employee_polices.rata_premimum as old_si_premium,
|
||||
employee_polices.age_band,
|
||||
|
||||
batch_data.emp_policy_id,
|
||||
batch_data.bl AS batch_list_batch_code,
|
||||
batch_data.bf AS batch_files_batch_code,
|
||||
|
||||
sidata.new_basic_cover_si,
|
||||
sidata.new_si_premium,
|
||||
sidata.date_of_coverage,
|
||||
@ -814,6 +821,8 @@ class EmployeePolicyModel extends Model
|
||||
employee_polices.uhid as uhid,
|
||||
employee_polices.rata_premimum as premium,
|
||||
employee_polices.claim_status,
|
||||
employee_polices.age_band,
|
||||
|
||||
|
||||
batch_data.emp_policy_id AS emp_policy_id,
|
||||
batch_data.bl AS batch_list_batch_code,
|
||||
|
||||
@ -175,14 +175,14 @@
|
||||
<label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Enrollment App</label>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group col-md-4">
|
||||
<div class="form-group col-md-4">
|
||||
<label class="switch" style="position: relative;top: 43px;left: 20px;">
|
||||
<input id="is_member_modify_allowed" type="checkbox" name="is_member_modify_allowed" checked>
|
||||
<input id="is_lgbtq" type="checkbox" name="is_lgbtq">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
|
||||
<label for="is_member_modify_allowed" style="position: relative;bottom: 5px;left: 85px;"> In Enrollment Member Data Modification Allowed</label>
|
||||
</div> -->
|
||||
<label for="is_lgbtq" style="position: relative;bottom: 5px;left: 85px;"> Is LGBTQ Enable</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="policy_fields"></div>
|
||||
@ -825,6 +825,13 @@
|
||||
$('#policy_visibility').prop('checked', false);
|
||||
}
|
||||
|
||||
if (res.data.is_lgbtq == 1) {
|
||||
$('#is_lgbtq').prop('checked', true);
|
||||
} else {
|
||||
$('#is_lgbtq').prop('checked', false);
|
||||
}
|
||||
|
||||
|
||||
// Member Modify Data Enable or Disable
|
||||
// if (res.data.is_member_modify_allowed == 1) {
|
||||
// $('#is_member_modify_allowed').prop('checked', true);
|
||||
@ -1886,6 +1893,19 @@
|
||||
$('#policy_visibility').prop('checked', false);
|
||||
}
|
||||
|
||||
console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||
|
||||
console.log(res.data.is_lgbtq)
|
||||
|
||||
if (res.data.is_lgbtq == 1) {
|
||||
$('#is_lgbtq').prop('checked', true);
|
||||
} else {
|
||||
$('#is_lgbtq').prop('checked', false);
|
||||
}
|
||||
|
||||
console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||
|
||||
|
||||
|
||||
if (res.data.policy_type_id == '4' || res.data.policy_type_id == '5') {
|
||||
|
||||
|
||||
@ -147,13 +147,12 @@
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
|
||||
<?php
|
||||
if (
|
||||
(in_array($employee['emp_status'], ['draft', 'enrolled']) && in_array($employee['status'], ['draft', 'enrolled'])) ||
|
||||
($employee['status'] == 'active' && $employee['emp_status'] == 'active' && (empty($employee['email_corporate']) || empty($employee['mobile'])))
|
||||
) {
|
||||
?>
|
||||
|
||||
<?php
|
||||
if
|
||||
(
|
||||
(in_array($employee['emp_status'], ['draft', 'enrolled', 'active']) && in_array($employee['status'], ['draft', 'enrolled', 'active']))
|
||||
) {
|
||||
?>
|
||||
<a class="dropdown-item" onclick="get_emp_master_data_for_update(this, '<?= $employee['employee_id'];?>', '<?= $employee['status'];?>')" ><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user