Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
3c2513103b
@ -94,12 +94,12 @@ define('EVENT_PRIORITY_NORMAL', 100);
|
||||
define('EVENT_PRIORITY_HIGH', 10);
|
||||
|
||||
/**
|
||||
* @User Role Constant
|
||||
* @User Teams Constant
|
||||
*/
|
||||
|
||||
define('ENROLLMENT_TEAM_ID', '1');
|
||||
define('CLAIMS_TEAM_ID', '2');
|
||||
define('BUSINESS_TEAM_ID', '3');
|
||||
// define('BUSINESS_TEAM_ID', '3'); // old don't delete it
|
||||
define('BUSINESS_TEAM_ID', '4'); // 25th OCT 2025 changed
|
||||
define('FINANCE_TEAM_ID', '4');
|
||||
define('SALES_TEAM_ID', '5');
|
||||
define('MANAGEMENT_TEAM_ID', '6');
|
||||
@ -107,9 +107,8 @@ define('BUSINESS_SUPPORT_TEAM_ID', '7');
|
||||
define('POS_TEAM_ID', '8');
|
||||
|
||||
/**
|
||||
* @User Teams Constant
|
||||
* @User Role Constant
|
||||
*/
|
||||
|
||||
define('ADMIN_ROLE_ID', 1);
|
||||
define('MANAGER_ROLE_ID', 2);
|
||||
define('ACCOUNT_MANAGER_ROLE_ID', 3);
|
||||
|
||||
@ -48,6 +48,7 @@ $routes->get("frontend_content", "AppContentManagementController::frontend_conte
|
||||
$routes->get('/test', 'Home::index');
|
||||
$routes->get('/check_gemini', 'Home::check_Gemini');
|
||||
$routes->get('/check_gemini2', 'Home::check_gemini_2');
|
||||
$routes->get('/checkPolicyDoc', 'Home::checkPolicyDoc');
|
||||
$routes->get('/login', 'LoginController::index'); ///auth/google
|
||||
$routes->get('/loginPos', 'LoginController::loginPos'); //login POS team
|
||||
$routes->post('/getVerifyPosMobileNo', 'LoginController::getVerifyPosMobileNo'); //Verify POS team mobile no
|
||||
@ -212,6 +213,7 @@ $routes->group("/master", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("edit", "MasterController::editInsurerBranch");
|
||||
$routes->get("editget/(:any)", "MasterController::editInsurerGet/$1");
|
||||
$routes->get("list/(:any)", "MasterController::insurerBranchList/$1");
|
||||
$routes->post("getList", "MasterController::getInsurerBranchList");
|
||||
$routes->get("remove/(:any)", "MasterController::removeInsurerBranch/$1");
|
||||
});
|
||||
});
|
||||
@ -395,6 +397,11 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get('getMemberDataExcelFileErrors', 'LeadsController::getMemberDataExcelFileErrors');
|
||||
$routes->post('savePlacementDataAndValidateMemberDataFile', 'LeadsController::savePlacementDataAndValidateMemberDataFile');
|
||||
$routes->get('checkMemberDataFileValidationStatus', 'LeadsController::checkMemberDataFileValidationStatus');
|
||||
$routes->match(['get', 'post', 'delete'], 'nhanceBranchMaster', 'MasterController::nhanceBranchMaster');
|
||||
$routes->match(['get', 'post', 'delete'], 'vehicleTypeMaster', 'MasterController::vehicleTypeMaster');
|
||||
$routes->match(['get', 'post', 'delete'], 'rtoMaster', 'MasterController::rtoMaster');
|
||||
$routes->get('checkDuplicateCdAccount', 'MasterController::checkDuplicateCdAccount');
|
||||
$routes->get('proceedExcelFileDataValidation', 'EmployeeController::proceedExcelFileDataValidation');
|
||||
});
|
||||
|
||||
$routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
|
||||
@ -420,13 +427,14 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("remove/(:any)", "PolicyTransactionController::removeCDMaster/$1");
|
||||
});
|
||||
|
||||
$routes->group("report", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->match(['get', 'post'],"list", "PolicyTransactionController::reportBDS");
|
||||
$routes->get("report-varience-list", "PolicyTransactionController::reportVarience");
|
||||
$routes->get("report-business-list", "PolicyTransactionController::reportBusinessList");
|
||||
$routes->get("report-finance-list", "PolicyTransactionController::reportFinanceList");
|
||||
$routes->get("report-outstanding-list", "PolicyTransactionController::reportOutstanding");
|
||||
});
|
||||
$routes->group("report", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->match(['get', 'post'],"list", "PolicyTransactionController::reportBDS");
|
||||
$routes->match(['get', 'post'],"list_new", "PolicyTransactionController::reportBDSNew");
|
||||
$routes->get("report-varience-list", "PolicyTransactionController::reportVarience");
|
||||
$routes->get("report-business-list", "PolicyTransactionController::reportBusinessList");
|
||||
$routes->get("report-finance-list", "PolicyTransactionController::reportFinanceList");
|
||||
$routes->get("report-outstanding-list", "PolicyTransactionController::reportOutstanding");
|
||||
});
|
||||
|
||||
$routes->group("statement", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("list", "PolicyTransactionController::statementList");
|
||||
@ -493,12 +501,16 @@ $routes->cli('cli/sendMailWithAutoQuery','TicketController::sendMailWithAutoQuer
|
||||
//Employee login api's
|
||||
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
|
||||
$routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||
$routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyMpin");
|
||||
$routes->post("/employeeRest/checkMpin", "RestAuthenticationController::checkMpin");
|
||||
$routes->post("/employeeRest/verifyEmployeeEmailId", "RestAuthenticationController::verifyEmployeeWithEmailId");
|
||||
$routes->post("/employeeRest/updateEmpOTP", "RestAuthenticationController::updateEmpOTP");
|
||||
|
||||
$routes->post("employeeRest/saveMpin", "RestAuthenticationController::saveMpin");
|
||||
$routes->post("employeeRest/updateMpin", "RestAuthenticationController::updateMpin");
|
||||
$routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyMpin");
|
||||
$routes->post("/employeeRest/checkMpin", "RestAuthenticationController::checkMpin");
|
||||
$routes->post("/employeeRest/updateEmpMPIN", "RestAuthenticationController::updateEmpMPIN");
|
||||
$routes->post("employeeRest/forgotMPIN", "RestAuthenticationController::forgotMPIN");
|
||||
$routes->post("employeeRest/updateMobileNumber", "RestAuthenticationController::updateMobileNumber");
|
||||
// $routes->post("/employeeRest/saveMpin", "RestAuthenticationController::saveMpin");
|
||||
|
||||
|
||||
@ -522,8 +534,6 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
|
||||
});
|
||||
|
||||
$routes->post("employeeRest/saveMpin", "RestAuthenticationController::saveMpin");
|
||||
$routes->post("employeeRest/updateMpin", "RestAuthenticationController::updateMpin");
|
||||
$routes->post("employeeRest/getPostEmployeeDataForAuth", "RestAuthenticationController::getPostEmployeeDataForAuth");
|
||||
// $routes->post("logHrActivity", "RestAuthenticationController::logHrActivity");
|
||||
|
||||
@ -734,6 +744,9 @@ $routes->group('test', function($routes) {
|
||||
$routes->get('mapping_client_id_and_branch_id','TestingController::mapping_client_id_and_branch_id');
|
||||
$routes->get('membervalidation', 'TestingController::membervalidation');
|
||||
$routes->get('generateExcel', 'TestingController::generateExcel');
|
||||
$routes->get('logo_renaming','TestingController::logo_renaming');
|
||||
// $routes->get('createDefaultMailTempalteInDB','TestingController::createDefaultMailTempalteInCrossDB');
|
||||
// $routes->get('createDefaultMailTempalteInSameDB','TestingController::createDefaultMailTempalteInSameDB');
|
||||
});
|
||||
$routes->cli('cli/testcli', 'TestingController::testcli');
|
||||
|
||||
|
||||
@ -181,7 +181,7 @@ class BDSReportController extends AdminController
|
||||
'Client' => 'client'
|
||||
];
|
||||
|
||||
$data['page_name'] = "IRBA Report";
|
||||
$data['page_name'] = "IRDA Report";
|
||||
|
||||
return $this->loadLayout('irba_report', $data);
|
||||
} else {
|
||||
@ -202,9 +202,11 @@ class BDSReportController extends AdminController
|
||||
$viewData = [];
|
||||
}
|
||||
|
||||
$view_name = "bds_report_Insurer_wise_Data" ;
|
||||
|
||||
|
||||
$html = view('bds_report_Insurer_wise_Data', $viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
return $this->respond(['status' => true, 'html' => $html , 'view_name' => $view_name], 200);
|
||||
} else if ($report_type == 'bap') {
|
||||
|
||||
$life = $category == 'life' ? 1 : 0;
|
||||
@ -217,33 +219,40 @@ class BDSReportController extends AdminController
|
||||
$viewData = [];
|
||||
}
|
||||
|
||||
$view_name = "bds_report_bap_wise_data";
|
||||
|
||||
$html = view('bds_report_bap_wise_data', $viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
return $this->respond(['status' => true, 'html' => $html , 'view_name' => $view_name], 200);
|
||||
} else if ($report_type == 'bapInsurer') {
|
||||
|
||||
//Condition for BAP Insurer wise date
|
||||
$category = $category == 'life' ? 1 : 0;
|
||||
$viewData['data'] = $this->getBAPInsurerData($category, $fromDate, $toDate);
|
||||
|
||||
$view_name = "irda_bap_insurer_report_list";
|
||||
|
||||
$html = view('irda_bap_insurer_report_list', $viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
return $this->respond(['status' => true, 'html' => $html , 'view_name' => $view_name], 200);
|
||||
} else if ($report_type == 'bapClient') {
|
||||
|
||||
//Condition for BAP Client wise date
|
||||
$category = $category == 'life' ? 1 : 0;
|
||||
$viewData['data'] = $this->getBAPClientData($category, $fromDate, $toDate);
|
||||
|
||||
$view_name = "irda_bap_client_report_list";
|
||||
|
||||
$html = view('irda_bap_client_report_list', $viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
return $this->respond(['status' => true, 'html' => $html , 'view_name' => $view_name], 200);
|
||||
} else if ($report_type == 'client') {
|
||||
|
||||
//Condition for Client wise date
|
||||
$category = $category == 'life' ? 1 : 0;
|
||||
$viewData['data'] = $this->getClientData($category, $fromDate, $toDate);
|
||||
|
||||
$view_name = "irda_client_report_list";
|
||||
|
||||
$html = view('irda_client_report_list', $viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
return $this->respond(['status' => true, 'html' => $html , 'view_name' => $view_name], 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -932,12 +941,19 @@ class BDSReportController extends AdminController
|
||||
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];
|
||||
$data['renewal_data'] = $this->policyTransactionModel->getRenewalReportData($fromDate, $toDate, $client_type, $client_id, $issuer);
|
||||
// print_r($data); die;
|
||||
$view_name = "bds_renewal_report_list";
|
||||
$html = view('bds_renewal_report_list', $data);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
return $this->respond(['status' => true, 'html' => $html , 'view_name' => $view_name], 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function bdsTATReport()
|
||||
/** New arugument Introduced Named as "$isInternalCalled"
|
||||
* Functional Based called means $isInternalCalled is True.
|
||||
* Output returning as Array
|
||||
* Route Based called means $isInternalCalled is False. becoz this is External Call
|
||||
* Output returning as Page
|
||||
*/
|
||||
public function bdsTATReport($isInternalCalled = false)
|
||||
{
|
||||
$sql = "
|
||||
SELECT
|
||||
@ -1010,9 +1026,8 @@ class BDSReportController extends AdminController
|
||||
// dd(db_connect()->getLastQuery(),$result);
|
||||
$data['data'] = $result;
|
||||
// dd($data, get_role_id(), ENROLLMENT_TEAM_ID, user_team());
|
||||
// return $this->loadLayout('bds_tat_wise_report', $data);
|
||||
|
||||
return $result;
|
||||
if ($isInternalCalled) { return $result; }
|
||||
return $this->loadLayout('bds_tat_wise_report', $data);
|
||||
}
|
||||
|
||||
public function accountMangerStatusBDSReport()
|
||||
@ -1141,7 +1156,7 @@ class BDSReportController extends AdminController
|
||||
if ($report_type == 1){
|
||||
|
||||
$data['page_title'] = "BDS TAT Report";
|
||||
$data['data'] = $this->bdsTATReport();
|
||||
$data['data'] = $this->bdsTATReport(true); // Functional Based called means True
|
||||
}else if ($report_type == 2){
|
||||
|
||||
$data['page_title'] = "Account Manager Status Report";
|
||||
|
||||
@ -518,7 +518,6 @@ class ClientController extends AdminController
|
||||
|
||||
public function updateEmpAndPolicyStatus()
|
||||
{
|
||||
|
||||
$return = $this->clientPolicyModel->updateStatus();
|
||||
$this->myLogger->logme('error', 'Client Policy Status Update Count: {data}', ['data' => $return['client']]);
|
||||
$this->myLogger->logme('error', 'Employee Policy Status Update Count: {data}', ['data' => $return['emp']]);
|
||||
@ -869,6 +868,12 @@ class ClientController extends AdminController
|
||||
|
||||
if ($insert) {
|
||||
$client_data = $this->clientModel->where(['id' => $insert, 'is_active' => 1])->first();
|
||||
|
||||
$client_id = $insert;
|
||||
$default_template_creation = $this->createDefaultMailTemplate($client_id , $client_data);
|
||||
if($default_template_creation == false){
|
||||
$this->myLogger->logme('error', 'Default Mail Template Creation Failed for Client ID: {data}', ['data' => $client_id]);
|
||||
}
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $client_data], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||
@ -1613,7 +1618,7 @@ class ClientController extends AdminController
|
||||
|
||||
if ($update) {
|
||||
|
||||
$policy_transaction_update = $this->deactivatePolicyTransactionsPolicy($id);
|
||||
// $policy_transaction_update = $this->deactivatePolicyTransactionsPolicy($id);
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200], 200);
|
||||
} else {
|
||||
@ -4669,7 +4674,7 @@ class ClientController extends AdminController
|
||||
// Additional logic for non-individual clients (client_type != 2)
|
||||
$branch_insert = null;
|
||||
if ($client_type != 2) {
|
||||
$unit[] = $postData['short_name'] . '-' . $postData['branch_code'] ?? 001;
|
||||
$unit[] = $postData['short_name'] . '-' . ($postData['branch_code'] ?? 001);
|
||||
$branch_data = [
|
||||
'client_id' => $client_insert,
|
||||
'branch_name' => $postData['branch_name'],
|
||||
@ -4816,6 +4821,7 @@ class ClientController extends AdminController
|
||||
'vehicle_no' => $data['vehicle_no'],
|
||||
'type' => $data['type'],
|
||||
'rc' => $data['rc'],
|
||||
'rto_id' => $data['rto_id'],
|
||||
'branch_id' => $branch_insert,
|
||||
'owner' => $client_insert,
|
||||
];
|
||||
@ -4861,6 +4867,7 @@ class ClientController extends AdminController
|
||||
'vehicle_no' => $data['vehicle_no'],
|
||||
'type' => $data['type'],
|
||||
'rc' => $data['rc'],
|
||||
'rto_id' => $data['rto_id'],
|
||||
'branch_id' => $data['branch_id'] ?? null,
|
||||
'owner' => $data['owner'],
|
||||
];
|
||||
@ -5064,10 +5071,12 @@ class ClientController extends AdminController
|
||||
->where('policy_no', $policy_no)
|
||||
->countAllResults();
|
||||
|
||||
$client_policy_data = $this->clientPolicyModel->where('is_active', 1)->where('policy_status', 1)->where('policy_no', trim($policy_no))->first();
|
||||
|
||||
if ($data > 0) {
|
||||
return $this->respond(['status' => true, 'message' => 'This policy number is already linked to another client', 'data' => $data, 'code' => 409, 'received_data' => $received_data], 200);
|
||||
return $this->respond(['status' => true, 'message' => 'This policy number is already linked to another client', 'data' => $data, 'code' => 409, 'received_data' => $received_data, 'client_policy_id' => $client_policy_data['id'] ?? null], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'message' => 'No Data Found', 'code' => 404, 'received_data' => $received_data], 200);
|
||||
return $this->respond(['status' => false, 'message' => 'No Data Found', 'code' => 404, 'received_data' => $received_data, 'client_policy_id' => $client_policy_data['id'] ?? null], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5636,11 +5645,11 @@ class ClientController extends AdminController
|
||||
|
||||
public function sendextraparam()
|
||||
{
|
||||
// $data = db_connect()->table('jobs')->where('id', 1677)->get()->getRowArray();
|
||||
// // dd($data);
|
||||
// $return = $this->updatePolicyTransactionDataWhileClinetPolicyUpdate(json_decode($data['payload'], true));
|
||||
// dd($return);
|
||||
// die;
|
||||
// $data = db_connect()->table('jobs')->where('id', 1677)->get()->getRowArray();
|
||||
// // dd($data);
|
||||
// $return = $this->updatePolicyTransactionDataWhileClinetPolicyUpdate(json_decode($data['payload'], true));
|
||||
// dd($return);
|
||||
// die;
|
||||
|
||||
// $employeeController = new EmployeeController();
|
||||
// $employeeController->truncateFileData('633');
|
||||
@ -5658,20 +5667,21 @@ class ClientController extends AdminController
|
||||
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
|
||||
|
||||
$empServiceController = new EmployeeServiceController();
|
||||
$res = $empServiceController->excelFileFormatValidation(['file_id' => '2055']);
|
||||
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '1126']);
|
||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '865']);
|
||||
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 726]);
|
||||
// $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]);
|
||||
// $res = $empServiceController->employeesEnrollmentInsert(['file_id' => 836]);
|
||||
// $res = $empServiceController->employeesSIEnhanceProcess(['file_id' => '978']);
|
||||
// $res = $empServiceController->employeesSIEnhanceProcess(['file_id' => '1131']);
|
||||
// $res = $empServiceController->employeeDisembark(['file_id' => '1681']);
|
||||
// $res = $empServiceController->employeesCorrectionProcess(['file_id' => '2033']);
|
||||
dd($res);
|
||||
// $res = $empServiceController->employeesCorrectionProcess(['file_id' => '2033']);
|
||||
// $res = $empServiceController->compareMemberDataAndInceptionData(['file_id' => '1126']);
|
||||
// dd($res);
|
||||
|
||||
$EmployeeMultiEventServiceController = new EmployeeMultiEventServiceController();
|
||||
// $res = $EmployeeMultiEventServiceController->constructMultiEventData(['file_id' => '1069']);
|
||||
// $res = $EmployeeMultiEventServiceController->excelMultieventFileFormateValidation(['file_id' => '1084']);
|
||||
// $res = $EmployeeMultiEventServiceController->excelMultieventFileDataValidation(['file_id' => '1069']);
|
||||
// $res = $EmployeeMultiEventServiceController->excelMultieventFileFormateValidation(['file_id' => '2373']);
|
||||
// $res = $EmployeeMultiEventServiceController->excelMultieventFileDataValidation(['file_id' => '2373']);
|
||||
// $res = $EmployeeMultiEventServiceController->excelMultieventFileOnBoard(['file_id' => '1069']);
|
||||
// dd($res);
|
||||
|
||||
@ -5726,8 +5736,8 @@ class ClientController extends AdminController
|
||||
// $res = $EmpDataServiceController->generateExcelForCorrection($batch_data);
|
||||
// $res = $EmpDataServiceController->importInceptionFileValidation(['file_id' => 1932]); die;
|
||||
// $res = $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live
|
||||
// $res = $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 1199]); //for live
|
||||
// $res = $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 2496]); //for live
|
||||
// $res = $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 387]); //for live
|
||||
// $res = $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 387]); //for live
|
||||
// $res = $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 214]); //for live
|
||||
// $res = $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 310]); dd($res);//for live
|
||||
// $res = $EmpDataServiceController->getInceptionBasePremium(["13332","13333","13334","13335","13336"]); dd($res);//for live
|
||||
@ -7305,7 +7315,9 @@ class ClientController extends AdminController
|
||||
$pre_hr_id = $db2->table('client_branch cb')
|
||||
->select('lc.id')
|
||||
->join('level_contacts lc','lc.ref_id = cb.id')
|
||||
->where('cb.id',$pre_branch_id)->where('cb.is_Active',1)->where('lc.is_Active',1)->get()->getResultArray()[0]['id']??"";
|
||||
->where('lc.contact_type', 'client')
|
||||
->where('cb.id',$pre_branch_id)->where('cb.is_Active',1)
|
||||
->where('lc.is_Active',1)->get()->getResultArray()[0]['id']??"";
|
||||
return $pre_hr_id;
|
||||
}
|
||||
|
||||
@ -7725,9 +7737,110 @@ class ClientController extends AdminController
|
||||
return true;
|
||||
}
|
||||
|
||||
public function createDefaultMailTemplate($client_id , $client_data){
|
||||
|
||||
$member_welcome_mail_template = $this->notificationModel->where('client_id',NULL)->where('template_name','member_welcome_mail')->get()->getResultArray()[0]??[];
|
||||
|
||||
$member_remainder_mail_template = $this->notificationModel->where('client_id',NULL)->where('template_name','member_reminder_mail')->get()->getResultArray()[0]??[];
|
||||
|
||||
$member_review_and_summary_mail_template = $this->notificationModel->where('client_id',NULL)->where('template_name','member_review_and_summary_mail')->get()->getResultArray()[0]??[];
|
||||
|
||||
$member_ecard_mail_template = $this->notificationModel->where('client_id',NULL)->where('template_name','member_ecard_mail')->get()->getResultArray()[0]??[];
|
||||
|
||||
$member_common_mail_template = $this->notificationModel->where('client_id',NULL)->where('template_name','member_common_mail')->get()->getResultArray()[0]??[];
|
||||
|
||||
$default_member_welcome_mail_template = [
|
||||
'client_id' => $client_id,
|
||||
'template_name' => 'member_welcome_mail',
|
||||
'subject' => $member_welcome_mail_template['subject']??'',
|
||||
'mail_content' => $member_welcome_mail_template['mail_content']??'',
|
||||
'mail_content_json'=> $member_welcome_mail_template['mail_content_json']??'',
|
||||
|
||||
'created_by' => get_session_userid(),
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_by' => null,
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
'mail_content_copy'=> null
|
||||
];
|
||||
|
||||
$default_member_remainder_mail_template = [
|
||||
'client_id' => $client_id,
|
||||
'template_name' => 'member_reminder_mail',
|
||||
'subject' => $member_remainder_mail_template['subject']??'',
|
||||
'mail_content' => $member_remainder_mail_template['mail_content']??'',
|
||||
'mail_content_json'=> $member_remainder_mail_template['mail_content_json']??'',
|
||||
|
||||
'created_by' => get_session_userid(),
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_by' => null,
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
'mail_content_copy'=> null
|
||||
];
|
||||
|
||||
$default_member_review_and_summary_mail_template = [
|
||||
'client_id' => $client_id,
|
||||
'template_name' => 'member_review_and_summary_mail',
|
||||
'subject' => $member_review_and_summary_mail_template['subject']??'',
|
||||
'mail_content' => $member_review_and_summary_mail_template['mail_content']??'',
|
||||
'mail_content_json'=> $member_review_and_summary_mail_template['mail_content_json']??'',
|
||||
|
||||
'created_by' => get_session_userid(),
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_by' => null,
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
'mail_content_copy'=> null
|
||||
];
|
||||
|
||||
$default_member_ecard_mail_template = [
|
||||
'client_id' => $client_id,
|
||||
'template_name' => 'member_ecard_mail',
|
||||
'subject' => $member_ecard_mail_template['subject']??'',
|
||||
'mail_content' => $member_ecard_mail_template['mail_content']??'',
|
||||
'mail_content_json'=> $member_ecard_mail_template['mail_content_json']??'',
|
||||
|
||||
'created_by' => get_session_userid(),
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_by' => null,
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
'mail_content_copy'=> null
|
||||
];
|
||||
|
||||
$default_member_common_mail_template = [
|
||||
'client_id' => $client_id,
|
||||
'template_name' => 'member_common_mail',
|
||||
'subject' => $member_common_mail_template['subject']??'',
|
||||
'mail_content' => $member_common_mail_template['mail_content']??'',
|
||||
'mail_content_json'=> $member_common_mail_template['mail_content_json']??'',
|
||||
|
||||
'created_by' => get_session_userid(),
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_by' => null,
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
'mail_content_copy'=> null
|
||||
];
|
||||
|
||||
$this->myLogger->logme('error', 'Default Mail Template Data ' . json_encode([
|
||||
$default_member_welcome_mail_template,
|
||||
$default_member_remainder_mail_template,
|
||||
$default_member_review_and_summary_mail_template
|
||||
], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
|
||||
|
||||
|
||||
|
||||
$default_templates_inserted = $this->notificationModel->insertBatch([
|
||||
$default_member_welcome_mail_template,
|
||||
$default_member_remainder_mail_template,
|
||||
$default_member_review_and_summary_mail_template,
|
||||
$default_member_ecard_mail_template,
|
||||
$default_member_common_mail_template
|
||||
]);
|
||||
|
||||
|
||||
return $default_templates_inserted ? true : false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -225,20 +225,23 @@ class DashboardController extends AdminController
|
||||
|
||||
$pendingActionsController = new PendingActionsController;
|
||||
$pendingActionsData = $pendingActionsController->getPendingActionsForDashBoard();
|
||||
$businessTeamData = $this->policyTransactionModel->getBusinessReportList();
|
||||
$financeTeamData = $this->policyTransactionModel->getFinanceReportList();
|
||||
$businessTeamStatusData = $this->data_construct_for_bds($businessTeamData);
|
||||
$financeTeamStatusData = $this->data_construct_for_bds($financeTeamData);
|
||||
|
||||
//BDS dashboard data
|
||||
// $businessTeamData = $this->policyTransactionModel->getBusinessReportList();
|
||||
// $financeTeamData = $this->policyTransactionModel->getFinanceReportList();
|
||||
// $businessTeamStatusData = $this->data_construct_for_bds($businessTeamData);
|
||||
// $financeTeamStatusData = $this->data_construct_for_bds($financeTeamData);
|
||||
$businessTeamData = [];
|
||||
$financeTeamData = [];
|
||||
$businessTeamStatusData = [];
|
||||
$financeTeamStatusData = [];
|
||||
|
||||
$data['client_branch_emp_list'] = $results;
|
||||
$session = \Config\Services::session();
|
||||
$session->set('enrollment_data', json_encode($data));
|
||||
|
||||
// echo "<pre>";
|
||||
$data['pendingActionsData'] = $pendingActionsData;
|
||||
$data['businessTeamCount'] = count($businessTeamData) ?? 0;
|
||||
// dd($businessTeamData);
|
||||
$data['financeTeamCount'] = count($financeTeamData) ?? 0;
|
||||
$data['businessTeamStatusData'] = $businessTeamStatusData;
|
||||
$data['financeTeamStatusData'] = $financeTeamStatusData;
|
||||
|
||||
@ -121,16 +121,17 @@ class EmpDataServiceController extends BaseController
|
||||
$insert = $this->batchFileModel->insert($data);
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
|
||||
if ($insert) {
|
||||
foreach ($objects as $value) {
|
||||
$batch_list_data['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||
$batch_list_data['emp_policy_id'] = $value->primaryKey ?? $value->employee_policy_id ?? '';
|
||||
$batch_list_data['created_by'] = get_session_userid();
|
||||
$this->batchListModel->insert($batch_list_data);
|
||||
}
|
||||
}
|
||||
// if ($insert) {
|
||||
// foreach ($objects as $value) {
|
||||
// $batch_list_data['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||
// $batch_list_data['emp_policy_id'] = $value->primaryKey ?? $value->employee_policy_id ?? '';
|
||||
// $batch_list_data['created_by'] = get_session_userid();
|
||||
// $this->batchListModel->insert($batch_list_data);
|
||||
// }
|
||||
// }
|
||||
|
||||
return true;
|
||||
return $insert;
|
||||
// return true;
|
||||
}
|
||||
|
||||
|
||||
@ -526,8 +527,8 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $objects]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $objects]]);
|
||||
|
||||
|
||||
// If batch operation is successful
|
||||
@ -640,7 +641,13 @@ class EmpDataServiceController extends BaseController
|
||||
foreach ($ids as $key => $id) {
|
||||
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||
if ($group_key) {
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set('status', 'inprogress')->update();
|
||||
|
||||
$endorsement_update_data['status'] = 'inprogress';
|
||||
if( $export_data['insurer_or_tpa'] == 'tpa'){
|
||||
$endorsement_update_data['is_tpa_export'] = $return ?? generate_random_string(4);
|
||||
}
|
||||
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set($endorsement_update_data)->update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -794,13 +801,21 @@ class EmpDataServiceController extends BaseController
|
||||
$success = generate_excel($excel_data_info['header'], $excel_data_info['data'], $tempFile);
|
||||
|
||||
if ($success) {
|
||||
|
||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||
if ($return) {
|
||||
|
||||
foreach ($ids as $key => $id) {
|
||||
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||
if ($group_key) {
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set('status', 'inprogress')->update();
|
||||
|
||||
$endorsement_update_data['status'] = 'inprogress';
|
||||
|
||||
if( $export_data['insurer_or_tpa'] == 'tpa'){
|
||||
$endorsement_update_data['is_tpa_export'] = $return ?? generate_random_string(4);
|
||||
}
|
||||
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set($endorsement_update_data)->update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -914,7 +929,11 @@ class EmpDataServiceController extends BaseController
|
||||
foreach ($ids as $key => $id) {
|
||||
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||
if ($group_key) {
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set('status', 'inprogress')->update();
|
||||
$endorsement_update_data['status'] = 'inprogress';
|
||||
if( $export_data['insurer_or_tpa'] == 'tpa'){
|
||||
$endorsement_update_data['is_tpa_export'] = $return ?? generate_random_string(4);
|
||||
}
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set($endorsement_update_data)->update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1002,12 +1021,12 @@ class EmpDataServiceController extends BaseController
|
||||
return 5;
|
||||
}
|
||||
|
||||
$cash_balance = $this->clientDepositModel
|
||||
->where('cd_ac_pk', $policy_details['cd_ac_pk'])
|
||||
// ->where('cd_ac_no', $policy_details['cd_ac_no'])
|
||||
->where('is_active', 1)
|
||||
->orderBy('id', 'DESC')
|
||||
->first();
|
||||
$cash_balance = $this->clientDepositModel
|
||||
->where('cd_ac_pk', $policy_details['cd_ac_pk'])
|
||||
// ->where('cd_ac_no', $policy_details['cd_ac_no'])
|
||||
->where('is_active', 1)
|
||||
->orderBy('id', 'DESC')
|
||||
->first();
|
||||
|
||||
if ($cash_balance == null) {
|
||||
$balance = $this->CDMasterModel
|
||||
@ -1028,7 +1047,7 @@ class EmpDataServiceController extends BaseController
|
||||
$totals = round($totals, 2);
|
||||
|
||||
|
||||
if($export_data['insurer_or_tpa'] != 'tpa')// check overal emp premium amt with cd balance only for insurer export, not tpa export
|
||||
if($export_data['insurer_or_tpa'] != 'tpa')// check overal emp premium amt with cd balance only for insurer export, not tpa export
|
||||
{
|
||||
if (!empty($cash_balance)) {
|
||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
||||
@ -1112,6 +1131,7 @@ class EmpDataServiceController extends BaseController
|
||||
$export_data['batch_code'] = session()->get('batch_code');
|
||||
$export_data['created_by'] = get_session_userid();
|
||||
|
||||
$insert = null;
|
||||
if($value == 'addition'){
|
||||
|
||||
if(!empty($additionData) && $additionData != null){
|
||||
@ -1125,8 +1145,8 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $additionData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $additionData]]);
|
||||
|
||||
}
|
||||
|
||||
@ -1143,8 +1163,8 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $inceptionData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $inceptionData]]);
|
||||
}
|
||||
|
||||
}else if($value == 'dependent_addition'){
|
||||
@ -1160,8 +1180,8 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $dependentAdditionData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $dependentAdditionData]]);
|
||||
}
|
||||
}else if($value == 'deletion'){
|
||||
|
||||
@ -1176,8 +1196,8 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $deletionData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $deletionData]]);
|
||||
}
|
||||
|
||||
}else if($value == 'si_enhancement'){
|
||||
@ -1193,8 +1213,8 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $enhancementData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $enhancementData]]);
|
||||
}
|
||||
|
||||
}else if($value == 'correction'){
|
||||
@ -1210,11 +1230,43 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $correctionData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $correctionData]]);
|
||||
}
|
||||
}
|
||||
|
||||
if(in_array($value, ['deletion', 'si_enhancement', 'correction']) && $insert){
|
||||
|
||||
$endorsement_data_for_update = [];
|
||||
|
||||
if($value == 'deletion'){
|
||||
$endorsement_data_for_update = $deletionData;
|
||||
}else if($value == 'si_enhancement') {
|
||||
$endorsement_data_for_update = $enhancementData;
|
||||
}else if($value == 'correction') {
|
||||
$endorsement_data_for_update = $correctionData;
|
||||
}
|
||||
|
||||
foreach ($endorsement_data_for_update as $key => $edata) {
|
||||
|
||||
$id = $edata->id ?? $edata->endorsement_primarykey ?? null;
|
||||
|
||||
if($id){
|
||||
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||
if ($group_key) {
|
||||
|
||||
$endorsement_update_data['status'] = 'inprogress';
|
||||
if( $export_data['insurer_or_tpa'] == 'tpa'){
|
||||
$endorsement_update_data['is_tpa_export'] = $return ?? generate_random_string(4);
|
||||
}
|
||||
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set($endorsement_update_data)->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
session()->remove('batch_code');
|
||||
@ -1457,6 +1509,47 @@ class EmpDataServiceController extends BaseController
|
||||
//get the employee data for excel file validation
|
||||
$employee_data = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($ref_data, 1);
|
||||
|
||||
// ----------------- CD BALANCE CHECK ---------------------------------------------------------------------------
|
||||
|
||||
$cash_balance = $this->clientDepositModel
|
||||
->where('cd_ac_pk', $client_policy_data['cd_ac_pk'])
|
||||
->where('is_active', 1)
|
||||
->orderBy('id', 'DESC')
|
||||
->first();
|
||||
|
||||
if ($cash_balance == null) {
|
||||
$balance = $this->CDMasterModel
|
||||
->where('client_id', $file['client_id'])
|
||||
->where('insurer_id', $client_policy_data['insurer_id'])
|
||||
->where('id', $client_policy_data['cd_ac_pk'])
|
||||
->first();
|
||||
|
||||
$cash_balance['balance'] = $balance['opening_bal'];
|
||||
}
|
||||
|
||||
// Calculate the total amount from the objects
|
||||
$totals = 0;
|
||||
foreach ($employee_data as $item) {
|
||||
$totals = $totals + $item['total'];
|
||||
}
|
||||
|
||||
$totals = round($totals, 2);
|
||||
|
||||
//check CD amt insufficient only insurer, not tpa
|
||||
if($file['insurer_or_tpa'] == 'insurer')
|
||||
{
|
||||
if (!empty($cash_balance)) {
|
||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
|
||||
$this->batchFileModel->where('id', $file_id)->set(['status' => 'failed-7', 'error_data' => 'Insufficient deposit balance. Available CD Balance: ' . $cash_balance['balance'] . ', Excel Total Amount: ' . $totals])->update();
|
||||
return ['status' => 'error', 'message' => 'Insufficient deposit balance. Available CD Balance: ' . $cash_balance['balance'] . ', Required Amount: ' . $totals];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- END CD BALANCE CHECK ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
if ($employee_data == null || empty($employee_data)) {
|
||||
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
@ -2500,7 +2593,8 @@ class EmpDataServiceController extends BaseController
|
||||
// dd($value[8]);
|
||||
|
||||
$emp_details[] = array('id' => $result['emp_id'], $result['field_name'] => $value[8]);
|
||||
$endorsement_details[] = array('group_key' => $result['group_key'], 'id' => $result['id'], 'endorsement_id' => $value[10], 'status' => 'complete');
|
||||
// $endorsement_details[] = array('group_key' => $result['group_key'], 'id' => $result['id'], 'endorsement_id' => $value[10], 'status' => 'complete');
|
||||
$endorsement_details[] = array('group_key' => $result['group_key'], 'endorsement_id' => $value[10], 'status' => 'complete');
|
||||
}
|
||||
|
||||
}
|
||||
@ -2569,6 +2663,7 @@ class EmpDataServiceController extends BaseController
|
||||
'event_type' => $file['event_type'],
|
||||
];
|
||||
|
||||
$client_policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
|
||||
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
|
||||
|
||||
@ -2691,6 +2786,47 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
// dd($endorsement_data, $excel_data);
|
||||
|
||||
// ----------------- CD BALANCE CHECK ---------------------------------------------------------------------------
|
||||
|
||||
$cash_balance = $this->clientDepositModel
|
||||
->where('cd_ac_pk', $client_policy_data['cd_ac_pk'])
|
||||
->where('is_active', 1)
|
||||
->orderBy('id', 'DESC')
|
||||
->first();
|
||||
|
||||
if ($cash_balance == null) {
|
||||
$balance = $this->CDMasterModel
|
||||
->where('client_id', $file['client_id'])
|
||||
->where('insurer_id', $client_policy_data['insurer_id'])
|
||||
->where('id', $client_policy_data['cd_ac_pk'])
|
||||
->first();
|
||||
|
||||
$cash_balance['balance'] = $balance['opening_bal'];
|
||||
}
|
||||
|
||||
// Calculate the total amount from the objects
|
||||
$totals = 0;
|
||||
foreach ($endorsement_data as $item) {
|
||||
$totals = $totals + $item['total'];
|
||||
}
|
||||
|
||||
$totals = round($totals, 2);
|
||||
|
||||
//check CD amt insufficient only insurer, not tpa
|
||||
if($file['insurer_or_tpa'] == 'insurer')
|
||||
{
|
||||
if (!empty($cash_balance)) {
|
||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
|
||||
$this->batchFileModel->where('id', $file_id)->set(['status' => 'failed-7', 'error_data' => 'Insufficient deposit balance. Available CD Balance: ' . $cash_balance['balance'] . ', Excel Total Amount: ' . $totals])->update();
|
||||
return ['status' => 'error', 'message' => 'Insufficient deposit balance. Available CD Balance: ' . $cash_balance['balance'] . ', Required Amount: ' . $totals];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- END CD BALANCE CHECK ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
if ($endorsement_data == null || empty($endorsement_data)) {
|
||||
|
||||
@ -3089,7 +3225,8 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$emp_policy_ids[] = array('id' => $result['emp_policy_id'], 'is_active' => 0);
|
||||
$employeeIds[] = $result['emp_policy_id'];
|
||||
$endorsement_details[] = array('id' => $result['id'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[19], 'status' => 'complete');
|
||||
// $endorsement_details[] = array('id' => $result['id'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[19], 'status' => 'complete');
|
||||
$endorsement_details[] = array('group_key' => $result['group_key'], 'endorsement_id' => $value[19], 'status' => 'complete');
|
||||
if (strtolower($result['relationship']) == 'self') {
|
||||
$no_of_insured[] = ['emp_id' => $result['emp_id'], 'emp_code' => $result['emp_code'], 'emp_name' => $result['emp_name'] ];
|
||||
}else{
|
||||
@ -3119,6 +3256,7 @@ class EmpDataServiceController extends BaseController
|
||||
$empData['rata_premimum'] = $value[16];
|
||||
$empData['gst'] = $value[17];
|
||||
$empData['created_by'] = $user_id;
|
||||
$empData['old_basic_cover_si'] = $value[9];
|
||||
|
||||
$emp_details[] = $empData;
|
||||
}
|
||||
@ -3139,14 +3277,46 @@ class EmpDataServiceController extends BaseController
|
||||
// $insertedIds[] = $startId + $i;
|
||||
// }
|
||||
|
||||
// $insertedIds = [];
|
||||
// foreach ($emp_details as $emp) {
|
||||
|
||||
// $old_si_value = $emp['old_basic_cover_si'];
|
||||
// $new_si_value = $emp['basic_cover_si'];
|
||||
|
||||
// if($old_si_value < $new_si_value){
|
||||
// $insertedIds['si_adjustment'] = 2;
|
||||
// }else{
|
||||
// $insertedIds['si_adjustment'] = 1;
|
||||
// }
|
||||
|
||||
// unset($emp['old_basic_cover_si']);
|
||||
// $insertedIds['pk'] = $this->employeePolicyModel->insert($emp);
|
||||
// }
|
||||
|
||||
$insertedIds = [];
|
||||
foreach ($emp_details as $emp) {
|
||||
$insertedIds[] = $this->employeePolicyModel->insert($emp);
|
||||
}
|
||||
|
||||
// dd($insertedIds);
|
||||
$old_si_value = $emp['old_basic_cover_si'];
|
||||
$new_si_value = $emp['basic_cover_si'];
|
||||
|
||||
$this->employeePolicyModel->bulkUpdateForEndorsement($endorsement_details);
|
||||
// Determine SI adjustment type
|
||||
$si_adjustment = ($old_si_value < $new_si_value) ? 1 : 2;
|
||||
|
||||
unset($emp['old_basic_cover_si']);
|
||||
|
||||
// Insert and store PK with adjustment info
|
||||
$pk = $this->employeePolicyModel->insert($emp);
|
||||
|
||||
$insertedIds[] = [
|
||||
'pk' => $pk,
|
||||
'si_adjustment' => $si_adjustment
|
||||
];
|
||||
} // dd($insertedIds);
|
||||
|
||||
// update si enhancement endorsement complete
|
||||
$this->empEndorsementModel->updateBatch($endorsement_details, 'group_key');
|
||||
|
||||
// $this->employeePolicyModel->bulkUpdateForEndorsement($endorsement_details); // do not remove this
|
||||
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||
}
|
||||
|
||||
@ -3158,7 +3328,6 @@ class EmpDataServiceController extends BaseController
|
||||
'amount' => $rounded_totals,
|
||||
]);
|
||||
|
||||
|
||||
$this->myLogger->logme('error', 'SI Enhancement Update Endorsement ID -- Employee count : {data}', ['data' => $emp_count]);
|
||||
$this->myLogger->logme('error', 'SI Enhancement Update Endorsement ID -- Batch File status : {data}', ['data' => $status_val]);
|
||||
|
||||
@ -4195,60 +4364,164 @@ class EmpDataServiceController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
public function cashDepositCalculationForSIEnhancement($arrayData)
|
||||
{
|
||||
// return $arrayData;
|
||||
// public function cashDepositCalculationForSIEnhancement($arrayData)
|
||||
// {
|
||||
// // return $arrayData;
|
||||
|
||||
// if (!empty($arrayData)) {
|
||||
|
||||
// $client_branch_data = $this->clientBranchModel->where('id', $arrayData['client_branch_id'])->first();
|
||||
// $units = json_decode($client_branch_data['units']);
|
||||
|
||||
// foreach($units as $unit)
|
||||
// {
|
||||
|
||||
// $amount = $this->employeePolicyModel->query("
|
||||
// SELECT SUM(rata_premimum + gst) AS total_sum
|
||||
// FROM employee_polices
|
||||
// JOIN employees ON employees.id = employee_polices.employee_id
|
||||
// WHERE employees.unit = '$unit'
|
||||
// AND employee_polices.id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||
// ")->getRow();
|
||||
|
||||
// if($amount){
|
||||
|
||||
// $insurer_id = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
|
||||
// $description = 'The following amount of ' . round($amount->total_sum, 2) . ' has been credited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event_name']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
||||
|
||||
// $data = [
|
||||
|
||||
// 'amount' => $amount->total_sum,
|
||||
// 'sub_type_id' => 4,
|
||||
// 'client_id' => $arrayData['client_id'],
|
||||
// 'client_policy_id' => $arrayData['client_policy_id'],
|
||||
// 'endorsement_no' => $arrayData['endorsement_no'] ?? null,
|
||||
// 'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
|
||||
// 'insurer_id' => $insurer_id['insurer_id'],
|
||||
// 'unit' => $unit,
|
||||
// 'description' => $description,
|
||||
// 'transaction_type' => 'Debit',
|
||||
// 'updated_by' => $arrayData['user_id'],
|
||||
// 'event_name' => $arrayData['event_name'],
|
||||
// 'is_active' => 1,
|
||||
// 'cd_ac_pk' => $insurer_id['cd_ac_pk']
|
||||
// ];
|
||||
|
||||
// $response = DepositHelper::saveDeposit($data, $arrayData['user_id']);
|
||||
// }
|
||||
// }
|
||||
|
||||
// $msg = "SI Enhancement Cash Deposite Updated Successfully ";
|
||||
// return [$msg];
|
||||
|
||||
// // print_r($response);
|
||||
// // $query = $this->employeePolicyModel->getLastQuery();
|
||||
// // echo $query . "<br>";
|
||||
|
||||
// } else {
|
||||
// return 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
public function cashDepositCalculationForSIEnhancement($arrayData)
|
||||
{
|
||||
if (!empty($arrayData)) {
|
||||
|
||||
$client_branch_data = $this->clientBranchModel->where('id', $arrayData['client_branch_id'])->first();
|
||||
$units = json_decode($client_branch_data['units']);
|
||||
|
||||
foreach($units as $unit)
|
||||
{
|
||||
foreach ($units as $unit) {
|
||||
|
||||
$amount = $this->employeePolicyModel->query("
|
||||
SELECT SUM(rata_premimum + gst) AS total_sum
|
||||
FROM employee_polices
|
||||
JOIN employees ON employees.id = employee_polices.employee_id
|
||||
WHERE employees.unit = '$unit'
|
||||
AND employee_polices.id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||
")->getRow();
|
||||
$si_enhance_amt = 0;
|
||||
$si_decrease_amt = 0;
|
||||
|
||||
if($amount){
|
||||
foreach ($arrayData['employeeIds'] as $value) {
|
||||
|
||||
$insurer_id = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
|
||||
$description = 'The following amount of ' . round($amount->total_sum, 2) . ' has been credited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event_name']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
||||
// If $value is an array, get its elements; otherwise, assign defaults
|
||||
$pk = is_array($value) ? ($value['pk'] ?? null) : $value;
|
||||
$si_adjustment = is_array($value) ? ($value['si_adjustment'] ?? null) : $value;
|
||||
|
||||
$query = "
|
||||
SELECT SUM(rata_premimum + gst) AS total_sum
|
||||
FROM employee_polices
|
||||
JOIN employees ON employees.id = employee_polices.employee_id
|
||||
WHERE employees.unit = '{$unit}'
|
||||
AND employee_polices.id = '{$pk}'
|
||||
";
|
||||
|
||||
$amount = $this->employeePolicyModel->query($query)->getRow();
|
||||
|
||||
if ($amount && $amount->total_sum > 0) {
|
||||
if ($si_adjustment == 2) {
|
||||
$si_decrease_amt += $amount->total_sum;
|
||||
} else {
|
||||
$si_enhance_amt += $amount->total_sum;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Save Enhancement amount
|
||||
if ($si_enhance_amt > 0) {
|
||||
$policy_data = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
|
||||
|
||||
$description = 'An amount of ' . round($si_enhance_amt, 2) .
|
||||
' has been debited for ' . $arrayData['count'] . ' employees under ' .
|
||||
remove_underscore_capitalize_first_letter($arrayData['event_name']) .
|
||||
' in ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
||||
|
||||
$data = [
|
||||
|
||||
'amount' => $amount->total_sum,
|
||||
'amount' => round($si_enhance_amt, 2),
|
||||
'sub_type_id' => 4,
|
||||
'client_id' => $arrayData['client_id'],
|
||||
'client_policy_id' => $arrayData['client_policy_id'],
|
||||
'endorsement_no' => $arrayData['endorsement_no'] ?? null,
|
||||
'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
|
||||
'insurer_id' => $insurer_id['insurer_id'],
|
||||
'insurer_id' => $policy_data['insurer_id'],
|
||||
'unit' => $unit,
|
||||
'description' => $description,
|
||||
'transaction_type' => 'Debit',
|
||||
'updated_by' => $arrayData['user_id'],
|
||||
'event_name' => $arrayData['event_name'],
|
||||
'is_active' => 1,
|
||||
'cd_ac_pk' => $insurer_id['cd_ac_pk']
|
||||
'cd_ac_pk' => $policy_data['cd_ac_pk']
|
||||
];
|
||||
|
||||
$response = DepositHelper::saveDeposit($data, $arrayData['user_id']);
|
||||
DepositHelper::saveDeposit($data, $arrayData['user_id']);
|
||||
}
|
||||
|
||||
// Save Decrease amount
|
||||
if ($si_decrease_amt > 0) {
|
||||
|
||||
$policy_data = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
|
||||
|
||||
$description = 'An amount of ' . round($si_decrease_amt, 2) .
|
||||
' has been credited for ' . $arrayData['count'] . ' employees due to a decrease in Sum Insured (SI) under ' .
|
||||
remove_underscore_capitalize_first_letter($arrayData['event_name']) .
|
||||
' in ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
||||
|
||||
$data = [
|
||||
'amount' => round($si_decrease_amt, 2),
|
||||
'sub_type_id' => 4,
|
||||
'client_id' => $arrayData['client_id'],
|
||||
'client_policy_id' => $arrayData['client_policy_id'],
|
||||
'endorsement_no' => $arrayData['endorsement_no'] ?? null,
|
||||
'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
|
||||
'insurer_id' => $policy_data['insurer_id'],
|
||||
'unit' => $unit,
|
||||
'description' => $description,
|
||||
'transaction_type' => 'Credit',
|
||||
'updated_by' => $arrayData['user_id'],
|
||||
'event_name' => $arrayData['event_name'],
|
||||
'is_active' => 1,
|
||||
'cd_ac_pk' => $policy_data['cd_ac_pk']
|
||||
];
|
||||
|
||||
DepositHelper::saveDeposit($data, $arrayData['user_id']);
|
||||
}
|
||||
}
|
||||
|
||||
$msg = "SI Enhancement Cash Deposite Updated Successfully ";
|
||||
$msg = "SI Adjustment Cash Deposit Updated Successfully.";
|
||||
return [$msg];
|
||||
|
||||
// print_r($response);
|
||||
// $query = $this->employeePolicyModel->getLastQuery();
|
||||
// echo $query . "<br>";
|
||||
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@ -4866,6 +5139,7 @@ class EmpDataServiceController extends BaseController
|
||||
'tpa_id' => $filedata['tpa_id'],
|
||||
'endorsement_no' => $endorsement_no,
|
||||
'file_id' => $enrollment_file_id,
|
||||
'batch_file_id' => $file_id,
|
||||
'endorsement_type' => $filedata['event_type'],
|
||||
'created_by' => $filedata['created_by'],
|
||||
]);
|
||||
|
||||
@ -35,7 +35,8 @@ use App\Controllers\JobWorker;
|
||||
use App\Controllers\Jobs\SubJob;
|
||||
use App\Controllers\EmployeeServiceController;
|
||||
use App\Controllers\EmpDataServiceController;
|
||||
|
||||
use App\Models\LeadsModel;
|
||||
use App\Models\ThzMasterModel;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
@ -171,7 +172,7 @@ class EmployeeController extends AdminController
|
||||
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||
} else {
|
||||
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $file['reason']], 200);
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $file['reason'], 'is_comparison_skipped' => $file['is_comparison_skipped'], 'policy_id' => $file['policy_id']], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -388,13 +389,11 @@ class EmployeeController extends AdminController
|
||||
batch_files.client_branch_id,
|
||||
|
||||
CASE
|
||||
WHEN batch_files.status = 'partially success' OR batch_files.status = 'in-progress-partially' THEN
|
||||
batch_files.error_data
|
||||
ELSE
|
||||
NULL
|
||||
WHEN batch_files.status IN ('partially success', 'in-progress-partially', 'failed-7')
|
||||
THEN batch_files.error_data
|
||||
ELSE NULL
|
||||
END AS error_data,
|
||||
|
||||
|
||||
clients.short_name as client_short_name,
|
||||
client_branch.branch_name,
|
||||
client_policy.policy_no,
|
||||
@ -669,6 +668,11 @@ class EmployeeController extends AdminController
|
||||
|
||||
} else if ($actions == 'import') {
|
||||
|
||||
if($insurer_or_tpa == "tpa" && in_array($event_type, ['correction', 'deletion', 'si_enhancement'])){
|
||||
session()->setFlashdata('error', "TPA upload is not applicable for this event.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
$batch_data['file'] = $this->request->getFile('import_file_data');
|
||||
$file = $this->request->getFile('import_file_data');
|
||||
|
||||
@ -1193,7 +1197,7 @@ class EmployeeController extends AdminController
|
||||
|
||||
// --------------- For E-Card Download -----------------------------------------------------------------------------------------------------
|
||||
|
||||
//E-CARD DOWNLOAD FUNCTION USING HTML PRINT
|
||||
//E-CARD DOWNLOAD FUNCTION USING HTML PRINT ( Not in use ) do not delete
|
||||
public function generateIDCardForEmployeeUsingHtml($rand_string, $people = 0)
|
||||
{
|
||||
// dd($rand_string, $people);
|
||||
@ -1418,7 +1422,7 @@ class EmployeeController extends AdminController
|
||||
echo $htmlContent;
|
||||
}
|
||||
|
||||
//E-CARD DOWNLOAD FUNCTION USING DOM PDF ( CURRENTLY USING THIS )
|
||||
//E-CARD DOWNLOAD FUNCTION USING DOM PDF ( CURRENTLY USING THIS ) Dompdf
|
||||
public function generateIDCardForEmployee($rand_string, $people = 0, $mode = 0)
|
||||
{
|
||||
// dd($rand_string, $people);
|
||||
@ -1470,7 +1474,8 @@ class EmployeeController extends AdminController
|
||||
// Step 3: Prepare template path
|
||||
$template_data_path = WRITEPATH . 'e_card_template/';
|
||||
// $tpa_short_name = strtolower(str_replace(' ', '_', $get_emp_code_and_client_policy_id['short_name'])) . '.html';
|
||||
$tpa_short_name = 'common.html';
|
||||
// $tpa_short_name = 'common.html';
|
||||
$tpa_short_name = 'new_ecard.html';
|
||||
$final_path = $template_data_path . $tpa_short_name;
|
||||
|
||||
$this->myLogger->logme('error', 'Checking if template file exists at: ' . $final_path);
|
||||
@ -1494,6 +1499,7 @@ class EmployeeController extends AdminController
|
||||
$value['back_card'] = "Nhance_Ecard_working_1_Back.png";
|
||||
|
||||
$placeholders = [
|
||||
|
||||
'{CLIENT_NAME}' => $value['client_name'],
|
||||
'{TPA_ID}' => $value['tpa_id'],
|
||||
'{NAME}' => $value['name'],
|
||||
@ -1505,9 +1511,6 @@ class EmployeeController extends AdminController
|
||||
'{POLICY_START_DATE}' => date('d-M-Y', strtotime($value['policy_start_date'])),
|
||||
'{POLICY_NO}' => $value['policy_no'],
|
||||
'{INSURER_NAME}' => strtoupper($value['insurer_name']),
|
||||
'{INSURER_LOGO}' => base_url() . 'public/uploads/logo/' . $value['insurer_logo'],
|
||||
'{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['front_card'],
|
||||
'{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['back_card'],
|
||||
'{EMP_ID}' => $value['emp_code'],
|
||||
'{SI_AMT}' => $value['basic_cover_si'],
|
||||
'{CORPORATE_NAME}' => $value['client_name'],
|
||||
@ -1515,18 +1518,38 @@ class EmployeeController extends AdminController
|
||||
'{TPA_NAME}' => $value['tpa_name'],
|
||||
'{INSURER_BRANCH}' => $value['insurer_branch_city'],
|
||||
'{RELATION}' => $value['relationship'],
|
||||
'{TPA_LOGO}' => base_url() . 'public/uploads/logo/' . $value['tpa_logo'],
|
||||
'{MEDI_USER}' => base_url() . 'public/e_card_imgs/medi_uesr.jpg',
|
||||
'{MEDI_INSURER}' => base_url() . 'public/e_card_imgs/Magma.png',
|
||||
'{MEDI_BARCODE}' => base_url() . 'public/e_card_imgs/borcode.jpeg',
|
||||
'{QR_ANDROID}' => base_url() . 'public/e_card_imgs/android.png',
|
||||
'{QR_IOS}' => base_url() . 'public/e_card_imgs/ios.png',
|
||||
'{QR_ANDROID_2}' => base_url() . 'public/e_card_imgs/play_store.png',
|
||||
'{QR_IOS_2}' => base_url() . 'public/e_card_imgs/appstore.png',
|
||||
|
||||
'{TPA_LOGO}' => getFileIfExists('uploads/logo/' . $value['tpa_logo']),
|
||||
'{MEDI_USER}' => getFileIfExists('e_card_imgs/medi_uesr.jpg'),
|
||||
'{MEDI_INSURER}' => getFileIfExists('e_card_imgs/Magma.png'),
|
||||
'{MEDI_BARCODE}' => getFileIfExists('e_card_imgs/borcode.jpeg'),
|
||||
'{QR_ANDROID}' => getFileIfExists('e_card_imgs/android.png'),
|
||||
'{QR_IOS}' => getFileIfExists('e_card_imgs/ios.png'),
|
||||
'{QR_ANDROID_2}' => getFileIfExists('e_card_imgs/play_store.png'),
|
||||
'{QR_IOS_2}' => getFileIfExists('e_card_imgs/appstore.png'),
|
||||
'{NHANCE_N_LOGO}' => getFileIfExists('assets/images/Nhance_Favi.png'),
|
||||
'{INSURER_LOGO}' => getFileIfExists('uploads/logo/' . $value['insurer_logo']),
|
||||
'{FRONT_CARD}' => getFileIfExists('uploads/template_bg/' . $value['front_card']),
|
||||
'{BACK_CARD}' => getFileIfExists('uploads/template_bg/' . $value['back_card']),
|
||||
|
||||
// '{TPA_LOGO}' => base_url() . 'public/uploads/logo/' . $value['tpa_logo'],
|
||||
// '{MEDI_USER}' => base_url() . 'public/e_card_imgs/medi_uesr.jpg',
|
||||
// '{MEDI_INSURER}' => base_url() . 'public/e_card_imgs/Magma.png',
|
||||
// '{MEDI_BARCODE}' => base_url() . 'public/e_card_imgs/borcode.jpeg',
|
||||
// '{QR_ANDROID}' => base_url() . 'public/e_card_imgs/android.png',
|
||||
// '{QR_IOS}' => base_url() . 'public/e_card_imgs/ios.png',
|
||||
// '{QR_ANDROID_2}' => base_url() . 'public/e_card_imgs/play_store.png',
|
||||
// '{QR_IOS_2}' => base_url() . 'public/e_card_imgs/appstore.png',
|
||||
// '{NHANCE_N_LOGO}' => base_url() . 'public/assets/images/Nhance_Favi.png',
|
||||
// '{INSURER_LOGO}' => base_url() . 'public/uploads/logo/' . $value['insurer_logo'],
|
||||
// '{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['front_card'],
|
||||
// '{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['back_card'],
|
||||
|
||||
];
|
||||
|
||||
$placeholders['{LEVELS}'] = $this->generateAcmAndMForEcard($client_id);
|
||||
|
||||
$placeholders['{NETWORK_HOSPITAL}'] = $this->generateNetworkHospitalsForEcard($value['network_hospitals']);
|
||||
|
||||
foreach ($placeholders as $placeholder => $replaceValue) {
|
||||
$htmlContent = str_replace($placeholder, $replaceValue, $htmlContent);
|
||||
}
|
||||
@ -1534,13 +1557,23 @@ class EmployeeController extends AdminController
|
||||
$html .= $htmlContent;
|
||||
}
|
||||
|
||||
// return $html;
|
||||
// DomPdf
|
||||
$options = new Options();
|
||||
$options->set('isRemoteEnabled', true);
|
||||
$options->set('isHtml5ParserEnabled', true);
|
||||
|
||||
$dompdf = new Dompdf($options);
|
||||
$dompdf->loadHtml('<style>@page { margin: 0; }</style>' . $html); // remove the margin
|
||||
// $dompdf->loadHtml('<style>@page { margin: 0; }</style>' . $html); // remove the margin
|
||||
$dompdf->loadHtml('
|
||||
<style>
|
||||
@page { margin: 0; }
|
||||
@import url("https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap");
|
||||
body { font-family: "Lato", sans-serif !important; }
|
||||
</style>
|
||||
' . $html
|
||||
);
|
||||
|
||||
$dompdf->setPaper('A4', 'portrait');
|
||||
$dompdf->render();
|
||||
|
||||
@ -2939,20 +2972,43 @@ class EmployeeController extends AdminController
|
||||
|
||||
// Generate the HTML content
|
||||
$html = '';
|
||||
|
||||
|
||||
$level_index = 1;
|
||||
foreach ($levels as $level => $contacts) {
|
||||
$displayLevel = $level == 3 ? 1 : 2; // Switch levels for display
|
||||
$html .= '<br>Level ' . $displayLevel . '<br>';
|
||||
if($level_index == 1){
|
||||
$html .= 'Level ' . $displayLevel . '<br>';
|
||||
}else{
|
||||
$html .= '<br> Level ' . $displayLevel . '<br>';
|
||||
}
|
||||
foreach ($contacts as $index => $contact) {
|
||||
$html .= ($index + 1) . '. ' . $contact['first_name'] . ' / ' . $contact['mobile'] . ' / ' . $contact['email'] . '<br>';
|
||||
}
|
||||
$level_index++;
|
||||
}
|
||||
|
||||
$html .= '<br><br><br>';
|
||||
$html .= '<br>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function generateNetworkHospitalsForEcard($network_hospitals)
|
||||
{
|
||||
$html = "";
|
||||
if (!empty($network_hospitals)) {
|
||||
$html = '<div style="margin-top: 6px;">
|
||||
<span style="font-weight: 500;">Network Hospital:</span>
|
||||
<a href="' . $network_hospitals . '" target="_blank" style="color: #0066cc; text-decoration: none; display: inline-block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;">' . $network_hospitals . '</a>
|
||||
</div>';
|
||||
}
|
||||
|
||||
// For debugging
|
||||
// print_r($html); die;
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
public function getBatchFileData()
|
||||
{
|
||||
$file_id = $this->request->getGet('file_id');
|
||||
@ -3065,7 +3121,8 @@ class EmployeeController extends AdminController
|
||||
} else {
|
||||
$text = "create";
|
||||
$data['created_by'] = get_session_userid();
|
||||
$this->thzMasterModel->insert($data);
|
||||
$thzMasterModel = new ThzMasterModel();
|
||||
$thzMasterModel->insert($data);
|
||||
$insertID = $this->partnerEndorsementRequestModel->insertID();
|
||||
$result = true;
|
||||
}
|
||||
@ -3095,5 +3152,58 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
// function for skip the Inception and Member data validation
|
||||
public function proceedExcelFileDataValidation()
|
||||
{
|
||||
$file_id = $this->request->getGet('file_id');
|
||||
$not_skiped = $this->request->getGet('not_skiped') ?? null;
|
||||
$this->myLogger->logme('error', json_encode($this->request->getGet() ?? []));
|
||||
|
||||
|
||||
if(!empty($not_skiped)){
|
||||
$file_model = new FileModel();
|
||||
$file_model->where('id', $file_id)->set(['is_comparison_skipped' => 0])->update();
|
||||
$message = "Inception and Member data comparision continuted by the user id : " . get_session_userid();
|
||||
$this->myLogger->logme('error', $message);
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Inception and Member data comparision continued'], 200);
|
||||
}
|
||||
|
||||
if(!empty($file_id)){
|
||||
|
||||
$r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
|
||||
$message = "Inception and Member data comparision skiped successfully by the user id : " . get_session_userid();
|
||||
$this->myLogger->logme('error', $message);
|
||||
|
||||
$file_model = new FileModel();
|
||||
$file_model->where('id', $file_id)->set(['is_comparison_skipped' => 1])->update();
|
||||
|
||||
$policy_id = $this->request->getGet('policy_id') ?? null;
|
||||
|
||||
if ($policy_id) {
|
||||
|
||||
$client_policy_data = $this->clientPolicyModel->where('id', $policy_id)->first();
|
||||
|
||||
if (!empty($client_policy_data) && isset($client_policy_data['is_from_lead'])) {
|
||||
$lead_id = $client_policy_data['is_from_lead'];
|
||||
|
||||
if (!empty($lead_id)) {
|
||||
$lead_model = new LeadsModel();
|
||||
$lead_model->where('id', $lead_id)->set(['policy_with_correction' => 1])->update();
|
||||
} else {
|
||||
$this->myLogger->logme('error', 'Lead ID missing for policy ID: ' . $policy_id);
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', 'No client policy data found for policy ID: ' . $policy_id);
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', 'Policy ID not provided in GET request.');
|
||||
}
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Inception and Member data comparision skiped successfully!'], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'code' => 500, 'message' => 'Failed to skip the comparison!'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use Kint\Kint;
|
||||
|
||||
use App\Helpers\ExcelSanitizeHelper;
|
||||
use App\Models\LeadsModel;
|
||||
|
||||
class EmployeeMultiEventServiceController extends BaseController
|
||||
{
|
||||
@ -140,7 +141,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
'is_mandatory' => ['I', 'A', 'DA'],
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => ['M', 'F']
|
||||
'allowed_values' => ['M', 'F', 'Male', 'Female', 'male', 'female']
|
||||
],
|
||||
'relationship' => [
|
||||
'col_idx' => 5,
|
||||
@ -524,7 +525,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
'is_mandatory' => ['I', 'A', 'DA', 'E'],
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => ['M', 'F']
|
||||
'allowed_values' => ['M', 'F', 'Male', 'Female', 'male', 'female']
|
||||
],
|
||||
'relationship' => [
|
||||
'col_idx' => 5,
|
||||
@ -889,8 +890,108 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
|
||||
protected $member_data_excel_columns = [
|
||||
'sno' => [
|
||||
'col_idx' => 0,
|
||||
'col_cell_name' => 'A',
|
||||
'col_name' => 'Sl no',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'emp_code' => [
|
||||
'col_idx' => 1,
|
||||
'col_cell_name' => 'B',
|
||||
'col_name' => 'Emp Code',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'name' => [
|
||||
'col_idx' => 2,
|
||||
'col_cell_name' => 'C',
|
||||
'col_name' => 'Name',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'relationship' => [
|
||||
'col_idx' => 3,
|
||||
'col_cell_name' => 'D',
|
||||
'col_name' => 'Relationship',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => [
|
||||
'Self', 'Spouse', 'Son', 'Daughter', 'Father', 'Mother',
|
||||
'Father-in-law', 'Mother-in-law',
|
||||
'self', 'spouse', 'son', 'daughter', 'father', 'mother',
|
||||
'father-in-law', 'mother-in-law'
|
||||
],
|
||||
'custom' => 'check_relationship_for_member_data',
|
||||
'params' => ['row', 'relationship', 'columns_to_check']
|
||||
],
|
||||
'gender' => [
|
||||
'col_idx' => 4,
|
||||
'col_cell_name' => 'E',
|
||||
'col_name' => 'Gender',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => ['M', 'F', 'Male', 'Female', 'male', 'female']
|
||||
],
|
||||
'dob' => [
|
||||
'col_idx' => 5,
|
||||
'col_cell_name' => 'F',
|
||||
'col_name' => 'DOB',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => 'd-M-Y',
|
||||
'allowed_values' => null,
|
||||
'age_validation' => true,
|
||||
// 'custom' => 'check_dob_diff',
|
||||
// 'params' => ['row', 'relationship', 'default_age_ratio', 'policy_details']
|
||||
],
|
||||
'age' => [
|
||||
'col_idx' => 6,
|
||||
'col_cell_name' => 'G',
|
||||
'col_name' => 'Age',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'int',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'email' => [
|
||||
'col_idx' => 7,
|
||||
'col_cell_name' => 'H',
|
||||
'col_name' => 'Email',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'mobile' => [
|
||||
'col_idx' => 8,
|
||||
'col_cell_name' => 'I',
|
||||
'col_name' => 'Mobile',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'si' => [
|
||||
'col_idx' => 9,
|
||||
'col_cell_name' => 'J',
|
||||
'col_name' => 'SI',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'int',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -914,6 +1015,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
|
||||
public function excelMultieventFileFormateValidation($params)
|
||||
{
|
||||
$this->myLogger->logme('error', 'Excel Multievent File Formate Validation function START: ' . json_encode(['params' => $params]));
|
||||
helper('excel_util_helper');
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->fileModel->find($file_id);
|
||||
@ -991,48 +1093,59 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "inception";
|
||||
$params["file_path"] = $file_paths['inception'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$this->myLogger->logme('error', 'Inception file formate validation result: ' . json_encode(['params' => $params]));
|
||||
if (isset($error['error_data']) && count($error['error_data']) == 0) {
|
||||
$error[] = $this->compareMemberDataAndInceptionData($params);
|
||||
$this->myLogger->logme('error', 'compare Member Data And Inception Data file validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
}
|
||||
|
||||
//addition
|
||||
if(isset($file_paths['addition']) && $file_paths['addition'] != "" && $file_paths['addition'] != null){
|
||||
$params["action"] = "addition";
|
||||
$params["file_path"] = $file_paths['addition'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$params["action"] = "addition";
|
||||
$params["file_path"] = $file_paths['addition'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$this->myLogger->logme('error', 'Addition file formate validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//dependent_addition
|
||||
if(isset($file_paths['dependent_addition']) && $file_paths['dependent_addition'] != "" && $file_paths['dependent_addition'] != null){
|
||||
$params["action"] = "dependent_addition";
|
||||
$params["file_path"] = $file_paths['dependent_addition'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$params["action"] = "dependent_addition";
|
||||
$params["file_path"] = $file_paths['dependent_addition'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$this->myLogger->logme('error', 'Dependent Addition file formate validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//deletion
|
||||
if(isset($file_paths['deletion']) && $file_paths['deletion'] != "" && $file_paths['deletion'] != null){
|
||||
$params["action"] = "deletion";
|
||||
$params["file_path"] = $file_paths['deletion'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$params["action"] = "deletion";
|
||||
$params["file_path"] = $file_paths['deletion'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$this->myLogger->logme('error', 'Deletion file formate validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//correction
|
||||
if(isset($file_paths['correction']) && $file_paths['correction'] != "" && $file_paths['correction'] != null){
|
||||
$params["action"] = "correction";
|
||||
$params["file_path"] = $file_paths['correction'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$params["action"] = "correction";
|
||||
$params["file_path"] = $file_paths['correction'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$this->myLogger->logme('error', 'Correction file formate validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//si_enhancement
|
||||
if(isset($file_paths['si_enhancement']) && $file_paths['si_enhancement'] != "" && $file_paths['si_enhancement'] != null){
|
||||
$params["action"] = "si_enhancement";
|
||||
$params["file_path"] = $file_paths['si_enhancement'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$params["action"] = "si_enhancement";
|
||||
$params["file_path"] = $file_paths['si_enhancement'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$this->myLogger->logme('error', 'SI Enhancement file formate validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//missed_inception
|
||||
if(isset($file_paths['missed_inception']) && $file_paths['missed_inception'] != "" && $file_paths['missed_inception'] != null){
|
||||
$params["action"] = "missed_inception";
|
||||
$params["file_path"] = $file_paths['missed_inception'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$params["action"] = "missed_inception";
|
||||
$params["file_path"] = $file_paths['missed_inception'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$this->myLogger->logme('error', 'Missed Inception file formate validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
$error_type = 1;
|
||||
@ -1041,6 +1154,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
|
||||
if (isset($error['error_data']) && count($error['error_data']) == 0) {
|
||||
$r = Jobs::addJob(['job_name' => 'excelMultieventFileDataValidation', 'payload' => $params]);
|
||||
$this->myLogger->logme('error', 'excelMultieventFileDataValidation job pushed');
|
||||
} else {
|
||||
|
||||
// $error['error_summary'] = array_count_values($error['error_summary']);
|
||||
@ -1056,12 +1170,16 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$this->unlinkFiles($file_paths);
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', 'Excel Multievent File Formate Validation function END');
|
||||
|
||||
return ($error);
|
||||
|
||||
}
|
||||
|
||||
public function excelMultieventFileDataValidation($params)
|
||||
{
|
||||
$this->myLogger->logme('error', 'Excel Multievent File Data Validation function START: ' . json_encode(['params' => $params]));
|
||||
|
||||
helper('excel_util_helper');
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->fileModel->find($file_id);
|
||||
@ -1091,6 +1209,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "inception";
|
||||
$params["file_path"] = $file_paths['inception'];
|
||||
$error[] = $this->excelFileDataValidation($params);
|
||||
$this->myLogger->logme('error', 'Inception file Data validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//addition
|
||||
@ -1098,6 +1217,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "addition";
|
||||
$params["file_path"] = $file_paths['addition'];
|
||||
$error[] = $this->excelFileDataValidation($params);
|
||||
$this->myLogger->logme('error', 'Addition file validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//dependent_addition
|
||||
@ -1105,6 +1225,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "dependent_addition";
|
||||
$params["file_path"] = $file_paths['dependent_addition'];
|
||||
$error[] = $this->excelFileDataValidation($params);
|
||||
$this->myLogger->logme('error', 'Dependent Addition file Data validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//deletion
|
||||
@ -1112,6 +1233,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "deletion";
|
||||
$params["file_path"] = $file_paths['deletion'];
|
||||
$error[] = $this->excelFileDataValidation($params);
|
||||
$this->myLogger->logme('error', 'Deletion file Data validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//correction
|
||||
@ -1119,6 +1241,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "correction";
|
||||
$params["file_path"] = $file_paths['correction'];
|
||||
$error[] = $this->excelFileDataValidation($params);
|
||||
$this->myLogger->logme('error', 'Correction file Data validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//si_enhancement
|
||||
@ -1126,6 +1249,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "si_enhancement";
|
||||
$params["file_path"] = $file_paths['si_enhancement'];
|
||||
$error[] = $this->excelFileDataValidation($params);
|
||||
$this->myLogger->logme('error', 'SI Enhancement file Data validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//missed_inception
|
||||
@ -1133,6 +1257,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "missed_inception";
|
||||
$params["file_path"] = $file_paths['missed_inception'];
|
||||
$error[] = $this->excelFileDataValidation($params);
|
||||
$this->myLogger->logme('error', 'Missed Inception file Data validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
$error_type = 2;
|
||||
@ -1141,6 +1266,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
|
||||
if (isset($error['error_data']) && count($error['error_data']) == 0) {
|
||||
$r = Jobs::addJob(['job_name' => 'excelMultieventFileOnBoard', 'payload' => $params]);
|
||||
$this->myLogger->logme('error', 'excelMultieventFileOnBoard job pushed');
|
||||
} else {
|
||||
|
||||
// $error['error_summary'] = array_count_values($error['error_summary']);
|
||||
@ -1153,11 +1279,15 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$this->setPullNotification($this->getFileMetaDataByFileId($file_id, 'failure'));
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', 'Excel Multievent File Data Validation function END');
|
||||
|
||||
return ($error);
|
||||
}
|
||||
|
||||
public function excelMultieventFileOnBoard($params)
|
||||
{
|
||||
$this->myLogger->logme('error', 'Excel Multievent File Onboard function START: ' . json_encode(['params' => $params]));
|
||||
|
||||
helper('excel_util_helper');
|
||||
|
||||
$file_id = $params['file_id'];
|
||||
@ -1187,6 +1317,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "inception";
|
||||
$params["file_path"] = $file_paths['inception'];
|
||||
$error['inception'] = $this->employeesOnboardPreprocess($params);
|
||||
$this->myLogger->logme('error', 'Inception file Onboard Process result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//addition
|
||||
@ -1194,6 +1325,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "addition";
|
||||
$params["file_path"] = $file_paths['addition'];
|
||||
$error['addition'] = $this->employeesOnboardPreprocess($params);
|
||||
$this->myLogger->logme('error', 'Addition file Onboard Process result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//dependent_addition
|
||||
@ -1201,6 +1333,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "dependent_addition";
|
||||
$params["file_path"] = $file_paths['dependent_addition'];
|
||||
$error['dependent_addition'] = $this->employeesOnboardPreprocess($params);
|
||||
$this->myLogger->logme('error', 'Dependent Addition file Onboard Process result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//missed_inception
|
||||
@ -1208,6 +1341,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "missed_inception";
|
||||
$params["file_path"] = $file_paths['missed_inception'];
|
||||
$error['missed_inception'] = $this->employeesOnboardPreprocess($params);
|
||||
$this->myLogger->logme('error', 'Missed Inception file Onboard Process result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//deletion
|
||||
@ -1215,6 +1349,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "deletion";
|
||||
$params["file_path"] = $file_paths['deletion'];
|
||||
$error['deletion'] = $this->employeeDisembark($params);
|
||||
$this->myLogger->logme('error', 'Deletion file Onboard Process result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//correction
|
||||
@ -1222,6 +1357,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "correction";
|
||||
$params["file_path"] = $file_paths['correction'];
|
||||
$error['correction'] = $this->employeesCorrectionProcess($params);
|
||||
$this->myLogger->logme('error', 'Correction file Onboard Process result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//si_enhancement
|
||||
@ -1229,11 +1365,13 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "si_enhancement";
|
||||
$params["file_path"] = $file_paths['si_enhancement'];
|
||||
$error['si_enhancement'] = $this->employeesSIEnhanceProcess($params);
|
||||
$this->myLogger->logme('error', 'SI Enhancement file Onboard Process result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
$this->fileModel->where('id', $file_id)->set(['status' => 'success', 'reason' => ''])->update();
|
||||
$this->myLogger->logme("error", $file['action'].': {file_id} uploaded success', ['file_id' => $file_id]);
|
||||
$this->setPullNotification($this->getFileMetaDataByFileId($file_id, 'success'));
|
||||
$this->myLogger->logme('error', 'Excel Multievent File Onboard function END');
|
||||
|
||||
//After insert the success than remove the TEMP JSON files
|
||||
// $this->unlinkFiles($params['multi_event_file_paths']);
|
||||
@ -1357,6 +1495,13 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$enrollment_keys = array_keys($enrollment_columns_to_check);
|
||||
}
|
||||
|
||||
// for this condition to avoid 5,00,000 to 500000
|
||||
if($current_column_action == 'SI'){
|
||||
$row[3] = removeNumberFormatting($row[3]);
|
||||
}else if(in_array($current_column_action, ['I','DA', 'MI', 'A'])){
|
||||
$row[6] = removeNumberFormatting($row[6]);
|
||||
}
|
||||
|
||||
//iterate each row for columns validations
|
||||
foreach ($row as $col_key => $col) {
|
||||
$is_mandatory = $columns_to_check[$keys[$col_key]]['is_mandatory'];
|
||||
@ -1495,6 +1640,16 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$columns_to_check = $this->inception_excel_columns;
|
||||
}
|
||||
|
||||
$current_column_action = null;
|
||||
if($file['action'] == 'inception'){ $current_column_action = 'I'; }
|
||||
else if($file['action'] == 'addition'){ $current_column_action = 'A'; }
|
||||
else if($file['action'] == 'dependent_addition'){ $current_column_action = 'DA'; }
|
||||
else if($file['action'] == 'deletion'){ $current_column_action = 'D'; }
|
||||
else if($file['action'] == 'correction'){ $current_column_action = 'C'; }
|
||||
else if($file['action'] == 'si_enhancement'){ $current_column_action = 'SI'; }
|
||||
else if($file['action'] == 'enrollment'){ $current_column_action = 'I'; }
|
||||
else if($file['action'] == 'missed_inception'){ $current_column_action = 'MI'; }
|
||||
|
||||
$columns_to_check = $this->syncColIndex($this->multievent_excel_columns, $columns_to_check);
|
||||
// print_rr($columns_to_check);
|
||||
|
||||
@ -1522,7 +1677,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
|
||||
if (in_array($file['action'], ['inception', 'missed_inception', 'addition', 'dependent_addition', 'deletion', 'correction', 'si_enhancement', 'enrollment'])) // the below funcitons are only for I,DA,A
|
||||
{
|
||||
$employee_data_group_by_family = data_group_by_family($excel_data, 'excel', ($file['action'] == 'enrollment' ? 'enrollment' : ''));
|
||||
$employee_data_group_by_family = data_group_by_family($excel_data, 'excel', ($file['action'] == 'enrollment' ? 'enrollment' : ''), $current_column_action);
|
||||
// dd($employee_data_group_by_family);
|
||||
$is_self_available_in_policy_terms = false;
|
||||
if ($policy_details['policy_type_id'] == 3) // GMC parents
|
||||
@ -1694,6 +1849,16 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$columns_to_check = $this->inception_excel_columns;
|
||||
}
|
||||
|
||||
$current_column_action = null;
|
||||
if($file['action'] == 'inception'){ $current_column_action = 'I'; }
|
||||
else if($file['action'] == 'addition'){ $current_column_action = 'A'; }
|
||||
else if($file['action'] == 'dependent_addition'){ $current_column_action = 'DA'; }
|
||||
else if($file['action'] == 'deletion'){ $current_column_action = 'D'; }
|
||||
else if($file['action'] == 'correction'){ $current_column_action = 'C'; }
|
||||
else if($file['action'] == 'si_enhancement'){ $current_column_action = 'SI'; }
|
||||
else if($file['action'] == 'enrollment'){ $current_column_action = 'I'; }
|
||||
else if($file['action'] == 'missed_inception'){ $current_column_action = 'MI'; }
|
||||
|
||||
// get policy and rack details
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'], $file['policy_id']);
|
||||
$policy_terms = (array) $policy_terms[0]; // convert obj to array
|
||||
@ -1717,7 +1882,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
//get existing units in the current branch
|
||||
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'], client_branch_id: $file['client_branch_id']);
|
||||
|
||||
$employee_data_group_by_family = data_group_by_family($excel_data);
|
||||
$employee_data_group_by_family = data_group_by_family($excel_data, 'excel', '', $current_column_action);
|
||||
// dd($employee_data_group_by_family);
|
||||
foreach ($employee_data_group_by_family as $emp_id => $family) {
|
||||
|
||||
@ -2029,6 +2194,9 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
if (check_row_is_empty_or_null($row)) {
|
||||
break;
|
||||
}
|
||||
|
||||
$row[3] = removeNumberFormatting($row[3]);
|
||||
|
||||
// echo '<br>START- ' . $row[2];
|
||||
$employee = $this->employeeModel
|
||||
->where('emp_code', $row[1])
|
||||
@ -2038,6 +2206,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
->where('emp_status', 'active')
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
$employee_policy = $this->employeePolicyModel
|
||||
->where('employee_id', $employee['id'])
|
||||
->where('client_policy_id', $file['policy_id'])
|
||||
@ -2052,8 +2221,11 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
->where('emp_code', $employee['emp_code'])
|
||||
->where('name', $employee['name'])
|
||||
->where('field_name', 'basic_cover_si')
|
||||
->where('is_active', 1)
|
||||
->where('status !=', 'truncated')
|
||||
->findAll();
|
||||
// dd($existing_endorsements);
|
||||
|
||||
//make entry in endorsement table
|
||||
if (!count($existing_endorsements)) {
|
||||
//transform data to send
|
||||
@ -2101,6 +2273,8 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'], 'emp_code' => $employee['emp_code'], 'table_name' => 'employee_polices', 'actions' => 'si', 'name' => $employee['name'], 'field_name' => 'basic_cover_si', 'old_value' => $employee_policy['basic_cover_si'], 'new_value' => $row[3], 'created_by' => $file['created_by'], 'remarks' => 'general si enhancement', 'group_key' => $group_key, 'file_id' => $file['id'], 'status' => 'pending']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'], 'emp_code' => $employee['emp_code'], 'table_name' => 'employee_polices', 'actions' => 'si', 'name' => $employee['name'], 'field_name' => 'premium', 'old_value' => $employee_policy['premium'], 'new_value' => $calculated_data['policy_details']['premium'], 'created_by' => $file['created_by'], 'remarks' => 'general si enhancement', 'group_key' => $group_key, 'file_id' => $file['id'], 'status' => 'pending']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'], 'emp_code' => $employee['emp_code'], 'table_name' => 'employee_polices', 'actions' => 'si', 'name' => $employee['name'], 'field_name' => 'si_enhancement_date', 'old_value' => null, 'new_value' => change_date_format($row[4], 'd-M-Y', 'Y-m-d'), 'created_by' => $file['created_by'], 'remarks' => 'general si enhancement', 'group_key' => $group_key, 'file_id' => $file['id'], 'status' => 'pending']);
|
||||
}else {
|
||||
$this->myLogger->logme("error", 'Endorsement already exists for this employee ' . json_encode(['file_id' => $file_id, 'emp_code' => $employee['emp_code'], 'emp_name' => $employee['name']]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2125,10 +2299,9 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
foreach ($familiy_data as $fkey => $value) {
|
||||
if (is_array($value)) {
|
||||
|
||||
|
||||
if (isset($value['gender'])) { $value['gender'] = normalizeGender($value['gender'] );}
|
||||
if ($file['id'] == null || $value['temp']['source'] == 'excel' || (($file['action'] == 'dependent_addition' && ($value['temp']['premium_type'] == 1 && strtolower($value['relationship']) == 'self') || ($value['temp']['premium_type'] == 2 || $value['temp']['premium_type'] == null)))) //insert data come from excel and from db i.e. ( $file['id'] == null for enrollment data)
|
||||
{
|
||||
|
||||
$employee = $this->employeeModel->checkExistingEmp($value, $file['client_branch_id']);
|
||||
$policy_data = $value['policy_details'];
|
||||
$temp = $value['temp'];
|
||||
@ -2773,9 +2946,13 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
// Save JSON file in writable/tmp/
|
||||
$savedFiles = [];
|
||||
foreach ($finalData as $key => $data) {
|
||||
$filePath = WRITEPATH . 'tmp/' . $key . '_' . time() . '.json';
|
||||
file_put_contents($filePath, json_encode($data, JSON_PRETTY_PRINT));
|
||||
$savedFiles[$key] = $filePath;
|
||||
if(!empty($data)){
|
||||
$filePath = WRITEPATH . 'tmp/' . $key . '_' . time() . '.json';
|
||||
file_put_contents($filePath, json_encode($data, JSON_PRETTY_PRINT));
|
||||
$savedFiles[$key] = $filePath;
|
||||
}else{
|
||||
$savedFiles[$key] = "";
|
||||
}
|
||||
}
|
||||
|
||||
return $savedFiles;
|
||||
@ -2881,6 +3058,135 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
return $temp;
|
||||
}
|
||||
|
||||
// --------- MEMBER DATA AND INCEPTION DATA COMPARISION ------------------------------------------------------------------------
|
||||
|
||||
public function compareMemberDataAndInceptionData($params)
|
||||
{
|
||||
$file_id = $params['file_id'] ?? null;
|
||||
if (empty($file_id)) {
|
||||
return ['status' => false, 'msg' => 'File ID is missing'];
|
||||
}
|
||||
|
||||
// ✅ Get File Data
|
||||
$file = $this->fileModel->where(['is_active' => 1, 'id' => $file_id])->first();
|
||||
if (empty($file)) {
|
||||
return ['status' => false, 'msg' => 'File not found in DB'];
|
||||
}
|
||||
|
||||
// ✅ Get Client Policy Data
|
||||
$client_policy_data = $this->clientPolicyModel->where(['is_active' => 1, 'id' => $file['policy_id']])->first();
|
||||
if (empty($client_policy_data)) {
|
||||
return ['status' => false, 'msg' => 'Client policy data not found in DB (policy_id: ' . $file['policy_id'] . ')'];
|
||||
}
|
||||
|
||||
// ✅ Get Lead Data
|
||||
$leadModel = new LeadsModel();
|
||||
$lead_data = $leadModel->where(['is_active' => 1, 'id' => $client_policy_data['is_from_lead']])->first();
|
||||
if (empty($lead_data)) {
|
||||
return ['status' => false, 'msg' => 'Lead data not found in DB (lead_id: ' . $client_policy_data['is_from_lead'] . ')'];
|
||||
}
|
||||
|
||||
// ✅ Define File Paths
|
||||
// $inception_file_path = !empty($file['file_name']) ? WRITEPATH . "uploads/excel/" . $file['file_name'] : '';
|
||||
$member_file_path = !empty($lead_data['file_name']) ? WRITEPATH . "uploads/lead_files/" . $lead_data['file_name'] : '';
|
||||
|
||||
// ✅ Check Inception File
|
||||
// if (empty($file['file_name']) || !file_exists($inception_file_path)) {
|
||||
// $message = empty($file['file_name']) ? "Inception file name is missing" : "Inception physical file not found";
|
||||
// $this->myLogger->logme('error', "$message for file id $file_id");
|
||||
// $this->fileModel->update($file_id, [
|
||||
// 'status' => 'failed',
|
||||
// 'reason' => json_encode(['error_summary' => [5], 'error_data' => $message])
|
||||
// ]);
|
||||
// return ['error_summary' => [5], 'error_data' => $message];
|
||||
// }
|
||||
|
||||
// ✅ Check Member File
|
||||
if (empty($lead_data['file_name']) || !file_exists($member_file_path)) {
|
||||
$message = empty($lead_data['file_name']) ? "Member file name is missing" : "Member data physical file not found";
|
||||
$this->myLogger->logme('error', "$message for lead id {$lead_data['id']}");
|
||||
$this->fileModel->update($file_id, [
|
||||
'status' => 'failed',
|
||||
'reason' => json_encode(['error_summary' => [5], 'error_data' => $message])
|
||||
]);
|
||||
return ['error_summary' => [5], 'error_data' => $message];
|
||||
}
|
||||
|
||||
|
||||
// ✅ Read Inception Excel
|
||||
$inception_columns = $this->inception_excel_columns;
|
||||
$inception_data = json_decode(file_get_contents($params['file_path'] ?? []), true);
|
||||
// $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inception_file_path);
|
||||
// $sheet = $spreadsheet->getActiveSheet();
|
||||
// $highestRow = $sheet->getHighestDataRow();
|
||||
// $allowedColumn = end($inception_columns)['col_cell_name'];
|
||||
// $inception_data = $sheet->rangeToArray("A1:{$allowedColumn}{$highestRow}");
|
||||
// $inception_data = ExcelSanitizeHelper::sanitizeArrayData($inception_data);
|
||||
|
||||
// ✅ Read Member Excel
|
||||
$member_columns = $this->member_data_excel_columns;
|
||||
$spreadsheet2 = \PhpOffice\PhpSpreadsheet\IOFactory::load($member_file_path);
|
||||
$sheet2 = $spreadsheet2->getSheet(0);
|
||||
$highestRow2 = $sheet2->getHighestDataRow();
|
||||
$allowedColumn2 = end($member_columns)['col_cell_name'];
|
||||
$member_data = $sheet2->rangeToArray("A1:{$allowedColumn2}{$highestRow2}");
|
||||
$member_data = ExcelSanitizeHelper::sanitizeArrayData($member_data);
|
||||
|
||||
// dd($inception_data, $member_data);
|
||||
|
||||
// ✅ Compare Inception Data with Member Data
|
||||
$result = ['error_type' => 2, 'error_summary' => [], 'error_data' => []];
|
||||
|
||||
$inception_data_count = count($inception_data);
|
||||
$member_data_count = count($member_data);
|
||||
|
||||
if ($inception_data_count !== $member_data_count) {
|
||||
$result['error_summary'][] = 15;
|
||||
$result['error_message'] = "
|
||||
<strong>Inception Data Count:</strong>
|
||||
<span class='badge badge-danger'>{$inception_data_count}</span>
|
||||
<strong>Member Data Count:</strong>
|
||||
<span class='badge badge-danger'>{$member_data_count}</span>";
|
||||
}
|
||||
|
||||
foreach ($inception_data as $inception_key => $inception_row) {
|
||||
|
||||
// 🔹 If inception row is empty → stop all further processing
|
||||
if (check_row_is_empty_or_null($inception_row)) {
|
||||
break;
|
||||
}
|
||||
|
||||
$match_found = false;
|
||||
|
||||
foreach ($member_data as $member_row) {
|
||||
if (
|
||||
$inception_row[1] == $member_row[1] && // emp_id / emp_code
|
||||
$inception_row[2] == $member_row[2] && // name_of_emp_dep / name
|
||||
$inception_row[5] == $member_row[3] && // relationship
|
||||
normalizeGender($inception_row[4]) == normalizeGender($member_row[4]) && // gender
|
||||
$inception_row[3] == $member_row[5] && // dob
|
||||
$inception_row[13] == $member_row[7] && // email
|
||||
$inception_row[12] == $member_row[8] // phone / mobile
|
||||
) {
|
||||
$match_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$match_found) {
|
||||
array_push($result['error_summary'], 14);
|
||||
$result['error_data'][$inception_key]['sno']['error'][] = "This inception row was not found in the member data list.";
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ Handle Result
|
||||
if (!empty($result['error_summary'])) {
|
||||
$result['error_summary'] = array_count_values($result['error_summary']);
|
||||
$this->myLogger->logme('error', "File ID $file_id comparison failed");
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -57,6 +57,8 @@ use Illuminate\Http\Request;
|
||||
|
||||
use App\Controllers\EmployeeServiceController;
|
||||
use App\Models\ClaimFilesModel;
|
||||
use App\Models\TicketMailTemplateModel;
|
||||
use Composer\Pcre\Preg;
|
||||
use Kreait\Firebase\Factory;
|
||||
use Kreait\Firebase\Messaging\CloudMessage;
|
||||
use Kreait\Firebase\Messaging\Notification;
|
||||
@ -94,6 +96,7 @@ class EmployeeRestController extends AdminController
|
||||
protected $hrAccessControlModel;
|
||||
protected $insurerModel;
|
||||
protected $hrFileUploadModel;
|
||||
protected $ticketMailTemplateModel;
|
||||
|
||||
|
||||
public function __construct()
|
||||
@ -126,6 +129,7 @@ class EmployeeRestController extends AdminController
|
||||
$this->hrAccessControlModel = new HRAccessControlModel();
|
||||
$this->insurerModel = new InsurerModel();
|
||||
$this->hrFileUploadModel = new HrFileUploadModel();
|
||||
$this->ticketMailTemplateModel = new TicketMailTemplateModel();
|
||||
|
||||
}
|
||||
|
||||
@ -2831,7 +2835,7 @@ class EmployeeRestController extends AdminController
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', $policy_status)
|
||||
->where('client_policy.enrolment_visibility', 1 )
|
||||
->where('client_policy.enrolment_visibility', 1)
|
||||
->orderby('client_policy.id' , 'ASC')
|
||||
->findAll();
|
||||
|
||||
@ -2840,16 +2844,25 @@ class EmployeeRestController extends AdminController
|
||||
->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||
->where('is_active', 1 )->findAll();
|
||||
$employeeName = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
|
||||
|
||||
$employeeSelfData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
|
||||
->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||
->where('family_floater_key','self')->where('is_active', 1 )
|
||||
->get()->getRow()->name;
|
||||
->get()->getRow();
|
||||
|
||||
$employeeName = $employeeSelfData->name ?? "";
|
||||
|
||||
|
||||
//for get the pre enrollment policy count
|
||||
$empMobileNo = $this->request->getGet('mobile_no');
|
||||
$clientId = $this->request->getGet('client_id');
|
||||
$prePolicyCount = $this->getPreEmployeePolicyCount($empMobileNo, $clientId);
|
||||
|
||||
if(!empty($employeeSelfData) && isset($employeeSelfData->email_corporate)){
|
||||
$prePolicyCount = $this->getPreEmployeePolicyCount($empMobileNo, $clientId, $employeeSelfData->email_corporate);
|
||||
}else{
|
||||
$prePolicyCount = $this->getPreEmployeePolicyCount($empMobileNo, $clientId);
|
||||
}
|
||||
|
||||
$whereArrayForId = [];
|
||||
foreach ( $employeeData as $key => $value) { array_push($whereArrayForId, $value['id']); }
|
||||
@ -2972,7 +2985,11 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
|
||||
function policyTermsFiter($terms , $type)
|
||||
{
|
||||
{
|
||||
if(empty($terms)){
|
||||
return [];
|
||||
}
|
||||
|
||||
$gpa = [
|
||||
"sumInsured2" => "Sum Insured",
|
||||
"totalSumInsured" => "Total Sum Assured",
|
||||
@ -3471,6 +3488,15 @@ class EmployeeRestController extends AdminController
|
||||
$received_data = $this->request->getPost();
|
||||
$this->myLogger->logme('error', 'API claim initiate Recevied Params :' . json_encode($received_data ?? []));
|
||||
$get_file_data = $this->request->getFiles('claim_docs');
|
||||
$get_docs_name = $this->request->getPost('claim_doc_names') ?? [];
|
||||
|
||||
if (is_string($get_docs_name)) {
|
||||
$decoded = json_decode($get_docs_name, true);
|
||||
$get_docs_name = json_last_error() === JSON_ERROR_NONE ? $decoded : [];
|
||||
} elseif (!is_array($get_docs_name)) {
|
||||
$get_docs_name = [];
|
||||
}
|
||||
|
||||
// print_r($get_file_data); die;
|
||||
$employee_id = $received_data['emp_id'];
|
||||
$client_policy_id = $received_data['client_policy_id'];
|
||||
@ -3479,7 +3505,7 @@ class EmployeeRestController extends AdminController
|
||||
$file_data = [];
|
||||
if(isset($get_file_data) && !empty($get_file_data)){
|
||||
$file_path = WRITEPATH . 'uploads/claim_files/';
|
||||
$file_data = multi_file_Upload($get_file_data, $file_path);
|
||||
$file_data = multi_file_Upload($get_file_data, $file_path, $get_docs_name);
|
||||
}
|
||||
|
||||
|
||||
@ -3629,7 +3655,8 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
$data = [
|
||||
'ticket_id' => $ticket_id,
|
||||
'doc_name' => $value['file_name'],
|
||||
'doc_name' => $value['doc_name'],
|
||||
'file_name' => $value['file_name'],
|
||||
'url' => $value['file_path'],
|
||||
'file_type' => 2,
|
||||
'ticket_message_id' => $ticket_message_id,
|
||||
@ -4075,18 +4102,19 @@ class EmployeeRestController extends AdminController
|
||||
// }
|
||||
// }
|
||||
|
||||
public function getPreEmployeePolicyCount($mobile_no, $clientId = null)
|
||||
{
|
||||
log_message('error', 'STEP 1: getPreEmployeePolicyCount called with params: ' . json_encode(['mobile_no' => $mobile_no, 'client_id' => $clientId]));
|
||||
public function getPreEmployeePolicyCount($mobile_no, $clientId = null, $email = null)
|
||||
{
|
||||
log_message('error', 'STEP 1: getPreEmployeePolicyCount called with params: ' . json_encode(['mobile_no' => $mobile_no, 'client_id' => $clientId, 'email' => $email]));
|
||||
|
||||
if (empty($mobile_no)) {
|
||||
log_message('error', 'STEP 2: Mobile number is empty or null. Returning 0.');
|
||||
if (empty($mobile_no) && empty($email)) {
|
||||
log_message('error', 'STEP 2: Mobile number and Email is empty or null. Returning 0.');
|
||||
return 0;
|
||||
}
|
||||
|
||||
$client_short_name = null;
|
||||
|
||||
if (!empty($clientId)) {
|
||||
|
||||
log_message('error', 'STEP 3: Fetching client short name for client ID: ' . $clientId);
|
||||
$client_data = $this->clientModel->where('is_active', 1)->where('id', $clientId)->first();
|
||||
|
||||
@ -4096,14 +4124,25 @@ class EmployeeRestController extends AdminController
|
||||
} else {
|
||||
log_message('error', 'STEP 4: No client found for ID: ' . $clientId);
|
||||
}
|
||||
|
||||
} else {
|
||||
log_message('error', 'STEP 3: No clientId provided. Skipping client lookup.');
|
||||
}
|
||||
|
||||
$post_data = [
|
||||
'mobile_number' => $mobile_no,
|
||||
'client_short_name' => $client_short_name
|
||||
];
|
||||
if(!empty($email)){
|
||||
$post_data = [
|
||||
'email_id' => $email,
|
||||
'client_short_name' => $client_short_name
|
||||
];
|
||||
}else{
|
||||
$post_data = [
|
||||
'mobile_number' => $mobile_no,
|
||||
'client_short_name' => $client_short_name
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
log_message('error', 'STEP 5: Calling third-party API with payload: ' . json_encode($post_data));
|
||||
|
||||
@ -4181,7 +4220,11 @@ class EmployeeRestController extends AdminController
|
||||
];
|
||||
|
||||
// Save into DB
|
||||
$this->hrFileUploadModel->insert($data);
|
||||
$result = $this->hrFileUploadModel->insert($data);
|
||||
|
||||
if($result){
|
||||
$this->giveNotificationToClientsAccountManager($data);
|
||||
}
|
||||
|
||||
return $this->respondCreated([
|
||||
'status' => true,
|
||||
@ -4195,6 +4238,45 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
private function giveNotificationToClientsAccountManager($data){
|
||||
|
||||
$client_name = $this->clientModel->where('id',$data['client_id'])->findAll()[0]['client_name'] ?? [] ;
|
||||
|
||||
$account_manager_email = $this->clientRMModel->findAccountManagerEmail($data['client_id']);
|
||||
|
||||
$templateName = "hr_endorsement_template";
|
||||
|
||||
$mailTemplate = $this->ticketMailTemplateModel->where('template_name', $templateName)->findAll()[0] ?? [];
|
||||
|
||||
if(empty($mailTemplate)){
|
||||
//empty mail template please update the template in database or create one..!!
|
||||
log_message("error","Empty mail template for inception_addition please update the template in database or create one..!!");
|
||||
return ;
|
||||
}
|
||||
|
||||
$data['file_action'] = ucwords(preg_replace("/_/", " ", $data['file_action']));
|
||||
|
||||
$mailTemplate['mail_content'] = str_replace('%file_action%', $data['file_action'] ?? '', $mailTemplate['mail_content']);
|
||||
$mailTemplate['mail_content'] = str_replace('%client_name%', $client_name ?? '', $mailTemplate['mail_content']);
|
||||
$mailTemplate['mail_content'] = str_replace('%policy_no%', $data['policy_no'] ?? '', $mailTemplate['mail_content']);
|
||||
|
||||
$mailTemplate['subject'] = str_replace('%subject%',$data['file_action']??'',$mailTemplate['subject']);
|
||||
$mailTemplate['subject'] = str_replace('%client_name%',$client_name??'',$mailTemplate['subject']);
|
||||
|
||||
$from_mail = "";
|
||||
$to_mail = $account_manager_email;
|
||||
$subject = $mailTemplate['subject'];
|
||||
$message = $mailTemplate['mail_content'];
|
||||
$cc_string = "";
|
||||
$attachments = "";
|
||||
$reply_to = "";
|
||||
$bcc_string = "";
|
||||
|
||||
|
||||
MailHelper::send_email(['from_mail' => $from_mail, 'mail' => $to_mail, 'cc' => $cc_string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string]);
|
||||
|
||||
}
|
||||
|
||||
public function updateHrFileUploadData()
|
||||
{
|
||||
try {
|
||||
|
||||
@ -29,7 +29,7 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use Kint\Kint;
|
||||
|
||||
use App\Helpers\ExcelSanitizeHelper;
|
||||
|
||||
use App\Models\LeadsModel;
|
||||
|
||||
class EmployeeServiceController extends AdminController
|
||||
{
|
||||
@ -144,7 +144,7 @@ class EmployeeServiceController extends AdminController
|
||||
'is_mandatory' => ['I', 'A', 'DA'],
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => ['M', 'F']
|
||||
'allowed_values' => ['M', 'F', 'Male', 'Female', 'male', 'female', 'MALE', 'FEMALE']
|
||||
],
|
||||
'relationship' => [
|
||||
'col_idx' => 5,
|
||||
@ -529,7 +529,8 @@ class EmployeeServiceController extends AdminController
|
||||
'is_mandatory' => ['I', 'A', 'DA','E'],
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => ['M', 'F']
|
||||
'allowed_values' => ['M', 'F', 'Male', 'Female', 'male', 'female', 'MALE', 'FEMALE']
|
||||
|
||||
],
|
||||
'relationship' => [
|
||||
'col_idx' => 5,
|
||||
@ -643,21 +644,121 @@ class EmployeeServiceController extends AdminController
|
||||
];
|
||||
|
||||
protected $enrollment_to_inception_mapping = [
|
||||
0 => 0, // enrollment: sno (Sno) -> inception: sno (S.No)
|
||||
1 => 1, // enrollment: emp_code (Emp_Code) -> inception: emp_id (EMP ID)
|
||||
2 => 2, // enrollment: name (NAME OF EMP/DEP) -> inception: name_of_emp_dep (NAME OF EMP/DEP)
|
||||
3 => 8, // enrollment: doj (DOJ) -> inception: doj (DOJ)
|
||||
4 => 4, // enrollment: gender (Gender) -> inception: gender (Gender)
|
||||
5 => 5, // enrollment: relationship (Relation) -> inception: relationship (RELATIONSHIP)
|
||||
6 => 3, // enrollment: dob (DOB) -> inception: dob (DOB)
|
||||
7 => 13, // enrollment: email (Email) -> inception: email (Email)
|
||||
8 => 12, // enrollment: phone (Mobile) -> inception: phone (Phone)
|
||||
9 => 6, // enrollment: basic_cover_si (SI) -> inception: basic_cover_si (BASIC COVER SI)
|
||||
10 => 10, // enrollment: band_grade (Grade) -> inception: band_grade (Band/Grade)
|
||||
11 => 9 // enrollment: basic_pay (Basic Pay) -> inception: basic_pay (Basic Pay)
|
||||
];
|
||||
|
||||
|
||||
0 => 0, // enrollment: sno (Sno) -> inception: sno (S.No)
|
||||
1 => 1, // enrollment: emp_code (Emp_Code) -> inception: emp_id (EMP ID)
|
||||
2 => 2, // enrollment: name (NAME OF EMP/DEP) -> inception: name_of_emp_dep (NAME OF EMP/DEP)
|
||||
3 => 8, // enrollment: doj (DOJ) -> inception: doj (DOJ)
|
||||
4 => 4, // enrollment: gender (Gender) -> inception: gender (Gender)
|
||||
5 => 5, // enrollment: relationship (Relation) -> inception: relationship (RELATIONSHIP)
|
||||
6 => 3, // enrollment: dob (DOB) -> inception: dob (DOB)
|
||||
7 => 13, // enrollment: email (Email) -> inception: email (Email)
|
||||
8 => 12, // enrollment: phone (Mobile) -> inception: phone (Phone)
|
||||
9 => 6, // enrollment: basic_cover_si (SI) -> inception: basic_cover_si (BASIC COVER SI)
|
||||
10 => 10, // enrollment: band_grade (Grade) -> inception: band_grade (Band/Grade)
|
||||
11 => 9 // enrollment: basic_pay (Basic Pay) -> inception: basic_pay (Basic Pay)
|
||||
];
|
||||
protected $member_data_excel_columns = [
|
||||
'sno' => [
|
||||
'col_idx' => 0,
|
||||
'col_cell_name' => 'A',
|
||||
'col_name' => 'Sl no',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'emp_code' => [
|
||||
'col_idx' => 1,
|
||||
'col_cell_name' => 'B',
|
||||
'col_name' => 'Emp Code',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'name' => [
|
||||
'col_idx' => 2,
|
||||
'col_cell_name' => 'C',
|
||||
'col_name' => 'Name',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'relationship' => [
|
||||
'col_idx' => 3,
|
||||
'col_cell_name' => 'D',
|
||||
'col_name' => 'Relationship',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => [
|
||||
'Self', 'Spouse', 'Son', 'Daughter', 'Father', 'Mother',
|
||||
'Father-in-law', 'Mother-in-law',
|
||||
'self', 'spouse', 'son', 'daughter', 'father', 'mother',
|
||||
'father-in-law', 'mother-in-law'
|
||||
],
|
||||
'custom' => 'check_relationship_for_member_data',
|
||||
'params' => ['row', 'relationship', 'columns_to_check']
|
||||
],
|
||||
'gender' => [
|
||||
'col_idx' => 4,
|
||||
'col_cell_name' => 'E',
|
||||
'col_name' => 'Gender',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => ['M', 'F', 'Male', 'Female', 'male', 'female', 'MALE', 'FEMALE']
|
||||
],
|
||||
'dob' => [
|
||||
'col_idx' => 5,
|
||||
'col_cell_name' => 'F',
|
||||
'col_name' => 'DOB',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'str',
|
||||
'format' => 'd-M-Y',
|
||||
'allowed_values' => null,
|
||||
'age_validation' => true,
|
||||
// 'custom' => 'check_dob_diff',
|
||||
// 'params' => ['row', 'relationship', 'default_age_ratio', 'policy_details']
|
||||
],
|
||||
'age' => [
|
||||
'col_idx' => 6,
|
||||
'col_cell_name' => 'G',
|
||||
'col_name' => 'Age',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => 'int',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'email' => [
|
||||
'col_idx' => 7,
|
||||
'col_cell_name' => 'H',
|
||||
'col_name' => 'Email',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'mobile' => [
|
||||
'col_idx' => 8,
|
||||
'col_cell_name' => 'I',
|
||||
'col_name' => 'Mobile',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'str',
|
||||
'format' => null,
|
||||
'allowed_values' => null
|
||||
],
|
||||
'si' => [
|
||||
'col_idx' => 9,
|
||||
'col_cell_name' => 'J',
|
||||
'col_name' => 'SI',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => 'int',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -809,6 +910,13 @@ class EmployeeServiceController extends AdminController
|
||||
$enrollment_columns_to_check = $this->enrollment_excel_columns;
|
||||
$enrollment_keys = array_keys($enrollment_columns_to_check);
|
||||
}
|
||||
|
||||
// for this condition to avoid 5,00,000 to 500000
|
||||
if($current_column_action == 'SI'){
|
||||
$row[3] = removeNumberFormatting($row[3]);
|
||||
}else if(in_array($current_column_action, ['I','DA', 'MI', 'A'])){
|
||||
$row[6] = removeNumberFormatting($row[6]);
|
||||
}
|
||||
|
||||
//iterate each row for columns validations
|
||||
foreach ($row as $col_key => $col)
|
||||
@ -923,7 +1031,14 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
}
|
||||
else //trigger next data validation via job queue server
|
||||
{
|
||||
{
|
||||
// check the condition if the policy from the Leads and check the lead id exist in the client policy table
|
||||
if($file['action'] == 'inception' && $policy_details[0]->policy_entry_from == 3 && !empty($policy_details[0]->is_from_lead)){
|
||||
$r = Jobs::addJob(['job_name' => 'compareMemberDataAndInceptionData','payload' => ['file_id' => $file_id]]);
|
||||
$this->myLogger->logme("error",'compareMemberDataAndInceptionData job pushed');
|
||||
return $result;
|
||||
}
|
||||
|
||||
if($file['action'] == 'enrollment' && $file['uploaded_by'] != 1) // if current action is enrollment and uploaded by HR (0 or NULL) call next validation and return result
|
||||
{
|
||||
// dd();
|
||||
@ -978,6 +1093,16 @@ class EmployeeServiceController extends AdminController
|
||||
if($file['action'] == 'enrollment'){ $columns_to_check = $this->enrollment_excel_columns; }
|
||||
if($file['action'] == 'missed_inception'){ $columns_to_check = $this->inception_excel_columns; }
|
||||
|
||||
$current_column_action = null;
|
||||
if($file['action'] == 'inception'){ $current_column_action = 'I'; }
|
||||
else if($file['action'] == 'addition'){ $current_column_action = 'A'; }
|
||||
else if($file['action'] == 'dependent_addition'){ $current_column_action = 'DA'; }
|
||||
else if($file['action'] == 'deletion'){ $current_column_action = 'D'; }
|
||||
else if($file['action'] == 'correction'){ $current_column_action = 'C'; }
|
||||
else if($file['action'] == 'si_enhancement'){ $current_column_action = 'SI'; }
|
||||
else if($file['action'] == 'enrollment'){ $current_column_action = 'I'; }
|
||||
else if($file['action'] == 'missed_inception'){ $current_column_action = 'MI'; }
|
||||
|
||||
// get policy and rack details
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
$policy_details = (array)$policy_terms[0];
|
||||
@ -1008,7 +1133,7 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
if(in_array($file['action'],['inception','missed_inception','addition','dependent_addition','deletion','correction','si_enhancement','enrollment']))// the below funcitons are only for I,DA,A
|
||||
{
|
||||
$employee_data_group_by_family = data_group_by_family($excel_data,'excel',($file['action'] == 'enrollment' ? 'enrollment' : ''));
|
||||
$employee_data_group_by_family = data_group_by_family($excel_data,'excel',($file['action'] == 'enrollment' ? 'enrollment' : ''), $current_column_action);
|
||||
// dd($employee_data_group_by_family);
|
||||
$is_self_available_in_policy_terms = false;
|
||||
if($policy_details['policy_type_id'] == 3) // GMC parents
|
||||
@ -1213,6 +1338,16 @@ class EmployeeServiceController extends AdminController
|
||||
if($file['action'] == 'si_enhancement'){ $columns_to_check = $this->si_enhance_excel_columns; }
|
||||
if($file['action'] == 'missed_inception'){ $columns_to_check = $this->inception_excel_columns; }
|
||||
|
||||
$current_column_action = null;
|
||||
if($file['action'] == 'inception'){ $current_column_action = 'I'; }
|
||||
else if($file['action'] == 'addition'){ $current_column_action = 'A'; }
|
||||
else if($file['action'] == 'dependent_addition'){ $current_column_action = 'DA'; }
|
||||
else if($file['action'] == 'deletion'){ $current_column_action = 'D'; }
|
||||
else if($file['action'] == 'correction'){ $current_column_action = 'C'; }
|
||||
else if($file['action'] == 'si_enhancement'){ $current_column_action = 'SI'; }
|
||||
else if($file['action'] == 'enrollment'){ $current_column_action = 'I'; }
|
||||
else if($file['action'] == 'missed_inception'){ $current_column_action = 'MI'; }
|
||||
|
||||
// get policy and rack details
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
$policy_terms = (array) $policy_terms[0];// convert obj to array
|
||||
@ -1236,7 +1371,7 @@ class EmployeeServiceController extends AdminController
|
||||
//get existing units in the current branch
|
||||
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'],client_branch_id: $file['client_branch_id']);
|
||||
|
||||
$employee_data_group_by_family = data_group_by_family($excel_data);
|
||||
$employee_data_group_by_family = data_group_by_family($excel_data, 'excel', '', $current_column_action);
|
||||
// dd($employee_data_group_by_family);
|
||||
foreach ($employee_data_group_by_family as $emp_id => $family)
|
||||
{
|
||||
@ -1379,9 +1514,9 @@ class EmployeeServiceController extends AdminController
|
||||
->where('employees.client_id',$file['client_id'])
|
||||
->where('employees.client_branch_id',$file['client_branch_id'])
|
||||
->where('employee_polices.client_policy_id',$file['policy_id'])
|
||||
->where('employees.emp_status !=','truncated')
|
||||
->where('employees.emp_status','active')
|
||||
->where('employees.is_active', 1)
|
||||
->where('employee_polices.status !=','truncated')
|
||||
->where('employee_polices.status','active')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->first();
|
||||
|
||||
@ -1415,7 +1550,7 @@ class EmployeeServiceController extends AdminController
|
||||
$employee_policy = $this->employeePolicyModel
|
||||
->where('employee_id',$employee['id'])
|
||||
->where('client_policy_id',$file['policy_id'])
|
||||
->where('status !=','truncated')
|
||||
->where('status','active')
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
@ -1542,76 +1677,78 @@ class EmployeeServiceController extends AdminController
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//enhance of emp
|
||||
//enhance of emp
|
||||
public function employeesSIEnhanceProcess($params)
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
helper('excel_util_helper');
|
||||
//get file name
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->fileModel->find($file_id);
|
||||
// dd($file);
|
||||
|
||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
||||
$file_name_with_path = WRITEPATH . "/uploads/excel/" . $file['file_name'];
|
||||
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
$allowedHighestColumn = end($this->si_enhance_excel_columns);
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
|
||||
// $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
|
||||
|
||||
unset($excel_data[0]);
|
||||
// dd($excel_data);
|
||||
|
||||
//get policy slab rates
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'], $file['client_id']);
|
||||
//iterate each row
|
||||
// dd($slab_details);
|
||||
foreach ($excel_data as $col_key => $row)
|
||||
{
|
||||
if(check_row_is_empty_or_null($row))
|
||||
{
|
||||
break;
|
||||
foreach ($excel_data as $col_key => $row) {
|
||||
if (check_row_is_empty_or_null($row)) {
|
||||
break;
|
||||
}
|
||||
|
||||
$row[3] = removeNumberFormatting($row[3]);
|
||||
|
||||
// echo '<br>START- ' . $row[2];
|
||||
$employee = $this->employeeModel
|
||||
->where('emp_code', $row[1])
|
||||
->where('name',$row[2])
|
||||
->where('client_id',$file['client_id'])
|
||||
->where('client_branch_id',$file['client_branch_id'])
|
||||
->where('emp_status', 'active')
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
->where('emp_code', $row[1])
|
||||
->where('name', $row[2])
|
||||
->where('client_id', $file['client_id'])
|
||||
->where('client_branch_id', $file['client_branch_id'])
|
||||
->where('emp_status', 'active')
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
$employee_policy = $this->employeePolicyModel
|
||||
->where('employee_id',$employee['id'])
|
||||
->where('client_policy_id',$file['policy_id'])
|
||||
->where('employee_id', $employee['id'])
|
||||
->where('client_policy_id', $file['policy_id'])
|
||||
->where('status', 'active')
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
// dd($employee, $employee_policy);
|
||||
|
||||
$existing_endorsements = $this->empEndorsementModel->where('actions','si')
|
||||
->where('table_name','employee_polices')
|
||||
->where('endorsement_id is null')
|
||||
->where('emp_code',$employee['emp_code'])
|
||||
->where('name',$employee['name'])
|
||||
->where('field_name','basic_cover_si')
|
||||
->findAll();
|
||||
// dd($existing_endorsements);
|
||||
//make entry in endorsement table
|
||||
if(!count($existing_endorsements))
|
||||
{
|
||||
$existing_endorsements = $this->empEndorsementModel->where('actions', 'si')
|
||||
->where('table_name', 'employee_polices')
|
||||
->where('endorsement_id is null')
|
||||
->where('emp_code', $employee['emp_code'])
|
||||
->where('name', $employee['name'])
|
||||
->where('field_name', 'basic_cover_si')
|
||||
->where('is_active', 1)
|
||||
->where('status !=', 'truncated')
|
||||
->findAll();
|
||||
// dd($existing_endorsements);
|
||||
|
||||
//make entry in endorsement table
|
||||
if (!count($existing_endorsements)) {
|
||||
//transform data to send
|
||||
|
||||
//get applicable slab rate for current member relation
|
||||
$pre_rack_rate_name = '';
|
||||
$applicable_rack_rate_name = '';
|
||||
$applicable_rack_rate_master = [];
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
if($pre_rack_rate_name != $slab_value['rack_rate_name'])
|
||||
{
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value) {
|
||||
if ($pre_rack_rate_name != $slab_value['rack_rate_name']) {
|
||||
$pre_rack_rate_name = $slab_value['rack_rate_name'];
|
||||
$rack_rate_json = json_decode($slab_value['additional_relationship'], true);
|
||||
$relationship_array_key = strtolower(trim($employee['relationship']));
|
||||
@ -1624,51 +1761,46 @@ class EmployeeServiceController extends AdminController
|
||||
$relationship_array_key = 'parents-in-law';
|
||||
}
|
||||
|
||||
if(array_key_exists($relationship_array_key, $rack_rate_json) && $rack_rate_json[$relationship_array_key] != 0 && $rack_rate_json[$relationship_array_key] != 'NA')
|
||||
{
|
||||
if (array_key_exists($relationship_array_key, $rack_rate_json) && $rack_rate_json[$relationship_array_key] != 0 && $rack_rate_json[$relationship_array_key] != 'NA') {
|
||||
$applicable_rack_rate_name = $slab_value['rack_rate_name'];
|
||||
$applicable_rack_rate_master = $slab_value['grid_master'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//get max age,max count of the familiy
|
||||
$max_age_and_max_count_of_current_member = $this->employeeModel->getFamiliyCountAndMaxage($employee['emp_code']);
|
||||
//transform SI excel row data as inception excel OR premium calculateable fomart
|
||||
|
||||
$data = transform_si_excel_row_to_calculatable_format(employee: $employee,employee_policy: $employee_policy,maxage_and_maxcount: $max_age_and_max_count_of_current_member,slab_details: $slab_details,applicable_slab_name: $applicable_rack_rate_name,augmented_si: $row[3],grid_master: $applicable_rack_rate_master);
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
$data = transform_si_excel_row_to_calculatable_format(employee: $employee, employee_policy: $employee_policy, maxage_and_maxcount: $max_age_and_max_count_of_current_member, slab_details: $slab_details, applicable_slab_name: $applicable_rack_rate_name, augmented_si: $row[3], grid_master: $applicable_rack_rate_master);
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'], $file['policy_id']);
|
||||
$policy_terms = (array) $policy_terms[0];
|
||||
// dd($policy_terms);
|
||||
//grouping slab details by rack rate name
|
||||
$temp_slab_rates = group_slab_rates_basedon_name($slab_details);
|
||||
|
||||
$calculated_data = premium_calculation_manager($data,$policy_terms,$temp_slab_rates,$row[3]);
|
||||
$calculated_data = premium_calculation_manager($data, $policy_terms, $temp_slab_rates, $row[3]);
|
||||
|
||||
$group_key = rand(100000, 999999);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'basic_cover_si','old_value' => $employee_policy['basic_cover_si'],'new_value' => $row[3],'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'premium','old_value' => $employee_policy['premium'],'new_value' => $calculated_data['policy_details']['premium'],'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'si_enhancement_date','old_value' => null,'new_value' => change_date_format($row[4],'d-M-Y','Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||
|
||||
|
||||
$group_key = rand(100000, 999999);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'], 'emp_code' => $employee['emp_code'], 'table_name' => 'employee_polices', 'actions' => 'si', 'name' => $employee['name'], 'field_name' => 'basic_cover_si', 'old_value' => $employee_policy['basic_cover_si'], 'new_value' => $row[3], 'created_by' => $file['created_by'], 'remarks' => 'general si enhancement', 'group_key' => $group_key, 'file_id' => $file['id'], 'status' => 'pending']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'], 'emp_code' => $employee['emp_code'], 'table_name' => 'employee_polices', 'actions' => 'si', 'name' => $employee['name'], 'field_name' => 'premium', 'old_value' => $employee_policy['premium'], 'new_value' => $calculated_data['policy_details']['premium'], 'created_by' => $file['created_by'], 'remarks' => 'general si enhancement', 'group_key' => $group_key, 'file_id' => $file['id'], 'status' => 'pending']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'], 'emp_code' => $employee['emp_code'], 'table_name' => 'employee_polices', 'actions' => 'si', 'name' => $employee['name'], 'field_name' => 'si_enhancement_date', 'old_value' => null, 'new_value' => change_date_format($row[4], 'd-M-Y', 'Y-m-d'), 'created_by' => $file['created_by'], 'remarks' => 'general si enhancement', 'group_key' => $group_key, 'file_id' => $file['id'], 'status' => 'pending']);
|
||||
} else {
|
||||
$this->myLogger->logme("error", 'Endorsement already exists for this employee ' . json_encode(['file_id' => $file_id, 'emp_code' => $employee['emp_code'], 'emp_name' => $employee['name']]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
$this->fileModel->where('id', $file_id)->set(['status' => 'success','reason' => ''])->update();
|
||||
$this->myLogger->logme("error",'{file_id} uploaded success',['file_id' => $file_id]);
|
||||
$this->fileModel->where('id', $file_id)->set(['status' => 'success', 'reason' => ''])->update();
|
||||
$this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]);
|
||||
|
||||
//set success msg to pull notifications
|
||||
$this->setPullNotification($this->getFileMetaDataByFileId($file_id,'success'));
|
||||
return true;
|
||||
$this->setPullNotification($this->getFileMetaDataByFileId($file_id, 'success'));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// insert or update in db for inception addition depent addition
|
||||
public function employeesOnboardProcess($params)
|
||||
public function employeesOnboardProcess($params)
|
||||
{
|
||||
// dd($params);
|
||||
|
||||
@ -1683,7 +1815,7 @@ class EmployeeServiceController extends AdminController
|
||||
if(is_array($value))
|
||||
{
|
||||
|
||||
|
||||
if (isset($value['gender'])) { $value['gender'] = normalizeGender($value['gender'] );}
|
||||
if($file['id'] == null || $value['temp']['source'] == 'excel' || (($file['action'] == 'dependent_addition' && ($value['temp']['premium_type'] == 1 && strtolower($value['relationship']) == 'self') || ($value['temp']['premium_type'] == 2 || $value['temp']['premium_type'] == null)))) //insert data come from excel and from db i.e. ( $file['id'] == null for enrollment data)
|
||||
{
|
||||
|
||||
@ -1723,7 +1855,7 @@ class EmployeeServiceController extends AdminController
|
||||
$value['updated_by'] = $file['created_by'];
|
||||
$value['id'] = $employee[0]['id'];
|
||||
$value['emp_status'] = 'active';
|
||||
$value['family_floater_key'] = generate_family_floater_key($value['relationship']);
|
||||
$value['family_floater_key'] = generate_family_floater_key($value['relationship']);
|
||||
$value['client_branch_id'] = $file['client_branch_id'];
|
||||
$value['file_id'] = isset($employee[0]['file_id']) && $employee[0]['file_id'] != '' ? $employee[0]['file_id'] : $file['id'] ;
|
||||
$log_message = 'Update Employee - '.$employee[0]['name'].'('.$employee[0]['emp_code'].') with PK '.$employee[0]['id'];
|
||||
@ -1872,127 +2004,125 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
|
||||
}
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
public function getExcelErrorData($file_id){
|
||||
public function getExcelErrorData($file_id)
|
||||
{
|
||||
|
||||
try {
|
||||
$file = $this->fileModel->find($file_id);
|
||||
$error_data = json_decode($file['reason']);
|
||||
// dd($error_data);
|
||||
// return $error_data;
|
||||
try {
|
||||
$file = $this->fileModel->find($file_id);
|
||||
$error_data = json_decode($file['reason']);
|
||||
// dd($error_data);
|
||||
// return $error_data;
|
||||
|
||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
||||
|
||||
//check the file exist or not
|
||||
if(!file_exists($file_name_with_path))
|
||||
{
|
||||
$error_message = "File not found";
|
||||
$this->myLogger->logme('error',($error_message . ' for file id ' . $file_id));
|
||||
return 0;
|
||||
}
|
||||
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
$excelErrorData['excel_header'] = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
// echo '<pre>';
|
||||
// Kint::dump($excel_data);
|
||||
if($error_data->error_type == 1){
|
||||
|
||||
$finalArray = [];
|
||||
foreach ($error_data->error_data as $key => $value) {
|
||||
|
||||
foreach ($value as $key2 => $value2) {
|
||||
$error_data = $value2->error;
|
||||
$data = ['value' => $excel_data[$key][$value2->col_idx], 'error'=>$error_data,];
|
||||
$excel_data[$key][$value2->col_idx] = $data;
|
||||
|
||||
}
|
||||
array_push($finalArray, $excel_data[$key]);
|
||||
//check the file exist or not
|
||||
if(!file_exists($file_name_with_path))
|
||||
{
|
||||
$error_message = "File not found";
|
||||
$this->myLogger->logme('error',($error_message . ' for file id ' . $file_id));
|
||||
return 0;
|
||||
}
|
||||
|
||||
foreach ($finalArray as $fkey => $value){
|
||||
foreach ($value as $vkey => $arrayData){
|
||||
if(!is_array($arrayData)){
|
||||
$data = ['value' => $arrayData];
|
||||
$finalArray[$fkey][$vkey] = $data;
|
||||
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
$excelErrorData['excel_header'] = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
// echo '<pre>';
|
||||
// Kint::dump($excel_data);
|
||||
if($error_data->error_type == 1){
|
||||
|
||||
$finalArray = [];
|
||||
foreach ($error_data->error_data as $key => $value) {
|
||||
|
||||
foreach ($value as $key2 => $value2) {
|
||||
$error_data = $value2->error;
|
||||
$data = ['value' => $excel_data[$key][$value2->col_idx], 'error'=>$error_data,];
|
||||
$excel_data[$key][$value2->col_idx] = $data;
|
||||
|
||||
}
|
||||
array_push($finalArray, $excel_data[$key]);
|
||||
}
|
||||
|
||||
foreach ($finalArray as $fkey => $value){
|
||||
foreach ($value as $vkey => $arrayData){
|
||||
if(!is_array($arrayData)){
|
||||
$data = ['value' => $arrayData];
|
||||
$finalArray[$fkey][$vkey] = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$excelErrorData['excel_data'] = $finalArray;
|
||||
return $excelErrorData;
|
||||
|
||||
$excelErrorData['excel_data'] = $finalArray;
|
||||
return $excelErrorData;
|
||||
|
||||
}else if($error_data->error_type == 2){
|
||||
}else if($error_data->error_type == 2){
|
||||
|
||||
|
||||
$allErrors = [];
|
||||
$typeTowArray = [];
|
||||
$allErrors = [];
|
||||
$typeTowArray = [];
|
||||
|
||||
foreach ($error_data->error_data as $index => $item) {
|
||||
foreach ($error_data->error_data as $index => $item) {
|
||||
|
||||
foreach ($item as $field) {
|
||||
if (!isset($allErrors[$index])) {
|
||||
$allErrors[$index] = [];
|
||||
foreach ($item as $field) {
|
||||
if (!isset($allErrors[$index])) {
|
||||
$allErrors[$index] = [];
|
||||
}
|
||||
$allErrors[$index] = array_merge($allErrors[$index], $field->error);
|
||||
}
|
||||
$allErrors[$index] = array_merge($allErrors[$index], $field->error);
|
||||
}
|
||||
}
|
||||
|
||||
// dd(array_keys($allErrors));
|
||||
foreach ($allErrors as $key => $value){
|
||||
// echo $key;
|
||||
// print_r($value);
|
||||
foreach($excel_data as $excel_data_index => $excel_data_value)
|
||||
{
|
||||
if($excel_data_value[0] == $key)
|
||||
// dd(array_keys($allErrors));
|
||||
foreach ($allErrors as $key => $value){
|
||||
// echo $key;
|
||||
// print_r($value);
|
||||
foreach($excel_data as $excel_data_index => $excel_data_value)
|
||||
{
|
||||
$data = ['value' => $excel_data[$excel_data_index][1], 'error'=>$value,];
|
||||
$excel_data[$excel_data_index][1] = $data;
|
||||
array_push($typeTowArray, $excel_data[$excel_data_index]);
|
||||
break;
|
||||
if($excel_data_value[0] == $key)
|
||||
{
|
||||
$data = ['value' => $excel_data[$excel_data_index][1], 'error'=>$value,];
|
||||
$excel_data[$excel_data_index][1] = $data;
|
||||
array_push($typeTowArray, $excel_data[$excel_data_index]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// dd($data);
|
||||
foreach ($typeTowArray as $fkey => $value){
|
||||
foreach ($value as $vkey => $arrayData){
|
||||
if(!is_array($arrayData)){
|
||||
$data = ['value' => $arrayData];
|
||||
$typeTowArray[$fkey][$vkey] = $data;
|
||||
|
||||
}
|
||||
// dd($data);
|
||||
foreach ($typeTowArray as $fkey => $value){
|
||||
foreach ($value as $vkey => $arrayData){
|
||||
if(!is_array($arrayData)){
|
||||
$data = ['value' => $arrayData];
|
||||
$typeTowArray[$fkey][$vkey] = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$excelErrorData['excel_data'] = $typeTowArray;
|
||||
return $excelErrorData;
|
||||
|
||||
}
|
||||
|
||||
$excelErrorData['excel_data'] = $typeTowArray;
|
||||
return $excelErrorData;
|
||||
}catch (\Exception $e) {
|
||||
// Handle any exceptions
|
||||
$errorMessage = $e->getMessage();//die();
|
||||
$this->myLogger->logme('error', $errorMessage);
|
||||
return false; // You can return an error response here
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
}catch (\Exception $e) {
|
||||
// Handle any exceptions
|
||||
$errorMessage = $e->getMessage();//die();
|
||||
$this->myLogger->logme('error', $errorMessage);
|
||||
return false; // You can return an error response here
|
||||
}
|
||||
public function getFileMetaDataByFileId($file_id, $status = 'success')
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||
|
||||
$data = $this->fileModel
|
||||
$data = $this->fileModel
|
||||
->select('files.*, clients.client_name, clients.short_name, policy_type.policy_type as policy_name,client_branch.branch_code')
|
||||
->join('clients', 'clients.id = files.client_id')
|
||||
->join('client_policy', 'client_policy.id = files.policy_id')
|
||||
@ -2016,11 +2146,9 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||
|
||||
return ['msg_txt' => $msg_txt, 'user_id' => $user_id, 'url' => $url, 'status' => $status, 'title' => $msg_title];
|
||||
}
|
||||
|
||||
|
||||
public function setPullNotification($data){
|
||||
|
||||
|
||||
|
||||
public function setPullNotification($data)
|
||||
{
|
||||
$array = ['message_text' => $data['msg_txt'], 'action_url' => $data['url'], 'msg_status' => $data['status'], 'msg_title' => $data['title']];
|
||||
$jsonEncodeData = json_encode($array);
|
||||
|
||||
@ -2031,17 +2159,14 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||
'role_id' => NULL,
|
||||
'team_id' => NULL,
|
||||
'message_type' => '1to1',
|
||||
];
|
||||
];
|
||||
|
||||
|
||||
$this->messageModel->insert($msg_data);
|
||||
|
||||
|
||||
}
|
||||
$this->messageModel->insert($msg_data);
|
||||
}
|
||||
|
||||
public function employeesEnrollmentInsert($params)
|
||||
{
|
||||
// dd($this->request);
|
||||
// dd($this->request);
|
||||
helper('excel_util_helper');
|
||||
//get file name
|
||||
$file_id = $params['file_id'];
|
||||
@ -2059,10 +2184,10 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||
if(!file_exists($file_name_with_path))
|
||||
{
|
||||
//file not found update status and reason
|
||||
$message = "Physical file not found";
|
||||
$message = "Physical file not found";
|
||||
// echo $message;
|
||||
$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);
|
||||
}
|
||||
|
||||
@ -2077,7 +2202,8 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||
$allowedHighestColumn = end($columns_to_check);
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
|
||||
// print_r($keys);die();
|
||||
//get existing units in the current branch
|
||||
|
||||
//get existing units in the current branch
|
||||
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'],client_branch_id: $file['client_branch_id']);
|
||||
//remove header
|
||||
unset($excel_data[0]);
|
||||
@ -2109,11 +2235,11 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||
{
|
||||
$temp_unit = $existing_units[0];
|
||||
}
|
||||
|
||||
|
||||
$value['emp_code'] = $row[1];
|
||||
$value['name'] = $row[2];
|
||||
$value['doj'] = (!empty($row[3]) ? change_date_format($row[3],'d-M-Y','Y-m-d') : null );
|
||||
$value['gender'] = $row[4];
|
||||
$value['gender'] = normalizeGender($row[4]);
|
||||
$value['relationship'] = ucfirst(trim($row[5]));
|
||||
$value['dob'] = change_date_format($row[6],'d-M-Y','Y-m-d');
|
||||
$value['email_corporate'] = $row[7];
|
||||
@ -2149,10 +2275,10 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||
$policy_data['date_coverage'] = $row[13] != "" && $row[13] != null ? change_date_format($row[13],'d-M-Y','Y-m-d') : null;
|
||||
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||
|
||||
$employee = $this->employeeModel->checkExistingEmployee($value,$file['client_branch_id']);
|
||||
unset($value['temp']);
|
||||
$employee = $this->employeeModel->checkExistingEmployee($value,$file['client_branch_id']);
|
||||
unset($value['temp']);
|
||||
//save employee table
|
||||
// dd($employee['id']);
|
||||
// dd($employee['id']);
|
||||
if($employee !== null)
|
||||
{
|
||||
$value['updated_by'] = $file['created_by'];
|
||||
@ -2170,11 +2296,11 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||
|
||||
$value = ExcelSanitizeHelper::sanitizeArrayData($value);
|
||||
$this->employeeModel->save($value);
|
||||
if (isset($value['id']))
|
||||
{ $emp_id = $value['id']; }
|
||||
else { $emp_id = $this->employeeModel->getInsertID();
|
||||
if (isset($value['id']))
|
||||
{ $emp_id = $value['id']; }
|
||||
else { $emp_id = $this->employeeModel->getInsertID();
|
||||
$log_message .= $emp_id;
|
||||
}
|
||||
}
|
||||
|
||||
// $emp_id = $this->employeeModel->getInsertID();
|
||||
// if($emp_id != 0){ $log_message .= $emp_id; }
|
||||
@ -2232,8 +2358,8 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||
'employee_id' => $emp_id,
|
||||
'mail_type' => 'member_welcome_mail',
|
||||
];
|
||||
//store email and mail content via helper to send notification
|
||||
$emp_emails[] = sendMailNotification::sendMailNotification('member_welcome_mail', $params);
|
||||
//store email and mail content via helper to send notification
|
||||
$emp_emails[] = sendMailNotification::sendMailNotification('member_welcome_mail', $params);
|
||||
}
|
||||
}
|
||||
}// endof if row is empty check
|
||||
@ -2241,7 +2367,7 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||
|
||||
// dd($emp_emails);
|
||||
|
||||
// for bulk mail queue job push
|
||||
// for bulk mail queue job push
|
||||
if (!empty($emp_emails) && count($emp_emails) > 0) {
|
||||
|
||||
$emp_emails = array_chunk($emp_emails, 20);
|
||||
@ -2259,6 +2385,142 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||
|
||||
|
||||
return true;
|
||||
}//end of employeesEnrollmentInsert
|
||||
} //end of employeesEnrollmentInsert
|
||||
|
||||
// --------- MEMBER DATA AND INCEPTION DATA COMPARISION ------------------------------------------------------------------------
|
||||
|
||||
public function compareMemberDataAndInceptionData($params)
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
|
||||
$file_id = $params['file_id'] ?? null;
|
||||
if (empty($file_id)) {
|
||||
return ['status' => false, 'msg' => 'File ID is missing'];
|
||||
}
|
||||
|
||||
// ✅ Get File Data
|
||||
$file = $this->fileModel->where(['is_active' => 1, 'id' => $file_id])->first();
|
||||
if (empty($file)) {
|
||||
return ['status' => false, 'msg' => 'File not found in DB'];
|
||||
}
|
||||
|
||||
// ✅ Get Client Policy Data
|
||||
$client_policy_data = $this->clientPolicyModel->where(['is_active' => 1, 'id' => $file['policy_id']])->first();
|
||||
if (empty($client_policy_data)) {
|
||||
return ['status' => false, 'msg' => 'Client policy data not found in DB (policy_id: ' . $file['policy_id'] . ')'];
|
||||
}
|
||||
|
||||
// ✅ Get Lead Data
|
||||
$leadModel = new LeadsModel();
|
||||
$lead_data = $leadModel->where(['is_active' => 1, 'id' => $client_policy_data['is_from_lead']])->first();
|
||||
if (empty($lead_data)) {
|
||||
return ['status' => false, 'msg' => 'Lead data not found in DB (lead_id: ' . $client_policy_data['is_from_lead'] . ')'];
|
||||
}
|
||||
|
||||
// ✅ Define File Paths
|
||||
$inception_file_path = !empty($file['file_name']) ? WRITEPATH . "uploads/excel/" . $file['file_name'] : '';
|
||||
$member_file_path = !empty($lead_data['file_name']) ? WRITEPATH . "uploads/lead_files/" . $lead_data['file_name'] : '';
|
||||
|
||||
// ✅ Check Inception File
|
||||
if (empty($file['file_name']) || !file_exists($inception_file_path)) {
|
||||
$message = empty($file['file_name']) ? "Inception file name is missing" : "Inception physical file not found";
|
||||
$this->myLogger->logme('error', "$message for file id $file_id");
|
||||
$this->fileModel->update($file_id, [
|
||||
'status' => 'failed',
|
||||
'reason' => json_encode(['error_summary' => [5], 'error_data' => $message])
|
||||
]);
|
||||
return ['error_summary' => [5], 'error_data' => $message];
|
||||
}
|
||||
|
||||
// ✅ Check Member File
|
||||
if (empty($lead_data['file_name']) || !file_exists($member_file_path)) {
|
||||
$message = empty($lead_data['file_name']) ? "Member file name is missing" : "Member data physical file not found";
|
||||
$this->myLogger->logme('error', "$message for lead id {$lead_data['id']}");
|
||||
$this->fileModel->update($file_id, [
|
||||
'status' => 'failed',
|
||||
'reason' => json_encode(['error_summary' => [5], 'error_data' => $message])
|
||||
]);
|
||||
return ['error_summary' => [5], 'error_data' => $message];
|
||||
}
|
||||
|
||||
|
||||
// ✅ Read Inception Excel
|
||||
$inception_columns = $this->inception_excel_columns;
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inception_file_path);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
$highestRow = $sheet->getHighestDataRow();
|
||||
$allowedColumn = end($inception_columns)['col_cell_name'];
|
||||
$inception_data = $sheet->rangeToArray("A1:{$allowedColumn}{$highestRow}");
|
||||
$inception_data = ExcelSanitizeHelper::sanitizeArrayData($inception_data);
|
||||
|
||||
// ✅ Read Member Excel
|
||||
$member_columns = $this->member_data_excel_columns;
|
||||
$spreadsheet2 = \PhpOffice\PhpSpreadsheet\IOFactory::load($member_file_path);
|
||||
$sheet2 = $spreadsheet2->getSheet(0);
|
||||
$highestRow2 = $sheet2->getHighestDataRow();
|
||||
$allowedColumn2 = end($member_columns)['col_cell_name'];
|
||||
$member_data = $sheet2->rangeToArray("A1:{$allowedColumn2}{$highestRow2}");
|
||||
$member_data = ExcelSanitizeHelper::sanitizeArrayData($member_data);
|
||||
|
||||
// dd($inception_data, $member_data);
|
||||
|
||||
// ✅ Compare Inception Data with Member Data
|
||||
$result = ['error_type' => 2, 'error_summary' => [], 'error_data' => []];
|
||||
|
||||
$inception_data_count = count($inception_data);
|
||||
$member_data_count = count($member_data);
|
||||
|
||||
if ($inception_data_count !== $member_data_count) {
|
||||
$result['error_summary'][] = 15;
|
||||
$result['error_message'] = "
|
||||
<strong>Inception Data Count:</strong>
|
||||
<span class='badge badge-danger'>{$inception_data_count}</span>
|
||||
<strong>Member Data Count:</strong>
|
||||
<span class='badge badge-danger'>{$member_data_count}</span>";
|
||||
}
|
||||
|
||||
foreach ($inception_data as $inception_key => $inception_row) {
|
||||
|
||||
// 🔹 If inception row is empty → stop all further processing
|
||||
if (check_row_is_empty_or_null($inception_row)) {
|
||||
break;
|
||||
}
|
||||
|
||||
$match_found = false;
|
||||
|
||||
foreach ($member_data as $member_row) {
|
||||
if (
|
||||
$inception_row[1] == $member_row[1] && // emp_id / emp_code
|
||||
$inception_row[2] == $member_row[2] && // name_of_emp_dep / name
|
||||
$inception_row[5] == $member_row[3] && // relationship
|
||||
normalizeGender($inception_row[4]) == normalizeGender($member_row[4]) && // gender
|
||||
$inception_row[3] == $member_row[5] && // dob
|
||||
$inception_row[13] == $member_row[7] && // email
|
||||
$inception_row[12] == $member_row[8] // phone / mobile
|
||||
) {
|
||||
$match_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$match_found) {
|
||||
array_push($result['error_summary'], 14);
|
||||
$result['error_data'][$inception_key]['sno']['error'][] = "This inception row was not found in the member data list.";
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ Handle Result
|
||||
if (!empty($result['error_summary'])) {
|
||||
$result['error_summary'] = array_count_values($result['error_summary']);
|
||||
$this->fileModel->update($file_id, [
|
||||
'status' => 'failed',
|
||||
'reason' => json_encode($result)
|
||||
]);
|
||||
$this->myLogger->logme('error', "File ID $file_id comparison failed");
|
||||
} else {
|
||||
Jobs::addJob(['job_name' => 'excelFileDataValidation', 'payload' => ['file_id' => $file_id]]);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -60,6 +60,8 @@ class Home extends PublicController
|
||||
//print_rr($data);
|
||||
}
|
||||
|
||||
|
||||
//for insurer statement upload
|
||||
public function check_gemini_2()
|
||||
{
|
||||
|
||||
@ -203,6 +205,189 @@ class Home extends PublicController
|
||||
|
||||
}
|
||||
|
||||
|
||||
//for insurer policy doc upload
|
||||
public function checkPolicyDoc()
|
||||
{
|
||||
|
||||
try
|
||||
{ // $this->convertToPdf();die();
|
||||
// Replace with your actual Gemini API key
|
||||
$apiKey = getenv('GEMINI_API_KEY');
|
||||
// The model to use and the API endpoint
|
||||
$model = "gemini-pro";
|
||||
$model = getenv('GEMINI_MODEL');
|
||||
// $model = "gemini-1.5-pro";
|
||||
// $model = "gemini-1.5-pro";
|
||||
$url = "https://generativelanguage.googleapis.com/v1beta/models/{$model}:generateContent?key={$apiKey}";
|
||||
|
||||
$filePath = 'C:\Users\Venba\AppData\Local\Programs\Python\pyenv\pdfreader\bike-0904023124P114268957.pdf';
|
||||
$filePath = 'C:\Users\Venba\AppData\Local\Programs\Python\pyenv\pdfreader\car-insurance-0904023124P114213011.pdf';
|
||||
|
||||
// Check if the file exists
|
||||
if (!file_exists($filePath)) {
|
||||
die("Error: File not found at {$filePath}");
|
||||
}
|
||||
|
||||
// Get the file's MIME type using the finfo extension
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$mimeType = finfo_file($finfo, $filePath);
|
||||
finfo_close($finfo);
|
||||
print_r($mimeType);die();
|
||||
// Define supported inline MIME types
|
||||
$supportedInlineMimeTypes = ['application/pdf','text/csv'];
|
||||
|
||||
// Read the file content and encode it to Base64
|
||||
$fileContent = file_get_contents($filePath);
|
||||
$base64Content = base64_encode($fileContent);
|
||||
// The prompt you want to send to the model
|
||||
// $prompt = "give me a json with emp data like name,age,dob,mobile and email. only json not any explanations";
|
||||
$prompt = "Read the following motor policy pdf document and convert into JSON format as sample specified. Give me only JSON,not any explanations.while pick up premium break up give own damage, third party ,personal accident and taxes as mentioned in JSON format.Notes:vehicle_type should be like Two Wheeler,Four Feeler,Good Vehicle,Bus, Tractor,Commercial Vehicle.rto_state_code is first two char of reg_no and rto_city_code 3rd & 4th char of reg_no and it should be two digit numeric code. Any date should be in mysql date format";
|
||||
$prompt .= '"{\"policy\":{\"policy_number\":\"\",\"issue_date\":\"\",\"period\":{\"start\":\"\",\"end\":\"\"},\"insurer\":\"\",\"previous_policy_number\":\"\"},\"insured\":{\"name\":\"\",\"father_name\":\"\",\"address\":[\"\"],\"mobile\":\"\",\"id_proofs\":{\"aadhaar\":\"\",\"pan\":\"\"}},\"vehicle\":{\"reg_no\":\"\",\"rto_state_code\":\"\",\"rto_city_code\":\"\",\"weight\":\"\",\"fuel_type\":\"\",\"date_of_registration\":\"\",\"year_of_manufacture\":\"\",\"engine_no\":\"\",\"chassis_no\":\"\",\"make\":\"\",\"model\":\"\",\"year\":\"\",\"cubic_capacity\":\"\",\"vehicle_type\":\"\"},\"rto\":\"\",\"premium\":{\"tp\":0,\"od\":0,\"pa\":0,\"taxes\":{},\"total\":0,\"in_words\":\"\"},\"endorsements\":[{\"code\":\"\",\"desc\":\"\"}]}"';
|
||||
|
||||
$payloadPart = null;
|
||||
|
||||
// The text part of the prompt
|
||||
$text_part = [
|
||||
"text" => $prompt
|
||||
];
|
||||
// Conditionally handle the file upload based on MIME type
|
||||
if (in_array($mimeType, $supportedInlineMimeTypes)) {
|
||||
// echo "Detected supported format inline MIME type ({$mimeType})";
|
||||
// Handle PDF as inline data
|
||||
$fileContent = file_get_contents($filePath);
|
||||
$base64Content = base64_encode($fileContent);
|
||||
$payloadPart = [
|
||||
"inlineData" => [
|
||||
"mimeType" => $mimeType,
|
||||
"data" => $base64Content
|
||||
]
|
||||
];
|
||||
|
||||
$content_parts = [
|
||||
"parts" => [
|
||||
$text_part,
|
||||
$payloadPart
|
||||
]
|
||||
];
|
||||
} else {
|
||||
// Handle Excel/CSV using the Files API
|
||||
// echo "Detected unsupported inline MIME type ({$mimeType}). Uploading via Files API...\n";
|
||||
$fileInfo = $this->uploadFileToGemini($filePath, $apiKey); // Pass apiKey
|
||||
|
||||
// print_r($fileInfo);
|
||||
// The file part, using the URI from the Files API upload
|
||||
$file_part = [
|
||||
"fileData" => [
|
||||
"fileUri" => $fileInfo['uri'],
|
||||
"mimeType" => $fileInfo['mimeType']
|
||||
]
|
||||
];
|
||||
|
||||
// The full content array, containing both parts
|
||||
$content_parts = [
|
||||
"parts" => [
|
||||
$text_part,
|
||||
$file_part
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// The final JSON payload
|
||||
$data = [
|
||||
"contents" => [
|
||||
$content_parts
|
||||
]
|
||||
];
|
||||
|
||||
// Encode the data to a JSON string
|
||||
$json_data = json_encode($data);
|
||||
|
||||
// Initialize cURL
|
||||
$ch = curl_init($url);
|
||||
|
||||
// Set cURL options
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); // Set the Content-Type header
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data); // Set the JSON payload
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return the response as a string
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Optional: to bypass SSL verification if needed (not recommended for production)
|
||||
|
||||
// Execute the cURL request and get the response
|
||||
$response = curl_exec($ch);
|
||||
|
||||
// Check for cURL errors
|
||||
if (curl_errno($ch)) {
|
||||
$curl_error = curl_error($ch);
|
||||
throw new Exception("cURL Error: " . $curl_error);
|
||||
}
|
||||
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
|
||||
// Close the cURL handle
|
||||
curl_close($ch);
|
||||
$ch = null; // Mark handle as closed
|
||||
// Check for non-successful HTTP status codes
|
||||
if ($http_code < 200 || $http_code >= 300) {
|
||||
throw new Exception("API returned non-successful HTTP status code: $http_code. Response: " . substr($response, 0, 200) . '...');
|
||||
}
|
||||
|
||||
// Decode the JSON response
|
||||
$responseData = json_decode($response, true, 512, JSON_THROW_ON_ERROR);
|
||||
$text_path = $responseData['candidates'][0]['content']['parts'][0]['text'] ?? null;
|
||||
|
||||
if ($text_path) {
|
||||
$generatedText = $text_path;
|
||||
log_message('info', "Successfully received generated text.");
|
||||
|
||||
// 9. Attempt to extract and decode the exact JSON from the generated text
|
||||
$json_string = '';
|
||||
|
||||
// Preferred: Regex to find content inside a JSON markdown block: ```json\n(.*?)\n```
|
||||
$extracted_json_match = [];
|
||||
if (preg_match('/```json\s*(.*?)\s*```/s', $generatedText, $extracted_json_match)) {
|
||||
$json_string = trim($extracted_json_match[1]);
|
||||
} else {
|
||||
// Fallback: Find the first '{' and the last '}'
|
||||
$start = strpos($generatedText, '{');
|
||||
$end = strrpos($generatedText, '}');
|
||||
if ($start !== false && $end !== false && $end > $start) {
|
||||
$json_string = substr($generatedText, $start, $end - $start + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($json_string)) {
|
||||
throw new Exception("Could not extract a valid JSON string from the generated text.");
|
||||
}
|
||||
|
||||
// Decode the extracted JSON string
|
||||
$final_data = json_decode($json_string, true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
log_message('info', "Extracted and decoded final JSON data successfully.");
|
||||
echo '<pre>';
|
||||
print_r($final_data);
|
||||
// return $final_data;
|
||||
|
||||
} else {
|
||||
// No generated text found, possibly a model safety block or API structure change
|
||||
throw new Exception("Response structure invalid or no generated text candidate found.");
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
// Log the error
|
||||
log_message('ERROR', "$request_id: Fatal Error: " . $e->getMessage());
|
||||
|
||||
// Ensure cURL handle is closed if an exception occurred after initialization but before closing
|
||||
if ($ch !== null) {
|
||||
curl_close($ch);
|
||||
}
|
||||
return null; // Return null on failure
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Function to upload a file to the Gemini Files API
|
||||
|
||||
@ -171,6 +171,10 @@ class JobWorker extends AdminController
|
||||
'type' => 'CC', // Handler Category
|
||||
'handler' => 'App\Controllers\LeadsController',
|
||||
],
|
||||
'compareMemberDataAndInceptionData' => [
|
||||
'type' => 'CC', // Handler Category
|
||||
'handler' => 'App\Controllers\EmployeeServiceController',
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ class LeadsController extends BaseController
|
||||
protected $issuer;
|
||||
protected $clientType;
|
||||
protected $leadType;
|
||||
protected $leadsStatus;
|
||||
public $leadsStatus;
|
||||
protected $claim_type_for_gpa;
|
||||
protected $cause_of_death;
|
||||
protected $buisnessType;
|
||||
@ -344,10 +344,15 @@ class LeadsController extends BaseController
|
||||
$where = [];
|
||||
foreach ($search_data as $search_objects => $key) {
|
||||
if ($key != null && $key != '' && $key != 0 && $search_objects != 'is_dashboard') {
|
||||
$where[$search_objects] = $key;
|
||||
if($search_objects == 'status')
|
||||
{
|
||||
$where[('leads.'.$search_objects)] = $key;
|
||||
}else{
|
||||
$where[$search_objects] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// !dd($where);
|
||||
$data['lead_data_list'] = $this->leadsModel->getLeadDataForLising($where);
|
||||
|
||||
$html = view('leads_list', $data);
|
||||
@ -665,7 +670,10 @@ class LeadsController extends BaseController
|
||||
if ($value['lead_form_type'] == 1) {
|
||||
//for this push the job to the calculateMembersDemography() function
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'memberDataListExcelFileFormatValidation', 'payload' => [
|
||||
// $r = Jobs::addJob(['job_name' => 'memberDataListExcelFileFormatValidation', 'payload' => [
|
||||
// 'lead_id' => $insert,
|
||||
// ]]);
|
||||
$r = Jobs::addJob(['job_name' => 'calculateMembersDemography', 'payload' => [
|
||||
'lead_id' => $insert,
|
||||
]]);
|
||||
}
|
||||
@ -773,7 +781,7 @@ class LeadsController extends BaseController
|
||||
|
||||
$multi_file_data = [];
|
||||
foreach ($files as $index => $value) {
|
||||
$file_name = file_Upload($value, $uploadFilePath);
|
||||
$file_name = file_Upload_for_lead($value, $uploadFilePath);
|
||||
$multi_file_data[] = [
|
||||
'file_name' => $file_name,
|
||||
'docs_name' => $docs_names[$index],
|
||||
@ -809,7 +817,10 @@ class LeadsController extends BaseController
|
||||
if (!empty($lead_form_type) && $lead_form_type == 1 && $key == 0) {
|
||||
//for this push the job to the calculateMembersDemography() function
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'memberDataListExcelFileFormatValidation', 'payload' => [
|
||||
// $r = Jobs::addJob(['job_name' => 'memberDataListExcelFileFormatValidation', 'payload' => [
|
||||
// 'lead_id' => $lead_id,
|
||||
// ]]);
|
||||
$r = Jobs::addJob(['job_name' => 'calculateMembersDemography', 'payload' => [
|
||||
'lead_id' => $lead_id,
|
||||
]]);
|
||||
log_message('info', "calculateMembersDemography JOB PUSHED");
|
||||
@ -1024,14 +1035,7 @@ class LeadsController extends BaseController
|
||||
// 3. Optimize lead data query with specific field selection
|
||||
$lead_data = $this->leadsModel
|
||||
->select('
|
||||
leads.id,
|
||||
leads.policy_type_id,
|
||||
leads.lead_type,
|
||||
leads.source_policy_id,
|
||||
leads.policy_end_date,
|
||||
leads.lead_form_type,
|
||||
leads.created_by,
|
||||
leads.client_name,
|
||||
leads.*,
|
||||
lead_files.status as demography_file_status,
|
||||
policy_type.question_json,
|
||||
policy_type.policy_type,
|
||||
@ -1090,6 +1094,7 @@ class LeadsController extends BaseController
|
||||
|
||||
// 7. Define mail templates as constants or config
|
||||
$mail_content = $this->getMailTemplate();
|
||||
$placement_mail_content = $this->getMailTemplate('placement');
|
||||
$subject = $this->getSubjectTemplate($lead_data);
|
||||
|
||||
// 8. Pre-calculate sum assured only for GPA
|
||||
@ -1098,7 +1103,7 @@ class LeadsController extends BaseController
|
||||
// 9. Transform mail content once
|
||||
$data['mail_content'] = $this->transformMailContent($lead_data, $mail_content, $data['page_name']);
|
||||
$data['subject'] = $this->transformMailContent($lead_data, $subject, $data['page_name']);
|
||||
$data['placement_mail_content'] = $this->transformMailContent($lead_data, $mail_content, 'Placement');
|
||||
$data['placement_mail_content'] = $this->transformMailContent($lead_data, $placement_mail_content, 'Placement');
|
||||
$data['placement_subject'] = $this->transformMailContent($lead_data, $subject, 'Placement');
|
||||
|
||||
// 10. Combine related queries
|
||||
@ -1151,24 +1156,43 @@ class LeadsController extends BaseController
|
||||
}
|
||||
|
||||
// 13. Extract mail template to separate method for reusability
|
||||
private function getMailTemplate()
|
||||
{
|
||||
return '
|
||||
<p>Dear Sir,</p>
|
||||
<p>Greetings From Nhance India!</p>
|
||||
<p>Please find attached the {{RFQ_OR_QCR}} for <strong>{{POLICY_TYPE}}</strong> policy pertaining to <strong>{{CLIENT_NAME}}</strong>.</p>
|
||||
<p>Kindly request you to share the competitive quotes at the earliest.</p>
|
||||
<p>In case of any query, please feel free to contact us.</p>
|
||||
<p>Thank You!</p><br>
|
||||
<p>Best regards,</p>
|
||||
private function getMailTemplate( $template_type = "" )
|
||||
{
|
||||
if($template_type == 'placement'){
|
||||
return '
|
||||
<p>Dear Sir,</p>
|
||||
<p>Greetings From Nhance India!</p>
|
||||
<p>Please find attached the {{RFQ_OR_QCR}} for <strong>{{POLICY_TYPE}}</strong> policy pertaining to <strong>{{CLIENT_NAME}}</strong>.</p>
|
||||
<p>Kindly request you to issue the policy at the earliest.</p>
|
||||
<p>In case of any query, please feel free to contact us.</p>
|
||||
<p>Thank You!</p><br>
|
||||
<p>Best regards,</p>
|
||||
|
||||
<div style="margin: 0; padding: 0; line-height: 1.2;">
|
||||
<div>{{LOGGED_USER_NAME}}</div>
|
||||
<div>Mobile: {{LOGGED_USER_MOBILE}}</div>
|
||||
</div>
|
||||
|
||||
<div style="margin: 0; padding: 0; line-height: 1.2;">
|
||||
<div>{{LOGGED_USER_NAME}}</div>
|
||||
<div>Mobile: {{LOGGED_USER_MOBILE}}</div>
|
||||
</div>
|
||||
|
||||
<img src="{{LOGO_PATH}}" alt="Nhance Logo" width="100" style="margin-top:10px;">
|
||||
';
|
||||
<img src="{{LOGO_PATH}}" alt="Nhance Logo" width="100" style="margin-top:10px;">
|
||||
';
|
||||
}else{
|
||||
return '
|
||||
<p>Dear Sir,</p>
|
||||
<p>Greetings From Nhance India!</p>
|
||||
<p>Please find attached the {{RFQ_OR_QCR}} for <strong>{{POLICY_TYPE}}</strong> policy pertaining to <strong>{{CLIENT_NAME}}</strong>.</p>
|
||||
<p>Kindly request you to share the competitive quotes at the earliest.</p>
|
||||
<p>In case of any query, please feel free to contact us.</p>
|
||||
<p>Thank You!</p><br>
|
||||
<p>Best regards,</p>
|
||||
|
||||
<div style="margin: 0; padding: 0; line-height: 1.2;">
|
||||
<div>{{LOGGED_USER_NAME}}</div>
|
||||
<div>Mobile: {{LOGGED_USER_MOBILE}}</div>
|
||||
</div>
|
||||
|
||||
<img src="{{LOGO_PATH}}" alt="Nhance Logo" width="100" style="margin-top:10px;">
|
||||
';
|
||||
}
|
||||
}
|
||||
|
||||
// 14. Extract subject template to separate method
|
||||
@ -1776,6 +1800,24 @@ class LeadsController extends BaseController
|
||||
|
||||
// dd($rfq_data, $lead_id, $type, $propsal_and_insurer);
|
||||
// print_r($propsal_and_insurer); die;
|
||||
// print_r($is_placement); die;
|
||||
|
||||
$data = json_decode($rfq_data['json'], true);
|
||||
$sheetName = 'Worksheet';
|
||||
if ($type == 2) {
|
||||
$sheetName = 'QCR';
|
||||
// $propsal_and_insurer = "Proposal 1-ICICIPRU-ICICI001";
|
||||
$data = $this->convertJsonForQCR($data, $type);
|
||||
if ($propsal_and_insurer !== null) {
|
||||
list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2);
|
||||
$data = $this->transformProposelData($data, $proposal_key, $insurer_key);
|
||||
$is_placement = true;
|
||||
$sheetName = 'Placement';
|
||||
}
|
||||
} else if ($type == 1) {
|
||||
$sheetName = 'RFQ';
|
||||
$data = $this->convertJsonForQCR($data, $type);
|
||||
} // dd($data);
|
||||
|
||||
if ($rfq_data['lead_type'] == 1) {
|
||||
|
||||
@ -1808,36 +1850,71 @@ class LeadsController extends BaseController
|
||||
} else {
|
||||
|
||||
if (in_array($rfq_data['policy_type_id'], [2, 3, 4, 5])) {
|
||||
$lead_data = [
|
||||
if($is_placement == true){
|
||||
$lead_data = [
|
||||
|
||||
'Insured' => $rfq_data['client_name'],
|
||||
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
|
||||
'Insured' => $rfq_data['client_name'],
|
||||
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
|
||||
|
||||
// 'No of Employees at Inception' => $rfq_data['incept_emp_count'],
|
||||
// 'No of Dependents at Inception' => $rfq_data['incept_dept_count'],
|
||||
// 'Total Lives at Inception ' => $rfq_data['incept_no_of_lives'],
|
||||
// 'No of Employees at Inception' => $rfq_data['incept_emp_count'],
|
||||
// 'No of Dependents at Inception' => $rfq_data['incept_dept_count'],
|
||||
// 'Total Lives at Inception ' => $rfq_data['incept_no_of_lives'],
|
||||
|
||||
// 'No of Employees at Expiry' => $rfq_data['exp_emp_count'],
|
||||
// 'No of Dependents at Expiry' => $rfq_data['exp_dept_count'],
|
||||
// 'Total Lives at Expiry ' => $rfq_data['exp_no_of_lives'],
|
||||
// 'No of Employees at Expiry' => $rfq_data['exp_emp_count'],
|
||||
// 'No of Dependents at Expiry' => $rfq_data['exp_dept_count'],
|
||||
// 'Total Lives at Expiry ' => $rfq_data['exp_no_of_lives'],
|
||||
|
||||
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
|
||||
'No of Dependents at Renewal' => $rfq_data['renewal_dept_count'],
|
||||
'Total Lives at Renewal ' => $rfq_data['renewal_no_of_lives'],
|
||||
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
|
||||
'No of Dependents at Renewal' => $rfq_data['renewal_dept_count'],
|
||||
'Total Lives at Renewal ' => $rfq_data['renewal_no_of_lives'],
|
||||
|
||||
'Period of Insurance ' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d-m-Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d-m-Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
||||
'Insurer' => $rfq_data['insurer_name'] ?? " - ",
|
||||
'TPA' => $rfq_data['tpa_name'] ?? " - ",
|
||||
'Period of Insurance ' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d-m-Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d-m-Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
||||
'Insurer' => $rfq_data['insurer_name'] ?? " - ",
|
||||
'TPA' => $rfq_data['tpa_name'] ?? " - ",
|
||||
|
||||
// 'Policy Run Days' => $rfq_data['policy_run_days'],
|
||||
// 'Inception Premium' => formatIndianCurrency($rfq_data['premium_at_inception']),
|
||||
// 'Premium as on (' . date('d-m-Y', strtotime($rfq_data['incurred_claims_date'])) . ')' => formatIndianCurrency($rfq_data['premium_date']),
|
||||
// 'Earned Premium' => formatIndianCurrency(intval($rfq_data['earned_premium'])),
|
||||
// 'Incurred Claims as on (' . date('d-m-Y', strtotime($rfq_data['incurred_claims_date'])) . ')' => formatIndianCurrency($rfq_data['incurred_claims']),
|
||||
// 'Annualised Claims' => formatIndianCurrency(intval($rfq_data['annualised_claims'])),
|
||||
// 'Incurred Claims Ratio' => $rfq_data['incurred_claims_ratio'] . " %",
|
||||
// 'Earned Claims Ratio' => $rfq_data['earned_claims_ratio'] . " %",
|
||||
];
|
||||
// 'Policy Run Days' => $rfq_data['policy_run_days'],
|
||||
// 'Inception Premium' => formatIndianCurrency($rfq_data['premium_at_inception']),
|
||||
// 'Premium as on (' . date('d-m-Y', strtotime($rfq_data['incurred_claims_date'])) . ')' => formatIndianCurrency($rfq_data['premium_date']),
|
||||
// 'Earned Premium' => formatIndianCurrency(intval($rfq_data['earned_premium'])),
|
||||
// 'Incurred Claims as on (' . date('d-m-Y', strtotime($rfq_data['incurred_claims_date'])) . ')' => formatIndianCurrency($rfq_data['incurred_claims']),
|
||||
// 'Annualised Claims' => formatIndianCurrency(intval($rfq_data['annualised_claims'])),
|
||||
// 'Incurred Claims Ratio' => $rfq_data['incurred_claims_ratio'] . " %",
|
||||
// 'Earned Claims Ratio' => $rfq_data['earned_claims_ratio'] . " %",
|
||||
];
|
||||
}else{
|
||||
$lead_data = [
|
||||
'Insured' => $rfq_data['client_name'],
|
||||
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
|
||||
|
||||
'No of Employees at Inception' => $is_placement ? '-' : $rfq_data['incept_emp_count'],
|
||||
'No of Dependents at Inception' => $is_placement ? '-' : $rfq_data['incept_dept_count'],
|
||||
'Total Lives at Inception ' => $is_placement ? '-' : $rfq_data['incept_no_of_lives'],
|
||||
|
||||
'No of Employees at Expiry' => $is_placement ? '-' : $rfq_data['exp_emp_count'],
|
||||
'No of Dependents at Expiry' => $is_placement ? '-' : $rfq_data['exp_dept_count'],
|
||||
'Total Lives at Expiry ' => $is_placement ? '-' : $rfq_data['exp_no_of_lives'],
|
||||
|
||||
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
|
||||
'No of Dependents at Renewal' => $rfq_data['renewal_dept_count'],
|
||||
'Total Lives at Renewal ' => $rfq_data['renewal_no_of_lives'],
|
||||
|
||||
'Period of Insurance ' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date'])
|
||||
? date('d-m-Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d-m-Y', strtotime($rfq_data['policy_end_date']))
|
||||
: "To be decided",
|
||||
|
||||
'Insurer' => $rfq_data['insurer_name'] ?? " - ",
|
||||
'TPA' => $rfq_data['tpa_name'] ?? " - ",
|
||||
|
||||
'Policy Run Days' => $is_placement ? '-' : $rfq_data['policy_run_days'],
|
||||
'Inception Premium' => $is_placement ? '-' : formatIndianCurrency($rfq_data['premium_at_inception']),
|
||||
'Premium as on (' . date('d-m-Y', strtotime($rfq_data['incurred_claims_date'])) . ')' => $is_placement ? '-' : formatIndianCurrency($rfq_data['premium_date']),
|
||||
'Earned Premium' => $is_placement ? '-' : formatIndianCurrency(intval($rfq_data['earned_premium'])),
|
||||
'Incurred Claims as on (' . date('d-m-Y', strtotime($rfq_data['incurred_claims_date'])) . ')' => $is_placement ? '-' : formatIndianCurrency($rfq_data['incurred_claims']),
|
||||
'Annualised Claims' => $is_placement ? '-' : formatIndianCurrency(intval($rfq_data['annualised_claims'])),
|
||||
'Incurred Claims Ratio' => $is_placement ? '-' : $rfq_data['incurred_claims_ratio'] . " %",
|
||||
'Earned Claims Ratio' => $is_placement ? '-' : $rfq_data['earned_claims_ratio'] . " %",
|
||||
];
|
||||
}
|
||||
} else if (in_array($rfq_data['policy_type_id'], [1, 6, 7])) {
|
||||
|
||||
$lead_data = [
|
||||
@ -1857,27 +1934,8 @@ class LeadsController extends BaseController
|
||||
];
|
||||
}
|
||||
}
|
||||
// print_r($lead_data); die;
|
||||
|
||||
$data = json_decode($rfq_data['json'], true);
|
||||
// dd($data);
|
||||
|
||||
$sheetName = 'Worksheet';
|
||||
if ($type == 2) {
|
||||
$sheetName = 'QCR';
|
||||
// $propsal_and_insurer = "Proposal 1-ICICIPRU-ICICI001";
|
||||
$data = $this->convertJsonForQCR($data, $type);
|
||||
if ($propsal_and_insurer !== null) {
|
||||
list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2);
|
||||
$data = $this->transformProposelData($data, $proposal_key, $insurer_key);
|
||||
$is_placement = true;
|
||||
$sheetName = 'Placement';
|
||||
}
|
||||
} else if ($type == 1) {
|
||||
$sheetName = 'RFQ';
|
||||
$data = $this->convertJsonForQCR($data, $type);
|
||||
// dd($data);
|
||||
}
|
||||
// dd($data);
|
||||
|
||||
$spreadsheet = new Spreadsheet();
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
@ -3646,7 +3704,7 @@ class LeadsController extends BaseController
|
||||
private function prepareClientData($data)
|
||||
{
|
||||
return [
|
||||
'client_type' => $data['client_type'] ?? null,
|
||||
'client_type' => 1,
|
||||
'entity_type_id' => $data['entity_type_id'] ?? null,
|
||||
'client_code' => $data['client_code'] ?? null,
|
||||
'client_name' => $data['client_name'] ?? null,
|
||||
@ -3696,6 +3754,8 @@ class LeadsController extends BaseController
|
||||
'policy_start_date' => $data['policy_start_date'],
|
||||
'policy_end_date' => $data['policy_end_date'],
|
||||
'policy_status' => 1,
|
||||
'policy_entry_from' => 3,
|
||||
'is_from_lead' => $data['id'],
|
||||
];
|
||||
|
||||
$policy_type_id = $data['policy_type_id'];
|
||||
@ -5239,10 +5299,10 @@ class LeadsController extends BaseController
|
||||
'filePath' => $fullPath
|
||||
];
|
||||
} else {
|
||||
log_message('warning', 'File name is empty for ID: ' . $id);
|
||||
log_message('error', 'File name is empty for ID: ' . $id);
|
||||
}
|
||||
} else {
|
||||
log_message('warning', 'File does not exist at path: ' . $fullPath);
|
||||
log_message('error', 'File does not exist at path: ' . $fullPath);
|
||||
}
|
||||
} else {
|
||||
log_message('warning', 'No active lead file found for ID: ' . $id . ' and lead_id: ' . $lead_id);
|
||||
|
||||
@ -33,8 +33,11 @@ use App\Models\ClientDepositModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Models\FileModel;
|
||||
use App\Models\InsurerExcelExportTemplateModel;
|
||||
use App\Models\NhanceBranchModel;
|
||||
use App\Models\SettingsModel;
|
||||
use App\Models\VehicleModel;
|
||||
use App\Models\VehicleTypeModel;
|
||||
use App\Models\RTOModel;
|
||||
|
||||
use CodeIgniter\CLI\CLI;
|
||||
|
||||
@ -351,6 +354,15 @@ class MasterController extends AdminController
|
||||
exit();
|
||||
}
|
||||
|
||||
public function getInsurerBranchList()
|
||||
{
|
||||
$id = $this->request->getPost('insurer_id');
|
||||
|
||||
$insurer_branch_list = $this->insurerBranchModel->where(['insurer_id' => $id, 'is_active' => 1])->findAll()??[];
|
||||
|
||||
return $this->response->setJSON([ 'data' => $insurer_branch_list ])->setStatusCode(200);
|
||||
}
|
||||
|
||||
public function editInsurerGeneralInfo()
|
||||
{
|
||||
$this->myLogger->logme('error','edit Insurer general info function called');
|
||||
@ -1347,6 +1359,16 @@ class MasterController extends AdminController
|
||||
// === INSERT ===
|
||||
if (empty($id)) {
|
||||
|
||||
$cd_acc_count = $this->CDMasterModel->where('is_active', 1)
|
||||
->where('client_id', $data['client_id'])
|
||||
->where('insurer_id', $data['insurer_id'])
|
||||
->where('insurer_branch_id', $data['insurer_branch_id'])
|
||||
->countAllResults();
|
||||
|
||||
if($cd_acc_count > 0){
|
||||
return $this->respond(['status' => false, 'message' => 'A CD account has already been created for this client, insurer, and insurer branch combination.'], 200);
|
||||
}
|
||||
|
||||
$this->myLogger->logme("error", 'Performing INSERT operation.');
|
||||
$insert = $this->CDMasterModel->insert($data);
|
||||
$this->myLogger->logme("error", 'Insert result: ' . json_encode($insert));
|
||||
@ -1571,6 +1593,15 @@ class MasterController extends AdminController
|
||||
|
||||
$data['insurer_branch_id'] = $insurer_branch_id;
|
||||
|
||||
$cd_acc_count = $this->CDMasterModel->where('is_active', 1)
|
||||
->where('client_id', $data['client_id'])
|
||||
->where('insurer_id', $data['insurer_id'])
|
||||
->where('insurer_branch_id', $data['insurer_branch_id'])
|
||||
->countAllResults();
|
||||
|
||||
if($cd_acc_count > 0){
|
||||
return $this->respond(['status' => false, 'message' => 'A CD account has already been created for this client, insurer, and insurer branch combination.'], 200);
|
||||
}
|
||||
|
||||
// array with data for CD Traction table
|
||||
$cd_tranction_data = [
|
||||
@ -1614,11 +1645,30 @@ class MasterController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function checkDuplicateCdAccount()
|
||||
{
|
||||
$data = $this->request->getGet();
|
||||
|
||||
$cd_acc_count = $this->CDMasterModel
|
||||
->where('is_active', 1)
|
||||
->where('client_id', $data['client_id'])
|
||||
->where('insurer_id', $data['insurer_id'])
|
||||
->where('insurer_branch_id', $data['insurer_branch_id'])
|
||||
->countAllResults();
|
||||
|
||||
if($cd_acc_count > 0){
|
||||
return $this->respond(['status' => false, 'message' => 'A CD account has already been created for this client, insurer, and insurer branch combination.'], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => true], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Vehicle Master data Function
|
||||
|
||||
public function VehicleMasterList()
|
||||
{ $data['tab_name'] = 'Vehicle Master';
|
||||
{
|
||||
$data['tab_name'] = 'Vehicle Master';
|
||||
$data['page_name'] = 'Vehicles';
|
||||
$data['vehicle_type'] = [
|
||||
'two_wheeler' => 'Two Wheeler',
|
||||
@ -2020,4 +2070,255 @@ class MasterController extends AdminController
|
||||
dd($result);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
|
||||
public function nhanceBranchMaster()
|
||||
{
|
||||
$nhanceBranchModel = new NhanceBranchModel();
|
||||
$method = $this->request->getMethod();
|
||||
$data['tab_name'] = 'Nhance Branch';
|
||||
$data['page_name'] = 'Nhance Branchs';
|
||||
|
||||
if ($method === 'post') {
|
||||
|
||||
$id = $this->request->getPost('pk') ?? null;
|
||||
$data = $this->request->getPost();
|
||||
|
||||
if (empty($id)) {
|
||||
$update_status = $nhanceBranchModel->insert($data);
|
||||
} else {
|
||||
$update_status = $nhanceBranchModel->where('id', $id)->set($data)->update();
|
||||
}
|
||||
|
||||
if ($update_status) {
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'message' => 'Nhance Branch Master updated successfully',
|
||||
'data' => $data
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 400,
|
||||
'message' => 'Failed to update',
|
||||
'data' => $data
|
||||
], 200);
|
||||
}
|
||||
|
||||
} elseif ($method === 'get') {
|
||||
|
||||
$id = $this->request->getGet('pk') ?? null;
|
||||
|
||||
if (!empty($id)) {
|
||||
$data = $nhanceBranchModel->where('is_active', 1)->where('id', $id)->findAll();
|
||||
if (!empty($data)) {
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $data], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
$data = $nhanceBranchModel->where('is_active', 1)->orderBy('id', 'DESC')->findAll();
|
||||
return $this->loadLayout('nhance_branch_list', ['data' => $data]);
|
||||
|
||||
} elseif ($method === 'delete') {
|
||||
|
||||
$input = $this->request->getRawInput();
|
||||
$id = $input['pk'] ?? null;
|
||||
|
||||
if (empty($id)) {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 404,
|
||||
'message' => 'No ID provided for deletion'
|
||||
], 200);
|
||||
}
|
||||
|
||||
$update_status = $nhanceBranchModel->where('id', $id)->set(['is_active' => 0])->update();
|
||||
|
||||
if ($update_status) {
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'message' => 'Data removed successfully',
|
||||
'pk' => $id
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 400,
|
||||
'message' => 'Failed to remove data',
|
||||
'pk' => $id
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function vehicleTypeMaster()
|
||||
{
|
||||
$vehicleTypeModel = new VehicleTypeModel();
|
||||
$method = $this->request->getMethod();
|
||||
$data['tab_name'] = 'Vehicle Type';
|
||||
$data['page_name'] = 'Vehicle Types';
|
||||
if ($method === 'post') {
|
||||
|
||||
$id = $this->request->getPost('pk') ?? null;
|
||||
$data = $this->request->getPost();
|
||||
|
||||
if (empty($id)) {
|
||||
$update_status = $vehicleTypeModel->insert($data);
|
||||
} else {
|
||||
$update_status = $vehicleTypeModel->where('id', $id)->set($data)->update();
|
||||
}
|
||||
|
||||
if ($update_status) {
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'message' => 'Vehicle Type Master updated successfully',
|
||||
'data' => $data
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 400,
|
||||
'message' => 'Failed to update',
|
||||
'data' => $data
|
||||
], 200);
|
||||
}
|
||||
|
||||
} elseif ($method === 'get') {
|
||||
|
||||
$id = $this->request->getGet('pk') ?? null;
|
||||
|
||||
if (!empty($id)) {
|
||||
$data = $vehicleTypeModel->where('is_active', 1)->where('id', $id)->findAll();
|
||||
if (!empty($data)) {
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $data], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
$data = $vehicleTypeModel->where('is_active', 1)->orderBy('id', 'DESC')->findAll();
|
||||
return $this->loadLayout('vehicle_type_master_list', ['data' => $data]);
|
||||
|
||||
} elseif ($method === 'delete') {
|
||||
|
||||
$input = $this->request->getRawInput();
|
||||
$id = $input['pk'] ?? null;
|
||||
|
||||
if (empty($id)) {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 404,
|
||||
'message' => 'No ID provided for deletion'
|
||||
], 200);
|
||||
}
|
||||
|
||||
$update_status = $vehicleTypeModel->where('id', $id)->set(['is_active' => 0])->update();
|
||||
|
||||
if ($update_status) {
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'message' => 'Data removed successfully',
|
||||
'pk' => $id
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 400,
|
||||
'message' => 'Failed to remove data',
|
||||
'pk' => $id
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function rtoMaster()
|
||||
{
|
||||
$rtoModel = new RTOModel();
|
||||
$method = $this->request->getMethod();
|
||||
$data['tab_name'] = 'RTO';
|
||||
$data['page_name'] = 'RTO';
|
||||
|
||||
if ($method === 'post') {
|
||||
|
||||
$id = $this->request->getPost('pk') ?? null;
|
||||
$data = $this->request->getPost();
|
||||
|
||||
if (empty($id)) {
|
||||
$update_status = $rtoModel->insert($data);
|
||||
} else {
|
||||
$update_status = $rtoModel->where('id', $id)->set($data)->update();
|
||||
}
|
||||
|
||||
if ($update_status) {
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'message' => 'RTO Master updated successfully',
|
||||
'data' => $data
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 400,
|
||||
'message' => 'Failed to update',
|
||||
'data' => $data
|
||||
], 200);
|
||||
}
|
||||
|
||||
} elseif ($method === 'get') {
|
||||
|
||||
$id = $this->request->getGet('pk') ?? null;
|
||||
|
||||
if (!empty($id)) {
|
||||
$data = $rtoModel->where('is_active', 1)->where('id', $id)->findAll();
|
||||
if (!empty($data)) {
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $data], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
$data = $rtoModel->where('is_active', 1)->orderBy('id', 'DESC')->findAll();
|
||||
return $this->loadLayout('rto_master_list', ['data' => $data]);
|
||||
|
||||
} elseif ($method === 'delete') {
|
||||
|
||||
$input = $this->request->getRawInput();
|
||||
$id = $input['pk'] ?? null;
|
||||
|
||||
if (empty($id)) {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 404,
|
||||
'message' => 'No ID provided for deletion'
|
||||
], 200);
|
||||
}
|
||||
|
||||
$update_status = $rtoModel->where('id', $id)->set(['is_active' => 0])->update();
|
||||
|
||||
if ($update_status) {
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'message' => 'Data removed successfully',
|
||||
'pk' => $id
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 400,
|
||||
'message' => 'Failed to remove data',
|
||||
'pk' => $id
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -3,6 +3,7 @@
|
||||
// declare(strict_types=1);
|
||||
|
||||
namespace App\Controllers;
|
||||
use App\Models\CommonEMailModel;
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
@ -28,13 +29,16 @@ class NotificationController extends AdminController
|
||||
protected $notificationModel;
|
||||
protected $clientModel;
|
||||
protected $MailAttachmentModel;
|
||||
|
||||
protected $CommonEMailModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
$this->notificationModel = new NotificationModel();
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->MailAttachmentModel = new MailAttachmentModel();
|
||||
$this->MailAttachmentModel = new MailAttachmentModel();
|
||||
$this->CommonEMailModel = new CommonEMailModel();
|
||||
}
|
||||
|
||||
// This is for Template Name Camel Case to Snake Case for store in DB
|
||||
@ -53,33 +57,80 @@ class NotificationController extends AdminController
|
||||
$form_data['mail_content'] = $this->request->getPost('mailContent');
|
||||
$form_data['client_id'] = $this->request->getPost('client_id');
|
||||
$form_data['mail_content_json'] = $this->request->getPost('mailJson');
|
||||
$form_data['email_list'] = $this->request->getPost('email_list');
|
||||
$notificationModel = new NotificationModel();
|
||||
|
||||
$find_notification = $notificationModel->where('client_id',$form_data['client_id'])->where('template_name',$form_data['template_name'])->first();
|
||||
|
||||
if ($find_notification) {
|
||||
|
||||
$id = $find_notification['id'];
|
||||
$id = $find_notification['id'] ?? '';
|
||||
$form_data['updated_by'] = get_session_userid();
|
||||
$notificationModel->update($id,$form_data);
|
||||
$this->save_common_mail($id , $form_data);
|
||||
$complete = "Update";
|
||||
|
||||
}else{
|
||||
|
||||
$form_data['created_by'] = get_session_userid();
|
||||
$notificationModel->insert($form_data);
|
||||
$id = $notificationModel->insert($form_data);
|
||||
$this->save_common_mail($id , $form_data);
|
||||
$complete = "Inserted";
|
||||
}
|
||||
|
||||
return json_encode($complete);
|
||||
|
||||
|
||||
}
|
||||
private function save_common_mail($id, $form_data)
|
||||
{
|
||||
|
||||
$this->logger->debug("step 1 - inside save common mail");
|
||||
|
||||
if (empty($form_data['email_list'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$this->logger->debug("step 2 - id and form_data are present");
|
||||
|
||||
$emails = array_map('trim', explode(',', $form_data['email_list']));
|
||||
|
||||
|
||||
$this->logger->debug("step 3 common emails were present");
|
||||
|
||||
$common_mail_data = [];
|
||||
|
||||
foreach ($emails as $email) {
|
||||
$common_mail_data[] = ['notification_id' => $id , 'email' => $email , 'is_active' => 1];
|
||||
}
|
||||
|
||||
$this->logger->debug("step 4 common email data \n" . json_encode($common_mail_data));
|
||||
|
||||
|
||||
// Deactivate existing emails
|
||||
$this->CommonEMailModel
|
||||
->where('notification_id', $id)
|
||||
->set(['is_active' => 0])
|
||||
->update();
|
||||
|
||||
$this->logger->debug("step 5 deleted old common email data");
|
||||
|
||||
|
||||
|
||||
// Insert all at once
|
||||
$this->CommonEMailModel->insertBatch($common_mail_data);
|
||||
|
||||
$this->logger->debug("step 6 common mail data insertion done ..!!");
|
||||
|
||||
}
|
||||
|
||||
|
||||
// This is for the Enabls in Notification area and Update the Recipient and HR Mail Id in( Enables -> Notification table and Mail id's -> Client table)
|
||||
public function update_enable()
|
||||
{
|
||||
$checkboxNames = [
|
||||
'member_welcome_mail_btn',
|
||||
'common_mail_btn',
|
||||
'member_reminder_mail_btn',
|
||||
'member_ecard_mail_btn',
|
||||
'member_review_and_summary_mail_btn',
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -869,6 +869,7 @@ class RestAuthenticationController extends AdminController
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
|
||||
|
||||
}
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - saveMpin: Exception: " . $th->getMessage() . " --- Line: " . $th->getLine() . " --- Trace: " . $th->getTraceAsString());
|
||||
log_message('error', ' ');
|
||||
@ -1496,4 +1497,460 @@ class RestAuthenticationController extends AdminController
|
||||
return $this->fail("Invalid Token: " . $e->getMessage(), 401);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------- PASSWORD API'S -------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public function savePassword()
|
||||
{
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* POST START **************************************** ');
|
||||
log_message('error', ' ');
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - savePassword: Function called");
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - savePassword: Received payload = " . json_encode($this->request->getJSON() ?? []));
|
||||
|
||||
try {
|
||||
|
||||
$payload = $this->request->getJSON();
|
||||
$mobile_number = $payload->mobile_number ?? null;
|
||||
$email_id = $payload->email_id ?? null;
|
||||
$client_id = $payload->client_id ?? null;
|
||||
$plain_password = $payload->password ?? null;
|
||||
|
||||
if (empty($plain_password)) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'message' => 'Password cannot be empty'], 400);
|
||||
}
|
||||
|
||||
// Build employee query
|
||||
if ($mobile_number) {
|
||||
|
||||
$builder = $this->employeeModel
|
||||
->select('employees.*')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.mobile', $mobile_number)
|
||||
->where('employees.relationship', 'Self')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->whereIn('employee_polices.status', ['active', 'expired'])
|
||||
->where('employees.is_active', 1)
|
||||
->whereIn('employees.emp_status', ['active', 'expired']);
|
||||
if (!empty($client_id)) $builder->where('employees.client_id', $client_id);
|
||||
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||
|
||||
} else {
|
||||
|
||||
$builder = $this->employeeModel
|
||||
->select('employees.*')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.email_corporate', $email_id)
|
||||
->where('employees.relationship', 'Self')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->whereIn('employee_polices.status', ['active', 'expired'])
|
||||
->where('employees.is_active', 1)
|
||||
->whereIn('employees.emp_status', ['active', 'expired']);
|
||||
if (!empty($client_id)) $builder->where('employees.client_id', $client_id);
|
||||
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||
|
||||
}
|
||||
|
||||
$lastQuery = $this->employeeModel->db->getLastQuery();
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - savePassword: Last Executed Query: " . $lastQuery);
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - savePassword: employeeData: " . json_encode($employeeData ?? []));
|
||||
|
||||
if ($employeeData) {
|
||||
$id = $employeeData['id'];
|
||||
$hashedPassword = password_hash($plain_password, PASSWORD_DEFAULT);
|
||||
|
||||
$updateData = [
|
||||
'password' => $hashedPassword,
|
||||
];
|
||||
|
||||
$updated = $this->employeeModel->where('id', $id)->set($updateData)->update();
|
||||
|
||||
if ($updated) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - savePassword: Password saved successfully");
|
||||
$result = ['user_verification' => true, 'message' => "Password saved successfully"];
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
||||
} else {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - savePassword: Password save failed");
|
||||
$result = ['user_verification' => true, 'message' => "Password not saved"];
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $result], 200);
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - savePassword: Employee not found");
|
||||
$result = ['user_verification' => false, 'message' => "User not found"];
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - savePassword: Exception: " . $th->getMessage() . " --- Line: " . $th->getLine() . " --- Trace: " . $th->getTraceAsString());
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'message' => $th->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function changePassword()
|
||||
{
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* CHANGE PASSWORD START **************************************** ');
|
||||
log_message('error', ' ');
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - changePassword: Function called");
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - changePassword: Received payload = " . json_encode($this->request->getJSON() ?? []));
|
||||
|
||||
try {
|
||||
$payload = $this->request->getJSON(true);
|
||||
|
||||
$mobile_number = $payload['mobile_number'] ?? null;
|
||||
$email_id = $payload['email_id'] ?? null;
|
||||
$client_id = $payload['client_id'] ?? null;
|
||||
$otp = $payload['otp'] ?? null;
|
||||
$new_password = $payload['new_password'] ?? null;
|
||||
|
||||
if (empty($otp) || empty($new_password)) {
|
||||
return $this->respond([
|
||||
'status' => 'failed',
|
||||
'code' => 400,
|
||||
'message' => 'OTP and new password are required'
|
||||
], 400);
|
||||
}
|
||||
|
||||
// Fetch employee details
|
||||
$builder = $this->employeeModel
|
||||
->select('employees.*')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.relationship', 'Self')
|
||||
->where('employees.is_active', 1)
|
||||
->whereIn('employees.emp_status', ['active'])
|
||||
->where('employee_polices.is_active', 1)
|
||||
->whereIn('employee_polices.status', ['active']);
|
||||
|
||||
if (!empty($client_id)) $builder->where('employees.client_id', $client_id);
|
||||
|
||||
if ($mobile_number) {
|
||||
$builder->where('employees.mobile', $mobile_number);
|
||||
} elseif ($email_id) {
|
||||
$builder->where('employees.email_corporate', $email_id);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => 'failed',
|
||||
'code' => 400,
|
||||
'message' => 'Mobile number or Email ID is required'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - changePassword: employeeData: " . json_encode($employeeData ?? []));
|
||||
|
||||
if (!$employeeData) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => 'User not found'], 404);
|
||||
}
|
||||
|
||||
// Check OTP validity (assuming fields: otp, otp_expiry exist)
|
||||
if (empty($employeeData['otp']) || $employeeData['otp'] != $otp) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 401, 'message' => 'Invalid OTP'], 200);
|
||||
}
|
||||
|
||||
if (!empty($employeeData['otp_expiry']) && strtotime($employeeData['otp_expiry']) < time()) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 401, 'message' => 'OTP expired'], 200);
|
||||
}
|
||||
|
||||
// Hash new password
|
||||
$newHashedPassword = password_hash($new_password, PASSWORD_DEFAULT);
|
||||
|
||||
// Update password and clear OTP
|
||||
$updated = $this->employeeModel->update($employeeData['id'], [
|
||||
'password' => $newHashedPassword,
|
||||
'otp' => null,
|
||||
]);
|
||||
|
||||
if ($updated) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - changePassword: Password updated successfully");
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* CHANGE PASSWORD END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'code' => 200,
|
||||
'message' => 'Password changed successfully'
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => 'failed',
|
||||
'code' => 500,
|
||||
'message' => 'Failed to update password'
|
||||
], 500);
|
||||
}
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - changePassword: Exception: " . $th->getMessage());
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* CHANGE PASSWORD END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'message' => $th->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function verifyPassword()
|
||||
{
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* POST START **************************************** ');
|
||||
log_message('error', ' ');
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - Verify Password: Function called");
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyPassword: Received payload = " . json_encode($this->request->getJSON() ?? []));
|
||||
|
||||
try {
|
||||
$requestData = $this->request->getJSON(true);
|
||||
|
||||
$mobile_number = $requestData['mobile_number'] ?? null;
|
||||
$email_id = $requestData['email_id'] ?? null;
|
||||
$password = $requestData['password'] ?? null;
|
||||
$client_id = $requestData['client_id'] ?? null;
|
||||
|
||||
if (!$password) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'data' => "", 'message' => 'Password is required'], 400);
|
||||
}
|
||||
|
||||
// 🔹 Fetch employee data
|
||||
if ($mobile_number) {
|
||||
$builder = $this->employeeModel
|
||||
->select('employees.*')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.mobile', $mobile_number)
|
||||
->where('employees.relationship', 'Self')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->whereIn('employee_polices.status', ['active'])
|
||||
->where('employees.is_active', 1)
|
||||
->whereIn('employees.emp_status', ['active']);
|
||||
|
||||
if (!empty($client_id)) {
|
||||
$builder->where('employees.client_id', $client_id);
|
||||
}
|
||||
|
||||
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||
} elseif ($email_id) {
|
||||
$builder = $this->employeeModel
|
||||
->select('employees.*')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.email_corporate', $email_id)
|
||||
->where('employees.relationship', 'Self')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->whereIn('employee_polices.status', ['active'])
|
||||
->where('employees.is_active', 1)
|
||||
->whereIn('employees.emp_status', ['active']);
|
||||
|
||||
if (!empty($client_id)) {
|
||||
$builder->where('employees.client_id', $client_id);
|
||||
}
|
||||
|
||||
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||
} else {
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'data' => "", 'message' => 'Mobile number or Email ID is required'], 400);
|
||||
}
|
||||
|
||||
$lastQuery = $this->employeeModel->db->getLastQuery();
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyPassword: Last Executed Query: " . $lastQuery);
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyPassword: employeeData: " . json_encode($employeeData ?? []));
|
||||
|
||||
// 🔹 Verify password hash
|
||||
if ($employeeData && isset($employeeData['password']) && password_verify($password, $employeeData['password'])) {
|
||||
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyPassword: Verified employee found");
|
||||
|
||||
// ✅ Log authentication info
|
||||
$auth = HttpRequestHelper::getRequestInfo();
|
||||
if ($auth) {
|
||||
$this->authHistoryModel->insert([
|
||||
'user_id' => $employeeData['id'],
|
||||
'user_type' => 'employee',
|
||||
'ip' => $auth['ip'],
|
||||
'platform' => $auth['platform'],
|
||||
'broswer' => $auth['browser'],
|
||||
]);
|
||||
}
|
||||
|
||||
// ✅ Generate JWT token
|
||||
$employeeData['token_type'] = "post";
|
||||
$token = JWTToken::encode($employeeData);
|
||||
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* POST END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $token], 200);
|
||||
} else {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyPassword: Invalid password or employee not found");
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* POST END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => "", 'message' => 'Invalid password'], 200);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyPassword: Exception: " . $e->getMessage() . " --- Line: " . $e->getLine());
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* POST END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => "", 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function sendChangePasswordOTP()
|
||||
{
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* SEND OTP START **************************************** ');
|
||||
log_message('error', ' ');
|
||||
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - sendChangePasswordOTP: Function called");
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - sendChangePasswordOTP: Received payload = " . json_encode($this->request->getJSON() ?? []));
|
||||
|
||||
try {
|
||||
$requestData = $this->request->getJSON(true);
|
||||
|
||||
$email_id = $requestData['email_id'] ?? null;
|
||||
$client_id = $requestData['client_id'] ?? null;
|
||||
|
||||
if (!$email_id) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'data' => "", 'message' => 'Email ID is required'], 400);
|
||||
}
|
||||
|
||||
// Get employee details
|
||||
$builder = $this->employeeModel
|
||||
->select('employees.id, employees.mobile, employees.email_corporate, employees.client_id')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.is_active', 1)
|
||||
->whereIn('employees.emp_status', ['active'])
|
||||
->where('employee_polices.is_active', 1)
|
||||
->whereIn('employee_polices.status', ['active'])
|
||||
->where('employees.relationship', 'Self');
|
||||
|
||||
if (!empty($client_id)) {
|
||||
$builder->where('employees.client_id', $client_id);
|
||||
}
|
||||
|
||||
if ($email_id) {
|
||||
$builder->where('employees.email_corporate', $email_id);
|
||||
}
|
||||
|
||||
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - sendChangePasswordOTP: Employee Data: " . json_encode($employeeData ?? []));
|
||||
|
||||
if (!$employeeData) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => "", 'message' => 'Employee not found'], 404);
|
||||
}
|
||||
|
||||
// Generate 6-digit OTP
|
||||
$otp = rand(100000, 999999);
|
||||
|
||||
// Save OTP to DB (assuming 'otp' and 'otp_expiry' columns exist)
|
||||
$this->employeeModel->update($employeeData['id'], [
|
||||
'otp' => $otp,
|
||||
]);
|
||||
|
||||
// Send OTP via SMS or Email (you can replace with your actual helper)
|
||||
if ($email_id) {
|
||||
// Example: MailHelper::sendMail($email_id, 'Password Change OTP', "Your OTP is {$otp}");
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - sendChangePasswordOTP: OTP {$otp} sent to email {$email_id}");
|
||||
}
|
||||
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* SEND OTP END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => ['otp_sent_to' => $email_id], 'message' => 'OTP sent successfully'], 200);
|
||||
} catch (\Exception $e) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - sendChangePasswordOTP: Exception: " . $e->getMessage() . " --- Line: " . $e->getLine());
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* SEND OTP END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => "", 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------- EMP MOBILE NUMBER UPDATE API'S -------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public function updateMobileNumber()
|
||||
{
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* UPDATE MOBILE START **************************************** ');
|
||||
log_message('error', ' ');
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Function called");
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Received payload = " . json_encode($this->request->getJSON() ?? []));
|
||||
|
||||
try {
|
||||
|
||||
$payload = $this->request->getJSON(true);
|
||||
|
||||
$email_id = $payload['email_id'] ?? null;
|
||||
$client_id = $payload['client_id'] ?? null;
|
||||
$new_mobile = $payload['new_mobile_number'] ?? null;
|
||||
|
||||
if (empty($email_id) || empty($new_mobile)) {
|
||||
return $this->respond([
|
||||
'status' => 'failed',
|
||||
'code' => 400,
|
||||
'message' => 'Email ID and new mobile number are required'
|
||||
], 400);
|
||||
}
|
||||
|
||||
// Fetch employee by email
|
||||
$builder = $this->employeeModel
|
||||
->select('employees.*')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.email_corporate', $email_id)
|
||||
->where('employees.relationship', 'Self')
|
||||
->where('employees.is_active', 1)
|
||||
->whereIn('employees.emp_status', ['active'])
|
||||
->where('employee_polices.is_active', 1)
|
||||
->whereIn('employee_polices.status', ['active']);
|
||||
|
||||
if (!empty($client_id)) {
|
||||
$builder->where('employees.client_id', $client_id);
|
||||
}
|
||||
|
||||
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: employeeData: " . json_encode($employeeData ?? []));
|
||||
|
||||
if (!$employeeData) {
|
||||
return $this->respond([
|
||||
'status' => 'failed',
|
||||
'code' => 404,
|
||||
'message' => 'User not found with this Email ID'
|
||||
], 404);
|
||||
}
|
||||
|
||||
// Update mobile number
|
||||
$updated = $this->employeeModel->update($employeeData['id'], [
|
||||
'mobile' => $new_mobile,
|
||||
]);
|
||||
|
||||
if ($updated) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Mobile number updated successfully");
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* UPDATE MOBILE END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'code' => 200,
|
||||
'message' => 'Mobile number updated successfully'
|
||||
], 200);
|
||||
} else {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Failed to update mobile number");
|
||||
return $this->respond([
|
||||
'status' => 'failed',
|
||||
'code' => 500,
|
||||
'message' => 'Failed to update mobile number'
|
||||
], 500);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Exception: " . $th->getMessage());
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* UPDATE MOBILE END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
return $this->respond([
|
||||
'status' => 'failed',
|
||||
'code' => 500,
|
||||
'message' => $th->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -362,7 +362,18 @@ class TestingController extends BaseController
|
||||
|
||||
$pre_clients_list = $this->getNonDuplicatePreClients();
|
||||
|
||||
|
||||
$log_post_clients_list = $post_clients_list;
|
||||
|
||||
$log_pre_clients_list = $pre_clients_list;
|
||||
|
||||
log_message('error', 'Post Clients to be processed: ' . count($log_post_clients_list));
|
||||
log_message('error', 'Pre Clients to be processed: ' . count($log_pre_clients_list));
|
||||
|
||||
|
||||
|
||||
$matched_Count = 0;
|
||||
$expected_match_count = min(count($post_clients_list), count($pre_clients_list));
|
||||
|
||||
|
||||
if (
|
||||
!empty($pre_clients_list) &&
|
||||
@ -372,12 +383,18 @@ class TestingController extends BaseController
|
||||
$postDB = \Config\Database::connect();
|
||||
$preDB = \Config\Database::connect('preDB');
|
||||
|
||||
foreach ($post_clients_list as $post_client) {
|
||||
foreach ($post_clients_list as $index => $post_client) {
|
||||
|
||||
foreach ($pre_clients_list as $pre_client) {
|
||||
foreach ($pre_clients_list as $index => $pre_client) {
|
||||
|
||||
if (trim($post_client['short_name']) == trim($pre_client['short_name'])) {
|
||||
|
||||
unset($log_post_clients_list[$index]);
|
||||
unset($log_pre_clients_list[$index]);
|
||||
|
||||
$matched_Count++;
|
||||
|
||||
|
||||
$postDB->table('clients')->where('id', $post_client['id'])->update(['pre_client_id' => $pre_client['id']]);
|
||||
|
||||
$preDB->table('clients')->where('id', $pre_client['id'])->update(['post_client_id' => $post_client['id']]);
|
||||
@ -426,7 +443,28 @@ class TestingController extends BaseController
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
log_message('error', 'Expected Match Count : ' . $expected_match_count);
|
||||
log_message('error', 'Total Matched Count: ' . $matched_Count);
|
||||
log_message('error', 'Total UnMatched Count: ' . $expected_match_count - $matched_Count);
|
||||
|
||||
|
||||
log_message('error', 'unmatched_reocrds');
|
||||
|
||||
$log_post_clients_list = array_values($log_post_clients_list);
|
||||
$log_pre_clients_list = array_values($log_pre_clients_list);
|
||||
|
||||
if ((count($log_pre_clients_list) < count($log_post_clients_list))) {
|
||||
log_message('error', "unmatched records count from pre- " . count($log_pre_clients_list));
|
||||
log_message('error', print_r($log_pre_clients_list, true));
|
||||
} else {
|
||||
log_message('error', "unmatched records count from post - " . count($log_post_clients_list));
|
||||
log_message('error', print_r($log_post_clients_list, true));
|
||||
}
|
||||
}
|
||||
|
||||
return $this->response->setJSON(['status' => 'success', 'message' => 'Client and Branch mapping completed.'])->setStatusCode(200);
|
||||
}
|
||||
|
||||
|
||||
@ -493,7 +531,7 @@ class TestingController extends BaseController
|
||||
return $results;
|
||||
}
|
||||
public function membervalidation($lead_id = 329)
|
||||
{
|
||||
{
|
||||
$lead_controll = new LeadsController();
|
||||
// $lead_controll->getMemberDataExcelFileErrors();
|
||||
$res = $lead_controll->memberDataListExcelFileFormatValidation(['lead_id' => $lead_id]);
|
||||
@ -501,18 +539,81 @@ class TestingController extends BaseController
|
||||
}
|
||||
|
||||
private $firstNames = [
|
||||
'Rajesh', 'Priya', 'Amit', 'Sneha', 'Vikram', 'Anjali', 'Rahul', 'Deepika',
|
||||
'Sanjay', 'Kavita', 'Arun', 'Pooja', 'Manoj', 'Nisha', 'Suresh', 'Meera',
|
||||
'Karthik', 'Divya', 'Ravi', 'Lakshmi', 'Anand', 'Swathi', 'Vijay', 'Rekha',
|
||||
'Ashok', 'Sangeetha', 'Prakash', 'Uma', 'Ramesh', 'Vani', 'Kumar', 'Radha',
|
||||
'Dinesh', 'Shanti', 'Ganesh', 'Parvati', 'Mohan', 'Sita', 'Arjun', 'Geetha'
|
||||
'Rajesh',
|
||||
'Priya',
|
||||
'Amit',
|
||||
'Sneha',
|
||||
'Vikram',
|
||||
'Anjali',
|
||||
'Rahul',
|
||||
'Deepika',
|
||||
'Sanjay',
|
||||
'Kavita',
|
||||
'Arun',
|
||||
'Pooja',
|
||||
'Manoj',
|
||||
'Nisha',
|
||||
'Suresh',
|
||||
'Meera',
|
||||
'Karthik',
|
||||
'Divya',
|
||||
'Ravi',
|
||||
'Lakshmi',
|
||||
'Anand',
|
||||
'Swathi',
|
||||
'Vijay',
|
||||
'Rekha',
|
||||
'Ashok',
|
||||
'Sangeetha',
|
||||
'Prakash',
|
||||
'Uma',
|
||||
'Ramesh',
|
||||
'Vani',
|
||||
'Kumar',
|
||||
'Radha',
|
||||
'Dinesh',
|
||||
'Shanti',
|
||||
'Ganesh',
|
||||
'Parvati',
|
||||
'Mohan',
|
||||
'Sita',
|
||||
'Arjun',
|
||||
'Geetha'
|
||||
];
|
||||
|
||||
private $lastNames = [
|
||||
'Kumar', 'Sharma', 'Singh', 'Patel', 'Reddy', 'Nair', 'Iyer', 'Krishnan',
|
||||
'Rao', 'Gupta', 'Verma', 'Agarwal', 'Joshi', 'Mehta', 'Desai', 'Pillai',
|
||||
'Menon', 'Bhat', 'Naidu', 'Varma', 'Malhotra', 'Kapoor', 'Chopra', 'Saxena',
|
||||
'Pandey', 'Mishra', 'Tiwari', 'Dubey', 'Sinha', 'Jain', 'Shah', 'Thakur'
|
||||
'Kumar',
|
||||
'Sharma',
|
||||
'Singh',
|
||||
'Patel',
|
||||
'Reddy',
|
||||
'Nair',
|
||||
'Iyer',
|
||||
'Krishnan',
|
||||
'Rao',
|
||||
'Gupta',
|
||||
'Verma',
|
||||
'Agarwal',
|
||||
'Joshi',
|
||||
'Mehta',
|
||||
'Desai',
|
||||
'Pillai',
|
||||
'Menon',
|
||||
'Bhat',
|
||||
'Naidu',
|
||||
'Varma',
|
||||
'Malhotra',
|
||||
'Kapoor',
|
||||
'Chopra',
|
||||
'Saxena',
|
||||
'Pandey',
|
||||
'Mishra',
|
||||
'Tiwari',
|
||||
'Dubey',
|
||||
'Sinha',
|
||||
'Jain',
|
||||
'Shah',
|
||||
'Thakur'
|
||||
];
|
||||
|
||||
private $relationships = ['Self', 'Spouse', 'Son', 'Daughter', 'Father', 'Mother'];
|
||||
@ -569,9 +670,9 @@ class TestingController extends BaseController
|
||||
|
||||
for ($i = 1; $i <= $totalRecords; $i++) {
|
||||
$row = $i + 1; // Start from row 2 (row 1 is header)
|
||||
|
||||
|
||||
$record = $this->generateSampleRecord($i);
|
||||
|
||||
|
||||
$sheet->setCellValue('A' . $row, $record['sl_no']);
|
||||
$sheet->setCellValue('B' . $row, $record['emp_code']);
|
||||
$sheet->setCellValue('C' . $row, $record['name']);
|
||||
@ -622,33 +723,33 @@ class TestingController extends BaseController
|
||||
$firstName = $this->firstNames[array_rand($this->firstNames)];
|
||||
$lastName = $this->lastNames[array_rand($this->lastNames)];
|
||||
$name = $firstName . ' ' . $lastName;
|
||||
|
||||
|
||||
$relationship = $this->relationships[array_rand($this->relationships)];
|
||||
$gender = $this->genders[array_rand($this->genders)];
|
||||
|
||||
|
||||
// Generate random age between 18 and 65
|
||||
$age = rand(18, 65);
|
||||
|
||||
|
||||
// Calculate DOB based on age
|
||||
$year = date('Y') - $age;
|
||||
$month = str_pad(rand(1, 12), 2, '0', STR_PAD_LEFT);
|
||||
$day = str_pad(rand(1, 28), 2, '0', STR_PAD_LEFT);
|
||||
$dob = "{$day}-{$month}-{$year}";
|
||||
|
||||
|
||||
// Generate employee code
|
||||
$empCode = 'EMP' . str_pad($index, 6, '0', STR_PAD_LEFT);
|
||||
|
||||
|
||||
// Generate email
|
||||
$email = strtolower($firstName . '.' . $lastName . $index) . '@' . $this->domains[array_rand($this->domains)];
|
||||
|
||||
|
||||
// Generate mobile number (Indian format)
|
||||
$mobile = '+91' . rand(7000000000, 9999999999);
|
||||
|
||||
|
||||
// Generate insurance amounts
|
||||
$siOptions = [100000, 200000, 300000, 500000, 1000000];
|
||||
$si = $siOptions[array_rand($siOptions)];
|
||||
$si_enhancement = rand(0, 1) ? rand(50000, 200000) : 0;
|
||||
|
||||
|
||||
$proposed_si_1 = $si + rand(100000, 500000);
|
||||
$proposed_si_2 = $proposed_si_1 + rand(100000, 500000);
|
||||
$proposed_si_3 = $proposed_si_2 + rand(100000, 500000);
|
||||
@ -673,4 +774,214 @@ class TestingController extends BaseController
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function logo_renaming()
|
||||
{
|
||||
|
||||
$directory = ROOTPATH . 'public/uploads/logo/';
|
||||
|
||||
if (!is_dir($directory)) {
|
||||
die("Directory not found: $directory");
|
||||
}
|
||||
|
||||
$files = scandir($directory);
|
||||
|
||||
$client_logo_files = $this->get_client_logo_files();
|
||||
|
||||
$rename_files = "";
|
||||
$failed_rename_files = "";
|
||||
|
||||
foreach ($files as $file) {
|
||||
// Skip system entries
|
||||
if ($file === '.' || $file === '..') {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$oldPath = $directory . $file;
|
||||
|
||||
if (is_file($oldPath) && in_array(trim($file), $client_logo_files)) {
|
||||
|
||||
// Remove all spaces from filename
|
||||
$newFileName = preg_replace('/\s+|\x{00A0}|\x{200B}|\x{200C}|\x{200D}|\x{FEFF}/u', '', $file);
|
||||
|
||||
$newPath = $directory . $newFileName;
|
||||
|
||||
// Only rename if the name changed
|
||||
if ($oldPath !== $newPath) {
|
||||
if (rename($oldPath, $newPath)) {
|
||||
$rename_files .= "\n Renamed: $file → $newFileName \n";
|
||||
} else {
|
||||
$failed_rename_files .= "\n Failed file: $file \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$dbUpdated = $this->update_client_logo_files();
|
||||
|
||||
log_message('error', 'Renamed Files: ' . $rename_files);
|
||||
log_message('error', 'Failed Renames: ' . $failed_rename_files);
|
||||
log_message('error', 'Database Update Status: ' . ($dbUpdated ? 'Success' : 'No changes made'));
|
||||
|
||||
return $this->response->setJSON([
|
||||
'status' => 'success',
|
||||
'message' => 'Logo renaming completed. kindly check backend logs for details',
|
||||
'data' => [
|
||||
'renamed_files' => $rename_files,
|
||||
'failed_renames' => $failed_rename_files
|
||||
]
|
||||
])->setStatusCode(200);
|
||||
}
|
||||
|
||||
public function get_client_logo_files()
|
||||
{
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
|
||||
$sql = "SELECT client_logo FROM clients WHERE client_logo IS NOT NULL AND TRIM(client_logo) <> '' ";
|
||||
|
||||
$query = $db->query($sql);
|
||||
|
||||
$results = $query->getResultArray() ?? [];
|
||||
|
||||
$files = array_map(function ($item) {
|
||||
return trim($item['client_logo']);
|
||||
}, $results);
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
public function update_client_logo_files()
|
||||
{
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
|
||||
$sql = "UPDATE clients
|
||||
SET client_logo = REPLACE(REPLACE(REPLACE(client_logo, CHAR(160), ''), ' ', ''), '\t', '')
|
||||
WHERE client_logo IS NOT NULL
|
||||
AND TRIM(client_logo) <> ''
|
||||
";
|
||||
|
||||
$query = $db->query($sql);
|
||||
|
||||
return $db->affectedRows() > 0;
|
||||
}
|
||||
|
||||
|
||||
public function createDefaultMailTempalteInCrossDB()
|
||||
{
|
||||
$postDB = \Config\Database::connect(); // target DB
|
||||
$preDB = \Config\Database::connect('preDB'); // source DB
|
||||
|
||||
// Templates to copy
|
||||
$templateNames = [
|
||||
'member_welcome_mail',
|
||||
'member_reminder_mail',
|
||||
'member_review_and_summary_mail'
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
foreach ($templateNames as $template) {
|
||||
|
||||
$exists = $postDB->table('notifications')
|
||||
->where('client_id', NULL)
|
||||
->where('template_name', $template)
|
||||
->countAllResults();
|
||||
|
||||
if ($exists > 0) {
|
||||
continue; // Skip if already inserted
|
||||
}
|
||||
|
||||
// Fetch template from preDB
|
||||
$templateData = $preDB->table('notifications')
|
||||
->where('client_id', NULL)
|
||||
->where('template_name', $template)
|
||||
->get()
|
||||
->getRowArray();
|
||||
|
||||
if (!empty($templateData)) {
|
||||
|
||||
// Remove ID to avoid duplicate primary key issues
|
||||
unset($templateData['id']);
|
||||
|
||||
// Set created_by and timestamps if needed
|
||||
$templateData['client_id'] = NULL;
|
||||
$templateData['created_by'] = 1;
|
||||
$templateData['cretaed_at'] = date('Y-m-d H:i:s');
|
||||
$templateData['updated_by'] = NULL;
|
||||
$templateData['updated_at'] = NULL;
|
||||
|
||||
// Insert into postDB
|
||||
$postDB->table('notifications')->insert($templateData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $this->response->setJSON(['message'=>"Created Default Mail Tempalte In Cross DB "])->setStatusCode(200);
|
||||
}
|
||||
|
||||
public function createDefaultMailTempalteInSameDB()
|
||||
{
|
||||
$postDB = \Config\Database::connect();
|
||||
|
||||
// Templates to copy
|
||||
$templateNames = [
|
||||
'member_welcome_mail',
|
||||
'member_reminder_mail',
|
||||
'member_review_and_summary_mail',
|
||||
'member_common_mail',
|
||||
'member_ecard_mail'
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
foreach ($templateNames as $template) {
|
||||
|
||||
$exists = $postDB->table('notifications')
|
||||
->where('client_id', NULL)
|
||||
->where('template_name', $template)
|
||||
->countAllResults();
|
||||
|
||||
if ($exists > 0 ) {
|
||||
continue; // Skip if already inserted
|
||||
}
|
||||
|
||||
// Fetch template from preDB
|
||||
$templateData = $postDB->table('notifications')
|
||||
|
||||
// this is where we want to replace 0 with the client id we want to replace
|
||||
->where('client_id', 0)
|
||||
|
||||
// template_name from which you want to create a common template from templateNames array.
|
||||
->where('template_name', $template)
|
||||
->get()
|
||||
->getRowArray();
|
||||
|
||||
if (!empty($templateData)) {
|
||||
|
||||
// Remove ID to avoid duplicate primary key issues
|
||||
unset($templateData['id']);
|
||||
|
||||
// Set created_by and timestamps if needed
|
||||
$templateData['client_id'] = NULL;
|
||||
$templateData['created_by'] = 1;
|
||||
$templateData['cretaed_at'] = date('Y-m-d H:i:s');
|
||||
$templateData['updated_by'] = NULL;
|
||||
$templateData['updated_at'] = NULL;
|
||||
|
||||
// Insert into postDB
|
||||
$postDB->table('notifications')->insert($templateData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $this->response->setJSON(['message'=>"Created Default Mail Tempalte In Same DB "])->setStatusCode(200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1281,8 +1281,12 @@ class TicketController extends BaseController
|
||||
// $actionType = $this->request->getGet();
|
||||
$claimFiles = new ClaimFilesModel();
|
||||
$file_data = $claimFiles->where('id', $claim_file_id)->first();
|
||||
$fileName = $file_data['doc_name'];
|
||||
// $fileName = $file_data['doc_name'];
|
||||
|
||||
$url = $file_data['url'];
|
||||
$parts = explode('/', $url);
|
||||
$fileName = end($parts);
|
||||
|
||||
$filePath = WRITEPATH . '/uploads/claim_files/' . $fileName;
|
||||
|
||||
try {
|
||||
|
||||
@ -62,7 +62,7 @@ class UserController extends AdminController
|
||||
// echo '<pre>';
|
||||
// print_r($data); die;
|
||||
$data['roleData'] = $this->roleModel->select('id, role')->findAll();
|
||||
$data['teamData'] = $this->teamModel->select('id, name')->findAll();
|
||||
$data['teamData'] = $this->teamModel->select('id, name')->where('is_active',1)->findAll();
|
||||
$this->loadLayout('UserList', $data);
|
||||
}
|
||||
|
||||
@ -156,9 +156,11 @@ class UserController extends AdminController
|
||||
public function edit()
|
||||
{
|
||||
|
||||
// echo ":/ in 159";
|
||||
if (!$this->request->getPost()) {
|
||||
return redirect()->to(base_url('/user/list'));
|
||||
} else {
|
||||
// echo ":/ in 163";
|
||||
$id = $this->request->getPost('PrimaryKey');
|
||||
$teams = $this->request->getPost('team');
|
||||
$userData = $this->request->getPost();
|
||||
@ -166,6 +168,7 @@ class UserController extends AdminController
|
||||
unset($userData['PrimaryKey']);
|
||||
|
||||
$existingData = $this->userModel->where('id',$id)->first();;
|
||||
// dd($existingData);die;
|
||||
|
||||
// Update data in the 'users' table based on the $id
|
||||
$userData['updated_by'] = get_session_userid();
|
||||
@ -776,32 +779,63 @@ class UserController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
// public function downloadIncentivesFile($file_id)
|
||||
// {
|
||||
// try {
|
||||
// $result = $this->partnerManagerIncentiveFileModel->where('id', $file_id)->first();
|
||||
|
||||
// if (!$result || empty($result['incentive_file_name'])) {
|
||||
// throw new \Exception("File Name Not Found");
|
||||
// }
|
||||
|
||||
// $incentive_file_name = $result['incentive_file_name'];
|
||||
// $file_name = basename($incentive_file_name);
|
||||
// $filePath = WRITEPATH . 'uploads/incentives/' . $file_name;
|
||||
|
||||
// if (file_exists($filePath)) {
|
||||
// return $this->response->download($filePath, null);
|
||||
// } else {
|
||||
// throw new \Exception("File Not Found");
|
||||
// }
|
||||
|
||||
// } catch (\Exception $e) {
|
||||
|
||||
// $this->myLogger->logme('error', $e->getMessage());
|
||||
|
||||
// // Show 404 error view
|
||||
// $data['message'] = $e->getMessage();
|
||||
// return view('errors/404', $data);
|
||||
// }
|
||||
// }
|
||||
|
||||
public function downloadIncentivesFile($file_id)
|
||||
{
|
||||
try {
|
||||
$result = $this->partnerManagerIncentiveFileModel->where('id', $file_id)->first();
|
||||
|
||||
if (!$result || empty($result['incentive_file_name'])) {
|
||||
throw new \Exception("File Name Not Found");
|
||||
throw new \Exception("File Name Not Found for ID {$file_id}");
|
||||
}
|
||||
|
||||
$incentive_file_name = $result['incentive_file_name'];
|
||||
$file_name = basename($incentive_file_name);
|
||||
$filePath = WRITEPATH . 'uploads/incentives/' . $file_name;
|
||||
|
||||
if (file_exists($filePath)) {
|
||||
return $this->response->download($filePath, null);
|
||||
} else {
|
||||
throw new \Exception("File Not Found");
|
||||
if (!file_exists($filePath)) {
|
||||
throw new \Exception("File Not Found: {$file_name}");
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $this->response->download($filePath, null);
|
||||
} catch (\Throwable $e) {
|
||||
// Catch all kinds of exceptions
|
||||
$this->myLogger->logme('error', $e->getMessage());
|
||||
|
||||
// Show 404 error view
|
||||
$data['message'] = $e->getMessage();
|
||||
return view('errors/404', $data);
|
||||
// Return proper 404 for missing file, else 500 for unexpected error
|
||||
if (str_contains($e->getMessage(), 'Not Found')) {
|
||||
return $this->response->setStatusCode(404)->setBody($e->getMessage());
|
||||
}
|
||||
|
||||
return $this->response->setStatusCode(500)->setBody('Internal Server Error');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -66,7 +66,8 @@ class DepositHelper
|
||||
'updated_by' => $data['updated_by'],
|
||||
'balance' => $newBalance, // Include the new balance in the data array
|
||||
'cd_ac_pk'=> isset($data['cd_ac_pk'])?$data['cd_ac_pk']:null,
|
||||
'record_date' => $data['record_date'] ?? null
|
||||
'record_date' => $data['record_date'] ?? null,
|
||||
'policy_transaction_id' => $data['pt_id'] ?? null
|
||||
];
|
||||
|
||||
// Insert data and get the insert ID
|
||||
|
||||
@ -109,7 +109,8 @@ if (!function_exists('check_relationship')) {
|
||||
|
||||
$family_floaters = isset($policy_terms['family_floaters']);
|
||||
if ($family_floaters) {
|
||||
if (isset($relationship[$col]) && $relationship[$col]['gender'] != $row[4]) {
|
||||
$relation_gender = normalizeGender($row[4]);
|
||||
if (isset($relationship[$col]) && $relationship[$col]['gender'] != $relation_gender) {
|
||||
$error = "Gender relationship conflict: Expected " . $relationship[$col]['gender'] . ", received $row[4]";
|
||||
return array('status' => false, 'error' => $error);
|
||||
}
|
||||
@ -369,13 +370,24 @@ if (!function_exists('check_dob_diff')) {
|
||||
}
|
||||
|
||||
if (!function_exists('data_group_by_family')) {
|
||||
function data_group_by_family($emp_data, $data_source = 'excel', $action = '')
|
||||
function data_group_by_family($emp_data, $data_source = 'excel', $action = '', $current_column_action = null)
|
||||
{
|
||||
$result = [];
|
||||
// Kint::dump($emp_data);
|
||||
foreach ($emp_data as $rkey => $row) {
|
||||
|
||||
|
||||
|
||||
if ($data_source == 'excel') {
|
||||
if (!check_row_is_empty_or_null($row)) {
|
||||
|
||||
// for this condition to avoid 5,00,000 to 500000
|
||||
if($current_column_action == 'SI'){
|
||||
$row[3] = removeNumberFormatting($row[3]);
|
||||
}else if(in_array($current_column_action, ['I','DA', 'MI', 'A'])){
|
||||
$row[6] = removeNumberFormatting($row[6]);
|
||||
}
|
||||
|
||||
if ($action == 'enrollment') //if action is enrollment transform current row into inception row, becoz we treat enrollment as inception
|
||||
{
|
||||
$row = transform_enrollment_row_to_inception_row($row);
|
||||
@ -637,12 +649,19 @@ if (!function_exists('check_dependent_conflict')) {
|
||||
if (!function_exists('generate_relationship_code')) {
|
||||
function generate_relationship_code($arr)
|
||||
{
|
||||
$gender = ['M' => 1, 'F' => 2];
|
||||
$gender = [
|
||||
'M' => 1,
|
||||
'Male' => 1,
|
||||
'male' => 1,
|
||||
'F' => 2,
|
||||
'Female' => 2,
|
||||
'female' => 2,
|
||||
];
|
||||
$relationship = ['self' => 1, 'spouse' => 2, 'son' => 3, 'daughter' => 4, 'father' => 5, 'mother' => 6, 'father-in-law' => 7, 'mother-in-law' => 8];
|
||||
$slug = \Config\Services::slug();
|
||||
$relationship_code = $slug->slugify($arr['relationship']);
|
||||
$emp_type_code = ($relationship_code == 'self' ? 'EMP_TYP_01' : 'EMP_TYP_03');
|
||||
$relationship_code = $gender[trim($arr['gender'])] . $relationship[trim($relationship_code)];
|
||||
$relationship_code = $gender[trim($arr['gender'])] ?? "" . $relationship[trim($relationship_code)] ?? "";
|
||||
return ['relationship_code' => $relationship_code, 'emp_type_code' => $emp_type_code];
|
||||
}
|
||||
}
|
||||
@ -1627,21 +1646,53 @@ if (!function_exists('check_dup_mobileno')) {
|
||||
}
|
||||
}
|
||||
|
||||
// if (!function_exists('check_dup_email')) {
|
||||
// function check_dup_email(array $row, array $existing_mobilenos)
|
||||
// {
|
||||
// is_valid_or_empty_email($row['13']);
|
||||
// if(!empty($row['13'])){
|
||||
// foreach ($existing_mobilenos as $k => $value) {
|
||||
// if (strtolower($row['5']) == 'self' && $row['13'] == $value['email_corporate']) {
|
||||
// return array('status' => false, 'error' => "Duplicate Email");
|
||||
// // break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return array('status' => true);
|
||||
// }
|
||||
// }
|
||||
|
||||
if (!function_exists('check_dup_email')) {
|
||||
function check_dup_email(array $row, array $existing_mobilenos)
|
||||
{
|
||||
if(!empty($row['13'])){
|
||||
foreach ($existing_mobilenos as $k => $value) {
|
||||
if (strtolower($row['5']) == 'self' && $row['13'] == $value['email_corporate']) {
|
||||
return array('status' => false, 'error' => "Duplicate Email");
|
||||
// break;
|
||||
$errorMessages = [];
|
||||
|
||||
// Validate email
|
||||
$emailCheck = is_valid_or_empty_email($row['13'] ?? "");
|
||||
if (!$emailCheck) {
|
||||
$errorMessages[] = 'Invalid email format';
|
||||
}
|
||||
|
||||
// Check duplicate only if email is not empty
|
||||
if (!empty($row['13'])) {
|
||||
foreach ($existing_mobilenos as $value) {
|
||||
if (strtolower(trim($row['5'])) === 'self' && trim($row['13']) === trim($value['email_corporate'])) {
|
||||
$errorMessages[] = 'Duplicate Email';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return array('status' => true);
|
||||
|
||||
// Prepare final return
|
||||
if (!empty($errorMessages)) {
|
||||
return ['status' => false, 'error' => implode(' & ', $errorMessages)];
|
||||
}
|
||||
|
||||
return ['status' => true, 'error' => ''];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('generate_family_relationship_array')) {
|
||||
function generate_family_relationship_array($family_structure_from_policy_terms)
|
||||
{
|
||||
@ -2041,6 +2092,22 @@ if (!function_exists('formatIndianCurrency')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('normalizeGender')) {
|
||||
function normalizeGender($gender)
|
||||
{
|
||||
$gender = strtoupper(trim($gender));
|
||||
|
||||
if (in_array($gender, ['M', 'MALE'])) {
|
||||
return 'M';
|
||||
} elseif (in_array($gender, ['F', 'FEMALE'])) {
|
||||
return 'F';
|
||||
}
|
||||
|
||||
// Optional: return null or original if not recognized
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------- FUNCTION FOR LEAD MEMBER DATA LIST VALIDATIONS --------------------------------------
|
||||
|
||||
if (!function_exists('check_columns_name_exist')) {
|
||||
@ -2291,8 +2358,8 @@ if (!function_exists('validateFamily')) {
|
||||
// Validation 3: Validate spouse gender if spouse exists
|
||||
if ($spouseMember !== null) {
|
||||
|
||||
$selfGender = strtoupper(trim($selfMember[4])); // Gender field
|
||||
$spouseGender = strtoupper(trim($spouseMember[4]));
|
||||
$selfGender = normalizeGender(trim($selfMember[4])); // Gender field
|
||||
$spouseGender = normalizeGender(trim($spouseMember[4]));
|
||||
$selfName = $selfMember[2]; // Name field
|
||||
$spouseName = $spouseMember[2];
|
||||
|
||||
@ -2368,3 +2435,24 @@ if (!function_exists('check_age_validation')) {
|
||||
// ------------- END OF LEAD MEMBER DATA LIST VALIDATIONS --------------------------------------
|
||||
|
||||
|
||||
if (!function_exists('is_valid_or_empty_email')) {
|
||||
function is_valid_or_empty_email($email)
|
||||
{
|
||||
// If empty or null → return success
|
||||
if (empty($email) && $email != 0) {
|
||||
// return ['status' => true, 'error' => 'Value is empty'];
|
||||
return true;
|
||||
}
|
||||
|
||||
// If valid email → return success
|
||||
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
// return ['status' => true, 'error' => 'Valid email format'];
|
||||
return true;
|
||||
}
|
||||
|
||||
// If invalid email → return failure
|
||||
// return ['status' => false, 'error' => 'Invalid email format'];
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -57,6 +57,13 @@ class sendMailNotification
|
||||
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
if ($dataToInsert['relationship'] == 'Self' && $mail != null || $mail != '') {
|
||||
|
||||
$mail_content = preg_replace('/<p[^>]*>( |\s)*<\/p>/i', '', $mail_content);
|
||||
|
||||
$data['params'] = $params;$data['client_logo'] = $client_logo;
|
||||
$data['mail_content'] = $mail_content;
|
||||
$mail_content = view('mail_template', $data);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'attachments' => $attachments, 'common' => $common];
|
||||
}
|
||||
|
||||
@ -89,6 +96,12 @@ class sendMailNotification
|
||||
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $employee_mobile_no, $mail_content);
|
||||
$mail = $emp_data['email_corporate'];
|
||||
|
||||
$mail_content = preg_replace('/<p[^>]*>( |\s)*<\/p>/i', '', $mail_content);
|
||||
|
||||
$data['params'] = $params;$data['client_logo'] = $client_logo;
|
||||
$data['mail_content'] = $mail_content;
|
||||
$mail_content = view('mail_template', $data);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
||||
|
||||
return $wholeData;
|
||||
@ -139,11 +152,73 @@ class sendMailNotification
|
||||
$mail_content = str_replace(["[[ecard_download_link]]", "{{ecard_download_link}}"], "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
|
||||
$mail_content = preg_replace('/<p[^>]*>( |\s)*<\/p>/i', '', $mail_content);
|
||||
|
||||
$data['params'] = $params;$data['client_logo'] = $client_logo;
|
||||
$data['mail_content'] = $mail_content;
|
||||
$mail_content = view('mail_template', $data);
|
||||
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
||||
|
||||
return $wholeData;
|
||||
|
||||
} else if($action == 'member_review_and_summary_mail'){
|
||||
} else if($action == 'member_common_mail'){
|
||||
|
||||
$notification = $params['notification'];
|
||||
$get_emp_email_and_other_details = $params['get_emp_email_and_other_details'];
|
||||
$rand_string = $params['rand_string'];
|
||||
$client_data = $params['client_data'];
|
||||
$tpa_id = $params['tpa_id'];
|
||||
$common = $params['common'];
|
||||
|
||||
|
||||
$mail_content = $notification['mail_content'];
|
||||
$mail = $get_emp_email_and_other_details['email_corporate'];
|
||||
$subject = $notification['subject'];
|
||||
|
||||
$cleanedText = mb_convert_encoding($subject, 'UTF-8', 'UTF-8'); // Normalize encoding
|
||||
$cleanedText = preg_replace('/[^\x20-\x7E]/', '', $cleanedText);
|
||||
|
||||
$subject = $cleanedText;
|
||||
|
||||
$link = generate_download_link($rand_string).'/1';
|
||||
|
||||
$app_link = $_ENV['App_Url'];
|
||||
$name = $get_emp_email_and_other_details['name'];
|
||||
$employee_mobile_no = $get_emp_email_and_other_details['mobile'];
|
||||
$mail_content = $notification['mail_content'];
|
||||
|
||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||
|
||||
$post_enrollment_app_link = $_ENV['POST_ENROLLMENT_APP_LINK'];
|
||||
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
// $client_logo = $nhance_logo;
|
||||
|
||||
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name, $mail_content);
|
||||
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $employee_mobile_no, $mail_content);
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[post_enrollment_app_link]]", "{{post_enrollment_app_link}}"], "<a href='$post_enrollment_app_link'>Review Details</a>", $mail_content);
|
||||
// $mail_content = str_replace("[[tpa_id]]", $tpa_id, $mail_content);
|
||||
$mail_content = str_replace(["[[ecard_download_link]]", "{{ecard_download_link}}"], "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
|
||||
$mail_content = preg_replace('/<p[^>]*>( |\s)*<\/p>/i', '', $mail_content);
|
||||
|
||||
$data['params'] = $params;$data['client_logo'] = $client_logo;
|
||||
$data['mail_content'] = $mail_content;
|
||||
$mail_content = view('mail_template', $data);
|
||||
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
||||
|
||||
return $wholeData;
|
||||
|
||||
}else if($action == 'member_review_and_summary_mail'){
|
||||
|
||||
$array_list = $params['array_list'];//employeee lst
|
||||
$client_policy_id = $params['client_policy_id'];
|
||||
@ -523,6 +598,13 @@ class sendMailNotification
|
||||
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $employee_mobile_no, $mail_content);
|
||||
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content , $mail_content);
|
||||
|
||||
$mail_content = preg_replace('/<p[^>]*>( |\s)*<\/p>/i', '', $mail_content);
|
||||
|
||||
$data['params'] = $params;$data['client_logo'] = $client_logo;
|
||||
$data['mail_content'] = $mail_content;
|
||||
$mail_content = view('mail_template', $data);
|
||||
|
||||
|
||||
// print_r($mail_content); die;
|
||||
|
||||
// $mail = "aadhavanvalli@gmail.com";
|
||||
@ -825,6 +907,13 @@ class sendMailNotification
|
||||
$full_name = $value['first_name'] .' ' .$value['last_name'];
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $full_name , $mail_content);
|
||||
|
||||
$mail_content = preg_replace('/<p[^>]*>( |\s)*<\/p>/i', '', $mail_content);
|
||||
|
||||
$data['params'] = $params;$data['client_logo'] = $client_logo;
|
||||
$data['mail_content'] = $mail_content;
|
||||
$mail_content = view('mail_template', $data);
|
||||
|
||||
|
||||
$wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
||||
// $wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'}};
|
||||
}
|
||||
@ -1118,6 +1207,11 @@ class sendMailNotification
|
||||
|
||||
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content , $mail_content);
|
||||
|
||||
$mail_content = preg_replace('/<p[^>]*>( |\s)*<\/p>/i', '', $mail_content);
|
||||
|
||||
$data['params'] = $params;$data['client_logo'] = $client_logo;
|
||||
$data['mail_content'] = $mail_content;
|
||||
$mail_content = view('mail_template', $data);
|
||||
|
||||
$hr_mails = $client_data['hr_mails'];
|
||||
$mail_array = explode(',', $hr_mails);
|
||||
@ -1182,7 +1276,14 @@ class sendMailNotification
|
||||
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
if ($mail != null || $mail != '') {
|
||||
if ( isset($mail) && !empty($mail) ) {
|
||||
|
||||
$mail_content = preg_replace('/<p[^>]*>( |\s)*<\/p>/i', '', $mail_content);
|
||||
|
||||
$data['params'] = $params;$data['client_logo'] = $client_logo;
|
||||
$data['mail_content'] = $mail_content;
|
||||
$mail_content = view('mail_template', $data);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'attachments' => $attachments];
|
||||
}
|
||||
|
||||
@ -1215,6 +1316,13 @@ class sendMailNotification
|
||||
if ((isset($notification_data) && $notification_data['enabled'] == 1)) {
|
||||
|
||||
if (isset($mail) && !empty($mail)) {
|
||||
|
||||
$mail_content = preg_replace('/<p[^>]*>( |\s)*<\/p>/i', '', $mail_content);
|
||||
|
||||
$data['params'] = $params;$data['client_logo'] = $client_logo;
|
||||
$data['mail_content'] = $mail_content;
|
||||
$mail_content = view('mail_template', $data);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']];
|
||||
}
|
||||
|
||||
@ -1268,6 +1376,67 @@ class sendMailNotification
|
||||
$mail_content = str_replace(["[[ecard_download_link]]", "{{ecard_download_link}}"], "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
|
||||
$mail_content = preg_replace('/<p[^>]*>( |\s)*<\/p>/i', '', $mail_content);
|
||||
|
||||
$data['params'] = $params;$data['client_logo'] = $client_logo;
|
||||
$data['mail_content'] = $mail_content;
|
||||
$mail_content = view('mail_template', $data);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'],'attachments' => $attachments, 'reply_to' => $client_data['reply_to']];
|
||||
|
||||
return $wholeData;
|
||||
|
||||
}else if($action == 'member_common_mail'){
|
||||
|
||||
$notification = $params['notification_data'];
|
||||
$client_data = $params['client_data'];
|
||||
$mail = $params['test_mail'];
|
||||
$mailAttachmentModel = new MailAttachmentModel();
|
||||
$attachment_data = $mailAttachmentModel
|
||||
->select('file_path, file_name')
|
||||
->where('notification_id', $notification['id'])
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$attachments = [];
|
||||
foreach ($attachment_data as $data) {
|
||||
$attachments[] = [
|
||||
"filePath" => WRITEPATH . $data['file_path'],
|
||||
"fileName" => $data['file_name']
|
||||
];
|
||||
}
|
||||
|
||||
$mail_content = $notification['mail_content'];
|
||||
$subject = $notification['subject'];
|
||||
|
||||
$rand_string = 'HX3kUh';
|
||||
$link = generate_download_link($rand_string).'/1';
|
||||
|
||||
$name = 'John Doe';
|
||||
$mobile = 9080706050;
|
||||
|
||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||
$app_link = $_ENV['App_Url'];
|
||||
$post_enrollment_app_link = $_ENV['POST_ENROLLMENT_APP_LINK'];
|
||||
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
|
||||
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name, $mail_content);
|
||||
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $mobile, $mail_content);
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[post_enrollment_app_link]]", "{{post_enrollment_app_link}}"], "<a href='$post_enrollment_app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[ecard_download_link]]", "{{ecard_download_link}}"], "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
|
||||
$mail_content = preg_replace('/<p[^>]*>( |\s)*<\/p>/i', '', $mail_content);
|
||||
|
||||
$data['params'] = $params;$data['client_logo'] = $client_logo;
|
||||
$data['mail_content'] = $mail_content;
|
||||
$mail_content = view('mail_template', $data);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'],'attachments' => $attachments, 'reply_to' => $client_data['reply_to']];
|
||||
|
||||
return $wholeData;
|
||||
@ -1419,6 +1588,11 @@ class sendMailNotification
|
||||
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $mobile, $mail_content);
|
||||
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content , $mail_content);
|
||||
|
||||
$mail_content = preg_replace('/<p[^>]*>( |\s)*<\/p>/i', '', $mail_content);
|
||||
|
||||
$data['params'] = $params;$data['client_logo'] = $client_logo;
|
||||
$data['mail_content'] = $mail_content;
|
||||
$mail_content = view('mail_template', $data);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']];
|
||||
|
||||
@ -1568,6 +1742,13 @@ class sendMailNotification
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . ' (' . $emp_code . ')' , $mail_content);
|
||||
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content , $mail_content);
|
||||
|
||||
|
||||
$mail_content = preg_replace('/<p[^>]*>( |\s)*<\/p>/i', '', $mail_content);
|
||||
|
||||
$data['params'] = $params;$data['client_logo'] = $client_logo;
|
||||
$data['mail_content'] = $mail_content;
|
||||
$mail_content = view('mail_template', $data);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']];
|
||||
|
||||
return $wholeData;
|
||||
@ -1717,6 +1898,11 @@ class sendMailNotification
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . ' (' . $emp_code . ')' , $mail_content);
|
||||
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content , $mail_content);
|
||||
|
||||
$mail_content = preg_replace('/<p[^>]*>( |\s)*<\/p>/i', '', $mail_content);
|
||||
|
||||
$data['params'] = $params;$data['client_logo'] = $client_logo;
|
||||
$data['mail_content'] = $mail_content;
|
||||
$mail_content = view('mail_template', $data);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']];
|
||||
|
||||
|
||||
@ -53,6 +53,20 @@ if (!function_exists('change_date_format2')) {
|
||||
|
||||
if (!function_exists('file_Upload')) {
|
||||
function file_Upload($fileToUpload, $filepath)
|
||||
{
|
||||
if ($fileToUpload !== null && $fileToUpload->isValid() && !$fileToUpload->hasMoved()) {
|
||||
$fileToUpload->move($filepath);
|
||||
$fileName = $fileToUpload->getName();
|
||||
$fileName = preg_replace('/[\s\x{00A0}\x{200B}-\x{200D}\x{FEFF}]/u', '', $fileName);
|
||||
return $fileName;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('file_Upload_for_lead')) {
|
||||
function file_Upload_for_lead($fileToUpload, $filepath)
|
||||
{
|
||||
if ($fileToUpload !== null && $fileToUpload->isValid() && !$fileToUpload->hasMoved()) {
|
||||
$fileToUpload->move($filepath);
|
||||
@ -98,8 +112,9 @@ if (!function_exists('file_Upload')) {
|
||||
// }
|
||||
// }
|
||||
|
||||
// function for only using in the Flutter Claim File Upload
|
||||
if (!function_exists('multi_file_Upload')) {
|
||||
function multi_file_Upload($fileToUpload, $filepath)
|
||||
function multi_file_Upload($fileToUpload, $filepath, $docs_name = [])
|
||||
{
|
||||
$uploadedFiles = [];
|
||||
|
||||
@ -109,13 +124,15 @@ if (!function_exists('multi_file_Upload')) {
|
||||
foreach ($files as $file) {
|
||||
// If file is itself an array (multiple under same input name)
|
||||
if (is_array($file)) {
|
||||
foreach ($file as $f) {
|
||||
foreach ($file as $index => $f) {
|
||||
if ($f !== null && $f->isValid() && !$f->hasMoved()) {
|
||||
$fileName = $f->getRandomName(); // safer unique name
|
||||
$f->move($filepath, $fileName);
|
||||
$fileRandomName = $f->getRandomName(); // safer unique name
|
||||
$fileName = $f->getName();
|
||||
$f->move($filepath, $fileRandomName);
|
||||
$uploadedFiles[] = [
|
||||
'file_name' => $fileName,
|
||||
'file_path' => $filepath . $fileName
|
||||
'doc_name' => $docs_name[$index] ?? $fileName,
|
||||
'file_path' => $filepath . $fileRandomName
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -858,3 +875,29 @@ if (!function_exists('expected_amount_calc')) {
|
||||
return round($expectedAmount, 2); // Optional: round to 2 decimal places
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('getFileIfExists')) {
|
||||
function getFileIfExists($path)
|
||||
{
|
||||
return file_exists(FCPATH . $path) ? base_url($path) : '';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('removeNumberFormatting')) {
|
||||
function removeNumberFormatting($number)
|
||||
{
|
||||
return (float) str_replace(',', '', trim($number));
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('formatKey')) {
|
||||
function formatKey($key, $len = 3)
|
||||
{
|
||||
$words = explode('_', $key);
|
||||
$formatted = array_map(function ($word) use ($len) {
|
||||
return strlen($word) < $len ? strtoupper($word) : ucfirst(strtolower($word));
|
||||
}, $words);
|
||||
return implode(' ', $formatted);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,8 @@ class ClaimFilesModel extends Model
|
||||
'updated_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'is_active'
|
||||
'is_active',
|
||||
'file_name',
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
|
||||
@ -28,7 +28,8 @@ class ClientDepositModel extends Model
|
||||
"event_name",
|
||||
"unit",
|
||||
"cd_ac_pk",
|
||||
"record_date"
|
||||
"record_date",
|
||||
"policy_transaction_id",
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -55,6 +55,8 @@ class ClientPolicyModel extends Model
|
||||
"cd_ac_pk",
|
||||
"is_lgbtq",
|
||||
"placement_json",
|
||||
"policy_entry_from",
|
||||
"is_from_lead",
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
@ -429,8 +431,8 @@ class ClientPolicyModel extends Model
|
||||
$emp_count = $this->db->affectedRows();
|
||||
|
||||
// Log the result
|
||||
log_message('info', "Client policies updated: {$client_count}");
|
||||
log_message('info', "Employee policies updated: {$emp_count}");
|
||||
log_message('error', "Client policies updated: {$client_count}");
|
||||
log_message('error', "Employee policies updated: {$emp_count}");
|
||||
|
||||
return ['client' => $client_count, 'emp' => $emp_count];
|
||||
}
|
||||
|
||||
42
app/Models/CommonEMailModel.php
Normal file
42
app/Models/CommonEMailModel.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class CommonEMailModel extends Model
|
||||
{
|
||||
protected $table = 'common_mail';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = ['email','notification_id','is_active'];
|
||||
|
||||
protected bool $allowEmptyInserts = false;
|
||||
|
||||
// Dates
|
||||
protected $useTimestamps = false;
|
||||
protected $dateFormat = 'datetime';
|
||||
protected $createdField = 'created_at';
|
||||
protected $updatedField = 'updated_at';
|
||||
protected $deletedField = 'deleted_at';
|
||||
|
||||
// Validation
|
||||
protected $validationRules = [];
|
||||
protected $validationMessages = [];
|
||||
protected $skipValidation = false;
|
||||
protected $cleanValidationRules = true;
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = [];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = [];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
}
|
||||
@ -26,7 +26,8 @@ class EmpEndorsementModel extends Model
|
||||
"updated_by",
|
||||
"is_active",
|
||||
"remarks",
|
||||
"file_id"
|
||||
"file_id",
|
||||
"is_tpa_export",
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
|
||||
@ -382,6 +382,7 @@ class EmployeePolicyModel extends Model
|
||||
{
|
||||
return $this->where('employee_id',$arr['employee_id'])
|
||||
->where('client_policy_id',$arr['client_policy_id'])
|
||||
->where('status', 'active')
|
||||
->where('is_active',1)
|
||||
->find();
|
||||
}
|
||||
@ -607,9 +608,41 @@ class EmployeePolicyModel extends Model
|
||||
$client_branch_id = $ref_data['client_branch_id'];
|
||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||
|
||||
$endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NOT NULL OR a.endorsement_id != '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
$subquery_endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "WHERE (endorsement_id IS NOT NULL OR endorsement_id != '')" : "WHERE (endorsement_id IS NULL OR endorsement_id = '')";
|
||||
// $endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NOT NULL OR a.endorsement_id != '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
// $subquery_endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "WHERE (endorsement_id IS NOT NULL OR endorsement_id != '')" : "WHERE (endorsement_id IS NULL OR endorsement_id = '')";
|
||||
|
||||
$endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NULL OR a.is_tpa_export IS NULL)" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
$subquery_endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "WHERE (endorsement_id IS NULL OR is_tpa_export IS NULL)" : "WHERE (endorsement_id IS NULL OR endorsement_id = '')";
|
||||
|
||||
/*
|
||||
ROUND(sidata.new_si_premium - sidata.old_si_premium, 2) AS difference_premium,
|
||||
ROUND(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365,
|
||||
2
|
||||
) AS pro_rata_premium,
|
||||
ROUND(
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) * 0.18,
|
||||
2
|
||||
) AS gst,
|
||||
ROUND(
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) +
|
||||
ROUND(
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) * 0.18,
|
||||
2
|
||||
),
|
||||
2
|
||||
) AS total
|
||||
*/
|
||||
|
||||
$query = $this->db->query("
|
||||
SELECT
|
||||
@ -643,33 +676,40 @@ class EmployeePolicyModel extends Model
|
||||
sidata.old_si_premium,
|
||||
sidata.date_of_coverage,
|
||||
DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1 AS no_of_days,
|
||||
ROUND(sidata.new_si_premium - sidata.old_si_premium, 2) AS difference_premium,
|
||||
|
||||
ROUND(ABS(sidata.new_si_premium - sidata.old_si_premium), 2) AS difference_premium,
|
||||
ROUND(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365,
|
||||
ABS(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
),
|
||||
2
|
||||
) AS pro_rata_premium,
|
||||
ROUND(
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) * 0.18,
|
||||
ABS(
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) * 0.18
|
||||
),
|
||||
2
|
||||
) AS gst,
|
||||
ROUND(
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) +
|
||||
ROUND(
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) * 0.18,
|
||||
2
|
||||
ABS(
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) +
|
||||
(
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) * 0.18
|
||||
)
|
||||
),
|
||||
2
|
||||
) AS total
|
||||
|
||||
FROM
|
||||
emp_endorsement a
|
||||
LEFT JOIN employees ON employees.emp_code = a.emp_code
|
||||
@ -1471,7 +1511,7 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
ep.tpa_id,
|
||||
ep.uhid,
|
||||
ep.policy_end_date,
|
||||
cp.policy_end_date,
|
||||
ep.basic_cover_si,
|
||||
|
||||
clients.client_name,
|
||||
@ -1492,6 +1532,7 @@ class EmployeePolicyModel extends Model
|
||||
tpa.tpa_logo AS tpa_logo,
|
||||
tpa.front_card,
|
||||
tpa.back_card,
|
||||
tpa.network_hospitals,
|
||||
tpa.short_name AS tpa_short_name'
|
||||
)
|
||||
|
||||
@ -1531,12 +1572,19 @@ class EmployeePolicyModel extends Model
|
||||
e.doj,
|
||||
e.band,
|
||||
TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age,
|
||||
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ' and client_id = '.$client_id.' LIMIT 1) AS self,
|
||||
|
||||
(
|
||||
SELECT name FROM employees
|
||||
WHERE relationship = "Self"
|
||||
and emp_code = ' . $this->db->escape($emp_code) . '
|
||||
and client_id = '.$client_id.'
|
||||
and is_active = 1
|
||||
and emp_status = "active"
|
||||
LIMIT 1
|
||||
) AS self,
|
||||
|
||||
ep.tpa_id,
|
||||
ep.uhid,
|
||||
ep.policy_end_date,
|
||||
cp.policy_end_date,
|
||||
ep.basic_cover_si,
|
||||
|
||||
clients.client_name,
|
||||
@ -1557,6 +1605,7 @@ class EmployeePolicyModel extends Model
|
||||
tpa.tpa_logo AS tpa_logo,
|
||||
tpa.front_card,
|
||||
tpa.back_card,
|
||||
tpa.network_hospitals,
|
||||
tpa.short_name AS tpa_short_name'
|
||||
)
|
||||
|
||||
|
||||
@ -25,7 +25,8 @@ class EndorsementModel extends Model
|
||||
'updated_by',
|
||||
'updated_at',
|
||||
'file_id',
|
||||
'is_active'
|
||||
'is_active',
|
||||
'batch_file_id',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ class FileModel extends Model
|
||||
"uploaded_by",
|
||||
"updated_by",
|
||||
"hr_file_id",
|
||||
"is_comparison_skipped",
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ class InsurerBranchModel extends Model
|
||||
|
||||
public function getInsurerBranchesWithInsurerNames()
|
||||
{
|
||||
$query = $this->select('insurer_branch.*, I.short_name as insurer_name')
|
||||
$query = $this->select('insurer_branch.*, I.short_name as insurer_name, I.category')
|
||||
->join('insurers I', 'insurer_branch.insurer_id = I.id', 'left')
|
||||
->find();
|
||||
return $query;
|
||||
|
||||
@ -106,6 +106,7 @@ class LeadsModel extends Model
|
||||
'is_insurer_auto_mail',
|
||||
'quote_received_insurer',
|
||||
'acm_id',
|
||||
'policy_with_correction',
|
||||
];
|
||||
|
||||
|
||||
@ -204,78 +205,151 @@ class LeadsModel extends Model
|
||||
return $result;
|
||||
}
|
||||
|
||||
// public function getDashData()
|
||||
// {
|
||||
// $statuses = $this->db->table('leads')
|
||||
// ->select('status, policy_with_correction')
|
||||
// ->where("is_active", 1)
|
||||
// ->groupBy('status')
|
||||
// ->get()
|
||||
// ->getResultArray();
|
||||
|
||||
// $policy_with_correction_count = $this->db->table('leads')
|
||||
// ->where('is_active', 1)
|
||||
// ->where('policy_with_correction', 1)
|
||||
// ->countAllResults();
|
||||
|
||||
// $selectParts = [];
|
||||
|
||||
// foreach ($statuses as $status) {
|
||||
// $s = $status['status'];
|
||||
// $alias = strtolower(str_replace(' ', '_', $s));
|
||||
|
||||
// // Count alias
|
||||
// $selectParts[] = "SUM(CASE WHEN status = '{$s}' THEN 1 ELSE 0 END) AS `{$alias}`";
|
||||
|
||||
// // IDs alias
|
||||
// $selectParts[] = "GROUP_CONCAT(CASE WHEN status = '{$s}' THEN leads.id ELSE NULL END) AS `{$alias}_ids`";
|
||||
// }
|
||||
|
||||
// $select = implode(", ", $selectParts);
|
||||
|
||||
// // Start query builder
|
||||
// $builder = $this->db->table('leads');
|
||||
|
||||
// $builder->select($select);
|
||||
|
||||
// // Auditing subquery
|
||||
// $subquery = "(SELECT pk, MAX(created_at) AS last_claim_status_change
|
||||
// FROM auditing_history
|
||||
// WHERE table_name = 'leads' AND field_name = 'status'
|
||||
// GROUP BY pk)";
|
||||
|
||||
// $builder->join("{$subquery} AS th", 'leads.id = th.pk', 'left');
|
||||
|
||||
// // Date filtering for last status change
|
||||
// $dateLimit = 3;
|
||||
// $dateThreshold = date('Y-m-d H:i:s', strtotime("-{$dateLimit} days"));
|
||||
|
||||
// $builder->groupStart()
|
||||
// ->where('th.last_claim_status_change <=', $dateThreshold)
|
||||
// ->orWhere('th.last_claim_status_change IS NULL')
|
||||
// ->groupEnd();
|
||||
|
||||
// // Add only active
|
||||
// $builder->where("leads.is_active", 1);
|
||||
|
||||
// $lead_data = $builder->get()->getResultArray();
|
||||
|
||||
// // dd($this->db->getLastQuery());
|
||||
|
||||
// // Fallback for empty results
|
||||
// if (empty($lead_data)) {
|
||||
// $lead_data[0] = ['total' => 0];
|
||||
// foreach ($statuses as $status) {
|
||||
// $alias = strtolower(str_replace(' ', '_', $status['status']));
|
||||
// $lead_data[0][$alias] = 0;
|
||||
// $lead_data[0]["{$alias}_ids"] = '';
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Calculate total
|
||||
// $total = 0;
|
||||
// foreach ($lead_data[0] as $key => $value) {
|
||||
// // if (!str_ends_with($key, '_ids') && $key != "won") {
|
||||
// // $total += (int) $value;
|
||||
// // }
|
||||
|
||||
// if (!str_ends_with($key, '_ids')) {
|
||||
// $total += (int) $value;
|
||||
// }
|
||||
// }
|
||||
|
||||
// $total = $total + $policy_with_correction_count ?? 0;
|
||||
// $lead_data[0]['total'] = $total;
|
||||
// $lead_data[0]['policy_with_correction'] = $policy_with_correction_count;
|
||||
|
||||
|
||||
// // dd($lead_data[0]);
|
||||
// return $lead_data[0];
|
||||
// }
|
||||
|
||||
|
||||
public function getDashData()
|
||||
{
|
||||
// Get all unique statuses
|
||||
$statuses = $this->db->table('leads')
|
||||
->select('status')
|
||||
->where("is_active", 1)
|
||||
->groupBy('status')
|
||||
->select('DISTINCT(status)')
|
||||
->where('is_active', 1)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
|
||||
$policy_with_correction_data = $this->db->table('leads')
|
||||
->select('COUNT(id) AS count, GROUP_CONCAT(id) AS ids')
|
||||
->where('is_active', 1)
|
||||
->where('policy_with_correction', 1)
|
||||
->get()
|
||||
->getRowArray();
|
||||
|
||||
if (empty($statuses)) {
|
||||
return ['total' => 0];
|
||||
}
|
||||
|
||||
// Build dynamic select fields for each status
|
||||
$selectParts = [];
|
||||
|
||||
foreach ($statuses as $status) {
|
||||
$s = $status['status'];
|
||||
$alias = strtolower(str_replace(' ', '_', $s));
|
||||
|
||||
// Count alias
|
||||
$selectParts[] = "SUM(CASE WHEN status = '{$s}' THEN 1 ELSE 0 END) AS `{$alias}`";
|
||||
|
||||
// IDs alias
|
||||
$selectParts[] = "GROUP_CONCAT(CASE WHEN status = '{$s}' THEN leads.id ELSE NULL END) AS `{$alias}_ids`";
|
||||
foreach ($statuses as $row) {
|
||||
$status = $row['status'];
|
||||
$alias = strtolower(str_replace(' ', '_', $status));
|
||||
|
||||
$selectParts[] = "SUM(CASE WHEN status = '{$status}' THEN 1 ELSE 0 END) AS `{$alias}`";
|
||||
$selectParts[] = "GROUP_CONCAT(CASE WHEN status = '{$status}' THEN id END) AS `{$alias}_ids`";
|
||||
}
|
||||
|
||||
|
||||
$select = implode(", ", $selectParts);
|
||||
|
||||
// Start query builder
|
||||
$builder = $this->db->table('leads');
|
||||
|
||||
$builder->select($select);
|
||||
|
||||
// Auditing subquery
|
||||
$subquery = "(SELECT pk, MAX(created_at) AS last_claim_status_change
|
||||
FROM auditing_history
|
||||
WHERE table_name = 'leads' AND field_name = 'status'
|
||||
GROUP BY pk)";
|
||||
|
||||
$builder->join("{$subquery} AS th", 'leads.id = th.pk', 'left');
|
||||
|
||||
// Date filtering for last status change
|
||||
$dateLimit = 3;
|
||||
$dateThreshold = date('Y-m-d H:i:s', strtotime("-{$dateLimit} days"));
|
||||
|
||||
$builder->groupStart()
|
||||
->where('th.last_claim_status_change <=', $dateThreshold)
|
||||
->orWhere('th.last_claim_status_change IS NULL')
|
||||
->groupEnd();
|
||||
|
||||
// Add only active
|
||||
$builder->where("leads.is_active", 1);
|
||||
|
||||
$lead_data = $builder->get()->getResultArray();
|
||||
|
||||
// Fallback for empty results
|
||||
if (empty($lead_data)) {
|
||||
$lead_data[0] = ['total' => 0];
|
||||
foreach ($statuses as $status) {
|
||||
$alias = strtolower(str_replace(' ', '_', $status['status']));
|
||||
$lead_data[0][$alias] = 0;
|
||||
$lead_data[0]["{$alias}_ids"] = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Main query
|
||||
$lead_data = $this->db->table('leads')
|
||||
->select($select)
|
||||
->where('is_active', 1)
|
||||
->get()
|
||||
->getRowArray();
|
||||
|
||||
// Calculate total
|
||||
$total = 0;
|
||||
foreach ($lead_data[0] as $key => $value) {
|
||||
if (!str_ends_with($key, '_ids') && $key != "won") {
|
||||
$total += (int) $value;
|
||||
foreach ($lead_data as $key => $val) {
|
||||
if (!str_ends_with($key, '_ids')) {
|
||||
$total += (int) $val;
|
||||
}
|
||||
}
|
||||
$lead_data[0]['total'] = $total;
|
||||
|
||||
// dd($lead_data[0]);
|
||||
return $lead_data[0];
|
||||
|
||||
$lead_data['total'] = $total;
|
||||
$lead_data['policy_with_correction'] = $policy_with_correction_data['count'] ?? 0;
|
||||
$lead_data['policy_with_correction_ids'] = $policy_with_correction_data['ids'] ?? null;
|
||||
|
||||
// dd($lead_data);
|
||||
return $lead_data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
57
app/Models/RTOModel.php
Normal file
57
app/Models/RTOModel.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class RTOModel extends Model
|
||||
{
|
||||
|
||||
protected $table = 'rto_master';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
|
||||
'id',
|
||||
'rto_state',
|
||||
'rto_code',
|
||||
'rto_name',
|
||||
'created_at',
|
||||
'created_by',
|
||||
'updated_at',
|
||||
'updated_by',
|
||||
'is_active',
|
||||
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
protected function checkAndADDCreatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['created_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['created_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['updated_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}}
|
||||
@ -25,6 +25,7 @@ class VehicleModel extends Model
|
||||
'is_active',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'rto_id',
|
||||
];
|
||||
|
||||
|
||||
|
||||
54
app/Models/VehicleTypeModel.php
Normal file
54
app/Models/VehicleTypeModel.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class VehicleTypeModel extends Model
|
||||
{
|
||||
protected $table = 'vehicle_type';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
|
||||
'id',
|
||||
'vehicle_type',
|
||||
'created_at',
|
||||
'created_by',
|
||||
'updated_at',
|
||||
'updated_by',
|
||||
'is_active',
|
||||
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
protected function checkAndADDCreatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['created_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['created_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['updated_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}}
|
||||
@ -208,7 +208,7 @@
|
||||
|
||||
<?php if(in_array(get_role_id(), [1,2,3,5]) || (get_role_id() == 4 && in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
|
||||
|
||||
<li class="nav-item d-flex justify-content-center align-items-center">
|
||||
<!-- <li class="nav-item d-flex justify-content-center align-items-center">
|
||||
<a href="#bds-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-1 dash-anchor nav-dash" id="bds_tab">
|
||||
<img src="<?= base_url() . "public"; ?>/assets/images/inactive_bds.png" alt="Logo" height="14" class="inactive_bds">
|
||||
<img src="<?= base_url() . "public"; ?>/assets/images/active_bds.png" alt="Logo" height="14"
|
||||
@ -217,7 +217,7 @@
|
||||
<span class="d-none d-sm-inline-block dash-tab dash-tab-font">BDS</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
-->
|
||||
|
||||
<?php } ?>
|
||||
<?php if ((get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team())) || in_array(get_role_id(),[1,5])) :?>
|
||||
@ -262,7 +262,7 @@
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if(in_array(get_role_id(), [1,2,3,5]) || (get_role_id() == 4 && in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
|
||||
<?php include('bds_dash.php'); ?>
|
||||
<!-- <?php //include('bds_dash.php'); ?> -->
|
||||
<?php } ?>
|
||||
<?php if ((get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_team())) || in_array(get_role_id(),[1,5])) :?>
|
||||
<?php include("leads_dash.php") ?>
|
||||
|
||||
@ -342,6 +342,13 @@ table.dataTable tbody td {
|
||||
|
||||
</style>
|
||||
|
||||
<?php
|
||||
|
||||
$session = \Config\Services::session();
|
||||
$currentLogInRole = $session->get()['userData']->role;
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<!-- End ADD and EDIT Page HTML -->
|
||||
<div class="row" id="List-page">
|
||||
@ -511,7 +518,17 @@ table.dataTable tbody td {
|
||||
</label>
|
||||
<select class="form-control" id="role" name="role" required>
|
||||
<option value="">Select Role</option>
|
||||
<?php foreach($roleData as $value) { ?>
|
||||
|
||||
<?php foreach($roleData as $value) {
|
||||
|
||||
// $headRoleValue = $value['id']??"";
|
||||
|
||||
// // we are showing head role only to head's who logged in
|
||||
// if($headRoleValue == "5" && $currentLogInRole != "5" ){
|
||||
// continue;
|
||||
// }
|
||||
|
||||
?>
|
||||
<option value="<?= $value['id'] ?>"><?= $value['role'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
@ -522,7 +539,16 @@ table.dataTable tbody td {
|
||||
<span class="tooltip-trigger mdi mdi-information-outline" id="accessMatrixTrigger"></span>
|
||||
</label>
|
||||
<select hidden class="form-control" id="team" name="team[]" multiple required>
|
||||
<?php foreach($teamData as $value) { ?>
|
||||
<?php foreach($teamData as $value) {
|
||||
|
||||
$teamValue = $value['id']??"";
|
||||
|
||||
// we are showing head role only to head's who logged in
|
||||
if( ($teamValue == "4" || $teamValue =="6" ) && $currentLogInRole != "5" ){
|
||||
continue;
|
||||
}
|
||||
|
||||
?>
|
||||
<option value="<?= $value['id'] ?>"><?= $value['name'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
@ -673,7 +699,34 @@ table.dataTable tbody td {
|
||||
<td>BDS - All access</td>
|
||||
<td>All access</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="team-cell" rowspan="6">Accounts</td>
|
||||
<td>BDS - Policy Transaction</td>
|
||||
<td>Policy | Endorsement | Statement Upload</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BDS - Report</td>
|
||||
<td>TAT wise | ACM Status wise | ACM TAT wise</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BDS - Policy Report</td>
|
||||
<td>BDS | Variance | Outstanding | IRDA | Renewal | TAT Band </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BDS - Pending Actions</td>
|
||||
<td>Finance Team</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BDS - Masters</td>
|
||||
<td>Vehicle | CD | Insurer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BDS - Documents</td>
|
||||
<td>✓</td>
|
||||
</tr>
|
||||
<!-- Temporary please don't delete (start's) -->
|
||||
<!--
|
||||
<tr>
|
||||
<td class="team-cell" rowspan="5">Finance</td>
|
||||
<td>BDS - Policy Transaction</td>
|
||||
<td>Policy | Endorsement | Statement Upload</td>
|
||||
@ -715,6 +768,8 @@ table.dataTable tbody td {
|
||||
<td>BDS - Documents</td>
|
||||
<td>✓</td>
|
||||
</tr>
|
||||
-->
|
||||
<!-- Temporary please don't delete (ends) -->
|
||||
<tr>
|
||||
<td class="team-cell" rowspan="2">POS</td>
|
||||
<td>BDS - Policy Transaction</td>
|
||||
@ -1495,9 +1550,10 @@ table.dataTable tbody td {
|
||||
container.append(`<div class="no-files-message">No Files have been Uploaded</div>`);
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
error: function (xhr, status, errorThrown) {
|
||||
container.html(`<div class="no-files-message">No Files have been Uploaded</div>`);
|
||||
toastr.error('Server error occurred.', 'Error');
|
||||
console.log("Error: " + xhr.status + " - " + errorThrown);
|
||||
if (xhr.status !== 404) toastr.error(errorThrown || xhr.responseText || 'Something went wrong', 'Error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -82,14 +82,15 @@
|
||||
|
||||
<?php } else if ($file['status'] == 'partially success') { ?>
|
||||
|
||||
<?php echo $file['status']; ?>
|
||||
<?php if ($file['error_data'] != 0) { ?>
|
||||
<?php echo $file['status']; ?>
|
||||
|
||||
<a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top" title="<?= $file['error_data'] ?>"></a>
|
||||
|
||||
<?php if ($file['error_data'] != 0) { ?>
|
||||
|
||||
<?php } ?>
|
||||
<a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top" title="<?= $file['error_data'] ?>"></a>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php } else if ($file['status'] == 'in-progress-partially') { ?>
|
||||
|
||||
@ -98,7 +99,6 @@
|
||||
<a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top" title="<?= $file['error_data'] ?>"></a>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php } else if ($file['status'] == 'failed-1') { ?>
|
||||
@ -135,6 +135,11 @@
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top" title="There is no data to update"></a>
|
||||
|
||||
<?php } else if ($file['status'] == 'failed-7') { ?>
|
||||
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top" title="<?= $file['error_data'] ?>"></a>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<?php echo $file['status']; ?>
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
// Get headers dynamically
|
||||
$headers = array_keys($data[0]);
|
||||
foreach ($headers as $header): ?>
|
||||
<th><?= esc($header) ?></th>
|
||||
<th><?= esc(str_replace('_', ' ', $header)) ?></th>
|
||||
<?php endforeach; ?>
|
||||
<th>TOTAL</th>
|
||||
</tr>
|
||||
|
||||
@ -154,35 +154,18 @@ $(document).ready(function() {
|
||||
// Global DataTables defaults
|
||||
$.extend(true, $.fn.dataTable.defaults, {
|
||||
language: {
|
||||
search: "", // remove "Search:" label
|
||||
search: `
|
||||
<div class="datatable-search-wrapper">
|
||||
_INPUT_
|
||||
<i class="mdi mdi-magnify datatable-search-icon"></i>
|
||||
</div>`,
|
||||
searchPlaceholder: "Search"
|
||||
},
|
||||
|
||||
paging: true,
|
||||
pageLength: 10,
|
||||
ordering: false
|
||||
});
|
||||
|
||||
// Global init hook
|
||||
$(document).on('init.dt', function (e, settings) {
|
||||
let $filter = $(settings.nTableWrapper).find('.dataTables_filter');
|
||||
let $input = $filter.find('input');
|
||||
|
||||
if (!$filter.hasClass('custom-search')) {
|
||||
// Wrap in Bootstrap input-group
|
||||
$input
|
||||
.addClass('form-control')
|
||||
.wrap('<div class="input-group"></div>');
|
||||
|
||||
// Append icon
|
||||
$input.after(`
|
||||
<span class="input-group-text bg-white border-0">
|
||||
<i class="mdi mdi-magnify"></i>
|
||||
</span>
|
||||
`);
|
||||
|
||||
// Align to right
|
||||
$filter.addClass('text-right custom-search');
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -19,6 +19,10 @@ table.dataTable tbody td {
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#scroll-horizontal-datatable tfoot .right-align-input {
|
||||
text-align: right !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="col-12">
|
||||
@ -84,6 +88,7 @@ table.dataTable tbody td {
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
className: 'app-btn-primary ',
|
||||
title: 'Insurer-Wise-Report-List',
|
||||
footer: true
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
@ -93,6 +98,7 @@ table.dataTable tbody td {
|
||||
orthogonal: 'sort'
|
||||
},
|
||||
className: 'app-btn-primary ',
|
||||
footer: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -19,6 +19,12 @@ table.dataTable tbody td {
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#scroll-horizontal-datatable tfoot .right-align-input {
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<div class="col-12">
|
||||
@ -84,6 +90,7 @@ table.dataTable tbody td {
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
className: 'app-btn-primary ',
|
||||
title: 'Bap-Wise-Report-List',
|
||||
footer: true
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
@ -93,6 +100,7 @@ table.dataTable tbody td {
|
||||
},
|
||||
className: 'app-btn-primary ',
|
||||
title: 'Bap-Wise-Report-List',
|
||||
footer: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="insurer_branch_id">Insurer Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control <?= !isset($CD_Master_Data) ? 'readonly-select' : '' ?>" id="insurer_branch_id" name="insurer_branch_id" required>
|
||||
<select class="form-control <?= !isset($CD_Master_Data) ? 'readonly-select' : '' ?>" id="insurer_branch_id" name="insurer_branch_id" onchange="checkDuplicateCdAccount(this)" required>
|
||||
<option value="">Select Insurer Branch</option>
|
||||
<?php if(isset($insurer_branch) && !empty($insurer_branch))
|
||||
{ foreach($insurer_branch as $branch) { ?>
|
||||
@ -229,11 +229,11 @@
|
||||
$('#opening_bal').prop("disabled", false);
|
||||
|
||||
if(isCdMasterPage == true){
|
||||
$('#client_id').val('').change();
|
||||
$('#insurer_id_for_cd').val('').change();
|
||||
$('#insurer_branch_id').val('').change();
|
||||
$('#cd_client_id').val('').select2();
|
||||
$('#insurer_id_for_cd').val('').select2();
|
||||
$('#insurer_branch_id').val('').select2();
|
||||
|
||||
$('#client_id').prop("disabled", false);
|
||||
$('#cd_client_id').prop("disabled", false);
|
||||
$('#insurer_id_for_cd').prop("disabled", false);
|
||||
$('#insurer_branch_id').prop("disabled", false);
|
||||
|
||||
@ -266,7 +266,7 @@
|
||||
);
|
||||
});
|
||||
|
||||
$branchSelect.val('').trigger('change.select2');
|
||||
$branchSelect.val('').select2();
|
||||
}
|
||||
|
||||
function showCdMasterAddModal(){
|
||||
@ -301,5 +301,43 @@
|
||||
$('#cd_ac_no_for_cd_master').append(option);
|
||||
}
|
||||
|
||||
function checkDuplicateCdAccount(){
|
||||
|
||||
let url = '<?= base_url('util/checkDuplicateCdAccount') ?>';
|
||||
let client_id = $('#cd_client_id').val();
|
||||
let insurer_id = $('#insurer_id_for_cd').val();
|
||||
let insurer_branch_id = $('#insurer_branch_id').val();
|
||||
console.log({client_id, insurer_id, insurer_branch_id});
|
||||
|
||||
// Data to send in the AJAX request
|
||||
let requestData = {
|
||||
client_id: client_id,
|
||||
insurer_id: insurer_id,
|
||||
insurer_branch_id: insurer_branch_id,
|
||||
};
|
||||
|
||||
if(client_id != "" && insurer_id != "" && insurer_branch_id != ""){
|
||||
// Send AJAX request
|
||||
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
||||
|
||||
console.log('Data fetched successfully:', response);
|
||||
|
||||
if (response.status == true) {
|
||||
console.log('No dublicate found');
|
||||
} else {
|
||||
|
||||
$('#cd_client_id').val('').select2();
|
||||
$('#insurer_id_for_cd').val('').select2();
|
||||
$('#insurer_branch_id').val('').select2();
|
||||
toastr.warning(response.message, 'WARNING');
|
||||
}
|
||||
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
toastr.error('An error occurred while checking the CD amount.', 'ERROR');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -323,7 +323,7 @@ table.dataTable thead th {
|
||||
$('#cd_client_id').prop("disabled", true);
|
||||
$('#insurer_id_for_cd').val(res.data.insurer_id).change();
|
||||
$('#insurer_id_for_cd').prop("disabled", true);
|
||||
$('#insurer_branch_id').val(res.data.insurer_id).change();
|
||||
$('#insurer_branch_id').val(res.data.insurer_branch_id).select2();
|
||||
$('#insurer_branch_id').prop("disabled", true);
|
||||
$('#opening_date').val(res.data.opening_date);
|
||||
$('#cd_ac_no_for_cd_master').val(res.data.cd_ac_no);
|
||||
|
||||
@ -74,7 +74,7 @@
|
||||
|
||||
<div class="row float-left" style="position: relative; bottom: 20px; left: 13px;">
|
||||
<button type="button" id="btnAutoBranchFetch"
|
||||
class="btn btn-primary waves-effect waves-light btn-sm "> Auto Fetch branch Details</button>
|
||||
class="btn btn-primary waves-effect waves-light btn-sm ">Fetch Client Branch (Pre-Enrolment)</button>
|
||||
</div>
|
||||
|
||||
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
||||
@ -305,6 +305,8 @@ $('#btnBranchAdd').click(function() {
|
||||
$('#branch_form')[0].reset();
|
||||
$('#branch_form').parsley().reset();
|
||||
$('#pre_branch_id').val('');
|
||||
$('#branch_id_primarykey').val('');
|
||||
|
||||
$('.ac').css('display', 'block');
|
||||
contactCount = 1
|
||||
|
||||
@ -371,13 +373,14 @@ $("#branch_form").submit(function(event) {
|
||||
|
||||
var selectedValues = $("#selected").val();
|
||||
console.log(selectedValues, selectedValues);
|
||||
console.log("branch_id_primarykey", $('#branch_id_primarykey').val());
|
||||
|
||||
|
||||
let level_contect_data = getContactsData();
|
||||
console.log('level_contect_data', level_contect_data);
|
||||
|
||||
event.preventDefault();
|
||||
branch_PrimaryKey = $('#client_id_branch').val();
|
||||
|
||||
console.log('branch_PrimaryKey', branch_PrimaryKey)
|
||||
|
||||
if (branch_PrimaryKey === '') {
|
||||
@ -983,55 +986,108 @@ function validateDuplicateByClientBranch(input, field, submitButId) {
|
||||
let message = label ? label + " is duplicate!" : "Value is duplicate!";
|
||||
|
||||
console.log(`cId: ${clientId} | bId: ${branchId}`);
|
||||
|
||||
|
||||
// Don't forgot be careful
|
||||
// 1 Local duplication check (User entered)
|
||||
let isLocalDuplicate = false;
|
||||
$('input[name="' + field + '[]"]').each(function(index) {
|
||||
let compareVal = $(this).val().trim();
|
||||
console.log(`Entered value: ${value} | Contact ${index+1} value: ${$(this).val()}`);
|
||||
if (this !== input && $(this).val().trim() === value) {
|
||||
if (this !== input && compareVal !== '' && compareVal === value) {
|
||||
isLocalDuplicate = true;
|
||||
return false; // break loop
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (isLocalDuplicate) {
|
||||
console.log(`r u n Local`);
|
||||
console.log(`btn Dis - true`);
|
||||
console.log(`duplicate found for ${field}`);
|
||||
toastr.warning(message, 'WARNING');
|
||||
$('#' + submitButId).prop('disabled', true);
|
||||
return; // don’t call server if duplicate in UI
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// important Skip empty values
|
||||
if (value === '') {
|
||||
checkAllFieldsValid(submitButId);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't forgot be careful
|
||||
// 2 Server-side duplicate check (DB)
|
||||
if (!isLocalDuplicate && value !== '') {
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/others/check-duplicate") ?>',
|
||||
type: 'POST',
|
||||
data: {
|
||||
client_id: clientId,
|
||||
branch_id: branchId,
|
||||
value: value,
|
||||
field: field
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
if (response.isDuplicate) {
|
||||
console.log(`r u n Server`);
|
||||
console.log(`btn Dis - true`);
|
||||
toastr.warning(message, 'WARNING');
|
||||
$('#' + submitButId).prop('disabled', true);
|
||||
} else {
|
||||
console.log(`btn Dis - false`);
|
||||
$('#' + submitButId).prop('disabled', false);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('AJAX Error:', error);
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/others/check-duplicate") ?>',
|
||||
type: 'POST',
|
||||
data: {
|
||||
client_id: clientId,
|
||||
branch_id: branchId,
|
||||
value: value,
|
||||
field: field
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
if (response.isDuplicate) {
|
||||
console.log(`r u n Server`);
|
||||
console.log(`duplicate found for ${field}`);
|
||||
toastr.warning(message, 'WARNING');
|
||||
$('#' + submitButId).prop('disabled', true);
|
||||
} else {
|
||||
console.log(`No duplicate for ${field}`);
|
||||
checkAllFieldsValid(submitButId);
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('AJAX Error:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// recheck all contacts before enabling submit
|
||||
function checkAllFieldsValid(submitButId) {
|
||||
let emailDuplicates = false;
|
||||
let mobileDuplicates = false;
|
||||
|
||||
// cross check all EMAIL duplicates
|
||||
let emailSeen = [];
|
||||
$('input[name="email[]"]').each(function() {
|
||||
let val = $(this).val().trim();
|
||||
if (val && emailSeen.includes(val)) {
|
||||
emailDuplicates = true;
|
||||
} else if (val) {
|
||||
emailSeen.push(val);
|
||||
}
|
||||
});
|
||||
|
||||
// cross check all MOBILE duplicates
|
||||
let mobileSeen = [];
|
||||
$('input[name="mobile[]"]').each(function() {
|
||||
let val = $(this).val().trim();
|
||||
if (val && mobileSeen.includes(val)) {
|
||||
mobileDuplicates = true;
|
||||
} else if (val) {
|
||||
mobileSeen.push(val);
|
||||
}
|
||||
});
|
||||
|
||||
if (emailDuplicates || mobileDuplicates) {
|
||||
$('#' + submitButId).prop('disabled', true);
|
||||
// show correct message based on what’s duplicated
|
||||
if (emailDuplicates && mobileDuplicates) {
|
||||
toastr.warning("Email and Mobile values are duplicate!", "WARNING");
|
||||
console.log('Both Email and Mobile duplicates');
|
||||
} else if (emailDuplicates) {
|
||||
toastr.warning("Email duplicate!", "WARNING");
|
||||
console.log('Cross Check Email duplicates');
|
||||
} else if (mobileDuplicates) {
|
||||
toastr.warning("Mobile duplicate!", "WARNING");
|
||||
console.log('Cross Check Mobile duplicates');
|
||||
}
|
||||
console.log(`btn Dis - true`);
|
||||
} else {
|
||||
console.log('unique — enable');
|
||||
console.log(`btn Dis - false`);
|
||||
$('#' + submitButId).prop('disabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -407,7 +407,7 @@
|
||||
<div class="modal-dialog modal-dialog-centered" style="margin-left: 400px !important;">
|
||||
<div class="modal-content modal-lg">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="autoFetchBranchModalLabel">Auto Fetch Branch Details</h5>
|
||||
<h5 class="modal-title" id="autoFetchBranchModalLabel">Fetch Client Branch (Pre-Enrolment)</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
|
||||
@ -27,13 +27,95 @@
|
||||
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.switch-label {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
cursor: pointer;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
justify-content: flex-end;
|
||||
margin-right: 40px;
|
||||
}
|
||||
|
||||
.switch-label input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.slider,
|
||||
.slider_blue {
|
||||
position: relative;
|
||||
width: 50px;
|
||||
height: 25px;
|
||||
background-color: #fff;
|
||||
border-radius: 25px;
|
||||
box-shadow: 0 0 5px rgba(0,0,0,0.2);
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
.slider::before ,
|
||||
.slider_blue::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
height: 19px;
|
||||
width: 19px;
|
||||
left: 3px;
|
||||
top: 3px;
|
||||
background-color: #ccc;
|
||||
border-radius: 50%;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: #ff4d4d; /* red when ON */
|
||||
}
|
||||
|
||||
input:checked + .slider_blue {
|
||||
background-color: #268ef5ff; /* blue when ON */
|
||||
}
|
||||
|
||||
input:checked + .slider::before ,
|
||||
input:checked + .slider_blue::before {
|
||||
transform: translateX(25px);
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.switch-text {
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
#table-client-policy_wrapper .row>.col-sm-12.col-md-6:first-child{
|
||||
display: none;
|
||||
}
|
||||
|
||||
#table-client-policy_filter{
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="save-indicator" id="saveIndicator">Saved</div>
|
||||
<div class="tab-pane fade" id="police-tab">
|
||||
|
||||
<div class="row float-right" style="padding-bottom: 10px; position: relative;right: 13px;">
|
||||
<div class="row" style="padding-bottom: 10px; position: relative;right: 13px; justify-content: end;">
|
||||
<button type="button" id="BtnAdd" class="btn btn-primary waves-effect waves-light btnAdd btn-sm" style="position: relative;right: 10px;"><span class="mdi mdi-plus-box-outline" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policy</button>
|
||||
<button type="button" id="BtnAddSuccess" class="btn btn-success waves-effect waves-light BtnAddSuccess btn-sm" onclick="showModal()"><span class="mdi mdi-plus-box-outline" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policy From Lead</button>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="" style="padding-bottom: 10px; position: absolute;
|
||||
right: 0;">
|
||||
<label class="switch-label">
|
||||
<input type="checkbox" id="chk-show-expired">
|
||||
<span class="slider"></span>
|
||||
<span class="switch-text">Expired Policies</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive" id="table_list">
|
||||
<table data-custom-table-css="table" class="table table-borderless table mb-0" id="table-client-policy">
|
||||
@ -194,23 +276,18 @@
|
||||
<textarea class="form-control" placeholder="Enter Disclaimer" name="disclaimer" id="disclaimer" ></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4 EB">
|
||||
<label class="switch" style="position: relative;top: 43px;left: 20px;">
|
||||
<div class="form-group col-md-12 EB mt-3 ">
|
||||
<label class="switch-label">
|
||||
<input id="policy_visibility" type="checkbox" name="enrolment_visibility" checked>
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
<span class="slider_blue"></span>
|
||||
<span class="switch-text">Policy Visibilty in Employee App</span>
|
||||
</label>
|
||||
|
||||
<!-- <label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Enrollment App</label> -->
|
||||
<label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Employee App</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4 EB">
|
||||
<label class="switch" style="position: relative;top: 43px;left: 20px;">
|
||||
|
||||
<label class="switch-label" >
|
||||
<input id="is_lgbtq" type="checkbox" name="is_lgbtq">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
<span class="slider_blue"></span>
|
||||
<span class="switch-text">Is LGBTQ Enable</span>
|
||||
</label>
|
||||
|
||||
<label for="is_lgbtq" style="position: relative;bottom: 5px;left: 85px;"> Is LGBTQ Enable</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -268,7 +345,8 @@
|
||||
</div>
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<script>
|
||||
<script>
|
||||
|
||||
// $('#inception_type').change(function () {
|
||||
// var open_data = $('#open_date').parent();
|
||||
// var close_data = $('#close_date').parent();
|
||||
@ -290,6 +368,8 @@
|
||||
var policy_PrimaryKey = $('#client_id_policy').val();
|
||||
var policy_client = $('#policy_PrimaryKey').val();
|
||||
var submitInterval = null;
|
||||
let insurer_data = <?= json_encode($insurer ?? []) ?>;
|
||||
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
@ -308,6 +388,8 @@
|
||||
// Get today's date
|
||||
var today = new Date();
|
||||
|
||||
const showExpired = $('#chk-show-expired').is(':checked');
|
||||
|
||||
var startDatePicker = flatpickr("#start_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
defaultDate: today,
|
||||
@ -412,37 +494,42 @@
|
||||
|
||||
var policy_name_data = `${item.policy_type_name ?? ''}` + ' - ' + `${item.policy_no ?? ''}`;
|
||||
|
||||
if(showExpired == false && checkDateStatus(item.policy_end_date) != 'Expired'){
|
||||
|
||||
|
||||
|
||||
policyTable += `
|
||||
<tr>
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${policy_name_data}</td>
|
||||
<td>${item.branch_name ? item.branch_name : ' - '}</td>
|
||||
<td>${tpaValue}</td>
|
||||
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||
|
||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" ><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>`;
|
||||
|
||||
// Conditionally render the delete option based on the role
|
||||
if (role !== 3 && role !== 4) {
|
||||
policyTable += `
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
|
||||
}
|
||||
<tr>
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${policy_name_data}</td>
|
||||
<td>${item.branch_name ? item.branch_name : ' - '}</td>
|
||||
<td>${tpaValue}</td>
|
||||
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||
|
||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" ><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>`;
|
||||
|
||||
policyTable += `
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
// Conditionally render the delete option based on the role
|
||||
if (role != 3 && role != 4) {
|
||||
|
||||
policyTable += `
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
|
||||
}
|
||||
|
||||
policyTable += `
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@ -452,9 +539,11 @@
|
||||
|
||||
|
||||
$('#table-client-policy').DataTable({
|
||||
paging: true,
|
||||
searching: false,
|
||||
// ordering: false
|
||||
paging: true,
|
||||
searching: true,
|
||||
autoWidth: false,
|
||||
responsive: true,
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -658,35 +747,41 @@
|
||||
|
||||
var policy_name_data = `${item.policy_type_name ?? ''}` + ' - ' + `${item.policy_no ?? ''}`;
|
||||
|
||||
policyTable += `
|
||||
<tr>
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${policy_name_data}</td>
|
||||
<td>${item.branch_name ? item.branch_name : ' - '}</td>
|
||||
<td>${tpaValue}</td>
|
||||
|
||||
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" ><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>`;
|
||||
|
||||
// Conditionally render the delete option based on the role
|
||||
if (role !== 3 && role !== 4) {
|
||||
if(checkDateStatus(item.policy_end_date) != 'Expired'){
|
||||
|
||||
policyTable += `
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="mdi mdi-delete-outline mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
|
||||
<tr>
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${policy_name_data}</td>
|
||||
<td>${item.branch_name ? item.branch_name : ' - '}</td>
|
||||
<td>${tpaValue}</td>
|
||||
|
||||
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" ><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>`;
|
||||
|
||||
// Conditionally render the delete option based on the role
|
||||
if (role != 3 && role != 4) {
|
||||
|
||||
|
||||
policyTable += `
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="mdi mdi-delete-outline mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
|
||||
}
|
||||
|
||||
policyTable += `
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
}
|
||||
|
||||
policyTable += `
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#policy_table').append(policyTable);
|
||||
// console.log(policyTable);
|
||||
@ -713,6 +808,9 @@
|
||||
//console.log('Unknown error occurred', 'Warning');
|
||||
}
|
||||
}, 1000);
|
||||
},
|
||||
complete :function(){
|
||||
console.log('AJAX request completed');
|
||||
}
|
||||
});
|
||||
|
||||
@ -749,6 +847,17 @@
|
||||
|
||||
if(response.status == false && response.insurer_id != 'undefined'){
|
||||
toastr.warning('The CD Account Number not found.', 'Warning');
|
||||
|
||||
$('#cd_ac_no').empty();
|
||||
$('#cd_ac_no').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select CD Account Number'
|
||||
}));
|
||||
$('#cd_ac_no').append($('<option>', {
|
||||
value: 'add_cd',
|
||||
text: '+ Add New CD'
|
||||
}));
|
||||
|
||||
return;
|
||||
}
|
||||
appendCDACNO(response.data)
|
||||
@ -777,6 +886,14 @@
|
||||
$('#tpa').prop('required', true);
|
||||
$('#tpa_danger').show()
|
||||
}
|
||||
|
||||
var select = $('#insurer');
|
||||
let category = insurer_category[policy_type_id] ?? null;
|
||||
console.log('insurer_category', category);
|
||||
|
||||
if(select && category){
|
||||
appendInsurerByCategory(insurer_data, select, category);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -1713,15 +1830,18 @@
|
||||
//console.log('appendCDACNO', select);
|
||||
|
||||
$('#cd_ac_no').empty();
|
||||
|
||||
$('#cd_ac_no').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select CD Account Number'
|
||||
}));
|
||||
|
||||
$('#cd_ac_no').append($('<option>', {
|
||||
value: 'add_cd',
|
||||
text: '+ Add New CD'
|
||||
}));
|
||||
if(data.length == 0){
|
||||
$('#cd_ac_no').append($('<option>', {
|
||||
value: 'add_cd',
|
||||
text: '+ Add New CD'
|
||||
}));
|
||||
}
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
const option = $('<option>', {
|
||||
@ -2286,4 +2406,139 @@
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#chk-show-expired').on('change', function () {
|
||||
|
||||
const showExpired = $(this).is(':checked');
|
||||
|
||||
let policyTable = '';
|
||||
let data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
||||
let role = data.role
|
||||
delete data.role;
|
||||
|
||||
console.log("checkbox working");
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
// console.log('step 1');
|
||||
let patternGMC = /gmc/i; // Case insensitive pattern for 'gmc'
|
||||
let patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
|
||||
let subject = item.policy_type_name;
|
||||
|
||||
//console.log('search terms subject', subject);
|
||||
|
||||
if (patternGMC.test(subject)) {
|
||||
search_term = 'GMC';
|
||||
} else if (patternGPA.test(subject)) {
|
||||
search_term = 'GPA';
|
||||
} else {
|
||||
search_term = subject; // Set default value if neither 'GMC' nor 'GPA' exists
|
||||
}
|
||||
|
||||
let tpaValue = 'TPA Unavailable';
|
||||
|
||||
if (item.tpa_short && item.tpa_branch_code) {
|
||||
tpaValue = item.tpa_short + '-' + item.tpa_branch_code;
|
||||
}
|
||||
|
||||
let policy_name_data = `${item.policy_type_name ?? ''}` + ' - ' + `${item.policy_no ?? ''}`;
|
||||
|
||||
if(showExpired == true && checkDateStatus(item.policy_end_date) == 'Expired'){
|
||||
|
||||
|
||||
policyTable += `
|
||||
<tr>
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${policy_name_data}</td>
|
||||
<td>${item.branch_name ? item.branch_name : ' - '}</td>
|
||||
<td>${tpaValue}</td>
|
||||
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||
|
||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" ><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>`;
|
||||
|
||||
// Conditionally render the delete option based on the role
|
||||
if (role != 3 && role != 4) {
|
||||
policyTable += `
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
|
||||
}
|
||||
|
||||
policyTable += `
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(showExpired == false && checkDateStatus(item.policy_end_date) != 'Expired'){
|
||||
|
||||
|
||||
policyTable += `
|
||||
<tr>
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${policy_name_data}</td>
|
||||
<td>${item.branch_name ? item.branch_name : ' - '}</td>
|
||||
<td>${tpaValue}</td>
|
||||
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||
|
||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" ><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>`;
|
||||
|
||||
// Conditionally render the delete option based on the role
|
||||
if (role != 3 && role != 4) {
|
||||
policyTable += `
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
|
||||
}
|
||||
|
||||
policyTable += `
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
const table = $('#table-client-policy').DataTable();
|
||||
table.clear().destroy();
|
||||
|
||||
$('#table-client-policy tbody').html(policyTable); // replace tbody content
|
||||
|
||||
$('#table-client-policy').DataTable({
|
||||
paging: true,
|
||||
searching: true,
|
||||
autoWidth: false,
|
||||
responsive: true,
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -463,17 +463,26 @@ function fetchFileError(file_id) {
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
console.log('fetchFileError response', response);
|
||||
$(this).find(".modal-body").html("");
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
|
||||
try {
|
||||
// console.log((JSON.parse(response.data)));
|
||||
var file_error_data = (JSON.parse(response.data));
|
||||
var file_error_html = "";
|
||||
let hasError14 = false;
|
||||
let hasError15 = false;
|
||||
let buttonAdded = false;
|
||||
let error_code = 0;
|
||||
let is_comparison_skipped = response.is_comparison_skipped ?? null;
|
||||
let policy_id = response.policy_id ?? null;
|
||||
|
||||
for (var key in file_error_data['error_summary']) {
|
||||
// console.log(key);
|
||||
var err_id = parseInt(key);
|
||||
var err_count = file_error_data['error_summary'][key];
|
||||
|
||||
switch (err_id) {
|
||||
case 0:
|
||||
file_error_html +=
|
||||
@ -538,6 +547,20 @@ function fetchFileError(file_id) {
|
||||
"<strong>Rule conflict: Twofold relationship found within family</strong> <span class='badge badge-danger float-right'>" +
|
||||
err_count + "</span>";
|
||||
break;
|
||||
case 14:
|
||||
hasError14 = true;
|
||||
error_code = 14;
|
||||
file_error_html +=
|
||||
"<strong>This inception row was not found in the member data list.</strong> <span class='badge badge-danger float-right'>" +
|
||||
err_count + "</span>";
|
||||
break;
|
||||
case 15:
|
||||
hasError15 = true;
|
||||
error_code = 15;
|
||||
file_error_html +=
|
||||
"<strong>Inception–member data count mismatch.</strong> <span class='badge badge-danger float-right'>" + err_count + "</span> <br>"
|
||||
+ file_error_data['error_message'] ?? "" ;
|
||||
break;
|
||||
|
||||
default:
|
||||
file_error_html += "";
|
||||
@ -565,13 +588,37 @@ function fetchFileError(file_id) {
|
||||
// console.log('file_error_html_2', file_error_html)
|
||||
|
||||
}
|
||||
|
||||
// ✅ Decide when to add buttons
|
||||
if (!buttonAdded && is_comparison_skipped != 1 && is_comparison_skipped != 0) {
|
||||
if (hasError15 && error_code == 15) {
|
||||
// Add after 15 (preferred if both exist)
|
||||
file_error_html +=
|
||||
"<div id='confirmationdiv' class='mt-2 text-center'>" +
|
||||
"<p class='mb-2'>Do you want to skip the comparison?</p>" +
|
||||
"<button id='confirmYes' class='btn btn-success btn-sm mx-1' data-id="+file_id+" data-pid="+policy_id+">Yes</button>" +
|
||||
"<button id='confirmNo' class='btn btn-danger btn-sm mx-1' data-id="+file_id+" data-pid="+policy_id+">No</button>" +
|
||||
"</div>";
|
||||
buttonAdded = true;
|
||||
} else if (hasError14 && !hasError15 && error_code == 14) {
|
||||
// Add after 14 if 15 doesn't exist
|
||||
file_error_html +=
|
||||
"<div id='confirmationdiv' class='mt-2 text-center'>" +
|
||||
"<p class='mb-2'>Do you want to skip the comparison?</p>" +
|
||||
"<button id='confirmYes' class='btn btn-success btn-sm mx-1' data-id="+file_id+" data-pid="+policy_id+">Yes</button>" +
|
||||
"<button id='confirmNo' class='btn btn-danger btn-sm mx-1' data-id="+file_id+" data-pid="+policy_id+">No</button>" +
|
||||
"</div>";
|
||||
buttonAdded = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (err_id != 5 && err_id != 6 && err_id != 0) {
|
||||
file_error_html += (file_error_html != "" ?
|
||||
"<a href ='<?php echo base_url()?>" +
|
||||
"employee/excel_error/" + file_id +
|
||||
"' target=_blank>click here to more details...</a>" : "");
|
||||
"' target=_blank class='text-center'>click here to more details...</a>" : "");
|
||||
}
|
||||
|
||||
|
||||
// console.log(file_error_html);
|
||||
$('#file-err-modal').find(".modal-body").html(file_error_html);
|
||||
return file_error_html;
|
||||
@ -1043,5 +1090,105 @@ function checkValues() {
|
||||
// return true;
|
||||
}
|
||||
|
||||
$(document).on('click', '#confirmYes', function() {
|
||||
let file_id = $(this).data('id');
|
||||
let policy_id = $(this).data('pid');
|
||||
|
||||
console.log('file_id', file_id);
|
||||
console.log('policy_id', policy_id);
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "If you proceed, the comparison of the Inception and Member data list will be skipped, and the Inception file data validation process will start.",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "Yes, proceed",
|
||||
cancelButtonText: "No, cancel",
|
||||
confirmButtonColor: "#28a745",
|
||||
cancelButtonColor: "#dc3545",
|
||||
reverseButtons: true
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("util/proceedExcelFileDataValidation") ?>', // replace with actual API URL
|
||||
type: 'GET',
|
||||
data: { file_id: file_id, policy_id: policy_id },
|
||||
success: function(response) {
|
||||
console.log('API response:', response);
|
||||
|
||||
if (response.status === true) {
|
||||
toastr.success(response.message, 'SUCCESS');
|
||||
} else {
|
||||
toastr.warning(response.message, 'WARNING');
|
||||
}
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
window.location.reload();
|
||||
},
|
||||
error: function(xhr) {
|
||||
toastr.error('Failed to complete the action.');
|
||||
console.error('API error:', xhr.responseText);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '#confirmNo', function() {
|
||||
let file_id = $(this).data('id');
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "If you proceed, the comparison between the Inception and Member data list will continue without skipping, and the validation process will not start until the comparison is completed.",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "Yes, proceed",
|
||||
cancelButtonText: "No, cancel",
|
||||
confirmButtonColor: "#28a745",
|
||||
cancelButtonColor: "#dc3545",
|
||||
reverseButtons: true
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("util/proceedExcelFileDataValidation") ?>', // replace with actual API URL
|
||||
type: 'GET',
|
||||
data: { file_id: file_id, not_skiped : true },
|
||||
success: function(response) {
|
||||
console.log('API response:', response);
|
||||
|
||||
if (response.status === true) {
|
||||
toastr.success(response.message, 'SUCCESS');
|
||||
} else {
|
||||
toastr.warning(response.message, 'WARNING');
|
||||
}
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
window.location.reload();
|
||||
},
|
||||
error: function(xhr) {
|
||||
toastr.error('Failed to complete the action.');
|
||||
console.error('API error:', xhr.responseText);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
</script>
|
||||
@ -508,7 +508,7 @@
|
||||
</table> -->
|
||||
<!-- <button type="button" id="add_row_btn" class="btn btn-secondary float-right mt-2"><i class="fa fa-plus"></i></button> -->
|
||||
|
||||
<div class="payment-card">
|
||||
<div class="payment-card" id="default_payment_card">
|
||||
<input type="hidden" class="form-control" name="pk[]" placeholder="Enter Amount">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@ -959,19 +959,54 @@
|
||||
return parts[2] + '/' + parts[1] + '/' + parts[0]; // Rearrange to DD-MM-YYYY
|
||||
}
|
||||
|
||||
function togglePaymentCardRequired(flag) {
|
||||
// Select the default payment card container
|
||||
const card = document.getElementById("default_payment_card");
|
||||
if (!card) return;
|
||||
|
||||
// Select all input elements inside the card
|
||||
const inputs = card.querySelectorAll("input");
|
||||
|
||||
inputs.forEach(input => {
|
||||
if (flag) {
|
||||
input.setAttribute("required", "required");
|
||||
} else {
|
||||
input.removeAttribute("required");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showInvoiceStatusModal(event) {
|
||||
console.log('############ showInvoiceStatusModal function called ##################');
|
||||
var modal_received_amt_div = document.getElementById('modal_received_amt_div');
|
||||
modal_received_amt_div.style.display = 'none';
|
||||
// alert();
|
||||
// console.log(event.target.data)
|
||||
var dataId = event.target.getAttribute('data-id');
|
||||
// make sure event exists
|
||||
event = event || window.event;
|
||||
|
||||
// the element actually clicked
|
||||
const clicked = event.target;
|
||||
|
||||
// find the nearest ancestor <a> (or element) that has data-id
|
||||
const anchor = clicked.closest('a[data-id], .btnEdit');
|
||||
|
||||
if (!anchor) {
|
||||
console.warn('Could not find element with data-id');
|
||||
return;
|
||||
}
|
||||
|
||||
const dataId = anchor.getAttribute('data-id');
|
||||
const expAmt = anchor.getAttribute('data-exp-amt');
|
||||
const receivedAmt = anchor.getAttribute('data-received-amt');
|
||||
|
||||
console.log('stmt id :', dataId, expAmt, receivedAmt);
|
||||
|
||||
var dataExpAmt = event.target.getAttribute('data-exp-amt');
|
||||
var dataReceivedAmt = event.target.getAttribute('data-received-amt');
|
||||
// Set the value to a hidden input field in the modal
|
||||
document.getElementById('hidden_statement_id').value = dataId;
|
||||
// document.getElementById('modal_exp_amt').value = dataExpAmt;
|
||||
document.getElementById('modal_received_amt').value = dataReceivedAmt;
|
||||
document.getElementById('modal_received_amt').value = receivedAmt;
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
@ -981,10 +1016,78 @@
|
||||
method: 'get',
|
||||
// data: { id: dataId },
|
||||
// dataType: 'json',
|
||||
// success: function(response) {
|
||||
// $('.loader').fadeOut();
|
||||
// $('.loader-mask').delay(10).fadeOut('slow');
|
||||
// console.log(response);
|
||||
// // Assuming response contains the necessary data
|
||||
// if (response.dataStatus === true && response.code === 200) {
|
||||
// // Populate modal fields
|
||||
// if (response.data.invoice_status !== null) {
|
||||
// var inv_status_element = document.getElementById('invoice_status');
|
||||
// inv_status_element.value = response.data.invoice_status;
|
||||
// var event = new Event('change');
|
||||
// inv_status_element.dispatchEvent(event);
|
||||
// }
|
||||
|
||||
// document.getElementById('invoice_no_modal').value = response.data.invoice_no;
|
||||
// document.getElementById('invoice_date_modal').value = response.data.invoice_date === '' ? <?php echo date('d-m-Y') ?> : response.data.invoice_date;
|
||||
// document.getElementById('invoice_amount_no_modal').value = response.data.invoice_amount;
|
||||
|
||||
// document.getElementById('invoice_value_modal').value = response.data.invoice_value;
|
||||
// document.getElementById('gst_per_modal').value = response.data.gst_per;
|
||||
// document.getElementById('gst_value_modal').value = response.data.gst_value;
|
||||
// console.log('response.data.gst_value - ' + response.data.gst_value);
|
||||
// if (response.data.gst_value == 0 || response.data.gst_value == '' || response.data.gst_value == null) {
|
||||
// calcGSTValue();
|
||||
// }
|
||||
|
||||
// if (!$('#invoice_date_modal').val()) {
|
||||
// // alert('nope');
|
||||
// // Set today's date as the default date
|
||||
// $('#invoice_date_modal').datepicker('setDate', new Date());
|
||||
// }
|
||||
// // Clear existing rows in the payment table
|
||||
// var paymentTableBody = document.querySelector('#payment_table_modal tbody');
|
||||
// // var paymentTableBody = document.getElementById('payment_card_container');
|
||||
|
||||
// console.log('response.data.payments.length', response.data.payments.length)
|
||||
// // Populate payment table rows
|
||||
// if (response.data.payments.length) {
|
||||
// paymentTableBody.innerHTML = '';
|
||||
// response.data.payments.forEach(function(payment) {
|
||||
// var row = paymentTableBody.insertRow();
|
||||
|
||||
// row.innerHTML = `
|
||||
// <td style="display: none;"><input type="hidden" class="form-control" name="pk[]" value="${payment.id}"></td>
|
||||
// <td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" value="${payment.inv_amt}" onchange="checkInvAmont(event)" required step="0.01"></td>
|
||||
// <td><input type="number" class="form-control" name="gst_amount[]" placeholder="Enter Amount" value="${payment.gst}" onchange="checkInvAmont(event)" required step="0.01"></td>
|
||||
// <td><input type="number" class="form-control" name="tds[]" placeholder="Enter Amount" value="${payment.tds}" onchange="checkInvAmont(event)" required></td>
|
||||
// <td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" value="${payment.utr_no}" required></td>
|
||||
// <td><input type="text" class="form-control payment_date" name="payment_date[]" value="${formatDateToDMY(payment.received_date)}" required readonly></td>
|
||||
// <td><i class="mdi mdi-delete mr-2 font-18 vertical-middle text-danger remove-row" style="text-align: center;"></i></td>
|
||||
// `;
|
||||
// });
|
||||
// }
|
||||
// $('.payment_date').datepicker({
|
||||
// format: 'dd/mm/yyyy',
|
||||
// autoclose: true
|
||||
// });
|
||||
// // Show the modal
|
||||
// var myModal = new bootstrap.Modal(document.getElementById('invoice_modal'));
|
||||
// myModal.show();
|
||||
// } else {
|
||||
// // Handle error if the response is not successful
|
||||
// console.error('Failed to fetch data:', response);
|
||||
// alert("Something went wrong! Couldn't get data");
|
||||
// }
|
||||
// },
|
||||
|
||||
success: function(response) {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(10).fadeOut('slow');
|
||||
console.log(response);
|
||||
|
||||
// Assuming response contains the necessary data
|
||||
if (response.dataStatus === true && response.code === 200) {
|
||||
// Populate modal fields
|
||||
@ -996,46 +1099,84 @@
|
||||
}
|
||||
|
||||
document.getElementById('invoice_no_modal').value = response.data.invoice_no;
|
||||
document.getElementById('invoice_date_modal').value = response.data.invoice_date === '' ? <?php echo date('d-m-Y') ?> : response.data.invoice_date;
|
||||
document.getElementById('invoice_date_modal').value = response.data.invoice_date === '' ? '<?php echo date('d-m-Y') ?>' : response.data.invoice_date;
|
||||
document.getElementById('invoice_amount_no_modal').value = response.data.invoice_amount;
|
||||
|
||||
document.getElementById('invoice_value_modal').value = response.data.invoice_value;
|
||||
document.getElementById('gst_per_modal').value = response.data.gst_per;
|
||||
document.getElementById('gst_value_modal').value = response.data.gst_value;
|
||||
console.log('response.data.gst_value - ' + response.data.gst_value);
|
||||
|
||||
if (response.data.gst_value == 0 || response.data.gst_value == '' || response.data.gst_value == null) {
|
||||
calcGSTValue();
|
||||
}
|
||||
|
||||
if (!$('#invoice_date_modal').val()) {
|
||||
// alert('nope');
|
||||
// Set today's date as the default date
|
||||
$('#invoice_date_modal').datepicker('setDate', new Date());
|
||||
}
|
||||
// Clear existing rows in the payment table
|
||||
var paymentTableBody = document.querySelector('#payment_table_modal tbody');
|
||||
|
||||
// Clear existing payment cards in the container
|
||||
var defaultPaymentCardContainer = document.getElementById('default_payment_card');
|
||||
defaultPaymentCardContainer.style.display = 'block';
|
||||
togglePaymentCardRequired(true);
|
||||
var paymentCardContainer = document.getElementById('payment_card_container');
|
||||
paymentCardContainer.innerHTML = '';
|
||||
|
||||
console.log('response.data.payments.length', response.data.payments.length)
|
||||
// Populate payment table rows
|
||||
console.log('response.data.payments.length', response.data.payments.length);
|
||||
|
||||
// Populate payment cards
|
||||
if (response.data.payments.length) {
|
||||
paymentTableBody.innerHTML = '';
|
||||
response.data.payments.forEach(function(payment) {
|
||||
var row = paymentTableBody.insertRow();
|
||||
row.innerHTML = `
|
||||
<td style="display: none;"><input type="hidden" class="form-control" name="pk[]" value="${payment.id}"></td>
|
||||
<td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" value="${payment.inv_amt}" onchange="checkInvAmont(event)" required step="0.01"></td>
|
||||
<td><input type="number" class="form-control" name="gst_amount[]" placeholder="Enter Amount" value="${payment.gst}" onchange="checkInvAmont(event)" required step="0.01"></td>
|
||||
<td><input type="number" class="form-control" name="tds[]" placeholder="Enter Amount" value="${payment.tds}" onchange="checkInvAmont(event)" required></td>
|
||||
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" value="${payment.utr_no}" required></td>
|
||||
<td><input type="text" class="form-control payment_date" name="payment_date[]" value="${formatDateToDMY(payment.received_date)}" required readonly></td>
|
||||
<td><i class="mdi mdi-delete mr-2 font-18 vertical-middle text-danger remove-row" style="text-align: center;"></i></td>
|
||||
defaultPaymentCardContainer.style.display = 'none';
|
||||
togglePaymentCardRequired(false);
|
||||
// if (defaultPaymentCardContainer) {
|
||||
// defaultPaymentCardContainer.remove();
|
||||
// }
|
||||
response.data.payments.forEach(function(payment, index) {
|
||||
var paymentCard = document.createElement('div');
|
||||
paymentCard.className = 'payment-card';
|
||||
|
||||
paymentCard.innerHTML = `
|
||||
<input type="hidden" class="form-control" name="pk[]" value="${payment.id}">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<label>Invoice value</label>
|
||||
<input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" value="${payment.inv_amt}" required step="0.01" onchange="checkInvAmont(event)">
|
||||
</div>
|
||||
<div class="col">
|
||||
<label>GST</label>
|
||||
<input type="number" class="form-control" name="gst_amount[]" placeholder="Enter GST" value="${payment.gst}" required step="0.01" onchange="checkInvAmont(event)">
|
||||
</div>
|
||||
<div class="col">
|
||||
<label>TDS</label>
|
||||
<input type="number" class="form-control" name="tds[]" placeholder="Enter TDS" value="${payment.tds}" onchange="checkInvAmont(event)" required>
|
||||
</div>
|
||||
<div class="col">
|
||||
<label>UTR Number</label>
|
||||
<input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" value="${payment.utr_no}" required>
|
||||
</div>
|
||||
<div class="col">
|
||||
<label>Date</label>
|
||||
<input type="text" class="form-control payment_date" name="payment_date[]" value="${formatDateToDMY(payment.received_date)}" placeholder="dd/mm/yyyy" required readonly>
|
||||
</div>
|
||||
<div class="col-auto d-flex align-items-end">
|
||||
<button type="button" class="btn btn-danger btn-sm remove-row">
|
||||
<i class="mdi mdi-delete"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
paymentCardContainer.appendChild(paymentCard);
|
||||
});
|
||||
}
|
||||
|
||||
// Initialize datepicker for all payment date fields
|
||||
$('.payment_date').datepicker({
|
||||
format: 'dd/mm/yyyy',
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
// Show the modal
|
||||
var myModal = new bootstrap.Modal(document.getElementById('invoice_modal'));
|
||||
myModal.show();
|
||||
|
||||
@ -64,6 +64,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- <div id="view_name"></div> -->
|
||||
<div id="report"></div>
|
||||
</div>
|
||||
|
||||
@ -131,19 +132,26 @@
|
||||
var toDate = $('#endDate').val();
|
||||
var category = $('#category').val();
|
||||
var report_type = $('#report_type').val();
|
||||
|
||||
if(category == false || report_type == false){
|
||||
alert("Please Fill the Mandatory Fields Category and Report Type to Proceed ..!! ");
|
||||
return ;
|
||||
}
|
||||
|
||||
var requestData = {
|
||||
fromDate: fromDate,
|
||||
toDate: toDate,
|
||||
category: category,
|
||||
report_type: report_type
|
||||
};
|
||||
console.log(typeof fromDate);
|
||||
|
||||
var url = '<?= base_url('/bdsReport/irba_report') ?>';
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
|
||||
if (response.status == true) {
|
||||
$('#report').html(response.html);
|
||||
// $('#view_name').html(response.view_name);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
|
||||
@ -31,6 +31,10 @@ table.dataTable tbody td {
|
||||
background-color: #ffffff; /* White shade */
|
||||
}
|
||||
|
||||
#scroll-horizontal-datatable tfoot .right-align-input {
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="col-12" id="second_page">
|
||||
@ -216,6 +220,7 @@ $(document).ready(function() {
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
className: 'app-btn-primary ',
|
||||
title: 'IRDA-BAP-CLIENT-List',
|
||||
footer:true
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
@ -225,6 +230,7 @@ $(document).ready(function() {
|
||||
orthogonal: 'sort'
|
||||
},
|
||||
className: 'app-btn-primary ',
|
||||
footer:true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -20,6 +20,10 @@ table.dataTable tbody td {
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#scroll-horizontal-datatable tfoot .right-align-input {
|
||||
text-align: right !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="col-12" id="second_page">
|
||||
@ -167,7 +171,7 @@ table.dataTable tbody td {
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tfoot align="right">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Grand Total</th>
|
||||
@ -299,12 +303,14 @@ $(document).ready(function() {
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
footer:true,
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
className: 'app-btn-primary ',
|
||||
title: 'IRDA-BAP-INSURER-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
footer:true,
|
||||
text: '<i class="mdi mdi-file-excel " ></i><span class=" btn-custom"> EXCEL </span>',
|
||||
className: 'app-btn-primary ',
|
||||
title: 'IRDA-BAP-INSURER-List',
|
||||
|
||||
@ -1049,7 +1049,11 @@
|
||||
$nav.find("li:first-child a").addClass("active active-tab");
|
||||
|
||||
// also need to find the tab name and show only active image
|
||||
let tab_name = $nav.find("li:first-child a").attr('href').split('-')[0];
|
||||
// let tab_name = $nav.find("li:first-child a").attr('href').split('-')[0];
|
||||
|
||||
let href = $nav.find("li:first-child a").attr('href');
|
||||
let tab_name = href ? href.split('-')[0] : '';
|
||||
|
||||
tab_name = tab_name.replace('#', '');
|
||||
|
||||
|
||||
@ -1145,6 +1149,61 @@ $(function(){
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
const insurer_category = {
|
||||
1: "general", 2: "general", 3: "general", 4: "general", 5: "general",
|
||||
6: "life", 7: "life", 8: "general", 9: "general", 10: "general",
|
||||
11: "general", 12: "general", 13: "general", 14: "general", 15: "general",
|
||||
16: "general", 17: "general", 18: "general", 19: "general", 20: "general",
|
||||
21: "general", 22: "general", 23: "general", 24: "general", 25: "general",
|
||||
26: "general", 27: "general", 28: "general", 29: "general", 30: "general",
|
||||
31: "general", 32: "life", 33: "general", 34: "life", 35: "general",
|
||||
36: "general", 37: "general", 38: "general", 39: "life", 40: "general",
|
||||
41: "general", 42: "general", 43: "general", 44: "general", 45: "general",
|
||||
46: "general", 47: "general", 48: "general", 49: "general", 50: "general",
|
||||
51: "general", 52: "general", 53: "general", 54: "general", 55: "general",
|
||||
56: "general", 57: "general", 58: "general", 59: "general", 60: "general",
|
||||
61: "general", 62: "general", 63: "general", 64: "general", 65: "general",
|
||||
66: "general", 67: "general", 68: "general", 69: "general", 70: "general",
|
||||
71: "general"
|
||||
};
|
||||
|
||||
function appendInsurerByCategory(data, object, type)
|
||||
{
|
||||
return true;
|
||||
|
||||
$(object).empty();
|
||||
|
||||
$(object).append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select Insurer'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
|
||||
var displayValue = item.insurer_name + ' - ' + item.branch_code;
|
||||
var dbValue = item.id+'-'+item.insurer_id
|
||||
|
||||
if(item.category == type){
|
||||
|
||||
var option = $('<option>', {
|
||||
value: dbValue,
|
||||
text: displayValue,
|
||||
'data-id': item.insurer_id,
|
||||
'data-bid': item.id,
|
||||
'data-ic': item.category,
|
||||
});
|
||||
|
||||
$(object).append(option);
|
||||
}
|
||||
});
|
||||
|
||||
$(object).select2();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
@ -149,7 +149,7 @@
|
||||
<style>
|
||||
.nav-bar {
|
||||
position: fixed !important;
|
||||
z-index: 2;
|
||||
z-index: 4;
|
||||
width: 90%;
|
||||
margin-left: 120px !important;
|
||||
background: #fff;
|
||||
@ -355,6 +355,7 @@
|
||||
|
||||
.content-page {
|
||||
padding: 80px 15px 65px 15px !important;
|
||||
min-height: 1000px ;
|
||||
}
|
||||
|
||||
/* Media query for small screens */
|
||||
@ -1254,16 +1255,16 @@
|
||||
}
|
||||
|
||||
/* Cancel Bootstrap's .form-control for file inputs */
|
||||
input[type="file"].form-control {
|
||||
height: auto !important;
|
||||
/* input[type="file"].form-control { */
|
||||
/* height: auto !important;*/
|
||||
/* remove forced height */
|
||||
padding: initial !important;
|
||||
/* padding: initial !important;*/
|
||||
/* reset padding */
|
||||
font-size: inherit !important;
|
||||
/* font-size: inherit !important;*/
|
||||
/* reset font size */
|
||||
line-height: normal !important;
|
||||
/* line-height: normal !important;*/
|
||||
/* reset line height */
|
||||
}
|
||||
/* } */
|
||||
|
||||
|
||||
/* Apply to Select2 (single select) */
|
||||
@ -1737,9 +1738,9 @@
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/endorsement-list') ?>">View Endorsement</a>
|
||||
</li>
|
||||
<li>
|
||||
<!-- <li>
|
||||
<a href="<?= base_url('/employee/enrollment-list') ?>">View Enrolment</a>
|
||||
</li>
|
||||
</li> -->
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/test_members_list') ?>">Test Members List</a>
|
||||
</li>
|
||||
@ -1752,7 +1753,7 @@
|
||||
<?php } ?>
|
||||
|
||||
<!-- Masters -->
|
||||
<?php if (get_role_id() == 1 || get_role_id() == 5 || get_role_id() == 4) { ?>
|
||||
<?php if (get_role_id() == 1 || get_role_id() == 5 || ( get_role_id() == 4 && (in_array(BUSINESS_SUPPORT_TEAM_ID, user_team()) || in_array(SALES_TEAM_ID, user_team())))) { ?>
|
||||
|
||||
<li class="li-seperate" id="masters-li">
|
||||
<a href="#sidebarPolicies" data-toggle="collapse" class=" img-inactive">
|
||||
@ -1792,6 +1793,15 @@
|
||||
<li>
|
||||
<a href="<?= base_url('/user/list') ?>"> Users </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/util/nhanceBranchMaster') ?>"> Nhance Branch </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/util/vehicleTypeMaster') ?>"> Vehicle Type </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/util/rtoMaster') ?>"> RTO </a>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
@ -1852,27 +1862,8 @@
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<!-- leads -->
|
||||
<?php if (in_array(get_role_id(), [1, 2, 3, 5]) || in_array(BUSINESS_SUPPORT_TEAM_ID, user_team()) || in_array(SALES_TEAM_ID, user_team())) { ?>
|
||||
<li class="li-seperate" id="leads-li">
|
||||
<a href="<?= base_url('/leads/list') ?>" class="img-inactive">
|
||||
<img
|
||||
src="<?= base_url() . "public"; ?>/assets/images/leads_sb.png" alt="Logo" height="20">
|
||||
<span> Leads </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<!-- Tickets -->
|
||||
<?php if (in_array(get_role_id(), [1, 2, 3, 4, 5]) || in_array(CLAIMS_TEAM_ID, user_team())) { ?>
|
||||
<li class="li-seperate" id="tickets-li">
|
||||
<a id="tickets" href="<?= base_url('/ticketList?return_type=web') ?>" class="waves-effect img-inactive">
|
||||
<img src="<?= base_url() . "public"; ?>/assets/images/ticket.png" alt="Logo" height="20">
|
||||
<span>Tickets</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<!-- BDS -->
|
||||
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team()))) { ?>
|
||||
<?php if ((get_role_id() == 1 || get_role_id() == 5 || get_role_id() == 4) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team()))) { ?>
|
||||
<li class="li-seperate" id="policy-transactions-li">
|
||||
<a href="#policyTransactions" data-toggle="collapse" class="waves-effect img-inactive">
|
||||
<img
|
||||
@ -1907,9 +1898,9 @@
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team()))) { ?>
|
||||
<?php if ((get_role_id() == 1 || get_role_id() == 5) ||(get_role_id() == 4 && in_array(FINANCE_TEAM_ID, user_team())) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team()))) { ?>
|
||||
|
||||
<?php if (in_array(get_role_id(), [1, 5]) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team())) { ?>
|
||||
<?php if (in_array(get_role_id(), [1, 5]) ||(get_role_id() == 4 && in_array(FINANCE_TEAM_ID, user_team())) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="#policyReports" data-toggle="collapse" class="waves-effect">
|
||||
<i class="ri-file-chart-fill"></i>
|
||||
@ -1920,7 +1911,7 @@
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
|
||||
</li>
|
||||
<?php if (in_array(get_role_id(), [1, 5]) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
<?php if (in_array(get_role_id(), [1, 5]) || (get_role_id() == 4 && in_array(FINANCE_TEAM_ID, user_team())) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
|
||||
</li>
|
||||
@ -2000,6 +1991,11 @@
|
||||
<li>
|
||||
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
|
||||
</li>
|
||||
<?php if ((get_role_id() === 4 && in_array(FINANCE_TEAM_ID, user_team())) || in_array(BUSINESS_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/insurer/list') ?>">Insurer Master</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
@ -2020,6 +2016,26 @@
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<!-- leads -->
|
||||
<?php if (in_array(get_role_id(), [1, 2, 3, 5]) || in_array(BUSINESS_SUPPORT_TEAM_ID, user_team()) || in_array(SALES_TEAM_ID, user_team())) { ?>
|
||||
<li class="li-seperate" id="leads-li">
|
||||
<a href="<?= base_url('/leads/list') ?>" class="img-inactive">
|
||||
<img
|
||||
src="<?= base_url() . "public"; ?>/assets/images/leads_sb.png" alt="Logo" height="20">
|
||||
<span> Leads </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<!-- Tickets -->
|
||||
<?php if (in_array(get_role_id(), [1, 2, 3, 4, 5]) || in_array(CLAIMS_TEAM_ID, user_team())) { ?>
|
||||
<li class="li-seperate" id="tickets-li">
|
||||
<a id="tickets" href="<?= base_url('/ticketList?return_type=web') ?>" class="waves-effect img-inactive">
|
||||
<img src="<?= base_url() . "public"; ?>/assets/images/ticket.png" alt="Logo" height="20">
|
||||
<span>Tickets</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<!-- Ad -->
|
||||
<?php if (in_array(get_role_id(), [1, 2, 3, 5])) { ?>
|
||||
<li class="li-seperate" id="app-content-mng-li">
|
||||
|
||||
@ -209,9 +209,13 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID, user_
|
||||
$index = 0;
|
||||
foreach ($lead_data as $key => $value) : ?>
|
||||
<?php
|
||||
if ($key == "total" || $key == "won" || substr($key, -4) === "_ids") {
|
||||
if ($key == "total" || substr($key, -4) === "_ids") {
|
||||
continue;
|
||||
} // Skip the total key
|
||||
}
|
||||
// if ($key == "total" || $key == "won" || substr($key, -4) === "_ids") {
|
||||
// continue;
|
||||
// }
|
||||
// Skip the total key
|
||||
?>
|
||||
<?php
|
||||
// Initialize color set and shade indexes
|
||||
@ -222,7 +226,7 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID, user_
|
||||
$bgColor = $colorShades[$colorSetIndex][$shadeIndex];
|
||||
?>
|
||||
<?php
|
||||
$formattedStatus = strlen($key) < 5 ? strtoupper($key) : ucwords(str_replace('_', ' ', $key));
|
||||
$formattedStatus = strlen($key) < 5 ? strtoupper($key) : formatKey($key, 4);
|
||||
$truncatedStatus = strlen($formattedStatus) > 20 ? substr($formattedStatus, 0, 15) . '...' : $formattedStatus;
|
||||
$showTooltip = strlen($formattedStatus) > 20;
|
||||
?>
|
||||
|
||||
@ -452,6 +452,58 @@ if (isset($selected_lead_type)) {
|
||||
$('#salse_person_id').trigger('change');
|
||||
}
|
||||
|
||||
// $('#client_name').on('input', generateShortName);
|
||||
|
||||
let shortNameTimer;
|
||||
|
||||
$('#client_name').on('input', function() {
|
||||
clearTimeout(shortNameTimer);
|
||||
shortNameTimer = setTimeout(generateShortName, 200);
|
||||
});
|
||||
|
||||
function generateShortName() {
|
||||
let clientInput = $("#client_name");
|
||||
let shortInput = $("#client_short_name");
|
||||
let newClientName = clientInput.val().trim();
|
||||
|
||||
console.log(`LN : NEW - ${newClientName}`);
|
||||
if (newClientName.length == 0) {
|
||||
shortInput.val('');
|
||||
return;
|
||||
}
|
||||
|
||||
let shortName = newClientName.substring(0, 10).replace(/\s+/g, '').toUpperCase();
|
||||
makeUniqueShortName(shortName);
|
||||
}
|
||||
|
||||
function makeUniqueShortName(baseName) {
|
||||
let input = $("#client_short_name")[0];
|
||||
|
||||
checkDuplicateTableFieldValue("clients", "short_name", baseName, function(isDuplicate) {
|
||||
if (isDuplicate) {
|
||||
let counter = 1;
|
||||
function tryNext() {
|
||||
let padded = String(counter).padStart(3, '0'); // 001, 002, 003
|
||||
let newName = baseName + padded;
|
||||
|
||||
checkDuplicateTableFieldValue("clients", "short_name", newName, function(exists) {
|
||||
if (exists) {
|
||||
counter++;
|
||||
tryNext();
|
||||
} else {
|
||||
$("#client_short_name").val(newName);
|
||||
validateInput(input, "clients", "short_name");
|
||||
}
|
||||
});
|
||||
}
|
||||
tryNext();
|
||||
} else {
|
||||
$("#client_short_name").val(baseName);
|
||||
validateInput(input, "clients", "short_name");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function validateInput(input, table, field){
|
||||
|
||||
let client_type = $('#client_type').val();
|
||||
|
||||
@ -164,7 +164,7 @@ table.dataTable tbody td {
|
||||
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th><div class="column-header">S.No </div></th>
|
||||
<th><div class="column-header">S.No </div></th>
|
||||
<th><div class="column-header">Lead Type </div></th>
|
||||
<th><div class="column-header">Issuer </div></th>
|
||||
<th><div class="column-header">Client Type </div></th>
|
||||
@ -209,8 +209,10 @@ table.dataTable tbody td {
|
||||
<td><?php echo $lead_status[$row['status']] ?? '-'; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript:void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="mdi mdi-dots-horizontal"></i>
|
||||
<a href="javascript:void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm"
|
||||
data-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
data-boundary="window"> <i class="mdi mdi-dots-horizontal"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" data-ft="<?= $row['lead_form_type']; ?>" onclick="getLeadsDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>', '<?= htmlspecialchars($row['lead_form_type'], ENT_QUOTES) ?>')">
|
||||
@ -300,126 +302,154 @@ table.dataTable tbody td {
|
||||
|
||||
<script>
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const table = document.getElementById("tickets-table");
|
||||
|
||||
function createCustomDropdown(row) {
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
// New menu
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const table = document.getElementById("tickets-table");
|
||||
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
|
||||
// Clone the items but remove their original click handlers
|
||||
const items = originalDropdown.querySelectorAll('.dropdown-item');
|
||||
items.forEach(item => {
|
||||
const newItem = item.cloneNode(true);
|
||||
// Preserve the attributes but remove the onclick
|
||||
newItem.removeAttribute('onclick');
|
||||
customDropdown.appendChild(newItem);
|
||||
});
|
||||
|
||||
return customDropdown;
|
||||
}
|
||||
function createCustomDropdown(row) {
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
|
||||
// Clone the items but remove their original click handlers
|
||||
const items = originalDropdown.querySelectorAll('.dropdown-item');
|
||||
items.forEach(item => {
|
||||
const newItem = item.cloneNode(true);
|
||||
// Preserve the attributes but remove the onclick
|
||||
newItem.removeAttribute('onclick');
|
||||
customDropdown.appendChild(newItem);
|
||||
});
|
||||
|
||||
return customDropdown;
|
||||
}
|
||||
|
||||
let activeDropdown = null;
|
||||
let activeDropdown = null;
|
||||
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
const customDropdown = createCustomDropdown(row);
|
||||
if (!customDropdown) return;
|
||||
|
||||
document.body.appendChild(customDropdown);
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
const customDropdown = createCustomDropdown(row);
|
||||
if (!customDropdown) return;
|
||||
|
||||
document.body.appendChild(customDropdown);
|
||||
|
||||
row.addEventListener("click", function(event) {
|
||||
// Ignore clicks on the action column
|
||||
if (event.target.closest('td:last-child')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
}
|
||||
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||
|
||||
activeDropdown = customDropdown;
|
||||
|
||||
// 1. CRITICAL CHECK: Stop propagation if the click came from the dropdown toggle itself.
|
||||
if (event.target.closest('.dropdown-toggle')) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// Handle clicks on dropdown items
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
console.log("##############");
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// Get the data-id and other attributes from the original button
|
||||
const originalItem = row.querySelector(`.dropdown-item[data-id="${this.getAttribute('data-id')}"]`);
|
||||
|
||||
// **IMPORTANT:** Since you're using a custom script, you need to
|
||||
// manually trigger the logic for your custom detached dropdown here.
|
||||
// The code below should run when the dropdown toggle is clicked:
|
||||
const originalDropdown = event.target.closest('.btn-group').querySelector('.dropdown-menu');
|
||||
if (originalDropdown) {
|
||||
|
||||
// For edit functionality
|
||||
if (this.classList.contains('btnEdit')) {
|
||||
const id = this.getAttribute('data-id');
|
||||
const lead_form_type = this.getAttribute('data-ft');
|
||||
console.log('second drop lead_form_type', lead_form_type)
|
||||
if (id) {
|
||||
getLeadsDataForEdit(id, lead_form_type);
|
||||
}
|
||||
}else if (this.classList.contains('btnHistory')) {
|
||||
let lead_id = this.getAttribute('data-id');
|
||||
if(lead_id){ console.log("******** Clicked from td lead_id-", lead_id); getLeadsDataForMailHistory(lead_id); }
|
||||
else{ console.log("******** Clicked from td but i don`t have lead_id"); }
|
||||
|
||||
}
|
||||
else{
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
}
|
||||
|
||||
// For RFQ links
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#' && !this.classList.contains('btnEdit')) {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
// Close the dropdown
|
||||
// This is the code that opens your custom dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener("click", function() {
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||
|
||||
activeDropdown = customDropdown;
|
||||
}
|
||||
|
||||
return; // Exit the row listener early
|
||||
}
|
||||
|
||||
// 2. Ignore clicks on the entire action column (your existing, good check)
|
||||
if (event.target.closest('td:last-child')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// ... rest of your row logic for general row clicks ...
|
||||
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||
|
||||
activeDropdown = customDropdown;
|
||||
event.stopPropagation(); // Only needed if there is a parent handler
|
||||
});
|
||||
|
||||
document.addEventListener("click", function(e) {
|
||||
if (e.target.closest(".btnHistory")) {
|
||||
let lead_id = e.target.closest(".btnHistory").dataset.id;
|
||||
console.log("******** in triple dot id available - " + lead_id);
|
||||
getLeadsDataForMailHistory(lead_id);
|
||||
}
|
||||
else{ console.log("******** in triple dot but id not available"); }
|
||||
// Handle clicks on dropdown items
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
console.log("##############");
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// Get the data-id and other attributes from the original button
|
||||
const originalItem = row.querySelector(`.dropdown-item[data-id="${this.getAttribute('data-id')}"]`);
|
||||
|
||||
// For edit functionality
|
||||
if (this.classList.contains('btnEdit')) {
|
||||
const id = this.getAttribute('data-id');
|
||||
const lead_form_type = this.getAttribute('data-ft');
|
||||
console.log('second drop lead_form_type', lead_form_type)
|
||||
if (id) {
|
||||
getLeadsDataForEdit(id, lead_form_type);
|
||||
}
|
||||
}else if (this.classList.contains('btnHistory')) {
|
||||
let lead_id = this.getAttribute('data-id');
|
||||
if(lead_id){ console.log("******** Clicked from td lead_id-", lead_id); getLeadsDataForMailHistory(lead_id); }
|
||||
else{ console.log("******** Clicked from td but i don`t have lead_id"); }
|
||||
|
||||
}
|
||||
else{
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
}
|
||||
|
||||
// For RFQ links
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#' && !this.classList.contains('btnEdit')) {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
// Close the dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener("click", function() {
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener("click", function(e) {
|
||||
if (e.target.closest(".btnHistory")) {
|
||||
let lead_id = e.target.closest(".btnHistory").dataset.id;
|
||||
console.log("******** in triple dot id available - " + lead_id);
|
||||
getLeadsDataForMailHistory(lead_id);
|
||||
}
|
||||
else{ console.log("******** in triple dot but id not available"); }
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
// Datatable document ready
|
||||
$(document).ready(function() {
|
||||
|
||||
@ -504,141 +534,143 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
function getLeadsDataForMailHistory(lead_id){
|
||||
|
||||
console.log("******** Inside Fnz :", lead_id);
|
||||
let url = '<?= base_url('/util/getLeadEmailHistory/') ?>' + lead_id;
|
||||
console.log("******** Fetching:", url);
|
||||
console.log("******** Inside Fnz :", lead_id);
|
||||
let url = '<?= base_url('/util/getLeadEmailHistory/') ?>' + lead_id;
|
||||
console.log("******** Fetching:", url);
|
||||
|
||||
fetch(url, {
|
||||
method: "GET",
|
||||
headers: { "Accept": "application/json" }
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => {
|
||||
let container = document.querySelector(".history-container");
|
||||
container.innerHTML = "";
|
||||
if (response.status === "success" && response.data.length > 0) {
|
||||
console.log("******** 1" + response.status);
|
||||
let table = `
|
||||
<div class="table-responsive">
|
||||
<table data-custom-table-css="table" id="historytable" class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
|
||||
fetch(url, {
|
||||
method: "GET",
|
||||
headers: { "Accept": "application/json" }
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => {
|
||||
let container = document.querySelector(".history-container");
|
||||
container.innerHTML = "";
|
||||
if (response.status === "success" && response.data.length > 0) {
|
||||
console.log("******** 1" + response.status);
|
||||
let table = `
|
||||
<div class="table-responsive">
|
||||
<table data-custom-table-css="table" id="historytable" class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
|
||||
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th><div class="column-header">S.No </div></th>
|
||||
<th><div class="column-header">From Mail </div></th>
|
||||
<th><div class="column-header">To Mail </div></th>
|
||||
<th><div class="column-header">BCC </div></th>
|
||||
<th><div class="column-header">CC </div></th>
|
||||
<th><div class="column-header">Type </div></th>
|
||||
<th><div class="column-header">Status </div></th>
|
||||
<th><div class="column-header">Date/Time </div></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
`;
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th><div class="column-header">S.No </div></th>
|
||||
<th><div class="column-header">From Mail </div></th>
|
||||
<th><div class="column-header">To Mail </div></th>
|
||||
<th><div class="column-header">BCC </div></th>
|
||||
<th><div class="column-header">CC </div></th>
|
||||
<th><div class="column-header">Type </div></th>
|
||||
<th><div class="column-header">Status </div></th>
|
||||
<th><div class="column-header">Date/Time </div></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
`;
|
||||
|
||||
response.data.forEach((row, index) => {
|
||||
let formattedDate = "-";
|
||||
let statusValue = "-";
|
||||
if (row.received_message) {
|
||||
if (row.received_message.toLowerCase().includes("error")) {
|
||||
statusValue = "Failed";
|
||||
} else {
|
||||
statusValue = "Success";
|
||||
}
|
||||
}
|
||||
if (row.created_at) {
|
||||
let dt = new Date(row.created_at);
|
||||
let dateStr = dt.toLocaleDateString("en-GB", {
|
||||
day: "2-digit",
|
||||
month: "long",
|
||||
year: "numeric"
|
||||
});
|
||||
let timeStr = dt.toLocaleTimeString("en-US", {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: true
|
||||
}).toLowerCase();
|
||||
formattedDate = `${dateStr} ${timeStr}`;
|
||||
}
|
||||
let fromMails = "-";
|
||||
if (row.from_mail) {
|
||||
fromMails = row.from_mail
|
||||
.split(",") // split by comma
|
||||
.map(m => m.trim().replace(/^"|"$/g, "")) // trim + remove quotes at start/end
|
||||
.filter(m => m !== "") // remo
|
||||
.join("<br>"); // join with line break
|
||||
}
|
||||
let toMails = "-";
|
||||
if (row.mail) {
|
||||
toMails = row.mail
|
||||
.split(",")
|
||||
.map(m => m.trim().replace(/^"|"$/g, ""))
|
||||
.filter(m => m !== "")
|
||||
.join("<br>");
|
||||
}
|
||||
let ccMails = "-";
|
||||
if (row.cc && row.cc.trim() !== "") {
|
||||
ccMails = row.cc
|
||||
.split(",")
|
||||
.map(m => m.trim().replace(/^"|"$/g, ""))
|
||||
.filter(m => m !== "")
|
||||
.join("<br>");
|
||||
}
|
||||
let bccMails = "-";
|
||||
if (row.bcc && row.bcc.trim() !== "") {
|
||||
bccMails = row.bcc
|
||||
.split(",")
|
||||
.map(m => m.trim().replace(/^"|"$/g, ""))
|
||||
.filter(m => m !== "")
|
||||
.join("<br>");
|
||||
}
|
||||
response.data.forEach((row, index) => {
|
||||
let formattedDate = "-";
|
||||
let statusValue = "-";
|
||||
if (row.received_message) {
|
||||
if (row.received_message.toLowerCase().includes("error")) {
|
||||
statusValue = "Failed";
|
||||
} else {
|
||||
statusValue = "Success";
|
||||
}
|
||||
}
|
||||
if (row.created_at) {
|
||||
let dt = new Date(row.created_at);
|
||||
let dateStr = dt.toLocaleDateString("en-GB", {
|
||||
day: "2-digit",
|
||||
month: "long",
|
||||
year: "numeric"
|
||||
});
|
||||
let timeStr = dt.toLocaleTimeString("en-US", {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: true
|
||||
}).toLowerCase();
|
||||
formattedDate = `${dateStr} ${timeStr}`;
|
||||
}
|
||||
let fromMails = "-";
|
||||
if (row.from_mail) {
|
||||
fromMails = row.from_mail
|
||||
.split(",") // split by comma
|
||||
.map(m => m.trim().replace(/^"|"$/g, "")) // trim + remove quotes at start/end
|
||||
.filter(m => m !== "") // remo
|
||||
.join("<br>"); // join with line break
|
||||
}
|
||||
let toMails = "-";
|
||||
if (row.mail) {
|
||||
toMails = row.mail
|
||||
.split(",")
|
||||
.map(m => m.trim().replace(/^"|"$/g, ""))
|
||||
.filter(m => m !== "")
|
||||
.join("<br>");
|
||||
}
|
||||
let ccMails = "-";
|
||||
if (row.cc && row.cc.trim() !== "") {
|
||||
ccMails = row.cc
|
||||
.split(",")
|
||||
.map(m => m.trim().replace(/^"|"$/g, ""))
|
||||
.filter(m => m !== "")
|
||||
.join("<br>");
|
||||
}
|
||||
let bccMails = "-";
|
||||
if (row.bcc && row.bcc.trim() !== "") {
|
||||
bccMails = row.bcc
|
||||
.split(",")
|
||||
.map(m => m.trim().replace(/^"|"$/g, ""))
|
||||
.filter(m => m !== "")
|
||||
.join("<br>");
|
||||
}
|
||||
|
||||
|
||||
table += `
|
||||
<tr>
|
||||
<td style="white-space: nowrap !important;">${index + 1}</td>
|
||||
<td style="white-space: nowrap !important;">${fromMails}</td>
|
||||
<td style="white-space: nowrap !important;">${toMails}</td>
|
||||
<td style="white-space: nowrap !important;">${bccMails ? bccMails : '-'}</td>
|
||||
<td style="white-space: nowrap !important;">${ccMails ? ccMails : '-'}</td>
|
||||
<td style="white-space: nowrap !important;">${row.mail_type ? row.mail_type.toUpperCase() : '-'}</td>
|
||||
<td style="white-space: nowrap !important;">${statusValue ? statusValue.toUpperCase() : '-'}</td>
|
||||
<td style="white-space: nowrap !important;">${formattedDate}</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
|
||||
table += `</tbody></table>`;
|
||||
container.innerHTML = table;
|
||||
// show modal (if using Bootstrap 5)
|
||||
} else {
|
||||
|
||||
container.innerHTML = `
|
||||
<div class="d-flex justify-content-center align-items-center" style="height: 50vh; width:100%;">
|
||||
<p class="text-center font-color-black"><i>${response.message ?? "No History Available"}</i></p>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
// Show modal always
|
||||
new bootstrap.Modal(document.getElementById("EmailModal")).show();
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
console.log("******** 3" + error);
|
||||
document.querySelector(".history-container").innerHTML = `
|
||||
<div class="d-flex justify-content-center align-items-center" style="height: 50vh; width:100%;">
|
||||
<p class="text-center font-color-black"><i>No Data Found</i></p>
|
||||
</div>
|
||||
`;
|
||||
let EmailModal = new bootstrap.Modal(document.getElementById("EmailModal"));
|
||||
EmailModal.show();
|
||||
console.error(error);
|
||||
table += `
|
||||
<tr>
|
||||
<td style="white-space: nowrap !important;">${index + 1}</td>
|
||||
<td style="white-space: nowrap !important;">${fromMails}</td>
|
||||
<td style="white-space: nowrap !important;">${toMails}</td>
|
||||
<td style="white-space: nowrap !important;">${bccMails ? bccMails : '-'}</td>
|
||||
<td style="white-space: nowrap !important;">${ccMails ? ccMails : '-'}</td>
|
||||
<td style="white-space: nowrap !important;">${row.mail_type ? row.mail_type.toUpperCase() : '-'}</td>
|
||||
<td style="white-space: nowrap !important;">${statusValue ? statusValue.toUpperCase() : '-'}</td>
|
||||
<td style="white-space: nowrap !important;">${formattedDate}</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
}
|
||||
|
||||
table += `</tbody></table>`;
|
||||
container.innerHTML = table;
|
||||
// show modal (if using Bootstrap 5)
|
||||
} else {
|
||||
|
||||
container.innerHTML = `
|
||||
<div class="d-flex justify-content-center align-items-center" style="height: 50vh; width:100%;">
|
||||
<p class="text-center font-color-black"><i>${response.message ?? "No History Available"}</i></p>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
// Show modal always
|
||||
new bootstrap.Modal(document.getElementById("EmailModal")).show();
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
console.log("******** 3" + error);
|
||||
document.querySelector(".history-container").innerHTML = `
|
||||
<div class="d-flex justify-content-center align-items-center" style="height: 50vh; width:100%;">
|
||||
<p class="text-center font-color-black"><i>No Data Found</i></p>
|
||||
</div>
|
||||
`;
|
||||
let EmailModal = new bootstrap.Modal(document.getElementById("EmailModal"));
|
||||
EmailModal.show();
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
function selectOption(element, radioId) {
|
||||
// Remove selected class from all options
|
||||
document.querySelectorAll('.radio-option').forEach(option => {
|
||||
|
||||
123
app/Views/mail_template.php
Normal file
123
app/Views/mail_template.php
Normal file
@ -0,0 +1,123 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Email Notification</title>
|
||||
</head>
|
||||
|
||||
<style>
|
||||
|
||||
.mail-template-header {
|
||||
max-width: 500px;
|
||||
background-color: #ffffff !important;
|
||||
border-bottom: 1px solid #00999E;
|
||||
width: 100%; /* default: allow full width */
|
||||
}
|
||||
|
||||
/* On screens smaller than 600px → force 100% */
|
||||
@media screen and (max-width: 600px) {
|
||||
.mail-template-header {
|
||||
background-color: #ffffff !important;
|
||||
max-width: 100% !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
.mail-template-footer {
|
||||
max-width: 500px;
|
||||
background-color: #ffffff !important;
|
||||
border-top: 1px solid #00999E;
|
||||
width: 100%; /* default: allow full width */
|
||||
}
|
||||
|
||||
p{
|
||||
margin:0 !important;
|
||||
}
|
||||
|
||||
/* On screens smaller than 600px → force 100% */
|
||||
@media screen and (max-width: 600px) {
|
||||
.mail-template-footer {
|
||||
background-color: #ffffff !important;
|
||||
max-width: 100% !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px){
|
||||
|
||||
.header-div{
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.footer-div{
|
||||
width : 100% !important ;
|
||||
}
|
||||
}
|
||||
|
||||
.client_logo,
|
||||
.nhance_logo
|
||||
{
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<body>
|
||||
<!-- header -->
|
||||
<div align="center" class="header-div">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mail-template-header">
|
||||
<tr style="height:90px; background-color: #ffffff !important;">
|
||||
<td align="left" class="client_logo" style="padding:5px;" width="50%">
|
||||
<div style="
|
||||
width:160px;
|
||||
height:80px;
|
||||
background-image:url('<?= $client_logo ?>');
|
||||
background-size:contain;
|
||||
background-repeat:no-repeat;
|
||||
">
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td align="right" class="nhance_logo" style="padding:5px;" width="50%">
|
||||
<img src="<?= base_url('/public/assets/images/Nhance-Logo-Final.png'); ?>"
|
||||
alt="Default Logo"
|
||||
style="height:auto; max-width: 120px;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- mail content -->
|
||||
|
||||
<?php
|
||||
echo $mail_content;
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<!-- footer -->
|
||||
<div align="center" class="footer-div">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mail-template-footer">
|
||||
<tr style="background-color: #ffffff !important;">
|
||||
<td align="center" valign="middle" style="padding-top:5px;">
|
||||
<img src="<?= base_url('/public/assets/images/Nhance-Logo-Final.png'); ?>"
|
||||
alt="Default Logo"
|
||||
style="height:auto; max-width: 120px;padding-top:5px;">
|
||||
<p>
|
||||
© <?= date('Y'); ?> Nhance India Insurance Broking Pvt Ltd
|
||||
</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
||||
291
app/Views/nhance_branch_list.php
Normal file
291
app/Views/nhance_branch_list.php
Normal file
@ -0,0 +1,291 @@
|
||||
<style>
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- End ADD and EDIT Page HTML -->
|
||||
<div class="row" id="List-page">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body maincard">
|
||||
<table data-custom-table-css="table" class="table table-sm m-0 table-centered dt-responsive nowrap w-100" cellspacing="a" id="user-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">S.No.</th>
|
||||
<th class="font-weight-medium">Branch Name</th>
|
||||
<!-- <th class="font-weight-medium">Status</th> -->
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if(isset($data)) { $slno = 1; ?>
|
||||
<?php foreach($data as $index => $row) { ?>
|
||||
<tr>
|
||||
<td class="text-center"><?= $slno++; ?></td>
|
||||
<td><?= $row['branch_name']; ?></td>
|
||||
<!-- <td>
|
||||
<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'; } ?>
|
||||
</span>
|
||||
</td> -->
|
||||
<td>
|
||||
<div class="btn-group dropdown" style="position: relative !important;left:0px !important;top:0px !important;">
|
||||
<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" style="cursor: pointer;">
|
||||
<a class="dropdown-item" data-id="<?= $row['id']; ?>" onclick="handleSaveEditAndDelete('edit', this)">
|
||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
</a>
|
||||
<?php if ($row['is_active'] == 1): ?>
|
||||
<a class="dropdown-item" data-id="<?= $row['id']; ?>" onclick="handleSaveEditAndDelete('remove', this)">
|
||||
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<tr>
|
||||
<td colspan="3" class="text-center">No data available</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- modal content -->
|
||||
<div id="con-close-modal" class="modal fade app-font-family" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;" data-backdrop="static">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="modalLabel">Add Branch</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body p-4">
|
||||
<!-- <form class="parsley-examples" id="nhanceBranchForm" enctype="multipart/form-data"> -->
|
||||
<form id="nhanceBranchForm" enctype="multipart/form-data">
|
||||
<input type="hidden" name="pk" id="nhance_branch_id"/>
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="branch_name">Branch Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branch_name" name="branch_name" placeholder="Enter Branch Name" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="button" class="btn app-btn-secondary waves-effect waves-light" id="btnSubmit" onclick="handleSaveEditAndDelete('submit')">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var table;
|
||||
$(document).ready(function () {
|
||||
var ticketsTable = $('#user-table');
|
||||
ticketsTable.DataTable({
|
||||
scrollX: true,
|
||||
dom: "<'row'<'col-sm-7'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
buttons: [
|
||||
{
|
||||
text: 'Add',
|
||||
className: 'btn app-btn-primary mr-2',
|
||||
action: function(e, dt, node, config) {
|
||||
openModal()
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'collection',
|
||||
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
||||
className: 'btn app-btn-secondary ',
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
title: 'Policy-Tranction-Inception-List',
|
||||
className: 'app-btn-primary ',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
language: {
|
||||
search: `
|
||||
<div class="datatable-search-wrapper">
|
||||
_INPUT_
|
||||
<i class="mdi mdi-magnify datatable-search-icon"></i>
|
||||
</div>`,
|
||||
searchPlaceholder: "Search"
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 10, // Set default number of rows per page (optional)
|
||||
// ordering: false,
|
||||
});
|
||||
});
|
||||
|
||||
$('.close').click(function(){
|
||||
resetValues()
|
||||
})
|
||||
|
||||
function openModal(){
|
||||
var myModal = new bootstrap.Modal(document.getElementById('con-close-modal'));
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
// old Version
|
||||
// function handleSaveEditAndDelete(type = 'submit', pk = null){
|
||||
|
||||
// let url = '<?= base_url('util/nhanceBranchMaster') ?>';
|
||||
// let method = "POST";
|
||||
// let requestData = {};
|
||||
|
||||
// $('#modalLabel').text('Add Branch');
|
||||
// requestData.pk = pk;
|
||||
|
||||
// if(type == 'submit'){
|
||||
// $("#nhanceBranchForm").find("input, select, textarea").each(function () {
|
||||
// let name = $(this).attr("name");
|
||||
// let value = $.trim($(this).val());
|
||||
// if (name) requestData[name] = value;
|
||||
// });
|
||||
// }
|
||||
|
||||
// if(type == 'remove'){
|
||||
// method = "DELETE";
|
||||
// }else if (type == 'edit'){
|
||||
// method = "GET"
|
||||
// }
|
||||
|
||||
// console.log("type", type)
|
||||
// console.log("url", url)
|
||||
// console.log("method", method)
|
||||
// console.log("requestData", requestData)
|
||||
|
||||
|
||||
// $('.loader').fadeIn();
|
||||
// $('.loader-mask').fadeIn();
|
||||
|
||||
// // Send AJAX request
|
||||
// sendAjaxRequestForGlobal(url, method, requestData, function(response) {
|
||||
|
||||
// console.log('Data fetched successfully:', response);
|
||||
|
||||
// if (response.status) {
|
||||
// if(type == 'edit'){
|
||||
// $('#modalLabel').text('Edit Branch');
|
||||
// appendEditData(response.data);
|
||||
// }else{
|
||||
// toastr.success(response.message, 'SUCCESS');
|
||||
// }
|
||||
// } else {
|
||||
// toastr.warning(response.message, 'WARNING');
|
||||
// }
|
||||
|
||||
// $('.loader').fadeOut();
|
||||
// $('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
// }, function(xhr, status, error) {
|
||||
// console.error('Error fetching data:', error);
|
||||
// console.error(xhr.responseText);
|
||||
// $('.loader').fadeOut();
|
||||
// $('.loader-mask').delay(350).fadeOut('slow');
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
function handleSaveEditAndDelete(type = 'submit', el = null) {
|
||||
|
||||
let url = '<?= base_url('util/nhanceBranchMaster') ?>';
|
||||
let method = "POST";
|
||||
let requestData = {};
|
||||
|
||||
let pk = null;
|
||||
|
||||
// If element is passed (from edit/remove button), get its data-id
|
||||
if (el) { pk = $(el).data('id'); }
|
||||
|
||||
requestData.pk = pk;
|
||||
|
||||
if(type == 'submit'){
|
||||
$("#nhanceBranchForm").find("input, select, textarea").each(function () {
|
||||
let name = $(this).attr("name");
|
||||
let value = $.trim($(this).val());
|
||||
if (name) requestData[name] = value;
|
||||
});
|
||||
}
|
||||
|
||||
if(type == 'remove'){
|
||||
method = "DELETE";
|
||||
} else if (type == 'edit'){
|
||||
method = "GET";
|
||||
$('#modalLabel').text('Edit Branch');
|
||||
$('#nhanceBranchForm')[0].reset();
|
||||
}
|
||||
|
||||
console.log("type", type)
|
||||
console.log("url", url)
|
||||
console.log("method", method)
|
||||
console.log("requestData", requestData)
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
// Send AJAX request
|
||||
sendAjaxRequestForGlobal(url, method, requestData, function(response) {
|
||||
|
||||
console.log('Data fetched successfully:', response);
|
||||
|
||||
if (response.status) {
|
||||
if(type == 'edit'){
|
||||
appendEditData(response.data);
|
||||
} else if(type == 'remove'){
|
||||
toastr.success(response.message, 'Success');
|
||||
if(el) $(el).closest('tr').remove();
|
||||
window.location.reload();
|
||||
} else if(type == 'submit'){
|
||||
toastr.success(response.message, 'Success');
|
||||
var myModal = new bootstrap.Modal(document.getElementById('con-close-modal'));
|
||||
myModal.hide();
|
||||
$('#nhanceBranchForm')[0].reset();
|
||||
window.location.reload();
|
||||
}
|
||||
} else {
|
||||
toastr.warning(response.message, 'Warning');
|
||||
}
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
});
|
||||
}
|
||||
|
||||
function resetValues(){
|
||||
$('#modalLabel').text('Add Branch');
|
||||
$('#nhanceBranchForm')[0].reset();
|
||||
}
|
||||
|
||||
function appendEditData(data){
|
||||
$('#nhance_branch_id').val(data[0]['id']);
|
||||
$('#branch_name').val(data[0]['branch_name']);
|
||||
openModal()
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -125,6 +125,7 @@
|
||||
|
||||
// print_r($notification);
|
||||
$member_welcome_mail = 0;
|
||||
$member_common_mail = 0 ;
|
||||
$member_reminder_mail = 0;
|
||||
$member_ecard_mail = 0;
|
||||
$member_review_and_summary_mail = 0;
|
||||
@ -137,6 +138,10 @@
|
||||
$member_welcome_mail = $value['enabled'];
|
||||
}
|
||||
|
||||
if ($value['template_name'] == 'member_common_mail') {
|
||||
$member_common_mail = $value['enabled'];
|
||||
}
|
||||
|
||||
if ($value['template_name'] == 'member_reminder_mail') {
|
||||
$member_reminder_mail = $value['enabled'];
|
||||
}
|
||||
@ -187,11 +192,9 @@
|
||||
<!-- mail section -->
|
||||
|
||||
|
||||
<!-- Member welcome mail row-->
|
||||
<div class="form-row">
|
||||
|
||||
<!-- Example: Member welcome mail -->
|
||||
<div class="form-group col-md-6 mail-row">
|
||||
<!-- <div class="form-group col-md-6 mail-row">
|
||||
<div class="mail-section">
|
||||
<div class="left">
|
||||
<label class="switch">
|
||||
@ -206,10 +209,9 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> -->
|
||||
<!-- Example: Member reminder mail -->
|
||||
<div class="form-group col-md-6 mail-row">
|
||||
<!-- <div class="form-group col-md-6 mail-row">
|
||||
<div class="mail-section">
|
||||
<div class="left">
|
||||
<label class="switch">
|
||||
@ -224,12 +226,12 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<!-- Member Ecard mail row-->
|
||||
|
||||
<div class="form-row">
|
||||
<!-- Member Ecard mail row-->
|
||||
<div class="form-group col-md-6 mail-row">
|
||||
<div class="mail-section">
|
||||
<div class="left">
|
||||
@ -246,7 +248,25 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6 mail-row">
|
||||
<div class="mail-section">
|
||||
<div class="left">
|
||||
<label class="switch">
|
||||
<input id="member_common_mail_btn" type="checkbox" name="member_common_mail_btn" <?= $member_common_mail == 1 ? 'checked' : '' ?>>
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
<span class="ml-2"> Common Mail </span>
|
||||
</div>
|
||||
<div class="right">
|
||||
<a href="" data-toggle="modal" id="member_common_mail" onclick="getMailTemplateData(this)" data-target="#member_common_mail_modal">
|
||||
<i class="mdi mdi-pencil"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- member review and summary mail -->
|
||||
<!-- <div class="form-group col-md-6 mail-row">
|
||||
<div class="mail-section">
|
||||
<div class="left">
|
||||
<label class="switch">
|
||||
@ -263,12 +283,13 @@
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<!-- Account Manager Summary Mail row-->
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6 mail-row">
|
||||
<!-- Account Manager Summary Mail row-->
|
||||
<!-- <div class="form-group col-md-6 mail-row">
|
||||
<div class="mail-section">
|
||||
<div class="left">
|
||||
<label class="switch">
|
||||
@ -283,8 +304,9 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-6 mail-row">
|
||||
</div> -->
|
||||
<!-- client hr summary mail -->
|
||||
<!-- <div class="form-group col-md-6 mail-row">
|
||||
<div class="mail-section">
|
||||
<div class="left">
|
||||
<label class="switch">
|
||||
@ -299,7 +321,7 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
@ -320,6 +342,107 @@
|
||||
<!-- end -->
|
||||
|
||||
|
||||
<!-- Modal content for the Large example -->
|
||||
<div class="modal fade" id="member_common_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
||||
aria-hidden="true" aria-modal="true" data-backdrop="static">
|
||||
<div class="modal-dialog modal-full-width scrollb">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myLargeModalLabel">Common mail <span id="nameOfThePolicy"></span></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="text-center" id="no_data"></div>
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="member_common_mail_form" enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" class="form-control" id="template_name" name="template_name" value="Common Mail" readonly>
|
||||
<input type="hidden" id="member_common_mail_template_name" value="member_common_mail">
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-2">
|
||||
<label for="emp_code">Template Name</label>
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<input type="text" id="template_name" name="template_name" class="form-control" value="Member Common Mail" readonly placeholder="Template Name">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row" id="email_list">
|
||||
<div class="form-group col-md-2">
|
||||
<label for="emp_code">Email(s)</label>
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<input type="text" id="email_list" name="email_list" class="form-control" placeholder="Enter Emails">
|
||||
<p style="color: black;font-size:12px;"> (* Multiple Emails Should Be Comma Seperated)</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-2">
|
||||
<label for="emp_code">Subject</label>
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2 testmail" >
|
||||
<a class="btn btn-primary waves-effect waves-light mr-1 setid" onclick="testMailSend(this)">Test Mail</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<select id="member_common_mail_modal_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;" onchange="copyToClipboard(this)">
|
||||
<option value="">PlaceHolders</option>
|
||||
<?php foreach ($placeHolders as $value): ?>
|
||||
<?php if ($value == 'member_name' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name' || $value == 'member_summary') { ?>
|
||||
<?php $valueChange = str_replace('_', ' ', $value);
|
||||
$valueChange = ucwords($valueChange); ?>
|
||||
<option value="{{<?php echo $value; ?>}}"><?php echo $valueChange; ?></option>
|
||||
<?php } ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<span id="copy-feedback" style="display: none; position: absolute; top: 50px; right: 10px; color: green; font-size: 12px;">Copied to clipboard!</span>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<!-- Unlayer editor -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<div id="member_common_mail_editor_container" style="height: 600px"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="file" id="Question_title_fileInput" style="display: none;">
|
||||
|
||||
<table data-custom-table-css="table" id="attachment_table" class="table table-sm mb-0" style="margin-top: 30px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attachments</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="attachment_tbody">
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnGridSubmit_2">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
<!-- Modal content for the Large example -->
|
||||
<div class="modal fade" id="member_welcome_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
||||
@ -1221,7 +1344,7 @@
|
||||
});
|
||||
|
||||
} else {
|
||||
let alert_msg = 'Template ID not exist'
|
||||
let alert_msg = 'Template ID not exist , Kindly Save to Send Test Mails ..!!'
|
||||
toastr.warning(alert_msg, 'WARNING');
|
||||
}
|
||||
|
||||
@ -1248,7 +1371,8 @@
|
||||
var container = '';
|
||||
if (template_name == 'member_welcome_mail') {
|
||||
container = document.getElementById('attachment_tbody');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
container = document.getElementById('attachment_tbody_ecard');
|
||||
}
|
||||
|
||||
@ -1399,6 +1523,8 @@
|
||||
submitButton.innerText = 'Submit';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function removeAttachment(id) {
|
||||
@ -1563,7 +1689,7 @@
|
||||
function getMailTemplateData(element) {
|
||||
template_name = element.id;
|
||||
const validTemplates = [
|
||||
"account_maneger_summary_mail", "member_reminder_mail", "member_ecard_mail", "member_welcome_mail", "member_review_and_summary_mail", "client_hr_summary_mail"
|
||||
"account_maneger_summary_mail", "member_reminder_mail","member_common_mail", "member_ecard_mail", "member_welcome_mail", "member_review_and_summary_mail", "client_hr_summary_mail"
|
||||
];
|
||||
|
||||
if (!validTemplates.includes(template_name)) {
|
||||
@ -1916,6 +2042,64 @@
|
||||
});
|
||||
});
|
||||
|
||||
$('#member_common_mail_form').submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
// Check if editor instance exists
|
||||
if (!editor) {
|
||||
console.error("Editor not initialized");
|
||||
toastr.error("Editor not ready. Please try again.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Use the editor instance instead of unlayer directly
|
||||
editor.exportHtml(function(data) {
|
||||
var formData = $('#member_common_mail_form').serializeArray();
|
||||
|
||||
// Append Unlayer editor data
|
||||
formData.push({
|
||||
name: 'mailContent',
|
||||
value: data.html
|
||||
});
|
||||
formData.push({
|
||||
name: 'client_id',
|
||||
value: $('#general_PrimaryKey').val()
|
||||
});
|
||||
formData.push({
|
||||
name: 'mailJson',
|
||||
value: JSON.stringify(data.design)
|
||||
});
|
||||
|
||||
// Show loading indicators
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var form_action = '<?= base_url("client/notification/create") ?>';
|
||||
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
$('#member_common_mail_modal').find('.close').click();
|
||||
toastr.success('Template saved successfully');
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Went Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('#member_review_and_summary_mail_form').submit(function(event) {
|
||||
event.preventDefault();
|
||||
@ -2082,6 +2266,7 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('click', '#notification_enable_form_submit', function() {
|
||||
var formData = [];
|
||||
console.log($('#hr_mail_id').val());
|
||||
@ -2118,6 +2303,10 @@
|
||||
name: 'member_ecard_mail_btn',
|
||||
value: $('#member_ecard_mail_btn').prop('checked')
|
||||
});
|
||||
formData.push({
|
||||
name: 'member_common_mail_btn',
|
||||
value: $('#member_common_mail_btn').prop('checked')
|
||||
});
|
||||
formData.push({
|
||||
name: 'member_review_and_summary_mail_btn',
|
||||
value: $('#member_review_and_summary_mail_btn').prop('checked')
|
||||
|
||||
@ -40,24 +40,10 @@
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label for="client_branch">Client<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="0">Select Client</option>
|
||||
<?php
|
||||
if (isset($clients) && count($clients)) {
|
||||
foreach ($clients as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="addon_policy"> Insurer <span id="base_danger"
|
||||
class="text-danger"></span></label>
|
||||
<select class="form-control" id="insurer_id" name="insurer_id">
|
||||
<label for="addon_policy"> Insurer <span
|
||||
class="text-danger">*</span></label>
|
||||
<select class="form-control" id="insurer_id" name="insurer_id" onchange="getInsurerBranch()">
|
||||
<option value="0" selected>Select Insurer</option>
|
||||
<?php if (isset($insurer) && count($insurer)) { ?>
|
||||
<?php foreach ($insurer as $value) { ?>
|
||||
@ -68,65 +54,13 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="addon_policy"> Insurer Branch<span id="base_danger"
|
||||
class="text-danger"></span></label>
|
||||
<select class="form-control" id="insurer_id" name="insurer_id">
|
||||
<label for="addon_policy"> Insurer Branch<span
|
||||
class="text-danger">*</span></label>
|
||||
<select class="form-control" id="insurer_branch_id" name="insurer_branch_id">
|
||||
<option value="0" selected>Select Insurer Branch</option>
|
||||
<?php if (isset($insurer) && count($insurer)) { ?>
|
||||
<?php foreach ($insurer as $value) { ?>
|
||||
<option value="<?= $value['id'] ?>"><?= $value['name'] ?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label for="email"> Policy Type <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="policy_type_id" name="policy_type_id">
|
||||
<option value="0">Select Policy Type</option>
|
||||
<?php
|
||||
if (isset($policy_types) && count($policy_types)) {
|
||||
foreach ($policy_types as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div> -->
|
||||
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label for="client_branch">Issuer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="issuer" name="issuer" required>
|
||||
<option value="0">Select Issure</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div> -->
|
||||
|
||||
<!-- </div>
|
||||
|
||||
<div class="form-row"> -->
|
||||
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label>Date Type<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="date_type" name="date_type"
|
||||
onchange="hideDateField()">
|
||||
<option value="0">Select Date Type</option>
|
||||
<?php
|
||||
if (isset($date_type) && count($date_type)) {
|
||||
foreach ($date_type as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-4" style="display: true;" id="date_div">
|
||||
<label>Statement Month<span class="text-danger"></span></label>
|
||||
<div class="input-icon">
|
||||
@ -242,12 +176,12 @@
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
title: 'Outstanding Report',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: '<i class="mdi mdi-file-excel " ></i><span class=" btn-custom"> EXCEL </span>',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
title: 'Outstanding Report',
|
||||
customize: function(xlsx) {
|
||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
var total = 0;
|
||||
@ -294,6 +228,7 @@
|
||||
getURLParams()
|
||||
$('#client_id').select2();
|
||||
$('#insurer_id').select2();
|
||||
$('#insurer_branch_id').select2();
|
||||
$('#policy_type_id').select2();
|
||||
})
|
||||
|
||||
@ -304,10 +239,17 @@
|
||||
var end_date = $('#endDate').val();
|
||||
var client_id = $('#client_id').val();
|
||||
var insurer_id = $('#insurer_id').val();
|
||||
var insurer_branch_id = $('#insurer_branch_id').val();
|
||||
var policy_type_id = $('#policy_type_id').val();
|
||||
var date_type = $('#date_type').val();
|
||||
var issuer = $('#issuer').val();
|
||||
|
||||
if(insurer_id == false || insurer_branch_id == false){
|
||||
alert("Please Choose Insurer and its branch to Proceed .. !!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
console.log(start_date + '-' + end_date);
|
||||
|
||||
var queryParams = {
|
||||
@ -315,6 +257,7 @@
|
||||
end_date: end_date,
|
||||
client_id: client_id,
|
||||
insurer_id: insurer_id,
|
||||
insurer_branch_id : insurer_branch_id,
|
||||
policy_type_id: policy_type_id,
|
||||
date_type: date_type,
|
||||
issuer: issuer,
|
||||
@ -338,6 +281,7 @@
|
||||
const endDate = params.get('end_date') || 0; // Default to 0 if not found
|
||||
const client_id = params.get('client_id') || 0; // Default to 0 if not found
|
||||
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
|
||||
const insurer_branch_id = params.get('insurer_branch_id') || 0 ; // Default to 0 if not found
|
||||
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
|
||||
const date_type = params.get('date_type') || 0; // Default to 0 if not found
|
||||
const issuer = params.get('issuer') || 0; // Default to 0 if not found
|
||||
@ -348,6 +292,7 @@
|
||||
console.log('endDate', endDate)
|
||||
console.log('client_id', client_id)
|
||||
console.log('insurer_id', insurer_id)
|
||||
console.log('insurer_branch_id',insurer_branch_id)
|
||||
console.log('policy_type_id', policy_type_id)
|
||||
console.log('date_type', date_type)
|
||||
console.log('issuer', issuer)
|
||||
@ -361,7 +306,8 @@
|
||||
$('#start_date').val(startDate)
|
||||
$('#end_date').val(endDate)
|
||||
$('#client_id').val(client_id).change()
|
||||
$('#insurer_id').val(insurer_id).change()
|
||||
$('#insurer_id').val(insurer_id)
|
||||
$('#insurer_branch_id').val(insurer_branch_id).change()
|
||||
$('#policy_type_id').val(policy_type_id).change()
|
||||
$('#date_type').val(date_type)
|
||||
$('#issuer').val(issuer)
|
||||
@ -415,6 +361,7 @@
|
||||
// Reset all select dropdowns to the first option
|
||||
$('#client_id').val('0').change();
|
||||
$('#insurer_id').val('0').change();
|
||||
$('#insurer_branch_id').val('0').change();
|
||||
$('#policy_type_id').val('0').change();
|
||||
$('#date_type').val('0');
|
||||
$('#issuer').val('0');
|
||||
@ -457,4 +404,68 @@
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
}
|
||||
|
||||
function getInsurerBranch(){
|
||||
|
||||
let insurer_id = $('#insurer_id').val();
|
||||
|
||||
if(insurer_id == 0){
|
||||
return;
|
||||
}
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn('slow');
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url('master/insurer/branch/getList?') ?>',
|
||||
type: 'POST',
|
||||
data: {insurer_id},
|
||||
success: function(response) {
|
||||
|
||||
console.log(response)
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
if (response.data && response.data != []) {
|
||||
|
||||
let options ="";
|
||||
let insurer_branch_list = response.data;
|
||||
|
||||
insurer_branch_list.forEach(element => {
|
||||
options += `<option value="${element['id']}"> ${element['branch_name']} </option>`;
|
||||
});
|
||||
|
||||
$('#insurer_branch_id').html('<option value="0" selected>Select Insurer Branch</option>' + options);
|
||||
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
// Handle error
|
||||
console.error('Upload error occurred:');
|
||||
console.error('Status: ', status); // Status of the request
|
||||
console.error('Error: ', error); // Specific error message
|
||||
console.error('XHR Object: ', xhr); // Full XHR object with response details
|
||||
|
||||
// Optionally log server response, if available
|
||||
if (xhr.responseText) {
|
||||
console.error('Response Text: ', xhr.responseText);
|
||||
}
|
||||
|
||||
toastr.warning('Error uploading file', 'WARNING');
|
||||
console.error('Upload error:', error);
|
||||
},
|
||||
complete: function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log("Ajax call completed successfully");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
@ -327,7 +327,7 @@ table.dataTable thead th {
|
||||
<?php foreach ($endorsement_data_list as $index => $row) { ?>
|
||||
<tr>
|
||||
<td class="text-center"><?php echo $index + 1; ?></td>
|
||||
<td><?php echo $issuer[$row['issuer']] ?: 'N/A'; ?></td><!-- Issuer -->
|
||||
<td><?php echo $issuer[$row['issuer']] ?? 'N/A'; ?></td><!-- Issuer -->
|
||||
<td><?php echo $row['client_short_name'] ?: 'N/A'; ?></td><!-- Client -->
|
||||
<td><?php echo $row['client_branch_name'] ?: 'N/A'; ?></td><!-- Branch -->
|
||||
<td><?php echo $row['insurer_short_name'] ?: 'N/A'; ?></td><!-- Insurer -->
|
||||
@ -346,6 +346,9 @@ table.dataTable thead th {
|
||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getPolicyTransactionDataForEndorsementEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
</a>
|
||||
<a class="dropdown-item delete" data-id="<?= $row['id'];?>" onclick="removePolicyTransaction(this, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>', <?= $row['policy_type_id'] ?>)">
|
||||
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -689,7 +692,7 @@ table.dataTable thead th {
|
||||
});
|
||||
}
|
||||
|
||||
function appendPolicies(data) {
|
||||
function appendPolicies(data, policy_id=null) {
|
||||
if (!data) {
|
||||
|
||||
toastr.warning("There are no policies in Inception for the selected client and branch.");
|
||||
@ -717,9 +720,15 @@ table.dataTable thead th {
|
||||
'data-iep': item.iep,
|
||||
'data-itp': item.itp,
|
||||
'data-bap': item.bap,
|
||||
'data-allocg': item.allocg,
|
||||
'data-tpa': item.tpa_branch_id + '-' + item.tpa_id,
|
||||
'data-ptid': item.policy_type_id,
|
||||
});
|
||||
|
||||
if (policy_id == item.id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
|
||||
$('#client_policy_id').append(option);
|
||||
});
|
||||
}
|
||||
@ -978,4 +987,41 @@ table.dataTable thead th {
|
||||
$('#date_div').hide()
|
||||
}
|
||||
}
|
||||
|
||||
function removePolicyTransaction(input, pt_id, policy_type_id) {
|
||||
|
||||
let string = "Do you want to delete this transaction?";
|
||||
if(policy_type_id > 7){
|
||||
string = "Do you want to delete this transaction? Deleting this will also remove the linked CRM policy entry.";
|
||||
}
|
||||
|
||||
confirmActionSweertAlert(string, "Yes, Proceed!", "No, Cancel").then((confirmed) => {
|
||||
if (confirmed) {
|
||||
|
||||
let type = '1';
|
||||
let url = '<?= base_url('policy_tranction/inception/removePolicyTransaction/') ?>' + pt_id + '/' + type;
|
||||
|
||||
// Include `pt_id` in the AJAX request if necessary
|
||||
let requestData = {
|
||||
pt_id: pt_id ,
|
||||
type: 1 ,
|
||||
};
|
||||
|
||||
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
||||
console.log('Data fetched successfully:', response);
|
||||
|
||||
if (response.status === true) {
|
||||
toastr.success(response.message, 'SUCCESS');
|
||||
window.location.reload();
|
||||
} else {
|
||||
toastr.warning(response.message, 'WARNING');
|
||||
}
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
@ -570,6 +570,7 @@ $(document).ready(function() {
|
||||
className: 'btn app-btn-primary mr-2',
|
||||
action: function (e, dt, node, config) {
|
||||
hide_list_show_add();
|
||||
addInsurerColumn() ;
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -806,9 +807,11 @@ function appendVehicles(data, vehicle_id = null)
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var displayValue = item.vehicle_no ? item.vehicle_no : item.rc;
|
||||
var dbValue = item.id
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.vehicle_no ?? item.rc,
|
||||
value: dbValue,
|
||||
text: displayValue,
|
||||
'data-cid': item.owner,
|
||||
'data-bid': item.branch_id,
|
||||
'data-cty': item.client_type,
|
||||
|
||||
@ -79,36 +79,36 @@ table.dataTable tbody td {
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>S. No</th>
|
||||
<th>User</th>
|
||||
<th style="display: none;">User</th>
|
||||
<th>Month</th>
|
||||
<th>Business Type</th>
|
||||
<th>Client Type</th>
|
||||
<th style="display: none;">Business Type</th>
|
||||
<th style="display: none;">Client Type</th>
|
||||
<th>Insured Name</th>
|
||||
<th>Policy/<br>Endorsement</th>
|
||||
<th>Policy Type</th>
|
||||
<th>BAP Group</th>
|
||||
<th>Vehicle Number</th>
|
||||
<th style="display: none;">BAP Group</th>
|
||||
<th style="display: none;">Vehicle Number</th>
|
||||
<th>Policy No</th>
|
||||
<th>Endorsement No</th>
|
||||
<th>Insurer Name</th>
|
||||
<!-- <th style="display: none;">Insurer Name</th> -->
|
||||
<th>Insurer Branch</th>
|
||||
<th>TPA</th>
|
||||
<th>Endorsement <br> Effective Date</th>
|
||||
<th>Policy <br> Effective Date</th>
|
||||
<th>Policy <br> Expiry Date</th>
|
||||
<th>Reference</th>
|
||||
<th>Remarks</th>
|
||||
<th>Base Premium</th>
|
||||
<th>Terrorism/TP</th>
|
||||
<th>Premium <br> (without GST)</th>
|
||||
<th>GST @ 18%</th>
|
||||
<!-- <th style="display: none;">TPA</th> -->
|
||||
<th style="display: none;">Endorsement <br> Effective Date</th>
|
||||
<th style="display: none;">Policy <br> Effective Date</th>
|
||||
<th style="display: none;">Policy <br> Expiry Date</th>
|
||||
<th style="display: none;">Reference</th>
|
||||
<th style="display: none;">Remarks</th>
|
||||
<th>BP Premium</th>
|
||||
<th>TP/Ter Premium</th>
|
||||
<th style="display: none;">Premium <br> (without GST)</th>
|
||||
<!-- <th style="display: none;">GST @ 18%</th> -->
|
||||
<th>Total Premium</th>
|
||||
<th>Base <br> Revenue %</th>
|
||||
<th>TP / Terrorism <br> Revenue %</th>
|
||||
<th>Rewards</th>
|
||||
<th>Total IRDA <br> Revenue INR</th>
|
||||
<th>Billed Amount</th>
|
||||
<th>UnBilled Amount</th>
|
||||
<th>BP %</th>
|
||||
<th>TP/Ter %</th>
|
||||
<th style="display: none;">Rewards</th>
|
||||
<th>Agreed Amount</th>
|
||||
<th>Invoiced Amount</th>
|
||||
<th>Outstanding Amount</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
@ -116,34 +116,40 @@ table.dataTable tbody td {
|
||||
<?php if (isset($report_list)) { ?>
|
||||
<?php foreach($report_list as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?= $index + 1 ?></td>
|
||||
<td><?php echo $row['user_name'] ?: 'N/A'; ?></td>
|
||||
<td><?= $index + 1 ?> <a href="<?php
|
||||
if(strtolower($row['action_type']) == "policy"){
|
||||
echo base_url('policy_tranction/inception/list') . '?pt_id=' . $row['id'] ;
|
||||
}else{
|
||||
echo base_url('policy_tranction/endorsement/list') . '?pt_id=' . $row['id'] ;
|
||||
}
|
||||
?>" class="mdi mdi-pencil" ></a> </td>
|
||||
<td style="display: none;"><?php echo $row['user_name'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['policy_issue_month'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['revenue_type'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['client_type'] ?: 'N/A'; ?></td>
|
||||
<td style="display: none;"><?php echo $row['revenue_type'] ?: 'N/A'; ?></td>
|
||||
<td style="display: none;"><?php echo $row['client_type'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['client_name'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['action_type'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['policy_type'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['bap'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['vehicle_no'] ?: 'N/A'; ?></td>
|
||||
<td style="display: none;"><?php echo $row['bap'] ?: 'N/A'; ?></td>
|
||||
<td style="display: none;"><?php echo $row['vehicle_no'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['policy_no'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['endorsement_no'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['insurer_name'] ?: 'N/A'; ?> </td>
|
||||
<!-- <td style="display: none;"><?php echo $row['insurer_name'] ?: 'N/A'; ?> </td> -->
|
||||
<td><?php echo $row['insurer_branch_name'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['tpa_name']; ?></td>
|
||||
<td><?php echo empty($row['endorse_eff_date']) ? 'N/A' : date('d/m/Y', strtotime($row['endorse_eff_date'])) ?></td>
|
||||
<td><?php echo empty($row['policy_start_date']) ? 'N/A' : date('d/m/Y', strtotime($row['policy_start_date'])); ?></td>
|
||||
<td><?php echo empty($row['policy_end_date']) ? 'N/A' : date('d/m/Y', strtotime($row['policy_end_date'])); ?></td>
|
||||
<td><?php echo $row['ref'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['remarks'] ?: 'N/A'; ?></td>
|
||||
<!-- <td style="display: none;"><?php echo $row['tpa_name']; ?></td> -->
|
||||
<td style="display: none;"><?php echo empty($row['endorse_eff_date']) ? 'N/A' : date('d/m/Y', strtotime($row['endorse_eff_date'])) ?></td>
|
||||
<td style="display: none;"><?php echo empty($row['policy_start_date']) ? 'N/A' : date('d/m/Y', strtotime($row['policy_start_date'])); ?></td>
|
||||
<td style="display: none;"><?php echo empty($row['policy_end_date']) ? 'N/A' : date('d/m/Y', strtotime($row['policy_end_date'])); ?></td>
|
||||
<td style="display: none;"><?php echo $row['ref'] ?: 'N/A'; ?></td>
|
||||
<td style="display: none;"><?php echo $row['remarks'] ?: 'N/A'; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['bp_amt']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['tp_or_ter']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['premium_wo_gst']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['gst_amount']; ?></td>
|
||||
<td class="right-align-input" style="display: none;"><?php echo $row['premium_wo_gst']; ?></td>
|
||||
<!-- <td class="right-align-input" style="display: none;"><?php echo $row['gst_amount']; ?></td> -->
|
||||
<td class="right-align-input"><?php echo $row['total_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_bp_per']; ?> %</td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_tp_or_ter_per'];?> %</td>
|
||||
<td class="right-align-input"><?php echo isset($row['reward']) ? $row['reward'] : '0.00'; ?></td>
|
||||
<td class="right-align-input" style="display: none;"><?php echo isset($row['reward']) ? $row['reward'] : '0.00'; ?></td>
|
||||
|
||||
<?php $total_irda_amt = empty($row['total_irda_amt']) ? $row['exp_amt'] : $row['total_irda_amt']; ?>
|
||||
<td class="right-align-input" onclick="showCoShareStatementDetails(this)" data-id="<?= $row['pt_id'] ?>"><?php echo $total_irda_amt; ?></td>
|
||||
@ -273,18 +279,44 @@ $(document).ready(function() {
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
exportOptions: {
|
||||
columns: ':visible', // or specify exact columns [0,1,2,...]
|
||||
columns: function (idx, data, node) {
|
||||
return true; // ✅ include all columns (even hidden)
|
||||
},
|
||||
format: {
|
||||
body: function (data, row, column, node) {
|
||||
// Force K and L columns to string
|
||||
if (column === 10 || column === 11) {
|
||||
// Option 1: prepend single quote
|
||||
return '\u200C' + data;
|
||||
|
||||
// Option 2: use Excel formula trick
|
||||
// return '="' + data + '"';
|
||||
data = data.replace(/ /g, '').replace(/\s+/g, ' ').trim();
|
||||
|
||||
// If it's the first, 20th, 10th, or 11th column, clean the data
|
||||
if (column === 0 || column === 20 || column === 10 || column === 11) {
|
||||
// Remove all <a> tags and their contents first
|
||||
data = data.replace(/<a[^>]*>.*?<\/a>/gi, '');
|
||||
|
||||
// Convert any HTML entities / remaining tags to plain text
|
||||
// (jQuery used only for HTML decoding; you can replace with DOMParser if you prefer)
|
||||
data = $('<div>').html(data).text();
|
||||
|
||||
// Normalize NBSP to space
|
||||
data = data.replace(/\u00A0/g, ' ');
|
||||
|
||||
// Remove BOM, zero-width, and control characters
|
||||
data = data.replace(/[\u0000-\u001F\u007F-\u009F\u200B-\u200F\uFEFF]/g, '').trim();
|
||||
}
|
||||
|
||||
// Do NOT prepend \u200C. Return raw cleaned value.
|
||||
// If you need to force Excel as string, use the formula trick or prepend a single apostrophe.
|
||||
if (column === 10 || column === 11) {
|
||||
// Option A: return as Excel formula to preserve formatting
|
||||
// return '="' + data + '"';
|
||||
|
||||
// Option B: prepend apostrophe (visible in Excel formula bar, not in cell)
|
||||
// return "'" + data;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
return data;
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -415,33 +447,64 @@ $(document).ready(function() {
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 10, // Set default number of rows per page (optional)
|
||||
ordering: false,
|
||||
"footerCallback": function(row, data, start, end, display) {
|
||||
// "footerCallback": function(row, data, start, end, display) {
|
||||
// var api = this.api();
|
||||
|
||||
// // Calculate column totals
|
||||
// var totalPremium = api.column(23).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b) || 0;
|
||||
// }, 0);
|
||||
|
||||
// var total_rewards = api.column(26).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b) || 0;
|
||||
// }, 0); // Add initial value 0 here
|
||||
|
||||
// console.log('total_rewards - ' + total_rewards);
|
||||
|
||||
// var totalIrda = api.column(27).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b) || 0;
|
||||
// }, 0);
|
||||
|
||||
// var totalBilled = api.column(28).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b) || 0;
|
||||
// }, 0);
|
||||
|
||||
// var totalUnbilled = api.column(29).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b) || 0;
|
||||
// }, 0);
|
||||
|
||||
// // Update the totals in the div above the table
|
||||
// $('#total_premium').text(totalPremium.toFixed(2));
|
||||
// $('#total_rewards').text(total_rewards.toFixed(2));
|
||||
// $('#total_irda').text(totalIrda.toFixed(2));
|
||||
// $('#total_billed').text(totalBilled.toFixed(2));
|
||||
// $('#total_unbilled').text(totalUnbilled.toFixed(2));
|
||||
// }
|
||||
"footerCallback": function(row, data, start, end, display) {
|
||||
var api = this.api();
|
||||
|
||||
// Calculate column totals
|
||||
var totalPremium = api.column(23).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b) || 0;
|
||||
// Calculate column totals (adjust indices based on VISIBLE columns)
|
||||
var totalPremium = api.column(20, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
|
||||
var total_rewards = api.column(26).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b) || 0;
|
||||
}, 0); // Add initial value 0 here
|
||||
|
||||
console.log('total_rewards - ' + total_rewards);
|
||||
|
||||
var totalIrda = api.column(27).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b) || 0;
|
||||
var total_rewards = api.column(23, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
|
||||
var totalBilled = api.column(28).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b) || 0;
|
||||
var totalIrda = api.column(24, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
|
||||
var totalUnbilled = api.column(29).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b) || 0;
|
||||
var totalBilled = api.column(25, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
|
||||
// Update the totals in the div above the table
|
||||
var totalUnbilled = api.column(26, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
|
||||
// Update the totals
|
||||
$('#total_premium').text(totalPremium.toFixed(2));
|
||||
$('#total_rewards').text(total_rewards.toFixed(2));
|
||||
$('#total_irda').text(totalIrda.toFixed(2));
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
642
app/Views/report_bds_new.php
Normal file
642
app/Views/report_bds_new.php
Normal file
@ -0,0 +1,642 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.col-12 {
|
||||
|
||||
max-width: 98% !important;
|
||||
}
|
||||
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.badge-container {
|
||||
background: #F0F0F0;
|
||||
padding: 6px 12px;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
display: inline-block;
|
||||
}
|
||||
#totals {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<div class="col-12" id="second_page">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">BDS Report <span id="bds_title"></span></h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<div id="totals" class="d-flex flex-wrap gap-2 mb-2">
|
||||
|
||||
<div class="badge-container">
|
||||
Total Premium: <span class="text-primary" id="total_premium">0.00</span>
|
||||
</div>
|
||||
|
||||
<div class="badge-container">
|
||||
Total Rewards: <span class="text-primary" id="total_rewards">0.00</span>
|
||||
</div>
|
||||
|
||||
<div class="badge-container">
|
||||
Total IRDA Revenue INR: <span class="text-primary" id="total_irda">0.00</span>
|
||||
</div>
|
||||
|
||||
<div class="badge-container">
|
||||
Total Billed Amount: <span class="text-primary" id="total_billed">0.00</span>
|
||||
</div>
|
||||
|
||||
<div class="badge-container">
|
||||
Total Unbilled Amount: <span class="text-primary" id="total_unbilled">0.00</span>
|
||||
</div>
|
||||
|
||||
<div class="badge-container">
|
||||
Total Policy Count: <span class="text-primary"><?= $policy_count ?></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>S. No</th>
|
||||
<th>User</th>
|
||||
<th>Month</th>
|
||||
<th style="display: none;">statement upload</th>
|
||||
<!-- <th style="display: none;">Business Type</th> -->
|
||||
<th style="display: none;">Client Type</th>
|
||||
<th>Insured Name</th>
|
||||
<th>Policy/<br>Endorsement</th>
|
||||
<th>Policy Type</th>
|
||||
<th style="display: none;">BAP Group</th>
|
||||
<th style="display: none;">Vehicle Number</th>
|
||||
<th>Policy No</th>
|
||||
<th>Endorsement No</th>
|
||||
<!-- <th style="display: none;">Insurer Name</th> -->
|
||||
<th>Insurer Branch</th>
|
||||
|
||||
|
||||
<!-- <th style="display: none;">TPA</th> -->
|
||||
<th style="display: none;">Endorsement <br> Effective Date</th>
|
||||
<th style="display: none;">Policy <br> Effective Date</th>
|
||||
<th style="display: none;">Policy <br> Expiry Date</th>
|
||||
<th style="display: none;">Reference</th>
|
||||
<th style="display: none;">Remarks</th>
|
||||
|
||||
|
||||
|
||||
<th>BP Premium</th>
|
||||
<th>TP/Ter Premium</th>
|
||||
<th style="display: none;">Premium <br> (without GST)</th>
|
||||
<!-- <th style="display: none;">GST @ 18%</th> -->
|
||||
<th>Total Premium</th>
|
||||
<th>BP %</th>
|
||||
<th>TP/Ter %</th>
|
||||
<th>Rewards</th>
|
||||
<th>Agreed Amount</th>
|
||||
<th>Invoiced Amount</th>
|
||||
<th>Outstanding Amount</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (isset($report_list)) {
|
||||
|
||||
// empty array to initialize for policies per insurer per month
|
||||
|
||||
$uniquePoliciesReport = [];
|
||||
|
||||
// irrespective of months or multiple months
|
||||
$uniqueAgreedAmountList = [];
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
foreach($report_list as $index => $row){
|
||||
|
||||
$policy_no = $row['policy_no'];
|
||||
|
||||
$policy_updated_month = $row['policy_issue_month'];
|
||||
|
||||
$policy_type = $row['policy_type'];
|
||||
|
||||
$statement_status = $row['statement_uploaded'];
|
||||
|
||||
$client_name = $row['client_name'];
|
||||
|
||||
$insurer_branch_name = $row['insurer_branch_name'];
|
||||
|
||||
|
||||
|
||||
$uniqueRecord = "$policy_no-$policy_updated_month-$policy_type-$client_name-$insurer_branch_name-$statement_status" ;
|
||||
|
||||
// irrespective of months or multiple months
|
||||
$uniqueAgreedAmountPerInsurer = "$policy_no-$policy_type-$client_name-$insurer_branch_name" ;
|
||||
|
||||
|
||||
|
||||
if(isset($uniqueAgreedAmountList[$uniqueAgreedAmountPerInsurer]) ){
|
||||
|
||||
|
||||
$uniqueAgreedAmountList[$uniqueAgreedAmountPerInsurer] -= $row['billed_amt'];
|
||||
$row['total_irda_amt'] = 0 ;
|
||||
$row['outstanding_amt'] = $uniqueAgreedAmountList[$uniqueAgreedAmountPerInsurer];
|
||||
$row['multiple_months'] = true ;
|
||||
}
|
||||
else{
|
||||
$row['outstanding_amt'] = $row['total_irda_amt'] - $row['billed_amt'];
|
||||
$uniqueAgreedAmountList[$uniqueAgreedAmountPerInsurer] = $row['total_irda_amt'] ;
|
||||
$row['multiple_months'] = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$uniquePoliciesReport[$uniqueRecord] = $row;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$report_list = array_values($uniquePoliciesReport);
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<?php foreach($report_list as $index => $row){
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><?= $index + 1 ?> <a href="<?php
|
||||
if($row['action_type'] == "inception"){
|
||||
echo base_url('policy_tranction/inception/list') . '?pt_id=' . $row['id'] ;
|
||||
}else{
|
||||
echo base_url('policy_tranction/endorsement/list') . '?pt_id=' . $row['id'] ;
|
||||
}
|
||||
?>" class="mdi mdi-pencil" ></a> </td>
|
||||
<td ><?php echo $row['statement_uploaded'] == 'statement uploaded' && $row['multiple_months'] == true && $row['reward'] != "0" ? 'rewards': $row['user_name']??'N/A' ; ?></td>
|
||||
<td><?php echo $row['policy_issue_month'] ?: 'N/A'; ?></td>
|
||||
<td style="display: none;"><?php echo $row['statement_uploaded'] ?: 'N/A'; ?></td>
|
||||
<!-- <td style="display: none;"><?php echo $row['revenue_type'] ?: 'N/A'; ?></td> -->
|
||||
<td style="display: none;"><?php echo $row['client_type'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['client_name'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['action_type'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['policy_type'] ?: 'N/A'; ?></td>
|
||||
<td style="display: none;"><?php echo $row['bap'] ?: 'N/A'; ?></td>
|
||||
<td style="display: none;"><?php echo $row['vehicle_no'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['policy_no'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['endorsement_no'] ?: 'N/A'; ?></td>
|
||||
<!-- <td style="display: none;"><?php echo $row['insurer_name'] ?: 'N/A'; ?> </td> -->
|
||||
<td><?php echo $row['insurer_branch_name'] ?: 'N/A'; ?></td>
|
||||
<!-- <td style="display: none;"><?php echo $row['tpa_name']; ?></td> -->
|
||||
|
||||
|
||||
<td style="display: none;"><?php echo empty($row['endorse_eff_date']) ? 'N/A' : date('d/m/Y', strtotime($row['endorse_eff_date'])) ?></td>
|
||||
<td style="display: none;"><?php echo empty($row['policy_start_date']) ? 'N/A' : date('d/m/Y', strtotime($row['policy_start_date'])); ?></td>
|
||||
<td style="display: none;"><?php echo empty($row['policy_end_date']) ? 'N/A' : date('d/m/Y', strtotime($row['policy_end_date'])); ?></td>
|
||||
<td style="display: none;"><?php echo $row['ref'] ?: 'N/A'; ?></td>
|
||||
<td style="display: none;"><?php echo $row['remarks'] ?: 'N/A'; ?></td>
|
||||
|
||||
|
||||
|
||||
<td class="right-align-input"><?php echo $row['bp_amt']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['tp_or_ter']; ?></td>
|
||||
<td class="right-align-input" style="display: none;"><?php echo $row['premium_wo_gst']; ?></td>
|
||||
<!-- <td class="right-align-input" style="display: none;"><?php echo $row['gst_amount']; ?></td> -->
|
||||
<td class="right-align-input"><?php echo $row['total_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_bp_per']; ?> %</td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_tp_or_ter_per'];?> %</td>
|
||||
<td class="right-align-input" ><?php echo isset($row['reward']) ? $row['reward'] : '0.00'; ?></td>
|
||||
<!-- Agreed Amount as total_irda_amt -->
|
||||
<td class="right-align-input" onclick="showCoShareStatementDetails(this)" data-id="<?= $row['pt_id'] ?>"><?php echo $row['total_irda_amt']; ?></td>
|
||||
<!-- invoiced amount as billed_amt -->
|
||||
<td class="right-align-input"><?php echo empty($row['billed_amt']) ? '0.00' : $row['billed_amt'] ?></td>
|
||||
<!-- Outstanding Amount (Agreed amount - invoice amount) -->
|
||||
<td class="right-align-input"><?php echo number_format((float)$row['outstanding_amt'],2, '.', '')?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- modal content -->
|
||||
<div class="modal fade" id="centermodal" tabindex="-1" role="dialog" aria-hidden="true" aria-modal="true" data-backdrop="static">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" style="background-color: gainsboro;">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">Statement Details <span id="heading"></span></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body" id="modal_body">
|
||||
<div class="table-responsive">
|
||||
<table data-custom-table-css="table" class="table table-hover mb-0">
|
||||
<thead class="bg-light" id="table_head_data">
|
||||
<tr>
|
||||
<th>Statement No.</th>
|
||||
<th>Statement Month</th>
|
||||
<th>Actual Amount</th>
|
||||
<th>Invoice No.</th>
|
||||
<th>Invoice Date.</th>
|
||||
<th>Invoice Status.</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="table_data">
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end table-responsive-->
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<!-------------------------------------------------------------------------------------------------->
|
||||
|
||||
<script>
|
||||
// Datatable document ready
|
||||
$(document).ready(function() {
|
||||
|
||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||
|
||||
if (ticketsTable.length) {
|
||||
ticketsTable.DataTable({
|
||||
scrollX: true,
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
// buttons: [
|
||||
// {
|
||||
// extend: 'csv',
|
||||
// text: 'CSV',
|
||||
// title: 'Policy-Tranction-BDS-List',
|
||||
// },
|
||||
// {
|
||||
// extend: 'excel',
|
||||
// text: 'Excel',
|
||||
// title: 'Policy-Tranction-BDS-List',
|
||||
// customize: function(xlsx) {
|
||||
// var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
// var total = 0;
|
||||
|
||||
// // 🔹 Force column K (11) and L (12) as string
|
||||
// $('row c[r^="K"], row c[r^="L"]', sheet).attr('t', 'inlineStr');
|
||||
|
||||
// // Find cells in column AB (28th column in Excel)
|
||||
// $('row c[r^="AB"]', sheet).each(function() {
|
||||
// var value = parseFloat($('v', this).text()); // Get the value inside the cell
|
||||
// if (!isNaN(value)) {
|
||||
// total += value;
|
||||
// }
|
||||
// });
|
||||
|
||||
// // Get the last row index and append the total row
|
||||
// var lastRow = $('row:last', sheet);
|
||||
// var rowIndex = parseInt(lastRow.attr('r')) + 2; // Find the next row index
|
||||
// var totalRow = '<row r="' + rowIndex + '">' +
|
||||
// '<c t="inlineStr" r="AA' + rowIndex + '"><is><t>Total</t></is></c>' + // Insert "Total" in AA
|
||||
// '<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) + '</v></c>' + // Insert sum in AB
|
||||
// '</row>';
|
||||
|
||||
// // Append the new total row to the sheet
|
||||
// $(sheet).find('sheetData').append(totalRow);
|
||||
// },
|
||||
// exportOptions: {
|
||||
// orthogonal: 'sort'
|
||||
// },
|
||||
// customizeData: function (data) {
|
||||
// for (var i = 0; i < data.body.length; i++) {
|
||||
// for (var j = 0; j < data.body[i].length; j++) {
|
||||
// // Check if the column is the 9th index (10th column) and 10th index (11th column)
|
||||
// if (j === 9 || j === 10) {
|
||||
// data.body[i][j] = '\u200C' + data.body[i][j];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// ],
|
||||
buttons: [
|
||||
{
|
||||
extend: 'collection',
|
||||
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
||||
className: 'btn app-btn-secondary ',
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
exportOptions: {
|
||||
columns: ':visible', // or specify exact columns [0,1,2,...]
|
||||
format: {
|
||||
body: function (data, row, column, node) {
|
||||
// Force K and L columns to string
|
||||
if (column === 10 || column === 11) {
|
||||
// Option 1: prepend single quote
|
||||
return '\u200C' + data;
|
||||
|
||||
// Option 2: use Excel formula trick
|
||||
// return '="' + data + '"';
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
text: '<i class="mdi mdi-file-excel " ></i><span class=" btn-custom"> EXCEL </span>',
|
||||
className: 'app-btn-primary ',
|
||||
// customize: function (xlsx) {
|
||||
// var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
// var total = 0;
|
||||
|
||||
// // 🔹 Force column K (11) and L (12) as string
|
||||
// // $('row c[r^="K"], row c[r^="L"]', sheet).attr('t', 'inlineStr');
|
||||
// // 🔹 Convert column K (11th) & L (12th) to inline string
|
||||
// $('row c[r^="K"], row c[r^="L"]', sheet).each(function () {
|
||||
// var cell = $(this);
|
||||
// console.log(cell);
|
||||
// var val = cell.find('v').text(); // get value
|
||||
// if (val) {
|
||||
// cell.attr('t', 'inlineStr'); // mark as text
|
||||
// cell.remove('v'); // remove <v>
|
||||
// cell.append('<is><t>' + val + '</t></is>'); // replace with inline string
|
||||
// }
|
||||
// });
|
||||
|
||||
// // Calculate total in AB (28th column)
|
||||
// $('row c[r^="AB"]', sheet).each(function () {
|
||||
// var value = parseFloat($('v', this).text());
|
||||
// if (!isNaN(value)) {
|
||||
// total += value;
|
||||
// }
|
||||
// });
|
||||
|
||||
// // Append total row
|
||||
// var lastRow = $('row:last', sheet);
|
||||
// var rowIndex = parseInt(lastRow.attr('r')) + 2;
|
||||
// var totalRow = '<row r="' + rowIndex + '">' +
|
||||
// '<c t="inlineStr" r="AA' + rowIndex + '"><is><t>Total</t></is></c>' +
|
||||
// '<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) + '</v></c>' +
|
||||
// '</row>';
|
||||
|
||||
// $(sheet).find('sheetData').append(totalRow);
|
||||
// },
|
||||
customize: function (xlsx) {
|
||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
var total = 0;
|
||||
|
||||
function forceAsText(cell) {
|
||||
var val = cell.find('v').text();
|
||||
if (val) {
|
||||
// Remove old <v>
|
||||
cell.find('v').remove();
|
||||
|
||||
// Force as inline string
|
||||
cell.attr('t', 'inlineStr');
|
||||
cell.append('<is><t>' + val + '</t></is>');
|
||||
}
|
||||
}
|
||||
|
||||
function forceAsTextPreserveOriginal(cell) {
|
||||
// Get the original cell value from the cell's text content
|
||||
var vElement = cell.find('v');
|
||||
if (vElement.length > 0) {
|
||||
var originalValue = vElement.text();
|
||||
|
||||
// Remove the <v> element
|
||||
vElement.remove();
|
||||
|
||||
// Set cell type to inline string and preserve the original value
|
||||
cell.attr('t', 'inlineStr');
|
||||
cell.append('<is><t>' + originalValue + '</t></is>');
|
||||
}
|
||||
}
|
||||
|
||||
// 🔹 Force K column as text (working correctly)
|
||||
$('row c[r^="K"]', sheet).each(function () {
|
||||
forceAsText($(this));
|
||||
});
|
||||
|
||||
// 🔹 Force L column as text with better preservation
|
||||
$('row c[r^="L"]', sheet).each(function () {
|
||||
forceAsTextPreserveOriginal($(this));
|
||||
});
|
||||
|
||||
// 🔹 Calculate total in AB (28th column)
|
||||
$('row c[r^="AB"] v', sheet).each(function () {
|
||||
var value = parseFloat($(this).text());
|
||||
if (!isNaN(value)) total += value;
|
||||
});
|
||||
|
||||
// 🔹 Append total row
|
||||
var lastRow = $('row:last', sheet);
|
||||
var rowIndex = parseInt(lastRow.attr('r')) + 2;
|
||||
var totalRow = '<row r="' + rowIndex + '">' +
|
||||
'<c t="inlineStr" r="AA' + rowIndex + '"><is><t>Total</t></is></c>' +
|
||||
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) + '</v></c>' +
|
||||
'</row>';
|
||||
|
||||
$(sheet).find('sheetData').append(totalRow);
|
||||
},
|
||||
exportOptions: {
|
||||
orthogonal: 'sort' ,
|
||||
columns: ':not(:eq(3))' // skip the same 4th column
|
||||
},
|
||||
customizeData: function (data) {
|
||||
for (var i = 0; i < data.body.length; i++) {
|
||||
for (var j = 0; j < data.body[i].length; j++) {
|
||||
// Force 10th (index 9) & 11th (index 10) as text
|
||||
if (j === 9 || j === 10 || j === 11 || j === 12 ) {
|
||||
data.body[i][j] = '\u200C' + data.body[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
language: {
|
||||
search: `
|
||||
<div class="datatable-search-wrapper">
|
||||
_INPUT_
|
||||
<i class="mdi mdi-magnify datatable-search-icon"></i>
|
||||
</div>`,
|
||||
searchPlaceholder: "Search"
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 10, // Set default number of rows per page (optional)
|
||||
ordering: false,
|
||||
// "footerCallback": function(row, data, start, end, display) {
|
||||
// var api = this.api();
|
||||
|
||||
// // Calculate column totals
|
||||
// var totalPremium = api.column(23).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b) || 0;
|
||||
// }, 0);
|
||||
|
||||
// var total_rewards = api.column(26).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b) || 0;
|
||||
// }, 0); // Add initial value 0 here
|
||||
|
||||
// console.log('total_rewards - ' + total_rewards);
|
||||
|
||||
// var totalIrda = api.column(27).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b) || 0;
|
||||
// }, 0);
|
||||
|
||||
// var totalBilled = api.column(28).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b) || 0;
|
||||
// }, 0);
|
||||
|
||||
// var totalUnbilled = api.column(29).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b) || 0;
|
||||
// }, 0);
|
||||
|
||||
// // Update the totals in the div above the table
|
||||
// $('#total_premium').text(totalPremium.toFixed(2));
|
||||
// $('#total_rewards').text(total_rewards.toFixed(2));
|
||||
// $('#total_irda').text(totalIrda.toFixed(2));
|
||||
// $('#total_billed').text(totalBilled.toFixed(2));
|
||||
// $('#total_unbilled').text(totalUnbilled.toFixed(2));
|
||||
// }
|
||||
"footerCallback": function(row, data, start, end, display) {
|
||||
var api = this.api();
|
||||
|
||||
// Calculate column totals (adjust indices based on VISIBLE columns)
|
||||
var totalPremium = api.column(20, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
|
||||
var total_rewards = api.column(23, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
|
||||
var totalIrda = api.column(24, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
|
||||
var totalBilled = api.column(25, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
|
||||
var totalUnbilled = api.column(26, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
|
||||
// Update the totals
|
||||
$('#total_premium').text(totalPremium.toFixed(2));
|
||||
$('#total_rewards').text(total_rewards.toFixed(2));
|
||||
$('#total_irda').text(totalIrda.toFixed(2));
|
||||
$('#total_billed').text(totalBilled.toFixed(2));
|
||||
$('#total_unbilled').text(totalUnbilled.toFixed(2));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error("Table atet found.");
|
||||
}
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
|
||||
function showCoShareStatementDetails(input){
|
||||
|
||||
let pt_id = $(input).data('id');
|
||||
console.log('pt_id', pt_id)
|
||||
|
||||
var myModal = new bootstrap.Modal(document.getElementById('centermodal'));
|
||||
myModal.show();
|
||||
|
||||
getCoShareStatementDetails(pt_id)
|
||||
}
|
||||
|
||||
|
||||
function getCoShareStatementDetails(pt_id){
|
||||
|
||||
let url = '<?= base_url('util/getCoShareStatementDetails/') ?>' + pt_id;
|
||||
|
||||
sendAjaxRequestForGlobal(url, 'GET', {}, function(response) {
|
||||
console.log('Data fetched successfully:', response);
|
||||
|
||||
if (response.status === true) {
|
||||
|
||||
appendTableData(response.data)
|
||||
|
||||
} else {
|
||||
toastr.warning(response.message, 'WARNING');
|
||||
}
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function appendTableData(data) {
|
||||
|
||||
// Ensure the table body selector matches your table's structure
|
||||
let tableBody = $("#table_data");
|
||||
|
||||
// Clear the table body before appending new rows
|
||||
tableBody.empty();
|
||||
|
||||
// Loop through the data and append rows
|
||||
data.forEach(row => {
|
||||
let tableRow = `
|
||||
<tr>
|
||||
<td>${row.stmt_sno ?? '-'}</td>
|
||||
<td>${row.month ?? '-'}</td>
|
||||
<td>${row.sum_of_actual_amt ?? '-'}</td>
|
||||
<td>${row.invoice_no ?? '-'}</td>
|
||||
<td>${row.invoice_date ?? '-'}</td>
|
||||
<td>${row.invoice_status ?? '-'}</td>
|
||||
</tr>
|
||||
`;
|
||||
tableBody.append(tableRow);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@ -71,10 +71,11 @@
|
||||
<label for="gender">Gender<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="gender" name="gender[]">
|
||||
<option value="">Select Gender</option>
|
||||
<option value="Female" <?= htmlspecialchars(isset($value['gender']) && $value['gender'] == "" ? 'selected' : "Female" ) ?> >Female</option>
|
||||
<option value="Male" <?= htmlspecialchars(isset($value['gender']) && $value['gender'] == "" ? 'selected' : "Male" ) ?> >Male</option>
|
||||
<option value="Female" <?= (isset($value['gender']) && $value['gender'] == 'Female') ? 'selected' : '' ?>>Female</option>
|
||||
<option value="Male" <?= (isset($value['gender']) && $value['gender'] == 'Male') ? 'selected' : '' ?>>Male</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="designation">Designation <span class="text-danger">*</span></label>
|
||||
|
||||
255
app/Views/rto_master_list.php
Normal file
255
app/Views/rto_master_list.php
Normal file
@ -0,0 +1,255 @@
|
||||
<style>
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- End ADD and EDIT Page HTML -->
|
||||
<div class="row" id="List-page">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body maincard">
|
||||
<table data-custom-table-css="table" class="table table-sm m-0 table-centered dt-responsive nowrap w-100" cellspacing="a" id="user-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">S.No.</th>
|
||||
<th class="font-weight-medium">RTO Office at</th>
|
||||
<th class="font-weight-medium">RTO Code</th>
|
||||
<th class="font-weight-medium">RTO State</th>
|
||||
<!-- <th class="font-weight-medium">Status</th> -->
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if(isset($data)) { $slno = 1; ?>
|
||||
<?php foreach($data as $index => $row) { ?>
|
||||
<tr>
|
||||
<td class="text-center"><?= $slno++; ?></td>
|
||||
<td><?= $row['rto_name']; ?></td>
|
||||
<td><?= $row['rto_code']; ?></td>
|
||||
<td><?= $row['rto_state']; ?></td>
|
||||
<!-- <td>
|
||||
<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'; } ?>
|
||||
</span>
|
||||
</td> -->
|
||||
<td>
|
||||
<div class="btn-group dropdown" style="position: relative !important;left:0px !important;top:0px !important;">
|
||||
<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" style="cursor: pointer;">
|
||||
<a class="dropdown-item" data-id="<?= $row['id']; ?>" onclick="handleSaveEditAndDelete('edit', this)">
|
||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
</a>
|
||||
<?php if ($row['is_active'] == 1): ?>
|
||||
<a class="dropdown-item" data-id="<?= $row['id']; ?>" onclick="handleSaveEditAndDelete('remove', this)">
|
||||
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<tr>
|
||||
<td colspan="3" class="text-center">No data available</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- modal content -->
|
||||
<div id="con-close-modal" class="modal fade app-font-family" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;" data-backdrop="static">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="modalLabel">Add RTO Details</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body p-4">
|
||||
<!-- <form class="parsley-examples" id="RTOForm" enctype="multipart/form-data"> -->
|
||||
<form id="RTOForm" enctype="multipart/form-data">
|
||||
<input type="hidden" name="pk" id="rto_id"/>
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="rto_name">RTO Office Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="rto_name" name="rto_name" placeholder="Enter RTO Office Name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="rto_code">RTO Code<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="rto_code" name="rto_code"
|
||||
placeholder="Enter RTO Code" required
|
||||
maxlength="2"
|
||||
inputmode="numeric"
|
||||
pattern="[0-9]{2}"
|
||||
oninput="this.value = this.value.replace(/[^0-9]/g, '').slice(0,2);">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="rto_state">RTO State<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="rto_state" name="rto_state"
|
||||
placeholder="Enter RTO State" required
|
||||
maxlength="2"
|
||||
pattern="[A-Z]{2}"
|
||||
oninput="this.value = this.value.replace(/[^A-Za-z]/g, '').toUpperCase().slice(0,2);">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="button" class="btn app-btn-secondary waves-effect waves-light" id="btnSubmit" onclick="handleSaveEditAndDelete('submit')">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var table;
|
||||
$(document).ready(function () {
|
||||
var ticketsTable = $('#user-table');
|
||||
ticketsTable.DataTable({
|
||||
scrollX: true,
|
||||
dom: "<'row'<'col-sm-7'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
buttons: [
|
||||
{
|
||||
text: 'Add',
|
||||
className: 'btn app-btn-primary mr-2',
|
||||
action: function(e, dt, node, config) {
|
||||
openModal()
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'collection',
|
||||
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
||||
className: 'btn app-btn-secondary ',
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
title: 'RTO',
|
||||
className: 'app-btn-primary ',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
language: {
|
||||
search: `
|
||||
<div class="datatable-search-wrapper">
|
||||
_INPUT_
|
||||
<i class="mdi mdi-magnify datatable-search-icon"></i>
|
||||
</div>`,
|
||||
searchPlaceholder: "Search"
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 10, // Set default number of rows per page (optional)
|
||||
// ordering: false,
|
||||
});
|
||||
});
|
||||
|
||||
$('.close').click(function(){
|
||||
resetValues()
|
||||
})
|
||||
|
||||
function openModal(){
|
||||
var myModal = new bootstrap.Modal(document.getElementById('con-close-modal'));
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
function handleSaveEditAndDelete(type = 'submit', el = null) {
|
||||
|
||||
let url = '<?= base_url('util/rtoMaster') ?>';
|
||||
let method = "POST";
|
||||
let requestData = {};
|
||||
|
||||
let pk = null;
|
||||
|
||||
// If element is passed (from edit/remove button), get its data-id
|
||||
if (el) { pk = $(el).data('id'); }
|
||||
|
||||
requestData.pk = pk;
|
||||
|
||||
if(type == 'submit'){
|
||||
$("#RTOForm").find("input, select, textarea").each(function () {
|
||||
let name = $(this).attr("name");
|
||||
let value = $.trim($(this).val());
|
||||
if (name) requestData[name] = value;
|
||||
});
|
||||
}
|
||||
|
||||
if(type == 'remove'){
|
||||
method = "DELETE";
|
||||
} else if (type == 'edit'){
|
||||
method = "GET";
|
||||
$('#modalLabel').text('Edit RTO details');
|
||||
$('#vehicleTypeForm')[0].reset();
|
||||
}
|
||||
|
||||
console.log("type", type)
|
||||
console.log("url", url)
|
||||
console.log("method", method)
|
||||
console.log("requestData", requestData)
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
// Send AJAX request
|
||||
sendAjaxRequestForGlobal(url, method, requestData, function(response) {
|
||||
|
||||
console.log('Data fetched successfully:', response);
|
||||
|
||||
if (response.status) {
|
||||
if(type == 'edit'){
|
||||
appendEditData(response.data);
|
||||
} else if(type == 'remove'){
|
||||
toastr.success(response.message, 'Success');
|
||||
if(el) $(el).closest('tr').remove();
|
||||
window.location.reload();
|
||||
} else if(type == 'submit'){
|
||||
toastr.success(response.message, 'Success');
|
||||
var myModal = new bootstrap.Modal(document.getElementById('con-close-modal'));
|
||||
myModal.hide();
|
||||
resetValues();
|
||||
window.location.reload();
|
||||
}
|
||||
} else {
|
||||
toastr.warning(response.message, 'Warning');
|
||||
}
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
});
|
||||
}
|
||||
|
||||
function resetValues(){
|
||||
$('#modalLabel').text('Add RTO Details');
|
||||
$('#RTOForm')[0].reset();
|
||||
}
|
||||
|
||||
function appendEditData(data){
|
||||
$('#rto_id').val(data[0]['id']);
|
||||
$('#rto_name').val(data[0]['rto_name']);
|
||||
$('#rto_code').val(data[0]['rto_code']);
|
||||
$('#rto_state').val(data[0]['rto_state']);
|
||||
openModal()
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -231,12 +231,12 @@
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
title: 'Variance-Report-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: '<i class="mdi mdi-file-excel " ></i><span class=" btn-custom"> EXCEL </span>',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
title: 'Variance-Report-List',
|
||||
customize: function(xlsx) {
|
||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
var total = 0;
|
||||
|
||||
1692
app/Views/vehicle_type_list.php
Normal file
1692
app/Views/vehicle_type_list.php
Normal file
File diff suppressed because it is too large
Load Diff
231
app/Views/vehicle_type_master_list.php
Executable file
231
app/Views/vehicle_type_master_list.php
Executable file
@ -0,0 +1,231 @@
|
||||
<style>
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- End ADD and EDIT Page HTML -->
|
||||
<div class="row" id="List-page">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body maincard">
|
||||
<table data-custom-table-css="table" class="table table-sm m-0 table-centered dt-responsive nowrap w-100" cellspacing="a" id="user-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">S.No.</th>
|
||||
<th class="font-weight-medium">Vehicle Type</th>
|
||||
<!-- <th class="font-weight-medium">Status</th> -->
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if(isset($data)) { $slno = 1; ?>
|
||||
<?php foreach($data as $index => $row) { ?>
|
||||
<tr>
|
||||
<td class="text-center"><?= $slno++; ?></td>
|
||||
<td><?= $row['vehicle_type']; ?></td>
|
||||
<!-- <td>
|
||||
<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'; } ?>
|
||||
</span>
|
||||
</td> -->
|
||||
<td>
|
||||
<div class="btn-group dropdown" style="position: relative !important;left:0px !important;top:0px !important;">
|
||||
<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" style="cursor: pointer;">
|
||||
<a class="dropdown-item" data-id="<?= $row['id']; ?>" onclick="handleSaveEditAndDelete('edit', this)">
|
||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
</a>
|
||||
<?php if ($row['is_active'] == 1): ?>
|
||||
<a class="dropdown-item" data-id="<?= $row['id']; ?>" onclick="handleSaveEditAndDelete('remove', this)">
|
||||
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<tr>
|
||||
<td colspan="3" class="text-center">No data available</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- modal content -->
|
||||
<div id="con-close-modal" class="modal fade app-font-family" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;" data-backdrop="static">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="modalLabel">Add Vehicle Type</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body p-4">
|
||||
<!-- <form class="parsley-examples" id="vehicleTypeForm" enctype="multipart/form-data"> -->
|
||||
<form id="vehicleTypeForm" enctype="multipart/form-data">
|
||||
<input type="hidden" name="pk" id="vehicle_type_id"/>
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="vehicle_type">Vehicle Type<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="vehicle_type" name="vehicle_type" placeholder="Enter Vehicle Type" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="button" class="btn app-btn-secondary waves-effect waves-light" id="btnSubmit" onclick="handleSaveEditAndDelete('submit')">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var table;
|
||||
$(document).ready(function () {
|
||||
var ticketsTable = $('#user-table');
|
||||
ticketsTable.DataTable({
|
||||
scrollX: true,
|
||||
dom: "<'row'<'col-sm-7'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
buttons: [
|
||||
{
|
||||
text: 'Add',
|
||||
className: 'btn app-btn-primary mr-2',
|
||||
action: function(e, dt, node, config) {
|
||||
openModal()
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'collection',
|
||||
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
||||
className: 'btn app-btn-secondary ',
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
title: 'Policy-Tranction-Inception-List',
|
||||
className: 'app-btn-primary ',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
language: {
|
||||
search: `
|
||||
<div class="datatable-search-wrapper">
|
||||
_INPUT_
|
||||
<i class="mdi mdi-magnify datatable-search-icon"></i>
|
||||
</div>`,
|
||||
searchPlaceholder: "Search"
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 10, // Set default number of rows per page (optional)
|
||||
// ordering: false,
|
||||
});
|
||||
});
|
||||
|
||||
$('.close').click(function(){
|
||||
resetValues()
|
||||
})
|
||||
|
||||
function openModal(){
|
||||
var myModal = new bootstrap.Modal(document.getElementById('con-close-modal'));
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
function handleSaveEditAndDelete(type = 'submit', el = null) {
|
||||
|
||||
let url = '<?= base_url('util/vehicleTypeMaster') ?>';
|
||||
let method = "POST";
|
||||
let requestData = {};
|
||||
|
||||
let pk = null;
|
||||
|
||||
// If element is passed (from edit/remove button), get its data-id
|
||||
if (el) { pk = $(el).data('id'); }
|
||||
|
||||
requestData.pk = pk;
|
||||
|
||||
if(type == 'submit'){
|
||||
$("#vehicleTypeForm").find("input, select, textarea").each(function () {
|
||||
let name = $(this).attr("name");
|
||||
let value = $.trim($(this).val());
|
||||
if (name) requestData[name] = value;
|
||||
});
|
||||
}
|
||||
|
||||
if(type == 'remove'){
|
||||
method = "DELETE";
|
||||
} else if (type == 'edit'){
|
||||
method = "GET";
|
||||
$('#modalLabel').text('Edit Vehicle Type');
|
||||
$('#vehicleTypeForm')[0].reset();
|
||||
|
||||
}
|
||||
|
||||
console.log("type", type)
|
||||
console.log("url", url)
|
||||
console.log("method", method)
|
||||
console.log("requestData", requestData)
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
// Send AJAX request
|
||||
sendAjaxRequestForGlobal(url, method, requestData, function(response) {
|
||||
|
||||
console.log('Data fetched successfully:', response);
|
||||
|
||||
if (response.status) {
|
||||
if(type == 'edit'){
|
||||
appendEditData(response.data);
|
||||
} else if(type == 'remove'){
|
||||
toastr.success(response.message, 'Success');
|
||||
if(el) $(el).closest('tr').remove();
|
||||
window.location.reload();
|
||||
} else if(type == 'submit'){
|
||||
toastr.success(response.message, 'Success');
|
||||
var myModal = new bootstrap.Modal(document.getElementById('con-close-modal'));
|
||||
myModal.hide();
|
||||
resetValues();
|
||||
window.location.reload();
|
||||
}
|
||||
} else {
|
||||
toastr.warning(response.message, 'Warning');
|
||||
}
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
});
|
||||
}
|
||||
|
||||
function resetValues(){
|
||||
$('#modalLabel').text('Add Vehicle Type');
|
||||
$('#vehicleTypeForm')[0].reset();
|
||||
}
|
||||
|
||||
function appendEditData(data){
|
||||
$('#vehicle_type_id').val(data[0]['id']);
|
||||
$('#vehicle_type').val(data[0]['vehicle_type']);
|
||||
openModal()
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -1360,7 +1360,7 @@ $(document).ready(function () {
|
||||
if (lead_status != "won") {
|
||||
console.log("Lead status is not 'won', setting interval for submitData");
|
||||
|
||||
// startInterval();
|
||||
startInterval();
|
||||
} else {
|
||||
console.log("Lead status is 'won', submitData will not be called");
|
||||
}
|
||||
@ -1557,8 +1557,8 @@ function saveFamilyMembersDetails() {
|
||||
|
||||
function resetFamiliyDialogModalValues() {
|
||||
|
||||
$('#familiy_dialog_row_index').val('');
|
||||
$('#familiy_dialog_column_index').val('');
|
||||
// $('#familiy_dialog_row_index').val('');
|
||||
// $('#familiy_dialog_column_index').val('');
|
||||
|
||||
// Reset Self
|
||||
$('#family_self').prop('checked', true);
|
||||
@ -3751,6 +3751,8 @@ function setCellInnerHTMLByCellIndex(tableId, rowIndex, colIndex, htmlContent) {
|
||||
// Set the innerHTML of the cell
|
||||
cell.innerHTML = htmlContent;
|
||||
console.log(`Updated cell at row ${rowIndex}, column ${colIndex} with content: ${htmlContent}`);
|
||||
$('#familiy_dialog_row_index').val('');
|
||||
$('#familiy_dialog_column_index').val('');
|
||||
} else {
|
||||
console.error(`Column index ${colIndex} does not exist in row ${rowIndex}`);
|
||||
}
|
||||
|
||||
Binary file not shown.
BIN
public/sample_excel/insurer_stament_sample_old.xlsx
Normal file
BIN
public/sample_excel/insurer_stament_sample_old.xlsx
Normal file
Binary file not shown.
100
test.http
100
test.http
@ -1,100 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
POST https://testtips.vidalhealthtpa.com:7443/mobilerest/vidalbrokerservices/submitClaim
|
||||
Authorization: Basic dmlkYWxicm9rZXJsb2dpbjp2aWRhbHN0YWdlQDEyMw==
|
||||
Cookie: JSESSIONID=678ofNbsfB8svK1lyV6rON3w.worker1
|
||||
Content-Type: multipart/form-data; boundary=WebApiBoundary
|
||||
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="username"
|
||||
|
||||
Web_api
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="password"
|
||||
|
||||
Web@api
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="policyNo"
|
||||
|
||||
CI/TEST/POLICY/123456
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="enrollmentId"
|
||||
|
||||
BLR-RG-H0351-043-0000002-A
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="typeOfClaim"
|
||||
|
||||
Main hospitalization claim
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="claimSubType"
|
||||
|
||||
Hospitalization
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="requestedAmount"
|
||||
|
||||
4500
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="ailmentType"
|
||||
|
||||
Non covid
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="admissionDate"
|
||||
|
||||
20-03-2025
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="dischargeDate"
|
||||
|
||||
23-03-2025
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="hospitalName"
|
||||
|
||||
A G HOSPITAL NEW
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="empanelmentNo"
|
||||
|
||||
HOS-PON-010427
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="documentType"
|
||||
|
||||
Claim
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="ailmentName"
|
||||
|
||||
Cold
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="hospitalAddress"
|
||||
|
||||
abc
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="hospitalState"
|
||||
|
||||
karnataka
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="hospitalCity"
|
||||
|
||||
bangalore
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="hospitalPinCode"
|
||||
|
||||
560036
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="hospitalPhoneNo"
|
||||
|
||||
7656879899
|
||||
--WebApiBoundary
|
||||
Content-Disposition: form-data; name="File"; filename="tracker.pdf"
|
||||
Content-Type: application/pdf
|
||||
|
||||
< ./C:\Users\jvadi\Downloads\Tickets - Business Show_ Chennai (India) (06_11_2025 14_00_00) - vadivel.pdf
|
||||
--WebApiBoundary--
|
||||
|
||||
|
||||
// claim
|
||||
|
||||
280
writable/e_card_template/new_ecard.html
Normal file
280
writable/e_card_template/new_ecard.html
Normal file
@ -0,0 +1,280 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Health Insurance E-Card</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
/* font-family: 'Lato', sans-serif; */
|
||||
background-color: #fff;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.card-container {
|
||||
display: table;
|
||||
width: 100%;
|
||||
max-width: 750px;
|
||||
margin: 0 auto;
|
||||
table-layout: fixed;
|
||||
border-spacing: 5px 0;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.card {
|
||||
display: table-cell;
|
||||
background: white;
|
||||
width: 50%;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: table;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
.logo-left {
|
||||
display: table-cell;
|
||||
width: 35px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.logo-left img {
|
||||
width: 48px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.logo-right {
|
||||
display: table-cell;
|
||||
text-align: right;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.logo-right img {
|
||||
width: 65px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.card-body {
|
||||
position: relative;
|
||||
padding-left: 65px;
|
||||
min-height: 80px;
|
||||
}
|
||||
|
||||
.n-logo {
|
||||
position: absolute;
|
||||
left: 5px;
|
||||
top: 30px;
|
||||
width: 55px;
|
||||
}
|
||||
|
||||
.n-logo img {
|
||||
width: 55px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.details {
|
||||
width: 100%;
|
||||
margin-left: 16px;
|
||||
}
|
||||
|
||||
.details-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 10px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.details-table td {
|
||||
padding: 1px 1px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.detail-label {
|
||||
width: 65px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.detail-separator {
|
||||
width: 8px;
|
||||
text-align: center;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.detail-value {
|
||||
color: #333;
|
||||
word-break: break-word;
|
||||
white-space: normal;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.support-section {
|
||||
font-size: 7.5px;
|
||||
|
||||
}
|
||||
|
||||
.support-title {
|
||||
color: #ff6b35;
|
||||
font-weight: 600;
|
||||
margin-bottom: 6px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.support-details {
|
||||
font-size: 8px;
|
||||
font-weight: 500;
|
||||
line-height: 1.4;
|
||||
color: #333;
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
.level-title {
|
||||
font-weight: 500;
|
||||
margin-top: 4px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.cashless-title {
|
||||
color: #ff6b35;
|
||||
font-weight: 600;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 3px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.footer-note {
|
||||
text-align: center;
|
||||
margin-top: 8px;
|
||||
font-size: 8px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.card-header img[src=""],
|
||||
.card-header img:not([src]) {
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="card-container">
|
||||
<!-- Front Card -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="logo-left">
|
||||
<img src="{INSURER_LOGO}" alt=" " onerror="this.style.visibility='hidden';">
|
||||
</div>
|
||||
<div class="logo-right">
|
||||
<img src="{TPA_LOGO}" alt=" " onerror="this.style.visibility='hidden';">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="n-logo">
|
||||
<img src="{NHANCE_N_LOGO}" alt=" " onerror="this.style.visibility='hidden';">
|
||||
</div>
|
||||
|
||||
<div class="details">
|
||||
<table class="details-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="detail-label">Policy Holder</td>
|
||||
<td class="detail-separator">:</td>
|
||||
<td class="detail-value">{CLIENT_NAME}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="detail-label">Insurer</td>
|
||||
<td class="detail-separator">:</td>
|
||||
<td class="detail-value">{INSURER_NAME}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="detail-label">TPA</td>
|
||||
<td class="detail-separator">:</td>
|
||||
<td class="detail-value">{TPA_NAME}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="detail-label">Primary Insured</td>
|
||||
<td class="detail-separator">:</td>
|
||||
<td class="detail-value">{SELF_NAME}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="detail-label">Beneficiary Name</td>
|
||||
<td class="detail-separator">:</td>
|
||||
<td class="detail-value">{NAME}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="detail-label">Member ID</td>
|
||||
<td class="detail-separator">:</td>
|
||||
<td class="detail-value">{TPA_ID}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="detail-label">Employee Code</td>
|
||||
<td class="detail-separator">:</td>
|
||||
<td class="detail-value">{EMP_ID}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="detail-label">Relation</td>
|
||||
<td class="detail-separator">:</td>
|
||||
<td class="detail-value">{RELATION}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="detail-label">Policy Period</td>
|
||||
<td class="detail-separator">:</td>
|
||||
<td class="detail-value">{POLICY_START_DATE} to {POLICY_DATE}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Back Card -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="logo-left">
|
||||
<img src="{INSURER_LOGO}" alt=" " onerror="this.style.visibility='hidden';">
|
||||
</div>
|
||||
<div class="logo-right">
|
||||
<img src="{TPA_LOGO}" alt=" " onerror="this.style.visibility='hidden';">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="n-logo">
|
||||
<img src="{NHANCE_N_LOGO}" alt=" " onerror="this.style.visibility='hidden';">
|
||||
</div>
|
||||
|
||||
<div class="details">
|
||||
<div class="support-section">
|
||||
<div class="support-title">For support :</div>
|
||||
<div class="support-details">
|
||||
{LEVELS}
|
||||
<div class="cashless-title">For cashless claims:</div>
|
||||
<div>Share a valid ID with this E-card at the Hospital Insurance Desk.</div>
|
||||
{NETWORK_HOSPITAL}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer-note">
|
||||
This E-Card is non-transferable and valid only at network (cashless) hospitals
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue
Block a user