Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
30776868b9
@ -51,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");
|
||||
@ -404,6 +404,7 @@ $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");
|
||||
});
|
||||
|
||||
|
||||
@ -530,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"))
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -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 assist?');
|
||||
$bot->startConversation(new MainMenuConversation());
|
||||
if ($this->isMemberLoggedIn){
|
||||
$bot->reply('Hi how can i assist?');
|
||||
$bot->startConversation(new MainMenuConversation());
|
||||
}else {
|
||||
$bot->startConversation(new LoginToContiueConversation());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
@ -3679,7 +3679,10 @@ class ClientController extends AdminController
|
||||
{
|
||||
// ---------for client-----------------------------------------------------------------------------
|
||||
|
||||
$clients = $this->clientModel->where('is_active', 1)->findAll();
|
||||
$clients = $this->clientModel
|
||||
->select("*, DATE_FORMAT(dob, '%d-%m-%Y') as dob")
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$clientIds = array_column($clients, 'id');
|
||||
|
||||
@ -3814,7 +3817,7 @@ class ClientController extends AdminController
|
||||
// Add additional fields if client type is 2
|
||||
if ($client_type == 2) {
|
||||
$client_data = array_merge($client_data, [
|
||||
'dob' => $postData['dob'],
|
||||
'dob' => change_date_format($postData['dob'],'d/m/Y','Y-m-d'),
|
||||
'aadhar' => $postData['aadhar'],
|
||||
'phone' => $postData['phone'],
|
||||
'email' => $postData['email'],
|
||||
@ -4295,7 +4298,7 @@ class ClientController extends AdminController
|
||||
// dd($policyTerms);
|
||||
// Re-encode the ordered policy terms
|
||||
$updatedPolicyTerms = json_encode($policyTerms);
|
||||
dd($updatedPolicyTerms);
|
||||
// dd($updatedPolicyTerms);
|
||||
|
||||
// dd($orderedPolicyTerms, $updatedPolicyTerms);
|
||||
$this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]);
|
||||
@ -4574,7 +4577,7 @@ class ClientController extends AdminController
|
||||
|
||||
$employeeRestController = new EmployeeServiceController();
|
||||
// $employeeRestController->excelFileDataValidation(['file_id' => 823]);
|
||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 644]);
|
||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 726]);
|
||||
// $employeeRestController->employeesOnboardProcess(['file_id' => 835]);
|
||||
// $employeeRestController->employeesEnrollmentInsert(['file_id' => 836]);
|
||||
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
|
||||
@ -4705,6 +4708,9 @@ class ClientController extends AdminController
|
||||
// $this->loadLayout('tat_report_band_wise_list', $reportData);
|
||||
// $data = $ticketModel->getTATReport(1);
|
||||
|
||||
// $empmodel = new EmployeeModel();
|
||||
// $data = $empmodel->getEmployeePolicy(348);
|
||||
// dd($data);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
@ -4897,26 +4903,22 @@ class ClientController extends AdminController
|
||||
$memberData = [];
|
||||
$dataForClientAndInsurer = [];
|
||||
|
||||
$acms = db_connect()->table('user_profiles')
|
||||
->select('user_profiles.id, user_profiles.first_name')
|
||||
->where('user_profiles.is_active', 1)
|
||||
->where('user_profiles.role', 3)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
// $acms = db_connect()->table('user_profiles')
|
||||
// ->select('user_profiles.id, user_profiles.first_name')
|
||||
// ->where('user_profiles.is_active', 1)
|
||||
// ->where('user_profiles.role', 3)
|
||||
// ->get()
|
||||
// ->getResultArray();
|
||||
|
||||
if(!empty($data) && count($data) > 0){
|
||||
|
||||
$memberData = $this->employeeModel->getEmployeeByEmployeeCode($data['emp_code'], $data['policy_id'], $client_id);
|
||||
|
||||
$acms = $this->clientRMModel
|
||||
->select('user_profiles.id, user_profiles.first_name')
|
||||
->join('clients', 'client_rm.client_id = clients.id', 'left')
|
||||
->join('user_profiles', 'client_rm.user_id = user_profiles.id', 'left')
|
||||
->where('clients.is_active', 1)
|
||||
->where('client_rm.is_active', 1)
|
||||
->where('user_profiles.is_active', 1)
|
||||
->where('clients.id', $data['client_id'])
|
||||
->findAll();
|
||||
$acms_datas = $this->employeeModel->getAcmUsingClientID($data['client_id']);
|
||||
// if(!empty($acms_datas)){
|
||||
// $acms = $acms_datas;
|
||||
// }
|
||||
}else{
|
||||
$acms_datas = "";
|
||||
}
|
||||
|
||||
|
||||
@ -4933,7 +4935,7 @@ class ClientController extends AdminController
|
||||
'type' => $type,
|
||||
'dataForClientAndInsurer' => $dataForClientAndInsurer,
|
||||
'memberData' => $memberData,
|
||||
'acms' => $acms,
|
||||
'acms' => $acms_datas,
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond([
|
||||
@ -4945,7 +4947,7 @@ class ClientController extends AdminController
|
||||
'type' => $type,
|
||||
'dataForClientAndInsurer' => $dataForClientAndInsurer,
|
||||
'memberData' => $memberData,
|
||||
'acms' => $acms
|
||||
'acms' => $acms_datas
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -1640,6 +1640,7 @@ class EmployeeServiceController extends AdminController
|
||||
$value['updated_by'] = $file['created_by'];
|
||||
$value['id'] = $employee[0]['id'];
|
||||
$value['emp_status'] = 'active';
|
||||
$value['family_floater_key'] = generate_family_floater_key($value['relationship']);
|
||||
$value['client_branch_id'] = $file['client_branch_id'];
|
||||
$value['file_id'] = isset($employee[0]['file_id']) && $employee[0]['file_id'] != '' ? $employee[0]['file_id'] : $file['id'] ;
|
||||
$log_message = 'Update Employee - '.$employee[0]['name'].'('.$employee[0]['emp_code'].') with PK '.$employee[0]['id'];
|
||||
|
||||
@ -2384,6 +2384,11 @@ class LeadsController extends BaseController
|
||||
|
||||
return $financialYears;
|
||||
}
|
||||
|
||||
public function rfqNonEB(){
|
||||
|
||||
$this->loadLayout('view_rfq_non_eb');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1746,6 +1746,7 @@ class MasterController extends AdminController
|
||||
'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) {
|
||||
|
||||
@ -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{
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -102,70 +102,68 @@ class RestAuthenticationController extends AdminController
|
||||
{
|
||||
try {
|
||||
$email = $this->request->getJSON()->email;
|
||||
|
||||
|
||||
$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.email_corporate', $email)
|
||||
->where('EP.is_active', 1)
|
||||
->whereIn('EP.status', ['active'])
|
||||
->first();
|
||||
|
||||
if (isset($employeeData['employee_id']))
|
||||
{
|
||||
|
||||
$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
|
||||
@ -45,6 +48,8 @@ class TicketController extends BaseController
|
||||
protected $triggerType;
|
||||
protected $userModel;
|
||||
protected $employeeModel;
|
||||
protected $clientPolicyModel;
|
||||
protected $employeePolicyModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -80,10 +85,10 @@ class TicketController extends BaseController
|
||||
];
|
||||
$this->claimType = [
|
||||
1 => [
|
||||
1 => "Main",
|
||||
1 => "Main Hospitalization",
|
||||
3 => "Pre / Post",
|
||||
2 => "OPD",
|
||||
3 => "Pre ReOpen",
|
||||
4 => "Post ReOpen",
|
||||
4 => "ReOpen",
|
||||
],
|
||||
2 => [
|
||||
1 => "TTD",
|
||||
@ -114,6 +119,7 @@ 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'],
|
||||
@ -157,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()
|
||||
@ -432,6 +440,11 @@ class TicketController extends BaseController
|
||||
// $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)) {
|
||||
@ -439,7 +452,6 @@ class TicketController extends BaseController
|
||||
$template_data['subject'] = $this->replacePlaceholders($template_data['subject'], $ticket_data);
|
||||
}
|
||||
$data = $this->ticket_form_data($ticket_data['ticket_type_id'], $ticket_data['claim_status_id']);
|
||||
$data['ticket_data'] = $ticket_data;
|
||||
$data['reply_data'] = $template_data;
|
||||
$data['placeHolders'] = $this->placeHolders;
|
||||
$data['message_data'] = $this->getTicketMessage($ticket_id);
|
||||
@ -447,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);
|
||||
@ -789,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
|
||||
@ -841,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);
|
||||
@ -1208,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)
|
||||
@ -1433,5 +1332,116 @@ class TicketController extends BaseController
|
||||
|
||||
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
|
||||
$doi = $this->employeePolicyModel->select('date_coverage,basic_cover_si')->where('client_policy_id',$client_policy_id)->first();
|
||||
$emp['dob'] = date('d/m/Y', strtotime($emp['dob']));
|
||||
$emp['doj'] = date('d/m/Y', strtotime($emp['doj']));
|
||||
$emp['date_of_inception'] = date('d/m/Y', strtotime($doi['date_coverage']));
|
||||
$emp['basic_cover_si'] = $doi['basic_cover_si'];
|
||||
}
|
||||
}
|
||||
|
||||
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,client_policy.policy_no')
|
||||
->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.');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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)
|
||||
@ -273,5 +287,21 @@ class EmployeeModel extends Model
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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(
|
||||
(
|
||||
|
||||
@ -72,6 +72,8 @@ class TicketMasterModel extends Model
|
||||
'non_id_reason',
|
||||
'head_rejection_reason',
|
||||
'pay_initiate_date',
|
||||
'emp_personal_mail',
|
||||
'client_policy_id'
|
||||
|
||||
];
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
@ -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>
|
||||
|
||||
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>
|
||||
@ -734,17 +734,23 @@ 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.dob ? ('- (' + item.dob + ' )' ) : '') + (item.pan ? ('- ' + item.pan ) : '');
|
||||
// console.log(client_show_name);
|
||||
}
|
||||
|
||||
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)
|
||||
@ -1249,7 +1255,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();
|
||||
|
||||
@ -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>
|
||||
@ -1,3 +1,17 @@
|
||||
<style>
|
||||
.readonly-color {
|
||||
background-color: #e0e0e0;
|
||||
/* Darker background */
|
||||
color: #666;
|
||||
/* Darker text color */
|
||||
}
|
||||
|
||||
.readonly-select {
|
||||
pointer-events: none;
|
||||
background-color: #f0f0f0;
|
||||
color: #666;
|
||||
}
|
||||
</style>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="<?= !isset($ticket_data) ? "card" : "" ?>" style="margin-right: 23px;">
|
||||
@ -32,32 +46,32 @@
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_code">Employee ID <i class="fa fa-search text-danger"
|
||||
<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">
|
||||
name="emp_code" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_name">Employee Name<span class="text-danger"></span></label>
|
||||
<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">
|
||||
name="emp_name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="insured_name"> Insured Name <span class="text-danger"></span></label>
|
||||
<label for="insured_name"> Insured Name <span class="text-danger">*</span></label>
|
||||
<input type=hidden id="insured_emp_id" name="insured_emp_id" value="<?= isset($ticket_data['insured_emp_id']) ? $ticket_data['insured_emp_id'] : '' ?>">
|
||||
<input class="form-control" id="insured_name" name="insured_name" value="<?= isset($ticket_data['insured_name']) ? $ticket_data['insured_name'] : '' ?>">
|
||||
<input class="form-control" id="insured_name" name="insured_name" value="<?= isset($ticket_data['insured_name']) ? $ticket_data['insured_name'] : '' ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="relationship"> Relationship <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="relationship" name="relationship">
|
||||
<option value="0">Select Relationship</option>
|
||||
<label for="relationship"> Relationship <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="relationship" name="relationship" required>
|
||||
<option value="">Select Relationship</option>
|
||||
<?php
|
||||
if (isset($relationshipType) && count($relationshipType)) {
|
||||
foreach ($relationshipType as $key => $value) {
|
||||
@ -70,62 +84,82 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="policy_no">Policy No<span class="text-danger"></span></label>
|
||||
<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" placeholder="Policy Number" >
|
||||
name="policy_no" placeholder="Policy Number">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="tpa_id">TPA ID<span class="text-danger"></span></label>
|
||||
<label for="tpa_id">TPA ID <span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="tpa_no" placeholder="Enter TPA ID"
|
||||
value="<?= isset($ticket_data['tpa_no']) ? $ticket_data['tpa_no'] : '' ?>"
|
||||
name="tpa_no">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_mobile">Employee Mobile No<span class="text-danger"></span></label>
|
||||
<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">
|
||||
name="emp_mobile" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_mail">Employee Mail ID<span class="text-danger"></span></label>
|
||||
<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">
|
||||
name="emp_mail" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_name">Corporate Name<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="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>
|
||||
<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>
|
||||
<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>
|
||||
<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="setMinDateDOA(this.value)">
|
||||
<?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="">Policy</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="tpa_id">TPA<span class="text-danger"></span></label>
|
||||
<label for="tpa_id">TPA <span class="text-danger"></span></label>
|
||||
<input type=hidden id="tpa_id" name="tpa_id" value="<?= isset($ticket_data['tpa_id']) ? $ticket_data['tpa_id'] : '' ?>">
|
||||
<input type=text class="form-control" id="tpa_name" placeholder="TPA" value="<?= isset($ticket_data['tpa_name']) ? $ticket_data['tpa_name'] : '' ?>" readonly>
|
||||
</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">
|
||||
<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>";
|
||||
}
|
||||
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>
|
||||
@ -133,6 +167,7 @@
|
||||
</div>
|
||||
<!-- end first_data_points -->
|
||||
|
||||
<br><br>
|
||||
<h5>Claim Details</h5>
|
||||
<hr>
|
||||
|
||||
@ -140,39 +175,39 @@
|
||||
<div class="form-row">
|
||||
|
||||
<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">
|
||||
<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>";
|
||||
}
|
||||
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="priority">Priority<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="priority" name="priority">
|
||||
<label for="priority">Priority <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="priority" name="priority" required>
|
||||
<!-- <option value="0">Select Priority</option> -->
|
||||
<?php
|
||||
if (isset($priorityType) && count($priorityType)) {
|
||||
foreach ($priorityType as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['priority'] == $key) ? 'selected' : '';
|
||||
echo "<option value=" . $key . " $selected>" . $value . "</option>";
|
||||
}
|
||||
if (isset($priorityType) && count($priorityType)) {
|
||||
foreach ($priorityType as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['priority'] == $key) ? 'selected' : '';
|
||||
echo "<option value=" . $key . " $selected>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mode_of_intimation"> Mode of Intimation <span
|
||||
class="text-danger"></span></label>
|
||||
<select class="form-control" id="mode_of_intimation" name="mode_of_intimation">
|
||||
<label for="mode_of_intimation"> Mode of Submission <span
|
||||
class="text-danger">*</span></label>
|
||||
<select class="form-control" id="mode_of_intimation" name="mode_of_intimation" required>
|
||||
<!-- <option value="0">Select Mode</option> -->
|
||||
<?php
|
||||
if (isset($modeOFIntimate) && count($modeOFIntimate)) {
|
||||
@ -186,8 +221,8 @@
|
||||
</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">
|
||||
<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)) {
|
||||
@ -201,36 +236,36 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="hospital_name">Hospital Name<span class="text-danger"></span></label>
|
||||
<label for="hospital_name">Hospital Name <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="hospital_name"
|
||||
placeholder="Enter Hospital Name"
|
||||
value="<?= isset($ticket_data['hospital_name']) ? $ticket_data['hospital_name'] : '' ?>"
|
||||
name="hospital_name">
|
||||
name="hospital_name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="doa">DOA<span class="text-danger"></span></label>
|
||||
<label for="doa">DOA <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="doa" placeholder="Enter DOA"
|
||||
value="<?= isset($ticket_data['doa']) ? $ticket_data['doa'] : '' ?>"
|
||||
name="doa">
|
||||
name="doa" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="dod">DOD<span class="text-danger"></span></label>
|
||||
<label for="dod">DOD <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="dod" placeholder="Enter DOD"
|
||||
value="<?= isset($ticket_data['dod']) ? $ticket_data['dod'] : '' ?>" name="dod">
|
||||
value="<?= isset($ticket_data['dod']) ? $ticket_data['dod'] : '' ?>" name="dod" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="claim_amount">Claim Amount<span class="text-danger"></span></label>
|
||||
<label for="claim_amount">Claim Amount <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="claim_amount"
|
||||
placeholder="Enter Claim Amount"
|
||||
value="<?= isset($ticket_data['claim_amount']) ? $ticket_data['claim_amount'] : '' ?>"
|
||||
name="claim_amount">
|
||||
name="claim_amount" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label id="pod_no_label_1" for="pod_no">POD No<span id="pod_no_label_1_span" class="text-danger"></span></label>
|
||||
<label id="pod_no_label_1" for="pod_no">POD No with Courier Name <span id="pod_no_label_1_span" class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="pod_no" placeholder="Enter POD NO"
|
||||
value="<?= isset($ticket_data['pod_no']) ? $ticket_data['pod_no'] : '' ?>"
|
||||
name="pod_no">
|
||||
@ -239,6 +274,7 @@
|
||||
</div>
|
||||
<!-- end second_data_points -->
|
||||
|
||||
<br><br>
|
||||
<h5>Additional Details</h5>
|
||||
<hr>
|
||||
|
||||
@ -246,7 +282,7 @@
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3 up_cnu" style="display: none;">
|
||||
<label for="claim_number">Claim Number<span class="text-danger"></span></label>
|
||||
<label for="claim_number">Claim Number <span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="claim_number" placeholder="Enter Claim NO"
|
||||
value="<?= isset($ticket_data['claim_number']) ? $ticket_data['claim_number'] : '' ?>"
|
||||
name="claim_number">
|
||||
@ -335,22 +371,22 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6 returned" style="display: none;">
|
||||
<label for="awb_no_courier_name">AWB No with Courier Name</label>
|
||||
<label for="awb_no_courier_name">Return 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 class="form-group col-md-3 non_id" style="display: none;">
|
||||
<label for="non_id_reason">Non ID Reason</label>
|
||||
<label for="non_id_reason">Non ID Reason <span id="non_id_reason_lable_id" class="text-danger"></span></label>
|
||||
<select class="form-control" id="non_id_reason" name="non_id_reason">
|
||||
<option value="">Select Reason</option>
|
||||
<?php
|
||||
if (isset($nonIDReason) && count($nonIDReason)) {
|
||||
foreach ($nonIDReason as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['non_id_reason'] == $key) ? 'selected' : '';
|
||||
echo "<option value='" . $key . "' $selected>" . $value . "</option>";
|
||||
}
|
||||
if (isset($nonIDReason) && count($nonIDReason)) {
|
||||
foreach ($nonIDReason as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['non_id_reason'] == $key) ? 'selected' : '';
|
||||
echo "<option value='" . $key . "' $selected>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
@ -387,12 +423,23 @@
|
||||
|
||||
<script>
|
||||
let GlobelExtraFields = [];
|
||||
var doa;
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#emp_client_policy").select2();
|
||||
|
||||
var policy_id = $("#emp_client_policy").val();
|
||||
if (policy_id != null && policy_id != "") {
|
||||
$("#emp_client_policy").addClass('readonly-select').select2('destroy');
|
||||
}
|
||||
// getClientPolicy();
|
||||
var doa = flatpickr("#doa", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
allowInput: false,
|
||||
onChange: function(selectedDates) {
|
||||
let selectedDOA = selectedDates[0]; // Get selected DOA date
|
||||
dod.set("minDate", selectedDOA); // Set DOD minDate to DOA
|
||||
}
|
||||
});
|
||||
|
||||
var dod = flatpickr("#dod", {
|
||||
@ -563,7 +610,46 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('.' + thirdClass).find('input, textarea').attr('required', true);
|
||||
// $('.' + 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;
|
||||
|
||||
$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);
|
||||
|
||||
// ✅ 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);
|
||||
} else {
|
||||
$label.find('.text-danger').remove();
|
||||
console.log("input ", $inputs);
|
||||
// $inputs.prop('required', false);
|
||||
$('.' + thirdClass).find('input, textarea,select').attr('required', false);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@ -585,7 +671,7 @@
|
||||
if ($parentDiv.length) {
|
||||
let thirdClass = $parentDiv.attr("class").split(" ")[2] || "";
|
||||
console.log('thirdClass', thirdClass);
|
||||
addRequiredFieldSymbolByClass(thirdClass);
|
||||
// addRequiredFieldSymbolByClass(thirdClass);
|
||||
// addRequiredFieldSymbol(targetId);
|
||||
if (thirdClass) {
|
||||
// console.log("fields",fields);
|
||||
@ -606,76 +692,341 @@
|
||||
}
|
||||
});
|
||||
|
||||
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 addRequiredFieldSymbol(field_name) {
|
||||
// // Find the field with the given name
|
||||
// var $field = $(`[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>');
|
||||
// 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) {
|
||||
var $divsWithClass = $(`.${className}`);
|
||||
|
||||
if ($divsWithClass.length) {
|
||||
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();
|
||||
console.log("Selected claim status ID:", selectedClaimStatus);
|
||||
console.log("Extra Field Array:", extrafieldsArray[selectedClaimStatus]);
|
||||
|
||||
// ✅ Check if at least one field inside the class has a value
|
||||
// var hasValue = $divsWithClass.find('input, textarea, select').filter(function () {
|
||||
// return $(this).val().trim() !== ''; // Check if at least one field is not empty
|
||||
// }).length > 0;
|
||||
|
||||
// $divsWithClass.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);
|
||||
|
||||
// // ✅ 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);
|
||||
// } else {
|
||||
// $label.find('.text-danger').remove();
|
||||
// console.log("input ",$inputs);
|
||||
// $inputs.prop('required', false);
|
||||
// }
|
||||
// });
|
||||
|
||||
console.log(`Processed ${$divsWithClass.length} labels with class "${className}"`);
|
||||
} else {
|
||||
console.warn(`No divs found with class="${className}"`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('#mode_of_intimation').change(function() {
|
||||
console.log("function called");
|
||||
var mode_of_intimation = $('#mode_of_intimation').val();
|
||||
console.log('mode of ', mode_of_intimation);
|
||||
|
||||
if (mode_of_intimation == 2) {
|
||||
$('#pod_no').attr('required', 'required');
|
||||
$('#pod_no_label_1_span').text("*");
|
||||
} else {
|
||||
$('#pod_no').removeAttr('required', false);
|
||||
$('#pod_no_label_1_span').text("");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$("#empIDHidden").change(function() {
|
||||
console.log("change is detected in hidden branch id");
|
||||
getClientPolicy();
|
||||
})
|
||||
|
||||
function getClientPolicy() {
|
||||
console.log("get policy function called");
|
||||
hiddenData = $("#empIDHidden").val();
|
||||
hiddenData = JSON.parse(hiddenData);
|
||||
console.log('employee id ', 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);
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`Added required symbol to ${$divsWithClass.length} labels with class "${className}"`);
|
||||
} else {
|
||||
console.warn(`No divs found with class="${className}"`);
|
||||
}
|
||||
}
|
||||
|
||||
$('#mode_of_intimation').change(function(){
|
||||
console.log("function called");
|
||||
var mode_of_intimation = $('#mode_of_intimation').val();
|
||||
console.log('mode of ',mode_of_intimation);
|
||||
|
||||
if (mode_of_intimation == 2){
|
||||
$('#pod_no').attr('required', 'required');
|
||||
$('#pod_no_label_1_span').text("*");
|
||||
}else{
|
||||
$('#pod_no').removeAttr('required', false);
|
||||
$('#pod_no_label_1_span').text("");
|
||||
//append the clients policy data to the modal
|
||||
// function appendPolicyDropdown(data) {
|
||||
// console.log("second function is called : ", data);
|
||||
// let ticket_type = $('#ticket_type_id').val();
|
||||
// hiddenData = $("#empIDHidden").val();
|
||||
// hiddenData = JSON.parse(hiddenData);
|
||||
// let branch_id = hiddenData['branch_id'];
|
||||
// let policy_id = hiddenData['policy_id'];
|
||||
// let searchType = hiddenData['searchType'];
|
||||
// data = data[branch_id];
|
||||
// console.log("branch filtered data ", data);
|
||||
// $('#emp_client_policy').empty();
|
||||
|
||||
// $('#emp_client_policy').append($('<option>', {
|
||||
// value: '',
|
||||
// text: 'Select Client Policy'
|
||||
// }));
|
||||
|
||||
// $.each(data, function(index, item) {
|
||||
// // console.log('inside the loop for this time count : ',item);
|
||||
// console.log("debugging policy type id : ", item.id);
|
||||
// if (ticket_type == 1) {
|
||||
// console.log("inside if condition 1");
|
||||
|
||||
// if (item.policy_type_id == 2 || item.policy_type_id == 3 || item.policy_type_id == 4 || item
|
||||
// .policy_type_id == 5) {
|
||||
// console.log("inside if condition 2");
|
||||
|
||||
// if (policy_id == item.id) {
|
||||
// console.log("inside if condition 3");
|
||||
|
||||
// var option = $('<option>', {
|
||||
// value: item.id,
|
||||
// text: item.policy_type + '-' + item.policy_no,
|
||||
// });
|
||||
|
||||
// $('#emp_client_policy').append(option).select2();
|
||||
// if (searchType != null && searchType != "") {
|
||||
// $('#emp_client_policy').val(item.id).addClass('readonly-select').select2('destroy');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else if (ticket_type == 2) {
|
||||
|
||||
// if (item.policy_type_id == 1) {
|
||||
// var option = $('<option>', {
|
||||
// value: item.id,
|
||||
// text: item.policy_type + '-' + item.policy_no,
|
||||
// });
|
||||
|
||||
// $('#emp_client_policy').append(option).select2();
|
||||
// }
|
||||
|
||||
// } else if (ticket_type == 3) {
|
||||
|
||||
// if (item.policy_type_id == 6) {
|
||||
// var option = $('<option>', {
|
||||
// value: item.id,
|
||||
// text: item.policy_type + '-' + item.policy_no,
|
||||
// });
|
||||
|
||||
// $('#emp_client_policy').append(option).select2();
|
||||
// }
|
||||
|
||||
// } else if (ticket_type == 4) {
|
||||
|
||||
// if (item.policy_type == 7) {
|
||||
// var option = $('<option>', {
|
||||
// value: item.id,
|
||||
// text: item.policy_type + '-' + item.policy_no,
|
||||
// });
|
||||
|
||||
// $('#emp_client_policy').append(option).select2();
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// });
|
||||
// console.log("loop is completed");
|
||||
// setMinDateDOA(policy_id);
|
||||
// }
|
||||
|
||||
function appendPolicyDropdown(data) {
|
||||
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'
|
||||
}));
|
||||
console.log("got data from backend ",data);
|
||||
let policyCount = 1;
|
||||
var policyAppendCount = 0;
|
||||
$.each(data, function(index, item) {
|
||||
// console.log(item);
|
||||
|
||||
if (ticket_type == 1 && item.policy_type_id != 1) {
|
||||
$('#emp_client_policy').append($('<option>', {
|
||||
value: item.client_policy_value,
|
||||
text: item.client_policy_name
|
||||
}));
|
||||
$("#policy_no").val("");
|
||||
if (policyCount == 1){
|
||||
console.log("policy count from if",item.policy_no);
|
||||
$("#policy_no").val(item.policy_no);
|
||||
}else{
|
||||
console.log("policy count from greter if ","");
|
||||
$("#policy_no").val("");
|
||||
}
|
||||
policyCount++;
|
||||
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
|
||||
// }));
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
console.log('policy append count ',policyAppendCount);
|
||||
if (policyAppendCount == 0){
|
||||
toastr.warning("No Policies found for the Employee","Warning");
|
||||
}
|
||||
}
|
||||
// $('#emp_client_policy').select2();
|
||||
$("#emp_client_policy").on('change', function() {
|
||||
var policy_name = $("#emp_client_policy option:selected").text();
|
||||
var policy_no = policy_name.split("-")[1];
|
||||
$("#policy_no").val(policy_no);
|
||||
console.log("change function called ");
|
||||
policy_id = $("#emp_client_policy").val();
|
||||
setMinDateDOA(policy_id);
|
||||
})
|
||||
|
||||
function setMinDateDOA(policy_id) {
|
||||
var policy_name = $("#emp_client_policy option:selected").text();
|
||||
var policy_no = policy_name.split("-")[1];
|
||||
$("#policy_no").val(policy_no);
|
||||
console.log("Function set min date called ");
|
||||
console.log("Existing DOA instance: ", doa);
|
||||
console.log('sent data ',policy_id);
|
||||
$.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>
|
||||
@ -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">
|
||||
@ -26,78 +26,102 @@
|
||||
<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) : "[]" ?>'>
|
||||
<input type="hidden" id="ticket_master_id" name="ticket_master_id" value="<?= isset($ticket_data['id']) ? $ticket_data['id'] : '' ?>">
|
||||
<input type="hidden" id="is_head_approved" name="is_head_approved" value="<?= isset($ticket_data['is_head_approved']) ? $ticket_data['is_head_approved'] : '' ?>">
|
||||
<input type="hidden" id="extra_fields_array_for_validate" name="extra_fields_array_for_validate" value='<?= isset($extra_fields_array_for_validate) && !empty($extra_fields_array_for_validate) ? json_encode($extra_fields_array_for_validate) : "[]" ?>'>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<h5>Employee Details</h5>
|
||||
<hr>
|
||||
|
||||
|
||||
<!-- first_data_points -->
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<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>
|
||||
<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">
|
||||
name="emp_code" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_name">Employee Name<span class="text-danger"></span></label>
|
||||
<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">
|
||||
name="emp_name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_mobile">Employee Mobile No<span class="text-danger"></span></label>
|
||||
<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">
|
||||
name="emp_mobile" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_mail">Employee Mail ID<span class="text-danger"></span></label>
|
||||
<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">
|
||||
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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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">
|
||||
<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>";
|
||||
}
|
||||
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>
|
||||
@ -105,6 +129,7 @@
|
||||
</div>
|
||||
<!-- end first_data_points -->
|
||||
|
||||
<br><br>
|
||||
<h5>Claim Details</h5>
|
||||
<hr>
|
||||
|
||||
@ -115,44 +140,44 @@
|
||||
<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_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>
|
||||
|
||||
<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="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="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>
|
||||
@ -174,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'] : '' ?>"
|
||||
@ -188,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'] : '' ?>"
|
||||
@ -196,22 +221,23 @@
|
||||
</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>
|
||||
|
||||
@ -278,7 +304,7 @@
|
||||
<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])) { ?>
|
||||
<?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>
|
||||
@ -289,212 +315,492 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let GlobelExtraFields = [];
|
||||
|
||||
let GlobelExtraFields = [];
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var date_of_join = flatpickr("#date_of_join", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var dob = flatpickr("#dob", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var date_of_incep = flatpickr("#date_of_incep", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var date_of_accident = flatpickr("#date_of_accident", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var date_of_death = flatpickr("#date_of_death", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var date_of_intimat = flatpickr("#date_of_intimat", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
flatpickr("#approved_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
flatpickr("#settled_date", { dateFormat: "d/m/Y", allowInput: false });
|
||||
|
||||
// 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);
|
||||
var date_of_join;
|
||||
var dob;
|
||||
var date_of_accident;
|
||||
var date_of_death;
|
||||
var date_of_intimat;
|
||||
|
||||
|
||||
})
|
||||
$(document).ready(function() {
|
||||
|
||||
function updateClaimStatusDisplay(value) {
|
||||
$("#emp_client_policy").select2();
|
||||
date_of_join = flatpickr("#date_of_join", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
console.log('value', value);
|
||||
dob = flatpickr("#dob", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
// Hide all sections first
|
||||
$('.settled, .approved, .canceled, .returned').hide();
|
||||
var date_of_incep = flatpickr("#date_of_incep", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
// 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());
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
$(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>');
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`Added required symbol to ${$divsWithClass.length} labels with class "${className}"`);
|
||||
} else {
|
||||
console.warn(`No divs found with class="${className}"`);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
});
|
||||
|
||||
flatpickr("#approved_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
flatpickr("#settled_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
// 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);
|
||||
|
||||
|
||||
})
|
||||
|
||||
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());
|
||||
});
|
||||
|
||||
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;
|
||||
console.log("got data from backend ",data);
|
||||
let policyCount = 1;
|
||||
$.each(data, function(index, item) {
|
||||
// console.log("item len",item.length);
|
||||
|
||||
if (ticket_type != 1 && item.policy_type_id != 2) {
|
||||
$('#emp_client_policy').append($('<option>', {
|
||||
value: item.client_policy_value,
|
||||
text: item.client_policy_name
|
||||
}));
|
||||
console.log("policy count from loop","");
|
||||
$("#policy_no").val("");
|
||||
if (policyCount == 1){
|
||||
console.log("policy count from if",item.policy_no);
|
||||
$("#policy_no").val(item.policy_no);
|
||||
}else{
|
||||
console.log("policy count from greter if ","");
|
||||
$("#policy_no").val("");
|
||||
}
|
||||
policyCount++;
|
||||
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 setPolicyNo(){
|
||||
var policy_name = $("#emp_client_policy option:selected").text();
|
||||
var policy_no = policy_name.split("-")[1];
|
||||
$("#policy_no").val(policy_no);
|
||||
console.log("after text split",policy_no);
|
||||
}
|
||||
|
||||
function setDateValidation(policy_id, memberset = null) {
|
||||
setPolicyNo();
|
||||
$.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 dateOfInception = response.empData[0].date_of_inception;
|
||||
var dobValue = response.empData[0].dob;
|
||||
var doj = response.empData[0].doj;
|
||||
var basicCoverSI = response.empData[0].basic_cover_si
|
||||
console.log('data received fro controller ', dob, doj);
|
||||
if (dobValue) {
|
||||
$("#dob").val(dobValue);
|
||||
$("#dob").addClass('readonly-select');
|
||||
}
|
||||
if (dateOfInception){
|
||||
$("#date_of_incep").val(dateOfInception);
|
||||
$("#date_of_incep").addClass('readonly-select');
|
||||
}
|
||||
if (doj) {
|
||||
$("#date_of_join").val(doj);
|
||||
$("#date_of_join").addClass('readonly-select');
|
||||
}
|
||||
|
||||
$("#si_amt").val(basicCoverSI);
|
||||
$("#si_amt").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
@ -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() {
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -5666,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