Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
velz 2025-09-10 09:35:45 +05:30
commit 708fe8f5a5
184 changed files with 27750 additions and 4101 deletions

4
.gitignore vendored
View File

@ -22,8 +22,8 @@ writable/debugbar/*
writable/**/*.db writable/**/*.db
writable/**/*.sqlite writable/**/*.sqlite
writable/e_card_template/* # writable/e_card_template/*
!writable/e_card_template/.gitkeep # !writable/e_card_template/.gitkeep
writable/tmp/* writable/tmp/*
!writable/tmp/.gitkeep !writable/tmp/.gitkeep

View File

@ -61,6 +61,7 @@ $routes->get('download-kyc-docs/(:segment)', 'ClientController::downloadKYCDocum
$routes->get('claim-form-download/(:any)', 'TicketController::downloadClaimForm/$1'); $routes->get('claim-form-download/(:any)', 'TicketController::downloadClaimForm/$1');
$routes->match (['get','post'],"claims-feedback-form/(:any)/(:any)", "TicketController::viewClaimFeedbackForm/$1/$2"); $routes->match (['get','post'],"claims-feedback-form/(:any)/(:any)", "TicketController::viewClaimFeedbackForm/$1/$2");
$routes->match (['get','post'],"claims-feedback-form/(:any)", "TicketController::viewClaimFeedbackForm/$1"); $routes->match (['get','post'],"claims-feedback-form/(:any)", "TicketController::viewClaimFeedbackForm/$1");
$routes->get('downloadClaimFile/(:any)', 'TicketController::downloadClaimFile/$1');
@ -73,6 +74,9 @@ $routes->group("/user", ["filter" => "authMVC"], function ($routes) {
$routes->get("deactive/(:hash)", "UserController::deactive/$1"); $routes->get("deactive/(:hash)", "UserController::deactive/$1");
$routes->get("rolesandteams", "UserController::getRolesAndTeams"); $routes->get("rolesandteams", "UserController::getRolesAndTeams");
$routes->get("getUserActivityHistory", "UserController::getUserActivityHistory"); $routes->get("getUserActivityHistory", "UserController::getUserActivityHistory");
$routes->match(['get','post','put'], 'partner', 'UserController::partner');
$routes->match(['get','post','put'], 'partnerIncentive', 'UserController::partnerIncentive');
$routes->get("download-incentive-file/(:any)", "UserController::downloadIncentivesFile/$1");
}); });
$routes->group("/dashboard", ["filter" => "authMVC"], function ($routes) { $routes->group("/dashboard", ["filter" => "authMVC"], function ($routes) {
@ -181,8 +185,11 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
$routes->post("test-rack-rate", "EmployeeController::testRackRate"); $routes->post("test-rack-rate", "EmployeeController::testRackRate");
$routes->get('test_members_list', 'EmployeeController::test_members_list'); $routes->get('test_members_list', 'EmployeeController::test_members_list');
$routes->post('get_emp_history','EmployeeController::getEmpHistory'); $routes->post('get_emp_history','EmployeeController::getEmpHistory');
$routes->get("retail-endorsement-list", "EmployeeController::retailendorsementList");
}); });
$routes->group("/master", ["filter" => "authMVC"], function ($routes) { $routes->group("/master", ["filter" => "authMVC"], function ($routes) {
$routes->group("insurer", ["filter" => "authMVC"], function ($routes) { $routes->group("insurer", ["filter" => "authMVC"], function ($routes) {
@ -362,14 +369,19 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
$routes->get('transformMailContent', 'LeadsController::transformMailContent'); $routes->get('transformMailContent', 'LeadsController::transformMailContent');
$routes->get('getCDAmount', 'ClientController::getCDAmount'); $routes->get('getCDAmount', 'ClientController::getCDAmount');
$routes->get('getTheEmpDataForClaim/(:any)', 'ClientController::getTheEmpDataForClaim/$1'); $routes->get('getTheEmpDataForClaim/(:any)', 'ClientController::getTheEmpDataForClaim/$1');
$routes->get('getTheEmpDataForClaimSearchByMobile/(:any)', 'ClientController::getTheEmpDataForClaimSearchByMobile/$1'); // $routes->get('getTheEmpDataForClaimSearchByMobile/(:any)', 'ClientController::getTheEmpDataForClaimSearchByMobile/$1');
$routes->get('getTheEmpDataForClaimSearchByMobile', 'ClientController::getTheEmpDataForClaimSearchByMobile');
$routes->get('getLeadNonEB/(:any)', 'LeadsController::getLeadNonEB/$1'); $routes->get('getLeadNonEB/(:any)', 'LeadsController::getLeadNonEB/$1');
$routes->get('getPolicyTypeFields', 'LeadsController::getPolicyTypeFields'); $routes->get('getPolicyTypeFields', 'LeadsController::getPolicyTypeFields');
$routes->get('removeMultiFile', 'LeadsController::removeMultiFile'); $routes->get('removeMultiFile', 'LeadsController::removeMultiFile');
$routes->get('removeInstallments', 'LeadsController::removeInstallments'); $routes->get('removeInstallments', 'LeadsController::removeInstallments');
$routes->get('getLeadEmailHistory/(:any)', 'LeadsController::getLeadEmailHistory/$1');
$routes->get('viewHrAccessData', 'ClientController::viewHrAccessData'); $routes->get('viewHrAccessData', 'ClientController::viewHrAccessData');
$routes->post('saveHrAccessData', 'ClientController::saveHrAccessData'); $routes->post('saveHrAccessData', 'ClientController::saveHrAccessData');
$routes->get('removeLevelContacts', 'ClientController::removeLevelContacts'); $routes->get('removeLevelContacts', 'ClientController::removeLevelContacts');
$routes->get('getClaimDumpFileErrorData', 'TicketController::getClaimDumpFileErrorData');
$routes->get("claim_dump_excel_error/(:any)", "TicketController::getClaimDumpExcelFileErrors/$1");
$routes->get("download_claim_dump_file/(:any)", "TicketController::downloadClaimDumpFile/$1");
}); });
$routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail"); $routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
@ -447,7 +459,6 @@ $routes->get('cli/sendZeptoMail', 'MasterController::testZeptoSMTP');
$routes->cli('cli/processjob', 'JobWorker::processJob'); $routes->cli('cli/processjob', 'JobWorker::processJob');
$routes->cli('cli/processjobs', 'JobWorker::processJobs'); $routes->cli('cli/processjobs', 'JobWorker::processJobs');
$routes->cli('cli/sendMailWithAutoQuery','TicketController::sendMailWithAutoQuery');
$routes->get("processjob", "JobWorker::processJob"); $routes->get("processjob", "JobWorker::processJob");
$routes->cli('cli/new_gmail_token', 'MasterController::generateNewGmailAPIToken'); $routes->cli('cli/new_gmail_token', 'MasterController::generateNewGmailAPIToken');
@ -461,6 +472,10 @@ $routes->cli('cli/new_gdrive_token', 'GoogleDriveController::generateNewGoogleDr
$routes->cli('cli/enrollOpendAndClose', 'DashboardController::updatePolicyEnrollmentStatus'); $routes->cli('cli/enrollOpendAndClose', 'DashboardController::updatePolicyEnrollmentStatus');
$routes->cli("cli/sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail"); $routes->cli("cli/sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
$routes->cli('cli/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus'); $routes->cli('cli/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus');
$routes->cli('cli/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus');
$routes->cli('cli/insurerRFQRemainder', 'LeadsController::remainderForQcr');
$routes->cli('cli/sendMailWithAutoQuery','TicketController::sendMailWithAutoQuery');
//Employee login api's //Employee login api's
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber"); $routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
@ -491,9 +506,6 @@ $routes->get('get_ticket_data',"EmployeeRestController::get_ticket_data");
$routes->group("/api", ["filter" => "authJWT"], function ($routes) { $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
$routes->post("logined", "RestAuthenticationController::logined"); $routes->post("logined", "RestAuthenticationController::logined");
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken"); $routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
$routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
$routes->get('get_ticket_type',"EmployeeRestController::get_ticket_type");
$routes->get('get_ticket_data',"EmployeeRestController::get_ticket_data");
}); });
$routes->post("employeeRest/saveMpin", "RestAuthenticationController::saveMpin"); $routes->post("employeeRest/saveMpin", "RestAuthenticationController::saveMpin");
@ -551,7 +563,30 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
$routes->get("claimView", "EmployeeRestController::claimView"); $routes->get("claimView", "EmployeeRestController::claimView");
$routes->get("exportCashDepositData", "EmployeeRestController::exportCashDepositData"); $routes->get("exportCashDepositData", "EmployeeRestController::exportCashDepositData");
//thz_master's
$routes->post("ticketSave", "ThzController::ticketSave");
$routes->get("ticketList", "ThzController::ticketList");
$routes->post("ticketConversationSave", "ThzController::ticketConversationSave");
$routes->get("ticketConversationList", "ThzController::ticketConversationList");
$routes->get("ticketHistoryList", "ThzController::ticketHistoryList");
$routes->match(['get','post','put'], 'ticketType', 'ThzController::ticketType');
$routes->get("hrFileList", "EmployeeRestController::hrFileList");
$routes->get("hrFileUploadMasters", "EmployeeRestController::hrFileUploadMasters");
$routes->get("hrFileDownload", "EmployeeRestController::hrFileDownload");
$routes->post("hrFileUpload", "EmployeeRestController::hrFileUpload");
$routes->post("updateHrFileUploadData", "EmployeeRestController::updateHrFileUploadData");
//claims
$routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
$routes->get('get_ticket_type',"EmployeeRestController::get_ticket_type");
$routes->get('get_ticket_data',"EmployeeRestController::get_ticket_data");
}); });
$routes->get("hrFileDownload", "EmployeeRestController::hrFileDownload");
$routes->post("hrFileList", "EmployeeRestController::hrFileList");
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy"); $routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification"); $routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");
$routes->post("sendEmail", "EmployeeRestController::send_email"); $routes->post("sendEmail", "EmployeeRestController::send_email");
@ -598,6 +633,8 @@ $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
$routes->post('upload_url',"TicketController::upload_url"); $routes->post('upload_url',"TicketController::upload_url");
$routes->post('getUrlDataByTicketId',"TicketController::getUrlDataByTicketId"); $routes->post('getUrlDataByTicketId',"TicketController::getUrlDataByTicketId");
$routes->get('remove_url',"TicketController::remove_url"); $routes->get('remove_url',"TicketController::remove_url");
$routes->get('fetchVehiclePolicy/(:any)','TicketController::fetchVehiclePolicy/$1');
}); });
$routes->group("clientApi",["filter" => "AuthClientApi"], function ($routes){ $routes->group("clientApi",["filter" => "AuthClientApi"], function ($routes){
@ -636,6 +673,21 @@ $routes->post('enrollment','VidalApiController::enrollment');
$routes->post("ticketSave", "ThzController::ticketSave"); $routes->post("ticketSave", "ThzController::ticketSave");
$routes->post("ticketList", "ThzController::ticketList"); $routes->get("ticketList", "ThzController::ticketList");
$routes->post("ticketConversationSave", "ThzController::ticketConversationSave"); $routes->post("ticketConversationSave", "ThzController::ticketConversationSave");
$routes->post("ticketConversationList", "ThzController::ticketConversationList"); $routes->get("ticketConversationList", "ThzController::ticketConversationList");
$routes->post('ticketAutoFetchDetails',"ThzController::ticketAutoFetchDetails");
$routes->match(['get','post','put'], 'ticketType', 'ThzController::ticketType');
$routes->get("ticketHistoryList", "ThzController::ticketHistoryList");
//for testing
$routes->group('test', function($routes) {
$routes->post('api/saveForm', 'TestingController::saveForm');
$routes->get('insurerRFQRemainder', 'LeadsController::remainderForQcr');
$routes->get('generatePDF', 'TestingController::generatePDF');
$routes->get('viewPDF', 'TestingController::viewPDF');
$routes->get('generate-pdf-view', 'TestingController::generatePDFWithView');
});
$routes->cli('cli/testcli', 'TestingController::testcli');

File diff suppressed because it is too large Load Diff

View File

@ -1862,6 +1862,7 @@ class EmpDataServiceController extends BaseController
$status = $file['status']; $status = $file['status'];
$batch_code = $file['batch_code']; $batch_code = $file['batch_code'];
$user_id = $file['created_by']; $user_id = $file['created_by'];
$policy_issue_date = $file['policy_issue_date'];
$insurer_id = $this->clientPolicyModel->where('id', $client_policy_id)->first(); $insurer_id = $this->clientPolicyModel->where('id', $client_policy_id)->first();
@ -2086,6 +2087,8 @@ class EmpDataServiceController extends BaseController
'no_of_dependent' => count($no_of_dependent ?? []) ?? null, 'no_of_dependent' => count($no_of_dependent ?? []) ?? null,
'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null,
'gst' => $base_bremium_and_gst['gst'] ?? null, 'gst' => $base_bremium_and_gst['gst'] ?? null,
'policy_issue_date' => $policy_issue_date ?? null,
'created_by' => $file['created_by'] ?? null,
]]); ]]);
// $this->cashDepositCalculationForInception($depositeData); // $this->cashDepositCalculationForInception($depositeData);
@ -2417,6 +2420,7 @@ class EmpDataServiceController extends BaseController
$batch_code = $file['batch_code']; $batch_code = $file['batch_code'];
$user_id = $file['created_by']; $user_id = $file['created_by'];
$event_type = $file['event_type']; $event_type = $file['event_type'];
$policy_issue_date = $file['policy_issue_date'];
$status_val = 'success'; $status_val = 'success';
@ -2519,6 +2523,8 @@ class EmpDataServiceController extends BaseController
'endorsement_no' => $endorsement_id[0] ?? null, 'endorsement_no' => $endorsement_id[0] ?? null,
'emp_count' => $emp_count ?? null, 'emp_count' => $emp_count ?? null,
'action_type' => $file['event_type'] ?? null, 'action_type' => $file['event_type'] ?? null,
'policy_issue_date' => $policy_issue_date ?? null,
'created_by' => $file['created_by'] ?? null,
]]); ]]);
@ -2999,6 +3005,7 @@ class EmpDataServiceController extends BaseController
$status = $file['status']; $status = $file['status'];
$batch_code = $file['batch_code']; $batch_code = $file['batch_code'];
$user_id = $file['created_by']; $user_id = $file['created_by'];
$policy_issue_date = $file['policy_issue_date'];
$insurer_id = $this->clientPolicyModel->where('id', $client_policy_id)->first(); $insurer_id = $this->clientPolicyModel->where('id', $client_policy_id)->first();
@ -3179,6 +3186,8 @@ class EmpDataServiceController extends BaseController
'no_of_dependent' => count($no_of_dependent ?? []) ?? null, 'no_of_dependent' => count($no_of_dependent ?? []) ?? null,
'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null,
'gst' => $base_bremium_and_gst['gst'] ?? null, 'gst' => $base_bremium_and_gst['gst'] ?? null,
'policy_issue_date' => $policy_issue_date ?? null,
'created_by' => $file['created_by'] ?? null,
]]); ]]);
} }
@ -3537,6 +3546,7 @@ class EmpDataServiceController extends BaseController
$status = $file['status']; $status = $file['status'];
$batch_code = $file['batch_code']; $batch_code = $file['batch_code'];
$user_id = $file['created_by']; $user_id = $file['created_by'];
$policy_issue_date = $file['policy_issue_date'];
$insurer_id = $this->clientPolicyModel->where('id', $client_policy_id)->first(); $insurer_id = $this->clientPolicyModel->where('id', $client_policy_id)->first();
@ -3687,6 +3697,8 @@ class EmpDataServiceController extends BaseController
'no_of_dependent' => count($no_of_dependent ?? []) ?? null, 'no_of_dependent' => count($no_of_dependent ?? []) ?? null,
'base_premium' => $base_bremium_and_gst['base_premium'] ?? null, 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null,
'gst' => $base_bremium_and_gst['gst'] ?? null, 'gst' => $base_bremium_and_gst['gst'] ?? null,
'policy_issue_date' => $policy_issue_date ?? null,
'created_by' => $file['created_by'] ?? null,
]]); ]]);
} }
@ -4981,7 +4993,7 @@ class EmpDataServiceController extends BaseController
'policy_no' => $policy_data['policy_no'] ?? null, 'policy_no' => $policy_data['policy_no'] ?? null,
'cd_ac_no' => $policy_data['cd_ac_no'] ?? null, 'cd_ac_no' => $policy_data['cd_ac_no'] ?? null,
'cd_ac_pk' => $policy_data['cd_ac_pk'] ?? null, 'cd_ac_pk' => $policy_data['cd_ac_pk'] ?? null,
'policy_issue_date' => $policy_data['policy_start_date'] ?? null, 'policy_issue_date' => $params['policy_issue_date'] ?? null,
'policy_start_date' => $policy_data['policy_start_date'] ?? null, 'policy_start_date' => $policy_data['policy_start_date'] ?? null,
'policy_end_date' => $policy_data['policy_end_date'] ?? null, 'policy_end_date' => $policy_data['policy_end_date'] ?? null,
'data_received_date' => $policy_data['data_received_date'] ?? null, 'data_received_date' => $policy_data['data_received_date'] ?? null,
@ -4992,7 +5004,7 @@ class EmpDataServiceController extends BaseController
'co_share' => $policy_data['co_share'] ?? 0, 'co_share' => $policy_data['co_share'] ?? 0,
'pre_payable_by' => $policy_data['pre_payable_by'] ?? 1, 'pre_payable_by' => $policy_data['pre_payable_by'] ?? 1,
'renewal_date' => $policy_data['policy_end_date'] ?? null, 'renewal_date' => $policy_data['policy_end_date'] ?? null,
'month' => date('Y-m-01', strtotime($policy_data['policy_start_date'])) ?? null, 'month' => date('Y-m-01', strtotime($params['policy_issue_date'] ?? "")) ?? null,
'ct_type' => 1, 'ct_type' => 1,
'is_cd_reduce_from_bds' => 0, 'is_cd_reduce_from_bds' => 0,
'client_type_id' => 0, 'client_type_id' => 0,
@ -5007,6 +5019,7 @@ class EmpDataServiceController extends BaseController
'source_client_policy_id' => $lead_data['source_policy_id'] ?? null, 'source_client_policy_id' => $lead_data['source_policy_id'] ?? null,
'tsi' => generate_tsi_code($lead_data['lead_type'] ?? 1) ?? null, 'tsi' => generate_tsi_code($lead_data['lead_type'] ?? 1) ?? null,
'installment' => $lead_data['no_of_installment'] ?? null, 'installment' => $lead_data['no_of_installment'] ?? null,
'created_by' => $params['created_by'] ?? null,
]; ];
$this->myLogger->logme("error", "Constructed policy transaction data: " . json_encode($policyTransactionData)); $this->myLogger->logme("error", "Constructed policy transaction data: " . json_encode($policyTransactionData));

View File

@ -27,6 +27,7 @@ use App\Models\ClientDepositModel;
use App\Models\PolicyPremium2Model; use App\Models\PolicyPremium2Model;
use App\Models\AuditHistoryModel; use App\Models\AuditHistoryModel;
use App\Models\UserModel; use App\Models\UserModel;
use App\Models\PartnerEndorsementRequestModel;
use App\Controllers\Jobs; use App\Controllers\Jobs;
@ -68,6 +69,7 @@ class EmployeeController extends AdminController
protected $PolicyPremium2Model; protected $PolicyPremium2Model;
protected $auditHistory; protected $auditHistory;
protected $userModel; protected $userModel;
protected $partnerEndorsementRequestModel;
public function __construct() public function __construct()
{ {
@ -90,6 +92,7 @@ class EmployeeController extends AdminController
$this->PolicyPremium2Model = new PolicyPremium2Model(); $this->PolicyPremium2Model = new PolicyPremium2Model();
$this->auditHistory = new AuditHistoryModel(); $this->auditHistory = new AuditHistoryModel();
$this->userModel = new userModel(); $this->userModel = new userModel();
$this->partnerEndorsementRequestModel = new PartnerEndorsementRequestModel();
} }
public function list() public function list()
@ -270,28 +273,35 @@ class EmployeeController extends AdminController
$client_id = $this->request->getPost('client_id'); $client_id = $this->request->getPost('client_id');
$policy_id = $this->request->getPost('policy_id'); $policy_id = $this->request->getPost('policy_id');
$branch_id = $this->request->getPost('branch_id'); $branch_id = $this->request->getPost('branch_id');
$hr_file_id = $this->request->getPost('hr_file_id') ?? null;
$action = $this->request->getPost('upload-action-type'); $action = $this->request->getPost('upload-action-type');
$status = 'inprogress'; $status = 'inprogress';
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $loggedInUserID, 'status' => $status, 'action' => $action, 'client_branch_id' => $branch_id,'uploaded_by' => 1]); //here field policy_id have client_policy_id and not policy id from policy master $file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $loggedInUserID, 'status' => $status, 'action' => $action, 'client_branch_id' => $branch_id,'uploaded_by' => 1, 'hr_file_id' => $hr_file_id]); //here field policy_id have client_policy_id and not policy id from policy master
$this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]); $this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]);
//start validation process if ($action == "all") {
if($fileSize < 1) // if file size less than 1
{ $r = Jobs::addJob(['job_name' => 'excelMultieventFileFormateValidation', 'payload' => ['file_id' => $file_id]]);
$empServiceController = new EmployeeServiceController();
$result = $empServiceController->excelFileFormatValidation(['file_id' => $file_id]);
$this->myLogger->logme("error", '{file_id} is less than 1MB, validating on the fly', ['file_id' => $file_id]);
//endof validation process
if (isset($result['error_summary']) && count($result['error_summary'])) {
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'file rejected with errors'], 200);
}
}
else //if file size greater than 1 add the file as job
{
$job_details = new Jobs();
$r = Jobs::addJob(['job_name' => 'excelFileFormatValidation','payload' => ['file_id' => $file_id]]);
$this->myLogger->logme("error", '{file_id} is greather than 1MB, validating with job queue', ['file_id' => $file_id]); $this->myLogger->logme("error", '{file_id} is greather than 1MB, validating with job queue', ['file_id' => $file_id]);
} else {
//start validation process
if ($fileSize < 1) // if file size less than 1
{
$empServiceController = new EmployeeServiceController();
$result = $empServiceController->excelFileFormatValidation(['file_id' => $file_id]);
$this->myLogger->logme("error", '{file_id} is less than 1MB, validating on the fly', ['file_id' => $file_id]);
//endof validation process
if (isset($result['error_summary']) && count($result['error_summary'])) {
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'file rejected with errors'], 200);
}
} else //if file size greater than 1 add the file as job
{
$job_details = new Jobs();
$r = Jobs::addJob(['job_name' => 'excelFileFormatValidation', 'payload' => ['file_id' => $file_id]]);
$this->myLogger->logme("error", '{file_id} is greather than 1MB, validating with job queue', ['file_id' => $file_id]);
}
} }
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => 'file upload success'], 200); return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => 'file upload success'], 200);
@ -302,7 +312,7 @@ class EmployeeController extends AdminController
//for TPA/insurer upload //for TPA/insurer upload
$data['events'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement']; $data['events'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
//for inception upload //for inception upload
$data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement']; $data['actions'] = ['all' => 'All', 'inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
// $data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement','enrollment' => 'Enrolment']; // $data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement','enrollment' => 'Enrolment'];
// $data['import_or_export'] = ['import' => 'Import', 'export' => 'Export']; // $data['import_or_export'] = ['import' => 'Import', 'export' => 'Export'];
@ -468,6 +478,8 @@ class EmployeeController extends AdminController
$filePath = ROOTPATH . 'public/sample_excel/sample_inception.xls'; $filePath = ROOTPATH . 'public/sample_excel/sample_inception.xls';
}else if ($actionType == 'member_data') { }else if ($actionType == 'member_data') {
$filePath = ROOTPATH . 'public/sample_excel/Sample_Member_Data.xlsx'; $filePath = ROOTPATH . 'public/sample_excel/Sample_Member_Data.xlsx';
}else if ($actionType == 'all') {
$filePath = ROOTPATH . 'public/sample_excel/sample_multievent_file.xlsx';
} }
// Check if the file exists // Check if the file exists
@ -514,6 +526,7 @@ class EmployeeController extends AdminController
$client_branch_id = $this->request->getPost('client_branch_id'); $client_branch_id = $this->request->getPost('client_branch_id');
$insurer_or_tpa = $this->request->getPost('insurer_or_tpa'); $insurer_or_tpa = $this->request->getPost('insurer_or_tpa');
$actions = $this->request->getPost('action_type'); $actions = $this->request->getPost('action_type');
$policy_issue_date = $this->request->getPost('policy_issue_date');
$client_data = $this->clientPolicyModel->getCliendDataForExcelFileName($client_policy_id); $client_data = $this->clientPolicyModel->getCliendDataForExcelFileName($client_policy_id);
$file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $client_data['policy_type'], $client_data['branch_code']); $file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $client_data['policy_type'], $client_data['branch_code']);
@ -529,6 +542,13 @@ class EmployeeController extends AdminController
'actions' => $actions, 'actions' => $actions,
'file_name' => $file_name, 'file_name' => $file_name,
]; ];
$batch_data['policy_issue_date'] = (!empty($policy_issue_date) && strtotime($policy_issue_date) !== false)
? change_date_format($policy_issue_date)
: null;
if ($actions == 'export') { if ($actions == 'export') {
if ($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition' || $event_type == 'missed_inception' || ($event_type == 'MultipleEvents' && $insurer_or_tpa == 'tpa')) { if ($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition' || $event_type == 'missed_inception' || ($event_type == 'MultipleEvents' && $insurer_or_tpa == 'tpa')) {
@ -1163,8 +1183,10 @@ class EmployeeController extends AdminController
return $response; return $response;
} }
//E-CARD DOWNLOAD FUNCTION // --------------- For E-Card Download -----------------------------------------------------------------------------------------------------
public function generateIDCardForEmployee($rand_string, $people = 0)
//E-CARD DOWNLOAD FUNCTION USING HTML PRINT
public function generateIDCardForEmployeeUsingHtml($rand_string, $people = 0)
{ {
// dd($rand_string, $people); // dd($rand_string, $people);
try { try {
@ -1299,6 +1321,258 @@ class EmployeeController extends AdminController
} }
// Preview E-Card Template function
public function previewTemplate($id = null)
{
$value = [
'tpa_id' => 'TPA12345',
'name' => 'John Doe',
'uhid' => 'UHID67890',
'gender' => 'Male',
'dob' => '1985-05-15',
'self' => 'John Doe',
'policy_end_date' => '2024-12-31',
'policy_start_date' => '2023-01-01',
'policy_no' => 'POL1234567890',
'insurer_name' => 'Example Insurance Company',
'emp_code' => 'EMP001122',
'client_name' => 'Corporate Client Inc.',
'emp_age' => 39,
'tpa_name' => 'Example TPA',
'insurer_branch_city' => 'New York',
'relationship' => 'Self',
'basic_cover_si' => '5,00,000',
];
$tpa_id = $this->TPAModel->where('id', $id)->first();
$template_data_path = WRITEPATH . 'e_card_template/';
$tpa_short_name = strtolower(str_replace(' ', '_', $tpa_id['short_name'])) . '.html';
$final_path = $template_data_path . $tpa_short_name;
if (!file_exists($final_path)) {
$data['message'] = 'Record Not Found';
return view('errors/404', $data);
}
$tmplt_data = file_get_contents($final_path);
$placeholders = [
'{TPA_ID}' => $value['tpa_id'],
'{NAME}' => $value['name'],
'{UHID}' => $value['uhid'],
'{GENDER}' => $value['gender'],
'{DOB}' => date('d-M-Y', strtotime($value['dob'])),
'{SELF_NAME}' => $value['self'] ?? $value['name'],
'{POLICY_DATE}' => date('d-M-Y', strtotime($value['policy_end_date'])),
'{POLICY_START_DATE}' => date('d-M-Y', strtotime($value['policy_start_date'])),
'{POLICY_NO}' => $value['policy_no'],
'{INSURER_NAME}' => strtoupper($value['insurer_name']),
'{EMP_ID}' => $value['emp_code'],
'{SI_AMT}' => $value['basic_cover_si'],
'{CORPORATE_NAME}' => $value['client_name'],
'{AGE}' => $value['emp_age'],
'{TPA_NAME}' => $value['tpa_name'],
'{INSURER_BRANCH}' => $value['insurer_branch_city'],
'{RELATION}' => $value['relationship'],
'{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $tpa_id['front_card'],
'{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $tpa_id['back_card'],
'{TPA_LOGO}' => base_url() . 'public/uploads/logo/' . $tpa_id['tpa_logo'],
'{INSURER_LOGO}' => base_url() . 'public/assets/images/sample_logo_3.png',
'{MEDI_USER}' => base_url() . 'public/e_card_imgs/medi_uesr.jpg',
'{MEDI_INSURER}' => base_url() . 'public/e_card_imgs/Magma.png',
'{MEDI_BARCODE}' => base_url() . 'public/e_card_imgs/borcode.jpeg',
'{QR_ANDROID}' => base_url() . 'public/e_card_imgs/android.png',
'{QR_IOS}' => base_url() . 'public/e_card_imgs/ios.png',
'{QR_ANDROID_2}' => base_url() . 'public/e_card_imgs/play_store.png',
'{QR_IOS_2}' => base_url() . 'public/e_card_imgs/appstore.png',
];
$placeholders['{LEVELS}'] = '
<span style="font-family: sans-serif;">Level 1</span><br><br>
<span style="font-family: sans-serif;">1. Gowtham / 8754081806 / gowtham@gmail.com</span><br>
<span style="font-family: sans-serif;">2. Gowtham / 8754081806 / gowtham@gmail.com</span><br><br>';
// dd($placeholders);
// Get the values to replace the placeholders
$replaceValues = array_values($placeholders);
// Get the placeholders to search for
$searchPlaceholders = array_keys($placeholders);
// Replace placeholders with values in HTML content
$htmlContent = str_replace($searchPlaceholders, $replaceValues, $tmplt_data);
echo $htmlContent;
}
//E-CARD DOWNLOAD FUNCTION USING DOM PDF ( CURRENTLY USING THIS )
public function generateIDCardForEmployee($rand_string, $people = 0, $mode = 0)
{
// dd($rand_string, $people);
$this->myLogger->logme('error', 'generateIDCardForEmployee params .' . json_encode(["rand_string" => $rand_string, "people" => $people, "mode" => $mode]));
try {
$this->myLogger->logme('error', 'generateIDCardForEmployee function started.');
// Step 1: Attempt to fetch employee code and client policy ID
$this->myLogger->logme('error', 'Fetching employee code and client policy ID.');
$get_emp_code_and_client_policy_id = $this->employeePolicyModel
->select('employee_polices.client_policy_id, employees.emp_code, tpa.short_name,employees.client_id')
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
->join('employees', 'employees.id = employee_polices.employee_id')
->join('tpa', 'tpa.id = client_policy.tpa_id')
->where('employees.emp_status', 'active')
->where('employees.is_active', '1')
->where("employee_polices.tpa_id IS NOT NULL AND employee_polices.tpa_id <> ''")
->where('employee_polices.status', 'active')
->where('employee_polices.is_active', '1')
->where('employee_polices.rand_string', $rand_string)
->first();
// dd($this->employeePolicyModel->getLastQuery());
// dd($rand_string, $get_emp_code_and_client_policy_id);
if ($get_emp_code_and_client_policy_id == null || $get_emp_code_and_client_policy_id == "") {
$this->myLogger->logme('error', 'Member not found in this rand_string: ' . $rand_string);
$data['message'] = 'Record Not Found';
return view('errors/404', $data);
}
$this->myLogger->logme('error', 'Member found. Client policy ID: ' . $get_emp_code_and_client_policy_id['client_policy_id']);
$client_policy_id = $get_emp_code_and_client_policy_id['client_policy_id'];
$emp_code = $get_emp_code_and_client_policy_id['emp_code'];
$client_id = $get_emp_code_and_client_policy_id['client_id'];
// Step 2: Fetch ECard data
$this->myLogger->logme('error', 'Fetching ECard data using client_policy_id: ' . $client_policy_id . ' and emp_code: ' . $emp_code);
$data = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code,$client_id);
if ($people == 0) {
$this->myLogger->logme('error', 'Fetching single ECard data using rand_string: ' . $rand_string . ' and emp_code: ' . $emp_code);
$data = $this->employeePolicyModel->getECardSingleData($rand_string, $emp_code,$client_id);
}
// Step 3: Prepare template path
$template_data_path = WRITEPATH . 'e_card_template/';
// $tpa_short_name = strtolower(str_replace(' ', '_', $get_emp_code_and_client_policy_id['short_name'])) . '.html';
$tpa_short_name = 'common.html';
$final_path = $template_data_path . $tpa_short_name;
$this->myLogger->logme('error', 'Checking if template file exists at: ' . $final_path);
if (!file_exists($final_path)) {
$this->myLogger->logme('error', 'Template file not found: ' . $final_path);
$data['message'] = 'Template File Not Found';
return view('errors/404', $data);
}
$this->myLogger->logme('error', 'Template file found. Reading template data.');
$tmplt_data = file_get_contents($final_path);
// Step 4: Generate HTML content
$this->myLogger->logme('error', 'Generating HTML content from template.');
$html = "";
foreach ($data as $key => $value) {
$htmlContent = $tmplt_data;
$value['front_card'] = "Nhance_Ecard_working_1_front.png";
$value['back_card'] = "Nhance_Ecard_working_1_Back.png";
$placeholders = [
'{CLIENT_NAME}' => $value['client_name'],
'{TPA_ID}' => $value['tpa_id'],
'{NAME}' => $value['name'],
'{UHID}' => $value['uhid'],
'{GENDER}' => $value['gender'],
'{DOB}' => date('d-M-Y', strtotime($value['dob'])),
'{SELF_NAME}' => $value['self'] ?? $value['name'],
'{POLICY_DATE}' => date('d-M-Y', strtotime($value['policy_end_date'])),
'{POLICY_START_DATE}' => date('d-M-Y', strtotime($value['policy_start_date'])),
'{POLICY_NO}' => $value['policy_no'],
'{INSURER_NAME}' => strtoupper($value['insurer_name']),
'{INSURER_LOGO}' => base_url() . 'public/uploads/logo/' . $value['insurer_logo'],
'{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['front_card'],
'{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['back_card'],
'{EMP_ID}' => $value['emp_code'],
'{SI_AMT}' => $value['basic_cover_si'],
'{CORPORATE_NAME}' => $value['client_name'],
'{AGE}' => $value['emp_age'],
'{TPA_NAME}' => $value['tpa_name'],
'{INSURER_BRANCH}' => $value['insurer_branch_city'],
'{RELATION}' => $value['relationship'],
'{TPA_LOGO}' => base_url() . 'public/uploads/logo/' . $value['tpa_logo'],
'{MEDI_USER}' => base_url() . 'public/e_card_imgs/medi_uesr.jpg',
'{MEDI_INSURER}' => base_url() . 'public/e_card_imgs/Magma.png',
'{MEDI_BARCODE}' => base_url() . 'public/e_card_imgs/borcode.jpeg',
'{QR_ANDROID}' => base_url() . 'public/e_card_imgs/android.png',
'{QR_IOS}' => base_url() . 'public/e_card_imgs/ios.png',
'{QR_ANDROID_2}' => base_url() . 'public/e_card_imgs/play_store.png',
'{QR_IOS_2}' => base_url() . 'public/e_card_imgs/appstore.png',
];
$placeholders['{LEVELS}'] = $this->generateAcmAndMForEcard($client_id);
foreach ($placeholders as $placeholder => $replaceValue) {
$htmlContent = str_replace($placeholder, $replaceValue, $htmlContent);
}
$html .= $htmlContent;
}
// DomPdf
$options = new Options();
$options->set('isRemoteEnabled', true);
$options->set('isHtml5ParserEnabled', true);
$dompdf = new Dompdf($options);
$dompdf->loadHtml('<style>@page { margin: 0; }</style>' . $html); // remove the margin
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
// Set document title
$dompdf->addInfo("Title", "E-Card");
$filename = 'ecard_' . date('Y-m-d_H-i-s') . '.pdf';
// if($mode == 1){
// $dompdf->stream($filename, ['Attachment' => false]); // Inline view
// }else{
// $dompdf->stream($filename, ['Attachment' => true]); // Force download
// }
if ($mode == 1) {
// Inline view
return $this->response
->setHeader('Content-Type', 'application/pdf')
->setHeader('Content-Disposition', 'inline; filename="' . $filename . '"')
->setBody($dompdf->output());
} else {
// Force download
return $this->response
->setHeader('Content-Type', 'application/pdf')
->setHeader('Content-Disposition', 'attachment; filename="' . $filename . '"')
->setBody($dompdf->output());
}
$this->myLogger->logme('error', 'generateIDCardForEmployee function completed successfully.');
} catch (\Exception $e) {
$this->myLogger->logme('error', 'Exception occurred: ' . $e->getMessage());
$data['message'] = 'Record Not Found';
return view('errors/404', $data);
}
}
// --------------------------------------------------------------------------------------------------------------------
public function viewECard() public function viewECard()
{ {
@ -1866,95 +2140,6 @@ class EmployeeController extends AdminController
} }
} }
// Preview E-Card Template function
public function previewTemplate($id = null)
{
$value = [
'tpa_id' => 'TPA12345',
'name' => 'John Doe',
'uhid' => 'UHID67890',
'gender' => 'Male',
'dob' => '1985-05-15',
'self' => 'John Doe',
'policy_end_date' => '2024-12-31',
'policy_start_date' => '2023-01-01',
'policy_no' => 'POL1234567890',
'insurer_name' => 'Example Insurance Company',
'emp_code' => 'EMP001122',
'client_name' => 'Corporate Client Inc.',
'emp_age' => 39,
'tpa_name' => 'Example TPA',
'insurer_branch_city' => 'New York',
'relationship' => 'Self',
'basic_cover_si' => '5,00,000',
];
$tpa_id = $this->TPAModel->where('id', $id)->first();
$template_data_path = WRITEPATH . 'e_card_template/';
$tpa_short_name = strtolower(str_replace(' ', '_', $tpa_id['short_name'])) . '.html';
$final_path = $template_data_path . $tpa_short_name;
if (!file_exists($final_path)) {
$data['message'] = 'Record Not Found';
return view('errors/404', $data);
}
$tmplt_data = file_get_contents($final_path);
$placeholders = [
'{TPA_ID}' => $value['tpa_id'],
'{NAME}' => $value['name'],
'{UHID}' => $value['uhid'],
'{GENDER}' => $value['gender'],
'{DOB}' => date('d-M-Y', strtotime($value['dob'])),
'{SELF_NAME}' => $value['self'] ?? $value['name'],
'{POLICY_DATE}' => date('d-M-Y', strtotime($value['policy_end_date'])),
'{POLICY_START_DATE}' => date('d-M-Y', strtotime($value['policy_start_date'])),
'{POLICY_NO}' => $value['policy_no'],
'{INSURER_NAME}' => strtoupper($value['insurer_name']),
'{EMP_ID}' => $value['emp_code'],
'{SI_AMT}' => $value['basic_cover_si'],
'{CORPORATE_NAME}' => $value['client_name'],
'{AGE}' => $value['emp_age'],
'{TPA_NAME}' => $value['tpa_name'],
'{INSURER_BRANCH}' => $value['insurer_branch_city'],
'{RELATION}' => $value['relationship'],
'{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $tpa_id['front_card'],
'{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $tpa_id['back_card'],
'{TPA_LOGO}' => base_url() . 'public/uploads/logo/' . $tpa_id['tpa_logo'],
'{INSURER_LOGO}' => base_url() . 'public/assets/images/sample_logo_3.png',
'{MEDI_USER}' => base_url() . 'public/e_card_imgs/medi_uesr.jpg',
'{MEDI_INSURER}' => base_url() . 'public/e_card_imgs/Magma.png',
'{MEDI_BARCODE}' => base_url() . 'public/e_card_imgs/borcode.jpeg',
'{QR_ANDROID}' => base_url() . 'public/e_card_imgs/android.png',
'{QR_IOS}' => base_url() . 'public/e_card_imgs/ios.png',
'{QR_ANDROID_2}' => base_url() . 'public/e_card_imgs/play_store.png',
'{QR_IOS_2}' => base_url() . 'public/e_card_imgs/appstore.png',
];
$placeholders['{LEVELS}'] = '
<span style="font-family: sans-serif;">Level 1</span><br><br>
<span style="font-family: sans-serif;">1. Gowtham / 8754081806 / gowtham@gmail.com</span><br>
<span style="font-family: sans-serif;">2. Gowtham / 8754081806 / gowtham@gmail.com</span><br><br>';
// dd($placeholders);
// Get the values to replace the placeholders
$replaceValues = array_values($placeholders);
// Get the placeholders to search for
$searchPlaceholders = array_keys($placeholders);
// Replace placeholders with values in HTML content
$htmlContent = str_replace($searchPlaceholders, $replaceValues, $tmplt_data);
echo $htmlContent;
}
public function errorListExportImport($file_id) public function errorListExportImport($file_id)
{ {
@ -2825,4 +3010,31 @@ class EmployeeController extends AdminController
} }
/**
* Below function displays the endorsement list page.
*
* This method retrieves filter data from the request and fetches the endorsement list
* based on the provided filters such as client ID, policy ID, and status.
*/
public function retailendorsementList()
{
// $data = [];
// $data['status'] = ['open' => 'Open', 'inprogress' => 'In-Progress', 'complete' => 'Complete'];
// if (count($this->request->getGet())) {
// $filterData = $this->request->getGet();
// $data['employees'] = $this->partnerEndorsementRequestModel->getRetailEndorsementList(
// client_id: $filterData['client_id'],
// insurer_id: $filterData['insurer_id'],
// status: $filterData['status']
// );
// $data['getData'] = $filterData;
// // echo "<pre>";
// // print_r($data); die;
// }
// $this->myLogger->logme('error', 'list called');
// $this->loadLayout('retail_endorsement_list', $data);
}
} }

File diff suppressed because it is too large Load Diff

View File

@ -34,6 +34,7 @@ use App\Models\TicketMasterModel;
use App\Models\TicketMessageModel; use App\Models\TicketMessageModel;
use App\Models\HRAccessControlModel; use App\Models\HRAccessControlModel;
use App\Models\InsurerModel; use App\Models\InsurerModel;
use App\Models\HrFileUploadModel;
@ -50,7 +51,7 @@ use CodeIgniter\API\ResponseTrait;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Controllers\EmployeeServiceController; use App\Controllers\EmployeeServiceController;
use App\Models\ClaimFilesModel;
use Kreait\Firebase\Factory; use Kreait\Firebase\Factory;
use Kreait\Firebase\Messaging\CloudMessage; use Kreait\Firebase\Messaging\CloudMessage;
use Kreait\Firebase\Messaging\Notification; use Kreait\Firebase\Messaging\Notification;
@ -87,6 +88,7 @@ class EmployeeRestController extends AdminController
protected $ticketController; protected $ticketController;
protected $hrAccessControlModel; protected $hrAccessControlModel;
protected $insurerModel; protected $insurerModel;
protected $hrFileUploadModel;
public function __construct() public function __construct()
@ -118,6 +120,7 @@ class EmployeeRestController extends AdminController
$this->ticketController = new TicketController(); $this->ticketController = new TicketController();
$this->hrAccessControlModel = new HRAccessControlModel(); $this->hrAccessControlModel = new HRAccessControlModel();
$this->insurerModel = new InsurerModel(); $this->insurerModel = new InsurerModel();
$this->hrFileUploadModel = new HrFileUploadModel();
} }
@ -2619,9 +2622,38 @@ class EmployeeRestController extends AdminController
} }
} }
return $this->respond(['status' => (count($data) ? 'success' : 'failed'),'code' => (count($data) ? 200 : 404),'data' => $data ], 200); $ticketMesssageModel = new TicketMessageModel();
$ticket_message = $ticketMesssageModel
->where('is_active', 1)
->where('sender', "user")
->where('ticket_id', $ticket_id)
->orderBy('id', "desc")
->first();
$claim_file_urls = [];
if (isset($ticket_message['id'])) {
$claimFiles = new ClaimFilesModel();
$claim_files_data = $claimFiles
->select('id as claim_file_id, doc_name as claim_file_name')
->where('is_active', 1)
->where('file_type', 2)
->where('ticket_id', $ticket_id)
->where('ticket_message_id', $ticket_message['id'])
->findAll();
foreach ($claim_files_data as &$value) {
$value['url'] = base_url('downloadClaimFile/') . $value['claim_file_id'];
$claim_file_urls[] = $value;
}
unset($value);
}
$data['claim_files'] = $claim_file_urls;
return $this->respond(['status' => (count($data) ? 'success' : 'failed'),'code' => (count($data) ? 200 : 404),'data' => $data, ], 200);
} }
@ -2817,18 +2849,29 @@ class EmployeeRestController extends AdminController
{ {
$policyGroup = 'gpa'; $policyGroup = 'gpa';
$data['ticket_type_id'] = 2; $data['ticket_type_id'] = 2;
$data['claim_subject'] = "Claim GPA";
$data['sum_insured_label'] = "Sum Assured";
}else if($ClientPolicyValue['policy_type_id'] == 6) }else if($ClientPolicyValue['policy_type_id'] == 6)
{ {
$policyGroup = 'gpa'; $policyGroup = 'gpa';
$data['ticket_type_id'] = 3; $data['ticket_type_id'] = 3;
$data['claim_subject'] = "Claim EDLI";
$data['sum_insured_label'] = "Sum Assured";
}else if($ClientPolicyValue['policy_type_id'] == 7) }else if($ClientPolicyValue['policy_type_id'] == 7)
{ {
$policyGroup = 'gpa'; $policyGroup = 'gpa';
$data['ticket_type_id'] = 4; $data['ticket_type_id'] = 4;
$data['claim_subject'] = "Claim GTLI";
$data['sum_insured_label'] = "Sum Assured";
}else }else
{ {
$policyGroup = 'gmc'; $policyGroup = 'gmc';
$data['ticket_type_id'] = 1; $data['ticket_type_id'] = 1;
$data['claim_subject'] = "Claim GMC";
$data['sum_insured_label'] = "Sum Insured";
} }
$terms = json_decode($ClientPolicyValue['policy_terms'] , true); $terms = json_decode($ClientPolicyValue['policy_terms'] , true);
@ -3403,11 +3446,20 @@ class EmployeeRestController extends AdminController
{ {
$received_data = $this->request->getPost(); $received_data = $this->request->getPost();
// print_r($received_data); die; $this->myLogger->logme('error', 'API claim initiate Recevied Params :' . json_encode($received_data ?? []));
$get_file_data = $this->request->getFiles('claim_docs');
// print_r($get_file_data); die;
$employee_id = $received_data['emp_id']; $employee_id = $received_data['emp_id'];
$client_policy_id = $received_data['client_policy_id']; $client_policy_id = $received_data['client_policy_id'];
$insured_emp_id = $received_data['insured_emp_id']; $insured_emp_id = $received_data['insured_emp_id'];
$file_data = [];
if(isset($get_file_data) && !empty($get_file_data)){
$file_path = WRITEPATH . 'uploads/claim_files/';
$file_data = multi_file_Upload($get_file_data, $file_path);
}
if (empty($received_data['doa'])) { if (empty($received_data['doa'])) {
$received_data['doa'] = null; $received_data['doa'] = null;
} else{ } else{
@ -3500,11 +3552,14 @@ class EmployeeRestController extends AdminController
'mail_content' => $fetchData['message'] ?? "New Claim", 'mail_content' => $fetchData['message'] ?? "New Claim",
]; ];
$ticket_message_id = null;
if (!empty($messagesData['ticket_id'])) { if (!empty($messagesData['ticket_id'])) {
$TicketMessageModel = new TicketMessageModel(); $TicketMessageModel = new TicketMessageModel();
$TicketMessageModel->insert($messagesData); $ticket_message_id = $TicketMessageModel->insert($messagesData);
} }
$this->handleCliamFiles($file_data, $ticket_id, $ticket_message_id);
$mail_sent_status = ($this->ticketController->sendAutoMailTrigger($ticket_id)); $mail_sent_status = ($this->ticketController->sendAutoMailTrigger($ticket_id));
if (gettype($mail_sent_status) == 'array') { if (gettype($mail_sent_status) == 'array') {
$message = 'Claim Iniated Successfully'; $message = 'Claim Iniated Successfully';
@ -3541,15 +3596,132 @@ class EmployeeRestController extends AdminController
} }
} }
public function handleCliamFiles($data, $ticket_id, $ticket_message_id)
{
if(!empty($data) && !empty($ticket_id))
{
$insert_ids = [];
$claim_file = new ClaimFilesModel();
foreach ($data as $key => $value) {
$data = [
'ticket_id' => $ticket_id,
'doc_name' => $value['file_name'],
'url' => $value['file_path'],
'file_type' => 2,
'ticket_message_id' => $ticket_message_id,
];
$insert_ids[] = $claim_file->insert($data);
}
return $insert_ids;
}
return [];
}
//department //department
// public function get_ticket_type()
// {
// $ticket_type = $this->ticketController->ticketType;
// $ticket_type = array_map(fn($value, $key) => (object) ['id' => $key, 'name' => $value], array_values($ticket_type), array_keys($ticket_type));
// // print_r($ticket_type); die;
// return $this->response->setJSON(['ticket_type' => $ticket_type])->setStatusCode(200);
// }
public function get_ticket_type() public function get_ticket_type()
{ {
$ticket_type = $this->ticketController->ticketType; try {
$ticket_type = array_map(fn($value, $key) => (object) ['id' => $key, 'name' => $value], array_values($ticket_type), array_keys($ticket_type));
// print_r($ticket_type); die; $client_id = $this->request->getGet('client_id');
return $this->response->setJSON(['ticket_type' => $ticket_type])->setStatusCode(200); $emp_code = $this->request->getGet('emp_code');
if (empty($client_id) || empty($emp_code)) {
$this->myLogger->logme('error', "Missing required parameters: client_id={$client_id}, emp_code={$emp_code}");
// return $this->response->setJSON([
// 'status' => false,
// 'code' => 400,
// 'message' => 'client_id and emp_code are required'
// ])->setStatusCode(400);
$ticket_type = $this->ticketController->ticketType;
$ticket_type = array_map(fn($value, $key) => (object) ['id' => $key, 'name' => $value], array_values($ticket_type), array_keys($ticket_type));
return $this->response->setJSON(['ticket_type' => $ticket_type])->setStatusCode(200);
}
// Get policy type ids
$policy_type_ids = $this->employeePolicyModel
->select('client_policy.policy_type_id')
->join('employees', 'employee_polices.employee_id = employees.id')
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id')
->where('employees.is_active', 1)
->whereIn('employees.emp_status', ['active', 'expired'])
->where('employee_polices.is_active', 1)
->whereIn('employee_polices.status', ['active', 'expired'])
->where('employees.client_id', $client_id)
->where('employees.emp_code', $emp_code)
->groupBy('employee_polices.client_policy_id')
->findAll();
if (!$policy_type_ids) {
$this->myLogger->logme('error', "No policy types found for client_id={$client_id}, emp_code={$emp_code}");
return $this->response->setJSON([
'status' => false,
'code' => 404,
'message' => 'No policy types found'
])->setStatusCode(404);
}
$this->myLogger->logme('info', "Policy type IDs fetched: " . json_encode($policy_type_ids));
$ticket_type = $this->ticketController->ticketType;
$filtered = [];
$mapping = [
2 => 1,
3 => 1,
4 => 1,
5 => 1,
1 => 2,
6 => 3,
7 => 4,
];
foreach ($policy_type_ids as $value) {
$ticketTypeId = $value['policy_type_id'] ?? null;
if (isset($mapping[$ticketTypeId]) && isset($ticket_type[$mapping[$ticketTypeId]])) {
$mappedId = $mapping[$ticketTypeId];
$mappedName = $ticket_type[$mappedId];
// Use mappedId as key to avoid duplicates
$filtered[$mappedId] = [
'id' => $mappedId,
'name' => $mappedName
];
$this->myLogger->logme('info', "Ticket type resolved: ID={$ticketTypeId}, Name={$mappedName}");
} else {
$this->myLogger->logme('warning', "No valid ticket type mapping for policy_type_id={$ticketTypeId}");
}
}
$filtered = array_values($filtered);
return $this->response->setJSON(['status' => true,'code' => 200, 'ticket_type' => $filtered ])->setStatusCode(200);
} catch (\Throwable $e) {
$this->myLogger->logme('error', "Error in get_ticket_type: " . $e->getMessage() . " Trace: " . $e->getTraceAsString());
return $this->response->setJSON([
'status' => false,
'code' => 500,
'message' => 'Internal Server Error'
])->setStatusCode(500);
}
} }
//ticket data //ticket data
public function get_ticket_data() public function get_ticket_data()
{ {
@ -3563,6 +3735,10 @@ class EmployeeRestController extends AdminController
$emp_id = $this->request->getGet('emp_id'); $emp_id = $this->request->getGet('emp_id');
$ticket_type = $this->request->getGet('ticket_type') ?? null; $ticket_type = $this->request->getGet('ticket_type') ?? null;
$ticket_id = $this->request->getGet('ticket_id') ?? null; $ticket_id = $this->request->getGet('ticket_id') ?? null;
$request = \Config\Services::request();
$uri = $request->uri->getPath();
$returnType = "";
// $returnType = (strpos($uri, 'api') !== false) ? 'api' : 'web';
// dd($emp_id); // dd($emp_id);
if (empty($emp_id)) { if (empty($emp_id)) {
@ -3570,7 +3746,7 @@ class EmployeeRestController extends AdminController
} }
$TicketMasterModel = new TicketMasterModel(); $TicketMasterModel = new TicketMasterModel();
$ticket_data = $TicketMasterModel->get_ticket_data($emp_id, $ticket_type, $ticket_id); $ticket_data = $TicketMasterModel->get_ticket_data($emp_id, $returnType, $ticket_type, $ticket_id);
if (!empty($ticket_data)) { if (!empty($ticket_data)) {
@ -3586,6 +3762,7 @@ class EmployeeRestController extends AdminController
]; ];
foreach ($ticket_data as $key => $value) { foreach ($ticket_data as $key => $value) {
foreach ($client_claim_status as $claim_key => $claim_value) { foreach ($client_claim_status as $claim_key => $claim_value) {
if (in_array($value['claim_status_id'], $claim_value)) { // Corrected argument order if (in_array($value['claim_status_id'], $claim_value)) { // Corrected argument order
$ticket_data[$key]['claim_status'] = $claim_key ?? null; // Assign back to the main array $ticket_data[$key]['claim_status'] = $claim_key ?? null; // Assign back to the main array
@ -3600,6 +3777,29 @@ class EmployeeRestController extends AdminController
} }
$ticket_data[$key]['claim_type_value'] = $claimType[$claimPrimaryTypey][$value['claim_type']] ?? null; $ticket_data[$key]['claim_type_value'] = $claimType[$claimPrimaryTypey][$value['claim_type']] ?? null;
$ticket_data[$key]['ticket_policy_type'] = $ticketTypeArray[$value['ticket_type_id']] ?? null; $ticket_data[$key]['ticket_policy_type'] = $ticketTypeArray[$value['ticket_type_id']] ?? null;
$claim_file_urls = [];
if (isset($value['ticket_message_id'])) {
$claimFiles = new ClaimFilesModel();
$claim_files_data = $claimFiles
->select('id as claim_file_id, doc_name as claim_file_name')
->where('is_active', 1)
->where('file_type', 2)
->where('ticket_id', $value['id'])
->where('ticket_message_id', $value['ticket_message_id'])
->findAll();
foreach ($claim_files_data as &$value) {
$value['url'] = base_url('downloadClaimFile/') . $value['claim_file_id'];
$claim_file_urls[] = $value;
}
unset($value);
}
// always set the key (empty if no files found)
$ticket_data[$key]['claim_files'] = $claim_file_urls;
} }
} }
@ -3650,6 +3850,11 @@ class EmployeeRestController extends AdminController
], 200); ], 200);
} }
public function getClaimFiles()
{
$ticket_id = $this->request->getGet('ticket_id');
}
// public function getPreEmployeePolicyCount($mobile_no, $clientId = null) // public function getPreEmployeePolicyCount($mobile_no, $clientId = null)
// { // {
// log_message('error', 'getPreEmployeePolicyCount called with params : ' . json_encode(['mobile_no' => $mobile_no, 'client_id' => $clientId], true)); // log_message('error', 'getPreEmployeePolicyCount called with params : ' . json_encode(['mobile_no' => $mobile_no, 'client_id' => $clientId], true));
@ -3781,4 +3986,272 @@ class EmployeeRestController extends AdminController
return $response->getBody(); return $response->getBody();
} }
//--------------------------------------------------------------------------------------------
public function hrFileUpload()
{
try {
// Check file
$file = $this->request->getFile('file_name');
if (!$file) {
return $this->response->setJSON([
'status' => false,
'message' => "Invalid file or file not uploaded.",
'data' => "No Data"
]);
}
// Upload folder path
$uploadPath = WRITEPATH . 'uploads/hr_files/';
// If directory not exists, create it
if (!is_dir($uploadPath)) {
mkdir($uploadPath, 0777, true);
}
// New file name with timestamp
$newFileName = time() . '_' . $file->getRandomName();
// Move file
$file->move($uploadPath, $newFileName);
// Prepare data
$data = [
'client_id' => $this->request->getPost('client_id'),
'client_branch_id' => $this->request->getPost('client_branch_id'),
'policy_id' => $this->request->getPost('policy_id'),
'policy_no' => $this->request->getPost('policy_no'),
'file_name' => $newFileName,
'file_action' => $this->request->getPost('file_action'),
'status' => 'Yet to start',
'created_by' => $this->request->getPost('created_by'),
'updated_by' => $this->request->getPost('created_by'),
];
// Save into DB
$this->hrFileUploadModel->insert($data);
return $this->respondCreated([
'status' => true,
'message' => 'File uploaded successfully',
'data' => $data
]);
} catch (\Exception $e) {
return $this->failServerError($e->getMessage());
}
}
public function updateHrFileUploadData()
{
try {
$id = $this->request->getPost('id');
if (!$id) {
return $this->failValidationErrors('ID is required for update.');
}
// Prepare data
$data = [
'client_id' => $this->request->getPost('client_id'),
'client_branch_id' => $this->request->getPost('client_branch_id'),
'policy_id' => $this->request->getPost('policy_id'),
'policy_no' => $this->request->getPost('policy_no'),
'file_action' => $this->request->getPost('file_action'),
'status' => $this->request->getPost('status'),
'updated_by' => $this->request->getPost('updated_by'),
];
// Check if record exists
$record = $this->hrFileUploadModel->find($id);
if (!$record) {
return $this->failNotFound("Record with ID {$id} not found.");
}
// Update record
$this->hrFileUploadModel->update($id, $data);
return $this->respond([
'status' => true,
'message' => 'File record updated successfully',
'data' => $data
], 200);
} catch (\Exception $e) {
return $this->failServerError($e->getMessage());
}
}
public function hrFileDownload($id = null)
{
try {
$file_id = $this->request->getGet('id') ?? $id;
// Find record
$record = $this->hrFileUploadModel->where('id',$file_id)->find();
// print_rr( $record);die;
if (!$record) {
return $this->failNotFound("File record not found");
}
$uploadPath = WRITEPATH . 'uploads/hr_files/';
$filePath = $uploadPath . $record[0]['file_name'];
if (!file_exists($filePath)) {
// return $this->failNotFound("File not found on server");
$data['message'] = 'The Physical File Not Found';
return view('errors/404', $data);
}
// Force file download
return $this->response->download($filePath, null)
->setFileName($record[0]['file_name']);
} catch (\Exception $e) {
return $this->failServerError($e->getMessage());
}
}
// public function hrFileList()
// {
// try {
// $request = service('request');
// $builder = $this->hrFileUploadModel
// ->select('hr_file_upload.* , c.short_name , cb.branch_name , lc.name as first_name ');
// // Allowed filter keys
// $filters = [
// 'client_id',
// 'client_branch_id',
// 'policy_no',
// 'file_action',
// 'status',
// 'created_by'
// ];
// // Apply filters dynamically
// foreach ($filters as $key) {
// $value = $request->getGetPost($key); // supports both GET and POST
// if (!empty($value)) {
// $builder->where($key, $value);
// }
// }
// // Fetch results
// $builder->join('clients c', 'c.id = hr_file_upload.client_id AND c.is_active = 1', 'left');
// $builder->join('client_branch cb', 'cb.id = hr_file_upload.client_branch_id AND cb.is_active = 1', 'left');
// $builder->join('level_contacts lc', 'lc.id = hr_file_upload.created_by AND lc.contact_type = "client" AND lc.is_active = 1', 'left');
// $data = $builder->findAll();
// return $this->respond([
// 'status' => true,
// 'message' => 'File list fetched successfully',
// 'data' => $data
// ]);
// } catch (\Exception $e) {
// return $this->failServerError($e->getMessage());
// }
// }
public function hrFileList()
{
try {
$request = service('request');
// Start builder from model
// $builder = $this->hrFileUploadModel
// ->select('hr_file_upload.* , c.short_name , cb.branch_name , lc.name as first_name')
// ->join('clients c', 'c.id = hr_file_upload.client_id AND c.is_active = 1', 'left')
// ->join('client_branch cb', 'cb.id = hr_file_upload.client_branch_id AND cb.is_active = 1', 'left')
// ->join('level_contacts lc', 'lc.id = hr_file_upload.created_by AND lc.contact_type = "client" AND lc.is_active = 1', 'left');
$builder = $this->hrFileUploadModel
->select('
hr_file_upload.id,
hr_file_upload.client_id,
hr_file_upload.client_branch_id,
hr_file_upload.policy_id,
hr_file_upload.policy_no,
hr_file_upload.file_name,
hr_file_upload.file_action,
hr_file_upload.created_at,
hr_file_upload.created_by,
hr_file_upload.updated_at,
hr_file_upload.updated_by,
c.short_name,
cb.branch_name,
lc.name as first_name,
CASE
WHEN f.status IS NULL
THEN hr_file_upload.status
ELSE CONCAT(UCASE(LEFT(f.status, 1)), LCASE(SUBSTRING(f.status, 2)))
END AS status
', false)
->join('clients c', 'c.id = hr_file_upload.client_id AND c.is_active = 1', 'left')
->join('client_branch cb', 'cb.id = hr_file_upload.client_branch_id AND cb.is_active = 1', 'left')
->join('level_contacts lc', 'lc.id = hr_file_upload.created_by AND lc.contact_type = "client" AND lc.is_active = 1', 'left')
->join(
'(SELECT f1.*
FROM files f1
WHERE f1.is_active = 1
ORDER BY f1.id DESC
LIMIT 1) f',
'f.hr_file_id = hr_file_upload.id',
'left'
);
// Allowed filter keys
$filters = [
'client_id',
'client_branch_id',
'policy_id',
'policy_no',
'file_action',
'status',
'created_by'
];
// Apply filters dynamically
foreach ($filters as $key) {
$value = $request->getGetPost($key); // supports both GET and POST
if (!empty($value)) {
$builder->where("hr_file_upload.$key", $value);
}
}
// Execute query
$data = $builder->get()->getResultArray();
return $this->respond([
'status' => "success",
'message' => 'File list fetched successfully',
'data' => $data
]);
} catch (\Exception $e) {
return $this->failServerError($e->getMessage());
}
}
public function hrFileUploadMasters()
{
try {
//for inception upload
$data['actions'] = ['addition' => 'Addition (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
return $this->respond([
'status' => true,
'message' => 'File inception upload masters',
'data' => $data
]);
} catch (\Exception $e) {
return $this->failServerError($e->getMessage());
}
}
} }

View File

@ -1702,6 +1702,15 @@ class EmployeeServiceController extends AdminController
$value['relationship'] = ucfirst(trim($value['relationship'])); $value['relationship'] = ucfirst(trim($value['relationship']));
if(count($employee)) if(count($employee))
{ {
if (isset($employee[0]['email_corporate']) && $employee[0]['email_corporate'] != '')
{
unset($value['email_corporate']);
}
if (isset($employee[0]['mobile']) && $employee[0]['mobile'] != '')
{
unset($value['mobile']);
}
$value['updated_by'] = $file['created_by']; $value['updated_by'] = $file['created_by'];
$value['id'] = $employee[0]['id']; $value['id'] = $employee[0]['id'];
$value['emp_status'] = 'active'; $value['emp_status'] = 'active';

View File

@ -309,7 +309,7 @@ public function convertToPdf($inputFile = null)
{ {
// Customize this based on your needs // Customize this based on your needs
$html = '<h2>' . htmlspecialchars($worksheet->getTitle()) . '</h2>'; $html = '<h2>' . htmlspecialchars($worksheet->getTitle()) . '</h2>';
$html .= '<table border="1" cellpadding="5">'; $html .= '<table data-custom-table-css="table" border="1" cellpadding="5">';
foreach ($worksheet->getRowIterator() as $row) { foreach ($worksheet->getRowIterator() as $row) {
$html .= '<tr>'; $html .= '<tr>';

View File

@ -143,6 +143,30 @@ class JobWorker extends AdminController
'type' => 'CC', // Handler Category 'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\ClientController', 'handler' => 'App\Controllers\ClientController',
], ],
'claimDumpExcelFileFormatValidation' => [
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\TicketServiceController',
],
'claimDumpExcelFileDataValidation' => [
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\TicketServiceController',
],
'claimDumpOnBoardProcess' => [
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\TicketServiceController',
],
'excelMultieventFileFormateValidation' => [
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\EmployeeMultiEventServiceController',
],
'excelMultieventFileDataValidation' => [
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\EmployeeMultiEventServiceController',
],
'excelMultieventFileOnBoard' => [
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\EmployeeMultiEventServiceController',
],
]; ];

View File

@ -31,6 +31,7 @@ use App\Models\InsurerModel;
use App\Models\OccupancyMasterModel; use App\Models\OccupancyMasterModel;
use App\Models\LeadFilesModel; use App\Models\LeadFilesModel;
use App\Models\LeadInstallmentPaymentDetails; use App\Models\LeadInstallmentPaymentDetails;
use App\Models\GmailSentHistoryModel;
use App\Helpers\MailHelper; use App\Helpers\MailHelper;
use App\Helpers\ExcelMergeHelper; use App\Helpers\ExcelMergeHelper;
@ -70,6 +71,7 @@ class LeadsController extends BaseController
protected $occupancyModel; protected $occupancyModel;
protected $leadFilesModel; protected $leadFilesModel;
protected $leadInstallmentPaymentDetails; protected $leadInstallmentPaymentDetails;
protected $gmailSentHistoryModel;
//variables for storing array //variables for storing array
protected $issuer; protected $issuer;
@ -102,6 +104,7 @@ class LeadsController extends BaseController
$this->occupancyModel = new OccupancyMasterModel(); $this->occupancyModel = new OccupancyMasterModel();
$this->leadFilesModel = new LeadFilesModel(); $this->leadFilesModel = new LeadFilesModel();
$this->leadInstallmentPaymentDetails = new LeadInstallmentPaymentDetails(); $this->leadInstallmentPaymentDetails = new LeadInstallmentPaymentDetails();
$this->gmailSentHistoryModel = new GmailSentHistoryModel();
$this->issuer = [1 => 'JIBS', 2 => 'Nhance']; $this->issuer = [1 => 'JIBS', 2 => 'Nhance'];
$this->clientType = [1 => 'Group', 2 => 'Individual']; $this->clientType = [1 => 'Group', 2 => 'Individual'];
@ -383,6 +386,20 @@ class LeadsController extends BaseController
$data['source_policy_end_date'] = null; $data['source_policy_end_date'] = null;
} }
//convert the date
if (!empty($data['next_reminder_date'])) {
$data['next_reminder_date'] = change_date_format($data['next_reminder_date']);
} else {
$data['next_reminder_date'] = null;
}
//convert 0 and 1
if (isset($data['is_insurer_auto_mail'])) {
$data['is_insurer_auto_mail'] = 1;
} else {
$data['is_insurer_auto_mail'] = 0;
}
// $file_name = file_Upload($files[$index], $uploadFilePath); // $file_name = file_Upload($files[$index], $uploadFilePath);
$last_3_years_claims = $data['finyear']; $last_3_years_claims = $data['finyear'];
@ -459,9 +476,12 @@ class LeadsController extends BaseController
'lead_form_type' => $data['lead_form_type'] ?? 1, 'lead_form_type' => $data['lead_form_type'] ?? 1,
'custom_fields' => $data['custom_fields'] ?? null, 'custom_fields' => $data['custom_fields'] ?? null,
'source_policy_start_date' => $data['source_policy_start_date'] ?? null, 'source_policy_start_date' => $data['source_policy_start_date'] ?? null,
'source_policy_end_date' => $data['source_policy_end_date'] ?? null, 'source_policy_end_date' => $data['source_policy_end_date'] ?? null,
'claim_history' => $data['claim_history'] ?? 0 'claim_history' => $data['claim_history'] ?? 0,
'next_reminder_date' => $data['next_reminder_date'] ?? 0,
'is_insurer_auto_mail' => $data['is_insurer_auto_mail'] ?? 0
]; ];
} }
// print_r($processedData);die(); // print_r($processedData);die();
@ -856,21 +876,40 @@ class LeadsController extends BaseController
$qcr_created = true; $qcr_created = true;
} }
if (($data['submit_type'] ?? "") == 'QCR') { $quote_received_insurer = [];
if (($data['submit_type'] ?? "") === 'QCR') {
$inputJson = json_decode($data['json'], true); $inputJson = json_decode($data['json'], true);
$proposal_data = array_pop($inputJson); $proposal_data = $inputJson['proposal_data'] ?? array_pop($inputJson);
if (isset($proposal_data['proposal_data']['over_all_column_data'])) {
$proposel_count = $proposal_data['proposal_data']['over_all_column_data']; if (isset($proposal_data['over_all_column_data'])) {
$proposel_count = $proposal_data['over_all_column_data'];
$this->myLogger->logme("error", "insurer id : " . json_encode($proposel_count));
foreach ($proposel_count as $key => $value) { foreach ($proposel_count as $key => $value) {
if (!empty($value['insurers'])) { if (!empty($value['insurers'])) {
$qcr_created = true; $qcr_created = true;
foreach ($value['insurers'] as $insurer => $id) {
if (!empty($id['id'])) {
$quote_received_insurer[] = $id['id'];
}
}
} }
} }
} }
} }
$this->myLogger->logme("error", "quote_received_insurer : " . json_encode($quote_received_insurer));
$data['type'] = 1; $data['type'] = 1;
//update the quote received insurer data to the lead
if(count($quote_received_insurer) != 0){
$this->leadsModel->update($lead_id, ['quote_received_insurer' => json_encode($quote_received_insurer ?? [])]);
$this->myLogger->logme("error", "quote_received_insurer data updated in the lead: " . json_encode($quote_received_insurer));
}
// Deactivate existing RFQs for this lead and type // Deactivate existing RFQs for this lead and type
if (!isset($data['rfq_primaryKey']) && empty($data['rfq_primaryKey'])) { if (!isset($data['rfq_primaryKey']) && empty($data['rfq_primaryKey'])) {
$this->RFQModel $this->RFQModel
@ -2552,6 +2591,21 @@ class LeadsController extends BaseController
$from_mail = "bs@nhanceindia.in"; $from_mail = "bs@nhanceindia.in";
} }
$type = "";
$insurer_ids = null;
if (in_array($recipient_type, ['placement'])) {
$type = "placement";
} else if (in_array($recipient_type, ['insurer'])) {
$type = "insurer";
$insurer_ids = json_decode($params['insurer_ids'] ?? "", true) ?? [];
}else if (in_array($recipient_type, ['internal'])) {
$type = "internal";
}else if (in_array($recipient_type, ['client'])) {
$type = "client";
}
// print_r($insurer_ids); die;
if ($recipient_type === 'placement') { if ($recipient_type === 'placement') {
$lead_data = $this->leadsModel->find($lead_id); $lead_data = $this->leadsModel->find($lead_id);
@ -2733,7 +2787,7 @@ class LeadsController extends BaseController
$subject = $file_type == 'rfq' ? 'Request for Quotation from ' . $lead_data['client_name'] . ' for ' . $lead_data['policy_type'] : 'Quotation Comparison Report for ' . $lead_data['policy_type']; $subject = $file_type == 'rfq' ? 'Request for Quotation from ' . $lead_data['client_name'] . ' for ' . $lead_data['policy_type'] : 'Quotation Comparison Report for ' . $lead_data['policy_type'];
$original_message = '<div style="width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9;font-family:Arial,sans-serif;color:#333;line-height:1.6"><div style=background-color:#4a90e2;color:#fff;padding:15px;text-align:center><h1 style=margin:0;font-size:24px>Request for Quotation (RFQ)</h1></div><div style=padding:20px;background-color:#fff><h2 style=color:#4a90e2;font-size:20px;margin-top:0>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2 style=color:#4a90e2;font-size:20px;margin-top:20px>RFQ Details</h2><table style=width:100%;border-collapse:collapse;margin-top:20px><tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Client name<td style="border:1px solid #ddd;padding:10px;text-align:left">{{CLIENT_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Coverage Type<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_LONG_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Start Date<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_START_DATE}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Duration<td style="border:1px solid #ddd;padding:10px;text-align:left">{{DURATION}}</table><div style="margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic">Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div style=margin-top:20px;font-size:12px;color:#777;text-align:center><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>'; $original_message = '<div style="width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9;font-family:Arial,sans-serif;color:#333;line-height:1.6"><div style=background-color:#4a90e2;color:#fff;padding:15px;text-align:center><h1 style=margin:0;font-size:24px>Request for Quotation (RFQ)</h1></div><div style=padding:20px;background-color:#fff><h2 style=color:#4a90e2;font-size:20px;margin-top:0>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2 style=color:#4a90e2;font-size:20px;margin-top:20px>RFQ Details</h2><table data-custom-table-css="table" style=width:100%;border-collapse:collapse;margin-top:20px><tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Client name<td style="border:1px solid #ddd;padding:10px;text-align:left">{{CLIENT_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Coverage Type<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_LONG_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Start Date<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_START_DATE}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Duration<td style="border:1px solid #ddd;padding:10px;text-align:left">{{DURATION}}</table><div style="margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic">Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div style=margin-top:20px;font-size:12px;color:#777;text-align:center><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
//for mail content //for mail content
if (!empty($mail_content)) { if (!empty($mail_content)) {
@ -2746,10 +2800,14 @@ class LeadsController extends BaseController
} }
// print_r($subject); die; // print_r($subject); die;
$common = ['module' => "leads", 'pk' => $lead_id, 'mail_type' => $type, 'common' => null];
if ($recipient_data) { if ($recipient_data) {
foreach ($recipient_data as $recipient) { foreach ($recipient_data as $position => $recipient) {
if ($recipient_type == 'insurer'){
$common['common'] = $insurer_ids[$position] ?? null;
}
$message = $original_message; $message = $original_message;
$message = str_replace("{{RECIPIENT_NAME}}", $recipient['name'] != "" ? $recipient['name'] : " ", $message); $message = str_replace("{{RECIPIENT_NAME}}", $recipient['name'] != "" ? $recipient['name'] : " ", $message);
$message = str_replace("{{CLIENT_NAME}}", $lead_data['client_name'] != "" ? $lead_data['client_name'] : "", $message); $message = str_replace("{{CLIENT_NAME}}", $lead_data['client_name'] != "" ? $lead_data['client_name'] : "", $message);
@ -2761,7 +2819,7 @@ class LeadsController extends BaseController
$string = implode(", ", $cc_mails); $string = implode(", ", $cc_mails);
$bcc_string = implode(", ", $bcc_mails); $bcc_string = implode(", ", $bcc_mails);
$res = MailHelper::send_email(['from_mail' => $from_mail, 'mail' => $recipient['email'], 'cc' => $string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string]); $res = MailHelper::send_email(['from_mail' => $from_mail, 'mail' => $recipient['email'], 'cc' => $string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string, 'common' => $common]);
// !dd($res); // !dd($res);
$result_data[] = ['mail' => $recipient['email'], 'status' => $res]; $result_data[] = ['mail' => $recipient['email'], 'status' => $res];
} }
@ -3539,10 +3597,11 @@ class LeadsController extends BaseController
$message = str_replace("{{POLICY_YEAR}}", $policy_year, $message); $message = str_replace("{{POLICY_YEAR}}", $policy_year, $message);
$message = str_replace("{{POLICY_END_DATE}}", " (Due On " . $formatted_policy . ")", $message); $message = str_replace("{{POLICY_END_DATE}}", " (Due On " . $formatted_policy . ")", $message);
$message = str_replace("{{LOGGED_USER_NAME}}", ucfirst($logged_user_data['first_name']) . " " . ucfirst($logged_user_data['last_name']), $message);
$message = str_replace("{{LOGGED_USER_EMAIL}}", $logged_user_data['email'], $message); $message = str_replace("{{LOGGED_USER_NAME}}", ucfirst($logged_user_data['first_name'] ?? "") . " " . ucfirst($logged_user_data['last_name'] ?? ""), $message);
$message = str_replace("{{LOGGED_USER_MOBILE}}", $logged_user_data['mobile'], $message); $message = str_replace("{{LOGGED_USER_EMAIL}}", $logged_user_data['email'] ?? "", $message);
$message = str_replace("{{LOGO_PATH}}", $log_path, $message); $message = str_replace("{{LOGGED_USER_MOBILE}}", $logged_user_data['mobile'] ?? "", $message);
$message = str_replace("{{LOGO_PATH}}", $log_path ?? "", $message);
return $message; return $message;
} else { } else {
@ -3627,7 +3686,7 @@ class LeadsController extends BaseController
} }
if (!empty($data['lead_edit_data'])) { if (!empty($data['lead_edit_data'])) {
foreach (['policy_start_date', 'policy_end_date', 'source_policy_start_date', 'source_policy_end_date', 'incurred_claims_date'] as $dateField) { foreach (['policy_start_date', 'policy_end_date', 'source_policy_start_date', 'source_policy_end_date', 'incurred_claims_date', 'next_reminder_date'] as $dateField) {
$data['lead_edit_data'][$dateField] = !empty($data['lead_edit_data'][$dateField]) $data['lead_edit_data'][$dateField] = !empty($data['lead_edit_data'][$dateField])
? change_date_format($data['lead_edit_data'][$dateField], 'Y-m-d', 'd/m/Y') ? change_date_format($data['lead_edit_data'][$dateField], 'Y-m-d', 'd/m/Y')
: null; : null;
@ -3657,6 +3716,28 @@ class LeadsController extends BaseController
return $this->loadLayout('leads_form_handler', $data); return $this->loadLayout('leads_form_handler', $data);
} }
public function getLeadEmailHistory($id){
if(!empty($id)){
$result = $this->gmailSentHistoryModel
->where('pk', $id)
->where('module',"leads")
->orderBy('created_at', 'desc')
->findAll();
if(!empty($result)){
$result = !empty($result) ? $result : [];
return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(200);
}else{
return $this->response->setJSON((['status' => 'error', 'message' => 'No History found']))->setStatusCode(400);
}
}else{
return $this->response->setJSON((['status' => 'error', 'message' => 'ID not found']))->setStatusCode(404);
}
// Select * from gmail_sent_history where pk != "" and module = "leads";
// echo $id;
}
public function getPolicyTypeFields() public function getPolicyTypeFields()
{ {
@ -4866,7 +4947,7 @@ class LeadsController extends BaseController
// Start table with clean styling // Start table with clean styling
$html .= "<h3 style='color: #333; font-weight: 500; margin-bottom: 15px;'>{$category}</h3>"; $html .= "<h3 style='color: #333; font-weight: 500; margin-bottom: 15px;'>{$category}</h3>";
$html .= "<table style='width: 100%; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px;'>"; $html .= "<table data-custom-table-css='table' style='width: 100%; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px;'>";
// Table header with light background // Table header with light background
$html .= "<tr>"; $html .= "<tr>";
@ -4893,4 +4974,197 @@ class LeadsController extends BaseController
return $html; return $html;
} }
// function for insurer remainder mail cron job
public function remainderForQcr()
{
$lead_data = $this->leadsModel
->select(
'leads.*,
user_profiles.email as created_person_email,
policy_type.policy_type,
policy_type.long_name
')
->join('policy_type', 'leads.policy_type_id = policy_type.id')
->join('user_profiles', 'leads.created_by = user_profiles.id', 'left')
->where('leads.is_active', 1)
->where('user_profiles.is_active', 1)
->whereIn('leads.status', ['rfq_sent', 'qcr_created'])
->where('leads.next_reminder_date', date('Y-m-d'))
->findAll();
// dd($lead_data);
if (count($lead_data) == 0) {
$this->myLogger->logme("info", "No leads found for reminder mail at " . date('Y-m-d H:i:s'));
print_r(["status" => true, "message" => "There is no data to send reminder mail"]);
return ["status" => true, "message" => "There is no data to send reminder mail"];
}
$from_mail = "im@nhanceindia.in";
$subject = "Reminder for RFQ";
$content_string = '
<p>Dear Sir,</p>
<p>Greetings from Nhance India!</p>
<p>This is a gentle reminder regarding our earlier mail about the RFQ for the <strong>{{POLICY_TYPE}}</strong> policy pertaining to <strong>{{CLIENT_NAME}}</strong>.</p>
<p>We kindly request you to share the competitive quotes at the earliest possible convenience.</p>
<p>In case of any clarification, please feel free to contact us.</p>
<p>Thank you for your prompt attention to this matter.</p><br>
<p>Best regards,</p>
<p><strong>Nhance India</strong></p>
';
$reminder_sended_lead = [];
foreach ($lead_data as $lead) {
$leadId = $lead['id'];
$reply_to = $lead['created_person_email'] ?? "";
if (isset($lead['policy_end_date']) && $lead['policy_end_date'] != null) {
$subject = "{{CLIENT_NAME}} _ {{POLICY_TYPE}} _ {{RFQ_OR_QCR}} _ {{POLICY_YEAR}} {{POLICY_END_DATE}}";
} else {
$subject = "{{CLIENT_NAME}} _ {{POLICY_TYPE}} _ {{RFQ_OR_QCR}} _ {{POLICY_YEAR}}";
}
$mail_content = $this->transformMailContent($lead, $content_string, "RFQ");
$mail_subject = $this->transformMailContent($lead, $subject, "RFQ");
$this->myLogger->logme("info", "Processing lead_id={$leadId} for reminder mails");
// get sales person + created_by emails
$sales_person_emails = $this->userModel
->select('email')
->where('is_active', 1)
->whereIn('id', json_decode($lead['salse_person_id'] ?? "[]", true))
->findAll();
$email_list = array_column($sales_person_emails, 'email');
if (!empty($reply_to)) {
$email_list[] = $reply_to;
}
$email_list = array_filter(array_unique($email_list));
$email_string = implode(',', $email_list);
// Get latest sent mail timestamp
$createdAtRow = $this->gmailSentHistoryModel
->select("DATE_FORMAT(created_at, '%Y-%m-%d %H:%i') as created_at", false)
->where('isactive', 1)
->where('mail_type', 'insurer')
->where('pk', $leadId)
->orderBy('id', 'desc')
->first();
// dd(db_connect()->getLastQuery(), $createdAtRow);
if (!$createdAtRow) {
$this->myLogger->logme("warning", "No sent history found for lead_id={$leadId}, skipping...");
continue;
}
$createdAt = $createdAtRow['created_at'];
// Fetch mail data for that timestamp
$mail_datas = $this->gmailSentHistoryModel
->where('isactive', 1)
->where('mail_type', "insurer")
->where('pk', $leadId)
->where("DATE_FORMAT(created_at, '%Y-%m-%d %H:%i')", $createdAt)
->findAll();
if (empty($mail_datas)) {
$this->myLogger->logme("warning", "No mail data found for lead_id={$leadId} at created_at={$createdAt}");
continue;
}
// Filter only pending insurers
$quote_received_insurer = json_decode($lead['quote_received_insurer'] ?? "[]", true);
$reminder_mail_data = [];
if (empty($quote_received_insurer)) {
$reminder_mail_data = $mail_datas;
} else {
foreach ($mail_datas as $mail_value) {
$insurer_id = $mail_value['common'] ?? "";
if (!in_array($insurer_id, $quote_received_insurer)) {
$reminder_mail_data[] = $mail_value;
}
}
}
// dd($reminder_mail_data);
if (empty($reminder_mail_data)) {
$this->myLogger->logme("info", "All insurers already responded for lead_id={$leadId}, no reminder needed");
continue;
}
$this->myLogger->logme("info", "Sending " . count($reminder_mail_data) . " reminder mail(s) for lead_id={$leadId}");
$common = ['module' => "leads", 'pk' => $leadId, 'mail_type' => "remainder", 'common' => null];
foreach ($reminder_mail_data as $content) {
$insurerId = $content['common'] ?? null;
$common['common'] = $insurerId;
try {
if ($lead['is_insurer_auto_mail'] == 1) {
// send reminder to insurer
$res = MailHelper::send_email([
'from_mail' => $from_mail,
'mail' => $content['mail'] ?? "",
'cc' => json_decode($content['cc'] ?? "", true) ?? "",
'subject' => $mail_subject ?? "",
'message' => $mail_content ?? "",
'reply_to' => $reply_to,
'bcc' => json_decode($content["bcc"] ?? "", true) ?? "",
'common' => $common
]);
$this->myLogger->logme("info", "Reminder mail sent to the insurer | lead_id={$leadId}, insurer_id={$insurerId}, response=" . json_encode($res));
$reminder_sended_lead[] = [
'lead_id' => $leadId,
'insurer_id' => $insurerId,
'response' => $res
];
} else{
$this->myLogger->logme("info", "Reminder mail disable for this lead_id={$leadId}");
}
} catch (\Throwable $e) {
$errorDetails = [
'error_message' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
'stack_trace' => $e->getTraceAsString(),
];
$this->myLogger->logme("error", "Exception while sending reminder | lead_id={$leadId}, insurer_id={$insurerId}, error=" . json_encode($errorDetails));
$reminder_sended_lead[] = [
'lead_id' => $leadId,
'insurer_id' => $insurerId,
'response' => ['status' => false, 'error' => $errorDetails]
];
}
// send reminder to sales person / creator only
$internal_mail_response = MailHelper::send_email([
'mail' => $from_mail,
'cc' => $email_string,
'subject' => $mail_subject ?? "",
'message' => $mail_content ?? "",
'common' => $common
]);
$this->myLogger->logme("info", "Reminder mail sent to sales persons | lead_id={$leadId}, recipients={$email_string}, response=" . json_encode($internal_mail_response));
}
}
return ['status' => true, "data" => $reminder_sended_lead];
}
} }

View File

@ -1798,7 +1798,7 @@ class MasterController extends AdminController
$email_id = CLI::getOption('to') ? CLI::getOption('to') : $email_id; $email_id = CLI::getOption('to') ? CLI::getOption('to') : $email_id;
// print_r($email_id);die(); // print_r($email_id);die();
// $gmailapi = \Config\Services::gmailapi(); // $gmailapi = \Config\Services::gmailapi();
$message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>'; $message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table data-custom-table-css="table" class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
// $attachments = [ // $attachments = [
// ["filePath" => WRITEPATH."uploads/excel/sample/correction.xls","fileName" => "correction.xls"], // ["filePath" => WRITEPATH."uploads/excel/sample/correction.xls","fileName" => "correction.xls"],
@ -1821,7 +1821,7 @@ class MasterController extends AdminController
public function testZeptoSMTP() public function testZeptoSMTP()
{ {
$message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>'; $message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table data-custom-table-css="table" class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
$attachments = [ $attachments = [
["filePath" => ROOTPATH . "public/sample_excel/sample_addition.xls", "fileName" => "sample_addition.xls"], ["filePath" => ROOTPATH . "public/sample_excel/sample_addition.xls", "fileName" => "sample_addition.xls"],
["filePath" => ROOTPATH . "public/sample_excel/sample_inception.xls", "fileName" => "sample_inception.xls"], ["filePath" => ROOTPATH . "public/sample_excel/sample_inception.xls", "fileName" => "sample_inception.xls"],
@ -1894,6 +1894,8 @@ class MasterController extends AdminController
'cache' => WRITEPATH . 'cache', 'cache' => WRITEPATH . 'cache',
'sample_import_excel' => ROOTPATH . 'public/sample_import_excel', 'sample_import_excel' => ROOTPATH . 'public/sample_import_excel',
'lead_files' => WRITEPATH . 'uploads/lead_files/', 'lead_files' => WRITEPATH . 'uploads/lead_files/',
'claim_files' => WRITEPATH . 'uploads/claim_files/',
'claim_dump_excel' => WRITEPATH . 'uploads/claim_dump_excel/',
'claim_sample_forms' => ROOTPATH . 'public/claim_sample_forms/', 'claim_sample_forms' => ROOTPATH . 'public/claim_sample_forms/',
]; ];
@ -1973,7 +1975,7 @@ class MasterController extends AdminController
public function sendMutipleToEmails() public function sendMutipleToEmails()
{ {
$message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>'; $message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table data-custom-table-css="table" class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
$attachments = [ $attachments = [
["filePath" => ROOTPATH . "public/sample_excel/sample_addition.xls", "fileName" => "sample_addition.xls"], ["filePath" => ROOTPATH . "public/sample_excel/sample_addition.xls", "fileName" => "sample_addition.xls"],
["filePath" => ROOTPATH . "public/sample_excel/sample_inception.xls", "fileName" => "sample_inception.xls"], ["filePath" => ROOTPATH . "public/sample_excel/sample_inception.xls", "fileName" => "sample_inception.xls"],

View File

@ -87,6 +87,8 @@ class NotificationController extends AdminController
'client_hr_summary_mail_btn' 'client_hr_summary_mail_btn'
]; ];
$data = []; $data = [];
$emptyTemplate = [];
$updatedTemplate = [];
foreach ($checkboxNames as $checkboxName) foreach ($checkboxNames as $checkboxName)
{ {
@ -111,9 +113,31 @@ class NotificationController extends AdminController
$id = $find['id']; $id = $find['id'];
$changeData['enabled']= $value; $changeData['enabled']= $value;
$update = $notificationModel->update($id, $changeData); $update = $notificationModel->update($id, $changeData);
$updatedTemplate [] = $key;
}
if(!$find && $value == 1){
$emptyTemplate [] = $key;
} }
} }
return json_encode("true");
if(count($emptyTemplate) > 0){
return $this->response->setJSON([
'status' => false,
'code' => 400,
'message' => 'Notification settings updation Failed.',
'updated_templates' => $updatedTemplate,
'empty_templates' => $emptyTemplate
]);
}
return $this->response->setJSON([
'status' => true,
'code' => 200,
'message' => 'Notification settings updated successfully.',
'updated_templates' => $updatedTemplate,
'empty_templates' => $emptyTemplate
]);
} }
// This for Load the Template Data for in View Page // This for Load the Template Data for in View Page

View File

@ -248,12 +248,14 @@ class PolicyTransactionController extends BaseController
// policy Transaction Create function start // policy Transaction Create function start
public function createInceptionPolicy() public function createInceptionPolicy()
{ {
// print_r($this->request->getPost()); die; $post_data = $this->request->getPost() ?? [];
$this->myLogger->logme('error', 'Policy Trancaction form data : '. json_encode($post_data));
$id = $this->request->getPost('id'); $id = $this->request->getPost('id');
$data = $this->preparePolicyData(); $data = $this->preparePolicyData();
$data['cd_ac_pk'] = $this->request->getPost('cd_ac_no'); $data['cd_ac_pk'] = $this->request->getPost('cd_ac_no');
// print_r($this->request->getPost()); die; $this->myLogger->logme('error', 'Policy Trancaction modified form data ( insert data ) : '. json_encode($data));
if (!$id) { if (!$id) {
@ -381,7 +383,12 @@ class PolicyTransactionController extends BaseController
} }
$client_data = $this->clientModel->where('id', $data['client_id'])->first(); $client_data = $this->clientModel->where('id', $data['client_id'])->first();
$data['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $data['client_id'])->findAll(); $data['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $data['client_id'])->findAll();
$clientController = new ClientController();
$data['client_kyc_primary_table'] = $clientController->generateKycPrimaryTable($data['client_id']);
$data['client_kyc_other_table'] = $clientController->generateKycOthersTable($data['client_id']);
$data['entity_type_id'] = $client_data['entity_type_id']; $data['entity_type_id'] = $client_data['entity_type_id'];
return $this->respondSuccess($insert, "Policy transaction created successfully", $data); return $this->respondSuccess($insert, "Policy transaction created successfully", $data);
@ -431,6 +438,11 @@ class PolicyTransactionController extends BaseController
$client_data = $this->clientModel->where('id', $data['client_id'])->first(); $client_data = $this->clientModel->where('id', $data['client_id'])->first();
$data['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $data['client_id'])->findAll(); $data['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $data['client_id'])->findAll();
$clientController = new ClientController();
$data['client_kyc_primary_table'] = $clientController->generateKycPrimaryTable($data['client_id']);
$data['client_kyc_other_table'] = $clientController->generateKycOthersTable($data['client_id']);
$data['entity_type_id'] = $client_data['entity_type_id']; $data['entity_type_id'] = $client_data['entity_type_id'];
return $this->respondSuccess($id, "Policy transaction updated successfully", $data); return $this->respondSuccess($id, "Policy transaction updated successfully", $data);
@ -975,7 +987,12 @@ class PolicyTransactionController extends BaseController
->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left') ->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
->where('employees.client_id', $data['client_id']) ->where('employees.client_id', $data['client_id'])
->where('employees.is_active', 1)->findAll(); ->where('employees.is_active', 1)->findAll();
$data['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $data['client_id'])->findAll(); // $data['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $data['client_id'])->findAll();
$clientController = new ClientController();
$data['client_kyc_primary_table'] = $clientController->generateKycPrimaryTable($data['client_id']);
$data['client_kyc_other_table'] = $clientController->generateKycOthersTable($data['client_id']);
$data['vehicle_docs'] = $this->clientKYCDocsModel $data['vehicle_docs'] = $this->clientKYCDocsModel
->where('client_id', $data['client_id']) ->where('client_id', $data['client_id'])
->where('vehicle_id', $data['vehicle_id']) ->where('vehicle_id', $data['vehicle_id'])
@ -995,8 +1012,16 @@ class PolicyTransactionController extends BaseController
if ($id) { if ($id) {
$data['is_active'] = 0; $data['is_active'] = 0;
$this->policyTransactionModel->where('id', $id)->set($data)->update(); $policy_transaction_data = $this->policyTransactionModel->where('id', $id)->first();
$this->PTCOShareDetailsModel->where('pt_id', $id)->set($data)->update(); if($policy_transaction_data['policy_type_id'] > 7){
$this->policyTransactionModel->where('id', $id)->set($data)->update();
$this->PTCOShareDetailsModel->where('pt_id', $id)->set($data)->update();
$this->clientPolicyModel->where('id', $policy_transaction_data['client_policy_id'])->set($data)->update();
$this->policyTransactionModel->where('client_policy_id', $policy_transaction_data['client_policy_id'])->set($data)->update();
}else{
$this->policyTransactionModel->where('id', $id)->set($data)->update();
$this->PTCOShareDetailsModel->where('pt_id', $id)->set($data)->update();
}
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Policy Transaction removed successfully'], 200); return $this->respond(['status' => true, 'code' => 200, 'message' => 'Policy Transaction removed successfully'], 200);
} else { } else {

View File

@ -0,0 +1,239 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use App\Models\EmployeePolicyModel;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\API\ResponseTrait;
use Dompdf\Dompdf;
use Dompdf\Options;
class TestingController extends BaseController
{
use ResponseTrait;
protected $myLogger;
public function __construct()
{
$this->myLogger = \Config\Services::mylogger();
}
public function saveForm()
{
// Get JSON input
$data = $this->request->getPost();
// For testing: just return the received data
return $this->respond([
'status' => 'success',
'message' => 'Form data received successfully!',
'data' => $data
]);
}
public function testcli()
{
echo "hi";
$this->myLogger->logme('error', "test log");
echo "hi 2";
log_message('error', 'test message for log_message_function');
echo "hi 3";
}
public function generatePDF()
{
// Sample data - replace with your actual data source
$data = [
'NAME' => 'John Doe',
'GENDER' => 'Male',
'DOB' => '01/01/1990',
'RELATION' => 'Self',
'POLICY_NO' => 'POL123456789',
'TPA_ID' => 'TPA987654321',
'POLICY_START_DATE' => '01/01/2024',
'POLICY_DATE' => '31/12/2024',
'INSURER_NAME' => 'ABC Insurance Co.',
'TPA_NAME' => 'XYZ TPA Ltd.',
'FRONT_CARD' => base_url('assets/images/front-card.jpg'), // Your card images
'BACK_CARD' => base_url('assets/images/back-card.jpg'),
'LEVELS' => 'Level 1: 1800-XXX-XXXX<br>Level 2: support@company.com'
];
// Load the HTML template
$html = $this->loadTemplate($data);
// Configure DomPDF options
$options = new Options();
$options->set('isRemoteEnabled', true); // Enable loading of remote images
$options->set('isHtml5ParserEnabled', true);
$options->set('isPhpEnabled', true);
$options->set('debugPng', false);
$options->set('debugKeepTemp', false);
$options->set('debugCss', false);
$options->set('debugLayout', false);
$options->set('debugLayoutLines', false);
$options->set('debugLayoutBlocks', false);
$options->set('debugLayoutInline', false);
$options->set('debugLayoutPaddingBox', false);
// Initialize DomPDF
$dompdf = new Dompdf($options);
// Load HTML content
$dompdf->loadHtml($html);
// Set paper size and orientation
$dompdf->setPaper('A4', 'landscape'); // or 'portrait'
// Render PDF
$dompdf->render();
// Output PDF to browser
$filename = 'ecard_' . date('Y-m-d_H-i-s') . '.pdf';
$dompdf->stream($filename, ['Attachment' => true]); // Set to false for inline view
}
public function viewPDF()
{
// Same as generatePDF but with inline view
$data = [
'NAME' => 'Korukonda Naga Venkata Ramalinga Satya Swarna Kumari',
'GENDER' => 'Male',
'DOB' => '01/01/1990',
'RELATION' => 'Self',
'POLICY_NO' => '97000034230400000109_EX_Parental',
'TPA_ID' => 'TPA987654321',
'POLICY_START_DATE' => '01/01/2024',
'POLICY_DATE' => '31/12/2024',
'INSURER_NAME' => 'ZURICH KOTAK GTNERAL INSURANCE COIIPANY lNDlA LIMITED',
'TPA_NAME' => 'HealthIndia Insurance TPA Services Pvt. Ltd.',
'FRONT_CARD' => base_url() .('public/uploads/template_bg/Nhance_Ecard_working_1_front_3.png'),
'BACK_CARD' => base_url() . ('public/uploads/template_bg/Nhance_Ecard_working_1_Back_3.png'),
'LEVELS' => 'Level 1: 1800-XXX-XXXX<br>Level 2: support@company.com'
];
$data2 = [
'NAME' => 'John Doe',
'GENDER' => 'Male',
'DOB' => '01/01/1990',
'RELATION' => 'Self',
'POLICY_NO' => 'POL123456789',
'TPA_ID' => 'TPA987654321',
'POLICY_START_DATE' => '01/01/2024',
'POLICY_DATE' => '31/12/2024',
'INSURER_NAME' => 'ABC Insurance Co.',
'TPA_NAME' => 'XYZ TPA Ltd.',
'FRONT_CARD' => base_url() .('public/uploads/template_bg/Nhance_Ecard_working_1_front_3.png'),
'BACK_CARD' => base_url() . ('public/uploads/template_bg/Nhance_Ecard_working_1_Back_3.png'),
'LEVELS' => 'Level 1: 1800-XXX-XXXX<br>Level 2: support@company.com'
];
$employeeController = new EmployeeController();
// $html = $employeeController->generateIDCardForEmployeeUsingDom('LfpH3R');
$html = $this->loadTemplate($data2);
// print_r($html); die;
$options = new Options();
$options->set('isRemoteEnabled', true);
$options->set('isHtml5ParserEnabled', true);
$dompdf = new Dompdf($options);
// $dompdf->loadHtml($html);
$dompdf->loadHtml('<style>@page { margin: 0; }</style>' . $html);
$dompdf->setPaper('A4', 'portrait');
// $dompdf->setPaper('A4', 'landscape');
$dompdf->render();
$filename = 'ecard_' . date('Y-m-d_H-i-s') . '.pdf';
// $dompdf->stream($filename, ['Attachment' => true]); // Inline view
$dompdf->stream($filename, ['Attachment' => false]); // Force download
}
private function loadTemplate($data)
{
// Load your HTML template
$template = file_get_contents(WRITEPATH . 'e_card_template/common.html');
// Replace placeholders with actual data
foreach ($data as $key => $value) {
$template = str_replace('{' . $key . '}', $value, $template);
}
return $template;
}
// not using and not working
public function viewPdfUsingMpdf()
{
$data = [
'NAME' => 'Korukonda Naga Venkata Ramalinga Satya Swarna Kumari',
'GENDER' => 'Male',
'DOB' => '01/01/1990',
'RELATION' => 'Self',
'POLICY_NO' => '97000034230400000109_EX_Parental',
'TPA_ID' => 'TPA987654321',
'POLICY_START_DATE' => '01/01/2024',
'POLICY_DATE' => '31/12/2024',
'INSURER_NAME' => 'ZURICH KOTAK GTNERAL INSURANCE COIIPANY lNDlA LIMITED',
'TPA_NAME' => 'HealthIndia Insurance TPA Services Pvt. Ltd.',
'FRONT_CARD' => base_url('public/uploads/template_bg/Nhance_Ecard_working_1_front_3.png'),
'BACK_CARD' => base_url('public/uploads/template_bg/Nhance_Ecard_working_1_Back_3.png'),
'LEVELS' => 'Level 1: 1800-XXX-XXXX<br>Level 2: support@company.com'
];
$html = $this->loadTemplate($data);
// Load mPDF
$mpdf = "";
// $mpdf = new \Mpdf\Mpdf([
// 'mode' => 'utf-8',
// 'format' => 'A4',
// 'margin_left' => 0,
// 'margin_right' => 0,
// 'margin_top' => 0,
// 'margin_bottom' => 0,
// 'tempDir' => __DIR__ . '/writable/mpdf'
// ]);
// Optional: Stretch background or images fully
// $html = '
// <style>
// body { margin:0; padding:0; }
// @page { margin:0; }
// </style>' . $html;
// $mpdf->WriteHTML($html);
// // Output inline (no download prompt)
// $filename = 'ecard_' . date('Y-m-d_H-i-s') . '.pdf';
// $mpdf->Output($filename, 'D');
/*
'I' = inline view in browser (no download prompt).
'D' = force download.
'F' = save to file.
'S' = return as string.
*/
}
public function getEmployeePolicyTypes($client_id, $emp_code, $emp_id)
{
$employeePolicy = new EmployeePolicyModel();
$data = $employeePolicy
->select('client_policy.policy_type_id')
->join('employees', 'employee_polices.employee_id = employees.id')
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id')
->where('employees.is_active', 1)
->where('employees.emp_status', ['active', 'expired'])
->where('employee_polices.is_active', 1)
->where('employee_polices.status', ['active', 'expired'])
->where('employees.client_id', $client_id)
->where('employees.emp_code', $emp_code)
->groupBy('employee_polices.client_policy_id')
->findAll();
}
}

View File

@ -3,25 +3,52 @@
namespace App\Controllers; namespace App\Controllers;
use App\Controllers\BaseController; use App\Controllers\BaseController;
use App\Helpers\MailHelper;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use App\Models\ThzMasterModel; use App\Models\ThzMasterModel;
use App\Models\ThzMasterNotesModel; use App\Models\ThzMasterNotesModel;
use App\Models\ThzTypeModel;
use App\Models\ThzHistoryModel;
use App\ControllerCleaners\ThzControllerCleaner; use App\ControllerCleaners\ThzControllerCleaner;
use App\Models\UserModel;
use App\Models\ClientPolicyModel;
use App\Models\ClientModel;
use App\Models\TicketMailTemplateModel;
use App\Models\ClientRMModel;
class ThzController extends BaseController class ThzController extends BaseController
{ {
protected $thzMasterModel; protected $thzMasterModel;
protected $thzMasterNotesModel; protected $thzMasterNotesModel;
protected $thzTypeModel;
protected $thzHistoryModel;
protected $thzControllerCleaner; protected $thzControllerCleaner;
protected $userModel;
protected $clientPolicyModel;
protected $clientModel;
protected $ticketMailTemplateModel;
protected $cientRmModel;
protected $myLogger;
public function __construct() public function __construct()
{ {
$this->thzMasterModel = new ThzMasterModel(); $this->thzMasterModel = new ThzMasterModel();
$this->thzMasterNotesModel = new ThzMasterNotesModel(); $this->thzMasterNotesModel = new ThzMasterNotesModel();
$this->thzControllerCleaner = new ThzControllerCleaner(); $this->thzTypeModel = new thzTypeModel();
$this->thzHistoryModel = new ThzHistoryModel();
$this->thzControllerCleaner = new ThzControllerCleaner();
$this->userModel = new UserModel();
$this->clientPolicyModel = new ClientPolicyModel();
$this->clientModel = new ClientModel();
$this->cientRmModel = new ClientRMModel();
$this->ticketMailTemplateModel = new TicketMailTemplateModel();
$this->myLogger = \Config\Services::mylogger();
} }
public function index() public function index()
@ -29,141 +56,668 @@ class ThzController extends BaseController
// //
} }
public function ticketSave(){ public function ticketSave()
{
try {
$data = $this->request->getPost();
$references = "";
if (!empty($data['thz_id'])) {
$data = $this->request->getJSON(true); $text = "update";
// here insert history Status.
$old = $this->thzMasterModel->where('thz_id', $data['thz_id'])->get()->getRowArray();
$result = $this->updateTicket($data);
if (!empty($data['thz_id'])) { if ($old && isset($data['status'])) {
$data['updated_by'] = get_session_userid();
$ticket_id = $data['thz_id'];
$text = "update";
$result = $this->thzMasterModel->where('thz_id', $ticket_id)->set($data)->update(); if ($old['status'] != $data['status']) {
$history = [
'thz_id' => $data['thz_id'],
'field_name' => 'status',
'display_name' => 'Status',
'old_value' => $old['status'],
'new_value' => $data['status'],
'is_active' => 1
];
if (!empty(get_session_userid())) {
$history['created_by'] = get_session_userid();
}
$hist_id = $this->thzHistoryModel->insert($history);
$references = $old['status'] . " - " . $data['status'] . " - " . $hist_id;
} else {
$references = $old['status'] . " - " . $data['status'];
}
} else {
$references = "No Details";
}
$updateID = $data['thz_id'];
} else { } else {
$data['created_by'] = get_session_userid();
$text = "create";
$result = $this->thzMasterModel->insert($data); $text = "create";
$insertID = $this->insertTicket($data);
$result = true;
$references = "";
} }
return $this->response->setJSON(([ 'status' => $result ? 'success' : 'error' , $id = isset($insertID) && !empty($insertID) ? $insertID : $updateID;
'message' => $result ? "Ticket {$text}d successfully" : "Unable to {$text} ticket. Please try again." ]));
$emailNotificationResult = $this->ticketSaveNotification($data, $insertOrUpdate = $text, $id);
return $this->response->setJSON([
'status' => $result ? 'success' : 'error',
'message' => $result ? "Ticket {$text}d successfully " : "Unable to {$text} ticket. Please try again.",
'notification' => $emailNotificationResult ? 'Email Notification Success..!!' : 'Email Notification Failed..!!',
'ref' => $references
])->setStatusCode($result ? 200 : 400);
} catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([
'status' => 'error',
'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
}
} }
public function ticketList() public function ticketList()
{ {
$returnType = strtolower($this->request->getGet('return_type') ?? 'api'); try {
$returnType = strtolower($this->request->getGet('return_type') ?? 'api');
$data = $this->request->getJSON(true);
$tickets = $this->fetchTicketsBasedOnrole($data);
$data = $this->request->getGet();
if ($returnType === 'api') { if ($returnType === 'web' && in_array(get_role_id(), [2, 3, 4])) {
if (empty($tickets)) { $data['assign_to'] = $data['assign_to'] ?? get_session_userid();
return $this->response->setJSON([ 'status' => 'error','message' => 'No tickets found',])->setStatusCode(404);
} }
}else{
$tickets = $this->fetchTicketsBasedOnrole($data);
$data['page_name'] = "Ticket List";
$data['ticket_data'] = $tickets;
$data['assigner'] = $this->userModel->where('is_active', 1)->findAll(); if ($returnType === 'api') {
return $this->loadLayout('ticket_list_web', $data); if (empty($tickets)) {
// return $this->response->setJSON([ 'status' => 'error','message' => 'No tickets found'])->setStatusCode(404);
throw new \RuntimeException('No tickets found', 400);
}
} else {
$data['page_name'] = "Tickets";
$data['ticket_data'] = $tickets;
$data['assignee'] = $this->userModel->where('is_active', 1)->whereIn('role', ['2', '3', '4'])->findAll(); // enga 5-"head" and 1-"admin" assign pannvaga so dropdown la varakudhathu
// 2,3,4 remain person varannum.
$data['client_list'] = $this->clientModel->getCreatedByUserName();
$data['ticket_type'] = $this->thzTypeModel->where('is_active', 1)->findAll();
return $this->loadLayout('thz_list', $data);
}
return $this->response->setJSON([
'status' => 'success',
'data' => $tickets,
])->setStatusCode(200);
} catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([
'status' => 'error',
'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
} }
return $this->response->setJSON([
'status' => 'success',
'data' => $tickets,
]);
} }
public function ticketConversationSave()
{
public function ticketConversationSave(){ try {
$data = $this->request->getPost();
$data = $this->request->getJSON(true); $data['notes_type'] = $data['notes_type'] ?? 'External';
$result = $this->thzMasterNotesModel->insert($data); $result = $this->thzMasterNotesModel->insert($data);
if(empty($result)){ if (empty($result)) {
return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found'])); // return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(404);
throw new \RuntimeException('No tickets found', 404);
}
if ($data['notes_type'] == "External") {
$emailNotificationResult = $this->ticketConversationSaveNotification($data);
} else {
$emailNotificationResult = false;
}
return $this->response->setJSON([
'status' => $result ? 'success' : 'error',
'message' => $result ? "Ticket Notes created successfully" : "Unable to create ticket notes. Please try again.",
'notification' => $emailNotificationResult ? 'Email Notification Success..!!' : 'Email Notification Failed Or No Need..!!'
])->setStatusCode($result ? 200 : 400);
} catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([
'status' => 'error',
'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
} }
return $this->response->setJSON((['status' => 'success', 'data' => $result]));
} }
public function ticketConversationList(){ public function ticketAutoFetchDetails()
{
try {
$data = $this->request->getPost();
$data = $this->request->getJSON(true); $client_id = $data['client_id'] ?? null;
$mobile = $data['mobile'] ?? null;
$thz_id = $data['thz_id'] ?? null; if ($client_id && $mobile) {
$details = $this->thzMasterModel->ticketAutoFetchDetails($client_id, $mobile);
$result = $this->thzMasterNotesModel->ticketConversationList($thz_id); if (empty($details)) {
throw new \RuntimeException('No Data found', 400);
}
if(empty($result)){ $policyIds = array_filter(array_column($details, 'policy_id'));
return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found'])); $clientPolicy = !empty($policyIds)
? $this->clientPolicyModel->whereIn('id', $policyIds)->where('is_active', 1)->get()->getResultArray()
: [];
$result['client_details'] = $details;
$result['policy_details'] = $clientPolicy ?? [];
} else {
throw new \RuntimeException('Client and Mobile Not found', 400);
}
return $this->response->setJSON(['status' => 'success', 'data' => $result])->setStatusCode(200);
} catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([
'status' => 'error',
'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
} }
return $this->response->setJSON((['status' => 'success', 'data' => $result]));
} }
public function ticketConversationList()
{
$data = $this->request->getGet();
$returnType = strtolower($this->request->getGet('return_type') ?? 'api');
$thz_id = $data['thz_id'] ?? null;
$ticketType = $data['notes_type'] ?? 'External';
if ($thz_id) {
$result['master'] = $this->thzMasterModel
->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name')
->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
->where('thz_master.thz_id', $thz_id)
->findAll();
if (!empty($result['master'])) {
$notes = $this->thzMasterNotesModel->ticketConversationList($thz_id, $returnType);
$result['notes'] = !empty($notes) ? $notes : [];
} else {
// return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(400);
throw new \RuntimeException('No tickets found', 400);
}
} else {
// return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(404);
throw new \RuntimeException('No tickets found', 404);
}
if ($returnType === 'api') {
try {
return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(200);
} catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([
'status' => 'error',
'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
}
} else {
$assign_to = $result['master'][0]['assign_to'];
$mobile = $result['master'][0]['mobile'];
$toGetPolicyId = (!empty($result['master'][0]['policy_id']) && strtolower($result['master'][0]['policy_id']) !== 'null')
? $result['master'][0]['policy_id']
: '';
$result['related_tickets'] = $this->thzMasterModel
->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name')
->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
->where('thz_master.assign_to', $assign_to)
->where('thz_master.mobile', $mobile)
->where('thz_master.thz_id !=', $thz_id)
->where('thz_master.status !=', 'Closed')
->where('thz_master.status !=', 'Resolved')
->findAll();
$result['assignee'] = $this->userModel->where('is_active', 1)->whereIn('role', ['2', '3', '4'])->findAll(); // enga 5-"head" and 1-"admin" assign pannvaga so dropdown la varakudhathu
// 2,3,4 remain person varannum.
$result['policy_terms'] = $toGetPolicyId ? $this->getPolicyTerms($toGetPolicyId) : '';
$result['ticket_type'] = $this->thzTypeModel->where('is_active', 1)->findAll();
return $this->loadLayout('thz_notes', $result);
}
}
public function ticketType()
{
$method = $this->request->getMethod(); // get, post
try {
if ($method === 'get') {
$types = $this->thzTypeModel->select('id,name,is_active')->where('is_active', 1)->findAll();
if (empty($types)) {
return $this->response->setJSON(['status' => 'error', 'message' => 'No ticket types found'])->setStatusCode(404);
}
return $this->response->setJSON(['status' => 'success', 'data' => $types])->setStatusCode(200);
}
if ($method === 'post') {
$data = $this->request->getPost();
if (!empty($data['id'])) {
$text = "update";
$result = $this->thzTypeModel->update($data['id'], $data);
$updateID = $data['id'];
} else {
$text = "create";
$insertID = $this->thzTypeModel->insert($data);
$result = true;
}
$id = isset($insertID) && !empty($insertID) ? $insertID : ($updateID ?? null);
return $this->response->setJSON([
'status' => $id ? 'success' : 'error',
'message' => $id ? "Ticket Type {$text}d successfully" : "Unable to {$text} ticket type. Please try again.",
'id' => $id
])->setStatusCode($id ? 200 : 400);
}
return $this->response->setJSON(['status' => 'error', 'message' => 'Invalid request method'])->setStatusCode(405);
} catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([
'status' => 'error',
'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
}
}
public function ticketHistoryList()
{
try {
$data = $this->request->getGet();
$thz_id = $data['thz_id'];
// $details = $this->thzHistoryModal->whereIn('thz_id', $thz_id)->where('is_active', 1)->get()->getResultArray();
$details = $this->thzHistoryModel->select('thz_history.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as created_name')
->join('user_profiles', 'user_profiles.id = thz_history.created_by', 'left')
->where('thz_history.thz_id', $thz_id)->where('thz_history.is_active', 1)
->orderBy('thz_history.created_at', 'desc')
->get()->getResultArray();
if (empty($details)) {
// return $this->response->setJSON([ 'status' => 'error','message' => 'No History found'])->setStatusCode(404);
throw new \RuntimeException('No History found', 404);
}
return $this->response->setJSON(['status' => 'success', 'data' => $details])->setStatusCode(200);
} catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([
'status' => 'error',
'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
}
}
/************************************************** PRIVATE FUNCTIONS ********************************************************/ /************************************************** PRIVATE FUNCTIONS ********************************************************/
private function checkGeneralUserOrEmployee($data){
if($data['empcode']){
return $data['empcode'];
} elseif ($data['mobile']) {
return $data['mobile'];
} elseif ($data['email']) {
return $data['email'];
} else {
return null;
}
}
private function fetchTicketsBasedOnrole(array $data): array private function fetchTicketsBasedOnrole(array $data): array
{ {
$id = $data['thz_id'] ?? null; // $id = $data['thz_id'] ?? null;
$assign_to = $data['assign_to'] ?? null; $assign_to = $data['assign_to'] ?? null;
$mobile = $data['mobile'] ?? null; $mobile = $data['mobile'] ?? null;
if (!empty($assign_to)) { if (!empty($assign_to)) {
// Tickets assigned to a staff // Tickets assigned to a staff
return $this->thzMasterModel return $this->thzMasterModel
->where('assign_to', $assign_to) ->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name')
->findAll(); ->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
->where('thz_master.assign_to', $assign_to)
->orderBy('thz_master.created_at', 'desc')
->findAll();
} }
if (!empty($id) && !empty($mobile)) { // if (!empty($id) && !empty($mobile)) {
if (!empty($mobile)) {
// Specific ticket by ID and mobile // Specific ticket by ID and mobile
return $this->thzMasterModel return $this->thzMasterModel
->where('thz_id', $id) ->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name')
->where('mobile', $mobile) ->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
->findAll(); // ->where('thz_id', $id)
->where('thz_master.mobile', $mobile)
->orderBy('thz_master.created_at', 'desc')
->findAll();
} }
// All tickets (e.g., for managers) // All tickets (e.g., for managers)
return $this->thzMasterModel->findAll(); return $this->thzMasterModel
->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name')
->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
->orderBy('thz_master.created_at', 'desc')
->findAll();
} }
} private function ticketSaveNotification($data, $insertOrUpdate, $id)
{
$user_email = $data['email'] ?? null;
$assignee_id = $data['assign_to'] ?? null;
$assignee_email = $this->findAssigneeEmail($assignee_id);
$client_id = $data['client_id'] ?? null;
$emailToNotified = [
'user_email' => $user_email,
'assignee_email' => $assignee_email
];
$ticketId = $id;
$result = $this->ticketSaveEmailNotificationBasedOnRole($emailToNotified, $insertOrUpdate, $ticketId, $data, $client_id);
return $result;
}
private function ticketConversationSaveNotification($data)
{
$thz_id = $data['thz_id']; // thz is alias of ticket
$data['subject'] = $this->findSubject($data['thz_id']);
$assignee_id = $this->findAssigneeId($data['thz_id']);
$user_email = $this->findUserEmail($data['thz_id']);
$assignee_email = $this->findAssigneeEmail($assignee_id) ?? '';
$sender_mail = $data['notes_by'] == "User" ? $user_email : $assignee_email;
$receiver_mail = $data['notes_by'] == "User" ? $assignee_email : $user_email;
$templateName = "ticket_conversation_save_notification";
$to_email = $receiver_mail;
$ticketId = $thz_id;
$message = $data['notes'] ?? '';
$this->sendEmail($templateName, $data, $to_email, $ticketId, $message);
return true;
}
private function findAssigneeEmail($assignee_id)
{
$row = $this->userModel->where('id', $assignee_id)->get()->getRow();
$assigneeEmail = $row ? $row->email : null;
return $assigneeEmail ? $assigneeEmail : "";
}
private function findAssigneeId($ticketId)
{
$row = $this->thzMasterModel->where('thz_id', $ticketId)->get()->getRow();
$assigneeId = $row ? $row->assign_to : null;
return $assigneeId ? $assigneeId : 0;
}
private function findUserEmail($ticket_id)
{
$row = $this->thzMasterModel->where('thz_id', $ticket_id)->get()->getRow();
$email = $row ? $row->email : null;
return $email ? $email : " ";
}
private function findSubject($ticketId)
{
$row = $this->thzMasterModel->where('thz_id', $ticketId)->get()->getRow();
$subject = $row ? $row->subject : null;
return $subject ? $subject : " ";
}
private function ticketSaveEmailNotificationBasedOnRole($emailToNotified, $insertOrUpdate, $ticketId, $data, $client_id)
{
$user_email = $emailToNotified['user_email'] ?? null;
$assignee_email = $emailToNotified['assignee_email'] ?? null;
if (!empty($assignee_email)) {
switch ($insertOrUpdate) {
case 'update':
$this->sendEmail('ticket_save_update_assignee', $data, $assignee_email, $ticketId);
break;
case 'create':
$this->sendEmail('ticket_save_create_assignee', $data, $assignee_email, $ticketId);
break;
default:
# code...
break;
}
}
if (!empty($user_email)) {
switch ($insertOrUpdate) {
case 'update':
$data['assigneeAndStatus'] = empty($assignee_email)
? "Not Yet Assigned"
: "Assigned With {$assignee_email}";
$this->sendEmail('ticket_save_update_user', $data, $user_email, $ticketId);
break;
case 'create':
$account_manager_email = $this->cientRmModel->findAccountManagerEmail($client_id);
$cc = getenv(' G_ticketing_system_cc');
$template = empty($assignee_email)
? 'ticket_save_create_user_unassigned'
: 'ticket_save_create_user_assigned';
if (!empty($assignee_email)) {
$data['assignee_email'] = $assignee_email;
}
$this->sendEmail($template, $data, $user_email, $ticketId);
// send to account manager and if it is more than one email also no problem we send to all account managers
if (!empty($account_manager_email)) {
$this->sendEmail($template, $data, $account_manager_email, $ticketId, $cc);
}
break;
default:
# code...
break;
}
}
return true;
}
private function updateTicket($data)
{
$data['updated_by'] = get_session_userid();
$ticket_id = $data['thz_id'];
$result = $this->thzMasterModel->where('thz_id', $ticket_id)->set($data)->update();
return $result;
}
private function insertTicket($data)
{
$data['created_by'] = get_session_userid();
$this->thzMasterModel->insert($data);
return $this->thzMasterModel->insertID(); // returns the inserted row's ID
}
private function sendEmail($templateName, $data, $to_email, $ticketId , $cc = "", $message = "", $bcc = "")
{
$mailTemplate = $this->ticketMailTemplateModel->where('template_name', $templateName)->findAll()[0] ?? [];
if (empty($mailTemplate)) {
return;
}
$mailTemplate['subject'] = str_replace('%subject%', $data['subject'] ?? '', $mailTemplate['subject']);
$mailTemplate['mail_content'] = str_replace('%subject%', $data['subject'] ?? '', $mailTemplate['mail_content']);
$mailTemplate['mail_content'] = str_replace('%ticketId%', $ticketId ?? '', $mailTemplate['mail_content']);
$mailTemplate['mail_content'] = str_replace('%message%', $message ?? '', $mailTemplate['mail_content']);
$mailTemplate['mail_content'] = str_replace('%assignee_email%', $data['assignee_email'] ?? '', $mailTemplate['mail_content']);
$mailTemplate['mail_content'] = str_replace('%assigneeAndStatus%', $data['assigneeAndStatus'] ?? '', $mailTemplate['mail_content']);
$from_mail = "";
$to_mail = $to_email;
$cc_string = $cc;
$subject = $mailTemplate['subject'];
$message = $mailTemplate['mail_content'];
$attachments = "";
$reply_to = "";
$bcc_string = $bcc;
$res = MailHelper::send_email(['from_mail' => $from_mail, 'mail' => $to_mail, 'cc' => $cc_string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string]);
}
public function getPolicyTerms($client_policy_id)
{
$policy_data = $this->clientPolicyModel->where('is_active', 1)->where('id', $client_policy_id)->first();
$policy_terms = [];
if (isset($policy_data['policy_terms']) && !empty($policy_data['policy_terms'])) {
$raw_terms = json_decode($policy_data['policy_terms'] ?? [], true) ?? [];
$ticketController = new TicketController();
$policy_terms = $ticketController->convertTermsToDisplay($raw_terms);
}
$data['policy_terms'] = $policy_terms;
return view('view_policy_terms', $data);
}
}

View File

@ -21,6 +21,9 @@ use App\Models\InsurerModel;
use App\Models\EmployeeModel; use App\Models\EmployeeModel;
use App\Models\TPAModel; use App\Models\TPAModel;
use App\Models\ClaimFilesModel; use App\Models\ClaimFilesModel;
use App\Models\ClaimDumpFileModel;
use App\Models\VehicleModel;
use App\Models\PartnerPolicyModel;
use DOMDocument; use DOMDocument;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
@ -60,6 +63,9 @@ class TicketController extends BaseController
protected $insurerModel; protected $insurerModel;
protected $TPAModel; protected $TPAModel;
protected $claimFilesModel; protected $claimFilesModel;
protected $claimDumpFileModel;
protected $vehicleModel;
protected $partnerPolicyModel;
public function __construct() public function __construct()
{ {
@ -69,7 +75,7 @@ class TicketController extends BaseController
$this->ticketMasterModel = new TicketMasterModel(); $this->ticketMasterModel = new TicketMasterModel();
$this->ticketType = [1 => "Claim-GMC", 2 => "Claim-GPA", 3 => "EDLI", 4 => "GTLI"]; $this->ticketType = [1 => "Claim-GMC", 2 => "Claim-GPA", 3 => "EDLI", 4 => "GTLI", 8 => "Motor"];
$this->priorityType = [ $this->priorityType = [
1 => "Low", 1 => "Low",
2 => "Medium", 2 => "Medium",
@ -345,6 +351,9 @@ class TicketController extends BaseController
$this->insurerModel = new InsurerModel(); $this->insurerModel = new InsurerModel();
$this->TPAModel = new TPAModel(); $this->TPAModel = new TPAModel();
$this->claimFilesModel = new ClaimFilesModel(); $this->claimFilesModel = new ClaimFilesModel();
$this->claimDumpFileModel = new ClaimDumpFileModel();
$this->vehicleModel = new VehicleModel();
$this->partnerPolicyModel = new PartnerPolicyModel();
} }
public function ticketList() public function ticketList()
@ -681,6 +690,9 @@ class TicketController extends BaseController
case 4: case 4:
$data['ticket_form'] = 'GTLI'; $data['ticket_form'] = 'GTLI';
break; break;
case 8:
$data['ticket_form'] = 'Motor';
break;
} }
// Fetch ACM Users // Fetch ACM Users
@ -701,7 +713,10 @@ class TicketController extends BaseController
$claim_status_id = 25; $claim_status_id = 25;
}else if($ticket_type == 4){ }else if($ticket_type == 4){
$claim_status_id = 35; $claim_status_id = 35;
}else{ }else if($ticket_type == 8){
$claim_status_id = 62;
}
else{
$claim_status_id = 1; $claim_status_id = 1;
} }
} }
@ -716,11 +731,79 @@ class TicketController extends BaseController
$data['claim_type'] = $this->claimType[2]; $data['claim_type'] = $this->claimType[2];
} }
$data['client_for_motor'] = $this->clientModel->select('id,client_name,phone')->where('client_type', 2)->where('is_active', 1)->findAll();
$this->myLogger->logme('error', "Ticket form data fetched successfully for Ticket Type: $ticket_type"); $this->myLogger->logme('error', "Ticket form data fetched successfully for Ticket Type: $ticket_type");
return $data; return $data;
} }
public function fetchVehiclePolicy($id)
{
$method = $this->request->getMethod();
try {
if (!$id) {
throw new \Exception('Invalid ID', 400);
}
if ($method === 'get') {
$data['vehicle_list'] = $this->vehicleModel
->where('is_active', 1)
->where('owner', $id)
->findAll();
// $data['partner_policy_list'] = $this->partnerPolicyModel
// ->where('is_active', 1)
// ->findAll();
$data['partner_policy_list'] = $this->partnerPolicyModel->partnerPolicyList();
$client = $this->clientModel
->where('is_active', 1)
->where('id', $id)
->first();
$data['email'] = !empty($client) ? $client['email'] : null;
$data['phone'] = !empty($client) ? $client['phone'] : null;
if (empty($data['vehicle_list']) && empty($data['partner_policy_list'])) {
throw new \Exception('No Records found', 404);
}
return $this->response
->setJSON(['status' => 'success', 'data' => $data])
->setStatusCode(200);
}
throw new \Exception('Invalid request method', 405);
} catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = [
'title' => get_class($e),
'type' => get_class($e),
'code' => $code,
'message' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine()
];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([
'status' => 'error',
'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => ($isDbError ? 'database - ' : 'application - ') . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
}
}
//transform the claim status //transform the claim status
public function transFormClaimStatus($claimStatusId, $ticket_type) public function transFormClaimStatus($claimStatusId, $ticket_type)
{ {
@ -789,9 +872,10 @@ class TicketController extends BaseController
} }
public function view_ticket($ticket_id) public function view_ticket($ticket_id)
{ {
// $ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first(); // $ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first();
$ticket_data = $this->ticketMasterModel->getTicketDataByTicketID($ticket_id); $ticket_data = $this->ticketMasterModel->getTicketDataByTicketID($ticket_id);
$ticket_data = $this->formatDateForClaim($ticket_data, 'd/m/Y'); $ticket_data = $this->formatDateForClaim($ticket_data, 'd/m/Y');
if (in_array($ticket_data['claim_status_id'], [15, 25, 35])) { if (in_array($ticket_data['claim_status_id'], [15, 25, 35])) {
@ -850,6 +934,14 @@ class TicketController extends BaseController
// print_rr($data); die; // print_rr($data); die;
} }
// 8TH TYPE is Motor - so do not remove it....
if($ticket_data['ticket_type_id'] == 8){
$claim_status_id = $ticket_data['claim_status_id'];
$ticket_type = $ticket_data['ticket_type_id'];
$data['claim_status'] = $this->transFormClaimStatus($claim_status_id, $ticket_type);
$data['client_for_motor'] = $this->clientModel->select('id,client_name,phone')->where('client_type', 2)->where('is_active', 1)->findAll();
}
return $this->loadLayout('ticket_edit_onbording', $data); return $this->loadLayout('ticket_edit_onbording', $data);
} }
@ -1154,13 +1246,23 @@ class TicketController extends BaseController
->orderBy('ticket_messages.created_at', 'DESC') ->orderBy('ticket_messages.created_at', 'DESC')
->findAll(); ->findAll();
foreach ($dataToSend['messages'] as $message) { foreach ($dataToSend['messages'] as &$message) {
$mail_content_converted = $this->convertHtmlToText($message['mail_content']); $mail_content_converted = $this->convertHtmlToText($message['mail_content']);
$message['mail_content'] = $mail_content_converted; $message['mail_content'] = $mail_content_converted;
$claimFiles = new ClaimFilesModel();
$message["files_data"] = $claimFiles->where('is_active', 1)
->where('file_type', 2)->where('ticket_id', $ticket_master_id)
->where('ticket_message_id', $message['id'])
->findAll();
} }
unset($message);
$dataToSend['emp_name'] = $this->ticketMasterModel->select('emp_name') $dataToSend['emp_name'] = $this->ticketMasterModel->select('emp_name')
->where('id', $ticket_master_id)->where('is_active', 1) ->where('id', $ticket_master_id)->where('is_active', 1)
->first()['emp_name']; ->first()['emp_name'];
// dd($dataToSend); // dd($dataToSend);
if ($dataToSend) { if ($dataToSend) {
return $dataToSend; return $dataToSend;
@ -1170,6 +1272,38 @@ class TicketController extends BaseController
} }
} }
public function downloadClaimFile($claim_file_id = null)
{
// $actionType = $this->request->getGet();
$claimFiles = new ClaimFilesModel();
$file_data = $claimFiles->where('id', $claim_file_id)->first();
$fileName = $file_data['doc_name'];
$filePath = WRITEPATH . '/uploads/claim_files/' . $fileName;
try {
// Check if the file exists
if (file_exists($filePath)) {
// Set the appropriate MIME type
$mimeType = mime_content_type($filePath);
// Send the file to the client for download
return $this->response->download($filePath, null, $mimeType);
} else {
$data['message'] = 'The Physical File Not Found';
echo view('errors/404', $data);
}
} catch (\Exception $e) {
// Handle any exceptions
$errorMessage = $e->getMessage();
$this->myLogger->logme('error', $errorMessage);
// You can return an error response here
echo $errorMessage;
}
}
public function convertHtmlToText($html) public function convertHtmlToText($html)
{ {
if(!empty($html)){ if(!empty($html)){
@ -1865,18 +1999,40 @@ class TicketController extends BaseController
public function getPoliciesbyEmpID() public function getPoliciesbyEmpID()
{ {
$received_data = $this->request->getPost(); $received_data = $this->request->getPost();
$ticket_type_id = $this->request->getPost('ticket_type_id') ?? null;
$emp_id = $received_data['emp_id']; $emp_id = $received_data['emp_id'];
// Get all client policy IDs for the given employee // Get all client policy IDs for the given employee
$policies = $this->employeePolicyModel if ($ticket_type_id == 1) {
->select('client_policy_id')
->where('employee_id', $emp_id) //get the self data for get the all policy list aginst the emp_code
->where('is_active', 1) $self_data = $this->employeeModel->where('is_active', 1)->where('id', $emp_id)->first();
->where('status', 'active')
->findAll(); $db = db_connect();
$builder = $db->table('employees e');
$builder->select('ep.*');
$builder->join('employee_polices ep', 'e.id = ep.employee_id');
$builder->join('client_policy cp', 'cp.id = ep.client_policy_id AND cp.policy_type_id IN (2,3,4,5)');
$builder->where('e.is_active', 1);
$builder->where('ep.is_active', 1);
$builder->where('e.emp_code', $self_data['emp_code']);
$builder->groupBy('client_policy_id');
$query = $builder->get();
$policies = $query->getResultArray();
} else {
$policies = $this->employeePolicyModel
->select('client_policy_id')
->where('employee_id', $emp_id)
->where('is_active', 1)
->where('status', 'active')
->findAll();
}
// Return empty if no policies found
if (empty($policies)) { if (empty($policies)) {
return []; // Return empty if no policies found return [];
} }
// Extract client policy IDs into an array // Extract client policy IDs into an array
@ -1899,7 +2055,7 @@ class TicketController extends BaseController
->join('tpa', 'tpa.id = client_policy.tpa_id AND tpa.is_active = 1', 'left') ->join('tpa', 'tpa.id = client_policy.tpa_id AND tpa.is_active = 1', 'left')
->where('client_policy.policy_status', 1) ->where('client_policy.policy_status', 1)
->whereIn('client_policy.id', $policy_ids) ->whereIn('client_policy.id', $policy_ids)
->findAll(); ->findAll();
// dd($policyNameandID); // dd($policyNameandID);
if ($policyNameandID){ if ($policyNameandID){
@ -2173,7 +2329,8 @@ class TicketController extends BaseController
'url' => $data['url'][$key]??'', 'url' => $data['url'][$key]??'',
'ticket_id'=> $data['ticket_id_url']??'', 'ticket_id'=> $data['ticket_id_url']??'',
'created_by' => get_session_userid(), 'created_by' => get_session_userid(),
'is_active' => 1 'is_active' => 1,
'file_type' => 1
]; ];
$insertArr[] = $insertData; $insertArr[] = $insertData;
@ -2210,6 +2367,7 @@ class TicketController extends BaseController
$urlData = $this->claimFilesModel $urlData = $this->claimFilesModel
->where('ticket_id', $ticket_id) ->where('ticket_id', $ticket_id)
->where('is_active',1) ->where('is_active',1)
->where('file_type',1)
->findAll(); ->findAll();
return $this->response->setJSON([ return $this->response->setJSON([
@ -2383,17 +2541,20 @@ class TicketController extends BaseController
} }
// 5. Merge the Sum Insured value if the multiple sum insured exists // 5. Merge the Sum Insured value if the multiple sum insured exists
if(isset($data['multiple_sum_insured'])){ if (isset($data['multiple_sum_insured'])) {
if(isset($data['sumInsured2'])){
$data['sumInsured2'] = $data['sumInsured2'] . ", " . implode(", ", $data['multiple_sum_insured']); $multipleSumInsured = is_array($data['multiple_sum_insured']) ? $data['multiple_sum_insured'] : [$data['multiple_sum_insured']]; // force into array if string
}else{
$data['sum_insured'] = $data['sum_insured'] . ", " . implode(", ", $data['multiple_sum_insured']); if (isset($data['sumInsured2'])) {
$data['sumInsured2'] .= ", " . implode(", ", $multipleSumInsured);
} else {
$data['sum_insured'] .= ", " . implode(", ", $multipleSumInsured);
} }
unset($data['multiple_sum_insured']); unset($data['multiple_sum_insured']);
} }
// 6. Add the special condition to key value pair // 6. Add the special condition to key value pair
if(!empty($data['special_condition_label'])){ if(!empty($data['special_condition_label'])){
foreach ($data['special_condition_label'] as $key => $value) { foreach ($data['special_condition_label'] as $key => $value) {
if($value != "" && $value != null) { if($value != "" && $value != null) {
@ -2445,6 +2606,155 @@ class TicketController extends BaseController
} }
// -------- CLAIM DUMP UPLOAD ----------------------------------------------------------------------------------------------
public function claimDumpUpload()
{
$data['page_name'] = "Claim Dupm Upload";
if($this->request->is('get')){
$data['claim_dump_file_data'] = $this->claimDumpFileModel
->select('
claim_dump_files.id as file_id,
claim_dump_files.file_name,
claim_dump_files.status,
claim_dump_files.created_at,
up.first_name as user_name
')
->join('user_profiles as up', 'claim_dump_files.created_by = up.id', 'left')
->where('claim_dump_files.is_active', 1)
->orderBy('claim_dump_files.id', 'desc')
->findAll();
return $this->loadLayout('claim_dump_file_list', $data);
}else{
// print_r($this->request->getFile('claim_dump_list')); die;
$filename = '';
$fileSize = '';
//validate uploaded file
$validated = $this->validate([
'claim_dump_list' => [
'uploaded[claim_dump_list]',
'mime_in[claim_dump_list,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.oasis.opendocument.spreadsheet]',
'max_size[claim_dump_list,16384]',
],
]);
if ($validated)
{
$avatar = $this->request->getFile('claim_dump_list');
if (!$avatar) {
$this->myLogger->logme("error", 'File not found');
return $this->respond(['status' => false, 'code' => 400, 'message' => 'File not found'], 400);
}
$is_moved = $avatar->move(WRITEPATH . 'uploads/claim_dump_excel/');
if ($is_moved) {
$filename = $avatar->getName();
$fileSize = $avatar->getSize(); // File size in bytes
$fileSize = $fileSize / (1024 * 1024); // Convert to MB
$this->myLogger->logme("error", 'File move successful');
} else {
$this->myLogger->logme("error", 'File move failed');
return $this->respond(['status' => false, 'code' => 500, 'message' => 'File move failed'], 500);
}
} else {
$this->myLogger->logme("error", 'Upload failed Invalid file');
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Invalid file'], 404);
}
$status = 'inprogress';
$insert_data = [
'file_name' => $filename,
'status' => $status
];
$file_id = $this->claimDumpFileModel->insert($insert_data);
$this->myLogger->logme("error", 'claim_dumb_file_id : {file_id}, uploaded success', ['file_id' => $file_id]);
//after file upload success than call the file formate validation in service controller
$ticketServiceController = new TicketServiceController();
// $response = $ticketServiceController->claimDumpExcelFileFormatValidation(["file_id" => $file_id]);
$r = Jobs::addJob(['job_name' => 'claimDumpExcelFileFormatValidation', 'payload' => ['file_id' => $file_id]]);
return $this->respond(['status' => true, 'code' => 200, 'message' => 'File uploaded successfully. File being validated'], 200);
}
}
public function getClaimDumpFileErrorData()
{
$file_id = $this->request->getGet('file_id');
$file = $this->claimDumpFileModel->where('id', $file_id)->first();
if (!isset($file)) {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'No data found'], 200);
} else {
return $this->respond(['status' => true, 'code' => 200, 'data' => $file['reason']], 200);
}
}
public function getClaimDumpExcelFileErrors($file_id)
{
// $file_id = $this->request->getGet('file_id');
$ticketServiceController = new TicketServiceController();
// Render views and capture output
$result = $ticketServiceController->getClaimExcelErrorData($file_id) ?? [];
// dd($result);
if ($result != 0) {
$result['file_id'] = $file_id;
echo view('excel_errors', $result);
} else if ($result == 0) {
$data['message'] = 'File Not Found Physically';
return view('errors/404', $data);
} else {
echo view('errors/html/production');
}
}
public function downloadClaimDumpFile($file_id)
{
// $actionType = $this->request->getGet();
$file_data = $this->claimDumpFileModel->where('id', $file_id)->first();
$fileName = $file_data['file_name'];
$filePath = WRITEPATH . '/uploads/claim_dump_excel/' . $fileName;
try {
// Check if the file exists
if (file_exists($filePath)) {
// Set the appropriate MIME type
$mimeType = mime_content_type($filePath);
// Send the file to the client for download
return $this->response->download($filePath, null, $mimeType);
} else {
$data['message'] = 'The Physical File Not Found';
echo view('errors/404', $data);
}
} catch (\Exception $e) {
// Handle any exceptions
$errorMessage = $e->getMessage();
$this->myLogger->logme('error', $errorMessage);
// You can return an error response here
echo $errorMessage;
}
}
} }

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,8 @@ use App\Models\UserTeamsModel;
use App\Helpers\BookStackUserHelper; use App\Helpers\BookStackUserHelper;
use App\Models\AuthHistoryModel; use App\Models\AuthHistoryModel;
use App\Models\UserActivityHistoryModel; use App\Models\UserActivityHistoryModel;
use App\Models\PartnerStaffModel;
use App\Models\PartnerManagerIncentiveFileModel;
class UserController extends AdminController class UserController extends AdminController
@ -32,6 +34,8 @@ class UserController extends AdminController
protected $bookStack; protected $bookStack;
protected $authHistoryModel; protected $authHistoryModel;
protected $userActivityHistoryModel; protected $userActivityHistoryModel;
protected $partnerStaffModel;
protected $partnerManagerIncentiveFileModel;
public function __construct() public function __construct()
{ {
@ -45,6 +49,8 @@ class UserController extends AdminController
$this->bookStack = new BookStackUserHelper(); $this->bookStack = new BookStackUserHelper();
$this->authHistoryModel = new AuthHistoryModel(); $this->authHistoryModel = new AuthHistoryModel();
$this->userActivityHistoryModel = new UserActivityHistoryModel(); $this->userActivityHistoryModel = new UserActivityHistoryModel();
$this->partnerStaffModel = new PartnerStaffModel();
$this->partnerManagerIncentiveFileModel = new PartnerManagerIncentiveFileModel();
} }
public function list() public function list()
@ -563,4 +569,226 @@ class UserController extends AdminController
} }
} }
public function partner()
{
$method = $this->request->getMethod(); // get, post
try{
// Listing
if ($method === 'get') {
$types = $this->partnerStaffModel->findAll();
if (empty($types)) {
return $this->response->setJSON(['status' => 'error','message' => 'No Staff found'])->setStatusCode(404);
}
return $this->response->setJSON(['status' => 'success','data' => $types])->setStatusCode(200);
}
// add/update
if ($method === 'post') {
$data = $this->request->getPost();
if (!empty($data['id'])) {
$text = "update";
$result = $this->partnerStaffModel->update($data['id'], $data);
$updateID = $data['id'];
} else {
$text = "create";
$data['role_id'] = 1;
$data['created_by'] = get_session_userid();
$insertID = $this->partnerStaffModel->insert($data);
$result = true;
}
$id = isset($insertID) && !empty($insertID) ? $insertID : ($updateID ?? null);
return $this->response->setJSON([
'status' => $id ? 'success' : 'error',
'message' => $id ? "Staff {$text}d successfully" : "Unable to {$text} staff. Please try again.",
'id' => $id
])->setStatusCode($id ? 200 : 400);
}
// delete
if ($method === 'put') {
$data = $this->request->getRawInput();
$id = $data['id'] ?? null;
if (!$id) {
return $this->response->setJSON(['status' => 'error', 'message' => 'ID is required'])->setStatusCode(400);
}
$staff = $this->partnerStaffModel->find($id);
if (!$staff) {
return $this->response->setJSON(['status' => 'error','message' => 'Staff not found'])->setStatusCode(404);
}
if ($staff['is_active'] == 1) {
$result = $this->partnerStaffModel->update($id, ['is_active' => 0]);
$message = "Staff deleted successfully";
} else {
return $this->response->setJSON(['status' => 'error','message' => 'Staff already deleted'])->setStatusCode(400);
}
return $this->response->setJSON([
'status' => $result ? 'success' : 'error',
'message' => $result ? $message : "Unable to delete staff. Please try again.",
'id' => $id
])->setStatusCode($result ? 200 : 400);
}
return $this->response->setJSON([ 'status' => 'error', 'message' => 'Invalid request method' ])->setStatusCode(405);
}
catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
}
}
public function partnerIncentive()
{
$method = $this->request->getMethod(); // get, post
try{
// Listing
if ($method === 'get') {
$manager_id = $this->request->getGet('manager_id');
$files = $this->partnerManagerIncentiveFileModel->where('manager_id', $manager_id)->findAll();
if (empty($files)) {
return $this->response->setJSON(['status' => 'error','message' => 'No Records found'])->setStatusCode(404);
}
return $this->response->setJSON(['status' => 'success','data' => $files])->setStatusCode(200);
}
// add/update
if ($method === 'post') {
$file = $this->request->getFile('incentive_file_name');
$month = $this->request->getPost('incentive_month');
$managerId = $this->request->getPost('manager_id');
$fileId = $this->request->getPost('id');
if ($file && $file->isValid() && !$file->hasMoved()) {
$originalName = $file->getClientName();
$extension = $file->getExtension();
$fileName = pathinfo($originalName, PATHINFO_FILENAME) . '_' . date('Ymd_His') . '.' . $extension;
$path = WRITEPATH . 'uploads/incentives';
$file->move($path, $fileName);
$data = [
'manager_id' => $managerId,
'incentive_month' => date('M Y', strtotime($month)),
'incentive_file_name' => $fileName,
'created_by' => get_session_userid()
];
if ($fileId) {
$text = "update";
$this->partnerManagerIncentiveFileModel->update($fileId, $data);
$updateID = $data['id'];
} else {
$text = "create";
$insertID = $this->partnerManagerIncentiveFileModel->insert($data);
$result = true;
}
$id = isset($insertID) && !empty($insertID) ? $insertID : ($updateID ?? null);
return $this->response->setJSON([
'status' => $id ? 'success' : 'error',
'message' => $id ? "File {$text}d successfully" : "Unable to {$text} file. Please try again.",
'id' => $id
])->setStatusCode($id ? 200 : 400);
}
return $this->response->setJSON([
'status' => 'error',
'message' => "Unable to Upload file. Please try again.",
'id' => ''
])->setStatusCode(400);
}
// delete
if ($method === 'put') {
$data = $this->request->getRawInput();
$id = $data['id'] ?? null;
if (!$id) {
return $this->response->setJSON(['status' => 'error', 'message' => 'ID is required'])->setStatusCode(400);
}
$files = $this->partnerManagerIncentiveFileModel->find($id);
if (!$files) {
return $this->response->setJSON(['status' => 'error','message' => 'No Records found'])->setStatusCode(404);
}
if ($files['is_active'] == 1) {
$result = $this->partnerManagerIncentiveFileModel->update($id, ['is_active' => 0]);
$message = "Files deleted successfully";
} else {
return $this->response->setJSON(['status' => 'error','message' => 'files already deleted'])->setStatusCode(400);
}
return $this->response->setJSON([
'status' => $result ? 'success' : 'error',
'message' => $result ? $message : "Unable to delete staff. Please try again.",
'id' => $id
])->setStatusCode($result ? 200 : 400);
}
return $this->response->setJSON([ 'status' => 'error', 'message' => 'Invalid request method' ])->setStatusCode(405);
}
catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
}
}
public function downloadIncentivesFile($file_id)
{
try {
$result = $this->partnerManagerIncentiveFileModel->where('id', $file_id)->first();
if (!$result || empty($result['incentive_file_name'])) {
throw new \Exception("File Name Not Found");
}
$incentive_file_name = $result['incentive_file_name'];
$file_name = basename($incentive_file_name);
$filePath = WRITEPATH . 'uploads/incentives/' . $file_name;
if (file_exists($filePath)) {
return $this->response->download($filePath, null);
} else {
throw new \Exception("File Not Found");
}
} catch (\Exception $e) {
$this->myLogger->logme('error', $e->getMessage());
// Show 404 error view
$data['message'] = $e->getMessage();
return view('errors/404', $data);
}
}
} }

View File

@ -123,13 +123,21 @@ class VidalApiController extends BaseController
} }
public function newClaim(){ public function newClaim()
{
$postData = $this->request->getPost(); $postData = $this->request->getPost();
if (empty($postData)) {
return $this->response->setJSON([
'status' => false,
'message' => 'Empty Data Given.',
'data' => $postData
]);
}
helper('api'); helper('api');
$url = ''. getenv('VIDAL_API_BASE_URL').'/submitClaim'; $url = getenv('VIDAL_API_BASE_URL') . '/submitClaim';
$method = 'POST'; $method = 'POST';
$headers = [ $headers = [
@ -138,27 +146,38 @@ class VidalApiController extends BaseController
]; ];
$body = [ $body = [
'username:' .getenv('VIDAL_API_USERNAME').'', 'username' => getenv('VIDAL_API_USERNAME'),
'password:' .getenv('VIDAL_API_PASSWORD').'', 'password' => getenv('VIDAL_API_PASSWORD'),
'PolicyNo:' .$postData['policyNo'] ?? '', 'policyNo' => $postData['policyNo'] ?? '',
'enrollmentId:' .$postData['enrollmentId'] ?? '', 'enrollmentId' => $postData['enrollmentId'] ?? '',
'typeOfClaim:' .$postData['typeOfClaim'] ?? '', 'typeOfClaim' => $postData['typeOfClaim'] ?? '',
'claimSubType:' .$postData['claimSubType'] ?? '', 'claimSubType' => $postData['claimSubType'] ?? '',
'requestedAmount:' .$postData['requestedAmount'] ?? '', 'requestedAmount' => $postData['requestedAmount'] ?? '',
'ailmentType:' .$postData['ailmentType'] ?? '', 'ailmentType' => $postData['ailmentType'] ?? '',
'admissionDate:' .$postData['admissionDate'] ?? '', 'admissionDate' => $postData['admissionDate'] ?? '',
'dischargeDate:' .$postData['dischargeDate'] ?? '', 'dischargeDate' => $postData['dischargeDate'] ?? '',
'hospitalName:' .$postData['hospitalName'] ?? '', 'hospitalName' => $postData['hospitalName'] ?? '',
'empanelmentNo:' .$postData['empanelmentNo'] ?? '', 'empanelmentNo' => $postData['empanelmentNo'] ?? '',
'documentType:' .$postData['documentType'] ?? '', 'documentType' => $postData['documentType'] ?? '',
'ailmentName:' .$postData['ailmentName'] ?? '', 'ailmentName' => $postData['ailmentName'] ?? '',
'hospitalAddress:' .$postData['hospitalAddress'] ?? '', 'hospitalAddress' => $postData['hospitalAddress'] ?? '',
'hospitalState:' .$postData['hospitalState'] ?? '', 'hospitalState' => $postData['hospitalState'] ?? '',
'hospitalCity:' .$postData['hospitalCity'] ?? '', 'hospitalCity' => $postData['hospitalCity'] ?? '',
'hospitalPinCode:' .$postData['hospitalPinCode'] ?? '', 'hospitalPinCode' => $postData['hospitalPinCode'] ?? '',
'hospitalPhoneNo:' .$postData['hospitalPhoneNo'] ?? '' 'hospitalPhoneNo' => $postData['hospitalPhoneNo'] ?? '',
]; ];
// ✅ Handle file upload
if ($file = $this->request->getFile('File')) {
if ($file->isValid() && !$file->hasMoved()) {
$filePath = $file->getTempName();
$originalName = $file->getClientName();
$mimeType = $file->getMimeType();
$body['File'] = new \CURLFile($filePath, $mimeType, $originalName);
}
}
$response = call_third_party_api($url, $method, $headers, $body); $response = call_third_party_api($url, $method, $headers, $body);
if($response['status'] != true){ if($response['status'] != true){
@ -170,10 +189,10 @@ class VidalApiController extends BaseController
} }
return $this->response->setJSON($response); return $this->response->setJSON($response);
} }
public function enrollment(){ public function enrollment(){
$postData = $this->request->getJSON(true); $postData = $this->request->getJSON(true);

View File

@ -395,18 +395,18 @@ class ChatbotHelper
<body class="clean-body u_body" style="margin: 0;padding: 0;-webkit-text-size-adjust: 100%;background-color: #F9F9F9;color: #000000"> <body class="clean-body u_body" style="margin: 0;padding: 0;-webkit-text-size-adjust: 100%;background-color: #F9F9F9;color: #000000">
<!--[if IE]><div class="ie-container"><![endif]--> <!--[if IE]><div class="ie-container"><![endif]-->
<!--[if mso]><div class="mso-container"><![endif]--> <!--[if mso]><div class="mso-container"><![endif]-->
<table style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;min-width: 320px;Margin: 0 auto;background-color: #F9F9F9;width:100%" cellpadding="0" cellspacing="0"> <table data-custom-table-css="table" style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;min-width: 320px;Margin: 0 auto;background-color: #F9F9F9;width:100%" cellpadding="0" cellspacing="0">
<tbody> <tbody>
<tr style="vertical-align: top"> <tr style="vertical-align: top">
<td style="word-break: break-word;border-collapse: collapse !important;vertical-align: top"> <td style="word-break: break-word;border-collapse: collapse !important;vertical-align: top">
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" style="background-color: #F9F9F9;"><![endif]--> <!--[if (mso)|(IE)]><table data-custom-table-css="table" width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" style="background-color: #F9F9F9;"><![endif]-->
<div class="u-row-container" style="padding: 0px;background-color: transparent"> <div class="u-row-container" style="padding: 0px;background-color: transparent">
<div class="u-row" style="margin: 0 auto;min-width: 320px;max-width: 620px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: transparent;"> <div class="u-row" style="margin: 0 auto;min-width: 320px;max-width: 620px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: transparent;">
<div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;"> <div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;">
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: transparent;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:620px;"><tr style="background-color: transparent;"><![endif]--> <!--[if (mso)|(IE)]><table data-custom-table-css="table" width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: transparent;" align="center"><table data-custom-table-css="table" cellpadding="0" cellspacing="0" border="0" style="width:620px;"><tr style="background-color: transparent;"><![endif]-->
<!--[if (mso)|(IE)]><td align="center" width="620" style="width: 620px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;" valign="top"><![endif]--> <!--[if (mso)|(IE)]><td align="center" width="620" style="width: 620px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;" valign="top"><![endif]-->
<div class="u-col u-col-100" style="max-width: 320px;min-width: 620px;display: table-cell;vertical-align: top;"> <div class="u-col u-col-100" style="max-width: 320px;min-width: 620px;display: table-cell;vertical-align: top;">
@ -414,12 +414,12 @@ class ChatbotHelper
<!--[if (!mso)&(!IE)]><!--> <!--[if (!mso)&(!IE)]><!-->
<div style="box-sizing: border-box; height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;"><!--<![endif]--> <div style="box-sizing: border-box; height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;"><!--<![endif]-->
<table style="font-family:times new roman,times;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> <table data-custom-table-css="table" style="font-family:times new roman,times;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
<tbody> <tbody>
<tr> <tr>
<td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:times new roman,times;" align="left"> <td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:times new roman,times;" align="left">
<table width="100%" cellpadding="0" cellspacing="0" border="0"> <table data-custom-table-css="table" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr> <tr>
<td style="padding-right: 0px;padding-left: 0px;" align="center"> <td style="padding-right: 0px;padding-left: 0px;" align="center">
@ -451,7 +451,7 @@ class ChatbotHelper
<div class="u-row-container" style="padding: 0px;background-color: transparent"> <div class="u-row-container" style="padding: 0px;background-color: transparent">
<div class="u-row" style="margin: 0 auto;min-width: 320px;max-width: 620px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: transparent;"> <div class="u-row" style="margin: 0 auto;min-width: 320px;max-width: 620px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: transparent;">
<div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;"> <div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;">
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: transparent;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:620px;"><tr style="background-color: transparent;"><![endif]--> <!--[if (mso)|(IE)]><table data-custom-table-css="table" width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: transparent;" align="center"><table data-custom-table-css="table" cellpadding="0" cellspacing="0" border="0" style="width:620px;"><tr style="background-color: transparent;"><![endif]-->
<!--[if (mso)|(IE)]><td align="center" width="620" style="width: 620px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;" valign="top"><![endif]--> <!--[if (mso)|(IE)]><td align="center" width="620" style="width: 620px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;" valign="top"><![endif]-->
<div class="u-col u-col-100" style="max-width: 320px;min-width: 620px;display: table-cell;vertical-align: top;"> <div class="u-col u-col-100" style="max-width: 320px;min-width: 620px;display: table-cell;vertical-align: top;">
@ -459,7 +459,7 @@ class ChatbotHelper
<!--[if (!mso)&(!IE)]><!--> <!--[if (!mso)&(!IE)]><!-->
<div style="box-sizing: border-box; height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;"><!--<![endif]--> <div style="box-sizing: border-box; height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;"><!--<![endif]-->
<table style="font-family:times new roman,times;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> <table data-custom-table-css="table" style="font-family:times new roman,times;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
<tbody> <tbody>
<tr> <tr>
<td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:times new roman,times;" align="left"> <td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:times new roman,times;" align="left">
@ -494,7 +494,7 @@ class ChatbotHelper
<div class="u-row-container" style="padding: 0px;background-color: transparent"> <div class="u-row-container" style="padding: 0px;background-color: transparent">
<div class="u-row" style="margin: 0 auto;min-width: 320px;max-width: 620px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: transparent;"> <div class="u-row" style="margin: 0 auto;min-width: 320px;max-width: 620px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: transparent;">
<div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;"> <div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;">
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: transparent;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:620px;"><tr style="background-color: transparent;"><![endif]--> <!--[if (mso)|(IE)]><table data-custom-table-css="table" width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: transparent;" align="center"><table data-custom-table-css="table" cellpadding="0" cellspacing="0" border="0" style="width:620px;"><tr style="background-color: transparent;"><![endif]-->
<!--[if (mso)|(IE)]><td align="center" width="620" style="width: 620px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;" valign="top"><![endif]--> <!--[if (mso)|(IE)]><td align="center" width="620" style="width: 620px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;" valign="top"><![endif]-->
<div class="u-col u-col-100" style="max-width: 320px;min-width: 620px;display: table-cell;vertical-align: top;"> <div class="u-col u-col-100" style="max-width: 320px;min-width: 620px;display: table-cell;vertical-align: top;">
@ -502,7 +502,7 @@ class ChatbotHelper
<!--[if (!mso)&(!IE)]><!--> <!--[if (!mso)&(!IE)]><!-->
<div style="box-sizing: border-box; height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;"><!--<![endif]--> <div style="box-sizing: border-box; height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;border-radius: 0px;-webkit-border-radius: 0px; -moz-border-radius: 0px;"><!--<![endif]-->
<table style="font-family:times new roman,times;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> <table data-custom-table-css="table" style="font-family:times new roman,times;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
<tbody> <tbody>
<tr> <tr>
<td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:times new roman,times;" align="left"> <td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:times new roman,times;" align="left">
@ -516,7 +516,7 @@ class ChatbotHelper
</tbody> </tbody>
</table> </table>
<table style="font-family:times new roman,times;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> <table data-custom-table-css="table" style="font-family:times new roman,times;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
<tbody> <tbody>
<tr> <tr>
<td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:times new roman,times;" align="left"> <td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:times new roman,times;" align="left">

View File

@ -322,6 +322,7 @@ class MailHelper
$from_address = isset($params['from_mail']) && !empty($params['from_mail']) ? $params['from_mail'] : getenv('email.fromEmail'); $from_address = isset($params['from_mail']) && !empty($params['from_mail']) ? $params['from_mail'] : getenv('email.fromEmail');
// $from_address = "claims@nhanceindia.in"; // $from_address = "claims@nhanceindia.in";
if(isset($params['common'])){ $params['common']['from_mail'] = $from_address; }
try { try {
$curl = curl_init(); $curl = curl_init();

View File

@ -59,6 +59,7 @@ if (!function_exists('call_third_party_api')) {
} }
$decoded = json_decode($response, true); $decoded = json_decode($response, true);
return [ return [
'status' => ($httpCode >= 200 && $httpCode < 300), 'status' => ($httpCode >= 200 && $httpCode < 300),
'data' => $decoded ?: $response, // fallback to raw response 'data' => $decoded ?: $response, // fallback to raw response

View File

@ -0,0 +1,179 @@
<?php
use App\Models\EmployeeModel;
use App\Models\InsurerModel;
use App\Models\TPAModel;
use Kint\Kint;
if (!function_exists('check_client')) {
function check_client($params)
{
$client_data = $params['client_data'] ?? [];
$client_name = $params['client_name'] ?? "";
// Kint::dump($client_name);
if (!empty($client_data)) {
foreach ($client_data as $key => $value) {
// Kint::dump($value['client_name'], $client_name);
if(trim($value['client_name']) === trim($client_name)){
return array('status' => true, 'client_id' => $value['id'], 'error' => '');
}
}
}
return array('status' => false, 'error' => 'This Client Name does not exist in the system');
}
}
if (!function_exists('check_insurer')) {
function check_insurer($params)
{
$insurer_data = $params['insurer_data'] ?? [];
$insurer_name = $params['insurer_name'] ?? "";
if (!empty($insurer_data)) {
foreach ($insurer_data as $key => $value) {
if(trim($value['short_name']) === trim($insurer_name)){
return array('status' => true, 'insuer_id' => $value['id'], 'error' => '');
}
}
}
return array('status' => false, 'error' => 'This Insurer does not exist in the system');
}
}
if (!function_exists('check_tpa')) {
function check_tpa($params)
{
$tpa_data = $params['tpa_data'] ?? [];
$tpa_name = $params['tpa_name'] ?? "";
if (!empty($tpa_data)) {
foreach ($tpa_data as $key => $value) {
if(trim($value['short_name']) === trim($tpa_name)){
return array('status' => true, 'tpa_id' => $value['id'], 'error' => '');
}
}
}
return array('status' => false, 'error' => 'This TPA does not exist in the system');
}
}
if (!function_exists('check_status')) {
function check_status($params)
{
$data = $params['data'] ?? [];
$check_value = $params['value'] ?? "";
if (!empty($data)) {
foreach ($data as $key => $value) {
// Kint::dump(strtolower(trim($value['claim_status'])), strtolower(trim($check_value)));
if(strtolower(trim($value['claim_status'])) === strtolower(trim($check_value))){
return array('status' => true, 'status_id' => $value['id'], 'error' => '');
}
}
}
return array('status' => false, 'error' => "This Status ('{$check_value}') does not exist in the system");
}
}
if (!function_exists('check_policy')) {
function check_policy($params)
{
$data = $params['data'] ?? [];
$client_id = $params['client_id'] ?? "";
$check_value = $params['value'] ?? "";
if (!empty($data)) {
foreach ($data as $key => $value) {
if($value['client_id'] === $client_id && trim($value['policy_no']) === trim($check_value)){
return array('status' => true, 'status_id' => $value['id'], 'error' => '');
}
}
}
return array('status' => false, 'error' => "This Policy Number does not exist in the Client");
}
}
if (!function_exists('check_emp_and_insured')) {
function check_emp_and_insured($params)
{
$employee_modal = new EmployeeModel();
$tpa_data = $employee_modal
->join('employee_polices', 'employees.id = employee_polices.employee_id')
->where('employees.client', $params['client_id'])
->where('employees.name', $params['emp_name'])
->where('employees.emp_code', $params['emp_code'])
->where('employees.is_active', 1)
->where('employees.emp_status !=', "truncated")
->where('employee_polices.is_active', 1)
->where('employees.status !=', "truncated")
->first();
if (empty($tpa_data)) {
return false;
}
return $tpa_data['id'];
}
}
if (!function_exists('dynamic_check_excel_date_format')) {
function dynamic_check_excel_date_format($dateString, $format = 'd/m/Y')
{
if ($dateString == "") {
return array('status' => true);
}
$date = DateTime::createFromFormat($format, $dateString);
if ($date && $date->format($format) == $dateString) {
return array('status' => true);
} else {
$res = validate_date_flexible($dateString, $format);
if (!$res) {
return array('status' => false, 'error' => "wrong date format: Expected {$format}({$res}) and received $dateString");
} else {
return array('status' => true);
}
}
}
}
if (!function_exists('validate_date_flexible')) {
function validate_date_flexible($date, $format = 'm/d/Y')
{
// Create a DateTime from the given format
$d = DateTime::createFromFormat($format, $date);
if (!$d) return false;
// Compare normalized values (remove leading zeros)
$original = preg_replace('/\b0+/', '', $date);
$normalized = preg_replace('/\b0+/', '', $d->format($format));
return $original === $normalized;
}
}
if (!function_exists('normalizeDate')) {
function normalizeDate($dateString, $formats = ['d-m-Y', 'd/m/Y', 'm-d-Y', 'm/d/Y', 'Y-m-d'])
{
if (empty($dateString)) {
return null; // keep null if no value
}
foreach ($formats as $format) {
$dt = DateTime::createFromFormat($format, trim($dateString));
if ($dt && $dt->format($format) === trim($dateString)) {
return $dt->format('Y-m-d'); // ✅ return in DB format
}
}
return null; // if no valid format found
}
}
?>

View File

@ -73,7 +73,7 @@
body[data-sidebar-size=condensed]:not([data-layout=compact]):not(.auth-fluid-pages) { body[data-sidebar-size=condensed]:not([data-layout=compact]):not(.auth-fluid-pages) {
min-height: 0; max-height:100vh !important;
} }
.navbar-custom { .navbar-custom {
@ -267,7 +267,6 @@
.right-bar { .right-bar {
width: 300px;
/* Adjust as needed */ /* Adjust as needed */
overflow: hidden; overflow: hidden;
} }
@ -616,7 +615,7 @@
</li> </li>
<li> <li>
<a id="app_content_management" href="#sidebarDashboardsmenu" data-toggle="collapse" class="waves-effect" style="color: grey;"> <a id="app_content_management" href="#sidebarDashboardsmenu" data-toggle="collapse" class="waves-effect" style="color: grey;">
<i class="fa fa-info-circle" aria-hidden="true"></i> <i class="mdi mdi-information-outline" aria-hidden="true"></i>
<span class="badge badge-success badge-pill float-right">2</span> <span class="badge badge-success badge-pill float-right">2</span>
<span> App Content Management </span> <span> App Content Management </span>
</a> </a>

View File

@ -305,7 +305,7 @@ class sendMailNotification
} }
$table_content .= $policy_name_for_policy_type . '</h4></div>'; $table_content .= $policy_name_for_policy_type . '</h4></div>';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">'; $table_content .= '<table data-custom-table-css="table" border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
// Add text-align: center to the table head // Add text-align: center to the table head
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">'; $table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
@ -442,7 +442,7 @@ class sendMailNotification
} }
$table_content .= $policy_name_for_policy_type . ' ( Payable By Employee ) </h4></div>'; $table_content .= $policy_name_for_policy_type . ' ( Payable By Employee ) </h4></div>';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">'; $table_content .= '<table data-custom-table-css="table" border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
// Add text-align: center to the table head // Add text-align: center to the table head
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">'; $table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
@ -479,7 +479,7 @@ class sendMailNotification
if (count($Addon_list) > 0) { if (count($Addon_list) > 0) {
$table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">'; $table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">'; $table_content .= '<table data-custom-table-css="table" border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
// Center align for table header and body // Center align for table header and body
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">'; $table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
@ -655,7 +655,7 @@ class sendMailNotification
} }
$table_content .= $policy_name_for_policy_type . '</h4></div>'; $table_content .= $policy_name_for_policy_type . '</h4></div>';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">'; $table_content .= '<table data-custom-table-css="table" border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
// Add text-align: center to the table head // Add text-align: center to the table head
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">'; $table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
@ -741,7 +741,7 @@ class sendMailNotification
} }
$table_content .= $policy_name_for_policy_type . ' ( Payable By Employee ) </h4></div>'; $table_content .= $policy_name_for_policy_type . ' ( Payable By Employee ) </h4></div>';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">'; $table_content .= '<table data-custom-table-css="table" border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
// Add text-align: center to the table head // Add text-align: center to the table head
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">'; $table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
@ -779,7 +779,7 @@ class sendMailNotification
if (count($Addon_list) > 0) { if (count($Addon_list) > 0) {
$table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">'; $table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">'; $table_content .= '<table data-custom-table-css="table" border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
// Center align for table header and body // Center align for table header and body
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">'; $table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
@ -956,7 +956,7 @@ class sendMailNotification
} }
$table_content .= $policy_name_for_policy_type . '</h4></div>'; $table_content .= $policy_name_for_policy_type . '</h4></div>';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">'; $table_content .= '<table data-custom-table-css="table" border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
// Add text-align: center to the table head // Add text-align: center to the table head
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">'; $table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
@ -1042,7 +1042,7 @@ class sendMailNotification
} }
$table_content .= $policy_name_for_policy_type . ' ( Payable By Employee ) </h4></div>'; $table_content .= $policy_name_for_policy_type . ' ( Payable By Employee ) </h4></div>';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">'; $table_content .= '<table data-custom-table-css="table" border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
// Add text-align: center to the table head // Add text-align: center to the table head
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">'; $table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
@ -1079,7 +1079,7 @@ class sendMailNotification
if (count($Addon_list) > 0) { if (count($Addon_list) > 0) {
$table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">'; $table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">'; $table_content .= '<table data-custom-table-css="table" border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
// Center align for table header and body // Center align for table header and body
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">'; $table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
@ -1332,7 +1332,7 @@ class sendMailNotification
// Start table row // Start table row
$table_content .= $policy_name . '</h4></div>'; $table_content .= $policy_name . '</h4></div>';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">'; $table_content .= '<table data-custom-table-css="table" border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">'; $table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
$table_content .= '<tr>'; $table_content .= '<tr>';
$table_content .= '<th>Name</th>'; $table_content .= '<th>Name</th>';
@ -1384,7 +1384,7 @@ class sendMailNotification
// Generate summary table for addon if applicable // Generate summary table for addon if applicable
if (count($Addon_list) > 0) { if (count($Addon_list) > 0) {
$table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">'; $table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">'; $table_content .= '<table data-custom-table-css="table" border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">'; $table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
$table_content .= '<tr>'; $table_content .= '<tr>';
@ -1482,7 +1482,7 @@ class sendMailNotification
// Start table row // Start table row
$table_content .= $policy_name . '</h4></div>'; $table_content .= $policy_name . '</h4></div>';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">'; $table_content .= '<table data-custom-table-css="table" border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">'; $table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
$table_content .= '<tr>'; $table_content .= '<tr>';
$table_content .= '<th>Name</th>'; $table_content .= '<th>Name</th>';
@ -1534,7 +1534,7 @@ class sendMailNotification
// Generate summary table for addon if applicable // Generate summary table for addon if applicable
if (count($Addon_list) > 0) { if (count($Addon_list) > 0) {
$table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">'; $table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">'; $table_content .= '<table data-custom-table-css="table" border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">'; $table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
$table_content .= '<tr>'; $table_content .= '<tr>';
@ -1630,7 +1630,7 @@ class sendMailNotification
// Start table row // Start table row
$table_content .= $policy_name . '</h4></div>'; $table_content .= $policy_name . '</h4></div>';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">'; $table_content .= '<table data-custom-table-css="table" border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">'; $table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
$table_content .= '<tr>'; $table_content .= '<tr>';
$table_content .= '<th>Name</th>'; $table_content .= '<th>Name</th>';
@ -1683,7 +1683,7 @@ class sendMailNotification
if (count($Addon_list) > 0) { if (count($Addon_list) > 0) {
$table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">'; $table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">'; $table_content .= '<table data-custom-table-css="table" border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">'; $table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
$table_content .= '<tr>'; $table_content .= '<tr>';

View File

@ -64,6 +64,79 @@ if (!function_exists('file_Upload')) {
} }
} }
// if (!function_exists('multi_file_Upload')) {
// function multi_file_Upload($fileToUpload, $filepath)
// {
// $uploadedFiles = [];
// // Handle multiple files
// if (is_array($fileToUpload)) {
// foreach ($fileToUpload as $file) {
// if ($file !== null && $file->isValid() && !$file->hasMoved()) {
// $file->move($filepath);
// $fileName = $file->getName(); // safer unique name
// $uploadedFiles[] = [
// 'file_name' => $fileName,
// 'file_path' => $filepath . $fileName
// ];
// }
// }
// }
// // Handle single file
// else {
// if ($fileToUpload !== null && $fileToUpload->isValid() && !$fileToUpload->hasMoved()) {
// $fileToUpload->move($filepath);
// $fileName = $fileToUpload->getName();
// $uploadedFiles[] = [
// 'file_name' => $fileName,
// 'file_path' => $filepath . $fileName
// ];
// }
// }
// return $uploadedFiles; // always return array of files
// }
// }
if (!function_exists('multi_file_Upload')) {
function multi_file_Upload($fileToUpload, $filepath)
{
$uploadedFiles = [];
// Normalize: always work with an array of UploadedFile objects
$files = is_array($fileToUpload) ? $fileToUpload : [$fileToUpload];
foreach ($files as $file) {
// If file is itself an array (multiple under same input name)
if (is_array($file)) {
foreach ($file as $f) {
if ($f !== null && $f->isValid() && !$f->hasMoved()) {
$fileName = $f->getRandomName(); // safer unique name
$f->move($filepath, $fileName);
$uploadedFiles[] = [
'file_name' => $fileName,
'file_path' => $filepath . $fileName
];
}
}
} else {
// Single file
if ($file !== null && $file->isValid() && !$file->hasMoved()) {
$fileName = $file->getRandomName();
$file->move($filepath, $fileName);
$uploadedFiles[] = [
'file_name' => $fileName,
'file_path' => $filepath . $fileName
];
}
}
}
return $uploadedFiles; // always return array
}
}
if (!function_exists('file_unlink')) { if (!function_exists('file_unlink')) {
function file_unlink($filepath) function file_unlink($filepath)
{ {

View File

@ -25,6 +25,7 @@ class BatchFileModel extends Model
"status", "status",
"error_data", "error_data",
"client_branch_id", "client_branch_id",
"policy_issue_date",
]; ];
// Callbacks // Callbacks

View File

@ -0,0 +1,56 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class ClaimDumpFileModel extends Model
{
protected $table = 'claim_dump_files';
protected $primaryKey = 'id';
protected $allowedFields = [
"id",
"file_name",
"status",
"reason",
"created_by",
"created_at",
"updated_by",
"updated_at",
"is_active",
];
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = ["checkAndADDCreatedByValue"];
protected $afterInsert = [];
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
protected function checkAndADDCreatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['created_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['created_by'] = get_session_userid();
}
return $data;
}
protected function checkAndUpdateUpdatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['updated_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['updated_by'] = get_session_userid();
}
return $data;
}
}

View File

@ -11,6 +11,8 @@ class ClaimFilesModel extends Model
protected $allowedFields = [ protected $allowedFields = [
'id', 'id',
'ticket_id', 'ticket_id',
'ticket_message_id',
'file_type',
'doc_name', 'doc_name',
'url', 'url',
'created_by', 'created_by',

View File

@ -21,22 +21,38 @@ class ClientRMModel extends Model
public function checkExistenceOfClientRelation($id, $user_id, $level) public function checkExistenceOfClientRelation($id, $user_id, $level)
{ {
$query = $this->where('client_id', $id) $query = $this->where('client_id', $id)
->where('user_id', $user_id) ->where('user_id', $user_id)
->where('level', $level) ->where('level', $level)
->countAllResults(); ->countAllResults();
return ($query > 0) ? true : false; return ($query > 0) ? true : false;
} }
public function getAllClientRM(){ public function getAllClientRM()
{
return $this->db->table('client_rm') return $this->db->table('client_rm')
->select('client_rm.client_id, client_rm.level,') ->select('client_rm.client_id, client_rm.level,')
->select('user_profiles.first_name as account_manager') ->select('user_profiles.first_name as account_manager')
->join('user_profiles', 'user_profiles.id = client_rm.user_id') ->join('user_profiles', 'user_profiles.id = client_rm.user_id')
->where('level', 3) ->where('level', 3)
->get() ->get()
->getResult(); ->getResult();
} }
public function findAccountManagerEmail($client_id)
{
$builder = $this->db->table('client_rm');
$builder->select('user_profiles.email');
$builder->join('user_profiles', 'user_profiles.id = client_rm.user_id');
$builder->where('client_rm.client_id', $client_id);
$builder->where('client_rm.level', 3); // Assuming level 3 is for account managers
$result = $builder->get()->getResultArray();
if (count($result) > 0) {
// Extract just the email values into a simple string array
return array_column($result, 'email');
} else {
return null; // or []
}
}
} }

View File

@ -20,7 +20,8 @@ class FileModel extends Model
"policy_id", "policy_id",
"client_branch_id", "client_branch_id",
"uploaded_by", "uploaded_by",
"updated_by" "updated_by",
"hr_file_id",
]; ];

View File

@ -7,5 +7,5 @@ use CodeIgniter\Model;
class GmailSentHistoryModel extends Model{ class GmailSentHistoryModel extends Model{
protected $table = 'gmail_sent_history'; protected $table = 'gmail_sent_history';
protected $primaryKey = 'id'; protected $primaryKey = 'id';
protected $allowedFields = ["id", "mail", "bcc", "cc", "message", "attachments", "client_id", "client_branch_id", "client_policy_id", "employee_policy_id", "employee_id", "mail_type", "gmail_api_status", "gmail_api_id", "created_by", "created_at", "updated_by", "updated_at", "isactive","received_message"]; protected $allowedFields = ["id", "mail", "bcc", "cc", "message", "attachments", "client_id", "client_branch_id", "client_policy_id", "employee_policy_id", "employee_id", "mail_type", "gmail_api_status", "gmail_api_id", "module", "pk", "from_mail", "created_by", "created_at", "updated_by", "updated_at", "isactive","received_message", "common"];
} }

View File

@ -0,0 +1,35 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class HrFileUploadModel extends Model
{
protected $table = 'hr_file_upload';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
// Allowed fields
protected $allowedFields = [
'client_id',
'client_branch_id',
'policy_id',
'policy_no',
'file_name',
'file_action',
'status',
'created_by',
'created_at',
'updated_by',
'updated_at'
];
// Automatically set timestamps
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
// Return type
protected $returnType = 'array';
}

View File

@ -101,6 +101,10 @@ class LeadsModel extends Model
'total_lives_at_incept', 'total_lives_at_incept',
'premium_at_incept', 'premium_at_incept',
'next_reminder_date',
'is_insurer_auto_mail',
'quote_received_insurer',
]; ];

View File

@ -33,7 +33,9 @@ class LevelContactModel extends Model
->select(' ->select('
level_contacts.id, level_contacts.id,
insurers.short_name as insurer_name, insurers.short_name as insurer_name,
insurers.id as insurer_id,
insurer_branch.branch_code, insurer_branch.branch_code,
insurer_branch.id as insurer_branch_id,
level_contacts.name as contact_person_name, level_contacts.name as contact_person_name,
level_contacts.email as contact_person_email level_contacts.email as contact_person_email
') ')
@ -51,7 +53,7 @@ class LevelContactModel extends Model
$query->where('insurer_branch.insurer_id', $insurer_id); $query->where('insurer_branch.insurer_id', $insurer_id);
} }
$result = $query->get()->getResultArray(); $result = $query->orderBy('insurers.id')->get()->getResultArray();
return $result; return $result;
} }

View File

@ -0,0 +1,89 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class PartnerEndorsementRequestModel extends Model
{
protected $table = 'partner_endorsement_request';
protected $primaryKey = 'id';
// Auto-increment
protected $useAutoIncrement = true;
// Return type
protected $returnType = 'array';
// Soft deletes (youre using is_active instead of deleted_at, so keep it false)
protected $useSoftDeletes = false;
// Allowed fields (columns you want to insert/update)
protected $allowedFields = [
'id',
'client_id',
'client_policy_id',
'insurer_id',
'insurer_branch_id',
'policy_number',
'endorsement_no',
'endorsement_type',
'endorsement_description',
'updated_by',
'is_active',
'created_by',
'manager_id',
'agent_id',
'status',
];
public function getRetailEndorsementList($client_id, $insurers_id, $status)
{
$query = $this->db->table('partner_endorsement_request per')
->distinct()
->select('
per.id,
per.client_id,
per.client_policy_id,
per.insurer_id,
per.insurer_branch_id,
per.policy_number,
per.endorsement_no,
per.endorsement_type,
per.endorsement_description,
per.created_at,
per.updated_by,
per.updated_at,
per.is_active,
per.created_by,
per.manager_id,
per.agent_id,
per.status,
i.name as insurer_name,
i.short_name as insurer_short_name,
c.client_name,
c.short_name as client_short_name,
ps.name as manager_name,
pa.name as agent_name
')
->join('insurers as i', 'i.id = per.insurer_id', 'left')
->join('clients as c', 'c.id = per.client_id AND c.client_type = 2', 'left')
->join('partner_staff as ps', 'ps.id = per.manager_id AND ps.role_id = 1', 'left')
->join('partner_agent as pa', 'pa.id = per.agent_id', 'left');
if (!empty($status)) {
$query->where('per.status', $status);
}
if (!empty($client_id)) {
$query->where('per.client_id', $client_id);
}
if (!empty($insurers_id)) {
$query->where('per.insurer_id', $insurers_id);
}
$query->orderBy('per.id', 'desc');
return $query->get()->getResultArray();
}
}

View File

@ -0,0 +1,56 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class PartnerManagerIncentiveFileModel extends Model
{
protected $table = 'partner_manager_incentive_file';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array'; // or 'object'
protected $useSoftDeletes = false;
protected $allowedFields = [
'manager_id',
'incentive_month',
'incentive_file_name',
'is_active',
'created_by',
'created_on',
'updated_by',
'updated_on'
];
// Timestamps
protected $useTimestamps = true;
protected $createdField = 'created_on';
protected $updatedField = 'updated_on';
protected $dateFormat = 'datetime'; // can be 'date' or 'int'
// Validation Rules (optional, can add more)
// protected $validationRules = [
// 'manager_id' => 'required|integer',
// 'incentive_month' => 'required|valid_date',
// 'incentive_file_name'=> 'required|string|max_length[150]',
// ];
// protected $validationMessages = [
// 'manager_id' => [
// 'required' => 'Manager ID is required',
// 'integer' => 'Manager ID must be a number',
// ],
// 'incentive_month' => [
// 'required' => 'Incentive Month is required',
// 'valid_date' => 'Incentive Month must be a valid date (Y-m-d)',
// ],
// 'incentive_file_name' => [
// 'required' => 'File name is required',
// 'max_length' => 'File name cannot exceed 150 characters',
// ],
// ];
// protected $skipValidation = false;
}

View File

@ -0,0 +1,72 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class PartnerPolicyModel extends Model
{
protected $table = 'partner_policy';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
// Allowed fields (make sure to include only updatable/insertable ones)
protected $allowedFields = [
'quotation_id',
'insured_name',
'rc_no',
'premium_amount',
'policy_number',
'payment_mode',
'policy_pdf_file_name',
'policy_payment_receipt_file_name',
'is_active',
'issued_date',
'start_date',
'end_date',
'manager_id',
'client_id',
'client_policy_id',
'vehicle_id',
'policy_transaction_id',
'pt_oc_share_details_id',
'created_by',
'updated_by'
];
// Optional settings
protected $useTimestamps = true; // enables auto timestamp
protected $createdField = 'created_on';
protected $updatedField = 'updated_on';
protected $dateFormat = 'datetime';
public function partnerPolicyList()
{
return $this->db->table('partner_policy as pp')
->select('
pp.id,
pp.id as partner_policy_id,
pp.enquiry_id,
pp.insured_name,
pp.policy_number,
pp.agent_id,
pp.manager_id,
pp.client_id,
pp.client_policy_id,
pp.is_active as partner_policy_is_active,
pe.insurer_id,
pe.is_active as partner_enquiry_is_active,
i.name as insurer_name,
i.short_name as insurer_short_name,
i.is_active as insurer_is_active
')
->join('partner_enquiry as pe', 'pe.id = pp.enquiry_id', 'left')
->join('insurers as i', 'i.id = pe.insurer_id', 'left')
->where('pp.is_active', 1)
->get()
->getResultArray();
}
// $data['partner_policy_list'] = $this->partnerPolicyModel
// ->where('is_active', 1)
// ->findAll();
}

View File

@ -0,0 +1,50 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class PartnerStaffModel extends Model
{
protected $table = 'partner_staff'; // table name
protected $primaryKey = 'id'; // primary key
protected $useAutoIncrement = true;
// return results as array
protected $returnType = 'array';
protected $useSoftDeletes = false;
// allowed fields for insert/update
protected $allowedFields = ['name','email','mobile','emp_id','role_id','email_otp','is_active','created_by','updated_by','manager_id'];
// automatic timestamps
protected $useTimestamps = true;
protected $createdField = 'created_on';
protected $updatedField = 'updated_on';
protected $dateFormat = 'datetime';
// validation rules
// protected $validationRules = [
// 'name' => 'required|min_length[2]|max_length[150]',
// 'email' => 'permit_empty|valid_email|max_length[150]',
// 'mobile' => 'permit_empty|regex_match[/^[0-9]{10,20}$/]',
// ];
// protected $validationMessages = [
// 'name' => [
// 'required' => 'Name is required',
// 'min_length' => 'Name must have at least 2 characters',
// 'max_length' => 'Name cannot exceed 150 characters'
// ],
// 'email' => [
// 'valid_email' => 'Please provide a valid email address',
// 'max_length' => 'Email cannot exceed 150 characters'
// ],
// 'mobile' => [
// 'regex_match' => 'Mobile number must be 1020 digits only'
// ]
// ];
// protected $skipValidation = false;
}

View File

@ -0,0 +1,45 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class ThzHistoryModel extends Model
{
protected $table = 'thz_history';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['thz_id','field_name','display_name','old_value','new_value','created_by','created_at','is_active'];
protected bool $allowEmptyInserts = false;
// Dates
protected $useTimestamps = false;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
}

View File

@ -12,7 +12,7 @@ class ThzMasterModel extends Model
protected $returnType = 'array'; protected $returnType = 'array';
protected $useSoftDeletes = false; protected $useSoftDeletes = false;
protected $protectFields = true; protected $protectFields = true;
protected $allowedFields = ['name','mobile','email','empcode','policy_no','ticket_type','subject','message','status','assign_to','created_at','updated_at']; protected $allowedFields = ['name','mobile','email','empcode','policy_no','ticket_type','subject','message','status','assign_to','created_at','updated_at','created_by','updated_by' ,'client_id' ,'policy_id' ,'branch_id'];
protected bool $allowEmptyInserts = false; protected bool $allowEmptyInserts = false;
@ -39,4 +39,22 @@ class ThzMasterModel extends Model
protected $afterFind = []; protected $afterFind = [];
protected $beforeDelete = []; protected $beforeDelete = [];
protected $afterDelete = []; protected $afterDelete = [];
public function ticketAutoFetchDetails($client_id ,$mobile){
$result = $this->db->table('employees e')
->select('e.id, e.email_personal,e.email_corporate, e.client_id, e.client_branch_id as branch_id, e.mobile, e.emp_code, e.name, ep.client_policy_id as policy_id')
->join('employee_polices ep', 'ep.employee_id = e.id AND ep.is_active = 1', 'left')
->whereIn('e.emp_status', ['active', 'draft', 'enrolled'])
->where('e.is_active', 1)
->where('e.mobile', $mobile)
->where('e.client_id', $client_id)
->groupBy('e.client_id')
->get()
->getResultArray();
return $result;
}
} }

View File

@ -12,7 +12,7 @@ class ThzMasterNotesModel extends Model
protected $returnType = 'array'; protected $returnType = 'array';
protected $useSoftDeletes = false; protected $useSoftDeletes = false;
protected $protectFields = true; protected $protectFields = true;
protected $allowedFields = ['thz_id','notes','notes_by','created_by','created_at']; protected $allowedFields = ['thz_id','notes','notes_by','created_by','created_at','notes_type'];
protected bool $allowEmptyInserts = false; protected bool $allowEmptyInserts = false;
@ -40,7 +40,7 @@ class ThzMasterNotesModel extends Model
protected $beforeDelete = []; protected $beforeDelete = [];
protected $afterDelete = []; protected $afterDelete = [];
public function ticketConversationList($thz_id){ public function ticketConversationLists($thz_id){
if(empty($thz_id)){ if(empty($thz_id)){
@ -76,5 +76,42 @@ class ThzMasterNotesModel extends Model
} }
public function ticketConversationList($thz_id , $returnType)
{
$ticketTypeFilter = "";
if ($returnType == 'api') {
//user only see his message
$ticketTypeFilter = "AND thz_master_notes.notes_type = 'External' ";
}
$integer_ticket_id = (int)$thz_id;
$notes_sql = "SELECT
thz_master_notes.*,
CASE
WHEN LOWER(thz_master_notes.notes_by) = 'staff'
THEN CONCAT(user_profiles.first_name, ' ', user_profiles.last_name)
WHEN LOWER(thz_master_notes.notes_by) = 'user'
THEN thz_master.name
ELSE thz_master_notes.notes_by
END AS name
FROM thz_master_notes
LEFT JOIN user_profiles
ON user_profiles.id = thz_master_notes.created_by
AND LOWER(thz_master_notes.notes_by) = 'staff'
LEFT JOIN thz_master
ON thz_master.thz_id = thz_master_notes.thz_id
AND LOWER(thz_master_notes.notes_by) = 'user'
WHERE thz_master_notes.thz_id = ". $integer_ticket_id ."
$ticketTypeFilter
ORDER BY thz_master_notes.created_at DESC";
$result = $this->db->query($notes_sql)->getResultArray();
return $result;
}
} }

View File

@ -0,0 +1,44 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class ThzTypeModel extends Model
{
protected $table = 'thz_type';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['name','created_at','updated_at','created_by','updated_by' ,'is_active'];
protected bool $allowEmptyInserts = false;
// Dates
protected $useTimestamps = false;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
}

View File

@ -76,8 +76,13 @@ class TicketMasterModel extends Model
'emp_personal_mail', 'emp_personal_mail',
'client_policy_id', 'client_policy_id',
'approved_description' 'approved_description',
'file_id',
'denial_letter',
'manager_id',
'agent_id' ,
'vehicle_id',
]; ];
@ -786,13 +791,13 @@ class TicketMasterModel extends Model
} }
//api //api
public function get_ticket_data($emp_id, $ticket_type = null, $ticket_id = null) public function get_ticket_data($emp_id, $returnType,$ticket_type = null, $ticket_id = null)
{ {
$query = $this->select('ticket_master.*, tms.mail_subject as subject') $query = $this->select('ticket_master.*, tms.mail_subject as subject, tms.id as ticket_message_id')
->join('ticket_messages tms', 'ticket_master.id = tms.ticket_id', 'left') ->join('ticket_messages tms', 'ticket_master.id = tms.ticket_id', 'left')
->where('ticket_master.is_active', 1) ->where('ticket_master.is_active', 1);
->where('tms.sender', "user") $query->whereIn('sender', ['staff', 'user']);
->where('ticket_master.emp_id', $emp_id); $query->where('ticket_master.emp_id', $emp_id);
if (!empty($ticket_id)) { if (!empty($ticket_id)) {
$query->where('ticket_master.id', $ticket_id); $query->where('ticket_master.id', $ticket_id);
@ -802,8 +807,10 @@ class TicketMasterModel extends Model
$query->where('ticket_master.ticket_type_id', $ticket_type); $query->where('ticket_master.ticket_type_id', $ticket_type);
} }
$query->groupBy('ticket_master.id');
$data = $query->findAll(); $data = $query->findAll();
// dd($data, db_connect()->getLastQuery()); // dd($data, db_connect()->getLastQuery());
// print_r($this->db->getLastQuery());die;
return $data; return $data;
} }
@ -883,8 +890,6 @@ class TicketMasterModel extends Model
return $finalResults; return $finalResults;
} }
public function getNotSettledbutApprovedCount($ticket_type) public function getNotSettledbutApprovedCount($ticket_type)
{ {
// Fetch the approved and settled claim_status IDs // Fetch the approved and settled claim_status IDs
@ -975,7 +980,198 @@ class TicketMasterModel extends Model
return json_encode(['policy_terms' => null]); return json_encode(['policy_terms' => null]);
} }
// ---------- CLAIM DUMP UPLOAD-------------------------------------------------------------------------------------------
public function getPolicyData($params)
{
$client_name = $params['client_name'] ?? null;
$insurer_short_name = $params['insurer_short_name'] ?? null;
$tpa_short_name = $params['tpa_short_name'] ?? null;
$policy_no = $params['policy_no'] ?? null;
$builder = $this->db->table('client_policy');
$builder->select('client_policy.*');
$builder->join('clients c', 'client_policy.client_id = c.id');
$builder->join('insurers i', 'client_policy.insurer_id = i.id');
$builder->join('tpa', 'client_policy.tpa_id = tpa.id and tpa.is_active = 1', 'left');
$builder->where('c.is_active', 1);
$builder->where('client_policy.is_active', 1);
$builder->where('i.is_active', 1);
$builder->where('c.client_name', trim($client_name));
$builder->where('i.short_name', trim($insurer_short_name));
if(!empty($tpa_short_name)){
$builder->where('tpa.short_name', trim($tpa_short_name));
}
$builder->where('client_policy.policy_no', trim($policy_no));
$query = $builder->get();
$result = $query->getResultArray();
// dd($this->db->getLastQuery());
return $result;
}
public function getTheClaimDetails($params)
{
$client_name = $params['client_name'] ?? null;
$policy_no = $params['policy_no'] ?? null;
$insurer_short_name = $params['insurer_short_name'] ?? null;
$tpa_short_name = $params['tpa_short_name'] ?? null;
$emp_code = $params['emp_code'] ?? null;
$emp_name = $params['emp_name'] ?? null;
$insured_name = $params['insured_name'] ?? null;
$claim_no = $params['claim_no'] ?? null;
$tpa_no = $params['tpa_no'] ?? null;
$relationship = $params['relationship'] ?? null;
$builder = $this->table('ticket_master');
$builder->select('ticket_master.*');
$builder->join('clients c', 'ticket_master.client_id = c.id');
$builder->join('insurers i', 'ticket_master.insurer_id = i.id');
$builder->join('tpa', 'ticket_master.tpa_id = tpa.id', 'left');
$builder->where('c.is_active', 1);
$builder->where('i.is_active', 1);
$builder->where('tpa.is_active', 1);
$builder->where('ticket_master.is_active', 1);
$builder->where('c.client_name', trim($client_name));
$builder->where('i.short_name', trim($insurer_short_name));
$builder->where('ticket_master.policy_no', trim($policy_no));
$builder->where('ticket_master.emp_code', trim($emp_code));
$builder->where('ticket_master.emp_name', trim($emp_name));
$builder->where('ticket_master.insured_name', trim($insured_name));
$builder->where('ticket_master.tpa_no', trim($tpa_no));
$builder->where('ticket_master.claim_number', trim($claim_no));
$builder->where('ticket_master.relationship', trim($relationship));
if(!empty($tpa_short_name)){
$builder->where('tpa.short_name', trim($tpa_short_name));
}
$query = $builder->get();
$result = $query->getResultArray();
return $result;
}
public function getEmployeeAndEmployeePolicyDetails($params)
{
$client_name = $params['client_name'] ?? null;
$emp_code = $params['emp_code'] ?? null;
$emp_name = $params['emp_name'] ?? null;
$policy_no = $params['policy_no'] ?? null;
$relationship = $params['relationship'] ?? null;
$insured_name = $params['insured_name'] ?? null;
// $client_name = "6-Eleven";
// $emp_code = "EMP0020K12";
// $emp_name = "Lokesh";
// $policy_no = "GMC-1999/2000/2021/2022";
$builder = $this->db->table('employees e');
$builder->select("
e.id as emp_id,
e.client_id,
e.client_branch_id,
e.emp_code,
e.name as emp_name,
e.mobile as emp_mobile,
e.email_corporate as emp_mail,
e.email_personal as emp_mail_personal,
ep.id as emp_policy_id,
ep.tpa_id as tpa_no,
cp.id as client_policy_id,
cp.insurer_id,
cp.tpa_id,
cp.policy_no,
CASE
WHEN cp.policy_type_id = 2 THEN 1
WHEN cp.policy_type_id = 1 THEN 2
WHEN cp.policy_type_id = 6 THEN 3
WHEN cp.policy_type_id = 7 THEN 4
ELSE NULL
END AS ticket_type_id
", false);
$builder->join('employee_polices ep', 'e.id = ep.employee_id');
$builder->join('clients c', 'e.client_id = c.id');
$builder->join('client_policy cp', 'ep.client_policy_id = cp.id');
$builder->where('e.is_active', 1);
$builder->where('ep.is_active', 1);
$builder->where('c.is_active', 1);
$builder->where('cp.is_active', 1);
$builder->where('e.emp_code', trim($emp_code));
$builder->where('e.name', trim($emp_name));
$builder->where('c.client_name', trim($client_name));
$builder->where('cp.policy_no', trim($policy_no));
$builder->where('LOWER(e.relationship)', strtolower('self'));
$query = $builder->get();
$result = $query->getRowArray();
return $result;
}
public function getAcmUserDetails($params)
{
$acm_name = $params['acm_name'] ?? null;
$acm_mobile = $params['acm_mobile'] ?? null;
if ($acm_mobile != null) {
$builder = $this->db->table('user_profiles');
$builder->select("user_profiles.*");
$builder->where('user_profiles.is_active', 1);
$builder->where('user_profiles.mobile', trim($acm_mobile));
$query = $builder->get();
$result = $query->getRowArray();
return $result;
}
return [];
}
public function getInsuredDetails($params)
{
$client_id = $params['client_id'] ?? null;
$emp_code = $params['emp_code'] ?? null;
$policy_id = $params['client_policy_id'] ?? null;
$insured_name = $params['insured_name'] ?? null;
$builder = $this->db->table('employees e');
$builder->select("
e.id as emp_id,
e.client_id,
e.client_branch_id,
e.emp_code,
e.name as emp_name,
e.mobile as emp_mobile,
e.email_corporate as emp_mail,
e.email_personal as emp_mail_personal,
ep.id as emp_policy_id,
ep.tpa_id as tpa_no,
");
$builder->join('employee_polices ep', 'e.id = ep.employee_id');
$builder->where('e.is_active', 1);
$builder->where('ep.is_active', 1);
$builder->where('e.emp_code', trim($emp_code));
$builder->where('e.name', trim($insured_name));
$builder->where('e.client_id', trim($client_id));
$builder->where('ep.client_policy_id', trim($policy_id));
$query = $builder->get();
$result = $query->getRowArray();
// dd($this->db->getLastQuery());
return $result;
}
// -----------------------------------------------------------------------------------------------------
} }

View File

@ -167,36 +167,22 @@
} }
} }
.navtab-bg .nav-link { #client_add .tab-content-styles{
margin: 0 5px 10px!important;
}
.nav-link{
color:black !important;
background-color: #D4F5F6 !important;
font-size: small;
padding:8px;
border-radius: 10px !important;
}
.nav-link.active-tab {
color: white !important;
background-color: #00999E !important;
font-size: small;
padding:8px;
border-radius: 10px !important;
}
.tab-content-styles{
background-color:#F4F4F4; background-color:#F4F4F4;
margin-right:20px; margin-right:20px;
margin-top:0px !important;
border-radius:25px!important; border-radius:25px!important;
min-height: 70vh !important; min-height: 70vh !important;
} }
.active{
color : white !important ;
}
</style> </style>
<p style="color:black;font-size:x-large;margin-left:50px;margin-bottom:20px;"><b>Dashboard</b></p> <p style="color:black;font-size:x-large;margin-left:20px !important;margin-bottom:20px;"><b>Dashboard</b></p>
<?php if(in_array(get_role_id(), [1,2,3,4,5]) || (in_array(ENROLLMENT_TEAM_ID, user_team()) || in_array(CLAIMS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?> <?php if(in_array(get_role_id(), [1,2,3,4,5]) || (in_array(ENROLLMENT_TEAM_ID, user_team()) || in_array(CLAIMS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
@ -204,20 +190,18 @@
<div class="col-12"> <div class="col-12">
<!-- <div class="card"> --> <!-- <div class="card"> -->
<div class="card-body"> <div class="card-body">
<br>
<ul class="nav nav-pills navtab-bg"> <ul class="nav nav-pills navtab-bg">
<?php if(in_array(get_role_id(), [1,2,3,5])) { ?> <?php if(in_array(get_role_id(), [1,2,3,5])) { ?>
<li class="nav-item d-flex justify-content-center align-items-center"> <li class="nav-item d-flex justify-content-center align-items-center">
<a href="#pending-actions-dash-tab" data-toggle="tab" aria-expanded="false" <a href="#pending-actions-dash-tab" data-toggle="tab" aria-expanded="false"
class="nav-link px-3 py-1 " id="pending_actions_tab"> class="nav-link px-3 py-1 dash-anchor" id="pending_actions_tab">
<img src="<?= base_url() . "public"; ?>/assets/images/inactive_pending_actions.png" alt="Logo" height="14" class="inactive_pending" > <img src="<?= base_url() . "public"; ?>/assets/images/inactive_pending_actions.png" alt="Logo" height="14" class="inactive_pending" >
<img src="<?= base_url() . "public"; ?>/assets/images/active_pending_actions.png" alt="Logo" height="14" <img src="<?= base_url() . "public"; ?>/assets/images/active_pending_actions.png" alt="Logo" height="14"
class="active_pending" style="display:none;"> class="active_pending" style="display:none;">
&nbsp;&nbsp; &nbsp;&nbsp;
<span class="d-none d-sm-inline-block">Pending Actions</span> <span class="d-none d-sm-inline-block dash-tab dash-tab-font">Pending Actions</span>
</a> </a>
</li> </li>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
@ -226,12 +210,12 @@
<?php if(in_array(get_role_id(), [1,2,3,5]) || (get_role_id() == 4 && in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?> <?php if(in_array(get_role_id(), [1,2,3,5]) || (get_role_id() == 4 && in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
<li class="nav-item d-flex justify-content-center align-items-center"> <li class="nav-item d-flex justify-content-center align-items-center">
<a href="#bds-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-1" id="bds_tab"> <a href="#bds-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-1 dash-anchor" id="bds_tab">
<img src="<?= base_url() . "public"; ?>/assets/images/inactive_bds.png" alt="Logo" height="14" class="inactive_bds"> <img src="<?= base_url() . "public"; ?>/assets/images/inactive_bds.png" alt="Logo" height="14" class="inactive_bds">
<img src="<?= base_url() . "public"; ?>/assets/images/active_bds.png" alt="Logo" height="14" <img src="<?= base_url() . "public"; ?>/assets/images/active_bds.png" alt="Logo" height="14"
class="active_bds" style="display:none;"> class="active_bds " style="display:none;">
&nbsp;&nbsp; &nbsp;&nbsp;
<span class="d-none d-sm-inline-block">BDS</span> <span class="d-none d-sm-inline-block dash-tab dash-tab-font">BDS</span>
</a> </a>
</li> </li>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
@ -242,12 +226,12 @@
$isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team()) ? 'active show' : ''; $isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team()) ? 'active show' : '';
?> ?>
<li class="nav-item d-flex justify-content-center align-items-center"> <li class="nav-item d-flex justify-content-center align-items-center">
<a href="#claims-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-1" id="claims_tab"> <a href="#claims-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-1 dash-anchor" id="claims_tab">
<img src="<?= base_url() . "public"; ?>/assets/images/inactive_claims.png" alt="Logo" height="14" class="inactive_claims"> <img src="<?= base_url() . "public"; ?>/assets/images/inactive_claims.png" alt="Logo" height="14" class="inactive_claims">
<img src="<?= base_url() . "public"; ?>/assets/images/active_claims.png" alt="Logo" height="14" <img src="<?= base_url() . "public"; ?>/assets/images/active_claims.png" alt="Logo" height="14"
class="active_claims" style="display:none;"> class="active_claims " style="display:none;">
&nbsp;&nbsp; &nbsp;&nbsp;
<span class="d-none d-sm-inline-block">Claims</span> <span class="d-none d-sm-inline-block dash-tab dash-tab-font">Claims</span>
</a> </a>
</li> </li>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
@ -256,13 +240,13 @@
<?php <?php
$isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_team()) ? 'active show' : ''; $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_team()) ? 'active show' : '';
?> ?>
<li class="nav-item d-flex justify-content-center align-items-center"> <li class="nav-item d-flex justify-content-center align-items-center ">
<a href="#leads-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-1" id="leads_tab" > <a href="#leads-dash-tab " data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-1 dash-anchor" id="leads_tab" >
<img src="<?= base_url() . "public"; ?>/assets/images/inactive_leads_and_bds_renewal.png" alt="Logo" height="14" class="inactive_leads"> <img src="<?= base_url() . "public"; ?>/assets/images/inactive_leads_and_bds_renewal.png" alt="Logo" height="14" class="inactive_leads">
<img src="<?= base_url() . "public"; ?>/assets/images/active_leads_and_bds_renewal.png" alt="Logo" height="14" <img src="<?= base_url() . "public"; ?>/assets/images/active_leads_and_bds_renewal.png" alt="Logo" height="14"
class="active_leads" style="display:none;"> class="active_leads " style="display:none;">
&nbsp;&nbsp; &nbsp;&nbsp;
<span class="d-none d-sm-inline-block">Leads and BDS Renewals</span> <span class="d-none d-sm-inline-block dash-tab dash-tab-font">Leads and BDS Renewals</span>
</a> </a>
</li> </li>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
@ -271,7 +255,7 @@
</ul> </ul>
<br>
<div class="tab-content tab-content-styles"> <div class="tab-content tab-content-styles">
<?php if ((get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team())) || in_array(get_role_id(),[1,5])) :?> <?php if ((get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team())) || in_array(get_role_id(),[1,5])) :?>
@ -375,3 +359,19 @@ $(document).ready(function(){
}); });
</script> </script>
<script>
$(document).on('click', '.dash-anchor', function () {
// remove active class from all tabs
$('.dash-tab').removeClass('active');
// add active only to the clicked one's child span
$(this).find('.dash-tab').addClass('active');
});
</script>

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@ table.dataTable thead th {
<a data-toggle="modal" data-target="#bike_make_login-modal" href="#" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a> <a data-toggle="modal" data-target="#bike_make_login-modal" href="#" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
</div> </div>
</div> </div>
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" <table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
id="tickets-table"> id="tickets-table">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>

View File

@ -25,7 +25,7 @@
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<table id="datatable-buttons" class="table table-hover m-0 table-centered dt-responsive w-100"> <table data-custom-table-css="table" id="datatable-buttons" class="table table-hover m-0 table-centered dt-responsive w-100">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th class="font-weight-medium">SNO</th> <th class="font-weight-medium">SNO</th>

View File

@ -132,7 +132,7 @@
border-radius: 15px !important; border-radius: 15px !important;
border:2px solid #09B9BF; border:2px solid #09B9BF;
box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.1), 0px 4px 8px rgba(0, 0, 0, 0.2); box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.1), 0px 4px 8px rgba(0, 0, 0, 0.2);
min-width: 250px; min-width: 300px;
} }
#bds-dash-tab{ #bds-dash-tab{
@ -158,14 +158,19 @@
<div class="tab-pane <?= isset($add_active_calss) ? $add_active_calss : 'fade' ?>" id="bds-dash-tab" > <div class="tab-pane <?= isset($add_active_calss) ? $add_active_calss : 'fade' ?>" id="bds-dash-tab" >
<div class="row">
<div class="StatusTileHide" style="display: none; padding-bottom: 10px;padding-left: 17px">
<a href="#" onclick="hide_status_show_pending_tile()" ><i class="fas fa-arrow-left"></i> Back to Overview</a> <div class="row d-flex align-items-center">
<div class="StatusTileHide" style="padding-left: 25px;">
<a href="#" onclick="hide_status_show_pending_tile()" ><b><i class="mdi mdi-chevron-left mdi-36px"></i></b> </a>
</div> </div>
<div class="StatusTileHide" style="display: none;padding-left: 30px;"> <div class="StatusTileHide" style="display: none;padding-left: 15px;">
<a href="#" id="mainMenuTiles">Current Tile : </a> <a href="#" id="mainMenuTiles">Current Tile : </a>
</div> </div>
</div> </div>
<br>
<div class="row"> <div class="row">
<div class="col inside-tab-content-div"> <div class="col inside-tab-content-div">
<?php if (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?> <?php if (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
@ -177,7 +182,7 @@
<h2> <h2>
<span class="mb-3 span-color"><?= $businessTeamCount ?> <span class="mb-3 span-color"><?= $businessTeamCount ?>
</h2> </h2>
<h6 >&nbsp;<span class="text-danger"> Team Action</span></h6> <h6 >&nbsp;<span class="text-danger"> Team Action </span></h6>
</div> </div>
</div> </div>
</div> </div>
@ -310,7 +315,7 @@ function show_business_status_tile(){
$('.businessStatusTile').show() $('.businessStatusTile').show()
$('.StatusTileHide').show() $('.StatusTileHide').show()
$("#mainMenuTiles").text("Viewing Details of Business Team Pending"); $("#mainMenuTiles").text(" Business Team Pending");
$('.businessPendingTile').hide() $('.businessPendingTile').hide()
$('.financePendingTile').hide() $('.financePendingTile').hide()
@ -338,7 +343,7 @@ function show_finance_status_tile(){
$('.financePendingTile').hide() $('.financePendingTile').hide()
$('.businessPendingTile').hide() $('.businessPendingTile').hide()
$("#mainMenuTiles").text("Viewing Details of Finance Team Pending"); $("#mainMenuTiles").text("Finance Team Pending");
} }

View File

@ -33,7 +33,7 @@
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap"> <table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead> <thead>
<tr> <tr>
<?php <?php

View File

@ -20,7 +20,7 @@ table.dataTable tbody td {
</div> </div>
<div> <div>
<div class="table-responsive"> <div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap"> <table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th> <th>

View File

@ -30,7 +30,7 @@ table.dataTable tbody td {
</div> </div>
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap"> <table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th>Insurer</th> <th>Insurer</th>

View File

@ -30,7 +30,7 @@ table.dataTable tbody td {
</div> </div>
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap"> <table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th>Insurer</th> <th>Insurer</th>

View File

@ -33,7 +33,7 @@
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap"> <table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead> <thead>
<tr> <tr>
<?php <?php

View File

@ -137,8 +137,8 @@ table.dataTable tbody td {
<label>Date<span class="text-danger"></span></label> <label>Date<span class="text-danger"></span></label>
<div id="reportrange" class="form-control" <div id="reportrange" class="form-control"
style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%"> style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
<i class="fa fa-calendar"></i>&nbsp; <i class="mdi mdi-calendar-blank"></i>&nbsp;
<span></span> <i class="fa fa-caret-down"></i> <span></span> <i class="mdi mdi-menu-down"></i>
</div> </div>
<input type="hidden" id="startDate"> <input type="hidden" id="startDate">
<input type="hidden" id="endDate"> <input type="hidden" id="endDate">
@ -179,7 +179,7 @@ table.dataTable tbody td {
</div> </div>
<div class="table-responsive" style="overflow-x: auto;"> <div class="table-responsive" style="overflow-x: auto;">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap"> <table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th>S.No</th> <th>S.No</th>

View File

@ -1,20 +1,21 @@
<!-- modal content --> <!-- modal content -->
<div id="con-close-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static"> <div id="con-close-modal" class="modal fade app-font-family" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog" <?= !isset($CD_Master_Data) ? 'style="max-width: 35% !important;"' : '' ?>> <div class="modal-dialog modal-dialog-centered modal-lg" <?= !isset($CD_Master_Data) ? 'style="max-width: 35% !important; margin:5px auto!important;"' : '' ?>>
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title" id="title">Add Opening Amount</h4> <h4 class="modal-title" id="title">Add Opening Amount</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="resetCdMasterFormModal()">×</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="resetCdMasterFormModal()">×</button>
</div> </div>
<div class="modal-body p-4"> <div class="modal-body">
<div class=""> <div class="">
<form role="form" class="parsley-examples" id="CDMasterForm" enctype="multipart/form-data"> <form role="form" class="parsley-examples" id="CDMasterForm" enctype="multipart/form-data">
<input type="hidden" name="PrimaryKey" id="CD_Master_ID" /> <input type="hidden" name="PrimaryKey" id="CD_Master_ID" />
<div class="form-group"> <div class="form-group">
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-12"> <div class="form-group col-md-6">
<label for="emp_code">Client<span class="text-danger">*</span></label> <label for="emp_code">Client<span class="text-danger">*</span></label>
<select class="form-control <?= !isset($CD_Master_Data) ? 'readonly-select' : '' ?>" id="cd_client_id" name="client_id" required> <select class="form-control <?= !isset($CD_Master_Data) ? 'readonly-select' : '' ?>" id="cd_client_id" name="client_id" required>
<option value="" >Select Client</option> <option value="" >Select Client</option>
@ -30,10 +31,8 @@
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
</div>
<div class="form-group col-md-6">
<div class="form-row">
<div class="form-group col-md-12">
<label for="profile">Insurer<span class="text-danger">*</span></label> <label for="profile">Insurer<span class="text-danger">*</span></label>
<select class="form-control <?= !isset($CD_Master_Data) ? 'readonly-select' : '' ?>" id="insurer_id_for_cd" name="insurer_id" <?= isset($CD_Master_Data) ? 'onchange="filterInsurerBranch(this)"' : '' ?> required> <select class="form-control <?= !isset($CD_Master_Data) ? 'readonly-select' : '' ?>" id="insurer_id_for_cd" name="insurer_id" <?= isset($CD_Master_Data) ? 'onchange="filterInsurerBranch(this)"' : '' ?> required>
<option value="">Select Insurer</option> <option value="">Select Insurer</option>
@ -45,7 +44,7 @@
</div> </div>
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-12"> <div class="form-group col-md-6">
<label for="insurer_branch_id">Insurer Branch<span class="text-danger">*</span></label> <label for="insurer_branch_id">Insurer Branch<span class="text-danger">*</span></label>
<select class="form-control <?= !isset($CD_Master_Data) ? 'readonly-select' : '' ?>" id="insurer_branch_id" name="insurer_branch_id" required> <select class="form-control <?= !isset($CD_Master_Data) ? 'readonly-select' : '' ?>" id="insurer_branch_id" name="insurer_branch_id" required>
<option value="">Select Insurer Branch</option> <option value="">Select Insurer Branch</option>
@ -55,24 +54,23 @@
<?php } } ?> <?php } } ?>
</select> </select>
</div> </div>
</div>
<div class="form-group col-md-6">
<div class="form-row">
<div class="form-group col-md-12">
<label for="email">Opening Date<span class="text-danger">*</span></label> <label for="email">Opening Date<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="opening_date" id="opening_date" required> <div class="input-icon">
<input type="text" class="form-control" name="opening_date" id="opening_date" required>
<i class="mdi mdi-calendar-blank-outline additional-icon"></i>
</div>
</div> </div>
</div> </div>
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-12"> <div class="form-group col-md-6">
<label for="mobile">CD Account Number<span class="text-danger">*</span></label> <label for="mobile">CD Account Number<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="cd_ac_no_for_cd_master" name="cd_ac_no" required> <input type="text" class="form-control" id="cd_ac_no_for_cd_master" name="cd_ac_no" required>
</div> </div>
</div>
<div class="form-group col-md-6">
<div class="form-row">
<div class="form-group col-md-12">
<label for="mobile">Opening Amount<span class="text-danger">*</span></label> <label for="mobile">Opening Amount<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="opening_bal" name="opening_bal" onkeypress="return onlyNumbers(event)" required> <input type="text" class="form-control" id="opening_bal" name="opening_bal" onkeypress="return onlyNumbers(event)" required>
</div> </div>
@ -81,7 +79,8 @@
</div> </div>
<div id="cdButtonWrapper" class="form-group text-right m-b-0"> <div id="cdButtonWrapper" class="form-group text-right m-b-0">
<button class="btn btn-primary waves-effect waves-light mr-1" id="cd_master_btn_Submit">Submit</button> <button class="btn app-btn-outline-secondary mr-2 " type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="resetCdMasterFormModal()">Cancel</button>
<button class="btn btn-primary waves-effect waves-light" id="cd_master_btn_Submit">Submit</button>
<!-- <button type="button" class="btn btn-secondry waves-effect waves-light mr-1" data-dismiss="modal" aria-hidden="true">Close</button> --> <!-- <button type="button" class="btn btn-secondry waves-effect waves-light mr-1" data-dismiss="modal" aria-hidden="true">Close</button> -->
</div> </div>
</form> </form>

View File

@ -44,9 +44,7 @@ table.dataTable thead th {
cursor: pointer !important; cursor: pointer !important;
} }
.addbtnStyle{
margin-left: 20px !important;
}
.dataTables_filter { .dataTables_filter {
position: absolute; position: absolute;
@ -57,10 +55,10 @@ table.dataTable thead th {
<div class="row" id="client_list"> <div class="row" id="client_list">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body maincard">
<div class="row" style="margin-bottom:1rem;"> <div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;"> <div class="col-6" style="align-self: center;">
<h4 style="position: relative;">CD Master List</h4> <h4 style="position: relative;">CD Master</h4>
</div> </div>
<div class="col-6" style="text-align: right; position: relative;top: 56px;"> <div class="col-6" style="text-align: right; position: relative;top: 56px;">
<!-- <button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" <!-- <button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light"
@ -68,7 +66,7 @@ table.dataTable thead th {
data-trigger="hover">ADD</button> --> data-trigger="hover">ADD</button> -->
</div> </div>
</div> </div>
<table id="scroll-horizontal-datatable" class="table w-100 nowrap" > <table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap" >
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th class="font-weight-medium">S.No.</th> <th class="font-weight-medium">S.No.</th>
@ -231,7 +229,7 @@ table.dataTable thead th {
}, },
{ {
text: 'Add', text: 'Add',
className: 'buttons-html5 addbtnStyle', className: 'buttons-html5 ',
action: function (e, dt, node, config) { action: function (e, dt, node, config) {
showCdMasterAddModal(); showCdMasterAddModal();
} }

View File

@ -0,0 +1,415 @@
<style>
.reload:hover {
cursor: pointer;
}
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
.addbtnStyle{
margin-left: 20px !important;
}
.dataTables_filter {
position: absolute;
}
</style>
<!-- <div class="row">
<div class="col-xl-12" style="margin-left: 14px;max-width: 98%;">
<div id="accordion1" class="mb-3">
<div class="card mb-1">
<h5 class="m-1">
<a id="toggleIcon1" class="text-dark float-right" data-toggle="collapse" href="#collapseTwo"
aria-expanded="true">
<i id="icon1" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</h5>
<div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion1">
<div class="card-body">
<form class="parsley-examples" id="claim-upload-form" enctype="multipart/form-data">
<div class="form-group">
<div class="form-row" id="file_upload">
<div class="form-group col-md-4">
<label>Upload file</label>
<input type="file" name="claim_dump_list" id="claim_dump_list" accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet" required>
</div>
<div class="d-flex align-items-center justify-content-start">
<div class="form-group col-md-11">
<div class="col-md-3">
<button id="claim_form_submit_button" type="submit" class="btn btn-primary waves-effect waves-light justify-content-end">Upload</button>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div> -->
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Files</h4>
</div>
</div>
<table data-custom-table-css="table" class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="tickets-table">
<thead class="bg-light">
<tr>
<th class="font-weight-medium">SNO</th>
<th class="font-weight-medium">File name</th>
<th class="font-weight-medium">User/Time</th>
<th class="font-weight-medium">Status</th>
<th class="font-weight-medium">Action</th>
</tr>
</thead>
<tbody class="font-12">
<?php
if (isset($claim_dump_file_data)) {
foreach ($claim_dump_file_data as $key => $file) {
?>
<tr>
<td><b><?php echo ($key + 1) ?></b></td>
<td style="overflow: hidden;" class="reload truncate" data-toggle="tooltip" data-placement="top" title="<?php echo $file['file_name'] ?>">
<?php echo $file['file_name'] ?>
</td>
<td><?php echo change_date_format($file['created_at'], 'Y-m-d H:i:s', 'd M Y h:i a') . ' by <strong>' . $file['user_name'] . '</strong>' ?> </td>
<td>
<?php if ($file['status'] == "failed") { ?>
<?= $file['status'] ?> <span class='col-xl-3 col-lg-4 col-sm-6'>
<!-- <a href="<?= base_url('util/claim_dump_excel_error/') . $file['file_id'] ?>" target="_blank" class='fe-alert-circle' data-err="<?= $file['file_id'] ?>"></a> -->
<a href="#" class='fe-alert-circle' onclick="fetchFileError(<?= $file['file_id'] ?>)"></a>
</span>
<?php } else if ($file['status'] == "inprogress") { ?>
<a data-id="<?= $file['status'] ?>" class="reload" href="#"><?= $file['status'] ?></a>
<?php } else { ?>
<?= $file['status'] ?>
<?php } ?>
</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 target="_blank" class="dropdown-item" href="<?= base_url("util/download_claim_dump_file/") . $file['file_id']; ?>"><i class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download</a>
<!-- <a data-id="<?php echo $file['file_id'] ?>" data-toggle="modal" data-target="#full-width-modal-emp-list" class="dropdown-item view_emp_list" href="#"><i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View</a> -->
</div>
</div>
</td>
</tr>
<?php }
} ?>
</tbody>
</table>
</div>
</div>
</div><!-- end col -->
<!-- Center modal content -->
<div class="modal fade" id="cliam-dump-file-err-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myCenterModalLabel">File Rejected Reason</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div id="modal_body" class="modal-body">
<div class="spinner-border text-primary" role="status" style="position: relative; left: 200px;"></div>
</div>
</div>
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Center modal content for upload file-->
<div class="modal fade" id="claim-file-upload-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">Claim Dump Upload</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<form class="parsley-examples" id="claim-upload-form" enctype="multipart/form-data">
<div class="form-group">
<div class="form-row" id="file_upload">
<div class="form-group col-md-9">
<label>Upload file</label>
<!-- &nbsp;[ <a href="#" id="excel_download" data-toggle="tooltip" data-placement="top" title="Download Sample Excel">Sample Excel</a> ] -->
<input type="file" name="claim_dump_list" id="claim_dump_list" accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet" required>
</div>
<div class="form-group col-md-3" style="margin-top: 18px;">
<button id="claim_form_submit_button" type="submit" class="btn btn-primary waves-effect waves-light justify-content-end">Upload</button>
</div>
</div>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
$(document).ready(function() {
// AJAX Form Submit Function
$('#claim-upload-form').on('submit', function(e) {
e.preventDefault(); // Prevent default form submission
// Get form data
var formData = new FormData(this);
var fileInput = $('#claim_dump_list')[0];
// Validate file type
var allowedTypes = [
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.ms-excel',
'application/vnd.oasis.opendocument.spreadsheet'
];
var selectedFile = fileInput.files[0];
if (!allowedTypes.includes(selectedFile.type)) {
alert('Please upload a valid Excel file (.xlsx, .xls, .ods)');
return false;
}
//form submit url;
let url = `<?php echo base_url('ticket/claim-upload'); ?>`;
// Show loading state
var submitButton = $('#claim_form_submit_button');
var originalText = submitButton.text();
submitButton.prop('disabled', true).text('Uploading...');
// AJAX request
$.ajax({
url: url, // Your route URL
type: 'POST',
data: formData,
processData: false, // CRITICAL: Don't process the data
contentType: false, // CRITICAL: Don't set content-type header
cache: false,
success: function(response) {
// Handle successful response
console.log('Upload successful:', response);
if (response.status == true) {
toastr.success(response.message, "SUCCESS");
} else {
toastr.error(response.message, "ERROR");
}
// Reset form
$('#claim-upload-form')[0].reset();
$('.close').click();
window.location.reload();
},
error: function(xhr, status, error) {
// Handle error response
console.error('Upload failed:', error);
console.error('Upload failed:', error);
},
complete: function() {
// Reset button state
submitButton.prop('disabled', false).text(originalText);
}
});
});
// File input change event for additional validation
$('#claim_dump_list').on('change', function() {
var fileInput = this;
var file = fileInput.files[0];
if (file) {
// Check file size (optional - set max size as needed, e.g., 10MB)
var maxSize = 10 * 1024 * 1024; // 10MB in bytes
if (file.size > maxSize) {
toastr.warning('File size should not exceed 10MB');
$(this).val(''); // Clear the input
return false;
}
// Display selected file name
var fileName = file.name;
if ($('#selected-file').length === 0) {
$('<div id="selected-file" class="mt-2 text-muted"><small>Selected file: <span id="file-name"></span></small></div>')
.insertAfter('#claim_dump_list');
}
$('#file-name').text(fileName);
}
});
$('body').on('click', '.reload', function() {
status = this.getAttribute('data-id')
console.log(status);
if (status == 'inprogress') {
window.location.reload(true);
}
})
});
// Datatable document ready
$(document).ready(function() {
var ticketsTable = $('#tickets-table');
if (ticketsTable.length) {
ticketsTable.DataTable({
scrollX: true,
dom: "<'row'<'col-sm-7'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [
{
text: 'Add',
className: 'buttons-html5 addbtnStyle',
action: function (e, dt, node, config) {
openDumpUploadModal();
}
}
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 15, // Set default number of rows per page (optional)
});
} else {
console.error("Table not found.");
}
});
function fetchFileError(file_id) {
var url = '<?php echo base_url('util/getClaimDumpFileErrorData/'); ?>';
let requestData = { file_id: file_id };
var myModal = new bootstrap.Modal(document.getElementById('cliam-dump-file-err-modal'));
myModal.show();
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
console.log('Data fetched successfully:', response);
$('#modal_body').empty();
if (response.status === true) {
var file_error_data = (JSON.parse(response.data));
var file_error_html = "";
for (var key in file_error_data['error_summary']) {
var err_id = parseInt(key);
var err_count = file_error_data['error_summary'][key];
switch (err_id) {
case 0:
file_error_html += "<strong>" + file_error_data['error_data'] + "</strong>";
break;
case 1:
file_error_html += "<strong>Mandatory values missing</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span><br>";
break;
case 2:
file_error_html += "<strong>Values not in expected format</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span><br>";
break;
case 3:
file_error_html += "<strong>Field contains not allowed values</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span><br>";
break;
case 4:
file_error_html += "<strong>Rule Conflict</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span><br>";
break;
case 5:
file_error_html += "<strong>" + (file_error_data['error_data'] || 'Error data not available') + "</strong>";
break;
case 6:
file_error_html += "<strong>" + (file_error_data['error_data'] || 'Error data not available') + "</strong>";
break;
case 7:
file_error_html += "<strong>Claim already exist</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span><br>";
break;
case 8:
file_error_html += "<strong>Policy not found</strong> <span class='badge badge-warning float-right'>" +
err_count + "</span><br>";
break;
case 9:
file_error_html += "<strong>Employee not found</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span><br>";
break;
case 10:
file_error_html += "<strong>ACM not found</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span><br>";
break;
default:
file_error_html += "<strong>Unknown error type</strong> <span class='badge badge-secondary float-right'>" +
err_count + "</span><br>";
break;
}
}
if (err_id != 5 && err_id != 6 && err_id != 0) {
file_error_html += (file_error_html != "" ?
"<a href ='<?php echo base_url('util/claim_dump_excel_error/') ?>" + file_id +
"' target=_blank>click here to more details...</a>" : "");
}
// console.log(file_error_html);
$('#modal_body').append(file_error_html);
} else {
console.log('Response status was false');
$('#modal_body').append('<div class="alert alert-warning">No error data available.</div>');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error('Status:', status);
console.error('Response:', xhr.responseText);
// Show error message to user
$('#modal_body').empty().append(
'<div class="alert alert-danger">Failed to fetch error data. Please try again.</div>'
);
});
}
$('.close').click(function(){
$('#modal_body').empty()
let html = `<div class="spinner-border text-primary" role="status" style="position: relative; left: 200px;"></div>`
$('#modal_body').append(html);
});
function openDumpUploadModal() {
var myModal = new bootstrap.Modal(document.getElementById('claim-file-upload-modal'));
myModal.show();
}
</script>

View File

@ -45,7 +45,7 @@
</div> </div>
<div class="table-responsive" style="overflow-x: auto;"> <div class="table-responsive" style="overflow-x: auto;">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap"> <table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th>S.No</th> <th>S.No</th>

View File

@ -138,7 +138,8 @@
border-radius:25px; border-radius:25px;
border:2px solid #09B9BF; border:2px solid #09B9BF;
box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.1), 0px 4px 8px rgba(0, 0, 0, 0.2); box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.1), 0px 4px 8px rgba(0, 0, 0, 0.2);
min-width: 250px; min-width: 300px;
max-width: 300px;
} }
#claims-dash-tab{ #claims-dash-tab{
@ -160,7 +161,7 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team(
<div class="card dash-card" onclick="hideAndShowTile(1,1)"> <div class="card dash-card" onclick="hideAndShowTile(1,1)">
<div class="card-block"> <div class="card-block">
<h4 class="mb-3">GMC</h4> <h4 class="mb-3">GMC</h4>
<h2 class="span-color"><span><?= isset($claim_data[1]['total']) ? $claim_data[1]['total'] : '0' ?></span></h2> <h2 ><span class="span-color"><?= isset($claim_data[1]['total']) ? $claim_data[1]['total'] : '0' ?></span></h2>
<h6><span class="text-danger">All GMC Records</span></h6> <h6><span class="text-danger">All GMC Records</span></h6>
</div> </div>
</div> </div>
@ -170,7 +171,7 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team(
<div class="card dash-card" onclick="hideAndShowTile(1,2)"> <div class="card dash-card" onclick="hideAndShowTile(1,2)">
<div class="card-block"> <div class="card-block">
<h4 class="mb-3">GPA</h4> <h4 class="mb-3">GPA</h4>
<h2 class="span-color"><span><?= isset($claim_data[2]['total']) ? $claim_data[2]['total'] : '0' ?></span></h2> <h2 ><span class="span-color"><?= isset($claim_data[2]['total']) ? $claim_data[2]['total'] : '0' ?></span></h2>
<h6><span class="text-danger">All GPA Records</span></h6> <h6><span class="text-danger">All GPA Records</span></h6>
</div> </div>
</div> </div>
@ -179,7 +180,7 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team(
<div class="card dash-card" onclick="hideAndShowTile(1,3)"> <div class="card dash-card" onclick="hideAndShowTile(1,3)">
<div class="card-block"> <div class="card-block">
<h4 class="mb-3">EDLI</h4> <h4 class="mb-3">EDLI</h4>
<h2 class="span-color"><span><?= isset($claim_data[3]['total']) ? $claim_data[3]['total'] : '0' ?></span></h2> <h2 ><span class="span-color"><?= isset($claim_data[3]['total']) ? $claim_data[3]['total'] : '0' ?></span></h2>
<h6><span class="text-danger">All EDLI Records</span></h6> <h6><span class="text-danger">All EDLI Records</span></h6>
</div> </div>
</div> </div>
@ -188,7 +189,7 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team(
<div class="card dash-card" onclick="hideAndShowTile(1,4)"> <div class="card dash-card" onclick="hideAndShowTile(1,4)">
<div class="card-block"> <div class="card-block">
<h4 class="mb-3">GTLI</h4> <h4 class="mb-3">GTLI</h4>
<h2 class="span-color"><span><?= isset($claim_data[4]['total']) ? $claim_data[4]['total'] : '0' ?></span></h2> <h2 ><span class="span-color"><?= isset($claim_data[4]['total']) ? $claim_data[4]['total'] : '0' ?></span></h2>
<h6><span class="text-danger">All GTLI Records</span></h6> <h6><span class="text-danger">All GTLI Records</span></h6>
</div> </div>
</div> </div>
@ -199,20 +200,22 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team(
</div> </div>
<div class="row"> <div class="row d-flex align-items-center">
<div class="goBack" style="padding-bottom: 10px;padding-left: 17px;"> <div class="goBack" style="padding-left: 25px;">
<a href="#" onclick="hideAndShowTile('2')" ><i class="fas fa-arrow-left"></i> Back to Overview<br></a> <a href="#" onclick="hideAndShowTile('2')" ><b><i class="mdi mdi-chevron-left mdi-36px"></i></b> </a>
</div> </div>
<div class="goBack" style="display: none;padding-left: 30px;"> <div class="goBack" style="display: none;padding-left: 15px;">
<a href="#" id="current_tile">Current Tile : </a> <a href="#" id="current_tile">Current Tile : </a>
</div> </div>
</div> </div>
<br>
<div class="row"> <div class="row">
<div class="col inside-tab-content-div"> <div class="col inside-tab-content-div">
<?php <?php
$colorSetCount = count($colorShades); // Number of color sets $colorSetCount = count($colorShades); // Number of color sets
$shadeCount = count($colorShades[0]); // Number of shades per set $shadeCount = count($colorShades[0]); // Number of shades per set
$index = 0; $index = 0;
?> ?>
<?php foreach ($claim_data as $ticketTypeId => $statuses) : ?> <?php foreach ($claim_data as $ticketTypeId => $statuses) : ?>
@ -239,16 +242,23 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team(
$truncatedStatus = strlen($formattedStatus) > 20 ? substr($formattedStatus, 0, 15) . '...' : $formattedStatus; $truncatedStatus = strlen($formattedStatus) > 20 ? substr($formattedStatus, 0, 15) . '...' : $formattedStatus;
$showTooltip = strlen($formattedStatus) > 20; $showTooltip = strlen($formattedStatus) > 20;
?> ?>
<?php
$formattedStatus = explode('-',$formattedStatus);
?>
<div class="claimStatusTitle claimStatusTitle_<?=$ticketTypeId?>" style="display: none;"> <div class="claimStatusTitle claimStatusTitle_<?=$ticketTypeId?>" style="display: none;">
<div class="card dash-card" onclick="linkRedirectForClaims(<?= $ticketTypeId ?>, '<?= $status ?>','<?= $statuses[$status . '_ids'] ?? '' ?>')"> <div class="card dash-card" onclick="linkRedirectForClaims(<?= $ticketTypeId ?>, '<?= $status ?>','<?= $statuses[$status . '_ids'] ?? '' ?>')">
<div class="card-block"> <div class="card-block">
<h5 class="text-right" <h5 class="text-right <?= isset($formattedStatus[1]) ? 'mt-1 mb-0':''?>">
<?= $showTooltip ? 'data-toggle="tooltip" title="' . htmlspecialchars($formattedStatus, ENT_QUOTES, 'UTF-8') . '"' : '' ?>> <span class="f-left" style="word-break: break-word; white-space: normal;">
<span class="f-left"> <?= $truncatedStatus ?> </span> <?= htmlspecialchars($formattedStatus[0], ENT_QUOTES, 'UTF-8') ?>
</span>
<span class="span-color"><?= $count ?></span> <span class="span-color"><?= $count ?></span>
<p class="text-left mt-1 mb-0" style="font-size: x-small !important;"><?= htmlspecialchars($formattedStatus[1]??'', ENT_QUOTES, 'UTF-8') ?></p>
</h5> </h5>
</div> </div>
</div> </div>
@ -312,13 +322,13 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team(
$('.claimStatusTitle_'+claimType).show(); $('.claimStatusTitle_'+claimType).show();
if (claimType == 1) { if (claimType == 1) {
$('#current_tile').text("Viewing Details For : GMC"); $('#current_tile').text(" GMC");
} else if (claimType == 2) { } else if (claimType == 2) {
$('#current_tile').text("Viewing Details For : GPA"); $('#current_tile').text(" GPA");
} else if (claimType == 3) { } else if (claimType == 3) {
$('#current_tile').text("Viewing Details For : EDLI"); $('#current_tile').text(" EDLI");
} else if (claimType == 4) { } else if (claimType == 4) {
$('#current_tile').text("Viewing Details For : GTLI"); $('#current_tile').text(" GTLI");
} }
} }
} }

View File

@ -33,7 +33,7 @@
</div> </div>
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap"> <table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light"> <thead class="bg-light">
<?php if ($policy_type != 1) {?> <?php if ($policy_type != 1) {?>
<tr> <tr>

View File

@ -29,7 +29,7 @@
</div> </div>
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap"> <table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th style="text-align: center;" colspan="8">OPEN</th> <th style="text-align: center;" colspan="8">OPEN</th>

View File

@ -44,7 +44,7 @@
</div> --> </div> -->
</div> </div>
<!-- <div class="table-responsive"> <!-- <div class="table-responsive">
<table class="table table-bordered table-striped"> <table data-custom-table-css="table" class="table table-bordered table-striped">
<tr> <tr>
<td>Get Individual Employee Data</td> <td>Get Individual Employee Data</td>
<td><?= base_url("getEmpData") ?></td> <td><?= base_url("getEmpData") ?></td>

View File

@ -64,11 +64,30 @@ input:checked + .slider:before {
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="card-body"> <div class="card-body">
<form role="form" class="parsley-examples" method="post" id="general_form" enctype="multipart/form-data"> <form role="form" class="parsley-examples" method="post" id="general_form" enctype="multipart/form-data">
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" /> <input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<input type="hidden" name="PrimaryKey" id="general_PrimaryKey" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/> <input type="hidden" name="PrimaryKey" id="general_PrimaryKey" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
<input type="hidden" name="client_id" id="client_id" /> <input type="hidden" name="client_id" id="client_id" />
<div class="form-group"> <div class="form-group">
<div class="form-row">
<div class="form-group">
<label for="">Upload Your Logo</label> <br>
<img
src="<?= isset($client['client_logo']) && !empty($client['client_logo']) ? base_url() . "public/uploads/logo/" . $client['client_logo'] : base_url()."public/assets/images/avatar_2x.png" ?>"
width="75" height="75"
id="uploadPreview"
class="avatar img-circle img-thumbnail"
style="border-radius:25px; border:1px solid #00999E;padding:10px;color:#00999E;"
alt="avatar"/>
<span style="margin-bottom:5px;">
<input type="file" name="client_logo" id="client_logo" accept="image/*" onchange="PreviewImage();"><br>
<i class="text">( Image dimensions 100 x 100 pixels and size of 200KB. )</i>
</span>
<br>
</div>
</div>
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="entity_type_id">Entity Type <span <label for="entity_type_id">Entity Type <span
@ -125,16 +144,7 @@ input:checked + .slider:before {
</div> </div>
<hr> <hr>
</div> </div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="gst">Logo</label>
<input type="file" name="client_logo" id="client_logo" accept="image/*" onchange="PreviewImage();"><br>
<i class="text">( Image dimensions 100 x 100 pixels and size of 200KB. )</i>
</div>
<div class="form-group col-md-6 float-right" style="position: relative;top: 20px;">
<img src="<?= isset($client['client_logo']) && !empty($client['client_logo']) ? base_url() . "public/uploads/logo/" . $client['client_logo'] : base_url()."public/assets/images/avatar_2x.png" ?>" width="100" height="100" id="uploadPreview" class="avatar img-circle img-thumbnail" alt="avatar"/>
</div>
</div>
<!-- <div> <!-- <div>
<label class="switch"> <label class="switch">
@ -346,7 +356,7 @@ input:checked + .slider:before {
if (!allowedExtensions.includes(fileExtension) || file.size > 200 * 1024) { if (!allowedExtensions.includes(fileExtension) || file.size > 200 * 1024) {
toastr.warning('Maximum file size allowed is 200KB.', 'File size exceeds limit.'); toastr.warning('Maximum file size allowed is 200KB.', 'File size exceeds limit.');
fileInput.value = ""; // Clear the file input fileInput.value = ""; // Clear the file input
document.getElementById("uploadPreview").src = "http://ssl.gstatic.com/accounts/ui/avatar_2x.png"; // Remove the preview image document.getElementById("uploadPreview").src = "<?= base_url()?>/public/assets/images/avatar_2x.png"; // Remove the preview image
} else { } else {
var reader = new FileReader(); var reader = new FileReader();
reader.readAsDataURL(file); reader.readAsDataURL(file);
@ -368,7 +378,7 @@ input:checked + .slider:before {
// Check if the file extension is allowed // Check if the file extension is allowed
if (!allowedExtensions.includes(fileExtension)) { if (!allowedExtensions.includes(fileExtension)) {
toastr.warning('Only JPG, JPEG, PNG files are allowed.', 'Invalid file type.'); toastr.warning('Only JPG, JPEG, PNG files are allowed.', 'Invalid file type.');
$("#uploadPreview").attr("src", "http://ssl.gstatic.com/accounts/ui/avatar_2x.png"); $("#uploadPreview").attr("src", "<?= base_url()?>/public/assets/images/avatar_2x.png");
input.value = ""; input.value = "";
} }
@ -377,7 +387,7 @@ input:checked + .slider:before {
const fileSize = file.size / 1024; // in KB const fileSize = file.size / 1024; // in KB
if (fileSize > 200) { if (fileSize > 200) {
toastr.warning('Maximum file size allowed is 200KB.', 'File size exceeds limit.'); toastr.warning('Maximum file size allowed is 200KB.', 'File size exceeds limit.');
$("#uploadPreview").attr("src", "http://ssl.gstatic.com/accounts/ui/avatar_2x.png"); $("#uploadPreview").attr("src", "<?= base_url()?>/public/assets/images/avatar_2x.png");
input.value = ""; input.value = "";
} }
@ -386,7 +396,7 @@ input:checked + .slider:before {
img.onload = function() { img.onload = function() {
if (this.width !== 100 || this.height !== 100) { if (this.width !== 100 || this.height !== 100) {
toastr.warning('Image dimensions should be 100x100 pixels.', 'Invalid image dimensions.'); toastr.warning('Image dimensions should be 100x100 pixels.', 'Invalid image dimensions.');
$("#uploadPreview").attr("src", "http://ssl.gstatic.com/accounts/ui/avatar_2x.png"); $("#uploadPreview").attr("src", "<?= base_url()?>/public/assets/images/avatar_2x.png");
} }
// If both size and dimensions are valid, you can proceed with your logic here // If both size and dimensions are valid, you can proceed with your logic here
// For example, you can display the image // For example, you can display the image

View File

@ -49,13 +49,13 @@
<input type="hidden" id="client_id_for_client_branch" value="<?= isset($client['id']) ? $client['id'] : '' ?>" /> <input type="hidden" id="client_id_for_client_branch" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;"> <div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span <button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span
class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button> class="mdi mdi-plus-box-outline" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button>
</div> </div>
<div class="table-responsive" id="branch_table"> <div class="table-responsive" id="branch_table">
<table class="table table-borderless table-nowrap mb-0"> <table data-custom-table-css="table" class="table table-borderless table-nowrap mb-0">
<thead class="thead-light"> <thead class="">
<tr> <tr>
<th>Branch Name</th> <th>Branch Name</th>
<th>Branch Code</th> <th>Branch Code</th>
@ -72,7 +72,7 @@
<div class="card-body"> <div class="card-body">
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;"> <div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
<button type="button" id="btnBranchBack" <button type="button" id="btnBranchBack"
class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="mdi mdi-format-list-bulleted"
aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button> aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
</div> </div>
@ -343,6 +343,8 @@ $('.btnBack').click(function() {
} }
} }
window.scrollTo({ top: 0, behavior: 'smooth' });
}) })
$("#branch_form").submit(function(event) { $("#branch_form").submit(function(event) {
@ -466,7 +468,12 @@ $("#branch_form").submit(function(event) {
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
console.log('Something Wrong!', 'warning'); console.log('Something Wrong!', 'warning');
}, 300); }, 300);
},
complete: function() {
console.log('Ajax request completed');
window.scrollTo({ top: 0, behavior: 'smooth' });
} }
}); });
} }
contactCount = 1 contactCount = 1
@ -511,7 +518,7 @@ $('body').on('click', '.btnBranchEdit', function() {
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}, 500); }, 500);
// console.log('branch contact : ',res.contact)
$('#add_branch').show(); $('#add_branch').show();
$('#branch_table').hide(); $('#branch_table').hide();

View File

@ -10,13 +10,13 @@
</div> </div>
<div class="col-6" style="text-align: right;"> <div class="col-6" style="text-align: right;">
<a href="<?= base_url("client/list"); ?>"><i class="fas fa-arrow-left" style="font-size: 17px;"></i></a> <a href="<?= base_url("client/list"); ?>"><i class="mdi mdi-arrow-left" style="font-size: 17px;"></i></a>
</div> </div>
<!-- <div class="col-6" style="text-align: right; position: relative;top: 53px;"> <!-- <div class="col-6" style="text-align: right; position: relative;top: 53px;">
<a href="<?= base_url("client/client_deposit"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a> <a href="<?= base_url("client/client_deposit"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
</div> --> </div> -->
</div> </div>
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" <table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
id="tickets-table"> id="tickets-table">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>

View File

@ -1,3 +1,16 @@
<style>
#relationship_manager {
border-collapse: separate; /* important */
border-spacing: 20px 0; /* 20px horizontal, 0 vertical */
}
#client_info_modal .modal-body{
padding:20px 0px 10px 40px !important;
}
</style>
<div id="client_info"> <div id="client_info">
<div class="row"> <div class="row">
@ -34,62 +47,25 @@
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"> <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body" style="position: relative;bottom: 25px;"> <div class="card-body" style="position: relative;bottom: 25px;">
<h2>Relationship Manager</h2>
<br>
<div class="row"> <div class="row">
<!-- <table id="relationship_manager">
<div class="col-6"> <thead>
<tr style="color:black;">
<table> <th>Account Manager</th>
<tr> <th>Manager</th>
<td style="font-size: 18px;"></td> <th>Head</th>
</tr> </tr>
</thead>
<tbody>
<tr style="color:black;">
<td><?= implode(', ', $account_managers) ?></td>
<td><?= implode(', ', $managers) ?></td>
<td><?= implode(', ', $heads) ?></td>
</tr>
</tbody>
</table> </table>
</div> -->
<div class="col-6">
<table>
<tr>
<td style="font-size: 18px;"> <strong> Relationship Manager </strong></td>
</tr>
</table>
</div>
</div>
<br>
<div class="row">
<!-- <div class="col-6">
<table>
<tr>
<td style="padding: 3px;"></td>
</tr>
<tr>
<td style="padding: 3px;"></td>
</tr>
</table>
</div> -->
<div class="col-6">
<table>
<tr>
<td style="padding: 3px;"><label> Account Manager :
</label> <?= implode(', ', $account_managers) ?></td>
</tr>
<tr>
<td style="padding: 3px;"><label> Manager :
</label> <?= implode(', ', $managers) ?></td>
</tr>
<tr>
<td style="padding: 3px;"><label> Head : </label>
<?= implode(', ', $heads) ?>
</td>
</tr>
</table>
</div>
</div> </div>
@ -120,7 +96,7 @@
<div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"> <div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body" style="position: relative;bottom: 25px;"> <div class="card-body" style="position: relative;bottom: 25px;">
<div class="row"> <div class="row">
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" <table data-custom-table-css="table" class="table table-hover m-0 table-centered dt-responsive nowrap w-100"
cellspacing="0"> cellspacing="0">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
@ -138,7 +114,7 @@
<?php foreach ($client_policy as $key => $value) { ?> <?php foreach ($client_policy as $key => $value) { ?>
<tr class="policy_terms" <tr class="policy_terms"
data-id="<?= htmlspecialchars($value['policy_terms']) ?>" data-id="<?= htmlspecialchars($value['policy_terms']) ?>"
data-toggle="modal" data-target="#bs-example-modal-lg"> data-toggle="modal" data-target="#client_info_modal">
<td><?= $value['branch_name'] ?></td> <td><?= $value['branch_name'] ?></td>
<td><?= $value['policy_type'] ?></td> <td><?= $value['policy_type'] ?></td>
<td><?= $value['insurer_short_name'] ?></td> <td><?= $value['insurer_short_name'] ?></td>
@ -205,7 +181,7 @@
<div id="collapseThree" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"> <div id="collapseThree" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body" style="position: relative;bottom: 25px;"> <div class="card-body" style="position: relative;bottom: 25px;">
<div class="row"> <div class="row">
<table id="tb1" class="table table-hover m-0 table-centered dt-responsive nowrap w-100" <table data-custom-table-css="table" id="tb1" class="table table-hover m-0 table-centered dt-responsive nowrap w-100"
cellspacing="0"> cellspacing="0">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
@ -243,7 +219,7 @@
<!-- Modal content for the Large example --> <!-- Modal content for the Large example -->
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" <div class="modal fade" id="client_info_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true" aria-modal="true" data-backdrop="static" style="padding-right: 15px"> aria-hidden="true" aria-modal="true" data-backdrop="static" style="padding-right: 15px">
<div class="modal-dialog modal-full-width"> <div class="modal-dialog modal-full-width">
<div class="modal-content"> <div class="modal-content">

View File

@ -1,4 +1,35 @@
<style> <style>
#kyc_table #tbody td,
#other_docs_table tbody td
{
background-color: white !important;
}
#kyc_table #tbody tr ,
#other_docs_table tbody tr
{
box-shadow: 0px 2px 4px 0px #00000024;
background-color: white;
border-radius: 10px;
}
#kyc_table #tbody tr:hover td ,
#other_docs_table tr:hover td
{
background-color: #e0e0e0 !important;
}
#KYC-DOC-tab .card-body ,
#other_docs_table .card-body
{
background-color: #F5FFFF !important;
border-radius: 10px;
box-shadow: 0px 4px 4px 0px #00000040;
}
#KYC-DOC-tab thead{
padding: 15px !important;
}
</style> </style>
@ -9,22 +40,22 @@
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<div class="table-responsive"> <div class="table-responsive">
<table id="kyc_table" class="table table-sm mb-0"> <table data-custom-table-css="table" id="kyc_table" class="table table-sm mb-0">
<thead> <thead>
<tr> <tr>
<th>S.no</th>
<th>Document Name</th> <th>Document Name</th>
<th>Status</th> <th>Status</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
</thead> </thead>
<tbody id="tbody"> <tbody id="tbody">
<?= isset($client_kyc_primary_table) ? $client_kyc_primary_table : "" ?>
</tbody> </tbody>
</table> </table>
</div> <!-- end table-responsive--> </div> <!-- end table-responsive-->
<hr> <!-- <button class="btn btn-primary waves-effect waves-light btn-sm" id="btn_other_docs">Other Documents</button> -->
<button class="btn btn-primary waves-effect waves-light btn-sm" id="btn_other_docs">Other Documents</button>
</div> </div>
</div> <!-- end card --> </div> <!-- end card -->
@ -34,28 +65,31 @@
<div class="col-12"> <div class="col-12">
<div class="card" style="margin-left: 12px;margin-right: -12px;"> <div class="card" style="margin-left: 12px;margin-right: -12px;">
<div class="card-body"> <div class="card-body">
<h3>Additional Documents</h3>
<form role="form" class="parsley-examples" method="post" id="kyc_form" <form role="form" class="parsley-examples" method="post" id="kyc_form"
enctype="multipart/form-data"> enctype="multipart/form-data">
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" /> <input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<input type="hidden" name="PrimaryKey" id="kyc_PrimaryKey" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/> <input type="hidden" name="PrimaryKey" id="kyc_PrimaryKey" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
<input type="hidden" name="client_id" id="client_id_kyc" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/> <input type="hidden" name="client_id" id="client_id_kyc" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
<input type="hidden" name="kyc_doc_type_id" value="0" /> <input type="hidden" name="kyc_doc_type_id" value="" />
<div class="form-group"> <div class="form-group">
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="emp_code">Other Documents<span <label for="emp_code">Document Name<span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<input type="text" class="form-control" id="other_docs_name" placeholder="Document Name" name="other_docs_name" required> <input type="text" class="form-control" id="other_docs_name" placeholder="Document Name" name="other_docs_name" required>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="kyc_docs">File<span <label for="kyc_docs">File<span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<input class="form-control" type="file" name="file_name" id="kyc_docs_file" required accept=".pdf, .jpeg, .jpg, .png"> <input class="form-control" type="file" name="file_name"
id="kyc_docs_file"
required accept=".pdf, .jpeg, .jpg, .png">
</div> </div>
<!-- <div class="form-group col-md-4 align-self-end"> --> <!-- <div class="form-group col-md-4 align-self-end"> -->
<div class="form-group col-md-4" style="<?= isset($client['id']) ? 'margin-top: 41px;' : 'margin-top: 30px;' ?>"> <div class="form-group col-md-4" style="<?= isset($client['id']) ? 'margin-top: 41px;' : 'margin-top: 30px;' ?>">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"id="btnSubmit">Upload</button> <button type="submit" class="btn btn-primary waves-effect waves-light mr-1"id="btnSubmit">Save</button>
</div> </div>
</div> </div>
@ -70,7 +104,7 @@
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<div class="table-responsive"> <div class="table-responsive">
<table id="kyc_table" class="table table-sm mb-0"> <table data-custom-table-css="table" id="kyc_table" class="table table-sm mb-0">
<thead> <thead>
<tr> <tr>
<th>Document Name</th> <th>Document Name</th>
@ -79,10 +113,10 @@
</tr> </tr>
</thead> </thead>
<tbody id="other_docs"> <tbody id="other_docs">
<?= isset($client_kyc_other_table) ? $client_kyc_other_table : "" ?>
</tbody> </tbody>
</table> </table>
</div> <!-- end table-responsive--> </div> <!-- end table-responsive-->
</div> </div>
</div> <!-- end card --> </div> <!-- end card -->
</div> <!-- end col --> </div> <!-- end col -->
@ -97,10 +131,6 @@
$(document).ready(function(){ $(document).ready(function(){
kycPrimaryKey = $('#kyc_PrimaryKey').val(); kycPrimaryKey = $('#kyc_PrimaryKey').val();
$('#others').hide()
$('#other_docs_table').hide();
$(document).on('click', '.submit', function(e) { $(document).on('click', '.submit', function(e) {
e.preventDefault(); e.preventDefault();
@ -111,7 +141,6 @@
var fileInputs = form.find('input[type="file"]'); var fileInputs = form.find('input[type="file"]');
var allowedExtensions = ['pdf', 'png', 'jpeg', 'jpg']; var allowedExtensions = ['pdf', 'png', 'jpeg', 'jpg'];
if (kycPrimaryKey === '') { if (kycPrimaryKey === '') {
toastr.error('Client is required', 'Error'); toastr.error('Client is required', 'Error');
form.trigger('reset') form.trigger('reset')
@ -141,7 +170,6 @@
return; return;
} }
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
@ -152,94 +180,32 @@
processData: false, processData: false,
contentType: false, contentType: false,
success: function (res) { success: function (res) {
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
// res = JSON.parse(res)
console.log(res);
if(res){ console.log('KYC PRIMARY SUBMIT', res);
setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
toastr.success('File Uploaded successfully', 'Success');
}, 500); if(res.status == true){
$('#tbody').empty();
$('#tbody').append(res.data);
toastr.success('File uploaded successfully', 'Success');
}else{
toastr.warning('File uploaded failed', 'WARNING');
} }
form.trigger('reset')
$.each(res.data, function (index, item) {
$('#name_'+item.kyc_doc_type_id).show();
$('#name_'+item.kyc_doc_type_id).html(item.file_name);
$('#form_'+item.kyc_doc_type_id).hide();
// var url = "<?= base_url('/downloadGdriveFile'); ?>" +
// "?client_id=" + item.client_id +
// "&file_type=kyc" +
// "&file_name=" + item.file_name +
// "&client_policy_id=client_policy_id";
var url = '<?= base_url('download-kyc-docs/') ?>' + item.file_name;
// console.log('step 1')
if(item.file_name != null && item.file_name != ""){
// console.log('step 2')
$('#download_'+item.kyc_doc_type_id).show();
$('#download_' + item.kyc_doc_type_id).attr('href', url);
$('#delete_'+item.kyc_doc_type_id).show();
}
else{
// console.log('step 3')
$('#download_'+item.kyc_doc_type_id).hide();
$('#download_' + item.kyc_doc_type_id).attr('href', '#');
$('#delete_'+item.kyc_doc_type_id).hide();
}
// console.log('step 4')
});
}, },
error: function (xhr, status, error) { error: function (xhr, status, error) {
console.error(xhr.responseText); console.error(xhr.responseText);
console.error(status, error); console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning'); toastr.warning('Something Wrong!', 'warning');
}, 1000);
} }
}); });
}); });
if(kycPrimaryKey !== ''){
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var entity_type_id = '<?= isset($client['entity_type_id']) ? $client['entity_type_id'] : '' ?>'
var client_id = '<?= isset($client['id']) ? $client['id'] : '' ?>'
getKYCEntityDocument(entity_type_id, client_id);
var data = <?= isset($client_kyc) ? json_encode($client_kyc) : '[]' ?>;
appendKycTableListData(data)
}
}) })
$('#btn_other_docs').click(function(){
$('#others').toggle();
$('#other_docs_table').toggle();
});
/*** for Others documents form submit ***/ /*** for Others documents form submit ***/
$("#kyc_form").submit(function(event) { $("#kyc_form").submit(function(event) {
event.preventDefault(); event.preventDefault();
@ -255,6 +221,7 @@
form_action = '<?= base_url("client/kyc/edit"); ?>'; form_action = '<?= base_url("client/kyc/edit"); ?>';
} }
var formData = new FormData($('#kyc_form')[0]); var formData = new FormData($('#kyc_form')[0]);
formData.append("form_type", "others");
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
@ -268,74 +235,27 @@
contentType: false, contentType: false,
success: function(res) { success: function(res) {
setTimeout(function() { console.log('KYC OTHERS SUBMIT', res);
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
// console.log(res); if(res.status == true){
$('#kyc_form').trigger('reset'); $('#other_docs').empty();
if(res){ $('#other_docs').append(res.data);
setTimeout(function() { toastr.success('File uploaded successfully', 'Success');
$('.loader').fadeOut(); }else{
$('.loader-mask').delay(350).fadeOut('slow'); toastr.warning('File uploaded failed', 'WARNING');
var message = (kycPrimaryKey === '') ? 'KYC Other Docs Uploaded successfully' : 'KYC Other Docs Uploaded successfully';
toastr.success(message, 'Success');
}, 500);
} }
var other_docs_count = 0; $('#kyc_form').trigger('reset');
$('#other_docs tr').remove();
$.each(res.data, function(index, item) {
if(item.other_docs_name != ""){
other_docs_count++;
}
// var url = "<?= base_url('/downloadGdriveFile'); ?>" +
// "?client_id=" + item.client_id +
// "&file_type=kyc" +
// "&file_name=" + item.file_name +
// "&client_policy_id=client_policy_id";
var url = '<?= base_url('download-kyc-docs/') ?>' + item.file_name;
// console.log("Current item:", item);
if (item.kyc_doc_type_id == '0') {
// console.log("Appending item:", item);
var rowHtml = `
<tr id="kyc-${item.id}">
<td>${item.other_docs_name}</td>
<td>${item.file_name}</td>
<td>
<a href = "${url}" data-id="${item.id}" class="fa fa-download" style="font-size:18px;" download></a>
</td>
</tr>
`;
}
$('#other_docs').append(rowHtml);
//<i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
if(other_docs_count > 0){
$('#others').show()
$('#other_docs_table').show();
}
});
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(xhr.responseText); console.error(xhr.responseText);
console.error(status, error); console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning'); toastr.warning('Something Wrong!', 'warning');
}, 1000);
} }
}); });
@ -402,6 +322,8 @@
contentType: false, contentType: false,
success: function (res) { success: function (res) {
console.log("KYC DOCUMENTS TABLE RSPONSE", res);
setTimeout(function() { setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
@ -412,6 +334,7 @@
$.each(res.data, function(index, item) { $.each(res.data, function(index, item) {
var row = `<tr> var row = `<tr>
<td>${index+1}</td>
<td>${item.file_name}</td> <td>${item.file_name}</td>
<td id="form_${item.id}"> <td id="form_${item.id}">
<form class="ajax"> <form class="ajax">
@ -419,12 +342,12 @@
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>"> <input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>">
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id"> <input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id">
<input type="hidden" name="client_id" value="${client_id}"> <input type="hidden" name="client_id" value="${client_id}">
<button class="btn btn-sm btn-primary submit" style="position: relative; right: 80px;">Submit</button> <button class="btn btn-sm btn-primary submit" style="position: relative; right:0px;">Submit</button>
</form> </form>
</td> </td>
<td id="name_${item.id}" style="display:none;"></td> <td id="name_${item.id}" style="display:none;"></td>
<td> <td>
<a id="download_${item.id}" data-id="${item.id}" class="fa fa-download" style="font-size:18px; display: none" download></a> <a id="download_${item.id}" data-id="${item.id}" class="mdi mdi-download" style="font-size:18px; display: none" download></a>
</td> </td>
</tr>`; </tr>`;
tbody.append(row); tbody.append(row);
@ -480,13 +403,12 @@
<td>${item.other_docs_name}</td> <td>${item.other_docs_name}</td>
<td>${item.file_name}</td> <td>${item.file_name}</td>
<td> <td>
<a href = "${url}" data-id="${item.id}" class="fa fa-download" style="font-size:18px;" target="_blank"></a> <a href = "${url}" data-id="${item.id}" class="mdi mdi-download" style="font-size:18px;" target="_blank"></a>
</td> </td>
</tr> </tr>
`; `;
} }
// <i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i> // <i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
}); });

View File

@ -0,0 +1,14 @@
<?php if (isset($data) && !empty($data)): ?>
<?php foreach ($data as $index => $item): ?>
<tr id="kyc-<?= $item['id'] ?>">
<!-- <td><?= $index + 1; ?></td> -->
<td><?= esc($item['file_name']); ?></td>
<td><?= esc($item['other_docs_name']); ?></td>
<td><a id="download_<?= esc($item['id']); ?>" data-id="<?= esc($item['id']); ?>" class="mdi mdi-download" style="font-size:18px;" download></a></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="5" class="text-center">No records found</td>
</tr>
<?php endif; ?>

View File

@ -0,0 +1,28 @@
<?php if (isset($data) && !empty($data)): ?>
<?php foreach ($data as $index => $item): ?>
<tr>
<td><?= $index + 1; ?></td>
<td><?= esc($item['file_name']); ?></td>
<?php if(empty($item['upload_doc_name'])) { ?>
<td id="form_<?= esc($item['id']); ?>">
<form class="ajax" enctype="multipart/form-data" method="post">
<input class="file-input__input" type="file" name="file_name">
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>">
<input type="hidden" class="form-control" value="<?= esc($item['id']); ?>" name="kyc_doc_type_id">
<input type="hidden" name="client_id" value="<?= esc($client_id); ?>">
<button type="submit" class="btn btn-sm btn-primary submit" style="position: relative; right: 80px;">Submit</button>
</form>
</td>
<td></td>
<?php } else { ?>
<td><?= esc($item['upload_doc_name']); ?></td>
<td><a id="download_<?= esc($item['id']); ?>" data-id="<?= esc($item['id']); ?>" class="mdi mdi-download" style="font-size:18px;" download></a></td>
<?php } ?>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="5" class="text-center">No records found</td>
</tr>
<?php endif; ?>

View File

@ -1,3 +1,4 @@
<style> <style>
.table th, .table th,
.table td { .table td {
@ -47,6 +48,26 @@ table.dataTable thead th {
color: #16181b !important; color: #16181b !important;
cursor: pointer !important; cursor: pointer !important;
} }
.add-from-lead{
color:#E26828;
border : 0px solid white ;
background-color: white;
text-decoration: underline ;
}
.add-from-lead:hover{
color:#E26828;
border : 0px solid white ;
background-color: white;
text-decoration: underline ;
}
</style> </style>
<div class="row" id="client_list"> <div class="row" id="client_list">
@ -64,10 +85,11 @@ table.dataTable thead th {
<a href="<?= base_url("client/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">Add</a> <a href="<?= base_url("client/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">Add</a>
</div> --> </div> -->
</div> </div>
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" <table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
id="tickets-table"> id="tickets-table">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th class="font-weight-medium">S.No</th>
<th class="font-weight-medium">Client Name</th> <th class="font-weight-medium">Client Name</th>
<th class="font-weight-medium">Account Manager</th> <th class="font-weight-medium">Account Manager</th>
<th class="font-weight-medium">Action</th> <th class="font-weight-medium">Action</th>
@ -75,8 +97,9 @@ table.dataTable thead th {
</thead> </thead>
<tbody> <tbody>
<?php foreach($clientList as $row){ ?> <?php foreach($clientList as $index => $row){ ?>
<tr > <tr >
<td><?=$index+1?></td>
<td class="client_info" data-id="<?php echo $row->id; ?>"><?php echo $row->client_name; ?> ( <?php echo $row->short_name; ?> ) </td> <td class="client_info" data-id="<?php echo $row->id; ?>"><?php echo $row->client_name; ?> ( <?php echo $row->short_name; ?> ) </td>
<td> <td>
<?php $account_managers = ''; ?> <?php $account_managers = ''; ?>
@ -277,6 +300,21 @@ $(document).ready(function()
"<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", "<'row'<'col-sm-5'i><'col-sm-7'p>>",
buttons: [ buttons: [
{
text: 'Add From Lead',
className: 'btn-filter add-from-lead', // custom class
action: function(e, dt, node, config) {
showModal();
}
},
{
text: '+ create New Client',
className: 'btn-filter buttons-html5', // custom class
action: function(e, dt, node, config) {
addClient();
}
},
{ {
extend: 'csv', extend: 'csv',
text: 'CSV', text: 'CSV',
@ -285,20 +323,6 @@ $(document).ready(function()
exportOptions: { exportOptions: {
columns: ':not(:last-child)' columns: ':not(:last-child)'
}, },
},
{
text: 'Add From Lead',
className: 'btn-filter', // custom class
action: function(e, dt, node, config) {
showModal();
}
},
{
text: 'Add',
className: 'btn-filter', // custom class
action: function(e, dt, node, config) {
addClient();
}
} }
], ],

View File

@ -258,6 +258,49 @@ body {
border-radius: 4px; border-radius: 4px;
border: 1px solid #dee2e6; border: 1px solid #dee2e6;
} }
#client_add .nav-pills ,
#client_add .nav-link
{
background-color: #F5FFFF !important;
color : #00999E !important;
border-radius:10px;
}
#client_add .nav-pills
{
background-color: #F5FFFF !important;
color : #00999E !important;
box-shadow: 0px 2px 4px 0px #00000040;
padding-top: 5px ;
}
#client_add .nav-link.active-tab {
color: white !important;
background-color: #00999E !important;
font-size: small !important;
padding:8px 16px;
border-radius: 10px !important;
box-shadow: 0px 2px 4px 0px #00000040;
}
#hr_activity_history_append_area{
padding-top:0;
margin-top:0;
background-color: #F5FFFF !important;
border: 2px solid #F5FFFF;
border-radius: 10px;
box-shadow: 0px 4px 4px 0px #00000040;
}
#hr_activity_history_append_area tbody tr{
background-color: white !important;
}
</style> </style>
@ -271,13 +314,13 @@ body {
<h4 style="position: relative;">Client Onboarding <?php if(isset($client)) {echo ' - ' . $client['client_name']; } ?></h4> <h4 style="position: relative;">Client Onboarding <?php if(isset($client)) {echo ' - ' . $client['client_name']; } ?></h4>
</div> </div>
<div class="col-6" style="text-align: right;"> <div class="col-6" style="text-align: right;">
<a href="<?= base_url("client/list"); ?>"><i class="fas fa-arrow-left" style="font-size: 17px;"></i></a> <a href="<?= base_url("client/list"); ?>"><i class="mdi mdi-arrow-left" style="font-size: 17px;"></i></a>
</div> </div>
</div> </div>
<br> <br>
<ul class="nav nav-pills navtab-bg"> <ul class="nav nav-pills navtab-bg" >
<li class="nav-item"> <li class="nav-item">
<a href="#general-q-tab" data-toggle="tab" aria-expanded="false" <a href="#general-q-tab" data-toggle="tab" aria-expanded="false"
class="nav-link px-3 py-2 active" id="general_tab"> class="nav-link px-3 py-2 active" id="general_tab">
@ -287,7 +330,7 @@ body {
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="#KYC-DOC-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab"> <a href="#KYC-DOC-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab">
<span class="mr-1"><i class="fa fa-file"></i></span> <span class="mr-1"><i class="mdi mdi-file"></i></span>
<span class="d-none d-sm-inline-block">KYC Docs</span> <span class="d-none d-sm-inline-block">KYC Docs</span>
</a> </a>
</li> </li>
@ -318,7 +361,7 @@ body {
<li class="nav-item"> <li class="nav-item">
<a href="#hr-access-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="hr_access_tab" onclick="appendHrAccessControllHtml(this)"> <a href="#hr-access-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="hr_access_tab" onclick="appendHrAccessControllHtml(this)">
<span class="mr-1"><i class="mdi mdi-book-open-page-variant"></i></span> <span class="mr-1"><i class="mdi mdi-book-open-page-variant"></i></span>
<span class="d-none d-sm-inline-block">HR Access Controll</span> <span class="d-none d-sm-inline-block">HR Access Control</span>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
@ -357,7 +400,7 @@ body {
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-body" id="hr_activity_history_append_area" style="position: relative;bottom: 50px;"> <div class="card-body" id="hr_activity_history_append_area">
</div> </div>
</div> </div>
</div> <!-- end col --> </div> <!-- end col -->
@ -570,20 +613,17 @@ body {
if (otherCard !== card) { if (otherCard !== card) {
const otherContent = otherCard.querySelector('.card-content'); const otherContent = otherCard.querySelector('.card-content');
const otherIcon = otherCard.querySelector('.accordion-icon i'); const otherIcon = otherCard.querySelector('.accordion-icon i');
otherContent.classList.remove('active'); otherIcon.setAttribute('class', 'mdi mdi-chevron-down');
otherIcon.classList.remove('fa-chevron-up');
otherIcon.classList.add('fa-chevron-down');
} }
}); });
// Toggle current accordion // Toggle current accordion
content.classList.toggle('active'); content.classList.toggle('active');
if (content.classList.contains('active')) { if (content.classList.contains('active')) {
icon.classList.remove('fa-chevron-down'); icon.classList.setAttribute('class', 'mdi mdi-chevron-up');
icon.classList.add('fa-chevron-up');
} else { } else {
icon.classList.remove('fa-chevron-up'); icon.classList.setAttribute('class', 'mdi mdi-chevron-down');
icon.classList.add('fa-chevron-down');
} }
} }
@ -935,4 +975,16 @@ body {
</script> </script>
<script>
$(document).ready(function(){
$('#client_add .nav-link').click(function(){
// change bg color of tab
$('#client_add .nav-link').removeClass('active-tab');
$(this).addClass('active-tab');
});
});
</script>

View File

@ -17,20 +17,28 @@
opacity: 1; opacity: 1;
} }
#lead_modal .modal-dialog{
width:600px !important;
}
#lead_modal .modal-body{
min-height: 200px !important;
}
</style> </style>
<div class="save-indicator" id="saveIndicator">Saved</div> <div class="save-indicator" id="saveIndicator">Saved</div>
<div class="tab-pane fade" id="police-tab"> <div class="tab-pane fade" id="police-tab">
<div class="row float-right" style="padding-bottom: 10px; position: relative;right: 13px;"> <div class="row float-right" style="padding-bottom: 10px; position: relative;right: 13px;">
<button type="button" id="BtnAdd" class="btn btn-primary waves-effect waves-light btnAdd btn-sm" style="position: relative;right: 10px;"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policy</button> <button type="button" id="BtnAdd" class="btn btn-primary waves-effect waves-light btnAdd btn-sm" style="position: relative;right: 10px;"><span class="mdi mdi-plus-box-outline" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policy</button>
<button type="button" id="BtnAddSuccess" class="btn btn-success waves-effect waves-light BtnAddSuccess btn-sm" onclick="showModal()"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policy From Lead</button> <button type="button" id="BtnAddSuccess" class="btn btn-success waves-effect waves-light BtnAddSuccess btn-sm" onclick="showModal()"><span class="mdi mdi-plus-box-outline" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policy From Lead</button>
</div> </div>
<div class="table-responsive" id="table_list"> <div class="table-responsive" id="table_list">
<table class="table table-borderless table mb-0" id="table-client-policy"> <table data-custom-table-css="table" class="table table-borderless table mb-0" id="table-client-policy">
<thead class="thead-light"> <thead class="">
<tr> <tr style="color:black !important;">
<th>Insurer</th> <th>Insurer</th>
<th>Policy</th> <th>Policy</th>
<th>Client Branch</th> <th>Client Branch</th>
@ -51,7 +59,7 @@
<div class="card-body"> <div class="card-body">
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;"> <div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
<button type="button" id="btnPolicyBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack btn-sm"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button> <button type="button" id="btnPolicyBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack btn-sm"><span class="mdi mdi-format-list-bulleted" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
</div> </div>
<hr> <hr>
@ -231,7 +239,7 @@
<!-- Center modal content --> <!-- Center modal content -->
<div class="modal fade" id="lead_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false"> <div class="modal fade" id="lead_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false">
<div class="modal-dialog modal-dialog-centered"> <div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title" id="myCenterModalLabel">Lead List</h4> <h4 class="modal-title" id="myCenterModalLabel">Lead List</h4>
@ -425,7 +433,7 @@
// Conditionally render the delete option based on the role // Conditionally render the delete option based on the role
if (role !== 3 && role !== 4) { if (role !== 3 && role !== 4) {
policyTable += ` policyTable += `
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="fa fa-trash mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`; <a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
} }
policyTable += ` policyTable += `
@ -669,7 +677,7 @@
// Conditionally render the delete option based on the role // Conditionally render the delete option based on the role
if (role !== 3 && role !== 4) { if (role !== 3 && role !== 4) {
policyTable += ` policyTable += `
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="fa fa-trash mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`; <a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="mdi mdi-delete-outline mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
} }
policyTable += ` policyTable += `

View File

@ -1,13 +1,11 @@
<div class="tab-pane fade" id="RM-tab"> <div class="tab-pane fade card " id="RM-tab">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12" id="collapseOne">
<div class="card-body"> <div class="card-body">
<div class="row float-right" style="position: relative; bottom: 20px; right:13px;"> <div class="row float-right" style="position: relative; bottom: 20px; right:13px;">
<button class="btn btn-primary btn-sm" id="client_rm_edit" ><span id="rm_icons" class="mdi mdi-lead-pencil"></span> Edit</button> <button class="btn btn-primary btn-sm" id="client_rm_edit" ><span id="rm_icons" class="mdi mdi-lead-pencil"></span> Edit</button>
</div> </div>
<hr>
<form role="form" class="parsley-examples" method="post" id="relation_form" enctype="multipart/form-data"> <form role="form" class="parsley-examples" method="post" id="relation_form" enctype="multipart/form-data">
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" /> <input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
@ -180,7 +178,7 @@ $(document).ready(function(){
}).prop('disabled', false); }).prop('disabled', false);
$('#client_rm_btnSubmit').show(); $('#client_rm_btnSubmit').show();
$(this).html('<span id="rm_icons" class="fa fa-times-circle"></span> Close Edit '); $(this).html('<span id="rm_icons" class="mdi mdi-close-circle-outline"></span> Close Edit ');
} else { } else {
$('#account_manager').select2({ $('#account_manager').select2({
placeholder: "Select Account Manager" placeholder: "Select Account Manager"

View File

@ -99,7 +99,7 @@
</div> </div>
<div class="table-responsive" style="overflow-x: auto;"> <div class="table-responsive" style="overflow-x: auto;">
<table id="scroll-horizontal-datatable" class="table w-100"> <table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th>S.No</th> <th>S.No</th>
@ -118,7 +118,7 @@
<td> <td>
<a id="download_1" <a id="download_1"
data-id="1" data-id="1"
class="fa fa-download" class="mdi mdi-download"
style="font-size: 18px;" style="font-size: 18px;"
target="_blank" target="_blank"
href="<?= base_url("/downloadGdriveFile?client_id=" . $row['client_id'] . "&file_type=" . $row['file_type'] . "&file_name=" . $row['file_name']."&client_policy_id=".$row['client_policy_id']); ?>"> href="<?= base_url("/downloadGdriveFile?client_id=" . $row['client_id'] . "&file_type=" . $row['file_type'] . "&file_name=" . $row['file_name']."&client_policy_id=".$row['client_policy_id']); ?>">

View File

@ -45,7 +45,7 @@
</div> </div>
<div class="table-responsive" style="overflow-x: auto;"> <div class="table-responsive" style="overflow-x: auto;">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap"> <table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th>S.No</th> <th>S.No</th>

View File

@ -15,7 +15,7 @@
<body> <body>
<table> <table data-custom-table-css="table">
<?php if(isset($data)) { ?> <?php if(isset($data)) { ?>
<?php foreach ($data as $key => $value) { ?> <?php foreach ($data as $key => $value) { ?>
<tr> <tr>

View File

@ -17,7 +17,7 @@
<body> <body>
<table style="width: 100%;"> <table data-custom-table-css="table" style="width: 100%;">
<?php if(isset($data)) { ?> <?php if(isset($data)) { ?>
<?php foreach ($data as $key => $value) { ?> <?php foreach ($data as $key => $value) { ?>
@ -36,7 +36,7 @@
<div style="display: flex;gap: 20px;"> <div style="display: flex;gap: 20px;">
<table> <table data-custom-table-css="table">
<tr> <tr>
<td> <td>

View File

@ -8,7 +8,7 @@
</head> </head>
<body> <body>
<table style="width: 100%;"> <table data-custom-table-css="table" style="width: 100%;">
<?php if(isset($data)) { ?> <?php if(isset($data)) { ?>
<?php foreach ($data as $key => $value) { ?> <?php foreach ($data as $key => $value) { ?>
@ -25,7 +25,7 @@
<div style="display: flex;gap: 20px; padding-top: 10px;"> <div style="display: flex;gap: 20px; padding-top: 10px;">
<table> <table data-custom-table-css="table">
<tr> <tr>
<td> <td>

View File

@ -12,7 +12,7 @@
POLICY</span></div> POLICY</span></div>
</div> </div>
<table <table data-custom-table-css="table"
style="font-family: sans-serif;font-size: 14px;width: 100%;margin-top: 20px;margin-left: 20px;line-height: 20px;"> style="font-family: sans-serif;font-size: 14px;width: 100%;margin-top: 20px;margin-left: 20px;line-height: 20px;">
<tbody> <tbody>
<tr> <tr>
@ -40,7 +40,7 @@
<div style="border: 1px solid black;width: 400px;max-height: 300px;padding: 5px;"> <div style="border: 1px solid black;width: 400px;max-height: 300px;padding: 5px;">
<div style="font-size: 11px;text-align: center;">The card is for identification purpose only</div> <div style="font-size: 11px;text-align: center;">The card is for identification purpose only</div>
<table style="width: 100%;text-align: center;font-size: 11px;"> <table data-custom-table-css="table" style="width: 100%;text-align: center;font-size: 11px;">
<tbody> <tbody>
<tr> <tr>
<td>General & Claim Enquiry Helpline</td> <td>General & Claim Enquiry Helpline</td>
@ -50,7 +50,7 @@
</table> </table>
<table style="font-size: 11px;width: 100%;text-align: center;"> <table data-custom-table-css="table" style="font-size: 11px;width: 100%;text-align: center;">
<tbody> <tbody>
<tr> <tr>
<td style="border: 1px solid black;">Toll Free : 1800-209-7777 <br>Email : <td style="border: 1px solid black;">Toll Free : 1800-209-7777 <br>Email :
@ -63,7 +63,7 @@
<div style="font-size: 14px;text-align: center;">CITI MDIndia branch contact</div> <div style="font-size: 14px;text-align: center;">CITI MDIndia branch contact</div>
<div> <div>
<table style="text-align: center;width: 100%;font-size: 12px;"> <table data-custom-table-css="table" style="text-align: center;width: 100%;font-size: 12px;">
<thead> <thead>
<tr> <tr>
<th style="border: 1px solid black;">Center</th> <th style="border: 1px solid black;">Center</th>

View File

@ -89,7 +89,7 @@
<h4 style="position: relative;">Employees</h4> <h4 style="position: relative;">Employees</h4>
</div> </div>
</div> </div>
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table"> <table data-custom-table-css="table" class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th class="font-weight-medium">SNO</th> <th class="font-weight-medium">SNO</th>
@ -195,7 +195,7 @@
<?php } ?> <?php } ?>
<?php if(in_array($employee['policy_type_id'], [2,3,4,5]) && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?> <?php if(in_array($employee['policy_type_id'], [2,3,4,5]) && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>
<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> <a href="<?= base_url('download-e-card/'). $employee['rand_string'] . "/0/1" ?>" 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 } ?>
<?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'])) { ?> <?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'])) { ?>
@ -245,7 +245,7 @@
<!-- modal content --> <!-- modal content -->
<div id="emp_modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;"> <div id="emp_modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title">Edit Employee</h4> <h4 class="modal-title">Edit Employee</h4>
@ -287,12 +287,12 @@
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<label for="email">Email<span class="text-danger">*</span></label> <label for="email">Email<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="email_corporate" placeholder="Enter Email" name="email_corporate" data-parsley-trigger="change" data-parsley-type="email" onchange="validateInput(this, 'employees', 'email_corporate')" required> <input type="text" class="form-control" id="email_corporate" placeholder="Enter Email" name="email_corporate" data-parsley-trigger="change" data-parsley-type="email" onkeyup="validateInput(this, 'employees', 'email_corporate')" required>
</div> </div>
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<label for="mobile">Mobile Number<span class="text-danger">*</span></label> <label for="mobile">Mobile Number<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="mobile" placeholder="Enter Mobile Number" name="mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" minlength="10" onchange="validateInput(this, 'employees', 'mobile')" required> <input type="text" class="form-control" id="mobile" placeholder="Enter Mobile Number" name="mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" minlength="10" onkeyup="validateInput(this, 'employees', 'mobile')" required>
</div> </div>
</div> </div>
@ -570,21 +570,53 @@
}); });
} }
function validateInput(input, table, field){ // function validateInput(input, table, field){
// let value = $(input).val();
// let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
// let message = "Value is duplicate!";
// if(label){
// message = label + " already exists!";
// }
// checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) {
// if (isDuplicate) {
// toastr.warning(message, 'WARNING');
// $(input).val('')
// }
// });
// }
function validateInput(input, table, field) {
let emp_code = $('#emp_code_for_edit').val();
let client_id = $('#clients').val();
console.log("emp_code", emp_code);
console.log("client_id", client_id);
let value = $(input).val(); let value = $(input).val();
let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim(); let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
let message = "Value is duplicate!"; let message = "Value is duplicate!";
if(label){ if (label) {
message = label + " already exists!"; message = label + " already exists!";
} }
checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) { let data = {};
data["emp_code !="] = emp_code;
data[field] = value;
console.log(data);
checkDuplicateTableFieldValue(table, field, data, function(isDuplicate) {
if (isDuplicate) { if (isDuplicate) {
toastr.warning(message, 'WARNING'); toastr.warning(message, 'WARNING');
$(input).val('') $("#btnSubmit").prop('disabled', true);
} }else{
$("#btnSubmit").prop('disabled', false);
}
}); });
} }
@ -597,108 +629,106 @@
} }
var modalInstance; // Store the modal instance globally var modalInstance; // Store the modal instance globally
function showModal() { function showModal() {
var myModalEl = document.getElementById('emp_history_modal'); var myModalEl = document.getElementById('emp_history_modal');
modalInstance = new bootstrap.Modal(myModalEl, { modalInstance = new bootstrap.Modal(myModalEl, {
backdrop: true, // Ensures the backdrop is shown backdrop: true, // Ensures the backdrop is shown
keyboard: true // Allows closing with the Escape key keyboard: true // Allows closing with the Escape key
}); });
modalInstance.show(); modalInstance.show();
}
function closeModal() {
if (modalInstance) {
modalInstance.hide(); // Hide the modal and its backdrop
// Manually remove backdrop if it's still visible
setTimeout(function () {
document.querySelector('.modal-backdrop').classList.remove('show');
}, 150); // Wait for animation to finish
} }
}
function closeModal() {
if (modalInstance) {
modalInstance.hide(); // Hide the modal and its backdrop
// Manually remove backdrop if it's still visible
setTimeout(function () {
document.querySelector('.modal-backdrop').classList.remove('show');
}, 150); // Wait for animation to finish
}
}
function get_emp_history(input, emp_id) { function get_emp_history(input, emp_id) {
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
let url = '<?= base_url("employee/get_emp_history")?>'; let url = '<?= base_url("employee/get_emp_history")?>';
let requestData = { emp_id: emp_id }; let requestData = { emp_id: emp_id };
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) { sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
if (response.status === true) { if (response.status === true) {
console.log('response data length', response.data.emp_history.length); console.log('response data length', response.data.emp_history.length);
// **Clear old data** // **Clear old data**
$('#emp_history_content').html(''); $('#emp_history_content').html('');
// **Check if data exists** // **Check if data exists**
if (response.data.emp_history.length > 0) { if (response.data.emp_history.length > 0) {
let historyTable = ` let historyTable = `
<div class="card-body"> <div class="card-body">
<div class="table-responsive"> <div class="table-responsive">
<table class="table w-100"> <table data-custom-table-css="table" class="table w-100">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th>Field</th> <th>Field</th>
<th>Change</th> <th>Change</th>
<th>User</th> <th>User</th>
<th>Date/Time</th> <th>Date/Time</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
`;
// **Loop through the data dynamically**
response.data.emp_history.forEach(row => {
historyTable += `
<tr>
<td>${row.field_name}</td>
<td>${row.old_value} => ${row.new_value}</td>
<td>${row.created_by}</td>
<td>${row.created_at}</td>
</tr>
`; `;
});
historyTable += ` // **Loop through the data dynamically**
</tbody> response.data.emp_history.forEach(row => {
</table> historyTable += `
<tr>
<td>${row.field_name}</td>
<td>${row.old_value} => ${row.new_value}</td>
<td>${row.created_by}</td>
<td>${row.created_at}</td>
</tr>
`;
});
historyTable += `
</tbody>
</table>
</div>
</div> </div>
</div> `;
`;
// **Append to modal** // **Append to modal**
$('#emp_history_content').append(historyTable); $('#emp_history_content').append(historyTable);
} else {
$('#emp_history_content').html('<p class="text-center text-muted">No history available.</p>');
}
// **Show the modal**
showModal();
} else { } else {
$('#emp_history_content').html('<p class="text-center text-muted">No history available.</p>'); 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');
// **Show the modal** $('.loader').fadeOut();
showModal(); $('.loader-mask').delay(350).fadeOut('slow');
} else { });
let message = response.message; }
toastr.error(message, 'ERROR');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while fetching the report page.', 'ERROR');
$('.loader').fadeOut(); // function closeModal(){
$('.loader-mask').delay(350).fadeOut('slow'); // var myModalEl = document.getElementById('emp_history_modal');
}); // var modalInstance = bootstrap.Modal.getInstance(myModalEl);
} // if (modalInstance) {
// modalInstance.hide();
// function closeModal(){ // }
// var myModalEl = document.getElementById('emp_history_modal'); // }
// var modalInstance = bootstrap.Modal.getInstance(myModalEl);
// if (modalInstance) {
// modalInstance.hide();
// }
// }
</script> </script>

View File

@ -45,18 +45,25 @@ table.dataTable tbody td {
color: #16181b !important; color: #16181b !important;
cursor: pointer !important; cursor: pointer !important;
} }
.row{
margin-right:20px !important;
margin-left:30px !important;
}
</style> </style>
<div class="row"> <div class="row">
<div class="col-xl-12"> <div class="col-xl-12">
<div id="accordion" class="mb-3"> <div id="accordion" class="mb-3">
<div class="card mb-1"> <div class="card mb-1">
<h5 class="m-1"> <h3 class="m-1">
<span>Members</span>
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" <a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
aria-expanded="true"> aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i> <i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a> </a>
</h5> </h3>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"> <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body"> <div class="card-body">
<!-- <div class="text-center"> --> <!-- <div class="text-center"> -->
@ -116,7 +123,9 @@ table.dataTable tbody td {
<div class="row justify-content-end"> <div class="row justify-content-end">
<div class="col-auto"> <div class="col-auto">
<!-- <div id="categoryFilter_12"> --> <!-- <div id="categoryFilter_12"> -->
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="sendManualEcard(this)">Send Ecard</a> <a href="#" class="btn btn-primary waves-effect waves-light"
style="background-color: #F5FFFF; color:black; border:1px solid #00999E;"
onclick="sendManualEcard(this)">Send Ecard</a>
<!-- </div> --> <!-- </div> -->
</div> </div>
<div class="col-auto"> <div class="col-auto">

View File

@ -72,42 +72,37 @@ option:disabled {
</div> </div>
</div> </div>
<hr>
<div class="form-row" id="file_upload"> <div class="form-row" id="file_upload">
<div class="form-group col-md-4"> <div class="form-group col-md-12">
<label>Upload file</label> &nbsp;[ <a id="excel_download" <label>Upload file</label> &nbsp;[ <a id="excel_download"
data-toggle="tooltip" data-placement="top" data-toggle="tooltip" data-placement="top" style="color:#00999E"
title="Download Sample Excel">Sample Excel</a> ] title="Download Sample Excel">Sample Excel</a> ]
<br>
<input type="file" name="emplist" id="emplist" <input type="file" name="emplist" id="emplist"
accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet" accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet"
required> required>
</div>
<div class="d-flex align-items-center justify-content-start" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
style="margin-top: 18px;">
<div class="form-group col-md-11">
<!-- Adjusted the width to 11 columns -->
<div class="col-md-3">
<button id="emp_form_submit_button" type="submit"
class="btn btn-primary waves-effect waves-light justify-content-end">Upload</button>
</div>
</div>
</div>
<button id="emp_form_submit_button" type="submit"
class=" nav-link-btn px-3 py-1 btn btn-primary waves-effect waves-light justify-content-end">Upload</button>
<div class="form-group col-md-2" &nbsp;&nbsp;
style="margin-top: 26px;position: relative;left: 65px;"> OR </div>
<div class="form-group col-md-4" style="margin-top: 18px;"> <span style="color:black;"> OR </span>
<a class="btn btn-primary waves-effect waves-light justify-content-end"
&nbsp;&nbsp;
<a class=" nav-link-btn px-3 py-1 btn btn-primary waves-effect waves-light justify-content-end"
id="fetch_enrolled_data" data-toggle="modal" id="fetch_enrolled_data" data-toggle="modal"
data-target="#full-width-modal" title="Download Sample Excel">Fetch data-target="#full-width-modal" title="Download Sample Excel">Fetch
Enrolled Data</a> Enrolled Data</a>
</div> </div>
</div> </div>
</div> </div>
@ -148,8 +143,6 @@ option:disabled {
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
</div><!-- /.modal --> </div><!-- /.modal -->
<!-- Center modal content --> <!-- Center modal content -->
<div class="modal fade" id="file-err-modal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal fade" id="file-err-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered"> <div class="modal-dialog modal-dialog-centered">
@ -167,6 +160,11 @@ option:disabled {
<script> <script>
var client_id_param = 0;
var client_branch_id_param = 0;
var client_policy_param = 0;
$('#file_upload').hide(); $('#file_upload').hide();
$(document).ready(function() { $(document).ready(function() {
@ -181,15 +179,6 @@ $(document).ready(function() {
}); });
// Declare a global variable to store API response data
var clientPolicies = [];
var clientPoliciesWithBranch = {
policies: []
};
var client_id_param = 0;
var client_branch_id_param = 0;
var client_policy_param = 0;
$(document).ready(function() { $(document).ready(function() {
// console.log("document loaded"); // console.log("document loaded");
@ -330,8 +319,6 @@ $(document).ready(function() {
$(window).on("load", function() { $(window).on("load", function() {
console.log("window loaded"); console.log("window loaded");
fetchClientPolicies();
// Get the current page URL // Get the current page URL
const url = window.location.href; const url = window.location.href;
@ -368,87 +355,88 @@ $(window).on("load", function() {
}); });
function fetchClientPolicies() { // function fetchClientPolicies() {
$('#loader').show();
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
// console.log('fetchClientPolicies');
// console.log(apiURL);
$.ajax({
url: apiURL,
method: 'GET',
headers: {
"Content-Type": "application/json",
"X-Requested-With": "XMLHttpRequest"
},
success: function(response) {
console.log(response); // $('#loader').show();
// console.log(response.dataStatus); // var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
// console.log(response.data); // // console.log('fetchClientPolicies');
// // console.log(apiURL);
// $.ajax({
// url: apiURL,
// method: 'GET',
// headers: {
// "Content-Type": "application/json",
// "X-Requested-With": "XMLHttpRequest"
// },
// success: function(response) {
if (response.code === 200 && response.dataStatus === true && response.data !== "") { // console.log(response);
try { // // console.log(response.dataStatus);
clientPolicies = (response.data) // // console.log(response.data);
// console.log(clientPolicies);
response.data.forEach(policy => { // if (response.code === 200 && response.dataStatus === true && response.data !== "") {
// console.log('policies', policy.policies); // try {
policy.policies.forEach(p => { // clientPolicies = (response.data)
clientPoliciesWithBranch.policies.push(p); // // console.log(clientPolicies);
});
});
// console.log(clientPoliciesWithBranch); // response.data.forEach(policy => {
// // console.log('policies', policy.policies);
// policy.policies.forEach(p => {
// clientPoliciesWithBranch.policies.push(p);
// });
// });
appendClients(clientPolicies); // // console.log(clientPoliciesWithBranch);
// appendClients(clientPolicies);
setTimeout(function() { // setTimeout(function() {
if (client_id_param != null ) { // if (client_id_param != null ) {
var foundPolicies = clientPolicies.find(function(item) { // var foundPolicies = clientPolicies.find(function(item) {
// console.log(typeof item.id) // // console.log(typeof item.id)
return item.id == client_id_param; // return item.id == client_id_param;
}); // });
appendBranch(foundPolicies.branchs); // appendBranch(foundPolicies.branchs);
} // }
}, 500); // }, 500);
setTimeout(function() { // setTimeout(function() {
if (client_branch_id_param != null ) { // if (client_branch_id_param != null ) {
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) { // var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
// console.log('item', item); // // console.log('item', item);
return item.branch_id === client_branch_id_param; // return item.branch_id === client_branch_id_param;
}); // });
if (foundPolicies) { // if (foundPolicies) {
// console.log('foundPolicies', foundPolicies); // // console.log('foundPolicies', foundPolicies);
appendPolicies(foundPolicies); // appendPolicies(foundPolicies);
} else { // } else {
console.log('No policies found for the selected client'); // console.log('No policies found for the selected client');
} // }
} // }
}, 500); // }, 500);
} catch (error) { // } catch (error) {
console.error('Error parsing API response data:', error); // console.error('Error parsing API response data:', error);
} // }
} else if (response.code === 404 && response.dataStatus === false) { // } else if (response.code === 404 && response.dataStatus === false) {
console.error('no data found', response); // console.error('no data found', response);
} else { // } else {
console.error('Something went wrong!'); // console.error('Something went wrong!');
} // }
}, // },
error: function(xhr, status, error) { // error: function(xhr, status, error) {
console.error('Error fetching data from API:', error); // console.error('Error fetching data from API:', error);
console.error(xhr.responseText); // console.error(xhr.responseText);
} // }
}); // });
$('#loader').hide(); // $('#loader').hide();
} // }
function fetchFileError(file_id) { function fetchFileError(file_id) {
@ -593,7 +581,6 @@ function fetchFileError(file_id) {
$('#loader').hide(); $('#loader').hide();
} }
function appendClients(data) { function appendClients(data) {
// console.log('client_id_param', client_id_param) // console.log('client_id_param', client_id_param)
@ -610,7 +597,6 @@ function appendClients(data) {
}); });
} }
function appendBranch(data) { function appendBranch(data) {
$('#branch_id').empty(); $('#branch_id').empty();
@ -630,7 +616,6 @@ function appendBranch(data) {
}); });
} }
function appendPolicies(data) { function appendPolicies(data) {
// console.log(data) // console.log(data)
@ -645,14 +630,11 @@ function appendPolicies(data) {
$.each(data, function(index, item) { $.each(data, function(index, item) {
// console.log(item)
var option = $('<option>', { var option = $('<option>', {
value: item.client_policy_id, value: item.id,
// text:`${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
text:`${item.policy_type ?? ''} - ${item.policy_no ?? ''}` text:`${item.policy_type ?? ''} - ${item.policy_no ?? ''}`
}); });
if (client_policy_param == item.client_policy_id) { if (client_policy_param == item.id) {
option.attr('selected', true); option.attr('selected', true);
} }
$('#policy_id').append(option); $('#policy_id').append(option);
@ -664,51 +646,25 @@ $(document).ready(function() {
$('#client_id').on('change', function() { $('#client_id').on('change', function() {
$('#policy_id').empty(); let client_id = $(this).val();
console.log('client_id', client_id);
$('#policy_id').append($('<option>', { if(branch_list != '') {
value: '', // console.log(branch_list[client_id]);
text: 'Select' let data = branch_list[client_id];
})); appendBranch(data);
}
var selectedClient = $(this).val();
// console.log('selectedClient', selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData
var foundPolicies = clientPolicies.find(function(item) {
return item.id === selectedClient;
});
console.log('foundPolicies.branchs', foundPolicies.branchs);
appendBranch(foundPolicies.branchs);
}); });
});
$(document).ready(function() {
$('#branch_id').on('change', function() { $('#branch_id').on('change', function() {
var selectedClient = $(this).val();
// console.log('selectedBranch', selectedClient); let branch_id = $(this).val();
// console.log('clientPolicies', clientPoliciesWithBranch); console.log("branch_id", branch_id);
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) { if(policy_list != '' && branch_id != '') {
// console.log('item', item); let data = policy_list[branch_id];
return item.branch_id === selectedClient; appendPolicies(data);
});
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
appendPolicies(foundPolicies);
toastr.warning('No policies found for the selected client branch.');
} else {
// console.log('foundPolicies', foundPolicies);
appendPolicies(foundPolicies);
} }
}); });

View File

@ -166,6 +166,10 @@
color:#09B9BF; color:#09B9BF;
} }
.diff-span-color{
color: #0EB96E !important;
}
.endorsement-div{ .endorsement-div{
margin-left:20px; margin-left:20px;
} }
@ -215,7 +219,7 @@
<span class="span-color"><?= $pendingActionsData['uhid'] ?></span> <span class="span-color"><?= $pendingActionsData['uhid'] ?></span>
</h2> </h2>
<h6 class="text-right"> <h6 class="text-right">
<span class="span-color f-left">Exported : <?= $pendingActionsData['uhid_export_count'] ?></span> <span class="diff-span-color f-left">Exported : <?= $pendingActionsData['uhid_export_count'] ?></span>
<span class="text-danger">Not Exported : <?= $pendingActionsData['uhid_not_export_count'] ?></span> <span class="text-danger">Not Exported : <?= $pendingActionsData['uhid_not_export_count'] ?></span>
</h6> </h6>
@ -232,7 +236,7 @@
<span class="span-color"><?= $pendingActionsData['tpa'] ?></span> <span class="span-color"><?= $pendingActionsData['tpa'] ?></span>
</h2> </h2>
<h6 class="text-right"> <h6 class="text-right">
<span class="span-color f-left">Exported : <?= $pendingActionsData['tpa_export_count'] ?></span> <span class="diff-span-color f-left">Exported : <?= $pendingActionsData['tpa_export_count'] ?></span>
<span class="text-danger">Not Exported : <?= $pendingActionsData['tpa_not_export_count'] ?></span> <span class="text-danger">Not Exported : <?= $pendingActionsData['tpa_not_export_count'] ?></span>
</h6> </h6>
@ -249,8 +253,8 @@
<span class="span-color"><?= $pendingActionsData['correction'] ?></span> <span class="span-color"><?= $pendingActionsData['correction'] ?></span>
</h2> </h2>
<h6 class="tex-right"> <h6 class="tex-right">
<span class="span-color">Exported : <?= $pendingActionsData['correction_export_count'] ?></span> <span class="diff-span-color">Exported : <?= $pendingActionsData['correction_export_count'] ?></span>
<span class="text-danger f-right">Not Exported : <span ><?= $pendingActionsData['correction_not_export_count'] ?></span></span> <span class="text-danger f-right">Not Exported : <?= $pendingActionsData['correction_not_export_count'] ?></span>
</h6> </h6>
</div> </div>
@ -266,8 +270,8 @@
<span class="span-color"><?= $pendingActionsData['deletion'] ?></span> <span class="span-color"><?= $pendingActionsData['deletion'] ?></span>
</h2> </h2>
<h6> <h6>
<span class="span-color">Exported : <?= $pendingActionsData['deletion_export_count'] ?></span> <span class="diff-span-color">Exported : <?= $pendingActionsData['deletion_export_count'] ?></span>
<span class="text-danger f-right">Not Exported : <span ><?= $pendingActionsData['deletion_not_export_count'] ?></span></span> <span class="text-danger f-right">Not Exported : <?= $pendingActionsData['deletion_not_export_count'] ?></span>
</h6> </h6>
</div> </div>
@ -283,8 +287,8 @@
<span class="span-color"><?= $pendingActionsData['si_enhancement'] ?></span> <span class="span-color"><?= $pendingActionsData['si_enhancement'] ?></span>
</h2> </h2>
<h6> <h6>
<span class="span-color">Exported : <?= $pendingActionsData['si_export_count'] ?></span> <span class="diff-span-color">Exported : <?= $pendingActionsData['si_export_count'] ?></span>
<span class="text-danger f-right">Not Exported : <span ><?= $pendingActionsData['si_not_export_count'] ?></span></span> <span class="text-danger f-right">Not Exported : <?= $pendingActionsData['si_not_export_count'] ?></span>
</h6> </h6>
</div> </div>
@ -370,7 +374,7 @@ function getPendingActionClientDataForDashboard(input, headerName, type)
var link = '<?=base_url()?>'; var link = '<?=base_url()?>';
if (res.data.length !== 0) { if (res.data.length !== 0) {
// table = `<table class="table table-striped table-sm table-centered mb-0"><tbody>`; // table = `<table data-custom-table-css="table" class="table table-striped table-sm table-centered mb-0"><tbody>`;
div = `<div class="row">`; div = `<div class="row">`;
$.each(res.data, function(index, item) { $.each(res.data, function(index, item) {

View File

@ -14,145 +14,149 @@
} }
</style> </style>
<div class="row"> <div class="container-fluid">
<div class="col-xl-12"> <h2>Endorsement</h2>
<div id="accordion" class="mb-3"> <div class="row">
<div class="card mb-1"> <div class="col-xl-12">
<h5 class="m-1"> <div id="accordion" class="mb-3">
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true"> <div class="card mb-1">
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i> <h5 class="m-1">
</a> <a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true">
</h5> <i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"> </a>
<div class="card-body"> </h5>
<!-- <div class="text-center"> --> <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="form-row"> <div class="card-body">
<div class="form-group col-md-4"> <!-- <div class="text-center"> -->
<label>Client</label> <br /> <div class="form-row">
<select class="form-control" id="clients"> <div class="form-group col-md-4">
<option value="0">Select</option> <label>Client</label> <br />
</select> <select class="form-control" id="clients">
<option value="0">Select</option>
</select>
</div>
<div class="form-group col-md-4">
<label>Branch</label> <br />
<select name="branch_id" class="form-control" id="branch_id">
<option value="0">Select</option>
</select>
</div>
<div class="form-group col-md-4">
<label>Policy</label> <br />
<select class="form-control" id="policies">
<option value="0">Select</option>
</select>
</div>
<div class="form-group col-md-4">
<label>Status</label> <br />
<select class="form-control" id="status1">
<option value="0">Select</option>
<?php foreach ($status as $key => $value) { ?>
<option value="<?= $key ?>" <?= (isset($getData) && $getData['status'] == $key) ? 'selected' : '' ?>>
<?= $value ?>
</option>
<?php } ?>
</select>
</div>
</div> </div>
<div class="row">
<div class="col-12" style="text-align: right;">
<div class="form-group col-md-4"> <a href="<?= base_url("employee/endorsement-list"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
<label>Branch</label> <br /> </div>
<select name="branch_id" class="form-control" id="branch_id">
<option value="0">Select</option>
</select>
</div> </div>
<!-- </div> -->
<div class="form-group col-md-4">
<label>Policy</label> <br />
<select class="form-control" id="policies">
<option value="0">Select</option>
</select>
</div>
<div class="form-group col-md-4">
<label>Status</label> <br />
<select class="form-control" id="status1">
<option value="0">Select</option>
<?php foreach ($status as $key => $value) { ?>
<option value="<?= $key ?>" <?= (isset($getData) && $getData['status'] == $key) ? 'selected' : '' ?>>
<?= $value ?>
</option>
<?php } ?>
</select>
</div>
</div> </div>
<div class="row">
<div class="col-12" style="text-align: right;">
<a href="<?= base_url("employee/endorsement-list"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
</div>
</div>
<!-- </div> -->
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="row" id="client_list">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Endorsement List</h4>
</div>
<div class="row" id="client_list">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Endorsement List</h4>
</div> </div>
<table data-custom-table-css="table" class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="tickets-table">
<thead class="bg-light">
<tr>
<th class="font-weight-medium">SNO</th>
<th class="font-weight-medium">Name/code</th>
<th class="font-weight-medium">Policy name</th>
<th class="font-weight-medium">Endorsement ID</th>
<th class="font-weight-medium">Insurer name</th>
<th class="font-weight-medium">Remarks</th>
<th class="font-weight-medium">Endorsement Type</th>
<th class="font-weight-medium">Status</th>
<th class="font-weight-medium">Action</th>
</tr>
</thead>
<tbody class="font-12">
<?php
if (isset($employees)) {
foreach ($employees as $key => $employee) { ?>
<tr>
<td><b><?php echo ($key + 1) ?></b></td>
<td><?php echo $employee['name'] ?>( <?php echo $employee['emp_code'] ?> )</td>
<!-- <td><?php echo isset($employee['policy_name']) ? $employee['policy_name'] : '' ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : '' ?> - <?php echo isset($employee['policy_type']) ? $employee['policy_type'] : '' ?></td> -->
<td><?php echo isset($employee['policy_type']) ? $employee['policy_type'] : '' ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : '' ?></td>
<td><?php echo $employee['endorsement_id'] ?></td>
<td><?php echo isset($employee['insurer_short_name']) ? $employee['insurer_short_name'] : '' ?>
</td>
<td><?php echo $employee['remarks'] ?></td>
<td>
<?php
if ($employee['actions'] == 'c') {
echo 'Correction';
} elseif ($employee['actions'] == 'si') {
echo 'SI Enhancement';
} elseif ($employee['actions'] == 'd') {
echo 'Deletion';
}
?>
</td>
<td>
<?php
if ($employee['status'] == 'pending') {
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
} elseif ($employee['status'] == 'inprogress') {
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
} elseif ($employee['status'] == 'complete') {
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
}
?>
</td>
<td class="text-center"><a href="#" data-id="<?php echo $employee['id'] ?>" class="mdi mdi-eye emp_data_model" aria-hidden="true" data-toggle="modal" data-target="#centermodal"></a>
</td>
</tr>
<?php }
} ?>
</tbody>
</table>
</div> </div>
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="tickets-table">
<thead class="bg-light">
<tr>
<th class="font-weight-medium">SNO</th>
<th class="font-weight-medium">Name/code</th>
<th class="font-weight-medium">Policy name</th>
<th class="font-weight-medium">Endorsement ID</th>
<th class="font-weight-medium">Insurer name</th>
<th class="font-weight-medium">Remarks</th>
<th class="font-weight-medium">Endorsement Type</th>
<th class="font-weight-medium">Status</th>
<th class="font-weight-medium">Action</th>
</tr>
</thead>
<tbody class="font-12">
<?php
if (isset($employees)) {
foreach ($employees as $key => $employee) { ?>
<tr>
<td><b><?php echo ($key + 1) ?></b></td>
<td><?php echo $employee['name'] ?>( <?php echo $employee['emp_code'] ?> )</td>
<!-- <td><?php echo isset($employee['policy_name']) ? $employee['policy_name'] : '' ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : '' ?> - <?php echo isset($employee['policy_type']) ? $employee['policy_type'] : '' ?></td> -->
<td><?php echo isset($employee['policy_type']) ? $employee['policy_type'] : '' ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : '' ?></td>
<td><?php echo $employee['endorsement_id'] ?></td>
<td><?php echo isset($employee['insurer_short_name']) ? $employee['insurer_short_name'] : '' ?>
</td>
<td><?php echo $employee['remarks'] ?></td>
<td>
<?php
if ($employee['actions'] == 'c') {
echo 'Correction';
} elseif ($employee['actions'] == 'si') {
echo 'SI Enhancement';
} elseif ($employee['actions'] == 'd') {
echo 'Deletion';
}
?>
</td>
<td>
<?php
if ($employee['status'] == 'pending') {
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
} elseif ($employee['status'] == 'inprogress') {
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
} elseif ($employee['status'] == 'complete') {
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
}
?>
</td>
<td class="text-center"><a href="#" data-id="<?php echo $employee['id'] ?>" class="fa fa-eye emp_data_model" aria-hidden="true" data-toggle="modal" data-target="#centermodal"></a>
</td>
</tr>
<?php }
} ?>
</tbody>
</table>
</div> </div>
</div> </div><!-- end col -->
</div><!-- end col --> </div>
</div> </div>
<!-- Center modal content --> <!-- Center modal content -->
<div class="modal fade" id="centermodal" tabindex="-1" role="dialog" aria-hidden="true" aria-modal="true" data-backdrop="static"> <div class="modal fade" id="centermodal" tabindex="-1" role="dialog" aria-hidden="true" aria-modal="true" data-backdrop="static">
<div class="modal-dialog modal-dialog-centered"> <div class="modal-dialog modal-dialog-centered">
@ -163,7 +167,7 @@
</div> </div>
<div class="modal-body" id="modal_body"> <div class="modal-body" id="modal_body">
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-hover mb-0"> <table data-custom-table-css="table" class="table table-hover mb-0">
<thead id="table_head_data"> <thead id="table_head_data">
</thead> </thead>

View File

@ -40,15 +40,74 @@
.card { .card {
border-radius: 10px; border-radius: 10px;
} }
.row.visa_status_count_view .card-header{
background-color: #F5FFFF;
padding: 25px;
border: 2px solid #fff;
border-radius: 10px;
/* box-shadow: 2px 2px 2px; */
box-shadow: 0px 1px 1px 0px #00000040;
}
.row.visa_status_count_view .card-header #categoryFilter_11 a{
background-color: #D4F5F6 !important;
font-weight:800;
color:#000 !important;
border : 1px solid #D4F5F6 !important;
border-radius: 15px;
padding : 5px 10px;
}
#categoryFilter_12 a ,
#categoryFilter_13 a ,
#categoryFilter_14 a
{
background-color: #00999E;
box-shadow: 0px 2px 4px 0px #00000040;
}
#statusContent{
background-color: #F5FFFF;
border-radius: 10px;
box-shadow: 0px 1px 1px 0px #00000040;
}
#statusContent .statusContent-flex{
display:flex;
flex-flow: row wrap;
}
.statusContent-flex .my-2{
color:black !important;
}
#statusContent .custom-card{
min-width:300px;
min-height: 50px;
padding:15px;
background-color: white;
color:black;
margin-right:15px;
margin-top :10px;
border-radius: 10px;
box-shadow: 0px 2px 4px 0px #00000024 !important;
}
</style> </style>
<div class="container-fluid">
<h2>Enrollment</h2>
<div class="row visa_status_count_view"> <div class="row visa_status_count_view">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<div class="row" style="margin-bottom: -22px;"> <div class="row" >
<div class="col-3"> <div class="col-3">
<div id="categoryFilter" style="display: flex;"> <div id="categoryFilter" >
<label for="">Client</label>
<select class="form-control" id="clients" onchange="populateBranches()"> <select class="form-control" id="clients" onchange="populateBranches()">
<option value="0">Select Client</option> <option value="0">Select Client</option>
<?php foreach ($client_list as $client) { ?> <?php foreach ($client_list as $client) { ?>
@ -59,6 +118,7 @@
</div> </div>
<div class="col-3"> <div class="col-3">
<div id="categoryFilter_11"> <div id="categoryFilter_11">
<label for="">Branch</label>
<select name="branch_id" class="form-control" id="branch_id" onchange="populatePolicies()"> <select name="branch_id" class="form-control" id="branch_id" onchange="populatePolicies()">
<option value="0">Select Branch</option> <option value="0">Select Branch</option>
</select> </select>
@ -66,106 +126,82 @@
</div> </div>
<div class="col-3"> <div class="col-3">
<div id="categoryFilter_14"> <div id="categoryFilter_14">
<label for="">Policy</label>
<select name="client_policy_id" class="form-control" id="client_policy_id"> <select name="client_policy_id" class="form-control" id="client_policy_id">
<option value="0">Select Policy</option> <option value="0">Select Policy</option>
</select> </select>
</div> </div>
</div> </div>
<div class="col-1"> <div class="col-3">
<div id="categoryFilter_11"> <div id="categoryFilter_11" >
<a class="btn btn-primary waves-effect waves-light" onclick="fetchEmpolyeeList(event);" data-toggle="tooltip" data-placement="top" title="Search" id="get-emp-list"><i class="fa fa-search" aria-hidden="true"></i></a> <a class="btn btn-primary waves-effect waves-light"
style="margin-top:30px !important"
onclick="fetchEmpolyeeList(event);"
data-toggle="tooltip" data-placement="top" title="Search"
id="get-emp-list"><i class="mdi mdi-magnify" aria-hidden="true"></i></a>
</div> </div>
</div> </div>
<div class="col-0" style="margin-right: 15px; "> <div class="col-6" style="margin-right: 15px; margin-top:30px; ">
<div id="categoryFilter_12"> <span id="categoryFilter_12" style="margin-right: 15px;">
<a class="btn btn-primary waves-effect waves-light" onclick="sendManualReminder(this)" data-toggle="tooltip" data-placement="top" title="Send Reminder"><i class="fa fa-bell" aria-hidden="true"></i></a> <a class="btn btn-primary waves-effect waves-light" onclick="sendManualReminder(this)" data-toggle="tooltip" data-placement="top" title="Send Reminder"><span >Send Remainder</span></a>
</div> </span>
</div>
<div class="col-0"> <span id="categoryFilter_13" style="margin-right: 15px;">
<div id="categoryFilter_13"> <a class="btn btn-primary waves-effect waves-light" onclick="uploadEnrollmentFile(this)" data-toggle="tooltip" data-placement="top" title="Enrollment File Upload"><span >File Upload</span></a>
<a class="btn btn-primary waves-effect waves-light" onclick="uploadEnrollmentFile(this)" data-toggle="tooltip" data-placement="top" title="Enrollment File Upload"><i class="fas fa-file-upload" ></i></a> </span>
</div>
</div>
<!-- </div> -->
<!-- <div class="row" style="margin-bottom: 44px;"> --> <button id="categoryFilter_14" type="button" class="btn btn-link visa_status_button" onclick="toggleContent()" data-toggle="tooltip" data-placement="top" >
<div class="col-1 text-right view-status-btn" style="position: relative;bottom: 7px;"> <a class="btn btn-primary waves-effect waves-light" data-toggle="tooltip" data-placement="top" title="View Status"><span >View Status</span></a>
<button type="button" class="btn btn-link visa_status_button" onclick="toggleContent()" style="color: #000;" data-toggle="tooltip" data-placement="top" title="View Status Card">
Status <i id="toggleIcon" class="fas fa-minus"></i>
</button> </button>
</div> </div>
</div> </div>
</div> </div>
<div class="card-body status-option" id="statusContent" style="padding: 1.5rem !important;background-color: darkgrey;"> <div class="card-body status-option" id="statusContent" >
<h4>Status</h4>
<div class="text-center"> <div class="text-center">
<div class="row" style="margin-left: 125px; margin-bottom: -11px;"> <div style="margin-left: 60px; margin-top: 0px;">
<div class="col-xl-2 col-md-2"> <div class="statusContent-flex">
<div class="card cardWidth"> <div class="custom-card d-flex justify-content-between" id="emp_count_view_click">
<div class="card-body" id="emp_count_view_click"> <div>
<div class="d-flex justify-content-between" style="justify-content: center !important;"> <span class="text-muted font-weight-normal mt-0 text-truncate my-2" title="Emp Count">Emp Count</span>
<div> </div>
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Emp Count">Emp Count</h5> <div>
<h3 class="my-2 py-1"><span data-plugin="counterup" id="emp_count_view">0</span></h3> <span class="my-2"><span data-plugin="counterup" id="emp_count_view" >0</span>
</div>
</div> </div>
</div>
</div> </div>
</div><!-- end col --> <div class="custom-card d-flex justify-content-between" id="emp_enrolled_view_click">
<div class="col-xl-2 col-md-2"> <div>
<div class="card"> <span class="text-muted font-weight-normal mt-0 text-truncate my-2" title="Enrolled">Enroled</span>
<div class="card-body" id="emp_enrolled_view_click"> </div>
<div class="d-flex justify-content-between" style="justify-content: center !important;"> <div>
<div> <span class="my-2"><span data-plugin="counterup" id="emp_enrolled_view" >0</span>
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Enrolled">Enroled</h5>
<h3 class="my-2 py-1"><span data-plugin="counterup" id="emp_enrolled_view">0</span></h3>
</div>
</div> </div>
</div>
</div> </div>
</div><!-- end col --> <div class="custom-card d-flex justify-content-between" id="emp_not_enrolled_view_click">
<div class="col-xl-2 col-md-2"> <div>
<div class="card"> <span class="text-muted font-weight-normal mt-0 text-truncate my-2" title="Not Enrolled">Not Enroled</span>
<div class="card-body" id="emp_not_enrolled_view_click"> </div>
<div class="d-flex justify-content-between" style="justify-content: center !important;"> <div>
<div> <span class="my-2"><span data-plugin="counterup" id="emp_not_enrolled_view">0</span>
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Not Enrolled">Not Enroled</h5>
<h3 class="my-2 py-1"><span data-plugin="counterup" id="emp_not_enrolled_view">0</span></h3>
</div>
</div> </div>
</div>
</div> </div>
</div><!-- end col --> <div class="custom-card d-flex justify-content-between" id="emp_logged_in_view_click">
<div class="col-xl-2 col-md-2"> <div>
<div class="card"> <span class="text-muted font-weight-normal mt-0 text-truncate my-2" title="Logged-In">Logged-In</span>
<div class="card-body" id="emp_logged_in_view_click"> </div>
<div class="d-flex justify-content-between" style="justify-content: center !important;"> <div>
<div> <span class="my-2"><span data-plugin="counterup" id="emp_logged_in_view">0</span>
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Logged-In">Logged-In</h5>
<h3 class="my-2 py-1"><span data-plugin="counterup" id="emp_logged_in_view">0</span></h3>
</div>
</div> </div>
</div>
</div> </div>
</div><!-- end col --> <div class="custom-card d-flex justify-content-between" id="emp_not_logged_in_view_click">
<div class="col-xl-2 col-md-2"> <div>
<div class="card"> <span class="text-muted font-weight-normal mt-0 text-truncate my-2" title="Not Logged-In">Not Logged-In</span>
<div class="card-body" id="emp_not_logged_in_view_click"> </div>
<div class="d-flex justify-content-between" style="justify-content: center !important;"> <div>
<div> <span class="my-2"><span data-plugin="counterup" id="emp_not_logged_in_view">0</span>
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Not Logged-In">Not Logged-In</h5>
<h3 class="my-2 py-1"><span data-plugin="counterup" id="emp_not_logged_in_view">0</span></h3>
</div>
</div> </div>
</div>
</div> </div>
</div><!-- end col --> </div><!-- end col -->
</div> </div>
@ -181,7 +217,7 @@
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="tickets-table"> <table data-custom-table-css="table" class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="tickets-table">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th class="font-weight-medium">SNO</th> <th class="font-weight-medium">SNO</th>
@ -200,6 +236,7 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<!-- Center modal content --> <!-- Center modal content -->
<div class="modal fade" id="upload_enrollment_model" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false"> <div class="modal fade" id="upload_enrollment_model" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false">
@ -454,25 +491,25 @@
buttons: [ buttons: [
{ {
extend: 'copy', extend: 'copy',
text: '<i class="fa fa-copy"></i>', text: '<i class="mdi mdi-content-copy"></i>',
titleAttr: 'Copy', titleAttr: 'Copy',
filename: 'Enrolment List' filename: 'Enrolment List'
}, },
{ {
extend: 'print', extend: 'print',
text: '<i class="fa fa-print"></i>', text: '<i class="mdi mdi-printer"></i>',
titleAttr: 'Print', titleAttr: 'Print',
filename: 'Enrolment List' filename: 'Enrolment List'
}, },
{ {
extend: 'pdf', extend: 'pdf',
text: '<i class="fa fa-file-pdf"></i>', text: '<i class="mdi mdi-file-pdf"></i>',
titleAttr: 'PDF', titleAttr: 'PDF',
filename: 'Enrolment List' filename: 'Enrolment List'
}, },
{ {
extend: 'csv', extend: 'csv',
text: '<i class="fa fa-file-csv"></i>', text: '<i class="mdi mdi-file-document"></i>',
titleAttr: 'CSV', titleAttr: 'CSV',
filename: 'Enrolment List' filename: 'Enrolment List'
} }

View File

@ -86,7 +86,7 @@ $errorId = uniqid('error', true);
<?php $argsId = $errorId . 'args' . $index ?> <?php $argsId = $errorId . 'args' . $index ?>
( <a href="#" onclick="return toggle('<?= esc($argsId, 'attr') ?>');">arguments</a> ) ( <a href="#" onclick="return toggle('<?= esc($argsId, 'attr') ?>');">arguments</a> )
<div class="args" id="<?= esc($argsId, 'attr') ?>"> <div class="args" id="<?= esc($argsId, 'attr') ?>">
<table cellspacing="0"> <table data-custom-table-css="table" cellspacing="0">
<?php <?php
$params = null; $params = null;
@ -138,7 +138,7 @@ $errorId = uniqid('error', true);
<h3>$<?= esc($var) ?></h3> <h3>$<?= esc($var) ?></h3>
<table> <table data-custom-table-css="table">
<thead> <thead>
<tr> <tr>
<th>Key</th> <th>Key</th>
@ -168,7 +168,7 @@ $errorId = uniqid('error', true);
<?php if (! empty($constants['user'])) : ?> <?php if (! empty($constants['user'])) : ?>
<h3>Constants</h3> <h3>Constants</h3>
<table> <table data-custom-table-css="table">
<thead> <thead>
<tr> <tr>
<th>Key</th> <th>Key</th>
@ -197,7 +197,7 @@ $errorId = uniqid('error', true);
<div class="content" id="request"> <div class="content" id="request">
<?php $request = Services::request(); ?> <?php $request = Services::request(); ?>
<table> <table data-custom-table-css="table">
<tbody> <tbody>
<tr> <tr>
<td style="width: 10em">Path</td> <td style="width: 10em">Path</td>
@ -243,7 +243,7 @@ $errorId = uniqid('error', true);
<h3>$<?= esc($var) ?></h3> <h3>$<?= esc($var) ?></h3>
<table style="width: 100%"> <table data-custom-table-css="table" style="width: 100%">
<thead> <thead>
<tr> <tr>
<th>Key</th> <th>Key</th>
@ -281,7 +281,7 @@ $errorId = uniqid('error', true);
<h3>Headers</h3> <h3>Headers</h3>
<table> <table data-custom-table-css="table">
<thead> <thead>
<tr> <tr>
<th>Header</th> <th>Header</th>
@ -307,7 +307,7 @@ $errorId = uniqid('error', true);
$response->setStatusCode(http_response_code()); $response->setStatusCode(http_response_code());
?> ?>
<div class="content" id="response"> <div class="content" id="response">
<table> <table data-custom-table-css="table">
<tr> <tr>
<td style="width: 15em">Response Status</td> <td style="width: 15em">Response Status</td>
<td><?= esc($response->getStatusCode() . ' - ' . $response->getReasonPhrase()) ?></td> <td><?= esc($response->getStatusCode() . ' - ' . $response->getReasonPhrase()) ?></td>
@ -320,7 +320,7 @@ $errorId = uniqid('error', true);
<h3>Headers</h3> <h3>Headers</h3>
<table> <table data-custom-table-css="table">
<thead> <thead>
<tr> <tr>
<th>Header</th> <th>Header</th>
@ -354,7 +354,7 @@ $errorId = uniqid('error', true);
<!-- Memory --> <!-- Memory -->
<div class="content" id="memory"> <div class="content" id="memory">
<table> <table data-custom-table-css="table">
<tbody> <tbody>
<tr> <tr>
<td>Memory Usage</td> <td>Memory Usage</td>

View File

@ -68,7 +68,7 @@ table.dataTable tbody td {
<!-- <button><a href="">download full file</a></button> --> <!-- <button><a href="">download full file</a></button> -->
<div class="container"> <div class="container">
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table"> <table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<?php foreach ($excel_header as $header): ?> <?php foreach ($excel_header as $header): ?>

View File

@ -68,7 +68,7 @@ table.dataTable tbody td {
<!-- <button><a href="">download full file</a></button> --> <!-- <button><a href="">download full file</a></button> -->
<div class="container"> <div class="container">
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table"> <table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<?php foreach ($excel_header as $header): ?> <?php foreach ($excel_header as $header): ?>

View File

@ -19,7 +19,7 @@
</div> </div>
</div> </div>
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" <table data-custom-table-css="table" class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0"
id="tickets-table"> id="tickets-table">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>

View File

@ -137,8 +137,8 @@ table.dataTable tbody td {
<label>Date<span class="text-danger"></span></label> <label>Date<span class="text-danger"></span></label>
<div id="reportrange" class="form-control" <div id="reportrange" class="form-control"
style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%"> style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
<i class="fa fa-calendar"></i>&nbsp; <i class="mdi mdi-calendar-blank"></i>&nbsp;
<span></span> <i class="fa fa-caret-down"></i> <span></span> <i class="mdi mdi-menu-down"></i>
</div> </div>
<input type="hidden" id="startDate"> <input type="hidden" id="startDate">
<input type="hidden" id="endDate"> <input type="hidden" id="endDate">
@ -179,7 +179,7 @@ table.dataTable tbody td {
</div> </div>
<div class="table-responsive" style="overflow-x: auto;"> <div class="table-responsive" style="overflow-x: auto;">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap"> <table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th>S.No</th> <th>S.No</th>

View File

@ -1,12 +1,76 @@
<style>
<?php foreach ($hr_access_data as $key => $value) {
$key = $key + 1;
?>
#user<?php echo "$key"; ?>-active {
margin: 0;
}
#user<?= $key ?>-active .checkbox-item {
padding-left: 0;
}
#user<?= $key ?>-active label {
font-size: 11px !important;
height: auto !important;
}
#user<?php echo "$key"; ?>-pre {
margin: 0;
}
#user<?= $key ?>-pre .checkbox-item {
padding-left: 0;
}
#user<?= $key ?>-pre label {
font-size: 11px !important;
height: auto !important;
}
#user<?php echo "$key"; ?>-gmc2 {
margin: 0;
}
#user<?= $key ?>-gmc2 .checkbox-item {
padding-left: 0;
}
#user<?= $key ?>-gmc2 label {
font-size: 11px !important;
height: auto !important;
}
#user<?php echo "$key"; ?>-cd {
margin: 0;
}
#user<?= $key ?>-cd .checkbox-item {
padding-left: 0;
}
#user<?= $key ?>-cd label {
font-size: 11px !important;
height: auto !important;
}
<?php } ?>
</style>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<?php if(isset($hr_access_data) && !empty($hr_access_data)) { ?> <?php if (isset($hr_access_data) && !empty($hr_access_data)) { ?>
<form id="insuranceForm" onsubmit="submitForm(event)"> <form id="insuranceForm" onsubmit="submitForm(event)">
<?php foreach ($hr_access_data as $key => $value) { <?php foreach ($hr_access_data as $key => $value) {
$key = $key + 1 ?> $key = $key + 1;
?>
<!-- User 1 Card --> <!-- User 1 Card -->
<div class="user-card" data-user-id="<?= 'user' . $key ?>"> <div class="user-card" data-user-id="<?= 'user' . $key ?>">
@ -16,19 +80,19 @@
<input type="hidden" name="<?= 'user' . $key ?>_post_hr_id" value="<?= $value['post_hr_id'] ?>"> <input type="hidden" name="<?= 'user' . $key ?>_post_hr_id" value="<?= $value['post_hr_id'] ?>">
<input type="hidden" name="<?= 'user' . $key ?>_post_client_id" value="<?= $value['post_client_id'] ?>"> <input type="hidden" name="<?= 'user' . $key ?>_post_client_id" value="<?= $value['post_client_id'] ?>">
<div class="card-header" onclick="toggleAccordion(this)"> <div class="card-header" onclick="toggleAccordion(this)" style="background-color: #F5FFFF;">
<div class="user-info"> <div class="user-info">
<h5 class="mb-0"><?= $value['hr_name'] ?> <h5 class="mb-0"><?= $value['hr_name'] ?>
<!-- <i class="fa fa-info-circle" aria-hidden="true" data-id="<?= (!empty($value['pre_hr_id']) ? $value['pre_hr_id'] : 0) . '-' . (!empty($value['post_hr_id']) ? $value['post_hr_id'] : 0) ?>"></i> --> <!-- <i class="mdi mdi-information-outline" aria-hidden="true" data-id="<?= (!empty($value['pre_hr_id']) ? $value['pre_hr_id'] : 0) . '-' . (!empty($value['post_hr_id']) ? $value['post_hr_id'] : 0) ?>"></i> -->
</h5> </h5>
<p class="user-email"><?= $value['hr_mail'] ?></p> <p class="user-email"><?= $value['hr_mail'] ?></p>
</div> </div>
<div class="accordion-icon"> <div class="accordion-icon">
<i class="fas fa-chevron-down"></i> <i class="mdi mdi-chevron-down"></i>
</div> </div>
</div> </div>
<div class="card-content"> <div class="card-content">
<div class="content-inner"> <div class="content-inner" style="background-color: #F5FFFF;">
<div class="row"> <div class="row">
<div class="col-md-6 col-lg-3"> <div class="col-md-6 col-lg-3">
<div class="section"> <div class="section">
@ -38,7 +102,7 @@
value="1" <?php if (in_array(1, $value['allowed_pre_modules'] ?? [])) { value="1" <?php if (in_array(1, $value['allowed_pre_modules'] ?? [])) {
echo 'checked'; echo 'checked';
} ?>> } ?>>
<i class="fas fa-user-plus mr-2"></i>Pre enrollment <i class="mdi mdi-account-plus mr-2"></i>Pre enrollment
</div> </div>
<div class="<?= in_array(1, $value['allowed_pre_modules']) ? 'checkbox-group' : 'checkbox-group hidden' ?>" id="<?= 'user' . $key ?>-pre"> <div class="<?= in_array(1, $value['allowed_pre_modules']) ? 'checkbox-group' : 'checkbox-group hidden' ?>" id="<?= 'user' . $key ?>-pre">
@ -68,7 +132,9 @@
<div class="checkbox-item"> <div class="checkbox-item">
<input type="checkbox" class="policy-checkbox <?= $statusClass ?>" name="<?= 'user' . $key ?>_pre_policies" data-user="<?= $key ?>" data-group="pre" value="<?= $policies['client_policy_id'] ?>" <input type="checkbox" class="policy-checkbox <?= $statusClass ?>" name="<?= 'user' . $key ?>_pre_policies" data-user="<?= $key ?>" data-group="pre" value="<?= $policies['client_policy_id'] ?>"
<?= in_array($policies['client_policy_id'], $value['allowed_pre_policies']) ? 'checked' : '' ?>> <?= in_array($policies['client_policy_id'], $value['allowed_pre_policies']) ? 'checked' : '' ?>>
<label style="<?php if($policies['policy_status'] == 0){echo 'color:#ff5757';} ?>"><?= $policies['policy_type'] . ' - ' . $policies['policy_no'] ?></label> <label style="<?php if ($policies['policy_status'] == 0) {
echo 'color:#ff5757';
} ?>"><?= $policies['policy_type'] . ' - ' . $policies['policy_no'] ?></label>
</div> </div>
<?php } ?> <?php } ?>
</div> </div>
@ -84,11 +150,15 @@
value="2" <?php if (in_array(2, $value['allowed_post_modules'])) { value="2" <?php if (in_array(2, $value['allowed_post_modules'])) {
echo 'checked'; echo 'checked';
} ?>> } ?>>
<i class="fas fa-check-circle mr-2"></i>Active policies <i class="mdi mdi-check-circle mr-2"></i>Active policies
</div> </div>
<div class="<?php if (in_array(2, $value['allowed_post_modules'])) {echo 'checkbox-group';} else {echo 'checkbox-group hidden';} ?>" id="<?= 'user' . $key ?>-active"> <div class="<?php if (in_array(2, $value['allowed_post_modules'])) {
echo 'checkbox-group';
} else {
echo 'checkbox-group hidden';
} ?>" id="<?= 'user' . $key ?>-active">
<!-- Select All --> <!-- Select All -->
<div class="checkbox-item"> <div class="checkbox-item">
<input type="checkbox" class="select-all" data-type="all" data-user="<?= $key ?>" data-group="post"> <input type="checkbox" class="select-all" data-type="all" data-user="<?= $key ?>" data-group="post">
@ -107,14 +177,20 @@
<label>Select all In-Active policies</label> <label>Select all In-Active policies</label>
</div> </div>
<?php foreach ($post_policy_data as $key2 => $policies) { <?php foreach ($post_policy_data as $key2 => $policies) {
$statusText = $policies['policy_status'] == 1 ? 'Active' : 'In-Active'; $statusText = $policies['policy_status'] == 1 ? 'Active' : 'In-Active';
$statusClass = $policies['policy_status'] == 1 ? 'active' : 'inactive'; $statusClass = $policies['policy_status'] == 1 ? 'active' : 'inactive';
?> ?>
<div class="checkbox-item"> <div class="checkbox-item">
<input type="checkbox" class="policy-checkbox <?= $statusClass ?>" id="<?= 'user' . $key ?>-gmc2" name="<?= 'user' . $key ?>_active_policies" data-user="<?= $key ?>" data-group="post" <input type="checkbox" class="policy-checkbox <?= $statusClass ?>" id="<?= 'user' . $key ?>-gmc2" name="<?= 'user' . $key ?>_active_policies" data-user="<?= $key ?>" data-group="post"
value="<?= $policies['client_policy_id'] ?>" <?php if (in_array($policies['client_policy_id'], $value['allowed_active_policies'])) {echo 'checked';} ?>> value="<?= $policies['client_policy_id'] ?>" <?php if (in_array($policies['client_policy_id'], $value['allowed_active_policies'])) {
<label for="<?= 'user' . $key ?>-gmc2" style="<?php if($policies['policy_status'] == 0){echo 'color:#ff5757';} ?>"><?= $policies['policy_type'] . ' - ' . $policies['policy_no'] ?></label> echo 'checked';
} ?>>
<label for="<?= 'user' . $key ?>-gmc2" style="<?php if ($policies['policy_status'] == 0) {
echo 'color:#ff5757';
} ?>">
<?= $policies['policy_type'] . ' - ' . $policies['policy_no'] ?>
</label>
</div> </div>
<?php } ?> <?php } ?>
@ -127,11 +203,17 @@
<div class="section"> <div class="section">
<div class="section-title"> <div class="section-title">
<input type="checkbox" class="main-checkbox" <input type="checkbox" class="main-checkbox"
onchange="toggleSection(this, '<?= 'user' . $key ?>-cd')" name="<?= 'user' . $key ?>_modules" value="3" <?php if (in_array(3, $value['allowed_post_modules'])) { echo 'checked';} ?>> onchange="toggleSection(this, '<?= 'user' . $key ?>-cd')" name="<?= 'user' . $key ?>_modules" value="3" <?php if (in_array(3, $value['allowed_post_modules'])) {
<i class="fas fa-file-alt mr-2"></i>CD statement echo 'checked';
} ?>>
<i class="mdi mdi-file mr-2"></i>CD statement
</div> </div>
<div class="<?php if (in_array(3, $value['allowed_post_modules'])) {echo 'checkbox-group';} else {echo 'checkbox-group hidden';} ?>" id="<?= 'user' . $key ?>-cd"> <div class="<?php if (in_array(3, $value['allowed_post_modules'])) {
echo 'checkbox-group';
} else {
echo 'checkbox-group hidden';
} ?>" id="<?= 'user' . $key ?>-cd">
<!-- Select All --> <!-- Select All -->
<div class="checkbox-item"> <div class="checkbox-item">
@ -141,7 +223,9 @@
<?php foreach ($post_cd_data as $key3 => $cd) { ?> <?php foreach ($post_cd_data as $key3 => $cd) { ?>
<div class="checkbox-item"> <div class="checkbox-item">
<input type="checkbox" class="policy-checkbox" data-user="<?= $key ?>" data-group="cd" id="<?= 'user' . $key ?>-icici1" name="<?= 'user' . $key ?>_cd" value="<?= $cd['cd_master_pk'] ?>" <?php if (in_array($cd['cd_master_pk'], $value['allowed_cd'])) { echo 'checked';} ?>> <input type="checkbox" class="policy-checkbox" data-user="<?= $key ?>" data-group="cd" id="<?= 'user' . $key ?>-icici1" name="<?= 'user' . $key ?>_cd" value="<?= $cd['cd_master_pk'] ?>" <?php if (in_array($cd['cd_master_pk'], $value['allowed_cd'])) {
echo 'checked';
} ?>>
<label for="<?= 'user' . $key ?>-icici1"><?= $cd['insurer_short_name'] ?> - <span class="policy-number"><?= $cd['cd_account_no'] ?></span></label> <label for="<?= 'user' . $key ?>-icici1"><?= $cd['insurer_short_name'] ?> - <span class="policy-number"><?= $cd['cd_account_no'] ?></span></label>
</div> </div>
<?php } ?> <?php } ?>
@ -152,8 +236,10 @@
<div class="col-md-6 col-lg-3"> <div class="col-md-6 col-lg-3">
<div class="section"> <div class="section">
<div class="section-title"> <div class="section-title">
<input type="checkbox" class="main-checkbox" name="<?= 'user' . $key ?>_modules" value="4" <?php if (in_array(4, $value['allowed_post_modules'])) {echo 'checked';} ?>> <input type="checkbox" class="main-checkbox" name="<?= 'user' . $key ?>_modules" value="4" <?php if (in_array(4, $value['allowed_post_modules'])) {
<i class="fas fa-clipboard-list mr-2"></i>Claims echo 'checked';
} ?>>
<i class="mdi mdi-clipboard-text mr-2"></i>Claims
</div> </div>
</div> </div>
</div> </div>
@ -173,7 +259,9 @@
</form> </form>
<?php } else { ?> <?php } else { ?>
<div class="submit-container"><b>There is no HR data</b></div> <div class="submit-container">
<p align="center"> <b>There is no HR data</b></p>
</div>
<?php } ?> <?php } ?>
</div> </div>
</div> </div>

View File

@ -23,12 +23,34 @@ table.dataTable tbody td {
} */ } */
</style> </style>
<div class="row" style="position: relative;left: 250px;top: 55px;"> <style>
/* Put this in your CSS */
#scroll-horizontal-datatable_wrapper .btn-secondary {
cursor: pointer;
width: auto;
display: inline-flex;
align-items: center;
border: 1px solid #F5FFFF;
background-color: #F5FFFF !important;
}
#scroll-horizontal-datatable_wrapper #submitBtn{
background-color: #E26728 !important;
color: white !important;
border: 1px solid #E26728;
padding: 5px 10px !important;
border-radius: 10px !important;
cursor: pointer !important;
box-shadow: 0px 2px 4px 0px #00000024 !important;
}
</style>
<!-- <div class="row" style="position: relative;left: 250px;top: 55px;">
<div class="form-group col-md-3" id="date_div"> <div class="form-group col-md-3" id="date_div">
<!-- <label>ActivityDate<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%"> <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>&nbsp; <i class="mdi mdi-calendar-blank"></i>&nbsp;
<span></span> <i class="fa fa-caret-down"></i> <span></span> <i class="mdi mdi-menu-down"></i>
</div> </div>
<input type="hidden" id="startDate"> <input type="hidden" id="startDate">
<input type="hidden" id="endDate"> <input type="hidden" id="endDate">
@ -36,9 +58,9 @@ table.dataTable tbody td {
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<button type="button" class="btn btn-primary" onclick="appendHrActivityHistoryHtml(this, true)"> submit </button> <button type="button" class="btn btn-primary" onclick="appendHrActivityHistoryHtml(this, true)"> submit </button>
</div> </div>
</div> </div> -->
<table id="scroll-horizontal-datatable" class="table w-100 nowrap"> <table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap flex-grow">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th>S. No</th> <th>S. No</th>
@ -69,9 +91,9 @@ $(document).ready(function () {
var ticketsTable = $('#scroll-horizontal-datatable'); var ticketsTable = $('#scroll-horizontal-datatable');
if (ticketsTable.length) { if (ticketsTable.length) {
ticketsTable.DataTable({ var table = ticketsTable.DataTable({
scrollX: true, scrollX: true,
dom: "<'row'<'col-sm-2'f><'col-sm-2'>>" + // Filter left, buttons right dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // search left, buttons right
"<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-3'i><'col-sm-2'l><'col-sm-7'p>>", "<'row'<'col-sm-3'i><'col-sm-2'l><'col-sm-7'p>>",
language: { language: {
@ -80,40 +102,62 @@ $(document).ready(function () {
}, },
paging: true, paging: true,
pageLength: 25, pageLength: 25,
ordering: false ordering: false,
buttons: [
{
text: '<div id="reportrange" class="form-control d-inline-block mr-2 custom-daterange" style="background:white; cursor: pointer; width: auto; display:inline-flex; align-items:center;">' +
'<i class="mdi mdi-calendar-blank"></i>&nbsp;<span></span> <i class="mdi mdi-menu-down"></i>' +
'</div>' +
'<input type="hidden" id="startDate">' +
'<input type="hidden" id="endDate">' +
'<button type="button" id="submitBtn" class="btn btn-primary ml-2">Submit</button>',
className: 'btn-group d-inline-block btn-secondary',
style : 'background: white; border: 1px solid #ced4da; padding: 5px 10px; border-radius: 5px;',
action: function () {
appendHrActivityHistoryHtml(this, true);
}
}
]
});
// Attach submit handler separately so it works
$(document).on("click", "#submitBtn", function () {
appendHrActivityHistoryHtml(this, true);
});
// Daterangepicker setup
const params = new URLSearchParams(window.location.search);
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
const start = moment(startDateParam, 'DD-MM-YYYY');
const end = moment(endDateParam, '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'));
}
$(document).ready(function () {
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'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')]
}
}, cb);
cb(start, end);
}); });
} else { } else {
console.error("Table not found."); console.error("Table not found.");
} }
// Daterangepicker setup
const params = new URLSearchParams(window.location.search);
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
const start = moment(startDateParam, 'DD-MM-YYYY');
const end = moment(endDateParam, '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()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'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')]
}
}, cb);
cb(start, end);
}); });

View File

@ -0,0 +1,451 @@
<style>
.select2-container .select2-selection--multiple .select2-selection__choice {
padding: 5px 7px 5px 0 !important;
color: #000000;
}
</style>
<div class="tab-pane fade" id="HR-DOC-tab">
<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"> -->
<form class="parsley-examples" id="hr_file_upload_search" >
<input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>" id="csrf_token">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-4">
<label>Client</label> <br />
<select name="client_id" class="form-control" id="client2" >
<option value="">Select</option>
</select>
</div>
<div class="form-group col-md-4">
<label>Branch</label> <br />
<select name="client_branch_id" class="form-control" id="client_branch_id2" >
<option value="0">Select</option>
</select>
</div>
<div class="form-group col-md-4">
<label>Policy</label> <br />
<select name="policy_id" class="form-control" id="policy2" >
<option value="">Select</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label>Event<span class="text-danger">*</span></label> <br />
<select name="file_action" class="form-control" id="event_type" required>
<option value="">Select</option>
<?php
if (isset($events) && count($events)) {
foreach ($events as $key => $action) {
if($key != "inception"){
echo "<option value='$key'" . ($key == "si_enhancement" ? " class='si-enhancement-option'" : "") . ">$action</option>";
}
}
}
?>
</select>
</div>
</div>
<div class="form-row" id="">
<div class="d-flex align-items-center justify-content-start" style="margin-top: 18px;">
<div class="form-group col-md-3">
<button type="submit" class="btn btn-primary waves-effect waves-light justify-content-end">Search</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- end page title -->
<div class="row" id="hr_file_list">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Files</h4>
</div>
</div>
<table data-custom-table-css="table" class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0"
id="hr_tickets_table">
<thead class="bg-light">
<tr>
<th class="font-weight-medium">SNO</th>
<th class="font-weight-medium">File name</th>
<th class="font-weight-medium">Client</th>
<th class="font-weight-medium">Client Branch</th>
<th class="font-weight-medium">Policy</th>
<th class="font-weight-medium">Event</th>
<th class="font-weight-medium">User/Time</th>
<th class="font-weight-medium">Status</th>
<th class="font-weight-medium">Action</th>
</tr>
</thead>
<tbody class="font-12">
<?php
if (isset($HRfileList)) { foreach ($fileList as $key => $file) { ?>
<tr>
<td><b><?php echo ($key + 1) ?></b></td>
<td title="<?php echo $file['file_name'] ?>">
<?php echo $file['file_name']?>
</td>
<td><?php echo $file['short_name'] ?></td>
<td><?php echo $file['branch_name'] ?></td>
<td><?php echo $file['policy_no'] ?></td>
<td><?php echo $file['file_action'] ?></td>
<td><?php echo change_date_format($file['created_at'],'Y-m-d H:i:s', 'd M Y h:i a') . ' by <strong>' . $file['first_name'] . '</strong>' ?></td>
<td><?php echo $file['status']; ?> </td>
<td> </td>
</tr>
<?php }
} ?>
</tbody>
</table>
</div>
</div>
</div><!-- end col -->
</div>
<!-- end row -->
</div>
<!-- Center modal content for reupload file-->
<div class="modal fade" id="hr-file-upload-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">Endorsement Upload</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<form class="parsley-examples" id="hrUploadForm" enctype="multipart/form-data">
<input type="hidden" id="hr_file_client_id" name="client_id">
<input type="hidden" id="hr_file_policy_id" name="policy_id">
<input type="hidden" id="hr_file_branch_id" name="branch_id">
<input type="hidden" id="hr_file_hr_file_id" name="hr_file_id">
<input type="hidden" id="hr_file_upload_actions" name="upload-action-type">
<input type="file" id="fileInput" name="emplist" required
accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet">
<button type="submit" class="btn btn-primary">Upload</button>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
$(document).ready(function(){
//client change to get the Client Branch
$('#client2').change(function(){
let client_id = $(this).val();
console.log('client_id', client_id);
if(branch_list != '') {
// console.log(branch_list[client_id]);
let data = branch_list[client_id];
appendBranch3(data);
}
})
//change the client branch than change the client policy
$('#client_branch_id2').change(function(){
let branch_id = $(this).val();
console.log("branch_id", branch_id);
if(policy_list != '' && branch_id != '') {
let data = policy_list[branch_id];
appendPolicy3(data);
}
});
})
$(document).ready(function() {
// Initialize select2
$("#client2").select2();
$("#policy2").select2();
$("#client_branch_id2").select2();
// Form submit event
$("#hr_file_upload_search").on("submit", function (e) {
e.preventDefault(); // stop normal form submit
let formData = $(this).serialize(); // serialize form with csrf
var baseurl = `<?= base_url() ?>`;
$.ajax({
url: "<?= base_url('hrFileList') ?>",
type: "POST",
data: formData,
dataType: "json",
beforeSend: function () {
// optional loader
$("#hr_tickets_table tbody").html(
"<tr><td colspan='9' class='text-center'>Loading...</td></tr>"
);
},
success: function (res) {
let tbody = "";
if (res.status === "success" && res.data.length > 0) {
$.each(res.data, function (index, file) {
tbody += `
<tr>
<td><b>${index + 1}</b></td>
<td id="${file.id}" class="reload truncate" title="${file.file_name}">${file.file_name}</td>
<td>${file.short_name ?? ""}</td>
<td>${file.branch_name ?? ""}</td>
<td>${file.policy_no ?? ""}</td>
<td>${formatTextToCamelCase(file.file_action) ?? ""}</td>
<td>${file.created_at} by <strong>${file.first_name ?? ""}</strong></td>
<td>${file.status}</td>
<td>
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm"
data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a href="${baseurl}/hrFileDownload?id=${file.id}" class="dropdown-item" style="color: #000;" aria-hidden="true" target="_blank" ><i class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download</a>
<a class="dropdown-item" onclick="uploadEndorsementFile(${file.client_id}, ${file.client_branch_id}, ${file.policy_id}, ${file.id}, '${file.file_action}')" style="color: #000;" aria-hidden="true"><i class="mdi mdi-upload mr-2 text-muted font-18 vertical-middle"></i>Initiate Endorsement</a>
</div>
</div>
</td>
</tr>
`;
});
} else {
tbody = `<tr><td colspan="9" class="text-center">No records found</td></tr>`;
}
$("#hr_tickets_table tbody").html(tbody);
},
error: function (xhr, status, error) {
console.error("Error:", error);
$("#hr_tickets_table tbody").html(
`<tr><td colspan="9" class="text-center text-danger">Something went wrong</td></tr>`
);
},
});
});
});
// ------------ Append Functions are Below ----------------------------------------------------------------------------------
function appendClients3(data)
{
$('#client2').empty();
$('#client2').append($('<option>', {
value: '',
text: 'Select Client'
}));
$.each(data, function(index, item) {
let client_show_name = item.client_name;
if (item.client_type == 2) {
client_show_name = item.client_name + (item.dob ? ('- (' + item.dob + ' )' ) : '') + (item.pan ? ('- ' + item.pan ) : '');
// console.log(client_show_name);
}
var option = $('<option>', {
value: item.id,
text: client_show_name,
'data-cn': item.client_name,
'data-ct': item.client_type,
});
$('#client2').append(option);
});
}
function appendBranch3(data)
{
$('#client_branch_id2').empty();
$('#client_branch_id2').append($('<option>', {
value: '',
text: 'Select Branch'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.branch_name
});
$('#client_branch_id2').append(option);
});
}
function appendPolicy3(data)
{
$('#policy2').empty();
$('#policy2').append($('<option>', {
value: '',
text: 'Select Policy',
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.policy_type + '-' + item.policy_no,
});
$('#policy2').append(option);
});
}
// ----------------------------------------------------------------------------------------------
// for datatable
$(document).ready(function() {
$('#hr_tickets_table').DataTable({
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
"buttons": [{
"extend": 'csv',
"text": 'CSV',
"title": 'Employee-Upload-List',
"className": 'my_class',
"exportOptions": {
"columns": ':not(:last-child)'
},
}],
"initComplete": function(settings, json) {
$('.my_class').css({
"position": "relative",
"left": "79px"
});
},
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true,
});
});
//for initialize the file upload for the files table
function uploadEndorsementFile(client_id, branch_id, policy_id, file_id, event){
console.log(client_id, branch_id, policy_id, file_id, event);
$('#hr_file_client_id').val(client_id);
$('#hr_file_branch_id').val(branch_id);
$('#hr_file_policy_id').val(policy_id);
$('#hr_file_upload_actions').val(event);
$('#hr_file_hr_file_id').val(file_id);
var myModal = new bootstrap.Modal(document.getElementById('hr-file-upload-modal'));
myModal.show();
}
//hr file upload reupload to the files table
$('#hrUploadForm').submit(function(e) {
e.preventDefault();
var isValid = $('#hrUploadForm').parsley().validate();
if (!isValid) {
console.log('Form is Empty', 'Warning');
return;
}
// Create FormData object
var formData = new FormData($(this)[0]);
for (var pair of formData.entries()) {
console.log(pair[0] + ', ' + pair[1]);
}
// return false;
$.ajax({
url: `<?= base_url('employee/upload') ?>`,
type: "POST",
data: formData,
processData: false, // Prevent jQuery from automatically processing the data
contentType: false, // Let jQuery handle the content type
headers: {
// "Content-Type":"multipart/form-data",
"X-Requested-With": "XMLHttpRequest"
},
success: function(response) {
console.log(response);
$('#hrUploadForm')[0].reset();
if (response.code === 200 && response.dataStatus === true && response
.data !== "") {
toastr.success(
'File upload successs, Data validation is in-progress',
'success');
$('.close').click()
window.location.reload(true);
} else if (response.code === 404 && response.dataStatus === false) {
console.error('no data found', response);
// alert(response.message);
toastr.error(response.message, 'Failed');
window.location.reload(true);
} else {
console.error('Something went wrong!');
// alert('Something went wrong! Try later');
toastr.error('Something went wrong! Try later', 'Error');
window.location.reload(true);
}
$('.close').click();
},
error: function(xhr, status, error) {
// Request failed, handle error
console.error("Request failed:", status, error);
toastr.error('Something went wrong! Try later', 'Error');
$('#hrUploadForm')[0].reset();
$('.close').click();
window.location.reload(true);
}
});
})
</script>

View File

@ -9,34 +9,86 @@
} }
</style> </style>
<script>
var client_list = ''; // local variable for storing the client branch list
var branch_list = ''; // local variable for storing the client branch list
var policy_list = ''; // local variable for storing the client policy list
var branch_policy = '';
$(document).ready(function(){
getClientAndBranchAndPolicy();
})
//featch client and branch and policy
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;
branch_list = res.branch_data;
policy_list = res.policy_data;
appendClients(res.client_data);
appendClients2(res.client_data);
appendClients3(res.client_data);
}else{
console.log('No data found');
}
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
}
});
}
</script>
<div class="row" id="client_add" style="position: relative; bottom: 25px;"> <div class="row" id="client_add" style="position: relative; bottom: 25px;">
<div class="col-12"> <div class="col-12">
<div class="card-body"> <div class="card-body">
<h3>Inception</h3>
<br>
<ul class="nav nav-pills navtab-bg"> <ul class="nav nav-pills navtab-bg">
<li class="nav-item"> <li class="nav-item d-flex justify-content-center align-items-center">
<a href="#general-q-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2 active" id="general_tab"> <a href="#general-q-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-1 active-tab" id="general_tab">
<span class="mr-1"><i class="mdi mdi-contacts"></i></span> <span class="mr-1"><i class="mdi mdi-contacts"></i></span>
<span class="d-none d-sm-inline-block">Data From Client</span> <span class="d-none d-sm-inline-block dash-tab-font">Data From Client</span>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item d-flex justify-content-center align-items-center">
<a href="#KYC-DOC-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab"> <a href="#KYC-DOC-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-1" id="kyc_tab">
<span class="mr-1"><i class="fa fa-file"></i></span> <span class="mr-1"><i class="mdi mdi-file"></i></span>
<span class="d-none d-sm-inline-block">Insurer or TPA Data</span> <span class="d-none d-sm-inline-block dash-tab-font">Insurer or TPA Data</span>
</a>
</li>
<li class="nav-item d-flex justify-content-center align-items-center">
<a href="#HR-DOC-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-1" id="hr_tab">
<span class="mr-1"><i class="mdi mdi-file"></i></span>
<span class="d-none d-sm-inline-block dash-tab-font">HR Uploaded Files</span>
</a> </a>
</li> </li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<?php include('employee_upload.php'); ?> <?php include('employee_upload.php'); ?>
<?php include('insurer_or_tpa_data.php'); ?> <?php include('insurer_or_tpa_data.php'); ?>
<?php include('hr_file_upload.php'); ?>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
@ -45,8 +97,17 @@
$('#kyc_tab').click(); $('#kyc_tab').click();
} }
if (window.location.hash === '#HR-DOC-tab') {
console.log('url hash :', window.location.hash)
$('#hr_tab').click();
}
}) })
function formatTextToCamelCase(str) {
return str
.replace(/_/g, ' ') // replace underscores with spaces
.toLowerCase() // convert everything to lowercase
.replace(/\b\w/g, char => char.toUpperCase()); // capitalize each word
}
</script> </script>

View File

@ -1,4 +1,5 @@
<style> <style>
.switch { .switch {
position: relative; position: relative;
display: inline-block; display: inline-block;
@ -37,11 +38,11 @@
} }
input:checked + .slider { input:checked + .slider {
background-color: #2196F3; background-color: #00999E;
} }
input:focus + .slider { input:focus + .slider {
box-shadow: 0 0 1px #2196F3; box-shadow: 0 0 1px #00999E;
} }
input:checked + .slider:before { input:checked + .slider:before {
@ -60,105 +61,130 @@ input:checked + .slider:before {
} }
</style> </style>
<div class="tab-pane fade active show" id="general-q-tab"> <div class="tab-pane fade active show" id="general-q-tab">
<!---- new ----->
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="card-body"> <div class="card-body">
<form role="form" class="parsley-examples" method="post" id="insurer_general_form" enctype="multipart/form-data"> <div class="custom-form">
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" /> <form role="form" class="parsley-examples" method="post" id="insurer_general_form" enctype="multipart/form-data">
<input type="hidden" name="PrimaryKey" id="insurer_General_PrimaryKey" value="<?= isset($insurer['id']) ? $insurer['id'] : '' ?>" /> <input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<input type="hidden" name="insurer_id" id="insurer_id" /> <input type="hidden" name="PrimaryKey" id="insurer_General_PrimaryKey" value="<?= isset($insurer['id']) ? $insurer['id'] : '' ?>" />
<div class="form-group"> <input type="hidden" name="insurer_id" id="insurer_id" />
<div class="form-row"> <!-- Insurer Name -->
<div class="form-group col-md-4"> <div class="form-group row">
<label for="insurer_name">Insurer Name<span class="text-danger">*</span></label> <label for="insurer_name" class="col-md-4 col-form-label">Insurer Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="insurer_name" placeholder="Enter Insurer Name" value="<?= isset($insurer['name']) ? $insurer['name'] : '' ?>" name="name" required> <div class="col-md-5">
</div> <input type="text" class="form-control" id="insurer_name" placeholder="Enter Insurer Name"
value="<?= isset($insurer['name']) ? $insurer['name'] : '' ?>" name="name" required>
</div>
</div>
<!-- Short Name -->
<div class="form-group row">
<label for="short_name" class="col-md-4 col-form-label">Insurer Short Name<span class="text-danger">*</span></label>
<div class="col-md-5">
<input type="text" class="form-control" id="short_name" placeholder="Enter Short Name"
value="<?= isset($insurer['short_name']) ? $insurer['short_name'] : '' ?>" name="short_name" required minlength="3" maxlength="8">
</div>
</div>
<!-- Insurer Type -->
<div class="form-group row">
<label class="col-md-4 col-form-label">Insurer Type</label>
<div class="col-md-6 d-flex align-items-center">
<input type="radio" id="type_pvt" name="type" value="pvt"
<?= isset($insurer['type']) && $insurer['type'] == 'pvt' ? 'checked' : '' ?>>
<label for="type_pvt" class="mr-3 ml-2 mt-1 ">PVT</label>
<input type="radio" id="type_psu" name="type" value="psu"
<?= isset($insurer['type']) && $insurer['type'] == 'psu' ? 'checked' : '' ?>>
<label for="type_psu" class="mr-3 ml-2 mt-1 ">PSU</label>
</div>
</div>
<!-- Insurer Category -->
<div class="form-group row">
<label class="col-md-4 col-form-label">Insurer Category</label>
<div class="col-md-6 d-flex align-items-center">
<input type="radio" id="cat_life" name="category" value="life"
<?= isset($insurer['category']) && $insurer['category'] == 'life' ? 'checked' : '' ?>>
<label for="cat_life" class="mr-3 ml-2 mt-1 ">Life</label>
<input type="radio" id="cat_general" name="category" value="general"
<?= isset($insurer['category']) && $insurer['category'] == 'general' ? 'checked' : '' ?>>
<label for="cat_general" class="mr-3 ml-2 mt-1 ">General (Non Life)</label>
</div>
</div>
<!-- Add one day (Addition) -->
<div class="form-group row">
<label class="col-md-4 col-form-label">Add one day to date of coverage when Addition/Dependent addition</label>
<div class="col-md-6 d-flex align-items-center">
<label class="switch">
<input id="addition_add_day" type="checkbox" name="addition_add_day"
<?= (isset($insurer['addition_add_day']) && $insurer['addition_add_day'] == 1) ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
</div>
</div>
<!-- Add one day (Deletion) -->
<div class="form-group row">
<label class="col-md-4 col-form-label">Add one day to date of Deletion</label>
<div class="col-md-6 d-flex align-items-center">
<label class="switch">
<input id="deletion_add_day" type="checkbox" name="deletion_add_day"
<?= (isset($insurer['deletion_add_day']) && $insurer['deletion_add_day'] == 1) ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
</div>
</div>
<!-- Multievent Export -->
<div class="form-group row">
<label class="col-md-4 col-form-label">Multievent Export</label>
<div class="col-md-6 d-flex align-items-center">
<label class="switch mb-0">
<input id="is_multi_event" type="checkbox" name="is_multi_event"
<?= (isset($insurer['is_multi_event']) && $insurer['is_multi_event'] == 1) ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
</div>
</div>
<!-- Logo -->
<div class="form-group row">
<label for="insurer_logo" class="col-md-4 col-form-label">Insurer Logo</label>
<div class="col-md-5">
<div class="input-icon">
<input type="file" class="form-control" id="insurer_logo" name="insurer_logo"
accept="image/jpeg, image/jpg, image/png" onchange="PreviewImage();">
<i class="mdi mdi-upload additional-icon"></i>
</div> </div>
</div>
<div class="col-md-3">
<img src="<?= isset($insurer['insurer_logo']) && !empty($insurer['insurer_logo']) ? base_url() . "public/uploads/logo/" . $insurer['insurer_logo'] : base_url() . "public/assets/images/avatar_2x.png" ?>"
width="100" height="100" id="uploadPreview"
class="avatar img-circle img-thumbnail" alt="avatar" />
</div>
</div>
<div class="form-row"> <!-- Buttons -->
<div class="form-group row">
<div class="form-group col-md-2"> <div class="col-md-12 text-right">
<label for="short_name">Insurer Short Name<span class="text-danger">*</span></label> <button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
<input type="text" class="form-control" id="short_name" placeholder="Enter Short Name" value="<?= isset($insurer['short_name']) ? $insurer['short_name'] : '' ?>" name="short_name" required minlength="3" maxlength="8"> <button type="button" class="btn btn-secondary waves-effect btnBack" id="btnBack">Cancel</button>
</div> </div>
</div>
<div class="form-group col-md-4"> </form>
<label class="switch" style="position: absolute;top: 32px;left: 17px;"> </div>
<input id="addition_add_day" type="checkbox" name="addition_add_day" <?= (isset($insurer['addition_add_day']) && $insurer['addition_add_day'] == 1) ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="addition_add_day" style="position: relative;top: 30px;left: 82px;">Add one day to date of coverage when <br> Addition/Dependent addition</label>
</div>
<div class="form-group col-md-2">
<label class="switch" style="position: absolute;top: 32px;left: 17px;">
<input id="deletion_add_day" type="checkbox" name="deletion_add_day" <?= (isset($insurer['deletion_add_day']) && $insurer['deletion_add_day'] == 1) ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="deletion_add_day" style="position: relative;top: 30px;left: 82px;">Add one day to date of Deletion </label>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-2">
<label for="html">Insurer Type</label><br>
<div style="margin-top: 10px;">
<input type="radio" id="html" name="type" value="pvt" <?= isset($insurer['type']) && $insurer['type'] == 'pvt' ? 'checked' : '' ?>>
<label for="html">PVT</label>&nbsp;
<input type="radio" id="css" name="type" value="psu" <?= isset($insurer['type']) && $insurer['type'] == 'psu' ? 'checked' : '' ?>>
<label for="css">PSU</label>
</div>
</div>
<div class="form-group col-md-2">
<label class="switch" style="position: absolute;top: 34px;left: 17px;">
<input id="is_multi_event" type="checkbox" name="is_multi_event" <?= (isset($insurer['is_multi_event']) && $insurer['is_multi_event'] == 1) ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="deletion_add_day" style="position: relative;top: 30px;left: 82px;">Multievent Export</label>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4" style="position: relative;right: 0px;">
<label for="html">Insurer Category</label><br>
<div style="margin-top: 10px;">
<input type="radio" id="html" name="category" value="life" <?= isset($insurer['category']) && $insurer['category'] == 'life' ? 'checked' : '' ?>>
<label for="html">Life</label>&nbsp;
<input type="radio" id="css" name="category" value="general" <?= isset($insurer['category']) && $insurer['category'] == 'general' ? 'checked' : '' ?>>
<label for="css" style="position: absolute;left: 70px;">General(Non Life)</label>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="short_name">Insurer Logo<span class="text-danger"></span></label>
<input type="file" class="form-control" onchange="PreviewImage();" id="insurer_logo" name="insurer_logo" accept="image/jpeg, image/jpg, image/png">
</div>
<div class="form-group col-md-4 float-right" style="position: relative;left: 90px;top: 30px;">
<img src="<?= isset($insurer['insurer_logo']) && !empty($insurer['insurer_logo']) ? base_url() . "public/uploads/logo/" . $insurer['insurer_logo'] : base_url() . "public/assets/images/avatar_2x.png" ?>" width="100" height="100" id="uploadPreview" class="avatar img-circle img-thumbnail" alt="avatar" />
</div>
</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="btnSubmit">Submit</button>
<button type="button" class="btn btn-secondary waves-effect btnBack" id="btnBack">Cancel</button>
</div>
</form>
</div> </div>
</div> <!-- end col--> </div> <!-- end col-->
</div> </div>
<!---- ends ------>
</div> </div>
<!-- end --> <!-- end -->

View File

@ -1,13 +1,46 @@
<div class="tab-pane fade" id="branch-tab"> <style>
.modal-subtitle {
font-weight: 500;
font-style: normal;
font-size: 18px;
line-height: 100%;
letter-spacing: 0%;
text-align: center;
margin-top: 5px;
color: #6c757d;
}
</style>
<!-- Optional CSS -->
<style>
/* Make modal really XL and scrollable */
#insurerBranchModal .modal-dialog.modal-xl {
max-width: 90%;
height: 90vh;
}
#insurerBranchModal .modal-content {
height: 100%;
overflow: hidden;
}
#insurerBranchModal .modal-body {
overflow-y: auto;
max-height: 80vh;
}
</style>
<div class="tab-pane fade" id="branch-tab" style="padding-left: 25px;">
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;"> <div class="row float-right" style="padding-bottom: 10px;position: relative;">
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button> <a href="#" id="btnBranchAdd" class="btn app-btn-primary mr-2"><span class="mdi mdi-plus" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</a>
</div> </div>
<div class="table-responsive" id="branch_table" > <div class="table-responsive" id="branch_table" >
<table class="table table-borderless table-nowrap mb-0"> <table data-custom-table-css="table" class="table table-borderless table-nowrap mb-0" id="branch-datatable">
<thead class="thead-light"> <thead class="">
<tr> <tr>
<th>Branch Name</th> <th>Branch Name</th>
<th>Branch Code</th> <th>Branch Code</th>
@ -19,11 +52,11 @@
</table> </table>
</div> </div>
<div class="row" id="add_branch"> <!-- <div class="row" id="add_branch">
<div class="col-12"> <div class="col-12">
<div class="card-body"> <div class="card-body">
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;"> <div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
<button type="button" id="btnBranchBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button> <button type="button" id="btnBranchBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="mdi mdi-format-list-bulleted" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
</div> </div>
<hr> <hr>
@ -132,10 +165,158 @@
</form> </form>
</div> </div>
</div> </div>
</div> <!-- end col--> </div> !-- end col-- -->
</div> </div>
<!-- end --> <!-- end -->
<!-- Modal -->
<div class="modal fade" id="insurerBranchModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl" style="max-width: 1140px !important;">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header flex-column">
<div class="d-flex w-100 justify-content-between align-items-center">
<h4 class="modal-title mb-0" id="modalLabel">New Branch</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
</div>
<!-- Modal Body -->
<div class="modal-body" style="overflow-y:auto; max-height:80vh;">
<form id="insurer_branch_form" role="form" class="parsley-examples" method="post" action="" enctype="multipart/form-data">
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<input type="hidden" name="PrimaryKey" id="insurer_Branch_PrimaryKey" />
<input type="hidden" name="insurer_id" id="insurer_id_branch" value="<?= isset($insurer['id']) ? $insurer['id'] : '' ?>"/>
<div class="row">
<!-- Left Section: Branch Details -->
<div class="col-md-8 d-flex flex-column" style="max-height: calc(80vh - 50px);">
<!-- Branch Name & Code -->
<div class="form-row">
<div class="form-group col-md-6">
<label for="branch_name">Branch Name <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_name"
placeholder="Enter Branch Name" name="branch_name" required>
</div>
<div class="form-group col-md-6">
<label for="branch_code">Branch Code <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_code"
placeholder="Enter Branch Code" name="branch_code" required>
</div>
</div>
<!-- Address Lines -->
<div class="form-row">
<div class="form-group col-md-6">
<label for="address1">Address Line 1 <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="address1" name="address1" placeholder="Enter Address 1" required>
</div>
<div class="form-group col-md-6">
<label for="address2">Address Line 2</label>
<input type="text" class="form-control" id="address2" placeholder="Enter Address 2" name="address2">
</div>
</div>
<!-- State & District -->
<div class="form-row">
<div class="form-group col-md-6">
<label for="state">State <span class="text-danger">*</span></label>
<select class="form-control" id="state" name="state" required>
<option value="">Select State</option>
<?php foreach($state as $value) { ?>
<option value="<?= $value['id'] ?>"><?= $value['state'] ?></option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-6">
<label for="district">District <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="district"
placeholder="Enter District" name="district" required>
</div>
</div>
<!-- City & Pincode -->
<div class="form-row">
<div class="form-group col-md-6">
<label for="branch_city">City <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_city"
placeholder="Enter City" name="city" required>
</div>
<div class="form-group col-md-6">
<label for="pincode">Pincode <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="pincode" placeholder="Enter Pincode" name="pincode" required>
</div>
</div>
<!-- Submit / Cancel -->
<div class="form-row">
<!-- <div class="form-group col-md-12 mt-2"> -->
<div style="margin-top: 85px;">
<button type="submit" class="btn btn-primary mr-2" id="btnSubmit">Submit</button>
<button type="button" class="btn app-btn-outline-secondary btnBack" id="btnBack" data-dismiss="modal" aria-hidden="true">Cancel</button>
</div>
<!-- </div> -->
</div>
</div>
<!-- Right Section: Contact Details -->
<div class="col-md-4" style="background:#f8f9fa; max-height: calc(80vh - 50px); overflow-y:auto; border-radius:8px; padding:10px;">
<!-- First Contact -->
<div id="contact_1_wrapper" class="bg-white p-2 mb-2 rounded contact-block">
<div class="d-flex justify-content-between align-items-center mb-2">
<h6 class="modal-subtitle mb-0">Contact 1</h6>
<div class="d-flex align-items-center">
<i class="mdi mdi-trash-can text-danger" style="cursor:pointer; font-size:24px !important;" onclick="removeContact(this)" id="${uniqueId}_remove"></i>
</div>
</div>
<!-- Contact Form Fields -->
<div class="form-row">
<!-- <input type="hidden" name="primarykey[]" id="contact_id_1" value=""/> -->
<div class="form-group col-md-12">
<label for="name">Name <span class="text-danger">*</span></label>
<input value="" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="name" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="designation">Designation <span class="text-danger">*</span></label>
<input value="" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="designation" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="email">Email <span class="text-danger">*</span></label>
<input value="" type="email" data-parsley-type="email" data-parsley-trigger="change"class="form-control" placeholder="Enter Contact Email" name="email[]" id="email" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="mobile">Mobile <span class="text-danger">*</span></label>
<!-- <input name="mobile[]" pattern="[0-9]{10}" value="" type="tel" data-parsley-type="number" data-parsley-length="[10,10]" class="form-control" placeholder="Enter Contact Mobile" id="mobile" required> -->
<!-- oninput="this.value = this.value.replace(/[^0-9]/g,'');" maxlength="10" -->
<input value="" name="mobile[]" value="" data-parsley-type="digits" data-parsley-length="[10,10]" data-parsley-trigger="change" type="text" class="form-control" placeholder="Enter Contact Mobile" id="mobile" required maxlength="10" inputmode="numeric">
</div>
</div>
</div>
<!-- Container for dynamically added contacts -->
<div id="container"></div>
<div>
<button type="button" class="btn btn-primary btn-sm ac me-3" style="width: 100%;" onclick="appendContactHtml()" id="add"><i class="mdi mdi-plus"></i> Add Contact</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script> <script>
@ -146,14 +327,17 @@
$(document).ready(function () { $(document).ready(function () {
insurer_Branch_PrimaryKey = $('#insurer_id_branch').val(); insurer_Branch_PrimaryKey = $('#insurer_id_branch').val();
var myModal = new bootstrap.Modal(document.getElementById('insurerBranchModal'));
myModal.hide();
$('#add_branch').hide(); // $('#add_branch').hide();
$('.btnBack').hide(); // $('.btnBack').hide();
if(insurer_Branch_PrimaryKey !== ''){ if(insurer_Branch_PrimaryKey !== ''){
var branchTable = ''; var branchTable = '';
var data = <?= isset($insuer_branch) ? json_encode($insuer_branch) : '[]' ?>; var data = <?= isset($insuer_branch) ? json_encode($insuer_branch) : '[]' ?>;
console.log("insurer branch data", data);
$.each(data, function(index, item) { $.each(data, function(index, item) {
branchTable += ` branchTable += `
<tr> <tr>
@ -169,6 +353,10 @@
$('#insurer_branch_list').append(branchTable); $('#insurer_branch_list').append(branchTable);
} }
$('#branch-datatable').DataTable({
paging: true ,
searching: true
});
}); });
@ -177,10 +365,12 @@
$("#insurer_branch_form")[0].reset(); $("#insurer_branch_form")[0].reset();
contactCount = 1 contactCount = 1
insurer_branch_form_action = '<?= base_url("master/insurer/branch/create"); ?>'; insurer_branch_form_action = '<?= base_url("master/insurer/branch/create"); ?>';
$('#add_branch').show(); var myModal = new bootstrap.Modal(document.getElementById('insurerBranchModal'));
$('#branch_table').hide(); myModal.show();
$('.btnBack').show(); // $('#add_branch').show();
$('#btnBranchAdd').hide(); // $('#branch_table').hide();
// $('.btnBack').show();
// $('#btnBranchAdd').hide();
$('#branch_name').val(''); $('#branch_name').val('');
$('#branch_code').val(''); $('#branch_code').val('');
@ -219,11 +409,13 @@
$('.btnBack').click(function(){ $('.btnBack').click(function(){
$("#insurer_branch_form")[0].reset(); $("#insurer_branch_form")[0].reset();
contactCount = 1 contactCount = 1
$('#add_branch').hide(); $('.close').click();
$('#branch_table').show(); // $('#add_branch').hide();
$('.btnBack').hide(); // $('#branch_table').show();
$('#btnBranchAdd').show(); // $('.btnBack').hide();
// $('#btnBranchAdd').show();
$('#branch_name').val(''); $('#branch_name').val('');
$('#branch_code').val(''); $('#branch_code').val('');
@ -235,6 +427,7 @@
$('#email').val(''); $('#email').val('');
$('#mobile').val(''); $('#mobile').val('');
$('#designation').val(''); $('#designation').val('');
$('#container').empty(); $('#contact_1_wrapper input').val('');
}) })
@ -256,12 +449,12 @@
dataType: 'json', dataType: 'json',
processData: false, processData: false,
contentType: false, contentType: false,
beforeSend: function() {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
},
success: function(res) { success: function(res) {
$("#insurer_branch_form")[0].reset(); $("#insurer_branch_form")[0].reset();
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
console.log(res); console.log(res);
$('#insurer_branch_list tr').remove(); $('#insurer_branch_list tr').remove();
var insurerBranchTableInsert = '' var insurerBranchTableInsert = ''
@ -279,10 +472,13 @@
}); });
$('#insurer_branch_list').append(insurerBranchTableInsert); $('#insurer_branch_list').append(insurerBranchTableInsert);
$('#add_branch').hide(); $('#container').empty(); $('#contact_1_wrapper input').val('');
$('#branch_table').show(); $('.close').click();
$('.btnBack').hide(); // window.location.reload();
$('#btnBranchAdd').show(); // $('#add_branch').hide();
// $('#branch_table').show();
// $('.btnBack').hide();
// $('#btnBranchAdd').show();
}, },
error: function (xhr, status, error) { error: function (xhr, status, error) {
@ -290,10 +486,17 @@
console.error(status, error); console.error(status, error);
setTimeout(function() { setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning'); toastr.warning('Something Wrong!', 'warning');
}, 1000); }, 1000);
},
complete: function() {
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
$('.close').click();
} }
}); });
@ -324,10 +527,13 @@
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}, 1000); }, 1000);
$('#add_branch').show(); var myModal = new bootstrap.Modal(document.getElementById('insurerBranchModal'));
$('#branch_table').hide(); myModal.show();
$('.btnBack').show(); // $('#add_branch').show();
$('#btnBranchAdd').hide(); // $('#branch_table').show();
// $('.btnBack').show();
// $('#btnBranchAdd').hide();
console.log("res.levelcontact[0].id"+res.levelcontact[0].id);
$('#branch_name').val(res.insurerbranch.branch_name); $('#branch_name').val(res.insurerbranch.branch_name);
$('#branch_code').val(res.insurerbranch.branch_code); $('#branch_code').val(res.insurerbranch.branch_code);
$('#state option[value="' + res.insurerbranch.state + '"]').prop('selected', true); $('#state option[value="' + res.insurerbranch.state + '"]').prop('selected', true);
@ -368,95 +574,198 @@
// function appendContactHtml(contact = false, reset = false) {
// console.log('appendContactHtml function called ')
// contactCount++;
// var container = document.getElementById('container');
// var uniqueId = Date.now().toString();
// var html = `
// <div id="${uniqueId}" class="bg-white p-2 mb-2 rounded">
// <div class="d-flex justify-content-between align-items-center mb-2">
// <h6 class="modal-subtitle mb-0">Contact ${contactCount}</h6>
// <div class="d-flex align-items-center">
// <i class="mdi mdi-trash-can text-danger" style="cursor:pointer; font-size:24px !important;" onclick="removeContact(this)" id="${uniqueId}_remove"></i>
// </div>
// </div>
// <br>
// <div class="form-row">
// <input type="hidden" name="primarykey[]" id="contact_id_1" value="${contact !== undefined && contact !== false ? contact.id : ''}"/>
// <div class="form-group col-md-12">
// <label for="${uniqueId}_first_name">Name<span class="text-danger">*</span></label>
// <input value="${contact !== undefined && contact !== false ? contact.name : ''}" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="${uniqueId}_name" required>
// </div>
// </div>
// <div class="form-row">
// <div class="form-group col-md-12">
// <label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
// <input data-parsley-type="email" value="${contact !== undefined && contact !== false ? contact.email : ''}" type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" required>
// </div>
// </div>
// <div class="form-row">
// <div class="form-group col-md-12">
// <label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
// <input data-parsley-type="number" data-parsley-length="[10,10]" pattern="[0-9]{10}" value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="tel" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" required>
// </div>
// </div>
// <div class="form-row">
// <div class="form-group col-md-12">
// <label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
// <input value="${contact !== undefined && contact !== false ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="${uniqueId}_designation" required>
// </div>
// </div>
// </div>
// `;
// if(reset == false){
// container.insertAdjacentHTML('beforeend', html);
// storeButtonId(uniqueId + '_add');
// if (contactCount >= 3) {
// hideStoredAddButtons();
// }
// }
// }
// function removeContact(button) {
// var uniqueId = button.id.split("_")[0];
// var contactSection = document.getElementById(uniqueId);
// if (contactSection) {
// contactSection.parentNode.removeChild(contactSection);
// contactCount --;
// if (contactCount < 3) {
// var addButton = document.querySelector('.ac');
// if (addButton) {
// addButton.style.display = 'block';
// }
// }
// }
// }
// function storeButtonId(id) {
// var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
// buttonIds.push(id);
// localStorage.setItem('buttonIds', JSON.stringify(buttonIds));
// }
// function hideStoredAddButtons() {
// var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
// storedIds.forEach(function(id) {
// var addButton = document.getElementById(id);
// var first_addButton = document.querySelector('.ac')
// if (addButton) {
// addButton.style.display = 'none';
// first_addButton.style.display = 'none';
// }
// });
// }
function renumberContacts() {
var contacts = document.querySelectorAll('.contact-block');
contacts.forEach(function(contact, index) {
let title = contact.querySelector('.modal-subtitle');
if (title) {
title.textContent = "Contact " + (index + 1); // auto numbering
}
});
contactCount = contacts.length; // keep global in sync
}
function appendContactHtml(contact = false, reset = false) { function appendContactHtml(contact = false, reset = false) {
console.log('appendContactHtml function called ');
console.log('appendContactHtml function called ') var container = document.getElementById('container');
contactCount++; var uniqueId = Date.now().toString();
var container = document.getElementById('container'); // <input type="hidden" name="primarykey[]" id="contact_id_1" value="${contact !== undefined && contact !== false ? contact.id : ''}"/>
var uniqueId = Date.now().toString(); var html = `
<div id="${uniqueId}" class="bg-white p-2 mb-2 rounded contact-block">
var html = ` <div class="d-flex justify-content-between align-items-center mb-2">
<div id="${uniqueId}"> <h6 class="modal-subtitle mb-0"></h6>
<hr> <div class="d-flex align-items-center">
<h6 class="header-title">Contact ${contactCount}</h6> <i class="mdi mdi-trash-can text-danger" style="cursor:pointer; font-size:24px !important;" onclick="removeContact(this)" id="${uniqueId}_remove"></i>
<br> </div>
<div class="form-row"> </div>
<input type="hidden" name="primarykey[]" id="contact_id_1" value="${contact !== undefined && contact !== false ? contact.id : ''}"/> <div class="form-row">
<div class="form-group col-md-6"> <div class="form-group col-md-12">
<label for="${uniqueId}_first_name">Name<span class="text-danger">*</span></label> <label>Name<span class="text-danger">*</span></label>
<input value="${contact !== undefined && contact !== false ? contact.name : ''}" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="${uniqueId}_name" required> <input value="${contact ? contact.name : ''}" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" required>
</div>
<div class="form-group col-md-6">
<label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
<input data-parsley-type="email" value="${contact !== undefined && contact !== false ? contact.email : ''}" type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
<input data-parsley-type="number" data-parsley-length="[10,10]" pattern="[0-9]{10}" value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="tel" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" required>
</div>
<div class="form-group col-md-6">
<label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
<input value="${contact !== undefined && contact !== false ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="${uniqueId}_designation" required>
</div>
</div>
<div class="form-group" style="display: flex;">
<button style="margin-right: 10px;" type="button" class="btn btn-primary btn-sm ac" onclick="appendContactHtml()" id="${uniqueId}_add">Add Contact</button>
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)" id="${uniqueId}_remove">Remove</button>
</div> </div>
</div> </div>
`; <div class="form-row">
<div class="form-group col-md-12">
if(reset == false){ <label>Designation<span class="text-danger">*</span></label>
container.insertAdjacentHTML('beforeend', html); <input value="${contact ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" required>
storeButtonId(uniqueId + '_add'); </div>
</div>
if (contactCount >= 3) { <div class="form-row">
hideStoredAddButtons(); <div class="form-group col-md-12">
} <label>Email<span class="text-danger">*</span></label>
} <input value="${contact ? contact.email : ''}" type="email" data-parsley-type="email" data-parsley-trigger="change"class="form-control" placeholder="Enter Contact Email" name="email[]" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label>Mobile<span class="text-danger">*</span></label>
<input value="${contact ? contact.mobile : ''}" name="mobile[]" value="" data-parsley-type="digits" data-parsley-length="[10,10]" data-parsley-trigger="change" type="text" class="form-control" placeholder="Enter Contact Mobile" id="mobile" required maxlength="10" inputmode="numeric">
</div>
</div>
</div>
`;
if(!reset){
container.insertAdjacentHTML('beforeend', html);
renumberContacts(); // ✅ fix numbering
toggleAddButton();
} }
}
function removeContact(button) {
var uniqueId = button.id.split("_")[0];
var contactSection = document.getElementById(uniqueId);
if (contactSection) { function removeContact(btn){
contactSection.parentNode.removeChild(contactSection); var $block = $(btn).closest('.contact-block');
contactCount --; var isFirst = $block.attr('id') === 'contact_1_wrapper';
if (contactCount < 3) { if (isFirst) {
var addButton = document.querySelector('.ac'); var $next = $('#container .contact-block').first();
if (addButton) { if ($next.length){
addButton.style.display = 'block'; $block.replaceWith($next);
} $next.attr('id','contact_1_wrapper');
} $next.find('.modal-subtitle').text('Contact 1');
} } else {
$block.find('input').val('');
return;
} }
} else {
$block.remove();
}
function storeButtonId(id) { renumberContacts();
toggleAddButton();
}
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
buttonIds.push(id); function toggleAddButton() {
localStorage.setItem('buttonIds', JSON.stringify(buttonIds)); var totalContacts = document.querySelectorAll('.contact-block, #contact_1_wrapper').length;
var addButton = document.querySelector('.ac');
if (totalContacts >= 3) {
addButton.style.display = 'none';
} else {
addButton.style.display = 'block';
} }
}
function hideStoredAddButtons() {
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
storedIds.forEach(function(id) {
var addButton = document.getElementById(id);
var first_addButton = document.querySelector('.ac')
if (addButton) {
addButton.style.display = 'none';
first_addButton.style.display = 'none';
}
});
}
function showNextAddButton() { function showNextAddButton() {
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || []; var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
var addButtonShown = false; var addButtonShown = false;

View File

@ -45,37 +45,40 @@
} }
</style> </style>
<div class="tab-pane fade" id="template-tab"> <div class="tab-pane fade" id="template-tab" style="padding-left: 25px;">
<input type="hidden" id="insurer_templete_count" value="<?= isset($insurer_templete_count) ? $insurer_templete_count : ''?>"> <input type="hidden" id="insurer_templete_count" value="<?= isset($insurer_templete_count) ? $insurer_templete_count : ''?>">
<input type="hidden" id="insurer_id" value="<?= isset($insurer['id']) ? $insurer['id'] : '' ?>"> <input type="hidden" id="insurer_id" value="<?= isset($insurer['id']) ? $insurer['id'] : '' ?>">
<div class="row"> <div class="row">
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<div class="custom-form">
<label for="email">Existing Insurer Export<span class="text-danger">*</span></label> <label for="email">Existing Insurer Export<span class="text-danger">*</span></label>
<select class="form-control" id="insurer" name="insurer" required> <select class="form-control" id="insurer" name="insurer" required>
<option value="">Select Insurer</option> <option value="">Select Insurer</option>
</select> </select>
</div>
</div> </div>
<div class="form-group col-md-6" style="position: relative;top: 28px;"> <div class="form-group col-md-6" style="position: relative;top: 28px;">
<label for="email"><span class="text-danger"></span></label> <label for="email"><span class="text-danger"></span></label>
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="checkInsurerTemplete(this)">Copy</a> <a href="#" class="btn app-btn-secondary mr-2" onclick="checkInsurerTemplete(this)">Copy</a>
</div> </div>
<div class="form-group col-md-2" style="position: relative;top: 28px;left: 80px;"> <div class="form-group col-md-2" style="position: relative;top: 28px;">
<label for="email"><span class="text-danger"></span></label> <div class="float-right">
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="addNewJsonExportTemplate(this)">Add New</a> <label for="email"><span class="text-danger"></span></label>
<a href="#" class="btn app-btn-primary " onclick="addNewJsonExportTemplate(this)"><i class="mdi mdi-plus"></i> Add </a>
</div>
</div> </div>
</div> </div>
<hr>
<div class="table-responsive" id="branch_table" > <div class="table-responsive" id="branch_table" >
<table class="table table-borderless table-nowrap mb-0"> <table data-custom-table-css="table" class="table table-borderless table-nowrap mb-0" id="insurer_datatable">
<thead class="thead-light"> <thead class="">
<tr> <tr>
<th>S.NO</th> <th>S.NO</th>
<th>Policy Type</th> <th>Policy Type</th>
@ -164,7 +167,7 @@
</div> </div>
<hr> <hr class="mb-0">
<!-- <div class="form-row dynamic-form-row"> <!-- <div class="form-row dynamic-form-row">
<div class="form-group col-md-5"> <div class="form-group col-md-5">
@ -191,7 +194,7 @@
</div> </div>
<div class="form-group text-right m-b-0" id="hide_smbt_btn"> <div class="form-group text-right m-b-0" id="hide_smbt_btn">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1">Submit</button> <button type="submit" class="btn btn-primary waves-effect waves-light mr-1">Submit</button>
</div> </div>
</form> </form>
</div> </div>
@ -255,7 +258,15 @@
$(document).ready(function(){ $(document).ready(function(){
$('#insurer').select2(); $('#insurer').select2();
// $('#event').select2(); // $('#event').select2();
featchInsurerList() featchInsurerList();
setTimeout(() => {
$('#insurer_datatable').DataTable({
paging: true ,
searching: true
});
}, 2000);
}) })
$('#templateForm').submit(function(event) { $('#templateForm').submit(function(event) {
@ -471,7 +482,12 @@
const newRow = document.createElement('div'); const newRow = document.createElement('div');
newRow.className = 'form-row dynamic-form-row'; newRow.className = 'form-row dynamic-form-row';
newRow.innerHTML = ` newRow.innerHTML = `
<div class="mt-3 p-3" style="width: 100%; background: #F7F7F7;
border-radius: 30px !important;
display: flex;
gap: 10px;
opacity: 1;
">
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="db_column_name">DataBase Column Name<span class="text-danger"></span></label> <label for="db_column_name">DataBase Column Name<span class="text-danger"></span></label>
<select class="form-control db-column-name-select dbColumn" name="db_column_name[]" onchange="checkForDuplicates(this); handleDbColumnChange(this)" ${data !== null && data !== undefined && data !== '' && data.default_value != "" && data.default_value != null ? 'disabled' : ''}> <select class="form-control db-column-name-select dbColumn" name="db_column_name[]" onchange="checkForDuplicates(this); handleDbColumnChange(this)" ${data !== null && data !== undefined && data !== '' && data.default_value != "" && data.default_value != null ? 'disabled' : ''}>
@ -494,10 +510,11 @@
<input id="default_value" value="${data != null && data != undefined && data != '' && data.default_value != "" && data.default_value != null ? data.default_value : ''}" class="form-control" type="text" name="default_value[]" placeholder="Excel Default value"> <input id="default_value" value="${data != null && data != undefined && data != '' && data.default_value != "" && data.default_value != null ? data.default_value : ''}" class="form-control" type="text" name="default_value[]" placeholder="Excel Default value">
</div> </div>
<div class="form-group col-md-2" style="position: relative;top: 28px;"> <div class="form-group col-md-2" style="position: relative;left: 28px;">
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="addHTMLInput(this)">+</a> <a class="btn app-btn-secondary waves-effect waves-light mr-1" onclick="addHTMLInput(this)"><i class="mdi mdi-plus text-white" style="cursor:pointer; font-size:15px !important;"></i></a>
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)">x</a> <a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)"><i class="mdi mdi-trash-can text-white" style="cursor:pointer; font-size:15px !important;"></i></a>
</div> </div>
</div>
`; `;
container.appendChild(newRow); container.appendChild(newRow);
if (data != null && data.db_column_name != undefined) { if (data != null && data.db_column_name != undefined) {

View File

@ -26,20 +26,30 @@
color: #16181b !important; color: #16181b !important;
cursor: pointer !important; cursor: pointer !important;
} }
.btn-color{
background-color: rgba(52, 174, 178, 1);
color: white;
border:1px solid rgba(52, 174, 178, 1);
}
.btn-color:hover{
background-color: rgba(41, 139, 142, 1);
color: white;
border:1px solid rgba(41, 139, 142, 1);
}
</style> </style>
<div class="row" id="insurer_list"> <div class="row" id="insurer_list">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body maincard">
<div class="row" style="margin-bottom:1rem;"> <div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;"> <div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Insurer List</h4> <h4 style="position: relative;">Insurers</h4>
</div>
<div class="col-6" style="text-align: right; position: relative;top: 56px;">
<a href="<?= base_url("master/insurer/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
</div> </div>
</div> </div>
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" <table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
id="tickets-table"> id="tickets-table">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
@ -182,6 +192,13 @@ document.addEventListener("DOMContentLoaded", function () {
exportOptions: { exportOptions: {
columns: ':not(:last-child)' columns: ':not(:last-child)'
} }
},
{
text: 'ADD',
className: 'btn btn-color',
action: function () {
window.location.href = "<?= base_url("master/insurer/create"); ?>";
}
} }
], ],

Some files were not shown because too many files have changed in this diff Show More