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("sendextraparam", "ClientController::sendextraparam");
|
||||
$routes->get("updateRenewalData", "ClientController::updateRenewalData");
|
||||
$routes->get("updateRenewalDataNotExistingClient", "ClientController::updateRenewalDataNotExistingClient");
|
||||
$routes->get("updateRenewalInsurerData", "ClientController::updateRenewalInsurerData");
|
||||
// $routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
|
||||
// $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
||||
// $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('download-e-card/(:any)', 'EmployeeController::generateIDCardForEmployee/$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->post("create", "UserController::create");
|
||||
@ -161,6 +163,7 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("test-rack-rate", "EmployeeController::testRackRate");
|
||||
$routes->post("test-rack-rate", "EmployeeController::testRackRate");
|
||||
$routes->get('test_members_list', 'EmployeeController::test_members_list');
|
||||
$routes->post('get_emp_history','EmployeeController::getEmpHistory');
|
||||
});
|
||||
|
||||
$routes->group("/master", ["filter" => "authMVC"], function ($routes) {
|
||||
@ -387,21 +390,21 @@ $routes->group("policy_tranction", ["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->get("list/(:any)", "LeadsController::getLeadDataForEdit/$1");
|
||||
$routes->get("sendMail", "LeadsController::sendMailWithAttachement");
|
||||
$routes->post("sendMail", "LeadsController::sendMailWithAttachement");
|
||||
$routes->get("exportQCRandRFQ/(:any)", "LeadsController::exportQCRandRFQ/$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->post("create", "LeadsController::createRFQ");
|
||||
$routes->post("createQCR", "LeadsController::createQCR");
|
||||
$routes->get("list/(:any)", "LeadsController::viewRFQ/$1");
|
||||
$routes->get("nonEB","LeadsController::rfqNonEB");
|
||||
});
|
||||
|
||||
|
||||
@ -440,13 +443,19 @@ $routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::
|
||||
|
||||
// Test initiate Claim
|
||||
$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->post("logined", "RestAuthenticationController::logined");
|
||||
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
|
||||
$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("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy");
|
||||
$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('reply','TicketController::saveReply');
|
||||
$routes->match( ['get', 'post'], 'ticket_reports','TicketController::ticketReports');
|
||||
$routes->post('getPolicyStartDate','TicketController::getPolicyStartDate');
|
||||
$routes->post("getPoliciesbyEmpID","TicketController::getPoliciesbyEmpID");
|
||||
// $routes->post('ticket_messages','TicketController::getTicketMessage');
|
||||
});
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ class BDSReportController extends AdminController
|
||||
ins.id,
|
||||
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 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 ptp.policy_category = $insurerCategory AND pt_co.insurer_id = ins.id THEN pt_co.exp_amt ELSE 0 END), 0) AS Expected_amt
|
||||
FROM
|
||||
@ -131,7 +131,7 @@ class BDSReportController extends AdminController
|
||||
SELECT
|
||||
pot.bap AS bap,
|
||||
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(pt_co.exp_amt), 0) AS Expected_amt
|
||||
FROM policy_type AS pot
|
||||
@ -267,26 +267,26 @@ class BDSReportController extends AdminController
|
||||
|
||||
-- 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' 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 pt_co.exp_amt ELSE 0 END), 0) AS health_exp_amt,
|
||||
|
||||
-- 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' 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 pt_co.exp_amt ELSE 0 END), 0) AS misc_exp_amt,
|
||||
|
||||
|
||||
-- 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' 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 pt_co.exp_amt ELSE 0 END), 0) AS motor_exp_amt,
|
||||
|
||||
-- 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' 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 pt_co.exp_amt ELSE 0 END), 0) AS engineering_exp_amt,
|
||||
|
||||
@ -294,35 +294,35 @@ class BDSReportController extends AdminController
|
||||
|
||||
-- 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' 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 pt_co.exp_amt ELSE 0 END), 0) AS fire_exp_amt,
|
||||
|
||||
|
||||
-- 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' 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 pt_co.exp_amt ELSE 0 END), 0) AS liability_exp_amt,
|
||||
|
||||
|
||||
-- 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' 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 pt_co.exp_amt ELSE 0 END), 0) AS life_exp_amt,
|
||||
|
||||
|
||||
-- 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' 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 pt_co.exp_amt ELSE 0 END), 0) AS marine_cargo_exp_amt,
|
||||
|
||||
|
||||
-- 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' 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 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,
|
||||
|
||||
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 = '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 = '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 = '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 = '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 = '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 = '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 = '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 = '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 = '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.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.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.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.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.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.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.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.cop_amt + pt_co.cotp_amt + pt_co.cotep_amt + pt_co.non_comm_per_amt) ELSE 0 END),
|
||||
0
|
||||
) AS total_premium,
|
||||
|
||||
@ -429,43 +429,43 @@ class BDSReportController extends AdminController
|
||||
|
||||
-- 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' 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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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((
|
||||
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
|
||||
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
|
||||
|
||||
@ -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();
|
||||
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());
|
||||
}else{
|
||||
$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:")
|
||||
->addButtons([
|
||||
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) {
|
||||
@ -271,6 +272,9 @@ class medicalClaimFormConversations extends Conversation
|
||||
]);
|
||||
$this->run();
|
||||
break;
|
||||
case "cancel":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->showSummary();
|
||||
|
||||
@ -180,7 +180,8 @@ class vehicleFormConversation extends Conversation
|
||||
$question = Question::create("Confim your Details:")
|
||||
->addButtons([
|
||||
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) {
|
||||
$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.");
|
||||
}
|
||||
break;
|
||||
case "no":
|
||||
$this->askVehicleName();
|
||||
case "restart":
|
||||
$this->bot->startConversation(new vehicleFormConversation());
|
||||
break;
|
||||
case "cancel":
|
||||
$this->say("Redirecting you to main menu...");
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Controllers\Chatbot\LoginToContiueConversation;
|
||||
use BotMan\BotMan\BotMan;
|
||||
use BotMan\BotMan\BotManFactory;
|
||||
use BotMan\BotMan\Drivers\DriverManager;
|
||||
@ -19,6 +20,7 @@ class ChatbotControllerNew extends BaseController
|
||||
protected $myLogger;
|
||||
protected $session;
|
||||
protected $botman;
|
||||
protected $isMemberLoggedIn;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -90,6 +92,12 @@ class ChatbotControllerNew extends BaseController
|
||||
// $this->myLogger->logme('error', ('TEST' . $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) {
|
||||
|
||||
@ -98,8 +106,13 @@ class ChatbotControllerNew extends BaseController
|
||||
});
|
||||
// Start the Main Menu when user says "hi" or "start"
|
||||
$this->botman->hears('start|hi|hello', function (BotMan $bot) {
|
||||
$bot->reply('Hi how can i assit?');
|
||||
$bot->startConversation(new MainMenuConversation());
|
||||
if ($this->isMemberLoggedIn){
|
||||
$bot->reply('Hi how can i assist?');
|
||||
$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 = [];
|
||||
|
||||
$results = $this->clientModel->select('clients.id as client_id, clients.client_name, clients.short_name,
|
||||
client_branch.id as client_branch_id, client_branch.branch_name,
|
||||
client_branch.branch_code, employees.id as employee_id,
|
||||
employees.name as employee_name, employees.relationship,
|
||||
employees.emp_code, employees.emp_status, auth_history.user_type, client_policy.policy_type_id, client_policy.id as client_policy_id')
|
||||
->join('client_branch', 'clients.id = client_branch.client_id', 'left')
|
||||
->join('client_policy', 'client_branch.id = client_policy.client_branch_id', 'left')
|
||||
->join('employees', 'client_branch.id = employees.client_branch_id', 'left')
|
||||
->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left')
|
||||
->findAll();
|
||||
$db = db_connect();
|
||||
$sql = "SELECT
|
||||
clients.id AS client_id,
|
||||
clients.client_name,
|
||||
clients.short_name,
|
||||
client_branch.id AS client_branch_id,
|
||||
client_branch.branch_name,
|
||||
client_branch.branch_code,
|
||||
|
||||
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;
|
||||
$pendingActionsData = $pendingActionsController->getPendingActionsForDashBoard();
|
||||
@ -118,94 +154,11 @@ class DashboardController extends AdminController
|
||||
$businessTeamStatusData = $this->data_construct_for_bds($businessTeamData);
|
||||
$financeTeamStatusData = $this->data_construct_for_bds($financeTeamData);
|
||||
|
||||
$groupedData = [];
|
||||
|
||||
foreach ($results as $row) {
|
||||
$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;
|
||||
$data['client_branch_emp_list'] = $results;
|
||||
$session = \Config\Services::session();
|
||||
$session->set('enrollment_data', json_encode($data));
|
||||
$session->set('enrollment_data', json_encode($data));
|
||||
|
||||
// echo "<pre>";
|
||||
$data['pendingActionsData'] = $pendingActionsData;
|
||||
$data['businessTeamCount'] = count($businessTeamData) ?? 0;
|
||||
|
||||
@ -975,7 +975,7 @@ class EmpDataServiceController extends BaseController
|
||||
$balance = $this->CDMasterModel
|
||||
->where('client_id', $export_data['client_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();
|
||||
|
||||
$cash_balance['balance'] = $balance['opening_bal'];
|
||||
@ -1011,14 +1011,33 @@ class EmpDataServiceController extends BaseController
|
||||
// dd($inceptionData, $additionData, $dependentAdditionData, $correctionData, $enhancementData, $deletionData, $mergedData);
|
||||
|
||||
|
||||
$template_json = $this->clientPolicyModel
|
||||
->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')
|
||||
->where('client_policy.id', $export_data['client_policy_id'])
|
||||
->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.type_name', $export_data['actions'])
|
||||
->first();
|
||||
// $template_json = $this->clientPolicyModel
|
||||
// ->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')
|
||||
// ->where('client_policy.id', $export_data['client_policy_id'])
|
||||
// ->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.type_name', $export_data['actions'])
|
||||
// ->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){
|
||||
|
||||
@ -25,6 +25,8 @@ use App\Models\InsurerExcelExportTemplateModel;
|
||||
use App\Models\InsurerModel;
|
||||
use App\Models\ClientDepositModel;
|
||||
use App\Models\PolicyPremium2Model;
|
||||
use App\Models\AuditHistoryModel;
|
||||
use App\Models\UserModel;
|
||||
|
||||
|
||||
use App\Controllers\Jobs;
|
||||
@ -64,6 +66,8 @@ class EmployeeController extends AdminController
|
||||
protected $insurerModel;
|
||||
protected $cashDepositModel;
|
||||
protected $PolicyPremium2Model;
|
||||
protected $auditHistory;
|
||||
protected $userModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -84,6 +88,8 @@ class EmployeeController extends AdminController
|
||||
$this->insurerModel = new InsurerModel();
|
||||
$this->cashDepositModel = new ClientDepositModel();
|
||||
$this->PolicyPremium2Model = new PolicyPremium2Model();
|
||||
$this->auditHistory = new AuditHistoryModel();
|
||||
$this->userModel = new userModel();
|
||||
}
|
||||
|
||||
public function list()
|
||||
@ -372,7 +378,7 @@ class EmployeeController extends AdminController
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
->join('clients', 'clients.id = client_policy.client_id')
|
||||
->orderBy('batch_files.id', 'desc')
|
||||
->limit(100)
|
||||
->limit(1000)
|
||||
->find();
|
||||
|
||||
|
||||
@ -1295,7 +1301,7 @@ class EmployeeController extends AdminController
|
||||
->orderBy('id', 'desc')
|
||||
->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') {
|
||||
|
||||
|
||||
@ -1452,6 +1458,7 @@ class EmployeeController extends AdminController
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
// dd($res);
|
||||
// print_r($this->empEndorsementModel->getLastQuery());
|
||||
// echo $res[0]->count;die();
|
||||
|
||||
@ -1461,14 +1468,15 @@ class EmployeeController extends AdminController
|
||||
$this->myLogger->logme('error', 'Event Type : -- {data} --', ['data' => $file['action']]);
|
||||
|
||||
$transaction_type = 'Credit';
|
||||
$cd_amount = $cd_tranction['amount'];
|
||||
$cd_amount = 0;
|
||||
|
||||
if($file['action'] == 'deletion'){
|
||||
if($file['action'] == 'deletion' && $res[0]->count > 0){
|
||||
|
||||
$transaction_type = 'Debit';
|
||||
//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']);
|
||||
$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]);
|
||||
}
|
||||
@ -1485,7 +1493,7 @@ class EmployeeController extends AdminController
|
||||
$this->myLogger->logme('error', 'emp_endorsement table updated');
|
||||
|
||||
//STEP 2:
|
||||
if($file['action'] == 'deletion') {
|
||||
if($file['action'] == 'deletion' && $res[0]->count > 0) {
|
||||
//update the employee policy table reverse the data
|
||||
$this->employeePolicyModel->updateEmployeePolicyTruncateReverse($file_id);
|
||||
$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');
|
||||
|
||||
|
||||
if($cd_tranction && $file['action'] != 'correction'){
|
||||
if(!empty($cd_amount) && $file['action'] != 'correction'){
|
||||
|
||||
$cd_data = [
|
||||
'amount' => $cd_amount,
|
||||
@ -1605,9 +1613,8 @@ class EmployeeController extends AdminController
|
||||
$db = db_connect();
|
||||
$query = "
|
||||
UPDATE employee_polices
|
||||
JOIN employees ON employees.id = employee_polices.employee_id
|
||||
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);
|
||||
@ -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()
|
||||
{
|
||||
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('tpa', 'client_policy.tpa_id = tpa.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)
|
||||
{
|
||||
$data['policy_terms'] = $this->policyTermsFiter($terms,'gpa');
|
||||
$data['department_id'] = 3;
|
||||
}else{
|
||||
$data['policy_terms'] = $this->policyTermsFiter($terms,'gmc');
|
||||
$data['department_id'] = 4;
|
||||
$policyGroup = 'gpa';
|
||||
$data['ticket_type_id'] = 2;
|
||||
}else if($ClientPolicyValue['policy_type_id'] == 6)
|
||||
{
|
||||
$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_policy_id'] = $ClientPolicyValue['id'];
|
||||
$data['policy_name'] = $ClientPolicyValue['policy_type'];
|
||||
@ -2555,13 +2572,15 @@ class EmployeeRestController extends AdminController
|
||||
$data['network_hospitals_url'] = $ClientPolicyValue['network_hospitals_url'];
|
||||
$data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']);
|
||||
$data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']);
|
||||
$data['heading'] = $ClientPolicyValue['policy_long_name'];
|
||||
// $data['policy_terms'] = $terms;
|
||||
|
||||
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'] == 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'] == 5){ $data['heading'] = 'Group Medical Coverage - Parents (Top Up)'; }
|
||||
// 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'] == 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'] == 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)
|
||||
{
|
||||
@ -2718,9 +2737,7 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return $finalarray;
|
||||
return $finalarray;
|
||||
|
||||
}
|
||||
|
||||
@ -3101,90 +3118,195 @@ class EmployeeRestController extends AdminController
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
//Get Data from post for inserting ticket and message
|
||||
public function initiateClaim()
|
||||
{
|
||||
|
||||
$received_data = $this->request->getPost();
|
||||
// print_r($received_data); die;
|
||||
$employee_id = $received_data['emp_id'];
|
||||
$client_policy_id = $received_data['client_policy_id'];
|
||||
$insured_emp_id = $received_data['insured_emp_id'];
|
||||
|
||||
$sql = "select cp.policy_type_id as ticket_type_id,
|
||||
cl_rm.user_id as acm_id,
|
||||
cp.insurer_id as insurer_id,
|
||||
cp.tpa_id as tpa_id,
|
||||
emp.client_id ,
|
||||
emp.id as emp_id,
|
||||
emp_pol.uhid as policy_no,
|
||||
emp.emp_code,
|
||||
emp_pol.tpa_id as tpa_no,
|
||||
emp.name as emp_name,
|
||||
emp.email_corporate as emp_mail,
|
||||
emp.mobile as emp_mobile,
|
||||
empl.id as insured_emp_id,
|
||||
empl.name as insured_name,
|
||||
empl.relationship
|
||||
$sql = "
|
||||
select
|
||||
cp.policy_type_id,
|
||||
cl_rm.user_id as acm_id,
|
||||
cp.insurer_id as insurer_id,
|
||||
cp.tpa_id as tpa_id,
|
||||
emp.client_id ,
|
||||
emp.id as emp_id,
|
||||
emp_pol.uhid as policy_no,
|
||||
emp.emp_code,
|
||||
emp_pol.tpa_id as tpa_no,
|
||||
emp.name as emp_name,
|
||||
emp.email_corporate as emp_mail,
|
||||
emp.mobile as emp_mobile,
|
||||
empl.id as insured_emp_id,
|
||||
empl.name as insured_name,
|
||||
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
|
||||
|
||||
left join employees empl on empl.id = $insured_emp_id and empl.is_active = 1 and empl.emp_status = 'active'
|
||||
left join employee_polices emp_pol on empl.id = emp_pol.employee_id and emp_pol.client_policy_id = $client_policy_id and emp_pol.is_active = 1
|
||||
left join client_policy cp on cp.id = emp_pol.client_policy_id and cp.is_active = 1
|
||||
left join client_rm cl_rm on cl_rm.client_id = empl.client_id and cl_rm.is_active = 1 and cl_rm.level = 3
|
||||
left join employees empl on empl.id = $insured_emp_id and empl.is_active = 1 and empl.emp_status = 'active'
|
||||
left join employee_polices emp_pol on empl.id = emp_pol.employee_id and emp_pol.client_policy_id = $client_policy_id and emp_pol.is_active = 1
|
||||
left join client_policy cp on cp.id = emp_pol.client_policy_id and cp.is_active = 1
|
||||
left join client_rm cl_rm on cl_rm.client_id = empl.client_id and cl_rm.is_active = 1 and cl_rm.level = 3
|
||||
|
||||
where emp.id = $employee_id and emp.is_active = 1 and emp.emp_status = 'active'
|
||||
limit 1 ";
|
||||
|
||||
$fetchData = $this->employeeModel->query($sql)->getResultArray()[0];
|
||||
$fetchData['claim_status_id'] = $this->claimStatusModel->select('id')->where('ticket_type', $fetchData['ticket_type_id'])->first()['id'];
|
||||
$fetchData['priority'] = 1;
|
||||
$fetchData['mode_of_intimation'] = 1;
|
||||
$fetchData['hospital_name'] = $received_data['hospital_name'];
|
||||
$emp_ticket_data = $this->employeeModel->query($sql)->getResultArray();
|
||||
// print_r(db_connect()->getLastQuery()); die;
|
||||
|
||||
$insert_status = $this->ticketMaster->insert($fetchData);
|
||||
$ticket_id = $this->ticketMaster->insertID();
|
||||
if(!empty($emp_ticket_data)){
|
||||
|
||||
if ($insert_status && !empty($ticket_id)) {
|
||||
$mail_sent_status = ($this->ticketController->sendAutoMailTrigger($ticket_id));
|
||||
if (gettype($mail_sent_status) == 'array') {
|
||||
$message = 'Claim Iniated Successfully';
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => $message], 200);
|
||||
} else {
|
||||
$mail_sent_status = json_decode($mail_sent_status);
|
||||
}
|
||||
// dd(gettype($mail_sent_status));
|
||||
$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'];
|
||||
|
||||
if ($mail_sent_status->status == 'success') {
|
||||
$sent_message_data['ticket_id'] = $ticket_id;
|
||||
$sent_message_data['sender'] = 'staff';
|
||||
$sent_message_data['emp_mail'] = $mail_sent_status->data->params->mail;
|
||||
$sent_message_data['mail_subject'] = $mail_sent_status->data->params->subject;
|
||||
$sent_message_data['mail_content'] = $mail_sent_status->data->params->message;
|
||||
$fetchData['priority'] = 1;
|
||||
$fetchData['mode_of_intimation'] = 1;
|
||||
$fetchData = array_merge($fetchData, $received_data);
|
||||
|
||||
$message_insert_status = $this->ticketMessage->insert($sent_message_data);
|
||||
// print_r($fetchData); die;
|
||||
$insert_status = $this->ticketMaster->insert($fetchData);
|
||||
$ticket_id = $this->ticketMaster->insertID();
|
||||
|
||||
if ($message_insert_status) {
|
||||
$message = 'Claim Initiated Successfully';
|
||||
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));
|
||||
if (gettype($mail_sent_status) == 'array') {
|
||||
$message = 'Claim Iniated Successfully';
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => $message], 200);
|
||||
} else {
|
||||
$message = 'Claim Initiated, Mail Sent Successfully';
|
||||
$this->myLogger->logme('error', "Claim initiated, Mail sent Successfully, Failed to store message:$ticket_id ");
|
||||
$mail_sent_status = json_decode($mail_sent_status);
|
||||
}
|
||||
// dd(gettype($mail_sent_status));
|
||||
|
||||
if ($mail_sent_status->status == 'success') {
|
||||
$sent_message_data['ticket_id'] = $ticket_id;
|
||||
$sent_message_data['sender'] = 'staff';
|
||||
$sent_message_data['emp_mail'] = $mail_sent_status->data->params->mail;
|
||||
$sent_message_data['mail_subject'] = $mail_sent_status->data->params->subject;
|
||||
$sent_message_data['mail_content'] = $mail_sent_status->data->params->message;
|
||||
|
||||
$message_insert_status = $this->ticketMessage->insert($sent_message_data);
|
||||
|
||||
if ($message_insert_status) {
|
||||
$message = 'Claim Initiated Successfully';
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => $message], 200);
|
||||
} else {
|
||||
$message = 'Claim Initiated, Mail Sent Successfully';
|
||||
$this->myLogger->logme('error', "Claim initiated, Mail sent Successfully, Failed to store message:$ticket_id ");
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200);
|
||||
}
|
||||
} else {
|
||||
|
||||
$message = 'Claim Initiated, Failed to send Mail ';
|
||||
$this->myLogger->logme('error', "Claim initiated, Failed to send Mail :$ticket_id ");
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200);
|
||||
}
|
||||
} else {
|
||||
|
||||
$message = 'Claim Initiated, Failed to send Mail ';
|
||||
$this->myLogger->logme('error', "Claim initiated, Failed to send Mail :$ticket_id ");
|
||||
$message = 'Something Went Wrong';
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200);
|
||||
}
|
||||
} else {
|
||||
$message = 'Something Went Wrong';
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1648,7 +1648,7 @@ class EmployeeServiceController extends AdminController
|
||||
// echo 'insert emp';
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$value['emp_status'] = 'active';
|
||||
$value['created_by'] = $file['created_by'];
|
||||
$value['client_branch_id'] = $file['client_branch_id'];
|
||||
@ -2057,6 +2057,8 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||
}
|
||||
$value['family_floater_key'] = $relation;
|
||||
|
||||
// dd($value['family_floater_key']);
|
||||
|
||||
$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['client_policy_id'] = $file['policy_id'];
|
||||
|
||||
@ -12,6 +12,8 @@ use PhpOffice\PhpSpreadsheet\Style\Border;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Fill;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||
|
||||
use App\Models\UserModel;
|
||||
use App\Models\ClientModel;
|
||||
@ -31,7 +33,7 @@ use App\Helpers\MailHelper;
|
||||
use App\Helpers\ExcelMergeHelper;
|
||||
use App\Helpers\ExcelSanitizeHelper;
|
||||
use Google\Service\CloudSearch\PushItem;
|
||||
use Kint;
|
||||
use Kint\Kint;
|
||||
|
||||
use App\Controllers\Jobs;
|
||||
use App\Controllers\JobWorker;
|
||||
@ -64,6 +66,9 @@ class LeadsController extends BaseController
|
||||
protected $clientType;
|
||||
protected $leadType;
|
||||
protected $leadsStatus;
|
||||
protected $claim_type_for_gpa;
|
||||
protected $cause_of_death;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -96,6 +101,19 @@ class LeadsController extends BaseController
|
||||
'completed_with_corrections' => 'Completed with 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()
|
||||
@ -107,6 +125,7 @@ class LeadsController extends BaseController
|
||||
// $d = $this->calculateMembersDemography(['lead_id' => 24]);
|
||||
//$this->mergeQuoteExcelFileWithMembersListExcelFile(24, 1, $propsal_and_insurer = null);
|
||||
// dd($d);
|
||||
|
||||
$data['page_name'] = 'Leads';
|
||||
|
||||
// Set basic data
|
||||
@ -122,7 +141,7 @@ class LeadsController extends BaseController
|
||||
// Fetch insurer and TPA branch data
|
||||
$data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
||||
$data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
|
||||
|
||||
// print_r($data['tpa']);die();
|
||||
// Fetch sales team members who are active in team 5
|
||||
$data['salse_team'] = $this->userModel
|
||||
->select('user_profiles.*')
|
||||
@ -133,12 +152,31 @@ class LeadsController extends BaseController
|
||||
->findAll();
|
||||
|
||||
// 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
|
||||
$data ['lead_data_list'] = $this->leadsModel->getLeadDataForLising();
|
||||
// Load layout and pass data
|
||||
$this->loadLayout('lead_filter', $data);
|
||||
}else{
|
||||
|
||||
// Fetch leads data
|
||||
$data ['lead_data_list'] = $this->leadsModel->getLeadDataForLising();
|
||||
|
||||
// Load layout and pass data
|
||||
$this->loadLayout('leads_list', $data);
|
||||
$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()
|
||||
@ -198,6 +236,8 @@ class LeadsController extends BaseController
|
||||
// Separate the insurer and insurer branch, handle missing or invalid data
|
||||
if (isset($data['insurer'][$index]) && strpos($data['insurer'][$index], '-') !== false) {
|
||||
list($insurer_branch_id, $insurer_id) = explode('-', $data['insurer'][$index]);
|
||||
|
||||
}else{
|
||||
$insurer_branch_id = 0;
|
||||
$insurer_id = 0;
|
||||
}
|
||||
@ -253,7 +293,18 @@ class LeadsController extends BaseController
|
||||
|
||||
$last_3_years_claims = null;
|
||||
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[] = [
|
||||
@ -321,7 +372,7 @@ class LeadsController extends BaseController
|
||||
'notes' => $data['notes'] ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
// print_r($processedData);die();
|
||||
return $processedData;
|
||||
}
|
||||
|
||||
@ -418,7 +469,9 @@ class LeadsController extends BaseController
|
||||
->where('lead_id', $id)
|
||||
// ->where('type', $type)
|
||||
->where('is_active', 1)
|
||||
->orderBy('id', 'desc')
|
||||
->first();
|
||||
// dd($data);
|
||||
|
||||
$data['rfq_count'] = $this->RFQModel
|
||||
->where('lead_id', $id)
|
||||
@ -436,8 +489,15 @@ class LeadsController extends BaseController
|
||||
|
||||
$data['lead_id'] = $id;
|
||||
$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('user_profiles', 'leads.created_by = user_profiles.id', 'left')
|
||||
->where('leads.id', $id)
|
||||
->where('leads.is_active', 1)
|
||||
->first();
|
||||
@ -455,7 +515,21 @@ class LeadsController extends BaseController
|
||||
$data['userList'] = $this->userModel->getUserListForRFQ();
|
||||
$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);
|
||||
$this->loadLayout('view_rfq.php', $data);
|
||||
@ -574,13 +648,13 @@ class LeadsController extends BaseController
|
||||
public function constructExcelToSaveTemp($lead_id, $type, $propsal_and_insurer = null)
|
||||
{
|
||||
$rfq_data = $this->RFQModel->getRFQTableDataWithLeadIDAndType($lead_id, $type);
|
||||
|
||||
|
||||
// dd($rfq_data, $lead_id, $type, $propsal_and_insurer);
|
||||
// print_r($propsal_and_insurer); die;
|
||||
|
||||
if($rfq_data['lead_type'] == 1){
|
||||
if ($rfq_data['lead_type'] == 1) {
|
||||
|
||||
if($rfq_data['policy_type_id'] == 2){
|
||||
if ($rfq_data['policy_type_id'] == 2) {
|
||||
$lead_data = [
|
||||
|
||||
'Insured' => $rfq_data['client_name'],
|
||||
@ -590,23 +664,22 @@ class LeadsController extends BaseController
|
||||
'No of Dependents' => $rfq_data['incept_dept_count'],
|
||||
'Total Lives' => $rfq_data['incept_no_of_lives'],
|
||||
|
||||
'Period of Insurance ' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])).' to '. date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||
'Period of Insurance ' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||
'Policy Run Days' => $rfq_data['policy_run_days'],
|
||||
];
|
||||
}else if($rfq_data['policy_type_id'] == 1){
|
||||
} else if ($rfq_data['policy_type_id'] == 1) {
|
||||
$lead_data = [
|
||||
'Insured' => $rfq_data['client_name'],
|
||||
'No of Employees at Inception' => $rfq_data['incept_emp_count'],
|
||||
'Total Sum Insured at Inception ' => $rfq_data['total_si_at_incept'],
|
||||
'Policy Period' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])).' to '. date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||
'Policy Period' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||
'Policy Status' => $rfq_data['status'],
|
||||
'Existing Insurer' => $rfq_data['insurer_name'],
|
||||
'TPA ' => $rfq_data['tpa_name'],
|
||||
];
|
||||
}
|
||||
|
||||
}else{
|
||||
if($rfq_data['policy_type_id'] == 2){
|
||||
} else {
|
||||
if ($rfq_data['policy_type_id'] == 2) {
|
||||
$lead_data = [
|
||||
|
||||
'Insured' => $rfq_data['client_name'],
|
||||
@ -624,7 +697,7 @@ class LeadsController extends BaseController
|
||||
'No of Dependents at Renewal' => $rfq_data['renewal_dept_count'],
|
||||
'Total Lives at Renewal ' => $rfq_data['renewal_no_of_lives'],
|
||||
|
||||
'Period of Insurance ' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])).' to '. date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||
'Period of Insurance ' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||
'Policy Run Days' => $rfq_data['policy_run_days'],
|
||||
'Inception Premium' => $rfq_data['premium_at_inception'],
|
||||
'Premium as on (Date - DD MM YYYY should be entered based on the claims dump report)' => $rfq_data['premium_date'],
|
||||
@ -634,12 +707,12 @@ class LeadsController extends BaseController
|
||||
'Incurred Claims Ratio' => $rfq_data['incurred_claims_ratio'],
|
||||
'Earned Claims Ratio' => $rfq_data['earned_claims_ratio'],
|
||||
];
|
||||
}else if($rfq_data['policy_type_id'] == 1){
|
||||
} else if ($rfq_data['policy_type_id'] == 1) {
|
||||
$lead_data = [
|
||||
'Insured' => $rfq_data['client_name'],
|
||||
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
|
||||
'Total Sum Insured at Renewal ' => $rfq_data['total_si_at_renewal'],
|
||||
'Policy Period' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])).' to '. date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||
'Policy Period' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||
'Policy Status' => $rfq_data['status'],
|
||||
'Existing Insurer' => $rfq_data['insurer_name'],
|
||||
'TPA ' => $rfq_data['tpa_name'],
|
||||
@ -648,14 +721,15 @@ class LeadsController extends BaseController
|
||||
}
|
||||
|
||||
$data = json_decode($rfq_data['json'], true);
|
||||
// dd($data);
|
||||
|
||||
if($type == 2){
|
||||
if ($type == 2) {
|
||||
$data = $this->convertJsonForQCR($data, $type);
|
||||
if($propsal_and_insurer !== null){
|
||||
if ($propsal_and_insurer !== null) {
|
||||
list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2);
|
||||
$data = $this->transformProposelData($data, $proposal_key, $insurer_key);
|
||||
}
|
||||
}else if($type == 1){
|
||||
} else if ($type == 1) {
|
||||
$data = $this->convertJsonForQCR($data, $type);
|
||||
// dd($data);
|
||||
}
|
||||
@ -663,17 +737,123 @@ class LeadsController extends BaseController
|
||||
$spreadsheet = new Spreadsheet();
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
|
||||
// Start with lead_data at the top
|
||||
$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) {
|
||||
|
||||
// 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("B{$rowNumber}", $value);
|
||||
$sheet->getStyle("A{$rowNumber}")->applyFromArray(['font' => ['bold' => true]]);
|
||||
$sheet->setCellValue("C{$rowNumber}", $value);
|
||||
|
||||
// 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++;
|
||||
}
|
||||
|
||||
$leadRange = "A1:B" . (count($lead_data));
|
||||
$sheet->getStyle($leadRange)->applyFromArray([
|
||||
// Set column width based on max content length (adjusted for padding)
|
||||
$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' => [
|
||||
'allBorders' => [
|
||||
'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;
|
||||
$columnLetter = 'A';
|
||||
|
||||
foreach ($headers as $header) {
|
||||
|
||||
if (in_array($header['parentHeader'], ['Item Key', 'Action'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($header['parentHeader'] === 'Sno') {
|
||||
$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
|
||||
@ -723,6 +907,13 @@ class LeadsController extends BaseController
|
||||
// Add subheaders
|
||||
foreach ($header['subHeaders'] as $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([
|
||||
'font' => ['bold' => true],
|
||||
'alignment' => [
|
||||
@ -746,12 +937,13 @@ class LeadsController extends BaseController
|
||||
]);
|
||||
|
||||
// Increase row height for headers and subheaders
|
||||
$sheet->getRowDimension($rowNumber)->setRowHeight(30); // Header row height
|
||||
$sheet->getRowDimension($subHeaderRow)->setRowHeight(25); // Subheader row height
|
||||
$sheet->getRowDimension($rowNumber)->setRowHeight(25); // Header row height
|
||||
$sheet->getRowDimension($subHeaderRow)->setRowHeight(20); // Subheader row height
|
||||
|
||||
$rowNumber = $subHeaderRow + 2;
|
||||
$column_data = $data['table_data']['data'];
|
||||
$serial_no = 1;
|
||||
$maxColumnWidths = [];
|
||||
|
||||
// Add table data rows
|
||||
foreach ($column_data as $dataRow) {
|
||||
@ -789,6 +981,7 @@ class LeadsController extends BaseController
|
||||
$rowNumber += 2;
|
||||
|
||||
// Add premium data
|
||||
// dd($data);
|
||||
$labelArray = ["Premium", "GST (%)", "GST Amount (₹)", "Total"];
|
||||
$premiumData = $data['premium_data']['data'];
|
||||
$premium = [$labelArray[0]];
|
||||
@ -797,7 +990,7 @@ class LeadsController extends BaseController
|
||||
$total = [$labelArray[3]];
|
||||
|
||||
foreach ($premiumData as $proposal => $insurers) {
|
||||
if($proposal != 'Particulars'){
|
||||
if ($proposal != 'Particulars') {
|
||||
foreach ($insurers as $insurer => $values) {
|
||||
$premium[] = $values[$labelArray[0]];
|
||||
$gst[] = $values[$labelArray[1]];
|
||||
@ -819,7 +1012,8 @@ class LeadsController extends BaseController
|
||||
$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([
|
||||
'borders' => [
|
||||
'allBorders' => [
|
||||
@ -831,10 +1025,53 @@ class LeadsController extends BaseController
|
||||
}
|
||||
|
||||
// Auto-size columns
|
||||
foreach ($sheet->getColumnIterator() as $column) {
|
||||
$sheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true);
|
||||
// foreach ($sheet->getColumnIterator() as $column) {
|
||||
// $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
|
||||
$string = ($type == 2) ? 'QCR' : 'RFQ';
|
||||
$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);
|
||||
$reply_to = $lead_data['created_person_email'];
|
||||
$reply_to = $lead_data['created_person_email'] ?? "";
|
||||
|
||||
//get file path to attach
|
||||
$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'] != '') {
|
||||
$temp_file_path = $file_info['filePath'];
|
||||
$temp_file_name = $file_info['fileName'];
|
||||
@ -1422,8 +1660,11 @@ class LeadsController extends BaseController
|
||||
$result = ExcelMergeHelper::mergeExcelFiles($filePaths, $outputPath);
|
||||
// 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);
|
||||
// $file_path = WRITEPATH."uploads/excel/sample/correction.xls";
|
||||
// $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) ?? '--';
|
||||
|
||||
// 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);
|
||||
$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');
|
||||
// // $params = $this->request->getGet();
|
||||
|
||||
// // print_r($params); die;
|
||||
// // $lead_id = $params['lead_id'];
|
||||
// // $file_type = $params['file_type']; //rfq or qcr
|
||||
// // $recipient_type = $params['recipient_type']; //insurer or client or internal or placement
|
||||
// // $recipient_mail = $params['recipient_mail']; // - only primary key of contacts
|
||||
// // $propsal_and_insurer = isset($params['proposal_insurer']) ? $params['proposal_insurer'] : null;
|
||||
|
||||
// // if ($recipient_type == 'insurer' && empty($recipient_mail)) {
|
||||
// // 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 '';
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// }
|
||||
|
||||
public function transformMailContent($lead_data, $mail_content, $page_name)
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
// $params = $this->request->getGet();
|
||||
$current_year = date('Y');
|
||||
$next_year = $current_year + 1;
|
||||
$policy_year = "$current_year-$next_year";
|
||||
|
||||
// print_r($params); die;
|
||||
// $lead_id = $params['lead_id'];
|
||||
// $file_type = $params['file_type']; //rfq or qcr
|
||||
// $recipient_type = $params['recipient_type']; //insurer or client or internal or placement
|
||||
// $recipient_mail = $params['recipient_mail']; // - only primary key of contacts
|
||||
// $propsal_and_insurer = isset($params['proposal_insurer']) ? $params['proposal_insurer'] : null;
|
||||
if ($lead_data) {
|
||||
|
||||
// Replacing placeholders with actual values
|
||||
$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);
|
||||
|
||||
// if ($recipient_type == 'insurer' && empty($recipient_mail)) {
|
||||
// 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>';
|
||||
|
||||
$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;
|
||||
|
||||
}else{
|
||||
|
||||
// return $this->respond(['status' => false, 'code' => 404, 'message' => "This lead has not data"], 200);
|
||||
return '';
|
||||
} else {
|
||||
return ''; // Return empty if no lead data found
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function getLastFiveFinancialYears() {
|
||||
$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;
|
||||
}
|
||||
|
||||
if($this->request->getPost('is_multi_event')){
|
||||
$data['is_multi_event'] = 1;
|
||||
}
|
||||
|
||||
$data['created_by'] = get_session_userid();
|
||||
$data['insurer_logo'] = $file_name;
|
||||
|
||||
@ -371,6 +375,12 @@ class MasterController extends AdminController
|
||||
$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);
|
||||
if($update){
|
||||
echo json_encode(array("status" => true , 'data' => $data));
|
||||
@ -1723,7 +1733,8 @@ class MasterController extends AdminController
|
||||
'excel' => WRITEPATH . 'uploads/excel/',
|
||||
'statements' => WRITEPATH . 'uploads/statements/',
|
||||
'import_excel' => WRITEPATH . 'uploads/import_excel/',
|
||||
'logs' => WRITEPATH . 'uploads/logs/',
|
||||
'logs' => WRITEPATH . 'logs',
|
||||
'session' => WRITEPATH . 'session',
|
||||
'client_kyc_documents' => WRITEPATH . 'uploads/client_kyc_documents/',
|
||||
'tmp' => WRITEPATH . 'tmp/',
|
||||
'e_card_imgs' => ROOTPATH . 'public/e_card_imgs',
|
||||
@ -1732,8 +1743,10 @@ class MasterController extends AdminController
|
||||
'logo' => ROOTPATH . 'public/uploads/logo/',
|
||||
'template_bg' => ROOTPATH . 'public/uploads/template_bg/',
|
||||
'attachments' => WRITEPATH . 'uploads/attachments/',
|
||||
'cache' => WRITEPATH . 'cache',
|
||||
'sample_import_excel' => ROOTPATH . 'public/sample_import_excel',
|
||||
'lead_files' => WRITEPATH . 'uploads/lead_files/',
|
||||
'claim_sample_forms' => ROOTPATH . 'public/claim_sample_forms/',
|
||||
];
|
||||
|
||||
foreach ($folders as $folderName => $folderPath) {
|
||||
|
||||
@ -274,7 +274,7 @@ class PolicyTransactionController extends BaseController
|
||||
// Separate Insurer and TPA Branch IDs and IDs
|
||||
if(isset($data['insurer_id']) && !empty($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']);
|
||||
}
|
||||
}
|
||||
@ -414,9 +414,13 @@ class PolicyTransactionController extends BaseController
|
||||
// Prepare data for insertion and updating
|
||||
$coShareDetails = [];
|
||||
|
||||
// print_r($data);
|
||||
// print_r($data); 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'])){
|
||||
|
||||
foreach ($data['follow_insurer_id'] as $index => $insurer) {
|
||||
@ -429,7 +433,7 @@ class PolicyTransactionController extends BaseController
|
||||
'pt_id' => $pt_id,
|
||||
'insurer_id' => $insurer_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,
|
||||
'bp_amt' => $data['base_premium'][$index] ?? 0,
|
||||
'bp_gst_amt' => $data['gst_amount'][$index] ?? 0,
|
||||
@ -438,6 +442,8 @@ class PolicyTransactionController extends BaseController
|
||||
'bp_cgst' => $data['cgst'][$index] ?? 0,
|
||||
'tp_amt' => $data['tp_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_bp_per' => $data['agreed_bp'][$index] ?? 0,
|
||||
'agreed_tp_per' => $data['agreed_tp'][$index] ?? 0,
|
||||
@ -499,7 +505,7 @@ class PolicyTransactionController extends BaseController
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// print_r($data);
|
||||
// die;
|
||||
}
|
||||
@ -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
|
||||
@ -1040,6 +1063,7 @@ class PolicyTransactionController extends BaseController
|
||||
{
|
||||
$id = $this->request->getPost('id');
|
||||
$data = $this->preparePolicyTransactionData();
|
||||
// print_r($data); die;
|
||||
|
||||
if (!$id) {
|
||||
return $this->insertEndorsementTransaction($data);
|
||||
@ -1056,25 +1080,12 @@ class PolicyTransactionController extends BaseController
|
||||
// print_r($data);
|
||||
// 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'])) {
|
||||
$data['policy_with_corr'] = 0;
|
||||
} elseif ($data['policy_with_corr']) {
|
||||
$data['policy_with_corr'] = 1;
|
||||
}
|
||||
|
||||
|
||||
if(empty($data['data_received_date'])){
|
||||
$data['data_received_date'] = null;
|
||||
}else{
|
||||
@ -1117,7 +1128,7 @@ class PolicyTransactionController extends BaseController
|
||||
// Separate Insurer and TPA Branch IDs and IDs
|
||||
if(isset($data['insurer_id']) && !empty($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']);
|
||||
}
|
||||
}
|
||||
@ -1246,7 +1257,7 @@ class PolicyTransactionController extends BaseController
|
||||
public function getEndorsementDataForEdit($id)
|
||||
{
|
||||
$data = $this->policyTransactionModel
|
||||
->select('
|
||||
->select('
|
||||
policy_transaction.*,
|
||||
clients.short_name as client_short_name,
|
||||
clients.client_type,
|
||||
@ -1260,52 +1271,43 @@ class PolicyTransactionController extends BaseController
|
||||
|
||||
) as last_action_date
|
||||
')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id')
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
->where('policy_transaction.id', $id)
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->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;
|
||||
->join('clients', 'clients.id = policy_transaction.client_id')
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
->where('policy_transaction.id', $id)
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->orderBy('id', 'asc')
|
||||
->first();
|
||||
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
if(!empty($data['policy_end_date'])){
|
||||
if (!empty($data['policy_end_date'])) {
|
||||
$data['policy_end_date'] = change_date_format($data['policy_end_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if(!empty($data['data_received_date'])){
|
||||
if (!empty($data['data_received_date'])) {
|
||||
$data['data_received_date'] = change_date_format($data['data_received_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if(!empty($data['policy_issue_date'])){
|
||||
if (!empty($data['policy_issue_date'])) {
|
||||
$data['policy_issue_date'] = change_date_format($data['policy_issue_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if(!empty($data['endorse_eff_date'])){
|
||||
if (!empty($data['endorse_eff_date'])) {
|
||||
$data['endorse_eff_date'] = change_date_format($data['endorse_eff_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if(!empty($data['install_due_date'])){
|
||||
if (!empty($data['install_due_date'])) {
|
||||
$data['install_due_date'] = change_date_format($data['install_due_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if(!empty($data['last_action_date'])){
|
||||
if (!empty($data['last_action_date'])) {
|
||||
$data['last_action_date'] = change_date_format($data['last_action_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if(!empty($data['month'])){
|
||||
if (!empty($data['month'])) {
|
||||
$data['month'] = change_date_format($data['month'], 'Y-m-d', 'M/Y');
|
||||
}
|
||||
|
||||
@ -1314,7 +1316,7 @@ class PolicyTransactionController extends BaseController
|
||||
//get PT Co-Share Details
|
||||
$data['pt_co_share_details'] = $this->PTCOShareDetailsModel
|
||||
|
||||
->select("
|
||||
->select("
|
||||
pt_co_share_details.*,
|
||||
|
||||
(
|
||||
@ -1430,19 +1432,18 @@ class PolicyTransactionController extends BaseController
|
||||
) AS actual_tep_brokerage_amount
|
||||
|
||||
")
|
||||
->where('pt_id', $id)
|
||||
->where('is_active', 1)
|
||||
->orderBy('id', 'asc')
|
||||
->findAll();
|
||||
->where('pt_id', $id)
|
||||
->where('is_active', 1)
|
||||
->orderBy('id', 'asc')
|
||||
->findAll();
|
||||
|
||||
// print_r($data['endorse_eff_date']); die;
|
||||
|
||||
if($data){
|
||||
if ($data) {
|
||||
return $this->respond(['status' => true, 'data' => $data], 200);
|
||||
}else{
|
||||
} else {
|
||||
return $this->respond(['status' => false], 200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
@ -1584,8 +1585,15 @@ class PolicyTransactionController extends BaseController
|
||||
->where('policy_transaction.action_type', 'inception')
|
||||
->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) {
|
||||
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 {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to get data'], 200);
|
||||
}
|
||||
@ -2700,7 +2708,7 @@ class PolicyTransactionController extends BaseController
|
||||
// Build query
|
||||
$db = db_connect();
|
||||
$builder = $db->table("cash_deposit")
|
||||
->where('cd_ac_no', $cd_ac_no)
|
||||
->where('cd_ac_pk', $cd_ac_no)
|
||||
->where('is_active', 1)
|
||||
->orderBy('id', 'desc')
|
||||
->limit(1);
|
||||
@ -2715,6 +2723,8 @@ class PolicyTransactionController extends BaseController
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'data' => $result,
|
||||
'base_premium' => $base_premium,
|
||||
'cd_ac_no' => $cd_ac_no,
|
||||
'base_premium_greater_than_balance' => $base_premium_greater_than_balance,
|
||||
], 200);
|
||||
}
|
||||
|
||||
@ -71,13 +71,20 @@ class RestAuthenticationController extends AdminController
|
||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||
|
||||
|
||||
$employeeData = $this->employeeModel->where('mobile', $mobile_number)
|
||||
->where('relationship', 'self')
|
||||
->where('emp_status !=', 'truncated')
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
$employeeData = $this->employeeModel->select('employees.relationship,EP.employee_id')
|
||||
->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.mobile', $mobile_number)
|
||||
->where('EP.is_active', 1)
|
||||
->whereIn('EP.status', ['active'])
|
||||
->first();
|
||||
|
||||
|
||||
|
||||
if ($employeeData) {
|
||||
if (isset($employeeData['employee_id']))
|
||||
{
|
||||
|
||||
$result = ['user_verification' => true ,'message' => "Verified Successfully"];
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
@ -95,63 +102,68 @@ class RestAuthenticationController extends AdminController
|
||||
{
|
||||
try {
|
||||
$email = $this->request->getJSON()->email;
|
||||
|
||||
|
||||
$employeeData = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'self')
|
||||
->where('emp_status !=', 'truncated')->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
if ($employeeData) {
|
||||
|
||||
$employeeData = $this->employeeModel->select('
|
||||
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();
|
||||
|
||||
if (isset($employeeData['employee_id'])) {
|
||||
|
||||
$otp = random_int(100000, 999999);
|
||||
|
||||
$update = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'self')
|
||||
->where('is_active', 1)->set(array('otp' => $otp ))
|
||||
->update();
|
||||
if($update)
|
||||
{
|
||||
$update = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'Self')
|
||||
->where('is_active', 1)->set(array('otp' => $otp))
|
||||
->update();
|
||||
if ($update) {
|
||||
|
||||
$common = [
|
||||
'client_id' => $employeeData['client_id'],
|
||||
'client_branch_id' => $employeeData['client_branch_id'],
|
||||
'client_policy_id' => null,
|
||||
'employee_policy_id' => null,
|
||||
'employee_id' => $employeeData['id'],
|
||||
'employee_id' => $employeeData['employee_id'],
|
||||
'mail_type' => 'otp_mail',
|
||||
];
|
||||
];
|
||||
$subject = 'Nhance user verification - OTP';
|
||||
$mail_content = $otp.' is your verification code for Nhance.';
|
||||
$res = MailHelper::send_email(['mail' => $employeeData['email_corporate'], 'subject' => $subject ,'common'=>$common ,'message' => $mail_content]);
|
||||
$mail_content = $otp . ' is your verification code for Nhance.';
|
||||
$res = MailHelper::send_email(['mail' => $employeeData['email_corporate'], 'subject' => $subject, 'common' => $common, 'message' => $mail_content]);
|
||||
$this->myLogger->logme("info", $res);
|
||||
|
||||
if(json_decode($res)->status == 'success')
|
||||
{
|
||||
$result = ['user_verification' => true ,'message' => "Verified Successfully"];
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
|
||||
}else{
|
||||
$result = ['user_verification' => false , 'message' => "Mail sending failed , try again"];
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
|
||||
if (json_decode($res)->status == 'success') {
|
||||
$result = ['user_verification' => true, 'message' => "Verified Successfully"];
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
||||
} else {
|
||||
$result = ['user_verification' => false, 'message' => "Mail sending failed , try again"];
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||
}
|
||||
} else {
|
||||
|
||||
}else{
|
||||
|
||||
$result = ['user_verification' => false , 'message' => "Verification failed , try again"];
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
|
||||
|
||||
$result = ['user_verification' => false, 'message' => "Verification failed , try again"];
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$result = ['user_verification' => false , 'message' => "User not found"];
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
|
||||
|
||||
$result = ['user_verification' => false, 'message' => "User not found"];
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $th], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getVerifiedUserData()
|
||||
{
|
||||
|
||||
@ -12,13 +12,16 @@ use App\Models\TicketMailTemplateModel;
|
||||
use App\Models\TicketMessageModel;
|
||||
use App\Models\TicketNoteModel;
|
||||
use App\Models\UserModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
|
||||
use DOMDocument;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Kint\Kint;
|
||||
use App\Models\EmployeeModel;
|
||||
|
||||
use App\Helpers\MailHelper;
|
||||
|
||||
use App\Models\InsurerModel;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
class TicketController extends BaseController
|
||||
@ -26,13 +29,15 @@ class TicketController extends BaseController
|
||||
use ResponseTrait;
|
||||
|
||||
protected $myLogger;
|
||||
protected $ticketType;
|
||||
protected $priorityType;
|
||||
protected $relationshipType;
|
||||
protected $modeOFIntimate;
|
||||
protected $claimType;
|
||||
protected $claimStatus;
|
||||
protected $placeHolders;
|
||||
public $ticketType;
|
||||
public $priorityType;
|
||||
public $relationshipType;
|
||||
public $modeOFIntimate;
|
||||
public $claimType;
|
||||
public $claimStatus;
|
||||
public $placeHolders;
|
||||
public $extraFields;
|
||||
public $nonIDReason;
|
||||
|
||||
protected $clientModel;
|
||||
protected $ticketMasterModel;
|
||||
@ -43,6 +48,8 @@ class TicketController extends BaseController
|
||||
protected $triggerType;
|
||||
protected $userModel;
|
||||
protected $employeeModel;
|
||||
protected $clientPolicyModel;
|
||||
protected $employeePolicyModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -73,14 +80,15 @@ class TicketController extends BaseController
|
||||
1 => "In Person",
|
||||
2 => "Courier",
|
||||
3 => "Online Mode - Email",
|
||||
4 => "Online Mode - To TPA"
|
||||
4 => "Smart Service Desk",
|
||||
5 => "Direct to TPA"
|
||||
];
|
||||
$this->claimType = [
|
||||
1 => [
|
||||
1 => "Main",
|
||||
1 => "Main Hospitalization",
|
||||
3 => "Pre / Post",
|
||||
2 => "OPD",
|
||||
3 => "Pre ReOpen",
|
||||
4 => "Post ReOpen",
|
||||
4 => "ReOpen",
|
||||
],
|
||||
2 => [
|
||||
1 => "TTD",
|
||||
@ -96,7 +104,8 @@ class TicketController extends BaseController
|
||||
4 => "Trigger 4",
|
||||
5 => "Trigger 5",
|
||||
6 => "Trigger 6",
|
||||
7 => "Trigger 7"
|
||||
7 => "Trigger 7",
|
||||
8 => "Trigger 8",
|
||||
];
|
||||
$this->placeHolders = [
|
||||
|
||||
@ -110,6 +119,39 @@ class TicketController extends BaseController
|
||||
'((RELATIONSHIP))' => 'relationship',
|
||||
'((POLICY_TYPE))' => 'policy_type',
|
||||
'((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();
|
||||
@ -121,6 +163,8 @@ class TicketController extends BaseController
|
||||
$this->ticketMessageModel = new TicketMessageModel();
|
||||
$this->userModel = new UserModel();
|
||||
$this->employeeModel = new EmployeeModel();
|
||||
$this->clientPolicyModel = new ClientPolicyModel();
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
}
|
||||
|
||||
public function ticketList()
|
||||
@ -260,7 +304,7 @@ class TicketController extends BaseController
|
||||
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");
|
||||
|
||||
@ -270,7 +314,8 @@ class TicketController extends BaseController
|
||||
'ticket_type' => $this->ticketType,
|
||||
'priorityType' => $this->priorityType,
|
||||
'relationshipType' => $this->relationshipType,
|
||||
'modeOFIntimate' => $this->modeOFIntimate
|
||||
'modeOFIntimate' => $this->modeOFIntimate,
|
||||
'nonIDReason' => $this->nonIDReason
|
||||
];
|
||||
|
||||
switch ($ticket_type) {
|
||||
@ -294,11 +339,23 @@ class TicketController extends BaseController
|
||||
->getResultArray();
|
||||
|
||||
// Fetch Claim Status
|
||||
$data['claim_status'] = $this->claimStatus
|
||||
->select('*')
|
||||
->where(['is_active' => 1, 'ticket_type' => $ticket_type])
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
if(empty($claim_status_id)){
|
||||
|
||||
if($ticket_type == 2){
|
||||
$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) {
|
||||
$data['claim_type'] = $this->claimType[1];
|
||||
@ -311,19 +368,90 @@ class TicketController extends BaseController
|
||||
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)
|
||||
{
|
||||
// $ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first();
|
||||
$ticket_data = $this->ticketMasterModel->getTicketDataByTicketID($ticket_id);
|
||||
$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);
|
||||
$template_data = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id);
|
||||
if (!empty($template_data)) {
|
||||
$template_data['mail_content'] = $this->replacePlaceholders($template_data['mail_content'], $ticket_data);
|
||||
$template_data['subject'] = $this->replacePlaceholders($template_data['subject'], $ticket_data);
|
||||
}
|
||||
$data = $this->ticket_form_data($ticket_data['ticket_type_id']);
|
||||
$data['ticket_data'] = $ticket_data;
|
||||
$data = $this->ticket_form_data($ticket_data['ticket_type_id'], $ticket_data['claim_status_id']);
|
||||
$data['reply_data'] = $template_data;
|
||||
$data['placeHolders'] = $this->placeHolders;
|
||||
$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['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();
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -430,6 +571,7 @@ class TicketController extends BaseController
|
||||
{
|
||||
$ticket_data = $this->request->getPost();
|
||||
$ticket_data = $this->formatDateForClaim($ticket_data);
|
||||
// $ticket_data = $this->getLastMatchedStatus($ticket_data, );
|
||||
// print_rr($ticket_data); die;
|
||||
|
||||
if ($ticket_data) {
|
||||
@ -451,6 +593,7 @@ class TicketController extends BaseController
|
||||
$ticket_id = $this->request->getPost('ticket_master_id');
|
||||
$ticket_data = $this->request->getPost();
|
||||
$ticket_data = $this->formatDateForClaim($ticket_data);
|
||||
$ticket_data['claim_status_id'] = $this->getLastMatchedStatus($ticket_data);
|
||||
// print_rr($ticket_data); die;
|
||||
$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);
|
||||
|
||||
//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);
|
||||
}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);
|
||||
@ -482,6 +629,17 @@ class TicketController extends BaseController
|
||||
$data['policy_type'] = $this->ticketType;
|
||||
$data['placeHolders'] = $this->placeHolders;
|
||||
$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['trigger_type'] = $this->triggerType;
|
||||
return $this->loadLayout('ticket_mail_template', $data);
|
||||
@ -510,6 +668,21 @@ class TicketController extends BaseController
|
||||
} elseif ($action == 2) {
|
||||
$table_id = (int)$this->request->getPost('id');
|
||||
$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) {
|
||||
return $this->respond(['status' => true, 'data' => $data], 200);
|
||||
} else {
|
||||
@ -635,6 +808,13 @@ class TicketController extends BaseController
|
||||
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));
|
||||
|
||||
// Generate Email Content
|
||||
@ -687,8 +867,10 @@ class TicketController extends BaseController
|
||||
$replaceData = $ticket_data[$value] ?? '';
|
||||
} else if ($value == "policy_type") {
|
||||
$replaceData = str_replace("Claim-", "", $this->ticketType[$ticket_data['ticket_type_id']] ?? "");
|
||||
} else {
|
||||
$replaceData = isset($ticket_data[$value]) ? strtoupper($ticket_data[$value]) : '';
|
||||
} 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 {
|
||||
$replaceData = isset($ticket_data[$value]) ? $ticket_data[$value] : '';
|
||||
}
|
||||
|
||||
$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
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
$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 = json_decode($res);
|
||||
@ -224,13 +224,22 @@ class ChatbotHelper
|
||||
}
|
||||
|
||||
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'];
|
||||
log_message('error','emp_id'.$emp_id);
|
||||
$emp_code = $chat_session_info['emp_code'];
|
||||
$client_id = $chat_session_info['client_id'];
|
||||
$client_branch_id = $chat_session_info['client_branch_id'];
|
||||
|
||||
$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('ticket_claim_status tcs',"ticket_master.claim_status_id = tcs.id and tcs.is_active = 1")
|
||||
->where('ticket_master.emp_id',$emp_id)
|
||||
@ -238,14 +247,38 @@ class ChatbotHelper
|
||||
->where('ticket_master.is_active',1)
|
||||
->orderBy('ticket_master.created_at', 'DESC')
|
||||
->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();
|
||||
|
||||
if (!empty($data)){
|
||||
if (!empty($data) && !empty($matched_key)){
|
||||
$ticket_id = $data['id'];
|
||||
$mail_content = $ticket_controller->constructMailContent($ticket_id);
|
||||
$mail_response = $ticket_controller->sendTrigger($mail_content);
|
||||
return $data;
|
||||
$mail_content = Self::ReimbursementStatusMailTemplate($data['emp_name'],$data['claim_number'],$matched_key);
|
||||
$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;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}else{
|
||||
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'],
|
||||
'balance' => $newBalance, // Include the new balance in the data array
|
||||
'cd_ac_pk'=> isset($data['cd_ac_pk'])?$data['cd_ac_pk']:null,
|
||||
'record_date' => $data['record_date'] ?? null
|
||||
];
|
||||
|
||||
// Insert data and get the insert ID
|
||||
|
||||
@ -682,7 +682,7 @@ if (!function_exists('generate_relationship_code'))
|
||||
$slug = \Config\Services::slug();
|
||||
$relationship_code = $slug->slugify($arr['relationship']);
|
||||
$emp_type_code = ($relationship_code == 'self' ? 'EMP_TYP_01' : 'EMP_TYP_03');
|
||||
$relationship_code = $gender[ $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];
|
||||
}
|
||||
}
|
||||
@ -2173,20 +2173,21 @@ if(!function_exists('group_slab_rates_basedon_name'))
|
||||
|
||||
|
||||
//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)
|
||||
{
|
||||
if (strtolower(trim($relationship)) === 'mother' || strtolower(trim($relationship)) === 'father') {
|
||||
$relation = 'parent';
|
||||
} else if(strtolower(trim($relationship)) === 'son' || strtolower(trim($relationship)) === 'daughter'){
|
||||
$relation = 'child';
|
||||
}else if(strtolower(trim($relationship)) === 'father in Law' || strtolower(trim($relationship)) === 'mother in Law'){
|
||||
$relation = 'parent_in_law';
|
||||
}else if(strtolower(trim($relationship)) === 'spouse'){
|
||||
$relation = 'spouse';
|
||||
}else{
|
||||
$relation = 'self';
|
||||
}
|
||||
$relation = 'parent';
|
||||
} else if (strtolower(trim($relationship)) === 'son' || strtolower(trim($relationship)) === 'daughter') {
|
||||
$relation = 'child';
|
||||
} else if (strtolower(trim($relationship)) === 'father in Law' || strtolower(trim($relationship)) === 'mother in Law') {
|
||||
$relation = 'parent_in_law';
|
||||
} else if (strtolower(trim($relationship)) === 'spouse') {
|
||||
$relation = 'spouse';
|
||||
} else {
|
||||
$relation = 'self';
|
||||
}
|
||||
|
||||
return $relation;
|
||||
}
|
||||
}
|
||||
@ -1247,7 +1247,7 @@ class sendMailNotification
|
||||
$subject = $notification['subject'];
|
||||
|
||||
$rand_string = 'HX3kUh';
|
||||
$link = generate_download_link($rand_string);
|
||||
$link = generate_download_link($rand_string).'/1';
|
||||
|
||||
$name = 'John Doe';
|
||||
$mobile = 9080706050;
|
||||
|
||||
@ -27,7 +27,8 @@ class ClientDepositModel extends Model
|
||||
"endorsement_no",
|
||||
"event_name",
|
||||
"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')
|
||||
->where('client_id', $clientId)
|
||||
->where('insurer_id', $insurerId)
|
||||
->where('cash_deposit.is_active', 1)
|
||||
->get()
|
||||
->getRow();
|
||||
}
|
||||
|
||||
@ -149,7 +149,21 @@ class EmployeeModel extends Model
|
||||
{
|
||||
|
||||
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('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
->where('client_policy.policy_status', 1)
|
||||
@ -240,9 +254,9 @@ class EmployeeModel extends Model
|
||||
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.name AS emp_name,
|
||||
employees.emp_code,
|
||||
@ -255,10 +269,39 @@ class EmployeeModel extends Model
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
|
||||
->where('employees.is_active', 1)
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employees.emp_code', $emp_code)
|
||||
->groupBy('employees.id')
|
||||
->findAll();
|
||||
->where('employees.emp_code', $emp_code);
|
||||
|
||||
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 (
|
||||
SELECT
|
||||
emp_code,
|
||||
group_key,
|
||||
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,
|
||||
@ -902,7 +901,7 @@ class EmployeePolicyModel extends Model
|
||||
group_key
|
||||
|
||||
) 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
|
||||
(
|
||||
@ -1682,7 +1681,10 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
// reverse the employee policy table data for the truncated the deletion file
|
||||
public function updateEmployeePolicyTruncateReverse($file_id)
|
||||
{
|
||||
{
|
||||
log_message('error', 'updateEmployeePolicyTruncateReverse model function called');
|
||||
log_message('error', 'FILE ID : {data}', ['data' => $file_id]);
|
||||
|
||||
$this->db->query("
|
||||
UPDATE employee_polices
|
||||
SET
|
||||
@ -1690,7 +1692,7 @@ class EmployeePolicyModel extends Model
|
||||
status = 'active',
|
||||
date_of_exit = NULL,
|
||||
reason_for_exit = NULL,
|
||||
claim_status = 0,
|
||||
claim_status = 0
|
||||
WHERE
|
||||
id IN (
|
||||
SELECT pk
|
||||
|
||||
@ -120,10 +120,10 @@ class LeadsModel extends Model
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getLeadDataForLising()
|
||||
public function getLeadDataForLising($where = null)
|
||||
{
|
||||
|
||||
return $this->select('
|
||||
$data = $this->select('
|
||||
leads.*,
|
||||
kyc_entity_type.name as entity_type,
|
||||
policy_type.policy_type,
|
||||
@ -144,13 +144,16 @@ class LeadsModel extends Model
|
||||
|
||||
) AS rfq_count
|
||||
')
|
||||
->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('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
|
||||
->where('leads.is_active', 1)
|
||||
->orderBy('id', 'desc')
|
||||
->findAll();
|
||||
->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('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
|
||||
->where('leads.is_active', 1);
|
||||
|
||||
if (!empty($where)) {
|
||||
$data->where($where);
|
||||
}
|
||||
|
||||
return $data->orderBy('leads.id', 'desc')->findAll();
|
||||
}
|
||||
|
||||
public function getLeadForInsertClientList($type = null, $client_id = null)
|
||||
|
||||
@ -66,6 +66,8 @@ class PTCOShareDetailsModel extends Model
|
||||
'statement_id',
|
||||
'follower_policy_no',
|
||||
'non_comm_per_amt',
|
||||
'cotp_amt',
|
||||
'cotep_amt',
|
||||
];
|
||||
|
||||
public function getNonReconcileredPolicyTransactions(string $insurer_id,string $insurer_branch_id)
|
||||
|
||||
@ -318,6 +318,280 @@ class PolicyTransactionModel extends Model
|
||||
|
||||
// BDS Report NEW Functin for QUERY
|
||||
// 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)
|
||||
{
|
||||
|
||||
@ -365,19 +639,19 @@ class PolicyTransactionModel extends Model
|
||||
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.cop_amt as 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((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,
|
||||
|
||||
@ -501,8 +775,8 @@ class PolicyTransactionModel extends Model
|
||||
->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', 'policy_transaction.insurer_id = insurers.id', 'left')
|
||||
->join('insurer_branch', 'policy_transaction.insurer_branch_id = insurer_branch.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')
|
||||
@ -591,9 +865,89 @@ class PolicyTransactionModel extends Model
|
||||
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)
|
||||
{
|
||||
// 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.*,
|
||||
@ -607,7 +961,8 @@ class PolicyTransactionModel extends Model
|
||||
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
|
||||
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('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||
@ -618,59 +973,44 @@ class PolicyTransactionModel extends Model
|
||||
->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);
|
||||
// Optimize Date Filtering
|
||||
if (!empty($start_date) && !empty($end_date) && !empty($date_type)) {
|
||||
$builder->where("policy_transaction.$date_type >=", date('Y-m-d 00:00:00', strtotime($start_date)))
|
||||
->where("policy_transaction.$date_type <=", date('Y-m-d 23:59:59', strtotime($end_date)));
|
||||
}
|
||||
|
||||
if ($client_id != 0) {
|
||||
// Apply Filters Only When Necessary
|
||||
if (!empty($client_id)) {
|
||||
$builder->where('policy_transaction.client_id', $client_id);
|
||||
}
|
||||
|
||||
if ($insurer_id != 0) {
|
||||
if (!empty($insurer_id)) {
|
||||
$builder->where('policy_transaction.insurer_id', $insurer_id);
|
||||
}
|
||||
|
||||
if ($policy_type_id != 0) {
|
||||
if (!empty($policy_type_id)) {
|
||||
$builder->where('client_policy.policy_type_id', $policy_type_id);
|
||||
}
|
||||
|
||||
if ($issuer != 0) {
|
||||
if (!empty($issuer)) {
|
||||
$builder->where('policy_transaction.issuer', $issuer);
|
||||
}
|
||||
if ($status != 0) {
|
||||
if (!empty($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'));
|
||||
$toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
|
||||
$builder->where('policy_transaction.created_at >=', $fromDate)
|
||||
->where('policy_transaction.created_at <=', $toDate);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Optimize Query Execution
|
||||
$builder->orderBy('policy_transaction.id', 'desc');
|
||||
|
||||
$result = $builder->get()->getResultArray();
|
||||
|
||||
// dd($this->db->getLastQuery());
|
||||
|
||||
return $result;
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
@ -761,7 +1101,7 @@ class PolicyTransactionModel extends Model
|
||||
|
||||
pt_co_share_details.exp_amt,
|
||||
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(
|
||||
(
|
||||
SELECT
|
||||
@ -779,7 +1119,7 @@ class PolicyTransactionModel extends Model
|
||||
) AS statement_premium,
|
||||
|
||||
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(
|
||||
(
|
||||
|
||||
@ -77,6 +77,7 @@ class RFQModel extends Model
|
||||
->where('rfq.lead_id', $lead_id)
|
||||
// ->where('rfq.type', $type)
|
||||
->where('rfq.is_active', 1)
|
||||
->orderBy('rfq.id', 'desc')
|
||||
->first();
|
||||
|
||||
}
|
||||
|
||||
@ -64,7 +64,18 @@ class TicketMasterModel extends Model
|
||||
'utr_details',
|
||||
'settle_letter',
|
||||
'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'
|
||||
|
||||
];
|
||||
|
||||
|
||||
// Callbacks
|
||||
@ -118,14 +129,20 @@ class TicketMasterModel extends Model
|
||||
public function getTemplateDataByTicketID($ticket_id)
|
||||
{
|
||||
$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_mail_template', '
|
||||
ticket_claim_status.trigger_type = ticket_mail_template.trigger_type
|
||||
and ticket_claim_status.ticket_type = ticket_mail_template.ticket_type
|
||||
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.is_active', 1)
|
||||
->where('ticket_claim_status.is_active', 1)
|
||||
->first();
|
||||
|
||||
return $template_data;
|
||||
@ -135,6 +152,11 @@ class TicketMasterModel extends Model
|
||||
{
|
||||
$ticket_data = $this->select("
|
||||
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.mobile as acm_mobile,
|
||||
@ -152,6 +174,7 @@ class TicketMasterModel extends Model
|
||||
->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('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.is_active', 1)
|
||||
->first();
|
||||
@ -659,5 +682,27 @@ class TicketMasterModel extends Model
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
//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) {
|
||||
botmanChatWidget.open();
|
||||
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');
|
||||
},3000);
|
||||
|
||||
|
||||
@ -202,6 +202,7 @@ table.dataTable thead th {
|
||||
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
|
||||
@ -46,6 +46,38 @@
|
||||
|
||||
</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 ?>
|
||||
|
||||
<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_history(this, '<?= $employee['employee_id'];?>')" > <i class="mdi mdi-history mr-2 text-muted font-18 vertical-middle"></i>Employee History</a>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?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><!-- /.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>
|
||||
|
||||
$(document).ready(function(){
|
||||
@ -543,5 +591,110 @@
|
||||
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
|
||||
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>
|
||||
|
||||
@ -232,7 +232,6 @@ table.dataTable tbody td {
|
||||
document.addEventListener("DOMContentLoaded", init);
|
||||
|
||||
function init() {
|
||||
|
||||
const table = document.getElementById("tickets-table");
|
||||
let activeDropdown = null;
|
||||
|
||||
@ -264,8 +263,21 @@ function init() {
|
||||
|
||||
const customDropdown = document.createElement('div');
|
||||
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;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -287,11 +299,15 @@ function init() {
|
||||
}
|
||||
|
||||
function handleItemClick(e, item) {
|
||||
const onclickAttr = item.getAttribute('onclick');
|
||||
e.preventDefault();
|
||||
|
||||
// Execute the stored onclick handler
|
||||
const onclickAttr = item.getAttribute('data-onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
|
||||
// Handle href navigation
|
||||
const href = item.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
window.location.href = href;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -103,7 +103,8 @@ input:checked + .slider:before {
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<div style="margin-top: 10px;">
|
||||
<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>
|
||||
</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 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">
|
||||
</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" />
|
||||
</div>
|
||||
|
||||
|
||||
@ -133,6 +133,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
// Preserve click handlers and add auto-close
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
event.preventDefault(e);
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
|
||||
@ -470,17 +470,21 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
// Get the original dropdown items
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
|
||||
// Create new dropdown with proper background and spacing
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
|
||||
// Copy inner content while maintaining icon alignment
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -494,45 +498,33 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
document.body.appendChild(customDropdown);
|
||||
|
||||
row.addEventListener("click", function(event) {
|
||||
// Ignore clicks on the action column
|
||||
if (event.target.closest('td:last-child')) {
|
||||
return;
|
||||
}
|
||||
// Ignore clicks on the first column
|
||||
if (event.target.closest('td:first-child')) 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();
|
||||
|
||||
// Position the dropdown with some offset
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
|
||||
// Set as active dropdown
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||
activeDropdown = customDropdown;
|
||||
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// Preserve click handlers and add auto-close
|
||||
// Handle custom dropdown clicks
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
e.preventDefault();
|
||||
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
window.location.href = href;
|
||||
}
|
||||
// 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');
|
||||
if (href && href !== '#') window.location.href = href;
|
||||
|
||||
// Close the dropdown after handling the click
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
@ -543,7 +535,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
});
|
||||
});
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
// Close dropdown on outside click
|
||||
document.addEventListener("click", function() {
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
|
||||
@ -129,6 +129,7 @@
|
||||
// Preserve click handlers and add auto-close
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
|
||||
@ -691,111 +691,121 @@
|
||||
</a>
|
||||
</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>
|
||||
<a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-format-list-bulleted"></i>
|
||||
<span class="badge badge-success badge-pill float-right">2</span>
|
||||
<span> Policy Transactions </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyTransactions">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-format-list-bulleted"></i>
|
||||
|
||||
<span>Policy Transactions</span>
|
||||
</a>
|
||||
<div class="collapse" id="policyTransactions">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
|
||||
</li>
|
||||
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement Upload</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#policyReports" data-toggle="collapse" class="waves-effect">
|
||||
<i class="ri-file-chart-fill"></i>
|
||||
<span> Policy Reports </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyReports">
|
||||
<ul class="nav-third-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-outstanding-list') ?>">Outstanding</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/irba_report') ?>">IRDA Reports</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-format-list-bulleted"></i>
|
||||
<span class="badge badge-success badge-pill float-right">2</span>
|
||||
<span> Policy Transactions </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyTransactions">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="#policyTransactionsSub" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-format-list-bulleted"></i>
|
||||
<span>Policy Transactions</span>
|
||||
</a>
|
||||
<div class="collapse" id="policyTransactionsSub">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
|
||||
</li>
|
||||
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement Upload</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<li>
|
||||
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-timer-sand"></i>
|
||||
<span> Policy Pending Actions </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyReports">
|
||||
<ul class="nav-third-level">
|
||||
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php if (in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="#policyReports" data-toggle="collapse" class="waves-effect">
|
||||
<i class="ri-file-chart-fill"></i>
|
||||
<span> Policy Reports </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyReports">
|
||||
<ul class="nav-third-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-outstanding-list') ?>">Outstanding</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/irba_report') ?>">IRDA Reports</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<li>
|
||||
<a href="#policyPendingActions" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-timer-sand"></i>
|
||||
<span> Policy Pending Actions </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyPendingActions">
|
||||
<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>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
|
||||
</li>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php if (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
|
||||
<i class="ri-database-2-line"></i>
|
||||
<span> Masters </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyReports">
|
||||
<ul class="nav-third-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
|
||||
<i class="ri-database-2-line"></i>
|
||||
<span> Masters </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyMasters">
|
||||
<ul class="nav-third-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="<?= base_url('/dmsSearch') ?>"><i class="ri-book-open-line"></i><span> Documents</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/dmsSearch') ?>">
|
||||
<i class="ri-book-open-line"></i>
|
||||
<span> Documents</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
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) ?>')">
|
||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
</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
|
||||
</a>
|
||||
<!-- <?php if($row['qcr_count'] > 0) { ?>
|
||||
@ -163,25 +163,27 @@ table.dataTable tbody td {
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const table = document.getElementById("tickets-table");
|
||||
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
// Get the original dropdown items
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
|
||||
// Create new dropdown with proper background and spacing
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
|
||||
// Copy inner content while maintaining icon alignment
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
// Clone the items but remove their original click handlers
|
||||
const items = originalDropdown.querySelectorAll('.dropdown-item');
|
||||
items.forEach(item => {
|
||||
const newItem = item.cloneNode(true);
|
||||
// Preserve the attributes but remove the onclick
|
||||
newItem.removeAttribute('onclick');
|
||||
customDropdown.appendChild(newItem);
|
||||
});
|
||||
|
||||
return customDropdown;
|
||||
}
|
||||
|
||||
let activeDropdown = null;
|
||||
|
||||
// Add click event listener to rows
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
const customDropdown = createCustomDropdown(row);
|
||||
if (!customDropdown) return;
|
||||
@ -194,46 +196,54 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide any active dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
}
|
||||
|
||||
// Get click position
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
|
||||
// Position the dropdown with some offset
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||
|
||||
// Set as active dropdown
|
||||
activeDropdown = customDropdown;
|
||||
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// Preserve click handlers and add auto-close
|
||||
// Handle clicks on dropdown items
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
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');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
}
|
||||
|
||||
// For RFQ links
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
if (href && href !== '#' && !this.classList.contains('btnEdit')) {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
// Close the dropdown after handling the click
|
||||
// Close the dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -280,7 +290,7 @@ $(document).ready(function(){
|
||||
|
||||
$('#client_id').select2();
|
||||
$('#client_branch_id').select2();
|
||||
$('#source_policy_id').select2();
|
||||
// $('#source_policy_id').select2();
|
||||
$('#salse_person_id').select2({
|
||||
placeholder: "Select Salse Person",
|
||||
});
|
||||
@ -326,12 +336,14 @@ $(document).ready(function() {
|
||||
function hide_list_show_add()
|
||||
{
|
||||
$('#leads_list').hide()
|
||||
$('#lead_filter_div').hide()
|
||||
$('#leads_form').show()
|
||||
}
|
||||
|
||||
function show_list_hide_add()
|
||||
{
|
||||
$('#leads_list').show()
|
||||
$('#lead_filter_div').show()
|
||||
$('#leads_form').hide()
|
||||
}
|
||||
|
||||
@ -435,10 +447,12 @@ $(document).ready(function(){
|
||||
let client_id = $(this).val();
|
||||
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]);
|
||||
let data = branch_list[client_id];
|
||||
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();
|
||||
|
||||
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]);
|
||||
let data = policy_list[client_branch_id];
|
||||
appendRenewalPolicies(data);
|
||||
}else{
|
||||
toastr.warning("No Policies Found for the selected Branch",'Warning');
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
@ -1395,7 +1395,7 @@
|
||||
console.log("Creating new editor instance...");
|
||||
editor = unlayer.createEditor({
|
||||
id: `${template_name}_editor_container`,
|
||||
projectId: 263979,
|
||||
projectId: <?=getenv('unlayer.projectID') ?>,
|
||||
displayMode: "email",
|
||||
features: {
|
||||
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>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -362,23 +362,26 @@ custom-dropdown-menu {
|
||||
|
||||
<?php include('policy_transaction_endorsement_form.php'); ?>
|
||||
<script>
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const table = document.getElementById("tickets-table");
|
||||
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
// Get the original dropdown items
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
|
||||
// Create new dropdown with proper background and spacing
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
|
||||
// Copy inner content while maintaining icon alignment
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -392,45 +395,34 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
document.body.appendChild(customDropdown);
|
||||
|
||||
row.addEventListener("click", function(event) {
|
||||
// Ignore clicks on the action column
|
||||
if (event.target.closest('td:last-child')) {
|
||||
return;
|
||||
}
|
||||
// Ignore clicks on the first column
|
||||
if (event.target.closest('td:first-child')) 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();
|
||||
|
||||
// Position the dropdown with some offset
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
|
||||
// Set as active dropdown
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||
activeDropdown = customDropdown;
|
||||
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// Preserve click handlers and add auto-close
|
||||
// Handle custom dropdown clicks
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
e.preventDefault();
|
||||
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
window.location.href = href;
|
||||
}
|
||||
// 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');
|
||||
if (href && href !== '#') window.location.href = href;
|
||||
|
||||
// Close the dropdown after handling the click
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
@ -441,7 +433,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
});
|
||||
});
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
// Close dropdown on outside click
|
||||
document.addEventListener("click", function() {
|
||||
if (activeDropdown) {
|
||||
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 $issuing_type[$row['issue_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['policy_type']; ?></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) ?>')">
|
||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
</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
|
||||
</a>
|
||||
</div>
|
||||
@ -370,25 +370,25 @@ table.dataTable tbody td {
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const table = document.getElementById("tickets-table");
|
||||
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
// Get the original dropdown items
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
|
||||
// Create new dropdown with proper background and spacing
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
|
||||
// Copy inner content while maintaining icon alignment
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
const items = originalDropdown.querySelectorAll('.dropdown-item');
|
||||
items.forEach(item => {
|
||||
const newItem = item.cloneNode(true);
|
||||
newItem.removeAttribute('onclick');
|
||||
customDropdown.appendChild(newItem);
|
||||
});
|
||||
|
||||
return customDropdown;
|
||||
}
|
||||
|
||||
let activeDropdown = null;
|
||||
|
||||
// Add click event listener to rows
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
const customDropdown = createCustomDropdown(row);
|
||||
if (!customDropdown) return;
|
||||
@ -401,51 +401,56 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide any active dropdown
|
||||
if (activeDropdown) {
|
||||
// Close any existing dropdown
|
||||
if (activeDropdown && activeDropdown !== customDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
}
|
||||
|
||||
// Get click position
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
|
||||
// Position the dropdown with some offset
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||
|
||||
// Set as active dropdown
|
||||
activeDropdown = customDropdown;
|
||||
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// Preserve click handlers and add auto-close
|
||||
// Handle clicks on dropdown items
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
const id = this.getAttribute('data-id');
|
||||
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
window.location.href = href;
|
||||
// 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');
|
||||
if (href && href !== '#' && href !== 'javascript: void(0);') {
|
||||
window.location.href = href;
|
||||
}
|
||||
}
|
||||
|
||||
// Close the dropdown after handling the click
|
||||
// Close dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
});
|
||||
}, { once: true });
|
||||
});
|
||||
});
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
// Close dropdown on outside click
|
||||
document.addEventListener("click", function() {
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
@ -729,17 +734,22 @@ function appendClients(data)
|
||||
}));
|
||||
|
||||
$.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>', {
|
||||
value: item.id,
|
||||
text: item.client_name,
|
||||
text: client_show_name,
|
||||
'data-cn': item.client_name,
|
||||
'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);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function appendVehicles(data, vehicle_id)
|
||||
@ -1244,7 +1254,7 @@ $('#issue_type').change(function(){
|
||||
let value = $(this).val()
|
||||
|
||||
if(value == 1){
|
||||
$('#revenue_type').val('NA');
|
||||
$('#revenue_type').val('');
|
||||
$('#revenue_type option[value="NA"]').show();
|
||||
$('#revenue_type option[value="EANR"]').show();
|
||||
$('#revenue_type option[value="EA"]').hide();
|
||||
@ -1486,7 +1496,7 @@ function onlyNumbers(event)
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
getURLParams()
|
||||
// getURLParams()
|
||||
$('#client_id_for_search').select2();
|
||||
$('#insurer_id_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('&');
|
||||
}
|
||||
|
||||
function getURLParams()
|
||||
{
|
||||
const url = new URL(window.location.href);
|
||||
const params = new URLSearchParams(url.search);
|
||||
// function getURLParams()
|
||||
// {
|
||||
// const url = new URL(window.location.href);
|
||||
// const params = new URLSearchParams(url.search);
|
||||
|
||||
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 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 policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
|
||||
const date_type = params.get('date_type') || 0; // Default to 0 if not found
|
||||
const issuer = params.get('issuer') || 0; // Default to 0 if not found
|
||||
const status = params.get('status') || 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 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 policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
|
||||
// const date_type = params.get('date_type') || 0; // Default to 0 if not found
|
||||
// const issuer = params.get('issuer') || 0; // Default to 0 if not found
|
||||
// const status = params.get('status') || 0; // Default to 0 if not found
|
||||
|
||||
hideDateField(date_type)
|
||||
// hideDateField(date_type)
|
||||
|
||||
// console.log('startDate', startDate)
|
||||
// console.log('endDate', endDate)
|
||||
// console.log('client_id', client_id)
|
||||
// console.log('insurer_id', insurer_id)
|
||||
// console.log('policy_type_id', policy_type_id)
|
||||
// console.log('date_type', date_type)
|
||||
// console.log('issuer', issuer)
|
||||
// console.log('status', status)
|
||||
// // console.log('startDate', startDate)
|
||||
// // console.log('endDate', endDate)
|
||||
// // console.log('client_id', client_id)
|
||||
// // console.log('insurer_id', insurer_id)
|
||||
// // console.log('policy_type_id', policy_type_id)
|
||||
// // console.log('date_type', date_type)
|
||||
// // console.log('issuer', issuer)
|
||||
// // console.log('status', status)
|
||||
|
||||
// Log the values or use them as needed
|
||||
// console.log('Start Date:', startDate);
|
||||
// console.log('End Date:', endDate);
|
||||
// // Log the values or use them as needed
|
||||
// // console.log('Start Date:', startDate);
|
||||
// // console.log('End Date:', endDate);
|
||||
|
||||
if (startDate != 0 && endDate != 0) {
|
||||
setTimeout(function(){
|
||||
$('#start_date').val(startDate)
|
||||
$('#end_date').val(endDate)
|
||||
$('#client_id_for_search').val(client_id).change()
|
||||
$('#insurer_id_for_search').val(insurer_id).change()
|
||||
$('#policy_type_for_search').val(policy_type_id).change()
|
||||
$('#date_type').val(date_type)
|
||||
$('#issuer_for_search').val(issuer)
|
||||
$('#policy_status_for_search').val(status)
|
||||
},1000)
|
||||
// if (startDate != 0 && endDate != 0) {
|
||||
// setTimeout(function(){
|
||||
// $('#start_date').val(startDate)
|
||||
// $('#end_date').val(endDate)
|
||||
// $('#client_id_for_search').val(client_id).change()
|
||||
// $('#insurer_id_for_search').val(insurer_id).change()
|
||||
// $('#policy_type_for_search').val(policy_type_id).change()
|
||||
// $('#date_type').val(date_type)
|
||||
// $('#issuer_for_search').val(issuer)
|
||||
// $('#policy_status_for_search').val(status)
|
||||
// },1000)
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
$(function() {
|
||||
|
||||
|
||||
@ -177,6 +177,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
// Preserve click handlers
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
|
||||
@ -420,17 +420,21 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
// Get the original dropdown items
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
|
||||
// Create new dropdown with proper background and spacing
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
|
||||
// Copy inner content while maintaining icon alignment
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -444,45 +448,34 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
document.body.appendChild(customDropdown);
|
||||
|
||||
row.addEventListener("click", function(event) {
|
||||
// Ignore clicks on the first column (td:first-child)
|
||||
if (event.target.closest('td:first-child')) {
|
||||
return;
|
||||
}
|
||||
// Ignore clicks on the first column
|
||||
if (event.target.closest('td:first-child')) 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();
|
||||
|
||||
// Position the dropdown with some offset
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
|
||||
// Set as active dropdown
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||
activeDropdown = customDropdown;
|
||||
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// Preserve click handlers and add auto-close
|
||||
// Handle custom dropdown clicks
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
e.preventDefault();
|
||||
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
window.location.href = href;
|
||||
}
|
||||
// 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');
|
||||
if (href && href !== '#') window.location.href = href;
|
||||
|
||||
// Close the dropdown after handling the click
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
@ -493,7 +486,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
});
|
||||
});
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
// Close dropdown on outside click
|
||||
document.addEventListener("click", function() {
|
||||
if (activeDropdown) {
|
||||
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="col-12">
|
||||
<div class="card-body">
|
||||
@ -8,156 +20,176 @@
|
||||
<div class="form-group col-md-12">
|
||||
<!-- <label for="ticket_auto_query_note">Add Notes</label> -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<select id="ticket_mail_auto_query_customButton" class="form-control"
|
||||
style="border:none;right: 13px;width: auto;position: absolute;z-index: 1;top: -19px;height: 32px;float: right;">
|
||||
<option value="">Documents</option>
|
||||
<div class="form-group col-md-9">
|
||||
<label>Documents</label> <br />
|
||||
<select class="form-control" name="documents[]" id="ticket_mail_auto_query_customButton" multiple>
|
||||
<?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; ?>
|
||||
</select>
|
||||
</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>
|
||||
<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><input type="hidden" id="query_note_id"><input type="hidden" <div
|
||||
class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary" id="ticket_auto_query_submit">Submit</button>
|
||||
</div><input type="hidden" id="query_note_id">
|
||||
|
||||
<div class="form-group text-right">
|
||||
<button type="submit" class="btn btn-primary" id="ticket_auto_query_submit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
url = '<?= base_url('ticket/note/1') ?>';
|
||||
data = {
|
||||
id: $('#ticket_master_id').val(),
|
||||
is_auto_query: 1
|
||||
};
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: data,
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
if (res.status == true) {
|
||||
$('#ticket_auto_query_note').val(res.data.note);
|
||||
$('#query_note_id').val(res.data.id);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Went Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
})
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#ticket_auto_query").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var url = '<?= base_url("/ticket/note/2"); ?>';
|
||||
var formData = $(this).serializeArray();
|
||||
var ticket_id = $('#ticket_master_id').val();
|
||||
if (ticket_id != null && ticket_id != '') {
|
||||
formData.push({
|
||||
name: 'ticket_id',
|
||||
value: ticket_id
|
||||
});
|
||||
}
|
||||
var primary_key = $('#query_note_id').val();
|
||||
if (primary_key != null && primary_key != '') {
|
||||
formData.push({
|
||||
name: 'id',
|
||||
value: primary_key
|
||||
});
|
||||
}
|
||||
formData.push({
|
||||
name: 'is_auto_query',
|
||||
value: 1
|
||||
})
|
||||
console.log(formData);
|
||||
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
|
||||
if (response.status == true) {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Note Added Successfully', 'Success');
|
||||
// console.log("Respone id is ")
|
||||
// console.log(response.id);
|
||||
$('#query_note_id').val(response.id);
|
||||
|
||||
|
||||
} 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 report page.', 'ERROR');
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
// $('#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') ?>';
|
||||
data = {
|
||||
id: $('#ticket_master_id').val(),
|
||||
is_auto_query: 1
|
||||
};
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: data,
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
console.log('auto query res', res)
|
||||
if (res.status == true) {
|
||||
|
||||
$('#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);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Went Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
})
|
||||
|
||||
$("#ticket_auto_query").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var url = '<?= base_url("/ticket/note/2"); ?>';
|
||||
var formData = $(this).serializeArray();
|
||||
var ticket_id = $('#ticket_master_id').val();
|
||||
if (ticket_id != null && ticket_id != '') {
|
||||
formData.push({
|
||||
name: 'ticket_id',
|
||||
value: ticket_id
|
||||
});
|
||||
}
|
||||
var primary_key = $('#query_note_id').val();
|
||||
if (primary_key != null && primary_key != '') {
|
||||
formData.push({
|
||||
name: 'id',
|
||||
value: primary_key
|
||||
});
|
||||
}
|
||||
formData.push({
|
||||
name: 'is_auto_query',
|
||||
value: 1
|
||||
})
|
||||
console.log(formData);
|
||||
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
|
||||
|
||||
if (response.status == true) {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Note Added Successfully', 'Success');
|
||||
// console.log("Respone id is ")
|
||||
// console.log(response.id);
|
||||
$('#query_note_id').val(response.id);
|
||||
} else {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
let message = response.message;
|
||||
toastr.error(message, 'ERROR');
|
||||
}
|
||||
|
||||
window.location.reload();
|
||||
|
||||
}, 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');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
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>
|
||||
@ -24,28 +24,28 @@
|
||||
<li class="nav-item">
|
||||
<a href="#general-tab" data-toggle="tab" class="nav-link px-2 py-1 active" id="general_tab"
|
||||
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>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#reply-tab" data-toggle="tab" class="nav-link px-2 py-1" id="reply_tab"
|
||||
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>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#note-tab" data-toggle="tab" class="nav-link px-2 py-1" id="note_tab"
|
||||
aria-expanded="false">
|
||||
<i class="mdi mdi-account-switch mr-1"></i>
|
||||
<span class="d-none d-sm-inline-block">Note</span>
|
||||
<i class="mdi mdi-note-text"></i>
|
||||
<span class="d-none d-sm-inline-block">Notes</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#history-tab" data-toggle="tab" class="nav-link px-2 py-1" id="history_tab"
|
||||
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>
|
||||
</a>
|
||||
</li>
|
||||
@ -139,6 +139,13 @@ function submitClaimForm(event, form) {
|
||||
|
||||
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"); ?>';
|
||||
|
||||
// Show loader
|
||||
@ -228,9 +235,44 @@ function showConfirmationModal(event) {
|
||||
console.log($('#ticket_form_data')[0])
|
||||
submitClaimForm(event, $('#ticket_form_data')[0]); // Fixed selector
|
||||
} else if (result.isDenied) {
|
||||
$('#is_head_approved').val(2);
|
||||
console.log($('#ticket_form_data')[0])
|
||||
submitClaimForm(event, $('#ticket_form_data')[0]); // Fixed selector
|
||||
// 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);
|
||||
$('#rejection_reason').val(reasonResult.value.trim());
|
||||
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 {
|
||||
$('#is_head_approved').val(0);
|
||||
return false;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,16 +1,16 @@
|
||||
<style>
|
||||
.readonly-select {
|
||||
pointer-events: none;
|
||||
background-color: #e0e0e0;
|
||||
color: #666;
|
||||
}
|
||||
.readonly-select {
|
||||
pointer-events: none;
|
||||
background-color: #e0e0e0;
|
||||
color: #666;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="<?= !isset($ticket_data) ? "card" : "" ?>" style="margin-right: 23px;">
|
||||
<div class="<?= !isset($ticket_data) ? "card" : "" ?>" style="margin-right: 23px;">
|
||||
<div class="card-body">
|
||||
<?php if(!isset($ticket_data)){ ?>
|
||||
<?php if (!isset($ticket_data)) { ?>
|
||||
<!-- Header Section -->
|
||||
<div class="row mb-3">
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
@ -25,123 +25,163 @@
|
||||
<?php } ?>
|
||||
<form role="form" class="parsley-examples" method="post" id="ticket_form_data" onsubmit="submitClaimForm(event, this)"
|
||||
enctype="multipart/form-data">
|
||||
|
||||
<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">
|
||||
|
||||
<input type="hidden" id="ticket_master_id" name="ticket_master_id" value="<?= isset($ticket_data['id']) ? $ticket_data['id'] : '' ?>">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="claim_status">Status<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="claim_status_id" name="claim_status_id">
|
||||
<!-- <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 class="form-group col-md-3">
|
||||
<label for="emp_code">Employee ID <span class="text-danger">*</span> <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" required>
|
||||
</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">
|
||||
<!-- <option value="0">Select Account Manager</option> -->
|
||||
<?php
|
||||
if (isset($acms) && count($acms)) {
|
||||
foreach ($acms as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['acm_id'] == $value['id']) ? 'selected' : '';
|
||||
echo "<option value=" . $value['id'] . " $selected>" . $value['first_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<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" required>
|
||||
</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>
|
||||
<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="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>
|
||||
<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="policy_no">Policy No<span class="text-danger"></span></label>
|
||||
<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> -->
|
||||
<?php
|
||||
if (isset($acms) && count($acms)) {
|
||||
foreach ($acms as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['acm_id'] == $value['id']) ? 'selected' : '';
|
||||
echo "<option value=" . $value['id'] . " $selected>" . $value['first_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- end first_data_points -->
|
||||
|
||||
<br><br>
|
||||
<h5>Claim Details</h5>
|
||||
<hr>
|
||||
|
||||
<!-- second_data_points -->
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="ticket_type_id"> Policy Type <span class="text-danger"></span></label>
|
||||
<select class="form-control readonly-select" id="ticket_type_id" name="ticket_type_id" readonly>
|
||||
<?php
|
||||
if (isset($ticket_type) && count($ticket_type)) {
|
||||
foreach ($ticket_type as $key => $value) {
|
||||
if($key != 1){
|
||||
$selected = (isset($ticket_data) && $ticket_data['ticket_type_id'] == $key) ? 'selected' : ((isset($selected_ticket_type) && $selected_ticket_type == $key) ? 'selected' : '');
|
||||
echo "<option value='" . $key . "' $selected>" . $value . "</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">
|
||||
<!-- <option value="0">Select claim Type</option> -->
|
||||
<?php
|
||||
if (isset($claim_type) && count($claim_type)) {
|
||||
foreach ($claim_type as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['claim_type'] == $key) ? 'selected' : '';
|
||||
if (isset($ticket_type) && count($ticket_type)) {
|
||||
foreach ($ticket_type as $key => $value) {
|
||||
if ($key != 1) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['ticket_type_id'] == $key) ? 'selected' : ((isset($selected_ticket_type) && $selected_ticket_type == $key) ? 'selected' : '');
|
||||
echo "<option value='" . $key . "' $selected>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</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">
|
||||
<label for="claim_status">Status <span class="text-danger">*</span></label>
|
||||
<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="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">
|
||||
<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> -->
|
||||
<?php
|
||||
if (isset($claim_type) && count($claim_type)) {
|
||||
foreach ($claim_type as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['claim_type'] == $key) ? 'selected' : '';
|
||||
echo "<option value='" . $key . "' $selected>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</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">
|
||||
<label for="date_of_join">Date of joining<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="date_of_join"
|
||||
@ -159,13 +199,13 @@
|
||||
</div>
|
||||
|
||||
<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"
|
||||
value="<?= isset($ticket_data['dob']) ? $ticket_data['dob'] : '' ?>" name="dob">
|
||||
value="<?= isset($ticket_data['dob']) ? $ticket_data['dob'] : '' ?>" name="dob" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="date_of_accident">Date of Accident<span class="text-danger"></span></label>
|
||||
<label for="date_of_accident">Date of Accident <span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="date_of_accident"
|
||||
placeholder="Enter Accident Date"
|
||||
value="<?= isset($ticket_data['date_of_accident']) ? $ticket_data['date_of_accident'] : '' ?>"
|
||||
@ -173,7 +213,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="date_of_death">Date of Death<span class="text-danger"></span></label>
|
||||
<label for="date_of_death">Date of Death <span class="text-danger"></span></label>
|
||||
<input type="date_of_death" class="form-control" id="date_of_death"
|
||||
placeholder="Enter Death Date"
|
||||
value="<?= isset($ticket_data['date_of_death']) ? $ticket_data['date_of_death'] : '' ?>"
|
||||
@ -181,18 +221,33 @@
|
||||
</div>
|
||||
|
||||
<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"
|
||||
placeholder="Enter Intimation Date"
|
||||
value="<?= isset($ticket_data['date_of_intimat']) ? $ticket_data['date_of_intimat'] : '' ?>"
|
||||
name="date_of_intimat">
|
||||
name="date_of_intimat" required>
|
||||
</div>
|
||||
|
||||
<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"
|
||||
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 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">
|
||||
</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>
|
||||
<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">
|
||||
@ -219,17 +274,39 @@
|
||||
value="<?= isset($ticket_data['settled_date']) ? $ticket_data['settled_date'] : '' ?>" name="settled_date">
|
||||
</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>
|
||||
<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">
|
||||
</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 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 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"
|
||||
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>
|
||||
</form>
|
||||
@ -238,63 +315,462 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
let GlobelExtraFields = [];
|
||||
|
||||
var date_of_join = flatpickr("#date_of_join", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
var date_of_join;
|
||||
var dob;
|
||||
var date_of_accident;
|
||||
var date_of_death;
|
||||
var date_of_intimat;
|
||||
|
||||
var dob = flatpickr("#dob", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var date_of_incep = flatpickr("#date_of_incep", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
$(document).ready(function() {
|
||||
|
||||
var date_of_accident = flatpickr("#date_of_accident", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
$("#emp_client_policy").select2();
|
||||
date_of_join = flatpickr("#date_of_join", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var date_of_death = flatpickr("#date_of_death", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
dob = flatpickr("#dob", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var date_of_intimat = flatpickr("#date_of_intimat", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
var date_of_incep = flatpickr("#date_of_incep", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
flatpickr("#approved_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
flatpickr("#settled_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
updateClaimStatusDisplay("<?= isset($ticket_data['claim_status_id']) ? $ticket_data['claim_status_id'] : 0 ?>")
|
||||
date_of_death = flatpickr("#date_of_death", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
})
|
||||
date_of_intimat = flatpickr("#date_of_intimat", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
function updateClaimStatusDisplay(value) {
|
||||
flatpickr("#approved_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
flatpickr("#settled_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
console.log('value', value);
|
||||
// updateClaimStatusDisplay("<?= isset($ticket_data['claim_status_id']) ? $ticket_data['claim_status_id'] : 0 ?>")
|
||||
var extraFields = <?= json_encode(isset($extra_fields) ? $extra_fields : []); ?>;
|
||||
GlobelExtraFields = extraFields;
|
||||
console.log("extraFields", extraFields);
|
||||
claimStatusFieldChanges(extraFields);
|
||||
|
||||
// Hide all sections first
|
||||
$('.settled, .approved').hide();
|
||||
|
||||
// Show relevant section based on value
|
||||
if (value == 20) { // APPROVED
|
||||
$('.approved').show();
|
||||
} else if (value == 24) { // SETTLED
|
||||
$('.settled').show();
|
||||
})
|
||||
|
||||
function updateClaimStatusDisplay(value) {
|
||||
|
||||
console.log('value', value);
|
||||
|
||||
// Hide all sections first
|
||||
$('.settled, .approved, .canceled, .returned').hide();
|
||||
|
||||
// Show relevant section based on value
|
||||
if (value == 20 || value == 30 || value == 40) { // APPROVED
|
||||
$('.approved').show();
|
||||
} else if (value == 24 || value == 34 || value == 44) { // SETTLED
|
||||
$('.settled').show();
|
||||
} else if (value == 47 || value == 53 || value == 58) { // CANCELLED
|
||||
$('.canceled').show();
|
||||
} else if (value == 48 || value == 54 || value == 59) { // RETURNED
|
||||
$('.returned').show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('#claim_status_id').on('change', function() {
|
||||
updateClaimStatusDisplay($(this).val());
|
||||
});
|
||||
$('#claim_status_id').on('change', function() {
|
||||
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>
|
||||
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@
|
||||
<table id="scroll-horizontal-datatable" class="table w-100">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Label</th>
|
||||
<!-- <th>Old Value</th>
|
||||
<th>New Value</th> -->
|
||||
<th>Change</th>
|
||||
|
||||
@ -74,11 +74,11 @@ table.dataTable tbody td {
|
||||
title=" <?php
|
||||
if ($row['claim_status_id'] == 8) {
|
||||
if ($row['is_head_approved'] == 0) {
|
||||
echo 'Waiting For Head Approvel';
|
||||
echo 'Waiting for approvel';
|
||||
} elseif ($row['is_head_approved'] == 1) {
|
||||
echo 'Head Approved';
|
||||
echo 'Rejection approved';
|
||||
} elseif ($row['is_head_approved'] == 2) {
|
||||
echo 'Head Rejected';
|
||||
echo 'Rejection not approved';
|
||||
} else {
|
||||
echo $row['status'];
|
||||
}
|
||||
@ -90,7 +90,7 @@ table.dataTable tbody td {
|
||||
|
||||
<span class="status-tooltip">
|
||||
<?php
|
||||
if ($row['claim_status_id'] == 8) {
|
||||
if (in_array($row['claim_status_id'],[8,23,33,43])) {
|
||||
if ($row['is_head_approved'] == 0) {
|
||||
echo $row['status'] . ' <i class="fa fa-exclamation-triangle" style="color:#cece00;" aria-hidden="true"></i>';
|
||||
} elseif ($row['is_head_approved'] == 1) {
|
||||
|
||||
@ -1,56 +1,56 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.col-12 {
|
||||
.col-12 {
|
||||
|
||||
max-width: 98% !important;
|
||||
}
|
||||
max-width: 98% !important;
|
||||
}
|
||||
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.addbtnStyle {
|
||||
margin-left: 20px !important;
|
||||
}
|
||||
.addbtnStyle {
|
||||
margin-left: 20px !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: #ffffff !important;
|
||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.5rem 0;
|
||||
min-width: 10rem;
|
||||
z-index: 9999;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.custom-dropdown-menu {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: #ffffff !important;
|
||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.5rem 0;
|
||||
min-width: 10rem;
|
||||
z-index: 9999;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item {
|
||||
display: block !important;
|
||||
width: 100% !important;
|
||||
padding: 0.5rem 1rem !important;
|
||||
color: #212529 !important;
|
||||
text-decoration: none !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
.custom-dropdown-menu .dropdown-item {
|
||||
display: block !important;
|
||||
width: 100% !important;
|
||||
padding: 0.5rem 1rem !important;
|
||||
color: #212529 !important;
|
||||
text-decoration: none !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item:hover {
|
||||
background-color: #f8f9fa !important;
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
.custom-dropdown-menu .dropdown-item:hover {
|
||||
background-color: #f8f9fa !important;
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="col-12">
|
||||
@ -75,28 +75,37 @@ table.dataTable tbody td {
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (isset($ticket_data)) { ?>
|
||||
<?php foreach($ticket_data as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?php echo $row['template_name'] ?? ""; ?></td>
|
||||
<td><?php echo $ticket_type[$row['ticket_type']] ?? ""; ?></td>
|
||||
<td><?php echo $trigger_type[$row['trigger_type']] ?? ""; ?></td>
|
||||
<td><?=$row['is_auto_mail'] == 1?'Auto':"Manual" ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);"
|
||||
class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"
|
||||
aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="#"
|
||||
onclick="getMailTemplateData(<?=$row['id']?>)"><i
|
||||
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" onclick="deleteTemplate(<?=$row['id']?>)"><i
|
||||
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php foreach ($ticket_data as $index => $row) { ?>
|
||||
<tr>
|
||||
<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 $trigger_type[$row['trigger_type']] ?? ""; ?></td>
|
||||
<td><?= $row['is_auto_mail'] == 1 ? 'Auto' : "Manual" ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);"
|
||||
class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"
|
||||
aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="#"
|
||||
onclick="getMailTemplateData(<?= $row['id'] ?>)"><i
|
||||
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" onclick="deleteTemplate(<?= $row['id'] ?>)"><i
|
||||
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -135,11 +144,11 @@ table.dataTable tbody td {
|
||||
<select class="form-control" id="policy_type" name="ticket_type" required>
|
||||
<option value="">Select Policy Type</option>
|
||||
<?php
|
||||
if (isset($policy_type) && count($policy_type)) {
|
||||
foreach ($policy_type as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
if (isset($policy_type) && count($policy_type)) {
|
||||
foreach ($policy_type as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
@ -149,11 +158,11 @@ table.dataTable tbody td {
|
||||
<select class="form-control" id="trigger_type" name="trigger_type" required>
|
||||
<option value="">Select status</option>
|
||||
<?php
|
||||
if (isset($trigger_type) && count($trigger_type)) {
|
||||
foreach ($trigger_type as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
if (isset($trigger_type) && count($trigger_type)) {
|
||||
foreach ($trigger_type as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select> <input id="primaryKey" type="hidden">
|
||||
</div>
|
||||
@ -171,6 +180,12 @@ table.dataTable tbody td {
|
||||
|
||||
</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 class="form-row">
|
||||
@ -191,12 +206,15 @@ table.dataTable tbody td {
|
||||
<select id="ticket_mail_customButton" class="form-control"
|
||||
style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
|
||||
<option value="">PlaceHolders</option>
|
||||
<?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 $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
|
||||
<option value="<?php echo $key; ?>"><?php echo $valueChange; ?></option>
|
||||
</option>
|
||||
<?php //} ?>
|
||||
<?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 $valueChange = str_replace('_', ' ', $value);
|
||||
$valueChange = ucwords($valueChange); ?>
|
||||
<option value="<?php echo $key; ?>"><?php echo $valueChange; ?></option>
|
||||
</option>
|
||||
<?php //}
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
@ -216,392 +234,397 @@ table.dataTable tbody td {
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<!-------------------------------------------------------------------------------------------------->
|
||||
|
||||
<script>
|
||||
// Datatable document ready
|
||||
$(document).ready(function() {
|
||||
|
||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||
|
||||
if (ticketsTable.length) {
|
||||
|
||||
ticketsTable.DataTable({
|
||||
scrollX: true,
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
buttons: [{
|
||||
text: 'Add Template',
|
||||
className: 'buttons-html5 addbtnStyle',
|
||||
action: function(e, dt, node, config) {
|
||||
openModal()
|
||||
}
|
||||
}],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 25, // Set default number of rows per page (optional)
|
||||
ordering: false,
|
||||
});
|
||||
} else {
|
||||
console.error("Table atet found.");
|
||||
}
|
||||
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();
|
||||
},
|
||||
}, ],
|
||||
};
|
||||
|
||||
const editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
||||
|
||||
let lastActiveField = null;
|
||||
|
||||
// Track last active input field
|
||||
$("#template_subject").on("focus", function() {
|
||||
lastActiveField = this;
|
||||
$(document).ready(function() {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
|
||||
// Track Jodit editor focus separately
|
||||
editor.events.on("focus", function() {
|
||||
lastActiveField = editor;
|
||||
});
|
||||
|
||||
document.addEventListener('change', function(event) {
|
||||
var target = event.target;
|
||||
if (target.matches('#ticket_mail_customButton')) {
|
||||
let placeholderValue = $(target).val();
|
||||
if (!placeholderValue) return;
|
||||
|
||||
if (lastActiveField) {
|
||||
if (lastActiveField.id === "template_subject") {
|
||||
insertAtCursor(lastActiveField, placeholderValue);
|
||||
} else {
|
||||
editor.selection.insertHTML(placeholderValue);
|
||||
}
|
||||
}
|
||||
|
||||
$(target).val('');
|
||||
}
|
||||
});
|
||||
|
||||
function insertAtCursor(input, textToInsert) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('.close').click(function() {
|
||||
$('#template_subject').val('');
|
||||
$('#template_name').val('');
|
||||
$('#primaryKey').val('');
|
||||
$('#policy_type').val('').change();
|
||||
$('#trigger_type').val('').change();
|
||||
editor.setEditorValue('');
|
||||
$('#primaryKey').val(null);
|
||||
$('#statusSwitch').prop('checked', false);
|
||||
|
||||
})
|
||||
$('#ticket_mail_editor_modal').submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
let isValid = true;
|
||||
$('#ticket_mail_editor_modal [required]').each(function() {
|
||||
if (!this.value.trim()) {
|
||||
isValid = false;
|
||||
$(this).addClass('is-invalid'); // Add a red border for visibility
|
||||
} else {
|
||||
$(this).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
|
||||
if (!isValid) {
|
||||
toastr.error('Please fill all required fields.', 'Validation Error');
|
||||
return; // Prevent submission
|
||||
}
|
||||
var joditEditor = editor;
|
||||
if (joditEditor) {
|
||||
var mailContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
|
||||
var formData = $(this).serializeArray();
|
||||
formData.push({
|
||||
name: 'mail_content',
|
||||
value: mailContent
|
||||
});
|
||||
// formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
|
||||
var isAutoMailEnabled = $('#statusSwitch').is(':checked') ? 1 : 0;
|
||||
formData.push({
|
||||
name: 'is_auto_mail',
|
||||
value: isAutoMailEnabled
|
||||
});
|
||||
var primary_key = $('#primaryKey').val();
|
||||
if (primary_key != null && primary_key != '') {
|
||||
formData.push({
|
||||
name: 'id',
|
||||
value: primary_key
|
||||
});
|
||||
}
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var form_action = '<?= base_url("ticket/crud_mail_template/1") ?>';
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
if (res.status == true) {
|
||||
$('#new_mail_template').find('.close').click();
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Template saved successfully!', 'Success');
|
||||
location.reload();
|
||||
} else if (res.status == false) {
|
||||
toastr.error('Failed to Save Data', 'error');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.error('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error("Jodit editor instance is not defined.");
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
function openModal() {
|
||||
var myModal = new bootstrap.Modal(document.getElementById('new_mail_template'));
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
function deleteTemplate(id) {
|
||||
const url = '<?= base_url("ticket/crud_mail_template/3") ?>';
|
||||
const data = {
|
||||
id: id
|
||||
}; // Ensure data is passed as an object
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this template.",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "POST",
|
||||
data: data,
|
||||
success: function(res) {
|
||||
if (res.status === true) {
|
||||
location.reload();
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Template Deleted successfully!', 'Success');
|
||||
} else if (res.status === false) {
|
||||
toastr.error('Failed to Delete Template', 'Error');
|
||||
$('.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.error('Something went wrong!', 'Warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getMailTemplateData(id) {
|
||||
const template_name = 'new_mail_template';
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var form_action = '<?= base_url("ticket/crud_mail_template/2") ?>';
|
||||
var data = {
|
||||
id: id
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
data: data,
|
||||
success: function(res) {
|
||||
console.log('get Mail Template Data', res);
|
||||
if (res) {
|
||||
if (res.status == true) {
|
||||
// Open the modal
|
||||
openModal();
|
||||
|
||||
// Populate the form fields
|
||||
$('#template_subject').val(res.data.subject);
|
||||
$('#template_name').val(res.data.template_name);
|
||||
$('#primaryKey').val(res.data.id);
|
||||
$('#policy_type').val(res.data.ticket_type).change();
|
||||
$('#trigger_type').val(res.data.trigger_type).change();
|
||||
$('.jodit-wysiwyg').html(res.data.mail_content);
|
||||
|
||||
// Set the auto mail switch
|
||||
if (res.data.is_auto_mail == 1) {
|
||||
$('#statusSwitch').prop('checked', true);
|
||||
} else {
|
||||
$('#statusSwitch').prop('checked', false);
|
||||
}
|
||||
|
||||
// Populate any additional fields if necessary, like placeholders
|
||||
// Assuming `placeholders` is an array in the response
|
||||
if (res.placeholders) {
|
||||
res.placeholders.forEach(function(placeholder) {
|
||||
// You can populate any dropdown or field as required
|
||||
$('#ticket_mail_customButton').val(placeholder);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
toastr.error('Data Not Found', 'error');
|
||||
}
|
||||
}
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Went Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const table = document.getElementById("scroll-horizontal-datatable");
|
||||
// Datatable document ready
|
||||
$(document).ready(function() {
|
||||
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
// Get the original dropdown items
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||
|
||||
// Create new dropdown with proper background and spacing
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
if (ticketsTable.length) {
|
||||
|
||||
// Copy inner content while maintaining icon alignment
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
ticketsTable.DataTable({
|
||||
scrollX: true,
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
buttons: [{
|
||||
text: 'Add Template',
|
||||
className: 'buttons-html5 addbtnStyle',
|
||||
action: function(e, dt, node, config) {
|
||||
openModal()
|
||||
}
|
||||
}],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 25, // Set default number of rows per page (optional)
|
||||
ordering: false,
|
||||
});
|
||||
} else {
|
||||
console.error("Table atet found.");
|
||||
}
|
||||
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();
|
||||
},
|
||||
}, ],
|
||||
};
|
||||
|
||||
return customDropdown;
|
||||
const editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
||||
|
||||
let lastActiveField = null;
|
||||
|
||||
// Track last active input field
|
||||
$("#template_subject").on("focus", function() {
|
||||
lastActiveField = this;
|
||||
});
|
||||
|
||||
// Track Jodit editor focus separately
|
||||
editor.events.on("focus", function() {
|
||||
lastActiveField = editor;
|
||||
});
|
||||
|
||||
document.addEventListener('change', function(event) {
|
||||
var target = event.target;
|
||||
if (target.matches('#ticket_mail_customButton')) {
|
||||
let placeholderValue = $(target).val();
|
||||
if (!placeholderValue) return;
|
||||
|
||||
if (lastActiveField) {
|
||||
if (lastActiveField.id === "template_subject") {
|
||||
insertAtCursor(lastActiveField, placeholderValue);
|
||||
} else {
|
||||
editor.selection.insertHTML(placeholderValue);
|
||||
}
|
||||
}
|
||||
|
||||
$(target).val('');
|
||||
}
|
||||
});
|
||||
|
||||
function insertAtCursor(input, textToInsert) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('.close').click(function() {
|
||||
$('#template_subject').val('');
|
||||
$('#template_name').val('');
|
||||
$('#primaryKey').val('');
|
||||
$('#policy_type').val('').change();
|
||||
$('#trigger_type').val('').change();
|
||||
editor.setEditorValue('');
|
||||
$('#primaryKey').val(null);
|
||||
$('#statusSwitch').prop('checked', false);
|
||||
|
||||
})
|
||||
$('#ticket_mail_editor_modal').submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
let isValid = true;
|
||||
$('#ticket_mail_editor_modal [required]').each(function() {
|
||||
if (!this.value.trim()) {
|
||||
isValid = false;
|
||||
$(this).addClass('is-invalid'); // Add a red border for visibility
|
||||
} else {
|
||||
$(this).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
|
||||
if (!isValid) {
|
||||
toastr.error('Please fill all required fields.', 'Validation Error');
|
||||
return; // Prevent submission
|
||||
}
|
||||
var joditEditor = editor;
|
||||
if (joditEditor) {
|
||||
var mailContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
|
||||
var formData = $(this).serializeArray();
|
||||
formData.push({
|
||||
name: 'mail_content',
|
||||
value: mailContent
|
||||
});
|
||||
// formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
|
||||
var isAutoMailEnabled = $('#statusSwitch').is(':checked') ? 1 : 0;
|
||||
formData.push({
|
||||
name: 'is_auto_mail',
|
||||
value: isAutoMailEnabled
|
||||
});
|
||||
var primary_key = $('#primaryKey').val();
|
||||
if (primary_key != null && primary_key != '') {
|
||||
formData.push({
|
||||
name: 'id',
|
||||
value: primary_key
|
||||
});
|
||||
}
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var form_action = '<?= base_url("ticket/crud_mail_template/1") ?>';
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
if (res.status == true) {
|
||||
$('#new_mail_template').find('.close').click();
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Template saved successfully!', 'Success');
|
||||
location.reload();
|
||||
} else if (res.status == false) {
|
||||
toastr.error('Failed to Save Data', 'error');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.error('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error("Jodit editor instance is not defined.");
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
function openModal() {
|
||||
var myModal = new bootstrap.Modal(document.getElementById('new_mail_template'));
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
let activeDropdown = null;
|
||||
function deleteTemplate(id) {
|
||||
const url = '<?= base_url("ticket/crud_mail_template/3") ?>';
|
||||
const data = {
|
||||
id: id
|
||||
}; // Ensure data is passed as an object
|
||||
|
||||
// Add click event listener to rows
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
const customDropdown = createCustomDropdown(row);
|
||||
if (!customDropdown) return;
|
||||
|
||||
document.body.appendChild(customDropdown);
|
||||
|
||||
row.addEventListener("click", function(event) {
|
||||
// Ignore clicks on the action column
|
||||
if (event.target.closest('td:last-child')) {
|
||||
return;
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this template.",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "POST",
|
||||
data: data,
|
||||
success: function(res) {
|
||||
if (res.status === true) {
|
||||
location.reload();
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Template Deleted successfully!', 'Success');
|
||||
} else if (res.status === false) {
|
||||
toastr.error('Failed to Delete Template', 'Error');
|
||||
$('.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.error('Something went wrong!', 'Warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Hide any active dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
}
|
||||
|
||||
// Get click position
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
|
||||
// Position the dropdown with some offset
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
|
||||
// Set as active dropdown
|
||||
activeDropdown = customDropdown;
|
||||
|
||||
event.stopPropagation();
|
||||
});
|
||||
}
|
||||
|
||||
// Preserve click handlers and add auto-close
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
function getMailTemplateData(id) {
|
||||
const template_name = 'new_mail_template';
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var form_action = '<?= base_url("ticket/crud_mail_template/2") ?>';
|
||||
var data = {
|
||||
id: id
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
data: data,
|
||||
success: function(res) {
|
||||
console.log('get Mail Template Data', res);
|
||||
if (res) {
|
||||
if (res.status == true) {
|
||||
// Open the modal
|
||||
openModal();
|
||||
|
||||
// Populate the form fields
|
||||
$('#template_subject').val(res.data.subject);
|
||||
$('#template_name').val(res.data.template_name);
|
||||
$('#primaryKey').val(res.data.id);
|
||||
$('#policy_type').val(res.data.ticket_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);
|
||||
|
||||
// Set the auto mail switch
|
||||
if (res.data.is_auto_mail == 1) {
|
||||
$('#statusSwitch').prop('checked', true);
|
||||
} else {
|
||||
$('#statusSwitch').prop('checked', false);
|
||||
}
|
||||
|
||||
// Populate any additional fields if necessary, like placeholders
|
||||
// Assuming `placeholders` is an array in the response
|
||||
if (res.placeholders) {
|
||||
res.placeholders.forEach(function(placeholder) {
|
||||
// You can populate any dropdown or field as required
|
||||
$('#ticket_mail_customButton').val(placeholder);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
toastr.error('Data Not Found', 'error');
|
||||
}
|
||||
}
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Went Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const table = document.getElementById("scroll-horizontal-datatable");
|
||||
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
// Get the original dropdown items
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
|
||||
// Create new dropdown with proper background and spacing
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
|
||||
// Copy inner content while maintaining icon alignment
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
|
||||
return customDropdown;
|
||||
}
|
||||
|
||||
let activeDropdown = null;
|
||||
|
||||
// Add click event listener to rows
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
const customDropdown = createCustomDropdown(row);
|
||||
if (!customDropdown) return;
|
||||
|
||||
document.body.appendChild(customDropdown);
|
||||
|
||||
row.addEventListener("click", function(event) {
|
||||
// Ignore clicks on the action column
|
||||
if (event.target.closest('td:last-child')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
// Close the dropdown after handling the click
|
||||
// Hide any active dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
// Get click position
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
|
||||
// Position the dropdown with some offset
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
|
||||
// Set as active dropdown
|
||||
activeDropdown = customDropdown;
|
||||
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// Preserve click handlers and add auto-close
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
// Close the dropdown after handling the click
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener("click", function() {
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener("click", function() {
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@ -47,36 +47,67 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
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 = {
|
||||
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();
|
||||
},
|
||||
|
||||
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();
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
||||
var mail_content = `<?=isset($reply_data['mail_content'])?$reply_data['mail_content']:'' ?>`;
|
||||
$('.jodit-wysiwyg').html(mail_content);
|
||||
const editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
||||
var mail_content = `<?=isset($reply_data['mail_content'])?$reply_data['mail_content']:'' ?>`;
|
||||
// console.log(mail_content);
|
||||
|
||||
let lastActiveField = null;
|
||||
if (editor) {
|
||||
editor.value = mail_content;
|
||||
}
|
||||
|
||||
// $('.jodit-wysiwyg').html(mail_content);
|
||||
|
||||
// Track last active input field
|
||||
$("#mail_subject").on("focus", function() {
|
||||
let lastActiveField = null;
|
||||
|
||||
// Track last active input field
|
||||
$("#mail_subject").on("focus", function() {
|
||||
lastActiveField = this;
|
||||
});
|
||||
|
||||
@ -85,7 +116,7 @@ $("#mail_subject").on("focus", function() {
|
||||
lastActiveField = editor;
|
||||
});
|
||||
|
||||
document.addEventListener('change', function(event) {
|
||||
document.addEventListener('change', function(event) {
|
||||
var target = event.target;
|
||||
if (target.matches('#ticket_mail_customButton')) {
|
||||
let placeholderValue = $(target).val();
|
||||
@ -176,6 +207,7 @@ document.addEventListener('change', function(event) {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<script>
|
||||
function reloadTicket_conversation() {
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
|
||||
@ -128,6 +128,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
// Preserve click handlers and add auto-close
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
|
||||
@ -107,6 +107,7 @@
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<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">Policy</th>
|
||||
<th class="font-weight-medium">Endorsement No</th>
|
||||
@ -122,6 +123,7 @@
|
||||
<?php foreach($depositdata as $row) { ?>
|
||||
<tr id="<?php echo $row->id;?>">
|
||||
<td><?php echo date('d-M-Y h:i A', strtotime($row->created_at)); ?></td>
|
||||
<td><?php echo isset($row->record_date)? date('d-M-Y', strtotime($row->record_date)):'-' ?></td>
|
||||
<td><?php echo $row->unit ?? ' - '; ?></td>
|
||||
<!-- <td><?php echo $row->policy_name ?? '<center> - </center>'; ?></td> -->
|
||||
<td>
|
||||
@ -139,8 +141,8 @@
|
||||
<td><?php echo $row->endorsement_no ?? '<center> - </center>'; ?></td>
|
||||
<td><?php echo isset($subTypeOptions[$row->sub_type]) ? $subTypeOptions[$row->sub_type] : ''; ?>
|
||||
</td>
|
||||
<td><?php echo ($row->transaction_type == 'Credit') ? $row->amount : ''; ?></td>
|
||||
<td><?php echo ($row->transaction_type == 'Debit') ? $row->amount : ''; ?></td>
|
||||
<td><?php echo ($row->transaction_type == 'Credit') ? $row->amount : '-'; ?></td>
|
||||
<td><?php echo ($row->transaction_type == 'Debit') ? $row->amount : '-'; ?></td>
|
||||
<td><?php echo $row->balance; ?></td>
|
||||
<td><?php echo $row->description; ?></td>
|
||||
<td><?php echo $row->username; ?></td>
|
||||
@ -205,6 +207,8 @@
|
||||
<div class="form-group">
|
||||
<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>
|
||||
<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>
|
||||
|
||||
@ -264,6 +268,12 @@ $(document).ready(function() {
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
var record_date = flatpickr("#record_date",{
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false,
|
||||
|
||||
});
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-7 text-right'B>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
@ -293,6 +303,8 @@ $(document).ready(function() {
|
||||
paging: true ,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@ -320,6 +332,7 @@ $(document).ready(function() {
|
||||
var insurerId = '<?php echo $insurerName->id; ?>';
|
||||
var transactionTypeValue = $('input[name="transactionMode"]:checked').val();
|
||||
var subType = "";
|
||||
var record_date = $('#record_date').val();
|
||||
|
||||
if(amount == ""){
|
||||
toastr.warning('Amount field is required')
|
||||
@ -372,7 +385,8 @@ $(document).ready(function() {
|
||||
transaction_type: transactionType,
|
||||
sub_type_id: subType, // Include sub_type_id
|
||||
client_id: clientId,
|
||||
insurer_id: insurerId
|
||||
insurer_id: insurerId,
|
||||
record_date : record_date
|
||||
},
|
||||
success: function(response) {
|
||||
// Handle success response
|
||||
|
||||
@ -58,6 +58,7 @@
|
||||
left: 0;
|
||||
background-color: #bfe0e2;
|
||||
z-index: 2;
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
.suggestion-box {
|
||||
@ -194,6 +195,14 @@
|
||||
background-color: #f0f0f0;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
table th.action,
|
||||
table th.disableborder,
|
||||
table td.action,
|
||||
table td.disableborder {
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
@ -362,7 +371,7 @@
|
||||
<div class="form-row" id="input_for_row">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary" onclick="constructURL(1)">Send Mail</button>
|
||||
</div>
|
||||
@ -411,9 +420,9 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-12">
|
||||
<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 class="form-group col-md-12">
|
||||
@ -423,9 +432,9 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<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>
|
||||
</div><!-- /.modal-content -->
|
||||
@ -508,9 +517,9 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<div class="form-group col-md-12">
|
||||
<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>
|
||||
@ -641,7 +650,7 @@
|
||||
|
||||
// Check if data is valid (not null or undefined) and is an 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);
|
||||
} else {
|
||||
addSuggestionsToTable();
|
||||
@ -1030,16 +1039,29 @@ function addSuggestionsToTable() {
|
||||
|
||||
console.log(' addSuggestionsToTable suggestions ', 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; ?>;
|
||||
console.log('leadType', leadType);
|
||||
|
||||
let renewal_or_rollover = "Proposal 1";
|
||||
if(leadType == 2){
|
||||
renewal_or_rollover = "Existing Renewal"
|
||||
}else if(leadType == 3){
|
||||
renewal_or_rollover = "Existing Rollover"
|
||||
if (leadType == 2) {
|
||||
renewal_or_rollover = "Existing Renewal";
|
||||
} else if (leadType == 3) {
|
||||
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(`
|
||||
${renewal_or_rollover}
|
||||
<span class="dropdown" onclick="showThreeDottedMenu(event)">
|
||||
@ -3137,9 +3159,9 @@ function appendInput(data) {
|
||||
}
|
||||
|
||||
html += `
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-12">
|
||||
<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>
|
||||
`;
|
||||
|
||||
@ -3197,9 +3219,9 @@ function appendInput(data) {
|
||||
`;
|
||||
|
||||
html += `
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-12">
|
||||
<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>
|
||||
`;
|
||||
|
||||
@ -3576,7 +3598,7 @@ function ajaxRequest(formData) {
|
||||
$('#cc').val('').select2({
|
||||
placeholder : 'select CC Mail'
|
||||
});
|
||||
$('#subject').val('');
|
||||
// $('#subject').val('');
|
||||
$('#proposals').val('');
|
||||
$('#placement_to').val('').select2({
|
||||
placeholder : 'select To Mail'
|
||||
@ -3653,7 +3675,7 @@ $('.close').click(function(){
|
||||
$('#cc').val('').select2({
|
||||
placeholder : 'select CC Mail'
|
||||
});
|
||||
$('#subject').val('');
|
||||
// $('#subject').val('');
|
||||
$('#proposals').val('');
|
||||
$('#placement_to').val('').select2({
|
||||
placeholder : 'select To Mail'
|
||||
@ -3806,7 +3828,7 @@ function constructInsurerNameWithVersion(proposal_name, insurerName) {
|
||||
let newDisplayName = `${insurerName}-V${maxVersion + 1}`;
|
||||
return newDisplayName;
|
||||
}
|
||||
return false;
|
||||
return insurerName;
|
||||
}
|
||||
|
||||
function checkTheTableDataChanged(redirect_type, url){
|
||||
@ -4441,7 +4463,7 @@ function jsonToTable(json) {
|
||||
//Premium Calculation child table
|
||||
function populateTable(json) {
|
||||
|
||||
console.log(json);
|
||||
console.log('populateTable json data', json);
|
||||
|
||||
const table = document.getElementById("rfqTable_for_calc");
|
||||
const thead = document.createElement("thead");
|
||||
@ -4458,7 +4480,7 @@ function populateTable(json) {
|
||||
let randomColor = 'hsl(' + Math.random() * 360 + ', 100%, 93%)';
|
||||
|
||||
// Skip unwanted parent headers
|
||||
if (!["Item Key", "Action"].includes(header.parentHeader)) {
|
||||
if (!["Item Key"].includes(header.parentHeader)) {
|
||||
// console.log(header.parentHeader);
|
||||
|
||||
// Create the parent header
|
||||
@ -4473,7 +4495,12 @@ function populateTable(json) {
|
||||
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;
|
||||
}
|
||||
// Calculate colspan based on the number of subheaders
|
||||
@ -4507,7 +4534,12 @@ function populateTable(json) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -4554,7 +4586,7 @@ function populateTable(json) {
|
||||
|
||||
// Create a td for each subheader
|
||||
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) => {
|
||||
|
||||
// if(value != '-'){
|
||||
@ -4568,6 +4600,13 @@ function populateTable(json) {
|
||||
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(
|
||||
'editablecolumnsforcalc',
|
||||
label.toLowerCase().replace(/\s+/g, '').replace(/[%₹()]/g, '')
|
||||
@ -4582,6 +4621,7 @@ function populateTable(json) {
|
||||
}
|
||||
|
||||
// td.id = `${label.toLowerCase()}`;
|
||||
console.log('child table', header.parentHeader);
|
||||
td.textContent = json.premium_data?.data?.[header.parentHeader]?.[value]?.[label] || "";
|
||||
tr.appendChild(td);
|
||||
// }
|
||||
@ -5626,7 +5666,7 @@ function autoCaluculationForPremiumChildTable(input) {
|
||||
.qcr === 0);
|
||||
if (actionData) first_json.table_data.data.splice(rowKey, 1);
|
||||
});
|
||||
|
||||
|
||||
console.log("Modified JSON:", first_json);
|
||||
return first_json;
|
||||
}
|
||||
|
||||
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