Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
f94fdb53d9
@ -30,6 +30,8 @@ $routes->get("updateRemainderDate", "ClientController::updateRemainderDate");
|
|||||||
$routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
$routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
||||||
$routes->get("sendextraparam", "ClientController::sendextraparam");
|
$routes->get("sendextraparam", "ClientController::sendextraparam");
|
||||||
$routes->get("updateRenewalData", "ClientController::updateRenewalData");
|
$routes->get("updateRenewalData", "ClientController::updateRenewalData");
|
||||||
|
$routes->get("updateRenewalDataNotExistingClient", "ClientController::updateRenewalDataNotExistingClient");
|
||||||
|
$routes->get("updateRenewalInsurerData", "ClientController::updateRenewalInsurerData");
|
||||||
// $routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
|
// $routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
|
||||||
// $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
// $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
||||||
// $routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
// $routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
||||||
@ -49,7 +51,7 @@ $routes->get('/auth/google', 'LoginController::initiateGoogleOAuth');
|
|||||||
$routes->get('/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus');
|
$routes->get('/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus');
|
||||||
$routes->get('download-e-card/(:any)', 'EmployeeController::generateIDCardForEmployee/$1');
|
$routes->get('download-e-card/(:any)', 'EmployeeController::generateIDCardForEmployee/$1');
|
||||||
$routes->get('download-kyc-docs/(:segment)', 'ClientController::downloadKYCDocument/$1');
|
$routes->get('download-kyc-docs/(:segment)', 'ClientController::downloadKYCDocument/$1');
|
||||||
|
$routes->get('claim-form-download/(:any)', 'TicketController::downloadClaimForm/$1');
|
||||||
|
|
||||||
$routes->group("/user", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("/user", ["filter" => "authMVC"], function ($routes) {
|
||||||
$routes->post("create", "UserController::create");
|
$routes->post("create", "UserController::create");
|
||||||
@ -161,6 +163,7 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get("test-rack-rate", "EmployeeController::testRackRate");
|
$routes->get("test-rack-rate", "EmployeeController::testRackRate");
|
||||||
$routes->post("test-rack-rate", "EmployeeController::testRackRate");
|
$routes->post("test-rack-rate", "EmployeeController::testRackRate");
|
||||||
$routes->get('test_members_list', 'EmployeeController::test_members_list');
|
$routes->get('test_members_list', 'EmployeeController::test_members_list');
|
||||||
|
$routes->post('get_emp_history','EmployeeController::getEmpHistory');
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->group("/master", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("/master", ["filter" => "authMVC"], function ($routes) {
|
||||||
@ -387,7 +390,7 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
|||||||
|
|
||||||
$routes->group("leads", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("leads", ["filter" => "authMVC"], function ($routes) {
|
||||||
|
|
||||||
$routes->get("list", "LeadsController::viewLeadsList");
|
$routes->match(['get', 'post'],"list", "LeadsController::viewLeadsList");
|
||||||
$routes->post("create", "LeadsController::createLead");
|
$routes->post("create", "LeadsController::createLead");
|
||||||
$routes->get("list/(:any)", "LeadsController::getLeadDataForEdit/$1");
|
$routes->get("list/(:any)", "LeadsController::getLeadDataForEdit/$1");
|
||||||
$routes->get("sendMail", "LeadsController::sendMailWithAttachement");
|
$routes->get("sendMail", "LeadsController::sendMailWithAttachement");
|
||||||
@ -395,13 +398,13 @@ $routes->group("leads", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get("exportQCRandRFQ/(:any)", "LeadsController::exportQCRandRFQ/$1");
|
$routes->get("exportQCRandRFQ/(:any)", "LeadsController::exportQCRandRFQ/$1");
|
||||||
$routes->get("featchLeadDataAndInsertClient/(:any)", "LeadsController::featchLeadDataAndInsertClient/$1");
|
$routes->get("featchLeadDataAndInsertClient/(:any)", "LeadsController::featchLeadDataAndInsertClient/$1");
|
||||||
$routes->get("featchClientPolicyFromLead/(:any)", "LeadsController::featchClientPolicyFromLead/$1");
|
$routes->get("featchClientPolicyFromLead/(:any)", "LeadsController::featchClientPolicyFromLead/$1");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->group("rfq", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("rfq", ["filter" => "authMVC"], function ($routes) {
|
||||||
$routes->post("create", "LeadsController::createRFQ");
|
$routes->post("create", "LeadsController::createRFQ");
|
||||||
$routes->post("createQCR", "LeadsController::createQCR");
|
$routes->post("createQCR", "LeadsController::createQCR");
|
||||||
$routes->get("list/(:any)", "LeadsController::viewRFQ/$1");
|
$routes->get("list/(:any)", "LeadsController::viewRFQ/$1");
|
||||||
|
$routes->get("nonEB","LeadsController::rfqNonEB");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -440,13 +443,19 @@ $routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::
|
|||||||
|
|
||||||
// Test initiate Claim
|
// Test initiate Claim
|
||||||
$routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
|
$routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
|
||||||
|
$routes->get('departments',"EmployeeRestController::get_ticket_type");
|
||||||
|
$routes->get('get_ticket_data',"EmployeeRestController::get_ticket_data");
|
||||||
|
|
||||||
|
|
||||||
|
//api
|
||||||
$routes->group("/api", ["filter" => "authJWT"], function ($routes) {
|
$routes->group("/api", ["filter" => "authJWT"], function ($routes) {
|
||||||
$routes->post("logined", "RestAuthenticationController::logined");
|
$routes->post("logined", "RestAuthenticationController::logined");
|
||||||
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
|
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
|
||||||
$routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
|
$routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
|
||||||
|
$routes->get('get_ticket_type',"EmployeeRestController::get_ticket_type");
|
||||||
|
$routes->get('get_ticket_data',"EmployeeRestController::get_ticket_data");
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
|
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
|
||||||
$routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy");
|
$routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy");
|
||||||
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||||
@ -522,6 +531,8 @@ $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->post('note/(:any)','TicketController::crudNote/$1');
|
$routes->post('note/(:any)','TicketController::crudNote/$1');
|
||||||
$routes->post('reply','TicketController::saveReply');
|
$routes->post('reply','TicketController::saveReply');
|
||||||
$routes->match( ['get', 'post'], 'ticket_reports','TicketController::ticketReports');
|
$routes->match( ['get', 'post'], 'ticket_reports','TicketController::ticketReports');
|
||||||
|
$routes->post('getPolicyStartDate','TicketController::getPolicyStartDate');
|
||||||
|
$routes->post("getPoliciesbyEmpID","TicketController::getPoliciesbyEmpID");
|
||||||
// $routes->post('ticket_messages','TicketController::getTicketMessage');
|
// $routes->post('ticket_messages','TicketController::getTicketMessage');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -91,7 +91,7 @@ class BDSReportController extends AdminController
|
|||||||
ins.id,
|
ins.id,
|
||||||
ins.name AS insurers,
|
ins.name AS insurers,
|
||||||
COALESCE(SUM(CASE WHEN pt.action_type = 'inception' AND pt.insurer_id = ins.id AND ptp.policy_category = $insurerCategory THEN 1 ELSE 0 END), 0) AS Policies,
|
COALESCE(SUM(CASE WHEN pt.action_type = 'inception' AND pt.insurer_id = ins.id AND ptp.policy_category = $insurerCategory THEN 1 ELSE 0 END), 0) AS Policies,
|
||||||
COALESCE(SUM(CASE WHEN ptp.policy_category = $insurerCategory AND pt_co.insurer_id = ins.id THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS Premium,
|
COALESCE(SUM(CASE WHEN ptp.policy_category = $insurerCategory AND pt_co.insurer_id = ins.id THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS Premium,
|
||||||
COALESCE(SUM(CASE WHEN stmt.co_share_id = pt_co.id AND ptp.policy_category = $insurerCategory AND pt_co.insurer_id = ins.id THEN stmt.reward + stmt.actual_bp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.actual_tp_brokerage_amt ELSE 0 END), 0) AS Revenue,
|
COALESCE(SUM(CASE WHEN stmt.co_share_id = pt_co.id AND ptp.policy_category = $insurerCategory AND pt_co.insurer_id = ins.id THEN stmt.reward + stmt.actual_bp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.actual_tp_brokerage_amt ELSE 0 END), 0) AS Revenue,
|
||||||
COALESCE(SUM(CASE WHEN ptp.policy_category = $insurerCategory AND pt_co.insurer_id = ins.id THEN pt_co.exp_amt ELSE 0 END), 0) AS Expected_amt
|
COALESCE(SUM(CASE WHEN ptp.policy_category = $insurerCategory AND pt_co.insurer_id = ins.id THEN pt_co.exp_amt ELSE 0 END), 0) AS Expected_amt
|
||||||
FROM
|
FROM
|
||||||
@ -131,7 +131,7 @@ class BDSReportController extends AdminController
|
|||||||
SELECT
|
SELECT
|
||||||
pot.bap AS bap,
|
pot.bap AS bap,
|
||||||
COALESCE(COUNT(DISTINCT pt.id), 0) AS Policies,
|
COALESCE(COUNT(DISTINCT pt.id), 0) AS Policies,
|
||||||
COALESCE(SUM((pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt)), 0) AS Premium,
|
COALESCE(SUM((pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt)), 0) AS Premium,
|
||||||
COALESCE(SUM(co.reward + co.actual_bp_brokerage_amt + co.actual_tep_brokerage_amt + co.actual_tp_brokerage_amt), 0) AS Revenue,
|
COALESCE(SUM(co.reward + co.actual_bp_brokerage_amt + co.actual_tep_brokerage_amt + co.actual_tp_brokerage_amt), 0) AS Revenue,
|
||||||
COALESCE(SUM(pt_co.exp_amt), 0) AS Expected_amt
|
COALESCE(SUM(pt_co.exp_amt), 0) AS Expected_amt
|
||||||
FROM policy_type AS pot
|
FROM policy_type AS pot
|
||||||
@ -267,26 +267,26 @@ class BDSReportController extends AdminController
|
|||||||
|
|
||||||
-- Health Policies
|
-- Health Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS health_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS health_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS health_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS health_premium,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS health_revenue,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS health_revenue,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN pt_co.exp_amt ELSE 0 END), 0) AS health_exp_amt,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN pt_co.exp_amt ELSE 0 END), 0) AS health_exp_amt,
|
||||||
|
|
||||||
-- Misc Policies
|
-- Misc Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS misc_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS misc_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS misc_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS misc_premium,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS misc_revenue,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS misc_revenue,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN pt_co.exp_amt ELSE 0 END), 0) AS misc_exp_amt,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN pt_co.exp_amt ELSE 0 END), 0) AS misc_exp_amt,
|
||||||
|
|
||||||
|
|
||||||
-- Motor Policies
|
-- Motor Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS motor_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS motor_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS motor_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS motor_premium,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS motor_revenue,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS motor_revenue,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN pt_co.exp_amt ELSE 0 END), 0) AS motor_exp_amt,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN pt_co.exp_amt ELSE 0 END), 0) AS motor_exp_amt,
|
||||||
|
|
||||||
-- Engineering Policies
|
-- Engineering Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS engineering_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS engineering_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS engineering_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS engineering_premium,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS engineering_revenue,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS engineering_revenue,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN pt_co.exp_amt ELSE 0 END), 0) AS engineering_exp_amt,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN pt_co.exp_amt ELSE 0 END), 0) AS engineering_exp_amt,
|
||||||
|
|
||||||
@ -294,35 +294,35 @@ class BDSReportController extends AdminController
|
|||||||
|
|
||||||
-- Fire Policies
|
-- Fire Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS fire_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS fire_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS fire_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS fire_premium,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS fire_revenue,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS fire_revenue,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN pt_co.exp_amt ELSE 0 END), 0) AS fire_exp_amt,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN pt_co.exp_amt ELSE 0 END), 0) AS fire_exp_amt,
|
||||||
|
|
||||||
|
|
||||||
-- Liability Policies
|
-- Liability Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS liability_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS liability_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS liability_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS liability_premium,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS liability_revenue,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS liability_revenue,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN pt_co.exp_amt ELSE 0 END), 0) AS liability_exp_amt,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN pt_co.exp_amt ELSE 0 END), 0) AS liability_exp_amt,
|
||||||
|
|
||||||
|
|
||||||
-- Life Policies
|
-- Life Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS life_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS life_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS life_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS life_premium,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS life_revenue,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS life_revenue,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN pt_co.exp_amt ELSE 0 END), 0) AS life_exp_amt,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN pt_co.exp_amt ELSE 0 END), 0) AS life_exp_amt,
|
||||||
|
|
||||||
|
|
||||||
-- Marine Cargo Policies
|
-- Marine Cargo Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_cargo_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_cargo_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS marine_cargo_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS marine_cargo_premium,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS marine_cargoe_revenue,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS marine_cargoe_revenue,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN pt_co.exp_amt ELSE 0 END), 0) AS marine_cargo_exp_amt,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN pt_co.exp_amt ELSE 0 END), 0) AS marine_cargo_exp_amt,
|
||||||
|
|
||||||
|
|
||||||
-- Marine Hull Policies
|
-- Marine Hull Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_hull_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_hull_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS marine_hull_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS marine_hull_premium,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS marine_hull_revenue,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS marine_hull_revenue,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN pt_co.exp_amt ELSE 0 END), 0) AS marine_hull_exp_amt,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN pt_co.exp_amt ELSE 0 END), 0) AS marine_hull_exp_amt,
|
||||||
|
|
||||||
@ -341,15 +341,15 @@ class BDSReportController extends AdminController
|
|||||||
) AS total_policy_count,
|
) AS total_policy_count,
|
||||||
|
|
||||||
COALESCE(
|
COALESCE(
|
||||||
SUM(CASE WHEN ptp.bap = 'Health' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
SUM(CASE WHEN ptp.bap = 'Health' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
||||||
SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
||||||
SUM(CASE WHEN ptp.bap = 'Life' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
SUM(CASE WHEN ptp.bap = 'Life' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
||||||
SUM(CASE WHEN ptp.bap = 'Motor' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
SUM(CASE WHEN ptp.bap = 'Motor' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
||||||
SUM(CASE WHEN ptp.bap = 'Fire' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
SUM(CASE WHEN ptp.bap = 'Fire' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
||||||
SUM(CASE WHEN ptp.bap = 'Engineering' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
SUM(CASE WHEN ptp.bap = 'Engineering' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
||||||
SUM(CASE WHEN ptp.bap = 'Liability' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END)+
|
SUM(CASE WHEN ptp.bap = 'Liability' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END)+
|
||||||
SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END)+
|
SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END)+
|
||||||
SUM(CASE WHEN ptp.bap = 'Misc' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END),
|
SUM(CASE WHEN ptp.bap = 'Misc' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END),
|
||||||
0
|
0
|
||||||
) AS total_premium,
|
) AS total_premium,
|
||||||
|
|
||||||
@ -429,43 +429,43 @@ class BDSReportController extends AdminController
|
|||||||
|
|
||||||
-- Health Policies
|
-- Health Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS health_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS health_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS health_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS health_premium,
|
||||||
|
|
||||||
-- Misc Policies
|
-- Misc Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS misc_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS misc_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS misc_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS misc_premium,
|
||||||
|
|
||||||
-- Motor Policies
|
-- Motor Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS motor_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS motor_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS motor_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS motor_premium,
|
||||||
|
|
||||||
-- Engineering Policies
|
-- Engineering Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS engineering_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS engineering_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS engineering_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS engineering_premium,
|
||||||
|
|
||||||
-- Fire Policies
|
-- Fire Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS fire_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS fire_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS fire_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS fire_premium,
|
||||||
|
|
||||||
-- Liability Policies
|
-- Liability Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS liability_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS liability_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS liability_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS liability_premium,
|
||||||
|
|
||||||
-- Life Policies
|
-- Life Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS life_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS life_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS life_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS life_premium,
|
||||||
|
|
||||||
-- Marine Cargo Policies
|
-- Marine Cargo Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_cargo_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_cargo_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS marine_cargo_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS marine_cargo_premium,
|
||||||
|
|
||||||
-- Marine Hull Policies
|
-- Marine Hull Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_hull_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_hull_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS marine_hull_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN (pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS marine_hull_premium,
|
||||||
|
|
||||||
-- Grand Totals
|
-- Grand Totals
|
||||||
COALESCE(SUM(CASE WHEN pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS total_policy_count,
|
COALESCE(SUM(CASE WHEN pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS total_policy_count,
|
||||||
COALESCE(SUM(pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt), 0) AS total_premium
|
COALESCE(SUM(pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt), 0) AS total_premium
|
||||||
|
|
||||||
FROM clients c
|
FROM clients c
|
||||||
LEFT JOIN policy_transaction pt ON pt.client_id = c.id AND pt.is_active = 1 AND pt.policy_issue_date >= '$fromDate' AND pt.policy_issue_date <= '$toDate'
|
LEFT JOIN policy_transaction pt ON pt.client_id = c.id AND pt.is_active = 1 AND pt.policy_issue_date >= '$fromDate' AND pt.policy_issue_date <= '$toDate'
|
||||||
@ -542,7 +542,7 @@ class BDSReportController extends AdminController
|
|||||||
|
|
||||||
COALESCE((
|
COALESCE((
|
||||||
select
|
select
|
||||||
sum(pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) as premium
|
sum(pt_co.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) as premium
|
||||||
from co_share_stmt_details stmt
|
from co_share_stmt_details stmt
|
||||||
left join pt_co_share_details pt_co on stmt.co_share_id = pt_co.id
|
left join pt_co_share_details pt_co on stmt.co_share_id = pt_co.id
|
||||||
left join policy_transaction pt on pt_co.pt_id = pt.id
|
left join policy_transaction pt on pt_co.pt_id = pt.id
|
||||||
|
|||||||
@ -1,110 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controllers\Chatbot;
|
|
||||||
|
|
||||||
use BotMan\BotMan\BotMan;
|
|
||||||
|
|
||||||
class BotService
|
|
||||||
{
|
|
||||||
public static function sendMainOptions(BotMan $bot)
|
|
||||||
{
|
|
||||||
$bot->reply('Welcome! Please choose an option:', [
|
|
||||||
'reply_markup' => json_encode([
|
|
||||||
'keyboard' => [
|
|
||||||
['Card Download'],
|
|
||||||
['Network Hospital'],
|
|
||||||
['Reimbursement Claim Process'],
|
|
||||||
['Reimbursement Claim Status'],
|
|
||||||
['New Policy'],
|
|
||||||
['Renew Policy']
|
|
||||||
],
|
|
||||||
'resize_keyboard' => true,
|
|
||||||
'one_time_keyboard' => true
|
|
||||||
])
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function handleCardDownload(BotMan $bot)
|
|
||||||
{
|
|
||||||
$bot->reply('Please choose an option:', [
|
|
||||||
'reply_markup' => json_encode([
|
|
||||||
'keyboard' => [
|
|
||||||
['Download Card'],
|
|
||||||
['Go Back']
|
|
||||||
],
|
|
||||||
'resize_keyboard' => true,
|
|
||||||
'one_time_keyboard' => true
|
|
||||||
])
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function handleNetworkHospital(BotMan $bot)
|
|
||||||
{
|
|
||||||
$bot->reply('Please choose an option:', [
|
|
||||||
'reply_markup' => json_encode([
|
|
||||||
'keyboard' => [
|
|
||||||
['Find Hospital'],
|
|
||||||
['Go Back']
|
|
||||||
],
|
|
||||||
'resize_keyboard' => true,
|
|
||||||
'one_time_keyboard' => true
|
|
||||||
])
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function handleReimbursementClaimProcess(BotMan $bot)
|
|
||||||
{
|
|
||||||
$bot->reply('Please choose an option:', [
|
|
||||||
'reply_markup' => json_encode([
|
|
||||||
'keyboard' => [
|
|
||||||
['Submit Claim'],
|
|
||||||
['Go Back']
|
|
||||||
],
|
|
||||||
'resize_keyboard' => true,
|
|
||||||
'one_time_keyboard' => true
|
|
||||||
])
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function handleReimbursementClaimStatus(BotMan $bot)
|
|
||||||
{
|
|
||||||
$bot->reply('Please choose an option:', [
|
|
||||||
'reply_markup' => json_encode([
|
|
||||||
'keyboard' => [
|
|
||||||
['Check Status'],
|
|
||||||
['Go Back']
|
|
||||||
],
|
|
||||||
'resize_keyboard' => true,
|
|
||||||
'one_time_keyboard' => true
|
|
||||||
])
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function handleNewPolicy(BotMan $bot)
|
|
||||||
{
|
|
||||||
$bot->reply('Please choose an option:', [
|
|
||||||
'reply_markup' => json_encode([
|
|
||||||
'keyboard' => [
|
|
||||||
['Get Quote'],
|
|
||||||
['Go Back']
|
|
||||||
],
|
|
||||||
'resize_keyboard' => true,
|
|
||||||
'one_time_keyboard' => true
|
|
||||||
])
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function handleRenewPolicy(BotMan $bot)
|
|
||||||
{
|
|
||||||
$bot->reply('Please choose an option:', [
|
|
||||||
'reply_markup' => json_encode([
|
|
||||||
'keyboard' => [
|
|
||||||
['Renew Now'],
|
|
||||||
['Go Back']
|
|
||||||
],
|
|
||||||
'resize_keyboard' => true,
|
|
||||||
'one_time_keyboard' => true
|
|
||||||
])
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controllers\Chatbot;
|
|
||||||
|
|
||||||
use BotMan\BotMan\BotMan;
|
|
||||||
use BotMan\BotMan\Messages\Outgoing\Actions\ButtonTemplate;
|
|
||||||
use BotMan\BotMan\Messages\Outgoing\Actions\ElementButton;
|
|
||||||
|
|
||||||
class ClaimHandler
|
|
||||||
{
|
|
||||||
public static function handle(BotMan $bot, $option)
|
|
||||||
{
|
|
||||||
$responses = [
|
|
||||||
'reimbursement_claim_process' => "Reimbursement Claim Process: Here is a dummy response.",
|
|
||||||
'reimbursement_claim_status' => "Reimbursement Claim Status: Here is a dummy response."
|
|
||||||
];
|
|
||||||
|
|
||||||
if (isset($responses[$option])) {
|
|
||||||
$bot->reply($responses[$option]);
|
|
||||||
} else {
|
|
||||||
$bot->reply("Unknown claim option.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send Back Button
|
|
||||||
self::sendBackButton($bot);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function sendBackButton(BotMan $bot)
|
|
||||||
{
|
|
||||||
$bot->reply(ButtonTemplate::create("Would you like to return?")
|
|
||||||
->addButton(ElementButton::create("Go Back")->type('postback')->payload("main_menu"))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
26
app/Controllers/Chatbot/LoginToContiueConversation.php
Normal file
26
app/Controllers/Chatbot/LoginToContiueConversation.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers\Chatbot;
|
||||||
|
|
||||||
|
use App\Helpers\ChatbotHelper;
|
||||||
|
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||||
|
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||||
|
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||||
|
use BotMan\Drivers\Web\WebDriver;
|
||||||
|
|
||||||
|
class LoginToContiueConversation extends Conversation
|
||||||
|
{
|
||||||
|
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$this->bot->userStorage()->delete();
|
||||||
|
$this->bot->types(); // Typing indicator for the first message
|
||||||
|
sleep(0.5); // Delay
|
||||||
|
$this->showLoginMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function showLoginMessage()
|
||||||
|
{
|
||||||
|
$this->say("Kindly Login to use the chatbot");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controllers\Chatbot;
|
|
||||||
|
|
||||||
use BotMan\BotMan\BotMan;
|
|
||||||
use BotMan\BotMan\Messages\Outgoing\Actions\ButtonTemplate;
|
|
||||||
use BotMan\BotMan\Messages\Outgoing\Actions\ElementButton;
|
|
||||||
|
|
||||||
class PolicyHandler
|
|
||||||
{
|
|
||||||
public static function handle(BotMan $bot, $option)
|
|
||||||
{
|
|
||||||
$responses = [
|
|
||||||
'ecard_download' => "Ecard Download: Here is a dummy response.",
|
|
||||||
'network_hospital' => "Network Hospital: Here is a dummy response.",
|
|
||||||
'new_policy' => "New Policy: Here is a dummy response.",
|
|
||||||
'renew_policy' => "Renew Policy: Here is a dummy response."
|
|
||||||
];
|
|
||||||
|
|
||||||
if (isset($responses[$option])) {
|
|
||||||
$bot->reply($responses[$option]);
|
|
||||||
} else {
|
|
||||||
$bot->reply("Unknown policy option.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send Back Button
|
|
||||||
self::sendBackButton($bot);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function sendBackButton(BotMan $bot)
|
|
||||||
{
|
|
||||||
$bot->reply(ButtonTemplate::create("Would you like to return?")
|
|
||||||
->addButton(ElementButton::create("Go Back")->type('postback')->payload("main_menu"))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -27,7 +27,7 @@ class ReimbursementClaimStatusConversation extends Conversation
|
|||||||
|
|
||||||
$this->bot->types();
|
$this->bot->types();
|
||||||
if ($data){
|
if ($data){
|
||||||
$this->say("The claim status for the claim Number {$data['claim_number']} is currently in {$data['claim_status']} status. <br> More Detailed Information is sent to your mail");
|
$this->say("The claim status for the claim Number {$data['claim_number']} is currently in <strong>{$data['client_status']}</strong> status. <br> More Detailed Information is sent to your mail");
|
||||||
$this->bot->startConversation(new doYouWantToContinueConversation());
|
$this->bot->startConversation(new doYouWantToContinueConversation());
|
||||||
}else{
|
}else{
|
||||||
$this->say("No Claim Raised against the user.");
|
$this->say("No Claim Raised against the user.");
|
||||||
|
|||||||
@ -1,27 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controllers\Chatbot;
|
|
||||||
|
|
||||||
use BotMan\BotMan\BotMan;
|
|
||||||
|
|
||||||
class TypingMiddleware
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Handle the middleware logic.
|
|
||||||
*
|
|
||||||
* @param BotMan $bot
|
|
||||||
* @param callable $next
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function handle($bot, $next)
|
|
||||||
{
|
|
||||||
$this->myLogger = \Config\Services::mylogger();
|
|
||||||
$this->myLogger->logme('error', 'MIDDLEWARE');
|
|
||||||
|
|
||||||
// Simulate typing indicator
|
|
||||||
$bot->types();
|
|
||||||
sleep(0.1); // Cap delay at 5 seconds (convert to microseconds)
|
|
||||||
// Proceed to the next middleware or response
|
|
||||||
return $next($bot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -246,7 +246,8 @@ class medicalClaimFormConversations extends Conversation
|
|||||||
$question = Question::create("Confirm all details:")
|
$question = Question::create("Confirm all details:")
|
||||||
->addButtons([
|
->addButtons([
|
||||||
Button::create("✅ Confirm")->value("confirm"),
|
Button::create("✅ Confirm")->value("confirm"),
|
||||||
Button::create("❌ Start Over")->value("restart"),
|
Button::create("🔁 Start Over")->value("restart"),
|
||||||
|
Button::create("❌ Cancel")->value('cancel')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->ask($question, function ($answer) use ($finalSummary) {
|
$this->ask($question, function ($answer) use ($finalSummary) {
|
||||||
@ -271,6 +272,9 @@ class medicalClaimFormConversations extends Conversation
|
|||||||
]);
|
]);
|
||||||
$this->run();
|
$this->run();
|
||||||
break;
|
break;
|
||||||
|
case "cancel":
|
||||||
|
$this->bot->startConversation(new MainMenuConversation());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$this->say("Invalid selection. Please choose an option.");
|
$this->say("Invalid selection. Please choose an option.");
|
||||||
$this->showSummary();
|
$this->showSummary();
|
||||||
|
|||||||
@ -180,7 +180,8 @@ class vehicleFormConversation extends Conversation
|
|||||||
$question = Question::create("Confim your Details:")
|
$question = Question::create("Confim your Details:")
|
||||||
->addButtons([
|
->addButtons([
|
||||||
Button::create("✅ Confirm")->value("confirm"),
|
Button::create("✅ Confirm")->value("confirm"),
|
||||||
Button::create("❌ No")->value("no"),
|
Button::create("🔁 Start Over")->value("restart"),
|
||||||
|
Button::create("❌ Cancel")->value('cancel')
|
||||||
]);
|
]);
|
||||||
$this->bot->ask($question, function ($answer) use($vehicle_info) {
|
$this->bot->ask($question, function ($answer) use($vehicle_info) {
|
||||||
$path = $this->bot->userStorage()->get('path');
|
$path = $this->bot->userStorage()->get('path');
|
||||||
@ -201,8 +202,12 @@ class vehicleFormConversation extends Conversation
|
|||||||
$this->say("There was a problem while requesting for a quotation please try again later.");
|
$this->say("There was a problem while requesting for a quotation please try again later.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "no":
|
case "restart":
|
||||||
$this->askVehicleName();
|
$this->bot->startConversation(new vehicleFormConversation());
|
||||||
|
break;
|
||||||
|
case "cancel":
|
||||||
|
$this->say("Redirecting you to main menu...");
|
||||||
|
$this->bot->startConversation(new MainMenuConversation());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->say("Invalid selection. Please choose an option.");
|
$this->say("Invalid selection. Please choose an option.");
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Controllers;
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Controllers\Chatbot\LoginToContiueConversation;
|
||||||
use BotMan\BotMan\BotMan;
|
use BotMan\BotMan\BotMan;
|
||||||
use BotMan\BotMan\BotManFactory;
|
use BotMan\BotMan\BotManFactory;
|
||||||
use BotMan\BotMan\Drivers\DriverManager;
|
use BotMan\BotMan\Drivers\DriverManager;
|
||||||
@ -19,6 +20,7 @@ class ChatbotControllerNew extends BaseController
|
|||||||
protected $myLogger;
|
protected $myLogger;
|
||||||
protected $session;
|
protected $session;
|
||||||
protected $botman;
|
protected $botman;
|
||||||
|
protected $isMemberLoggedIn;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -91,6 +93,12 @@ class ChatbotControllerNew extends BaseController
|
|||||||
$this->session->set('CHATBOT_RANDOM_USER_ID', $id);
|
$this->session->set('CHATBOT_RANDOM_USER_ID', $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->isMemberLoggedIn = false;
|
||||||
|
$chat_session_info = get_chatbot_session_info();
|
||||||
|
if (!empty($chat_session_info['emp_id']) && !empty($chat_session_info['emp_code'] )){
|
||||||
|
$this->isMemberLoggedIn = true;
|
||||||
|
}
|
||||||
|
|
||||||
$this->botman->hears('.*', function ($bot) {
|
$this->botman->hears('.*', function ($bot) {
|
||||||
|
|
||||||
$bot->types(); // Typing indicator for the first message
|
$bot->types(); // Typing indicator for the first message
|
||||||
@ -98,8 +106,13 @@ class ChatbotControllerNew extends BaseController
|
|||||||
});
|
});
|
||||||
// Start the Main Menu when user says "hi" or "start"
|
// Start the Main Menu when user says "hi" or "start"
|
||||||
$this->botman->hears('start|hi|hello', function (BotMan $bot) {
|
$this->botman->hears('start|hi|hello', function (BotMan $bot) {
|
||||||
$bot->reply('Hi how can i assit?');
|
if ($this->isMemberLoggedIn){
|
||||||
|
$bot->reply('Hi how can i assist?');
|
||||||
$bot->startConversation(new MainMenuConversation());
|
$bot->startConversation(new MainMenuConversation());
|
||||||
|
}else {
|
||||||
|
$bot->startConversation(new LoginToContiueConversation());
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -100,16 +100,52 @@ class DashboardController extends AdminController
|
|||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
$results = $this->clientModel->select('clients.id as client_id, clients.client_name, clients.short_name,
|
$db = db_connect();
|
||||||
client_branch.id as client_branch_id, client_branch.branch_name,
|
$sql = "SELECT
|
||||||
client_branch.branch_code, employees.id as employee_id,
|
clients.id AS client_id,
|
||||||
employees.name as employee_name, employees.relationship,
|
clients.client_name,
|
||||||
employees.emp_code, employees.emp_status, auth_history.user_type, client_policy.policy_type_id, client_policy.id as client_policy_id')
|
clients.short_name,
|
||||||
->join('client_branch', 'clients.id = client_branch.client_id', 'left')
|
client_branch.id AS client_branch_id,
|
||||||
->join('client_policy', 'client_branch.id = client_policy.client_branch_id', 'left')
|
client_branch.branch_name,
|
||||||
->join('employees', 'client_branch.id = employees.client_branch_id', 'left')
|
client_branch.branch_code,
|
||||||
->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left')
|
|
||||||
->findAll();
|
COUNT(employees.id) AS total_employees,
|
||||||
|
SUM(CASE WHEN employees.emp_status = 'draft' THEN 1 ELSE 0 END) AS draft_count,
|
||||||
|
SUM(CASE WHEN employees.emp_status IN ('enrolled', 'active') THEN 1 ELSE 0 END) AS enrolled_count,
|
||||||
|
|
||||||
|
SUM(CASE WHEN auth_history.user_id IS NOT NULL THEN 1 ELSE 0 END) AS logged_in_count,
|
||||||
|
SUM(CASE WHEN auth_history.user_id IS NULL THEN 1 ELSE 0 END) AS not_logged_in_count,
|
||||||
|
|
||||||
|
CASE
|
||||||
|
WHEN EXISTS (
|
||||||
|
SELECT 1 FROM client_policy
|
||||||
|
WHERE client_policy.client_branch_id = client_branch.id
|
||||||
|
AND client_policy.is_active = 1
|
||||||
|
AND client_policy.open_for_enrollment = 1
|
||||||
|
) THEN 1
|
||||||
|
ELSE 0
|
||||||
|
END AS open_or_close_enrollment
|
||||||
|
|
||||||
|
FROM clients
|
||||||
|
LEFT JOIN client_branch ON clients.id = client_branch.client_id
|
||||||
|
LEFT JOIN employees ON client_branch.id = employees.client_branch_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT user_id, user_type
|
||||||
|
FROM auth_history
|
||||||
|
WHERE user_type = 'employee'
|
||||||
|
GROUP BY user_id
|
||||||
|
) AS auth_history ON employees.id = auth_history.user_id
|
||||||
|
|
||||||
|
WHERE employees.relationship = 'Self'
|
||||||
|
AND employees.emp_status IN ('draft', 'enrolled', 'active')
|
||||||
|
AND employees.is_active = 1
|
||||||
|
AND clients.is_active = 1
|
||||||
|
AND client_branch.is_active = 1
|
||||||
|
|
||||||
|
GROUP BY clients.id, client_branch.id";
|
||||||
|
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
|
||||||
$pendingActionsController = new PendingActionsController;
|
$pendingActionsController = new PendingActionsController;
|
||||||
$pendingActionsData = $pendingActionsController->getPendingActionsForDashBoard();
|
$pendingActionsData = $pendingActionsController->getPendingActionsForDashBoard();
|
||||||
@ -118,94 +154,11 @@ class DashboardController extends AdminController
|
|||||||
$businessTeamStatusData = $this->data_construct_for_bds($businessTeamData);
|
$businessTeamStatusData = $this->data_construct_for_bds($businessTeamData);
|
||||||
$financeTeamStatusData = $this->data_construct_for_bds($financeTeamData);
|
$financeTeamStatusData = $this->data_construct_for_bds($financeTeamData);
|
||||||
|
|
||||||
$groupedData = [];
|
|
||||||
|
|
||||||
foreach ($results as $row) {
|
$data['client_branch_emp_list'] = $results;
|
||||||
$clientId = $row['client_id'];
|
|
||||||
$clientName = $row['client_name'];
|
|
||||||
$shortName = $row['short_name'];
|
|
||||||
$branchId = $row['client_branch_id'];
|
|
||||||
$branchName = $row['branch_name'];
|
|
||||||
$branchCode = $row['branch_code'];
|
|
||||||
|
|
||||||
$clientPolicyId = $row['client_policy_id'];
|
|
||||||
$policyTypeId = $row['policy_type_id'];
|
|
||||||
$employeeId = '';
|
|
||||||
if ($employeeId != $row['employee_id']) {
|
|
||||||
$employeeId = $row['employee_id'];
|
|
||||||
} else {
|
|
||||||
$employeeId = null;
|
|
||||||
}
|
|
||||||
$employeeName = $row['employee_name'];
|
|
||||||
$employeeRelationship = $row['relationship'];
|
|
||||||
$employeeEmpCode = $row['emp_code'];
|
|
||||||
$employeeEmpStatus = $row['emp_status'];
|
|
||||||
$employeeUserType = $row['user_type'];
|
|
||||||
|
|
||||||
// Initialize the client entry if it doesn't exist
|
|
||||||
if (!isset($groupedData[$clientId])) {
|
|
||||||
$groupedData[$clientId] = [
|
|
||||||
'client_id' => $clientId,
|
|
||||||
'client_name' => $clientName,
|
|
||||||
'short_name' => $shortName,
|
|
||||||
'branches' => []
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize the branch entry if it doesn't exist
|
|
||||||
if (!isset($groupedData[$clientId]['branches'][$branchId])) {
|
|
||||||
$groupedData[$clientId]['branches'][$branchId] = [
|
|
||||||
'client_branch_id' => $branchId,
|
|
||||||
'branch_name' => $branchName,
|
|
||||||
'branch_code' => $branchCode,
|
|
||||||
'emp_login' => 0,
|
|
||||||
'emp_enroll' => 0,
|
|
||||||
'client_policies' => [],
|
|
||||||
'employees' => []
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the client policy to the branch's policies list if it exists, not already added, and policyTypeId is not equal to 1
|
|
||||||
if ($clientPolicyId !== null && $policyTypeId != 1 && !in_array(['client_policy_id' => $clientPolicyId, 'policy_type_id' => $policyTypeId], $groupedData[$clientId]['branches'][$branchId]['client_policies'])) {
|
|
||||||
$groupedData[$clientId]['branches'][$branchId]['client_policies'][] = [
|
|
||||||
'client_policy_id' => $clientPolicyId,
|
|
||||||
'policy_type_id' => $policyTypeId
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Append employee error to the branch's employees list if relationship is 'Self' and not already added
|
|
||||||
$employeeKey = $employeeId . '-' . $employeeName; // unique key to identify an employee
|
|
||||||
if ($employeeId !== null && $employeeRelationship == 'Self' && !isset($groupedData[$clientId]['branches'][$branchId]['employees'][$employeeKey])) {
|
|
||||||
$groupedData[$clientId]['branches'][$branchId]['employees'][$employeeKey] = [
|
|
||||||
'employee_id' => $employeeId,
|
|
||||||
'employee_name' => $employeeName,
|
|
||||||
'relationship' => $employeeRelationship,
|
|
||||||
'emp_code' => $employeeEmpCode,
|
|
||||||
'emp_status' => $employeeEmpStatus,
|
|
||||||
'user_type' => $employeeUserType
|
|
||||||
];
|
|
||||||
if (!empty($employeeUserType)) {
|
|
||||||
$groupedData[$clientId]['branches'][$branchId]['emp_login']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Increment emp_enroll if emp_status is not 'draft'
|
|
||||||
if ($employeeEmpStatus !== 'draft') {
|
|
||||||
$groupedData[$clientId]['branches'][$branchId]['emp_enroll']++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Re-index the arrays to match the expected structure
|
|
||||||
foreach ($groupedData as &$client) {
|
|
||||||
foreach ($client['branches'] as &$branch) {
|
|
||||||
$branch['employees'] = array_values($branch['employees']);
|
|
||||||
}
|
|
||||||
$client['branches'] = array_values($client['branches']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['client_branch_emp_list'] = $groupedData;
|
|
||||||
$session = \Config\Services::session();
|
$session = \Config\Services::session();
|
||||||
$session->set('enrollment_data', json_encode($data));
|
$session->set('enrollment_data', json_encode($data));
|
||||||
|
|
||||||
// echo "<pre>";
|
// echo "<pre>";
|
||||||
$data['pendingActionsData'] = $pendingActionsData;
|
$data['pendingActionsData'] = $pendingActionsData;
|
||||||
$data['businessTeamCount'] = count($businessTeamData) ?? 0;
|
$data['businessTeamCount'] = count($businessTeamData) ?? 0;
|
||||||
|
|||||||
@ -975,7 +975,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$balance = $this->CDMasterModel
|
$balance = $this->CDMasterModel
|
||||||
->where('client_id', $export_data['client_id'])
|
->where('client_id', $export_data['client_id'])
|
||||||
->where('insurer_id', $policy_details['insurer_id'])
|
->where('insurer_id', $policy_details['insurer_id'])
|
||||||
->where('cd_ac_no', $policy_details['cd_ac_no'])
|
->where('id', $policy_details['cd_ac_pk'])
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$cash_balance['balance'] = $balance['opening_bal'];
|
$cash_balance['balance'] = $balance['opening_bal'];
|
||||||
@ -1011,14 +1011,33 @@ class EmpDataServiceController extends BaseController
|
|||||||
// dd($inceptionData, $additionData, $dependentAdditionData, $correctionData, $enhancementData, $deletionData, $mergedData);
|
// dd($inceptionData, $additionData, $dependentAdditionData, $correctionData, $enhancementData, $deletionData, $mergedData);
|
||||||
|
|
||||||
|
|
||||||
$template_json = $this->clientPolicyModel
|
// $template_json = $this->clientPolicyModel
|
||||||
->select('insurer_excel_export_template.jsoncolumns')
|
// ->select('insurer_excel_export_template.jsoncolumns')
|
||||||
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id')
|
// ->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id')
|
||||||
->where('client_policy.id', $export_data['client_policy_id'])
|
// ->where('client_policy.id', $export_data['client_policy_id'])
|
||||||
->where('insurer_excel_export_template.event_name', 'all')
|
// ->where('insurer_excel_export_template.event_name', 'all')
|
||||||
->where('insurer_excel_export_template.is_active', 1) //Live issue changes 17-10-2024
|
// ->where('insurer_excel_export_template.is_active', 1) //Live issue changes 17-10-2024
|
||||||
->where('insurer_excel_export_template.type_name', $export_data['actions'])
|
// ->where('insurer_excel_export_template.type_name', $export_data['actions'])
|
||||||
->first();
|
// ->first();
|
||||||
|
|
||||||
|
$sql = "
|
||||||
|
SELECT `insurer_excel_export_template`.`jsoncolumns`
|
||||||
|
FROM `client_policy`
|
||||||
|
JOIN `insurer_excel_export_template`
|
||||||
|
ON `insurer_excel_export_template`.`insurer_id` = `client_policy`.`insurer_id`
|
||||||
|
AND `insurer_excel_export_template`.`policy_type_id` =
|
||||||
|
CASE
|
||||||
|
WHEN `client_policy`.`policy_type_id` IN (2, 3, 4, 5) THEN 2
|
||||||
|
ELSE `client_policy`.`policy_type_id`
|
||||||
|
END
|
||||||
|
WHERE `client_policy`.`id` = '".$export_data['client_policy_id']."'
|
||||||
|
AND `insurer_excel_export_template`.`event_name` = 'all'
|
||||||
|
AND `insurer_excel_export_template`.`is_active` = 1
|
||||||
|
AND `insurer_excel_export_template`.`type_name` = '".$export_data['actions']."'
|
||||||
|
LIMIT 1";
|
||||||
|
|
||||||
|
$query = db_connect()->query($sql);
|
||||||
|
$template_json = $query->getRowArray();
|
||||||
|
|
||||||
|
|
||||||
if(!empty($template_json) && $template_json != null){
|
if(!empty($template_json) && $template_json != null){
|
||||||
|
|||||||
@ -25,6 +25,8 @@ use App\Models\InsurerExcelExportTemplateModel;
|
|||||||
use App\Models\InsurerModel;
|
use App\Models\InsurerModel;
|
||||||
use App\Models\ClientDepositModel;
|
use App\Models\ClientDepositModel;
|
||||||
use App\Models\PolicyPremium2Model;
|
use App\Models\PolicyPremium2Model;
|
||||||
|
use App\Models\AuditHistoryModel;
|
||||||
|
use App\Models\UserModel;
|
||||||
|
|
||||||
|
|
||||||
use App\Controllers\Jobs;
|
use App\Controllers\Jobs;
|
||||||
@ -64,6 +66,8 @@ class EmployeeController extends AdminController
|
|||||||
protected $insurerModel;
|
protected $insurerModel;
|
||||||
protected $cashDepositModel;
|
protected $cashDepositModel;
|
||||||
protected $PolicyPremium2Model;
|
protected $PolicyPremium2Model;
|
||||||
|
protected $auditHistory;
|
||||||
|
protected $userModel;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -84,6 +88,8 @@ class EmployeeController extends AdminController
|
|||||||
$this->insurerModel = new InsurerModel();
|
$this->insurerModel = new InsurerModel();
|
||||||
$this->cashDepositModel = new ClientDepositModel();
|
$this->cashDepositModel = new ClientDepositModel();
|
||||||
$this->PolicyPremium2Model = new PolicyPremium2Model();
|
$this->PolicyPremium2Model = new PolicyPremium2Model();
|
||||||
|
$this->auditHistory = new AuditHistoryModel();
|
||||||
|
$this->userModel = new userModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function list()
|
public function list()
|
||||||
@ -372,7 +378,7 @@ class EmployeeController extends AdminController
|
|||||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||||
->join('clients', 'clients.id = client_policy.client_id')
|
->join('clients', 'clients.id = client_policy.client_id')
|
||||||
->orderBy('batch_files.id', 'desc')
|
->orderBy('batch_files.id', 'desc')
|
||||||
->limit(100)
|
->limit(1000)
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
|
|
||||||
@ -1295,7 +1301,7 @@ class EmployeeController extends AdminController
|
|||||||
->orderBy('id', 'desc')
|
->orderBy('id', 'desc')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
// print_r($file); die;
|
// dd($cd_tranction, db_connect()->getLastQuery());
|
||||||
if ($file['action'] == 'inception' || $file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'enrollment' || $file['action'] == 'missed_inception') {
|
if ($file['action'] == 'inception' || $file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'enrollment' || $file['action'] == 'missed_inception') {
|
||||||
|
|
||||||
|
|
||||||
@ -1452,6 +1458,7 @@ class EmployeeController extends AdminController
|
|||||||
->get()
|
->get()
|
||||||
->getResult();
|
->getResult();
|
||||||
|
|
||||||
|
// dd($res);
|
||||||
// print_r($this->empEndorsementModel->getLastQuery());
|
// print_r($this->empEndorsementModel->getLastQuery());
|
||||||
// echo $res[0]->count;die();
|
// echo $res[0]->count;die();
|
||||||
|
|
||||||
@ -1461,14 +1468,15 @@ class EmployeeController extends AdminController
|
|||||||
$this->myLogger->logme('error', 'Event Type : -- {data} --', ['data' => $file['action']]);
|
$this->myLogger->logme('error', 'Event Type : -- {data} --', ['data' => $file['action']]);
|
||||||
|
|
||||||
$transaction_type = 'Credit';
|
$transaction_type = 'Credit';
|
||||||
$cd_amount = $cd_tranction['amount'];
|
$cd_amount = 0;
|
||||||
|
|
||||||
|
if($file['action'] == 'deletion' && $res[0]->count > 0){
|
||||||
|
|
||||||
if($file['action'] == 'deletion'){
|
|
||||||
$transaction_type = 'Debit';
|
$transaction_type = 'Debit';
|
||||||
//get cd amount for the particular file id to reverse entry to the cash deposite for only deletion
|
//get cd amount for the particular file id to reverse entry to the cash deposite for only deletion
|
||||||
$cd_amount_total = $this->employeePolicyModel->getDeletionDataForTruncated($file['id']);
|
$cd_amount_total = $this->employeePolicyModel->getDeletionDataForTruncated($file['id']);
|
||||||
$totalSum = array_sum(array_column($cd_amount_total, 'total'));
|
$totalSum = array_sum(array_column($cd_amount_total, 'total'));
|
||||||
$cd_amount = $totalSum;
|
$cd_amount = $totalSum ?? 0;
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'Deletion CD Amount : {data}', ['data' => $cd_amount]);
|
$this->myLogger->logme('error', 'Deletion CD Amount : {data}', ['data' => $cd_amount]);
|
||||||
}
|
}
|
||||||
@ -1485,7 +1493,7 @@ class EmployeeController extends AdminController
|
|||||||
$this->myLogger->logme('error', 'emp_endorsement table updated');
|
$this->myLogger->logme('error', 'emp_endorsement table updated');
|
||||||
|
|
||||||
//STEP 2:
|
//STEP 2:
|
||||||
if($file['action'] == 'deletion') {
|
if($file['action'] == 'deletion' && $res[0]->count > 0) {
|
||||||
//update the employee policy table reverse the data
|
//update the employee policy table reverse the data
|
||||||
$this->employeePolicyModel->updateEmployeePolicyTruncateReverse($file_id);
|
$this->employeePolicyModel->updateEmployeePolicyTruncateReverse($file_id);
|
||||||
$this->myLogger->logme('error', 'employee_polices table updated for deletion');
|
$this->myLogger->logme('error', 'employee_polices table updated for deletion');
|
||||||
@ -1501,7 +1509,7 @@ class EmployeeController extends AdminController
|
|||||||
$this->myLogger->logme('error', 'files table updated');
|
$this->myLogger->logme('error', 'files table updated');
|
||||||
|
|
||||||
|
|
||||||
if($cd_tranction && $file['action'] != 'correction'){
|
if(!empty($cd_amount) && $file['action'] != 'correction'){
|
||||||
|
|
||||||
$cd_data = [
|
$cd_data = [
|
||||||
'amount' => $cd_amount,
|
'amount' => $cd_amount,
|
||||||
@ -1605,9 +1613,8 @@ class EmployeeController extends AdminController
|
|||||||
$db = db_connect();
|
$db = db_connect();
|
||||||
$query = "
|
$query = "
|
||||||
UPDATE employee_polices
|
UPDATE employee_polices
|
||||||
JOIN employees ON employees.id = employee_polices.employee_id
|
|
||||||
SET employee_polices.status = 'truncated', employee_polices.is_active = 0
|
SET employee_polices.status = 'truncated', employee_polices.is_active = 0
|
||||||
WHERE employees.file_id = $file_id
|
WHERE employee_polices.file_id = $file_id
|
||||||
";
|
";
|
||||||
|
|
||||||
$db->query($query);
|
$db->query($query);
|
||||||
@ -2726,4 +2733,46 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getEmpHistory(){
|
||||||
|
|
||||||
|
$emp_id = $this->request->getPost('emp_id');
|
||||||
|
|
||||||
|
$data['emp_history'] = $this->auditHistory->select('field_name,old_value,new_value,created_by,created_at')->where('pk',$emp_id)->where('table_name','employees')->orderBy('created_at', 'DESC')->findAll();
|
||||||
|
|
||||||
|
foreach ($data['emp_history'] as &$emp_history) {
|
||||||
|
$emp_history['field_name'] = $this->formatFieldName($emp_history['field_name']);
|
||||||
|
$user = $emp_history['created_by'];
|
||||||
|
if ($user != null && $user != ''){
|
||||||
|
$userData = $this->userModel->select('first_name, last_name')->where('id', $user)->where('is_active', 1)->first();
|
||||||
|
$emp_history['created_by'] = ucwords($userData['first_name'] . ' ' . $userData['last_name']);
|
||||||
|
}else{
|
||||||
|
$emp_history['created_by'] = '-';
|
||||||
|
}
|
||||||
|
|
||||||
|
$emp_history['created_at'] = date("d-m-Y H:i:s", strtotime($emp_history['created_at']));
|
||||||
|
}
|
||||||
|
unset($emp_history);
|
||||||
|
|
||||||
|
$emp_pol_pk = $this->employeePolicyModel->select('id')->where('employee_id',$emp_id)->first()['id'];
|
||||||
|
$data['emp_pol_history'] = $this->auditHistory->select('field_name,old_value,new_value,created_by,created_at')->where('pk',$emp_pol_pk)->where('table_name','employee_polices')->findAll();
|
||||||
|
|
||||||
|
return $this->respond(['status' => true, 'data' => $data],200);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function formatFieldName($unformattedString){
|
||||||
|
|
||||||
|
if (str_contains($unformattedString, '_')) {
|
||||||
|
$data = str_replace('_', ' ', $unformattedString);
|
||||||
|
}else{
|
||||||
|
$data = $unformattedString;
|
||||||
|
}
|
||||||
|
|
||||||
|
$format = ucwords($data);
|
||||||
|
|
||||||
|
return $format;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2502,7 +2502,7 @@ class EmployeeRestController extends AdminController
|
|||||||
function getEmployeeActiveOrInactivePolicy()
|
function getEmployeeActiveOrInactivePolicy()
|
||||||
{
|
{
|
||||||
if($this->request->getGet('type') == 'Active'){ $policy_status = 1; }else{ $policy_status = 0; }
|
if($this->request->getGet('type') == 'Active'){ $policy_status = 1; }else{ $policy_status = 0; }
|
||||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policy_type.policy_type as policy_type,insurers.name as insurer_name,tpa.name as tpa_name,tpa.network_hospitals as network_hospitals_url')
|
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policy_type.policy_type as policy_type,insurers.name as insurer_name,tpa.name as tpa_name,tpa.network_hospitals as network_hospitals_url, policy_type.long_name as policy_long_name')
|
||||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||||
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
|
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
|
||||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||||
@ -2534,17 +2534,34 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
$terms = json_decode($ClientPolicyValue['policy_terms']);
|
|
||||||
|
|
||||||
if($ClientPolicyValue['policy_type_id'] == 1)
|
if($ClientPolicyValue['policy_type_id'] == 1)
|
||||||
{
|
{
|
||||||
$data['policy_terms'] = $this->policyTermsFiter($terms,'gpa');
|
$policyGroup = 'gpa';
|
||||||
$data['department_id'] = 3;
|
$data['ticket_type_id'] = 2;
|
||||||
}else{
|
}else if($ClientPolicyValue['policy_type_id'] == 6)
|
||||||
$data['policy_terms'] = $this->policyTermsFiter($terms,'gmc');
|
{
|
||||||
$data['department_id'] = 4;
|
$policyGroup = 'gpa';
|
||||||
|
$data['ticket_type_id'] = 3;
|
||||||
|
}else if($ClientPolicyValue['policy_type_id'] == 7)
|
||||||
|
{
|
||||||
|
$policyGroup = 'gpa';
|
||||||
|
$data['ticket_type_id'] = 4;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
$policyGroup = 'gmc';
|
||||||
|
$data['ticket_type_id'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$terms = json_decode($ClientPolicyValue['policy_terms'] , true);
|
||||||
|
$data['policy_terms'] = isset($terms['enrollment_display_key'])
|
||||||
|
&& !empty($terms['enrollment_display_key'])
|
||||||
|
? $terms['enrollment_display_key']
|
||||||
|
: $this->policyTermsFiter($terms, $policyGroup);
|
||||||
|
$terms = json_decode($ClientPolicyValue['policy_terms']);
|
||||||
|
|
||||||
|
|
||||||
$data['client_id'] = $ClientPolicyValue['client_id'];
|
$data['client_id'] = $ClientPolicyValue['client_id'];
|
||||||
$data['client_policy_id'] = $ClientPolicyValue['id'];
|
$data['client_policy_id'] = $ClientPolicyValue['id'];
|
||||||
$data['policy_name'] = $ClientPolicyValue['policy_type'];
|
$data['policy_name'] = $ClientPolicyValue['policy_type'];
|
||||||
@ -2555,13 +2572,15 @@ class EmployeeRestController extends AdminController
|
|||||||
$data['network_hospitals_url'] = $ClientPolicyValue['network_hospitals_url'];
|
$data['network_hospitals_url'] = $ClientPolicyValue['network_hospitals_url'];
|
||||||
$data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']);
|
$data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']);
|
||||||
$data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']);
|
$data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']);
|
||||||
|
$data['heading'] = $ClientPolicyValue['policy_long_name'];
|
||||||
// $data['policy_terms'] = $terms;
|
// $data['policy_terms'] = $terms;
|
||||||
|
|
||||||
if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else
|
// if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else
|
||||||
if($ClientPolicyValue['policy_type_id'] == 2){ $data['heading'] = 'Group Medical Coverage'; }else
|
// if($ClientPolicyValue['policy_type_id'] == 2){ $data['heading'] = 'Group Medical Coverage'; }else
|
||||||
if($ClientPolicyValue['policy_type_id'] == 3){ $data['heading'] = 'Group Medical Coverage - Parents'; }else
|
// if($ClientPolicyValue['policy_type_id'] == 3){ $data['heading'] = 'Group Medical Coverage - Parents'; }else
|
||||||
if($ClientPolicyValue['policy_type_id'] == 4){ $data['heading'] = 'Group Medical Coverage - Top Up'; }else
|
// if($ClientPolicyValue['policy_type_id'] == 4){ $data['heading'] = 'Group Medical Coverage - Top Up'; }else
|
||||||
if($ClientPolicyValue['policy_type_id'] == 5){ $data['heading'] = 'Group Medical Coverage - Parents (Top Up)'; }
|
// if($ClientPolicyValue['policy_type_id'] == 5){ $data['heading'] = 'Group Medical Coverage - Parents (Top Up)'; }else
|
||||||
|
// if($ClientPolicyValue['policy_type_id'] == 7){ $data['heading'] = 'Group Term Life Insurance'; }
|
||||||
|
|
||||||
if($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 6 || $ClientPolicyValue['policy_type_id'] == 7)
|
if($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 6 || $ClientPolicyValue['policy_type_id'] == 7)
|
||||||
{
|
{
|
||||||
@ -2718,8 +2737,6 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $finalarray;
|
return $finalarray;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3101,16 +3118,20 @@ class EmployeeRestController extends AdminController
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get Data from post for inserting ticket and message
|
//Get Data from post for inserting ticket and message
|
||||||
public function initiateClaim()
|
public function initiateClaim()
|
||||||
{
|
{
|
||||||
|
|
||||||
$received_data = $this->request->getPost();
|
$received_data = $this->request->getPost();
|
||||||
|
// print_r($received_data); die;
|
||||||
$employee_id = $received_data['emp_id'];
|
$employee_id = $received_data['emp_id'];
|
||||||
$client_policy_id = $received_data['client_policy_id'];
|
$client_policy_id = $received_data['client_policy_id'];
|
||||||
$insured_emp_id = $received_data['insured_emp_id'];
|
$insured_emp_id = $received_data['insured_emp_id'];
|
||||||
|
|
||||||
$sql = "select cp.policy_type_id as ticket_type_id,
|
$sql = "
|
||||||
|
select
|
||||||
|
cp.policy_type_id,
|
||||||
cl_rm.user_id as acm_id,
|
cl_rm.user_id as acm_id,
|
||||||
cp.insurer_id as insurer_id,
|
cp.insurer_id as insurer_id,
|
||||||
cp.tpa_id as tpa_id,
|
cp.tpa_id as tpa_id,
|
||||||
@ -3124,9 +3145,15 @@ class EmployeeRestController extends AdminController
|
|||||||
emp.mobile as emp_mobile,
|
emp.mobile as emp_mobile,
|
||||||
empl.id as insured_emp_id,
|
empl.id as insured_emp_id,
|
||||||
empl.name as insured_name,
|
empl.name as insured_name,
|
||||||
empl.relationship
|
empl.relationship,
|
||||||
|
|
||||||
|
|
||||||
|
CASE
|
||||||
|
WHEN cp.policy_type_id IN (2, 3, 4, 5) THEN 1
|
||||||
|
WHEN cp.policy_type_id = 1 THEN 2
|
||||||
|
WHEN cp.policy_type_id = 6 THEN 3
|
||||||
|
WHEN cp.policy_type_id = 7 THEN 4
|
||||||
|
ELSE NULL
|
||||||
|
END AS ticket_type_id
|
||||||
|
|
||||||
from employees emp
|
from employees emp
|
||||||
|
|
||||||
@ -3138,16 +3165,42 @@ class EmployeeRestController extends AdminController
|
|||||||
where emp.id = $employee_id and emp.is_active = 1 and emp.emp_status = 'active'
|
where emp.id = $employee_id and emp.is_active = 1 and emp.emp_status = 'active'
|
||||||
limit 1 ";
|
limit 1 ";
|
||||||
|
|
||||||
$fetchData = $this->employeeModel->query($sql)->getResultArray()[0];
|
$emp_ticket_data = $this->employeeModel->query($sql)->getResultArray();
|
||||||
$fetchData['claim_status_id'] = $this->claimStatusModel->select('id')->where('ticket_type', $fetchData['ticket_type_id'])->first()['id'];
|
// print_r(db_connect()->getLastQuery()); die;
|
||||||
|
|
||||||
|
if(!empty($emp_ticket_data)){
|
||||||
|
|
||||||
|
$fetchData = $emp_ticket_data[0];
|
||||||
|
$fetchData['claim_status_id'] = $this->claimStatusModel
|
||||||
|
->select('id')
|
||||||
|
->where('ticket_type', $fetchData['ticket_type_id'])
|
||||||
|
->orderBy('id', 'asc')
|
||||||
|
->first()['id'];
|
||||||
|
|
||||||
$fetchData['priority'] = 1;
|
$fetchData['priority'] = 1;
|
||||||
$fetchData['mode_of_intimation'] = 1;
|
$fetchData['mode_of_intimation'] = 1;
|
||||||
$fetchData['hospital_name'] = $received_data['hospital_name'];
|
$fetchData = array_merge($fetchData, $received_data);
|
||||||
|
|
||||||
|
// print_r($fetchData); die;
|
||||||
$insert_status = $this->ticketMaster->insert($fetchData);
|
$insert_status = $this->ticketMaster->insert($fetchData);
|
||||||
$ticket_id = $this->ticketMaster->insertID();
|
$ticket_id = $this->ticketMaster->insertID();
|
||||||
|
|
||||||
if ($insert_status && !empty($ticket_id)) {
|
if ($insert_status && !empty($ticket_id)) {
|
||||||
|
|
||||||
|
$messagesData = [
|
||||||
|
'ticket_id' => $ticket_id ?? null,
|
||||||
|
'sender' => 'user',
|
||||||
|
'claim_status' => $fetchData['claim_status_id'] ?? null,
|
||||||
|
'emp_mail' => $fetchData['emp_mail'] ?? null,
|
||||||
|
'mail_subject' => $fetchData['subject'] ?? null,
|
||||||
|
'mail_content' => $fetchData['message'] ?? null,
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!empty($messagesData['ticket_id'])) {
|
||||||
|
$TicketMessageModel = new TicketMessageModel();
|
||||||
|
$TicketMessageModel->insert($messagesData);
|
||||||
|
}
|
||||||
|
|
||||||
$mail_sent_status = ($this->ticketController->sendAutoMailTrigger($ticket_id));
|
$mail_sent_status = ($this->ticketController->sendAutoMailTrigger($ticket_id));
|
||||||
if (gettype($mail_sent_status) == 'array') {
|
if (gettype($mail_sent_status) == 'array') {
|
||||||
$message = 'Claim Iniated Successfully';
|
$message = 'Claim Iniated Successfully';
|
||||||
@ -3184,7 +3237,76 @@ class EmployeeRestController extends AdminController
|
|||||||
$message = 'Something Went Wrong';
|
$message = 'Something Went Wrong';
|
||||||
return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200);
|
return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
return $this->response->setJSON(['status' => false, 'code' => 200, 'message' => 'The employee is not active.'])->setStatusCode(404);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//department
|
||||||
|
public function get_ticket_type()
|
||||||
|
{
|
||||||
|
$ticket_type = $this->ticketController->ticketType;
|
||||||
|
$ticket_type = array_map(fn($value, $key) => (object) ['id' => $key, 'name' => $value], array_values($ticket_type), array_keys($ticket_type));
|
||||||
|
// print_r($ticket_type); die;
|
||||||
|
return $this->response->setJSON(['ticket_type' => $ticket_type])->setStatusCode(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
//ticket data
|
||||||
|
public function get_ticket_data()
|
||||||
|
{
|
||||||
|
$priorityType = $this->ticketController->priorityType;
|
||||||
|
$modeOFIntimate = $this->ticketController->modeOFIntimate;
|
||||||
|
$claimType = $this->ticketController->claimType;
|
||||||
|
$relationshipType = $this->ticketController->relationshipType;
|
||||||
|
$ticketTypeArray = $this->ticketController->ticketType;
|
||||||
|
|
||||||
|
|
||||||
|
$emp_id = $this->request->getGet('emp_id');
|
||||||
|
$ticket_type = $this->request->getGet('ticket_type') ?? null;
|
||||||
|
$ticket_id = $this->request->getGet('ticket_id') ?? null;
|
||||||
|
// dd($emp_id);
|
||||||
|
|
||||||
|
if (empty($emp_id)) {
|
||||||
|
return $this->response->setJSON(['status' => false, 'code' => 200, 'message' => 'emp_id is required.'])->setStatusCode(404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$TicketMasterModel = new TicketMasterModel();
|
||||||
|
$ticket_data = $TicketMasterModel->get_ticket_data($emp_id, $ticket_type, $ticket_id);
|
||||||
|
|
||||||
|
if (!empty($ticket_data)) {
|
||||||
|
|
||||||
|
$client_claim_status = [
|
||||||
|
'Received' => [1, 2, 3, 4, 15, 16, 17, 18, 25, 26, 27, 28, 35, 36, 37, 38],
|
||||||
|
'Rejected' => [8, 49, 55, 60],
|
||||||
|
'Cancelled' => [13, 47, 53, 58],
|
||||||
|
'Returned' => [14, 48, 54, 59],
|
||||||
|
'Closed' => [12, 22, 32, 42],
|
||||||
|
'Approved' => [9, 20, 30, 40],
|
||||||
|
'Settled' => [11, 24, 34],
|
||||||
|
'Under Process' => [5, 6, 7, 10, 19, 23, 45, 50, 29, 33, 51, 39, 43, 56],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($ticket_data as $key => $value) {
|
||||||
|
foreach ($client_claim_status as $claim_key => $claim_value) {
|
||||||
|
if (in_array($value['claim_status_id'], $claim_value)) { // Corrected argument order
|
||||||
|
$ticket_data[$key]['claim_status'] = $claim_key ?? null; // Assign back to the main array
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ticket_data[$key]['priority_type'] = $priorityType[$value['priority']] ?? null;
|
||||||
|
$ticket_data[$key]['mode_of_intimate_type'] = $modeOFIntimate[$value['mode_of_intimation']] ?? null;
|
||||||
|
$ticket_data[$key]['relationship_type'] = ucfirst($value['relationship']) ?? null;
|
||||||
|
$claimPrimaryTypey = "1";
|
||||||
|
if (in_array($value['claim_type'], [2, 3, 4])) {
|
||||||
|
$claimPrimaryTypey = "2";
|
||||||
|
}
|
||||||
|
$ticket_data[$key]['claim_type_value'] = $claimType[$claimPrimaryTypey][$value['claim_type']] ?? null;
|
||||||
|
$ticket_data[$key]['ticket_policy_type'] = $ticketTypeArray[$value['ticket_type_id']] ?? null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->response->setJSON(['ticket_data' => $ticket_data])->setStatusCode(200);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2057,6 +2057,8 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
|||||||
}
|
}
|
||||||
$value['family_floater_key'] = $relation;
|
$value['family_floater_key'] = $relation;
|
||||||
|
|
||||||
|
// dd($value['family_floater_key']);
|
||||||
|
|
||||||
$policy_data['basic_cover_si'] = $row[9];
|
$policy_data['basic_cover_si'] = $row[9];
|
||||||
$policy_data['date_coverage'] = $row[13] != "" && $row[13] != null ? change_date_format($row[13],'d-M-Y','Y-m-d') : null;
|
$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'];
|
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||||
|
|||||||
@ -12,6 +12,8 @@ use PhpOffice\PhpSpreadsheet\Style\Border;
|
|||||||
use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
||||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
use PhpOffice\PhpSpreadsheet\Style\Fill;
|
use PhpOffice\PhpSpreadsheet\Style\Fill;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||||
|
|
||||||
use App\Models\UserModel;
|
use App\Models\UserModel;
|
||||||
use App\Models\ClientModel;
|
use App\Models\ClientModel;
|
||||||
@ -31,7 +33,7 @@ use App\Helpers\MailHelper;
|
|||||||
use App\Helpers\ExcelMergeHelper;
|
use App\Helpers\ExcelMergeHelper;
|
||||||
use App\Helpers\ExcelSanitizeHelper;
|
use App\Helpers\ExcelSanitizeHelper;
|
||||||
use Google\Service\CloudSearch\PushItem;
|
use Google\Service\CloudSearch\PushItem;
|
||||||
use Kint;
|
use Kint\Kint;
|
||||||
|
|
||||||
use App\Controllers\Jobs;
|
use App\Controllers\Jobs;
|
||||||
use App\Controllers\JobWorker;
|
use App\Controllers\JobWorker;
|
||||||
@ -64,6 +66,9 @@ class LeadsController extends BaseController
|
|||||||
protected $clientType;
|
protected $clientType;
|
||||||
protected $leadType;
|
protected $leadType;
|
||||||
protected $leadsStatus;
|
protected $leadsStatus;
|
||||||
|
protected $claim_type_for_gpa;
|
||||||
|
protected $cause_of_death;
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -96,6 +101,19 @@ class LeadsController extends BaseController
|
|||||||
'completed_with_corrections' => 'Completed with Corrections',
|
'completed_with_corrections' => 'Completed with Corrections',
|
||||||
'completed_without_corrections' => 'Completed w/o Corrections',
|
'completed_without_corrections' => 'Completed w/o Corrections',
|
||||||
];
|
];
|
||||||
|
$this->claim_type_for_gpa = [
|
||||||
|
'accident_death' => 'Accident Death',
|
||||||
|
'permanent_total_disablement' => 'Permanent Total Disablement',
|
||||||
|
'permanent_partial_disablement' => 'Permanent Partial Disablement',
|
||||||
|
'temporary_total_disablement_benefit' => 'Temporary Total Disablement benefit'
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->cause_of_death = [
|
||||||
|
'natural_death' => 'Natural Death',
|
||||||
|
'suicide' => 'Suicide',
|
||||||
|
'accident' => 'Accident'
|
||||||
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function viewLeadsList()
|
public function viewLeadsList()
|
||||||
@ -107,6 +125,7 @@ class LeadsController extends BaseController
|
|||||||
// $d = $this->calculateMembersDemography(['lead_id' => 24]);
|
// $d = $this->calculateMembersDemography(['lead_id' => 24]);
|
||||||
//$this->mergeQuoteExcelFileWithMembersListExcelFile(24, 1, $propsal_and_insurer = null);
|
//$this->mergeQuoteExcelFileWithMembersListExcelFile(24, 1, $propsal_and_insurer = null);
|
||||||
// dd($d);
|
// dd($d);
|
||||||
|
|
||||||
$data['page_name'] = 'Leads';
|
$data['page_name'] = 'Leads';
|
||||||
|
|
||||||
// Set basic data
|
// Set basic data
|
||||||
@ -122,7 +141,7 @@ class LeadsController extends BaseController
|
|||||||
// Fetch insurer and TPA branch data
|
// Fetch insurer and TPA branch data
|
||||||
$data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
$data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
||||||
$data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
|
$data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
|
||||||
|
// print_r($data['tpa']);die();
|
||||||
// Fetch sales team members who are active in team 5
|
// Fetch sales team members who are active in team 5
|
||||||
$data['salse_team'] = $this->userModel
|
$data['salse_team'] = $this->userModel
|
||||||
->select('user_profiles.*')
|
->select('user_profiles.*')
|
||||||
@ -133,12 +152,31 @@ class LeadsController extends BaseController
|
|||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
// dd($data);
|
// dd($data);
|
||||||
|
$data['lastFiveYears'] = $this->getLastFiveFinancialYears();
|
||||||
|
$data['gpaClaimType'] = $this->claim_type_for_gpa;
|
||||||
|
$data['causeOfDeath'] = $this->cause_of_death;
|
||||||
|
// dd($lastFiveYears);
|
||||||
|
if ($this->request->is('get')) {
|
||||||
// Fetch leads data
|
// Fetch leads data
|
||||||
$data ['lead_data_list'] = $this->leadsModel->getLeadDataForLising();
|
$data ['lead_data_list'] = $this->leadsModel->getLeadDataForLising();
|
||||||
|
|
||||||
// Load layout and pass data
|
// Load layout and pass data
|
||||||
$this->loadLayout('leads_list', $data);
|
$this->loadLayout('lead_filter', $data);
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$search_data = $this->request->getPost();
|
||||||
|
// print_r($search_data);
|
||||||
|
|
||||||
|
$where = [];
|
||||||
|
foreach ($search_data as $search_objects => $key) {
|
||||||
|
if ($key != null && $key != '' && $key != 0) {
|
||||||
|
$where[$search_objects] = $key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['lead_data_list'] = $this->leadsModel->getLeadDataForLising($where);
|
||||||
|
$html = view('leads_list', $data);
|
||||||
|
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createLead()
|
public function createLead()
|
||||||
@ -198,6 +236,8 @@ class LeadsController extends BaseController
|
|||||||
// Separate the insurer and insurer branch, handle missing or invalid data
|
// Separate the insurer and insurer branch, handle missing or invalid data
|
||||||
if (isset($data['insurer'][$index]) && strpos($data['insurer'][$index], '-') !== false) {
|
if (isset($data['insurer'][$index]) && strpos($data['insurer'][$index], '-') !== false) {
|
||||||
list($insurer_branch_id, $insurer_id) = explode('-', $data['insurer'][$index]);
|
list($insurer_branch_id, $insurer_id) = explode('-', $data['insurer'][$index]);
|
||||||
|
|
||||||
|
}else{
|
||||||
$insurer_branch_id = 0;
|
$insurer_branch_id = 0;
|
||||||
$insurer_id = 0;
|
$insurer_id = 0;
|
||||||
}
|
}
|
||||||
@ -253,7 +293,18 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
$last_3_years_claims = null;
|
$last_3_years_claims = null;
|
||||||
if($value != 2){
|
if($value != 2){
|
||||||
$last_3_years_claims = $data['finyear'];
|
$last_3_years_claims = [];
|
||||||
|
$finyear = json_decode($data['finyear']);
|
||||||
|
|
||||||
|
foreach ($finyear as $year){
|
||||||
|
$received_policy_type = ($year->finyear[0]->policy_type);
|
||||||
|
if ($value == $received_policy_type){
|
||||||
|
array_push($last_3_years_claims,$year);
|
||||||
|
}else{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$last_3_years_claims = json_encode($last_3_years_claims);
|
||||||
}
|
}
|
||||||
|
|
||||||
$processedData[] = [
|
$processedData[] = [
|
||||||
@ -321,7 +372,7 @@ class LeadsController extends BaseController
|
|||||||
'notes' => $data['notes'] ?? null,
|
'notes' => $data['notes'] ?? null,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
// print_r($processedData);die();
|
||||||
return $processedData;
|
return $processedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,7 +469,9 @@ class LeadsController extends BaseController
|
|||||||
->where('lead_id', $id)
|
->where('lead_id', $id)
|
||||||
// ->where('type', $type)
|
// ->where('type', $type)
|
||||||
->where('is_active', 1)
|
->where('is_active', 1)
|
||||||
|
->orderBy('id', 'desc')
|
||||||
->first();
|
->first();
|
||||||
|
// dd($data);
|
||||||
|
|
||||||
$data['rfq_count'] = $this->RFQModel
|
$data['rfq_count'] = $this->RFQModel
|
||||||
->where('lead_id', $id)
|
->where('lead_id', $id)
|
||||||
@ -436,8 +489,15 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
$data['lead_id'] = $id;
|
$data['lead_id'] = $id;
|
||||||
$lead_data = $this->leadsModel
|
$lead_data = $this->leadsModel
|
||||||
->select('leads.*, policy_type.question_json, policy_type.policy_type')
|
->select('
|
||||||
|
leads.*,
|
||||||
|
policy_type.question_json,
|
||||||
|
policy_type.policy_type,
|
||||||
|
policy_type.long_name,
|
||||||
|
user_profiles.email as created_person_email
|
||||||
|
')
|
||||||
->join('policy_type', 'leads.policy_type_id = policy_type.id')
|
->join('policy_type', 'leads.policy_type_id = policy_type.id')
|
||||||
|
->join('user_profiles', 'leads.created_by = user_profiles.id', 'left')
|
||||||
->where('leads.id', $id)
|
->where('leads.id', $id)
|
||||||
->where('leads.is_active', 1)
|
->where('leads.is_active', 1)
|
||||||
->first();
|
->first();
|
||||||
@ -455,7 +515,21 @@ class LeadsController extends BaseController
|
|||||||
$data['userList'] = $this->userModel->getUserListForRFQ();
|
$data['userList'] = $this->userModel->getUserListForRFQ();
|
||||||
$data['lead_data'] = $lead_data;
|
$data['lead_data'] = $lead_data;
|
||||||
|
|
||||||
$data['mail_content'] = $this->transformMailContent($id);
|
$mail_content = "
|
||||||
|
<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>
|
||||||
|
";
|
||||||
|
|
||||||
|
|
||||||
|
$subject = "{{CLIENT_NAME}} _ {{POLICY_TYPE}} _ {{RFQ_OR_QCR}} _ {{POLICY_YEAR}}";
|
||||||
|
|
||||||
|
$data['mail_content'] = $this->transformMailContent($lead_data, $mail_content, $data['page_name']);
|
||||||
|
$data['subject'] = $this->transformMailContent($lead_data, $subject, $data['page_name']);
|
||||||
|
|
||||||
|
|
||||||
// dd($data);
|
// dd($data);
|
||||||
$this->loadLayout('view_rfq.php', $data);
|
$this->loadLayout('view_rfq.php', $data);
|
||||||
@ -604,7 +678,6 @@ class LeadsController extends BaseController
|
|||||||
'TPA ' => $rfq_data['tpa_name'],
|
'TPA ' => $rfq_data['tpa_name'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if ($rfq_data['policy_type_id'] == 2) {
|
if ($rfq_data['policy_type_id'] == 2) {
|
||||||
$lead_data = [
|
$lead_data = [
|
||||||
@ -648,6 +721,7 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data = json_decode($rfq_data['json'], true);
|
$data = json_decode($rfq_data['json'], true);
|
||||||
|
// dd($data);
|
||||||
|
|
||||||
if ($type == 2) {
|
if ($type == 2) {
|
||||||
$data = $this->convertJsonForQCR($data, $type);
|
$data = $this->convertJsonForQCR($data, $type);
|
||||||
@ -663,17 +737,123 @@ class LeadsController extends BaseController
|
|||||||
$spreadsheet = new Spreadsheet();
|
$spreadsheet = new Spreadsheet();
|
||||||
$sheet = $spreadsheet->getActiveSheet();
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
|
|
||||||
// Start with lead_data at the top
|
// Start with lead_data at the top
|
||||||
$rowNumber = 1;
|
$rowNumber = 1;
|
||||||
|
|
||||||
|
$mergeRange1 = "A{$rowNumber}:C{$rowNumber}";
|
||||||
|
$sheet->mergeCells($mergeRange1);
|
||||||
|
$sheet->setCellValue("A{$rowNumber}", "Nhance India Insurance Broking Pvt Ltd");
|
||||||
|
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
||||||
|
'font' => [
|
||||||
|
'bold' => true,
|
||||||
|
'size' => 20
|
||||||
|
],
|
||||||
|
'alignment' => [
|
||||||
|
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
|
||||||
|
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Set column width to fit the image properly
|
||||||
|
$sheet->getColumnDimension('D')->setWidth(20); // Adjust as needed
|
||||||
|
$sheet->getRowDimension($rowNumber)->setRowHeight(40); // Adjust as needed
|
||||||
|
|
||||||
|
$drawing = new Drawing();
|
||||||
|
$path = ROOTPATH . "public/assets/images/Nhance-Logo-Final.png"; // Use FCPATH for server path
|
||||||
|
$drawing->setPath($path);
|
||||||
|
$drawing->setCoordinates("D{$rowNumber}"); // Set position in column B
|
||||||
|
$drawing->setHeight(35); // Adjust image height
|
||||||
|
|
||||||
|
// Center align the image in the cell
|
||||||
|
$drawing->setOffsetX(30); // Adjust horizontal offset
|
||||||
|
$drawing->setOffsetY(5); // Adjust vertical offset
|
||||||
|
|
||||||
|
$drawing->setWorksheet($sheet);
|
||||||
|
|
||||||
|
// Apply center alignment to the cell
|
||||||
|
$sheet->getStyle("D{$rowNumber}")->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||||
|
$sheet->getStyle("D{$rowNumber}")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
||||||
|
|
||||||
|
|
||||||
|
$rowNumber = $rowNumber + 1;
|
||||||
|
|
||||||
|
// Initialize max width tracking variables
|
||||||
|
$maxWidthA = 0;
|
||||||
|
$maxWidthB = 0;
|
||||||
|
|
||||||
foreach ($lead_data as $key => $value) {
|
foreach ($lead_data as $key => $value) {
|
||||||
|
|
||||||
|
// Merge A:B for key and C:D for value
|
||||||
|
$mergeRangeKey = "A{$rowNumber}:B{$rowNumber}";
|
||||||
|
$mergeRangeValue = "C{$rowNumber}:D{$rowNumber}";
|
||||||
|
$sheet->mergeCells($mergeRangeKey);
|
||||||
|
$sheet->mergeCells($mergeRangeValue);
|
||||||
|
|
||||||
|
// Set values in merged cells
|
||||||
$sheet->setCellValue("A{$rowNumber}", $key);
|
$sheet->setCellValue("A{$rowNumber}", $key);
|
||||||
$sheet->setCellValue("B{$rowNumber}", $value);
|
$sheet->setCellValue("C{$rowNumber}", $value);
|
||||||
$sheet->getStyle("A{$rowNumber}")->applyFromArray(['font' => ['bold' => true]]);
|
|
||||||
|
// Apply styles for alignment and bold text in A:B
|
||||||
|
$sheet->getStyle($mergeRangeKey)->applyFromArray([
|
||||||
|
'font' => ['bold' => true],
|
||||||
|
'alignment' => [
|
||||||
|
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
|
||||||
|
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Apply bold style to B column if the key is "Insured"
|
||||||
|
if ($key == "Insured") {
|
||||||
|
$sheet->getStyle("C{$rowNumber}")->applyFromArray([
|
||||||
|
'font' => ['bold' => true],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Track max width needed for columns
|
||||||
|
$maxWidthA = max($maxWidthA, mb_strlen($key));
|
||||||
|
$maxWidthB = max($maxWidthB, mb_strlen($value));
|
||||||
|
|
||||||
$rowNumber++;
|
$rowNumber++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$leadRange = "A1:B" . (count($lead_data));
|
// Set column width based on max content length (adjusted for padding)
|
||||||
$sheet->getStyle($leadRange)->applyFromArray([
|
$sheet->getColumnDimension('A')->setWidth($maxWidthA * 1.2);
|
||||||
|
$sheet->getColumnDimension('B')->setWidth($maxWidthA * 1.2);
|
||||||
|
$sheet->getColumnDimension('C')->setWidth($maxWidthB * 1.2);
|
||||||
|
$sheet->getColumnDimension('D')->setWidth($maxWidthB * 1.2);
|
||||||
|
|
||||||
|
// $rowNumber += 2;
|
||||||
|
|
||||||
|
// Add headers and subheaders
|
||||||
|
$headers = $data['table_data']['headers'];
|
||||||
|
|
||||||
|
$sheet->setCellValue("A{$rowNumber}", "Details of Coverage");
|
||||||
|
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
||||||
|
'font' => [
|
||||||
|
'bold' => true,
|
||||||
|
],
|
||||||
|
'fill' => [
|
||||||
|
'fillType' => Fill::FILL_SOLID,
|
||||||
|
'startColor' => ['rgb' => 'ADD8E6'],
|
||||||
|
],
|
||||||
|
'borders' => [
|
||||||
|
'allBorders' => [
|
||||||
|
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
|
||||||
|
'color' => ['argb' => 'FF000000'], // Black color
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
$subheader_count = array_sum(array_map(fn($header) => count($header['subHeaders']), $data['table_data']['headers']));
|
||||||
|
$subheader_count = $subheader_count - 2;
|
||||||
|
$headerCount = count($data['table_data']['headers']);
|
||||||
|
$lastColumn = Coordinate::stringFromColumnIndex($subheader_count);
|
||||||
|
// dd( $headerCount, $lastColumn);
|
||||||
|
|
||||||
|
// Merge cells from A to the last column
|
||||||
|
$mergeRange = "A{$rowNumber}:{$lastColumn}{$rowNumber}";
|
||||||
|
|
||||||
|
$sheet->getStyle($mergeRange)->applyFromArray([
|
||||||
'borders' => [
|
'borders' => [
|
||||||
'allBorders' => [
|
'allBorders' => [
|
||||||
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
|
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
|
||||||
@ -682,21 +862,25 @@ class LeadsController extends BaseController
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$sheet->mergeCells($mergeRange);
|
||||||
|
$rowNumber = $rowNumber + 1;
|
||||||
|
|
||||||
$rowNumber += 2;
|
|
||||||
|
|
||||||
// Add headers and subheaders
|
|
||||||
$headers = $data['table_data']['headers'];
|
|
||||||
$subHeaderRow = $rowNumber + 1;
|
$subHeaderRow = $rowNumber + 1;
|
||||||
$columnLetter = 'A';
|
$columnLetter = 'A';
|
||||||
|
|
||||||
foreach ($headers as $header) {
|
foreach ($headers as $header) {
|
||||||
|
|
||||||
if (in_array($header['parentHeader'], ['Item Key', 'Action'])) {
|
if (in_array($header['parentHeader'], ['Item Key', 'Action'])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($header['parentHeader'] === 'Sno') {
|
if ($header['parentHeader'] === 'Sno') {
|
||||||
$header['parentHeader'] = 'S.No.';
|
$header['parentHeader'] = 'S.No.';
|
||||||
|
$sheet->getColumnDimension('A')->setWidth(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($header['parentHeader'] === 'Particulars') {
|
||||||
|
$sheet->getColumnDimension('B')->setWidth(40);
|
||||||
}
|
}
|
||||||
|
|
||||||
$startColumn = $columnLetter; // Start of the current header range
|
$startColumn = $columnLetter; // Start of the current header range
|
||||||
@ -723,6 +907,13 @@ class LeadsController extends BaseController
|
|||||||
// Add subheaders
|
// Add subheaders
|
||||||
foreach ($header['subHeaders'] as $subHeader) {
|
foreach ($header['subHeaders'] as $subHeader) {
|
||||||
$sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader);
|
$sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader);
|
||||||
|
|
||||||
|
if ($columnLetter != "A" && $columnLetter != "B" && $columnLetter != "C" && $columnLetter != "D") {
|
||||||
|
$sheet->getColumnDimension($columnLetter)->setWidth(35);
|
||||||
|
} else {
|
||||||
|
$sheet->getColumnDimension('A')->setWidth(10);
|
||||||
|
}
|
||||||
|
|
||||||
$sheet->getStyle("{$columnLetter}{$subHeaderRow}")->applyFromArray([
|
$sheet->getStyle("{$columnLetter}{$subHeaderRow}")->applyFromArray([
|
||||||
'font' => ['bold' => true],
|
'font' => ['bold' => true],
|
||||||
'alignment' => [
|
'alignment' => [
|
||||||
@ -746,12 +937,13 @@ class LeadsController extends BaseController
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Increase row height for headers and subheaders
|
// Increase row height for headers and subheaders
|
||||||
$sheet->getRowDimension($rowNumber)->setRowHeight(30); // Header row height
|
$sheet->getRowDimension($rowNumber)->setRowHeight(25); // Header row height
|
||||||
$sheet->getRowDimension($subHeaderRow)->setRowHeight(25); // Subheader row height
|
$sheet->getRowDimension($subHeaderRow)->setRowHeight(20); // Subheader row height
|
||||||
|
|
||||||
$rowNumber = $subHeaderRow + 2;
|
$rowNumber = $subHeaderRow + 2;
|
||||||
$column_data = $data['table_data']['data'];
|
$column_data = $data['table_data']['data'];
|
||||||
$serial_no = 1;
|
$serial_no = 1;
|
||||||
|
$maxColumnWidths = [];
|
||||||
|
|
||||||
// Add table data rows
|
// Add table data rows
|
||||||
foreach ($column_data as $dataRow) {
|
foreach ($column_data as $dataRow) {
|
||||||
@ -789,6 +981,7 @@ class LeadsController extends BaseController
|
|||||||
$rowNumber += 2;
|
$rowNumber += 2;
|
||||||
|
|
||||||
// Add premium data
|
// Add premium data
|
||||||
|
// dd($data);
|
||||||
$labelArray = ["Premium", "GST (%)", "GST Amount (₹)", "Total"];
|
$labelArray = ["Premium", "GST (%)", "GST Amount (₹)", "Total"];
|
||||||
$premiumData = $data['premium_data']['data'];
|
$premiumData = $data['premium_data']['data'];
|
||||||
$premium = [$labelArray[0]];
|
$premium = [$labelArray[0]];
|
||||||
@ -819,7 +1012,8 @@ class LeadsController extends BaseController
|
|||||||
$rowNumber++;
|
$rowNumber++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$premiumRange = "B" . ($rowNumber - 3) . ":" . chr(ord($columnLetter) - 1) . ($rowNumber - 1);
|
$premiumRange = "B" . ($rowNumber - 4) . ":" . chr(ord($columnLetter) - 2) . ($rowNumber - 1);
|
||||||
|
// dd($premiumRange);
|
||||||
$sheet->getStyle($premiumRange)->applyFromArray([
|
$sheet->getStyle($premiumRange)->applyFromArray([
|
||||||
'borders' => [
|
'borders' => [
|
||||||
'allBorders' => [
|
'allBorders' => [
|
||||||
@ -831,10 +1025,53 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Auto-size columns
|
// Auto-size columns
|
||||||
foreach ($sheet->getColumnIterator() as $column) {
|
// foreach ($sheet->getColumnIterator() as $column) {
|
||||||
$sheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true);
|
// $sheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true);
|
||||||
|
// }
|
||||||
|
|
||||||
|
$dataRange = $sheet->calculateWorksheetDimension();
|
||||||
|
|
||||||
|
$sheet->getStyle($dataRange)->getAlignment()
|
||||||
|
->setHorizontal(Alignment::HORIZONTAL_CENTER)
|
||||||
|
->setVertical(Alignment::VERTICAL_CENTER)
|
||||||
|
->setWrapText(true);
|
||||||
|
|
||||||
|
$sheet->getStyle('A1')->applyFromArray([
|
||||||
|
'alignment' => [
|
||||||
|
'wrapText' => false, // Disables text wrapping for A1
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Apply border to the entire sheet
|
||||||
|
preg_match('/([A-Z]+)(\d+):([A-Z]+)(\d+)/', $dataRange, $matches);
|
||||||
|
|
||||||
|
if ($matches) {
|
||||||
|
$startColumn = $matches[1]; // A
|
||||||
|
$startRow = $matches[2]; // 1
|
||||||
|
$endColumn = $matches[3]; // G
|
||||||
|
$endRow = $matches[4]; // 75
|
||||||
|
|
||||||
|
// Convert column letter to index, reduce by 1, and convert back
|
||||||
|
$endColumnIndex = Coordinate::columnIndexFromString($endColumn) - 1;
|
||||||
|
$newEndColumn = Coordinate::stringFromColumnIndex($endColumnIndex);
|
||||||
|
|
||||||
|
// Generate the new range (e.g., "A1:F75" instead of "A1:G75")
|
||||||
|
$newDataRange = "{$startColumn}{$startRow}:{$newEndColumn}{$endRow}";
|
||||||
|
// $sheet->getStyle($newDataRange)->getBorders()->getAllBorders()->setBorderStyle(Border::BORDER_THIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$lastRow = count($lead_data) + 1;
|
||||||
|
$leadRange = "A1:D{$lastRow}";
|
||||||
|
|
||||||
|
$sheet->getStyle($leadRange)->applyFromArray([
|
||||||
|
'borders' => [
|
||||||
|
'allBorders' => [
|
||||||
|
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
|
||||||
|
'color' => ['argb' => 'FF000000'], // Black color
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
// Set filename
|
// Set filename
|
||||||
$string = ($type == 2) ? 'QCR' : 'RFQ';
|
$string = ($type == 2) ? 'QCR' : 'RFQ';
|
||||||
$filename = "{$string}_{$rfq_data['client_short_name']}_{$rfq_data['policy_type']}_" . date('YmdHis') . '.xlsx';
|
$filename = "{$string}_{$rfq_data['client_short_name']}_{$rfq_data['policy_type']}_" . date('YmdHis') . '.xlsx';
|
||||||
@ -1405,10 +1642,11 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// dd($lead_data);
|
// dd($lead_data);
|
||||||
$reply_to = $lead_data['created_person_email'];
|
$reply_to = $lead_data['created_person_email'] ?? "";
|
||||||
|
|
||||||
//get file path to attach
|
//get file path to attach
|
||||||
$file_info = $this->constructExcelToSaveTemp($lead_id, ($file_type == 'rfq' ? 1 : 2), $propsal_and_insurer);
|
$file_info = $this->constructExcelToSaveTemp($lead_id, ($file_type == 'rfq' ? 1 : 2), $propsal_and_insurer);
|
||||||
|
log_message('error','File Info'.json_encode($file_info));
|
||||||
if ($lead_data['file_name'] != null && $lead_data['file_name'] != '') {
|
if ($lead_data['file_name'] != null && $lead_data['file_name'] != '') {
|
||||||
$temp_file_path = $file_info['filePath'];
|
$temp_file_path = $file_info['filePath'];
|
||||||
$temp_file_name = $file_info['fileName'];
|
$temp_file_name = $file_info['fileName'];
|
||||||
@ -1422,8 +1660,11 @@ class LeadsController extends BaseController
|
|||||||
$result = ExcelMergeHelper::mergeExcelFiles($filePaths, $outputPath);
|
$result = ExcelMergeHelper::mergeExcelFiles($filePaths, $outputPath);
|
||||||
// print_rr($result);
|
// print_rr($result);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
$result = $file_info['filePath'];
|
||||||
|
// return $this->respond(['status' => 'fail', 'code' => 200, 'messgae' => 'File Not Found'], 200);
|
||||||
}
|
}
|
||||||
// print_rr($lead_data);
|
// print_rr($result); die;
|
||||||
// print_rr($file_info);
|
// print_rr($file_info);
|
||||||
// $file_path = WRITEPATH."uploads/excel/sample/correction.xls";
|
// $file_path = WRITEPATH."uploads/excel/sample/correction.xls";
|
||||||
// $file_name = $file_type.'.xlsx';
|
// $file_name = $file_type.'.xlsx';
|
||||||
@ -1478,8 +1719,10 @@ class LeadsController extends BaseController
|
|||||||
$message = str_replace("{{DURATION}}", calculate_days_bw_dates($lead_data['policy_end_date'] ?? "", $lead_data['policy_start_date'] ?? "")->days, $message) ?? '--';
|
$message = str_replace("{{DURATION}}", calculate_days_bw_dates($lead_data['policy_end_date'] ?? "", $lead_data['policy_start_date'] ?? "")->days, $message) ?? '--';
|
||||||
|
|
||||||
// print_rr($message);calculate_days_bw_dates
|
// print_rr($message);calculate_days_bw_dates
|
||||||
|
$string = implode(", ", $cc_mails);
|
||||||
|
$bcc_string = implode(", ", $bcc_mails);
|
||||||
|
|
||||||
$res = MailHelper::send_email(['mail' => $recipient['email'], 'cc' => $cc_mails, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_mails]);
|
$res = MailHelper::send_email(['mail' => $recipient['email'], 'cc' => $string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string]);
|
||||||
// !dd($res);
|
// !dd($res);
|
||||||
$result_data[] = ['mail' => $recipient['email'], 'status' => $res];
|
$result_data[] = ['mail' => $recipient['email'], 'status' => $res];
|
||||||
}
|
}
|
||||||
@ -2036,54 +2279,117 @@ class LeadsController extends BaseController
|
|||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
public function transformMailContent($lead_id)
|
// public function transformMailContent($lead_id, $page_name)
|
||||||
{
|
// {
|
||||||
helper('excel_util_helper');
|
// helper('excel_util_helper');
|
||||||
// $params = $this->request->getGet();
|
// // $params = $this->request->getGet();
|
||||||
|
|
||||||
// print_r($params); die;
|
// // print_r($params); die;
|
||||||
// $lead_id = $params['lead_id'];
|
// // $lead_id = $params['lead_id'];
|
||||||
// $file_type = $params['file_type']; //rfq or qcr
|
// // $file_type = $params['file_type']; //rfq or qcr
|
||||||
// $recipient_type = $params['recipient_type']; //insurer or client or internal or placement
|
// // $recipient_type = $params['recipient_type']; //insurer or client or internal or placement
|
||||||
// $recipient_mail = $params['recipient_mail']; // - only primary key of contacts
|
// // $recipient_mail = $params['recipient_mail']; // - only primary key of contacts
|
||||||
// $propsal_and_insurer = isset($params['proposal_insurer']) ? $params['proposal_insurer'] : null;
|
// // $propsal_and_insurer = isset($params['proposal_insurer']) ? $params['proposal_insurer'] : null;
|
||||||
|
|
||||||
// if ($recipient_type == 'insurer' && empty($recipient_mail)) {
|
// // if ($recipient_type == 'insurer' && empty($recipient_mail)) {
|
||||||
// return $this->respond(['status' => 'failed', 'code' => 400, 'data' => '', 'messgae' => 'Recipient mail not found ! '], 200);
|
// // return $this->respond(['status' => 'failed', 'code' => 400, 'data' => '', 'messgae' => 'Recipient mail not found ! '], 200);
|
||||||
|
// // }
|
||||||
|
|
||||||
|
// //gather lead info
|
||||||
|
// $lead_data = $this->leadsModel
|
||||||
|
// ->select('leads.*,policy_type.long_name,policy_type.policy_type,user_profiles.email as created_person_email')
|
||||||
|
// ->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
|
||||||
|
// ->join('user_profiles', 'leads.created_by = user_profiles.id', 'left')
|
||||||
|
// ->where('leads.id', $lead_id)
|
||||||
|
// ->first();
|
||||||
|
|
||||||
|
// // dd($lead_data);
|
||||||
|
|
||||||
|
// if($lead_data){
|
||||||
|
|
||||||
|
// $recipient_data = ['name' => "Team"];
|
||||||
|
// // $original_message = '<div style="width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9;font-family:Arial,sans-serif;color:#333;line-height:1.6"><div style=background-color:#4a90e2;color:#fff;padding:15px;text-align:center><h1 style=margin:0;font-size:24px>Request for Quotation (RFQ)</h1></div><div style=padding:20px;background-color:#fff><h2 style=color:#4a90e2;font-size:20px;margin-top:0>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2 style=color:#4a90e2;font-size:20px;margin-top:20px>RFQ Details</h2><table style=width:100%;border-collapse:collapse;margin-top:20px><tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Client name<td style="border:1px solid #ddd;padding:10px;text-align:left">{{CLIENT_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Coverage Type<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_LONG_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Start Date<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_START_DATE}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Duration<td style="border:1px solid #ddd;padding:10px;text-align:left">{{DURATION}}</table><div style="margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic">Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div style=margin-top:20px;font-size:12px;color:#777;text-align:center><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
|
||||||
|
// $original_message = `Dear Sir,
|
||||||
|
|
||||||
|
// Greetings From Nhance India!
|
||||||
|
|
||||||
|
// Please find attached the RFQ for {{POLICY_TYPE}} policy pertaining to {{RECIPIENT_NAME}}
|
||||||
|
// Kindly request you to share the competitive quotes at the earliest
|
||||||
|
// In case of any query, Please feel free to contact us.
|
||||||
|
// Thank You !`;
|
||||||
|
|
||||||
|
// $message = $original_message;
|
||||||
|
// $message = str_replace("{{RECIPIENT_NAME}}", $lead_data['client_name'], $message);
|
||||||
|
// $message = str_replace("{{POLICY_LONG_NAME}}", $lead_data['long_name'] ?? $lead_data['policy_type'], $message);
|
||||||
|
// $message = str_replace("{{POLICY_TYPE}}", $lead_data['policy_type'], $message);
|
||||||
|
// $message = str_replace("{{RFQ_OR_QCR}}", $page_name, $message);
|
||||||
|
|
||||||
|
// $message = str_replace("{{CLIENT_NAME}}", $lead_data['client_name'], $message);
|
||||||
|
// $message = str_replace("{{POLICY_START_DATE}}", change_date_format($lead_data['policy_start_date'], 'Y-m-d', 'd-m-Y'), $message);
|
||||||
|
// $message = str_replace("{{DURATION}}", calculate_days_bw_dates($lead_data['policy_end_date'] ?? "", $lead_data['policy_start_date'] ?? "")->days, $message) ?? '--';
|
||||||
|
|
||||||
|
// dd($message);
|
||||||
|
// // return $this->respond(['status' => true, 'code' => 200, 'data' => $message], 200);
|
||||||
|
// return $message;
|
||||||
|
|
||||||
|
// }else{
|
||||||
|
|
||||||
|
// // return $this->respond(['status' => false, 'code' => 404, 'message' => "This lead has not data"], 200);
|
||||||
|
// return '';
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//gather lead info
|
|
||||||
$lead_data = $this->leadsModel
|
|
||||||
->select('leads.*,policy_type.long_name,policy_type.policy_type,user_profiles.email as created_person_email')
|
|
||||||
->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
|
|
||||||
->join('user_profiles', 'leads.created_by = user_profiles.id', 'left')
|
|
||||||
->where('leads.id', $lead_id)
|
|
||||||
->first();
|
|
||||||
|
|
||||||
// dd($lead_data);
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
public function transformMailContent($lead_data, $mail_content, $page_name)
|
||||||
|
{
|
||||||
|
$current_year = date('Y');
|
||||||
|
$next_year = $current_year + 1;
|
||||||
|
$policy_year = "$current_year-$next_year";
|
||||||
|
|
||||||
if ($lead_data) {
|
if ($lead_data) {
|
||||||
|
|
||||||
$recipient_data = ['name' => "Team"];
|
// Replacing placeholders with actual values
|
||||||
$original_message = '<div style="width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9;font-family:Arial,sans-serif;color:#333;line-height:1.6"><div style=background-color:#4a90e2;color:#fff;padding:15px;text-align:center><h1 style=margin:0;font-size:24px>Request for Quotation (RFQ)</h1></div><div style=padding:20px;background-color:#fff><h2 style=color:#4a90e2;font-size:20px;margin-top:0>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2 style=color:#4a90e2;font-size:20px;margin-top:20px>RFQ Details</h2><table style=width:100%;border-collapse:collapse;margin-top:20px><tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Client name<td style="border:1px solid #ddd;padding:10px;text-align:left">{{CLIENT_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Coverage Type<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_LONG_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Start Date<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_START_DATE}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Duration<td style="border:1px solid #ddd;padding:10px;text-align:left">{{DURATION}}</table><div style="margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic">Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div style=margin-top:20px;font-size:12px;color:#777;text-align:center><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
|
$message = $mail_content;
|
||||||
|
$message = str_replace("{{CLIENT_NAME}}", $lead_data['client_name'] ?? "Valued Client", $message);
|
||||||
|
$message = str_replace("{{POLICY_LONG_NAME}}", $lead_data['long_name'] ?? $lead_data['policy_type'] ?? "Insurance Policy", $message);
|
||||||
|
$message = str_replace("{{POLICY_TYPE}}", $lead_data['policy_type'] ?? "Insurance Policy", $message);
|
||||||
|
$message = str_replace("{{RFQ_OR_QCR}}", $page_name, $message);
|
||||||
|
$message = str_replace("{{POLICY_YEAR}}", $policy_year, $message);
|
||||||
|
|
||||||
$message = $original_message;
|
|
||||||
$message = str_replace("{{RECIPIENT_NAME}}", $recipient_data['name'], $message);
|
|
||||||
$message = str_replace("{{CLIENT_NAME}}", $lead_data['client_name'], $message);
|
|
||||||
$message = str_replace("{{POLICY_LONG_NAME}}", $lead_data['long_name'], $message);
|
|
||||||
$message = str_replace("{{POLICY_START_DATE}}", change_date_format($lead_data['policy_start_date'], 'Y-m-d', 'd-m-Y'), $message);
|
|
||||||
$message = str_replace("{{DURATION}}", calculate_days_bw_dates($lead_data['policy_end_date'] ?? "", $lead_data['policy_start_date'] ?? "")->days, $message) ?? '--';
|
|
||||||
|
|
||||||
// return $this->respond(['status' => true, 'code' => 200, 'data' => $message], 200);
|
|
||||||
return $message;
|
return $message;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
return ''; // Return empty if no lead data found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// return $this->respond(['status' => false, 'code' => 404, 'message' => "This lead has not data"], 200);
|
function getLastFiveFinancialYears() {
|
||||||
return '';
|
$currentYear = date('Y');
|
||||||
|
$currentMonth = date('m');
|
||||||
|
|
||||||
|
// In India, the financial year starts from April (04)
|
||||||
|
if ($currentMonth < 4) {
|
||||||
|
$currentYear--; // Adjust year if it's Jan-Mar
|
||||||
|
}
|
||||||
|
|
||||||
|
$financialYears = [];
|
||||||
|
|
||||||
|
for ($i = 0; $i < 5; $i++) {
|
||||||
|
$startYear = $currentYear - $i - 1;
|
||||||
|
$endYear = $currentYear - $i;
|
||||||
|
$financialYears[] = "$startYear-$endYear";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $financialYears;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rfqNonEB(){
|
||||||
|
|
||||||
|
$this->loadLayout('view_rfq_non_eb');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -287,6 +287,10 @@ class MasterController extends AdminController
|
|||||||
$data['deletion_add_day'] = 1;
|
$data['deletion_add_day'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($this->request->getPost('is_multi_event')){
|
||||||
|
$data['is_multi_event'] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$data['created_by'] = get_session_userid();
|
$data['created_by'] = get_session_userid();
|
||||||
$data['insurer_logo'] = $file_name;
|
$data['insurer_logo'] = $file_name;
|
||||||
|
|
||||||
@ -371,6 +375,12 @@ class MasterController extends AdminController
|
|||||||
$data['deletion_add_day'] = 0;
|
$data['deletion_add_day'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($this->request->getPost('is_multi_event')){
|
||||||
|
$data['is_multi_event'] = 1;
|
||||||
|
}else{
|
||||||
|
$data['is_multi_event'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$update = $this->insurerModel->update($id,$data);
|
$update = $this->insurerModel->update($id,$data);
|
||||||
if($update){
|
if($update){
|
||||||
echo json_encode(array("status" => true , 'data' => $data));
|
echo json_encode(array("status" => true , 'data' => $data));
|
||||||
@ -1723,7 +1733,8 @@ class MasterController extends AdminController
|
|||||||
'excel' => WRITEPATH . 'uploads/excel/',
|
'excel' => WRITEPATH . 'uploads/excel/',
|
||||||
'statements' => WRITEPATH . 'uploads/statements/',
|
'statements' => WRITEPATH . 'uploads/statements/',
|
||||||
'import_excel' => WRITEPATH . 'uploads/import_excel/',
|
'import_excel' => WRITEPATH . 'uploads/import_excel/',
|
||||||
'logs' => WRITEPATH . 'uploads/logs/',
|
'logs' => WRITEPATH . 'logs',
|
||||||
|
'session' => WRITEPATH . 'session',
|
||||||
'client_kyc_documents' => WRITEPATH . 'uploads/client_kyc_documents/',
|
'client_kyc_documents' => WRITEPATH . 'uploads/client_kyc_documents/',
|
||||||
'tmp' => WRITEPATH . 'tmp/',
|
'tmp' => WRITEPATH . 'tmp/',
|
||||||
'e_card_imgs' => ROOTPATH . 'public/e_card_imgs',
|
'e_card_imgs' => ROOTPATH . 'public/e_card_imgs',
|
||||||
@ -1732,8 +1743,10 @@ class MasterController extends AdminController
|
|||||||
'logo' => ROOTPATH . 'public/uploads/logo/',
|
'logo' => ROOTPATH . 'public/uploads/logo/',
|
||||||
'template_bg' => ROOTPATH . 'public/uploads/template_bg/',
|
'template_bg' => ROOTPATH . 'public/uploads/template_bg/',
|
||||||
'attachments' => WRITEPATH . 'uploads/attachments/',
|
'attachments' => WRITEPATH . 'uploads/attachments/',
|
||||||
|
'cache' => WRITEPATH . 'cache',
|
||||||
'sample_import_excel' => ROOTPATH . 'public/sample_import_excel',
|
'sample_import_excel' => ROOTPATH . 'public/sample_import_excel',
|
||||||
'lead_files' => WRITEPATH . 'uploads/lead_files/',
|
'lead_files' => WRITEPATH . 'uploads/lead_files/',
|
||||||
|
'claim_sample_forms' => ROOTPATH . 'public/claim_sample_forms/',
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($folders as $folderName => $folderPath) {
|
foreach ($folders as $folderName => $folderPath) {
|
||||||
|
|||||||
@ -274,7 +274,7 @@ class PolicyTransactionController extends BaseController
|
|||||||
// Separate Insurer and TPA Branch IDs and IDs
|
// Separate Insurer and TPA Branch IDs and IDs
|
||||||
if(isset($data['insurer_id']) && !empty($data['insurer_id'])){
|
if(isset($data['insurer_id']) && !empty($data['insurer_id'])){
|
||||||
list($data['insurer_branch_id'], $data['insurer_id']) = explode('-', $data['insurer_id']);
|
list($data['insurer_branch_id'], $data['insurer_id']) = explode('-', $data['insurer_id']);
|
||||||
if (isset($data['tpa'])) {
|
if (isset($data['tpa']) && !empty($data['tpa'])) {
|
||||||
list($data['tpa_branch_id'], $data['tpa_id']) = explode('-', $data['tpa']);
|
list($data['tpa_branch_id'], $data['tpa_id']) = explode('-', $data['tpa']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -414,9 +414,13 @@ class PolicyTransactionController extends BaseController
|
|||||||
// Prepare data for insertion and updating
|
// Prepare data for insertion and updating
|
||||||
$coShareDetails = [];
|
$coShareDetails = [];
|
||||||
|
|
||||||
// print_r($data);
|
// print_r($data); die;
|
||||||
// die;
|
// die;
|
||||||
|
|
||||||
|
if(isset($data['co_share_id']) && !empty($data['co_share_id'])){
|
||||||
|
$this->removePtCoShareRecords($data['co_share_id']);
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($data['follow_insurer_id'])){
|
if(isset($data['follow_insurer_id'])){
|
||||||
|
|
||||||
foreach ($data['follow_insurer_id'] as $index => $insurer) {
|
foreach ($data['follow_insurer_id'] as $index => $insurer) {
|
||||||
@ -429,7 +433,7 @@ class PolicyTransactionController extends BaseController
|
|||||||
'pt_id' => $pt_id,
|
'pt_id' => $pt_id,
|
||||||
'insurer_id' => $insurer_id ?? 0,
|
'insurer_id' => $insurer_id ?? 0,
|
||||||
'insurer_branch_id' => $insurer_branch_id ?? 0,
|
'insurer_branch_id' => $insurer_branch_id ?? 0,
|
||||||
'co_share_type' => $data['co_share_type'][$index] ?? null,
|
'co_share_type' => $data['co_share_type'][$index] ?? 1,
|
||||||
'co_share_per' => $data['co_share_per'][$index] ?? 0,
|
'co_share_per' => $data['co_share_per'][$index] ?? 0,
|
||||||
'bp_amt' => $data['base_premium'][$index] ?? 0,
|
'bp_amt' => $data['base_premium'][$index] ?? 0,
|
||||||
'bp_gst_amt' => $data['gst_amount'][$index] ?? 0,
|
'bp_gst_amt' => $data['gst_amount'][$index] ?? 0,
|
||||||
@ -438,6 +442,8 @@ class PolicyTransactionController extends BaseController
|
|||||||
'bp_cgst' => $data['cgst'][$index] ?? 0,
|
'bp_cgst' => $data['cgst'][$index] ?? 0,
|
||||||
'tp_amt' => $data['tp_premium'][$index] ?? 0,
|
'tp_amt' => $data['tp_premium'][$index] ?? 0,
|
||||||
'tep_amt' => $data['ter_premium'][$index] ?? 0,
|
'tep_amt' => $data['ter_premium'][$index] ?? 0,
|
||||||
|
'cotp_amt' => $data['co_tp_premium'][$index] ?? 0,
|
||||||
|
'cotep_amt' => $data['co_ter_premium'][$index] ?? 0,
|
||||||
'agreed_amt' => $data['agreed_amount'][$index] ?? 0,
|
'agreed_amt' => $data['agreed_amount'][$index] ?? 0,
|
||||||
'agreed_bp_per' => $data['agreed_bp'][$index] ?? 0,
|
'agreed_bp_per' => $data['agreed_bp'][$index] ?? 0,
|
||||||
'agreed_tp_per' => $data['agreed_tp'][$index] ?? 0,
|
'agreed_tp_per' => $data['agreed_tp'][$index] ?? 0,
|
||||||
@ -949,6 +955,23 @@ class PolicyTransactionController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//function for soft delete for pt_co_share_details records
|
||||||
|
public function removePtCoShareRecords($primaryKeys)
|
||||||
|
{
|
||||||
|
// print_r($primaryKeys); die;
|
||||||
|
if (empty($primaryKeys)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert array to a comma-separated string for query binding
|
||||||
|
$placeholders = implode(',', array_fill(0, count($primaryKeys), '?'));
|
||||||
|
|
||||||
|
$sql = "UPDATE pt_co_share_details SET is_active = 0 WHERE id NOT IN ($placeholders)";
|
||||||
|
|
||||||
|
return db_connect()->query($sql, $primaryKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Policy Transaction Endorsement
|
// Policy Transaction Endorsement
|
||||||
@ -1040,6 +1063,7 @@ class PolicyTransactionController extends BaseController
|
|||||||
{
|
{
|
||||||
$id = $this->request->getPost('id');
|
$id = $this->request->getPost('id');
|
||||||
$data = $this->preparePolicyTransactionData();
|
$data = $this->preparePolicyTransactionData();
|
||||||
|
// print_r($data); die;
|
||||||
|
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
return $this->insertEndorsementTransaction($data);
|
return $this->insertEndorsementTransaction($data);
|
||||||
@ -1056,25 +1080,12 @@ class PolicyTransactionController extends BaseController
|
|||||||
// print_r($data);
|
// print_r($data);
|
||||||
// die;
|
// die;
|
||||||
|
|
||||||
// $data_received_date = (string)$this->request->getPost('data_received_date');
|
|
||||||
// $closure_date = (string)$this->request->getPost('closure_date');
|
|
||||||
// $endorse_eff_date = (string)$this->request->getPost('endorse_eff_date');
|
|
||||||
// $month = (string)$this->request->getPost('month');
|
|
||||||
|
|
||||||
// $data['data_received_date'] = empty($data['data_received_date']) ? null : date('Y-m-d', strtotime($data_received_date));
|
|
||||||
// $data['closure_date'] = empty($data['closure_date']) ? null : date('Y-m-d', strtotime($closure_date));
|
|
||||||
// $data['endorse_eff_date'] = empty($data['endorse_eff_date']) ? null : date('Y-m-d', strtotime($endorse_eff_date));
|
|
||||||
|
|
||||||
// $month = '01-'.$data['month'];
|
|
||||||
// $data['month'] = empty($data['month']) ? null : date('Y-m-d', strtotime($month));
|
|
||||||
|
|
||||||
if (!isset($data['policy_with_corr'])) {
|
if (!isset($data['policy_with_corr'])) {
|
||||||
$data['policy_with_corr'] = 0;
|
$data['policy_with_corr'] = 0;
|
||||||
} elseif ($data['policy_with_corr']) {
|
} elseif ($data['policy_with_corr']) {
|
||||||
$data['policy_with_corr'] = 1;
|
$data['policy_with_corr'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(empty($data['data_received_date'])){
|
if(empty($data['data_received_date'])){
|
||||||
$data['data_received_date'] = null;
|
$data['data_received_date'] = null;
|
||||||
}else{
|
}else{
|
||||||
@ -1117,7 +1128,7 @@ class PolicyTransactionController extends BaseController
|
|||||||
// Separate Insurer and TPA Branch IDs and IDs
|
// Separate Insurer and TPA Branch IDs and IDs
|
||||||
if(isset($data['insurer_id']) && !empty($data['insurer_id'])){
|
if(isset($data['insurer_id']) && !empty($data['insurer_id'])){
|
||||||
list($data['insurer_branch_id'], $data['insurer_id']) = explode('-', $data['insurer_id']);
|
list($data['insurer_branch_id'], $data['insurer_id']) = explode('-', $data['insurer_id']);
|
||||||
if (isset($data['tpa'])) {
|
if (isset($data['tpa']) && !empty($data['tpa'])) {
|
||||||
list($data['tpa_branch_id'], $data['tpa_id']) = explode('-', $data['tpa']);
|
list($data['tpa_branch_id'], $data['tpa_id']) = explode('-', $data['tpa']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1264,18 +1275,9 @@ class PolicyTransactionController extends BaseController
|
|||||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||||
->where('policy_transaction.id', $id)
|
->where('policy_transaction.id', $id)
|
||||||
->where('policy_transaction.is_active', 1)
|
->where('policy_transaction.is_active', 1)
|
||||||
|
->orderBy('id', 'asc')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
// $data['policy_start_date'] = empty($data['policy_start_date']) ? '' : date('d/m/Y', strtotime($data['s_date']));
|
|
||||||
// $data['policy_end_date'] = empty($data['policy_end_date']) ? '' : date('d/m/Y', strtotime($data['e_date']));
|
|
||||||
// $data['data_received_date'] = empty($data['data_received_date']) ? '' : date('d/m/Y', strtotime($data['data_received_date']));
|
|
||||||
// $data['closure_date'] = empty($data['closure_date']) ? '' : date('d/m/Y', strtotime($data['closure_date']));
|
|
||||||
// $data['endorse_eff_date'] = empty($data['endorse_eff_date']) ? '' : date('d/m/Y', strtotime($data['endorse_eff_date']));
|
|
||||||
|
|
||||||
// $data['month'] = (isset($data['month']) && $data['month'] !== null && $data['month'] !== '')
|
|
||||||
// ? date('M/Y', strtotime($data['month']))
|
|
||||||
// : null;
|
|
||||||
|
|
||||||
|
|
||||||
if (!empty($data['policy_start_date'])) {
|
if (!empty($data['policy_start_date'])) {
|
||||||
$data['policy_start_date'] = change_date_format($data['policy_start_date'], 'Y-m-d', 'd/m/Y');
|
$data['policy_start_date'] = change_date_format($data['policy_start_date'], 'Y-m-d', 'd/m/Y');
|
||||||
@ -1442,7 +1444,6 @@ class PolicyTransactionController extends BaseController
|
|||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => false], 200);
|
return $this->respond(['status' => false], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
@ -1584,8 +1585,15 @@ class PolicyTransactionController extends BaseController
|
|||||||
->where('policy_transaction.action_type', 'inception')
|
->where('policy_transaction.action_type', 'inception')
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
|
$is_copay_yes = $this->policyTransactionModel
|
||||||
|
->where('client_id', $client_id)
|
||||||
|
->where('client_policy_id', $client_policy_id)
|
||||||
|
->where('action_type', 'inception')
|
||||||
|
->where('is_active', 1)
|
||||||
|
->first();
|
||||||
|
|
||||||
if ($totalCount) {
|
if ($totalCount) {
|
||||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $totalCount], 200);
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $totalCount, 'is_copay_yes' => $is_copay_yes], 200);
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to get data'], 200);
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to get data'], 200);
|
||||||
}
|
}
|
||||||
@ -2700,7 +2708,7 @@ class PolicyTransactionController extends BaseController
|
|||||||
// Build query
|
// Build query
|
||||||
$db = db_connect();
|
$db = db_connect();
|
||||||
$builder = $db->table("cash_deposit")
|
$builder = $db->table("cash_deposit")
|
||||||
->where('cd_ac_no', $cd_ac_no)
|
->where('cd_ac_pk', $cd_ac_no)
|
||||||
->where('is_active', 1)
|
->where('is_active', 1)
|
||||||
->orderBy('id', 'desc')
|
->orderBy('id', 'desc')
|
||||||
->limit(1);
|
->limit(1);
|
||||||
@ -2715,6 +2723,8 @@ class PolicyTransactionController extends BaseController
|
|||||||
'status' => true,
|
'status' => true,
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
'data' => $result,
|
'data' => $result,
|
||||||
|
'base_premium' => $base_premium,
|
||||||
|
'cd_ac_no' => $cd_ac_no,
|
||||||
'base_premium_greater_than_balance' => $base_premium_greater_than_balance,
|
'base_premium_greater_than_balance' => $base_premium_greater_than_balance,
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,13 +71,20 @@ class RestAuthenticationController extends AdminController
|
|||||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||||
|
|
||||||
|
|
||||||
$employeeData = $this->employeeModel->where('mobile', $mobile_number)
|
$employeeData = $this->employeeModel->select('employees.relationship,EP.employee_id')
|
||||||
->where('relationship', 'self')
|
->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
|
||||||
->where('emp_status !=', 'truncated')
|
->where('employees.is_active', 1)
|
||||||
->where('is_active', 1)
|
->where('employees.relationship', 'self')
|
||||||
|
->where('employees.emp_status !=', 'truncated')
|
||||||
|
->where('employees.mobile', $mobile_number)
|
||||||
|
->where('EP.is_active', 1)
|
||||||
|
->whereIn('EP.status', ['active'])
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($employeeData) {
|
|
||||||
|
|
||||||
|
if (isset($employeeData['employee_id']))
|
||||||
|
{
|
||||||
|
|
||||||
$result = ['user_verification' => true ,'message' => "Verified Successfully"];
|
$result = ['user_verification' => true ,'message' => "Verified Successfully"];
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||||
@ -97,26 +104,38 @@ class RestAuthenticationController extends AdminController
|
|||||||
$email = $this->request->getJSON()->email;
|
$email = $this->request->getJSON()->email;
|
||||||
|
|
||||||
|
|
||||||
$employeeData = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'self')
|
$employeeData = $this->employeeModel->select('
|
||||||
->where('emp_status !=', 'truncated')->where('is_active', 1)
|
employees.relationship,
|
||||||
|
EP.employee_id,
|
||||||
|
employees.client_id,
|
||||||
|
employees.client_branch_id,
|
||||||
|
employees.email_corporate
|
||||||
|
|
||||||
|
')
|
||||||
|
->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
|
||||||
|
->where('employees.is_active', 1)
|
||||||
|
->where('employees.relationship', 'Self')
|
||||||
|
->where('employees.emp_status !=', 'truncated')
|
||||||
|
->where('employees.email_corporate', $email)
|
||||||
|
->where('EP.is_active', 1)
|
||||||
|
->whereIn('EP.status', ['draft', 'enrolled'])
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($employeeData) {
|
if (isset($employeeData['employee_id'])) {
|
||||||
|
|
||||||
$otp = random_int(100000, 999999);
|
$otp = random_int(100000, 999999);
|
||||||
|
|
||||||
$update = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'self')
|
$update = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'Self')
|
||||||
->where('is_active', 1)->set(array('otp' => $otp))
|
->where('is_active', 1)->set(array('otp' => $otp))
|
||||||
->update();
|
->update();
|
||||||
if($update)
|
if ($update) {
|
||||||
{
|
|
||||||
|
|
||||||
$common = [
|
$common = [
|
||||||
'client_id' => $employeeData['client_id'],
|
'client_id' => $employeeData['client_id'],
|
||||||
'client_branch_id' => $employeeData['client_branch_id'],
|
'client_branch_id' => $employeeData['client_branch_id'],
|
||||||
'client_policy_id' => null,
|
'client_policy_id' => null,
|
||||||
'employee_policy_id' => null,
|
'employee_policy_id' => null,
|
||||||
'employee_id' => $employeeData['id'],
|
'employee_id' => $employeeData['employee_id'],
|
||||||
'mail_type' => 'otp_mail',
|
'mail_type' => 'otp_mail',
|
||||||
];
|
];
|
||||||
$subject = 'Nhance user verification - OTP';
|
$subject = 'Nhance user verification - OTP';
|
||||||
@ -124,28 +143,21 @@ class RestAuthenticationController extends AdminController
|
|||||||
$res = MailHelper::send_email(['mail' => $employeeData['email_corporate'], 'subject' => $subject, 'common' => $common, 'message' => $mail_content]);
|
$res = MailHelper::send_email(['mail' => $employeeData['email_corporate'], 'subject' => $subject, 'common' => $common, 'message' => $mail_content]);
|
||||||
$this->myLogger->logme("info", $res);
|
$this->myLogger->logme("info", $res);
|
||||||
|
|
||||||
if(json_decode($res)->status == 'success')
|
if (json_decode($res)->status == 'success') {
|
||||||
{
|
|
||||||
$result = ['user_verification' => true, 'message' => "Verified Successfully"];
|
$result = ['user_verification' => true, 'message' => "Verified Successfully"];
|
||||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$result = ['user_verification' => false, 'message' => "Mail sending failed , try again"];
|
$result = ['user_verification' => false, 'message' => "Mail sending failed , try again"];
|
||||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$result = ['user_verification' => false, 'message' => "Verification failed , try again"];
|
$result = ['user_verification' => false, 'message' => "Verification failed , try again"];
|
||||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$result = ['user_verification' => false, 'message' => "User not found"];
|
$result = ['user_verification' => false, 'message' => "User not found"];
|
||||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $th], 500);
|
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $th], 500);
|
||||||
|
|||||||
@ -12,13 +12,16 @@ use App\Models\TicketMailTemplateModel;
|
|||||||
use App\Models\TicketMessageModel;
|
use App\Models\TicketMessageModel;
|
||||||
use App\Models\TicketNoteModel;
|
use App\Models\TicketNoteModel;
|
||||||
use App\Models\UserModel;
|
use App\Models\UserModel;
|
||||||
|
use App\Models\ClientPolicyModel;
|
||||||
|
use App\Models\EmployeePolicyModel;
|
||||||
|
|
||||||
use DOMDocument;
|
use DOMDocument;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Kint\Kint;
|
use Kint\Kint;
|
||||||
use App\Models\EmployeeModel;
|
use App\Models\EmployeeModel;
|
||||||
|
|
||||||
use App\Helpers\MailHelper;
|
use App\Helpers\MailHelper;
|
||||||
|
use App\Models\InsurerModel;
|
||||||
use CodeIgniter\API\ResponseTrait;
|
use CodeIgniter\API\ResponseTrait;
|
||||||
|
|
||||||
class TicketController extends BaseController
|
class TicketController extends BaseController
|
||||||
@ -26,13 +29,15 @@ class TicketController extends BaseController
|
|||||||
use ResponseTrait;
|
use ResponseTrait;
|
||||||
|
|
||||||
protected $myLogger;
|
protected $myLogger;
|
||||||
protected $ticketType;
|
public $ticketType;
|
||||||
protected $priorityType;
|
public $priorityType;
|
||||||
protected $relationshipType;
|
public $relationshipType;
|
||||||
protected $modeOFIntimate;
|
public $modeOFIntimate;
|
||||||
protected $claimType;
|
public $claimType;
|
||||||
protected $claimStatus;
|
public $claimStatus;
|
||||||
protected $placeHolders;
|
public $placeHolders;
|
||||||
|
public $extraFields;
|
||||||
|
public $nonIDReason;
|
||||||
|
|
||||||
protected $clientModel;
|
protected $clientModel;
|
||||||
protected $ticketMasterModel;
|
protected $ticketMasterModel;
|
||||||
@ -43,6 +48,8 @@ class TicketController extends BaseController
|
|||||||
protected $triggerType;
|
protected $triggerType;
|
||||||
protected $userModel;
|
protected $userModel;
|
||||||
protected $employeeModel;
|
protected $employeeModel;
|
||||||
|
protected $clientPolicyModel;
|
||||||
|
protected $employeePolicyModel;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -73,14 +80,15 @@ class TicketController extends BaseController
|
|||||||
1 => "In Person",
|
1 => "In Person",
|
||||||
2 => "Courier",
|
2 => "Courier",
|
||||||
3 => "Online Mode - Email",
|
3 => "Online Mode - Email",
|
||||||
4 => "Online Mode - To TPA"
|
4 => "Smart Service Desk",
|
||||||
|
5 => "Direct to TPA"
|
||||||
];
|
];
|
||||||
$this->claimType = [
|
$this->claimType = [
|
||||||
1 => [
|
1 => [
|
||||||
1 => "Main",
|
1 => "Main Hospitalization",
|
||||||
|
3 => "Pre / Post",
|
||||||
2 => "OPD",
|
2 => "OPD",
|
||||||
3 => "Pre ReOpen",
|
4 => "ReOpen",
|
||||||
4 => "Post ReOpen",
|
|
||||||
],
|
],
|
||||||
2 => [
|
2 => [
|
||||||
1 => "TTD",
|
1 => "TTD",
|
||||||
@ -96,7 +104,8 @@ class TicketController extends BaseController
|
|||||||
4 => "Trigger 4",
|
4 => "Trigger 4",
|
||||||
5 => "Trigger 5",
|
5 => "Trigger 5",
|
||||||
6 => "Trigger 6",
|
6 => "Trigger 6",
|
||||||
7 => "Trigger 7"
|
7 => "Trigger 7",
|
||||||
|
8 => "Trigger 8",
|
||||||
];
|
];
|
||||||
$this->placeHolders = [
|
$this->placeHolders = [
|
||||||
|
|
||||||
@ -110,6 +119,39 @@ class TicketController extends BaseController
|
|||||||
'((RELATIONSHIP))' => 'relationship',
|
'((RELATIONSHIP))' => 'relationship',
|
||||||
'((POLICY_TYPE))' => 'policy_type',
|
'((POLICY_TYPE))' => 'policy_type',
|
||||||
'((AUTO_QUERY_CONTENT))' => 'auto_query_content',
|
'((AUTO_QUERY_CONTENT))' => 'auto_query_content',
|
||||||
|
'((CLAIM_FORM_LINK))' => 'claim_form_link',
|
||||||
|
];
|
||||||
|
$this->extraFields = [
|
||||||
|
1 => ['non_id_reason'],
|
||||||
|
10 => ['pay_initiate_date'],
|
||||||
|
3 => ['raised_date'],
|
||||||
|
4 => ['raised_date'],
|
||||||
|
5 => ['claim_number', 'registration_date'],
|
||||||
|
7 => ['query_received_date'],
|
||||||
|
8 => ['denial_reason','denial_date'],
|
||||||
|
9 => ['approved_amount','approved_date', 'approved_letter'],
|
||||||
|
11 => ['utr_details', 'settled_date', 'settle_letter'],
|
||||||
|
40 => ['approved_amount','approved_date', 'approved_letter'],
|
||||||
|
44 => ['utr_details', 'settled_date', 'settle_letter'],
|
||||||
|
30 => ['approved_amount','approved_date', 'approved_letter'],
|
||||||
|
34 => ['utr_details', 'settled_date', 'settle_letter'],
|
||||||
|
20 => ['approved_amount','approved_date', 'approved_letter'],
|
||||||
|
24 => ['utr_details', 'settled_date', 'settle_letter'],
|
||||||
|
14 => ['return_remark', 'awb_no_courier_name'],
|
||||||
|
48 => ['return_remark', 'awb_no_courier_name'],
|
||||||
|
59 => ['return_remark', 'awb_no_courier_name'],
|
||||||
|
54 => ['return_remark', 'awb_no_courier_name'],
|
||||||
|
13 => ['cancel_remark'],
|
||||||
|
47 => ['cancel_remark'],
|
||||||
|
53 => ['cancel_remark'],
|
||||||
|
58 => ['cancel_remark'],
|
||||||
|
];
|
||||||
|
$this->nonIDReason = [
|
||||||
|
"Newborn Baby" => "Newborn Baby",
|
||||||
|
"Newly Wedded Spouse" => "Newly Wedded Spouse",
|
||||||
|
"Policy Pending" => "Policy Pending",
|
||||||
|
"New Joinee" => "New Joinee",
|
||||||
|
"Exceptional Case" => "Exceptional Case"
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->ticketMasterModel = new TicketMasterModel();
|
$this->ticketMasterModel = new TicketMasterModel();
|
||||||
@ -121,6 +163,8 @@ class TicketController extends BaseController
|
|||||||
$this->ticketMessageModel = new TicketMessageModel();
|
$this->ticketMessageModel = new TicketMessageModel();
|
||||||
$this->userModel = new UserModel();
|
$this->userModel = new UserModel();
|
||||||
$this->employeeModel = new EmployeeModel();
|
$this->employeeModel = new EmployeeModel();
|
||||||
|
$this->clientPolicyModel = new ClientPolicyModel();
|
||||||
|
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ticketList()
|
public function ticketList()
|
||||||
@ -260,7 +304,7 @@ class TicketController extends BaseController
|
|||||||
return $this->loadLayout('ticket_form_handler', $data);
|
return $this->loadLayout('ticket_form_handler', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ticket_form_data($ticket_type)
|
public function ticket_form_data($ticket_type, $claim_status_id = null)
|
||||||
{
|
{
|
||||||
$this->myLogger->logme('error', "Fetching ticket form data for Ticket Type: $ticket_type");
|
$this->myLogger->logme('error', "Fetching ticket form data for Ticket Type: $ticket_type");
|
||||||
|
|
||||||
@ -270,7 +314,8 @@ class TicketController extends BaseController
|
|||||||
'ticket_type' => $this->ticketType,
|
'ticket_type' => $this->ticketType,
|
||||||
'priorityType' => $this->priorityType,
|
'priorityType' => $this->priorityType,
|
||||||
'relationshipType' => $this->relationshipType,
|
'relationshipType' => $this->relationshipType,
|
||||||
'modeOFIntimate' => $this->modeOFIntimate
|
'modeOFIntimate' => $this->modeOFIntimate,
|
||||||
|
'nonIDReason' => $this->nonIDReason
|
||||||
];
|
];
|
||||||
|
|
||||||
switch ($ticket_type) {
|
switch ($ticket_type) {
|
||||||
@ -294,11 +339,23 @@ class TicketController extends BaseController
|
|||||||
->getResultArray();
|
->getResultArray();
|
||||||
|
|
||||||
// Fetch Claim Status
|
// Fetch Claim Status
|
||||||
$data['claim_status'] = $this->claimStatus
|
|
||||||
->select('*')
|
if(empty($claim_status_id)){
|
||||||
->where(['is_active' => 1, 'ticket_type' => $ticket_type])
|
|
||||||
->get()
|
if($ticket_type == 2){
|
||||||
->getResultArray();
|
$claim_status_id = 15;
|
||||||
|
}else if($ticket_type == 3){
|
||||||
|
$claim_status_id = 25;
|
||||||
|
}else if($ticket_type == 4){
|
||||||
|
$claim_status_id = 35;
|
||||||
|
}else{
|
||||||
|
$claim_status_id = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['claim_status'] = $this->transFormClaimStatus($claim_status_id, $ticket_type);
|
||||||
|
$data['extra_fields'] = $this->getExtraFields($data['claim_status']);
|
||||||
|
$data['extra_fields_array_for_validate'] = $this->getExtraFields($data['claim_status'], 1);
|
||||||
|
|
||||||
if ($ticket_type == 1) {
|
if ($ticket_type == 1) {
|
||||||
$data['claim_type'] = $this->claimType[1];
|
$data['claim_type'] = $this->claimType[1];
|
||||||
@ -311,19 +368,90 @@ class TicketController extends BaseController
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//transform the claim status
|
||||||
|
public function transFormClaimStatus($claimStatusId, $ticket_type)
|
||||||
|
{
|
||||||
|
// Fetch the main claim status by ID
|
||||||
|
$claimStatusData = $this->claimStatus
|
||||||
|
->select('*')
|
||||||
|
->where(['is_active' => 1, 'ticket_type' => $ticket_type])
|
||||||
|
->where('id', $claimStatusId)
|
||||||
|
->first();
|
||||||
|
// dd($claimStatusData);
|
||||||
|
|
||||||
|
// Initialize the filtered claim status array
|
||||||
|
$filteredClaimStatus = [];
|
||||||
|
|
||||||
|
if (!empty($claimStatusData)) {
|
||||||
|
// Add the main claim status to the result
|
||||||
|
$filteredClaimStatus[] = $claimStatusData;
|
||||||
|
|
||||||
|
// Decode the allowed_status JSON field
|
||||||
|
$filterClaimStatusIds = json_decode($claimStatusData['allowed_status'], true);
|
||||||
|
|
||||||
|
// Fetch additional claim statuses if IDs exist
|
||||||
|
if (!empty($filterClaimStatusIds) && is_array($filterClaimStatusIds)) {
|
||||||
|
$additionalClaimStatuses = $this->claimStatus
|
||||||
|
->select('*')
|
||||||
|
->where(['is_active' => 1, 'ticket_type' => $ticket_type])
|
||||||
|
->whereIn('id', $filterClaimStatusIds)
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
|
// Merge additional claim statuses into the result
|
||||||
|
$filteredClaimStatus = array_merge($filteredClaimStatus, $additionalClaimStatuses);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $filteredClaimStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getExtraFields(array $claimStatus, $nonFilterArray = 0): array
|
||||||
|
{
|
||||||
|
$extra_fields = [];
|
||||||
|
|
||||||
|
if($nonFilterArray == 1){
|
||||||
|
|
||||||
|
foreach ($claimStatus as $value) {
|
||||||
|
if (isset($this->extraFields[$value['id']])) {
|
||||||
|
if (!isset($extra_fields[$value['id']])) {
|
||||||
|
$extra_fields[$value['id']] = [];
|
||||||
|
}
|
||||||
|
$extra_fields[$value['id']] = array_merge($extra_fields[$value['id']], $this->extraFields[$value['id']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
foreach ($claimStatus as $value) {
|
||||||
|
if (isset($this->extraFields[$value['id']])) {
|
||||||
|
$extra_fields[] = $this->extraFields[$value['id']];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$extra_fields = array_values(array_unique(array_merge(...$extra_fields)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $extra_fields;
|
||||||
|
}
|
||||||
|
|
||||||
public function view_ticket($ticket_id)
|
public function view_ticket($ticket_id)
|
||||||
{
|
{
|
||||||
// $ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first();
|
// $ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first();
|
||||||
$ticket_data = $this->ticketMasterModel->getTicketDataByTicketID($ticket_id);
|
$ticket_data = $this->ticketMasterModel->getTicketDataByTicketID($ticket_id);
|
||||||
$ticket_data = $this->formatDateForClaim($ticket_data, 'd/m/Y');
|
$ticket_data = $this->formatDateForClaim($ticket_data, 'd/m/Y');
|
||||||
|
|
||||||
|
if (in_array($ticket_data['claim_status_id'], [15, 25, 35])) {
|
||||||
|
$ticket_data['auto_query_content'] = $this->getCheckListAndConvertArrayToString($ticket_data);
|
||||||
|
}
|
||||||
|
|
||||||
// dd($ticket_data);
|
// dd($ticket_data);
|
||||||
$template_data = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id);
|
$template_data = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id);
|
||||||
if (!empty($template_data)) {
|
if (!empty($template_data)) {
|
||||||
$template_data['mail_content'] = $this->replacePlaceholders($template_data['mail_content'], $ticket_data);
|
$template_data['mail_content'] = $this->replacePlaceholders($template_data['mail_content'], $ticket_data);
|
||||||
$template_data['subject'] = $this->replacePlaceholders($template_data['subject'], $ticket_data);
|
$template_data['subject'] = $this->replacePlaceholders($template_data['subject'], $ticket_data);
|
||||||
}
|
}
|
||||||
$data = $this->ticket_form_data($ticket_data['ticket_type_id']);
|
$data = $this->ticket_form_data($ticket_data['ticket_type_id'], $ticket_data['claim_status_id']);
|
||||||
$data['ticket_data'] = $ticket_data;
|
|
||||||
$data['reply_data'] = $template_data;
|
$data['reply_data'] = $template_data;
|
||||||
$data['placeHolders'] = $this->placeHolders;
|
$data['placeHolders'] = $this->placeHolders;
|
||||||
$data['message_data'] = $this->getTicketMessage($ticket_id);
|
$data['message_data'] = $this->getTicketMessage($ticket_id);
|
||||||
@ -331,6 +459,13 @@ class TicketController extends BaseController
|
|||||||
$data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']);
|
$data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']);
|
||||||
$data['ticket_history'] = $this->ticketHistory($ticket_id);
|
$data['ticket_history'] = $this->ticketHistory($ticket_id);
|
||||||
$data['ticket_check_list'] = db_connect()->table('ticket_check_list')->where('is_active', 1)->where('ticket_type_id', $ticket_data['ticket_type_id'])->get()->getResultArray();
|
$data['ticket_check_list'] = db_connect()->table('ticket_check_list')->where('is_active', 1)->where('ticket_type_id', $ticket_data['ticket_type_id'])->get()->getResultArray();
|
||||||
|
if (!empty($ticket_data['client_policy_id'])){
|
||||||
|
$ticket_data['client_policy_id_text'] = $this->clientPolicyModel->select('concat(policy_type.policy_type,"-",client_policy.policy_no) as client_policy_name')->join('policy_type','policy_type.id = client_policy.policy_type_id and policy_type.is_active = 1')->where('client_policy.id',$ticket_data['client_policy_id'])->first()['client_policy_name'];
|
||||||
|
}
|
||||||
|
// dd($data);
|
||||||
|
$data['ticket_data'] = $ticket_data;
|
||||||
|
$data['acms'] = $this->employeeModel->getAcmUsingClientID($ticket_data['client_id']);
|
||||||
|
|
||||||
// dd($data);
|
// dd($data);
|
||||||
|
|
||||||
return $this->loadLayout('ticket_edit_onbording', $data);
|
return $this->loadLayout('ticket_edit_onbording', $data);
|
||||||
@ -423,6 +558,12 @@ class TicketController extends BaseController
|
|||||||
$ticket_data['settled_date'] = change_date_format($ticket_data['settled_date'], null, $out_put_format);
|
$ticket_data['settled_date'] = change_date_format($ticket_data['settled_date'], null, $out_put_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($ticket_data['pay_initiate_date'])) {
|
||||||
|
$ticket_data['pay_initiate_date'] = null;
|
||||||
|
} else {
|
||||||
|
$ticket_data['pay_initiate_date'] = change_date_format($ticket_data['pay_initiate_date'], null, $out_put_format);
|
||||||
|
}
|
||||||
|
|
||||||
return $ticket_data;
|
return $ticket_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,6 +571,7 @@ class TicketController extends BaseController
|
|||||||
{
|
{
|
||||||
$ticket_data = $this->request->getPost();
|
$ticket_data = $this->request->getPost();
|
||||||
$ticket_data = $this->formatDateForClaim($ticket_data);
|
$ticket_data = $this->formatDateForClaim($ticket_data);
|
||||||
|
// $ticket_data = $this->getLastMatchedStatus($ticket_data, );
|
||||||
// print_rr($ticket_data); die;
|
// print_rr($ticket_data); die;
|
||||||
|
|
||||||
if ($ticket_data) {
|
if ($ticket_data) {
|
||||||
@ -451,6 +593,7 @@ class TicketController extends BaseController
|
|||||||
$ticket_id = $this->request->getPost('ticket_master_id');
|
$ticket_id = $this->request->getPost('ticket_master_id');
|
||||||
$ticket_data = $this->request->getPost();
|
$ticket_data = $this->request->getPost();
|
||||||
$ticket_data = $this->formatDateForClaim($ticket_data);
|
$ticket_data = $this->formatDateForClaim($ticket_data);
|
||||||
|
$ticket_data['claim_status_id'] = $this->getLastMatchedStatus($ticket_data);
|
||||||
// print_rr($ticket_data); die;
|
// print_rr($ticket_data); die;
|
||||||
$old_ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first();
|
$old_ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first();
|
||||||
|
|
||||||
@ -462,8 +605,12 @@ class TicketController extends BaseController
|
|||||||
$mail_responce = $this->sendAutoMailTrigger($ticket_id);
|
$mail_responce = $this->sendAutoMailTrigger($ticket_id);
|
||||||
|
|
||||||
//send mail to the head for rejected ticket approvel
|
//send mail to the head for rejected ticket approvel
|
||||||
if($ticket_data['claim_status_id'] == 8){
|
if($ticket_data['claim_status_id'] == 8 && $ticket_data['is_head_approved'] == 0){
|
||||||
$this->sendMailToTheHead($ticket_data);
|
$this->sendMailToTheHead($ticket_data);
|
||||||
|
}else{
|
||||||
|
$this->myLogger->logme('error', "Head Mail can't be sent");
|
||||||
|
$this->myLogger->logme('error', "CLAIM STATUS ID : {data}", ['data' => $ticket_data['claim_status_id']]);
|
||||||
|
$this->myLogger->logme('error', "IS HEAD APPROVED : {data}", ['data' => $ticket_data['is_head_approved']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $ticket_data, "message" => "Claim updated successfully", 'mail_responce' => $mail_responce], 200);
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $ticket_data, "message" => "Claim updated successfully", 'mail_responce' => $mail_responce], 200);
|
||||||
@ -482,6 +629,17 @@ class TicketController extends BaseController
|
|||||||
$data['policy_type'] = $this->ticketType;
|
$data['policy_type'] = $this->ticketType;
|
||||||
$data['placeHolders'] = $this->placeHolders;
|
$data['placeHolders'] = $this->placeHolders;
|
||||||
$data['ticket_data'] = $this->ticketMailTemplateModel->where('is_active', 1)->findAll();
|
$data['ticket_data'] = $this->ticketMailTemplateModel->where('is_active', 1)->findAll();
|
||||||
|
|
||||||
|
foreach ($data['ticket_data'] as $key => $ticket_data) {
|
||||||
|
|
||||||
|
$tooltip_array = $this->claimStatus->select('claim_status')->where('ticket_type',$data['ticket_data'][$key]['ticket_type'])->where('trigger_type',$data['ticket_data'][$key]['trigger_type'])->where('is_active',1)->first();
|
||||||
|
if (isset($tooltip_array) && $tooltip_array != null){
|
||||||
|
$data['ticket_data'][$key]['tool_tip'] = $tooltip_array['claim_status'];
|
||||||
|
}else{
|
||||||
|
$data['ticket_data'][$key]['tool_tip'] =$data['ticket_data'][$key]['template_name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// dd($data['ticket_data']);
|
||||||
$data['ticket_type'] = $this->ticketType;
|
$data['ticket_type'] = $this->ticketType;
|
||||||
$data['trigger_type'] = $this->triggerType;
|
$data['trigger_type'] = $this->triggerType;
|
||||||
return $this->loadLayout('ticket_mail_template', $data);
|
return $this->loadLayout('ticket_mail_template', $data);
|
||||||
@ -510,6 +668,21 @@ class TicketController extends BaseController
|
|||||||
} elseif ($action == 2) {
|
} elseif ($action == 2) {
|
||||||
$table_id = (int)$this->request->getPost('id');
|
$table_id = (int)$this->request->getPost('id');
|
||||||
$data = $this->ticketMailTemplateModel->where('id', $table_id)->where('is_active', 1)->first();
|
$data = $this->ticketMailTemplateModel->where('id', $table_id)->where('is_active', 1)->first();
|
||||||
|
if ($data && isset($data['ticket_type']) && isset($data['trigger_type'])) {
|
||||||
|
$tooltip_array = $this->claimStatus->select('claim_status')
|
||||||
|
->where('ticket_type', $data['ticket_type'])
|
||||||
|
->where('trigger_type', $data['trigger_type'])
|
||||||
|
->where('is_active', 1)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$data['tool_tip'] = (isset($tooltip_array['claim_status']))
|
||||||
|
? $tooltip_array['claim_status']
|
||||||
|
: $data['template_name'];
|
||||||
|
} else {
|
||||||
|
// Handle case where $data is null or missing required fields
|
||||||
|
$data = $data ?: []; // Ensure $data is an array if null
|
||||||
|
$data['tool_tip'] = $data['template_name'];
|
||||||
|
}
|
||||||
if ($data) {
|
if ($data) {
|
||||||
return $this->respond(['status' => true, 'data' => $data], 200);
|
return $this->respond(['status' => true, 'data' => $data], 200);
|
||||||
} else {
|
} else {
|
||||||
@ -635,6 +808,13 @@ class TicketController extends BaseController
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (in_array($ticket_data['claim_status_id'], [15, 25, 35])) {
|
||||||
|
$ticket_data['auto_query_content'] = $this->getCheckListAndConvertArrayToString($ticket_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// print_r($ticket_data); die;
|
||||||
|
|
||||||
|
|
||||||
$this->myLogger->logme('error', "Fetched email template: " . json_encode($template_data));
|
$this->myLogger->logme('error', "Fetched email template: " . json_encode($template_data));
|
||||||
|
|
||||||
// Generate Email Content
|
// Generate Email Content
|
||||||
@ -687,8 +867,10 @@ class TicketController extends BaseController
|
|||||||
$replaceData = $ticket_data[$value] ?? '';
|
$replaceData = $ticket_data[$value] ?? '';
|
||||||
} else if ($value == "policy_type") {
|
} else if ($value == "policy_type") {
|
||||||
$replaceData = str_replace("Claim-", "", $this->ticketType[$ticket_data['ticket_type_id']] ?? "");
|
$replaceData = str_replace("Claim-", "", $this->ticketType[$ticket_data['ticket_type_id']] ?? "");
|
||||||
|
} else if ($value == "claim_form_link"){
|
||||||
|
$replaceData = '<a href="' . base_url('claim-form-download/' . md5($ticket_data['insurer_id'])) . '" target="_blank">Click here to download Claim Form</a>';
|
||||||
}else {
|
}else {
|
||||||
$replaceData = isset($ticket_data[$value]) ? strtoupper($ticket_data[$value]) : '';
|
$replaceData = isset($ticket_data[$value]) ? $ticket_data[$value] : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = str_replace($key, $replaceData, $content);
|
$content = str_replace($key, $replaceData, $content);
|
||||||
@ -1054,136 +1236,7 @@ class TicketController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function accountManagerWiseReport($policy_type = null ,$start_date = null, $end_date = null){
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// if ($policy_type == 1) {
|
|
||||||
// $sql = "SELECT
|
|
||||||
// u.first_name AS acc_manager_name,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = 1 THEN master.id END) AS id_not_generated,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = 1 THEN master.id END) AS non_id,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = 1 THEN master.id END) AS cda,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = 1 THEN master.id END) AS information_required,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = 1 THEN master.id END) AS under_process,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = 1 THEN master.id END) AS approved,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = 1 THEN master.id END) AS payment_initiated,
|
|
||||||
// (
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = 1 THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = 1 THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = 1 THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = 1 THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = 1 THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = 1 THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = 1 THEN master.id END)
|
|
||||||
// ) AS total
|
|
||||||
// FROM
|
|
||||||
// ticket_master master
|
|
||||||
// JOIN
|
|
||||||
// user_profiles u ON master.acm_id = u.id and u.is_active = 1
|
|
||||||
// JOIN
|
|
||||||
// ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
|
|
||||||
// WHERE
|
|
||||||
// master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1
|
|
||||||
// GROUP BY
|
|
||||||
// u.id;
|
|
||||||
// ";
|
|
||||||
// $result = $this->ticketMasterModel->query($sql)->getResultArray();
|
|
||||||
// // dd($result);
|
|
||||||
|
|
||||||
// return $result;
|
|
||||||
|
|
||||||
|
|
||||||
// }else{
|
|
||||||
// $sql = "SELECT u.first_name AS acc_manager_name,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'CLAIM INTIMATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS claim_intimation,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'INTIMATION TO INSURER' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS int_to_insurer,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'CLIENT PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS client_pending,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'INSURER PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS information_required,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'INVESTIGATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS investigation,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS approved,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'ON HOLD' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS on_hold,
|
|
||||||
|
|
||||||
// (
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'CLAIM INTIMATION' AND master.ticket_type_id = '$policy_type' THEN master.id END)+
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'INTIMATION TO INSURER' AND master.ticket_type_id = '$policy_type' THEN master.id END)+
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'CLIENT PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'INSURER PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'INVESTIGATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'ON HOLD' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
|
||||||
// ) AS total1,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'NOT COVERED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS not_covered,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS closed,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS settled,
|
|
||||||
// (
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'NOT COVERED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
|
||||||
// ) AS total2
|
|
||||||
// FROM
|
|
||||||
// ticket_master master
|
|
||||||
// JOIN
|
|
||||||
// user_profiles u ON master.acm_id = u.id and u.is_active = 1
|
|
||||||
// JOIN
|
|
||||||
// ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
|
|
||||||
// WHERE
|
|
||||||
// master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1 and master.ticket_type_id = '$policy_type'
|
|
||||||
// GROUP BY
|
|
||||||
// u.id;
|
|
||||||
// ";
|
|
||||||
// $result = $this->ticketMasterModel->query($sql)->getResultArray();
|
|
||||||
|
|
||||||
// return $result;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public function tpaWiseReport($policy_type = null ,$start_date = null,$end_date = null ){
|
|
||||||
// // $policy_type = 1;
|
|
||||||
// $sql = "SELECT
|
|
||||||
// tpa.name AS tpa_name,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS id_not_generated,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS non_id,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS cda,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS information_required,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS under_process,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS approved,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS payment_initiated,
|
|
||||||
// (
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
|
||||||
// ) AS total,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS closed,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS settled,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'RETURNED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS returned,
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'REJECTED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS denied,
|
|
||||||
// (
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type'THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'RETURNED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
|
||||||
// COUNT(CASE WHEN tcs.claim_status = 'REJECTED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
|
||||||
// ) AS total2
|
|
||||||
// FROM
|
|
||||||
// ticket_master master
|
|
||||||
// JOIN
|
|
||||||
// tpa ON master.tpa_id = tpa.id and tpa.is_active = 1
|
|
||||||
// JOIN
|
|
||||||
// ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
|
|
||||||
// WHERE
|
|
||||||
// master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1
|
|
||||||
// GROUP BY
|
|
||||||
// tpa.id;
|
|
||||||
|
|
||||||
|
|
||||||
// ";
|
|
||||||
// $result = $this->ticketMasterModel->query($sql)->getResultArray();
|
|
||||||
|
|
||||||
// return $result;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// function for Reject ticket Head Approvel mail sent function
|
// function for Reject ticket Head Approvel mail sent function
|
||||||
public function sendMailToTheHead($ticket_data)
|
public function sendMailToTheHead($ticket_data)
|
||||||
@ -1238,4 +1291,154 @@ class TicketController extends BaseController
|
|||||||
$this->myLogger->logme('error', "Head Mail can't be sent because ticket data is empty");
|
$this->myLogger->logme('error', "Head Mail can't be sent because ticket data is empty");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLastMatchedStatus($incoming_form_values)
|
||||||
|
{
|
||||||
|
if (empty($incoming_form_values) || !isset($incoming_form_values['claim_status_id']) || !isset($incoming_form_values['extra_fields_array_for_validate'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$lastMatchedStatus = $incoming_form_values['claim_status_id'];
|
||||||
|
|
||||||
|
// Use the provided `extra_fields_array_for_validate` from the incoming data
|
||||||
|
$statusMapping = json_decode($incoming_form_values['extra_fields_array_for_validate']);
|
||||||
|
|
||||||
|
foreach ($statusMapping as $status => $requiredFields) {
|
||||||
|
// Ensure requiredFields is an array
|
||||||
|
if (!is_array($requiredFields)) {
|
||||||
|
$requiredFields = [$requiredFields];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if all required fields exist and are not empty in the incoming form values
|
||||||
|
$allFieldsMatched = true;
|
||||||
|
foreach ($requiredFields as $field) {
|
||||||
|
if (!isset($incoming_form_values[$field]) || empty($incoming_form_values[$field])) {
|
||||||
|
$allFieldsMatched = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the last matched status if all fields are validated
|
||||||
|
if ($allFieldsMatched) {
|
||||||
|
$lastMatchedStatus = $status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($lastMatchedStatus == 1){
|
||||||
|
if(!empty($incoming_form_values['tpa_no'])){
|
||||||
|
$lastMatchedStatus = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $lastMatchedStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPolicyStartDate()
|
||||||
|
{
|
||||||
|
|
||||||
|
$data = $this->request->getPost();
|
||||||
|
$client_policy_id = $data['policy_id'];
|
||||||
|
$policy_start_date = $this->clientPolicyModel->select('policy_start_date')->where('id', $client_policy_id)->first()['policy_start_date'];
|
||||||
|
// dd($data);
|
||||||
|
if (isset($data['employeeId']) && $data['employeeId'] != "" && $data['employeeId'] != null) {
|
||||||
|
// dd($data);
|
||||||
|
$emp_id = $data['employeeId'];
|
||||||
|
$empData = $this->employeeModel->select('dob,doj')->where('id',$emp_id)->findAll();
|
||||||
|
|
||||||
|
if (!empty($empData) && $empData != "" && $empData != null ) {
|
||||||
|
foreach ($empData as &$emp) { // Loop through the data
|
||||||
|
$emp['dob'] = date('d/m/Y', strtotime($emp['dob']));
|
||||||
|
$emp['doj'] = date('d/m/Y', strtotime($emp['doj']));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($empData){
|
||||||
|
return $this->respond(['status' => true, 'minDate' => $policy_start_date,'empData'=> $empData], 200);
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status' => false, 'message' => "Policy Not Found"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// dd($policy_start_date);
|
||||||
|
if ($policy_start_date) {
|
||||||
|
return $this->respond(['status' => true, 'minDate' => $policy_start_date], 200);
|
||||||
|
} else {
|
||||||
|
return $this->respond(['status' => false, 'message' => "Policy Not Found"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPoliciesbyEmpID() {
|
||||||
|
$received_data = $this->request->getPost();
|
||||||
|
$emp_id = $received_data['emp_id'];
|
||||||
|
|
||||||
|
// Get all client policy IDs for the given employee
|
||||||
|
$policies = $this->employeePolicyModel
|
||||||
|
->select('client_policy_id')
|
||||||
|
->where('employee_id', $emp_id)
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
if (empty($policies)) {
|
||||||
|
return []; // Return empty if no policies found
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract client policy IDs into an array
|
||||||
|
$policy_ids = array_column($policies, 'client_policy_id');
|
||||||
|
|
||||||
|
// Fetch all policy names and IDs in one query
|
||||||
|
$policyNameandID = $this->clientPolicyModel
|
||||||
|
->select('CONCAT(policy_type.policy_type, "-", client_policy.policy_no) as client_policy_name, client_policy.id as client_policy_value,client_policy.policy_type_id')
|
||||||
|
->join('policy_type', 'policy_type.id = client_policy.policy_type_id AND policy_type.is_active = 1')
|
||||||
|
->whereIn('client_policy.id', $policy_ids)
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
// dd($policyNameandID);
|
||||||
|
if ($policyNameandID){
|
||||||
|
|
||||||
|
return $this->respond(['status'=>true,'policy_data'=> $policyNameandID]);
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status'=>false,'message'=> "Policy Not Found"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCheckListAndConvertArrayToString($ticket_data)
|
||||||
|
{
|
||||||
|
$data = db_connect()->table('ticket_check_list')
|
||||||
|
->where('is_active', 1)
|
||||||
|
->where('ticket_type_id', $ticket_data['ticket_type_id'])
|
||||||
|
->get()->getResultArray();
|
||||||
|
|
||||||
|
$data = !empty($data) ? implode("", array_map(fn($doc) => "<p>{$doc['document']}</p>", $data)) : "";
|
||||||
|
// $data = !empty($data) ? implode(", ", array_column($data, 'document')) : "";
|
||||||
|
// print_r($data); die;
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function downloadClaimForm($insurer_id)
|
||||||
|
{
|
||||||
|
$insurerModel = new InsurerModel();
|
||||||
|
$insurer_data = $insurerModel->where('MD5(id)', $insurer_id)->where('is_active', 1)->first();
|
||||||
|
|
||||||
|
if (!$insurer_data) {
|
||||||
|
$data['message'] = 'The Physical File Not Found';
|
||||||
|
echo view('errors/404', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
$fileName = $insurer_data['short_name'] . '.pdf';
|
||||||
|
$filePath = ROOTPATH . 'public/claim_sample_forms/' . $fileName;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (file_exists($filePath)) {
|
||||||
|
return $this->response->download($filePath, null);
|
||||||
|
} else {
|
||||||
|
$data['message'] = 'The Physical File Not Found';
|
||||||
|
echo view('errors/404', $data);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->myLogger->logme('error', $e->getMessage());
|
||||||
|
return $this->response->setStatusCode(500)->setBody('An error occurred while downloading the file.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -201,7 +201,7 @@ class ChatbotHelper
|
|||||||
$message = SELF::quotationRequestMailTemplate($data);
|
$message = SELF::quotationRequestMailTemplate($data);
|
||||||
|
|
||||||
$common = ['mail_type'=>'request_quotation_bot'];
|
$common = ['mail_type'=>'request_quotation_bot'];
|
||||||
$email_id = 'no-reply-otp@nhanceindia.in';
|
$email_id = getenv('email.enquiryMail');
|
||||||
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Quotation Request Received from bot.', 'message' => $message,'common'=>$common]);
|
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Quotation Request Received from bot.', 'message' => $message,'common'=>$common]);
|
||||||
|
|
||||||
$res = json_decode($res);
|
$res = json_decode($res);
|
||||||
@ -224,13 +224,22 @@ class ChatbotHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function getReimbursementClaimStatus($chat_session_info){
|
public static function getReimbursementClaimStatus($chat_session_info){
|
||||||
|
|
||||||
|
$client_claim_status = [
|
||||||
|
'Received' => [1,2,3,4],
|
||||||
|
'Under Process' => [5,6,7,10],
|
||||||
|
'Finished' => [9,11,12],
|
||||||
|
'Rejected' => [8],
|
||||||
|
'Cancelled' => [13,14]
|
||||||
|
];
|
||||||
$emp_id = $chat_session_info['emp_id'];
|
$emp_id = $chat_session_info['emp_id'];
|
||||||
|
log_message('error','emp_id'.$emp_id);
|
||||||
$emp_code = $chat_session_info['emp_code'];
|
$emp_code = $chat_session_info['emp_code'];
|
||||||
$client_id = $chat_session_info['client_id'];
|
$client_id = $chat_session_info['client_id'];
|
||||||
$client_branch_id = $chat_session_info['client_branch_id'];
|
$client_branch_id = $chat_session_info['client_branch_id'];
|
||||||
|
|
||||||
$ticketMaster = new TicketMasterModel();
|
$ticketMaster = new TicketMasterModel();
|
||||||
$data = $ticketMaster->select('tcs.claim_status,ticket_master.claim_number,ticket_master.id')
|
$data = $ticketMaster->select('tcs.id as tcs_id,tcs.claim_status,ticket_master.claim_number,ticket_master.id,ticket_master.emp_name,ticket_master.emp_mail')
|
||||||
// ->join('client_policy cp',"cp.client_id = {$client_id} and cp.client_branch_id = {$client_branch_id} and cp.policy_id = {$policy_id} and cp.is_active = 1")
|
// ->join('client_policy cp',"cp.client_id = {$client_id} and cp.client_branch_id = {$client_branch_id} and cp.policy_id = {$policy_id} and cp.is_active = 1")
|
||||||
->join('ticket_claim_status tcs',"ticket_master.claim_status_id = tcs.id and tcs.is_active = 1")
|
->join('ticket_claim_status tcs',"ticket_master.claim_status_id = tcs.id and tcs.is_active = 1")
|
||||||
->where('ticket_master.emp_id',$emp_id)
|
->where('ticket_master.emp_id',$emp_id)
|
||||||
@ -238,14 +247,38 @@ class ChatbotHelper
|
|||||||
->where('ticket_master.is_active',1)
|
->where('ticket_master.is_active',1)
|
||||||
->orderBy('ticket_master.created_at', 'DESC')
|
->orderBy('ticket_master.created_at', 'DESC')
|
||||||
->first();
|
->first();
|
||||||
|
$server_claim_status = $data['tcs_id'];
|
||||||
|
$matched_key = null;
|
||||||
|
foreach ($client_claim_status as $key => $statuses) {
|
||||||
|
if (in_array($server_claim_status, $statuses)) {
|
||||||
|
$matched_key = $key;
|
||||||
|
break; // Stop loop once found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log_message('error','Data from ticket master'.json_encode($data));
|
||||||
|
// print_r($data);
|
||||||
|
// die();
|
||||||
$ticket_controller = new TicketController();
|
$ticket_controller = new TicketController();
|
||||||
|
|
||||||
if (!empty($data)){
|
if (!empty($data) && !empty($matched_key)){
|
||||||
$ticket_id = $data['id'];
|
$ticket_id = $data['id'];
|
||||||
$mail_content = $ticket_controller->constructMailContent($ticket_id);
|
$mail_content = Self::ReimbursementStatusMailTemplate($data['emp_name'],$data['claim_number'],$matched_key);
|
||||||
$mail_response = $ticket_controller->sendTrigger($mail_content);
|
$common = ['mail_type'=>'Claim Status'];
|
||||||
|
$email_id = $data['emp_mail'];
|
||||||
|
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Here is your claim status you requested in bot.', 'message' => $mail_content,'common'=>$common]);
|
||||||
|
|
||||||
|
$res = json_decode($res);
|
||||||
|
log_message('error','res: '.json_encode($res));
|
||||||
|
if($res->status == 'success')
|
||||||
|
{
|
||||||
|
$data['client_status'] = $matched_key;
|
||||||
return $data;
|
return $data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
return false;
|
return false;
|
||||||
@ -253,6 +286,283 @@ class ChatbotHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function ReimbursementStatusMailTemplate($emp_name, $claim_number, $client_status) {
|
||||||
|
$template = '
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<!--[if gte mso 9]>
|
||||||
|
<xml>
|
||||||
|
<o:OfficeDocumentSettings>
|
||||||
|
<o:AllowPNG/>
|
||||||
|
<o:PixelsPerInch>96</o:PixelsPerInch>
|
||||||
|
</o:OfficeDocumentSettings>
|
||||||
|
</xml>
|
||||||
|
<![endif]-->
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="x-apple-disable-message-reformatting">
|
||||||
|
<!--[if !mso]><!-->
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"><!--<![endif]-->
|
||||||
|
<title></title>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
@media only screen and (min-width: 640px) {
|
||||||
|
.u-row {
|
||||||
|
width: 620px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-row .u-col {
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.u-row .u-col-100 {
|
||||||
|
width: 620px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 640px) {
|
||||||
|
.u-row-container {
|
||||||
|
max-width: 100% !important;
|
||||||
|
padding-left: 0px !important;
|
||||||
|
padding-right: 0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-row {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-row .u-col {
|
||||||
|
display: block !important;
|
||||||
|
width: 100% !important;
|
||||||
|
min-width: 320px !important;
|
||||||
|
max-width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-row .u-col>div {
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.u-row .u-col img {
|
||||||
|
max-width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
table,
|
||||||
|
td,
|
||||||
|
tr {
|
||||||
|
border-collapse: collapse;
|
||||||
|
vertical-align: top
|
||||||
|
}
|
||||||
|
|
||||||
|
.ie-container table,
|
||||||
|
.mso-container table {
|
||||||
|
table-layout: fixed
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
line-height: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
a[x-apple-data-detectors=true] {
|
||||||
|
color: inherit !important;
|
||||||
|
text-decoration: none !important
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
table,
|
||||||
|
td {
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="clean-body u_body" style="margin: 0;padding: 0;-webkit-text-size-adjust: 100%;background-color: #F9F9F9;color: #000000">
|
||||||
|
<!--[if IE]><div class="ie-container"><![endif]-->
|
||||||
|
<!--[if mso]><div class="mso-container"><![endif]-->
|
||||||
|
<table style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;min-width: 320px;Margin: 0 auto;background-color: #F9F9F9;width:100%" cellpadding="0" cellspacing="0">
|
||||||
|
<tbody>
|
||||||
|
<tr style="vertical-align: top">
|
||||||
|
<td style="word-break: break-word;border-collapse: collapse !important;vertical-align: top">
|
||||||
|
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" style="background-color: #F9F9F9;"><![endif]-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="u-row-container" style="padding: 0px;background-color: transparent">
|
||||||
|
<div class="u-row" style="margin: 0 auto;min-width: 320px;max-width: 620px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: transparent;">
|
||||||
|
<div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;">
|
||||||
|
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: transparent;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:620px;"><tr style="background-color: transparent;"><![endif]-->
|
||||||
|
|
||||||
|
<!--[if (mso)|(IE)]><td align="center" width="620" style="width: 620px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;" valign="top"><![endif]-->
|
||||||
|
<div class="u-col u-col-100" style="max-width: 320px;min-width: 620px;display: table-cell;vertical-align: top;">
|
||||||
|
<div style="height: 100%;width: 100% !important;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;">
|
||||||
|
<!--[if (!mso)&(!IE)]><!-->
|
||||||
|
<div style="box-sizing: border-box; height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;"><!--<![endif]-->
|
||||||
|
|
||||||
|
<table style="font-family:times new roman,times;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:times new roman,times;" align="left">
|
||||||
|
|
||||||
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td style="padding-right: 0px;padding-left: 0px;" align="center">
|
||||||
|
|
||||||
|
<img align="center" border="0" src="https://assets.unlayer.com/projects/263979/1739609649412-nhance_logo.png?w=372px" alt="" title="" style="outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;clear: both;display: inline-block !important;border: none;height: auto;float: none;width: 31%;max-width: 186px;" width="186" />
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<!--[if (!mso)&(!IE)]><!-->
|
||||||
|
</div><!--<![endif]-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--[if (mso)|(IE)]></td><![endif]-->
|
||||||
|
<!--[if (mso)|(IE)]></tr></table></td></tr></table><![endif]-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="u-row-container" style="padding: 0px;background-color: transparent">
|
||||||
|
<div class="u-row" style="margin: 0 auto;min-width: 320px;max-width: 620px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: transparent;">
|
||||||
|
<div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;">
|
||||||
|
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: transparent;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:620px;"><tr style="background-color: transparent;"><![endif]-->
|
||||||
|
|
||||||
|
<!--[if (mso)|(IE)]><td align="center" width="620" style="width: 620px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;" valign="top"><![endif]-->
|
||||||
|
<div class="u-col u-col-100" style="max-width: 320px;min-width: 620px;display: table-cell;vertical-align: top;">
|
||||||
|
<div style="height: 100%;width: 100% !important;">
|
||||||
|
<!--[if (!mso)&(!IE)]><!-->
|
||||||
|
<div style="box-sizing: border-box; height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;"><!--<![endif]-->
|
||||||
|
|
||||||
|
<table style="font-family:times new roman,times;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:times new roman,times;" align="left">
|
||||||
|
|
||||||
|
<div style="font-size: 14px; line-height: 140%; text-align: left; word-wrap: break-word;">
|
||||||
|
<p style="line-height: 140%; margin: 0px;"> </p>
|
||||||
|
<p style="line-height: 140%; margin: 0px;">Dear [[member_name]],</p>
|
||||||
|
<p style="line-height: 140%; margin: 0px;">Your Claim Number [[claim_number]] is currently in the <strong>[[status]]</strong> status with us.</p>
|
||||||
|
<p style="line-height: 140%; margin: 0px;"> </p>
|
||||||
|
<p style="line-height: 140%; margin: 0px;"> </p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<!--[if (!mso)&(!IE)]><!-->
|
||||||
|
</div><!--<![endif]-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--[if (mso)|(IE)]></td><![endif]-->
|
||||||
|
<!--[if (mso)|(IE)]></tr></table></td></tr></table><![endif]-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="u-row-container" style="padding: 0px;background-color: transparent">
|
||||||
|
<div class="u-row" style="margin: 0 auto;min-width: 320px;max-width: 620px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: transparent;">
|
||||||
|
<div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;">
|
||||||
|
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: transparent;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:620px;"><tr style="background-color: transparent;"><![endif]-->
|
||||||
|
|
||||||
|
<!--[if (mso)|(IE)]><td align="center" width="620" style="width: 620px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;" valign="top"><![endif]-->
|
||||||
|
<div class="u-col u-col-100" style="max-width: 320px;min-width: 620px;display: table-cell;vertical-align: top;">
|
||||||
|
<div style="height: 100%;width: 100% !important;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;">
|
||||||
|
<!--[if (!mso)&(!IE)]><!-->
|
||||||
|
<div style="box-sizing: border-box; height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;"><!--<![endif]-->
|
||||||
|
|
||||||
|
<table style="font-family:times new roman,times;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:times new roman,times;" align="left">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<img alt="Alternate image text" src="https://ci3.googleusercontent.com/meips/ADKq_NZ1tC_lDp1mJDJ6iwpQvycq0vGPIeb0bF_z4SVXl6h2csrbTBpjuVtXZuXhPHAIRyGfRvc30Y83qZtaXRsM4_p2B9-yGkYAS56f6UraLELku6bQTXbhUaAyXGeq8TndT-y0vuvSLRhMi8iS9xL62fcwJ8r-MqMCdiwLcvuYRFZHcWeuPmkC_ByeA0H0v3lVozfDHgTThXzpuzsfkMMhg4wcUoxWxVNg4GNkS9dv=s0-d-e1-ft#https://res.cloudinary.com/mailmodo/image/upload/v1731739899/editor/p/86755bd3-1482-4348-86df-ac4c01829407/93af6a8f9f9d7c81c28b1b51d9127cea_fv4fpe.gif" width="22" height="auto" class="CToWUd __web-inspector-hide-shortcut__" data-bit="iit" style="border: 0px solid transparent; height: auto; line-height: 13px; outline: 0px; text-decoration: none; object-fit: cover; border-radius: 0px; display: block; width: 21.9907px; font-size: 13px; margin-left: auto; margin-right: auto;">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table style="font-family:times new roman,times;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:times new roman,times;" align="left">
|
||||||
|
|
||||||
|
<div style="font-size: 14px; line-height: 140%; text-align: center; word-wrap: break-word;">
|
||||||
|
<p style="line-height: 140%; margin: 0px;">ⓒ2024 Nhance India Insurance Broking Pvt Ltd</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<!--[if (!mso)&(!IE)]><!-->
|
||||||
|
</div><!--<![endif]-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--[if (mso)|(IE)]></td><![endif]-->
|
||||||
|
<!--[if (mso)|(IE)]></tr></table></td></tr></table><![endif]-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<!--[if mso]></div><![endif]-->
|
||||||
|
<!--[if IE]></div><![endif]-->
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
';
|
||||||
|
|
||||||
|
// Replace placeholders with actual values
|
||||||
|
$replacedTemplate = str_replace(
|
||||||
|
['[[member_name]]', '[[claim_number]]', '[[status]]'],
|
||||||
|
[$emp_name, $claim_number, $client_status],
|
||||||
|
$template
|
||||||
|
);
|
||||||
|
|
||||||
|
return $replacedTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -63,6 +63,7 @@ class DepositHelper
|
|||||||
'updated_by' => $data['updated_by'],
|
'updated_by' => $data['updated_by'],
|
||||||
'balance' => $newBalance, // Include the new balance in the data array
|
'balance' => $newBalance, // Include the new balance in the data array
|
||||||
'cd_ac_pk'=> isset($data['cd_ac_pk'])?$data['cd_ac_pk']:null,
|
'cd_ac_pk'=> isset($data['cd_ac_pk'])?$data['cd_ac_pk']:null,
|
||||||
|
'record_date' => $data['record_date'] ?? null
|
||||||
];
|
];
|
||||||
|
|
||||||
// Insert data and get the insert ID
|
// Insert data and get the insert ID
|
||||||
|
|||||||
@ -682,7 +682,7 @@ if (!function_exists('generate_relationship_code'))
|
|||||||
$slug = \Config\Services::slug();
|
$slug = \Config\Services::slug();
|
||||||
$relationship_code = $slug->slugify($arr['relationship']);
|
$relationship_code = $slug->slugify($arr['relationship']);
|
||||||
$emp_type_code = ($relationship_code == 'self' ? 'EMP_TYP_01' : 'EMP_TYP_03');
|
$emp_type_code = ($relationship_code == 'self' ? 'EMP_TYP_01' : 'EMP_TYP_03');
|
||||||
$relationship_code = $gender[ $arr['gender'] ] . $relationship[ $relationship_code ] ;
|
$relationship_code = $gender[ trim($arr['gender']) ] . $relationship[ trim($relationship_code) ];
|
||||||
return ['relationship_code' => $relationship_code,'emp_type_code' => $emp_type_code];
|
return ['relationship_code' => $relationship_code,'emp_type_code' => $emp_type_code];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2173,8 +2173,7 @@ if(!function_exists('group_slab_rates_basedon_name'))
|
|||||||
|
|
||||||
|
|
||||||
//this key generating mandantory for display employee info in enrolment app w/o error
|
//this key generating mandantory for display employee info in enrolment app w/o error
|
||||||
if(!function_exists('generate_family_floater_key'))
|
if (!function_exists('generate_family_floater_key')) {
|
||||||
{
|
|
||||||
function generate_family_floater_key($relationship)
|
function generate_family_floater_key($relationship)
|
||||||
{
|
{
|
||||||
if (strtolower(trim($relationship)) === 'mother' || strtolower(trim($relationship)) === 'father') {
|
if (strtolower(trim($relationship)) === 'mother' || strtolower(trim($relationship)) === 'father') {
|
||||||
@ -2188,5 +2187,7 @@ if(!function_exists('generate_family_floater_key'))
|
|||||||
} else {
|
} else {
|
||||||
$relation = 'self';
|
$relation = 'self';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $relation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1247,7 +1247,7 @@ class sendMailNotification
|
|||||||
$subject = $notification['subject'];
|
$subject = $notification['subject'];
|
||||||
|
|
||||||
$rand_string = 'HX3kUh';
|
$rand_string = 'HX3kUh';
|
||||||
$link = generate_download_link($rand_string);
|
$link = generate_download_link($rand_string).'/1';
|
||||||
|
|
||||||
$name = 'John Doe';
|
$name = 'John Doe';
|
||||||
$mobile = 9080706050;
|
$mobile = 9080706050;
|
||||||
|
|||||||
@ -27,7 +27,8 @@ class ClientDepositModel extends Model
|
|||||||
"endorsement_no",
|
"endorsement_no",
|
||||||
"event_name",
|
"event_name",
|
||||||
"unit",
|
"unit",
|
||||||
"cd_ac_pk"
|
"cd_ac_pk",
|
||||||
|
"record_date"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -259,6 +259,7 @@ class ClientPolicyModel extends Model
|
|||||||
->select('SUM(CASE WHEN sub_type = 3 THEN amount ELSE 0 END) AS total_refund')
|
->select('SUM(CASE WHEN sub_type = 3 THEN amount ELSE 0 END) AS total_refund')
|
||||||
->where('client_id', $clientId)
|
->where('client_id', $clientId)
|
||||||
->where('insurer_id', $insurerId)
|
->where('insurer_id', $insurerId)
|
||||||
|
->where('cash_deposit.is_active', 1)
|
||||||
->get()
|
->get()
|
||||||
->getRow();
|
->getRow();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -149,7 +149,21 @@ class EmployeeModel extends Model
|
|||||||
{
|
{
|
||||||
|
|
||||||
return $this->db->table('employee_polices')
|
return $this->db->table('employee_polices')
|
||||||
->select(' policy_type.long_name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment,client_policy.disclaimer,client_policy.policy_type_id , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string') // Select all columns from both tables
|
->select('
|
||||||
|
policy_type.long_name as Policy_Name ,
|
||||||
|
client_policy.policy_terms as Policy_Terms,
|
||||||
|
client_policy.client_id as ClientId,
|
||||||
|
client_policy.policy_id as PolicyId,
|
||||||
|
client_policy.id as ClientPolicyId,
|
||||||
|
CASE
|
||||||
|
WHEN client_policy.open_for_enrollment IS NULL THEN 0
|
||||||
|
ELSE client_policy.open_for_enrollment
|
||||||
|
END AS OpenForEnrollment,
|
||||||
|
client_policy.disclaimer,
|
||||||
|
client_policy.policy_type_id ,
|
||||||
|
employee_polices.tpa_id as tpa_id ,
|
||||||
|
employee_polices.rand_string as rand_string
|
||||||
|
', FALSE) // Select all columns from both tables
|
||||||
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
||||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||||
->where('client_policy.policy_status', 1)
|
->where('client_policy.policy_status', 1)
|
||||||
@ -240,9 +254,9 @@ class EmployeeModel extends Model
|
|||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEmployeeByEmployeeCode($emp_code)
|
public function getEmployeeByEmployeeCode($emp_code, $client_policy_id = null, $client_id = null)
|
||||||
{
|
{
|
||||||
return $this->select("
|
$query = $this->select("
|
||||||
employees.id AS emp_id,
|
employees.id AS emp_id,
|
||||||
employees.name AS emp_name,
|
employees.name AS emp_name,
|
||||||
employees.emp_code,
|
employees.emp_code,
|
||||||
@ -255,9 +269,38 @@ class EmployeeModel extends Model
|
|||||||
->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
|
->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
|
||||||
->where('employees.is_active', 1)
|
->where('employees.is_active', 1)
|
||||||
->where('employee_polices.is_active', 1)
|
->where('employee_polices.is_active', 1)
|
||||||
->where('employees.emp_code', $emp_code)
|
->where('employees.emp_code', $emp_code);
|
||||||
->groupBy('employees.id')
|
|
||||||
->findAll();
|
if(!empty($client_id)){
|
||||||
|
$query->where('employees.client_id', $client_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($client_policy_id)){
|
||||||
|
$query->where('employee_polices.client_policy_id', $client_policy_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->groupBy('employees.id');
|
||||||
|
$data = $query->findAll();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAcmUsingClientID($client_id)
|
||||||
|
{
|
||||||
|
return $this->db->table('client_rm')
|
||||||
|
->select('user_profiles.id, user_profiles.first_name')
|
||||||
|
->join('user_profiles', 'client_rm.user_id = user_profiles.id')
|
||||||
|
->where([
|
||||||
|
'client_rm.level' => 3,
|
||||||
|
'user_profiles.role' => 3,
|
||||||
|
'client_rm.is_active' => 1,
|
||||||
|
'user_profiles.is_active' => 1,
|
||||||
|
'client_rm.client_id' => $client_id
|
||||||
|
])
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -886,7 +886,6 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT
|
SELECT
|
||||||
emp_code,
|
|
||||||
group_key,
|
group_key,
|
||||||
MAX(CASE WHEN field_name = 'emp_status' THEN new_value END) AS empstatus,
|
MAX(CASE WHEN field_name = 'emp_status' THEN new_value END) AS empstatus,
|
||||||
MAX(CASE WHEN field_name = 'change_event' THEN new_value END) AS changeevent,
|
MAX(CASE WHEN field_name = 'change_event' THEN new_value END) AS changeevent,
|
||||||
@ -902,7 +901,7 @@ class EmployeePolicyModel extends Model
|
|||||||
group_key
|
group_key
|
||||||
|
|
||||||
) AS deletiondata
|
) AS deletiondata
|
||||||
ON a.emp_code = deletiondata.emp_code AND a.status != 'truncated'
|
ON a.group_key = deletiondata.group_key AND a.status != 'truncated'
|
||||||
|
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
(
|
(
|
||||||
@ -1683,6 +1682,9 @@ class EmployeePolicyModel extends Model
|
|||||||
// reverse the employee policy table data for the truncated the deletion file
|
// reverse the employee policy table data for the truncated the deletion file
|
||||||
public function updateEmployeePolicyTruncateReverse($file_id)
|
public function updateEmployeePolicyTruncateReverse($file_id)
|
||||||
{
|
{
|
||||||
|
log_message('error', 'updateEmployeePolicyTruncateReverse model function called');
|
||||||
|
log_message('error', 'FILE ID : {data}', ['data' => $file_id]);
|
||||||
|
|
||||||
$this->db->query("
|
$this->db->query("
|
||||||
UPDATE employee_polices
|
UPDATE employee_polices
|
||||||
SET
|
SET
|
||||||
@ -1690,7 +1692,7 @@ class EmployeePolicyModel extends Model
|
|||||||
status = 'active',
|
status = 'active',
|
||||||
date_of_exit = NULL,
|
date_of_exit = NULL,
|
||||||
reason_for_exit = NULL,
|
reason_for_exit = NULL,
|
||||||
claim_status = 0,
|
claim_status = 0
|
||||||
WHERE
|
WHERE
|
||||||
id IN (
|
id IN (
|
||||||
SELECT pk
|
SELECT pk
|
||||||
|
|||||||
@ -120,10 +120,10 @@ class LeadsModel extends Model
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLeadDataForLising()
|
public function getLeadDataForLising($where = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->select('
|
$data = $this->select('
|
||||||
leads.*,
|
leads.*,
|
||||||
kyc_entity_type.name as entity_type,
|
kyc_entity_type.name as entity_type,
|
||||||
policy_type.policy_type,
|
policy_type.policy_type,
|
||||||
@ -147,10 +147,13 @@ class LeadsModel extends Model
|
|||||||
->join('kyc_entity_type', 'leads.entity_type_id = kyc_entity_type.id', 'left')
|
->join('kyc_entity_type', 'leads.entity_type_id = kyc_entity_type.id', 'left')
|
||||||
->join('user_profiles', 'leads.salse_person_id = user_profiles.id', 'left')
|
->join('user_profiles', 'leads.salse_person_id = user_profiles.id', 'left')
|
||||||
->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
|
->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
|
||||||
->where('leads.is_active', 1)
|
->where('leads.is_active', 1);
|
||||||
->orderBy('id', 'desc')
|
|
||||||
->findAll();
|
|
||||||
|
|
||||||
|
if (!empty($where)) {
|
||||||
|
$data->where($where);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data->orderBy('leads.id', 'desc')->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLeadForInsertClientList($type = null, $client_id = null)
|
public function getLeadForInsertClientList($type = null, $client_id = null)
|
||||||
|
|||||||
@ -66,6 +66,8 @@ class PTCOShareDetailsModel extends Model
|
|||||||
'statement_id',
|
'statement_id',
|
||||||
'follower_policy_no',
|
'follower_policy_no',
|
||||||
'non_comm_per_amt',
|
'non_comm_per_amt',
|
||||||
|
'cotp_amt',
|
||||||
|
'cotep_amt',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function getNonReconcileredPolicyTransactions(string $insurer_id,string $insurer_branch_id)
|
public function getNonReconcileredPolicyTransactions(string $insurer_id,string $insurer_branch_id)
|
||||||
|
|||||||
@ -318,6 +318,280 @@ class PolicyTransactionModel extends Model
|
|||||||
|
|
||||||
// BDS Report NEW Functin for QUERY
|
// BDS Report NEW Functin for QUERY
|
||||||
// public function getBDSReportList($client_id, $policy_id, $branch_id, $issuer)
|
// public function getBDSReportList($client_id, $policy_id, $branch_id, $issuer)
|
||||||
|
|
||||||
|
// public function getBDSReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $client_branch_id = 0, $insurer_branch_id = 0, $client_policy_id = 0)
|
||||||
|
// {
|
||||||
|
|
||||||
|
// $date_condition = '';
|
||||||
|
// if($date_type == 'statement_month' && $start_date != 0 && $end_date != 0) {
|
||||||
|
// $date_condition = "
|
||||||
|
// AND insurer_statements.month >= '".$start_date ."'
|
||||||
|
// AND insurer_statements.month <= '".$end_date ."'
|
||||||
|
// ";
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $builder = $this->db->table('policy_transaction')
|
||||||
|
// ->select("
|
||||||
|
// policy_transaction.*,
|
||||||
|
// DATE_FORMAT(policy_transaction.policy_issue_date, '%d %b %Y') AS policy_issue_date,
|
||||||
|
// DATE_FORMAT(
|
||||||
|
// IF(policy_transaction.month IS NULL,
|
||||||
|
// policy_transaction.policy_issue_date,
|
||||||
|
// policy_transaction.month),
|
||||||
|
// '%b %Y') AS policy_issue_month,
|
||||||
|
// CASE
|
||||||
|
// WHEN clients.client_type = 1 THEN 'Group'
|
||||||
|
// WHEN clients.client_type = 2 THEN 'Retail'
|
||||||
|
// ELSE '-'
|
||||||
|
// END AS client_type,
|
||||||
|
// CASE
|
||||||
|
// WHEN policy_transaction.revenue_type = 'NA' THEN 'Fresh'
|
||||||
|
// ELSE 'Renewal'
|
||||||
|
// END AS revenue_type,
|
||||||
|
// CASE
|
||||||
|
// WHEN policy_transaction.action_type = 'inception' THEN 'Policy'
|
||||||
|
// ELSE 'Endorsement'
|
||||||
|
// END AS action_type,
|
||||||
|
// clients.client_name AS client_name,
|
||||||
|
// clients.short_name AS client_short_name,
|
||||||
|
// client_branch.branch_name AS client_branch_name,
|
||||||
|
// client_branch.address1 AS client_address,
|
||||||
|
// policy_type.policy_type,
|
||||||
|
// policy_type.bap,
|
||||||
|
// insurers.name AS insurer_name,
|
||||||
|
// insurers.short_name AS insurer_short_name,
|
||||||
|
// insurer_branch.branch_name AS insurer_branch_name,
|
||||||
|
// insurer_branch.branch_code AS insurer_branch_code,
|
||||||
|
// user_profiles.first_name as user_name,
|
||||||
|
// vehicle.vehicle_no,
|
||||||
|
// tpa.name as tpa_name,
|
||||||
|
// pt_co_share_details.remark as remarks,
|
||||||
|
// pt_co_share_details.bp_amt,
|
||||||
|
// pt_co_share_details.exp_amt,
|
||||||
|
// pt_co_share_details.id as pt_id,
|
||||||
|
// sales_user.first_name as salse_person_name,
|
||||||
|
// service_user.first_name as service_person_name,
|
||||||
|
|
||||||
|
// ROUND((pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) AS premium_wo_gst,
|
||||||
|
|
||||||
|
// ROUND((ROUND((pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) * 18 / 100), 2) AS gst_amount,
|
||||||
|
|
||||||
|
// ROUND((ROUND((pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) + ROUND((ROUND((pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) * 18 / 100), 2)), 2) AS total_premium,
|
||||||
|
|
||||||
|
// ROUND((pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) AS tp_or_ter,
|
||||||
|
|
||||||
|
// DATEDIFF(policy_transaction.policy_end_date, CURDATE()) AS days,
|
||||||
|
|
||||||
|
// (pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per) AS agreed_tp_or_ter_per,
|
||||||
|
|
||||||
|
// pt_co_share_details.agreed_bp_per,
|
||||||
|
// ROUND(
|
||||||
|
// (
|
||||||
|
// SELECT
|
||||||
|
// (
|
||||||
|
// SUM(co_share_stmt_details.actual_bp_brokerage_amt) +
|
||||||
|
// SUM(co_share_stmt_details.actual_tp_brokerage_amt) +
|
||||||
|
// SUM(co_share_stmt_details.actual_tep_brokerage_amt) +
|
||||||
|
// SUM(co_share_stmt_details.reward)
|
||||||
|
|
||||||
|
// ) AS total_irda_amt
|
||||||
|
// FROM
|
||||||
|
// co_share_stmt_details
|
||||||
|
// JOIN insurer_statements ON co_share_stmt_details.statement_id = insurer_statements.id
|
||||||
|
// WHERE
|
||||||
|
// co_share_stmt_details.co_share_id = pt_co_share_details.id
|
||||||
|
// AND co_share_stmt_details.is_active = 1
|
||||||
|
// AND insurer_statements.is_active = 1
|
||||||
|
// $date_condition
|
||||||
|
// ),
|
||||||
|
// 2
|
||||||
|
// ) AS total_irda_amt,
|
||||||
|
// ROUND(
|
||||||
|
// (
|
||||||
|
// SELECT
|
||||||
|
// (
|
||||||
|
// SUM(co_share_stmt_details.reward)
|
||||||
|
|
||||||
|
// ) AS reward
|
||||||
|
// FROM
|
||||||
|
// co_share_stmt_details
|
||||||
|
// JOIN insurer_statements ON co_share_stmt_details.statement_id = insurer_statements.id
|
||||||
|
// WHERE
|
||||||
|
// co_share_stmt_details.co_share_id = pt_co_share_details.id
|
||||||
|
// AND co_share_stmt_details.is_active = 1
|
||||||
|
// AND insurer_statements.is_active = 1
|
||||||
|
// $date_condition
|
||||||
|
// ),
|
||||||
|
// 2
|
||||||
|
// ) AS reward,
|
||||||
|
|
||||||
|
// ROUND(
|
||||||
|
// (
|
||||||
|
// SELECT
|
||||||
|
// SUM(
|
||||||
|
// COALESCE(co_share_stmt_details.actual_bp_brokerage_amt, 0) +
|
||||||
|
// COALESCE(co_share_stmt_details.actual_tp_brokerage_amt, 0) +
|
||||||
|
// COALESCE(co_share_stmt_details.actual_tep_brokerage_amt, 0) +
|
||||||
|
// COALESCE(co_share_stmt_details.reward, 0)
|
||||||
|
// ) AS total_irda_amt
|
||||||
|
// FROM
|
||||||
|
// co_share_stmt_details
|
||||||
|
// JOIN pt_co_share_details AS pt_table ON co_share_stmt_details.co_share_id = pt_table.id
|
||||||
|
// JOIN insurer_statements ON co_share_stmt_details.statement_id = insurer_statements.id
|
||||||
|
// WHERE
|
||||||
|
// co_share_stmt_details.co_share_id = pt_co_share_details.id
|
||||||
|
// AND co_share_stmt_details.is_active = 1
|
||||||
|
// AND pt_table.is_active = 1
|
||||||
|
// AND insurer_statements.is_active = 1
|
||||||
|
// AND insurer_statements.invoice_status IS NOT NULL
|
||||||
|
// $date_condition
|
||||||
|
|
||||||
|
// ),
|
||||||
|
// 2
|
||||||
|
// ) AS billed_amt,
|
||||||
|
|
||||||
|
// ROUND(
|
||||||
|
// (
|
||||||
|
// (
|
||||||
|
// SELECT
|
||||||
|
// SUM(
|
||||||
|
// COALESCE(co_share_stmt_details.actual_bp_brokerage_amt, 0)
|
||||||
|
// + COALESCE(co_share_stmt_details.actual_tp_brokerage_amt, 0)
|
||||||
|
// + COALESCE(co_share_stmt_details.actual_tep_brokerage_amt, 0)
|
||||||
|
// + COALESCE(co_share_stmt_details.reward, 0)
|
||||||
|
// )
|
||||||
|
// FROM
|
||||||
|
// co_share_stmt_details
|
||||||
|
// JOIN insurer_statements ON co_share_stmt_details.statement_id = insurer_statements.id
|
||||||
|
// WHERE
|
||||||
|
// co_share_stmt_details.co_share_id = pt_co_share_details.id
|
||||||
|
// AND co_share_stmt_details.is_active = 1
|
||||||
|
// $date_condition
|
||||||
|
// )
|
||||||
|
// -
|
||||||
|
// (
|
||||||
|
// SELECT
|
||||||
|
// SUM(
|
||||||
|
// COALESCE(co_share_stmt_details.actual_bp_brokerage_amt, 0)
|
||||||
|
// + COALESCE(co_share_stmt_details.actual_tp_brokerage_amt, 0)
|
||||||
|
// + COALESCE(co_share_stmt_details.actual_tep_brokerage_amt, 0)
|
||||||
|
// + COALESCE(co_share_stmt_details.reward, 0)
|
||||||
|
// )
|
||||||
|
// FROM
|
||||||
|
// co_share_stmt_details
|
||||||
|
// JOIN pt_co_share_details AS pt_table ON co_share_stmt_details.co_share_id = pt_table.id
|
||||||
|
// JOIN insurer_statements ON co_share_stmt_details.statement_id = insurer_statements.id
|
||||||
|
// WHERE
|
||||||
|
// co_share_stmt_details.co_share_id = pt_co_share_details.id
|
||||||
|
// AND co_share_stmt_details.is_active = 1
|
||||||
|
// AND pt_table.is_active = 1
|
||||||
|
// AND insurer_statements.is_active = 1
|
||||||
|
// AND insurer_statements.invoice_status IS NULL
|
||||||
|
// $date_condition
|
||||||
|
// )
|
||||||
|
// ),
|
||||||
|
// 2
|
||||||
|
// ) AS unbilled_amt
|
||||||
|
|
||||||
|
// ")
|
||||||
|
// ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||||
|
// // ->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id', 'left')
|
||||||
|
// ->join('clients', 'clients.id = policy_transaction.client_id')
|
||||||
|
// ->join('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left')
|
||||||
|
// ->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||||
|
// ->join('user_profiles', 'policy_transaction.created_by = user_profiles.id', 'left')
|
||||||
|
// ->join('vehicle', 'policy_transaction.vehicle_id = vehicle.id', 'left')
|
||||||
|
// ->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
||||||
|
// ->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
|
||||||
|
// ->join('insurer_branch', 'pt_co_share_details.insurer_branch_id = insurer_branch.id', 'left')
|
||||||
|
// ->join('tpa', 'policy_transaction.tpa_id = tpa.id', 'left')
|
||||||
|
// ->join('tpa_branch', 'policy_transaction.tpa_branch_id = tpa_branch.id', 'left')
|
||||||
|
// ->join('user_profiles AS sales_user', 'policy_transaction.sales_generated_by = sales_user.id', 'left')
|
||||||
|
// ->join('user_profiles AS service_user', 'policy_transaction.serviced_by = service_user.id', 'left')
|
||||||
|
// ->where('policy_transaction.is_active', 1)
|
||||||
|
// ->where('pt_co_share_details.is_active', 1);
|
||||||
|
|
||||||
|
// // Check if the start date and end date are provided
|
||||||
|
// if ($start_date != 0 && $end_date != 0 && $date_type != 0 && $date_type != 'statement_month') {
|
||||||
|
|
||||||
|
// $startDate = date('Y-m-d 00:00:00', strtotime($start_date));
|
||||||
|
// $endDate = date('Y-m-d 23:59:59', strtotime($end_date));
|
||||||
|
|
||||||
|
// $builder->where('policy_transaction.'.$date_type.'>=', $startDate)
|
||||||
|
// ->where('policy_transaction.'.$date_type.'<=', $endDate);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // if($date_type == 'statement_month' && $start_date != 0 && $end_date != 0){
|
||||||
|
|
||||||
|
// // $startDate = date('Y-m-d 00:00:00', strtotime($start_date));
|
||||||
|
// // $endDate = date('Y-m-d 23:59:59', strtotime($end_date));
|
||||||
|
// // $builder->where('policy_transaction.month >=', $startDate)
|
||||||
|
// // ->where('policy_transaction.month <=', $endDate);
|
||||||
|
// // }
|
||||||
|
|
||||||
|
// // Conditionally join insurer_statements if $date_type == 'statement_month'
|
||||||
|
// if ($date_type == 'statement_month' && $start_date != 0 && $end_date != 0) {
|
||||||
|
// $startDate = date('Y-m-d', strtotime($start_date));
|
||||||
|
// $endDate = date('Y-m-d', strtotime($end_date));
|
||||||
|
|
||||||
|
// $builder->join('co_share_stmt_details', 'pt_co_share_details.id = co_share_stmt_details.co_share_id', 'left')
|
||||||
|
// ->join('insurer_statements', 'co_share_stmt_details.statement_id = insurer_statements.id','left')
|
||||||
|
// ->where('insurer_statements.is_active', 1)
|
||||||
|
// ->where('insurer_statements.month >=', $startDate)
|
||||||
|
// ->where('insurer_statements.month <=', $endDate)
|
||||||
|
// ->groupBy('co_share_stmt_details.co_share_id');
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($client_id != 0) {
|
||||||
|
// $builder->where('policy_transaction.client_id', $client_id);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($insurer_id != 0) {
|
||||||
|
// $builder->where('policy_transaction.insurer_id', $insurer_id);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($client_branch_id != 0) {
|
||||||
|
// $builder->where('policy_transaction.client_branch_id', $client_branch_id);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($insurer_branch_id != 0) {
|
||||||
|
// $builder->where('policy_transaction.insurer_branch_id', $insurer_branch_id);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($client_policy_id != 0) {
|
||||||
|
// $builder->where('policy_transaction.client_policy_id', $client_policy_id);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// if ($policy_type_id != 0) {
|
||||||
|
// $builder->where('client_policy.policy_type_id', $policy_type_id);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($issuer != 0) {
|
||||||
|
// $builder->where('policy_transaction.issuer', $issuer);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){
|
||||||
|
|
||||||
|
// $fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||||
|
// $toDate = date('Y-m-d 23:59:59');
|
||||||
|
|
||||||
|
// $builder->where('policy_transaction.created_at >=', $fromDate)
|
||||||
|
// ->where('policy_transaction.created_at <=', $toDate);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $builder->orderBy('policy_transaction.id', 'desc');
|
||||||
|
|
||||||
|
// $result = $builder->get()->getResultArray();
|
||||||
|
|
||||||
|
// // dd($this->db->getLastQuery());
|
||||||
|
|
||||||
|
// return $result;
|
||||||
|
// }
|
||||||
|
|
||||||
public function getBDSReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $client_branch_id = 0, $insurer_branch_id = 0, $client_policy_id = 0)
|
public function getBDSReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $client_branch_id = 0, $insurer_branch_id = 0, $client_policy_id = 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -365,19 +639,19 @@ class PolicyTransactionModel extends Model
|
|||||||
vehicle.vehicle_no,
|
vehicle.vehicle_no,
|
||||||
tpa.name as tpa_name,
|
tpa.name as tpa_name,
|
||||||
pt_co_share_details.remark as remarks,
|
pt_co_share_details.remark as remarks,
|
||||||
pt_co_share_details.bp_amt,
|
pt_co_share_details.cop_amt as bp_amt,
|
||||||
pt_co_share_details.exp_amt,
|
pt_co_share_details.exp_amt,
|
||||||
pt_co_share_details.id as pt_id,
|
pt_co_share_details.id as pt_id,
|
||||||
sales_user.first_name as salse_person_name,
|
sales_user.first_name as salse_person_name,
|
||||||
service_user.first_name as service_person_name,
|
service_user.first_name as service_person_name,
|
||||||
|
|
||||||
ROUND((pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) AS premium_wo_gst,
|
ROUND((pt_co_share_details.cop_amt + pt_co_share_details.cotp_amt + pt_co_share_details.cotep_amt), 2) AS premium_wo_gst,
|
||||||
|
|
||||||
ROUND((ROUND((pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) * 18 / 100), 2) AS gst_amount,
|
ROUND((ROUND((pt_co_share_details.cop_amt + pt_co_share_details.cotp_amt + pt_co_share_details.cotep_amt), 2) * 18 / 100), 2) AS gst_amount,
|
||||||
|
|
||||||
ROUND((ROUND((pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) + ROUND((ROUND((pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) * 18 / 100), 2)), 2) AS total_premium,
|
ROUND((ROUND((pt_co_share_details.cop_amt + pt_co_share_details.cotp_amt + pt_co_share_details.cotep_amt), 2) + ROUND((ROUND((pt_co_share_details.cop_amt + pt_co_share_details.cotp_amt + pt_co_share_details.cotep_amt), 2) * 18 / 100), 2)), 2) AS total_premium,
|
||||||
|
|
||||||
ROUND((pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) AS tp_or_ter,
|
ROUND((pt_co_share_details.cotp_amt + pt_co_share_details.cotep_amt), 2) AS tp_or_ter,
|
||||||
|
|
||||||
DATEDIFF(policy_transaction.policy_end_date, CURDATE()) AS days,
|
DATEDIFF(policy_transaction.policy_end_date, CURDATE()) AS days,
|
||||||
|
|
||||||
@ -501,8 +775,8 @@ class PolicyTransactionModel extends Model
|
|||||||
->join('user_profiles', 'policy_transaction.created_by = user_profiles.id', 'left')
|
->join('user_profiles', 'policy_transaction.created_by = user_profiles.id', 'left')
|
||||||
->join('vehicle', 'policy_transaction.vehicle_id = vehicle.id', 'left')
|
->join('vehicle', 'policy_transaction.vehicle_id = vehicle.id', 'left')
|
||||||
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
||||||
->join('insurers', 'policy_transaction.insurer_id = insurers.id', 'left')
|
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
|
||||||
->join('insurer_branch', 'policy_transaction.insurer_branch_id = insurer_branch.id', 'left')
|
->join('insurer_branch', 'pt_co_share_details.insurer_branch_id = insurer_branch.id', 'left')
|
||||||
->join('tpa', 'policy_transaction.tpa_id = tpa.id', 'left')
|
->join('tpa', 'policy_transaction.tpa_id = tpa.id', 'left')
|
||||||
->join('tpa_branch', 'policy_transaction.tpa_branch_id = tpa_branch.id', 'left')
|
->join('tpa_branch', 'policy_transaction.tpa_branch_id = tpa_branch.id', 'left')
|
||||||
->join('user_profiles AS sales_user', 'policy_transaction.sales_generated_by = sales_user.id', 'left')
|
->join('user_profiles AS sales_user', 'policy_transaction.sales_generated_by = sales_user.id', 'left')
|
||||||
@ -591,9 +865,89 @@ class PolicyTransactionModel extends Model
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public function getInceptionTranctionListData($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
|
||||||
|
// {
|
||||||
|
// // dd($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status);
|
||||||
|
// $builder = $this->db->table('policy_transaction')
|
||||||
|
// ->select('
|
||||||
|
// policy_transaction.*,
|
||||||
|
// clients.short_name AS client_short_name,
|
||||||
|
// clients.client_code,
|
||||||
|
// clients.client_type,
|
||||||
|
// clients.client_name,
|
||||||
|
// client_branch.branch_name AS client_branch_name,
|
||||||
|
// insurers.name AS insurer_name,
|
||||||
|
// insurers.short_name AS insurer_short_name,
|
||||||
|
// policy_type.policy_type,
|
||||||
|
// pt_co_share_details.agreed_amt AS amount,
|
||||||
|
// pt_co_share_details.bp_amt AS bp,
|
||||||
|
// pt_co_share_details.tp_amt AS tp
|
||||||
|
// ')
|
||||||
|
// ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||||
|
// ->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||||
|
// ->join('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left')
|
||||||
|
// ->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
|
||||||
|
// ->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||||
|
// ->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
||||||
|
// ->where('policy_transaction.is_active', 1)
|
||||||
|
// ->where('policy_transaction.action_type', 'inception');
|
||||||
|
|
||||||
|
// if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
|
||||||
|
|
||||||
|
// $startDate = date('Y-m-d 00:00:00', strtotime($start_date));
|
||||||
|
// $endDate = date('Y-m-d 23:59:59', strtotime($end_date));
|
||||||
|
|
||||||
|
// $builder->where('policy_transaction.'.$date_type.'>=', $startDate)
|
||||||
|
// ->where('policy_transaction.'.$date_type.'<=', $endDate);
|
||||||
|
// }else{
|
||||||
|
|
||||||
|
// // $fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||||
|
// // $toDate = date('Y-m-d 23:59:59');
|
||||||
|
|
||||||
|
// // $builder->where('policy_transaction.created_at >=', $fromDate)
|
||||||
|
// // ->where('policy_transaction.created_at <=', $toDate);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($client_id != 0) {
|
||||||
|
// $builder->where('policy_transaction.client_id', $client_id);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($insurer_id != 0) {
|
||||||
|
// $builder->where('policy_transaction.insurer_id', $insurer_id);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($policy_type_id != 0) {
|
||||||
|
// $builder->where('client_policy.policy_type_id', $policy_type_id);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($issuer != 0) {
|
||||||
|
// $builder->where('policy_transaction.issuer', $issuer);
|
||||||
|
// }
|
||||||
|
// if ($status != 0) {
|
||||||
|
// $builder->where('policy_transaction.status', $status);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){
|
||||||
|
|
||||||
|
// $fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||||
|
// $toDate = date('Y-m-d 23:59:59');
|
||||||
|
|
||||||
|
// $builder->where('policy_transaction.created_at >=', $fromDate)
|
||||||
|
// ->where('policy_transaction.created_at <=', $toDate);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $builder->orderBy('policy_transaction.id', 'desc')->limit(10);
|
||||||
|
|
||||||
|
// $result = $builder->get()->getResultArray();
|
||||||
|
|
||||||
|
// // dd($this->db->getLastQuery());
|
||||||
|
|
||||||
|
// return $result;
|
||||||
|
// }
|
||||||
|
|
||||||
public function getInceptionTranctionListData($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
|
public function getInceptionTranctionListData($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
|
||||||
{
|
{
|
||||||
// dd($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status);
|
|
||||||
$builder = $this->db->table('policy_transaction')
|
$builder = $this->db->table('policy_transaction')
|
||||||
->select('
|
->select('
|
||||||
policy_transaction.*,
|
policy_transaction.*,
|
||||||
@ -607,7 +961,8 @@ class PolicyTransactionModel extends Model
|
|||||||
policy_type.policy_type,
|
policy_type.policy_type,
|
||||||
pt_co_share_details.agreed_amt AS amount,
|
pt_co_share_details.agreed_amt AS amount,
|
||||||
pt_co_share_details.bp_amt AS bp,
|
pt_co_share_details.bp_amt AS bp,
|
||||||
pt_co_share_details.tp_amt AS tp
|
pt_co_share_details.tp_amt AS tp,
|
||||||
|
clients.pan
|
||||||
')
|
')
|
||||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||||
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||||
@ -618,60 +973,45 @@ class PolicyTransactionModel extends Model
|
|||||||
->where('policy_transaction.is_active', 1)
|
->where('policy_transaction.is_active', 1)
|
||||||
->where('policy_transaction.action_type', 'inception');
|
->where('policy_transaction.action_type', 'inception');
|
||||||
|
|
||||||
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
|
// Optimize Date Filtering
|
||||||
|
if (!empty($start_date) && !empty($end_date) && !empty($date_type)) {
|
||||||
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
|
$builder->where("policy_transaction.$date_type >=", date('Y-m-d 00:00:00', strtotime($start_date)))
|
||||||
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
|
->where("policy_transaction.$date_type <=", date('Y-m-d 23:59:59', strtotime($end_date)));
|
||||||
|
|
||||||
$builder->where('policy_transaction.'.$date_type.'>=', $startDate)
|
|
||||||
->where('policy_transaction.'.$date_type.'<=', $endDate);
|
|
||||||
}else{
|
|
||||||
|
|
||||||
// $fromDate = date('Y-m-d', strtotime('-30 days'));
|
|
||||||
// $toDate = date('Y-m-d 23:59:59');
|
|
||||||
|
|
||||||
// $builder->where('policy_transaction.created_at >=', $fromDate)
|
|
||||||
// ->where('policy_transaction.created_at <=', $toDate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($client_id != 0) {
|
// Apply Filters Only When Necessary
|
||||||
|
if (!empty($client_id)) {
|
||||||
$builder->where('policy_transaction.client_id', $client_id);
|
$builder->where('policy_transaction.client_id', $client_id);
|
||||||
}
|
}
|
||||||
|
if (!empty($insurer_id)) {
|
||||||
if ($insurer_id != 0) {
|
|
||||||
$builder->where('policy_transaction.insurer_id', $insurer_id);
|
$builder->where('policy_transaction.insurer_id', $insurer_id);
|
||||||
}
|
}
|
||||||
|
if (!empty($policy_type_id)) {
|
||||||
if ($policy_type_id != 0) {
|
|
||||||
$builder->where('client_policy.policy_type_id', $policy_type_id);
|
$builder->where('client_policy.policy_type_id', $policy_type_id);
|
||||||
}
|
}
|
||||||
|
if (!empty($issuer)) {
|
||||||
if ($issuer != 0) {
|
|
||||||
$builder->where('policy_transaction.issuer', $issuer);
|
$builder->where('policy_transaction.issuer', $issuer);
|
||||||
}
|
}
|
||||||
if ($status != 0) {
|
if (!empty($status)) {
|
||||||
$builder->where('policy_transaction.status', $status);
|
$builder->where('policy_transaction.status', $status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){
|
// Default to Last 30 Days if No Filters Are Applied
|
||||||
|
if (empty($client_id) && empty($insurer_id) && empty($policy_type_id) && empty($date_type) && empty($issuer)) {
|
||||||
$fromDate = date('Y-m-d', strtotime('-30 days'));
|
$fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||||
$toDate = date('Y-m-d 23:59:59');
|
$toDate = date('Y-m-d 23:59:59');
|
||||||
|
|
||||||
$builder->where('policy_transaction.created_at >=', $fromDate)
|
$builder->where('policy_transaction.created_at >=', $fromDate)
|
||||||
->where('policy_transaction.created_at <=', $toDate);
|
->where('policy_transaction.created_at <=', $toDate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Optimize Query Execution
|
||||||
$builder->orderBy('policy_transaction.id', 'desc');
|
$builder->orderBy('policy_transaction.id', 'desc');
|
||||||
|
|
||||||
$result = $builder->get()->getResultArray();
|
return $builder->get()->getResultArray();
|
||||||
|
|
||||||
// dd($this->db->getLastQuery());
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getEndorsementTranctionListData($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
|
public function getEndorsementTranctionListData($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
|
||||||
{
|
{
|
||||||
// dd($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status);
|
// dd($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status);
|
||||||
@ -761,7 +1101,7 @@ class PolicyTransactionModel extends Model
|
|||||||
|
|
||||||
pt_co_share_details.exp_amt,
|
pt_co_share_details.exp_amt,
|
||||||
pt_co_share_details.variance,
|
pt_co_share_details.variance,
|
||||||
ROUND ( (pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt),2) as original_premium,
|
ROUND ( (pt_co_share_details.cop_amt + pt_co_share_details.cotp_amt + pt_co_share_details.cotep_amt),2) as original_premium,
|
||||||
ROUND(
|
ROUND(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
@ -779,7 +1119,7 @@ class PolicyTransactionModel extends Model
|
|||||||
) AS statement_premium,
|
) AS statement_premium,
|
||||||
|
|
||||||
COALESCE(
|
COALESCE(
|
||||||
(pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 0
|
(pt_co_share_details.cop_amt + pt_co_share_details.cotp_amt + pt_co_share_details.cotep_amt), 0
|
||||||
) -
|
) -
|
||||||
COALESCE(
|
COALESCE(
|
||||||
(
|
(
|
||||||
|
|||||||
@ -77,6 +77,7 @@ class RFQModel extends Model
|
|||||||
->where('rfq.lead_id', $lead_id)
|
->where('rfq.lead_id', $lead_id)
|
||||||
// ->where('rfq.type', $type)
|
// ->where('rfq.type', $type)
|
||||||
->where('rfq.is_active', 1)
|
->where('rfq.is_active', 1)
|
||||||
|
->orderBy('rfq.id', 'desc')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,6 +64,17 @@ class TicketMasterModel extends Model
|
|||||||
'utr_details',
|
'utr_details',
|
||||||
'settle_letter',
|
'settle_letter',
|
||||||
'is_head_approved',
|
'is_head_approved',
|
||||||
|
|
||||||
|
'return_remark',
|
||||||
|
'cancel_remark',
|
||||||
|
'awb_no_courier_name',
|
||||||
|
|
||||||
|
'non_id_reason',
|
||||||
|
'head_rejection_reason',
|
||||||
|
'pay_initiate_date',
|
||||||
|
'emp_personal_mail',
|
||||||
|
'client_policy_id'
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@ -118,14 +129,20 @@ class TicketMasterModel extends Model
|
|||||||
public function getTemplateDataByTicketID($ticket_id)
|
public function getTemplateDataByTicketID($ticket_id)
|
||||||
{
|
{
|
||||||
$template_data = $this
|
$template_data = $this
|
||||||
->select("ticket_mail_template.*, ticket_master.emp_mail,ticket_master.claim_status_id")
|
->select("ticket_mail_template.*, CASE
|
||||||
|
WHEN employees.email_corporate IS NULL OR employees.email_corporate = ''
|
||||||
|
THEN ticket_master.emp_mail
|
||||||
|
ELSE employees.email_corporate
|
||||||
|
END as emp_mail, ,ticket_master.claim_status_id")
|
||||||
->join('ticket_claim_status', 'ticket_master.claim_status_id = ticket_claim_status.id and ticket_claim_status.is_active = 1')
|
->join('ticket_claim_status', 'ticket_master.claim_status_id = ticket_claim_status.id and ticket_claim_status.is_active = 1')
|
||||||
->join('ticket_mail_template', '
|
->join('ticket_mail_template', '
|
||||||
ticket_claim_status.trigger_type = ticket_mail_template.trigger_type
|
ticket_claim_status.trigger_type = ticket_mail_template.trigger_type
|
||||||
and ticket_claim_status.ticket_type = ticket_mail_template.ticket_type
|
and ticket_claim_status.ticket_type = ticket_mail_template.ticket_type
|
||||||
and ticket_mail_template.is_active = 1')
|
and ticket_mail_template.is_active = 1')
|
||||||
|
->join('employees','employees.id = ticket_master.emp_id','left')
|
||||||
->where('ticket_master.id', $ticket_id)
|
->where('ticket_master.id', $ticket_id)
|
||||||
->where('ticket_master.is_active', 1)
|
->where('ticket_master.is_active', 1)
|
||||||
|
->where('ticket_claim_status.is_active', 1)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
return $template_data;
|
return $template_data;
|
||||||
@ -135,6 +152,11 @@ class TicketMasterModel extends Model
|
|||||||
{
|
{
|
||||||
$ticket_data = $this->select("
|
$ticket_data = $this->select("
|
||||||
ticket_master.*,
|
ticket_master.*,
|
||||||
|
CASE
|
||||||
|
WHEN employees.email_corporate IS NULL OR employees.email_corporate = ''
|
||||||
|
THEN ticket_master.emp_mail
|
||||||
|
ELSE employees.email_corporate
|
||||||
|
END as emp_mail,
|
||||||
|
|
||||||
user_profiles.first_name as acm,
|
user_profiles.first_name as acm,
|
||||||
user_profiles.mobile as acm_mobile,
|
user_profiles.mobile as acm_mobile,
|
||||||
@ -152,6 +174,7 @@ class TicketMasterModel extends Model
|
|||||||
->join('tpa', 'ticket_master.tpa_id = tpa.id', 'left')
|
->join('tpa', 'ticket_master.tpa_id = tpa.id', 'left')
|
||||||
->join('ticket_notes', 'ticket_master.id = ticket_notes.ticket_id and ticket_notes.is_active = 1 and ticket_notes.is_auto_query = 1','left')
|
->join('ticket_notes', 'ticket_master.id = ticket_notes.ticket_id and ticket_notes.is_active = 1 and ticket_notes.is_auto_query = 1','left')
|
||||||
->join('user_profiles', 'ticket_master.acm_id = user_profiles.id', 'left')
|
->join('user_profiles', 'ticket_master.acm_id = user_profiles.id', 'left')
|
||||||
|
->join('employees','employees.id = ticket_master.emp_id','left')
|
||||||
->where('ticket_master.id', $ticket_id)
|
->where('ticket_master.id', $ticket_id)
|
||||||
->where('ticket_master.is_active', 1)
|
->where('ticket_master.is_active', 1)
|
||||||
->first();
|
->first();
|
||||||
@ -660,4 +683,26 @@ class TicketMasterModel extends Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//api
|
||||||
|
public function get_ticket_data($emp_id, $ticket_type = null, $ticket_id = null)
|
||||||
|
{
|
||||||
|
$query = $this->select('ticket_master.*, tms.mail_subject as subject')
|
||||||
|
->join('ticket_messages tms', 'ticket_master.id = tms.ticket_id', 'left')
|
||||||
|
->where('ticket_master.is_active', 1)
|
||||||
|
->where('ticket_master.emp_id', $emp_id);
|
||||||
|
|
||||||
|
if (!empty($ticket_id)) {
|
||||||
|
$query->where('ticket_master.id', $ticket_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($ticket_type)) {
|
||||||
|
$query->where('ticket_master.ticket_type_id', $ticket_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $query->findAll();
|
||||||
|
// dd($data, db_connect()->getLastQuery());
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,7 @@
|
|||||||
if (window.botmanWidget) {
|
if (window.botmanWidget) {
|
||||||
botmanChatWidget.open();
|
botmanChatWidget.open();
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
botmanChatWidget.sayAsBot('Hi '+ emp_name +',This is ILA your Insurance Assistant, plz choose the following options')
|
botmanChatWidget.sayAsBot('Hi '+ (typeof emp_name !== "undefined" && emp_name !== null && emp_name !== "" ? emp_name : "Guest User") +',This is ILA your Insurance Assistant, plz choose the following options')
|
||||||
botmanChatWidget.whisper('Hi');
|
botmanChatWidget.whisper('Hi');
|
||||||
},3000);
|
},3000);
|
||||||
|
|
||||||
|
|||||||
@ -202,6 +202,7 @@ table.dataTable thead th {
|
|||||||
|
|
||||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||||
item.addEventListener('click', function(e) {
|
item.addEventListener('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
const onclickAttr = this.getAttribute('onclick');
|
const onclickAttr = this.getAttribute('onclick');
|
||||||
if (onclickAttr) {
|
if (onclickAttr) {
|
||||||
eval(onclickAttr);
|
eval(onclickAttr);
|
||||||
|
|||||||
@ -46,6 +46,38 @@
|
|||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* Timeline Design */
|
||||||
|
.timeline {
|
||||||
|
position: relative;
|
||||||
|
padding-left: 30px;
|
||||||
|
border-left: 3px solid #007bff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-item {
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
padding-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-dot {
|
||||||
|
position: absolute;
|
||||||
|
left: -10px;
|
||||||
|
top: 5px;
|
||||||
|
width: 15px;
|
||||||
|
height: 15px;
|
||||||
|
background: #007bff;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-content {
|
||||||
|
background: #f8f9fa;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<?php $pro_rata_total = 0; $gst_total = 0 ?>
|
<?php $pro_rata_total = 0; $gst_total = 0 ?>
|
||||||
|
|
||||||
<div class="row" id="client_list">
|
<div class="row" id="client_list">
|
||||||
@ -154,6 +186,8 @@
|
|||||||
) {
|
) {
|
||||||
?>
|
?>
|
||||||
<a class="dropdown-item" onclick="get_emp_master_data_for_update(this, '<?= $employee['employee_id'];?>', '<?= $employee['status'];?>')" ><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
<a class="dropdown-item" onclick="get_emp_master_data_for_update(this, '<?= $employee['employee_id'];?>', '<?= $employee['status'];?>')" ><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
|
<a class="dropdown-item" onclick="get_emp_history(this, '<?= $employee['employee_id'];?>')" > <i class="mdi mdi-history mr-2 text-muted font-18 vertical-middle"></i>Employee History</a>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if(in_array($employee['policy_type_id'], [2,3,4,5]) && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>
|
<?php if(in_array($employee['policy_type_id'], [2,3,4,5]) && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>
|
||||||
@ -270,6 +304,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</div><!-- /.modal -->
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
<!-- Modal content for Emp History -->
|
||||||
|
<div class="modal fade" id="emp_history_modal" tabindex="-1" aria-labelledby="emp_history_modal_label" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="emp_history_modal_label">Employee History</h4>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
</div>
|
||||||
|
<div id = "emp_history_content"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
@ -543,5 +591,110 @@
|
|||||||
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
|
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
var modalInstance; // Store the modal instance globally
|
||||||
|
|
||||||
|
function showModal() {
|
||||||
|
var myModalEl = document.getElementById('emp_history_modal');
|
||||||
|
modalInstance = new bootstrap.Modal(myModalEl, {
|
||||||
|
backdrop: true, // Ensures the backdrop is shown
|
||||||
|
keyboard: true // Allows closing with the Escape key
|
||||||
|
});
|
||||||
|
modalInstance.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeModal() {
|
||||||
|
if (modalInstance) {
|
||||||
|
modalInstance.hide(); // Hide the modal and its backdrop
|
||||||
|
// Manually remove backdrop if it's still visible
|
||||||
|
setTimeout(function () {
|
||||||
|
document.querySelector('.modal-backdrop').classList.remove('show');
|
||||||
|
}, 150); // Wait for animation to finish
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function get_emp_history(input, emp_id) {
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
let url = '<?= base_url("employee/get_emp_history")?>';
|
||||||
|
let requestData = { emp_id: emp_id };
|
||||||
|
|
||||||
|
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
if (response.status === true) {
|
||||||
|
console.log('response data length', response.data.emp_history.length);
|
||||||
|
|
||||||
|
// **Clear old data**
|
||||||
|
$('#emp_history_content').html('');
|
||||||
|
|
||||||
|
// **Check if data exists**
|
||||||
|
if (response.data.emp_history.length > 0) {
|
||||||
|
let historyTable = `
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table w-100">
|
||||||
|
<thead class="bg-light">
|
||||||
|
<tr>
|
||||||
|
<th>Field</th>
|
||||||
|
<th>Change</th>
|
||||||
|
<th>User</th>
|
||||||
|
<th>Date/Time</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
`;
|
||||||
|
|
||||||
|
// **Loop through the data dynamically**
|
||||||
|
response.data.emp_history.forEach(row => {
|
||||||
|
historyTable += `
|
||||||
|
<tr>
|
||||||
|
<td>${row.field_name}</td>
|
||||||
|
<td>${row.old_value} => ${row.new_value}</td>
|
||||||
|
<td>${row.created_by}</td>
|
||||||
|
<td>${row.created_at}</td>
|
||||||
|
</tr>
|
||||||
|
`;
|
||||||
|
});
|
||||||
|
|
||||||
|
historyTable += `
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
// **Append to modal**
|
||||||
|
$('#emp_history_content').append(historyTable);
|
||||||
|
} else {
|
||||||
|
$('#emp_history_content').html('<p class="text-center text-muted">No history available.</p>');
|
||||||
|
}
|
||||||
|
|
||||||
|
// **Show the modal**
|
||||||
|
showModal();
|
||||||
|
} else {
|
||||||
|
let message = response.message;
|
||||||
|
toastr.error(message, 'ERROR');
|
||||||
|
}
|
||||||
|
}, function(xhr, status, error) {
|
||||||
|
console.error('Error fetching data:', error);
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
toastr.error('An error occurred while fetching the report page.', 'ERROR');
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// function closeModal(){
|
||||||
|
// var myModalEl = document.getElementById('emp_history_modal');
|
||||||
|
// var modalInstance = bootstrap.Modal.getInstance(myModalEl);
|
||||||
|
// if (modalInstance) {
|
||||||
|
// modalInstance.hide();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -232,7 +232,6 @@ table.dataTable tbody td {
|
|||||||
document.addEventListener("DOMContentLoaded", init);
|
document.addEventListener("DOMContentLoaded", init);
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
|
||||||
const table = document.getElementById("tickets-table");
|
const table = document.getElementById("tickets-table");
|
||||||
let activeDropdown = null;
|
let activeDropdown = null;
|
||||||
|
|
||||||
@ -264,8 +263,21 @@ function init() {
|
|||||||
|
|
||||||
const customDropdown = document.createElement('div');
|
const customDropdown = document.createElement('div');
|
||||||
customDropdown.className = 'custom-dropdown-menu';
|
customDropdown.className = 'custom-dropdown-menu';
|
||||||
|
|
||||||
|
// Clone original dropdown items while moving onclick handlers to data attributes
|
||||||
|
const originalItems = originalDropdown.querySelectorAll('.dropdown-item');
|
||||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||||
|
|
||||||
|
// Transfer onclick handlers to data attributes
|
||||||
|
customDropdown.querySelectorAll('.dropdown-item').forEach((item, index) => {
|
||||||
|
const originalItem = originalItems[index];
|
||||||
|
const originalOnclick = originalItem.getAttribute('onclick');
|
||||||
|
if (originalOnclick) {
|
||||||
|
item.setAttribute('data-onclick', originalOnclick);
|
||||||
|
item.removeAttribute('onclick'); // Remove original handler
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return customDropdown;
|
return customDropdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,11 +299,15 @@ function init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleItemClick(e, item) {
|
function handleItemClick(e, item) {
|
||||||
const onclickAttr = item.getAttribute('onclick');
|
e.preventDefault();
|
||||||
|
|
||||||
|
// Execute the stored onclick handler
|
||||||
|
const onclickAttr = item.getAttribute('data-onclick');
|
||||||
if (onclickAttr) {
|
if (onclickAttr) {
|
||||||
eval(onclickAttr);
|
eval(onclickAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle href navigation
|
||||||
const href = item.getAttribute('href');
|
const href = item.getAttribute('href');
|
||||||
if (href && href !== '#') {
|
if (href && href !== '#') {
|
||||||
window.location.href = href;
|
window.location.href = href;
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
<div class="tab-pane fade" id="enrollment-dash-tab">
|
<div class="tab-pane fade" id="enrollment-dash-tab">
|
||||||
<div class="row visa_status_count_view">
|
<div class="row visa_status_count_view">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card" style="border: 0px;height: 470px;">
|
<div class="card" style="border: 0px;height: 470px;">
|
||||||
<div class="card-body status-option" id="statusContent" style="padding: 0.5rem !important;background-color: white;">
|
<div class="card-body status-option" id="statusContent"
|
||||||
|
style="padding: 0.5rem !important;background-color: white;">
|
||||||
<!-- Search Input Field -->
|
<!-- Search Input Field -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
@ -14,7 +14,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-5"></div>
|
<div class="col-5"></div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<input type="text" id="searchInput" class="search-input" placeholder="Search by client or branch">
|
<input type="text" id="searchInput" class="search-input"
|
||||||
|
placeholder="Search by client or branch">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Carousel Structure -->
|
<!-- Carousel Structure -->
|
||||||
@ -25,23 +26,28 @@
|
|||||||
$currentItem = 0; // Counter for items
|
$currentItem = 0; // Counter for items
|
||||||
$isActive = true; // Variable to set the first item as active
|
$isActive = true; // Variable to set the first item as active
|
||||||
foreach ($client_branch_emp_list as $clients) {
|
foreach ($client_branch_emp_list as $clients) {
|
||||||
foreach ($clients['branches'] as $branches) {
|
|
||||||
// Start a new carousel item if needed
|
// Start a new carousel item if needed
|
||||||
if ($currentItem % $itemsPerSlide == 0) {
|
if ($currentItem % $itemsPerSlide == 0) {
|
||||||
if (!$isActive) echo '</div>'; // Close previous carousel item
|
if (!$isActive) echo '</div>'; // Close previous carousel item
|
||||||
echo '<div class="carousel-item' . ($isActive ? ' active' : '') . '">';
|
echo '<div class="carousel-item' . ($isActive ? ' active' : '') . '">';
|
||||||
$isActive = false;
|
$isActive = false;
|
||||||
}
|
}
|
||||||
if(count($branches['client_policies']) != 0){ ?>
|
?>
|
||||||
<!-- New Card Layout for each item -->
|
<!-- New Card Layout for each item -->
|
||||||
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item" data-client="<?php echo $clients['short_name']; ?>" data-branch="<?php echo $branches['branch_name']; ?>">
|
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item"
|
||||||
|
data-client="<?php echo $clients['short_name']; ?>"
|
||||||
|
data-branch="<?php echo $clients['branch_name']; ?>">
|
||||||
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
||||||
<div class="card-header add_card_background_random">
|
<div class="card-header add_card_background_random">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8 emp-count-view-click">
|
<div class="col-8 emp-count-view-click">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="w-100 ">
|
<div class="w-100 ">
|
||||||
<h3 class="my-2 py-1" ><span data-plugin="counterup" style="font-size: 2.0rem;background-color: white;border-radius: 6px;height: 30;padding: 4px 11px 4px 11px;" onclick="enrollment_list(this, 'emp_count_view_click')"><?php echo isset($branches['employees']) ? count($branches['employees']) : '0'; ?></span></h3>
|
<h3 class="my-2 py-1"><span data-plugin="counterup"
|
||||||
|
style="font-size: 2.0rem;background-color: white;border-radius: 6px;height: 30;padding: 4px 11px 4px 11px;"
|
||||||
|
onclick="enrollment_list(this, 'emp_count_view_click')"><?php echo isset($clients['total_employees']) ? $clients['total_employees'] : '0'; ?></span>
|
||||||
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -50,7 +56,12 @@
|
|||||||
<div class="col-12 emp-count-view-click">
|
<div class="col-12 emp-count-view-click">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="w-100">
|
<div class="w-100">
|
||||||
<h5 class="mt-0 text-truncate" title="Branch Info" style="font-weight: 400 !important;font-size: 20px !important;line-height: 36px;color: black !important;"><?php echo isset($clients['short_name']) ? $clients['short_name'] : 'N/A'; ?> - <?php echo isset($branches['branch_name']) ? $branches['branch_name'] : 'N/A'; ?></h5>
|
<h5 class="mt-0 text-truncate" title="Branch Info"
|
||||||
|
style="font-weight: 400 !important;font-size: 20px !important;line-height: 36px;color: black !important;">
|
||||||
|
<?php echo isset($clients['short_name']) ? $clients['short_name'] : 'N/A'; ?>
|
||||||
|
-
|
||||||
|
<?php echo isset($clients['branch_name']) ? $clients['branch_name'] : 'N/A'; ?>
|
||||||
|
</h5>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -67,26 +78,41 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<input type="text" class="client_id" value="<?php echo $clients['client_id']; ?>" hidden>
|
<input type="text" class="client_id"
|
||||||
<input type="text" class="client_branch_id" value="<?php echo $branches['client_branch_id'] ?>" hidden>
|
value="<?php echo $clients['client_id']; ?>" hidden>
|
||||||
|
<input type="text" class="client_branch_id"
|
||||||
|
value="<?php echo $clients['client_branch_id'] ?>" hidden>
|
||||||
<div class="row emp-status" style="margin-top: -9px;">
|
<div class="row emp-status" style="margin-top: -9px;">
|
||||||
<div class="col-6 emp-count-view-click">
|
<div class="col-6 emp-count-view-click">
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_logged_in_view_click')"><?php echo isset($branches['emp_login']) ? $branches['emp_login'] : '0'; ?></span><br>
|
<span style="font-size: large;color: black !important;"
|
||||||
<span class="text-nowrap " style="color: currentColor;font-size: 15px;">Logged-In</span>
|
class="number_css"
|
||||||
|
onclick="enrollment_list(this, 'emp_logged_in_view_click')"><?php echo isset($clients['logged_in_count']) ? $clients['logged_in_count'] : '0'; ?></span><br>
|
||||||
|
<span class="text-nowrap "
|
||||||
|
style="color: currentColor;font-size: 15px;">Logged-In</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 emp-count-view-click">
|
<div class="col-6 emp-count-view-click">
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"><?php echo isset($branches['emp_login']) ? count($branches['employees']) - $branches['emp_login'] : '0'; ?></span><br>
|
<span style="font-size: large;color: black !important;"
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;margin-left: -13px;">Not Logged-In</span>
|
class="number_css"
|
||||||
|
onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"><?php echo isset($clients['not_logged_in_count']) ? $clients['not_logged_in_count'] : '0'; ?></span><br>
|
||||||
|
<span class="text-nowrap"
|
||||||
|
style="color: currentColor;font-size: 15px;margin-left: -13px;">Not
|
||||||
|
Logged-In</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row emp-status" style="margin-top: 5px;">
|
<div class="row emp-status" style="margin-top: 5px;">
|
||||||
<div class="col-6 emp-count-view-click">
|
<div class="col-6 emp-count-view-click">
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_enrolled_view_click')"><?php echo isset($branches['emp_enroll']) ? count($branches['employees']) - $branches['emp_enroll'] : '0'; ?></span><br>
|
<span style="font-size: large;color: black !important;"
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Draft</span>
|
class="number_css"
|
||||||
|
onclick="enrollment_list(this, 'emp_not_enrolled_view_click')"><?php echo isset($clients['draft_count']) ? $clients['draft_count'] : '0'; ?></span><br>
|
||||||
|
<span class="text-nowrap"
|
||||||
|
style="color: currentColor;font-size: 15px;">Draft</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 emp-count-view-click">
|
<div class="col-6 emp-count-view-click">
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_enrolled_view_click')"><?php echo isset($branches['emp_enroll']) ? $branches['emp_enroll'] : '0'; ?></span><br>
|
<span style="font-size: large;color: black !important;"
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Enrolled</span>
|
class="number_css"
|
||||||
|
onclick="enrollment_list(this, 'emp_enrolled_view_click')"><?php echo isset($clients['enrolled_count']) ? $clients['enrolled_count'] : '0'; ?></span><br>
|
||||||
|
<span class="text-nowrap"
|
||||||
|
style="color: currentColor;font-size: 15px;">Enrolled</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -94,20 +120,31 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
$currentItem++;
|
$currentItem++;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($currentItem % $itemsPerSlide != 0) echo '</div>'; // Close the last carousel item
|
if ($currentItem % $itemsPerSlide != 0) echo '</div>'; // Close the last carousel item
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
|
<a class="carousel-control-prev" href="#carouselExampleControls" role="button"
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" style="width: 28px;"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"/></svg> <!-- <img src="<?php echo base_url()?>public/assets/images/left_arrow.png" alt="<"> -->
|
data-slide="prev">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" style="width: 28px;">
|
||||||
|
<!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.-->
|
||||||
|
<path
|
||||||
|
d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z" />
|
||||||
|
</svg>
|
||||||
|
<!-- <img src="<?php echo base_url() ?>public/assets/images/left_arrow.png" alt="<"> -->
|
||||||
<!-- <span class="carousel-control-prev-icon" aria-hidden="true"></span> -->
|
<!-- <span class="carousel-control-prev-icon" aria-hidden="true"></span> -->
|
||||||
<span class="sr-only">Previous</span>
|
<span class="sr-only">Previous</span>
|
||||||
</a>
|
</a>
|
||||||
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
|
<a class="carousel-control-next" href="#carouselExampleControls" role="button"
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" style="width: 28px;"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M278.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L210.7 256 73.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z"/></svg>
|
data-slide="next">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" style="width: 28px;">
|
||||||
|
<!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.-->
|
||||||
|
<path
|
||||||
|
d="M278.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L210.7 256 73.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z" />
|
||||||
|
</svg>
|
||||||
<!-- <span class="carousel-control-next-icon" aria-hidden="true"></span> -->
|
<!-- <span class="carousel-control-next-icon" aria-hidden="true"></span> -->
|
||||||
<span class="sr-only">Next</span>
|
<span class="sr-only">Next</span>
|
||||||
</a>
|
</a>
|
||||||
@ -119,6 +156,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var lastDirection = ''; // Variable to keep track of the last direction
|
var lastDirection = ''; // Variable to keep track of the last direction
|
||||||
|
|
||||||
@ -226,6 +264,69 @@ $(document).ready(function() {
|
|||||||
checkEmptyCarouselItem();
|
checkEmptyCarouselItem();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
random_color_set();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#enrollment_status_open_close').change(function() {
|
||||||
|
|
||||||
|
if ($(this).val() === 'open') {
|
||||||
|
|
||||||
|
var enrollment_data = '<?php echo addslashes(json_encode($client_branch_emp_list, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT)); ?>';
|
||||||
|
|
||||||
|
console.log('Raw enrollment_data:', enrollment_data);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Ensure enrollment_data is not empty or invalid
|
||||||
|
if (!enrollment_data || enrollment_data === 'null' || enrollment_data === '""') {
|
||||||
|
throw new Error('Invalid JSON data received.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse JSON data
|
||||||
|
var data = JSON.parse(enrollment_data);
|
||||||
|
console.log('Parsed data:', data);
|
||||||
|
|
||||||
|
// Ensure parsed data is always treated as an array
|
||||||
|
if (!Array.isArray(data)) {
|
||||||
|
data = data && typeof data === 'object' ? [data] : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Final client_branch_emp_list:', data);
|
||||||
|
updateCarouselWithData(data, 1);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error parsing JSON:', error.message, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Fetch the session data from PHP
|
||||||
|
var enrollment_data = '<?php echo addslashes(json_encode($client_branch_emp_list, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT)); ?>';
|
||||||
|
console.log('Raw enrollment_data:', enrollment_data);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Ensure enrollment_data is valid before parsing
|
||||||
|
if (!enrollment_data || enrollment_data === 'null' || enrollment_data === '""') {
|
||||||
|
throw new Error('Invalid JSON data received.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse JSON data
|
||||||
|
var data = JSON.parse(enrollment_data);
|
||||||
|
console.log('Parsed data:', data);
|
||||||
|
|
||||||
|
// Ensure `data` is always an array
|
||||||
|
data = Array.isArray(data) ? data : (data && typeof data === 'object' ? [data] : []);
|
||||||
|
|
||||||
|
console.log('Final client_branch_emp_list:', data);
|
||||||
|
updateCarouselWithData(data, 2);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error parsing JSON:', error.message, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
function enrollment_list(current_element, type) {
|
function enrollment_list(current_element, type) {
|
||||||
var clientId = $(current_element).closest('.carousel-slide-item').find('.client_id').val();
|
var clientId = $(current_element).closest('.carousel-slide-item').find('.client_id').val();
|
||||||
@ -244,79 +345,6 @@ function enrollment_list(current_element, type) {
|
|||||||
window.location.href = `${url}?${params.toString()}`;
|
window.location.href = `${url}?${params.toString()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#enrollment_status_open_close').change(function () {
|
|
||||||
if ($(this).val() === 'open') {
|
|
||||||
var enrollment_data = '<?php echo addslashes($_SESSION['enrollment_data']); ?>';
|
|
||||||
try {
|
|
||||||
// Parse JSON data
|
|
||||||
var data = JSON.parse(enrollment_data);
|
|
||||||
console.log('Parsed data:', data);
|
|
||||||
|
|
||||||
// Ensure data is an object and client_branch_emp_list is treated as an array
|
|
||||||
if (data && typeof data === 'object') {
|
|
||||||
if (Array.isArray(data.client_branch_emp_list)) {
|
|
||||||
console.log('client_branch_emp_list:', data.client_branch_emp_list);
|
|
||||||
updateCarouselWithData(data, 1);
|
|
||||||
} else {
|
|
||||||
// Convert client_branch_emp_list to an array if it's not already
|
|
||||||
if (data.client_branch_emp_list && typeof data.client_branch_emp_list === 'object') {
|
|
||||||
// If it's an object but not an array, wrap it in an array
|
|
||||||
data.client_branch_emp_list = [data.client_branch_emp_list];
|
|
||||||
} else {
|
|
||||||
// Handle the case where it's neither an array nor an object
|
|
||||||
console.error('client_branch_emp_list is not an array or object:', data.client_branch_emp_list);
|
|
||||||
data.client_branch_emp_list = []; // Ensure it is at least an empty array
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('Converted client_branch_emp_list:', data.client_branch_emp_list);
|
|
||||||
updateCarouselWithData(data, 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.error('Parsed data is not an object:', data);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Error parsing JSON:', e);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Fetch the session data from PHP
|
|
||||||
var enrollment_data = '<?php echo addslashes($_SESSION['enrollment_data']); ?>';
|
|
||||||
try {
|
|
||||||
// Parse JSON data
|
|
||||||
var data = JSON.parse(enrollment_data);
|
|
||||||
console.log('Parsed data:', data);
|
|
||||||
|
|
||||||
// Ensure data is an object and client_branch_emp_list is treated as an array
|
|
||||||
if (data && typeof data === 'object') {
|
|
||||||
if (Array.isArray(data.client_branch_emp_list)) {
|
|
||||||
console.log('client_branch_emp_list:', data.client_branch_emp_list);
|
|
||||||
updateCarouselWithData(data, 2);
|
|
||||||
} else {
|
|
||||||
// Convert client_branch_emp_list to an array if it's not already
|
|
||||||
if (data.client_branch_emp_list && typeof data.client_branch_emp_list === 'object') {
|
|
||||||
// If it's an object but not an array, wrap it in an array
|
|
||||||
data.client_branch_emp_list = [data.client_branch_emp_list];
|
|
||||||
} else {
|
|
||||||
// Handle the case where it's neither an array nor an object
|
|
||||||
console.error('client_branch_emp_list is not an array or object:', data.client_branch_emp_list);
|
|
||||||
data.client_branch_emp_list = []; // Ensure it is at least an empty array
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('Converted client_branch_emp_list:', data.client_branch_emp_list);
|
|
||||||
updateCarouselWithData(data, 2);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.error('Parsed data is not an object:', data);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Error parsing JSON:', e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function updateCarouselWithData(data, open_close) {
|
function updateCarouselWithData(data, open_close) {
|
||||||
var itemsPerSlide = 3; // Number of items per slide
|
var itemsPerSlide = 3; // Number of items per slide
|
||||||
var currentItem = 0; // Counter for items
|
var currentItem = 0; // Counter for items
|
||||||
@ -327,10 +355,11 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
carouselInner.empty();
|
carouselInner.empty();
|
||||||
|
|
||||||
// Check if data.client_branch_emp_list is valid
|
// Check if data.client_branch_emp_list is valid
|
||||||
if (Array.isArray(data.client_branch_emp_list) && data.client_branch_emp_list.length > 0) {
|
if (Array.isArray(data) && data.length > 0) {
|
||||||
console.log("Processing array...");
|
|
||||||
|
console.log("Processing array........................................");
|
||||||
// Handle the case where data.client_branch_emp_list is an array
|
// Handle the case where data.client_branch_emp_list is an array
|
||||||
var items = data.client_branch_emp_list[0];
|
var items = data[0];
|
||||||
console.log("Items data:", items);
|
console.log("Items data:", items);
|
||||||
|
|
||||||
// Convert items object to an array
|
// Convert items object to an array
|
||||||
@ -338,17 +367,15 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
|
|
||||||
// Validate if client_list is an array
|
// Validate if client_list is an array
|
||||||
if (Array.isArray(client_list)) {
|
if (Array.isArray(client_list)) {
|
||||||
|
|
||||||
console.log(client_list);
|
console.log(client_list);
|
||||||
for (var i = 0; i < client_list.length; i++) {
|
|
||||||
var client = client_list[i];
|
|
||||||
// console.log(item.branches);
|
|
||||||
var branch_list = client.branches;
|
|
||||||
for (var j = 0; j < branch_list.length; j++) {
|
|
||||||
var branch = branch_list[j];
|
|
||||||
console.log(branch);
|
|
||||||
|
|
||||||
if(open_close == 1){
|
for (var i = 0; i < data.length; i++) {
|
||||||
if(branch.client_policies.length > 0){
|
|
||||||
|
let client = data[i];
|
||||||
|
|
||||||
|
if (open_close == 1 && client.open_or_close_enrollment == 1) {
|
||||||
|
|
||||||
if (currentItem % itemsPerSlide === 0) {
|
if (currentItem % itemsPerSlide === 0) {
|
||||||
if (!isActive) carouselInner.append('</div>'); // Close previous carousel item
|
if (!isActive) carouselInner.append('</div>'); // Close previous carousel item
|
||||||
carouselInner.append('<div class="carousel-item' + (isActive ? ' active' : '') + '">');
|
carouselInner.append('<div class="carousel-item' + (isActive ? ' active' : '') + '">');
|
||||||
@ -356,14 +383,14 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
}
|
}
|
||||||
// Generate HTML for each item
|
// Generate HTML for each item
|
||||||
var itemHtml = `
|
var itemHtml = `
|
||||||
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item" data-client="${client.short_name}" data-branch="${branch.branch_name }">
|
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item" data-client="${client.short_name}" data-branch="${client.branch_name }">
|
||||||
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
||||||
<div class="card-header add_card_background_random" >
|
<div class="card-header add_card_background_random" >
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8 emp-count-view-click" >
|
<div class="col-8 emp-count-view-click" >
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="w-100 " >
|
<div class="w-100 " >
|
||||||
<h3 class="my-2 py-1" ><span data-plugin="counterup" style="font-size: 2.0rem;background-color: white;border-radius: 6px;height: 30;padding: 4px 11px 4px 11px;" onclick="enrollment_list(this, 'emp_count_view_click')">${branch.employees.length}</span></h3>
|
<h3 class="my-2 py-1" ><span data-plugin="counterup" style="font-size: 2.0rem;background-color: white;border-radius: 6px;height: 30;padding: 4px 11px 4px 11px;" onclick="enrollment_list(this, 'emp_count_view_click')">${client.total_employees}</span></h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -372,7 +399,7 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
<div class="col-12 emp-count-view-click" >
|
<div class="col-12 emp-count-view-click" >
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="w-100" >
|
<div class="w-100" >
|
||||||
<h5 class="mt-0 text-truncate" title="Branch Info" style="font-weight: 400 !important;font-size: 20px !important;line-height: 36px;color: black !important;">${client.short_name} - ${branch.branch_name} </h5>
|
<h5 class="mt-0 text-truncate" title="Branch Info" style="font-weight: 400 !important;font-size: 20px !important;line-height: 36px;color: black !important;">${client.short_name} - ${client.branch_name} </h5>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -390,24 +417,24 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body" >
|
<div class="card-body" >
|
||||||
<input type="text" class="client_id" value="${client.client_id}" hidden>
|
<input type="text" class="client_id" value="${client.client_id}" hidden>
|
||||||
<input type="text" class="client_branch_id" value="${branch.client_branch_id}" hidden>
|
<input type="text" class="client_branch_id" value="${client.client_branch_id}" hidden>
|
||||||
<div class="row emp-status" style="margin-top: -9px;">
|
<div class="row emp-status" style="margin-top: -9px;">
|
||||||
<div class="col-6 emp-count-view-click" >
|
<div class="col-6 emp-count-view-click" >
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_logged_in_view_click')">${branch.emp_login}</span><br>
|
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_logged_in_view_click')">${client.logged_in_count ?? 0}</span><br>
|
||||||
<span class="text-nowrap " style="color: currentColor;font-size: 15px;">Logged-In</span>
|
<span class="text-nowrap " style="color: currentColor;font-size: 15px;">Logged-In</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 emp-count-view-click" >
|
<div class="col-6 emp-count-view-click" >
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"> ${branch.employees.length - (branch.emp_login || 0)}</span><br>
|
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"> ${client.not_logged_in_count ?? 0}</span><br>
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;margin-left: -13px;">Not Logged-In</span>
|
<span class="text-nowrap" style="color: currentColor;font-size: 15px;margin-left: -13px;">Not Logged-In</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row emp-status" style="margin-top: 5px;">
|
<div class="row emp-status" style="margin-top: 5px;">
|
||||||
<div class="col-6 emp-count-view-click" >
|
<div class="col-6 emp-count-view-click" >
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_enrolled_view_click')">${branch.employees.length - (branch.emp_enroll || 0)}</span><br>
|
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_enrolled_view_click')">${client.draft_count ?? 0}</span><br>
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Draft</span>
|
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Draft</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 emp-count-view-click" >
|
<div class="col-6 emp-count-view-click" >
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_enrolled_view_click')">${(branch.emp_enroll || 0)}</span><br>
|
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_enrolled_view_click')">${(client.enrolled_count ?? 0)}</span><br>
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Enrolled</span>
|
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Enrolled</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -418,9 +445,9 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
|
|
||||||
carouselInner.find('.carousel-item').last().append(itemHtml);
|
carouselInner.find('.carousel-item').last().append(itemHtml);
|
||||||
currentItem++;
|
currentItem++;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if(branch.client_policies.length == 0){
|
|
||||||
if (currentItem % itemsPerSlide === 0) {
|
if (currentItem % itemsPerSlide === 0) {
|
||||||
if (!isActive) carouselInner.append('</div>'); // Close previous carousel item
|
if (!isActive) carouselInner.append('</div>'); // Close previous carousel item
|
||||||
carouselInner.append('<div class="carousel-item' + (isActive ? ' active' : '') + '">');
|
carouselInner.append('<div class="carousel-item' + (isActive ? ' active' : '') + '">');
|
||||||
@ -428,14 +455,14 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
}
|
}
|
||||||
// Generate HTML for each item
|
// Generate HTML for each item
|
||||||
var itemHtml = `
|
var itemHtml = `
|
||||||
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item" data-client="${client.short_name}" data-branch="${branch.branch_name }">
|
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item" data-client="${client.short_name}" data-branch="${client.branch_name }">
|
||||||
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
||||||
<div class="card-header add_card_background_random" >
|
<div class="card-header add_card_background_random" >
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8 emp-count-view-click" >
|
<div class="col-8 emp-count-view-click" >
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="w-100 " >
|
<div class="w-100 " >
|
||||||
<h3 class="my-2 py-1" ><span data-plugin="counterup" style="font-size: 2.0rem;background-color: white;border-radius: 6px;height: 30;padding: 4px 11px 4px 11px;" onclick="enrollment_list(this, 'emp_count_view_click')">${branch.employees.length}</span></h3>
|
<h3 class="my-2 py-1" ><span data-plugin="counterup" style="font-size: 2.0rem;background-color: white;border-radius: 6px;height: 30;padding: 4px 11px 4px 11px;" onclick="enrollment_list(this, 'emp_count_view_click')">${client.total_employees}</span></h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -444,7 +471,7 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
<div class="col-12 emp-count-view-click" >
|
<div class="col-12 emp-count-view-click" >
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="w-100" >
|
<div class="w-100" >
|
||||||
<h5 class="mt-0 text-truncate" title="Branch Info" style="font-weight: 400 !important;font-size: 20px !important;line-height: 36px;color: black !important;">${client.short_name} - ${branch.branch_name} </h5>
|
<h5 class="mt-0 text-truncate" title="Branch Info" style="font-weight: 400 !important;font-size: 20px !important;line-height: 36px;color: black !important;">${client.short_name} - ${client.branch_name} </h5>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -462,24 +489,24 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body" >
|
<div class="card-body" >
|
||||||
<input type="text" class="client_id" value="${client.client_id}" hidden>
|
<input type="text" class="client_id" value="${client.client_id}" hidden>
|
||||||
<input type="text" class="client_branch_id" value="${branch.client_branch_id}" hidden>
|
<input type="text" class="client_branch_id" value="${client.client_branch_id}" hidden>
|
||||||
<div class="row emp-status" style="margin-top: -9px;">
|
<div class="row emp-status" style="margin-top: -9px;">
|
||||||
<div class="col-6 emp-count-view-click" >
|
<div class="col-6 emp-count-view-click" >
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_logged_in_view_click')">${branch.emp_login}</span><br>
|
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_logged_in_view_click')">${client.logged_in_count}</span><br>
|
||||||
<span class="text-nowrap " style="color: currentColor;font-size: 15px;">Logged-In</span>
|
<span class="text-nowrap " style="color: currentColor;font-size: 15px;">Logged-In</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 emp-count-view-click" >
|
<div class="col-6 emp-count-view-click" >
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"> ${branch.employees.length - (branch.emp_login || 0)}</span><br>
|
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"> ${client.not_logged_in_count ?? 0}</span><br>
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;margin-left: -13px;">Not Logged-In</span>
|
<span class="text-nowrap" style="color: currentColor;font-size: 15px;margin-left: -13px;">Not Logged-In</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row emp-status" style="margin-top: 5px;">
|
<div class="row emp-status" style="margin-top: 5px;">
|
||||||
<div class="col-6 emp-count-view-click" >
|
<div class="col-6 emp-count-view-click" >
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_enrolled_view_click')">${branch.employees.length - (branch.emp_enroll || 0)}</span><br>
|
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_enrolled_view_click')">${client.draft_count ?? 0}</span><br>
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Draft</span>
|
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Draft</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 emp-count-view-click" >
|
<div class="col-6 emp-count-view-click" >
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_enrolled_view_click')">${(branch.emp_enroll || 0)}</span><br>
|
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_enrolled_view_click')">${(client.enrolled_count ?? 0)}</span><br>
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Enrolled</span>
|
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Enrolled</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -490,35 +517,28 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
|
|
||||||
carouselInner.find('.carousel-item').last().append(itemHtml);
|
carouselInner.find('.carousel-item').last().append(itemHtml);
|
||||||
currentItem++;
|
currentItem++;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
// Create a new carousel item every `itemsPerSlide` items
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the last carousel item if it was opened
|
// Close the last carousel item if it was opened
|
||||||
if (currentItem % itemsPerSlide !== 0) carouselInner.append('</div>');
|
if (currentItem % itemsPerSlide !== 0) carouselInner.append('</div>');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.error('Expected an array for items, but got:', client_list);
|
console.error('Expected an array for items, but got:', client_list);
|
||||||
}
|
}
|
||||||
} else if (typeof data.client_branch_emp_list === 'object') {
|
|
||||||
console.error('client_branch_emp_list is an object, not an array:', data.client_branch_emp_list);
|
} else if (typeof data === 'object') {
|
||||||
|
console.error('client_branch_emp_list is an object, not an array:', data);
|
||||||
} else {
|
} else {
|
||||||
console.error('client_branch_emp_list is missing or not in the expected format:', data.client_branch_emp_list);
|
console.error('client_branch_emp_list is missing or not in the expected format:', data);
|
||||||
}
|
}
|
||||||
random_color_set();
|
random_color_set();
|
||||||
|
|
||||||
// Initialize or refresh carousel if needed
|
// Initialize or refresh carousel if needed
|
||||||
$('#carouselExampleControls').carousel('dispose').carousel();
|
$('#carouselExampleControls').carousel('dispose'); // Properly dispose of the instance
|
||||||
}
|
$('#carouselExampleControls').carousel(); // Reinitialize it
|
||||||
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
random_color_set();
|
|
||||||
});
|
|
||||||
|
|
||||||
function remove_empty_carousel() {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -103,7 +103,8 @@ input:checked + .slider:before {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-4">
|
|
||||||
|
<div class="form-group col-md-2">
|
||||||
<label for="html">Insurer Type</label><br>
|
<label for="html">Insurer Type</label><br>
|
||||||
<div style="margin-top: 10px;">
|
<div style="margin-top: 10px;">
|
||||||
<input type="radio" id="html" name="type" value="pvt" <?= isset($insurer['type']) && $insurer['type'] == 'pvt' ? 'checked' : '' ?>>
|
<input type="radio" id="html" name="type" value="pvt" <?= isset($insurer['type']) && $insurer['type'] == 'pvt' ? 'checked' : '' ?>>
|
||||||
@ -112,6 +113,15 @@ input:checked + .slider:before {
|
|||||||
<label for="css">PSU</label>
|
<label for="css">PSU</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-2">
|
||||||
|
<label class="switch" style="position: absolute;top: 34px;left: 17px;">
|
||||||
|
<input id="is_multi_event" type="checkbox" name="is_multi_event" <?= (isset($insurer['is_multi_event']) && $insurer['is_multi_event'] == 1) ? 'checked' : '' ?>>
|
||||||
|
<span class="slider round" style="height: 27px;"></span>
|
||||||
|
</label>
|
||||||
|
<label for="deletion_add_day" style="position: relative;top: 30px;left: 82px;">Multievent Export</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -133,7 +143,7 @@ input:checked + .slider:before {
|
|||||||
<input type="file" class="form-control" onchange="PreviewImage();" id="insurer_logo" name="insurer_logo" accept="image/jpeg, image/jpg, image/png">
|
<input type="file" class="form-control" onchange="PreviewImage();" id="insurer_logo" name="insurer_logo" accept="image/jpeg, image/jpg, image/png">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4 float-right" style="position: relative;left: 40px;bottom: 28px;">
|
<div class="form-group col-md-4 float-right" style="position: relative;left: 90px;top: 30px;">
|
||||||
<img src="<?= isset($insurer['insurer_logo']) && !empty($insurer['insurer_logo']) ? base_url() . "public/uploads/logo/" . $insurer['insurer_logo'] : base_url() . "public/assets/images/avatar_2x.png" ?>" width="100" height="100" id="uploadPreview" class="avatar img-circle img-thumbnail" alt="avatar" />
|
<img src="<?= isset($insurer['insurer_logo']) && !empty($insurer['insurer_logo']) ? base_url() . "public/uploads/logo/" . $insurer['insurer_logo'] : base_url() . "public/assets/images/avatar_2x.png" ?>" width="100" height="100" id="uploadPreview" class="avatar img-circle img-thumbnail" alt="avatar" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -133,6 +133,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
// Preserve click handlers and add auto-close
|
// Preserve click handlers and add auto-close
|
||||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||||
item.addEventListener('click', function(e) {
|
item.addEventListener('click', function(e) {
|
||||||
|
event.preventDefault(e);
|
||||||
const onclickAttr = this.getAttribute('onclick');
|
const onclickAttr = this.getAttribute('onclick');
|
||||||
if (onclickAttr) {
|
if (onclickAttr) {
|
||||||
eval(onclickAttr);
|
eval(onclickAttr);
|
||||||
|
|||||||
@ -470,17 +470,21 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
|
|
||||||
// Create custom dropdown
|
// Create custom dropdown
|
||||||
function createCustomDropdown(row) {
|
function createCustomDropdown(row) {
|
||||||
// Get the original dropdown items
|
|
||||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||||
if (!originalDropdown) return null;
|
if (!originalDropdown) return null;
|
||||||
|
|
||||||
// Create new dropdown with proper background and spacing
|
|
||||||
const customDropdown = document.createElement('div');
|
const customDropdown = document.createElement('div');
|
||||||
customDropdown.className = 'custom-dropdown-menu';
|
customDropdown.className = 'custom-dropdown-menu';
|
||||||
|
|
||||||
// Copy inner content while maintaining icon alignment
|
|
||||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||||
|
|
||||||
|
// Remove inline onclick handlers and store them in data attributes
|
||||||
|
const originalItems = originalDropdown.querySelectorAll('.dropdown-item');
|
||||||
|
customDropdown.querySelectorAll('.dropdown-item').forEach((item, index) => {
|
||||||
|
const originalOnclick = originalItems[index].getAttribute('onclick');
|
||||||
|
item.removeAttribute('onclick'); // Remove the inline handler
|
||||||
|
item.setAttribute('data-onclick', originalOnclick); // Store in data attribute
|
||||||
|
});
|
||||||
|
|
||||||
return customDropdown;
|
return customDropdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,45 +498,33 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
document.body.appendChild(customDropdown);
|
document.body.appendChild(customDropdown);
|
||||||
|
|
||||||
row.addEventListener("click", function(event) {
|
row.addEventListener("click", function(event) {
|
||||||
// Ignore clicks on the action column
|
// Ignore clicks on the first column
|
||||||
if (event.target.closest('td:last-child')) {
|
if (event.target.closest('td:first-child')) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hide any active dropdown
|
if (activeDropdown) activeDropdown.style.display = 'none';
|
||||||
if (activeDropdown) {
|
|
||||||
activeDropdown.style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get click position
|
|
||||||
const rect = event.target.getBoundingClientRect();
|
const rect = event.target.getBoundingClientRect();
|
||||||
|
|
||||||
// Position the dropdown with some offset
|
|
||||||
customDropdown.style.display = 'block';
|
customDropdown.style.display = 'block';
|
||||||
customDropdown.style.position = 'fixed';
|
customDropdown.style.position = 'fixed';
|
||||||
customDropdown.style.left = `${rect.left}px`;
|
customDropdown.style.left = `${rect.left}px`;
|
||||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||||
|
|
||||||
// Set as active dropdown
|
|
||||||
activeDropdown = customDropdown;
|
activeDropdown = customDropdown;
|
||||||
|
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
|
// Handle custom dropdown clicks
|
||||||
// Preserve click handlers and add auto-close
|
|
||||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||||
item.addEventListener('click', function(e) {
|
item.addEventListener('click', function(e) {
|
||||||
const onclickAttr = this.getAttribute('onclick');
|
e.preventDefault();
|
||||||
if (onclickAttr) {
|
|
||||||
eval(onclickAttr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Execute the original onclick from data attribute
|
||||||
|
const onclickAttr = this.getAttribute('data-onclick');
|
||||||
|
if (onclickAttr) eval(onclickAttr);
|
||||||
|
|
||||||
|
// Handle href navigation
|
||||||
const href = this.getAttribute('href');
|
const href = this.getAttribute('href');
|
||||||
if (href && href !== '#') {
|
if (href && href !== '#') window.location.href = href;
|
||||||
window.location.href = href;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Close the dropdown after handling the click
|
|
||||||
if (activeDropdown) {
|
if (activeDropdown) {
|
||||||
activeDropdown.style.display = 'none';
|
activeDropdown.style.display = 'none';
|
||||||
activeDropdown = null;
|
activeDropdown = null;
|
||||||
@ -543,7 +535,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Close dropdown when clicking outside
|
// Close dropdown on outside click
|
||||||
document.addEventListener("click", function() {
|
document.addEventListener("click", function() {
|
||||||
if (activeDropdown) {
|
if (activeDropdown) {
|
||||||
activeDropdown.style.display = 'none';
|
activeDropdown.style.display = 'none';
|
||||||
|
|||||||
@ -129,6 +129,7 @@
|
|||||||
// Preserve click handlers and add auto-close
|
// Preserve click handlers and add auto-close
|
||||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||||
item.addEventListener('click', function(e) {
|
item.addEventListener('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
const onclickAttr = this.getAttribute('onclick');
|
const onclickAttr = this.getAttribute('onclick');
|
||||||
if (onclickAttr) {
|
if (onclickAttr) {
|
||||||
eval(onclickAttr);
|
eval(onclickAttr);
|
||||||
|
|||||||
@ -691,7 +691,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<?php if ((get_role_id() == 1 || get_role_id() == 5) && (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
|
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
|
<a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
|
||||||
@ -702,12 +702,11 @@
|
|||||||
<div class="collapse" id="policyTransactions">
|
<div class="collapse" id="policyTransactions">
|
||||||
<ul class="nav-second-level">
|
<ul class="nav-second-level">
|
||||||
<li>
|
<li>
|
||||||
<a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
|
<a href="#policyTransactionsSub" data-toggle="collapse" class="waves-effect">
|
||||||
<i class="mdi mdi-format-list-bulleted"></i>
|
<i class="mdi mdi-format-list-bulleted"></i>
|
||||||
|
|
||||||
<span>Policy Transactions</span>
|
<span>Policy Transactions</span>
|
||||||
</a>
|
</a>
|
||||||
<div class="collapse" id="policyTransactions">
|
<div class="collapse" id="policyTransactionsSub">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a>
|
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a>
|
||||||
@ -720,9 +719,12 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement Upload</a>
|
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement Upload</a>
|
||||||
</li>
|
</li>
|
||||||
|
<?php } ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<?php if (in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||||
<li>
|
<li>
|
||||||
<a href="#policyReports" data-toggle="collapse" class="waves-effect">
|
<a href="#policyReports" data-toggle="collapse" class="waves-effect">
|
||||||
<i class="ri-file-chart-fill"></i>
|
<i class="ri-file-chart-fill"></i>
|
||||||
@ -745,19 +747,20 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a>
|
<a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<li>
|
<a href="#policyPendingActions" data-toggle="collapse" class="waves-effect">
|
||||||
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
|
|
||||||
<i class="mdi mdi-timer-sand"></i>
|
<i class="mdi mdi-timer-sand"></i>
|
||||||
<span> Policy Pending Actions </span>
|
<span> Policy Pending Actions </span>
|
||||||
</a>
|
</a>
|
||||||
<div class="collapse" id="policyReports">
|
<div class="collapse" id="policyPendingActions">
|
||||||
<ul class="nav-third-level">
|
<ul class="nav-third-level">
|
||||||
|
<?php if (in_array(FINANCE_TEAM_ID, user_team())) { ?>
|
||||||
|
<li>
|
||||||
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
|
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@ -766,16 +769,17 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
|
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
|
||||||
</li>
|
</li>
|
||||||
</li>
|
<?php } ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
|
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
|
||||||
<i class="ri-database-2-line"></i>
|
<i class="ri-database-2-line"></i>
|
||||||
<span> Masters </span>
|
<span> Masters </span>
|
||||||
</a>
|
</a>
|
||||||
<div class="collapse" id="policyReports">
|
<div class="collapse" id="policyMasters">
|
||||||
<ul class="nav-third-level">
|
<ul class="nav-third-level">
|
||||||
<li>
|
<li>
|
||||||
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
|
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
|
||||||
@ -788,11 +792,17 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="<?= base_url('/dmsSearch') ?>"><i class="ri-book-open-line"></i><span> Documents</span></a>
|
<a href="<?= base_url('/dmsSearch') ?>">
|
||||||
|
<i class="ri-book-open-line"></i>
|
||||||
|
<span> Documents</span>
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|||||||
369
app/Views/lead_filter.php
Normal file
369
app/Views/lead_filter.php
Normal file
@ -0,0 +1,369 @@
|
|||||||
|
<style>
|
||||||
|
.col-12 {
|
||||||
|
max-width: 98% !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="row" id="lead_filter_div">
|
||||||
|
<div class="col-12" style="margin-top: -12px;">
|
||||||
|
<div id="accordion" class="mb-3">
|
||||||
|
<div class="card mb-1">
|
||||||
|
<h5 class="m-1">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6" style="position: relative;left: 17px;">
|
||||||
|
<h4 style="text-align: left;">Lead Filter</h4>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<a style="text-align: right;" id="toggleIcon" class="text-dark float-right"
|
||||||
|
data-toggle="collapse" href="#collapseOne" aria-expanded="true">
|
||||||
|
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary"
|
||||||
|
style="font-size: 28px;"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</h5>
|
||||||
|
<div id="collapseOne" class="collapse hide" aria-labelledby="headingOne" data-parent="#accordion">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="filter_issuer_type"> Issuer Type <span
|
||||||
|
class="text-danger"></span></label>
|
||||||
|
<select class="form-control" id="filter_issuer_type" name="filter_issuer_type">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
<?php
|
||||||
|
if (isset($issuer) && count($issuer)) {
|
||||||
|
foreach ($issuer as $key => $value) {
|
||||||
|
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="filter_lead_type"> Lead Type <span class="text-danger"></span></label>
|
||||||
|
<select class="form-control" id="filter_lead_type" name="filter_lead_type">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
<?php
|
||||||
|
if (isset($lead_type) && count($lead_type)) {
|
||||||
|
foreach ($lead_type as $key => $value) {
|
||||||
|
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="filter_client_type"> Client Type <span
|
||||||
|
class="text-danger"></span></label>
|
||||||
|
<select class="form-control" id="filter_client_type" name="filter_client_type">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
<?php
|
||||||
|
if (isset($client_type) && count($client_type)) {
|
||||||
|
foreach ($client_type as $key => $value) {
|
||||||
|
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="filter_policy_type"> Policy Type <span
|
||||||
|
class="text-danger"></span></label>
|
||||||
|
<select class="form-control" id="filter_policy_type" name="filter_policy_type">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
<?php
|
||||||
|
if (isset($policy_type) && count($policy_type)) {
|
||||||
|
foreach ($policy_type as $key => $value) {
|
||||||
|
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="filter_client_id">Client<span class="text-danger"></span></label>
|
||||||
|
<select class="form-control" id="filter_client_id" name="filter_client_id">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="filter_client_branch_id">Client Branch<span
|
||||||
|
class="text-danger"></span></label>
|
||||||
|
<select class="form-control" id="filter_client_branch_id"
|
||||||
|
name="filter_client_branch_id">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="filter_lead_status">Status<span class="text-danger"></span></label>
|
||||||
|
<select class="form-control" id="filter_lead_status" name="filter_lead_status">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
<?php
|
||||||
|
if (isset($lead_status) && count($lead_status)) {
|
||||||
|
foreach ($lead_status as $key => $value) {
|
||||||
|
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-12 text-right m-b-0" style="margin-bottom: -15px;">
|
||||||
|
<a href="<?= base_url("/leads/list"); ?>" class="btn btn-secondary"
|
||||||
|
id="clear-filters">Clear</a>
|
||||||
|
<a class="btn btn-primary" id="get-emp-list"
|
||||||
|
onclick="fetchTicketListData();">Submit</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- end page title -->
|
||||||
|
<div id="lead_list_div">
|
||||||
|
<?php include('leads_list.php'); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var filter_client_list = [];
|
||||||
|
var filter_branch_list = [];
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#filter_client_id').select2();
|
||||||
|
$('#filter_client_branch_id').select2();
|
||||||
|
$('#filter_policy_type').select2();
|
||||||
|
|
||||||
|
getfilterClientAndBranch()
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#filter_client_id').change(function() {
|
||||||
|
|
||||||
|
let client_id = $(this).val();
|
||||||
|
if (filter_branch_list != '') {
|
||||||
|
// console.log(branch_list[client_id]);
|
||||||
|
let data = filter_branch_list[client_id];
|
||||||
|
appendfilterBranch(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
//----- AJAX FUNCTIONS --------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function fetchTicketListData() {
|
||||||
|
|
||||||
|
var issuer_type = $('#filter_issuer_type').val();
|
||||||
|
var lead_type = $('#filter_lead_type').val();
|
||||||
|
var policy_type = $('#filter_policy_type').val();
|
||||||
|
var client_type = $('#filter_client_type').val();
|
||||||
|
var status = $('#filter_lead_status').val();
|
||||||
|
var client_id = $('#filter_client_id').val();
|
||||||
|
var client_branch_id = $('#filter_client_branch_id').val();
|
||||||
|
|
||||||
|
var requestData = {
|
||||||
|
issuer: issuer_type,
|
||||||
|
lead_type: lead_type,
|
||||||
|
policy_type_id: policy_type,
|
||||||
|
client_type: client_type,
|
||||||
|
status: status,
|
||||||
|
client_id: client_id,
|
||||||
|
client_branch_id: client_branch_id,
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log("requestData", requestData);
|
||||||
|
|
||||||
|
var url = '<?= base_url('/leads/list') ?>';
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
|
||||||
|
|
||||||
|
console.log('Filter Responce', response);
|
||||||
|
|
||||||
|
if (response.status == true) {
|
||||||
|
|
||||||
|
$('#lead_list_div').empty();
|
||||||
|
$('#lead_list_div').html(response.html);
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
setTimeout(function(){
|
||||||
|
additionalDropdown();
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
let message = response.message;
|
||||||
|
toastr.error(message, 'ERROR');
|
||||||
|
}
|
||||||
|
|
||||||
|
}, function(xhr, status, error) {
|
||||||
|
console.error('Error fetching data:', error);
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
toastr.error('An error occurred while fetching the data.', 'ERROR');
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//function for fetch client, branch
|
||||||
|
function getfilterClientAndBranch() {
|
||||||
|
$.ajax({
|
||||||
|
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(res) {
|
||||||
|
|
||||||
|
console.log('getClientAndBranchAndPolicy', res);
|
||||||
|
if (res.status == true) {
|
||||||
|
filter_client_list = res.client_data;
|
||||||
|
filter_branch_list = res.branch_data;
|
||||||
|
appendfilterClients(res.client_data);
|
||||||
|
} else {
|
||||||
|
console.log('No data found');
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//----- END AJAX FUNCTIONS --------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
function appendfilterClients(data) {
|
||||||
|
|
||||||
|
$('#filter_client_id').empty();
|
||||||
|
|
||||||
|
$('#filter_client_id').append($('<option>', {
|
||||||
|
value: 0,
|
||||||
|
text: 'Select'
|
||||||
|
}));
|
||||||
|
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
var option = $('<option>', {
|
||||||
|
value: item.id,
|
||||||
|
text: item.client_name,
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#filter_client_id').append(option);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendfilterBranch(data) {
|
||||||
|
|
||||||
|
$('#filter_client_branch_id').empty();
|
||||||
|
|
||||||
|
$('#filter_client_branch_id').append($('<option>', {
|
||||||
|
value: '',
|
||||||
|
text: 'Select'
|
||||||
|
}));
|
||||||
|
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
|
||||||
|
var option = $('<option>', {
|
||||||
|
value: item.id,
|
||||||
|
text: item.branch_name
|
||||||
|
});
|
||||||
|
$('#filter_client_branch_id').append(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function additionalDropdown() {
|
||||||
|
const table = document.getElementById("tickets-table");
|
||||||
|
if (!table) return; // Prevent errors if the table is not found
|
||||||
|
let activeDropdown = null;
|
||||||
|
|
||||||
|
function handleDropdownClick(row, event) {
|
||||||
|
// Hide any active dropdown
|
||||||
|
if (activeDropdown) {
|
||||||
|
activeDropdown.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
let customDropdown = row.customDropdown;
|
||||||
|
if (!customDropdown) {
|
||||||
|
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||||
|
if (!originalDropdown) return;
|
||||||
|
|
||||||
|
customDropdown = document.createElement('div');
|
||||||
|
customDropdown.className = 'custom-dropdown-menu';
|
||||||
|
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||||
|
|
||||||
|
document.body.appendChild(customDropdown);
|
||||||
|
row.customDropdown = customDropdown;
|
||||||
|
|
||||||
|
// Preserve click handlers and add auto-close
|
||||||
|
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||||
|
item.addEventListener('click', function (e) {
|
||||||
|
const onclickAttr = this.getAttribute('onclick');
|
||||||
|
if (onclickAttr) eval(onclickAttr);
|
||||||
|
|
||||||
|
const href = this.getAttribute('href');
|
||||||
|
if (href && href !== '#') window.location.href = href;
|
||||||
|
|
||||||
|
customDropdown.style.display = 'none';
|
||||||
|
activeDropdown = null;
|
||||||
|
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get click position
|
||||||
|
const rect = event.target.getBoundingClientRect();
|
||||||
|
|
||||||
|
// Position the dropdown
|
||||||
|
customDropdown.style.display = 'block';
|
||||||
|
customDropdown.style.position = 'fixed';
|
||||||
|
customDropdown.style.left = `${rect.left}px`;
|
||||||
|
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||||
|
|
||||||
|
activeDropdown = customDropdown;
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add click event listener to rows
|
||||||
|
table.querySelectorAll("tbody tr").forEach(row => {
|
||||||
|
row.addEventListener("click", function (event) {
|
||||||
|
if (!event.target.closest('td:last-child')) {
|
||||||
|
handleDropdownClick(row, event);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Close dropdown when clicking outside
|
||||||
|
document.addEventListener("click", function () {
|
||||||
|
if (activeDropdown) {
|
||||||
|
activeDropdown.style.display = 'none';
|
||||||
|
activeDropdown = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
File diff suppressed because it is too large
Load Diff
@ -127,7 +127,7 @@ table.dataTable tbody td {
|
|||||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getLeadsDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getLeadsDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<a href="<?= base_url('/rfq/list/').$row['id'] . '/' . 1; ?>" class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>">
|
<a href="<?= base_url('/rfq/list/').$row['id'] . '/' . 1; ?>" class="dropdown-item btnEdit2" data-id="<?= $row['id']; ?>">
|
||||||
<i class="mdi mdi-note-text mr-2 text-muted font-18 vertical-middle"></i>RFQ
|
<i class="mdi mdi-note-text mr-2 text-muted font-18 vertical-middle"></i>RFQ
|
||||||
</a>
|
</a>
|
||||||
<!-- <?php if($row['qcr_count'] > 0) { ?>
|
<!-- <?php if($row['qcr_count'] > 0) { ?>
|
||||||
@ -163,25 +163,27 @@ table.dataTable tbody td {
|
|||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
const table = document.getElementById("tickets-table");
|
const table = document.getElementById("tickets-table");
|
||||||
|
|
||||||
// Create custom dropdown
|
|
||||||
function createCustomDropdown(row) {
|
function createCustomDropdown(row) {
|
||||||
// Get the original dropdown items
|
|
||||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||||
if (!originalDropdown) return null;
|
if (!originalDropdown) return null;
|
||||||
|
|
||||||
// Create new dropdown with proper background and spacing
|
|
||||||
const customDropdown = document.createElement('div');
|
const customDropdown = document.createElement('div');
|
||||||
customDropdown.className = 'custom-dropdown-menu';
|
customDropdown.className = 'custom-dropdown-menu';
|
||||||
|
|
||||||
// Copy inner content while maintaining icon alignment
|
// Clone the items but remove their original click handlers
|
||||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
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;
|
return customDropdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
let activeDropdown = null;
|
let activeDropdown = null;
|
||||||
|
|
||||||
// Add click event listener to rows
|
|
||||||
table.querySelectorAll("tbody tr").forEach(row => {
|
table.querySelectorAll("tbody tr").forEach(row => {
|
||||||
const customDropdown = createCustomDropdown(row);
|
const customDropdown = createCustomDropdown(row);
|
||||||
if (!customDropdown) return;
|
if (!customDropdown) return;
|
||||||
@ -194,46 +196,54 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide any active dropdown
|
|
||||||
if (activeDropdown) {
|
if (activeDropdown) {
|
||||||
activeDropdown.style.display = 'none';
|
activeDropdown.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get click position
|
|
||||||
const rect = event.target.getBoundingClientRect();
|
const rect = event.target.getBoundingClientRect();
|
||||||
|
|
||||||
// Position the dropdown with some offset
|
|
||||||
customDropdown.style.display = 'block';
|
customDropdown.style.display = 'block';
|
||||||
customDropdown.style.position = 'fixed';
|
customDropdown.style.position = 'fixed';
|
||||||
customDropdown.style.left = `${rect.left}px`;
|
customDropdown.style.left = `${rect.left}px`;
|
||||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||||
|
|
||||||
// Set as active dropdown
|
|
||||||
activeDropdown = customDropdown;
|
activeDropdown = customDropdown;
|
||||||
|
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Preserve click handlers and add auto-close
|
// Handle clicks on dropdown items
|
||||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||||
item.addEventListener('click', function(e) {
|
item.addEventListener('click', function(e) {
|
||||||
|
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');
|
||||||
|
if (id) {
|
||||||
|
getLeadsDataForEdit(id);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
const onclickAttr = this.getAttribute('onclick');
|
const onclickAttr = this.getAttribute('onclick');
|
||||||
if (onclickAttr) {
|
if (onclickAttr) {
|
||||||
eval(onclickAttr);
|
eval(onclickAttr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// For RFQ links
|
||||||
const href = this.getAttribute('href');
|
const href = this.getAttribute('href');
|
||||||
if (href && href !== '#') {
|
if (href && href !== '#' && !this.classList.contains('btnEdit')) {
|
||||||
window.location.href = href;
|
window.location.href = href;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the dropdown after handling the click
|
// Close the dropdown
|
||||||
if (activeDropdown) {
|
if (activeDropdown) {
|
||||||
activeDropdown.style.display = 'none';
|
activeDropdown.style.display = 'none';
|
||||||
activeDropdown = null;
|
activeDropdown = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
e.stopPropagation();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -280,7 +290,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
$('#client_id').select2();
|
$('#client_id').select2();
|
||||||
$('#client_branch_id').select2();
|
$('#client_branch_id').select2();
|
||||||
$('#source_policy_id').select2();
|
// $('#source_policy_id').select2();
|
||||||
$('#salse_person_id').select2({
|
$('#salse_person_id').select2({
|
||||||
placeholder: "Select Salse Person",
|
placeholder: "Select Salse Person",
|
||||||
});
|
});
|
||||||
@ -326,12 +336,14 @@ $(document).ready(function() {
|
|||||||
function hide_list_show_add()
|
function hide_list_show_add()
|
||||||
{
|
{
|
||||||
$('#leads_list').hide()
|
$('#leads_list').hide()
|
||||||
|
$('#lead_filter_div').hide()
|
||||||
$('#leads_form').show()
|
$('#leads_form').show()
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_list_hide_add()
|
function show_list_hide_add()
|
||||||
{
|
{
|
||||||
$('#leads_list').show()
|
$('#leads_list').show()
|
||||||
|
$('#lead_filter_div').show()
|
||||||
$('#leads_form').hide()
|
$('#leads_form').hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,10 +447,12 @@ $(document).ready(function(){
|
|||||||
let client_id = $(this).val();
|
let client_id = $(this).val();
|
||||||
let client_type = $('#client_id option:selected').data('ct');
|
let client_type = $('#client_id option:selected').data('ct');
|
||||||
|
|
||||||
if(branch_list != '' && client_id != '') {
|
if(branch_list[client_id] != '' && branch_list[client_id] != null && client_id != '') {
|
||||||
console.log('branch_list', branch_list[client_id]);
|
console.log('branch_list', branch_list[client_id]);
|
||||||
let data = branch_list[client_id];
|
let data = branch_list[client_id];
|
||||||
appendBranch(data);
|
appendBranch(data);
|
||||||
|
}else{
|
||||||
|
toastr.warning("No Branch Found for the selected Client",'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -447,10 +461,12 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
let client_branch_id = $(this).val();
|
let client_branch_id = $(this).val();
|
||||||
|
|
||||||
if(policy_list != '' && client_branch_id != '') {
|
if(policy_list[client_branch_id] != '' && policy_list[client_branch_id] != null && client_branch_id != ''&& client_branch_id != null) {
|
||||||
console.log('policy_list', policy_list[client_branch_id]);
|
console.log('policy_list', policy_list[client_branch_id]);
|
||||||
let data = policy_list[client_branch_id];
|
let data = policy_list[client_branch_id];
|
||||||
appendRenewalPolicies(data);
|
appendRenewalPolicies(data);
|
||||||
|
}else{
|
||||||
|
toastr.warning("No Policies Found for the selected Branch",'Warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1395,7 +1395,7 @@
|
|||||||
console.log("Creating new editor instance...");
|
console.log("Creating new editor instance...");
|
||||||
editor = unlayer.createEditor({
|
editor = unlayer.createEditor({
|
||||||
id: `${template_name}_editor_container`,
|
id: `${template_name}_editor_container`,
|
||||||
projectId: 263979,
|
projectId: <?=getenv('unlayer.projectID') ?>,
|
||||||
displayMode: "email",
|
displayMode: "email",
|
||||||
features: {
|
features: {
|
||||||
textEditor: {
|
textEditor: {
|
||||||
@ -1972,4 +1972,52 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$(document).on('click', '#notification_enable_form_submit', function() {
|
||||||
|
var formData = [];
|
||||||
|
console.log($('#hr_mail_id').val());
|
||||||
|
|
||||||
|
formData.push({name:'client_id', value: $('#general_PrimaryKey').val()})
|
||||||
|
formData.push({ name: 'nhance_team_mail_ids', value: $('#nhance_team_mail_ids').val() });
|
||||||
|
formData.push({ name: 'hr_mail_id', value: $('#hr_mail_id').val() });
|
||||||
|
formData.push({ name: 'mail_domain', value: $('#mail_domain').val() });
|
||||||
|
formData.push({ name: 'reply_to', value: $('#reply_to').val() });
|
||||||
|
formData.push({ name: 'member_welcome_mail_btn', value: $('#member_welcome_mail_btn').prop('checked') });
|
||||||
|
formData.push({ name: 'member_reminder_mail_btn', value: $('#member_reminder_mail_btn').prop('checked') });
|
||||||
|
formData.push({ name: 'member_ecard_mail_btn', value: $('#member_ecard_mail_btn').prop('checked') });
|
||||||
|
formData.push({ name: 'member_review_and_summary_mail_btn', value: $('#member_review_and_summary_mail_btn').prop('checked') });
|
||||||
|
formData.push({ name: 'account_maneger_summary_mail_btn', value: $('#account_maneger_summary_mail_btn').prop('checked') });
|
||||||
|
formData.push({ name: 'client_hr_summary_mail_btn', value: $('#client_hr_summary_mail_btn').prop('checked') });
|
||||||
|
|
||||||
|
var form_action = '<?= base_url("client/notification/update_enable") ?>';
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
$.ajax({
|
||||||
|
url: form_action,
|
||||||
|
type: "POST",
|
||||||
|
data: formData,
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(res)
|
||||||
|
{
|
||||||
|
console.log(res);
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
toastr.success('Update 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 Wrong!', 'warning');
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
File diff suppressed because it is too large
Load Diff
@ -75,8 +75,10 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div id="policyGPATermsForm" style="display:none">
|
<div id="policyGPATermsForm" style="display:none">
|
||||||
<span id="policyGPATermsClose" style="float: right;font-size: 26px;color: red;margin-top: -42px;margin-left: 3px;margin-right: 7px;">x</span>
|
<span id="policyGPATermsClose"
|
||||||
<h5><label for="gpaTerms" style="margin-bottom: 20px;">Policy Terms <span id="nameOfThePolicyInGPA"></span></label></h5>
|
style="float: right;font-size: 26px;color: red;margin-top: -42px;margin-left: 3px;margin-right: 7px;">x</span>
|
||||||
|
<h5><label for="gpaTerms" style="margin-bottom: 20px;">Policy Terms <span id="nameOfThePolicyInGPA"></span></label>
|
||||||
|
</h5>
|
||||||
<form role="form" class="parsley-examples" method="post" id="policyGPATerms" enctype="multipart/form-data">
|
<form role="form" class="parsley-examples" method="post" id="policyGPATerms" enctype="multipart/form-data">
|
||||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||||
<input type="hidden" name="client_id" id="Client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
<input type="hidden" name="client_id" id="Client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
||||||
@ -91,7 +93,9 @@
|
|||||||
<label for="sumInsured">Sum Insured</label>
|
<label for="sumInsured">Sum Insured</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<input style="width: 128%;" class="form-control" type="text" name="sumInsured2" id="sumInsured2" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" style="width: 100% !important;">
|
<input style="width: 128%;" class="form-control" type="text" name="sumInsured2" id="sumInsured2"
|
||||||
|
onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)"
|
||||||
|
style="width: 100% !important;">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2" style="position: relative;left: 88px;">
|
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
||||||
@ -110,7 +114,8 @@
|
|||||||
<label for="totalSumInsured">Total Sum Assured</label>
|
<label for="totalSumInsured">Total Sum Assured</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="text" style="width: 100% !important;" class="form-control" name="totalSumInsured" id="totalSumInsured" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
<input type="text" style="width: 100% !important;" class="form-control" name="totalSumInsured"
|
||||||
|
id="totalSumInsured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
</div>
|
</div>
|
||||||
@ -126,28 +131,52 @@
|
|||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 5%;">
|
<td style="width: 5%;">
|
||||||
<span style="margin-right: 20px;">Self:</span>
|
<span style="margin-right: 20px;">Self:</span>
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 11%;">
|
<td style="width: 11%;">
|
||||||
<input disabled type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked>
|
<input disabled type="checkbox" style="margin-right: 70px;" name="family_floaters[]"
|
||||||
|
value="self" id="self" checked>
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 20%;">
|
<td style="width: 20%;">
|
||||||
<div class="self-age">
|
<div class="self-age">
|
||||||
<span style="margin-right: 20px;">Min Age:</span>
|
<span style="margin-right: 20px;">Min Age:</span>
|
||||||
<input class="underline-input min_age" value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>" style="width: 65%;" type="number" name="self_min_age" id="self_min_age_gpa" onchange="lowerIsEighteen(this)">
|
<input class="underline-input min_age"
|
||||||
|
value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>"
|
||||||
|
style="width: 65%;" type="number" name="self_min_age" id="self_min_age_gpa"
|
||||||
|
onchange="lowerIsEighteen(this)">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 20%;">
|
<td style="width: 20%;">
|
||||||
<div class="self-age">
|
<div class="self-age">
|
||||||
<span style="margin-right: 20px;">Max Age:</span>
|
<span style="margin-right: 20px;">Max Age:</span>
|
||||||
<input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 65%;" type="number" name="self_max_age" id="self_max_age_gpa" onchange="lowerIsEighteen(this)">
|
<input class="underline-input max_age"
|
||||||
|
value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>"
|
||||||
|
style="width: 65%;" type="number" name="self_max_age" id="self_max_age_gpa"
|
||||||
|
onchange="lowerIsEighteen(this)">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -157,176 +186,262 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="accidentalDeathBenefit_display" id="accidentalDeathBenefit_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
<label for="totalSumInsured">Accidental Death Benefit</label>
|
<label for="totalSumInsured">Accidental Death Benefit</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="accidentalDeathBenefit" value="1"> Yes
|
<input type="text" name="accidentalDeathBenefit" class="form-control">
|
||||||
<input type="radio" name="accidentalDeathBenefit" value="0" style="margin-left:10px" checked> No
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Permanent Total Disablement</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="permanentTotalDisablement_display" id="permanentTotalDisablement_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="permanentTotalDisablement">Permanent Total Disablement</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="text" name="permanentTotalDisablement" id="permanentTotalDisablement" class="form-control">
|
<input type="text" name="permanentTotalDisablement" id="permanentTotalDisablement"
|
||||||
|
class="form-control">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
|
||||||
<label for="totalSumInsured">Permanent Partial Disablement</label>
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="permanentPartialDisablement_display" id="permanentPartialDisablement_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="permanentPartialDisablement">Permanent Partial Disablement</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="text" name="permanentPartialDisablement" id="permanentPartialDisablement" class="form-control">
|
<input type="text" name="permanentPartialDisablement" id="permanentPartialDisablement"
|
||||||
|
class="form-control">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Temporary Total Disablement benefit</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="temporaryTotalDisablementBenefit_display" id="temporaryTotalDisablementBenefit_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="temporaryTotalDisablementBenefit">Temporary Total Disablement Benefit</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="text" name="temporaryTotalDisablementBenefit" id="temporaryTotalDisablementBenefit" class="form-control">
|
<input type="text" name="temporaryTotalDisablementBenefit" id="temporaryTotalDisablementBenefit"
|
||||||
|
class="form-control">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Accidental Hospitalization Expenses</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="medical_expenses_medical_extension_display" id="medical_expenses_medical_extension_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="medical_expenses_medical_extension">Medical Expenses / Medical Extension (IPD)</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<select name="accidentalHospitalizationExpenses" id="accidentalHospitalizationExpenses" class="form-control">
|
<input type="text" name="medical_expenses_medical_extension" id="medical_expenses_medical_extension"
|
||||||
<option value="">Select an option</option>
|
class="form-control">
|
||||||
<option value="No">No</option>
|
|
||||||
<option value="10%-40%">Covered upto 10% of SI or 40% of actual which ever is less</option>
|
|
||||||
<option value="20%-50%">Covered upto 20% of SI or 50% of actual which ever is less</option>
|
|
||||||
<option value="50K-500k">INR 50K, to vary in multiples of 25K till 5 Lacs</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Children Education Welfare Fund</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="opd_treatment_cover_display" id="opd_treatment_cover_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="opd_treatment_cover">OPD Treatment Cover</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<select name="childrenEducationWelfareFund" id="childrenEducationWelfareFund" class="form-control">
|
<input type="text" name="opd_treatment_cover" id="opd_treatment_cover" class="form-control">
|
||||||
<option value="">Select an option</option>
|
|
||||||
<option value="No">No</option>
|
|
||||||
<option value="10000">Covered upto 10,000/ per child ( Restricted to 2 children)</option>
|
|
||||||
<option value="5000">Covered upto 5,000/ per child ( Restricted to 2 children)</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Compassionate Visit Expenses</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="ambulanceCharges_display" id="ambulanceCharges_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="ambulanceCharges"> Ambulance Charges</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="compassionateVisitExpenses" value="1"> Yes
|
<input type="text" name="ambulanceCharges" class="form-control">
|
||||||
<input type="radio" name="compassionateVisitExpenses" value="0" style="margin-left:10px" checked> No
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<label for="totalSumInsured">Compassionate Visit Expenses Data</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<input type="text" name="compassionateVisitExpensesData" id="compassionateVisitExpensesData" class="form-control">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Broken Bone Expenses</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="repatriation_of_mortal_remains_display" id="repatriation_of_mortal_remains_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="repatriation_of_mortal_remains">Repatriation of Mortal Remains</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="brokenBoneExpenses" value="1"> Yes
|
<input type="text" name="repatriation_of_mortal_remains" id="repatriation_of_mortal_remains" class="form-control">
|
||||||
<input type="radio" name="brokenBoneExpenses" value="0" style="margin-left:10px" checked> No
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<label for="totalSumInsured">Broken Bone Expenses Data</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<input type="text" name="brokenBoneExpensesData" id="brokenBoneExpensesData" class="form-control">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured"> Ambulance charges</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="childrenEducationWelfareFund_display" id="childrenEducationWelfareFund_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="childrenEducationWelfareFund">Children Education Welfare Fund</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="ambulanceCharges" value="1"> Yes
|
<input type="text" name="childrenEducationWelfareFund" id="childrenEducationWelfareFund" class="form-control">
|
||||||
<input type="radio" name="ambulanceCharges" value="0" style="margin-left:10px" checked> No
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<label for="totalSumInsured">Ambulance charges Data</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<input type="text" name="ambulanceChargesData" id="ambulanceChargesData" class="form-control">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured"> Burn Expenses</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="terrorism_display" id="gpa_terrorism_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="terrorism">Terrorism</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="burnExpenses" value="1"> Yes
|
<input type="text" name="terrorism" class="form-control">
|
||||||
<input type="radio" name="burnExpenses" value="0" style="margin-left:10px" checked> No
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<label for="totalSumInsured">Burn Expenses Data</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<input type="text" name="burnExpensesData" id="burnExpensesData" class="form-control">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Carriage of Dead Body</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="worldwideCover_display" id="worldwideCover_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="worldwideCover">Worldwide Cover</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="carriageOfDeadBody" value="1"> Yes
|
<input type="text" name="worldwideCover" class="form-control">
|
||||||
<input type="radio" name="carriageOfDeadBody" value="0" style="margin-left:10px" checked> No
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<label for="totalSumInsured">Carriage of Dead Body Data</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<input type="text" name="carriageOfDeadBodyData" id="carriageOfDeadBodyData" class="form-control">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Animal/Snake/Insect bite</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="family_transportation_benefits_display" id="family_transportation_benefits_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="family_transportation_benefits">Family Transportation Benefits</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="animalSnakeInsectBite" value="1"> Yes
|
<input type="text" name="family_transportation_benefits" id="family_transportation_benefits" class="form-control">
|
||||||
<input type="radio" name="animalSnakeInsectBite" value="0" style="margin-left:10px" checked> No
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Terrorism</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="fractures_dislocation_burns_display" id="fractures_dislocation_burns_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="fractures_dislocation_burns">Fractures / Dislocation / Burns</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="terrorism" value="1"> Yes
|
<input type="text" name="fractures_dislocation_burns" id="fractures_dislocation_burns" class="form-control">
|
||||||
<input type="radio" name="terrorism" value="0" style="margin-left:10px" checked> No
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Worldwide Cover</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="coma_display" id="coma_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="coma">Coma</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="worldwideCover" value="1"> Yes
|
<input type="text" name="coma" id="coma" class="form-control">
|
||||||
<input type="radio" name="worldwideCover" value="0" style="margin-left:10px" checked> No
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="carriageofDeadBody_display" id="carriageofDeadBody_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="carriageOfDeadBody">Carriage of Dead Body</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="carriageOfDeadBody" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="compassionateVisitExpenses_display" id="compassionateVisitExpenses_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="compassionateVisitExpenses">Compassionate Visit Expenses</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="compassionateVisitExpenses" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="travel_expenses_for_medical_treatment_display" id="travel_expenses_for_medical_treatment_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="travel_expenses_for_medical_treatment">Travel expenses for Medical Treatment</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="travel_expenses_for_medical_treatment" id="travel_expenses_for_medical_treatment" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="daily_cash_allowance_display" id="daily_cash_allowance_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="daily_cash_allowance">Daily cash Allowance</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="daily_cash_allowance" id="daily_cash_allowance" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="artifical_limb_and_prosthesis_display" id="artifical_limb_and_prosthesis_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="artifical_limb_and_prosthesis">Artifical Limb and Prosthesis</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="artifical_limb_and_prosthesis" id="artifical_limb_and_prosthesis" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="animalSnakeInsectBite_display" id="animalSnakeInsectBite_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="animalSnakeInsectBite">Animal/Snake/Insect bite</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="animalSnakeInsectBite" id="animalSnakeInsectBite" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="air_ambulance_display" id="air_ambulance_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="air_ambulance">Air Ambulance</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="air_ambulance" id="air_ambulance" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -339,8 +454,10 @@
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
<div class="form-group text-right m-b-0" style="margin-top: -49px;">
|
<div class="form-group text-right m-b-0" style="margin-top: -49px;">
|
||||||
<a href="#" class="button-like" id="gpaButtonSpecialCondition" title="Special Condition">Special Condition</a>
|
<a href="#" class="button-like" id="gpaButtonSpecialCondition" title="Special Condition">Special
|
||||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGPATermsSubmit" style="margin-top: 100px;">Submit</button>
|
Condition</a>
|
||||||
|
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGPATermsSubmit"
|
||||||
|
style="margin-top: 100px;">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -428,7 +545,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("#policyGPATerms").submit(function(event) {
|
$("#policyGPATerms").submit(function(event) {
|
||||||
|
|
||||||
|
|
||||||
@ -451,11 +567,28 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var specialConditions = [];
|
||||||
|
|
||||||
|
$(".removeDom").each(function () {
|
||||||
|
var isChecked = $(this).find("input[name='gpa_special_condition_display[]']").is(":checked");
|
||||||
|
|
||||||
|
if (isChecked) {
|
||||||
|
var label = $(this).find("input[name='gpa_special_condition_label[]']").val();
|
||||||
|
var input = $(this).find("input[name='gpa_special_condition_input[]']").val();
|
||||||
|
|
||||||
|
specialConditions.push({ [label]: input });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("gpa_specialConditions", specialConditions);
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
$('.loader-mask').fadeIn();
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
var formData = new FormData($('#policyGPATerms')[0]);
|
var formData = new FormData($('#policyGPATerms')[0]);
|
||||||
var policy_form_action = '<?= base_url("client/terms/gpa_create") ?>';
|
var policy_form_action = '<?= base_url("client/terms/gpa_create") ?>';
|
||||||
|
formData.append("gpa_special_condition_display_value", JSON.stringify(specialConditions));
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: formData,
|
data: formData,
|
||||||
@ -500,7 +633,6 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('body').on('click', '.btnPolicyMaster', function() {
|
$('body').on('click', '.btnPolicyMaster', function() {
|
||||||
|
|
||||||
var client_policy_id = $(this).data('id');
|
var client_policy_id = $(this).data('id');
|
||||||
@ -550,13 +682,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (res) {
|
if (res && res.data) {
|
||||||
|
|
||||||
let gpaJsonObjectForSpecialCondition = JSON.parse(res.data);
|
let gpaJsonObjectForSpecialCondition = JSON.parse(res.data);
|
||||||
Object.keys(gpaJsonObjectForSpecialCondition).forEach(function(key) {
|
Object.keys(gpaJsonObjectForSpecialCondition).forEach(function(key) {
|
||||||
if (key.includes("gpa_special_condition_label") || key.includes("gpa_special_condition_input")) {
|
if (key.includes("gpa_special_condition_label") || key.includes(
|
||||||
|
"gpa_special_condition_input")) {
|
||||||
if (key.includes("gpa_special_condition_label")) {
|
if (key.includes("gpa_special_condition_label")) {
|
||||||
for (let index = 0; index < gpaJsonObjectForSpecialCondition[key].length; index++) {
|
for (let index = 0; index <
|
||||||
|
gpaJsonObjectForSpecialCondition[key].length; index++) {
|
||||||
specialConditionForGPA();
|
specialConditionForGPA();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -565,10 +699,33 @@
|
|||||||
if (elements) {
|
if (elements) {
|
||||||
elements.forEach((element, index) => {
|
elements.forEach((element, index) => {
|
||||||
|
|
||||||
if(gpaJsonObjectForSpecialCondition[key][index] == undefined){
|
if (gpaJsonObjectForSpecialCondition[key][
|
||||||
|
index
|
||||||
|
] == undefined) {
|
||||||
element.value = " ";
|
element.value = " ";
|
||||||
} else {
|
} else {
|
||||||
element.value = gpaJsonObjectForSpecialCondition[key][index];
|
element.value =
|
||||||
|
gpaJsonObjectForSpecialCondition[key][
|
||||||
|
index
|
||||||
|
];
|
||||||
|
|
||||||
|
if (key.includes("gpa_special_condition_label")) {
|
||||||
|
let checkbox = $(element).closest('.form-group').find('input[name="gpa_special_condition_display[]"]');
|
||||||
|
console.log("First element:", element);
|
||||||
|
|
||||||
|
if (checkbox.length) {
|
||||||
|
console.log("Checkbox found:", checkbox);
|
||||||
|
|
||||||
|
// Correct way to set the 'id' attribute
|
||||||
|
let formattedValue = gpaJsonObjectForSpecialCondition[key][index].replace(/[\s\-\/,&]+/g, '').toLowerCase();
|
||||||
|
console.log('formattedValue', formattedValue);
|
||||||
|
checkbox.attr('id', formattedValue + '_display');
|
||||||
|
|
||||||
|
console.log("Updated Checkbox:", checkbox);
|
||||||
|
} else {
|
||||||
|
console.log("Checkbox not found for:", element);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -577,7 +734,8 @@
|
|||||||
if (key.includes("multiple_sum_insured") && key != "") {
|
if (key.includes("multiple_sum_insured") && key != "") {
|
||||||
|
|
||||||
if (Array.isArray(gpaJsonObjectForSpecialCondition[key])) {
|
if (Array.isArray(gpaJsonObjectForSpecialCondition[key])) {
|
||||||
gpaJsonObjectForSpecialCondition[key].forEach((value, index) => {
|
gpaJsonObjectForSpecialCondition[key].forEach((value,
|
||||||
|
index) => {
|
||||||
appendGPASIAddMore(value);
|
appendGPASIAddMore(value);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -585,22 +743,36 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key.includes("enrollment_display_key") && key != "") {
|
||||||
|
|
||||||
|
console.log('enrollment_display_key');
|
||||||
|
console.log(gpaJsonObjectForSpecialCondition[key]);
|
||||||
|
|
||||||
|
processJsonObject2(gpaJsonObjectForSpecialCondition);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let jsonObject = JSON.parse(res.data);
|
let jsonObject = JSON.parse(res.data);
|
||||||
$("#numberToWordSumInsured").text(convertCommaNumberToWords(jsonObject.sumInsured2) ?? '' );
|
$("#numberToWordSumInsured").text(convertCommaNumberToWords(jsonObject
|
||||||
$("#numberToWordTotalSumInsured").text(convertCommaNumberToWords(jsonObject.totalSumInsured) ?? '');
|
.sumInsured2) ?? '');
|
||||||
|
$("#numberToWordTotalSumInsured").text(convertCommaNumberToWords(jsonObject
|
||||||
|
.totalSumInsured) ?? '');
|
||||||
|
|
||||||
if (jsonObject.compassionateVisitExpenses == '1') {
|
if (jsonObject.compassionateVisitExpenses == '1') {
|
||||||
var element = $('input[name="compassionateVisitExpenses"]').parent().parent().next()[0];
|
var element = $('input[name="compassionateVisitExpenses"]').parent()
|
||||||
|
.parent().next()[0];
|
||||||
$(element).css("display", "");
|
$(element).css("display", "");
|
||||||
}
|
}
|
||||||
if (jsonObject.brokenBoneExpenses == '1') {
|
if (jsonObject.brokenBoneExpenses == '1') {
|
||||||
var element = $('input[name="brokenBoneExpenses"]').parent().parent().next()[0];
|
var element = $('input[name="brokenBoneExpenses"]').parent().parent()
|
||||||
|
.next()[0];
|
||||||
$(element).css("display", "");
|
$(element).css("display", "");
|
||||||
}
|
}
|
||||||
if (jsonObject.ambulanceCharges == '1') {
|
if (jsonObject.ambulanceCharges == '1') {
|
||||||
var element = $('input[name="ambulanceCharges"]').parent().parent().next()[0];
|
var element = $('input[name="ambulanceCharges"]').parent().parent().next()[
|
||||||
|
0];
|
||||||
$(element).css("display", "");
|
$(element).css("display", "");
|
||||||
}
|
}
|
||||||
if (jsonObject.burnExpenses == '1') {
|
if (jsonObject.burnExpenses == '1') {
|
||||||
@ -608,22 +780,23 @@
|
|||||||
$(element).css("display", "");
|
$(element).css("display", "");
|
||||||
}
|
}
|
||||||
if (jsonObject.carriageOfDeadBody == '1') {
|
if (jsonObject.carriageOfDeadBody == '1') {
|
||||||
var element = $('input[name="carriageOfDeadBody"]').parent().parent().next()[0];
|
var element = $('input[name="carriageOfDeadBody"]').parent().parent()
|
||||||
|
.next()[0];
|
||||||
$(element).css("display", "");
|
$(element).css("display", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Object.keys(jsonObject).forEach(function(key) {
|
Object.keys(jsonObject).forEach(function(key) {
|
||||||
|
|
||||||
console.log('jsonObject key', key)
|
// console.log('jsonObject key', key)
|
||||||
console.log('jsonObject value', jsonObject[key])
|
// console.log('jsonObject value', jsonObject[key])
|
||||||
console.log('jsonObject value type',typeof jsonObject[key])
|
// console.log('jsonObject value type', typeof jsonObject[key])
|
||||||
|
|
||||||
let elements = document.getElementsByName(key);
|
let elements = document.getElementsByName(key);
|
||||||
if (elements && elements.length > 0) {
|
if (elements && elements.length > 0) {
|
||||||
let element = elements[0];
|
let element = elements[0];
|
||||||
|
|
||||||
if (element.tagName === 'INPUT' && (element.type === 'checkbox' || element.type === 'radio')) {
|
if (element.tagName === 'INPUT' && (element.type ===
|
||||||
|
'checkbox' || element.type === 'radio')) {
|
||||||
|
|
||||||
if (element.type === 'checkbox') {
|
if (element.type === 'checkbox') {
|
||||||
element.checked = jsonObject[key] === '1';
|
element.checked = jsonObject[key] === '1';
|
||||||
@ -657,7 +830,6 @@
|
|||||||
$('.multiple_sum_insured').trigger("keyup");
|
$('.multiple_sum_insured').trigger("keyup");
|
||||||
$("#totalSumInsured").trigger("keyup");
|
$("#totalSumInsured").trigger("keyup");
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
@ -676,7 +848,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
@ -690,7 +861,6 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function specialConditionForGPA(count = 0) {
|
function specialConditionForGPA(count = 0) {
|
||||||
|
|
||||||
console.log('specialConditionForGPA function called')
|
console.log('specialConditionForGPA function called')
|
||||||
@ -703,7 +873,9 @@
|
|||||||
|
|
||||||
var index = $('.modifyclassinput').length;
|
var index = $('.modifyclassinput').length;
|
||||||
var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
|
var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" name="gpa_special_condition_display[]" id="special_condition_display" class="unchecked" checked>
|
||||||
|
</div>
|
||||||
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;position: relative;bottom: 6px;">
|
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;position: relative;bottom: 6px;">
|
||||||
<input class="form-control" name="gpa_special_condition_label[]" id="gpa_special_condition_label[]" style="position: relative;right: 5px;">
|
<input class="form-control" name="gpa_special_condition_label[]" id="gpa_special_condition_label[]" style="position: relative;right: 5px;">
|
||||||
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
|
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
|
||||||
@ -721,8 +893,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(document).on('click', '#policyGPATermsClose', function() {
|
$(document).on('click', '#policyGPATermsClose', function() {
|
||||||
$('#policyGPATermsForm').css('display', 'none');
|
$('#policyGPATermsForm').css('display', 'none');
|
||||||
$('#police-tab').css('display', '');
|
$('#police-tab').css('display', '');
|
||||||
@ -733,7 +903,6 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("#sumInsured2").on("keyup", function() {
|
$("#sumInsured2").on("keyup", function() {
|
||||||
var inputNumber = $(this).val();
|
var inputNumber = $(this).val();
|
||||||
if (inputNumber) {
|
if (inputNumber) {
|
||||||
@ -759,7 +928,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function numtowordinkeyup(input) {
|
function numtowordinkeyup(input) {
|
||||||
console.log('testing......')
|
console.log('testing......')
|
||||||
console.log(input);
|
console.log(input);
|
||||||
@ -779,7 +947,6 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$("#totalSumInsured").on("keyup", function() {
|
$("#totalSumInsured").on("keyup", function() {
|
||||||
var inputNumber = $(this).val();
|
var inputNumber = $(this).val();
|
||||||
if (inputNumber) {
|
if (inputNumber) {
|
||||||
@ -790,9 +957,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function appendGPASIAddMore(data = null) {
|
||||||
function appendGPASIAddMore(data = null)
|
|
||||||
{
|
|
||||||
|
|
||||||
console.log('appendGPASIAddMore function called')
|
console.log('appendGPASIAddMore function called')
|
||||||
console.log('appendGPASIAddMore function data', data)
|
console.log('appendGPASIAddMore function data', data)
|
||||||
@ -818,4 +983,61 @@
|
|||||||
|
|
||||||
$('#gpa_si_add_more').append(html);
|
$('#gpa_si_add_more').append(html);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function inArray(key, array) {
|
||||||
|
return array.includes(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
function processJsonObject2(jsonObject) {
|
||||||
|
|
||||||
|
if (typeof jsonObject !== 'object' || Array.isArray(jsonObject)) {
|
||||||
|
console.log("jsonObject Input is not a valid object.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.unchecked').prop('checked', false);
|
||||||
|
|
||||||
|
for (let key in jsonObject) {
|
||||||
|
if (typeof jsonObject[key] === 'object' && !Array.isArray(jsonObject[key])) {
|
||||||
|
// console.log('enrollment_display_key');
|
||||||
|
// console.log(jsonObject[key]);
|
||||||
|
|
||||||
|
for (let innerKey in jsonObject[key]) {
|
||||||
|
|
||||||
|
const keysToCheck = [
|
||||||
|
"OPD Treatment Cover",
|
||||||
|
"Repatriation of Mortal Remains",
|
||||||
|
"Family Transportation Benefits",
|
||||||
|
"Fractures / Dislocation / Burns",
|
||||||
|
"Travel expenses for Medical Treatment",
|
||||||
|
"Daily cash Allowance",
|
||||||
|
"Artifical Limb and Prosthesis",
|
||||||
|
"Air Ambulance",
|
||||||
|
];
|
||||||
|
|
||||||
|
//let base_id = innerKey.replace(/[\s\-\/,&]+/g, '').toLowerCase();
|
||||||
|
let base_id = innerKey.replace(/[\s\-\/,&]+/g, '');
|
||||||
|
base_id = base_id.charAt(0).toLowerCase() + base_id.slice(1);
|
||||||
|
|
||||||
|
if (keysToCheck.includes(innerKey)) {
|
||||||
|
// console.log("Key found: " + innerKey);
|
||||||
|
base_id = innerKey.replace(/[\s\-\/]+/g, '_').toLowerCase();
|
||||||
|
} else if (innerKey == "Medical Expenses / Medical Extension (IPD)") {
|
||||||
|
// console.log("Key found: " + innerKey);
|
||||||
|
base_id = "medical_expenses_medical_extension";
|
||||||
|
} else if (innerKey == "Terrorism") {
|
||||||
|
// console.log("Key found: " + innerKey);
|
||||||
|
base_id = "gpa_terrorism";
|
||||||
|
}
|
||||||
|
|
||||||
|
let display_id = base_id + "_display";
|
||||||
|
$('#' + display_id).prop('checked', true);
|
||||||
|
// console.log('display_id : ', display_id);
|
||||||
|
// console.log($('#' + display_id))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log(`${key} is not an object.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
File diff suppressed because it is too large
Load Diff
@ -362,23 +362,26 @@ custom-dropdown-menu {
|
|||||||
|
|
||||||
<?php include('policy_transaction_endorsement_form.php'); ?>
|
<?php include('policy_transaction_endorsement_form.php'); ?>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
const table = document.getElementById("tickets-table");
|
const table = document.getElementById("tickets-table");
|
||||||
|
|
||||||
// Create custom dropdown
|
// Create custom dropdown
|
||||||
function createCustomDropdown(row) {
|
function createCustomDropdown(row) {
|
||||||
// Get the original dropdown items
|
|
||||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||||
if (!originalDropdown) return null;
|
if (!originalDropdown) return null;
|
||||||
|
|
||||||
// Create new dropdown with proper background and spacing
|
|
||||||
const customDropdown = document.createElement('div');
|
const customDropdown = document.createElement('div');
|
||||||
customDropdown.className = 'custom-dropdown-menu';
|
customDropdown.className = 'custom-dropdown-menu';
|
||||||
|
|
||||||
// Copy inner content while maintaining icon alignment
|
|
||||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||||
|
|
||||||
|
// Remove inline onclick handlers and store them in data attributes
|
||||||
|
const originalItems = originalDropdown.querySelectorAll('.dropdown-item');
|
||||||
|
customDropdown.querySelectorAll('.dropdown-item').forEach((item, index) => {
|
||||||
|
const originalOnclick = originalItems[index].getAttribute('onclick');
|
||||||
|
item.removeAttribute('onclick'); // Remove the inline handler
|
||||||
|
item.setAttribute('data-onclick', originalOnclick); // Store in data attribute
|
||||||
|
});
|
||||||
|
|
||||||
return customDropdown;
|
return customDropdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,45 +395,34 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
document.body.appendChild(customDropdown);
|
document.body.appendChild(customDropdown);
|
||||||
|
|
||||||
row.addEventListener("click", function(event) {
|
row.addEventListener("click", function(event) {
|
||||||
// Ignore clicks on the action column
|
// Ignore clicks on the first column
|
||||||
if (event.target.closest('td:last-child')) {
|
if (event.target.closest('td:first-child')) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hide any active dropdown
|
if (activeDropdown) activeDropdown.style.display = 'none';
|
||||||
if (activeDropdown) {
|
|
||||||
activeDropdown.style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get click position
|
|
||||||
const rect = event.target.getBoundingClientRect();
|
const rect = event.target.getBoundingClientRect();
|
||||||
|
|
||||||
// Position the dropdown with some offset
|
|
||||||
customDropdown.style.display = 'block';
|
customDropdown.style.display = 'block';
|
||||||
customDropdown.style.position = 'fixed';
|
customDropdown.style.position = 'fixed';
|
||||||
customDropdown.style.left = `${rect.left}px`;
|
customDropdown.style.left = `${rect.left}px`;
|
||||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||||
|
|
||||||
// Set as active dropdown
|
|
||||||
activeDropdown = customDropdown;
|
activeDropdown = customDropdown;
|
||||||
|
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Preserve click handlers and add auto-close
|
// Handle custom dropdown clicks
|
||||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||||
item.addEventListener('click', function(e) {
|
item.addEventListener('click', function(e) {
|
||||||
const onclickAttr = this.getAttribute('onclick');
|
e.preventDefault();
|
||||||
if (onclickAttr) {
|
|
||||||
eval(onclickAttr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Execute the original onclick from data attribute
|
||||||
|
const onclickAttr = this.getAttribute('data-onclick');
|
||||||
|
if (onclickAttr) eval(onclickAttr);
|
||||||
|
|
||||||
|
// Handle href navigation
|
||||||
const href = this.getAttribute('href');
|
const href = this.getAttribute('href');
|
||||||
if (href && href !== '#') {
|
if (href && href !== '#') window.location.href = href;
|
||||||
window.location.href = href;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Close the dropdown after handling the click
|
|
||||||
if (activeDropdown) {
|
if (activeDropdown) {
|
||||||
activeDropdown.style.display = 'none';
|
activeDropdown.style.display = 'none';
|
||||||
activeDropdown = null;
|
activeDropdown = null;
|
||||||
@ -441,7 +433,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Close dropdown when clicking outside
|
// Close dropdown on outside click
|
||||||
document.addEventListener("click", function() {
|
document.addEventListener("click", function() {
|
||||||
if (activeDropdown) {
|
if (activeDropdown) {
|
||||||
activeDropdown.style.display = 'none';
|
activeDropdown.style.display = 'none';
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -302,7 +302,7 @@ table.dataTable tbody td {
|
|||||||
<td><?php echo $issuer[$row['issuer']]; ?></td>
|
<td><?php echo $issuer[$row['issuer']]; ?></td>
|
||||||
<td><?php echo $issuing_type[$row['issue_type']]; ?></td>
|
<td><?php echo $issuing_type[$row['issue_type']]; ?></td>
|
||||||
<td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td>
|
<td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td>
|
||||||
<td><?php echo $row['client_type'] == 2 ? $row['client_name'] : $row['client_short_name'] . ' - ' . $row['client_branch_name']; ?></td>
|
<td><?php echo $row['client_type'] == 2 ? $row['client_name'] . " - " . (!empty($row['pan']) ? $row['pan'] : 'N/A') : $row['client_short_name'] . ' - ' . $row['client_branch_name']; ?></td>
|
||||||
<td><?php echo $row['insurer_short_name']; ?></td>
|
<td><?php echo $row['insurer_short_name']; ?></td>
|
||||||
<td><?php echo $row['policy_type']; ?></td>
|
<td><?php echo $row['policy_type']; ?></td>
|
||||||
<td><?php echo $row['policy_no']; ?></td>
|
<td><?php echo $row['policy_no']; ?></td>
|
||||||
@ -319,7 +319,7 @@ table.dataTable tbody td {
|
|||||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" data-id="<?= $row['id'];?>" onclick="removePolicyTransaction(this, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
<a class="dropdown-item delete" data-id="<?= $row['id'];?>" onclick="removePolicyTransaction(this, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||||
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@ -370,25 +370,25 @@ table.dataTable tbody td {
|
|||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
const table = document.getElementById("tickets-table");
|
const table = document.getElementById("tickets-table");
|
||||||
|
|
||||||
// Create custom dropdown
|
|
||||||
function createCustomDropdown(row) {
|
function createCustomDropdown(row) {
|
||||||
// Get the original dropdown items
|
|
||||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||||
if (!originalDropdown) return null;
|
if (!originalDropdown) return null;
|
||||||
|
|
||||||
// Create new dropdown with proper background and spacing
|
|
||||||
const customDropdown = document.createElement('div');
|
const customDropdown = document.createElement('div');
|
||||||
customDropdown.className = 'custom-dropdown-menu';
|
customDropdown.className = 'custom-dropdown-menu';
|
||||||
|
|
||||||
// Copy inner content while maintaining icon alignment
|
const items = originalDropdown.querySelectorAll('.dropdown-item');
|
||||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
items.forEach(item => {
|
||||||
|
const newItem = item.cloneNode(true);
|
||||||
|
newItem.removeAttribute('onclick');
|
||||||
|
customDropdown.appendChild(newItem);
|
||||||
|
});
|
||||||
|
|
||||||
return customDropdown;
|
return customDropdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
let activeDropdown = null;
|
let activeDropdown = null;
|
||||||
|
|
||||||
// Add click event listener to rows
|
|
||||||
table.querySelectorAll("tbody tr").forEach(row => {
|
table.querySelectorAll("tbody tr").forEach(row => {
|
||||||
const customDropdown = createCustomDropdown(row);
|
const customDropdown = createCustomDropdown(row);
|
||||||
if (!customDropdown) return;
|
if (!customDropdown) return;
|
||||||
@ -401,51 +401,56 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide any active dropdown
|
// Close any existing dropdown
|
||||||
if (activeDropdown) {
|
if (activeDropdown && activeDropdown !== customDropdown) {
|
||||||
activeDropdown.style.display = 'none';
|
activeDropdown.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get click position
|
|
||||||
const rect = event.target.getBoundingClientRect();
|
const rect = event.target.getBoundingClientRect();
|
||||||
|
|
||||||
// Position the dropdown with some offset
|
|
||||||
customDropdown.style.display = 'block';
|
customDropdown.style.display = 'block';
|
||||||
customDropdown.style.position = 'fixed';
|
customDropdown.style.position = 'fixed';
|
||||||
customDropdown.style.left = `${rect.left}px`;
|
customDropdown.style.left = `${rect.left}px`;
|
||||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||||
|
|
||||||
// Set as active dropdown
|
|
||||||
activeDropdown = customDropdown;
|
activeDropdown = customDropdown;
|
||||||
|
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Preserve click handlers and add auto-close
|
// Handle clicks on dropdown items
|
||||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||||
item.addEventListener('click', function(e) {
|
item.addEventListener('click', function(e) {
|
||||||
const onclickAttr = this.getAttribute('onclick');
|
e.preventDefault();
|
||||||
if (onclickAttr) {
|
e.stopPropagation();
|
||||||
eval(onclickAttr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const id = this.getAttribute('data-id');
|
||||||
|
|
||||||
|
// Handle edit button
|
||||||
|
if (this.classList.contains('btnEdit') && id) {
|
||||||
|
getPolicyTransactionDataForEdit(id);
|
||||||
|
}
|
||||||
|
// Handle delete button
|
||||||
|
else if (this.classList.contains('delete') && id) {
|
||||||
|
removePolicyTransaction(this, id);
|
||||||
|
}
|
||||||
|
// Handle other links
|
||||||
|
else {
|
||||||
const href = this.getAttribute('href');
|
const href = this.getAttribute('href');
|
||||||
if (href && href !== '#') {
|
if (href && href !== '#' && href !== 'javascript: void(0);') {
|
||||||
window.location.href = href;
|
window.location.href = href;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Close the dropdown after handling the click
|
// Close dropdown
|
||||||
if (activeDropdown) {
|
if (activeDropdown) {
|
||||||
activeDropdown.style.display = 'none';
|
activeDropdown.style.display = 'none';
|
||||||
activeDropdown = null;
|
activeDropdown = null;
|
||||||
}
|
}
|
||||||
|
}, { once: true });
|
||||||
e.stopPropagation();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Close dropdown when clicking outside
|
// Close dropdown on outside click
|
||||||
document.addEventListener("click", function() {
|
document.addEventListener("click", function() {
|
||||||
if (activeDropdown) {
|
if (activeDropdown) {
|
||||||
activeDropdown.style.display = 'none';
|
activeDropdown.style.display = 'none';
|
||||||
@ -729,17 +734,22 @@ function appendClients(data)
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
|
|
||||||
|
let client_show_name = item.client_name;
|
||||||
|
if (item.client_type == 2) {
|
||||||
|
client_show_name = item.client_name + ' - ' + (item.pan ?? 'N/A');
|
||||||
|
}
|
||||||
|
|
||||||
var option = $('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.id,
|
value: item.id,
|
||||||
text: item.client_name,
|
text: client_show_name,
|
||||||
'data-cn': item.client_name,
|
'data-cn': item.client_name,
|
||||||
'data-ct': item.client_type,
|
'data-ct': item.client_type,
|
||||||
class: (item.client_type == 1) ? 'group' : (item.client_type == 2) ? 'individual' : ''
|
class: item.client_type == 1 ? 'group' : item.client_type == 2 ? 'individual' : ''
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#client_id').append(option);
|
$('#client_id').append(option);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function appendVehicles(data, vehicle_id)
|
function appendVehicles(data, vehicle_id)
|
||||||
@ -1244,7 +1254,7 @@ $('#issue_type').change(function(){
|
|||||||
let value = $(this).val()
|
let value = $(this).val()
|
||||||
|
|
||||||
if(value == 1){
|
if(value == 1){
|
||||||
$('#revenue_type').val('NA');
|
$('#revenue_type').val('');
|
||||||
$('#revenue_type option[value="NA"]').show();
|
$('#revenue_type option[value="NA"]').show();
|
||||||
$('#revenue_type option[value="EANR"]').show();
|
$('#revenue_type option[value="EANR"]').show();
|
||||||
$('#revenue_type option[value="EA"]').hide();
|
$('#revenue_type option[value="EA"]').hide();
|
||||||
@ -1486,7 +1496,7 @@ function onlyNumbers(event)
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
getURLParams()
|
// getURLParams()
|
||||||
$('#client_id_for_search').select2();
|
$('#client_id_for_search').select2();
|
||||||
$('#insurer_id_for_search').select2();
|
$('#insurer_id_for_search').select2();
|
||||||
$('#policy_type_for_search').select2();
|
$('#policy_type_for_search').select2();
|
||||||
@ -1531,50 +1541,50 @@ function objectToQueryString(obj)
|
|||||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getURLParams()
|
// function getURLParams()
|
||||||
{
|
// {
|
||||||
const url = new URL(window.location.href);
|
// const url = new URL(window.location.href);
|
||||||
const params = new URLSearchParams(url.search);
|
// const params = new URLSearchParams(url.search);
|
||||||
|
|
||||||
const startDate = params.get('start_date') || 0; // Default to 0 if not found
|
// const startDate = params.get('start_date') || 0; // Default to 0 if not found
|
||||||
const endDate = params.get('end_date') || 0; // Default to 0 if not found
|
// 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 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_id = params.get('insurer_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 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 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
|
// const issuer = params.get('issuer') || 0; // Default to 0 if not found
|
||||||
const status = params.get('status') || 0; // Default to 0 if not found
|
// const status = params.get('status') || 0; // Default to 0 if not found
|
||||||
|
|
||||||
hideDateField(date_type)
|
// hideDateField(date_type)
|
||||||
|
|
||||||
// console.log('startDate', startDate)
|
// // console.log('startDate', startDate)
|
||||||
// console.log('endDate', endDate)
|
// // console.log('endDate', endDate)
|
||||||
// console.log('client_id', client_id)
|
// // console.log('client_id', client_id)
|
||||||
// console.log('insurer_id', insurer_id)
|
// // console.log('insurer_id', insurer_id)
|
||||||
// console.log('policy_type_id', policy_type_id)
|
// // console.log('policy_type_id', policy_type_id)
|
||||||
// console.log('date_type', date_type)
|
// // console.log('date_type', date_type)
|
||||||
// console.log('issuer', issuer)
|
// // console.log('issuer', issuer)
|
||||||
// console.log('status', status)
|
// // console.log('status', status)
|
||||||
|
|
||||||
// Log the values or use them as needed
|
// // Log the values or use them as needed
|
||||||
// console.log('Start Date:', startDate);
|
// // console.log('Start Date:', startDate);
|
||||||
// console.log('End Date:', endDate);
|
// // console.log('End Date:', endDate);
|
||||||
|
|
||||||
if (startDate != 0 && endDate != 0) {
|
// if (startDate != 0 && endDate != 0) {
|
||||||
setTimeout(function(){
|
// setTimeout(function(){
|
||||||
$('#start_date').val(startDate)
|
// $('#start_date').val(startDate)
|
||||||
$('#end_date').val(endDate)
|
// $('#end_date').val(endDate)
|
||||||
$('#client_id_for_search').val(client_id).change()
|
// $('#client_id_for_search').val(client_id).change()
|
||||||
$('#insurer_id_for_search').val(insurer_id).change()
|
// $('#insurer_id_for_search').val(insurer_id).change()
|
||||||
$('#policy_type_for_search').val(policy_type_id).change()
|
// $('#policy_type_for_search').val(policy_type_id).change()
|
||||||
$('#date_type').val(date_type)
|
// $('#date_type').val(date_type)
|
||||||
$('#issuer_for_search').val(issuer)
|
// $('#issuer_for_search').val(issuer)
|
||||||
$('#policy_status_for_search').val(status)
|
// $('#policy_status_for_search').val(status)
|
||||||
},1000)
|
// },1000)
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
|
|||||||
@ -177,6 +177,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
// Preserve click handlers
|
// Preserve click handlers
|
||||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||||
item.addEventListener('click', function(e) {
|
item.addEventListener('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
const onclickAttr = this.getAttribute('onclick');
|
const onclickAttr = this.getAttribute('onclick');
|
||||||
if (onclickAttr) {
|
if (onclickAttr) {
|
||||||
eval(onclickAttr);
|
eval(onclickAttr);
|
||||||
|
|||||||
@ -420,17 +420,21 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
|
|
||||||
// Create custom dropdown
|
// Create custom dropdown
|
||||||
function createCustomDropdown(row) {
|
function createCustomDropdown(row) {
|
||||||
// Get the original dropdown items
|
|
||||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||||
if (!originalDropdown) return null;
|
if (!originalDropdown) return null;
|
||||||
|
|
||||||
// Create new dropdown with proper background and spacing
|
|
||||||
const customDropdown = document.createElement('div');
|
const customDropdown = document.createElement('div');
|
||||||
customDropdown.className = 'custom-dropdown-menu';
|
customDropdown.className = 'custom-dropdown-menu';
|
||||||
|
|
||||||
// Copy inner content while maintaining icon alignment
|
|
||||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||||
|
|
||||||
|
// Remove inline onclick handlers and store them in data attributes
|
||||||
|
const originalItems = originalDropdown.querySelectorAll('.dropdown-item');
|
||||||
|
customDropdown.querySelectorAll('.dropdown-item').forEach((item, index) => {
|
||||||
|
const originalOnclick = originalItems[index].getAttribute('onclick');
|
||||||
|
item.removeAttribute('onclick'); // Remove the inline handler
|
||||||
|
item.setAttribute('data-onclick', originalOnclick); // Store in data attribute
|
||||||
|
});
|
||||||
|
|
||||||
return customDropdown;
|
return customDropdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,45 +448,34 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
document.body.appendChild(customDropdown);
|
document.body.appendChild(customDropdown);
|
||||||
|
|
||||||
row.addEventListener("click", function(event) {
|
row.addEventListener("click", function(event) {
|
||||||
// Ignore clicks on the first column (td:first-child)
|
// Ignore clicks on the first column
|
||||||
if (event.target.closest('td:first-child')) {
|
if (event.target.closest('td:first-child')) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hide any active dropdown
|
if (activeDropdown) activeDropdown.style.display = 'none';
|
||||||
if (activeDropdown) {
|
|
||||||
activeDropdown.style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get click position
|
|
||||||
const rect = event.target.getBoundingClientRect();
|
const rect = event.target.getBoundingClientRect();
|
||||||
|
|
||||||
// Position the dropdown with some offset
|
|
||||||
customDropdown.style.display = 'block';
|
customDropdown.style.display = 'block';
|
||||||
customDropdown.style.position = 'fixed';
|
customDropdown.style.position = 'fixed';
|
||||||
customDropdown.style.left = `${rect.left}px`;
|
customDropdown.style.left = `${rect.left}px`;
|
||||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||||
|
|
||||||
// Set as active dropdown
|
|
||||||
activeDropdown = customDropdown;
|
activeDropdown = customDropdown;
|
||||||
|
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Preserve click handlers and add auto-close
|
// Handle custom dropdown clicks
|
||||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||||
item.addEventListener('click', function(e) {
|
item.addEventListener('click', function(e) {
|
||||||
const onclickAttr = this.getAttribute('onclick');
|
e.preventDefault();
|
||||||
if (onclickAttr) {
|
|
||||||
eval(onclickAttr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Execute the original onclick from data attribute
|
||||||
|
const onclickAttr = this.getAttribute('data-onclick');
|
||||||
|
if (onclickAttr) eval(onclickAttr);
|
||||||
|
|
||||||
|
// Handle href navigation
|
||||||
const href = this.getAttribute('href');
|
const href = this.getAttribute('href');
|
||||||
if (href && href !== '#') {
|
if (href && href !== '#') window.location.href = href;
|
||||||
window.location.href = href;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Close the dropdown after handling the click
|
|
||||||
if (activeDropdown) {
|
if (activeDropdown) {
|
||||||
activeDropdown.style.display = 'none';
|
activeDropdown.style.display = 'none';
|
||||||
activeDropdown = null;
|
activeDropdown = null;
|
||||||
@ -493,7 +486,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Close dropdown when clicking outside
|
// Close dropdown on outside click
|
||||||
document.addEventListener("click", function() {
|
document.addEventListener("click", function() {
|
||||||
if (activeDropdown) {
|
if (activeDropdown) {
|
||||||
activeDropdown.style.display = 'none';
|
activeDropdown.style.display = 'none';
|
||||||
|
|||||||
@ -1,3 +1,15 @@
|
|||||||
|
<style>
|
||||||
|
.select2-selection__choice {
|
||||||
|
background-color: #0a8794 !important;
|
||||||
|
color: white !important;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-selection__choice__remove {
|
||||||
|
color: white !important;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@ -8,22 +20,35 @@
|
|||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<!-- <label for="ticket_auto_query_note">Add Notes</label> -->
|
<!-- <label for="ticket_auto_query_note">Add Notes</label> -->
|
||||||
<div class="form-row" id="rac_rate_dropdown">
|
<div class="form-row" id="rac_rate_dropdown">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-9">
|
||||||
<select id="ticket_mail_auto_query_customButton" class="form-control"
|
<label>Documents</label> <br />
|
||||||
style="border:none;right: 13px;width: auto;position: absolute;z-index: 1;top: -19px;height: 32px;float: right;">
|
<select class="form-control" name="documents[]" id="ticket_mail_auto_query_customButton" multiple>
|
||||||
<option value="">Documents</option>
|
|
||||||
<?php foreach ($ticket_check_list as $value): ?>
|
<?php foreach ($ticket_check_list as $value): ?>
|
||||||
<option value="<?= $value['document']; ?>"><?= $value['document']; ?></option>
|
<option value="<?= $value['document']; ?>"
|
||||||
|
<?php //
|
||||||
|
// if (!isset($getData) || (isset($getData['documents']) && in_array($value['document'], $getData['documents']))) {
|
||||||
|
// echo 'selected';
|
||||||
|
// }
|
||||||
|
?>>
|
||||||
|
<?= $value['document']; ?>
|
||||||
|
</option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div style="padding-top:30px;padding-left:20px;" class="col-md-3">
|
||||||
|
<button type="button" class="btn btn-primary" id="insertSelectedDocumnets">Insert Documents</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<textarea class="form-control" id="ticket_auto_query_note" name="note" rows="3"
|
<textarea class="form-control" id="ticket_auto_query_note" name="note" rows="3"
|
||||||
placeholder="Enter Text"><?= isset($ticket_note['note']) ? $ticket_note['note'] : '' ?></textarea>
|
placeholder="Enter Text"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div><input type="hidden" id="query_note_id"><input type="hidden" <div
|
</div><input type="hidden" id="query_note_id">
|
||||||
class="form-group text-right m-b-0">
|
|
||||||
|
<div class="form-group text-right">
|
||||||
<button type="submit" class="btn btn-primary" id="ticket_auto_query_submit">Submit</button>
|
<button type="submit" class="btn btn-primary" id="ticket_auto_query_submit">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@ -33,7 +58,51 @@
|
|||||||
<!-- end -->
|
<!-- end -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
// $('#ticket_mail_auto_query_customButton').select2();
|
||||||
|
$('#ticket_mail_auto_query_customButton').select2({
|
||||||
|
placeholder: "Select Documents",
|
||||||
|
allowClear: true,
|
||||||
|
closeOnSelect: false, // This is the key option to keep the dropdown open
|
||||||
|
tags: true
|
||||||
|
});
|
||||||
|
|
||||||
|
$("textarea.select2-search__field").attr('rows', '1');
|
||||||
|
$("textarea.select2-search__field").css('resize', 'none');
|
||||||
|
|
||||||
|
const auto_query_editor = Jodit.make("#ticket_auto_query_note", editorConfig);
|
||||||
|
let lastActiveField = null;
|
||||||
|
|
||||||
|
auto_query_editor.events.on("focus", function() {
|
||||||
|
lastActiveField = auto_query_editor;
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#insertSelectedDocumnets").on("click", function() {
|
||||||
|
// Get all selected documents
|
||||||
|
const selectedDocuments = $("#ticket_mail_auto_query_customButton").val();
|
||||||
|
|
||||||
|
if (!selectedDocuments || selectedDocuments.length === 0) {
|
||||||
|
toastr.warning('Please select documents first', 'Warning');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastActiveField === auto_query_editor) {
|
||||||
|
// Insert each document on a new line
|
||||||
|
selectedDocuments.forEach(document => {
|
||||||
|
auto_query_editor.selection.insertHTML(document + '<br>');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Clear the selection
|
||||||
|
$("#ticket_mail_auto_query_customButton").val(null).trigger('change');
|
||||||
|
} else {
|
||||||
|
toastr.warning('Please focus on the text area first', 'Warning');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
url = '<?= base_url('ticket/note/1') ?>';
|
url = '<?= base_url('ticket/note/1') ?>';
|
||||||
data = {
|
data = {
|
||||||
id: $('#ticket_master_id').val(),
|
id: $('#ticket_master_id').val(),
|
||||||
@ -44,8 +113,13 @@ $(document).ready(function() {
|
|||||||
data: data,
|
data: data,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
console.log('auto query res', res)
|
||||||
if (res.status == true) {
|
if (res.status == true) {
|
||||||
|
|
||||||
$('#ticket_auto_query_note').val(res.data.note);
|
$('#ticket_auto_query_note').val(res.data.note);
|
||||||
|
if (auto_query_editor) {
|
||||||
|
auto_query_editor.value = res.data.note;
|
||||||
|
}
|
||||||
$('#query_note_id').val(res.data.id);
|
$('#query_note_id').val(res.data.id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -88,22 +162,24 @@ $(document).ready(function() {
|
|||||||
})
|
})
|
||||||
console.log(formData);
|
console.log(formData);
|
||||||
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
|
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
|
||||||
|
|
||||||
if (response.status == true) {
|
if (response.status == true) {
|
||||||
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
toastr.success('Note Added Successfully', 'Success');
|
toastr.success('Note Added Successfully', 'Success');
|
||||||
// console.log("Respone id is ")
|
// console.log("Respone id is ")
|
||||||
// console.log(response.id);
|
// console.log(response.id);
|
||||||
$('#query_note_id').val(response.id);
|
$('#query_note_id').val(response.id);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
let message = response.message;
|
let message = response.message;
|
||||||
toastr.error(message, 'ERROR');
|
toastr.error(message, 'ERROR');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.location.reload();
|
||||||
|
|
||||||
}, function(xhr, status, error) {
|
}, function(xhr, status, error) {
|
||||||
console.error('Error fetching data:', error);
|
console.error('Error fetching data:', error);
|
||||||
@ -116,48 +192,4 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let lastActiveField = null;
|
|
||||||
|
|
||||||
$("#ticket_auto_query_note").on("focus", function() {
|
|
||||||
lastActiveField = this;
|
|
||||||
});
|
|
||||||
|
|
||||||
document.addEventListener('change', function(event) {
|
|
||||||
|
|
||||||
var target = event.target;
|
|
||||||
|
|
||||||
if (target.matches('#ticket_mail_auto_query_customButton')) {
|
|
||||||
|
|
||||||
let placeholderValue = $(target).val();
|
|
||||||
if (!placeholderValue) return;
|
|
||||||
|
|
||||||
if (lastActiveField) {
|
|
||||||
if (lastActiveField.id === "ticket_auto_query_note") {
|
|
||||||
insertAtCursor(lastActiveField, placeholderValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$(target).val('');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function insertAtCursor(input, textToInsert) {
|
|
||||||
|
|
||||||
textToInsert += '\n';
|
|
||||||
|
|
||||||
if (document.selection) {
|
|
||||||
input.focus();
|
|
||||||
var sel = document.selection.createRange();
|
|
||||||
sel.text = textToInsert;
|
|
||||||
} else if (input.selectionStart || input.selectionStart === 0) {
|
|
||||||
let startPos = input.selectionStart;
|
|
||||||
let endPos = input.selectionEnd;
|
|
||||||
input.value = input.value.substring(0, startPos) + textToInsert + input.value.substring(endPos, input.value
|
|
||||||
.length);
|
|
||||||
input.selectionStart = input.selectionEnd = startPos + textToInsert.length;
|
|
||||||
} else {
|
|
||||||
input.value += textToInsert;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
@ -24,28 +24,28 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="#general-tab" data-toggle="tab" class="nav-link px-2 py-1 active" id="general_tab"
|
<a href="#general-tab" data-toggle="tab" class="nav-link px-2 py-1 active" id="general_tab"
|
||||||
aria-expanded="true">
|
aria-expanded="true">
|
||||||
<i class="mdi mdi-contacts mr-1"></i>
|
<i class="mdi mdi-ticket-account"></i>
|
||||||
<span class="d-none d-sm-inline-block">General</span>
|
<span class="d-none d-sm-inline-block">General</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="#reply-tab" data-toggle="tab" class="nav-link px-2 py-1" id="reply_tab"
|
<a href="#reply-tab" data-toggle="tab" class="nav-link px-2 py-1" id="reply_tab"
|
||||||
aria-expanded="false">
|
aria-expanded="false">
|
||||||
<i class="fa fa-file mr-1"></i>
|
<i class="mdi mdi-message-processing"></i>
|
||||||
<span class="d-none d-sm-inline-block">Reply</span>
|
<span class="d-none d-sm-inline-block">Reply</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="#note-tab" data-toggle="tab" class="nav-link px-2 py-1" id="note_tab"
|
<a href="#note-tab" data-toggle="tab" class="nav-link px-2 py-1" id="note_tab"
|
||||||
aria-expanded="false">
|
aria-expanded="false">
|
||||||
<i class="mdi mdi-account-switch mr-1"></i>
|
<i class="mdi mdi-note-text"></i>
|
||||||
<span class="d-none d-sm-inline-block">Note</span>
|
<span class="d-none d-sm-inline-block">Notes</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="#history-tab" data-toggle="tab" class="nav-link px-2 py-1" id="history_tab"
|
<a href="#history-tab" data-toggle="tab" class="nav-link px-2 py-1" id="history_tab"
|
||||||
aria-expanded="false">
|
aria-expanded="false">
|
||||||
<i class="mdi mdi-source-branch mr-1"></i>
|
<i class="mdi mdi-history"></i>
|
||||||
<span class="d-none d-sm-inline-block">History</span>
|
<span class="d-none d-sm-inline-block">History</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@ -139,6 +139,13 @@ function submitClaimForm(event, form) {
|
|||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
var isValid = $('#ticket_form_data').parsley().validate();
|
||||||
|
|
||||||
|
if (!isValid) {
|
||||||
|
toastr.warning('Form validation failed. Please check the required fields.', 'WARNING');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const formAction = '<?= base_url("ticket/update"); ?>';
|
const formAction = '<?= base_url("ticket/update"); ?>';
|
||||||
|
|
||||||
// Show loader
|
// Show loader
|
||||||
@ -228,9 +235,44 @@ function showConfirmationModal(event) {
|
|||||||
console.log($('#ticket_form_data')[0])
|
console.log($('#ticket_form_data')[0])
|
||||||
submitClaimForm(event, $('#ticket_form_data')[0]); // Fixed selector
|
submitClaimForm(event, $('#ticket_form_data')[0]); // Fixed selector
|
||||||
} else if (result.isDenied) {
|
} else if (result.isDenied) {
|
||||||
|
// Show second Swal for rejection reason
|
||||||
|
Swal.fire({
|
||||||
|
title: "Rejection Reason",
|
||||||
|
text: "Please provide a reason for rejection",
|
||||||
|
input: "textarea",
|
||||||
|
inputPlaceholder: "Enter your reason here...",
|
||||||
|
icon: "info",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
cancelButtonColor: "#6c757d",
|
||||||
|
confirmButtonText: "Submit",
|
||||||
|
cancelButtonText: "Back"
|
||||||
|
}).then((reasonResult) => {
|
||||||
|
if (reasonResult.isConfirmed) {
|
||||||
|
// Check if reason is not empty
|
||||||
|
if (reasonResult.value && reasonResult.value.trim() !== "") {
|
||||||
$('#is_head_approved').val(2);
|
$('#is_head_approved').val(2);
|
||||||
console.log($('#ticket_form_data')[0])
|
$('#rejection_reason').val(reasonResult.value.trim());
|
||||||
submitClaimForm(event, $('#ticket_form_data')[0]); // Fixed selector
|
console.log($('#ticket_form_data')[0]);
|
||||||
|
$('#head_rejection_reason').val(reasonResult.value.trim());
|
||||||
|
submitClaimForm(event, $('#ticket_form_data')[0]);
|
||||||
|
} else {
|
||||||
|
// Alert if reason is empty
|
||||||
|
Swal.fire({
|
||||||
|
title: "Error",
|
||||||
|
text: "Rejection reason cannot be empty",
|
||||||
|
icon: "error",
|
||||||
|
confirmButtonColor: "#3085d6"
|
||||||
|
}).then(() => {
|
||||||
|
// Go back to the rejection reason dialog
|
||||||
|
showConfirmationModal(event);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// If canceled, go back to first Swal
|
||||||
|
showConfirmationModal(event);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
$('#is_head_approved').val(0);
|
$('#is_head_approved').val(0);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -25,29 +25,95 @@
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
<form role="form" class="parsley-examples" method="post" id="ticket_form_data" onsubmit="submitClaimForm(event, this)"
|
<form role="form" class="parsley-examples" method="post" id="ticket_form_data" onsubmit="submitClaimForm(event, this)"
|
||||||
enctype="multipart/form-data">
|
enctype="multipart/form-data">
|
||||||
<div class="form-group">
|
|
||||||
<div class="form-row">
|
|
||||||
|
|
||||||
<input type="hidden" id="ticket_master_id" name="ticket_master_id" value="<?= isset($ticket_data['id']) ? $ticket_data['id'] : '' ?>">
|
<input type="hidden" id="ticket_master_id" name="ticket_master_id" value="<?= isset($ticket_data['id']) ? $ticket_data['id'] : '' ?>">
|
||||||
|
<input type="hidden" id="is_head_approved" name="is_head_approved" value="<?= isset($ticket_data['is_head_approved']) ? $ticket_data['is_head_approved'] : '' ?>">
|
||||||
|
<input type="hidden" id="extra_fields_array_for_validate" name="extra_fields_array_for_validate" value='<?= isset($extra_fields_array_for_validate) && !empty($extra_fields_array_for_validate) ? json_encode($extra_fields_array_for_validate) : "[]" ?>'>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
|
||||||
|
<h5>Employee Details</h5>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<!-- first_data_points -->
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="claim_status">Status<span class="text-danger"></span></label>
|
<label for="emp_code">Employee ID <span class="text-danger">*</span> <i class="fa fa-search text-danger"
|
||||||
<select class="form-control" id="claim_status_id" name="claim_status_id">
|
aria-hidden="true" onclick="openFetchEmpDataodal(this)"></i> <span class="text-danger"></span></label>
|
||||||
<!-- <option value="0">Select status</option> -->
|
<input type="text" class="form-control" id="emp_code" placeholder="Enter Employee ID"
|
||||||
<?php
|
value="<?= isset($ticket_data['emp_code']) ? $ticket_data['emp_code'] : '' ?>"
|
||||||
if (isset($claim_status) && count($claim_status)) {
|
name="emp_code" required>
|
||||||
foreach ($claim_status as $key => $value) {
|
|
||||||
$selected = (isset($ticket_data) && $ticket_data['claim_status_id'] == $value['id']) ? 'selected' : '';
|
|
||||||
echo "<option value=" . $value['id'] . " $selected>" . $value['claim_status'] . "</option>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="acm_id">Account Manager<span class="text-danger"></span></label>
|
<label for="emp_name">Employee Name <span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="acm_id" name="acm_id">
|
<input type=hidden id="emp_id" name="emp_id" value="<?= isset($ticket_data['emp_id']) ? $ticket_data['emp_id'] : '' ?>">
|
||||||
|
<input type="text" class="form-control" id="emp_name" placeholder="Enter Employee Name"
|
||||||
|
value="<?= isset($ticket_data['emp_name']) ? $ticket_data['emp_name'] : '' ?>"
|
||||||
|
name="emp_name" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="emp_mobile">Employee Mobile No <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="emp_mobile" placeholder="Enter EMP Mobile"
|
||||||
|
value="<?= isset($ticket_data['emp_mobile']) ? $ticket_data['emp_mobile'] : '' ?>"
|
||||||
|
name="emp_mobile" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="emp_mail">Employee Mail ID <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="emp_mail" placeholder="Enter EMP Mail"
|
||||||
|
value="<?= isset($ticket_data['emp_mail']) ? $ticket_data['emp_mail'] : '' ?>"
|
||||||
|
name="emp_mail" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="emp_personal_mail">Employee Personal Mail ID</label>
|
||||||
|
<input type="text" class="form-control" id="emp_personal_mail" placeholder="Enter EMP Personal Mail"
|
||||||
|
value="<?= isset($ticket_data['emp_personal_mail']) ? $ticket_data['emp_personal_mail'] : '' ?>"
|
||||||
|
name="emp_personal_mail">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="policy_no">Policy No <span class="text-danger"></span></label>
|
||||||
|
<input type="text" class="form-control" id="policy_no"
|
||||||
|
value="<?= isset($ticket_data['policy_no']) ? $ticket_data['policy_no'] : '' ?>"
|
||||||
|
name="policy_no">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="client_name">Corporate Name <span class="text-danger">*</span></label>
|
||||||
|
<input type="hidden" id="client_id" name="client_id" value="<?= isset($ticket_data['client_id']) ? $ticket_data['client_id'] : '' ?>">
|
||||||
|
<input type="text" class="form-control" id="client_name" placeholder="Client" value="<?= isset($ticket_data['client_name']) ? $ticket_data['client_name'] : '' ?>" readonly required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="insurer_id">Insurer <span class="text-danger">*</span></label>
|
||||||
|
<input type=hidden id="insurer_id" name="insurer_id" value="<?= isset($ticket_data['insurer_id']) ? $ticket_data['insurer_id'] : '' ?>">
|
||||||
|
<input type=text class="form-control" id="insurer_name" placeholder="Insurer" value="<?= isset($ticket_data['insurer_name']) ? $ticket_data['insurer_name'] : '' ?>" readonly required>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" id="empIDHidden" onchange="getClientPolicy()">
|
||||||
|
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Policy <span class="text-danger">*</span></label>
|
||||||
|
<select id="emp_client_policy" name="client_policy_id"
|
||||||
|
class="form-control custom-select" required onchange="setDateValidation(this.value,true)"
|
||||||
|
<?= isset($ticket_data['client_policy_id'])?" class = 'readonly-select'":'' ?>
|
||||||
|
>
|
||||||
|
<?php if (!empty($ticket_data['client_policy_id'])) { ?>
|
||||||
|
<option value="<?= $ticket_data['client_policy_id'] ?>"><?= $ticket_data['client_policy_id_text'] ?></option>
|
||||||
|
<?php } else { ?>
|
||||||
|
<option value="">Select Policy</option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="acm_id">Account Manager <span class="text-danger">*</span></label>
|
||||||
|
<select class="form-control" id="acm_id" name="acm_id" required>
|
||||||
<!-- <option value="0">Select Account Manager</option> -->
|
<!-- <option value="0">Select Account Manager</option> -->
|
||||||
<?php
|
<?php
|
||||||
if (isset($acms) && count($acms)) {
|
if (isset($acms) && count($acms)) {
|
||||||
@ -60,24 +126,15 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label for="client_name">Corporate Name<span class="text-danger"></span></label>
|
|
||||||
<input type="hidden" id="client_id" name="client_id" value="<?= isset($ticket_data['client_id']) ? $ticket_data['client_id'] : '' ?>">
|
|
||||||
<input type="text" class="form-control" id="client_name" placeholder="Client" value="<?= isset($ticket_data['client_name']) ? $ticket_data['client_name'] : '' ?>" readonly>
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- end first_data_points -->
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<br><br>
|
||||||
<label for="insurer_id">Insurer<span class="text-danger"></span></label>
|
<h5>Claim Details</h5>
|
||||||
<input type=hidden id="insurer_id" name="insurer_id" value="<?= isset($ticket_data['insurer_id']) ? $ticket_data['insurer_id'] : '' ?>">
|
<hr>
|
||||||
<input type=text class="form-control" id="insurer_name" placeholder="Insurer" value="<?= isset($ticket_data['insurer_name']) ? $ticket_data['insurer_name'] : '' ?>" readonly>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<!-- second_data_points -->
|
||||||
<label for="policy_no">Policy No<span class="text-danger"></span></label>
|
<div class="form-row">
|
||||||
<input type="text" class="form-control" id="policy_no"
|
|
||||||
value="<?= isset($ticket_data['policy_no']) ? $ticket_data['policy_no'] : '' ?>"
|
|
||||||
name="policy_no">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="ticket_type_id"> Policy Type <span class="text-danger"></span></label>
|
<label for="ticket_type_id"> Policy Type <span class="text-danger"></span></label>
|
||||||
@ -96,8 +153,23 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="claim_type"> Claim Type <span class="text-danger"></span></label>
|
<label for="claim_status">Status <span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="claim_type" name="claim_type">
|
<select class="form-control" id="claim_status_id" name="claim_status_id" required>
|
||||||
|
<!-- <option value="0">Select status</option> -->
|
||||||
|
<?php
|
||||||
|
if (isset($claim_status) && count($claim_status)) {
|
||||||
|
foreach ($claim_status as $key => $value) {
|
||||||
|
$selected = (isset($ticket_data) && $ticket_data['claim_status_id'] == $value['id']) ? 'selected' : '';
|
||||||
|
echo "<option value=" . $value['id'] . " $selected>" . $value['claim_status'] . "</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="claim_type"> Claim Type <span class="text-danger">*</span></label>
|
||||||
|
<select class="form-control" id="claim_type" name="claim_type" required>
|
||||||
<!-- <option value="0">Select claim Type</option> -->
|
<!-- <option value="0">Select claim Type</option> -->
|
||||||
<?php
|
<?php
|
||||||
if (isset($claim_type) && count($claim_type)) {
|
if (isset($claim_type) && count($claim_type)) {
|
||||||
@ -110,38 +182,6 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label for="emp_code">Employee ID <i class="fa fa-search text-danger"
|
|
||||||
aria-hidden="true" onclick="openFetchEmpDataodal(this)"></i> <span class="text-danger"></span></label>
|
|
||||||
<input type="text" class="form-control" id="emp_code" placeholder="Enter Employee ID"
|
|
||||||
value="<?= isset($ticket_data['emp_code']) ? $ticket_data['emp_code'] : '' ?>"
|
|
||||||
name="emp_code">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label for="emp_name">Employee Name<span class="text-danger"></span></label>
|
|
||||||
<input type=hidden id="emp_id" name="emp_id" value="<?= isset($ticket_data['emp_id']) ? $ticket_data['emp_id'] : '' ?>">
|
|
||||||
<input type="text" class="form-control" id="emp_name" placeholder="Enter Employee Name"
|
|
||||||
value="<?= isset($ticket_data['emp_name']) ? $ticket_data['emp_name'] : '' ?>"
|
|
||||||
name="emp_name">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label for="emp_mobile">Employee Mobile No<span class="text-danger"></span></label>
|
|
||||||
<input type="text" class="form-control" id="emp_mobile" placeholder="Enter EMP Mobile"
|
|
||||||
value="<?= isset($ticket_data['emp_mobile']) ? $ticket_data['emp_mobile'] : '' ?>"
|
|
||||||
name="emp_mobile">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label for="emp_mail">Employee Mail ID<span class="text-danger"></span></label>
|
|
||||||
<input type="text" class="form-control" id="emp_mail" placeholder="Enter EMP Mail"
|
|
||||||
value="<?= isset($ticket_data['emp_mail']) ? $ticket_data['emp_mail'] : '' ?>"
|
|
||||||
name="emp_mail">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="date_of_join">Date of joining<span class="text-danger"></span></label>
|
<label for="date_of_join">Date of joining<span class="text-danger"></span></label>
|
||||||
<input type="text" class="form-control" id="date_of_join"
|
<input type="text" class="form-control" id="date_of_join"
|
||||||
@ -159,9 +199,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="dob">Date of Birth<span class="text-danger"></span></label>
|
<label for="dob">Date of Birth <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="dob" placeholder="Enter Birth Date"
|
<input type="text" class="form-control" id="dob" placeholder="Enter Birth Date"
|
||||||
value="<?= isset($ticket_data['dob']) ? $ticket_data['dob'] : '' ?>" name="dob">
|
value="<?= isset($ticket_data['dob']) ? $ticket_data['dob'] : '' ?>" name="dob" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
@ -181,18 +221,33 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="date_of_intimat">Date of Intimation<span class="text-danger"></span></label>
|
<label for="date_of_intimat">Date of Intimation <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="date_of_intimat"
|
<input type="text" class="form-control" id="date_of_intimat"
|
||||||
placeholder="Enter Intimation Date"
|
placeholder="Enter Intimation Date"
|
||||||
value="<?= isset($ticket_data['date_of_intimat']) ? $ticket_data['date_of_intimat'] : '' ?>"
|
value="<?= isset($ticket_data['date_of_intimat']) ? $ticket_data['date_of_intimat'] : '' ?>"
|
||||||
name="date_of_intimat">
|
name="date_of_intimat" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="si_amt">Sum insured<span class="text-danger"></span></label>
|
<label for="si_amt">Sum insured <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="si_amt" placeholder="Enter SI"
|
<input type="text" class="form-control" id="si_amt" placeholder="Enter SI"
|
||||||
value="<?= isset($ticket_data['si_amt']) ? $ticket_data['si_amt'] : '' ?>"
|
value="<?= isset($ticket_data['si_amt']) ? $ticket_data['si_amt'] : '' ?>"
|
||||||
name="si_amt">
|
name="si_amt" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- end second_data_points -->
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
<h5>Additional Details</h5>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<!-- third_data_points -->
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col-md-3 approved" style="display: none;">
|
||||||
|
<label for="approved_amount">Approved Amount</label>
|
||||||
|
<input type="text" class="form-control" id="approved_amount" placeholder="Enter Approved Amount"
|
||||||
|
value="<?= isset($ticket_data['approved_amount']) ? $ticket_data['approved_amount'] : '' ?>" name="approved_amount">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3 approved" style="display: none;">
|
<div class="form-group col-md-3 approved" style="display: none;">
|
||||||
@ -201,7 +256,7 @@
|
|||||||
value="<?= isset($ticket_data['approved_date']) ? $ticket_data['approved_date'] : '' ?>" name="approved_date">
|
value="<?= isset($ticket_data['approved_date']) ? $ticket_data['approved_date'] : '' ?>" name="approved_date">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3 approved" style="display: none;">
|
<div class="form-group col-md-6 approved" style="display: none;">
|
||||||
<label for="approved_letter">Approved Letter</label>
|
<label for="approved_letter">Approved Letter</label>
|
||||||
<input type="text" class="form-control" id="approved_letter" placeholder="Enter Approved Letter"
|
<input type="text" class="form-control" id="approved_letter" placeholder="Enter Approved Letter"
|
||||||
value="<?= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter">
|
value="<?= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter">
|
||||||
@ -219,17 +274,39 @@
|
|||||||
value="<?= isset($ticket_data['settled_date']) ? $ticket_data['settled_date'] : '' ?>" name="settled_date">
|
value="<?= isset($ticket_data['settled_date']) ? $ticket_data['settled_date'] : '' ?>" name="settled_date">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3 settled" style="display: none;">
|
<div class="form-group col-md-6 settled" style="display: none;">
|
||||||
<label for="settle_letter">Settle Letter</label>
|
<label for="settle_letter">Settle Letter</label>
|
||||||
<input type="text" class="form-control" id="settle_letter" placeholder="Enter Settle Letter"
|
<input type="text" class="form-control" id="settle_letter" placeholder="Enter Settle Letter"
|
||||||
value="<?= isset($ticket_data['settle_letter']) ? $ticket_data['settle_letter'] : '' ?>" name="settle_letter">
|
value="<?= isset($ticket_data['settle_letter']) ? $ticket_data['settle_letter'] : '' ?>" name="settle_letter">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3 canceled" style="display: none;">
|
||||||
|
<label for="cancel_remark">Cancel Remark</label>
|
||||||
|
<textarea class="form-control" id="cancel_remark" rows="1" placeholder="Enter Cancel Remark" name="cancel_remark"><?= isset($ticket_data['cancel_remark']) ? $ticket_data['cancel_remark'] : '' ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3 returned" style="display: none;">
|
||||||
|
<label for="return_remark">Return Remark</label>
|
||||||
|
<textarea class="form-control" id="return_remark" rows="1" placeholder="Enter Return Remark" name="return_remark"><?= isset($ticket_data['return_remark']) ? $ticket_data['return_remark'] : '' ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-6 returned" style="display: none;">
|
||||||
|
<label for="awb_no_courier_name">AWB No with Courier Name</label>
|
||||||
|
<input type="text" class="form-control" id="awb_no_courier_name" placeholder="eg : 0001/ST Courier"
|
||||||
|
value="<?= isset($ticket_data['awb_no_courier_name']) ? $ticket_data['awb_no_courier_name'] : '' ?>" name="awb_no_courier_name">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- end third_data_points -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;">
|
<div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;">
|
||||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||||
id="btnSubmit">Submit</button>
|
id="btnSubmit">Submit</button>
|
||||||
|
<?php if (get_role_id() == 5 && isset($ticket_data) && in_array($ticket_data['claim_status_id'], [23, 33, 43])) { ?>
|
||||||
|
<a class="btn btn-secondary waves-effect waves-light mr-1" onclick="showConfirmationModal(event)">Rejected Approve</a>
|
||||||
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@ -238,15 +315,24 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
let GlobelExtraFields = [];
|
||||||
|
|
||||||
|
var date_of_join;
|
||||||
|
var dob;
|
||||||
|
var date_of_accident;
|
||||||
|
var date_of_death;
|
||||||
|
var date_of_intimat;
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
var date_of_join = flatpickr("#date_of_join", {
|
$("#emp_client_policy").select2();
|
||||||
|
date_of_join = flatpickr("#date_of_join", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
|
|
||||||
var dob = flatpickr("#dob", {
|
dob = flatpickr("#dob", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
@ -256,25 +342,41 @@ $(document).ready(function() {
|
|||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
|
|
||||||
var date_of_accident = flatpickr("#date_of_accident", {
|
date_of_accident = flatpickr("#date_of_accident", {
|
||||||
|
dateFormat: "d/m/Y",
|
||||||
|
allowInput: false,
|
||||||
|
onChange: function(selectedDates) {
|
||||||
|
let selectedDOA = selectedDates[0]; // Get selected DOA date
|
||||||
|
date_of_death.set("minDate", selectedDOA); // Set DOD minDate to DOA
|
||||||
|
date_of_intimat.set("minDate",selectedDOA);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
date_of_death = flatpickr("#date_of_death", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
|
|
||||||
var date_of_death = flatpickr("#date_of_death", {
|
date_of_intimat = flatpickr("#date_of_intimat", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
|
|
||||||
var date_of_intimat = flatpickr("#date_of_intimat", {
|
flatpickr("#approved_date", {
|
||||||
|
dateFormat: "d/m/Y",
|
||||||
|
allowInput: false
|
||||||
|
});
|
||||||
|
flatpickr("#settled_date", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
|
|
||||||
flatpickr("#approved_date", { dateFormat: "d/m/Y", allowInput: false });
|
// updateClaimStatusDisplay("<?= isset($ticket_data['claim_status_id']) ? $ticket_data['claim_status_id'] : 0 ?>")
|
||||||
flatpickr("#settled_date", { dateFormat: "d/m/Y", allowInput: false });
|
var extraFields = <?= json_encode(isset($extra_fields) ? $extra_fields : []); ?>;
|
||||||
|
GlobelExtraFields = extraFields;
|
||||||
|
console.log("extraFields", extraFields);
|
||||||
|
claimStatusFieldChanges(extraFields);
|
||||||
|
|
||||||
updateClaimStatusDisplay("<?= isset($ticket_data['claim_status_id']) ? $ticket_data['claim_status_id'] : 0 ?>")
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -283,13 +385,17 @@ function updateClaimStatusDisplay(value) {
|
|||||||
console.log('value', value);
|
console.log('value', value);
|
||||||
|
|
||||||
// Hide all sections first
|
// Hide all sections first
|
||||||
$('.settled, .approved').hide();
|
$('.settled, .approved, .canceled, .returned').hide();
|
||||||
|
|
||||||
// Show relevant section based on value
|
// Show relevant section based on value
|
||||||
if (value == 20) { // APPROVED
|
if (value == 20 || value == 30 || value == 40) { // APPROVED
|
||||||
$('.approved').show();
|
$('.approved').show();
|
||||||
} else if (value == 24) { // SETTLED
|
} else if (value == 24 || value == 34 || value == 44) { // SETTLED
|
||||||
$('.settled').show();
|
$('.settled').show();
|
||||||
|
} else if (value == 47 || value == 53 || value == 58) { // CANCELLED
|
||||||
|
$('.canceled').show();
|
||||||
|
} else if (value == 48 || value == 54 || value == 59) { // RETURNED
|
||||||
|
$('.returned').show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,4 +403,374 @@ $('#claim_status_id').on('change', function() {
|
|||||||
updateClaimStatusDisplay($(this).val());
|
updateClaimStatusDisplay($(this).val());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function claimStatusFieldChanges(fields) {
|
||||||
|
console.log('fields', fields);
|
||||||
|
fields.forEach(function(fieldId) {
|
||||||
|
var $field = $("#" + fieldId);
|
||||||
|
|
||||||
|
if ($field.length) {
|
||||||
|
// $field.prop('required', true);
|
||||||
|
|
||||||
|
var $parentDiv = $field.closest("div");
|
||||||
|
$parentDiv.show();
|
||||||
|
|
||||||
|
var $label = $parentDiv.find("label[for='" + fieldId + "']");
|
||||||
|
if ($label.length && !$label.find(".text-danger").length) {
|
||||||
|
// $label.append(' <span class="text-danger">*</span>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function claimStatusFieldRemoveREquired(fields, remove_or_add, thirdClass) {
|
||||||
|
|
||||||
|
console.log('--------------------------- claimStatusFieldRemoveREquired ---------------------------');
|
||||||
|
console.log('fields', fields);
|
||||||
|
console.log('remove_or_add', remove_or_add);
|
||||||
|
|
||||||
|
fields.forEach(function(fieldId) {
|
||||||
|
var $field = $("#" + fieldId);
|
||||||
|
|
||||||
|
if ($field.length) {
|
||||||
|
$field.prop('required', remove_or_add);
|
||||||
|
var $parentDiv = $field.closest("div");
|
||||||
|
console.log('parentDiv', $parentDiv);
|
||||||
|
var $label = $parentDiv.find("label[for='" + fieldId + "']");
|
||||||
|
// if(remove_or_add == false){
|
||||||
|
// $parentDiv.find("label[for='" + fieldId + "'] .text-danger").remove();
|
||||||
|
// console.log('one', remove_or_add);
|
||||||
|
// }else{
|
||||||
|
// if ($label.length && !$label.find(".text-danger").length) {
|
||||||
|
// $label.append(' <span class="text-danger">*</span>');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// $('.'+thirdClass).find('input, textarea').attr('required', true);
|
||||||
|
let extrafieldsArray = $('#extra_fields_array_for_validate').val();
|
||||||
|
try {
|
||||||
|
extrafieldsArray = JSON.parse(extrafieldsArray); // Convert string to object
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Invalid JSON format in extra_fields_array_for_validate:", error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var selectedClaimStatus = $('#claim_status_id').val();
|
||||||
|
var $thirdClass = $(`.${thirdClass}`);
|
||||||
|
var hasValue = $thirdClass.find('input, textarea, select').filter(function() {
|
||||||
|
return $(this).val().trim() !== ''; // Check if at least one field is not empty
|
||||||
|
}).length > 0;
|
||||||
|
console.log("has value ", hasValue);
|
||||||
|
$thirdClass.each(function() {
|
||||||
|
var id = $(this).find('[id]').first().attr('id');
|
||||||
|
var $label = $(this).find('label');
|
||||||
|
var $thisDiv = $(this);
|
||||||
|
var $inputs = $thisDiv.find('input, textarea, select');
|
||||||
|
|
||||||
|
|
||||||
|
// ✅ Condition 1: Check if this ID is in extraFieldsArray (required by status)
|
||||||
|
var shouldAddRequired = extrafieldsArray[selectedClaimStatus] && extrafieldsArray[selectedClaimStatus].includes(id);
|
||||||
|
console.log("shouldAddRequired ", shouldAddRequired);
|
||||||
|
|
||||||
|
// ✅ Condition 2: If any field in the class has a value, make all required
|
||||||
|
if (shouldAddRequired || hasValue) {
|
||||||
|
if ($label.length && !$label.find('.text-danger').length) {
|
||||||
|
$label.append(' <span class="text-danger">*</span>');
|
||||||
|
}
|
||||||
|
// console.log("input from if ", $inputs);
|
||||||
|
// $inputs.attr('required', true);
|
||||||
|
$('.' + thirdClass).find('input, textarea,select').attr('required', true);
|
||||||
|
console.log(`class ${thirdClass} added required label and added required field`);
|
||||||
|
} else {
|
||||||
|
$label.find('.text-danger').remove();
|
||||||
|
console.log("input ", $inputs);
|
||||||
|
// $inputs.prop('required', false);
|
||||||
|
$('.' + thirdClass).find('input, textarea,select').attr('required', false);
|
||||||
|
console.log(`class ${thirdClass} removed required label and removed required field`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).on("input", function(event) {
|
||||||
|
|
||||||
|
let fields = GlobelExtraFields;
|
||||||
|
console.log('fields', fields);
|
||||||
|
let targetId = event.target.id;
|
||||||
|
console.log('targetId', targetId);
|
||||||
|
console.log('fields.includes(targetId)', fields.includes(targetId));
|
||||||
|
|
||||||
|
if (fields.includes(targetId)) {
|
||||||
|
|
||||||
|
let $field = $("#" + targetId);
|
||||||
|
console.log('$field id', $field);
|
||||||
|
let $parentDiv = $field.closest("div");
|
||||||
|
console.log('$parentDiv', $parentDiv);
|
||||||
|
// addRequiredFieldSymbol(targetId);
|
||||||
|
if ($parentDiv.length) {
|
||||||
|
let thirdClass = $parentDiv.attr("class").split(" ")[2] || "";
|
||||||
|
// addRequiredFieldSymbolByClass(thirdClass);
|
||||||
|
console.log('thirdClass', thirdClass);
|
||||||
|
|
||||||
|
if (thirdClass) {
|
||||||
|
claimStatusFieldRemoveREquired(fields, false, thirdClass);
|
||||||
|
let $label = $(thirdClass).find("label");
|
||||||
|
if ($label.length && !$label.find(".text-danger").length) {
|
||||||
|
$label.append(' <span class="text-danger">*</span>');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
claimStatusFieldRemoveREquired($field, false, '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// function addRequiredFieldSymbol(field_name) {
|
||||||
|
// // Find the field with the given name
|
||||||
|
// var $field = $(`[name="${field_name}"]`);
|
||||||
|
|
||||||
|
// if ($field.length) {
|
||||||
|
// // Find the parent div of this field
|
||||||
|
// var $parentDiv = $field.closest('div');
|
||||||
|
|
||||||
|
// if ($parentDiv.length) {
|
||||||
|
// // Get the classes as an array
|
||||||
|
// var classes = $parentDiv.attr('class') ? $parentDiv.attr('class').split(/\s+/) : [];
|
||||||
|
|
||||||
|
// if (classes.length > 0) {
|
||||||
|
// // Get the last class in the array
|
||||||
|
// var lastClass = classes[classes.length - 1];
|
||||||
|
|
||||||
|
// // Find all divs with this last class
|
||||||
|
// var $allDivsWithClass = $(`.${lastClass}`);
|
||||||
|
|
||||||
|
// // Add asterisk to all labels within these divs
|
||||||
|
// $allDivsWithClass.each(function() {
|
||||||
|
// var $label = $(this).find('label');
|
||||||
|
// if ($label.length && !$label.find('.text-danger').length) {
|
||||||
|
// $label.append(' <span class="text-danger">*</span>');
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
// console.log(`Added required symbol to ${$allDivsWithClass.length} labels with class "${lastClass}"`);
|
||||||
|
// } else {
|
||||||
|
// console.warn(`Parent div for field "${field_name}" has no classes`);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// console.warn(`No parent div found for field name="${field_name}"`);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// console.warn(`No field found with name="${field_name}"`);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// function addRequiredFieldSymbolByClass(className) {
|
||||||
|
// // Find all divs with the specified class
|
||||||
|
// var $divsWithClass = $(`.${className}`);
|
||||||
|
|
||||||
|
// if ($divsWithClass.length) {
|
||||||
|
// // Add asterisk to all labels within these divs
|
||||||
|
// $divsWithClass.each(function() {
|
||||||
|
// var $label = $(this).find('label');
|
||||||
|
// if ($label.length && !$label.find('.text-danger').length) {
|
||||||
|
// $label.append(' <span class="text-danger">*</span>');
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
// console.log(`Added required symbol to ${$divsWithClass.length} labels with class "${className}"`);
|
||||||
|
// } else {
|
||||||
|
// console.warn(`No divs found with class="${className}"`);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
$("#empIDHidden").change(function() {
|
||||||
|
console.log("change is detected in hidden branch id");
|
||||||
|
getClientPolicy();
|
||||||
|
})
|
||||||
|
|
||||||
|
var employeeId = "";
|
||||||
|
|
||||||
|
function getClientPolicy() {
|
||||||
|
console.log("get policy function called");
|
||||||
|
hiddenData = $("#empIDHidden").val();
|
||||||
|
hiddenData = JSON.parse(hiddenData);
|
||||||
|
console.log('employee id ', hiddenData['emp_id']);
|
||||||
|
employeeId = hiddenData['emp_id'];
|
||||||
|
data = {
|
||||||
|
emp_id: hiddenData['emp_id']
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: '<?= base_url("/ticket/getPoliciesbyEmpID") ?>',
|
||||||
|
type: "POST",
|
||||||
|
data: data,
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(res) {
|
||||||
|
|
||||||
|
console.log('getClientAndBranchAndPolicy', res);
|
||||||
|
if (res.status == true) {
|
||||||
|
console.log("data is received2");
|
||||||
|
policyList = res.policy_data;
|
||||||
|
// appendClients(res.client_data);
|
||||||
|
// appendClientsFoerMobileSearch(res.client_data);
|
||||||
|
appendPolicyDropdown(policyList);
|
||||||
|
console.log("after function");
|
||||||
|
} else {
|
||||||
|
console.log('No data found');
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendPolicyDropdown(data) {
|
||||||
|
|
||||||
|
// var ticket_type = $('#ticket_type').val();
|
||||||
|
hiddenData = $("#empIDHidden").val();
|
||||||
|
hiddenData = JSON.parse(hiddenData);
|
||||||
|
|
||||||
|
console.log("second function is called : ", data);
|
||||||
|
let ticket_type = $('#ticket_type_id').val();
|
||||||
|
$('#emp_client_policy').empty();
|
||||||
|
$('#emp_client_policy').append($('<option>', {
|
||||||
|
value: '',
|
||||||
|
text: 'Select Client Policy'
|
||||||
|
}));
|
||||||
|
|
||||||
|
var policyAppendCount = 0;
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
// console.log(item);
|
||||||
|
|
||||||
|
if (ticket_type != 1 && item.policy_type_id != 2) {
|
||||||
|
$('#emp_client_policy').append($('<option>', {
|
||||||
|
value: item.client_policy_value,
|
||||||
|
text: item.client_policy_name
|
||||||
|
}));
|
||||||
|
policyAppendCount++;
|
||||||
|
if (hiddenData['searchType'] != null && hiddenData['searchType'] != "" && hiddenData['policy_id'] != null && hiddenData['policy_id'] != "") {
|
||||||
|
// $('#emp_client_policy').select2();
|
||||||
|
$("#emp_client_policy").select2();
|
||||||
|
$('#emp_client_policy').val(hiddenData['policy_id']).addClass('readonly-select').select2('destroy').trigger("change");
|
||||||
|
} else {
|
||||||
|
// $('#emp_client_policy').append($('<option>', {
|
||||||
|
// value: item.client_policy_value,
|
||||||
|
// text: item.client_policy_name
|
||||||
|
// }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (policyAppendCount == 0) {
|
||||||
|
toastr.warning("No Policies found for the Employee", "Warning");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// $('#emp_client_policy').select2();
|
||||||
|
$("#emp_client_policy").on('change', function() {
|
||||||
|
console.log("change function called ");
|
||||||
|
policy_id = $("#emp_client_policy").val();
|
||||||
|
// setMinDateDOA(policy_id);
|
||||||
|
setDateValidation(policy_id, true);
|
||||||
|
})
|
||||||
|
|
||||||
|
function setDateValidation(policy_id, memberset = null) {
|
||||||
|
$.ajax({
|
||||||
|
url: '<?= base_url("ticket/getPolicyStartDate") ?>',
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
policy_id: policy_id,
|
||||||
|
employeeId: employeeId ?? null
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
console.log(response);
|
||||||
|
if (response.status) {
|
||||||
|
if (memberset) {
|
||||||
|
var dobValue = response.empData[0].dob;
|
||||||
|
var doj = response.empData[0].doj;
|
||||||
|
console.log('data received fro controller ', dob, doj);
|
||||||
|
if (dobValue) {
|
||||||
|
$("#dob").val(dobValue);
|
||||||
|
$("#dob").addClass('readonly-select');
|
||||||
|
}
|
||||||
|
if (doj) {
|
||||||
|
$("#date_of_join").val(doj);
|
||||||
|
$("#date_of_join").addClass('readonly-select');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if ($("#dob").hasClass('readonly-select')){
|
||||||
|
$("#dob").removeClass('readonly-select')
|
||||||
|
$("#dob").val("");
|
||||||
|
}
|
||||||
|
if ($("#date_of_join").hasClass('readonly-select')){
|
||||||
|
$("#date_of_join").removeClass('readonly-select')
|
||||||
|
$("#date_of_join").val("");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.minDate) {
|
||||||
|
// var formatMinDate = response.minDate;
|
||||||
|
var formatMinDate = new Date(response.minDate);
|
||||||
|
date_of_accident.set("minDate", formatMinDate)
|
||||||
|
date_of_death.set("minDate", formatMinDate)
|
||||||
|
date_of_intimat.set("minDate", formatMinDate)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.error(response.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// function setMinDateDOA(policy_id) {
|
||||||
|
// console.log("Function set min date called ");
|
||||||
|
// console.log("Existing DOA instance: ", doa);
|
||||||
|
|
||||||
|
// $.ajax({
|
||||||
|
// url: '<?= base_url("ticket/getPolicyStartDate") ?>',
|
||||||
|
// method: "POST",
|
||||||
|
// data: {
|
||||||
|
// policy_id: policy_id
|
||||||
|
// },
|
||||||
|
// success: function(response) {
|
||||||
|
// console.log("mindate response ", response);
|
||||||
|
|
||||||
|
// if (response.status) {
|
||||||
|
// let minDate = new Date(response.minDate);
|
||||||
|
// // If doa is not initialized, create the instance
|
||||||
|
// if (!doa) {
|
||||||
|
// console.log("doa not found, initializing");
|
||||||
|
// doa = flatpickr("#doa", {
|
||||||
|
// dateFormat: "d/m/Y",
|
||||||
|
// allowInput: false,
|
||||||
|
// onChange: function(selectedDates) {
|
||||||
|
// let selectedDOA = selectedDates[0]; // Get selected DOA date
|
||||||
|
// dod.set("minDate", selectedDOA); // Set DOD minDate to DOA
|
||||||
|
// },
|
||||||
|
// minDate: minDate
|
||||||
|
// });
|
||||||
|
// var dod = flatpickr("#dod", {
|
||||||
|
// dateFormat: "d/m/Y",
|
||||||
|
// allowInput: false
|
||||||
|
// });
|
||||||
|
// } else {
|
||||||
|
// // If already initialized, just set the minDate
|
||||||
|
// doa.set("minDate", minDate);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// console.error(response.message);
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// error: function(xhr, status, error) {
|
||||||
|
// console.error(xhr.responseText);
|
||||||
|
// console.error(status, error);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
</script>
|
</script>
|
||||||
@ -76,48 +76,37 @@ if(!isset($view_ticket_page)){
|
|||||||
<div id="mobileSearch" class="search-method">
|
<div id="mobileSearch" class="search-method">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col-md-5" style="display:true;">
|
<div class="col-md-3" style="display:true;">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Employee Data Points</label>
|
<label>Employee Data Points</label>
|
||||||
<select name="employee_data_points" id="employee_data_points"
|
<select name="employee_data_points" id="employee_data_points"
|
||||||
class="form-control">
|
class="form-control">
|
||||||
<option value="mobile">Employee Mobile Number</option>
|
<option value="mobile">Mobile Number</option>
|
||||||
<option value="emp_code">Employee ID</option>
|
<option value="emp_code">Employee ID</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-5">
|
<div class="col-md-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label id="employee_data_points_label">Employee Mobile Number</label>
|
<label>Client</label>
|
||||||
|
<select id="mobile_emp_client_data_list" name="client"
|
||||||
|
class="form-control custom-select">
|
||||||
|
<option value="0">Select Client</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label id="employee_data_points_label">Mobile Number</label>
|
||||||
<input class="form-control" type="text" id="emp_mobile_number_for_claim"
|
<input class="form-control" type="text" id="emp_mobile_number_for_claim"
|
||||||
name="mobile_numbers" onkeypress="return onlyNumbers(event)"
|
name="mobile_numbers" onkeypress="return onlyNumbers(event)"
|
||||||
maxlength="10">
|
maxlength="10">
|
||||||
</div>
|
</div>
|
||||||
<div class="text-danger" id="error_dis"></div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<div class="form-group" style="margin-top: 9px;">
|
|
||||||
<br>
|
|
||||||
<button class="btn btn-primary"
|
|
||||||
onclick="getTheEmpDataForClaimSearchByMobile(this)">Search</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="emp_member_policy_div" style="display:true;">
|
<div class="col-md-6">
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-5" style="display:none;">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Employee</label>
|
|
||||||
<select name="employee_by_number" id="employee_by_number"
|
|
||||||
class="form-control SelExample">
|
|
||||||
<option value="0">Select Employee</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-5">
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Insured List</label>
|
<label>Insured List</label>
|
||||||
<select name="employee_by_number" id="member_by_number"
|
<select name="employee_by_number" id="member_by_number"
|
||||||
@ -126,6 +115,18 @@ if(!isset($view_ticket_page)){
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-2">
|
||||||
|
<div class="form-group" style="margin-top: 9px; float:right;">
|
||||||
|
<br>
|
||||||
|
<button class="btn btn-primary"
|
||||||
|
onclick="getTheEmpDataForClaimSearchByMobile(this)">Search</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -246,6 +247,7 @@ $(document).ready(function() {
|
|||||||
if (policy_list != '') {
|
if (policy_list != '') {
|
||||||
// console.log(branch_list[client_id]);
|
// console.log(branch_list[client_id]);
|
||||||
let data = policy_list[branch_id];
|
let data = policy_list[branch_id];
|
||||||
|
console.log(data);
|
||||||
appendPolicy(data);
|
appendPolicy(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,6 +298,7 @@ function getClientAndBranchAndPolicy() {
|
|||||||
branch_list = res.branch_data;
|
branch_list = res.branch_data;
|
||||||
policy_list = res.policy_data;
|
policy_list = res.policy_data;
|
||||||
appendClients(res.client_data);
|
appendClients(res.client_data);
|
||||||
|
appendClientsForMobileSearch(res.client_data);
|
||||||
} else {
|
} else {
|
||||||
console.log('No data found');
|
console.log('No data found');
|
||||||
}
|
}
|
||||||
@ -329,6 +332,26 @@ function appendClients(data) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//append the clients data for mobile search to the modal
|
||||||
|
function appendClientsForMobileSearch(data) {
|
||||||
|
$('#mobile_emp_client_data_list').empty();
|
||||||
|
|
||||||
|
$('#mobile_emp_client_data_list').append($('<option>', {
|
||||||
|
value: '0',
|
||||||
|
text: 'Select Client'
|
||||||
|
}));
|
||||||
|
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
var option = $('<option>', {
|
||||||
|
value: item.id,
|
||||||
|
text: item.short_name,
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#mobile_emp_client_data_list').append(option).select2();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//append the clients branch data to the modal
|
//append the clients branch data to the modal
|
||||||
function appendBranch(data) {
|
function appendBranch(data) {
|
||||||
$('#emp_client_branch_data_list').empty();
|
$('#emp_client_branch_data_list').empty();
|
||||||
@ -353,6 +376,7 @@ function appendBranch(data) {
|
|||||||
//append the clients policy data to the modal
|
//append the clients policy data to the modal
|
||||||
function appendPolicy(data) {
|
function appendPolicy(data) {
|
||||||
|
|
||||||
|
console.log("function called appendPOlicy : ", data);
|
||||||
let ticket_type = $('#ticket_type_id').val();
|
let ticket_type = $('#ticket_type_id').val();
|
||||||
$('#emp_client_policy_data_list').empty();
|
$('#emp_client_policy_data_list').empty();
|
||||||
|
|
||||||
@ -364,8 +388,10 @@ function appendPolicy(data) {
|
|||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
|
|
||||||
if (ticket_type == 1) {
|
if (ticket_type == 1) {
|
||||||
|
console.log("inside if 1");
|
||||||
if(item.policy_type_id == 2 || item.policy_type_id == 3 || item.policy_type_id == 4 ||item.policy_type_id == 5) {
|
if (item.policy_type_id == 2 || item.policy_type_id == 3 || item.policy_type_id == 4 || item
|
||||||
|
.policy_type_id == 5) {
|
||||||
|
console.log("inside if 2");
|
||||||
var option = $('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.id,
|
value: item.id,
|
||||||
text: item.policy_type + '-' + item.policy_no,
|
text: item.policy_type + '-' + item.policy_no,
|
||||||
@ -375,8 +401,9 @@ function appendPolicy(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (ticket_type == 2) {
|
} else if (ticket_type == 2) {
|
||||||
|
console.log("inside if 3");
|
||||||
if (item.policy_type_id == 1) {
|
if (item.policy_type_id == 1) {
|
||||||
|
console.log("inside if 4");
|
||||||
var option = $('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.id,
|
value: item.id,
|
||||||
text: item.policy_type + '-' + item.policy_no,
|
text: item.policy_type + '-' + item.policy_no,
|
||||||
@ -407,6 +434,8 @@ function appendPolicy(data) {
|
|||||||
$('#emp_client_policy_data_list').append(option).select2();
|
$('#emp_client_policy_data_list').append(option).select2();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.log("inside else condition");
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -417,6 +446,13 @@ function submitClaimForm(event, form) {
|
|||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
var isValid = $('#ticket_form_data').parsley().validate();
|
||||||
|
|
||||||
|
if (!isValid) {
|
||||||
|
toastr.warning('Form validation failed. Please check the required fields.', 'WARNING');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const formAction = '<?= isset($view_ticket_page) ? base_url("ticket/update") : base_url("ticket/create"); ?>';
|
const formAction = '<?= isset($view_ticket_page) ? base_url("ticket/update") : base_url("ticket/create"); ?>';
|
||||||
|
|
||||||
// Show loader
|
// Show loader
|
||||||
@ -446,6 +482,8 @@ function submitClaimForm(event, form) {
|
|||||||
} else {
|
} else {
|
||||||
toastr.error(response.message, 'ERROR');
|
toastr.error(response.message, 'ERROR');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.location.href = '<?= base_url('ticket/list') ?>';
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
@ -481,6 +519,7 @@ function getEmpData(input) {
|
|||||||
console.log(response.message, 'SUCCESS');
|
console.log(response.message, 'SUCCESS');
|
||||||
appendEmployee(response.data, 'search_by_client_employee');
|
appendEmployee(response.data, 'search_by_client_employee');
|
||||||
setClientAndInsurerData(response.dataForClientAndInsurer);
|
setClientAndInsurerData(response.dataForClientAndInsurer);
|
||||||
|
setClientPolicyData(input);
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message, 'WARNING');
|
toastr.warning(response.message, 'WARNING');
|
||||||
}
|
}
|
||||||
@ -502,20 +541,26 @@ function getEmpData(input) {
|
|||||||
|
|
||||||
function getTheEmpDataForClaimSearchByMobile(input, searchType = null) {
|
function getTheEmpDataForClaimSearchByMobile(input, searchType = null) {
|
||||||
|
|
||||||
console.log(input)
|
console.log(input);
|
||||||
let type = $('#employee_data_points').val()
|
let type = $('#employee_data_points').val()
|
||||||
let param = $('#emp_mobile_number_for_claim').val()
|
let param = $('#emp_mobile_number_for_claim').val()
|
||||||
|
let client_policy_id = $('#emp_client_policy_data_list').val()
|
||||||
|
let client_id = $('#mobile_emp_client_data_list').val()
|
||||||
|
|
||||||
if (searchType == 'client') {
|
if (searchType == 'client') {
|
||||||
type = 'emp_code';
|
type = 'emp_code';
|
||||||
param = $(input).val();
|
param = $(input).val();
|
||||||
|
client_id = $('#emp_client_data_list').val()
|
||||||
}
|
}
|
||||||
let url = '<?= base_url('util/getTheEmpDataForClaimSearchByMobile/') ?>' + param + '/' + type;
|
let url = '<?= base_url('util/getTheEmpDataForClaimSearchByMobile/') ?>' + param + '/' + type + '/' +
|
||||||
|
client_policy_id + '/' + client_id;
|
||||||
|
|
||||||
// Data to send in the AJAX request
|
// Data to send in the AJAX request
|
||||||
let requestData = {
|
let requestData = {
|
||||||
param: param,
|
param: param,
|
||||||
type: type,
|
type: type,
|
||||||
|
client_policy_id: client_policy_id,
|
||||||
|
client_id: client_id,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Show loader
|
// Show loader
|
||||||
@ -527,19 +572,24 @@ function getTheEmpDataForClaimSearchByMobile(input, searchType = null) {
|
|||||||
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
||||||
console.log('Data fetched successfully:', response);
|
console.log('Data fetched successfully:', response);
|
||||||
|
|
||||||
if (response.status) {
|
if (response.status == true) {
|
||||||
console.log(response.message, 'SUCCESS');
|
console.log(response.message, 'SUCCESS');
|
||||||
if (searchType == 'client') {
|
if (searchType == 'client') {
|
||||||
appendMember(response.memberData, 'search_by_client_member');
|
appendMember(response.memberData, 'search_by_client_member');
|
||||||
} else {
|
} else {
|
||||||
appendMember(response.memberData, 'member_by_number');
|
appendMember(response.memberData, 'member_by_number');
|
||||||
}
|
}
|
||||||
|
// if (response.data.emp_id == null || response.data.emp_id == ''){
|
||||||
|
unSetClientPolicy();
|
||||||
|
// }
|
||||||
setClientAndInsurerData(response.data);
|
setClientAndInsurerData(response.data);
|
||||||
|
setClientBranchPolicy(response.data.emp_id, searchType ?? null, response.data.policy_id ?? null);
|
||||||
appendACMS(response.acms)
|
appendACMS(response.acms)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message, 'WARNING');
|
toastr.warning(response.message, 'WARNING');
|
||||||
appendACMS(response.acms);
|
appendACMS(response.acms);
|
||||||
|
unSetClientPolicy();
|
||||||
unSetClientAndInsurerData()
|
unSetClientAndInsurerData()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,6 +607,24 @@ function getTheEmpDataForClaimSearchByMobile(input, searchType = null) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setClientBranchPolicy(emp_id, searchType = null, policy_id = null) {
|
||||||
|
|
||||||
|
data = {
|
||||||
|
// branch_id : branch_id,
|
||||||
|
// policy_id : policy_id,
|
||||||
|
emp_id: emp_id,
|
||||||
|
searchType: searchType ?? null,
|
||||||
|
policy_id: policy_id ?? null
|
||||||
|
}
|
||||||
|
|
||||||
|
data = JSON.stringify(data);
|
||||||
|
console.log("set client branch function is called : ", data);
|
||||||
|
console.log("hidden input value before is ", $("#empIDHidden").val());
|
||||||
|
$("#empIDHidden").val(data).trigger('change');;
|
||||||
|
console.log("hidden input value after is ", $("#empIDHidden").val());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function appendEmployee(data, attrId) {
|
function appendEmployee(data, attrId) {
|
||||||
|
|
||||||
console.log('data', data)
|
console.log('data', data)
|
||||||
@ -651,6 +719,29 @@ function onlyNumbers(event) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setClientPolicyData(input) {
|
||||||
|
|
||||||
|
// console.log('policy_value ',input);
|
||||||
|
var selectedValue = $(input).val(); // Get selected value
|
||||||
|
var selectedText = $(input).find(":selected").text();
|
||||||
|
console.log('Selected value ', selectedValue, " selected text ", selectedText);
|
||||||
|
|
||||||
|
var targetDropdown = $("#emp_client_policy");
|
||||||
|
|
||||||
|
targetDropdown.select2();
|
||||||
|
targetDropdown.empty();
|
||||||
|
targetDropdown.append(new Option(selectedText, selectedValue));
|
||||||
|
targetDropdown.addClass('readonly-select ').select2('destroy');
|
||||||
|
let ticket_type = $('#ticket_type_id').val();
|
||||||
|
if (ticket_type == 1) {
|
||||||
|
setMinDateDOA(selectedValue);
|
||||||
|
}else{
|
||||||
|
setDateValidation(selectedValue,false);
|
||||||
|
}
|
||||||
|
// targetDropdown.attr("readonly");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function setClientAndInsurerData(data) {
|
function setClientAndInsurerData(data) {
|
||||||
|
|
||||||
$('#insurer_id').val(data.insurer_id);
|
$('#insurer_id').val(data.insurer_id);
|
||||||
@ -667,6 +758,35 @@ function setClientAndInsurerData(data) {
|
|||||||
$('#emp_mail').val(data.emp_email);
|
$('#emp_mail').val(data.emp_email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function unSetClientPolicy() {
|
||||||
|
var targetDropdown = $("#emp_client_policy");
|
||||||
|
|
||||||
|
if (targetDropdown.hasClass("readonly-select")) {
|
||||||
|
console.log("Class exists, removing...");
|
||||||
|
targetDropdown.removeClass("readonly-select");
|
||||||
|
targetDropdown.select2();
|
||||||
|
} else {
|
||||||
|
console.log("Class not found.");
|
||||||
|
}
|
||||||
|
var targetDropdown2 = $("#doa");
|
||||||
|
if (targetDropdown2.hasClass("readonly-select")) {
|
||||||
|
console.log("Class exists, removing...");
|
||||||
|
targetDropdown2.removeClass("readonly-select");
|
||||||
|
// targetDropdown.select2();
|
||||||
|
} else {
|
||||||
|
console.log("Class not found.");
|
||||||
|
}
|
||||||
|
var targetDropdown3 = $("#date_of_joininig");
|
||||||
|
if (targetDropdown3.hasClass("readonly-select")) {
|
||||||
|
console.log("Class exists, removing...");
|
||||||
|
targetDropdown3.removeClass("readonly-select");
|
||||||
|
// targetDropdown.select2();
|
||||||
|
} else {
|
||||||
|
console.log("Class not found.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function unSetClientAndInsurerData() {
|
function unSetClientAndInsurerData() {
|
||||||
|
|
||||||
$('#insurer_id').val("");
|
$('#insurer_id').val("");
|
||||||
@ -704,17 +824,46 @@ function setMemberData(input) {
|
|||||||
$(this).prop('selected', true);
|
$(this).prop('selected', true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (tpaNo == "") {
|
||||||
|
|
||||||
|
$('#claim_status_id').val(1)
|
||||||
|
$('#non_id_reason').attr('required', true);
|
||||||
|
var $label = $("#non_id_reason_lable_id");
|
||||||
|
$label.text('*');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#claim_status_id').val(2)
|
||||||
|
$('#non_id_reason').attr('required', false);
|
||||||
|
var $label = $("#non_id_reason_lable_id");
|
||||||
|
$label.text("");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// $('#employee_data_points').on('change', function() {
|
||||||
|
|
||||||
|
// let value = $(this).val()
|
||||||
|
// if (value == "mobile") {
|
||||||
|
// $('#employee_data_points_label').text('Employee Mobile Number')
|
||||||
|
// } else {
|
||||||
|
// $('#employee_data_points_label').text('Employee ID')
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
$('#employee_data_points').on('change', function() {
|
$('#employee_data_points').on('change', function() {
|
||||||
|
let value = $(this).val();
|
||||||
|
let $label = $('#employee_data_points_label');
|
||||||
|
let $input = $('#emp_mobile_number_for_claim');
|
||||||
|
|
||||||
let value = $(this).val()
|
|
||||||
if (value == "mobile") {
|
if (value == "mobile") {
|
||||||
$('#employee_data_points_label').text('Employee Mobile Number')
|
$label.text('Employee Mobile Number');
|
||||||
|
$input.attr('onkeypress', 'return onlyNumbers(event)').attr('maxlength', '10');
|
||||||
} else {
|
} else {
|
||||||
$('#employee_data_points_label').text('Employee ID')
|
$label.text('Employee ID');
|
||||||
|
$input.removeAttr('onkeypress maxlength');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
function toResetTheModelFields() {
|
function toResetTheModelFields() {
|
||||||
|
|
||||||
@ -728,4 +877,15 @@ function toResetTheModelFields() {
|
|||||||
$('#search_by_client_employee').val('0').select2();
|
$('#search_by_client_employee').val('0').select2();
|
||||||
$('#search_by_client_member').val('0').select2();
|
$('#search_by_client_member').val('0').select2();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#tpa_no').on('input', function() {
|
||||||
|
let tpaNo = $(this).val().trim();
|
||||||
|
console.log('tpaNo:', tpaNo);
|
||||||
|
|
||||||
|
let isEmpty = tpaNo === "";
|
||||||
|
$('#claim_status_id').val(isEmpty ? 1 : 2);
|
||||||
|
$('#non_id_reason').prop('required', isEmpty);
|
||||||
|
$('#non_id_reason_lable_id').text(isEmpty ? '*' : '');
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -5,7 +5,7 @@
|
|||||||
<table id="scroll-horizontal-datatable" class="table w-100">
|
<table id="scroll-horizontal-datatable" class="table w-100">
|
||||||
<thead class="bg-light">
|
<thead class="bg-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Field</th>
|
<th>Label</th>
|
||||||
<!-- <th>Old Value</th>
|
<!-- <th>Old Value</th>
|
||||||
<th>New Value</th> -->
|
<th>New Value</th> -->
|
||||||
<th>Change</th>
|
<th>Change</th>
|
||||||
|
|||||||
@ -74,11 +74,11 @@ table.dataTable tbody td {
|
|||||||
title=" <?php
|
title=" <?php
|
||||||
if ($row['claim_status_id'] == 8) {
|
if ($row['claim_status_id'] == 8) {
|
||||||
if ($row['is_head_approved'] == 0) {
|
if ($row['is_head_approved'] == 0) {
|
||||||
echo 'Waiting For Head Approvel';
|
echo 'Waiting for approvel';
|
||||||
} elseif ($row['is_head_approved'] == 1) {
|
} elseif ($row['is_head_approved'] == 1) {
|
||||||
echo 'Head Approved';
|
echo 'Rejection approved';
|
||||||
} elseif ($row['is_head_approved'] == 2) {
|
} elseif ($row['is_head_approved'] == 2) {
|
||||||
echo 'Head Rejected';
|
echo 'Rejection not approved';
|
||||||
} else {
|
} else {
|
||||||
echo $row['status'];
|
echo $row['status'];
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ table.dataTable tbody td {
|
|||||||
|
|
||||||
<span class="status-tooltip">
|
<span class="status-tooltip">
|
||||||
<?php
|
<?php
|
||||||
if ($row['claim_status_id'] == 8) {
|
if (in_array($row['claim_status_id'],[8,23,33,43])) {
|
||||||
if ($row['is_head_approved'] == 0) {
|
if ($row['is_head_approved'] == 0) {
|
||||||
echo $row['status'] . ' <i class="fa fa-exclamation-triangle" style="color:#cece00;" aria-hidden="true"></i>';
|
echo $row['status'] . ' <i class="fa fa-exclamation-triangle" style="color:#cece00;" aria-hidden="true"></i>';
|
||||||
} elseif ($row['is_head_approved'] == 1) {
|
} elseif ($row['is_head_approved'] == 1) {
|
||||||
|
|||||||
@ -77,7 +77,16 @@ table.dataTable tbody td {
|
|||||||
<?php if (isset($ticket_data)) { ?>
|
<?php if (isset($ticket_data)) { ?>
|
||||||
<?php foreach ($ticket_data as $index => $row) { ?>
|
<?php foreach ($ticket_data as $index => $row) { ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $row['template_name'] ?? ""; ?></td>
|
<td> <?php echo $row['template_name'] ?? ""; ?>
|
||||||
|
<i class="fe-alert-circle"
|
||||||
|
style="color: #000;"
|
||||||
|
aria-hidden="true"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="top"
|
||||||
|
title="<?php echo "Status : ". ($row['tool_tip'] ?? ''); ?>"></i>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
<td><?php echo $ticket_type[$row['ticket_type']] ?? ""; ?></td>
|
<td><?php echo $ticket_type[$row['ticket_type']] ?? ""; ?></td>
|
||||||
<td><?php echo $trigger_type[$row['trigger_type']] ?? ""; ?></td>
|
<td><?php echo $trigger_type[$row['trigger_type']] ?? ""; ?></td>
|
||||||
<td><?= $row['is_auto_mail'] == 1 ? 'Auto' : "Manual" ?></td>
|
<td><?= $row['is_auto_mail'] == 1 ? 'Auto' : "Manual" ?></td>
|
||||||
@ -171,6 +180,12 @@ table.dataTable tbody td {
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="claim_status_for_template">Claim Status</label>
|
||||||
|
<input type="text" readonly id="claim_status_for_template" class="form-control" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -192,11 +207,14 @@ table.dataTable tbody td {
|
|||||||
style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
|
style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
|
||||||
<option value="">PlaceHolders</option>
|
<option value="">PlaceHolders</option>
|
||||||
<?php foreach ($placeHolders as $key => $value): ?>
|
<?php foreach ($placeHolders as $key => $value): ?>
|
||||||
<?php // if($value == 'member_name' || $value == 'member_mobile' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name'){ ?>member_mobile
|
<?php // if($value == 'member_name' || $value == 'member_mobile' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name'){
|
||||||
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
|
?>member_mobile
|
||||||
|
<?php $valueChange = str_replace('_', ' ', $value);
|
||||||
|
$valueChange = ucwords($valueChange); ?>
|
||||||
<option value="<?php echo $key; ?>"><?php echo $valueChange; ?></option>
|
<option value="<?php echo $key; ?>"><?php echo $valueChange; ?></option>
|
||||||
</option>
|
</option>
|
||||||
<?php //} ?>
|
<?php //}
|
||||||
|
?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -216,7 +234,11 @@ table.dataTable tbody td {
|
|||||||
</div><!-- /.modal -->
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
<!-------------------------------------------------------------------------------------------------->
|
<!-------------------------------------------------------------------------------------------------->
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
<script>
|
<script>
|
||||||
// Datatable document ready
|
// Datatable document ready
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
@ -481,6 +503,7 @@ function getMailTemplateData(id) {
|
|||||||
$('#primaryKey').val(res.data.id);
|
$('#primaryKey').val(res.data.id);
|
||||||
$('#policy_type').val(res.data.ticket_type).change();
|
$('#policy_type').val(res.data.ticket_type).change();
|
||||||
$('#trigger_type').val(res.data.trigger_type).change();
|
$('#trigger_type').val(res.data.trigger_type).change();
|
||||||
|
$('#claim_status_for_template').val(res.data.tool_tip);
|
||||||
$('.jodit-wysiwyg').html(res.data.mail_content);
|
$('.jodit-wysiwyg').html(res.data.mail_content);
|
||||||
|
|
||||||
// Set the auto mail switch
|
// Set the auto mail switch
|
||||||
|
|||||||
@ -47,8 +47,33 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
|
||||||
var toolbar = "bold,italic,strikethrough,|,superscript,subscript,|,align,";
|
var toolbar = "bold,italic,strikethrough,|,superscript,subscript,|,align,";
|
||||||
|
|
||||||
|
const editorConfig = {
|
||||||
|
buttons: toolbar.concat(['fontsize']),
|
||||||
|
fontsize: [8, 10, 12, 14, 16, 18, 20, 22, 24], // Customize font sizes
|
||||||
|
showPlaceholder: false,
|
||||||
|
toolbarButtonSize: 'small',
|
||||||
|
toolbarAdaptive: false,
|
||||||
|
saveHeightInStorage: true,
|
||||||
|
minHeight: 400,
|
||||||
|
extraButtons: [
|
||||||
|
{
|
||||||
|
name: 'info',
|
||||||
|
iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL
|
||||||
|
exec: function (editor) {
|
||||||
|
const fileInput = document.getElementById("Question_title_fileInput");
|
||||||
|
fileInput.click();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
var toolbar = "bold,italic,strikethrough,|,superscript,subscript,|,align,";
|
||||||
|
|
||||||
const editorConfig = {
|
const editorConfig = {
|
||||||
buttons: toolbar.concat(['fontsize']),
|
buttons: toolbar.concat(['fontsize']),
|
||||||
fontsize: [8, 10, 12, 14, 16, 18, 20, 22, 24], // Customize font sizes
|
fontsize: [8, 10, 12, 14, 16, 18, 20, 22, 24], // Customize font sizes
|
||||||
@ -71,7 +96,13 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
const editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
const editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
||||||
var mail_content = `<?=isset($reply_data['mail_content'])?$reply_data['mail_content']:'' ?>`;
|
var mail_content = `<?=isset($reply_data['mail_content'])?$reply_data['mail_content']:'' ?>`;
|
||||||
$('.jodit-wysiwyg').html(mail_content);
|
// console.log(mail_content);
|
||||||
|
|
||||||
|
if (editor) {
|
||||||
|
editor.value = mail_content;
|
||||||
|
}
|
||||||
|
|
||||||
|
// $('.jodit-wysiwyg').html(mail_content);
|
||||||
|
|
||||||
let lastActiveField = null;
|
let lastActiveField = null;
|
||||||
|
|
||||||
@ -176,6 +207,7 @@ document.addEventListener('change', function(event) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
function reloadTicket_conversation() {
|
function reloadTicket_conversation() {
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-primary" onclick="submitToRedirectTicketNewUrl(this)">submit</button>
|
<button type="button" class="btn btn-primary" onclick="submitToRedirectTicketNewUrl(this)">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -128,6 +128,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
// Preserve click handlers and add auto-close
|
// Preserve click handlers and add auto-close
|
||||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||||
item.addEventListener('click', function(e) {
|
item.addEventListener('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
const onclickAttr = this.getAttribute('onclick');
|
const onclickAttr = this.getAttribute('onclick');
|
||||||
if (onclickAttr) {
|
if (onclickAttr) {
|
||||||
eval(onclickAttr);
|
eval(onclickAttr);
|
||||||
|
|||||||
@ -107,6 +107,7 @@
|
|||||||
<thead class="bg-light">
|
<thead class="bg-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="font-weight-medium">Date</th>
|
<th class="font-weight-medium">Date</th>
|
||||||
|
<th class="font-weight-medium">Record Date</th>
|
||||||
<th class="font-weight-medium">Unit</th>
|
<th class="font-weight-medium">Unit</th>
|
||||||
<th class="font-weight-medium">Policy</th>
|
<th class="font-weight-medium">Policy</th>
|
||||||
<th class="font-weight-medium">Endorsement No</th>
|
<th class="font-weight-medium">Endorsement No</th>
|
||||||
@ -122,6 +123,7 @@
|
|||||||
<?php foreach($depositdata as $row) { ?>
|
<?php foreach($depositdata as $row) { ?>
|
||||||
<tr id="<?php echo $row->id;?>">
|
<tr id="<?php echo $row->id;?>">
|
||||||
<td><?php echo date('d-M-Y h:i A', strtotime($row->created_at)); ?></td>
|
<td><?php echo date('d-M-Y h:i A', strtotime($row->created_at)); ?></td>
|
||||||
|
<td><?php echo isset($row->record_date)? date('d-M-Y', strtotime($row->record_date)):'-' ?></td>
|
||||||
<td><?php echo $row->unit ?? ' - '; ?></td>
|
<td><?php echo $row->unit ?? ' - '; ?></td>
|
||||||
<!-- <td><?php echo $row->policy_name ?? '<center> - </center>'; ?></td> -->
|
<!-- <td><?php echo $row->policy_name ?? '<center> - </center>'; ?></td> -->
|
||||||
<td>
|
<td>
|
||||||
@ -139,8 +141,8 @@
|
|||||||
<td><?php echo $row->endorsement_no ?? '<center> - </center>'; ?></td>
|
<td><?php echo $row->endorsement_no ?? '<center> - </center>'; ?></td>
|
||||||
<td><?php echo isset($subTypeOptions[$row->sub_type]) ? $subTypeOptions[$row->sub_type] : ''; ?>
|
<td><?php echo isset($subTypeOptions[$row->sub_type]) ? $subTypeOptions[$row->sub_type] : ''; ?>
|
||||||
</td>
|
</td>
|
||||||
<td><?php echo ($row->transaction_type == 'Credit') ? $row->amount : ''; ?></td>
|
<td><?php echo ($row->transaction_type == 'Credit') ? $row->amount : '-'; ?></td>
|
||||||
<td><?php echo ($row->transaction_type == 'Debit') ? $row->amount : ''; ?></td>
|
<td><?php echo ($row->transaction_type == 'Debit') ? $row->amount : '-'; ?></td>
|
||||||
<td><?php echo $row->balance; ?></td>
|
<td><?php echo $row->balance; ?></td>
|
||||||
<td><?php echo $row->description; ?></td>
|
<td><?php echo $row->description; ?></td>
|
||||||
<td><?php echo $row->username; ?></td>
|
<td><?php echo $row->username; ?></td>
|
||||||
@ -205,6 +207,8 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="field-1" class="control-label">Amount<span class="text-danger">*</span></label>
|
<label for="field-1" class="control-label">Amount<span class="text-danger">*</span></label>
|
||||||
<input type="number" class="form-control" id="amount" placeholder="Amount" required>
|
<input type="number" class="form-control" id="amount" placeholder="Amount" required>
|
||||||
|
<br><label for="record_date">Record Date <span class="text-danger"></span></label>
|
||||||
|
<input type="text" class="form-control policy_start_date" id="record_date" name="record_date" placeholder="Record Date">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -264,6 +268,12 @@ $(document).ready(function() {
|
|||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
|
||||||
|
var record_date = flatpickr("#record_date",{
|
||||||
|
dateFormat: "d/m/Y",
|
||||||
|
allowInput: false,
|
||||||
|
|
||||||
|
});
|
||||||
$('#tickets-table').DataTable({
|
$('#tickets-table').DataTable({
|
||||||
dom: "<'row'<'col-sm-0'f><'col-sm-7 text-right'B>>" +
|
dom: "<'row'<'col-sm-0'f><'col-sm-7 text-right'B>>" +
|
||||||
"<'row'<'col-sm-12'tr>>" +
|
"<'row'<'col-sm-12'tr>>" +
|
||||||
@ -293,6 +303,8 @@ $(document).ready(function() {
|
|||||||
paging: true ,
|
paging: true ,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
@ -320,6 +332,7 @@ $(document).ready(function() {
|
|||||||
var insurerId = '<?php echo $insurerName->id; ?>';
|
var insurerId = '<?php echo $insurerName->id; ?>';
|
||||||
var transactionTypeValue = $('input[name="transactionMode"]:checked').val();
|
var transactionTypeValue = $('input[name="transactionMode"]:checked').val();
|
||||||
var subType = "";
|
var subType = "";
|
||||||
|
var record_date = $('#record_date').val();
|
||||||
|
|
||||||
if(amount == ""){
|
if(amount == ""){
|
||||||
toastr.warning('Amount field is required')
|
toastr.warning('Amount field is required')
|
||||||
@ -372,7 +385,8 @@ $(document).ready(function() {
|
|||||||
transaction_type: transactionType,
|
transaction_type: transactionType,
|
||||||
sub_type_id: subType, // Include sub_type_id
|
sub_type_id: subType, // Include sub_type_id
|
||||||
client_id: clientId,
|
client_id: clientId,
|
||||||
insurer_id: insurerId
|
insurer_id: insurerId,
|
||||||
|
record_date : record_date
|
||||||
},
|
},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
// Handle success response
|
// Handle success response
|
||||||
|
|||||||
@ -58,6 +58,7 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
background-color: #bfe0e2;
|
background-color: #bfe0e2;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
width: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.suggestion-box {
|
.suggestion-box {
|
||||||
@ -194,6 +195,14 @@
|
|||||||
background-color: #f0f0f0;
|
background-color: #f0f0f0;
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table th.action,
|
||||||
|
table th.disableborder,
|
||||||
|
table td.action,
|
||||||
|
table td.disableborder {
|
||||||
|
border: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
@ -411,9 +420,9 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-12">
|
||||||
<label for="subject">Subject</label>
|
<label for="subject">Subject</label>
|
||||||
<input id="subject" type="text" class="form-control" name="subject" value="Internal Mail - ">
|
<input id="subject" type="text" class="form-control" name="subject" value="<?= isset($subject) ? $subject : " " ?>">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
@ -423,7 +432,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<br>
|
||||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||||
<button type="submit" class="btn btn-primary" onclick="constructURL(2)">Send Mail</button>
|
<button type="submit" class="btn btn-primary" onclick="constructURL(2)">Send Mail</button>
|
||||||
</div>
|
</div>
|
||||||
@ -508,9 +517,9 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-12">
|
||||||
<label for="subject">Subject</label>
|
<label for="subject">Subject</label>
|
||||||
<input type="text" class="form-control" id="placement_subject" name="placement_subject" value="Proposel Mail for - " placeholder="Enter Subject">
|
<input type="text" class="form-control" id="placement_subject" name="placement_subject" value="<?= isset($subject) ? $subject : " " ?>" placeholder="Enter Subject">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -641,7 +650,7 @@
|
|||||||
|
|
||||||
// Check if data is valid (not null or undefined) and is an object
|
// Check if data is valid (not null or undefined) and is an object
|
||||||
if (data && typeof data === 'object') {
|
if (data && typeof data === 'object') {
|
||||||
insurer_count = data.proposal_data.over_all_column_data['Proposal 1']['insurers'].length;
|
let insurer_count = data.proposal_data.over_all_column_data['Proposal 1']?.insurers?.length || 0;
|
||||||
jsonToTable(data);
|
jsonToTable(data);
|
||||||
} else {
|
} else {
|
||||||
addSuggestionsToTable();
|
addSuggestionsToTable();
|
||||||
@ -1030,16 +1039,29 @@ function addSuggestionsToTable() {
|
|||||||
|
|
||||||
console.log(' addSuggestionsToTable suggestions ', suggestions);
|
console.log(' addSuggestionsToTable suggestions ', suggestions);
|
||||||
console.log(' addSuggestionsToTable suggestions type', typeof suggestions);
|
console.log(' addSuggestionsToTable suggestions type', typeof suggestions);
|
||||||
|
console.log(' over_all_column_data', over_all_column_data);
|
||||||
let leadType = <?= isset($lead_data) && isset($lead_data['lead_type']) ? $lead_data['lead_type'] : 1; ?>;
|
let leadType = <?= isset($lead_data) && isset($lead_data['lead_type']) ? $lead_data['lead_type'] : 1; ?>;
|
||||||
console.log('leadType', leadType);
|
console.log('leadType', leadType);
|
||||||
|
|
||||||
let renewal_or_rollover = "Proposal 1";
|
let renewal_or_rollover = "Proposal 1";
|
||||||
if (leadType == 2) {
|
if (leadType == 2) {
|
||||||
renewal_or_rollover = "Existing Renewal"
|
renewal_or_rollover = "Existing Renewal";
|
||||||
} else if (leadType == 3) {
|
} else if (leadType == 3) {
|
||||||
renewal_or_rollover = "Existing Rollover"
|
renewal_or_rollover = "Existing Rollover";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
over_all_column_data = {
|
||||||
|
[renewal_or_rollover]: {
|
||||||
|
"qcr": 1,
|
||||||
|
"stc": 1,
|
||||||
|
"insurers": []
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('renewal_or_rollover', renewal_or_rollover);
|
||||||
|
console.log(' over_all_column_data', over_all_column_data);
|
||||||
|
|
||||||
|
|
||||||
$('#first_proposel_title').html(`
|
$('#first_proposel_title').html(`
|
||||||
${renewal_or_rollover}
|
${renewal_or_rollover}
|
||||||
<span class="dropdown" onclick="showThreeDottedMenu(event)">
|
<span class="dropdown" onclick="showThreeDottedMenu(event)">
|
||||||
@ -3137,9 +3159,9 @@ function appendInput(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
html += `
|
html += `
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-12">
|
||||||
<label for="mail_subject">Subject</label>
|
<label for="mail_subject">Subject</label>
|
||||||
<input value="Client Mail - " type="text" id="mail_subject" class="form-control" placeholder="Subject">
|
<input type="text" id="mail_subject" class="form-control" value="'<?= isset($subject) ? $subject : " " ?>'" placeholder="Subject">
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -3197,9 +3219,9 @@ function appendInput(data) {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
html += `
|
html += `
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-12">
|
||||||
<label for="mail_subject">Subject</label>
|
<label for="mail_subject">Subject</label>
|
||||||
<input value="Insurer Mail - " type="text" id="mail_subject" class="form-control" placeholder="Subject">
|
<input value="<?= isset($subject) ? $subject : " " ?>" type="text" id="mail_subject" class="form-control" placeholder="Subject">
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -3576,7 +3598,7 @@ function ajaxRequest(formData) {
|
|||||||
$('#cc').val('').select2({
|
$('#cc').val('').select2({
|
||||||
placeholder : 'select CC Mail'
|
placeholder : 'select CC Mail'
|
||||||
});
|
});
|
||||||
$('#subject').val('');
|
// $('#subject').val('');
|
||||||
$('#proposals').val('');
|
$('#proposals').val('');
|
||||||
$('#placement_to').val('').select2({
|
$('#placement_to').val('').select2({
|
||||||
placeholder : 'select To Mail'
|
placeholder : 'select To Mail'
|
||||||
@ -3653,7 +3675,7 @@ $('.close').click(function(){
|
|||||||
$('#cc').val('').select2({
|
$('#cc').val('').select2({
|
||||||
placeholder : 'select CC Mail'
|
placeholder : 'select CC Mail'
|
||||||
});
|
});
|
||||||
$('#subject').val('');
|
// $('#subject').val('');
|
||||||
$('#proposals').val('');
|
$('#proposals').val('');
|
||||||
$('#placement_to').val('').select2({
|
$('#placement_to').val('').select2({
|
||||||
placeholder : 'select To Mail'
|
placeholder : 'select To Mail'
|
||||||
@ -3806,7 +3828,7 @@ function constructInsurerNameWithVersion(proposal_name, insurerName) {
|
|||||||
let newDisplayName = `${insurerName}-V${maxVersion + 1}`;
|
let newDisplayName = `${insurerName}-V${maxVersion + 1}`;
|
||||||
return newDisplayName;
|
return newDisplayName;
|
||||||
}
|
}
|
||||||
return false;
|
return insurerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkTheTableDataChanged(redirect_type, url){
|
function checkTheTableDataChanged(redirect_type, url){
|
||||||
@ -4441,7 +4463,7 @@ function jsonToTable(json) {
|
|||||||
//Premium Calculation child table
|
//Premium Calculation child table
|
||||||
function populateTable(json) {
|
function populateTable(json) {
|
||||||
|
|
||||||
console.log(json);
|
console.log('populateTable json data', json);
|
||||||
|
|
||||||
const table = document.getElementById("rfqTable_for_calc");
|
const table = document.getElementById("rfqTable_for_calc");
|
||||||
const thead = document.createElement("thead");
|
const thead = document.createElement("thead");
|
||||||
@ -4458,7 +4480,7 @@ function populateTable(json) {
|
|||||||
let randomColor = 'hsl(' + Math.random() * 360 + ', 100%, 93%)';
|
let randomColor = 'hsl(' + Math.random() * 360 + ', 100%, 93%)';
|
||||||
|
|
||||||
// Skip unwanted parent headers
|
// Skip unwanted parent headers
|
||||||
if (!["Item Key", "Action"].includes(header.parentHeader)) {
|
if (!["Item Key"].includes(header.parentHeader)) {
|
||||||
// console.log(header.parentHeader);
|
// console.log(header.parentHeader);
|
||||||
|
|
||||||
// Create the parent header
|
// Create the parent header
|
||||||
@ -4473,7 +4495,12 @@ function populateTable(json) {
|
|||||||
th.classList.add('sticky');
|
th.classList.add('sticky');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(header.parentHeader !== 'Particulars' && header.parentHeader !== 'Sno'){
|
if (header.parentHeader === "Action") {
|
||||||
|
th.classList.add('readonly-select');
|
||||||
|
th.textContent = " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(header.parentHeader !== 'Particulars' && header.parentHeader !== 'Sno' && header.parentHeader !== "Action"){
|
||||||
th.style.backgroundColor = randomColor;
|
th.style.backgroundColor = randomColor;
|
||||||
}
|
}
|
||||||
// Calculate colspan based on the number of subheaders
|
// Calculate colspan based on the number of subheaders
|
||||||
@ -4507,7 +4534,12 @@ function populateTable(json) {
|
|||||||
subTh.classList.add('sticky');
|
subTh.classList.add('sticky');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(header.parentHeader != "Particulars" && header.parentHeader !== 'Sno'){
|
if (header.parentHeader === "Action") {
|
||||||
|
subTh.classList.add('readonly-select');
|
||||||
|
subTh.textContent = " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(header.parentHeader != "Particulars" && header.parentHeader !== 'Sno' && header.parentHeader !== "Action"){
|
||||||
subTh.style.backgroundColor = randomColor;
|
subTh.style.backgroundColor = randomColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4554,7 +4586,7 @@ function populateTable(json) {
|
|||||||
|
|
||||||
// Create a td for each subheader
|
// Create a td for each subheader
|
||||||
json.table_data.headers.forEach((header, headerIndexForCalc) => {
|
json.table_data.headers.forEach((header, headerIndexForCalc) => {
|
||||||
if (!["Item Key", "Sno", "Particulars", "Action"].includes(header.parentHeader)) {
|
if (!["Item Key", "Sno", "Particulars"].includes(header.parentHeader)) {
|
||||||
header.subHeaders.forEach((value, index) => {
|
header.subHeaders.forEach((value, index) => {
|
||||||
|
|
||||||
// if(value != '-'){
|
// if(value != '-'){
|
||||||
@ -4568,6 +4600,13 @@ function populateTable(json) {
|
|||||||
td.setAttribute("contenteditable", "true");
|
td.setAttribute("contenteditable", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(header.parentHeader == "Action"){
|
||||||
|
td.setAttribute("contenteditable", false);
|
||||||
|
td.classList.add('action');
|
||||||
|
td.classList.add('disableborder');
|
||||||
|
td.classList.add('readonly-select');
|
||||||
|
}
|
||||||
|
|
||||||
td.classList.add(
|
td.classList.add(
|
||||||
'editablecolumnsforcalc',
|
'editablecolumnsforcalc',
|
||||||
label.toLowerCase().replace(/\s+/g, '').replace(/[%₹()]/g, '')
|
label.toLowerCase().replace(/\s+/g, '').replace(/[%₹()]/g, '')
|
||||||
@ -4582,6 +4621,7 @@ function populateTable(json) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// td.id = `${label.toLowerCase()}`;
|
// td.id = `${label.toLowerCase()}`;
|
||||||
|
console.log('child table', header.parentHeader);
|
||||||
td.textContent = json.premium_data?.data?.[header.parentHeader]?.[value]?.[label] || "";
|
td.textContent = json.premium_data?.data?.[header.parentHeader]?.[value]?.[label] || "";
|
||||||
tr.appendChild(td);
|
tr.appendChild(td);
|
||||||
// }
|
// }
|
||||||
|
|||||||
1998
app/Views/view_rfq_non_eb.php
Normal file
1998
app/Views/view_rfq_non_eb.php
Normal file
File diff suppressed because it is too large
Load Diff
BIN
public/claim_sample_forms/DIGITLIF.pdf
Normal file
BIN
public/claim_sample_forms/DIGITLIF.pdf
Normal file
Binary file not shown.
BIN
public/claim_sample_forms/ICICIPRU.pdf
Normal file
BIN
public/claim_sample_forms/ICICIPRU.pdf
Normal file
Binary file not shown.
BIN
public/claim_sample_forms/MAXLIFE.pdf
Normal file
BIN
public/claim_sample_forms/MAXLIFE.pdf
Normal file
Binary file not shown.
BIN
public/claim_sample_forms/NIA.pdf
Normal file
BIN
public/claim_sample_forms/NIA.pdf
Normal file
Binary file not shown.
BIN
public/claim_sample_forms/OIC.pdf
Normal file
BIN
public/claim_sample_forms/OIC.pdf
Normal file
Binary file not shown.
BIN
public/claim_sample_forms/PIFL.pdf
Normal file
BIN
public/claim_sample_forms/PIFL.pdf
Normal file
Binary file not shown.
BIN
public/claim_sample_forms/RELIANCE.pdf
Normal file
BIN
public/claim_sample_forms/RELIANCE.pdf
Normal file
Binary file not shown.
11
writable/cache/.gitkeep
vendored
Executable file
11
writable/cache/.gitkeep
vendored
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>403 Forbidden</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Reference in New Issue
Block a user