Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
581d2a4e92
@ -340,6 +340,8 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post('unmap_employees/(:num)', 'EmployeeController::unmapEmployees/$1');
|
||||
$routes->get('transformMailContent', 'LeadsController::transformMailContent');
|
||||
$routes->get('getCDAmount', 'ClientController::getCDAmount');
|
||||
$routes->get('getTheEmpDataForClaim/(:any)', 'ClientController::getTheEmpDataForClaim/$1');
|
||||
$routes->get('getTheEmpDataForClaimSearchByMobile/(:any)', 'ClientController::getTheEmpDataForClaimSearchByMobile/$1');
|
||||
});
|
||||
|
||||
$routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
@ -430,9 +432,14 @@ $routes->post("/employeeRest/verifyEmployeeEmailId", "RestAuthenticationControll
|
||||
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
|
||||
$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
|
||||
|
||||
// Test initiate Claim
|
||||
$routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
|
||||
|
||||
$routes->group("/api", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->post("logined", "RestAuthenticationController::logined");
|
||||
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
|
||||
$routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
|
||||
|
||||
});
|
||||
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
|
||||
$routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy");
|
||||
@ -475,6 +482,7 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
||||
$routes->get("getFEContent", "EmployeeRestController::getFEContent");
|
||||
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
||||
// $routes->post('postDataForTicket',"EmployeeRestController::postDataForTicket");
|
||||
});
|
||||
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
||||
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");
|
||||
@ -489,9 +497,10 @@ $routes->get("getBackToEnrolledDetails", "EmployeeRestController::getBackToEnrol
|
||||
|
||||
//BDSReports
|
||||
$routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->match( ['get', 'post'], 'irba_report','BDSReportController::irba_report');
|
||||
$routes->match( ['get', 'post'], 'irba_report','BDSReportController::irba_report');
|
||||
$routes->get('insurer_wise_data/(:any)','BDSReportController::Insurer_wise_Data/$1');
|
||||
$routes->get('bap_wise_data/(:any)','BDSReportController::Bap_Wise_Data/$1');
|
||||
$routes->match( ['get', 'post'], 'renewal_report','BDSReportController::renewalReport');
|
||||
|
||||
});
|
||||
|
||||
@ -500,8 +509,12 @@ $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->match( ['get', 'post'], 'list','TicketController::ticketList');
|
||||
$routes->get('new/(:any)','TicketController::ticket_form/$1');
|
||||
$routes->post('create','TicketController::createTicket');
|
||||
$routes->get('update','TicketController::updateTicket');
|
||||
$routes->post('update','TicketController::updateTicket');
|
||||
$routes->get('view/(:any)','TicketController::view_ticket/$1');
|
||||
$routes->get('mail_template','TicketController::createMailTemplate');
|
||||
$routes->get('mail_template','TicketController::mailTemplate');
|
||||
$routes->post('crud_mail_template/(:any)','TicketController::crudTemplate/$1');
|
||||
$routes->post('note/(:any)','TicketController::crudNote/$1');
|
||||
$routes->post('reply','TicketController::saveReply');
|
||||
// $routes->post('ticket_messages','TicketController::getTicketMessage');
|
||||
});
|
||||
|
||||
|
||||
@ -47,6 +47,39 @@ class BDSReportController extends AdminController
|
||||
$this->coShareStmtDetailsModel = new COShareStmtDetailsModel();
|
||||
$this->policyTypeModel = new PolicyTypeModel();
|
||||
}
|
||||
|
||||
// public function Insurer_wise_Data($insurerCategory, $fromDate, $toDate)
|
||||
// {
|
||||
|
||||
// $fromDate = \DateTime::createFromFormat('d-m-Y', $fromDate)->format('Y-m-d');
|
||||
// $toDate = \DateTime::createFromFormat('d-m-Y', $toDate)->format('Y-m-d');
|
||||
// try {
|
||||
// $sql = "
|
||||
// select 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 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 insurers ins
|
||||
// left join pt_co_share_details pt_co on ins.id = pt_co.insurer_id and pt_co.is_active = 1
|
||||
// left join co_share_stmt_details stmt on pt_co.id = stmt.co_share_id and stmt.is_active = 1
|
||||
// left join policy_transaction pt on pt_co.pt_id = pt.id and pt.is_active = 1 and pt.policy_issue_date >= '$fromDate' and pt.policy_issue_date <= '$toDate'
|
||||
// left join policy_type ptp on pt.policy_type_id = ptp.id and ptp.policy_category = $insurerCategory and ptp.is_active = 1
|
||||
// where ins.is_active = 1 and (ptp.policy_category = $insurerCategory or ptp.policy_category is null)
|
||||
// group by ins.id
|
||||
// ";
|
||||
|
||||
// $data['insurer_wise_data'] = $this->insurerModel->query($sql)->getResultArray();
|
||||
// // log_message('error',$this->insurerModel->getLastQuery());
|
||||
// // log_message('error',json_encode($data));
|
||||
// } catch (\Exception $e) {
|
||||
// $data['message'] = 'No data Found';
|
||||
// $this->myLogger->logme('error', $e->getMessage());
|
||||
// return $data;
|
||||
// }
|
||||
// return ($data);
|
||||
// }
|
||||
|
||||
public function Insurer_wise_Data($insurerCategory, $fromDate, $toDate)
|
||||
{
|
||||
|
||||
@ -54,18 +87,28 @@ class BDSReportController extends AdminController
|
||||
$toDate = \DateTime::createFromFormat('d-m-Y', $toDate)->format('Y-m-d');
|
||||
try {
|
||||
$sql = "
|
||||
select 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 stmt.co_share_id = pt_co.id and ptp.policy_category = $insurerCategory and pt_co.insurer_id = ins.id THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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
|
||||
from insurers ins
|
||||
left join pt_co_share_details pt_co on ins.id = pt_co.insurer_id and pt_co.is_active = 1
|
||||
left join co_share_stmt_details stmt on pt_co.id = stmt.co_share_id and stmt.is_active = 1
|
||||
left join policy_transaction pt on pt_co.pt_id = pt.id and pt.is_active = 1 and pt.policy_issue_date >= '$fromDate' and pt.policy_issue_date <= '$toDate'
|
||||
left join policy_type ptp on pt.policy_type_id = ptp.id and ptp.policy_category = $insurerCategory and ptp.is_active = 1
|
||||
where ins.is_active = 1 and (ptp.policy_category = $insurerCategory or ptp.policy_category is null)
|
||||
group by ins.id
|
||||
";
|
||||
SELECT
|
||||
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 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
|
||||
insurers ins
|
||||
LEFT JOIN
|
||||
pt_co_share_details pt_co ON ins.id = pt_co.insurer_id AND pt_co.is_active = 1
|
||||
LEFT JOIN
|
||||
co_share_stmt_details stmt ON pt_co.id = stmt.co_share_id AND stmt.is_active = 1
|
||||
LEFT JOIN
|
||||
policy_transaction pt ON pt_co.pt_id = pt.id AND pt.is_active = 1 AND pt.policy_issue_date >= '$fromDate' AND pt.policy_issue_date <= '$toDate'
|
||||
LEFT JOIN
|
||||
policy_type ptp ON pt.policy_type_id = ptp.id AND ptp.policy_category = $insurerCategory AND ptp.is_active = 1
|
||||
WHERE
|
||||
ins.is_active = 1 AND (ptp.policy_category = $insurerCategory OR ptp.policy_category IS NULL)
|
||||
GROUP BY
|
||||
ins.id;
|
||||
";
|
||||
|
||||
$data['insurer_wise_data'] = $this->insurerModel->query($sql)->getResultArray();
|
||||
// log_message('error',$this->insurerModel->getLastQuery());
|
||||
@ -88,12 +131,13 @@ class BDSReportController extends AdminController
|
||||
SELECT
|
||||
pot.bap AS bap,
|
||||
COALESCE(COUNT(DISTINCT pt.id), 0) AS Policies,
|
||||
COALESCE(SUM(co.actual_bp_amt + co.actual_tep_amt + co.actual_tp_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.bp_amt + pt_co.tp_amt + pt_co.tep_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
|
||||
LEFT JOIN policy_transaction AS pt ON pot.id = pt.policy_type_id AND pt.is_active = 1 AND pt.action_type = 'inception' and pt.policy_issue_date >= '$fromDate' and pt.policy_issue_date <= '$toDate'
|
||||
LEFT JOIN pt_co_share_details AS ptco ON pt.id = ptco.pt_id AND ptco.is_active = 1
|
||||
LEFT JOIN co_share_stmt_details AS co ON ptco.id = co.co_share_id AND co.is_active = 1
|
||||
LEFT JOIN pt_co_share_details AS pt_co ON pt.id = pt_co.pt_id AND pt_co.is_active = 1
|
||||
LEFT JOIN co_share_stmt_details AS co ON pt_co.id = co.co_share_id AND co.is_active = 1
|
||||
WHERE pot.is_active = 1
|
||||
AND pot.policy_category = $insurerCategory
|
||||
GROUP BY pot.bap;
|
||||
@ -219,57 +263,68 @@ class BDSReportController extends AdminController
|
||||
|
||||
$db = db_connect();
|
||||
$builder = $db->query("
|
||||
|
||||
select ins.id, ins.name as insurer_name,
|
||||
|
||||
-- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS health_premium,
|
||||
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 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS misc_premium,
|
||||
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 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS motor_premium,
|
||||
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 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS engineering_premium,
|
||||
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 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,
|
||||
|
||||
|
||||
|
||||
-- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS fire_premium,
|
||||
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 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS liability_premium,
|
||||
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 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS life_premium,
|
||||
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 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS marine_cargo_premium,
|
||||
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 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS marine_hull_premium,
|
||||
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 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,
|
||||
|
||||
-- Grand Totals
|
||||
COALESCE(
|
||||
@ -286,15 +341,15 @@ class BDSReportController extends AdminController
|
||||
) AS total_policy_count,
|
||||
|
||||
COALESCE(
|
||||
SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END)+
|
||||
SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END)+
|
||||
SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END),
|
||||
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),
|
||||
0
|
||||
) AS total_premium,
|
||||
|
||||
@ -374,49 +429,49 @@ 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS health_premium,
|
||||
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,
|
||||
|
||||
-- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS misc_premium,
|
||||
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,
|
||||
|
||||
-- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS motor_premium,
|
||||
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,
|
||||
|
||||
-- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS engineering_premium,
|
||||
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,
|
||||
|
||||
-- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS fire_premium,
|
||||
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,
|
||||
|
||||
-- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS liability_premium,
|
||||
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,
|
||||
|
||||
-- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS life_premium,
|
||||
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,
|
||||
|
||||
-- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS marine_cargo_premium,
|
||||
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,
|
||||
|
||||
-- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS marine_hull_premium,
|
||||
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,
|
||||
|
||||
-- Grand Totals
|
||||
COALESCE(SUM(CASE WHEN pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS total_policy_count,
|
||||
COALESCE(SUM(stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt), 0) AS total_premium
|
||||
COALESCE(SUM(pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_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'
|
||||
LEFT JOIN policy_type ptp ON pt.policy_type_id = ptp.id
|
||||
LEFT JOIN pt_co_share_details ptco ON ptco.pt_id = pt.id AND ptco.is_active = 1
|
||||
LEFT JOIN co_share_stmt_details stmt ON stmt.co_share_id = ptco.id AND stmt.is_active = 1
|
||||
LEFT JOIN pt_co_share_details pt_co ON pt_co.pt_id = pt.id AND pt_co.is_active = 1
|
||||
LEFT JOIN co_share_stmt_details stmt ON stmt.co_share_id = pt_co.id AND stmt.is_active = 1
|
||||
WHERE c.is_active = 1
|
||||
AND ptp.policy_category = $category
|
||||
GROUP BY c.id
|
||||
@ -487,13 +542,13 @@ class BDSReportController extends AdminController
|
||||
|
||||
COALESCE((
|
||||
select
|
||||
sum(stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt) as premium
|
||||
sum(pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) as premium
|
||||
from co_share_stmt_details stmt
|
||||
left join pt_co_share_details ptco on stmt.co_share_id = ptco.id
|
||||
left join policy_transaction pt on ptco.pt_id = pt.id
|
||||
left join pt_co_share_details pt_co on stmt.co_share_id = pt_co.id
|
||||
left join policy_transaction pt on pt_co.pt_id = pt.id
|
||||
where pt.client_id = c.id
|
||||
and stmt.is_active = 1
|
||||
and ptco.is_active = 1
|
||||
and pt_co.is_active = 1
|
||||
and pt.is_active = 1
|
||||
|
||||
), 0) as premium
|
||||
@ -518,4 +573,358 @@ class BDSReportController extends AdminController
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// //Function for get BAP INSURE wise data for premium , policy count , revenue only
|
||||
// public function getBAPInsurerData($category = 0, $start_date = null, $end_date = null)
|
||||
// {
|
||||
// try {
|
||||
// $this->myLogger->logme('error', 'getBAPInsurerData function called');
|
||||
// $this->myLogger->logme('error', 'category : {data}', ['data' => $category]);
|
||||
// $this->myLogger->logme('error', 'start date : {start_date} - end date {end_date} ', ['start_date' => $start_date, 'end_date' => $end_date]);
|
||||
|
||||
|
||||
// //set default last 3 months data date
|
||||
// $fromDate = date('Y-m-d', strtotime('-90 days'));
|
||||
// $toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
// if (!empty($start_date) && !empty($end_date)) {
|
||||
// $fromDate = change_date_format($start_date);
|
||||
// $toDate = change_date_format($end_date);
|
||||
// }
|
||||
|
||||
// $this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]);
|
||||
|
||||
// $db = db_connect();
|
||||
// $builder = $db->query("
|
||||
|
||||
// select ins.id, ins.name as insurer_name,
|
||||
|
||||
// -- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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,
|
||||
|
||||
// -- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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,
|
||||
|
||||
|
||||
// -- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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,
|
||||
|
||||
// -- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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,
|
||||
|
||||
|
||||
// -- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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,
|
||||
|
||||
// -- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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,
|
||||
|
||||
|
||||
// -- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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,
|
||||
|
||||
|
||||
// -- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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,
|
||||
|
||||
// -- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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,
|
||||
|
||||
// -- Grand Totals
|
||||
// COALESCE(
|
||||
// SUM(CASE WHEN ptp.bap = 'Health' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Life' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Motor' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Fire' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Engineering' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Liability' AND pt.action_type = 'inception' THEN 1 ELSE 0 END)+
|
||||
// SUM(CASE WHEN ptp.bap = 'Marine Cargo' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Misc' AND pt.action_type = 'inception' THEN 1 ELSE 0 END),
|
||||
// 0
|
||||
// ) AS total_policy_count,
|
||||
|
||||
// COALESCE(
|
||||
// SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END)+
|
||||
// SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END)+
|
||||
// SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END),
|
||||
// 0
|
||||
// ) AS total_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) +
|
||||
// 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) +
|
||||
// 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) +
|
||||
// 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) +
|
||||
// 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) +
|
||||
// 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) +
|
||||
// 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)+
|
||||
// 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)+
|
||||
// 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 total_revenue
|
||||
|
||||
// from insurers ins
|
||||
// left join pt_co_share_details pt_co on ins.id = pt_co.insurer_id and pt_co.is_active = 1
|
||||
// left join co_share_stmt_details stmt on pt_co.id = stmt.co_share_id and stmt.is_active = 1
|
||||
// left join policy_transaction pt on pt_co.pt_id = pt.id and pt.is_active = 1 AND pt.policy_issue_date >= '$fromDate' AND pt.policy_issue_date <= '$toDate'
|
||||
// left join policy_type ptp on pt.policy_type_id = ptp.id and ptp.policy_category = $category
|
||||
// where ins.is_active = 1
|
||||
// group by ins.id
|
||||
// ORDER BY
|
||||
// health_premium DESC,
|
||||
// misc_premium DESC,
|
||||
// motor_premium DESC,
|
||||
// engineering_premium DESC,
|
||||
// fire_premium DESC,
|
||||
// liability_premium DESC,
|
||||
// life_premium DESC,
|
||||
// marine_cargo_premium DESC,
|
||||
// marine_hull_premium DESC;
|
||||
|
||||
// ");
|
||||
|
||||
// // Get the query
|
||||
// $result = $builder->getResultArray();
|
||||
// $this->myLogger->logme('error', 'Query executed successfully.');
|
||||
// // dd(db_connect()->getLastQuery(),$result);
|
||||
// return $result;
|
||||
// } catch (\Exception $e) {
|
||||
|
||||
// // Log the exception details for debugging
|
||||
// $this->myLogger->logme('error', 'Error occurred in getBAPInsurerData: {message}', ['message' => $e->getMessage()]);
|
||||
// $this->myLogger->logme('error', 'Stack trace: {trace}', ['trace' => $e->getTraceAsString()]);
|
||||
// return [];
|
||||
// }
|
||||
// }
|
||||
|
||||
// //Function for get BAP CLIENT wise data for premium , policy count , revenue only
|
||||
// public function getBAPClientData($category = 0, $start_date = null, $end_date = null)
|
||||
// {
|
||||
|
||||
// try {
|
||||
// $this->myLogger->logme('error', 'getBAPClientData function called');
|
||||
// $this->myLogger->logme('error', 'category : {data}', ['data' => $category]);
|
||||
// $this->myLogger->logme('error', 'start date : {start_date} - end date {end_date} ', ['start_date' => $start_date, 'end_date' => $end_date]);
|
||||
|
||||
// //set default last 3 months data date
|
||||
// $fromDate = date('Y-m-d', strtotime('-90 days'));
|
||||
// $toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
// if (!empty($start_date) && !empty($end_date)) {
|
||||
// $fromDate = change_date_format($start_date);
|
||||
// $toDate = change_date_format($end_date);
|
||||
// }
|
||||
|
||||
// $this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]);
|
||||
|
||||
// $db = db_connect();
|
||||
// $builder = $db->query("
|
||||
|
||||
// SELECT
|
||||
// c.id AS client_id,
|
||||
// c.client_name,
|
||||
|
||||
// -- 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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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 stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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(stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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'
|
||||
// LEFT JOIN policy_type ptp ON pt.policy_type_id = ptp.id
|
||||
// LEFT JOIN pt_co_share_details ptco ON ptco.pt_id = pt.id AND ptco.is_active = 1
|
||||
// LEFT JOIN co_share_stmt_details stmt ON stmt.co_share_id = ptco.id AND stmt.is_active = 1
|
||||
// WHERE c.is_active = 1
|
||||
// AND ptp.policy_category = $category
|
||||
// GROUP BY c.id
|
||||
// ORDER BY
|
||||
// health_premium DESC,
|
||||
// misc_premium DESC,
|
||||
// motor_premium DESC,
|
||||
// engineering_premium DESC,
|
||||
// fire_premium DESC,
|
||||
// liability_premium DESC,
|
||||
// life_premium DESC,
|
||||
// marine_cargo_premium DESC,
|
||||
// marine_hull_premium DESC
|
||||
|
||||
// ");
|
||||
|
||||
// // Get the query
|
||||
// $result = $builder->getResultArray();
|
||||
// // dd(db_connect()->getLastQuery(),$result);
|
||||
// return $result;
|
||||
// } catch (\Exception $e) {
|
||||
|
||||
// // Log the exception details for debugging
|
||||
// $this->myLogger->logme('error', 'Error occurred in getBAPClientData: {message}', ['message' => $e->getMessage()]);
|
||||
// $this->myLogger->logme('error', 'Stack trace: {trace}', ['trace' => $e->getTraceAsString()]);
|
||||
// return [];
|
||||
// }
|
||||
// }
|
||||
|
||||
// //Function for get CLIENT wise data for premium and policy count only
|
||||
// public function getClientData($category = 0, $start_date = null, $end_date = null)
|
||||
// {
|
||||
|
||||
// try {
|
||||
|
||||
// $this->myLogger->logme('error', 'getClientData function called');
|
||||
// $this->myLogger->logme('error', 'category : {data}', ['data' => $category]);
|
||||
// $this->myLogger->logme('error', 'start date : {start_date} - end date {end_date} ', ['start_date' => $start_date, 'end_date' => $end_date]);
|
||||
|
||||
// //set default last 3 months data date
|
||||
// $fromDate = date('Y-m-d', strtotime('-90 days'));
|
||||
// $toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
// if (!empty($start_date) && !empty($end_date)) {
|
||||
// $fromDate = change_date_format($start_date);
|
||||
// $toDate = change_date_format($end_date);
|
||||
// }
|
||||
|
||||
// $this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]);
|
||||
|
||||
// $db = db_connect();
|
||||
// $builder = $db->query("
|
||||
|
||||
// select
|
||||
// c.id as client_id,
|
||||
// c.client_name,
|
||||
|
||||
// (
|
||||
// select
|
||||
// count(policy_transaction.id)
|
||||
// from policy_transaction
|
||||
// left join policy_type on policy_transaction.policy_type_id = policy_type.id
|
||||
// where policy_transaction.client_id = c.id
|
||||
// and policy_transaction.action_type = 'inception'
|
||||
// and policy_transaction.is_active = 1
|
||||
|
||||
// ) as policy_count,
|
||||
|
||||
// COALESCE((
|
||||
// select
|
||||
// sum(stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt) as premium
|
||||
// from co_share_stmt_details stmt
|
||||
// left join pt_co_share_details ptco on stmt.co_share_id = ptco.id
|
||||
// left join policy_transaction pt on ptco.pt_id = pt.id
|
||||
// where pt.client_id = c.id
|
||||
// and stmt.is_active = 1
|
||||
// and ptco.is_active = 1
|
||||
// and pt.is_active = 1
|
||||
|
||||
// ), 0) as premium
|
||||
|
||||
// from clients c
|
||||
// join policy_transaction on c.id = policy_transaction.client_id AND policy_transaction.policy_issue_date >= '$fromDate' AND policy_transaction.policy_issue_date <= '$toDate'
|
||||
// join policy_type on policy_transaction.policy_type_id = policy_type.id and policy_type.policy_category = $category
|
||||
// where c.is_active = 1
|
||||
// group by client_name
|
||||
// order by premium desc
|
||||
// ");
|
||||
|
||||
// // Get the query
|
||||
// $result = $builder->getResultArray();
|
||||
// // dd(db_connect()->getLastQuery(),$result);
|
||||
// return $result;
|
||||
// } catch (\Exception $e) {
|
||||
|
||||
// // Log the exception details for debugging
|
||||
// $this->myLogger->logme('error', 'Error occurred in getClientData: {message}', ['message' => $e->getMessage()]);
|
||||
// $this->myLogger->logme('error', 'Stack trace: {trace}', ['trace' => $e->getTraceAsString()]);
|
||||
// return [];
|
||||
// }
|
||||
// }
|
||||
|
||||
// ---------------RENEWAL REPORT-----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
public function renewalReport()
|
||||
{
|
||||
if ($this->request->is('get')) {
|
||||
|
||||
$default_start = new \DateTime();
|
||||
$data['default_end'] = $default_start->format('d-m-Y');
|
||||
$data['default_start'] = $default_start->modify('-60 days')->format('d-m-Y');
|
||||
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
|
||||
$data['page_name'] = "Renewal Report";
|
||||
return $this->loadLayout('renewal_search', $data);
|
||||
|
||||
} else {
|
||||
|
||||
$fromDate = $this->request->getPost('fromDate');
|
||||
$toDate = $this->request->getPost('toDate');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$client_type = $this->request->getPost('client_type');
|
||||
$issuer = $this->request->getPost('issuer');
|
||||
|
||||
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
|
||||
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];
|
||||
$data['renewal_data'] = $this->policyTransactionModel->getRenewalReportData($fromDate, $toDate, $client_type, $client_id, $issuer);
|
||||
// print_r($data); die;
|
||||
$html = view('bds_renewal_report_list', $data);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4047,10 +4047,11 @@ class ClientController extends AdminController
|
||||
|
||||
// -----------BDS REPORT CONTROLLER---------------------------------------------------------------------------------
|
||||
|
||||
// $BDSReportController = new BDSReportController();
|
||||
$BDSReportController = new BDSReportController();
|
||||
|
||||
// $data['data'] = $BDSReportController->getBAPInsurerData();
|
||||
// return $this->loadLayout('irda_bap_insurer_report_list', $data);
|
||||
$data['data'] = $BDSReportController->getBAPInsurerData();
|
||||
|
||||
return $this->loadLayout('irda_bap_insurer_report_list', $data);
|
||||
|
||||
// $data['data'] = $BDSReportController->getBAPClientData();
|
||||
// return $this->loadLayout('irda_bap_client_report_list', $data);
|
||||
@ -4138,6 +4139,162 @@ class ClientController extends AdminController
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------Function for Claim Module--------------------------------------------------------------------------------------------
|
||||
|
||||
public function getTheEmpDataForClaim($param, $type = null)
|
||||
{
|
||||
// Construct the base query
|
||||
$data = $this->clientPolicyModel
|
||||
->select("
|
||||
clients.id AS client_id,
|
||||
clients.client_name,
|
||||
insurers.id AS insurer_id,
|
||||
insurers.name AS insurer_name,
|
||||
tpa.id AS tpa_id,
|
||||
tpa.name AS tpa_name,
|
||||
employees.id AS emp_id,
|
||||
employees.name AS emp_name,
|
||||
employees.emp_code,
|
||||
employees.mobile AS emp_mobile,
|
||||
employees.email_corporate AS emp_email,
|
||||
employees.relationship AS emp_relationship,
|
||||
employee_polices.uhid AS policy_no
|
||||
")
|
||||
->join('clients', 'client_policy.client_id = clients.id', 'left')
|
||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
|
||||
->join('employees', 'clients.id = employees.client_id', 'left')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
|
||||
->where('client_policy.is_active', 1)
|
||||
->where('insurers.is_active', 1)
|
||||
->where('tpa.is_active', 1)
|
||||
->where('employees.is_active', 1)
|
||||
->where('employees.relationship', "Self")
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('client_policy.id', $param)
|
||||
->findAll();
|
||||
|
||||
$dataForClientAndInsurer = [];
|
||||
$memberData = [];
|
||||
|
||||
// Respond based on the query result
|
||||
if (!empty($data) || !empty($dataForClientAndInsurer)) {
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'message' => 'Data found',
|
||||
'data' => $data,
|
||||
'param' => $param,
|
||||
'type' => $type,
|
||||
'dataForClientAndInsurer' => $dataForClientAndInsurer,
|
||||
'memberData' => $memberData
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 404,
|
||||
'message' => 'No data found',
|
||||
'param' => $param,
|
||||
'type' => $type,
|
||||
'dataForClientAndInsurer' => $dataForClientAndInsurer,
|
||||
'memberData' => $memberData
|
||||
], 404);
|
||||
}
|
||||
}
|
||||
|
||||
public function getTheEmpDataForClaimSearchByMobile($param, $type = 'mobile')
|
||||
{
|
||||
$field_name = 'employees.' . $type;
|
||||
|
||||
// Construct the base query
|
||||
$data = $this->clientPolicyModel
|
||||
->select("
|
||||
clients.id AS client_id,
|
||||
clients.client_name,
|
||||
insurers.id AS insurer_id,
|
||||
insurers.name AS insurer_name,
|
||||
tpa.id AS tpa_id,
|
||||
tpa.name AS tpa_name,
|
||||
employees.id AS emp_id,
|
||||
employees.name AS emp_name,
|
||||
employees.emp_code,
|
||||
employees.mobile AS emp_mobile,
|
||||
employees.email_corporate AS emp_email,
|
||||
employees.relationship AS emp_relationship,
|
||||
employee_polices.uhid AS policy_no,
|
||||
employee_polices.tpa_id AS tpa_no
|
||||
")
|
||||
->join('clients', 'client_policy.client_id = clients.id', 'left')
|
||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
|
||||
->join('employees', 'clients.id = employees.client_id', 'left')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
|
||||
->where('client_policy.is_active', 1)
|
||||
->where('insurers.is_active', 1)
|
||||
->where('tpa.is_active', 1)
|
||||
->where('employees.is_active', 1)
|
||||
->where('employees.relationship', "Self")
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where($field_name, $param)
|
||||
->groupBy('employees.id')
|
||||
->orderBy('employees.id', 'DESC')
|
||||
->first();
|
||||
|
||||
$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();
|
||||
|
||||
if(!empty($data) && count($data) > 0){
|
||||
|
||||
$memberData = $this->employeeModel->getEmployeeByEmployeeCode($data['emp_code']);
|
||||
|
||||
$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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Respond based on the query result
|
||||
if (!empty($data)) {
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'message' => 'Data found',
|
||||
'data' => $data,
|
||||
'param' => $param,
|
||||
'type' => $type,
|
||||
'dataForClientAndInsurer' => $dataForClientAndInsurer,
|
||||
'memberData' => $memberData,
|
||||
'acms' => $acms,
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 404,
|
||||
'message' => 'No data found',
|
||||
'param' => $param,
|
||||
'type' => $type,
|
||||
'dataForClientAndInsurer' => $dataForClientAndInsurer,
|
||||
'memberData' => $memberData,
|
||||
'acms' => $acms
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -4416,7 +4416,7 @@ class EmpDataServiceController extends BaseController
|
||||
employees.email_corporate,
|
||||
employees.name,
|
||||
employees.mobile,
|
||||
employees.basic_cover_si,
|
||||
employee_polices.basic_cover_si,
|
||||
|
||||
cp.policy_type_id,
|
||||
cp.is_addon,
|
||||
@ -4438,7 +4438,7 @@ class EmpDataServiceController extends BaseController
|
||||
if ($emp_details) {
|
||||
$this->myLogger->logme('error', 'sendMailForDownloadingECard - Processing employee_policy_id: {id}', ['id' => $id]);
|
||||
|
||||
if (!empty($emp_details['email_corporate'])) {
|
||||
if (!empty($emp_details['email_corporate']) && $emp_details['relationship'] === 'Self') {
|
||||
|
||||
$params = [
|
||||
'rand_string' => $emp_details['rand_string'],
|
||||
|
||||
@ -97,7 +97,7 @@ class EmployeeController extends AdminController
|
||||
|
||||
// Convert the status field to an array if it exists in the request data
|
||||
if (isset($filterData['status']) && !empty($filterData['status'])) {
|
||||
$filterData['status'] = explode(",", $filterData['status']);
|
||||
// $filterData['status'] = explode(",", $filterData['status']);
|
||||
}else{
|
||||
$filterData['status'] = [];
|
||||
}
|
||||
@ -114,6 +114,11 @@ class EmployeeController extends AdminController
|
||||
// log_message('error',json_encode($data['employees']));
|
||||
// Set getData in $data array with the processed $filterData
|
||||
$data['getData'] = $filterData;
|
||||
|
||||
// return view('employee_list',$data);
|
||||
$html = view('employee_data_list', $data);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
|
||||
}
|
||||
|
||||
// dd($this->employeeModel->getLastQuery());
|
||||
@ -2225,7 +2230,7 @@ class EmployeeController extends AdminController
|
||||
// print_rr($data);die();
|
||||
// $data['dob'] = date('Y-m-d', strtotime($data['dob']));
|
||||
if(isset( $data['dob'])){
|
||||
$data['dob'] = change_date_format($data['dob'], 'd/m/Y', 'Y-m-d');
|
||||
$data['dob'] = change_date_format($data['dob'], null, 'Y-m-d');
|
||||
}
|
||||
// print_rr($data); die;
|
||||
|
||||
|
||||
@ -29,10 +29,15 @@ use App\Models\FEContentModel;
|
||||
use App\Models\AddImgModel;
|
||||
use App\Models\ClientBranchModel;
|
||||
use App\Models\AuditHistoryModel;
|
||||
use App\Models\TicketClaimStatusModel;
|
||||
use App\Models\TicketMasterModel;
|
||||
use App\Models\TicketMessageModel;
|
||||
|
||||
|
||||
|
||||
use App\Controllers\Jobs ;
|
||||
use App\Controllers\JobWorker ;
|
||||
use App\Controllers\TicketController;
|
||||
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
@ -73,6 +78,11 @@ class EmployeeRestController extends AdminController
|
||||
protected $addImgModel;
|
||||
protected $clientBranchModel;
|
||||
protected $auditHistoryModel;
|
||||
protected $claimStatusModel;
|
||||
protected $ticketMaster;
|
||||
protected $ticketMessage;
|
||||
|
||||
protected $ticketController;
|
||||
|
||||
|
||||
public function __construct()
|
||||
@ -97,6 +107,11 @@ class EmployeeRestController extends AdminController
|
||||
$this->addImgModel = new AddImgModel();
|
||||
$this->clientBranchModel = new ClientBranchModel();
|
||||
$this->auditHistoryModel = new AuditHistoryModel();
|
||||
$this->claimStatusModel = new TicketClaimStatusModel();
|
||||
$this->ticketMaster = new TicketMasterModel();
|
||||
$this->ticketMessage = new TicketMessageModel();
|
||||
|
||||
$this->ticketController = new TicketController();
|
||||
|
||||
}
|
||||
|
||||
@ -722,7 +737,7 @@ class EmployeeRestController extends AdminController
|
||||
$jwt = $this->request->getHeaderLine('Authorization');
|
||||
$jwtParts = explode(' ', $jwt);
|
||||
|
||||
$token = $jwtParts[2];
|
||||
$token = $jwtParts[1];
|
||||
|
||||
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
|
||||
|
||||
@ -3086,10 +3101,90 @@ class EmployeeRestController extends AdminController
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
//Get Data from post for inserting ticket and message
|
||||
public function initiateClaim()
|
||||
{
|
||||
|
||||
$received_data = $this->request->getPost();
|
||||
$employee_id = $received_data['emp_id'];
|
||||
$client_policy_id = $received_data['client_policy_id'];
|
||||
$insured_emp_id = $received_data['insured_emp_id'];
|
||||
|
||||
$sql = "select cp.policy_type_id as ticket_type_id,
|
||||
cl_rm.user_id as acm_id,
|
||||
cp.insurer_id as insurer_id,
|
||||
cp.tpa_id as tpa_id,
|
||||
emp.client_id ,
|
||||
emp.id as emp_id,
|
||||
emp_pol.uhid as policy_no,
|
||||
emp.emp_code,
|
||||
emp_pol.tpa_id as tpa_no,
|
||||
emp.name as emp_name,
|
||||
emp.email_corporate as emp_mail,
|
||||
emp.mobile as emp_mobile,
|
||||
empl.id as insured_emp_id,
|
||||
empl.name as insured_name,
|
||||
empl.relationship
|
||||
|
||||
|
||||
|
||||
from employees emp
|
||||
|
||||
left join employees empl on empl.id = $insured_emp_id and empl.is_active = 1 and empl.emp_status = 'active'
|
||||
left join employee_polices emp_pol on empl.id = emp_pol.employee_id and emp_pol.client_policy_id = $client_policy_id and emp_pol.is_active = 1
|
||||
left join client_policy cp on cp.id = emp_pol.client_policy_id and cp.is_active = 1
|
||||
left join client_rm cl_rm on cl_rm.client_id = empl.client_id and cl_rm.is_active = 1 and cl_rm.level = 3
|
||||
|
||||
where emp.id = $employee_id and emp.is_active = 1 and emp.emp_status = 'active'
|
||||
limit 1 ";
|
||||
|
||||
$fetchData = $this->employeeModel->query($sql)->getResultArray()[0];
|
||||
$fetchData['claim_status_id'] = $this->claimStatusModel->select('id')->where('ticket_type', $fetchData['ticket_type_id'])->first()['id'];
|
||||
$fetchData['priority'] = 1;
|
||||
$fetchData['mode_of_intimation'] = 1;
|
||||
$fetchData['hospital_name'] = $received_data['hospital_name'];
|
||||
|
||||
$insert_status = $this->ticketMaster->insert($fetchData);
|
||||
$ticket_id = $this->ticketMaster->insertID();
|
||||
|
||||
if ($insert_status && !empty($ticket_id)) {
|
||||
$mail_sent_status = ($this->ticketController->sendAutoMailTrigger($ticket_id));
|
||||
if (gettype($mail_sent_status) == 'array') {
|
||||
$message = 'Claim Iniated Successfully';
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => $message], 200);
|
||||
} else {
|
||||
$mail_sent_status = json_decode($mail_sent_status);
|
||||
}
|
||||
// dd(gettype($mail_sent_status));
|
||||
|
||||
if ($mail_sent_status->status == 'success') {
|
||||
$sent_message_data['ticket_id'] = $ticket_id;
|
||||
$sent_message_data['sender'] = 'staff';
|
||||
$sent_message_data['emp_mail'] = $mail_sent_status->data->params->mail;
|
||||
$sent_message_data['mail_subject'] = $mail_sent_status->data->params->subject;
|
||||
$sent_message_data['mail_content'] = $mail_sent_status->data->params->message;
|
||||
|
||||
$message_insert_status = $this->ticketMessage->insert($sent_message_data);
|
||||
|
||||
if ($message_insert_status) {
|
||||
$message = 'Claim Initiated Successfully';
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => $message], 200);
|
||||
} else {
|
||||
$message = 'Claim Initiated, Mail Sent Successfully';
|
||||
$this->myLogger->logme('error', "Claim initiated, Mail sent Successfully, Failed to store message:$ticket_id ");
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200);
|
||||
}
|
||||
} else {
|
||||
|
||||
$message = 'Claim Initiated, Failed to send Mail ';
|
||||
$this->myLogger->logme('error', "Claim initiated, Failed to send Mail :$ticket_id ");
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200);
|
||||
}
|
||||
} else {
|
||||
$message = 'Something Went Wrong';
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1669,11 +1669,12 @@ class MasterController extends AdminController
|
||||
["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
|
||||
["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
|
||||
];
|
||||
$email_id = 'hariharan@nhanceindia.in';
|
||||
$email_id = 'srinivas.saravanan@venbainfotech.com';
|
||||
$params = ['mail'=>$email_id];
|
||||
$common = ['mail_type'=>'test_mail_cli'];
|
||||
$bcc = "vijayalakshmi@nhanceindia.in,vitvelz@gmail.com,velmurugan.s@venbainfotech.com,hariharan@nhanceindia.in,hariharan@jubiliant.in,srinivas.saravanan@venbainfotech.com";
|
||||
// $bcc = "vijayalakshmi@nhanceindia.in,vitvelz@gmail.com,velmurugan.s@venbainfotech.com,hariharan@nhanceindia.in,hariharan@jubiliant.in,srinivas.saravanan@venbainfotech.com";
|
||||
// Send email and get response
|
||||
$result = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI','bcc'=>$bcc ,'message' => $message,'attachments' => $attachments,'common'=>$common]);
|
||||
$result = MailHelper::send_email(['mail' => $email_id, 'params'=>$params,'subject' => 'Mail Via CLI','message' => $message,'attachments' => $attachments,'common'=>$common]);
|
||||
|
||||
|
||||
log_message('error',json_encode($result));
|
||||
|
||||
@ -244,34 +244,6 @@ class PolicyTransactionController extends BaseController
|
||||
// print_r($data); die;
|
||||
// var_dump($data); die;
|
||||
|
||||
// Format dates
|
||||
// $data['policy_issue_date'] = change_date_format($this->request->getPost('policy_issue_date'), 'd/m/Y', 'Y-m-d') ?? null;
|
||||
// $data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd/m/Y', 'Y-m-d') ?? null;
|
||||
// $data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd/m/Y', 'Y-m-d') ?? null;
|
||||
// $data['renewal_date'] = change_date_format($this->request->getPost('renewal_date'), 'd/m/Y', 'Y-m-d') ?? null;
|
||||
// $data['rollover_date'] = change_date_format($this->request->getPost('rollover_date'), 'd/m/Y', 'Y-m-d') ?? null;
|
||||
|
||||
// $data['policy_issue_date'] = (isset($data['policy_issue_date']) && $data['policy_issue_date'] !== null && $data['policy_issue_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['policy_issue_date']))
|
||||
// : null;
|
||||
|
||||
// $data['policy_start_date'] = (isset($data['policy_start_date']) && $data['policy_start_date'] !== null && $data['policy_start_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['policy_start_date']))
|
||||
// : null;
|
||||
|
||||
// $data['policy_end_date'] = (isset($data['policy_end_date']) && $data['policy_end_date'] !== null && $data['policy_end_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['policy_end_date']))
|
||||
// : null;
|
||||
|
||||
// $data['renewal_date'] = (isset($data['renewal_date']) && $data['renewal_date'] !== null && $data['renewal_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['renewal_date']))
|
||||
// : null;
|
||||
|
||||
// $data['rollover_date'] = (isset($data['rollover_date']) && $data['rollover_date'] !== null && $data['rollover_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['rollover_date']))
|
||||
// : null;
|
||||
|
||||
|
||||
if(empty($data['policy_issue_date'])){
|
||||
$data['policy_issue_date'] = null;
|
||||
}
|
||||
@ -302,7 +274,7 @@ class PolicyTransactionController extends BaseController
|
||||
// Separate Insurer and TPA Branch IDs and IDs
|
||||
if(isset($data['insurer_id']) && !empty($data['insurer_id'])){
|
||||
list($data['insurer_branch_id'], $data['insurer_id']) = explode('-', $data['insurer_id']);
|
||||
if ($data['tpa']) {
|
||||
if (isset($data['tpa'])) {
|
||||
list($data['tpa_branch_id'], $data['tpa_id']) = explode('-', $data['tpa']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,13 +11,18 @@ use App\Models\TicketHistoryModel;
|
||||
use App\Models\TicketMailTemplateModel;
|
||||
use App\Models\TicketMessageModel;
|
||||
use App\Models\TicketNoteModel;
|
||||
use App\Models\UserModel;
|
||||
use DOMDocument;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Kint\Kint;
|
||||
use App\Models\EmployeeModel;
|
||||
|
||||
use App\Helpers\MailHelper;
|
||||
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
class TicketController extends BaseController
|
||||
{
|
||||
{
|
||||
use ResponseTrait;
|
||||
|
||||
protected $myLogger;
|
||||
@ -27,13 +32,17 @@ class TicketController extends BaseController
|
||||
protected $modeOFIntimate;
|
||||
protected $claimType;
|
||||
protected $claimStatus;
|
||||
|
||||
protected $placeHolders;
|
||||
|
||||
protected $clientModel;
|
||||
protected $ticketMasterModel;
|
||||
protected $ticketHistoryModel;
|
||||
protected $ticketMailTemplateModel;
|
||||
protected $ticketMesageModel;
|
||||
protected $ticketMessageModel;
|
||||
protected $ticketNoteModel;
|
||||
protected $triggerType;
|
||||
protected $userModel;
|
||||
protected $employeeModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -43,11 +52,11 @@ class TicketController extends BaseController
|
||||
|
||||
$this->ticketType = [1 => "Claim-GMC", 2 => "Claim-GPA", 3 => "EDLI", 4 => "GTLI"];
|
||||
$this->priorityType = [
|
||||
1 => "Low",
|
||||
2 => "Medium",
|
||||
3 => "High",
|
||||
4 => "Urgent",
|
||||
5 => "Emergency",
|
||||
1 => "Low",
|
||||
2 => "Medium",
|
||||
3 => "High",
|
||||
4 => "Urgent",
|
||||
5 => "Emergency",
|
||||
6 => "Critical"
|
||||
];
|
||||
$this->relationshipType = [
|
||||
@ -61,9 +70,9 @@ class TicketController extends BaseController
|
||||
"mother-in-law" => "Mother-in-Law"
|
||||
];
|
||||
$this->modeOFIntimate = [
|
||||
1 => "In Person",
|
||||
2 => "Courier",
|
||||
3 => "Online Mode - Email",
|
||||
1 => "In Person",
|
||||
2 => "Courier",
|
||||
3 => "Online Mode - Email",
|
||||
4 => "Online Mode - To TPA"
|
||||
];
|
||||
$this->claimType = [
|
||||
@ -80,24 +89,49 @@ class TicketController extends BaseController
|
||||
4 => "Death",
|
||||
]
|
||||
];
|
||||
$this->triggerType = [
|
||||
1 => "Trigger 1",
|
||||
2 => "Trigger 2",
|
||||
3 => "Trigger 3",
|
||||
4 => "Trigger 4",
|
||||
5 => "Trigger 5",
|
||||
6 => "Trigger 6",
|
||||
7 => "Trigger 7"
|
||||
];
|
||||
|
||||
$this->placeHolders = [
|
||||
|
||||
'((ACM))' => 'acm',
|
||||
'((ACM_CONTACT))' => 'acm_mobile',
|
||||
'((EMPLOYEE_NAME))' => 'emp_name',
|
||||
'((EMPLOYEE_ID))' => 'emp_code',
|
||||
'((CORPORATE_NAME))' => 'client_name',
|
||||
'((INSURED_NAME))' => 'insured_name',
|
||||
'((CLAIM_NO))' => 'claim_number',
|
||||
'((RELATIONSHIP))' => 'relationship',
|
||||
];
|
||||
|
||||
$this->ticketMasterModel = new TicketMasterModel();
|
||||
$this->claimStatus = new TicketClaimStatusModel();
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->ticketHistoryModel = new TicketHistoryModel();
|
||||
|
||||
$this->ticketMailTemplateModel = new TicketMailTemplateModel();
|
||||
$this->ticketNoteModel = new TicketNoteModel();
|
||||
$this->ticketMessageModel = new TicketMessageModel();
|
||||
$this->userModel = new UserModel();
|
||||
$this->employeeModel = new EmployeeModel();
|
||||
}
|
||||
|
||||
public function ticketList()
|
||||
{
|
||||
{
|
||||
if ($this->request->is('get')) {
|
||||
$data['page_name'] = "Claims";
|
||||
$data['ticket_type'] = $this->ticketType;
|
||||
$data['claim_status'] = $this->claimStatus->select('id,ticket_type,claim_status')->where('is_active',1)->findAll();
|
||||
$data['client_list'] = $this->clientModel->select('id,client_name')->where('is_active',1)->findAll();
|
||||
|
||||
$data['claim_status'] = $this->claimStatus->select('id,ticket_type,claim_status')->where('is_active', 1)->findAll();
|
||||
$data['client_list'] = $this->clientModel->select('id,client_name')->where('is_active', 1)->findAll();
|
||||
$data['ticket_data'] = $this->ticketSearch(1);
|
||||
return $this->loadLayout('ticket_search', $data);
|
||||
|
||||
} else{
|
||||
} else {
|
||||
|
||||
$data['ticket_data'] = $this->ticketSearch();
|
||||
$html = view('ticket_list', $data);
|
||||
@ -105,121 +139,637 @@ class TicketController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function ticketSearch()
|
||||
public function ticketSearch($action = null)
|
||||
{
|
||||
$search_data = $this->request->getPost();
|
||||
// print_r($search_data);
|
||||
$where = [];
|
||||
foreach ($search_data as $search_objects => $key){
|
||||
if ($key != null && $key != '' && $key!= 0 ){
|
||||
$where[$search_objects] = $key;
|
||||
//action 1 get last 100 rows, action 2 filter and get all rows related to that
|
||||
if ($action == 1) {
|
||||
$data = $this->ticketMasterModel
|
||||
->select('ticket_master.id, ticket_claim_status.claim_status as status,
|
||||
ticket_master.claim_number as claim_no,ticket_master.tpa_id,ticket_master.emp_name,
|
||||
insurers.name as insurer_name, clients.client_name,
|
||||
DATE_FORMAT(ticket_master.created_at, "%d-%m-%Y") as tat')
|
||||
->join('insurers', 'insurers.id = ticket_master.insurer_id and insurers.is_active = 1', 'left')
|
||||
->join('clients', 'clients.id = ticket_master.client_id and clients.is_active = 1', 'left')
|
||||
->join('ticket_claim_status', 'ticket_claim_status.id = ticket_master.claim_status_id and ticket_claim_status.is_active = 1', 'left')
|
||||
->where('ticket_master.is_active', 1)
|
||||
->orderBy('ticket_master.id', 'DESC')
|
||||
->limit(100)
|
||||
->findAll();
|
||||
|
||||
return $data;
|
||||
} else {
|
||||
$search_data = $this->request->getPost();
|
||||
// print_r($search_data);
|
||||
$where = [];
|
||||
foreach ($search_data as $search_objects => $key) {
|
||||
if ($key != null && $key != '' && $key != 0) {
|
||||
$where[$search_objects] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
// print_rr($where);
|
||||
$data = $this->ticketMasterModel
|
||||
->select('ticket_master.id, ticket_claim_status.claim_status as status,
|
||||
// print_rr($where);
|
||||
$data = $this->ticketMasterModel
|
||||
->select('ticket_master.id, ticket_claim_status.claim_status as status,
|
||||
ticket_master.claim_number as claim_no,ticket_master.tpa_id,ticket_master.emp_name,
|
||||
insurers.name as insurer_name, clients.client_name,
|
||||
DATE_FORMAT(ticket_master.created_at, "%d-%m-%Y") as tat')
|
||||
->join('insurers','insurers.id = ticket_master.insurer_id and insurers.is_active = 1','left')
|
||||
->join('clients','clients.id = ticket_master.client_id and clients.is_active = 1','left')
|
||||
->join('ticket_claim_status','ticket_claim_status.id = ticket_master.claim_status_id and ticket_claim_status.is_active = 1','left')
|
||||
->where('ticket_master.is_active',1)
|
||||
->where($where)
|
||||
->findAll();
|
||||
// print_rr($data);
|
||||
// log_message('error',' Claims Master Data '.json_encode($data));die();
|
||||
// print_rr($data);die();
|
||||
return $data;
|
||||
->join('insurers', 'insurers.id = ticket_master.insurer_id and insurers.is_active = 1', 'left')
|
||||
->join('clients', 'clients.id = ticket_master.client_id and clients.is_active = 1', 'left')
|
||||
->join('ticket_claim_status', 'ticket_claim_status.id = ticket_master.claim_status_id and ticket_claim_status.is_active = 1', 'left')
|
||||
->where('ticket_master.is_active', 1)
|
||||
->where($where)
|
||||
->findAll();
|
||||
// print_rr($data);
|
||||
// log_message('error',' Claims Master Data '.json_encode($data));die();
|
||||
// print_rr($data);die();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
public function ticket_form($ticket_type)
|
||||
{
|
||||
$data['ticket_form'] = 1;
|
||||
$data['ticket_type'] = $this->ticketType;
|
||||
$data['priorityType'] = $this->priorityType;
|
||||
$data['relationshipType'] = $this->relationshipType;
|
||||
$data['modeOFIntimate'] = $this->modeOFIntimate;
|
||||
$data = $this->ticket_form_data($ticket_type);
|
||||
// dd($data);
|
||||
return $this->loadLayout('ticket_form_handler', $data);
|
||||
}
|
||||
|
||||
$data['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();
|
||||
public function ticket_form_data($ticket_type)
|
||||
{
|
||||
$this->myLogger->logme('error', "Fetching ticket form data for Ticket Type: $ticket_type");
|
||||
|
||||
$data['claim_status'] = db_connect()->table('ticket_claim_status')
|
||||
->select('ticket_claim_status.*')
|
||||
->where('ticket_claim_status.is_active', 1)
|
||||
->where('ticket_claim_status.ticket_type', $ticket_type)
|
||||
->get()
|
||||
->getResultArray();
|
||||
$data = [
|
||||
'ticket_form' => 1,
|
||||
'selected_ticket_type' => $ticket_type,
|
||||
'ticket_type' => $this->ticketType,
|
||||
'priorityType' => $this->priorityType,
|
||||
'relationshipType' => $this->relationshipType,
|
||||
'modeOFIntimate' => $this->modeOFIntimate
|
||||
];
|
||||
|
||||
if($ticket_type == 1){
|
||||
$data['modeOFIntimate'] = $this->claimType[1];
|
||||
return $this->loadLayout('ticket_form_handler', $data);
|
||||
}else{
|
||||
|
||||
$data['modeOFIntimate'] = $this->claimType[2];
|
||||
|
||||
if($ticket_type == 2){
|
||||
switch ($ticket_type) {
|
||||
case 2:
|
||||
$data['ticket_form'] = 'GPA';
|
||||
}else if($ticket_type = 3){
|
||||
$data['ticket_form'] == 'EDLI';
|
||||
}else if($ticket_type = 4){
|
||||
break;
|
||||
case 3:
|
||||
$data['ticket_form'] = 'EDLI';
|
||||
break;
|
||||
case 4:
|
||||
$data['ticket_form'] = 'GTLI';
|
||||
}
|
||||
|
||||
return $this->loadLayout('ticket_form_handler', $data);
|
||||
break;
|
||||
}
|
||||
|
||||
// Fetch ACM Users
|
||||
$db = db_connect();
|
||||
$data['acms'] = $db->table('user_profiles')
|
||||
->select('id, first_name')
|
||||
->where(['is_active' => 1, 'role' => 3])
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
// Fetch Claim Status
|
||||
$data['claim_status'] = $this->claimStatus
|
||||
->select('*')
|
||||
->where(['is_active' => 1, 'ticket_type' => $ticket_type])
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
if ($ticket_type == 1) {
|
||||
$data['claim_type'] = $this->claimType[1];
|
||||
} else {
|
||||
$data['claim_type'] = $this->claimType[2];
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', "Ticket form data fetched successfully for Ticket Type: $ticket_type");
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function view_ticket($ticket_id)
|
||||
{
|
||||
$data = [];
|
||||
// $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');
|
||||
// dd($ticket_data);
|
||||
$template_data = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id);
|
||||
if(!empty($template_data)){
|
||||
$template_data['mail_content'] = $this->replacePlaceholders($template_data['mail_content'], $ticket_data);
|
||||
$template_data['subject'] = $this->replacePlaceholders($template_data['subject'], $ticket_data);
|
||||
}
|
||||
$data = $this->ticket_form_data($ticket_data['ticket_type_id']);
|
||||
$data['ticket_data'] = $ticket_data;
|
||||
$data['reply_data'] = $template_data;
|
||||
$data['placeHolders'] = $this->placeHolders;
|
||||
$data['message_data'] = $this->getTicketMessage($ticket_id);
|
||||
$data['view_ticket_page'] = [];
|
||||
$data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']);
|
||||
$data['ticket_history'] = $this->ticketHistory($ticket_id);
|
||||
// dd($data);
|
||||
|
||||
return $this->loadLayout('ticket_edit_onbording', $data);
|
||||
}
|
||||
|
||||
public function createTicket()
|
||||
{
|
||||
$ticket_data = $this->request->getPost();
|
||||
// print_rr($ticket_data); die;
|
||||
public function formatDateForClaim($ticket_data, $out_put_format = 'Y-m-d')
|
||||
{
|
||||
|
||||
if(empty($ticket_data['doa'])){
|
||||
if (empty($ticket_data['doa'])) {
|
||||
$ticket_data['doa'] = null;
|
||||
}else{
|
||||
$ticket_data['doa'] = change_date_format($ticket_data['doa']);
|
||||
} else {
|
||||
$ticket_data['doa'] = change_date_format($ticket_data['doa'], null, $out_put_format);
|
||||
}
|
||||
|
||||
if(empty($ticket_data['dod'])){
|
||||
if (empty($ticket_data['dod'])) {
|
||||
$ticket_data['dod'] = null;
|
||||
}else{
|
||||
$ticket_data['dod'] = change_date_format($ticket_data['dod']);
|
||||
} else {
|
||||
$ticket_data['dod'] = change_date_format($ticket_data['dod'], null, $out_put_format);
|
||||
}
|
||||
|
||||
if (empty($ticket_data['dob'])) {
|
||||
$ticket_data['dob'] = null;
|
||||
} else {
|
||||
$ticket_data['dob'] = change_date_format($ticket_data['dob'], null, $out_put_format);
|
||||
}
|
||||
|
||||
if (empty($ticket_data['date_of_join'])) {
|
||||
$ticket_data['date_of_join'] = null;
|
||||
} else {
|
||||
$ticket_data['date_of_join'] = change_date_format($ticket_data['date_of_join'], null, $out_put_format);
|
||||
}
|
||||
|
||||
if (empty($ticket_data['date_of_incep'])) {
|
||||
$ticket_data['date_of_incep'] = null;
|
||||
} else {
|
||||
$ticket_data['date_of_incep'] = change_date_format($ticket_data['date_of_incep'], null, $out_put_format);
|
||||
}
|
||||
|
||||
if (empty($ticket_data['date_of_accident'])) {
|
||||
$ticket_data['date_of_accident'] = null;
|
||||
} else {
|
||||
$ticket_data['date_of_accident'] = change_date_format($ticket_data['date_of_accident'], null, $out_put_format);
|
||||
}
|
||||
|
||||
if (empty($ticket_data['date_of_death'])) {
|
||||
$ticket_data['date_of_death'] = null;
|
||||
} else {
|
||||
$ticket_data['date_of_death'] = change_date_format($ticket_data['date_of_death'], null, $out_put_format);
|
||||
}
|
||||
|
||||
if (empty($ticket_data['date_of_intimat'])) {
|
||||
$ticket_data['date_of_intimat'] = null;
|
||||
} else {
|
||||
$ticket_data['date_of_intimat'] = change_date_format($ticket_data['date_of_intimat'], null, $out_put_format);
|
||||
}
|
||||
|
||||
return $ticket_data;
|
||||
}
|
||||
|
||||
public function createTicket()
|
||||
{
|
||||
$ticket_data = $this->request->getPost();
|
||||
$ticket_data = $this->formatDateForClaim($ticket_data);
|
||||
// print_rr($ticket_data); die;
|
||||
|
||||
if($ticket_data){
|
||||
$return_value = $this->ticketMasterModel->insert($ticket_data);
|
||||
if($return_value){
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $ticket_data, "message" => "Claim created successfully"], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to create claim'], 200);
|
||||
}
|
||||
}else{
|
||||
if ($ticket_data) {
|
||||
$return_value = $this->ticketMasterModel->insert($ticket_data);
|
||||
if ($return_value) {
|
||||
//mail trigger part
|
||||
$mail_responce = $this->sendAutoMailTrigger($return_value);
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $ticket_data, "message" => "Claim created successfully", 'mail_responce' => $mail_responce], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to create claim'], 200);
|
||||
}
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'claim data not found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateTicket()
|
||||
{
|
||||
$ticket_id = $this->request->getPost('ticket_master_id');
|
||||
$ticket_data = $this->request->getPost();
|
||||
$ticket_data = $this->formatDateForClaim($ticket_data);
|
||||
// print_rr($ticket_data); die;
|
||||
$old_ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first();
|
||||
|
||||
if ($ticket_data) {
|
||||
$return_value = $this->ticketMasterModel->where('id', $ticket_id)->set($ticket_data)->update();
|
||||
if ($return_value) {
|
||||
|
||||
//mail trigger part
|
||||
$mail_responce = $this->sendAutoMailTrigger($ticket_id);
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $ticket_data, "message" => "Claim updated successfully", 'mail_responce' => $mail_responce], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update claim'], 200);
|
||||
}
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'claim data not found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function createMailTemplate()
|
||||
public function mailTemplate()
|
||||
{
|
||||
$data = [];
|
||||
$data['trigger_type'] = $this->triggerType;
|
||||
$data['policy_type'] = $this->ticketType;
|
||||
$data['placeHolders'] = $this->placeHolders;
|
||||
$data['ticket_data'] = $this->ticketMailTemplateModel->where('is_active', 1)->findAll();
|
||||
$data['ticket_type'] = $this->ticketType;
|
||||
$data['trigger_type'] = $this->triggerType;
|
||||
return $this->loadLayout('ticket_mail_template', $data);
|
||||
}
|
||||
|
||||
public function crudTemplate($action)
|
||||
{
|
||||
//action 1 is create. action 2 is edit and action 3 is delete
|
||||
if ($action == 1) {
|
||||
$received_data = $this->request->getPost();
|
||||
if (isset($received_data['id']) && $received_data['id'] != '') {
|
||||
$status = $this->ticketMailTemplateModel->save($received_data);
|
||||
if ($status) {
|
||||
return $this->respond(['status' => true], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false], 200);
|
||||
}
|
||||
} else {
|
||||
$status = $this->ticketMailTemplateModel->save($received_data);
|
||||
if ($status) {
|
||||
return $this->respond(['status' => true], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false], 200);
|
||||
}
|
||||
}
|
||||
} elseif ($action == 2) {
|
||||
$table_id = (int)$this->request->getPost('id');
|
||||
$data = $this->ticketMailTemplateModel->where('id', $table_id)->where('is_active', 1)->first();
|
||||
if ($data) {
|
||||
return $this->respond(['status' => true, 'data' => $data], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false], 404);
|
||||
}
|
||||
} elseif ($action == 3) {
|
||||
$table_id = (int)$this->request->getPost('id');
|
||||
|
||||
}
|
||||
$sql = "update ticket_mail_template set is_active = 0 where id = $table_id ";
|
||||
$status = $this->ticketMailTemplateModel->query($sql);
|
||||
if ($status) {
|
||||
return $this->respond(['status' => true], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false], 404);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function crudNote($action)
|
||||
{
|
||||
// action = 1 is read, action 2 is insert/update
|
||||
if ($action == 1) {
|
||||
$ticket_master_id = $this->request->getPost('id');
|
||||
if (isset($ticket_master_id) && $ticket_master_id != '') {
|
||||
$data = $this->ticketNoteModel->where('is_active', 1)->where('ticket_id', $ticket_master_id)->first();
|
||||
if ($data) {
|
||||
return $this->respond(['status' => true, 'data' => $data], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false], 200);
|
||||
}
|
||||
}
|
||||
} elseif ($action == 2) {
|
||||
$data = $this->request->getPost();
|
||||
// if (isset($data['id']) && $data['id'] != ''){
|
||||
$status = $this->ticketNoteModel->save($data);
|
||||
// }
|
||||
if ($status) {
|
||||
return $this->respond(['status' => true], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false], 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function saveReply()
|
||||
{
|
||||
|
||||
$received_data = $this->request->getPost();
|
||||
// print_r($received_data); die;
|
||||
$received_data['sender'] = 'staff';
|
||||
$status = $this->ticketMessageModel->insert($received_data);
|
||||
if ($status) {
|
||||
$return = $this->sendReplyMessage($received_data);
|
||||
return $this->respond(['status' => true, 'code' => 200, 'return' => $return], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404], 404);
|
||||
}
|
||||
}
|
||||
|
||||
public function getTicketMessage($ticket_master_id)
|
||||
{
|
||||
// log_message('error','Function called');die();
|
||||
// $ticket_master_id = $this->request->getPost('id');
|
||||
$user_id = get_session_userid();
|
||||
$logged_user = $this->userModel->select('first_name,last_name,profile')->where('id', $user_id)->first();
|
||||
$dataToSend = [];
|
||||
$dataToSend['user_name'] = $logged_user['first_name'] . ' ' . $logged_user['last_name'];
|
||||
$dataToSend['messages'] = $this->ticketMessageModel->where('is_active', 1)
|
||||
->where('ticket_id', $ticket_master_id)->orderBy('created_at', 'DESC')
|
||||
->findAll();
|
||||
foreach ($dataToSend['messages'] as $message) {
|
||||
$mail_content_converted = $this->convertHtmlToText($message['mail_content']);
|
||||
$message['mail_content'] = $mail_content_converted;
|
||||
}
|
||||
$dataToSend['emp_name'] = $this->ticketMasterModel->select('emp_name')
|
||||
->where('id', $ticket_master_id)->where('is_active', 1)
|
||||
->first()['emp_name'];
|
||||
// dd($dataToSend);
|
||||
if ($dataToSend) {
|
||||
return $dataToSend;
|
||||
} else {
|
||||
$data = [];
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
public function convertHtmlToText($html)
|
||||
{
|
||||
$dom = new DOMDocument();
|
||||
@$dom->loadHTML($html);
|
||||
return strip_tags($dom->saveHTML());
|
||||
}
|
||||
|
||||
//---- Email Trigger Part----------------------------------------------------------------------------------------------
|
||||
|
||||
public function constructMailContent($ticket_id)
|
||||
{
|
||||
$this->myLogger->logme('error', "Constructing mail content for Ticket ID: $ticket_id");
|
||||
|
||||
try {
|
||||
// Fetch Ticket Data
|
||||
$ticket_data = $this->ticketMasterModel->getTicketDataByTicketID($ticket_id);
|
||||
|
||||
if (!$ticket_data) {
|
||||
$this->myLogger->logme('error', "No ticket data found for Ticket ID: $ticket_id");
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', "Fetched ticket data: " . json_encode($ticket_data));
|
||||
|
||||
// Fetch Email Template Data
|
||||
$template_data = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id);
|
||||
|
||||
if (!$template_data) {
|
||||
$this->myLogger->logme('error', "No email template found for Claim Status ID: " . $ticket_data['claim_status_id']);
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', "Fetched email template: " . json_encode($template_data));
|
||||
|
||||
// Generate Email Content
|
||||
$subject = $this->replacePlaceholders($template_data['subject'], $ticket_data);
|
||||
$message = $this->replacePlaceholders($template_data['mail_content'], $ticket_data);
|
||||
|
||||
// Validate Essential Fields
|
||||
if (empty($ticket_data['emp_mail'])) {
|
||||
$this->myLogger->logme('error', "Employee email is missing for Ticket ID: $ticket_id");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (empty($subject) || empty($message)) {
|
||||
$this->myLogger->logme('error', "Generated email content is empty for Ticket ID: $ticket_id");
|
||||
return null;
|
||||
}
|
||||
|
||||
// Construct Mail Data
|
||||
$mailData = [
|
||||
'mail' => $ticket_data['emp_mail'],
|
||||
'subject' => $subject,
|
||||
'message' => $message,
|
||||
'cc' => $ticket_data['common_mails'] ?? '',
|
||||
'attachments' => []
|
||||
];
|
||||
|
||||
$this->myLogger->logme('error', "Final Email Data");
|
||||
|
||||
return $mailData;
|
||||
} catch (\Exception $e) {
|
||||
$this->myLogger->logme('error', "Exception in constructMailContent: " . $e->getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function replacePlaceholders($content, $ticket_data)
|
||||
{
|
||||
$this->myLogger->logme('error', "Replacing placeholders in content");
|
||||
|
||||
if (!empty($ticket_data) && !empty($content)) {
|
||||
foreach ($this->placeHolders as $key => $value) {
|
||||
$replaceData = strtoupper($ticket_data[$value]) ?? '';
|
||||
if ($value == "emp_code") {
|
||||
$replaceData = $ticket_data[$value] ?? '';
|
||||
}
|
||||
$content = str_replace($key, $replaceData, $content);
|
||||
}
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', "Final content after placeholder replacement");
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
//mail send function
|
||||
public function sendTrigger($mail_content)
|
||||
{
|
||||
$this->myLogger->logme('error', "Sending email with content");
|
||||
|
||||
$response = MailHelper::send_email($mail_content);
|
||||
|
||||
$this->myLogger->logme('error', "Email sent response: " . json_encode($response));
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
//reply mail part
|
||||
public function sendReplyMessage($mail_data)
|
||||
{
|
||||
$this->myLogger->logme('error', "Preparing reply email for Ticket ID: " . $mail_data['ticket_id']);
|
||||
|
||||
$acm_mails = $this->ticketMasterModel->getTicketDataByTicketID($mail_data['ticket_id']);
|
||||
|
||||
if (!$acm_mails) {
|
||||
$this->myLogger->logme('error', "No ACM mails found for Ticket ID: " . $mail_data['ticket_id']);
|
||||
$this->myLogger->logme('error', "Reply mail not send");
|
||||
return false;
|
||||
}
|
||||
|
||||
$ticket_data = $this->ticketMasterModel->getTicketDataByTicketID($mail_data['ticket_id']);
|
||||
|
||||
if (!$ticket_data) {
|
||||
$this->myLogger->logme('error', "No ticket data found for Ticket ID : " .$mail_data['ticket_id']);
|
||||
$this->myLogger->logme('error', "Reply mail not send");
|
||||
return null;
|
||||
}
|
||||
|
||||
if(!empty($mail_data)){
|
||||
$mail_data['mail_content'] = $this->replacePlaceholders($mail_data['mail_content'], $ticket_data);
|
||||
$mail_data['mail_subject'] = $this->replacePlaceholders($mail_data['mail_subject'], $ticket_data);
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', "Fetched ACM emails");
|
||||
|
||||
$emailData = [
|
||||
'mail' => $mail_data['emp_mail'],
|
||||
'subject' => $mail_data['mail_subject'],
|
||||
'message' => $mail_data['mail_content'],
|
||||
'common' => [],
|
||||
'cc' => $acm_mails['common_mails'],
|
||||
'attachments' => []
|
||||
];
|
||||
|
||||
$this->myLogger->logme('error', "Final Reply Email Data");
|
||||
|
||||
return $this->sendTrigger($emailData);
|
||||
}
|
||||
|
||||
//auto mail part
|
||||
public function sendAutoMailTrigger($ticket_id)
|
||||
{
|
||||
$auto_mail_enable = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id);
|
||||
// print_rr($auto_mail_enable);
|
||||
$mail_responce = [];
|
||||
if (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 1) {
|
||||
$mail_content = $this->constructMailContent($ticket_id);
|
||||
$mail_responce = $this->sendTrigger($mail_content);
|
||||
}elseif (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 0 ){
|
||||
$this->myLogger->logme('error','Auto Mail Not Sent, Reason: Automail Not Enabled');
|
||||
}else{
|
||||
$this->myLogger->logme('error','Auto Mail Not Sent, Reason: Mail Template Not Created');
|
||||
}
|
||||
|
||||
return $mail_responce;
|
||||
}
|
||||
|
||||
//---- End Email Trigger Part----------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
public function ticketHistory($ticket_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
th.id,
|
||||
th.field_name,
|
||||
th.display_name,
|
||||
th.old_value,
|
||||
th.new_value,
|
||||
th.created_at,
|
||||
CONCAT(creator.first_name, ' ', creator.last_name) as modified_by,
|
||||
-- Claim Status
|
||||
old_status.claim_status as old_status_value,
|
||||
new_status.claim_status as new_status_value,
|
||||
|
||||
-- Account Manager
|
||||
CONCAT(old_account_manager.first_name, ' ', old_account_manager.last_name) as old_account_manager,
|
||||
CONCAT(new_account_manager.first_name, ' ', new_account_manager.last_name) as new_account_manager,
|
||||
|
||||
-- Insured Employee ID Change
|
||||
old_insured_emp.name as old_insured_id_name,
|
||||
new_insured_emp.name as new_insured_id_name,
|
||||
|
||||
ticket_master.ticket_type_id
|
||||
|
||||
FROM
|
||||
ticket_history th
|
||||
|
||||
-- Join for the user who made the change
|
||||
LEFT JOIN user_profiles creator
|
||||
ON th.created_by = creator.id
|
||||
|
||||
-- Status value lookups
|
||||
LEFT JOIN ticket_claim_status old_status
|
||||
ON th.field_name = 'claim_status_id'
|
||||
AND th.old_value = old_status.id
|
||||
AND old_status.is_active = 1
|
||||
|
||||
LEFT JOIN ticket_claim_status new_status
|
||||
ON th.field_name = 'claim_status_id'
|
||||
AND th.new_value = new_status.id
|
||||
|
||||
LEFT JOIN user_profiles as old_account_manager
|
||||
ON th.field_name = 'acm_id'
|
||||
AND th.old_value = old_account_manager.id
|
||||
|
||||
LEFT JOIN user_profiles as new_account_manager
|
||||
ON th.field_name = 'acm_id'
|
||||
AND th.new_value = new_account_manager.id
|
||||
|
||||
LEFT JOIN employees as old_insured_emp
|
||||
ON th.field_name = 'insured_emp_id'
|
||||
AND th.old_value = old_insured_emp.id
|
||||
|
||||
LEFT JOIN employees as new_insured_emp
|
||||
ON th.field_name = 'insured_emp_id'
|
||||
AND th.new_value = new_insured_emp.id
|
||||
|
||||
LEFT JOIN ticket_master as ticket_master
|
||||
on th.field_name = 'claim_type'
|
||||
AND th.ticket_id = ticket_master.id
|
||||
|
||||
|
||||
|
||||
WHERE
|
||||
th.ticket_id = $ticket_id
|
||||
AND th.is_active = 1
|
||||
ORDER BY
|
||||
th.created_at DESC";
|
||||
$data = $this->ticketHistoryModel->query($sql)->getResultArray();
|
||||
$priorityType = $this->priorityType;
|
||||
$relationshipType = $this->relationshipType;
|
||||
$modeOFIntimate = $this->modeOFIntimate;
|
||||
$claim_type = $this->claimType;
|
||||
foreach ($data as &$row) {
|
||||
if ($row['field_name'] == 'claim_status_id') {
|
||||
$new_old_value = isset($row['old_status_value']) ? $row['old_status_value'] : '-';
|
||||
$new_new_value = $row['new_status_value'];
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'acm_id') {
|
||||
$new_old_value = isset($row['old_account_manager']) ? $row['old_account_manager'] : '-';
|
||||
$new_new_value = $row['new_account_manager'];
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'insured_emp_id') {
|
||||
$new_old_value = isset($row['old_insured_id_name']) ? $row['old_insured_id_name'] : '-';
|
||||
$new_new_value = $row['new_insured_id_name'];
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'priority') {
|
||||
$new_old_value = isset($priorityType[$row['old_value']]) ? $priorityType[$row['old_value']] : '-';
|
||||
$new_new_value = isset($priorityType[$row['new_value']]) ? $priorityType[$row['new_value']] : '-';
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'relationship') {
|
||||
$new_old_value = isset($relationshipType[$row['old_value']]) ? $relationshipType[$row['old_value']] : '-';
|
||||
$new_new_value = isset($relationshipType[$row['new_value']]) ? $relationshipType[$row['new_value']] : '-';
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'mode_of_intimation') {
|
||||
$new_old_value = isset($modeOFIntimate[$row['old_value']]) ? $modeOFIntimate[$row['old_value']] : "-";
|
||||
$new_new_value = isset($modeOFIntimate[$row['old_value']]) ? $modeOFIntimate[$row['old_value']] : "-";
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'claim_type') {
|
||||
$new_old_value = isset($claim_type[$row['ticket_type_id']][$row['old_value']]) ? $claim_type[$row['ticket_type_id']][$row['old_value']] : '-';
|
||||
$new_new_value = isset($claim_type[$row['ticket_type_id']][$row['new_value']])?$claim_type[$row['ticket_type_id']][$row['new_value']]:'-';
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} elseif ($row['field_name'] == 'claim_type') {
|
||||
$new_old_value = isset($claim_type[$row['old_value']]) ? $claim_type[$row['old_value']] : '-';
|
||||
$new_new_value = isset($claim_type[$row['new_value']]) ? $claim_type[$row['new_value']] : '-';
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
} else {
|
||||
$new_old_value = isset($row['old_value']) ? $row['old_value'] : '-';
|
||||
$new_new_value = isset($row['new_value']) ? $row['new_value'] : '-';
|
||||
$row['old_value'] = $new_old_value;
|
||||
$row['new_value'] = $new_new_value;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return ($data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,11 +56,12 @@ class GmailResponseHandler{
|
||||
// 'employee_id' => isset($params['params']['common']['employee_id']) ? $params['params']['common']['employee_id'] : null,
|
||||
// 'mail_type' => isset($params['params']['common']['mail_type']) ? $params['params']['common']['mail_type'] : null,
|
||||
// 'gmail_api_status' => isset($params['gmail_api']['status']) ? $params['gmail_api']['status'] : null,
|
||||
// 'gmail_api_id' => isset($params['gmail_api']['data']['id']) ? $params['gmail_api']['data']['id'] : null
|
||||
// 'gmail_api_id' => isset($params['gmail_api']['data']['id']) ? $params['gmail_api']['data']['id'] : null,
|
||||
// 'received_message' => isset($params['gmail_api']['data']['labelIds'])?json_encode($params['gmail_api']['data']['labelIds']): null
|
||||
// ];
|
||||
// Initialize data array
|
||||
$data = [];
|
||||
// print_r($params['params']['common']);die();
|
||||
// // print_r($params['params']['common']);die();
|
||||
if (isset($params['params']['common'])) {
|
||||
foreach ($params['params']['common'] as $key => $value) {
|
||||
$data[$key] = isset($value) ? $value : null;
|
||||
|
||||
@ -113,7 +113,7 @@ class sendMailNotification
|
||||
|
||||
$subject = $cleanedText;
|
||||
|
||||
$link = generate_download_link($rand_string);
|
||||
$link = generate_download_link($rand_string).'/1';
|
||||
|
||||
$app_link = $_ENV['App_Url'];
|
||||
$name = $get_emp_email_and_other_details['name'];
|
||||
|
||||
@ -240,4 +240,25 @@ class EmployeeModel extends Model
|
||||
return $results;
|
||||
}
|
||||
|
||||
public function getEmployeeByEmployeeCode($emp_code)
|
||||
{
|
||||
return $this->select("
|
||||
employees.id AS emp_id,
|
||||
employees.name AS emp_name,
|
||||
employees.emp_code,
|
||||
employees.mobile AS emp_mobile,
|
||||
employees.email_corporate AS emp_email,
|
||||
employees.relationship AS emp_relationship,
|
||||
employee_polices.uhid AS policy_no,
|
||||
employee_polices.tpa_id AS tpa_no
|
||||
")
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
|
||||
->where('employees.is_active', 1)
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employees.emp_code', $emp_code)
|
||||
->groupBy('employees.id')
|
||||
->findAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1201,5 +1201,62 @@ class PolicyTransactionModel extends Model
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
|
||||
|
||||
//function for fetch renewal report data
|
||||
public function getRenewalReportData($start_date = null, $end_date = null, $client_type = null, $client = null, $issuer = null)
|
||||
{
|
||||
$fromDate = date('Y-m-d', strtotime('-60 days'));
|
||||
$toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
if (!empty($start_date) && !empty($end_date)) {
|
||||
$fromDate = change_date_format($start_date);
|
||||
$toDate = change_date_format($end_date);
|
||||
}
|
||||
|
||||
$query = $this->db->table('policy_transaction pt')
|
||||
->select('
|
||||
pt.*,
|
||||
c.client_name,
|
||||
c.short_name AS client_short_name,
|
||||
c.client_type,
|
||||
policy_type.policy_type,
|
||||
i.name as insurer_name,
|
||||
ib.branch_name as insurer_branch_name,
|
||||
vehicle.vehicle_no,
|
||||
leads.status as lead_status
|
||||
')
|
||||
->join('clients c', 'pt.client_id = c.id', 'left')
|
||||
->join('pt_co_share_details pt_co', 'pt.id = pt_co.pt_id and pt_co.co_share_type = 1', 'left')
|
||||
->join('insurers i', 'pt_co.insurer_id = i.id', 'left')
|
||||
->join('insurer_branch ib', 'pt_co.insurer_branch_id = ib.id', 'left')
|
||||
->join('policy_type', 'pt.policy_type_id = policy_type.id', 'left')
|
||||
->join('vehicle', 'pt.vehicle_id = vehicle.id and vehicle.is_active = 1', 'left')
|
||||
->join('leads', 'pt.client_policy_id = leads.source_policy_id and leads.source_policy_id != 0 and leads.is_active = 1', 'left')
|
||||
->where('pt.policy_end_date >=', $fromDate)
|
||||
->where('pt.policy_end_date <=', $toDate)
|
||||
->where('pt.is_active', 1)
|
||||
->where('pt_co.is_active', 1)
|
||||
->where('pt.action_type', "inception");
|
||||
|
||||
// Apply filters if parameters are provided
|
||||
if (!empty($client_type)) {
|
||||
$query->where('c.client_type', $client_type);
|
||||
}
|
||||
if (!empty($client)) {
|
||||
$query->where('pt.client_id', $client);
|
||||
}
|
||||
if (!empty($issuer)) { // Corrected condition to check $issuer
|
||||
$query->where('pt.issuer', $issuer);
|
||||
}
|
||||
|
||||
$query->groupBy('pt.id');
|
||||
$query->orderBy('pt.id', 'DESC');
|
||||
// Fetch and return results
|
||||
$results = $query->get()->getResultArray();
|
||||
// print($this->db->getLastQuery()); die;
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -46,4 +46,6 @@ class TicketClaimStatusModel extends Model
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -12,7 +12,8 @@ class TicketHistoryModel extends Model
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [];
|
||||
protected $allowedFields = ['id','field_name','display_name','old_value',
|
||||
'new_value','created_by','created_at','updated_by','updated_at','is_active'];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
|
||||
@ -12,7 +12,7 @@ class TicketMailTemplateModel extends Model
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [];
|
||||
protected $allowedFields = ['id','template_name','subject','ticket_type','is_auto_mail','trigger_type','mail_content'];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
|
||||
@ -48,7 +48,9 @@ class TicketMasterModel extends Model
|
||||
'date_of_intimat',
|
||||
'si_amt',
|
||||
'is_active',
|
||||
'claim_number'
|
||||
'claim_number',
|
||||
'emp_id',
|
||||
'insured_emp_id',
|
||||
];
|
||||
|
||||
|
||||
@ -84,4 +86,63 @@ class TicketMasterModel extends Model
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getTemplateDataByStatusID($claim_status_id)
|
||||
{
|
||||
|
||||
$template_data = $this->table('ticket_claim_status')
|
||||
->select('ticket_mail_template.*')
|
||||
->join('ticket_mail_template', 'ticket_mail_template.trigger_type = ticket_claim_status.trigger_type')
|
||||
->where('ticket_mail_template.is_active', 1)
|
||||
->where('ticket_claim_status.is_active', 1)
|
||||
->where('ticket_claim_status.id', $claim_status_id)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
return $template_data;
|
||||
}
|
||||
|
||||
public function getTemplateDataByTicketID($ticket_id)
|
||||
{
|
||||
$template_data = $this
|
||||
->select("ticket_mail_template.*, ticket_master.emp_mail")
|
||||
->join('ticket_claim_status', 'ticket_master.claim_status_id = ticket_claim_status.id and ticket_claim_status.is_active = 1')
|
||||
->join('ticket_mail_template', '
|
||||
ticket_claim_status.trigger_type = ticket_mail_template.trigger_type
|
||||
and ticket_claim_status.ticket_type = ticket_mail_template.ticket_type
|
||||
and ticket_mail_template.is_active = 1')
|
||||
->where('ticket_master.id', $ticket_id)
|
||||
->where('ticket_master.is_active', 1)
|
||||
->first();
|
||||
|
||||
return $template_data;
|
||||
}
|
||||
|
||||
public function getTicketDataByTicketID($ticket_id)
|
||||
{
|
||||
$ticket_data = $this->select("
|
||||
ticket_master.*,
|
||||
|
||||
user_profiles.first_name as acm,
|
||||
user_profiles.mobile as acm_mobile,
|
||||
user_profiles.email as acm_email,
|
||||
|
||||
clients.common_mails,
|
||||
clients.client_name,
|
||||
|
||||
insurers.name as insurer_name,
|
||||
tpa.name as tpa_name
|
||||
")
|
||||
->join('clients', 'ticket_master.client_id = clients.id', 'left')
|
||||
->join('insurers', 'ticket_master.insurer_id = insurers.id', 'left')
|
||||
->join('tpa', 'ticket_master.tpa_id = tpa.id', 'left')
|
||||
->join('user_profiles', 'ticket_master.acm_id = user_profiles.id', 'left')
|
||||
->where('ticket_master.id', $ticket_id)
|
||||
->where('ticket_master.is_active', 1)
|
||||
->first();
|
||||
|
||||
return $ticket_data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ class TicketMessageModel extends Model
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [];
|
||||
protected $allowedFields = ['id','sender','ticket_id','mail_subject','emp_mail','mail_content','created_at'];
|
||||
|
||||
|
||||
// Callbacks
|
||||
|
||||
@ -12,7 +12,7 @@ class TicketNoteModel extends Model
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = ['id,created_by','updated_by','is_active'];
|
||||
protected $allowedFields = ['id','ticket_id','note','created_by','updated_by','is_active'];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
|
||||
145
app/Views/bds_renewal_report_list.php
Normal file
145
app/Views/bds_renewal_report_list.php
Normal file
@ -0,0 +1,145 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="inception_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Renewal Policy List</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>
|
||||
<div class="column-header">S.No.</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Renewal Month</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Issuer</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Policy No</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Policy</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Insurer Name</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Insurer Branch</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Insured</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Client Type</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Business Type</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Date of Issue </div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Policy Start Date</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Policy Expiry Date</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Vehicle No</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Lead Status</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php foreach($renewal_data as $index => $row) { ?>
|
||||
<tr>
|
||||
<td><?php echo $index+1; ?></td>
|
||||
<td><?php echo empty($row['policy_end_date']) ? ' - ' : date('M-Y', strtotime($row['policy_end_date'])); ?>
|
||||
<td><?php echo $issuer[$row['issuer']] ?? ' - '; ?></td>
|
||||
<td><?php echo $row['policy_no'] ?? ' - '; ?></td>
|
||||
<td><?php echo $row['policy_type'] ?? ' - '; ?></td>
|
||||
<td><?php echo $row['insurer_name'] ?? ' - '; ?></td>
|
||||
<td><?php echo $row['insurer_branch_name'] ?? ' - '; ?></td>
|
||||
<td><?php echo $row['client_name'] ?? ' - ' ?></td>
|
||||
<td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td>
|
||||
<td><?php echo $row['revenue_type'] ?? ' - ' ?></td>
|
||||
<td><?php echo empty($row['policy_issue_date']) ? '' : date('d/m/Y', strtotime($row['policy_issue_date'])); ?>
|
||||
</td>
|
||||
<td><?php echo empty($row['policy_start_date']) ? '' : date('d/m/Y', strtotime($row['policy_start_date'])); ?>
|
||||
</td>
|
||||
<td><?php echo empty($row['policy_end_date']) ? '' : date('d/m/Y', strtotime($row['policy_end_date'])); ?>
|
||||
</td>
|
||||
<td><?php echo $row['vehicle_no'] ?? ' - ' ?></td>
|
||||
<td><?php echo ucfirst($row['lead_status'] ?? ' - ') ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Datatable document ready
|
||||
$(document).ready(function() {
|
||||
|
||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||
|
||||
if (ticketsTable.length) {
|
||||
ticketsTable.DataTable({
|
||||
scrollX: true,
|
||||
dom: "<'row'<'col-sm-2'f><'col-sm-10 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Renewal-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'Renewal-List',
|
||||
exportOptions: {
|
||||
orthogonal: 'sort'
|
||||
},
|
||||
}
|
||||
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 20, // Set default number of rows per page (optional)
|
||||
ordering: true,
|
||||
});
|
||||
} else {
|
||||
console.error("Table atet found.");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@ -45,7 +45,7 @@ table.dataTable tbody td {
|
||||
<td><?= $data['insurers'] ?></td>
|
||||
<td><?= $data['Policies'] ?></td>
|
||||
<td><?= $data['Premium'] ?></td>
|
||||
<td><?= $data['Revenue'] ?></td>
|
||||
<td><?= $data['Revenue'] == 0.00 ? $data['Expected_amt'] : $data['Revenue']?></td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
|
||||
@ -45,7 +45,7 @@ table.dataTable tbody td {
|
||||
<td><?= $data['bap'] ?></td>
|
||||
<td><?= $data['Policies'] ?></td>
|
||||
<td><?= $data['Premium'] ?></td>
|
||||
<td><?= $data['Revenue'] ?></td>
|
||||
<td><?= $data['Revenue']== 0.00 ? $data['Expected_amt'] : $data['Revenue']?></td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
|
||||
@ -160,7 +160,7 @@
|
||||
<a href="<?= base_url('download-e-card/'). $employee['rand_string'] ?>" class="dropdown-item" target="_blank"><i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View E-Card</a>
|
||||
<?php } ?>
|
||||
|
||||
<?php if(in_array($employee['policy_type_id'], [2,3,4,5]) && $employee['email_corporate'] != '' && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>
|
||||
<?php if($employee['relationship'] == 'Self' && in_array($employee['policy_type_id'], [2,3,4,5]) && $employee['email_corporate'] != '' && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>
|
||||
<a class="dropdown-item" onclick="send_mail_for_individual_employee_ecard('<?= $employee['id'];?>')" ><i class="mdi mdi-email-alert mr-2 text-muted font-18 vertical-middle"></i>Send E-Card Mail</a>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@ -135,8 +135,9 @@ table.dataTable tbody td {
|
||||
|
||||
|
||||
|
||||
<?php include('employee_data_list.php');?>
|
||||
<?php // include('employee_data_list.php');?>
|
||||
|
||||
<div id="employee_table_list"></div>
|
||||
|
||||
<!-- end row -->
|
||||
<div id="loader" class="loader" style="display:none;">SPINNER</div>
|
||||
@ -502,24 +503,29 @@ function fetchEmpolyeeList(event) {
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
// console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
// window.location.href = apiURL;
|
||||
|
||||
|
||||
// var apiURL2 = $('#get-emp-list').attr('href'); // Get href attribute value
|
||||
// console.log(apiURL);
|
||||
// $.ajax({
|
||||
// url: apiURL,
|
||||
// method: 'GET',
|
||||
// data: queryParams,
|
||||
// success: function(response) {
|
||||
// // Assuming response is a JSON array
|
||||
// // displayDataTables(response);
|
||||
// console.log(response);
|
||||
// },
|
||||
// error: function(xhr, status, error) {
|
||||
// console.error('Error:', error);
|
||||
// }
|
||||
// });
|
||||
console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
data: queryParams,
|
||||
success: function(response) {
|
||||
if(response.status == true){
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$('#employee_table_list').html(response.html);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error:', error);
|
||||
toastr.error('Failed to fetch Data','Error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -87,7 +87,8 @@
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
|
||||
'Last Year': [moment().subtract(1, 'year').startOf('year'), moment().subtract(1, 'year').endOf('year')]
|
||||
}
|
||||
}, cb);
|
||||
|
||||
|
||||
@ -20,6 +20,17 @@ table.dataTable tbody td {
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.right-align-input:nth-child(4n+1),
|
||||
.right-align-input:nth-child(4n+2) {
|
||||
background-color: #f9f9f9; /* Light gray shade */
|
||||
}
|
||||
|
||||
.right-align-input:nth-child(4n+3),
|
||||
.right-align-input:nth-child(4n+4) {
|
||||
background-color: #ffffff; /* White shade */
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="col-12" id="second_page">
|
||||
@ -46,8 +57,8 @@ table.dataTable tbody td {
|
||||
<th colspan="2" style="text-align: center;">Life</th>
|
||||
<th colspan="2" style="text-align: center;">Marine Cargo</th>
|
||||
<th colspan="2" style="text-align: center;">Misc</th>
|
||||
<th colspan="2" style="text-align: center;">Motor</th>
|
||||
<th colspan="2" style="text-align: center;">Marine Hull</th>
|
||||
<th colspan="2" style="text-align: center;">Motor</th>
|
||||
<th colspan="2" style="text-align: center;">Grand Total</th>
|
||||
</tr>
|
||||
|
||||
@ -118,7 +129,6 @@ table.dataTable tbody td {
|
||||
<td class="right-align-input"><?php echo $row['marine_hull_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['marine_hull_premium']; ?></td>
|
||||
|
||||
|
||||
<td class="right-align-input"><?php echo $row['misc_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['misc_premium']; ?></td>
|
||||
|
||||
|
||||
@ -44,8 +44,8 @@ table.dataTable tbody td {
|
||||
<th colspan="3" style="text-align: center;">Life</th>
|
||||
<th colspan="3" style="text-align: center;">Marine Cargo</th>
|
||||
<th colspan="3" style="text-align: center;">Misc</th>
|
||||
<th colspan="3" style="text-align: center;">Motor</th>
|
||||
<th colspan="3" style="text-align: center;">Marine Hull</th>
|
||||
<th colspan="3" style="text-align: center;">Motor</th>
|
||||
<th colspan="3" style="text-align: center;">Grand Total</th>
|
||||
</tr>
|
||||
|
||||
@ -107,44 +107,59 @@ table.dataTable tbody td {
|
||||
|
||||
<td class="right-align-input"><?php echo $row['engineering_policy_count']; ?> </td>
|
||||
<td class="right-align-input"><?php echo $row['engineering_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['engineering_revenue']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['engineering_revenue']== 0.00 ? $row['engineering_exp_amt'] : $row['engineering_revenue']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['fire_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['fire_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['fire_revenue']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['fire_revenue']== 0.00 ? $row['fire_exp_amt'] : $row['fire_revenue']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['health_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['health_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['health_revenue']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['health_revenue']== 0.00 ? $row['health_exp_amt'] : $row['health_revenue']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['liability_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['liability_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['liability_revenue']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['liability_revenue']== 0.00 ? $row['liability_exp_amt'] : $row['liability_revenue']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['life_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['life_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['life_revenue'];?></td>
|
||||
<td class="right-align-input"><?php echo $row['life_revenue']== 0.00 ? $row['life_exp_amt'] : $row['life_revenue'];?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['marine_cargo_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['marine_cargo_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['marine_cargoe_revenue'];?></td>
|
||||
<td class="right-align-input"><?php echo $row['marine_cargoe_revenue']== 0.00 ? $row['marine_cargo_exp_amt'] : $row['marine_cargoe_revenue'];?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['marine_hull_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['marine_hull_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['marine_hull_revenue'];?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['marine_hull_revenue']== 0.00 ? $row['marine_hull_exp_amt'] : $row['marine_hull_revenue'];?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['misc_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['misc_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['misc_revenue']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['misc_revenue']== 0.00 ? $row['misc_exp_amt'] : $row['misc_revenue']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['motor_policy_count'] ?></td>
|
||||
<td class="right-align-input"><?php echo $row['motor_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['motor_revenue']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['motor_revenue']== 0.00 ? $row['motor_exp_amt'] : $row['motor_revenue']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['total_policy_count'] ?></td>
|
||||
<td class="right-align-input"><?php echo $row['total_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['total_revenue']; ?></td>
|
||||
|
||||
<?php
|
||||
$total_revenue = 0; // Initialize total revenue
|
||||
|
||||
// Calculate total revenue by summing all individual revenues
|
||||
$total_revenue += $row['engineering_revenue']== 0.00 ? $row['engineering_exp_amt'] : $row['engineering_revenue'];
|
||||
$total_revenue += $row['fire_revenue']== 0.00 ? $row['fire_exp_amt'] : $row['fire_revenue'];
|
||||
$total_revenue += $row['health_revenue']== 0.00 ? $row['health_exp_amt'] : $row['health_revenue'];
|
||||
$total_revenue += $row['liability_revenue']== 0.00 ? $row['liability_exp_amt'] : $row['liability_revenue'];
|
||||
$total_revenue += $row['life_revenue']== 0.00 ? $row['life_exp_amt'] : $row['life_revenue'];
|
||||
$total_revenue += $row['marine_cargoe_revenue']== 0.00 ? $row['marine_cargo_exp_amt'] : $row['marine_cargoe_revenue'];
|
||||
$total_revenue += $row['marine_hull_revenue']== 0.00 ? $row['marine_hull_exp_amt'] : $row['marine_hull_revenue'];
|
||||
$total_revenue += $row['misc_revenue']== 0.00 ? $row['misc_exp_amt'] : $row['misc_revenue'];
|
||||
$total_revenue += $row['motor_revenue']== 0.00 ? $row['motor_exp_amt'] : $row['motor_revenue'];
|
||||
?>
|
||||
|
||||
<td class="right-align-input"><?php echo round($total_revenue, 2); ?></td>
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
@ -739,6 +739,9 @@
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/irba_report') ?>">IRDA Reports</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
</ul>
|
||||
|
||||
2009
app/Views/notification old.php
Normal file
2009
app/Views/notification old.php
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
236
app/Views/renewal_search.php
Normal file
236
app/Views/renewal_search.php
Normal file
@ -0,0 +1,236 @@
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card mb-1">
|
||||
<h5 class="m-1">
|
||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
|
||||
aria-expanded="true">
|
||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||
</a>
|
||||
</h5>
|
||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<!-- <div class="text-center"> -->
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3" id="date_div">
|
||||
<label>Date<span class="text-danger"></span></label>
|
||||
<div id="reportrange" class="form-control"
|
||||
style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
|
||||
<i class="fa fa-calendar"></i>
|
||||
<span></span> <i class="fa fa-caret-down"></i>
|
||||
</div>
|
||||
<input type="hidden" id="startDate" value=<?= $default_start ?>>
|
||||
<input type="hidden" id="endDate" value=<?= $default_end ?>>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Issuer<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="issuer" name="issuer">
|
||||
<option value="">Select Issuer</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-3 client_type_div">
|
||||
<label for="client_type">Client Type<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="client_type" name="client_type">
|
||||
<option value="">Select Client type</option>
|
||||
<option value="1">Group</option>
|
||||
<option value="2">Individual</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Client<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="">Select Client</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row justify-content-end">
|
||||
|
||||
<div class="col-auto">
|
||||
<a href="#" class="btn btn-primary waves-effect waves-light" id="get-report-page"
|
||||
onclick="fetchReportPage(event);">Submit</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="report"></div>
|
||||
|
||||
<script>
|
||||
let client_list = [];
|
||||
|
||||
$(document).ready(function() {
|
||||
getClientAndBranchAndPolicy();
|
||||
$('#client_id').select2();
|
||||
})
|
||||
|
||||
$(function() {
|
||||
|
||||
var start = $('#startDate').val();
|
||||
var end = $('#endDate').val();
|
||||
|
||||
var start = moment(start, 'DD/MM/YYYY');
|
||||
var end = moment(end, 'DD/MM/YYYY');
|
||||
|
||||
function cb(start, end) {
|
||||
$('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
|
||||
$('#startDate').val(start.format('DD-MM-YYYY'));
|
||||
$('#endDate').val(end.format('DD-MM-YYYY'));
|
||||
}
|
||||
|
||||
$('#reportrange').daterangepicker({
|
||||
startDate: start,
|
||||
endDate: end,
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Next 7 Days': [moment(), moment().add(6, 'days')], // Next 7 Days
|
||||
'Next 30 Days': [moment(), moment().add(29, 'days')], // Next 30 Days
|
||||
'Next Month': [moment().add(1, 'month').startOf('month'), moment().add(1, 'month').endOf(
|
||||
'month')], // Next Month
|
||||
'Next Year': [moment().add(1, 'year').startOf('year'), moment().add(1, 'year').endOf(
|
||||
'year')], // Next Year
|
||||
'Current Year': [moment().startOf('year'), moment().endOf('year')] // Current Year
|
||||
|
||||
}
|
||||
}, cb);
|
||||
|
||||
cb(start, end);
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
|
||||
function fetchReportPage() {
|
||||
|
||||
var fromDate = $('#startDate').val();
|
||||
var toDate = $('#endDate').val();
|
||||
var client_id = $('#client_id').val();
|
||||
var client_type = $('#client_type').val();
|
||||
var issuer = $('#issuer').val();
|
||||
var requestData = {
|
||||
fromDate: fromDate,
|
||||
toDate: toDate,
|
||||
client_id: client_id,
|
||||
client_type: client_type,
|
||||
issuer: issuer,
|
||||
};
|
||||
console.log(typeof fromDate);
|
||||
var url = '<?= base_url('/bdsReport/renewal_report') ?>';
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
|
||||
if (response.status == true) {
|
||||
$('#report').html(response.html);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
} 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');
|
||||
});
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
|
||||
//get client , branch, policy data
|
||||
function getClientAndBranchAndPolicy() {
|
||||
$.ajax({
|
||||
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('getClientAndBranchAndPolicy', res);
|
||||
if (res.status == true) {
|
||||
client_list = res.client_data;
|
||||
appendClients(res.client_data);
|
||||
} else {
|
||||
console.log('No data found');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//append the clients data
|
||||
function appendClients(data) {
|
||||
$('#client_id').empty();
|
||||
|
||||
$('#client_id').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select Client'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name,
|
||||
'data-name': item.client_name,
|
||||
});
|
||||
|
||||
$('#client_id').append(option).select2();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$('#client_type').on('change', function() {
|
||||
|
||||
var selectedClientType = $(this).val();
|
||||
|
||||
// console.log('selectedClientType', selectedClientType);
|
||||
|
||||
// Clear and add default options for client
|
||||
$('#client_id').empty().append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select Client'
|
||||
}))
|
||||
|
||||
// Populate client options based on selected client type
|
||||
if (selectedClientType) {
|
||||
|
||||
$.each(client_list, function(index, item) {
|
||||
if (item.client_type == selectedClientType) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name,
|
||||
});
|
||||
$('#client_id').append(option);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Initialize or refresh Select2 for both dropdowns
|
||||
$('#client_id').select2();
|
||||
});
|
||||
</script>
|
||||
@ -1,28 +1,37 @@
|
||||
<div id="ticket_messages_div">
|
||||
<?php $messages = $message_data['messages'];
|
||||
foreach ($messages as $message) :
|
||||
?>
|
||||
<?php if ($message['sender'] == 'user') { ?>
|
||||
<div class="card mb-3" style="margin-right: 23px;">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-xl-2 col-lg-3">
|
||||
<div class="text-center">
|
||||
<div class="mb-3">
|
||||
<img src="https://venbait.in/nhance/helpdesk/dev/assets/helpdeskz/images/user.jpg"
|
||||
class="user-avatar rounded-circle img-fluid" style="max-width: 100px">
|
||||
<div style="padding-left: 10px;" class="mb-3">
|
||||
<div class="row">
|
||||
<img src="https://venbait.in/nhance/helpdesk/dev/assets/helpdeskz/images/user.jpg"
|
||||
class="user-avatar rounded-circle img-fluid col-mb-6" style="max-width: 70px">
|
||||
<div style="padding-left: 10px;padding-top: 15px;" class="col-mb-6"><?= $message_data['emp_name'] ?></div>
|
||||
</div>
|
||||
<span style="text-align: center; position: relative;text-align: center;bottom: 28px;left: 15px;" class="badge badge-dark">User</span>
|
||||
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<div>RUPESH</div>
|
||||
<span class="badge badge-dark">User</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="mb-3">
|
||||
<div class="text-muted"><i class="fa fa-calendar"></i> 16 December 2024 04:15 pm</div>
|
||||
<div class="text-muted"><i class="fa fa-calendar"></i> <?php echo (new DateTime($message['created_at']))->format('j F Y h:i a');?></div>
|
||||
</div>
|
||||
<div id="msg_388" class="form-group">
|
||||
Body </div>
|
||||
<div class="form-group mt-5">
|
||||
<p><?= $message['mail_content'] ?></p>
|
||||
</div>
|
||||
<!-- <div class="form-group mt-5">
|
||||
<button class="btn btn-dark btn-sm" type="button" onclick="quoteMessage(388);"><i
|
||||
class="fa fa-quote-left"></i> Quote</button>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="border-top mt-3 pt-4 text-right">
|
||||
</div>
|
||||
</div>
|
||||
@ -30,38 +39,41 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } else { ?>
|
||||
<div class="card mb-3 bg-staff" style="margin-right: 23px;">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-xl-2 col-lg-3">
|
||||
<div class="text-center">
|
||||
<div class="mb-3">
|
||||
<img src="https://venbait.in/nhance/helpdesk/dev/assets/helpdeskz/images/agent.jpg"
|
||||
class="user-avatar rounded-circle img-fluid" style="max-width: 100px">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<div>Venkatesh HelpDesk Admin</div>
|
||||
<span class="badge badge-primary">Staff</span>
|
||||
<div style="padding-left: 10px;" class="mb-3">
|
||||
<div class="row">
|
||||
<img src="https://venbait.in/nhance/helpdesk/dev/assets/helpdeskz/images/agent.jpg"
|
||||
class="user-avatar rounded-circle img-fluid col-mb-6" style="max-width: 70px">
|
||||
<div style="padding-left: 10px;padding-top: 15px;" class="col-mb-6"><?= $message_data['user_name'] ?></div>
|
||||
|
||||
</div>
|
||||
<span style="text-align: center; position: relative;text-align: center;bottom: 28px;left: 15px;" class="badge badge-primary">Staff</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="mb-3">
|
||||
<div class="text-muted"><i class="fa fa-calendar"></i> 24 January 2025 03:41 pm</div>
|
||||
<div class="text-muted"><i class="fa fa-calendar"></i> <?php echo (new DateTime($message['created_at']))->format('j F Y h:i a');?></div>
|
||||
</div>
|
||||
<div id="msg_394" class="form-group">
|
||||
<p>hi how are you i am fine</p>
|
||||
<p><?= $message['mail_content'] ?></p>
|
||||
</div>
|
||||
<div class="form-group mt-5">
|
||||
<!-- <div class="form-group mt-5">
|
||||
<button class="btn btn-dark btn-sm" type="button" onclick="quoteMessage(394);"><i
|
||||
class="fa fa-quote-left"></i> Quote</button>
|
||||
</div>
|
||||
<div class="border-top mt-3 pt-4 text-right">
|
||||
</div> -->
|
||||
<!-- <div class="border-top mt-3 pt-4 text-right">
|
||||
<i class="fa fa-globe"></i> 115.97.253.189
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } endforeach; ?>
|
||||
</div>
|
||||
|
||||
@ -22,25 +22,29 @@
|
||||
<!-- Navigation Tabs -->
|
||||
<ul class="nav nav-pills navtab-bg">
|
||||
<li class="nav-item">
|
||||
<a href="#general-tab" data-toggle="tab" class="nav-link px-2 py-1 active" id="general_tab" aria-expanded="true">
|
||||
<a href="#general-tab" data-toggle="tab" class="nav-link px-2 py-1 active" id="general_tab"
|
||||
aria-expanded="true">
|
||||
<i class="mdi mdi-contacts mr-1"></i>
|
||||
<span class="d-none d-sm-inline-block">General</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#reply-tab" data-toggle="tab" class="nav-link px-2 py-1" id="reply_tab" aria-expanded="false">
|
||||
<a href="#reply-tab" data-toggle="tab" class="nav-link px-2 py-1" id="reply_tab"
|
||||
aria-expanded="false">
|
||||
<i class="fa fa-file mr-1"></i>
|
||||
<span class="d-none d-sm-inline-block">Reply</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#note-tab" data-toggle="tab" class="nav-link px-2 py-1" id="note_tab" aria-expanded="false">
|
||||
<a href="#note-tab" data-toggle="tab" class="nav-link px-2 py-1" id="note_tab"
|
||||
aria-expanded="false">
|
||||
<i class="mdi mdi-account-switch mr-1"></i>
|
||||
<span class="d-none d-sm-inline-block">Note</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#history-tab" data-toggle="tab" class="nav-link px-2 py-1" id="history_tab" aria-expanded="false">
|
||||
<a href="#history-tab" data-toggle="tab" class="nav-link px-2 py-1" id="history_tab"
|
||||
aria-expanded="false">
|
||||
<i class="mdi mdi-source-branch mr-1"></i>
|
||||
<span class="d-none d-sm-inline-block">History</span>
|
||||
</a>
|
||||
@ -50,7 +54,14 @@
|
||||
<!-- Tab Content -->
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade show active" id="general-tab">
|
||||
<?php include('ticket_form_gpa.php'); ?>
|
||||
<?php
|
||||
|
||||
if ($ticket_data['ticket_type_id'] == 1) {
|
||||
include('ticket_form_gmc.php');
|
||||
} else {
|
||||
include('ticket_form_gpa.php');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="reply-tab">
|
||||
<?php include('ticket_reply.php'); ?>
|
||||
@ -67,6 +78,125 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="member_data_modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myCenterModalLabel"></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="acm_id">Insured Member<span class="text-danger"></span></label>
|
||||
<select class="form-control" onchange="setMemberData(this)">
|
||||
<option value="0">Select Insured Member</option>
|
||||
<?php if (!empty($member_data)) : ?>
|
||||
<?php foreach ($member_data as $value) : ?>
|
||||
<option value="<?= isset($value['emp_code']) ? $value['emp_code'] : '' ?>"
|
||||
data-empID="<?= isset($value['emp_id']) ? $value['emp_id'] : '' ?>"
|
||||
data-empName="<?= isset($value['emp_name']) ? htmlspecialchars($value['emp_name'], ENT_QUOTES, 'UTF-8') : '' ?>"
|
||||
data-policyNo="<?= isset($value['policy_no']) ? $value['policy_no'] : '' ?>"
|
||||
data-tpaNo="<?= isset($value['tpa_no']) ? $value['tpa_no'] : '' ?>"
|
||||
data-relationship="<?= isset($value['emp_relationship']) ? htmlspecialchars($value['emp_relationship'], ENT_QUOTES, 'UTF-8') : '' ?>">
|
||||
<?= isset($value['emp_name']) && isset($value['emp_relationship'])
|
||||
? htmlspecialchars($value['emp_name'] . ' - ' . $value['emp_relationship'], ENT_QUOTES, 'UTF-8')
|
||||
: 'Unknown Member' ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a class="btn btn-primary close" data-dismiss="modal" aria-label="Close">Submit</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ticket_conversation_div">
|
||||
<?php include("ticket_conversation.php") ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php //include("ticket_form_handler.php") ?>
|
||||
|
||||
<script>
|
||||
|
||||
function submitClaimForm(event, form) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
const formAction = '<?= base_url("ticket/update"); ?>';
|
||||
|
||||
// Show loader
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
// Collect IDs and form data
|
||||
const formData = new FormData(form);
|
||||
|
||||
// AJAX request
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: formAction,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(response) {
|
||||
// Hide loader
|
||||
|
||||
console.log('Form submitted response:', response);
|
||||
|
||||
if (response.status === true) {
|
||||
location.reload();
|
||||
toastr.success(response.message, 'SUCCESS');
|
||||
} else {
|
||||
toastr.error(response.message, 'ERROR');
|
||||
}
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
// Hide loader
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function openFetchEmpDataodal() {
|
||||
var myModal = new bootstrap.Modal(document.getElementById('member_data_modal'));
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
function setMemberData(input) {
|
||||
|
||||
var selectedOption = $(input).find(':selected');
|
||||
|
||||
// Retrieve the data-* attributes
|
||||
var empId = selectedOption.data('empid');
|
||||
var empName = selectedOption.data('empname');
|
||||
var policyNo = selectedOption.data('policyno');
|
||||
var tpaNo = selectedOption.data('tpano');
|
||||
var relationship = selectedOption.data('relationship');
|
||||
|
||||
$('#tpa_no').val(tpaNo);
|
||||
$('#insured_emp_id').val(empId);
|
||||
$('#insured_name').val(empName);
|
||||
$('#policy_no').val(policyNo);
|
||||
|
||||
$('#relationship option').each(function() {
|
||||
if ($(this).text() === relationship) {
|
||||
$(this).prop('selected', true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -1,8 +1,8 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="<?= isset($ticket_form) ? "card" : "" ?>" style="margin-right: 23px;">
|
||||
<div class="<?= !isset($ticket_data) ? "card" : "" ?>" style="margin-right: 23px;">
|
||||
<div class="card-body">
|
||||
<?php if(isset($ticket_form)){ ?>
|
||||
<?php if(!isset($ticket_data)){ ?>
|
||||
<!-- Header Section -->
|
||||
<div class="row mb-3">
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
@ -15,9 +15,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<form role="form" class="parsley-examples" method="post" id="ticket_form_gmc" enctype="multipart/form-data">
|
||||
<form role="form" class="parsley-examples" method="post" id="ticket_form_gmc" onsubmit="submitClaimForm(event, this)" enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" id="ticket_type_id" name="ticket_type_id" value="1">
|
||||
<input type="hidden" id="ticket_master_id" name="ticket_master_id" value="<?= isset($ticket_data['id']) ? $ticket_data['id'] : '' ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
@ -25,11 +26,12 @@
|
||||
<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>
|
||||
<!-- <option value="0">Select status</option> -->
|
||||
<?php
|
||||
if (isset($claim_status) && count($claim_status)) {
|
||||
foreach ($claim_status as $key => $value) {
|
||||
echo "<option value=" . $value['id'] . ">" . $value['claim_status'] . "</option>";
|
||||
$selected = (isset($ticket_data) && $ticket_data['claim_status_id'] == $value['id']) ? 'selected' : '';
|
||||
echo "<option value=" . $value['id'] . " $selected>" . $value['claim_status'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -39,11 +41,12 @@
|
||||
<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">
|
||||
<option value="0">Select Priority</option>
|
||||
<!-- <option value="0">Select Priority</option> -->
|
||||
<?php
|
||||
if (isset($priorityType) && count($priorityType)) {
|
||||
foreach ($priorityType as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
$selected = (isset($ticket_data) && $ticket_data['priority'] == $key) ? 'selected' : '';
|
||||
echo "<option value=" . $key . " $selected>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -53,11 +56,12 @@
|
||||
<div class="form-group col-md-3">
|
||||
<label for="acm_id">Account Manager<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="acm_id" name="acm_id">
|
||||
<option value="0">Select Account Manager</option>
|
||||
<!-- <option value="0">Select Account Manager</option> -->
|
||||
<?php
|
||||
if (isset($acms) && count($acms)) {
|
||||
foreach ($acms as $key => $value) {
|
||||
echo "<option value=" . $value['id'] . ">" . $value['first_name'] . "</option>";
|
||||
$selected = (isset($ticket_data) && $ticket_data['acm_id'] == $value['id']) ? 'selected' : '';
|
||||
echo "<option value=" . $value['id'] . " $selected >" . $value['first_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -67,26 +71,26 @@
|
||||
<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($client['client_name']) ? $client['client_name'] : '' ?>"
|
||||
name="policy_no" placeholder="Policy Number" readonly>
|
||||
value="<?= isset($ticket_data['policy_no']) ? $ticket_data['policy_no'] : '' ?>"
|
||||
name="policy_no" placeholder="Policy Number" >
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="insurer_id">Insurer<span class="text-danger"></span></label>
|
||||
<input type=hidden id="insurer_id" name="insurer_id">
|
||||
<input type=text class="form-control" id="insurer_name" placeholder="Insurer" readonly>
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="tpa_id">TPA<span class="text-danger"></span></label>
|
||||
<input type=hidden id="tpa_id" name="tpa_id">
|
||||
<input type=text class="form-control" id="tpa_name" placeholder="TPA" readonly>
|
||||
<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="client_name">Corporate Name<span class="text-danger"></span></label>
|
||||
<input type="hidden" id="client_id" name="client_id">
|
||||
<input type="text" class="form-control" id="client_name" placeholder="Client" readonly>
|
||||
<input type="hidden" id="client_id" name="client_id" value="<?= isset($ticket_data['client_id']) ? $ticket_data['client_id'] : '' ?>">
|
||||
<input type="text" class="form-control" id="client_name" placeholder="Client" value="<?= isset($ticket_data['client_name']) ? $ticket_data['client_name'] : '' ?>" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
@ -94,29 +98,29 @@
|
||||
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($client['client_name']) ? $client['client_name'] : '' ?>"
|
||||
value="<?= isset($ticket_data['emp_code']) ? $ticket_data['emp_code'] : '' ?>"
|
||||
name="emp_code">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<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($client['short_name']) ? $client['short_name'] : '' ?>"
|
||||
value="<?= isset($ticket_data['tpa_no']) ? $ticket_data['tpa_no'] : '' ?>"
|
||||
name="tpa_no">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_name">Employee Name<span class="text-danger"></span></label>
|
||||
<input type=hidden id="emp_id" name="emp_id">
|
||||
<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($client['short_name']) ? $client['short_name'] : '' ?>"
|
||||
value="<?= isset($ticket_data['emp_name']) ? $ticket_data['emp_name'] : '' ?>"
|
||||
name="emp_name">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="insured_name"> Insured Name <span class="text-danger"></span></label>
|
||||
<input type=hidden id="insured_emp_id" name="insured_emp_id">
|
||||
<input class="form-control" id="insured_name" name="insured_name">
|
||||
<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'] : '' ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
@ -126,7 +130,8 @@
|
||||
<?php
|
||||
if (isset($relationshipType) && count($relationshipType)) {
|
||||
foreach ($relationshipType as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
$selected = (isset($ticket_data) && $ticket_data['relationship'] == $key) ? 'selected' : '';
|
||||
echo "<option value='$key' $selected>$value</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -134,16 +139,16 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_name">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($client['client_name']) ? $client['client_name'] : '' ?>"
|
||||
value="<?= isset($ticket_data['emp_mobile']) ? $ticket_data['emp_mobile'] : '' ?>"
|
||||
name="emp_mobile">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_mail">Employee Mail ID<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="emp_mail" placeholder="Enter EMP Mail"
|
||||
value="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>"
|
||||
value="<?= isset($ticket_data['emp_mail']) ? $ticket_data['emp_mail'] : '' ?>"
|
||||
name="emp_mail">
|
||||
</div>
|
||||
|
||||
@ -151,11 +156,12 @@
|
||||
<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">
|
||||
<option value="0">Select Mode</option>
|
||||
<!-- <option value="0">Select Mode</option> -->
|
||||
<?php
|
||||
if (isset($modeOFIntimate) && count($modeOFIntimate)) {
|
||||
foreach ($modeOFIntimate as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
$selected = (isset($ticket_data) && $ticket_data['mode_of_intimation'] == $key) ? 'selected' : '';
|
||||
echo "<option value='" . $key . "' $selected>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -165,11 +171,12 @@
|
||||
<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>
|
||||
<!-- <option value="0">Select claim Type</option> -->
|
||||
<?php
|
||||
if (isset($modeOFIntimate) && count($modeOFIntimate)) {
|
||||
foreach ($modeOFIntimate as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
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>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -180,42 +187,42 @@
|
||||
<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($client['short_name']) ? $client['short_name'] : '' ?>"
|
||||
value="<?= isset($ticket_data['hospital_name']) ? $ticket_data['hospital_name'] : '' ?>"
|
||||
name="hospital_name">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="doa">DOA<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="doa" placeholder="Enter DOA"
|
||||
value="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>"
|
||||
value="<?= isset($ticket_data['doa']) ? $ticket_data['doa'] : '' ?>"
|
||||
name="doa">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="dod">DOD<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="dod" placeholder="Enter DOD"
|
||||
value="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>" name="dod">
|
||||
value="<?= isset($ticket_data['dod']) ? $ticket_data['dod'] : '' ?>" name="dod">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<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($client['short_name']) ? $client['short_name'] : '' ?>"
|
||||
value="<?= isset($ticket_data['claim_amount']) ? $ticket_data['claim_amount'] : '' ?>"
|
||||
name="claim_amount">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="pod_no">POD No<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="pod_no" placeholder="Enter POD NO"
|
||||
value="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>"
|
||||
value="<?= isset($ticket_data['pod_no']) ? $ticket_data['pod_no'] : '' ?>"
|
||||
name="pod_no">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;">
|
||||
<a href="#" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit" onclick="claimFormSubmit('ticket_form_gmc')">Submit</a>
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit" >Submit</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -8,9 +8,9 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="<?= isset($ticket_form) ? "card" : "" ?>" style="margin-right: 23px;">
|
||||
<div class="<?= !isset($ticket_data) ? "card" : "" ?>" style="margin-right: 23px;">
|
||||
<div class="card-body">
|
||||
<?php if(isset($ticket_form)){ ?>
|
||||
<?php if(!isset($ticket_data)){ ?>
|
||||
<!-- Header Section -->
|
||||
<div class="row mb-3">
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
@ -23,19 +23,22 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<form role="form" class="parsley-examples" method="post" id="ticket_form_gmc"
|
||||
<form role="form" class="parsley-examples" method="post" id="ticket_form_gmc" onsubmit="submitClaimForm(event, this)"
|
||||
enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<input type="hidden" id="ticket_master_id" name="ticket_master_id" value="<?= isset($ticket_data['id']) ? $ticket_data['id'] : '' ?>">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="claim_status">Status<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="claim_status" name="claim_status">
|
||||
<option value="0">Select status</option>
|
||||
<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) {
|
||||
echo "<option value=" . $value['id'] . ">" . $value['status'] . "</option>";
|
||||
$selected = (isset($ticket_data) && $ticket_data['claim_status_id'] == $value['id']) ? 'selected' : '';
|
||||
echo "<option value=" . $value['id'] . " $selected>" . $value['claim_status'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -45,11 +48,12 @@
|
||||
<div class="form-group col-md-3">
|
||||
<label for="acm_id">Account Manager<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="acm_id" name="acm_id">
|
||||
<option value="0">Select Account Manager</option>
|
||||
<!-- <option value="0">Select Account Manager</option> -->
|
||||
<?php
|
||||
if (isset($claim_status) && count($claim_status)) {
|
||||
foreach ($claim_status as $key => $value) {
|
||||
echo "<option value=" . $value['id'] . ">" . $value['status'] . "</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>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -58,37 +62,21 @@
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_name">Corporate Name<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="0">Select Corporate</option>
|
||||
<?php
|
||||
if (isset($claim_status) && count($claim_status)) {
|
||||
foreach ($claim_status as $key => $value) {
|
||||
echo "<option value=" . $value['id'] . ">" . $value['client_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<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'] : '' ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="acm_id">Insurer<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="insurer_id" name="insurer_id">
|
||||
<option value="0">Select insurer</option>
|
||||
<?php
|
||||
if (isset($claim_status) && count($claim_status)) {
|
||||
foreach ($claim_status as $key => $value) {
|
||||
echo "<option value=" . $value['id'] . ">" . $value['status'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<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'] : '' ?>">
|
||||
</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($client['client_name']) ? $client['client_name'] : '' ?>"
|
||||
name="policy_no">
|
||||
value="<?= isset($ticket_data['policy_no']) ? $ticket_data['policy_no'] : '' ?>"
|
||||
name="policy_no" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
@ -98,7 +86,8 @@
|
||||
if (isset($ticket_type) && count($ticket_type)) {
|
||||
foreach ($ticket_type as $key => $value) {
|
||||
if($key != 1){
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
$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>";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -107,13 +96,14 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="ticket_type"> Claim Type <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="ticket_type" name="ticket_type">
|
||||
<option value="0">Select claim Type</option>
|
||||
<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($ticket_type) && count($ticket_type)) {
|
||||
foreach ($ticket_type as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
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>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -121,17 +111,19 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_code">Employee ID<span class="text-danger"></span></label>
|
||||
<label for="emp_code">Employee ID <i class="fa fa-search text-danger"
|
||||
aria-hidden="true" onclick="openFetchEmpDataodal(this)"></i> <span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="emp_code" placeholder="Enter Employee ID"
|
||||
value="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>"
|
||||
value="<?= isset($ticket_data['emp_code']) ? $ticket_data['emp_code'] : '' ?>"
|
||||
name="emp_code">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_name">Employee Name<span class="text-danger"></span></label>
|
||||
<input type=hidden id="emp_id" name="emp_id" value="<?= isset($ticket_data['emp_id']) ? $ticket_data['emp_id'] : '' ?>">
|
||||
<input type="text" class="form-control" id="emp_name" placeholder="Enter Employee Name"
|
||||
value="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>"
|
||||
value="<?= isset($ticket_data['emp_name']) ? $ticket_data['emp_name'] : '' ?>"
|
||||
name="emp_name">
|
||||
</div>
|
||||
|
||||
@ -140,7 +132,7 @@
|
||||
<label for="date_of_join">Date of joining<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="date_of_join"
|
||||
placeholder="Enter Joining Date"
|
||||
value="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>"
|
||||
value="<?= isset($ticket_data['date_of_join']) ? $ticket_data['date_of_join'] : '' ?>"
|
||||
name="date_of_join">
|
||||
</div>
|
||||
|
||||
@ -148,21 +140,21 @@
|
||||
<label for="date_of_incep">Date of Inception<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="date_of_incep"
|
||||
placeholder="Enter Inception Date"
|
||||
value="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>"
|
||||
value="<?= isset($ticket_data['date_of_incep']) ? $ticket_data['date_of_incep'] : '' ?>"
|
||||
name="date_of_incep">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<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($client['short_name']) ? $client['short_name'] : '' ?>" name="dob">
|
||||
value="<?= isset($ticket_data['dob']) ? $ticket_data['dob'] : '' ?>" name="dob">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<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($client['client_name']) ? $client['client_name'] : '' ?>"
|
||||
value="<?= isset($ticket_data['date_of_accident']) ? $ticket_data['date_of_accident'] : '' ?>"
|
||||
name="date_of_accident">
|
||||
</div>
|
||||
|
||||
@ -170,7 +162,7 @@
|
||||
<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($client['short_name']) ? $client['short_name'] : '' ?>"
|
||||
value="<?= isset($ticket_data['date_of_death']) ? $ticket_data['date_of_death'] : '' ?>"
|
||||
name="date_of_death">
|
||||
</div>
|
||||
|
||||
@ -178,14 +170,14 @@
|
||||
<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($client['short_name']) ? $client['short_name'] : '' ?>"
|
||||
value="<?= isset($ticket_data['date_of_intimat']) ? $ticket_data['date_of_intimat'] : '' ?>"
|
||||
name="date_of_intimat">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<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($client['short_name']) ? $client['short_name'] : '' ?>"
|
||||
value="<?= isset($ticket_data['si_amt']) ? $ticket_data['si_amt'] : '' ?>"
|
||||
name="si_amt">
|
||||
</div>
|
||||
|
||||
@ -199,4 +191,39 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(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
|
||||
});
|
||||
})
|
||||
</script>
|
||||
@ -43,11 +43,12 @@
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
if ($ticket_form == 1) {
|
||||
include('ticket_form_gmc.php');
|
||||
} else {
|
||||
include('ticket_form_gpa.php');
|
||||
if(!isset($view_ticket_page)){
|
||||
if ($selected_ticket_type == 1) {
|
||||
include('ticket_form_gmc.php');
|
||||
} else {
|
||||
include('ticket_form_gpa.php');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -58,7 +59,8 @@ if ($ticket_form == 1) {
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="empDetailsModalLabel">Fetch Employee Data</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"
|
||||
onclick="toResetTheModelFields()">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
@ -73,123 +75,129 @@ if ($ticket_form == 1) {
|
||||
<div class="accordion-content" id="mobileAccordion">
|
||||
<div id="mobileSearch" class="search-method">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
|
||||
<div class="col-md-5" style="display:true;">
|
||||
<div class="form-group">
|
||||
<label>Employee Mobile Number</label>
|
||||
<input class="form-control" type="text" id="mobile_number"
|
||||
name="mobile_numbers" onkeypress="return onlyNumbers(event)">
|
||||
<label>Employee Data Points</label>
|
||||
<select name="employee_data_points" id="employee_data_points"
|
||||
class="form-control">
|
||||
<option value="mobile">Employee Mobile Number</option>
|
||||
<option value="emp_code">Employee ID</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-5">
|
||||
<div class="form-group">
|
||||
<label id="employee_data_points_label">Employee Mobile Number</label>
|
||||
<input class="form-control" type="text" id="emp_mobile_number_for_claim"
|
||||
name="mobile_numbers" onkeypress="return onlyNumbers(event)"
|
||||
maxlength="10">
|
||||
</div>
|
||||
<div class="text-danger" id="error_dis"></div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-2">
|
||||
<div class="form-group" style="margin-top: 9px;">
|
||||
<br>
|
||||
<button class="btn btn-primary"
|
||||
onclick="searchMobileNumber($('#mobile_number').val())">Search</button>
|
||||
onclick="getTheEmpDataForClaimSearchByMobile(this)">Search</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="emp_member_policy_div" style="display:none;">
|
||||
<div id="emp_member_policy_div" style="display:true;">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-5" style="display:none;">
|
||||
<div class="form-group">
|
||||
<label>Employee</label>
|
||||
<select name="employee_by_number" id="employee_by_number"
|
||||
class="form-control SelExample" onchange="get_member_by_employee(this)">
|
||||
class="form-control SelExample">
|
||||
<option value="0">Select Employee</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-5">
|
||||
<div class="form-group">
|
||||
<label>Member List</label>
|
||||
<select name="member_by_number" id="member_by_number"
|
||||
class="form-control SelExample"
|
||||
onchange="get_emp_policy(this), setMemberDetails(this)">
|
||||
<label>Insured List</label>
|
||||
<select name="employee_by_number" id="member_by_number"
|
||||
class="form-control SelExample" onchange="setMemberData(this)">
|
||||
<option value="0">Select Member</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label>Policy</label>
|
||||
<select id="policy_by_number" name="policy_by_number"
|
||||
class="form-control custom-select">
|
||||
<option value="">Select Policy</option>
|
||||
</select>
|
||||
<input type="text" id="policy_name" name="policy_name" hidden>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Search by Client, Branch, and Policy -->
|
||||
<div class="mt-4">
|
||||
<h4 onclick="toggleAccordion('clientBranchAccordion')">
|
||||
Search by Client, Branch, and Policy
|
||||
<span class="arrow" id="clientBranchArrow">➤</span>
|
||||
</h4>
|
||||
<div class="accordion-content" id="clientBranchAccordion">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label>Client</label>
|
||||
<select id="emp_client_data_list" name="client"
|
||||
class="form-control custom-select" onchange="get_branch_list(this)">
|
||||
<option value="">Select Client</option>
|
||||
</select>
|
||||
<!-- Search by Client, Branch, and Policy -->
|
||||
<div class="mt-4">
|
||||
<h4 onclick="toggleAccordion('clientBranchAccordion')">
|
||||
Search by Client, Branch, and Policy
|
||||
<span class="arrow" id="clientBranchArrow">➤</span>
|
||||
</h4>
|
||||
<div class="accordion-content" id="clientBranchAccordion">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Client</label>
|
||||
<select id="emp_client_data_list" name="client"
|
||||
class="form-control custom-select">
|
||||
<option value="0">Select Client</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Branch</label>
|
||||
<select id="emp_client_branch_data_list" name="branch"
|
||||
class="form-control custom-select">
|
||||
<option value="0">Select Branch</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Policy</label>
|
||||
<select id="emp_client_policy_data_list" name="policy_client_branch"
|
||||
class="form-control custom-select" onchange="getEmpData(this)">
|
||||
<option value="0">Select Policy</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label>Branch</label>
|
||||
<select id="branch" name="branch" class="form-control custom-select"
|
||||
onchange="get_policies_list(this)">
|
||||
<option value="">Select Branch</option>
|
||||
</select>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Employee</label>
|
||||
<select name="search_by_client_employee" id="search_by_client_employee"
|
||||
class="form-control SelExample"
|
||||
onchange="getTheEmpDataForClaimSearchByMobile(this, 'client')">
|
||||
<option value="0">Select Employee</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label>Policy</label>
|
||||
<select id="policy_client_branch" name="policy_client_branch"
|
||||
class="form-control custom-select" onchange="get_employee_list(this)">
|
||||
<option value="">Select Policy</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Employee</label>
|
||||
<select name="employee" id="employee" class="form-control SelExample"
|
||||
onchange="check_policy_gpa_gmc(this)">
|
||||
<option value="0">Select Employee</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label>Insured List</label>
|
||||
<select name="member" id="member" class="form-control SelExample"
|
||||
onchange="member_change_client_branch(this), setMemberDetails(this)">
|
||||
<option value="0">Select Member</option>
|
||||
</select>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Insured List</label>
|
||||
<select name="member" id="search_by_client_member"
|
||||
class="form-control SelExample" onchange="setMemberData(this)">
|
||||
<option value="0">Select Member</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a class="btn btn-primary close" data-dismiss="modal" aria-label="Close"
|
||||
onclick="toResetTheModelFields()">Submit</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Submit</button>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -200,7 +208,49 @@ var branch_list = ''; // local variable for storing the client branch list
|
||||
var policy_list = ''; // local variable for storing the client policy list
|
||||
|
||||
$(document).ready(function() {
|
||||
getClientAndBranchAndPolicy()
|
||||
getClientAndBranchAndPolicy();
|
||||
$('#emp_client_data_list').select2();
|
||||
$('#emp_client_branch_data_list').select2();
|
||||
$('#emp_client_policy_data_list').select2();
|
||||
$('#search_by_client_member').select2();
|
||||
$('#search_by_client_employee').select2();
|
||||
$('#employee_by_number').select2();
|
||||
$('#member_by_number').select2();
|
||||
})
|
||||
|
||||
//on change functions
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#emp_client_data_list').change(function() {
|
||||
|
||||
let client_id = $(this).val();
|
||||
let client_name = $('#emp_client_data_list option:selected').data('name');
|
||||
|
||||
console.log('client_id', client_id);
|
||||
console.log('client_name', client_name);
|
||||
|
||||
if (branch_list != '') {
|
||||
// console.log(branch_list[client_id]);
|
||||
let data = branch_list[client_id];
|
||||
appendBranch(data);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$('#emp_client_branch_data_list').change(function() {
|
||||
|
||||
let branch_id = $(this).val();
|
||||
|
||||
console.log('branch_id', branch_id);
|
||||
|
||||
if (policy_list != '') {
|
||||
// console.log(branch_list[client_id]);
|
||||
let data = policy_list[branch_id];
|
||||
appendPolicy(data);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
function toggleAccordion(id) {
|
||||
@ -222,6 +272,7 @@ function openFetchEmpDataodal() {
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
//get client , branch, policy data
|
||||
function getClientAndBranchAndPolicy() {
|
||||
$.ajax({
|
||||
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
|
||||
@ -247,11 +298,12 @@ function getClientAndBranchAndPolicy() {
|
||||
});
|
||||
}
|
||||
|
||||
//append the clients data to the modal
|
||||
function appendClients(data) {
|
||||
$('#emp_client_data_list').empty();
|
||||
|
||||
$('#emp_client_data_list').append($('<option>', {
|
||||
value: '',
|
||||
value: '0',
|
||||
text: 'Select Client'
|
||||
}));
|
||||
|
||||
@ -262,43 +314,365 @@ function appendClients(data) {
|
||||
'data-name': item.client_name,
|
||||
});
|
||||
|
||||
$('#emp_client_data_list').append(option);
|
||||
$('#emp_client_data_list').append(option).select2();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//append the clients branch data to the modal
|
||||
function appendBranch(data) {
|
||||
$('#emp_client_branch_data_list').empty();
|
||||
|
||||
function claimFormSubmit($form_id) {
|
||||
$('#emp_client_branch_data_list').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select Branch'
|
||||
}));
|
||||
|
||||
console.log('claimFormSubmit function called')
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.branch_name,
|
||||
'data-name': item.branch_name,
|
||||
});
|
||||
|
||||
console.log('$form_id ', $form_id)
|
||||
$('#emp_client_branch_data_list').append(option).select2();
|
||||
});
|
||||
|
||||
let url = '<?= base_url('/ticket/create') ?>';
|
||||
console.log('url ', url)
|
||||
}
|
||||
|
||||
//append the clients policy data to the modal
|
||||
function appendPolicy(data) {
|
||||
|
||||
$('#emp_client_policy_data_list').empty();
|
||||
|
||||
$('#emp_client_policy_data_list').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select Policy'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.policy_type + '-' + item.policy_no,
|
||||
});
|
||||
|
||||
$('#emp_client_policy_data_list').append(option).select2();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function submitClaimForm(event, form) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
const formAction = '<?= isset($view_ticket_page) ? base_url("ticket/update") : base_url("ticket/create"); ?>';
|
||||
|
||||
// Show loader
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
// Collect IDs and form data
|
||||
const formData = new FormData(form);
|
||||
|
||||
// AJAX request
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: formAction,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(response) {
|
||||
// Hide loader
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
console.log('Form submitted response:', response);
|
||||
|
||||
if (response.status === true) {
|
||||
toastr.success(response.message, 'SUCCESS');
|
||||
} else {
|
||||
toastr.error(response.message, 'ERROR');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
// Hide loader
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getEmpData(input) {
|
||||
|
||||
console.log(input)
|
||||
let param = $(input).val();
|
||||
let url = '<?= base_url('util/getTheEmpDataForClaim/') ?>' + param;
|
||||
|
||||
// Data to send in the AJAX request
|
||||
var formData = new FormData($('#'+$form_id)[0]);
|
||||
console.log('formData ', formData)
|
||||
let requestData = {
|
||||
param: param,
|
||||
};
|
||||
|
||||
// Show loader
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
// Send AJAX request
|
||||
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
|
||||
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
||||
console.log('Data fetched successfully:', response);
|
||||
|
||||
console.log('Form submitted response:', response);
|
||||
|
||||
if (response.status == true) {
|
||||
toastr.success(response.message, 'SUCCESS');
|
||||
if (response.status) {
|
||||
console.log(response.message, 'SUCCESS');
|
||||
appendEmployee(response.data, 'search_by_client_employee');
|
||||
} else {
|
||||
toastr.error(response.message, 'ERROR');
|
||||
toastr.warning(response.message, 'WARNING');
|
||||
}
|
||||
|
||||
// Hide loader
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
toastr.error('An error occurred while form submiting.', 'ERROR');
|
||||
toastr.error('An error occurred while fetch data.', 'ERROR');
|
||||
|
||||
// Hide loader
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
});
|
||||
}
|
||||
|
||||
function getTheEmpDataForClaimSearchByMobile(input, searchType = null) {
|
||||
|
||||
console.log(input)
|
||||
let type = $('#employee_data_points').val()
|
||||
let param = $('#emp_mobile_number_for_claim').val()
|
||||
|
||||
if (searchType == 'client') {
|
||||
type = 'emp_code';
|
||||
param = $(input).val();
|
||||
}
|
||||
let url = '<?= base_url('util/getTheEmpDataForClaimSearchByMobile/') ?>' + param + '/' + type;
|
||||
|
||||
// Data to send in the AJAX request
|
||||
let requestData = {
|
||||
param: param,
|
||||
type: type,
|
||||
};
|
||||
|
||||
// Show loader
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
|
||||
// Send AJAX request
|
||||
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
||||
console.log('Data fetched successfully:', response);
|
||||
|
||||
if (response.status) {
|
||||
console.log(response.message, 'SUCCESS');
|
||||
if (searchType == 'client') {
|
||||
appendMember(response.memberData, 'search_by_client_member');
|
||||
} else {
|
||||
appendMember(response.memberData, 'member_by_number');
|
||||
}
|
||||
setClientAndInsurerData(response.data);
|
||||
appendACMS(response.acms)
|
||||
|
||||
} else {
|
||||
toastr.warning(response.message, 'WARNING');
|
||||
appendACMS(response.acms);
|
||||
unSetClientAndInsurerData()
|
||||
}
|
||||
|
||||
// Hide loader
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
toastr.error('An error occurred while fetch data.', 'ERROR');
|
||||
|
||||
// Hide loader
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
});
|
||||
}
|
||||
|
||||
function appendEmployee(data, attrId) {
|
||||
|
||||
console.log('data', data)
|
||||
|
||||
$('#' + attrId).empty();
|
||||
$('#' + attrId).append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select Employee'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
console.log(item)
|
||||
var option = $('<option>', {
|
||||
value: item.emp_code,
|
||||
text: item.emp_name,
|
||||
});
|
||||
|
||||
$('#' + attrId).append(option).select2();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function appendMember(data, attrId) {
|
||||
|
||||
console.log('data', data);
|
||||
|
||||
// Clear the existing options
|
||||
$('#' + attrId).empty();
|
||||
|
||||
// Add the default 'Select Member' option
|
||||
$('#' + attrId).append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select Member'
|
||||
}));
|
||||
|
||||
// Append options dynamically with data attributes
|
||||
$.each(data, function(index, item) {
|
||||
console.log('Item:', item); // Log each item to debug
|
||||
|
||||
// Ensure all properties exist, set fallback if necessary
|
||||
var empID = item.emp_id ?? '';
|
||||
var empName = item.emp_name ?? '';
|
||||
var policyNo = item.policy_no ?? '';
|
||||
var tpaNo = item.tpa_no ?? '';
|
||||
var relationship = item.emp_relationship ?? '';
|
||||
|
||||
// Create an option and set data attributes
|
||||
var option = $('<option>', {
|
||||
value: item.emp_code,
|
||||
text: empName + " - " + relationship
|
||||
}).attr({
|
||||
'data-empID': empID,
|
||||
'data-empName': empName,
|
||||
'data-policyNo': policyNo,
|
||||
'data-tpaNo': tpaNo,
|
||||
'data-relationship': relationship
|
||||
});
|
||||
|
||||
$('#' + attrId).append(option);
|
||||
});
|
||||
|
||||
// Reinitialize select2
|
||||
$('#' + attrId).select2();
|
||||
}
|
||||
|
||||
function appendACMS(data) {
|
||||
|
||||
console.log(data);
|
||||
|
||||
$('#acm_id').empty();
|
||||
|
||||
// $('#acm_id').append($('<option>', {
|
||||
// value: '0',
|
||||
// text: 'Select Account Manager'
|
||||
// }));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.first_name,
|
||||
});
|
||||
|
||||
$('#acm_id').append(option);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function onlyNumbers(event) {
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function setClientAndInsurerData(data) {
|
||||
|
||||
$('#insurer_id').val(data.insurer_id);
|
||||
$('#insurer_name').val(data.insurer_name);
|
||||
$('#tpa_id').val(data.tpa_id);
|
||||
$('#tpa_name').val(data.tpa_name);
|
||||
$('#client_id').val(data.client_id);
|
||||
$('#client_name').val(data.client_name);
|
||||
|
||||
$('#emp_code').val(data.emp_code);
|
||||
$('#emp_id').val(data.emp_id);
|
||||
$('#emp_name').val(data.emp_name);
|
||||
$('#emp_mobile').val(data.emp_mobile);
|
||||
$('#emp_mail').val(data.emp_email);
|
||||
}
|
||||
|
||||
function unSetClientAndInsurerData() {
|
||||
|
||||
$('#insurer_id').val("");
|
||||
$('#insurer_name').val("");
|
||||
$('#tpa_id').val("");
|
||||
$('#tpa_name').val("");
|
||||
$('#client_id').val("");
|
||||
$('#client_name').val("");
|
||||
|
||||
$('#emp_code').val("");
|
||||
$('#emp_id').val("");
|
||||
$('#emp_name').val("");
|
||||
$('#emp_mobile').val("");
|
||||
$('#emp_mail').val("");
|
||||
}
|
||||
|
||||
function setMemberData(input) {
|
||||
|
||||
var selectedOption = $(input).find(':selected');
|
||||
|
||||
// Retrieve the data-* attributes
|
||||
var empId = selectedOption.data('empid');
|
||||
var empName = selectedOption.data('empname');
|
||||
var policyNo = selectedOption.data('policyno');
|
||||
var tpaNo = selectedOption.data('tpano');
|
||||
var relationship = selectedOption.data('relationship');
|
||||
|
||||
$('#tpa_no').val(tpaNo);
|
||||
$('#insured_emp_id').val(empId);
|
||||
$('#insured_name').val(empName);
|
||||
$('#policy_no').val(policyNo);
|
||||
|
||||
$('#relationship option').each(function() {
|
||||
if ($(this).text() === relationship) {
|
||||
$(this).prop('selected', true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#employee_data_points').on('change', function() {
|
||||
|
||||
let value = $(this).val()
|
||||
if (value == "mobile") {
|
||||
$('#employee_data_points_label').text('Employee Mobile Number')
|
||||
} else {
|
||||
$('#employee_data_points_label').text('Employee ID')
|
||||
}
|
||||
})
|
||||
|
||||
function toResetTheModelFields() {
|
||||
|
||||
$('#emp_mobile_number_for_claim').val('');
|
||||
$('#employee_data_points').val();
|
||||
$('#employee_by_number').val('');
|
||||
$('#member_by_number').val('0').select2();
|
||||
$('#emp_client_data_list').val('0').select2();
|
||||
$('#emp_client_branch_data_list').val('0').select2();
|
||||
$('#emp_client_policy_data_list').val('0').select2();
|
||||
$('#search_by_client_employee').val('0').select2();
|
||||
$('#search_by_client_member').val('0').select2();
|
||||
}
|
||||
</script>
|
||||
@ -2,12 +2,13 @@
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Old Value</th>
|
||||
<th>New Value</th>
|
||||
<!-- <th>Old Value</th>
|
||||
<th>New Value</th> -->
|
||||
<th>Change</th>
|
||||
<th>User</th>
|
||||
<th>Date/Time</th>
|
||||
</tr>
|
||||
@ -16,12 +17,11 @@
|
||||
<?php if (isset($ticket_history)) { ?>
|
||||
<?php foreach($ticket_history as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?php echo $row['status']; ?></td>
|
||||
<td><?php echo $row['claim_no']; ?></td>
|
||||
<td><?php echo $row['tpa_id']; ?></td>
|
||||
<td><?php echo $row['emp_name']; ?></td>
|
||||
<td><?php echo $row['insurer_name']; ?></td>
|
||||
<td><?php echo $row['client_name']; ?></td>
|
||||
<td><?php echo $row['display_name']; ?></td>
|
||||
<td><?php echo $row['old_value'].' => '.$row['new_value']; ?></td>
|
||||
<!-- <td><?php //echo $row['new_value']; ?></td> -->
|
||||
<td><?php echo $row['modified_by']; ?></td>
|
||||
<td><?php echo $row['created_at']; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
@ -31,3 +31,43 @@
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||
|
||||
if (ticketsTable.length) {
|
||||
ticketsTable.DataTable({
|
||||
// scrollX: true,
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
// buttons: [{
|
||||
// extend: 'csv',
|
||||
// text: 'CSV',
|
||||
// title: 'Ticket_History',
|
||||
// },
|
||||
// {
|
||||
// extend: 'excel',
|
||||
// text: 'Excel',
|
||||
// title: 'Ticket_History',
|
||||
// exportOptions: {
|
||||
// orthogonal: 'sort'
|
||||
// },
|
||||
// }
|
||||
|
||||
// ],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 10, // Set default number of rows per page (optional)
|
||||
ordering: false,
|
||||
});
|
||||
} else {
|
||||
console.error("Table atet found.");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -24,6 +24,33 @@ table.dataTable tbody td {
|
||||
.addbtnStyle {
|
||||
margin-left: 20px !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: #ffffff !important;
|
||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.5rem 0;
|
||||
min-width: 10rem;
|
||||
z-index: 9999;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item {
|
||||
display: block !important;
|
||||
width: 100% !important;
|
||||
padding: 0.5rem 1rem !important;
|
||||
color: #212529 !important;
|
||||
text-decoration: none !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item:hover {
|
||||
background-color: #f8f9fa !important;
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="col-12">
|
||||
@ -40,17 +67,34 @@ table.dataTable tbody td {
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>Template Name</th>
|
||||
<th>Status</th>
|
||||
<th>Policy Type</th>
|
||||
<th>Trigger Type</th>
|
||||
<th>Mail Send Type</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (isset($ticket_data)) { ?>
|
||||
<?php foreach($ticket_data as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?php echo $row['status']; ?></td>
|
||||
<td><?php echo $row['claim_no']; ?></td>
|
||||
<td><?php echo $row['tpa_id']; ?></td>
|
||||
<td><?php echo $row['template_name']; ?></td>
|
||||
<td><?php echo $ticket_type[$row['ticket_type']]; ?></td>
|
||||
<td><?php echo $trigger_type[$row['trigger_type']]; ?></td>
|
||||
<td><?=$row['is_auto_mail'] == 1?'Auto':"Manual" ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);"
|
||||
class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"
|
||||
aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="#"
|
||||
onclick="getMailTemplateData(<?=$row['id']?>)"><i
|
||||
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" onclick="deleteTemplate(<?=$row['id']?>)"><i
|
||||
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
@ -74,56 +118,95 @@ table.dataTable tbody td {
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="text-center" id="no_data"></div>
|
||||
<form role="form" class="parsley-examples" method="post" id="account_maneger_summary_mail_form"
|
||||
enctype="multipart/form-data">
|
||||
<form role="form" class="parsley-examples" method="post" id="ticket_mail_editor_modal"
|
||||
enctype="multipart/form-data" novalidate>
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="emp_code">Template Name</label>
|
||||
<input type="text" id="template_name" name="template_name" value="Trigger 1" class="form-control" placeholder="Template Name">
|
||||
<input type="text" id="template_name" name="template_name" class="form-control"
|
||||
placeholder="Template Name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="emp_code">Policy Type</label>
|
||||
<select class="form-control" id="policy_type" name="policy_type">
|
||||
<option value="0">Select Policy Type</option>
|
||||
<select class="form-control" id="policy_type" name="ticket_type" required>
|
||||
<option value="">Select Policy Type</option>
|
||||
<?php
|
||||
if (isset($claim_status) && count($claim_status)) {
|
||||
foreach ($claim_status as $key => $value) {
|
||||
echo "<option value=" . $value['id'] . ">" . $value['status'] . "</option>";
|
||||
if (isset($policy_type) && count($policy_type)) {
|
||||
foreach ($policy_type as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_code">Claim Status</label>
|
||||
<select class="form-control" id="claim_status" name="claim_status">
|
||||
<option value="0">Select status</option>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="trigger_type">Trigger Type</label>
|
||||
<select class="form-control" id="trigger_type" name="trigger_type" required>
|
||||
<option value="">Select status</option>
|
||||
<?php
|
||||
if (isset($claim_status) && count($claim_status)) {
|
||||
foreach ($claim_status as $key => $value) {
|
||||
echo "<option value=" . $value['id'] . ">" . $value['status'] . "</option>";
|
||||
if (isset($trigger_type) && count($trigger_type)) {
|
||||
foreach ($trigger_type as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</select> <input id="primaryKey" type="hidden">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<div>
|
||||
<div id="statusSwitchWrapper" class="dt-switch-wrapper"
|
||||
style="padding-top: 40px;padding-left: 10px;">
|
||||
<div class="custom-control custom-switch" style="text-align: left;">
|
||||
<input type="checkbox" class="custom-control-input" id="statusSwitch">
|
||||
<label class="custom-control-label" for="statusSwitch">Auto Mail</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<hr>
|
||||
<!-- Unlayer editor -->
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<textarea class="form-control" rows="5" placeholder="Enter Mail Content"></textarea>
|
||||
<label for="template_subject">Subject</label>
|
||||
<input type="text" id="template_subject" name="subject" class="form-control"
|
||||
placeholder="Subject" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<!-- <textarea class="form-control" rows="5" placeholder="Enter Mail Content"></textarea> -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<select id="ticket_mail_customButton" class="form-control"
|
||||
style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
|
||||
<option value="">PlaceHolders</option>
|
||||
<?php foreach ($placeHolders as $key => $value): ?>
|
||||
<?php // if($value == 'member_name' || $value == 'member_mobile' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name'){ ?>member_mobile
|
||||
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
|
||||
<option value="<?php echo $key; ?>"><?php echo $valueChange; ?></option>
|
||||
</option>
|
||||
<?php //} ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ticket_mail_editor" name="content" style="height: 300px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGridSubmit_2">Submit</button>
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnGridSubmit_2">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@ -165,10 +248,360 @@ $(document).ready(function() {
|
||||
} else {
|
||||
console.error("Table atet found.");
|
||||
}
|
||||
var toolbar = "bold,italic,strikethrough,|,superscript,subscript,|,align,";
|
||||
const editorConfig = {
|
||||
buttons: toolbar.concat(['fontsize']),
|
||||
fontsize: [8, 10, 12, 14, 16, 18, 20, 22, 24], // Customize font sizes
|
||||
showPlaceholder: false,
|
||||
toolbarButtonSize: 'small',
|
||||
toolbarAdaptive: false,
|
||||
saveHeightInStorage: true,
|
||||
minHeight: 400,
|
||||
extraButtons: [{
|
||||
name: 'info',
|
||||
iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL
|
||||
exec: function(editor) {
|
||||
const fileInput = document.getElementById("Question_title_fileInput");
|
||||
fileInput.click();
|
||||
},
|
||||
}, ],
|
||||
};
|
||||
|
||||
const editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
||||
|
||||
let lastActiveField = null;
|
||||
|
||||
// Track last active input field
|
||||
$("#template_subject").on("focus", function() {
|
||||
lastActiveField = this;
|
||||
});
|
||||
|
||||
// Track Jodit editor focus separately
|
||||
editor.events.on("focus", function() {
|
||||
lastActiveField = editor;
|
||||
});
|
||||
|
||||
document.addEventListener('change', function(event) {
|
||||
var target = event.target;
|
||||
if (target.matches('#ticket_mail_customButton')) {
|
||||
let placeholderValue = $(target).val();
|
||||
if (!placeholderValue) return;
|
||||
|
||||
if (lastActiveField) {
|
||||
if (lastActiveField.id === "template_subject") {
|
||||
insertAtCursor(lastActiveField, placeholderValue);
|
||||
} else {
|
||||
editor.selection.insertHTML(placeholderValue);
|
||||
}
|
||||
}
|
||||
|
||||
$(target).val('');
|
||||
}
|
||||
});
|
||||
|
||||
function insertAtCursor(input, textToInsert) {
|
||||
if (document.selection) {
|
||||
input.focus();
|
||||
var sel = document.selection.createRange();
|
||||
sel.text = textToInsert;
|
||||
} else if (input.selectionStart || input.selectionStart === 0) {
|
||||
let startPos = input.selectionStart;
|
||||
let endPos = input.selectionEnd;
|
||||
input.value = input.value.substring(0, startPos) + textToInsert + input.value.substring(endPos,
|
||||
input.value.length);
|
||||
input.selectionStart = input.selectionEnd = startPos + textToInsert.length;
|
||||
} else {
|
||||
input.value += textToInsert;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('.close').click(function() {
|
||||
$('#template_subject').val('');
|
||||
$('#template_name').val('');
|
||||
$('#primaryKey').val('');
|
||||
$('#policy_type').val('').change();
|
||||
$('#trigger_type').val('').change();
|
||||
editor.setEditorValue('');
|
||||
$('#primaryKey').val(null);
|
||||
$('#statusSwitch').prop('checked', false);
|
||||
|
||||
})
|
||||
$('#ticket_mail_editor_modal').submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
let isValid = true;
|
||||
$('#ticket_mail_editor_modal [required]').each(function() {
|
||||
if (!this.value.trim()) {
|
||||
isValid = false;
|
||||
$(this).addClass('is-invalid'); // Add a red border for visibility
|
||||
} else {
|
||||
$(this).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
|
||||
if (!isValid) {
|
||||
toastr.error('Please fill all required fields.', 'Validation Error');
|
||||
return; // Prevent submission
|
||||
}
|
||||
var joditEditor = editor;
|
||||
if (joditEditor) {
|
||||
var mailContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
|
||||
var formData = $(this).serializeArray();
|
||||
formData.push({
|
||||
name: 'mail_content',
|
||||
value: mailContent
|
||||
});
|
||||
// formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
|
||||
var isAutoMailEnabled = $('#statusSwitch').is(':checked') ? 1 : 0;
|
||||
formData.push({
|
||||
name: 'is_auto_mail',
|
||||
value: isAutoMailEnabled
|
||||
});
|
||||
var primary_key = $('#primaryKey').val();
|
||||
if (primary_key != null && primary_key != '') {
|
||||
formData.push({
|
||||
name: 'id',
|
||||
value: primary_key
|
||||
});
|
||||
}
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var form_action = '<?= base_url("ticket/crud_mail_template/1") ?>';
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
if (res.status == true) {
|
||||
$('#new_mail_template').find('.close').click();
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Template saved successfully!', 'Success');
|
||||
location.reload();
|
||||
} else if (res.status == false) {
|
||||
toastr.error('Failed to Save Data', 'error');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.error('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error("Jodit editor instance is not defined.");
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
function openModal() {
|
||||
var myModal = new bootstrap.Modal(document.getElementById('new_mail_template'));
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
function deleteTemplate(id) {
|
||||
const url = '<?= base_url("ticket/crud_mail_template/3") ?>';
|
||||
const data = {
|
||||
id: id
|
||||
}; // Ensure data is passed as an object
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this template.",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "POST",
|
||||
data: data,
|
||||
success: function(res) {
|
||||
if (res.status === true) {
|
||||
location.reload();
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Template Deleted successfully!', 'Success');
|
||||
} else if (res.status === false) {
|
||||
toastr.error('Failed to Delete Template', 'Error');
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.error('Something went wrong!', 'Warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getMailTemplateData(id) {
|
||||
const template_name = 'new_mail_template';
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var form_action = '<?= base_url("ticket/crud_mail_template/2") ?>';
|
||||
var data = {
|
||||
id: id
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
data: data,
|
||||
success: function(res) {
|
||||
console.log('get Mail Template Data', res);
|
||||
if (res) {
|
||||
if (res.status == true) {
|
||||
// Open the modal
|
||||
openModal();
|
||||
|
||||
// Populate the form fields
|
||||
$('#template_subject').val(res.data.subject);
|
||||
$('#template_name').val(res.data.template_name);
|
||||
$('#primaryKey').val(res.data.id);
|
||||
$('#policy_type').val(res.data.ticket_type).change();
|
||||
$('#trigger_type').val(res.data.ticket_type).change();
|
||||
$('.jodit-wysiwyg').html(res.data.mail_content);
|
||||
|
||||
// Set the auto mail switch
|
||||
if (res.data.is_auto_mail == 1) {
|
||||
$('#statusSwitch').prop('checked', true);
|
||||
} else {
|
||||
$('#statusSwitch').prop('checked', false);
|
||||
}
|
||||
|
||||
// Populate any additional fields if necessary, like placeholders
|
||||
// Assuming `placeholders` is an array in the response
|
||||
if (res.placeholders) {
|
||||
res.placeholders.forEach(function(placeholder) {
|
||||
// You can populate any dropdown or field as required
|
||||
$('#ticket_mail_customButton').val(placeholder);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
toastr.error('Data Not Found', 'error');
|
||||
}
|
||||
}
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Went Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const table = document.getElementById("scroll-horizontal-datatable");
|
||||
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
// Get the original dropdown items
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
|
||||
// Create new dropdown with proper background and spacing
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
|
||||
// Copy inner content while maintaining icon alignment
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
|
||||
return customDropdown;
|
||||
}
|
||||
|
||||
let activeDropdown = null;
|
||||
|
||||
// Add click event listener to rows
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
const customDropdown = createCustomDropdown(row);
|
||||
if (!customDropdown) return;
|
||||
|
||||
document.body.appendChild(customDropdown);
|
||||
|
||||
row.addEventListener("click", function(event) {
|
||||
// Ignore clicks on the action column
|
||||
if (event.target.closest('td:last-child')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide any active dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
}
|
||||
|
||||
// Get click position
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
|
||||
// Position the dropdown with some offset
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
|
||||
// Set as active dropdown
|
||||
activeDropdown = customDropdown;
|
||||
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// Preserve click handlers and add auto-close
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
// Close the dropdown after handling the click
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener("click", function() {
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@ -7,11 +7,11 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="ticket_note">Add Notes</label>
|
||||
<textarea class="form-control" id="ticket_note" name="ticket_note" rows="3"
|
||||
placeholder="Enter Text"><?= isset($client['addon_subheading']) ? $client['addon_subheading'] : '' ?></textarea>
|
||||
<textarea class="form-control" id="ticket_note" name="note" rows="3"
|
||||
placeholder="Enter Text"><?= isset($ticket_note['note']) ? $ticket_note['note'] : '' ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><input type="hidden" id="note_id">
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary" id="ticket_note_submit">Submit</button>
|
||||
</div>
|
||||
@ -24,6 +24,28 @@
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
url = '<?= base_url('ticket/note/1')?>';
|
||||
data = { id : $('#ticket_master_id').val()};
|
||||
$.ajax({
|
||||
url:url,
|
||||
data:data,
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
if (res.status == true){
|
||||
$('#ticket_note').val(res.data.note);
|
||||
$('#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_note_form").submit(function(event) {
|
||||
|
||||
@ -31,13 +53,23 @@ $(document).ready(function() {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var url = '<?= base_url("/ticket/note"); ?>';
|
||||
var formData = new FormData($('#ticket_note_form')[0]);
|
||||
|
||||
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 = $('#note_id').val();
|
||||
if (primary_key != null && primary_key != ''){
|
||||
formData.push({ name: 'id', value: primary_key});
|
||||
}
|
||||
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');
|
||||
|
||||
|
||||
} else {
|
||||
$('.loader').fadeOut();
|
||||
|
||||
@ -7,28 +7,39 @@
|
||||
<!-- Email To Field -->
|
||||
<div class="form-group col-md-4">
|
||||
<label for="emp_mail_for_to">To</label>
|
||||
<input type="text" class="form-control" id="emp_mail_for_to" name="emp_mail_for_to" placeholder="Recipient email">
|
||||
<input type="text" value="<?= isset($reply_data['emp_mail'])?$reply_data['emp_mail']:'' ?>" class="form-control" id="emp_mail_for_to" name="emp_mail" placeholder="Recipient email" readonly>
|
||||
</div>
|
||||
|
||||
<!-- Subject Field -->
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-8">
|
||||
<label for="mail_subject">Subject</label>
|
||||
<input type="text" class="form-control" id="mail_subject" name="mail_subject" placeholder="Mail subject">
|
||||
<input type="text" class="form-control" value="<?= isset($reply_data['subject'])?$reply_data['subject']:'' ?>" id="mail_subject" name="mail_subject" placeholder="Mail subject">
|
||||
</div>
|
||||
|
||||
<!-- Mail Content Field -->
|
||||
<div class="form-group col-md-12">
|
||||
<label for="mail_content">Mail Content</label>
|
||||
<textarea class="form-control" id="mail_content" name="mail_content" rows="3" placeholder="Enter mail content">
|
||||
<?= isset($client['addon_subheading']) ? $client['addon_subheading'] : '' ?>
|
||||
</textarea>
|
||||
</div>
|
||||
<!-- <textarea class="form-control" rows="5" placeholder="Enter Mail Content"></textarea> -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<select id="ticket_mail_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
|
||||
<option value="">PlaceHolders</option>
|
||||
<?php foreach ($placeHolders as $key => $value): ?>
|
||||
<!-- <?php // if($value == 'member_name' || $value == 'member_mobile' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name'){ ?>member_mobile -->
|
||||
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
|
||||
<option value="<?php echo $key; ?>"><?php echo $valueChange; ?></option>
|
||||
<?php //} ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ticket_mail_editor" name="content" style="height: 300px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Submit Button -->
|
||||
<div class="form-group text-right">
|
||||
<button type="submit" class="btn btn-primary" id="ticket_reply_submit">Submit</button>
|
||||
<button type="submit" class="btn btn-primary" id="ticket_reply_submit">Send Mail</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -37,31 +48,138 @@
|
||||
|
||||
<script>
|
||||
$(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 editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
||||
var mail_content = `<?=isset($reply_data['mail_content'])?$reply_data['mail_content']:'' ?>`;
|
||||
$('.jodit-wysiwyg').html(mail_content);
|
||||
|
||||
let lastActiveField = null;
|
||||
|
||||
// Track last active input field
|
||||
$("#mail_subject").on("focus", function() {
|
||||
lastActiveField = this;
|
||||
});
|
||||
|
||||
// Track Jodit editor focus separately
|
||||
editor.events.on("focus", function() {
|
||||
lastActiveField = editor;
|
||||
});
|
||||
|
||||
document.addEventListener('change', function(event) {
|
||||
var target = event.target;
|
||||
if (target.matches('#ticket_mail_customButton')) {
|
||||
let placeholderValue = $(target).val();
|
||||
if (!placeholderValue) return;
|
||||
|
||||
if (lastActiveField) {
|
||||
if (lastActiveField.id === "mail_subject") {
|
||||
insertAtCursor(lastActiveField, placeholderValue);
|
||||
} else {
|
||||
editor.selection.insertHTML(placeholderValue);
|
||||
}
|
||||
}
|
||||
|
||||
$(target).val('');
|
||||
}
|
||||
});
|
||||
|
||||
function insertAtCursor(input, textToInsert) {
|
||||
if (document.selection) {
|
||||
input.focus();
|
||||
var sel = document.selection.createRange();
|
||||
sel.text = textToInsert;
|
||||
} else if (input.selectionStart || input.selectionStart === 0) {
|
||||
let startPos = input.selectionStart;
|
||||
let endPos = input.selectionEnd;
|
||||
input.value = input.value.substring(0, startPos) + textToInsert + input.value.substring(endPos, input.value.length);
|
||||
input.selectionStart = input.selectionEnd = startPos + textToInsert.length;
|
||||
} else {
|
||||
input.value += textToInsert;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$("#ticket_reply_form").submit(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
// Show loaders
|
||||
$('.loader, .loader-mask').fadeIn();
|
||||
|
||||
var url = '<?= base_url("/ticket/reply"); ?>';
|
||||
var formData = new FormData(this);
|
||||
|
||||
// Send AJAX request
|
||||
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
|
||||
$('.loader, .loader-mask').fadeOut();
|
||||
|
||||
if (response.status) {
|
||||
toastr.success('Mail sent successfully.', 'Success');
|
||||
} else {
|
||||
toastr.error(response.message || 'Failed to send mail.', 'Error');
|
||||
var joditEditor = editor;
|
||||
if (joditEditor)
|
||||
{
|
||||
var mailContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
|
||||
var formData = $(this).serializeArray();
|
||||
formData.push({ name: 'mail_content', value: mailContent });
|
||||
// formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
|
||||
// var isAutoMailEnabled = $('#statusSwitch').is(':checked') ? 1 : 0;
|
||||
// formData.push({ name: 'is_auto_mail', value: isAutoMailEnabled });
|
||||
var ticket_id = $('#ticket_master_id').val();
|
||||
if (ticket_id != null && ticket_id != ''){
|
||||
formData.push({ name: 'ticket_id', value: ticket_id});
|
||||
}
|
||||
// console.log(formData);
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var form_action = '<?= base_url("/ticket/reply"); ?>';
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(res)
|
||||
{
|
||||
if(res.status == true){
|
||||
// $('#new_mail_template').find('.close').click();
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Message Sent successfully!', 'Success');
|
||||
reloadTicket_conversation();
|
||||
}else if (res.status == false){
|
||||
toastr.error('Failed to Send Message', 'error');
|
||||
}
|
||||
|
||||
},
|
||||
error: function (xhr, status, error)
|
||||
{
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function()
|
||||
{
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.error('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
console.error("Jodit editor instance is not defined.");
|
||||
}
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error:', error);
|
||||
console.error('Response:', xhr.responseText);
|
||||
|
||||
$('.loader, .loader-mask').fadeOut();
|
||||
toastr.error('An error occurred while processing the request.', 'Error');
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function reloadTicket_conversation() {
|
||||
$("#ticket_messages_div").load(location.href + " #ticket_messages_div");
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -161,7 +161,7 @@ function fetchTicketListData() {
|
||||
var requestData = {
|
||||
ticket_type_id: ticket_type,
|
||||
pod_no: pod_no,
|
||||
claim_no: claim_no,
|
||||
claim_number: claim_no,
|
||||
emp_code: emp_code,
|
||||
claim_status_id: claim_status,
|
||||
emp_mobile: emp_mobile_no,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user