MERGE_UAT_MEDI_ASSIT
This commit is contained in:
commit
2c2dde63d4
@ -213,6 +213,7 @@ $routes->group("/master", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("edit", "MasterController::editInsurerBranch");
|
||||
$routes->get("editget/(:any)", "MasterController::editInsurerGet/$1");
|
||||
$routes->get("list/(:any)", "MasterController::insurerBranchList/$1");
|
||||
$routes->post("getList", "MasterController::getInsurerBranchList");
|
||||
$routes->get("remove/(:any)", "MasterController::removeInsurerBranch/$1");
|
||||
});
|
||||
});
|
||||
@ -351,7 +352,8 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("get_client_policy_data_using_policy_no_and_endo_no", "ClientController::get_client_policy_data_using_policy_no_and_endo_no");
|
||||
$routes->get("checkInvoiceStatus/(:any)", "PolicyTransactionController::checkInvoiceStatus/$1");
|
||||
$routes->get("base_policy_for_policy_inception/(:any)", "PolicyTransactionController::getBasePolicy/$1");
|
||||
$routes->get("sentTestMail/(:any)", "NotificationController::sentTestMail/$1");
|
||||
$routes->get("sentTestMail/(:any)","NotificationController::sentTestMail/$1");
|
||||
$routes->post("sendCommonTestMail","NotificationController::sendCommonTestMail");
|
||||
$routes->get("send_manual_reminder/(:any)", "DashboardController::sendManualReminder/$1");
|
||||
$routes->get("send_manual_ecard/(:any)", "DashboardController::sendManualEcard/$1");
|
||||
$routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1");
|
||||
@ -401,6 +403,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->match(['get', 'post', 'delete'], 'rtoMaster', 'MasterController::rtoMaster');
|
||||
$routes->get('checkDuplicateCdAccount', 'MasterController::checkDuplicateCdAccount');
|
||||
$routes->get('proceedExcelFileDataValidation', 'EmployeeController::proceedExcelFileDataValidation');
|
||||
$routes->get('checkTpaApiEnable', 'EmployeeRestController::checkTpaApiEnable');
|
||||
});
|
||||
|
||||
$routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
|
||||
@ -500,12 +503,16 @@ $routes->cli('cli/sendMailWithAutoQuery','TicketController::sendMailWithAutoQuer
|
||||
//Employee login api's
|
||||
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
|
||||
$routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||
$routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyMpin");
|
||||
$routes->post("/employeeRest/checkMpin", "RestAuthenticationController::checkMpin");
|
||||
$routes->post("/employeeRest/verifyEmployeeEmailId", "RestAuthenticationController::verifyEmployeeWithEmailId");
|
||||
$routes->post("/employeeRest/updateEmpOTP", "RestAuthenticationController::updateEmpOTP");
|
||||
|
||||
$routes->post("employeeRest/saveMpin", "RestAuthenticationController::saveMpin");
|
||||
$routes->post("employeeRest/updateMpin", "RestAuthenticationController::updateMpin");
|
||||
$routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyMpin");
|
||||
$routes->post("/employeeRest/checkMpin", "RestAuthenticationController::checkMpin");
|
||||
$routes->post("/employeeRest/updateEmpMPIN", "RestAuthenticationController::updateEmpMPIN");
|
||||
$routes->post("employeeRest/forgotMPIN", "RestAuthenticationController::forgotMPIN");
|
||||
$routes->post("employeeRest/updateMobileNumber", "RestAuthenticationController::updateMobileNumber");
|
||||
// $routes->post("/employeeRest/saveMpin", "RestAuthenticationController::saveMpin");
|
||||
|
||||
|
||||
@ -529,15 +536,17 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
|
||||
});
|
||||
|
||||
$routes->post("employeeRest/saveMpin", "RestAuthenticationController::saveMpin");
|
||||
$routes->post("employeeRest/updateMpin", "RestAuthenticationController::updateMpin");
|
||||
$routes->post("employeeRest/getPostEmployeeDataForAuth", "RestAuthenticationController::getPostEmployeeDataForAuth");
|
||||
// $routes->post("logHrActivity", "RestAuthenticationController::logHrActivity");
|
||||
|
||||
$routes->get("employeeRest/getClientDetails", "EmployeeRestController::getClientDetails");
|
||||
|
||||
|
||||
|
||||
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
|
||||
$routes->post("ecardRequest", "ApiServiceController::ecardRequest");
|
||||
|
||||
$routes->post("logHrActivity", "RestAuthenticationController::logHrActivity");
|
||||
$routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||
|
||||
@ -574,6 +583,7 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->get("getFEContent", "EmployeeRestController::getFEContent");
|
||||
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
||||
$routes->get("getWellnessURL", "EmployeeRestController::getWellnessURL");
|
||||
$routes->get("getEcardURL", "EmployeeRestController::getEcardURL");
|
||||
//$routes->post('postDataForTicket',"EmployeeRestController::postDataForTicket");
|
||||
|
||||
|
||||
@ -682,9 +692,6 @@ $routes->get('createEnrollmentBatch','ICICILombardController::createEnrollmentBa
|
||||
$routes->get('getEnrollmentBatchStatus','ICICILombardController::getEnrollmentBatchStatus');
|
||||
$routes->get('fetchUHIDDetails','ICICILombardController::fetchUHIDDetails');
|
||||
|
||||
$routes->get('testTracelog','TestBusinessController::a');
|
||||
$routes->get("claimView", "EmployeeRestController::claimView");
|
||||
|
||||
//Third party Vidal Api Call
|
||||
|
||||
$routes->post('hospitalNetwork','VidalApiController::hospitalNetwork');
|
||||
@ -693,6 +700,29 @@ $routes->post('claimStatusCheck','VidalApiController::claimStatusCheck');
|
||||
$routes->post('newClaim','VidalApiController::newClaim');
|
||||
$routes->post('enrollment','VidalApiController::enrollment');
|
||||
|
||||
//Third party MediAssist Api Call
|
||||
|
||||
$routes->get('EcardRequest','MediAssistApiController::EcardRequest');
|
||||
$routes->get('HospitalNetwork','MediAssistApiController::HospitalNetwork');
|
||||
$routes->get('GetBenefDetails','MediAssistApiController::GetBenefDetails');
|
||||
$routes->get('ClaimDetail','MediAssistApiController::ClaimDetail');
|
||||
$routes->get('SubmitClaim','MediAssistApiController::SubmitClaim');
|
||||
$routes->get('IntimateClaim','MediAssistApiController::IntimateClaim');
|
||||
$routes->get('IRSubmission','MediAssistApiController::IRSubmission');
|
||||
|
||||
|
||||
// API service
|
||||
$routes->post("ecardRequest", "ApiServiceController::ecardRequest");
|
||||
$routes->post("getTPAID", "ApiServiceController::getTPAID");
|
||||
$routes->get('fileDownload','MediAssistApiController::fileDownload');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$routes->get('testTracelog','TestBusinessController::a');
|
||||
$routes->get("claimView", "EmployeeRestController::claimView");
|
||||
|
||||
// General Tickets
|
||||
|
||||
$routes->post("ticketSave", "ThzController::ticketSave");
|
||||
@ -719,7 +749,8 @@ $routes->group('test', function($routes) {
|
||||
$routes->get('membervalidation', 'TestingController::membervalidation');
|
||||
$routes->get('generateExcel', 'TestingController::generateExcel');
|
||||
$routes->get('logo_renaming','TestingController::logo_renaming');
|
||||
// $routes->get('createDefaultMailTempalteInDB','TestingController::createDefaultMailTempalteInDB');
|
||||
// $routes->get('createDefaultMailTempalteInDB','TestingController::createDefaultMailTempalteInCrossDB');
|
||||
// $routes->get('createDefaultMailTempalteInSameDB','TestingController::createDefaultMailTempalteInSameDB');
|
||||
});
|
||||
$routes->cli('cli/testcli', 'TestingController::testcli');
|
||||
|
||||
|
||||
299
app/Controllers/ApiServiceController.php
Normal file
299
app/Controllers/ApiServiceController.php
Normal file
@ -0,0 +1,299 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
|
||||
use App\Models\EmployeePolicyModel;
|
||||
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Controllers\VidalApiController;
|
||||
use App\Controllers\ICICILombardController;
|
||||
use App\Controllers\MediAssistApiController;
|
||||
use App\Models\BatchFileModel;
|
||||
use App\Models\FileModel;
|
||||
|
||||
class ApiServiceController extends BaseController
|
||||
{
|
||||
use ResponseTrait;
|
||||
// protected $format = 'json';
|
||||
protected $db;
|
||||
protected $employeePolicyModel;
|
||||
protected $medi_assist_primary_key;
|
||||
protected $vidal_primary_key;
|
||||
protected $icici_primary_key;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->db = \Config\Database::connect();
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
$this->medi_assist_primary_key = getenv('MEDI_ASSIST_PRIMARY_KEY_CONSTANT');
|
||||
$this->vidal_primary_key = getenv('VIDAL_PRIMARY_KEY_CONSTANT');
|
||||
$this->icici_primary_key = getenv('ICICI_PRIMARY_KEY_CONSTANT');
|
||||
}
|
||||
|
||||
// Push Claims
|
||||
public function pushClaims($claimId)
|
||||
{
|
||||
|
||||
$data = $this->db->table('ticket_master tm')
|
||||
->select('tm.id,tm.tpa_id ')->where('tm.id', $claimId)->get()->getRowArray(); // single record
|
||||
|
||||
if($data){
|
||||
|
||||
$tpaID = $data['tpa_id'];
|
||||
|
||||
if ($tpaID == $this->medi_assist_primary_key) { // MediAssist
|
||||
$mediAssistController = new MediAssistApiController();
|
||||
return $mediAssistController->SubmitClaim($claimId);
|
||||
}else{
|
||||
log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// E-Card Request
|
||||
public function ecardRequest($params = [], $return_type = 'api')
|
||||
{
|
||||
try{
|
||||
|
||||
if(empty($params) && $this->response){
|
||||
|
||||
$payload = $this->request->getJSON(true);
|
||||
$id = $payload['id'] ?? null;
|
||||
$emp_code = $payload['emp_code'] ?? null;
|
||||
$client_policy_id = $payload['client_policy_id'] ?? null;
|
||||
$policy_no = $payload['policy_no'] ?? null;
|
||||
$type = $payload['type'] ?? 'download';
|
||||
log_message('error', 'Received Payload API : '. json_encode($payload ?? ""));
|
||||
|
||||
}else{
|
||||
|
||||
$id = $params['id'] ?? null;
|
||||
$emp_code = $params['emp_code'] ?? null;
|
||||
$client_policy_id = $params['client_policy_id'] ?? null;
|
||||
$policy_no = $params['policy_no'] ?? null;
|
||||
$type = $params['type'] ?? 'download';
|
||||
|
||||
log_message('error', 'Received Payload INTERNAL : '. json_encode($params ?? ""));
|
||||
|
||||
}
|
||||
|
||||
$employee_policy = $this->employeePolicyModel
|
||||
->select('employees.*, employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid , client_policy.tpa_id as tpa_primary_id ')
|
||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id', 'left')
|
||||
->where('employee_polices.employee_id',$id)
|
||||
->where('employee_polices.client_policy_id',$client_policy_id)
|
||||
->where('employee_polices.is_active', 1 )->findAll();
|
||||
|
||||
|
||||
if(count($employee_policy) > 0)
|
||||
{
|
||||
if($employee_policy[0]['tpa_id'] != null)
|
||||
{
|
||||
if($employee_policy[0]['tpa_primary_id'] == $this->medi_assist_primary_key)//Medi assist
|
||||
{
|
||||
$mediAssistController = new MediAssistApiController();
|
||||
$data['eCardDownload'] = $mediAssistController->EcardRequest( $emp_code, $policy_no );
|
||||
}else{
|
||||
|
||||
if($type == "download"){
|
||||
// direct download
|
||||
$data['eCardDownload'] = base_url('download-e-card/') . $employee_policy[0]['rand_string'].'/1';
|
||||
}else{
|
||||
// view and download
|
||||
$data['eCardDownload'] = base_url('download-e-card/') . $employee_policy[0]['rand_string'].'/0/1';
|
||||
}
|
||||
}
|
||||
$data['message'] = "E-card generated";
|
||||
if(empty($data['eCardDownload'])){
|
||||
$data['message'] = "E-card not generated";
|
||||
}
|
||||
|
||||
} else {
|
||||
$data['eCardDownload'] = null;
|
||||
$data['message'] = "E-card not generated";
|
||||
log_message('error', 'TPA number is null');
|
||||
}
|
||||
}else{
|
||||
$data['eCardDownload'] = null;
|
||||
$data['message'] = "E-card not generated";
|
||||
log_message('error', 'Employee not found');
|
||||
}
|
||||
|
||||
if($return_type == 'api'){
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => '', 'data' => $data]);
|
||||
}else{
|
||||
return $data;
|
||||
}
|
||||
|
||||
} catch(\Exception $e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Get TPAID
|
||||
public function getTPAID()
|
||||
{
|
||||
|
||||
log_message('error', "getTPAID payloads :" . json_encode($this->request->getPost() ?? []));
|
||||
$tpa_id = $this->request->getPost('tpa_id') ?? null;
|
||||
$policy_no = $this->request->getPost('policy_no') ?? null;
|
||||
$client_id = $this->request->getPost('client_id') ?? null;
|
||||
$branch_id = $this->request->getPost('client_branch_id') ?? null;
|
||||
$policy_id = $this->request->getPost('client_policy_id') ?? null;
|
||||
|
||||
$fileModel = new BatchFileModel();
|
||||
$filesData = $fileModel->where('is_active', 1)->where('event_type', 'api')->where('status', 'inprogress')->countAllResults();
|
||||
|
||||
if($filesData > 0){
|
||||
log_message('error', "TPA GetBenefDetails job is already in process.");
|
||||
return $this->respond(['status' => false, 'code' => 200,'message' => 'TPA initiation is in progress.','data' => [] ]);
|
||||
}
|
||||
|
||||
$employeePolicyModel = new EmployeePolicyModel();
|
||||
$employeePolicyData = $employeePolicyModel
|
||||
->select('
|
||||
employees.*,
|
||||
employee_polices.id as emp_policy_id,
|
||||
employee_polices.client_policy_id,
|
||||
')
|
||||
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employee_polices.status', 'active')
|
||||
->where('employees.is_active', 1)
|
||||
->where('employees.emp_status', 'active')
|
||||
->where('employee_polices.tpa_id IS NULL')
|
||||
->where('employee_polices.client_policy_id', $policy_id)
|
||||
->countAllResults();
|
||||
|
||||
if($employeePolicyData == 0){
|
||||
log_message('error', "No Employee Policy found with null TPA ID. TPA ID is already updated.");
|
||||
return $this->respond(['status' => false, 'code' => 200,'message' => 'TPA ID Already updated','data' => [] ]);
|
||||
}
|
||||
|
||||
if (empty($policy_no)) {
|
||||
log_message('error', 'GetBenefDetails: policy_no missing in request');
|
||||
return $this->respond(['status' => false, 'message' => 'policy_no required']);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'file_name' => "API",
|
||||
'event_type' => "api",
|
||||
'actions' => "fetch",
|
||||
'insurer_or_tpa' => "tpa",
|
||||
'batch_code' => generate_random_string(4),
|
||||
'status' => "inprogress",
|
||||
'client_id' => $client_id,
|
||||
'client_policy_id'=> $policy_id,
|
||||
'client_branch_id'=> $branch_id,
|
||||
'created_by'=> get_session_userid(),
|
||||
];
|
||||
|
||||
if ($tpa_id == $this->medi_assist_primary_key) // MediAssist
|
||||
{
|
||||
$file_id = $fileModel->insert($data);
|
||||
log_message('error', "Files table inserted successfully, File id : {$file_id}");
|
||||
// $mediAssistController = new MediAssistApiController();
|
||||
// $mediAssistController->GetBenefDetails( [ 'polict_no' => $policy_no, 'file_id' =>$file_id ] );
|
||||
$r = Jobs::addJob(['job_name' => 'GetBenefDetails', 'payload' => ['policy_no' => $policy_no, 'file_id' => $file_id, 'client_policy_id' => $policy_id, 'return_type' => 'job']]);
|
||||
log_message('error', "GetBenefDetails job pushed successfully.");
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Action Triggered','data' => [] ]);
|
||||
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'code' => 200,'message' => 'TPA not found ','data' => [] ]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Get Claims
|
||||
public function getClaims($id)
|
||||
{
|
||||
if ($id == 1) {
|
||||
$controller = new VidalApiController();
|
||||
} elseif ($id == 2) {
|
||||
$controller = new ICICILombardController();
|
||||
} elseif ($id == 3) {
|
||||
$controller = new MediAssistApiController();
|
||||
}
|
||||
}
|
||||
|
||||
// Get UHID
|
||||
public function getUhid($id)
|
||||
{
|
||||
if ($id == 1) {
|
||||
$controller = new VidalApiController();
|
||||
} elseif ($id == 2) {
|
||||
$controller = new ICICILombardController();
|
||||
} elseif ($id == 3) {
|
||||
$controller = new MediAssistApiController();
|
||||
}
|
||||
}
|
||||
|
||||
// Push Enrollment
|
||||
public function pushEnrollment($id)
|
||||
{
|
||||
if ($id == 1) {
|
||||
$controller = new VidalApiController();
|
||||
} elseif ($id == 2) {
|
||||
$controller = new ICICILombardController();
|
||||
} elseif ($id == 3) {
|
||||
$controller = new MediAssistApiController();
|
||||
}
|
||||
}
|
||||
|
||||
// Get Hospital Network
|
||||
public function getHospitalNetwork($id)
|
||||
{
|
||||
if ($id == 1) {
|
||||
$controller = new VidalApiController();
|
||||
} elseif ($id == 2) {
|
||||
$controller = new ICICILombardController();
|
||||
} elseif ($id == 3) {
|
||||
$controller = new MediAssistApiController();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -181,7 +181,7 @@ class BDSReportController extends AdminController
|
||||
'Client' => 'client'
|
||||
];
|
||||
|
||||
$data['page_name'] = "IRBA Report";
|
||||
$data['page_name'] = "IRDA Report";
|
||||
|
||||
return $this->loadLayout('irba_report', $data);
|
||||
} else {
|
||||
@ -202,9 +202,11 @@ class BDSReportController extends AdminController
|
||||
$viewData = [];
|
||||
}
|
||||
|
||||
$view_name = "bds_report_Insurer_wise_Data" ;
|
||||
|
||||
|
||||
$html = view('bds_report_Insurer_wise_Data', $viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
return $this->respond(['status' => true, 'html' => $html , 'view_name' => $view_name], 200);
|
||||
} else if ($report_type == 'bap') {
|
||||
|
||||
$life = $category == 'life' ? 1 : 0;
|
||||
@ -217,33 +219,40 @@ class BDSReportController extends AdminController
|
||||
$viewData = [];
|
||||
}
|
||||
|
||||
$view_name = "bds_report_bap_wise_data";
|
||||
|
||||
$html = view('bds_report_bap_wise_data', $viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
return $this->respond(['status' => true, 'html' => $html , 'view_name' => $view_name], 200);
|
||||
} else if ($report_type == 'bapInsurer') {
|
||||
|
||||
//Condition for BAP Insurer wise date
|
||||
$category = $category == 'life' ? 1 : 0;
|
||||
$viewData['data'] = $this->getBAPInsurerData($category, $fromDate, $toDate);
|
||||
|
||||
$view_name = "irda_bap_insurer_report_list";
|
||||
|
||||
$html = view('irda_bap_insurer_report_list', $viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
return $this->respond(['status' => true, 'html' => $html , 'view_name' => $view_name], 200);
|
||||
} else if ($report_type == 'bapClient') {
|
||||
|
||||
//Condition for BAP Client wise date
|
||||
$category = $category == 'life' ? 1 : 0;
|
||||
$viewData['data'] = $this->getBAPClientData($category, $fromDate, $toDate);
|
||||
|
||||
$view_name = "irda_bap_client_report_list";
|
||||
|
||||
$html = view('irda_bap_client_report_list', $viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
return $this->respond(['status' => true, 'html' => $html , 'view_name' => $view_name], 200);
|
||||
} else if ($report_type == 'client') {
|
||||
|
||||
//Condition for Client wise date
|
||||
$category = $category == 'life' ? 1 : 0;
|
||||
$viewData['data'] = $this->getClientData($category, $fromDate, $toDate);
|
||||
|
||||
$view_name = "irda_client_report_list";
|
||||
|
||||
$html = view('irda_client_report_list', $viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
return $this->respond(['status' => true, 'html' => $html , 'view_name' => $view_name], 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -932,8 +941,9 @@ class BDSReportController extends AdminController
|
||||
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];
|
||||
$data['renewal_data'] = $this->policyTransactionModel->getRenewalReportData($fromDate, $toDate, $client_type, $client_id, $issuer);
|
||||
// print_r($data); die;
|
||||
$view_name = "bds_renewal_report_list";
|
||||
$html = view('bds_renewal_report_list', $data);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
return $this->respond(['status' => true, 'html' => $html , 'view_name' => $view_name], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1017,6 +1027,8 @@ class BDSReportController extends AdminController
|
||||
$data['data'] = $result;
|
||||
// dd($data, get_role_id(), ENROLLMENT_TEAM_ID, user_team());
|
||||
if ($isInternalCalled) { return $result; }
|
||||
$data['tab_name'] = "BDS TAT Band Wise Report";
|
||||
$data['page_name'] = "BDS TAT Band Wise Report";
|
||||
return $this->loadLayout('bds_tat_wise_report', $data);
|
||||
}
|
||||
|
||||
|
||||
@ -5651,6 +5651,14 @@ class ClientController extends AdminController
|
||||
// dd($return);
|
||||
// die;
|
||||
|
||||
// $ticket_id = 515;
|
||||
// $apiServiceController = new ApiServiceController();
|
||||
// $apiServiceController->pushClaims($ticket_id); die;
|
||||
// echo change_date_format('13/10/1998 00:00:00','d/m/Y H:i:s');die();
|
||||
// $medi_assist = new MediAssistApiController();
|
||||
// $res = $medi_assist->GetBenefDetails(['policy_no' => '97000034240400000030', 'file_id' => 389, 'return_type' => 'job', 'client_policy_id' => 6192 ]);
|
||||
// dd($res);
|
||||
|
||||
// $employeeController = new EmployeeController();
|
||||
// $employeeController->truncateFileData('633');
|
||||
|
||||
@ -5680,8 +5688,8 @@ class ClientController extends AdminController
|
||||
|
||||
$EmployeeMultiEventServiceController = new EmployeeMultiEventServiceController();
|
||||
// $res = $EmployeeMultiEventServiceController->constructMultiEventData(['file_id' => '1069']);
|
||||
// $res = $EmployeeMultiEventServiceController->excelMultieventFileFormateValidation(['file_id' => '1084']);
|
||||
// $res = $EmployeeMultiEventServiceController->excelMultieventFileDataValidation(['file_id' => '1069']);
|
||||
// $res = $EmployeeMultiEventServiceController->excelMultieventFileFormateValidation(['file_id' => '2373']);
|
||||
// $res = $EmployeeMultiEventServiceController->excelMultieventFileDataValidation(['file_id' => '2373']);
|
||||
// $res = $EmployeeMultiEventServiceController->excelMultieventFileOnBoard(['file_id' => '1069']);
|
||||
// dd($res);
|
||||
|
||||
@ -7745,6 +7753,10 @@ class ClientController extends AdminController
|
||||
|
||||
$member_review_and_summary_mail_template = $this->notificationModel->where('client_id',NULL)->where('template_name','member_review_and_summary_mail')->get()->getResultArray()[0]??[];
|
||||
|
||||
$member_ecard_mail_template = $this->notificationModel->where('client_id',NULL)->where('template_name','member_ecard_mail')->get()->getResultArray()[0]??[];
|
||||
|
||||
$member_common_mail_template = $this->notificationModel->where('client_id',NULL)->where('template_name','member_common_mail')->get()->getResultArray()[0]??[];
|
||||
|
||||
$default_member_welcome_mail_template = [
|
||||
'client_id' => $client_id,
|
||||
'template_name' => 'member_welcome_mail',
|
||||
@ -7787,6 +7799,34 @@ class ClientController extends AdminController
|
||||
'mail_content_copy'=> null
|
||||
];
|
||||
|
||||
$default_member_ecard_mail_template = [
|
||||
'client_id' => $client_id,
|
||||
'template_name' => 'member_ecard_mail',
|
||||
'subject' => $member_ecard_mail_template['subject']??'',
|
||||
'mail_content' => $member_ecard_mail_template['mail_content']??'',
|
||||
'mail_content_json'=> $member_ecard_mail_template['mail_content_json']??'',
|
||||
|
||||
'created_by' => get_session_userid(),
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_by' => null,
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
'mail_content_copy'=> null
|
||||
];
|
||||
|
||||
$default_member_common_mail_template = [
|
||||
'client_id' => $client_id,
|
||||
'template_name' => 'member_common_mail',
|
||||
'subject' => $member_common_mail_template['subject']??'',
|
||||
'mail_content' => $member_common_mail_template['mail_content']??'',
|
||||
'mail_content_json'=> $member_common_mail_template['mail_content_json']??'',
|
||||
|
||||
'created_by' => get_session_userid(),
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_by' => null,
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
'mail_content_copy'=> null
|
||||
];
|
||||
|
||||
$this->myLogger->logme('error', 'Default Mail Template Data ' . json_encode([
|
||||
$default_member_welcome_mail_template,
|
||||
$default_member_remainder_mail_template,
|
||||
@ -7798,7 +7838,9 @@ class ClientController extends AdminController
|
||||
$default_templates_inserted = $this->notificationModel->insertBatch([
|
||||
$default_member_welcome_mail_template,
|
||||
$default_member_remainder_mail_template,
|
||||
$default_member_review_and_summary_mail_template
|
||||
$default_member_review_and_summary_mail_template,
|
||||
$default_member_ecard_mail_template,
|
||||
$default_member_common_mail_template
|
||||
]);
|
||||
|
||||
|
||||
|
||||
@ -121,16 +121,17 @@ class EmpDataServiceController extends BaseController
|
||||
$insert = $this->batchFileModel->insert($data);
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
|
||||
if ($insert) {
|
||||
foreach ($objects as $value) {
|
||||
$batch_list_data['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||
$batch_list_data['emp_policy_id'] = $value->primaryKey ?? $value->employee_policy_id ?? '';
|
||||
$batch_list_data['created_by'] = get_session_userid();
|
||||
$this->batchListModel->insert($batch_list_data);
|
||||
}
|
||||
}
|
||||
// if ($insert) {
|
||||
// foreach ($objects as $value) {
|
||||
// $batch_list_data['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||
// $batch_list_data['emp_policy_id'] = $value->primaryKey ?? $value->employee_policy_id ?? '';
|
||||
// $batch_list_data['created_by'] = get_session_userid();
|
||||
// $this->batchListModel->insert($batch_list_data);
|
||||
// }
|
||||
// }
|
||||
|
||||
return true;
|
||||
return $insert;
|
||||
// return true;
|
||||
}
|
||||
|
||||
|
||||
@ -526,8 +527,8 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $objects]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $objects]]);
|
||||
|
||||
|
||||
// If batch operation is successful
|
||||
@ -640,7 +641,13 @@ class EmpDataServiceController extends BaseController
|
||||
foreach ($ids as $key => $id) {
|
||||
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||
if ($group_key) {
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set('status', 'inprogress')->update();
|
||||
|
||||
$endorsement_update_data['status'] = 'inprogress';
|
||||
if( $export_data['insurer_or_tpa'] == 'tpa'){
|
||||
$endorsement_update_data['is_tpa_export'] = $return ?? generate_random_string(4);
|
||||
}
|
||||
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set($endorsement_update_data)->update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -794,13 +801,21 @@ class EmpDataServiceController extends BaseController
|
||||
$success = generate_excel($excel_data_info['header'], $excel_data_info['data'], $tempFile);
|
||||
|
||||
if ($success) {
|
||||
|
||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||
if ($return) {
|
||||
|
||||
foreach ($ids as $key => $id) {
|
||||
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||
if ($group_key) {
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set('status', 'inprogress')->update();
|
||||
|
||||
$endorsement_update_data['status'] = 'inprogress';
|
||||
|
||||
if( $export_data['insurer_or_tpa'] == 'tpa'){
|
||||
$endorsement_update_data['is_tpa_export'] = $return ?? generate_random_string(4);
|
||||
}
|
||||
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set($endorsement_update_data)->update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -914,7 +929,11 @@ class EmpDataServiceController extends BaseController
|
||||
foreach ($ids as $key => $id) {
|
||||
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||
if ($group_key) {
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set('status', 'inprogress')->update();
|
||||
$endorsement_update_data['status'] = 'inprogress';
|
||||
if( $export_data['insurer_or_tpa'] == 'tpa'){
|
||||
$endorsement_update_data['is_tpa_export'] = $return ?? generate_random_string(4);
|
||||
}
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set($endorsement_update_data)->update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1002,12 +1021,12 @@ class EmpDataServiceController extends BaseController
|
||||
return 5;
|
||||
}
|
||||
|
||||
$cash_balance = $this->clientDepositModel
|
||||
->where('cd_ac_pk', $policy_details['cd_ac_pk'])
|
||||
// ->where('cd_ac_no', $policy_details['cd_ac_no'])
|
||||
->where('is_active', 1)
|
||||
->orderBy('id', 'DESC')
|
||||
->first();
|
||||
$cash_balance = $this->clientDepositModel
|
||||
->where('cd_ac_pk', $policy_details['cd_ac_pk'])
|
||||
// ->where('cd_ac_no', $policy_details['cd_ac_no'])
|
||||
->where('is_active', 1)
|
||||
->orderBy('id', 'DESC')
|
||||
->first();
|
||||
|
||||
if ($cash_balance == null) {
|
||||
$balance = $this->CDMasterModel
|
||||
@ -1028,7 +1047,7 @@ class EmpDataServiceController extends BaseController
|
||||
$totals = round($totals, 2);
|
||||
|
||||
|
||||
if($export_data['insurer_or_tpa'] != 'tpa')// check overal emp premium amt with cd balance only for insurer export, not tpa export
|
||||
if($export_data['insurer_or_tpa'] != 'tpa')// check overal emp premium amt with cd balance only for insurer export, not tpa export
|
||||
{
|
||||
if (!empty($cash_balance)) {
|
||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
||||
@ -1112,6 +1131,7 @@ class EmpDataServiceController extends BaseController
|
||||
$export_data['batch_code'] = session()->get('batch_code');
|
||||
$export_data['created_by'] = get_session_userid();
|
||||
|
||||
$insert = null;
|
||||
if($value == 'addition'){
|
||||
|
||||
if(!empty($additionData) && $additionData != null){
|
||||
@ -1125,8 +1145,8 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $additionData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $additionData]]);
|
||||
|
||||
}
|
||||
|
||||
@ -1143,8 +1163,8 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $inceptionData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $inceptionData]]);
|
||||
}
|
||||
|
||||
}else if($value == 'dependent_addition'){
|
||||
@ -1160,8 +1180,8 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $dependentAdditionData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $dependentAdditionData]]);
|
||||
}
|
||||
}else if($value == 'deletion'){
|
||||
|
||||
@ -1176,8 +1196,8 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $deletionData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $deletionData]]);
|
||||
}
|
||||
|
||||
}else if($value == 'si_enhancement'){
|
||||
@ -1193,8 +1213,8 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $enhancementData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $enhancementData]]);
|
||||
}
|
||||
|
||||
}else if($value == 'correction'){
|
||||
@ -1210,11 +1230,43 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $correctionData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $correctionData]]);
|
||||
}
|
||||
}
|
||||
|
||||
if(in_array($value, ['deletion', 'si_enhancement', 'correction']) && $insert){
|
||||
|
||||
$endorsement_data_for_update = [];
|
||||
|
||||
if($value == 'deletion'){
|
||||
$endorsement_data_for_update = $deletionData;
|
||||
}else if($value == 'si_enhancement') {
|
||||
$endorsement_data_for_update = $enhancementData;
|
||||
}else if($value == 'correction') {
|
||||
$endorsement_data_for_update = $correctionData;
|
||||
}
|
||||
|
||||
foreach ($endorsement_data_for_update as $key => $edata) {
|
||||
|
||||
$id = $edata->id ?? $edata->endorsement_primarykey ?? null;
|
||||
|
||||
if($id){
|
||||
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||
if ($group_key) {
|
||||
|
||||
$endorsement_update_data['status'] = 'inprogress';
|
||||
if( $export_data['insurer_or_tpa'] == 'tpa'){
|
||||
$endorsement_update_data['is_tpa_export'] = $return ?? generate_random_string(4);
|
||||
}
|
||||
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set($endorsement_update_data)->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
session()->remove('batch_code');
|
||||
@ -2541,7 +2593,8 @@ class EmpDataServiceController extends BaseController
|
||||
// dd($value[8]);
|
||||
|
||||
$emp_details[] = array('id' => $result['emp_id'], $result['field_name'] => $value[8]);
|
||||
$endorsement_details[] = array('group_key' => $result['group_key'], 'id' => $result['id'], 'endorsement_id' => $value[10], 'status' => 'complete');
|
||||
// $endorsement_details[] = array('group_key' => $result['group_key'], 'id' => $result['id'], 'endorsement_id' => $value[10], 'status' => 'complete');
|
||||
$endorsement_details[] = array('group_key' => $result['group_key'], 'endorsement_id' => $value[10], 'status' => 'complete');
|
||||
}
|
||||
|
||||
}
|
||||
@ -3172,7 +3225,8 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$emp_policy_ids[] = array('id' => $result['emp_policy_id'], 'is_active' => 0);
|
||||
$employeeIds[] = $result['emp_policy_id'];
|
||||
$endorsement_details[] = array('id' => $result['id'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[19], 'status' => 'complete');
|
||||
// $endorsement_details[] = array('id' => $result['id'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[19], 'status' => 'complete');
|
||||
$endorsement_details[] = array('group_key' => $result['group_key'], 'endorsement_id' => $value[19], 'status' => 'complete');
|
||||
if (strtolower($result['relationship']) == 'self') {
|
||||
$no_of_insured[] = ['emp_id' => $result['emp_id'], 'emp_code' => $result['emp_code'], 'emp_name' => $result['emp_name'] ];
|
||||
}else{
|
||||
@ -3257,10 +3311,12 @@ class EmpDataServiceController extends BaseController
|
||||
'pk' => $pk,
|
||||
'si_adjustment' => $si_adjustment
|
||||
];
|
||||
}
|
||||
// dd($insertedIds);
|
||||
} // dd($insertedIds);
|
||||
|
||||
$this->employeePolicyModel->bulkUpdateForEndorsement($endorsement_details);
|
||||
// update si enhancement endorsement complete
|
||||
$this->empEndorsementModel->updateBatch($endorsement_details, 'group_key');
|
||||
|
||||
// $this->employeePolicyModel->bulkUpdateForEndorsement($endorsement_details); // do not remove this
|
||||
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||
}
|
||||
|
||||
@ -4878,6 +4934,7 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
cp.policy_type_id,
|
||||
cp.is_addon,
|
||||
cp.policy_no,
|
||||
|
||||
employee_polices.id as emp_policy_id,
|
||||
employee_polices.client_policy_id,
|
||||
@ -4904,6 +4961,11 @@ class EmpDataServiceController extends BaseController
|
||||
'notification' => $notification,
|
||||
'client_data' => $client_data,
|
||||
'get_emp_email_and_other_details' => $emp_details,
|
||||
|
||||
'id' => $emp_details['emp_id'],
|
||||
'emp_code' => $emp_details['emp_code'],
|
||||
'policy_no' => $emp_details['policy_no'],
|
||||
'client_policy_id' => $emp_details['client_policy_id'],
|
||||
];
|
||||
|
||||
$params['common'] = [
|
||||
@ -5083,6 +5145,7 @@ class EmpDataServiceController extends BaseController
|
||||
'tpa_id' => $filedata['tpa_id'],
|
||||
'endorsement_no' => $endorsement_no,
|
||||
'file_id' => $enrollment_file_id,
|
||||
'batch_file_id' => $file_id,
|
||||
'endorsement_type' => $filedata['event_type'],
|
||||
'created_by' => $filedata['created_by'],
|
||||
]);
|
||||
|
||||
@ -668,6 +668,11 @@ class EmployeeController extends AdminController
|
||||
|
||||
} else if ($actions == 'import') {
|
||||
|
||||
if($insurer_or_tpa == "tpa" && in_array($event_type, ['correction', 'deletion', 'si_enhancement'])){
|
||||
session()->setFlashdata('error', "TPA upload is not applicable for this event.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
$batch_data['file'] = $this->request->getFile('import_file_data');
|
||||
$file = $this->request->getFile('import_file_data');
|
||||
|
||||
@ -2284,8 +2289,10 @@ class EmployeeController extends AdminController
|
||||
$si_enhancement_true_or_false = $policyTermsData->suminsuredenhancement;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$employeeRest = new EmployeeRestController();
|
||||
$tpa_api_service_status = $employeeRest->checkTpaApiEnable($client_policy_id, 'getTPAID', 'internel');
|
||||
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$policy_details['client_id']);
|
||||
|
||||
$message = null;
|
||||
@ -2300,7 +2307,7 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
$message = isset($message) ? ($message . ' not defined for choosed policy') : null;
|
||||
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message, 'si_enhancement' => $si_enhancement_true_or_false, 'insurer_multi_event' => $insurer_details['is_multi_event']], 200);
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message, 'si_enhancement' => $si_enhancement_true_or_false, 'insurer_multi_event' => $insurer_details['is_multi_event'], 'tpa_api_service_status' => $tpa_api_service_status], 200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1015,6 +1015,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
|
||||
public function excelMultieventFileFormateValidation($params)
|
||||
{
|
||||
$this->myLogger->logme('error', 'Excel Multievent File Formate Validation function START: ' . json_encode(['params' => $params]));
|
||||
helper('excel_util_helper');
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->fileModel->find($file_id);
|
||||
@ -1092,51 +1093,59 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "inception";
|
||||
$params["file_path"] = $file_paths['inception'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$this->myLogger->logme('error', 'Inception file formate validation result: ' . json_encode(['params' => $params]));
|
||||
if (isset($error['error_data']) && count($error['error_data']) == 0) {
|
||||
$error[] = $this->compareMemberDataAndInceptionData($params);
|
||||
$this->myLogger->logme('error', 'compare Member Data And Inception Data file validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
}
|
||||
|
||||
//addition
|
||||
if(isset($file_paths['addition']) && $file_paths['addition'] != "" && $file_paths['addition'] != null){
|
||||
$params["action"] = "addition";
|
||||
$params["file_path"] = $file_paths['addition'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$params["action"] = "addition";
|
||||
$params["file_path"] = $file_paths['addition'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$this->myLogger->logme('error', 'Addition file formate validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//dependent_addition
|
||||
if(isset($file_paths['dependent_addition']) && $file_paths['dependent_addition'] != "" && $file_paths['dependent_addition'] != null){
|
||||
$params["action"] = "dependent_addition";
|
||||
$params["file_path"] = $file_paths['dependent_addition'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$params["action"] = "dependent_addition";
|
||||
$params["file_path"] = $file_paths['dependent_addition'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$this->myLogger->logme('error', 'Dependent Addition file formate validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//deletion
|
||||
if(isset($file_paths['deletion']) && $file_paths['deletion'] != "" && $file_paths['deletion'] != null){
|
||||
$params["action"] = "deletion";
|
||||
$params["file_path"] = $file_paths['deletion'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$params["action"] = "deletion";
|
||||
$params["file_path"] = $file_paths['deletion'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$this->myLogger->logme('error', 'Deletion file formate validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//correction
|
||||
if(isset($file_paths['correction']) && $file_paths['correction'] != "" && $file_paths['correction'] != null){
|
||||
$params["action"] = "correction";
|
||||
$params["file_path"] = $file_paths['correction'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$params["action"] = "correction";
|
||||
$params["file_path"] = $file_paths['correction'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$this->myLogger->logme('error', 'Correction file formate validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//si_enhancement
|
||||
if(isset($file_paths['si_enhancement']) && $file_paths['si_enhancement'] != "" && $file_paths['si_enhancement'] != null){
|
||||
$params["action"] = "si_enhancement";
|
||||
$params["file_path"] = $file_paths['si_enhancement'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$params["action"] = "si_enhancement";
|
||||
$params["file_path"] = $file_paths['si_enhancement'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$this->myLogger->logme('error', 'SI Enhancement file formate validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//missed_inception
|
||||
if(isset($file_paths['missed_inception']) && $file_paths['missed_inception'] != "" && $file_paths['missed_inception'] != null){
|
||||
$params["action"] = "missed_inception";
|
||||
$params["file_path"] = $file_paths['missed_inception'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$params["action"] = "missed_inception";
|
||||
$params["file_path"] = $file_paths['missed_inception'];
|
||||
$error[] = $this->excelFileFormatValidation($params);
|
||||
$this->myLogger->logme('error', 'Missed Inception file formate validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
$error_type = 1;
|
||||
@ -1145,6 +1154,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
|
||||
if (isset($error['error_data']) && count($error['error_data']) == 0) {
|
||||
$r = Jobs::addJob(['job_name' => 'excelMultieventFileDataValidation', 'payload' => $params]);
|
||||
$this->myLogger->logme('error', 'excelMultieventFileDataValidation job pushed');
|
||||
} else {
|
||||
|
||||
// $error['error_summary'] = array_count_values($error['error_summary']);
|
||||
@ -1160,12 +1170,16 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$this->unlinkFiles($file_paths);
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', 'Excel Multievent File Formate Validation function END');
|
||||
|
||||
return ($error);
|
||||
|
||||
}
|
||||
|
||||
public function excelMultieventFileDataValidation($params)
|
||||
{
|
||||
$this->myLogger->logme('error', 'Excel Multievent File Data Validation function START: ' . json_encode(['params' => $params]));
|
||||
|
||||
helper('excel_util_helper');
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->fileModel->find($file_id);
|
||||
@ -1195,6 +1209,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "inception";
|
||||
$params["file_path"] = $file_paths['inception'];
|
||||
$error[] = $this->excelFileDataValidation($params);
|
||||
$this->myLogger->logme('error', 'Inception file Data validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//addition
|
||||
@ -1202,6 +1217,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "addition";
|
||||
$params["file_path"] = $file_paths['addition'];
|
||||
$error[] = $this->excelFileDataValidation($params);
|
||||
$this->myLogger->logme('error', 'Addition file validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//dependent_addition
|
||||
@ -1209,6 +1225,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "dependent_addition";
|
||||
$params["file_path"] = $file_paths['dependent_addition'];
|
||||
$error[] = $this->excelFileDataValidation($params);
|
||||
$this->myLogger->logme('error', 'Dependent Addition file Data validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//deletion
|
||||
@ -1216,6 +1233,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "deletion";
|
||||
$params["file_path"] = $file_paths['deletion'];
|
||||
$error[] = $this->excelFileDataValidation($params);
|
||||
$this->myLogger->logme('error', 'Deletion file Data validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//correction
|
||||
@ -1223,6 +1241,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "correction";
|
||||
$params["file_path"] = $file_paths['correction'];
|
||||
$error[] = $this->excelFileDataValidation($params);
|
||||
$this->myLogger->logme('error', 'Correction file Data validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//si_enhancement
|
||||
@ -1230,6 +1249,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "si_enhancement";
|
||||
$params["file_path"] = $file_paths['si_enhancement'];
|
||||
$error[] = $this->excelFileDataValidation($params);
|
||||
$this->myLogger->logme('error', 'SI Enhancement file Data validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//missed_inception
|
||||
@ -1237,6 +1257,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "missed_inception";
|
||||
$params["file_path"] = $file_paths['missed_inception'];
|
||||
$error[] = $this->excelFileDataValidation($params);
|
||||
$this->myLogger->logme('error', 'Missed Inception file Data validation result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
$error_type = 2;
|
||||
@ -1245,6 +1266,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
|
||||
if (isset($error['error_data']) && count($error['error_data']) == 0) {
|
||||
$r = Jobs::addJob(['job_name' => 'excelMultieventFileOnBoard', 'payload' => $params]);
|
||||
$this->myLogger->logme('error', 'excelMultieventFileOnBoard job pushed');
|
||||
} else {
|
||||
|
||||
// $error['error_summary'] = array_count_values($error['error_summary']);
|
||||
@ -1257,11 +1279,15 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$this->setPullNotification($this->getFileMetaDataByFileId($file_id, 'failure'));
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', 'Excel Multievent File Data Validation function END');
|
||||
|
||||
return ($error);
|
||||
}
|
||||
|
||||
public function excelMultieventFileOnBoard($params)
|
||||
{
|
||||
$this->myLogger->logme('error', 'Excel Multievent File Onboard function START: ' . json_encode(['params' => $params]));
|
||||
|
||||
helper('excel_util_helper');
|
||||
|
||||
$file_id = $params['file_id'];
|
||||
@ -1291,6 +1317,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "inception";
|
||||
$params["file_path"] = $file_paths['inception'];
|
||||
$error['inception'] = $this->employeesOnboardPreprocess($params);
|
||||
$this->myLogger->logme('error', 'Inception file Onboard Process result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//addition
|
||||
@ -1298,6 +1325,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "addition";
|
||||
$params["file_path"] = $file_paths['addition'];
|
||||
$error['addition'] = $this->employeesOnboardPreprocess($params);
|
||||
$this->myLogger->logme('error', 'Addition file Onboard Process result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//dependent_addition
|
||||
@ -1305,6 +1333,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "dependent_addition";
|
||||
$params["file_path"] = $file_paths['dependent_addition'];
|
||||
$error['dependent_addition'] = $this->employeesOnboardPreprocess($params);
|
||||
$this->myLogger->logme('error', 'Dependent Addition file Onboard Process result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//missed_inception
|
||||
@ -1312,6 +1341,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "missed_inception";
|
||||
$params["file_path"] = $file_paths['missed_inception'];
|
||||
$error['missed_inception'] = $this->employeesOnboardPreprocess($params);
|
||||
$this->myLogger->logme('error', 'Missed Inception file Onboard Process result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//deletion
|
||||
@ -1319,6 +1349,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "deletion";
|
||||
$params["file_path"] = $file_paths['deletion'];
|
||||
$error['deletion'] = $this->employeeDisembark($params);
|
||||
$this->myLogger->logme('error', 'Deletion file Onboard Process result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//correction
|
||||
@ -1326,6 +1357,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "correction";
|
||||
$params["file_path"] = $file_paths['correction'];
|
||||
$error['correction'] = $this->employeesCorrectionProcess($params);
|
||||
$this->myLogger->logme('error', 'Correction file Onboard Process result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
//si_enhancement
|
||||
@ -1333,11 +1365,13 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$params["action"] = "si_enhancement";
|
||||
$params["file_path"] = $file_paths['si_enhancement'];
|
||||
$error['si_enhancement'] = $this->employeesSIEnhanceProcess($params);
|
||||
$this->myLogger->logme('error', 'SI Enhancement file Onboard Process result: ' . json_encode(['params' => $params]));
|
||||
}
|
||||
|
||||
$this->fileModel->where('id', $file_id)->set(['status' => 'success', 'reason' => ''])->update();
|
||||
$this->myLogger->logme("error", $file['action'].': {file_id} uploaded success', ['file_id' => $file_id]);
|
||||
$this->setPullNotification($this->getFileMetaDataByFileId($file_id, 'success'));
|
||||
$this->myLogger->logme('error', 'Excel Multievent File Onboard function END');
|
||||
|
||||
//After insert the success than remove the TEMP JSON files
|
||||
// $this->unlinkFiles($params['multi_event_file_paths']);
|
||||
@ -2912,9 +2946,13 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
// Save JSON file in writable/tmp/
|
||||
$savedFiles = [];
|
||||
foreach ($finalData as $key => $data) {
|
||||
$filePath = WRITEPATH . 'tmp/' . $key . '_' . time() . '.json';
|
||||
file_put_contents($filePath, json_encode($data, JSON_PRETTY_PRINT));
|
||||
$savedFiles[$key] = $filePath;
|
||||
if(!empty($data)){
|
||||
$filePath = WRITEPATH . 'tmp/' . $key . '_' . time() . '.json';
|
||||
file_put_contents($filePath, json_encode($data, JSON_PRETTY_PRINT));
|
||||
$savedFiles[$key] = $filePath;
|
||||
}else{
|
||||
$savedFiles[$key] = "";
|
||||
}
|
||||
}
|
||||
|
||||
return $savedFiles;
|
||||
|
||||
@ -12,6 +12,10 @@ use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\sendMailNotification;
|
||||
|
||||
use App\Controllers\VidalApiController;
|
||||
use App\Controllers\ICICILombardController;
|
||||
use App\Controllers\MediAssistApiController;
|
||||
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
@ -54,6 +58,7 @@ use Illuminate\Http\Request;
|
||||
use App\Controllers\EmployeeServiceController;
|
||||
use App\Models\ClaimFilesModel;
|
||||
use App\Models\TicketMailTemplateModel;
|
||||
use App\Models\TpaApiSeviceModel;
|
||||
use Composer\Pcre\Preg;
|
||||
use Kreait\Firebase\Factory;
|
||||
use Kreait\Firebase\Messaging\CloudMessage;
|
||||
@ -2189,7 +2194,7 @@ class EmployeeRestController extends AdminController
|
||||
// print_r($params);die;
|
||||
$wholeData =sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
|
||||
$mail_send_return = MailHelper::send_email($wholeData[0]);
|
||||
$this->myLogger->logme("info", $mail_send_return);
|
||||
$this->myLogger->logme("error", $mail_send_return);
|
||||
|
||||
if (isset($wholeData[0])) {
|
||||
|
||||
@ -2200,7 +2205,7 @@ class EmployeeRestController extends AdminController
|
||||
{
|
||||
foreach ($account_manager_wholeData as $key => $value) {
|
||||
$mail_send_return1 = MailHelper::send_email($value);
|
||||
$this->myLogger->logme("info", $mail_send_return1);
|
||||
$this->myLogger->logme("error", $mail_send_return1);
|
||||
}
|
||||
}else{
|
||||
$this->myLogger->logme("error", 'Account Manager Mail Configuration not Enable for this client');
|
||||
@ -2213,7 +2218,7 @@ class EmployeeRestController extends AdminController
|
||||
{
|
||||
foreach ($client_hr_wholeData as $key => $value) {
|
||||
$mail_send_return2 = MailHelper::send_email($value);
|
||||
$this->myLogger->logme("info", $mail_send_return2);
|
||||
$this->myLogger->logme("error", $mail_send_return2);
|
||||
}
|
||||
}else{
|
||||
$this->myLogger->logme("error", 'Client HR Mail Configuration not Enable for this client');
|
||||
@ -2831,7 +2836,7 @@ class EmployeeRestController extends AdminController
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', $policy_status)
|
||||
->where('client_policy.enrolment_visibility', 1 )
|
||||
->where('client_policy.enrolment_visibility', 1)
|
||||
->orderby('client_policy.id' , 'ASC')
|
||||
->findAll();
|
||||
|
||||
@ -2840,16 +2845,25 @@ class EmployeeRestController extends AdminController
|
||||
->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||
->where('is_active', 1 )->findAll();
|
||||
$employeeName = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
|
||||
|
||||
$employeeSelfData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
|
||||
->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||
->where('family_floater_key','self')->where('is_active', 1 )
|
||||
->get()->getRow()->name;
|
||||
->get()->getRow();
|
||||
|
||||
$employeeName = $employeeSelfData->name ?? "";
|
||||
|
||||
|
||||
//for get the pre enrollment policy count
|
||||
$empMobileNo = $this->request->getGet('mobile_no');
|
||||
$clientId = $this->request->getGet('client_id');
|
||||
$prePolicyCount = $this->getPreEmployeePolicyCount($empMobileNo, $clientId);
|
||||
|
||||
if(!empty($employeeSelfData) && isset($employeeSelfData->email_corporate)){
|
||||
$prePolicyCount = $this->getPreEmployeePolicyCount($empMobileNo, $clientId, $employeeSelfData->email_corporate);
|
||||
}else{
|
||||
$prePolicyCount = $this->getPreEmployeePolicyCount($empMobileNo, $clientId);
|
||||
}
|
||||
|
||||
$whereArrayForId = [];
|
||||
foreach ( $employeeData as $key => $value) { array_push($whereArrayForId, $value['id']); }
|
||||
@ -2972,7 +2986,11 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
|
||||
function policyTermsFiter($terms , $type)
|
||||
{
|
||||
{
|
||||
if(empty($terms)){
|
||||
return [];
|
||||
}
|
||||
|
||||
$gpa = [
|
||||
"sumInsured2" => "Sum Insured",
|
||||
"totalSumInsured" => "Total Sum Assured",
|
||||
@ -3471,6 +3489,15 @@ class EmployeeRestController extends AdminController
|
||||
$received_data = $this->request->getPost();
|
||||
$this->myLogger->logme('error', 'API claim initiate Recevied Params :' . json_encode($received_data ?? []));
|
||||
$get_file_data = $this->request->getFiles('claim_docs');
|
||||
$get_docs_name = $this->request->getPost('claim_doc_names') ?? [];
|
||||
|
||||
if (is_string($get_docs_name)) {
|
||||
$decoded = json_decode($get_docs_name, true);
|
||||
$get_docs_name = json_last_error() === JSON_ERROR_NONE ? $decoded : [];
|
||||
} elseif (!is_array($get_docs_name)) {
|
||||
$get_docs_name = [];
|
||||
}
|
||||
|
||||
// print_r($get_file_data); die;
|
||||
$employee_id = $received_data['emp_id'];
|
||||
$client_policy_id = $received_data['client_policy_id'];
|
||||
@ -3479,7 +3506,7 @@ class EmployeeRestController extends AdminController
|
||||
$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);
|
||||
$file_data = multi_file_Upload($get_file_data, $file_path, $get_docs_name);
|
||||
}
|
||||
|
||||
|
||||
@ -3619,25 +3646,42 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function handleCliamFiles($data, $ticket_id, $ticket_message_id)
|
||||
public function handleCliamFiles($data, $ticket_id, $ticket_message_id = null)
|
||||
{
|
||||
if(!empty($data) && !empty($ticket_id))
|
||||
{
|
||||
$insert_ids = [];
|
||||
$pdf_exist_in_the_file = false;
|
||||
$claim_file = new ClaimFilesModel();
|
||||
foreach ($data as $key => $value) {
|
||||
|
||||
$data = [
|
||||
'ticket_id' => $ticket_id,
|
||||
'doc_name' => $value['file_name'],
|
||||
'doc_name' => $value['doc_name'],
|
||||
'file_name' => $value['file_name'],
|
||||
'url' => $value['file_path'],
|
||||
'file_type' => 2,
|
||||
'ticket_message_id' => $ticket_message_id,
|
||||
'mime_type' => getMimeTypeByFileName($value['file_name']),
|
||||
];
|
||||
|
||||
$insert_ids[] = $claim_file->insert($data);
|
||||
|
||||
if(getMimeTypeByFileName($value['file_name']) == "application/pdf"){
|
||||
$pdf_exist_in_the_file = true;
|
||||
}
|
||||
}
|
||||
|
||||
if($pdf_exist_in_the_file){
|
||||
// this call for TPA integration
|
||||
$apiServiceController = new ApiServiceController();
|
||||
$apiServiceController->pushClaims($ticket_id);
|
||||
log_message('error', "pushClaims function called with Ticket ID: {$ticket_id}, In Employee Rest Controller");
|
||||
}else{
|
||||
log_message('error', "Failed to call the pushClaims function in EmployeeRestController for Ticket ID: {$ticket_id}, because the .pdf file does not exist.");
|
||||
}
|
||||
|
||||
|
||||
return $insert_ids;
|
||||
}
|
||||
|
||||
@ -3697,7 +3741,7 @@ class EmployeeRestController extends AdminController
|
||||
])->setStatusCode(404);
|
||||
}
|
||||
|
||||
$this->myLogger->logme('info', "Policy type IDs fetched: " . json_encode($policy_type_ids));
|
||||
$this->myLogger->logme('error', "Policy type IDs fetched: " . json_encode($policy_type_ids));
|
||||
|
||||
$ticket_type = $this->ticketController->ticketType;
|
||||
$filtered = [];
|
||||
@ -3725,9 +3769,9 @@ class EmployeeRestController extends AdminController
|
||||
'name' => $mappedName
|
||||
];
|
||||
|
||||
$this->myLogger->logme('info', "Ticket type resolved: ID={$ticketTypeId}, Name={$mappedName}");
|
||||
$this->myLogger->logme('error', "Ticket type resolved: ID={$ticketTypeId}, Name={$mappedName}");
|
||||
} else {
|
||||
$this->myLogger->logme('warning', "No valid ticket type mapping for policy_type_id={$ticketTypeId}");
|
||||
$this->myLogger->logme('error', "No valid ticket type mapping for policy_type_id={$ticketTypeId}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -3834,6 +3878,7 @@ class EmployeeRestController extends AdminController
|
||||
{
|
||||
|
||||
$emp_id = $this->request->getGet('emp_id');
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
$data = $db->table('employees e')
|
||||
->select('pt.policy_type,
|
||||
@ -3850,11 +3895,12 @@ class EmployeeRestController extends AdminController
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
|
||||
// print_r($db->getLastQuery());die();
|
||||
// print_r($data);die();
|
||||
// Loop through $data and check for policy_type = GMC
|
||||
$userParams = [];
|
||||
foreach ($data as $row) {
|
||||
if ($row['policy_type'] === 'GMC') {
|
||||
// if ($row['policy_type'] === 'GMC') {
|
||||
$userParams['name'] = $row['name'];
|
||||
$userParams['email'] = $row['email'];
|
||||
$userParams['phone'] = $row['phone'];
|
||||
@ -3866,18 +3912,21 @@ class EmployeeRestController extends AdminController
|
||||
$userParams['employeeId'] = $row['employeeId'];
|
||||
$userParams['policyStartDate']= $row['policyStartDate'];
|
||||
$userParams['policyEndDate'] = $row['policyEndDate'];
|
||||
$userParams['policyName'] = 'Nhance ' . $row['policy_type'];
|
||||
$userParams['planId'] = 'NHANCE-PLAN-' . $row['policy_type'];
|
||||
// $userParams['policyName'] = 'Nhance ' . $row['policy_type'];
|
||||
// $userParams['planId'] = 'NHANCE-PLAN-' . $row['policy_type'];
|
||||
$userParams['policyName'] = $row['policy_type'];
|
||||
$userParams['planId'] = env('VISIT_PLAN_ID');
|
||||
|
||||
$userParams['moduleName'] = 'home';
|
||||
break; // stop after first GMC match
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
if (empty($userParams)) {
|
||||
return $this->respond(['status' => 'failed','message' => 'Coming soon........!'], 200);
|
||||
}
|
||||
|
||||
|
||||
// echo 'coming';die();
|
||||
// Derive 32-byte key from SHA256
|
||||
$derivedKey = hash('sha256', env('VISIT_SECRET_KEY'), true);
|
||||
|
||||
@ -3900,6 +3949,7 @@ class EmployeeRestController extends AdminController
|
||||
$finalUrl = $baseURL . '/sso?userParams=' . $output . '&clientId=' . $clientId;
|
||||
|
||||
if (!empty($finalUrl)) {
|
||||
log_message('error', 'VISIT SSO | emp_id: '.$emp_id.' | URL: '.$finalUrl);
|
||||
return $this->respond(['status' => 'success','data' => $finalUrl], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => 'failed','message' => 'Coming soon........!'], 200);
|
||||
@ -4072,18 +4122,19 @@ class EmployeeRestController extends AdminController
|
||||
// }
|
||||
// }
|
||||
|
||||
public function getPreEmployeePolicyCount($mobile_no, $clientId = null)
|
||||
{
|
||||
log_message('error', 'STEP 1: getPreEmployeePolicyCount called with params: ' . json_encode(['mobile_no' => $mobile_no, 'client_id' => $clientId]));
|
||||
public function getPreEmployeePolicyCount($mobile_no, $clientId = null, $email = null)
|
||||
{
|
||||
log_message('error', 'STEP 1: getPreEmployeePolicyCount called with params: ' . json_encode(['mobile_no' => $mobile_no, 'client_id' => $clientId, 'email' => $email]));
|
||||
|
||||
if (empty($mobile_no)) {
|
||||
log_message('error', 'STEP 2: Mobile number is empty or null. Returning 0.');
|
||||
if (empty($mobile_no) && empty($email)) {
|
||||
log_message('error', 'STEP 2: Mobile number and Email is empty or null. Returning 0.');
|
||||
return 0;
|
||||
}
|
||||
|
||||
$client_short_name = null;
|
||||
|
||||
if (!empty($clientId)) {
|
||||
|
||||
log_message('error', 'STEP 3: Fetching client short name for client ID: ' . $clientId);
|
||||
$client_data = $this->clientModel->where('is_active', 1)->where('id', $clientId)->first();
|
||||
|
||||
@ -4093,14 +4144,25 @@ class EmployeeRestController extends AdminController
|
||||
} else {
|
||||
log_message('error', 'STEP 4: No client found for ID: ' . $clientId);
|
||||
}
|
||||
|
||||
} else {
|
||||
log_message('error', 'STEP 3: No clientId provided. Skipping client lookup.');
|
||||
}
|
||||
|
||||
$post_data = [
|
||||
'mobile_number' => $mobile_no,
|
||||
'client_short_name' => $client_short_name
|
||||
];
|
||||
if(!empty($email)){
|
||||
$post_data = [
|
||||
'email_id' => $email,
|
||||
'client_short_name' => $client_short_name
|
||||
];
|
||||
}else{
|
||||
$post_data = [
|
||||
'mobile_number' => $mobile_no,
|
||||
'client_short_name' => $client_short_name
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
log_message('error', 'STEP 5: Calling third-party API with payload: ' . json_encode($post_data));
|
||||
|
||||
@ -4427,22 +4489,152 @@ class EmployeeRestController extends AdminController
|
||||
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'];
|
||||
|
||||
|
||||
public function hrFileUploadMasters()
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'message' => 'File inception upload masters',
|
||||
'data' => $data
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return $this->failServerError($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function checkTpaApiEnable($policy_id = null, $api_name = null, $return_type = 'api')
|
||||
{
|
||||
$this->myLogger->logme('error', '--- START checkTpaApiEnable ---');
|
||||
|
||||
try {
|
||||
// Step 1: Handle input parameters
|
||||
if (empty($policy_id)) {
|
||||
$policy_id = $this->request->getGet('policy_id');
|
||||
$api_name = $this->request->getGet('api_name');
|
||||
log_message('error', "Input parameters fetched from GET: policy_id={$policy_id}, api_name={$api_name}");
|
||||
} else {
|
||||
log_message('error', "Input parameters received directly: policy_id={$policy_id}, api_name={$api_name}");
|
||||
}
|
||||
|
||||
// Step 2: Validate policy_id
|
||||
if (empty($policy_id)) {
|
||||
log_message('error', 'Policy ID is empty');
|
||||
if ($return_type == 'api') {
|
||||
return $this->respond(['status' => false, 'code' => 200, 'message' => 'Policy ID missing']);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Step 3: Fetch policy data
|
||||
log_message('error', "Fetching policy data for policy_id={$policy_id}");
|
||||
$policy_data = $this->clientPolicyModel
|
||||
->where('is_active', 1)
|
||||
->where('id', $policy_id)
|
||||
->first();
|
||||
|
||||
if (empty($policy_data)) {
|
||||
log_message('error', "Policy data not found for policy_id={$policy_id}");
|
||||
if ($return_type == 'api') {
|
||||
return $this->respond(['status' => false, 'code' => 200, 'message' => 'Policy data not found']);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Step 4: Check for TPA ID
|
||||
if (empty($policy_data['tpa_id'])) {
|
||||
log_message('error', "TPA ID not found for policy_id={$policy_id}");
|
||||
if ($return_type == 'api') {
|
||||
return $this->respond(['status' => false, 'code' => 200, 'message' => 'TPA ID not found']);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$tpa_id = $policy_data['tpa_id'];
|
||||
log_message('error', "Found TPA ID={$tpa_id} for policy_id={$policy_id}");
|
||||
|
||||
// Step 5: Check if API service is enabled
|
||||
log_message('error', "Checking TPA API service for TPA ID={$tpa_id} and API name={$api_name}");
|
||||
$tpaApiServiceModel = new TpaApiSeviceModel();
|
||||
$api_data = $tpaApiServiceModel
|
||||
->where('is_active', 1)
|
||||
->where('api_name', $api_name)
|
||||
->where('tpa_id', $tpa_id)
|
||||
->first();
|
||||
|
||||
if (!empty($api_data)) {
|
||||
log_message('error', "API '{$api_name}' is enabled for TPA ID={$tpa_id}");
|
||||
if ($return_type == 'api') {
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'API services enabled']);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
log_message('error', "API '{$api_name}' is NOT enabled for TPA ID={$tpa_id}");
|
||||
if ($return_type == 'api') {
|
||||
return $this->respond(['status' => false, 'code' => 200, 'message' => 'API services not enabled']);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
log_message('error', 'Exception in checkTpaApiEnable: ' . $th->getMessage());
|
||||
if ($return_type == 'api') {
|
||||
return $this->respond(['status' => false, 'code' => 500, 'message' => 'Internal Server Error']);
|
||||
}
|
||||
return false;
|
||||
} finally {
|
||||
log_message('error', '--- END checkTpaApiEnable ---');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getEcardURL()
|
||||
{
|
||||
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());
|
||||
}
|
||||
try{
|
||||
|
||||
$id = $this->request->getGet('id');
|
||||
$emp_code = $this->request->getGet('emp_code');
|
||||
$client_policy_id = $this->request->getGet('client_policy_id');
|
||||
$policy_no = $this->request->getGet('policy_no');
|
||||
|
||||
$employee_policy = $this->employeePolicyModel
|
||||
->select('employees.*, employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid , client_policy.tpa_id as tpa_primary_id ')
|
||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id', 'left')
|
||||
->where('employee_polices.employee_id',$id)
|
||||
->where('employee_polices.client_policy_id',$client_policy_id)
|
||||
->where('employee_polices.is_active', 1 )->findAll();
|
||||
|
||||
|
||||
|
||||
if(count($employee_policy) > 0)
|
||||
{
|
||||
if($employee_policy[0]['tpa_id'] != null)
|
||||
{
|
||||
if($employee_policy[0]['tpa_primary_id'] == 2)//Medi assist
|
||||
{
|
||||
$mediAssistController = new MediAssistApiController();
|
||||
$data['eCardDownload'] = $mediAssistController->EcardRequest( $emp_code, $policy_no );
|
||||
}else{
|
||||
$data['eCardDownload'] = base_url('download-e-card/') . $employee_policy[0]['rand_string'].'/1';
|
||||
}
|
||||
|
||||
} else {
|
||||
$data['eCardDownload'] = null;
|
||||
}
|
||||
}else{
|
||||
$data['eCardDownload'] = null;
|
||||
}
|
||||
|
||||
|
||||
return $this->respond(['status' => true,'message' => '','data' => $data]);
|
||||
|
||||
} catch(\Exception $e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1514,9 +1514,9 @@ class EmployeeServiceController extends AdminController
|
||||
->where('employees.client_id',$file['client_id'])
|
||||
->where('employees.client_branch_id',$file['client_branch_id'])
|
||||
->where('employee_polices.client_policy_id',$file['policy_id'])
|
||||
->where('employees.emp_status !=','truncated')
|
||||
->where('employees.emp_status','active')
|
||||
->where('employees.is_active', 1)
|
||||
->where('employee_polices.status !=','truncated')
|
||||
->where('employee_polices.status','active')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->first();
|
||||
|
||||
@ -1550,7 +1550,7 @@ class EmployeeServiceController extends AdminController
|
||||
$employee_policy = $this->employeePolicyModel
|
||||
->where('employee_id',$employee['id'])
|
||||
->where('client_policy_id',$file['policy_id'])
|
||||
->where('status !=','truncated')
|
||||
->where('status','active')
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
|
||||
@ -87,32 +87,32 @@ class ICICILombardController extends AdminController
|
||||
|
||||
|
||||
$body = [
|
||||
"PolicyNumber" => "4016/A/O/53130557/00/000",
|
||||
"PolicyNumber" => "4016/PPN/A/O/53167743/00/000",
|
||||
"CDBGAccountNumber" => "CD-MUM-0026",
|
||||
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440010",
|
||||
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440012",
|
||||
"MemberDetails" => [
|
||||
[
|
||||
"MemberEmpId" => "EMPID3625557",
|
||||
"MemberEmpId" => "EMPID3625559",
|
||||
"DOJ" => "21-MAR-2019",
|
||||
"InsuredName" => "Kumar",
|
||||
"DOB" => "7-JUL-1983",
|
||||
"InsuredName" => "Gowtham",
|
||||
"DOB" => "7-JUL-1993",
|
||||
"Relationship" => "SELF",
|
||||
"Gender" => "MALE",
|
||||
"DOC" => "05-SEP-2025",
|
||||
"DOC" => '2025-10-27',
|
||||
"SumInsured" => "400000",
|
||||
"EmailId" => "KUMAR@GMAIL.COM",
|
||||
"EmailId" => "Gowtham@GMAIL.COM",
|
||||
"FlagStatus" => "A"
|
||||
],
|
||||
[
|
||||
"MemberEmpId" => "EMPID3625557",
|
||||
"MemberEmpId" => "EMPID3625559",
|
||||
"DOJ" => "21-MAR-2019",
|
||||
"InsuredName" => "Saranya",
|
||||
"InsuredName" => "Lavanya",
|
||||
"DOB" => "8-AUG-1970",
|
||||
"Relationship" => "MOTHER",
|
||||
"Gender" => "FEMALE",
|
||||
"DOC" => "05-SEP-2025",
|
||||
"DOC" => '2025-10-27',
|
||||
"SumInsured" => "400000",
|
||||
"EmailId" => "Saranya@GMAIL.COM",
|
||||
"EmailId" => "Lavanya@GMAIL.COM",
|
||||
"FlagStatus" => "A"
|
||||
],
|
||||
]
|
||||
@ -148,9 +148,9 @@ class ICICILombardController extends AdminController
|
||||
// dd($headers);
|
||||
|
||||
$body = [
|
||||
"PolicyNumber" => "4016/A/O/53130557/00/000",
|
||||
"BatchId" => "3658147",
|
||||
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440010"
|
||||
"PolicyNumber" => "4016/PPN/A/O/53167743/00/000",
|
||||
"BatchId" => "3672146",
|
||||
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440012"
|
||||
];
|
||||
|
||||
$response = call_third_party_api($url, 'POST', $headers, $body, true);
|
||||
@ -182,9 +182,9 @@ class ICICILombardController extends AdminController
|
||||
];
|
||||
|
||||
$body = [
|
||||
"PolicyNumber" => "4016/A/51974976/00/000",
|
||||
"IMID" => "2345617878",
|
||||
"CorrelationId" => "86383c78-4c67-4e4d-9aa0-9f926fb0d55e"
|
||||
"PolicyNumber" => "4016/PPN/A/O/53167743/00/000",
|
||||
"IMID" => "3672145",
|
||||
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440011"
|
||||
];
|
||||
|
||||
$response = call_third_party_api($url, 'POST', $headers, $body, true);
|
||||
|
||||
@ -175,6 +175,10 @@ class JobWorker extends AdminController
|
||||
'type' => 'CC', // Handler Category
|
||||
'handler' => 'App\Controllers\EmployeeServiceController',
|
||||
],
|
||||
'GetBenefDetails' => [
|
||||
'type' => 'CC', // Handler Category
|
||||
'handler' => 'App\Controllers\MediAssistApiController',
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -344,10 +344,15 @@ class LeadsController extends BaseController
|
||||
$where = [];
|
||||
foreach ($search_data as $search_objects => $key) {
|
||||
if ($key != null && $key != '' && $key != 0 && $search_objects != 'is_dashboard') {
|
||||
$where[$search_objects] = $key;
|
||||
if($search_objects == 'status')
|
||||
{
|
||||
$where[('leads.'.$search_objects)] = $key;
|
||||
}else{
|
||||
$where[$search_objects] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// !dd($where);
|
||||
$data['lead_data_list'] = $this->leadsModel->getLeadDataForLising($where);
|
||||
|
||||
$html = view('leads_list', $data);
|
||||
|
||||
@ -354,6 +354,15 @@ class MasterController extends AdminController
|
||||
exit();
|
||||
}
|
||||
|
||||
public function getInsurerBranchList()
|
||||
{
|
||||
$id = $this->request->getPost('insurer_id');
|
||||
|
||||
$insurer_branch_list = $this->insurerBranchModel->where(['insurer_id' => $id, 'is_active' => 1])->findAll()??[];
|
||||
|
||||
return $this->response->setJSON([ 'data' => $insurer_branch_list ])->setStatusCode(200);
|
||||
}
|
||||
|
||||
public function editInsurerGeneralInfo()
|
||||
{
|
||||
$this->myLogger->logme('error','edit Insurer general info function called');
|
||||
|
||||
674
app/Controllers/MediAssistApiController.php
Normal file
674
app/Controllers/MediAssistApiController.php
Normal file
@ -0,0 +1,674 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\BatchFileModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
class MediAssistApiController extends BaseController
|
||||
{
|
||||
use ResponseTrait;
|
||||
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
public function SubmitClaim ($claimId = null){
|
||||
|
||||
helper('api');
|
||||
|
||||
// $url = ''. getenv('MEDI_ASSIST_API_BASE_URL').'/SubmitClaim';
|
||||
$url = getenv('MEDI_ASSIST_API_BASE_URL_CLAIMSUBMIT');
|
||||
$method = 'POST';
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Username:'. getenv('MEDI_ASSIST_API_USERNAME').'',
|
||||
'Password:'. getenv('MEDI_ASSIST_API_PASSWORD').'',
|
||||
];
|
||||
|
||||
|
||||
//Prepare body data
|
||||
$db = \Config\Database::connect();
|
||||
|
||||
//Prepare body data
|
||||
$db = \Config\Database::connect();
|
||||
// Fetch the data from DB
|
||||
$data = $db->table('ticket_master tm')
|
||||
->select('
|
||||
tm.id,
|
||||
tm.emp_mobile as mobileNo,
|
||||
tm.emp_mail as emailId,
|
||||
tm.doa as claimDateOfAdmission,
|
||||
tm.dod as claimDateOfDischarge,
|
||||
tm.hospital_name as hospName,
|
||||
tm.claim_amount as claimAmount,
|
||||
cp.policy_no as policyNo,
|
||||
e.id as empId,
|
||||
e.emp_code as memberId,
|
||||
tn.note as disease,
|
||||
tn.note as reasonForHospitalization,
|
||||
cf.url as fileName,
|
||||
cf.url as filePath
|
||||
')
|
||||
->join('employees e', 'e.id = tm.emp_id', 'left')
|
||||
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left')
|
||||
->join('ticket_notes tn', 'tn.ticket_id = tm.id', 'left')
|
||||
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 2 and cf.mime_type = 'application/pdf'", 'left')
|
||||
->where('tm.id', $claimId)
|
||||
->get()
|
||||
->getRowArray(); // single record
|
||||
|
||||
|
||||
// Map DB result to request body
|
||||
if ($data) {
|
||||
|
||||
$filePath = $data['filePath'] ?? '';
|
||||
|
||||
$filename = basename($filePath);
|
||||
|
||||
$fileDir = WRITEPATH . 'uploads/claim_files/'.$filename;
|
||||
|
||||
|
||||
if ($fileDir) {
|
||||
$downloadUrl = base_url('fileDownload?file_path=').$fileDir;
|
||||
} else {
|
||||
$downloadUrl = '';
|
||||
}
|
||||
|
||||
$body = [
|
||||
"policyNo" => $data['policyNo'] ?? "",
|
||||
"memberId" => $data['memberId'] ?? "",
|
||||
"mobileNo" => $data['mobileNo'] ?? "",
|
||||
"emailId" => $data['emailId'] ?? "",
|
||||
"claimDateOfAdmission" => $data['claimDateOfAdmission'] ?? "",
|
||||
"claimDateOfDischarge" => $data['claimDateOfDischarge'] ?? "",
|
||||
"hospName" => $data['hospName'] ?? "",
|
||||
"hospAddress" => $data['hospName'] ?? "", // If hospAddress not available, reuse hospName
|
||||
"reasonForHospitalization" => $data['reasonForHospitalization'] ?? "",
|
||||
"disease" => $data['disease'] ?? "",
|
||||
"claimAmount" => (float)($data['claimAmount'] ?? 0),
|
||||
"claimType" => "HOSPITALIZATION", // static value
|
||||
"claimSubmissionAttachments" => [
|
||||
"fileName" => $data['fileName'] ?? "",
|
||||
"filePath" => $downloadUrl ?? ""
|
||||
]
|
||||
];
|
||||
} else {
|
||||
$body = [];
|
||||
}
|
||||
|
||||
// dd($body);
|
||||
|
||||
// $body = [
|
||||
// "policyNo" => "570000/48/2025/286",
|
||||
// "memberId" => 4078919887,
|
||||
// "mobileNo" => "95000XXXXX",
|
||||
// "emailId" => "test@Medi.com",
|
||||
// "claimDateOfAdmission" => "2023-12-14",
|
||||
// "claimDateOfDischarge" => "2023-12-16",
|
||||
// "hospName" => "TestHosp",
|
||||
// "hospAddress" => "Testhosp",
|
||||
// "reasonForHospitalization" => "test",
|
||||
// "disease" => "testkediney",
|
||||
// "claimAmount" => 10,
|
||||
// "claimType" => "HOSPITALIZATION",
|
||||
// "claimSubmissionAttachments" => [
|
||||
// "fileName" => "Test.pdf",
|
||||
// "filePath" => "https://apiintegration.mediassist.in/IntegrationEcard/DownloadEcard/4078613742/Senthil Kumar P/556/5386"
|
||||
// ]
|
||||
// ];
|
||||
|
||||
$response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
|
||||
if($response['status'] != true){
|
||||
|
||||
log_message('error', 'TPA CLAIM PUSH FAILED | claimId: '.$claimId.' | response: '.json_encode($response));
|
||||
return;
|
||||
}
|
||||
|
||||
// return $this->response->setJSON($response);
|
||||
|
||||
$claimRef = $response['data']['claimReferenceNo'] ?? null;
|
||||
|
||||
if(!empty($claimRef)){
|
||||
|
||||
log_message('error', 'TPA CLAIM PUSH SUCCESS | claimId: '.$claimId.' | claimReferenceNo: '.$claimRef);
|
||||
|
||||
$db->table('ticket_master')
|
||||
->where('id',$claimId)
|
||||
->update([ 'tpa_claim_push_reference_no' => $claimRef ]);
|
||||
|
||||
return;
|
||||
|
||||
} else {
|
||||
log_message('error', 'TPA CLAIM PUSH SUCCESS BUT claimReferenceNo EMPTY | claimId: '.$claimId.' | response: '.json_encode($response));
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function EcardRequest ($employeeId = null, $policyNo = null){
|
||||
|
||||
helper('api');
|
||||
|
||||
// $url = ''. getenv('MEDI_ASSIST_API_BASE_URL').'/EcardUrl';
|
||||
$url = getenv('MEDI_ASSIST_API_BASE_URL_ECARDREQUEST');
|
||||
$method = 'POST';
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Username:'. getenv('MEDI_ASSIST_API_USERNAME').'',
|
||||
'Password:'. getenv('MEDI_ASSIST_API_PASSWORD').'',
|
||||
];
|
||||
|
||||
$body = [
|
||||
"employeeId" => $employeeId,
|
||||
"policyNo" => $policyNo
|
||||
];
|
||||
|
||||
// $body = [
|
||||
// "employeeId" => "CITPL120006",
|
||||
// "policyNo" => "97000063250400000031"
|
||||
// ];
|
||||
|
||||
$response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
if($response['status'] != true){
|
||||
log_message('error', 'Ecard Request FAILED | employeeId: '.$employeeId.' | policyNo: '.$policyNo.' | response: '.json_encode($response));
|
||||
return null;
|
||||
}
|
||||
|
||||
$ecardUrl = $response['data']['ecardUrl'] ?? null;
|
||||
|
||||
if(!empty($ecardUrl)){
|
||||
log_message('error', 'Ecard Request PUSH SUCCESS | employeeId: '.$employeeId.' | policyNo: '.$policyNo.' | ecardUrl: '.$ecardUrl);
|
||||
return $ecardUrl;
|
||||
} else {
|
||||
log_message('error', 'Ecard Request SUCCESS BUT ecardUrl EMPTY | employeeId: '.$employeeId.' | policyNo: '.$policyNo.' | response: '.json_encode($response));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function GetBenefDetails($requestData)
|
||||
{
|
||||
helper('api');
|
||||
|
||||
$function_calling_type = $requestData['return_type'] ?? 'job';
|
||||
|
||||
try {
|
||||
|
||||
// $url = getenv('MEDI_ASSIST_API_BASE_URL') . '/GetBenefDetails';
|
||||
$url = getenv('MEDI_ASSIST_API_BASE_URL_FETCHTPA');
|
||||
$method = 'POST';
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Username:' . getenv('MEDI_ASSIST_API_USERNAME'),
|
||||
'Password:' . getenv('MEDI_ASSIST_API_PASSWORD'),
|
||||
];
|
||||
|
||||
$policyNo = $requestData['policy_no'] ?? null;
|
||||
$client_policy_id = $requestData['client_policy_id'] ?? null;
|
||||
|
||||
if (empty($policyNo)) {
|
||||
log_message('error', 'GetBenefDetails: policy_no missing in request');
|
||||
if($function_calling_type == "job"){
|
||||
return ['status' => false, 'message' => 'policy_no required'];
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'message' => 'policy_no required']);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($client_policy_id)) {
|
||||
log_message('error', 'GetBenefDetails: client_policy_id missing in request');
|
||||
if($function_calling_type == "job"){
|
||||
return ['status' => false, 'message' => 'client_policy_id required'];
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'message' => 'client_policy_id required']);
|
||||
}
|
||||
}
|
||||
|
||||
log_message('error', "GetBenefDetails called for policy_no: {$policyNo}");
|
||||
log_message('error', "GetBenefDetails called for client_policy_id: {$client_policy_id}");
|
||||
|
||||
$employeePolicyModel = new EmployeePolicyModel();
|
||||
$employeePolicyData = $employeePolicyModel
|
||||
->select('
|
||||
employees.*,
|
||||
employee_polices.id as emp_policy_id,
|
||||
employee_polices.client_policy_id,
|
||||
')
|
||||
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employee_polices.status', 'active')
|
||||
->where('employees.is_active', 1)
|
||||
->where('employees.emp_status', 'active')
|
||||
->where('employee_polices.tpa_id IS NULL')
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
->findAll();
|
||||
|
||||
if (empty($employeePolicyData)) {
|
||||
log_message('error', 'GetBenefDetails: employeePolicyData is empty');
|
||||
if($function_calling_type == "job"){
|
||||
return ['status' => false, 'message' => 'employeePolicyData not found'];
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'message' => 'employeePolicyData not found']);
|
||||
}
|
||||
}
|
||||
|
||||
$allBenef = [];
|
||||
$startIndex = 0;
|
||||
$range = 100;
|
||||
$totalCount = 0;
|
||||
|
||||
do {
|
||||
$body = [
|
||||
"policyNo" => $policyNo,
|
||||
"startDate" => "",
|
||||
"endDate" => "",
|
||||
"isDeActivedata" => false,
|
||||
"startIndex" => $startIndex,
|
||||
"range" => $range,
|
||||
"employeeId" => ""
|
||||
];
|
||||
|
||||
log_message('error', "GetBenefDetails API Request (startIndex={$startIndex}): " . json_encode($body));
|
||||
log_message('error', "GetBenefDetails API parems " . json_encode([$url, $method, $headers, $body]));
|
||||
|
||||
$response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
if ($response['status'] != true) {
|
||||
|
||||
// update file table status after the tpa id failed to update
|
||||
if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
|
||||
$file_model = new BatchFileModel();
|
||||
$file_model->where('id', $requestData['file_id'])->set('status', 'failed-8')->update();
|
||||
log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
|
||||
} else {
|
||||
log_message('error', "Failed to update file table status.");
|
||||
}
|
||||
|
||||
log_message('error', 'GetBenefDetails API failed: ' . json_encode($response));
|
||||
|
||||
if($function_calling_type == "job"){
|
||||
return ['status' => false, 'message' => 'API call failed', 'data' => $response];
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'message' => 'API call failed', 'data' => $response]);
|
||||
}
|
||||
}
|
||||
|
||||
$data = $response['data'] ?? [];
|
||||
|
||||
if (!isset($data['benefDetails'])) {
|
||||
log_message('error', "GetBenefDetails: 'benefDetails' missing in API response: " . json_encode($data));
|
||||
break;
|
||||
}
|
||||
|
||||
$count = $data['count'] ?? 0;
|
||||
$totalCount = $count;
|
||||
$fetchedCount = count($data['benefDetails']);
|
||||
|
||||
log_message('error', "Fetched {$fetchedCount} records (startIndex={$startIndex}) of total {$count}");
|
||||
|
||||
$allBenef = array_merge($allBenef, $data['benefDetails']);
|
||||
|
||||
$startIndex += $range;
|
||||
} while ($startIndex < $totalCount);
|
||||
|
||||
// now update DB
|
||||
$db = \Config\Database::connect();
|
||||
$updated = 0;
|
||||
|
||||
foreach ($employeePolicyData as $policy_data) {
|
||||
foreach ($allBenef as $row) {
|
||||
|
||||
// log_message(
|
||||
// "error",
|
||||
// "POLICY MATCH CHECK: " . json_encode([
|
||||
// 'policy_data' => [
|
||||
// 'name' => $policy_data['name'] ?? null,
|
||||
// 'emp_code' => $policy_data['emp_code'] ?? null,
|
||||
// 'relationship' => $policy_data['relationship'] ?? null,
|
||||
// 'gender' => $policy_data['gender'] ?? null,
|
||||
// 'dob' => $policy_data['dob'] ?? null,
|
||||
// ],
|
||||
// 'row_data' => [
|
||||
// 'benefName' => $row['benefName'] ?? null,
|
||||
// 'priBenefEmpCode' => $row['priBenefEmpCode'] ?? null,
|
||||
// 'relName' => $row['relName'] ?? null,
|
||||
// 'benefSex' => $row['benefSex'] ?? null,
|
||||
// 'benefDOB' => $row['benefDOB'] ?? null,
|
||||
// 'benefDOB_fmt' => change_date_format($row['benefDOB'],'d/m/Y H:i:s') ?? null,
|
||||
// ],
|
||||
// ])
|
||||
// );
|
||||
|
||||
if (
|
||||
strtolower(trim($policy_data['name'] ?? '')) == strtolower(trim($row['benefName'] ?? '')) &&
|
||||
($policy_data['emp_code'] ?? '') == ($row['priBenefEmpCode'] ?? '') &&
|
||||
strtolower(trim($policy_data['relationship'] ?? '')) == strtolower(trim($row['relName'] ?? '')) &&
|
||||
($policy_data['gender'] ?? '') == ($row['benefSex'] ?? '') &&
|
||||
($policy_data['dob'] ?? '') == (change_date_format($row['benefDOB'], 'd/m/Y H:i:s') ?? '')
|
||||
) {
|
||||
|
||||
log_message('error', "✅ Match found: emp_code={$row['priBenefEmpCode']} policy={$row['polNo']}");
|
||||
|
||||
$sql = "UPDATE employee_polices
|
||||
SET tpa_id = ?
|
||||
WHERE id = ?";
|
||||
$db->query($sql, [$row['benefMediAssistID'], $policy_data['emp_policy_id']]);
|
||||
|
||||
|
||||
if ($db->affectedRows() > 0) {
|
||||
$updated++;
|
||||
log_message('error', "✅ Updated tpa_id={$row['benefMediAssistID']} for emp_code={$row['priBenefEmpCode']} policy={$row['polNo']}");
|
||||
} else {
|
||||
log_message('error', "⚠️ No update (already set or not matched) for emp_code={$row['priBenefEmpCode']} policy={$row['polNo']}");
|
||||
}
|
||||
|
||||
}else{
|
||||
log_message('error', "❌ Not matched: emp_code={$row['priBenefEmpCode']} policy={$row['polNo']}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update file table status after the tpa id successfully updated
|
||||
if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
|
||||
$file_model = new BatchFileModel();
|
||||
$file_model->where('id', $requestData['file_id'])->set('status', 'success')->update();
|
||||
log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
|
||||
} else {
|
||||
log_message('error', "Failed to update file table status.");
|
||||
}
|
||||
|
||||
|
||||
log_message('error', "GetBenefDetails completed. Total fetched={$totalCount}, updated={$updated}");
|
||||
|
||||
if($function_calling_type == "job"){
|
||||
return [
|
||||
'status' => true,
|
||||
'message' => 'Updated successfully',
|
||||
'total_fetched' => $totalCount,
|
||||
'total_updated' => $updated
|
||||
];
|
||||
}else{
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'message' => 'Updated successfully',
|
||||
'total_fetched' => $totalCount,
|
||||
'total_updated' => $updated
|
||||
]);
|
||||
}
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
|
||||
// update file table status after the tpa id failed to update
|
||||
if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
|
||||
$file_model = new BatchFileModel();
|
||||
$file_model->where('id', $requestData['file_id'])->set('status', 'failed-8')->update();
|
||||
log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
|
||||
} else {
|
||||
log_message('error', "Failed to update file table status.");
|
||||
}
|
||||
|
||||
$errorData = [
|
||||
'message' => $th->getMessage(),
|
||||
'file' => $th->getFile(),
|
||||
'line' => $th->getLine(),
|
||||
'code' => $th->getCode(),
|
||||
'trace' => $th->getTraceAsString(),
|
||||
'trace_array' => $th->getTrace(), // full array version (optional)
|
||||
'function' => $th->getTrace()[0]['function'] ?? null,
|
||||
'class' => $th->getTrace()[0]['class'] ?? null,
|
||||
];
|
||||
|
||||
log_message('error', 'Exception thrown while calling GetBenefDetails API: ' . json_encode($errorData));
|
||||
if($function_calling_type == "job"){
|
||||
return ['status' => false, 'message' => 'API call failed', 'data' => $errorData];
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'message' => 'API call failed', 'data' => $errorData]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// public function GetBenefDetails (){
|
||||
|
||||
// $postData = $this->request->getJSON(true);
|
||||
|
||||
// helper('api');
|
||||
|
||||
// $url = ''. getenv('MEDI_ASSIST_API_BASE_URL').'/GetBenefDetails';
|
||||
// $method = 'POST';
|
||||
|
||||
// $headers = [
|
||||
// 'Content-Type: application/json',
|
||||
// 'Username:'. getenv('MEDI_ASSIST_API_USERNAME').'',
|
||||
// 'Password:'. getenv('MEDI_ASSIST_API_PASSWORD').'',
|
||||
// ];
|
||||
|
||||
// $body = [
|
||||
// "policyNo" => $$postData['policy_no'],
|
||||
// "startDate" => "",
|
||||
// "endDate" => "",
|
||||
// "isDeActivedata" => false,
|
||||
// "startIndex" => 0,
|
||||
// "range" => 100 ,
|
||||
// "employeeId" => ""
|
||||
// ];
|
||||
|
||||
// // $body = [
|
||||
// // "policyNo" => "97000063250400000031",
|
||||
// // "startDate" => "",
|
||||
// // "endDate" => "",
|
||||
// // "isDeActivedata" => false,
|
||||
// // "startIndex" => 0,
|
||||
// // "range" => 100 ,
|
||||
// // "employeeId" => ""
|
||||
// // ];
|
||||
|
||||
// $response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
|
||||
// if($response['status'] != true){
|
||||
// return $this->response->setJSON([
|
||||
// 'status' => false,
|
||||
// 'message' => 'failed.',
|
||||
// 'data' => $response
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// return $this->response->setJSON($response);
|
||||
|
||||
// }
|
||||
|
||||
public function ClaimDetail (){
|
||||
|
||||
|
||||
helper('api');
|
||||
|
||||
$url = ''. getenv('MEDI_ASSIST_API_BASE_URL').'/ClaimDetail';
|
||||
$method = 'POST';
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Username:'. getenv('MEDI_ASSIST_API_USERNAME').'',
|
||||
'Password:'. getenv('MEDI_ASSIST_API_PASSWORD').'',
|
||||
];
|
||||
|
||||
$body = [
|
||||
"policyNo" => "97000063250400000031",
|
||||
"startDate" => "",
|
||||
"endDate" => "",
|
||||
"employeeCode" => "CITPL120193",
|
||||
"memberID" => "",
|
||||
"claimNo" => "",
|
||||
"claimRefNo" => ""
|
||||
];
|
||||
|
||||
$response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
|
||||
if($response['status'] != true){
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'failed.',
|
||||
'data' => $response
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function HospitalNetwork (){
|
||||
|
||||
$postData = $this->request->getJSON(true);
|
||||
|
||||
helper('api');
|
||||
|
||||
$url = ''. getenv('MEDI_ASSIST_API_BASE_URL').'/NetworkHospital';
|
||||
$method = 'POST';
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Username:'. getenv('MEDI_ASSIST_API_USERNAME').'',
|
||||
'Password:'. getenv('MEDI_ASSIST_API_PASSWORD').'',
|
||||
];
|
||||
|
||||
$body = [
|
||||
"startIndex" => 0,
|
||||
"endIndex" => 10,
|
||||
"policyNumber" => "97000063250400000031"
|
||||
];
|
||||
|
||||
$response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
|
||||
if($response['status'] != true){
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'failed.',
|
||||
'data' => $response
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
|
||||
}
|
||||
|
||||
public function IntimateClaim (){
|
||||
|
||||
$postData = $this->request->getJSON(true);
|
||||
|
||||
helper('api');
|
||||
|
||||
// $url = ''. getenv('MEDI_ASSIST_API_BASE_URL').'/ClaimAPIServiceUAT/Claim/IntimateClaim';
|
||||
$url = "https://apiintegration.mediassist.in/ClaimAPIServiceUAT/Claim/IntimateClaim";
|
||||
$method = 'POST';
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Username:' .'NhanceUsr',
|
||||
'Password:' .'NhU$p&Cc5wGQbr2',
|
||||
];
|
||||
|
||||
|
||||
$p = 'NhU$p&Cc5wGQbr2';
|
||||
$body = [
|
||||
"Username" => "NhanceUsr",
|
||||
"Password" => $p,
|
||||
"policyNo" => "570000/48/2025/286",
|
||||
"memberId" => 4078919887,
|
||||
"DateOfAdmisssion" => date('Y-m-d', strtotime('2023-12-14')),
|
||||
"HospitalName" => "test",
|
||||
"AilmentDescription" => "Kidney",
|
||||
"ContactNo" => "78745XXXXX"
|
||||
];
|
||||
|
||||
$response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
|
||||
if($response['status'] != true){
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'failed.',
|
||||
'data' => $response
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
|
||||
}
|
||||
|
||||
public function IRSubmission (){
|
||||
|
||||
$postData = $this->request->getJSON(true);
|
||||
|
||||
helper('api');
|
||||
|
||||
// $url = ''. getenv('MEDI_ASSIST_API_BASE_URL').'/ClaimAPIServiceUAT/Claim/IRSubmission';
|
||||
$url = "https://apiintegration.mediassist.in/ClaimAPIServiceUAT/Claim/IRSubmission";
|
||||
$method = 'POST';
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Username:' .'NhanceUsr',
|
||||
'Password:' .'NhU$p&Cc5wGQbr2',
|
||||
];
|
||||
|
||||
$body = [
|
||||
"ClaimID" => "134431104",
|
||||
"Attachments" => [
|
||||
"AttachmentName" => "Test.pdf",
|
||||
"AttachmentPath" => "https://apiintegration.mediassist.in/IntegrationEcard/DownloadEcard/4078613742/Senthil Kumar P/556/5386"
|
||||
]
|
||||
];
|
||||
|
||||
$response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
|
||||
if($response['status'] != true){
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'failed.',
|
||||
'data' => $response
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function fileDownload()
|
||||
{
|
||||
|
||||
$filePath = $this->request->getGet('file_path');
|
||||
$filename = basename($filePath);
|
||||
|
||||
// Return file as download
|
||||
return $this->response->download($filePath, null)->setFileName($filename);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -3,6 +3,7 @@
|
||||
// declare(strict_types=1);
|
||||
|
||||
namespace App\Controllers;
|
||||
use App\Models\CommonEMailModel;
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
@ -28,13 +29,16 @@ class NotificationController extends AdminController
|
||||
protected $notificationModel;
|
||||
protected $clientModel;
|
||||
protected $MailAttachmentModel;
|
||||
|
||||
protected $CommonEMailModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
$this->notificationModel = new NotificationModel();
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->MailAttachmentModel = new MailAttachmentModel();
|
||||
$this->MailAttachmentModel = new MailAttachmentModel();
|
||||
$this->CommonEMailModel = new CommonEMailModel();
|
||||
}
|
||||
|
||||
// This is for Template Name Camel Case to Snake Case for store in DB
|
||||
@ -53,33 +57,38 @@ class NotificationController extends AdminController
|
||||
$form_data['mail_content'] = $this->request->getPost('mailContent');
|
||||
$form_data['client_id'] = $this->request->getPost('client_id');
|
||||
$form_data['mail_content_json'] = $this->request->getPost('mailJson');
|
||||
$form_data['common_mail'] = $this->request->getPost('common_mail')??'';
|
||||
$notificationModel = new NotificationModel();
|
||||
|
||||
$find_notification = $notificationModel->where('client_id',$form_data['client_id'])->where('template_name',$form_data['template_name'])->first();
|
||||
|
||||
if ($find_notification) {
|
||||
$this->logger->debug("inside notification update");
|
||||
|
||||
$id = $find_notification['id'];
|
||||
$id = $find_notification['id'] ?? '';
|
||||
$form_data['updated_by'] = get_session_userid();
|
||||
$notificationModel->update($id,$form_data);
|
||||
$complete = "Update";
|
||||
|
||||
}else{
|
||||
$this->logger->debug("inside notification insert");
|
||||
|
||||
$form_data['created_by'] = get_session_userid();
|
||||
$notificationModel->insert($form_data);
|
||||
$id = $notificationModel->insert($form_data);
|
||||
$complete = "Inserted";
|
||||
}
|
||||
|
||||
return json_encode($complete);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// This is for the Enabls in Notification area and Update the Recipient and HR Mail Id in( Enables -> Notification table and Mail id's -> Client table)
|
||||
public function update_enable()
|
||||
{
|
||||
$checkboxNames = [
|
||||
'member_welcome_mail_btn',
|
||||
'common_mail_btn',
|
||||
'member_reminder_mail_btn',
|
||||
'member_ecard_mail_btn',
|
||||
'member_review_and_summary_mail_btn',
|
||||
@ -144,11 +153,18 @@ class NotificationController extends AdminController
|
||||
public function getMailTemplateData($template_name,$client_id)
|
||||
{
|
||||
$notificationModel = new NotificationModel();
|
||||
$value = $notificationModel->where('client_id',$client_id)->where('template_name',$template_name)->first();
|
||||
if($value){
|
||||
$value['data'] = $this->MailAttachmentModel->where('notification_id', $value['id'])->where('is_active', 1)->findAll();
|
||||
$value = $notificationModel->where('client_id',$client_id)->where('template_name',$template_name)->first()??[];
|
||||
if(!empty($value)){
|
||||
$value['data'] = $this->MailAttachmentModel->where('notification_id', $value['id'])->where('is_active', 1)->findAll()??[];
|
||||
}
|
||||
// return $this->respond(['status' => true, 'code' => 200, '' => 'Attachment deleted successfully'], 200);
|
||||
|
||||
if( isset($value['template_name']) && !empty($value['template_name']) && $value['template_name'] == "member_common_mail"){
|
||||
$common_mails = $value['common_mail']??[];
|
||||
$value['comman_mails'] = !empty($common_mails) ? $common_mails : "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return json_encode($value);
|
||||
}
|
||||
@ -235,6 +251,51 @@ class NotificationController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function sendCommonTestMail()
|
||||
{
|
||||
|
||||
$template_id = $this->request->getPost('template_id');
|
||||
|
||||
$test_mail = $this->request->getPost('test_mail');
|
||||
|
||||
$test_mail_list = $this->request->getPost('test_mail_list');
|
||||
|
||||
|
||||
$notification_data = $this->notificationModel->where('id', $template_id)->first();
|
||||
$client_data = $this->clientModel->where('id', $notification_data['client_id'])->where('is_active', 1)->first();
|
||||
|
||||
if(!empty($notification_data)){
|
||||
|
||||
$params = [
|
||||
'client_data' => $client_data,
|
||||
'notification_data' => $notification_data,
|
||||
'test_mail' => $test_mail,
|
||||
'test_mail_list' => $test_mail_list
|
||||
];
|
||||
|
||||
$testMailData = sendMailNotification::sendMailNotificationForTesting($notification_data['template_name'], $params);
|
||||
// print_r($testMailData); die;
|
||||
if (!empty($testMailData)) {
|
||||
|
||||
$mail_send_return1 = MailHelper::send_email($testMailData);
|
||||
$this->myLogger->logme("info", $mail_send_return1);
|
||||
$this->myLogger->logme("info", $mail_send_return1);
|
||||
|
||||
return $this->respond(['status' => true,'code' => 200, 'respond' => json_decode($mail_send_return1)]);
|
||||
|
||||
}else{
|
||||
|
||||
return $this->respond(['status' => false,'code' => 200, 'message' => 'Test Mail Data Does Not Exist']);
|
||||
}
|
||||
}else{
|
||||
|
||||
return $this->respond(['status' => false,'code' => 200, 'message' => 'Notification Template not enabled']);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function insertAttachmentsForMailTemplates()
|
||||
{
|
||||
$form_data = $this->request->getPost();
|
||||
|
||||
@ -3283,6 +3283,8 @@
|
||||
$where ?? ''
|
||||
);
|
||||
|
||||
$data['list_new'] = true;
|
||||
|
||||
// 🧩 Load View
|
||||
$this->loadLayout('report_bds_filter', $data);
|
||||
}
|
||||
|
||||
@ -869,6 +869,7 @@ class RestAuthenticationController extends AdminController
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
|
||||
|
||||
}
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - saveMpin: Exception: " . $th->getMessage() . " --- Line: " . $th->getLine() . " --- Trace: " . $th->getTraceAsString());
|
||||
log_message('error', ' ');
|
||||
@ -1496,4 +1497,460 @@ class RestAuthenticationController extends AdminController
|
||||
return $this->fail("Invalid Token: " . $e->getMessage(), 401);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------- PASSWORD API'S -------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public function savePassword()
|
||||
{
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* POST START **************************************** ');
|
||||
log_message('error', ' ');
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - savePassword: Function called");
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - savePassword: Received payload = " . json_encode($this->request->getJSON() ?? []));
|
||||
|
||||
try {
|
||||
|
||||
$payload = $this->request->getJSON();
|
||||
$mobile_number = $payload->mobile_number ?? null;
|
||||
$email_id = $payload->email_id ?? null;
|
||||
$client_id = $payload->client_id ?? null;
|
||||
$plain_password = $payload->password ?? null;
|
||||
|
||||
if (empty($plain_password)) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'message' => 'Password cannot be empty'], 400);
|
||||
}
|
||||
|
||||
// Build employee query
|
||||
if ($mobile_number) {
|
||||
|
||||
$builder = $this->employeeModel
|
||||
->select('employees.*')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.mobile', $mobile_number)
|
||||
->where('employees.relationship', 'Self')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->whereIn('employee_polices.status', ['active', 'expired'])
|
||||
->where('employees.is_active', 1)
|
||||
->whereIn('employees.emp_status', ['active', 'expired']);
|
||||
if (!empty($client_id)) $builder->where('employees.client_id', $client_id);
|
||||
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||
|
||||
} else {
|
||||
|
||||
$builder = $this->employeeModel
|
||||
->select('employees.*')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.email_corporate', $email_id)
|
||||
->where('employees.relationship', 'Self')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->whereIn('employee_polices.status', ['active', 'expired'])
|
||||
->where('employees.is_active', 1)
|
||||
->whereIn('employees.emp_status', ['active', 'expired']);
|
||||
if (!empty($client_id)) $builder->where('employees.client_id', $client_id);
|
||||
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||
|
||||
}
|
||||
|
||||
$lastQuery = $this->employeeModel->db->getLastQuery();
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - savePassword: Last Executed Query: " . $lastQuery);
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - savePassword: employeeData: " . json_encode($employeeData ?? []));
|
||||
|
||||
if ($employeeData) {
|
||||
$id = $employeeData['id'];
|
||||
$hashedPassword = password_hash($plain_password, PASSWORD_DEFAULT);
|
||||
|
||||
$updateData = [
|
||||
'password' => $hashedPassword,
|
||||
];
|
||||
|
||||
$updated = $this->employeeModel->where('id', $id)->set($updateData)->update();
|
||||
|
||||
if ($updated) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - savePassword: Password saved successfully");
|
||||
$result = ['user_verification' => true, 'message' => "Password saved successfully"];
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
||||
} else {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - savePassword: Password save failed");
|
||||
$result = ['user_verification' => true, 'message' => "Password not saved"];
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $result], 200);
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - savePassword: Employee not found");
|
||||
$result = ['user_verification' => false, 'message' => "User not found"];
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - savePassword: Exception: " . $th->getMessage() . " --- Line: " . $th->getLine() . " --- Trace: " . $th->getTraceAsString());
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'message' => $th->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function changePassword()
|
||||
{
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* CHANGE PASSWORD START **************************************** ');
|
||||
log_message('error', ' ');
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - changePassword: Function called");
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - changePassword: Received payload = " . json_encode($this->request->getJSON() ?? []));
|
||||
|
||||
try {
|
||||
$payload = $this->request->getJSON(true);
|
||||
|
||||
$mobile_number = $payload['mobile_number'] ?? null;
|
||||
$email_id = $payload['email_id'] ?? null;
|
||||
$client_id = $payload['client_id'] ?? null;
|
||||
$otp = $payload['otp'] ?? null;
|
||||
$new_password = $payload['new_password'] ?? null;
|
||||
|
||||
if (empty($otp) || empty($new_password)) {
|
||||
return $this->respond([
|
||||
'status' => 'failed',
|
||||
'code' => 400,
|
||||
'message' => 'OTP and new password are required'
|
||||
], 400);
|
||||
}
|
||||
|
||||
// Fetch employee details
|
||||
$builder = $this->employeeModel
|
||||
->select('employees.*')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.relationship', 'Self')
|
||||
->where('employees.is_active', 1)
|
||||
->whereIn('employees.emp_status', ['active'])
|
||||
->where('employee_polices.is_active', 1)
|
||||
->whereIn('employee_polices.status', ['active']);
|
||||
|
||||
if (!empty($client_id)) $builder->where('employees.client_id', $client_id);
|
||||
|
||||
if ($mobile_number) {
|
||||
$builder->where('employees.mobile', $mobile_number);
|
||||
} elseif ($email_id) {
|
||||
$builder->where('employees.email_corporate', $email_id);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => 'failed',
|
||||
'code' => 400,
|
||||
'message' => 'Mobile number or Email ID is required'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - changePassword: employeeData: " . json_encode($employeeData ?? []));
|
||||
|
||||
if (!$employeeData) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => 'User not found'], 404);
|
||||
}
|
||||
|
||||
// Check OTP validity (assuming fields: otp, otp_expiry exist)
|
||||
if (empty($employeeData['otp']) || $employeeData['otp'] != $otp) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 401, 'message' => 'Invalid OTP'], 200);
|
||||
}
|
||||
|
||||
if (!empty($employeeData['otp_expiry']) && strtotime($employeeData['otp_expiry']) < time()) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 401, 'message' => 'OTP expired'], 200);
|
||||
}
|
||||
|
||||
// Hash new password
|
||||
$newHashedPassword = password_hash($new_password, PASSWORD_DEFAULT);
|
||||
|
||||
// Update password and clear OTP
|
||||
$updated = $this->employeeModel->update($employeeData['id'], [
|
||||
'password' => $newHashedPassword,
|
||||
'otp' => null,
|
||||
]);
|
||||
|
||||
if ($updated) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - changePassword: Password updated successfully");
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* CHANGE PASSWORD END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'code' => 200,
|
||||
'message' => 'Password changed successfully'
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => 'failed',
|
||||
'code' => 500,
|
||||
'message' => 'Failed to update password'
|
||||
], 500);
|
||||
}
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - changePassword: Exception: " . $th->getMessage());
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* CHANGE PASSWORD END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'message' => $th->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function verifyPassword()
|
||||
{
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* POST START **************************************** ');
|
||||
log_message('error', ' ');
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - Verify Password: Function called");
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyPassword: Received payload = " . json_encode($this->request->getJSON() ?? []));
|
||||
|
||||
try {
|
||||
$requestData = $this->request->getJSON(true);
|
||||
|
||||
$mobile_number = $requestData['mobile_number'] ?? null;
|
||||
$email_id = $requestData['email_id'] ?? null;
|
||||
$password = $requestData['password'] ?? null;
|
||||
$client_id = $requestData['client_id'] ?? null;
|
||||
|
||||
if (!$password) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'data' => "", 'message' => 'Password is required'], 400);
|
||||
}
|
||||
|
||||
// 🔹 Fetch employee data
|
||||
if ($mobile_number) {
|
||||
$builder = $this->employeeModel
|
||||
->select('employees.*')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.mobile', $mobile_number)
|
||||
->where('employees.relationship', 'Self')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->whereIn('employee_polices.status', ['active'])
|
||||
->where('employees.is_active', 1)
|
||||
->whereIn('employees.emp_status', ['active']);
|
||||
|
||||
if (!empty($client_id)) {
|
||||
$builder->where('employees.client_id', $client_id);
|
||||
}
|
||||
|
||||
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||
} elseif ($email_id) {
|
||||
$builder = $this->employeeModel
|
||||
->select('employees.*')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.email_corporate', $email_id)
|
||||
->where('employees.relationship', 'Self')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->whereIn('employee_polices.status', ['active'])
|
||||
->where('employees.is_active', 1)
|
||||
->whereIn('employees.emp_status', ['active']);
|
||||
|
||||
if (!empty($client_id)) {
|
||||
$builder->where('employees.client_id', $client_id);
|
||||
}
|
||||
|
||||
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||
} else {
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'data' => "", 'message' => 'Mobile number or Email ID is required'], 400);
|
||||
}
|
||||
|
||||
$lastQuery = $this->employeeModel->db->getLastQuery();
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyPassword: Last Executed Query: " . $lastQuery);
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyPassword: employeeData: " . json_encode($employeeData ?? []));
|
||||
|
||||
// 🔹 Verify password hash
|
||||
if ($employeeData && isset($employeeData['password']) && password_verify($password, $employeeData['password'])) {
|
||||
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyPassword: Verified employee found");
|
||||
|
||||
// ✅ Log authentication info
|
||||
$auth = HttpRequestHelper::getRequestInfo();
|
||||
if ($auth) {
|
||||
$this->authHistoryModel->insert([
|
||||
'user_id' => $employeeData['id'],
|
||||
'user_type' => 'employee',
|
||||
'ip' => $auth['ip'],
|
||||
'platform' => $auth['platform'],
|
||||
'broswer' => $auth['browser'],
|
||||
]);
|
||||
}
|
||||
|
||||
// ✅ Generate JWT token
|
||||
$employeeData['token_type'] = "post";
|
||||
$token = JWTToken::encode($employeeData);
|
||||
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* POST END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $token], 200);
|
||||
} else {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyPassword: Invalid password or employee not found");
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* POST END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => "", 'message' => 'Invalid password'], 200);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyPassword: Exception: " . $e->getMessage() . " --- Line: " . $e->getLine());
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* POST END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => "", 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function sendChangePasswordOTP()
|
||||
{
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* SEND OTP START **************************************** ');
|
||||
log_message('error', ' ');
|
||||
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - sendChangePasswordOTP: Function called");
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - sendChangePasswordOTP: Received payload = " . json_encode($this->request->getJSON() ?? []));
|
||||
|
||||
try {
|
||||
$requestData = $this->request->getJSON(true);
|
||||
|
||||
$email_id = $requestData['email_id'] ?? null;
|
||||
$client_id = $requestData['client_id'] ?? null;
|
||||
|
||||
if (!$email_id) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'data' => "", 'message' => 'Email ID is required'], 400);
|
||||
}
|
||||
|
||||
// Get employee details
|
||||
$builder = $this->employeeModel
|
||||
->select('employees.id, employees.mobile, employees.email_corporate, employees.client_id')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.is_active', 1)
|
||||
->whereIn('employees.emp_status', ['active'])
|
||||
->where('employee_polices.is_active', 1)
|
||||
->whereIn('employee_polices.status', ['active'])
|
||||
->where('employees.relationship', 'Self');
|
||||
|
||||
if (!empty($client_id)) {
|
||||
$builder->where('employees.client_id', $client_id);
|
||||
}
|
||||
|
||||
if ($email_id) {
|
||||
$builder->where('employees.email_corporate', $email_id);
|
||||
}
|
||||
|
||||
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - sendChangePasswordOTP: Employee Data: " . json_encode($employeeData ?? []));
|
||||
|
||||
if (!$employeeData) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => "", 'message' => 'Employee not found'], 404);
|
||||
}
|
||||
|
||||
// Generate 6-digit OTP
|
||||
$otp = rand(100000, 999999);
|
||||
|
||||
// Save OTP to DB (assuming 'otp' and 'otp_expiry' columns exist)
|
||||
$this->employeeModel->update($employeeData['id'], [
|
||||
'otp' => $otp,
|
||||
]);
|
||||
|
||||
// Send OTP via SMS or Email (you can replace with your actual helper)
|
||||
if ($email_id) {
|
||||
// Example: MailHelper::sendMail($email_id, 'Password Change OTP', "Your OTP is {$otp}");
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - sendChangePasswordOTP: OTP {$otp} sent to email {$email_id}");
|
||||
}
|
||||
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* SEND OTP END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => ['otp_sent_to' => $email_id], 'message' => 'OTP sent successfully'], 200);
|
||||
} catch (\Exception $e) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - sendChangePasswordOTP: Exception: " . $e->getMessage() . " --- Line: " . $e->getLine());
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* SEND OTP END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => "", 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------- EMP MOBILE NUMBER UPDATE API'S -------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public function updateMobileNumber()
|
||||
{
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* UPDATE MOBILE START **************************************** ');
|
||||
log_message('error', ' ');
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Function called");
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Received payload = " . json_encode($this->request->getJSON() ?? []));
|
||||
|
||||
try {
|
||||
|
||||
$payload = $this->request->getJSON(true);
|
||||
|
||||
$email_id = $payload['email_id'] ?? null;
|
||||
$client_id = $payload['client_id'] ?? null;
|
||||
$new_mobile = $payload['new_mobile_number'] ?? null;
|
||||
|
||||
if (empty($email_id) || empty($new_mobile)) {
|
||||
return $this->respond([
|
||||
'status' => 'failed',
|
||||
'code' => 400,
|
||||
'message' => 'Email ID and new mobile number are required'
|
||||
], 400);
|
||||
}
|
||||
|
||||
// Fetch employee by email
|
||||
$builder = $this->employeeModel
|
||||
->select('employees.*')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.email_corporate', $email_id)
|
||||
->where('employees.relationship', 'Self')
|
||||
->where('employees.is_active', 1)
|
||||
->whereIn('employees.emp_status', ['active'])
|
||||
->where('employee_polices.is_active', 1)
|
||||
->whereIn('employee_polices.status', ['active']);
|
||||
|
||||
if (!empty($client_id)) {
|
||||
$builder->where('employees.client_id', $client_id);
|
||||
}
|
||||
|
||||
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: employeeData: " . json_encode($employeeData ?? []));
|
||||
|
||||
if (!$employeeData) {
|
||||
return $this->respond([
|
||||
'status' => 'failed',
|
||||
'code' => 404,
|
||||
'message' => 'User not found with this Email ID'
|
||||
], 404);
|
||||
}
|
||||
|
||||
// Update mobile number
|
||||
$updated = $this->employeeModel->update($employeeData['id'], [
|
||||
'mobile' => $new_mobile,
|
||||
]);
|
||||
|
||||
if ($updated) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Mobile number updated successfully");
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* UPDATE MOBILE END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'code' => 200,
|
||||
'message' => 'Mobile number updated successfully'
|
||||
], 200);
|
||||
} else {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Failed to update mobile number");
|
||||
return $this->respond([
|
||||
'status' => 'failed',
|
||||
'code' => 500,
|
||||
'message' => 'Failed to update mobile number'
|
||||
], 500);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateMobileNumber: Exception: " . $th->getMessage());
|
||||
log_message('error', ' ');
|
||||
log_message('error', ' ************************************* UPDATE MOBILE END **************************************** ');
|
||||
log_message('error', ' ');
|
||||
return $this->respond([
|
||||
'status' => 'failed',
|
||||
'code' => 500,
|
||||
'message' => $th->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -869,7 +869,7 @@ class TestingController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
public function createDefaultMailTempalteInDB()
|
||||
public function createDefaultMailTempalteInCrossDB()
|
||||
{
|
||||
$postDB = \Config\Database::connect(); // target DB
|
||||
$preDB = \Config\Database::connect('preDB'); // source DB
|
||||
@ -920,7 +920,66 @@ class TestingController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
return $this->response->setJSON(['message'=>"Created Default Mail Tempalte In DB "])->setStatusCode(200);
|
||||
return $this->response->setJSON(['message'=>"Created Default Mail Tempalte In Cross DB "])->setStatusCode(200);
|
||||
}
|
||||
|
||||
public function createDefaultMailTempalteInSameDB()
|
||||
{
|
||||
$postDB = \Config\Database::connect();
|
||||
|
||||
// Templates to copy
|
||||
$templateNames = [
|
||||
'member_welcome_mail',
|
||||
'member_reminder_mail',
|
||||
'member_review_and_summary_mail',
|
||||
'member_common_mail',
|
||||
'member_ecard_mail'
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
foreach ($templateNames as $template) {
|
||||
|
||||
$exists = $postDB->table('notifications')
|
||||
->where('client_id', NULL)
|
||||
->where('template_name', $template)
|
||||
->countAllResults();
|
||||
|
||||
if ($exists > 0 ) {
|
||||
continue; // Skip if already inserted
|
||||
}
|
||||
|
||||
// Fetch template from preDB
|
||||
$templateData = $postDB->table('notifications')
|
||||
|
||||
// this is where we want to replace 0 with the client id we want to replace
|
||||
->where('client_id', 0)
|
||||
|
||||
// template_name from which you want to create a common template from templateNames array.
|
||||
->where('template_name', $template)
|
||||
->get()
|
||||
->getRowArray();
|
||||
|
||||
if (!empty($templateData)) {
|
||||
|
||||
// Remove ID to avoid duplicate primary key issues
|
||||
unset($templateData['id']);
|
||||
|
||||
// Set created_by and timestamps if needed
|
||||
$templateData['client_id'] = NULL;
|
||||
$templateData['created_by'] = 1;
|
||||
$templateData['cretaed_at'] = date('Y-m-d H:i:s');
|
||||
$templateData['updated_by'] = NULL;
|
||||
$templateData['updated_at'] = NULL;
|
||||
|
||||
// Insert into postDB
|
||||
$postDB->table('notifications')->insert($templateData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $this->response->setJSON(['message'=>"Created Default Mail Tempalte In Same DB "])->setStatusCode(200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1056,6 +1056,7 @@ class TicketController extends BaseController
|
||||
$this->putHistoryAfterInsert($ticket_data, $return_value);
|
||||
$mail_responce = $this->sendAutoMailTrigger($return_value);
|
||||
$this->autoMessageInsertBasedOnMailResponse($mail_responce, $return_value);
|
||||
|
||||
return $this->respond(['status' => true, 'ticket_id' => $return_value, 'code' => 200, 'data' => $ticket_data, "message" => "Claim created successfully", 'mail_responce' => $mail_responce], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to create claim'], 200);
|
||||
@ -1281,8 +1282,12 @@ class TicketController extends BaseController
|
||||
// $actionType = $this->request->getGet();
|
||||
$claimFiles = new ClaimFilesModel();
|
||||
$file_data = $claimFiles->where('id', $claim_file_id)->first();
|
||||
$fileName = $file_data['doc_name'];
|
||||
// $fileName = $file_data['doc_name'];
|
||||
|
||||
$url = $file_data['url'];
|
||||
$parts = explode('/', $url);
|
||||
$fileName = end($parts);
|
||||
|
||||
$filePath = WRITEPATH . '/uploads/claim_files/' . $fileName;
|
||||
|
||||
try {
|
||||
@ -2222,7 +2227,8 @@ class TicketController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
public function feedbackList(){
|
||||
public function feedbackList()
|
||||
{
|
||||
|
||||
$data['feedback_data'] = $this->ticketMasterModel->select("ticket_master.*,clients.client_name")->join("clients","clients.id = ticket_master.client_id")->where("ticket_master.is_active",1)->where("ticket_master.feedback_json IS NOT NULL", null, false)->where("ticket_master.feedback_json !=", "")->findAll();
|
||||
$data['page_name'] = "Claims";
|
||||
@ -2230,7 +2236,8 @@ class TicketController extends BaseController
|
||||
$this->loadLayout("ticket_feedback_list",$data);
|
||||
}
|
||||
|
||||
public function getMoreInfo($requestFrom = null , $ticket_id = null) {
|
||||
public function getMoreInfo($requestFrom = null , $ticket_id = null)
|
||||
{
|
||||
|
||||
if($requestFrom == null){
|
||||
$ticket_id = $this->request->getPost('ticket_id');
|
||||
@ -2255,7 +2262,7 @@ class TicketController extends BaseController
|
||||
->groupBy("th.old_value, tcs.claim_status")
|
||||
->get()
|
||||
->getResultArray();
|
||||
// dd($ticket_previous_status);
|
||||
// dd($ticket_previous_status);
|
||||
// Loop through previous status and gather the required data
|
||||
foreach ($ticket_previous_status as $status) {
|
||||
// $this->myLogger->logme("error", "Status : " . json_encode($status));
|
||||
@ -2316,48 +2323,72 @@ class TicketController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
private function isDate($value, $format = 'Y-m-d') {
|
||||
private function isDate($value, $format = 'Y-m-d')
|
||||
{
|
||||
// Check if the value is a valid date string (basic validation)
|
||||
$date = \DateTime::createFromFormat($format, $value);
|
||||
return $date && $date->format($format) === $value;
|
||||
}
|
||||
|
||||
public function upload_url(){
|
||||
public function upload_url()
|
||||
{
|
||||
|
||||
$data = $this->request->getPost();
|
||||
$get_file_data = $this->request->getFiles('file_upload') ?? [];
|
||||
$ticket_id = $data['ticket_id_url'];
|
||||
|
||||
$insertArr = [];
|
||||
if(empty($get_file_data)){
|
||||
|
||||
foreach ($data['docs_name'] as $key => $eachData) {
|
||||
$insertArr = [];
|
||||
|
||||
if (!empty($eachData) ) {
|
||||
foreach ($data['docs_name'] as $key => $eachData) {
|
||||
|
||||
if (!empty($eachData)) {
|
||||
|
||||
$insertData = [
|
||||
'doc_name' => $data['docs_name'][$key]??'',
|
||||
'url' => $data['url'][$key]??'',
|
||||
'ticket_id'=> $data['ticket_id_url']??'',
|
||||
'doc_name' => $data['docs_name'][$key] ?? '',
|
||||
'url' => $data['url'][$key] ?? '',
|
||||
'ticket_id' => $data['ticket_id_url'] ?? '',
|
||||
'created_by' => get_session_userid(),
|
||||
'is_active' => 1,
|
||||
'file_type' => 1
|
||||
];
|
||||
|
||||
|
||||
$insertArr[] = $insertData;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($insertArr)){
|
||||
// Insert into database
|
||||
$insert = $this->claimFilesModel->insertBatch($insertArr);
|
||||
}
|
||||
|
||||
if (!empty($insertArr)) {
|
||||
// Insert into database
|
||||
$insert = $this->claimFilesModel->insertBatch($insertArr);
|
||||
}
|
||||
|
||||
if (isset($insert) && !empty($insert)) {
|
||||
return $this->respond(['status' => true, 'message' => 'File uploaded successfully ']);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'message' => 'Failed to upload file ']);
|
||||
if (isset($insert) && !empty($insert)) {
|
||||
return $this->respond(['status' => true, 'message' => 'File uploaded successfully ']);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'message' => 'Failed to upload file ']);
|
||||
}
|
||||
}else{
|
||||
|
||||
$get_docs_name = $data['docs_name'];
|
||||
$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, $get_docs_name);
|
||||
}
|
||||
|
||||
if(!empty($file_data)){
|
||||
$employeeRest = new EmployeeRestController();
|
||||
$result = $employeeRest->handleCliamFiles($file_data, $ticket_id);
|
||||
if(!empty($result)){
|
||||
return $this->respond(['status' => true, 'message' => 'File uploaded successfully ']);
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'message' => 'Failed to upload file ']);
|
||||
}
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'message' => 'Failed to upload file ']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getUrlDataByTicketId()
|
||||
@ -2373,10 +2404,17 @@ class TicketController extends BaseController
|
||||
}
|
||||
|
||||
$urlData = $this->claimFilesModel
|
||||
->where('ticket_id', $ticket_id)
|
||||
->where('is_active',1)
|
||||
->where('file_type',1)
|
||||
->findAll();
|
||||
->select("
|
||||
*,
|
||||
CASE
|
||||
WHEN file_type = 2 AND url IS NOT NULL AND url != ''
|
||||
THEN CONCAT('" . base_url('downloadClaimFile/') . "', id)
|
||||
ELSE url
|
||||
END AS url
|
||||
")
|
||||
->where('ticket_id', $ticket_id)
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
return $this->response->setJSON([
|
||||
'status' => true,
|
||||
|
||||
@ -58,6 +58,8 @@ if (!function_exists('call_third_party_api')) {
|
||||
];
|
||||
}
|
||||
|
||||
// echo ($response); die;
|
||||
|
||||
$decoded = json_decode($response, true);
|
||||
|
||||
return [
|
||||
|
||||
@ -126,7 +126,8 @@ class sendMailNotification
|
||||
|
||||
$subject = $cleanedText;
|
||||
|
||||
$link = generate_download_link($rand_string).'/1';
|
||||
// $link = generate_download_link($rand_string).'/1';
|
||||
$link = generate_ecard_download_link_based_on_tpa($params);
|
||||
|
||||
$app_link = $_ENV['App_Url'];
|
||||
$name = $get_emp_email_and_other_details['name'];
|
||||
@ -163,7 +164,62 @@ class sendMailNotification
|
||||
|
||||
return $wholeData;
|
||||
|
||||
} else if($action == 'member_review_and_summary_mail'){
|
||||
} else if($action == 'member_common_mail'){
|
||||
|
||||
$notification = $params['notification'];
|
||||
$get_emp_email_and_other_details = $params['get_emp_email_and_other_details'];
|
||||
$rand_string = $params['rand_string'];
|
||||
$client_data = $params['client_data'];
|
||||
$tpa_id = $params['tpa_id'];
|
||||
$common = $params['common'];
|
||||
|
||||
|
||||
$mail_content = $notification['mail_content'];
|
||||
$mail = $get_emp_email_and_other_details['email_corporate'];
|
||||
$subject = $notification['subject'];
|
||||
|
||||
$cleanedText = mb_convert_encoding($subject, 'UTF-8', 'UTF-8'); // Normalize encoding
|
||||
$cleanedText = preg_replace('/[^\x20-\x7E]/', '', $cleanedText);
|
||||
|
||||
$subject = $cleanedText;
|
||||
|
||||
$link = generate_download_link($rand_string).'/1';
|
||||
|
||||
$app_link = $_ENV['App_Url'];
|
||||
$name = $get_emp_email_and_other_details['name'];
|
||||
$employee_mobile_no = $get_emp_email_and_other_details['mobile'];
|
||||
$mail_content = $notification['mail_content'];
|
||||
|
||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||
|
||||
$post_enrollment_app_link = $_ENV['POST_ENROLLMENT_APP_LINK'];
|
||||
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
// $client_logo = $nhance_logo;
|
||||
|
||||
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name, $mail_content);
|
||||
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $employee_mobile_no, $mail_content);
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[post_enrollment_app_link]]", "{{post_enrollment_app_link}}"], "<a href='$post_enrollment_app_link'>Review Details</a>", $mail_content);
|
||||
// $mail_content = str_replace("[[tpa_id]]", $tpa_id, $mail_content);
|
||||
$mail_content = str_replace(["[[ecard_download_link]]", "{{ecard_download_link}}"], "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
|
||||
$mail_content = preg_replace('/<p[^>]*>( |\s)*<\/p>/i', '', $mail_content);
|
||||
|
||||
$data['params'] = $params;$data['client_logo'] = $client_logo;
|
||||
$data['mail_content'] = $mail_content;
|
||||
$mail_content = view('mail_template', $data);
|
||||
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'cc' => $params['test_mail_list'],'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
||||
|
||||
return $wholeData;
|
||||
|
||||
}else if($action == 'member_review_and_summary_mail'){
|
||||
|
||||
$array_list = $params['array_list'];//employeee lst
|
||||
$client_policy_id = $params['client_policy_id'];
|
||||
@ -1331,6 +1387,61 @@ class sendMailNotification
|
||||
|
||||
return $wholeData;
|
||||
|
||||
}else if($action == 'member_common_mail'){
|
||||
|
||||
$notification = $params['notification_data'];
|
||||
$client_data = $params['client_data'];
|
||||
$mail = $params['test_mail'];
|
||||
$mailAttachmentModel = new MailAttachmentModel();
|
||||
$attachment_data = $mailAttachmentModel
|
||||
->select('file_path, file_name')
|
||||
->where('notification_id', $notification['id'])
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$attachments = [];
|
||||
foreach ($attachment_data as $data) {
|
||||
$attachments[] = [
|
||||
"filePath" => WRITEPATH . $data['file_path'],
|
||||
"fileName" => $data['file_name']
|
||||
];
|
||||
}
|
||||
|
||||
$mail_content = $notification['mail_content'];
|
||||
$subject = $notification['subject'];
|
||||
|
||||
$rand_string = 'HX3kUh';
|
||||
$link = generate_download_link($rand_string).'/1';
|
||||
|
||||
$name = 'John Doe';
|
||||
$mobile = 9080706050;
|
||||
|
||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||
$app_link = $_ENV['App_Url'];
|
||||
$post_enrollment_app_link = $_ENV['POST_ENROLLMENT_APP_LINK'];
|
||||
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
|
||||
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
|
||||
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name, $mail_content);
|
||||
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $mobile, $mail_content);
|
||||
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[post_enrollment_app_link]]", "{{post_enrollment_app_link}}"], "<a href='$post_enrollment_app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[ecard_download_link]]", "{{ecard_download_link}}"], "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
||||
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||
|
||||
$mail_content = preg_replace('/<p[^>]*>( |\s)*<\/p>/i', '', $mail_content);
|
||||
|
||||
$data['params'] = $params;$data['client_logo'] = $client_logo;
|
||||
$data['mail_content'] = $mail_content;
|
||||
$mail_content = view('mail_template', $data);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'cc' => $params['test_mail_list'], 'bcc'=> $client_data['common_mails'],'attachments' => $attachments, 'reply_to' => $client_data['reply_to']];
|
||||
|
||||
return $wholeData;
|
||||
|
||||
} else if($action == 'member_review_and_summary_mail'){
|
||||
|
||||
$array_list = [
|
||||
|
||||
@ -5,6 +5,7 @@ use App\Models\FileModel;
|
||||
use App\Models\BatchFileModelFileModel;
|
||||
use App\Controllers\GoogleDriveController;
|
||||
use App\Models\BatchFileModel;
|
||||
use App\Controllers\ApiServiceController;
|
||||
|
||||
// File: app/Helpers/Uuid_helper.php
|
||||
|
||||
@ -112,8 +113,9 @@ if (!function_exists('file_Upload_for_lead')) {
|
||||
// }
|
||||
// }
|
||||
|
||||
// function for only using in the Flutter Claim File Upload
|
||||
if (!function_exists('multi_file_Upload')) {
|
||||
function multi_file_Upload($fileToUpload, $filepath)
|
||||
function multi_file_Upload($fileToUpload, $filepath, $docs_name = [])
|
||||
{
|
||||
$uploadedFiles = [];
|
||||
|
||||
@ -123,13 +125,16 @@ if (!function_exists('multi_file_Upload')) {
|
||||
foreach ($files as $file) {
|
||||
// If file is itself an array (multiple under same input name)
|
||||
if (is_array($file)) {
|
||||
foreach ($file as $f) {
|
||||
foreach ($file as $index => $f) {
|
||||
if ($f !== null && $f->isValid() && !$f->hasMoved()) {
|
||||
$fileName = $f->getRandomName(); // safer unique name
|
||||
$f->move($filepath, $fileName);
|
||||
$fileRandomName = $f->getRandomName(); // safer unique name
|
||||
$fileName = $f->getName();
|
||||
$f->move($filepath, $fileRandomName);
|
||||
$uploadedFiles[] = [
|
||||
'file_name' => $fileName,
|
||||
'file_path' => $filepath . $fileName
|
||||
'doc_name' => $docs_name[$index] ?? $fileName,
|
||||
// 'file_path' => $filepath . $fileRandomName
|
||||
'file_path' => $fileRandomName
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -642,7 +647,9 @@ if (!function_exists('change_date_format')) {
|
||||
if ($source_format !== null && $output_format !== null) {
|
||||
$date = DateTime::createFromFormat($source_format, $date_str);
|
||||
if (!$date) {
|
||||
throw new Exception("Invalid date string for source format: $source_format");
|
||||
// throw new Exception("Invalid date string for source format: $source_format");
|
||||
log_message('error', "❌ Date format error : Invalid date string | Params => date_str: {$date_str}, source_format: {$source_format}, output_format: {$output_format}");
|
||||
return null;
|
||||
}
|
||||
return $date->format($output_format);
|
||||
}
|
||||
@ -651,7 +658,9 @@ if (!function_exists('change_date_format')) {
|
||||
if ($source_format !== null && $output_format === null) {
|
||||
$date = DateTime::createFromFormat($source_format, $date_str);
|
||||
if (!$date) {
|
||||
throw new Exception("Invalid date string for source format: $source_format");
|
||||
// throw new Exception("Invalid date string for source format: $source_format");
|
||||
log_message('error', "❌ Date format error : Invalid date string | Params => date_str: {$date_str}, source_format: {$source_format}, output_format: {$output_format}");
|
||||
return null;
|
||||
}
|
||||
return $date->format('Y-m-d'); // MySQL default format
|
||||
}
|
||||
@ -666,10 +675,17 @@ if (!function_exists('change_date_format')) {
|
||||
}
|
||||
// If no format matches, throw an exception
|
||||
$allowed_placeholders = implode(', ', $allowed_formats);
|
||||
throw new Exception("Invalid date string format. Allowed formats: $allowed_placeholders");
|
||||
// throw new Exception("Invalid date string format. Allowed formats: $allowed_placeholders");
|
||||
log_message(
|
||||
'error',
|
||||
"❌ Date format error: Invalid date string. Allowed formats: {$allowed_placeholders} | Params => date_str: {$date_str}, source_format: {$source_format}, output_format: {$output_format}"
|
||||
);
|
||||
return null;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return "Error: " . $e->getMessage();
|
||||
// return "Error: " . $e->getMessage();
|
||||
log_message('error', "❌ Date format error: {$e->getMessage()} | Params => date_str: {$date_str}, source_format: {$source_format}, output_format: {$output_format}");
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -898,3 +914,45 @@ if (!function_exists('formatKey')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('getMimeTypeByFileName')) {
|
||||
function getMimeTypeByFileName($file_name)
|
||||
{
|
||||
$ext = strtolower(pathinfo($file_name, PATHINFO_EXTENSION));
|
||||
|
||||
$mime_types = [
|
||||
'pdf' => 'application/pdf',
|
||||
'jpg' => 'image/jpeg',
|
||||
'jpeg' => 'image/jpeg',
|
||||
'png' => 'image/png',
|
||||
'gif' => 'image/gif',
|
||||
'doc' => 'application/msword',
|
||||
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'xls' => 'application/vnd.ms-excel',
|
||||
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'csv' => 'text/csv',
|
||||
'txt' => 'text/plain',
|
||||
'zip' => 'application/zip',
|
||||
'rar' => 'application/x-rar-compressed',
|
||||
'json' => 'application/json',
|
||||
];
|
||||
|
||||
return $mime_types[$ext] ?? 'application/octet-stream'; // default fallback
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('generate_ecard_download_link_based_on_tpa')) {
|
||||
|
||||
function generate_ecard_download_link_based_on_tpa($params) {
|
||||
|
||||
$apiServiceController = new ApiServiceController();
|
||||
$data = $apiServiceController->ecardRequest($params, $return_type = 'internal');
|
||||
log_message('error', 'E-card request call from the helper for mail send');
|
||||
|
||||
if(isset($data['eCardDownload']) && !empty($data['eCardDownload'])){
|
||||
return $data['eCardDownload'];
|
||||
}else{
|
||||
return $data['message'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,9 @@ class ClaimFilesModel extends Model
|
||||
'updated_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'is_active'
|
||||
'is_active',
|
||||
'file_name',
|
||||
'mime_type',
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
|
||||
42
app/Models/CommonEMailModel.php
Normal file
42
app/Models/CommonEMailModel.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class CommonEMailModel extends Model
|
||||
{
|
||||
protected $table = 'common_mail';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = ['email','notification_id','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 = [];
|
||||
}
|
||||
@ -26,7 +26,8 @@ class EmpEndorsementModel extends Model
|
||||
"updated_by",
|
||||
"is_active",
|
||||
"remarks",
|
||||
"file_id"
|
||||
"file_id",
|
||||
"is_tpa_export",
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
|
||||
@ -382,6 +382,7 @@ class EmployeePolicyModel extends Model
|
||||
{
|
||||
return $this->where('employee_id',$arr['employee_id'])
|
||||
->where('client_policy_id',$arr['client_policy_id'])
|
||||
->where('status', 'active')
|
||||
->where('is_active',1)
|
||||
->find();
|
||||
}
|
||||
@ -607,9 +608,11 @@ class EmployeePolicyModel extends Model
|
||||
$client_branch_id = $ref_data['client_branch_id'];
|
||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||
|
||||
$endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NOT NULL OR a.endorsement_id != '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
$subquery_endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "WHERE (endorsement_id IS NOT NULL OR endorsement_id != '')" : "WHERE (endorsement_id IS NULL OR endorsement_id = '')";
|
||||
// $endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NOT NULL OR a.endorsement_id != '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
// $subquery_endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "WHERE (endorsement_id IS NOT NULL OR endorsement_id != '')" : "WHERE (endorsement_id IS NULL OR endorsement_id = '')";
|
||||
|
||||
$endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NULL OR a.is_tpa_export IS NULL)" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
$subquery_endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "WHERE (endorsement_id IS NULL OR is_tpa_export IS NULL)" : "WHERE (endorsement_id IS NULL OR endorsement_id = '')";
|
||||
|
||||
/*
|
||||
ROUND(sidata.new_si_premium - sidata.old_si_premium, 2) AS difference_premium,
|
||||
|
||||
@ -25,7 +25,8 @@ class EndorsementModel extends Model
|
||||
'updated_by',
|
||||
'updated_at',
|
||||
'file_id',
|
||||
'is_active'
|
||||
'is_active',
|
||||
'batch_file_id',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@ -8,5 +8,5 @@ class NotificationModel extends Model
|
||||
{
|
||||
protected $table = 'notifications';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = ["id","client_id","template_name","subject","mail_content","enabled","created_by","updated_by","is_active",'mail_content_json'];
|
||||
protected $allowedFields = ["id","client_id","template_name","subject","mail_content","enabled","created_by","updated_by","is_active",'mail_content_json','common_mail'];
|
||||
}
|
||||
@ -648,9 +648,15 @@
|
||||
|
||||
ROUND((pt_co_share_details.cop_amt + pt_co_share_details.cotp_amt + pt_co_share_details.cotep_amt), 2) AS premium_wo_gst,
|
||||
|
||||
ROUND((ROUND((pt_co_share_details.cop_amt + pt_co_share_details.cotp_amt + pt_co_share_details.cotep_amt), 2) * 18 / 100), 2) AS gst_amount,
|
||||
ROUND((ROUND((pt_co_share_details.cop_amt + pt_co_share_details.cotp_amt + pt_co_share_details.cotep_amt), 2) * 18 / 100), 2) AS gst_amount_velmurugan,
|
||||
|
||||
ROUND((ROUND((pt_co_share_details.cop_amt + pt_co_share_details.cotp_amt + pt_co_share_details.cotep_amt), 2) + ROUND((ROUND((pt_co_share_details.cop_amt + pt_co_share_details.cotp_amt + pt_co_share_details.cotep_amt), 2) * 18 / 100), 2)), 2) AS total_premium,
|
||||
ROUND((ROUND((pt_co_share_details.cop_amt + pt_co_share_details.cotp_amt + pt_co_share_details.cotep_amt), 2) + ROUND((ROUND((pt_co_share_details.cop_amt + pt_co_share_details.cotp_amt + pt_co_share_details.cotep_amt), 2) * 18 / 100), 2)), 2) AS total_premium_velmurugan,
|
||||
|
||||
ROUND(COALESCE(tep_gst_amt, 0) + COALESCE(bp_gst_amt, 0) + COALESCE(tp_amt, 0),2) AS gst_amount,
|
||||
|
||||
ROUND(ROUND(pt_co_share_details.cop_amt + pt_co_share_details.cotp_amt + pt_co_share_details.cotep_amt, 2) +
|
||||
ROUND(COALESCE(tep_gst_amt, 0) + COALESCE(bp_gst_amt, 0) + COALESCE(tp_amt, 0),2),
|
||||
2) AS total_premium,
|
||||
|
||||
ROUND((pt_co_share_details.cotp_amt + pt_co_share_details.cotep_amt), 2) AS tp_or_ter,
|
||||
|
||||
@ -2191,6 +2197,8 @@
|
||||
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->where('pt_co_share_details.is_active', 1)
|
||||
->where('co_share_stmt_details.is_active', 1)
|
||||
->where('insurer_statements_oq.is_active', 1)
|
||||
->where('insurer_statements_oq.id IS NOT NULL')
|
||||
|
||||
|
||||
|
||||
19
app/Models/TpaApiSeviceModel.php
Normal file
19
app/Models/TpaApiSeviceModel.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class TpaApiSeviceModel extends Model
|
||||
{
|
||||
protected $table = 'tpa_api_services';
|
||||
protected $primaryKey = 'id';
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [
|
||||
'id',
|
||||
'tpa_id',
|
||||
'api_name',
|
||||
'description',
|
||||
'is_active',
|
||||
];
|
||||
}
|
||||
@ -63,7 +63,7 @@
|
||||
<td><?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?></td>
|
||||
<td><?php echo $file['event_type'] ?></td>
|
||||
<td><?php echo $insurer_or_tpa[$file['insurer_or_tpa']] ?></td>
|
||||
<td><?php echo $import_or_export[$file['actions']] ?></td>
|
||||
<td><?php echo $import_or_export[$file['actions']] ?? ucfirst($file['actions']) ?></td>
|
||||
<td><?php echo $file['count'] == null ? '-' : $file['count'] ?></td>
|
||||
|
||||
<td><?php echo format_indian_number($file['amount'])?></td>
|
||||
@ -140,6 +140,10 @@
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top" title="<?= $file['error_data'] ?>"></a>
|
||||
|
||||
<?php } else if ($file['status'] == 'failed-8') { ?>
|
||||
|
||||
failed
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<?php echo $file['status']; ?>
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
// Get headers dynamically
|
||||
$headers = array_keys($data[0]);
|
||||
foreach ($headers as $header): ?>
|
||||
<th><?= esc($header) ?></th>
|
||||
<th><?= esc(str_replace('_', ' ', $header)) ?></th>
|
||||
<?php endforeach; ?>
|
||||
<th>TOTAL</th>
|
||||
</tr>
|
||||
|
||||
@ -154,35 +154,18 @@ $(document).ready(function() {
|
||||
// Global DataTables defaults
|
||||
$.extend(true, $.fn.dataTable.defaults, {
|
||||
language: {
|
||||
search: "", // remove "Search:" label
|
||||
search: `
|
||||
<div class="datatable-search-wrapper">
|
||||
_INPUT_
|
||||
<i class="mdi mdi-magnify datatable-search-icon"></i>
|
||||
</div>`,
|
||||
searchPlaceholder: "Search"
|
||||
},
|
||||
|
||||
paging: true,
|
||||
pageLength: 10,
|
||||
ordering: false
|
||||
});
|
||||
|
||||
// Global init hook
|
||||
$(document).on('init.dt', function (e, settings) {
|
||||
let $filter = $(settings.nTableWrapper).find('.dataTables_filter');
|
||||
let $input = $filter.find('input');
|
||||
|
||||
if (!$filter.hasClass('custom-search')) {
|
||||
// Wrap in Bootstrap input-group
|
||||
$input
|
||||
.addClass('form-control')
|
||||
.wrap('<div class="input-group"></div>');
|
||||
|
||||
// Append icon
|
||||
$input.after(`
|
||||
<span class="input-group-text bg-white border-0">
|
||||
<i class="mdi mdi-magnify"></i>
|
||||
</span>
|
||||
`);
|
||||
|
||||
// Align to right
|
||||
$filter.addClass('text-right custom-search');
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -19,6 +19,10 @@ table.dataTable tbody td {
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#scroll-horizontal-datatable tfoot .right-align-input {
|
||||
text-align: right !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="col-12">
|
||||
@ -84,6 +88,7 @@ table.dataTable tbody td {
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
className: 'app-btn-primary ',
|
||||
title: 'Insurer-Wise-Report-List',
|
||||
footer: true
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
@ -93,6 +98,7 @@ table.dataTable tbody td {
|
||||
orthogonal: 'sort'
|
||||
},
|
||||
className: 'app-btn-primary ',
|
||||
footer: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -19,6 +19,12 @@ table.dataTable tbody td {
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#scroll-horizontal-datatable tfoot .right-align-input {
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<div class="col-12">
|
||||
@ -84,6 +90,7 @@ table.dataTable tbody td {
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
className: 'app-btn-primary ',
|
||||
title: 'Bap-Wise-Report-List',
|
||||
footer: true
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
@ -93,6 +100,7 @@ table.dataTable tbody td {
|
||||
},
|
||||
className: 'app-btn-primary ',
|
||||
title: 'Bap-Wise-Report-List',
|
||||
footer: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -26,11 +26,11 @@
|
||||
<div class="col-12" id="second_page">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<!-- <div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">BDS TAT Band Wise Report</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="table-responsive">
|
||||
<table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
@ -40,7 +40,7 @@
|
||||
// Get headers dynamically
|
||||
$headers = array_keys($data[0]);
|
||||
foreach ($headers as $header): ?>
|
||||
<th><?= esc($header) ?></th>
|
||||
<th><?= esc(str_replace('_', ' ', $header)) ?></th>
|
||||
<?php endforeach; ?>
|
||||
<th>TOTAL</th>
|
||||
</tr>
|
||||
@ -108,13 +108,6 @@
|
||||
|
||||
// ],
|
||||
buttons: [
|
||||
{
|
||||
text: '<i class="mdi mdi-plus" ></i><span class=" btn-custom"> Add </span>',
|
||||
className: 'btn app-btn-primary mr-2',
|
||||
action: function(e, dt, node, config) {
|
||||
openTicket();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'collection',
|
||||
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
||||
|
||||
@ -106,7 +106,7 @@
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Issuer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="issuer" name="issuer" required>
|
||||
<option value="0">Select Issure</option>
|
||||
<option value="0">Select Issuer</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
@ -390,7 +390,8 @@
|
||||
_INPUT_
|
||||
<i class="mdi mdi-magnify datatable-search-icon"></i>
|
||||
</div>`,
|
||||
searchPlaceholder: "Search"
|
||||
searchPlaceholder: "Search",
|
||||
emptyTable: '<div class="text-center text-muted">No Data found</div>'
|
||||
},
|
||||
paging: true,
|
||||
pageLength: 10,
|
||||
|
||||
@ -19,16 +19,17 @@
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<div id="dynamic-form-container">
|
||||
<div align="right">
|
||||
<a class="btn btn-primary waves-effect waves-light mr-1"
|
||||
onclick="addHTMLInput(this)">
|
||||
+ Add
|
||||
<div id="dynamic-form-container">
|
||||
<div align="right">
|
||||
<a id="toggle-upload-btn" class="btn btn-info waves-effect waves-light mr-1" onclick="toggleUploadType(this)">
|
||||
File Upload
|
||||
</a>
|
||||
<a class="btn btn-primary waves-effect waves-light" id="add_btn_for_claim_file_upload" onclick="addHTMLInput(this)">+ Add</a>
|
||||
</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="g_drive_file_upload_sbt_btn">Submit</button>
|
||||
@ -39,7 +40,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -112,6 +112,7 @@
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
@ -180,8 +181,7 @@ $("#drive_file_upload_form").submit(function(event) {
|
||||
});
|
||||
});
|
||||
|
||||
function addHTMLInput()
|
||||
{
|
||||
function addHTMLInput() {
|
||||
const container = document.getElementById('dynamic-form-container');
|
||||
const newRow = document.createElement('div');
|
||||
newRow.className = 'form-row dynamic-form-row';
|
||||
@ -208,8 +208,7 @@ function addHTMLInput()
|
||||
|
||||
}
|
||||
|
||||
function removeHTMLInput(element)
|
||||
{
|
||||
function removeHTMLInput(element) {
|
||||
const container = document.getElementById('dynamic-form-container');
|
||||
const rows = container.querySelectorAll('.dynamic-form-row');
|
||||
|
||||
@ -219,7 +218,7 @@ function removeHTMLInput(element)
|
||||
}
|
||||
}
|
||||
|
||||
function getUrlDataByTicketId(ticket_id) {
|
||||
function getUrlDataByTicketId(ticket_id) {
|
||||
|
||||
// Show loader
|
||||
$('.loader').fadeIn();
|
||||
@ -262,7 +261,6 @@ function openEditModal(id, docName, url) {
|
||||
$('#edit_url_modal').modal('show'); // Bootstrap modal
|
||||
}
|
||||
|
||||
|
||||
function create_url_list(data) {
|
||||
$('#table_bd').empty(); // clear existing rows
|
||||
|
||||
@ -276,7 +274,7 @@ function create_url_list(data) {
|
||||
<tr>
|
||||
<td class="text-center">${index + 1}</td>
|
||||
<td>${item.doc_name}</td>
|
||||
<td><a href="${item.url}" target="_blank">${item.url}</a></td>
|
||||
<td><a href="${item.url}" target="_blank">${item.file_type == 1 ? item.url : item.doc_name}</a></td>
|
||||
<td>
|
||||
<a href="javascript:void(0);" class="delete-url"
|
||||
style="bacolor:black;"
|
||||
@ -293,6 +291,7 @@ function create_url_list(data) {
|
||||
$('#table_bd').html('<tr><td colspan="4">No Data Found</td></tr>');
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('click', '.delete-url', function (e) {
|
||||
e.preventDefault();
|
||||
const url = $(this).data('href');
|
||||
@ -332,7 +331,68 @@ $(document).on('click', '.delete-url', function (e) {
|
||||
});
|
||||
});
|
||||
|
||||
function addFileUploadHtml() {
|
||||
const container = document.getElementById('dynamic-form-container');
|
||||
const newRow = document.createElement('div');
|
||||
newRow.className = 'form-row dynamic-form-row';
|
||||
newRow.innerHTML = `
|
||||
<div class="form-group col-md-5">
|
||||
<label for="file_name">Document Name <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="docs_name" name="docs_name[]" placeholder="Enter file name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<label for="file">Choose File <span class="text-danger">*</span></label>
|
||||
<input type="file" class="form-control" id="file_upload" name="file_upload[]" accept=".pdf,.jpg,.jpeg,.png" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2" style="position: relative; top: 28px;">
|
||||
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)" style="background-color: #BD0707;">
|
||||
<i class="mdi mdi-delete"></i>
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
container.appendChild(newRow);
|
||||
}
|
||||
|
||||
function toggleUploadType(btn) {
|
||||
|
||||
const $btn = $(btn);
|
||||
const $addBtn = $('#add_btn_for_claim_file_upload');
|
||||
console.log('addBtn', $addBtn);
|
||||
const $container = $('#dynamic-form-container');
|
||||
const currentType = $btn.text().trim();
|
||||
console.log('currentType', currentType);
|
||||
|
||||
// Remove all existing dynamic rows when mode changes
|
||||
$container.find('.dynamic-form-row').remove();
|
||||
|
||||
if (currentType === 'URL Upload') {
|
||||
|
||||
$btn.text('File Upload').removeClass('btn-success').addClass('btn-info');
|
||||
|
||||
// Change the Add button action
|
||||
$addBtn.attr('onclick', 'addHTMLInput(this)');
|
||||
|
||||
// Handle switching to file upload mode here
|
||||
console.log('Switched to File Upload mode');
|
||||
|
||||
// call the function
|
||||
addHTMLInput();
|
||||
|
||||
} else {
|
||||
|
||||
$btn.text('URL Upload').removeClass('btn-info').addClass('btn-success');
|
||||
|
||||
// Change the Add button action
|
||||
$addBtn.attr('onclick', 'addFileUploadHtml(this)');
|
||||
|
||||
// Handle switching to URL upload mode here
|
||||
console.log('Switched to URL Upload mode');
|
||||
|
||||
// call the function
|
||||
addFileUploadHtml();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@ -684,6 +684,7 @@ input:checked + .slider_blue::before {
|
||||
var message = (policy_PrimaryKey === '') ?
|
||||
'Policy Created successfully' : 'Policy Updated Successfully';
|
||||
toastr.success(message, 'Success');
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
|
||||
@ -1,81 +1,81 @@
|
||||
<style>
|
||||
.badge2 {
|
||||
box-shadow: none;
|
||||
}
|
||||
.badge2 {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.badge2-secondary2 {
|
||||
color: #fff;
|
||||
background-color: #187607;
|
||||
}
|
||||
.badge2-secondary2 {
|
||||
color: #fff;
|
||||
background-color: #187607;
|
||||
}
|
||||
|
||||
.badge2 {
|
||||
display: inline-block;
|
||||
padding: .25em .4em;
|
||||
font-size: 75%;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
border-radius: .25rem;
|
||||
transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
|
||||
}
|
||||
.badge2 {
|
||||
display: inline-block;
|
||||
padding: .25em .4em;
|
||||
font-size: 75%;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
border-radius: .25rem;
|
||||
transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
|
||||
}
|
||||
|
||||
.table-responsive {
|
||||
overflow-x: auto;
|
||||
}
|
||||
.table-responsive {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.word-wrap {
|
||||
word-wrap: break-word;
|
||||
white-space: normal;
|
||||
}
|
||||
.word-wrap {
|
||||
word-wrap: break-word;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.dataTables_filter{
|
||||
position: absolute;
|
||||
}
|
||||
.dataTables_filter{
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.readonly-select {
|
||||
pointer-events: none;
|
||||
background-color: #f0f0f0;
|
||||
color: #666;
|
||||
}
|
||||
.readonly-select {
|
||||
pointer-events: none;
|
||||
background-color: #f0f0f0;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<style>
|
||||
/* Timeline Design */
|
||||
.timeline {
|
||||
position: relative;
|
||||
padding-left: 30px;
|
||||
border-left: 3px solid #007bff;
|
||||
}
|
||||
/* Timeline Design */
|
||||
.timeline {
|
||||
position: relative;
|
||||
padding-left: 30px;
|
||||
border-left: 3px solid #007bff;
|
||||
}
|
||||
|
||||
.timeline-item {
|
||||
position: relative;
|
||||
margin-bottom: 20px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
.timeline-item {
|
||||
position: relative;
|
||||
margin-bottom: 20px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.timeline-dot {
|
||||
position: absolute;
|
||||
left: -10px;
|
||||
top: 5px;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background: #007bff;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.timeline-dot {
|
||||
position: absolute;
|
||||
left: -10px;
|
||||
top: 5px;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background: #007bff;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.timeline-content {
|
||||
background: #f8f9fa;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.timeline-content {
|
||||
background: #f8f9fa;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php $pro_rata_total = 0; $gst_total = 0 ?>
|
||||
@ -195,7 +195,8 @@
|
||||
<?php } ?>
|
||||
|
||||
<?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'] . "/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>
|
||||
<!-- <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> -->
|
||||
<a class="dropdown-item" onclick="viewEcard(<?= $employee['employee_id'] ?>, '<?= $employee['emp_code'] ?>', <?= $employee['client_policy_id'] ?>, '<?= $employee['policy_no'] ?>')"><i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View E-Card</a>
|
||||
<?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'])) { ?>
|
||||
@ -586,25 +587,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
// 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();
|
||||
@ -739,12 +721,51 @@
|
||||
});
|
||||
}
|
||||
|
||||
// function closeModal(){
|
||||
// var myModalEl = document.getElementById('emp_history_modal');
|
||||
// var modalInstance = bootstrap.Modal.getInstance(myModalEl);
|
||||
// if (modalInstance) {
|
||||
// modalInstance.hide();
|
||||
// }
|
||||
// }
|
||||
function viewEcard(emp_id, emp_code, policy_id, policy_no){
|
||||
|
||||
console.log({emp_id, emp_code, policy_id, policy_no});
|
||||
|
||||
let url_type = 'view';
|
||||
let url = '<?= base_url('ecardRequest') ?>';
|
||||
|
||||
// Data to send in the AJAX request
|
||||
let requestData = {
|
||||
id: emp_id,
|
||||
emp_code: emp_code,
|
||||
client_policy_id: policy_id,
|
||||
policy_no: policy_no,
|
||||
type: url_type,
|
||||
};
|
||||
|
||||
// Convert to JSON
|
||||
let jsonData = JSON.stringify(requestData);
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
// Send AJAX request
|
||||
sendAjaxRequestForGlobal(url, 'POST', jsonData, function(response) {
|
||||
|
||||
console.log('Data fetched successfully:', response);
|
||||
|
||||
if (response.status == true && response.data.eCardDownload) {
|
||||
console.log(response.data.message || 'Initiating successafully', 'SUCCESS');
|
||||
const newTab = window.open(response.data.eCardDownload, '_blank');
|
||||
if (newTab) newTab.focus();
|
||||
} else {
|
||||
toastr.error(response.data.message || 'Unable to fetch e-card', 'ERROR');
|
||||
}
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
toastr.error('An error occurred while checking the CD amount.', 'ERROR');
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@ -175,6 +175,7 @@ option:disabled {
|
||||
var client_id_param = 0;
|
||||
var client_branch_id_param = 0;
|
||||
var client_policy_param = 0;
|
||||
var tpa_api_sevice = 0;
|
||||
|
||||
$('#file_upload').hide();
|
||||
|
||||
@ -984,7 +985,6 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
@ -1011,6 +1011,19 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
|
||||
var event = response.insurer_multi_event ;
|
||||
$('#event_type_data').val(response.insurer_multi_event);
|
||||
|
||||
console.log('response.tpa_api_service_status', response.tpa_api_service_status);
|
||||
console.log('tpa_api_sevice 1', tpa_api_sevice);
|
||||
if(response.tpa_api_service_status){
|
||||
tpa_api_sevice = 1;
|
||||
}else{
|
||||
tpa_api_sevice = 0;
|
||||
}
|
||||
$('.fetch_tpa').hide();
|
||||
$('#action_type').val('').change();
|
||||
$('#event_type').val('').change();
|
||||
|
||||
console.log('tpa_api_sevice 2', tpa_api_sevice);
|
||||
|
||||
if(event == 1){
|
||||
$("#event_type").attr("multiple", "multiple");
|
||||
$("#event_type").attr("name", "event_type[]");
|
||||
|
||||
@ -111,15 +111,22 @@
|
||||
|
||||
<br>
|
||||
<div class="form-row" id="import_excel_btn">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label>Upload file</label> [ <a id="import_excel_download" data-toggle="tooltip" data-placement="top" title="Download Import Sample Excel" style="display: none;">Sample Excel</a> ]
|
||||
<input type="file" name="import_file_data" id="import_file" 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" style="margin-top: 18px;">
|
||||
<div class="form-group 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 class="form-group col-md-4 fetch_tpa" style="margin-top: 30px;">
|
||||
<a id="fetch_tpa_btn" class="btn btn-primary waves-effect waves-light justify-content-end" onclick="fetchTpaIdFromTpa(this)">Fetch TPA ID</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row" id="export_excel_btn">
|
||||
@ -129,6 +136,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -429,7 +437,9 @@
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text:`${item.policy_type ?? ''} - ${item.policy_no ?? ''}`
|
||||
text:`${item.policy_type ?? ''} - ${item.policy_no ?? ''}` ,
|
||||
'data-pno': item.policy_no ?? '',
|
||||
'data-tid': item.tpa_id ?? ''
|
||||
});
|
||||
if (client_policy_param2 == item.id) {
|
||||
option.attr('selected', true);
|
||||
@ -438,6 +448,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
// On change document ready functions
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#client').on('change', function() {
|
||||
@ -464,6 +475,186 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('#policy').on('change', function() {
|
||||
|
||||
var policy_value = $(this).val()
|
||||
var insurer_or_tpa = $('insurer_or_tpa').val()
|
||||
var action_type = $('action_type').val()
|
||||
|
||||
if(policy_value == 0 || insurer_or_tpa == 'tpa' || action_type == 'import'){
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
$("#event_type").select2('destroy');
|
||||
}
|
||||
})
|
||||
|
||||
/**This function updates the download link based on the selected option in the dropdown menu. **/
|
||||
$('#event_type').on('change', function() {
|
||||
|
||||
var selectedValue = $(this).val();
|
||||
if (selectedValue !== '') {
|
||||
$('#import_excel_download').show();
|
||||
var fullURL = '<?= base_url("util/download_import_excel/"); ?>' + selectedValue;
|
||||
$('#import_excel_download').attr('href', fullURL);
|
||||
} else {
|
||||
$('#import_excel_download').hide();
|
||||
$('#import_excel_download').removeAttr('href');
|
||||
}
|
||||
});
|
||||
|
||||
$('#event_type').on('change', function() {
|
||||
|
||||
var selectedVal = $(this).val();
|
||||
var insurer_or_tpa = $('#insurer_or_tpa').val()
|
||||
var action_type = $('#action_type').val()
|
||||
|
||||
console.log({tpa_api_sevice, selectedVal, insurer_or_tpa, action_type});
|
||||
|
||||
if (tpa_api_sevice == 0 || action_type == 'export' || insurer_or_tpa == "insurer" || (selectedVal == 'correction' || selectedVal == 'deletion' || selectedVal == 'si_enhancement')) {
|
||||
$('.fetch_tpa').hide();
|
||||
} else {
|
||||
$('.fetch_tpa').show();
|
||||
}
|
||||
|
||||
if (selectedVal === 'correction') {
|
||||
$('#policy').prop('required', false);
|
||||
$('#policy_danger').hide();
|
||||
} else {
|
||||
$('#policy').prop('required', true);
|
||||
$('#policy_danger').show();
|
||||
}
|
||||
|
||||
console.log('tpa_api_sevice', tpa_api_sevice);
|
||||
console.log('tpa_api_sevice type', typeof tpa_api_sevice);
|
||||
});
|
||||
|
||||
$('#action_type').on('change', function() {
|
||||
|
||||
var selectedValue = $(this).val();
|
||||
var insurer_or_tpa = $('#insurer_or_tpa').val()
|
||||
// console.log(selectedValue);
|
||||
|
||||
if (selectedValue == '') {
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').hide();
|
||||
} else if (selectedValue == 'import') {
|
||||
$('#import_file').prop('required', true);
|
||||
$('#import_file').attr('name', 'import_file_data');
|
||||
$('#import_excel_btn').show();
|
||||
$('#export_excel_btn').hide();
|
||||
} else if (selectedValue == 'export') {
|
||||
$('#import_file').removeAttr('name');
|
||||
$('#import_file').prop('required', false);
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').show();
|
||||
}
|
||||
|
||||
if (tpa_api_sevice == 0 || selectedValue == 'export' || insurer_or_tpa == "insurer") {
|
||||
$('.fetch_tpa').hide();
|
||||
} else {
|
||||
$('.fetch_tpa').show();
|
||||
}
|
||||
});
|
||||
|
||||
$('#insurer_or_tpa').on('change', function() {
|
||||
|
||||
var insurer_or_tpa = $(this).val()
|
||||
var policy_value = $('#policy').val()
|
||||
var event_type_data = $('#event_type_data').val();
|
||||
var action_type = $('#action_type').val()
|
||||
var event_string = $('#event_type').val();
|
||||
|
||||
console.log({tpa_api_sevice, insurer_or_tpa, policy_value, event_type_data, action_type, event_string});
|
||||
|
||||
if (tpa_api_sevice == 0 || action_type == 'export' || insurer_or_tpa == "insurer" || (event_string == 'correction' || event_string == 'deletion' || event_string == 'si_enhancement')) {
|
||||
$('.fetch_tpa').hide();
|
||||
} else {
|
||||
$('.fetch_tpa').show();
|
||||
}
|
||||
|
||||
// if(insurer_or_tpa == 'tpa' || event_type_data == 0){
|
||||
if(insurer_or_tpa == 'tpa'){
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
}else if(insurer_or_tpa == 'insurer' && action_type == 'import'){
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
}else if(insurer_or_tpa == 'insurer' && action_type == 'export' && event_type_data == 1){
|
||||
|
||||
$("#event_type").attr("multiple", "multiple");
|
||||
$("#event_type").attr("name", "event_type[]");
|
||||
$("#event_type").select2();
|
||||
|
||||
}else if(insurer_or_tpa == 'insurer' && action_type == 'export' && event_type_data == 0){
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
}else{
|
||||
if(policy_value != 0){
|
||||
$("#event_type").attr("multiple", "multiple");
|
||||
$("#event_type").attr("name", "event_type[]");
|
||||
$("#event_type").select2();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#action_type').on('change', function() {
|
||||
|
||||
var action_type = $(this).val()
|
||||
var policy_value = $('#policy').val()
|
||||
var insurer_or_tpa = $('#insurer_or_tpa').val()
|
||||
var event_string = $('#event_type').val();
|
||||
var event_type_data = $('#event_type_data').val();
|
||||
|
||||
console.log({tpa_api_sevice, action_type, policy_value, insurer_or_tpa, event_string, event_type_data})
|
||||
|
||||
if (tpa_api_sevice == 0 || action_type == 'export' || insurer_or_tpa == "insurer" || (event_string == 'correction' || event_string == 'deletion' || event_string == 'si_enhancement')) {
|
||||
$('.fetch_tpa').hide();
|
||||
} else {
|
||||
$('.fetch_tpa').show();
|
||||
}
|
||||
|
||||
if(action_type == 'import'){
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
} else if(action_type == 'export' && insurer_or_tpa == 'tpa'){
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
}else if(action_type == 'export' && insurer_or_tpa == 'insurer' && event_type_data == 1){
|
||||
|
||||
$("#event_type").attr("multiple", "multiple");
|
||||
$("#event_type").attr("name", "event_type[]");
|
||||
$("#event_type").select2();
|
||||
|
||||
}else if(action_type == 'export' && insurer_or_tpa == 'insurer' && event_type_data == 0){
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
}else{
|
||||
if(policy_value != 0){
|
||||
$("#event_type").attr("multiple", "multiple");
|
||||
$("#event_type").attr("name", "event_type[]");
|
||||
$("#event_type").select2();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Function to convert object to query parameters
|
||||
@ -497,156 +688,12 @@
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
$('#action_type').change(function() {
|
||||
|
||||
var selectedValue = $(this).val();
|
||||
// console.log(selectedValue);
|
||||
|
||||
if (selectedValue == '') {
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').hide();
|
||||
} else if (selectedValue == 'import') {
|
||||
$('#import_file').prop('required', true);
|
||||
$('#import_file').attr('name', 'import_file_data');
|
||||
$('#import_excel_btn').show();
|
||||
$('#export_excel_btn').hide();
|
||||
} else if (selectedValue == 'export') {
|
||||
$('#import_file').removeAttr('name');
|
||||
$('#import_file').prop('required', false);
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').show();
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('toggleIcon').addEventListener('click', function() {
|
||||
var icon = document.getElementById('icon');
|
||||
icon.classList.toggle('mdi-chevron-down');
|
||||
icon.classList.toggle('mdi-chevron-up');
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#event_type').change(function() {
|
||||
var selectedVal = $(this).val();
|
||||
// console.log(selectedVal);
|
||||
|
||||
if (selectedVal === 'correction') {
|
||||
$('#policy').prop('required', false);
|
||||
$('#policy_danger').hide();
|
||||
} else {
|
||||
$('#policy').prop('required', true);
|
||||
$('#policy_danger').show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
$('#insurer_or_tpa').change(function(){
|
||||
|
||||
var insurer_or_tpa = $(this).val()
|
||||
var policy_value = $('#policy').val()
|
||||
var event_type_data = $('#event_type_data').val();
|
||||
var action_type = $('#action_type').val()
|
||||
var event_type_data = $('#event_type_data').val();
|
||||
|
||||
console.log('policy_value', policy_value)
|
||||
|
||||
// if(insurer_or_tpa == 'tpa' || event_type_data == 0){
|
||||
if(insurer_or_tpa == 'tpa'){
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
}else if(insurer_or_tpa == 'insurer' && action_type == 'import'){
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
}else if(insurer_or_tpa == 'insurer' && action_type == 'export' && event_type_data == 1){
|
||||
|
||||
$("#event_type").attr("multiple", "multiple");
|
||||
$("#event_type").attr("name", "event_type[]");
|
||||
$("#event_type").select2();
|
||||
|
||||
}else if(insurer_or_tpa == 'insurer' && action_type == 'export' && event_type_data == 0){
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
}else{
|
||||
if(policy_value != 0){
|
||||
$("#event_type").attr("multiple", "multiple");
|
||||
$("#event_type").attr("name", "event_type[]");
|
||||
$("#event_type").select2();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#action_type').change(function(){
|
||||
|
||||
var action_type = $(this).val()
|
||||
var policy_value = $('#policy').val()
|
||||
var insurer_or_tpa = $('#insurer_or_tpa').val()
|
||||
|
||||
var event_type_data = $('#event_type_data').val();
|
||||
|
||||
console.log('policy_value', policy_value)
|
||||
// if(insurer_or_tpa == 'import' || event_type_data == 0){
|
||||
|
||||
if(action_type == 'import'){
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
} else if(action_type == 'export' && insurer_or_tpa == 'tpa'){
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
}else if(action_type == 'export' && insurer_or_tpa == 'insurer' && event_type_data == 1){
|
||||
|
||||
$("#event_type").attr("multiple", "multiple");
|
||||
$("#event_type").attr("name", "event_type[]");
|
||||
$("#event_type").select2();
|
||||
|
||||
}else if(action_type == 'export' && insurer_or_tpa == 'insurer' && event_type_data == 0){
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
}else{
|
||||
if(policy_value != 0){
|
||||
$("#event_type").attr("multiple", "multiple");
|
||||
$("#event_type").attr("name", "event_type[]");
|
||||
$("#event_type").select2();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#policy').change(function(){
|
||||
|
||||
var policy_value = $(this).val()
|
||||
var insurer_or_tpa = $('insurer_or_tpa').val()
|
||||
var action_type = $('action_type').val()
|
||||
|
||||
if(policy_value == 0 || insurer_or_tpa == 'tpa' || action_type == 'import'){
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
$("#event_type").select2('destroy');
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
|
||||
$('#import_excel_download').click(function() {
|
||||
@ -660,20 +707,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
/**This function updates the download link based on the selected option in the dropdown menu. **/
|
||||
$('#event_type').change(function() {
|
||||
|
||||
var selectedValue = $(this).val();
|
||||
if (selectedValue !== '') {
|
||||
$('#import_excel_download').show();
|
||||
var fullURL = '<?= base_url("util/download_import_excel/"); ?>' + selectedValue;
|
||||
$('#import_excel_download').attr('href', fullURL);
|
||||
} else {
|
||||
$('#import_excel_download').hide();
|
||||
$('#import_excel_download').removeAttr('href');
|
||||
}
|
||||
});
|
||||
|
||||
//------------- CHECK CD BALANCE in SESSION -----------------------------------------------------------------------------------------
|
||||
|
||||
// Global variables
|
||||
@ -759,17 +792,75 @@
|
||||
|
||||
</script>
|
||||
<script>
|
||||
function togglePolicyIssueDate() {
|
||||
let insurer = $('#insurer_or_tpa').val();
|
||||
let action = $('#action_type').val();
|
||||
// if (insurer === 'insurer' && action === 'import') {
|
||||
// $('.policy_issue_date_row').show();
|
||||
// $('#policy_issue_date').attr('required', true);
|
||||
// $('#policy_issue_date_label').html('Policy Issue Date <span class="text-danger">*</span>');
|
||||
// } else {
|
||||
// $('.policy_issue_date_row').hide();
|
||||
// $('#policy_issue_date').removeAttr('required').val('');
|
||||
// $('#policy_issue_date_label').text('Policy Issue Date');
|
||||
// }
|
||||
}
|
||||
|
||||
function togglePolicyIssueDate() {
|
||||
let insurer = $('#insurer_or_tpa').val();
|
||||
let action = $('#action_type').val();
|
||||
// if (insurer === 'insurer' && action === 'import') {
|
||||
// $('.policy_issue_date_row').show();
|
||||
// $('#policy_issue_date').attr('required', true);
|
||||
// $('#policy_issue_date_label').html('Policy Issue Date <span class="text-danger">*</span>');
|
||||
// } else {
|
||||
// $('.policy_issue_date_row').hide();
|
||||
// $('#policy_issue_date').removeAttr('required').val('');
|
||||
// $('#policy_issue_date_label').text('Policy Issue Date');
|
||||
// }
|
||||
}
|
||||
|
||||
function fetchTpaIdFromTpa(){
|
||||
|
||||
let event = $('#event_type').val();
|
||||
let client_id = $('#client').val();
|
||||
let branch_id = $('#client_branch_id').val();
|
||||
let policy_id = $('#policy').val();
|
||||
let tpa_id = $('#policy option:selected').data('tid');
|
||||
let policy_no = $('#policy option:selected').data('pno');
|
||||
|
||||
let checks = [
|
||||
{val: client_id, msg: 'Please select the client'},
|
||||
{val: branch_id, msg: 'Please select the client branch'},
|
||||
{val: policy_id, msg: 'Please select the policy'},
|
||||
{val: event, msg: 'Please select the event'},
|
||||
{val: tpa_id, msg: 'TPA id empty'},
|
||||
{val: policy_no, msg: 'Policy No empty'},
|
||||
];
|
||||
|
||||
for (let c of checks) {
|
||||
if (!c.val || c.val == 0) {
|
||||
toastr.warning(c.msg, 'WARNING');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let url = '<?= base_url('getTPAID') ?>';
|
||||
|
||||
// Data to send in the AJAX request
|
||||
let requestData = {
|
||||
policy_no: policy_no,
|
||||
tpa_id: tpa_id,
|
||||
client_id: client_id,
|
||||
client_branch_id: branch_id,
|
||||
client_policy_id: policy_id,
|
||||
};
|
||||
|
||||
// Send AJAX request
|
||||
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
|
||||
|
||||
console.log('Data fetched successfully:', response);
|
||||
|
||||
if (response.status == true) {
|
||||
toastr.success(response.message || 'Initiating successafully', 'SUCCESS');
|
||||
} else {
|
||||
toastr.error(response.message || 'Unable to fetch data', 'ERROR');
|
||||
}
|
||||
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
toastr.error('An error occurred while checking the CD amount.', 'ERROR');
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -64,6 +64,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- <div id="view_name"></div> -->
|
||||
<div id="report"></div>
|
||||
</div>
|
||||
|
||||
@ -131,19 +132,26 @@
|
||||
var toDate = $('#endDate').val();
|
||||
var category = $('#category').val();
|
||||
var report_type = $('#report_type').val();
|
||||
|
||||
if(category == false || report_type == false){
|
||||
alert("Please Fill the Mandatory Fields Category and Report Type to Proceed ..!! ");
|
||||
return ;
|
||||
}
|
||||
|
||||
var requestData = {
|
||||
fromDate: fromDate,
|
||||
toDate: toDate,
|
||||
category: category,
|
||||
report_type: report_type
|
||||
};
|
||||
console.log(typeof fromDate);
|
||||
|
||||
var url = '<?= base_url('/bdsReport/irba_report') ?>';
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
|
||||
if (response.status == true) {
|
||||
$('#report').html(response.html);
|
||||
// $('#view_name').html(response.view_name);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
|
||||
@ -31,6 +31,10 @@ table.dataTable tbody td {
|
||||
background-color: #ffffff; /* White shade */
|
||||
}
|
||||
|
||||
#scroll-horizontal-datatable tfoot .right-align-input {
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="col-12" id="second_page">
|
||||
@ -216,6 +220,7 @@ $(document).ready(function() {
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
className: 'app-btn-primary ',
|
||||
title: 'IRDA-BAP-CLIENT-List',
|
||||
footer:true
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
@ -225,6 +230,7 @@ $(document).ready(function() {
|
||||
orthogonal: 'sort'
|
||||
},
|
||||
className: 'app-btn-primary ',
|
||||
footer:true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -20,6 +20,10 @@ table.dataTable tbody td {
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#scroll-horizontal-datatable tfoot .right-align-input {
|
||||
text-align: right !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="col-12" id="second_page">
|
||||
@ -167,7 +171,7 @@ table.dataTable tbody td {
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tfoot align="right">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Grand Total</th>
|
||||
@ -299,12 +303,14 @@ $(document).ready(function() {
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
footer:true,
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
className: 'app-btn-primary ',
|
||||
title: 'IRDA-BAP-INSURER-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
footer:true,
|
||||
text: '<i class="mdi mdi-file-excel " ></i><span class=" btn-custom"> EXCEL </span>',
|
||||
className: 'app-btn-primary ',
|
||||
title: 'IRDA-BAP-INSURER-List',
|
||||
|
||||
@ -190,6 +190,14 @@
|
||||
// "box-shadow": "0px 4px 4px 0px #00000040"
|
||||
// });
|
||||
});
|
||||
|
||||
const observer = new MutationObserver(() => {
|
||||
document.querySelectorAll('.select2-search__field').forEach(el => {
|
||||
el.style.setProperty('box-shadow', 'none', 'important');
|
||||
});
|
||||
});
|
||||
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
@ -1049,7 +1057,11 @@
|
||||
$nav.find("li:first-child a").addClass("active active-tab");
|
||||
|
||||
// also need to find the tab name and show only active image
|
||||
let tab_name = $nav.find("li:first-child a").attr('href').split('-')[0];
|
||||
// let tab_name = $nav.find("li:first-child a").attr('href').split('-')[0];
|
||||
|
||||
let href = $nav.find("li:first-child a").attr('href');
|
||||
let tab_name = href ? href.split('-')[0] : '';
|
||||
|
||||
tab_name = tab_name.replace('#', '');
|
||||
|
||||
|
||||
@ -1145,6 +1157,61 @@ $(function(){
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
const insurer_category = {
|
||||
1: "general", 2: "general", 3: "general", 4: "general", 5: "general",
|
||||
6: "life", 7: "life", 8: "general", 9: "general", 10: "general",
|
||||
11: "general", 12: "general", 13: "general", 14: "general", 15: "general",
|
||||
16: "general", 17: "general", 18: "general", 19: "general", 20: "general",
|
||||
21: "general", 22: "general", 23: "general", 24: "general", 25: "general",
|
||||
26: "general", 27: "general", 28: "general", 29: "general", 30: "general",
|
||||
31: "general", 32: "life", 33: "general", 34: "life", 35: "general",
|
||||
36: "general", 37: "general", 38: "general", 39: "life", 40: "general",
|
||||
41: "general", 42: "general", 43: "general", 44: "general", 45: "general",
|
||||
46: "general", 47: "general", 48: "general", 49: "general", 50: "general",
|
||||
51: "general", 52: "general", 53: "general", 54: "general", 55: "general",
|
||||
56: "general", 57: "general", 58: "general", 59: "general", 60: "general",
|
||||
61: "general", 62: "general", 63: "general", 64: "general", 65: "general",
|
||||
66: "general", 67: "general", 68: "general", 69: "general", 70: "general",
|
||||
71: "general"
|
||||
};
|
||||
|
||||
function appendInsurerByCategory(data, object, type)
|
||||
{
|
||||
return true;
|
||||
|
||||
$(object).empty();
|
||||
|
||||
$(object).append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select Insurer'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
|
||||
var displayValue = item.insurer_name + ' - ' + item.branch_code;
|
||||
var dbValue = item.id+'-'+item.insurer_id
|
||||
|
||||
if(item.category == type){
|
||||
|
||||
var option = $('<option>', {
|
||||
value: dbValue,
|
||||
text: displayValue,
|
||||
'data-id': item.insurer_id,
|
||||
'data-bid': item.id,
|
||||
'data-ic': item.category,
|
||||
});
|
||||
|
||||
$(object).append(option);
|
||||
}
|
||||
});
|
||||
|
||||
$(object).select2();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
@ -355,6 +355,7 @@
|
||||
|
||||
.content-page {
|
||||
padding: 80px 15px 65px 15px !important;
|
||||
min-height: 1000px ;
|
||||
}
|
||||
|
||||
/* Media query for small screens */
|
||||
@ -1861,25 +1862,6 @@
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<!-- leads -->
|
||||
<?php if (in_array(get_role_id(), [1, 2, 3, 5]) || in_array(BUSINESS_SUPPORT_TEAM_ID, user_team()) || in_array(SALES_TEAM_ID, user_team())) { ?>
|
||||
<li class="li-seperate" id="leads-li">
|
||||
<a href="<?= base_url('/leads/list') ?>" class="img-inactive">
|
||||
<img
|
||||
src="<?= base_url() . "public"; ?>/assets/images/leads_sb.png" alt="Logo" height="20">
|
||||
<span> Leads </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<!-- Tickets -->
|
||||
<?php if (in_array(get_role_id(), [1, 2, 3, 4, 5]) || in_array(CLAIMS_TEAM_ID, user_team())) { ?>
|
||||
<li class="li-seperate" id="tickets-li">
|
||||
<a id="tickets" href="<?= base_url('/ticketList?return_type=web') ?>" class="waves-effect img-inactive">
|
||||
<img src="<?= base_url() . "public"; ?>/assets/images/ticket.png" alt="Logo" height="20">
|
||||
<span>Tickets</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<!-- BDS -->
|
||||
<?php if ((get_role_id() == 1 || get_role_id() == 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()) || in_array(POS_TEAM_ID, user_team()))) { ?>
|
||||
<li class="li-seperate" id="policy-transactions-li">
|
||||
@ -2034,6 +2016,26 @@
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<!-- leads -->
|
||||
<?php if (in_array(get_role_id(), [1, 2, 3, 5]) || in_array(BUSINESS_SUPPORT_TEAM_ID, user_team()) || in_array(SALES_TEAM_ID, user_team())) { ?>
|
||||
<li class="li-seperate" id="leads-li">
|
||||
<a href="<?= base_url('/leads/list') ?>" class="img-inactive">
|
||||
<img
|
||||
src="<?= base_url() . "public"; ?>/assets/images/leads_sb.png" alt="Logo" height="20">
|
||||
<span> Leads </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<!-- Tickets -->
|
||||
<?php if (in_array(get_role_id(), [1, 2, 3, 4, 5]) || in_array(CLAIMS_TEAM_ID, user_team())) { ?>
|
||||
<li class="li-seperate" id="tickets-li">
|
||||
<a id="tickets" href="<?= base_url('/ticketList?return_type=web') ?>" class="waves-effect img-inactive">
|
||||
<img src="<?= base_url() . "public"; ?>/assets/images/ticket.png" alt="Logo" height="20">
|
||||
<span>Tickets</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<!-- Ad -->
|
||||
<?php if (in_array(get_role_id(), [1, 2, 3, 5])) { ?>
|
||||
<li class="li-seperate" id="app-content-mng-li">
|
||||
|
||||
@ -1,3 +1,20 @@
|
||||
<?php
|
||||
$value = "";
|
||||
|
||||
if(isset($params['notification_data'])){
|
||||
$value = $params['notification_data'];
|
||||
}
|
||||
|
||||
if(isset($params['notification'])){
|
||||
$value = $params['notification'];
|
||||
}
|
||||
|
||||
$value = json_decode($value['mail_content_json'] ?? '[]', true);
|
||||
|
||||
$contentWidth = (int) $value['body']['values']['contentWidth'] ?? 500;
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
@ -10,7 +27,7 @@
|
||||
<style>
|
||||
|
||||
.mail-template-header {
|
||||
max-width: 500px;
|
||||
max-width: <?=$contentWidth?>px;
|
||||
background-color: #ffffff !important;
|
||||
border-bottom: 1px solid #00999E;
|
||||
width: 100%; /* default: allow full width */
|
||||
@ -26,12 +43,16 @@
|
||||
}
|
||||
|
||||
.mail-template-footer {
|
||||
max-width: 500px;
|
||||
max-width: <?=$contentWidth?>px;
|
||||
background-color: #ffffff !important;
|
||||
border-top: 1px solid #00999E;
|
||||
width: 100%; /* default: allow full width */
|
||||
}
|
||||
|
||||
p{
|
||||
margin:0 !important;
|
||||
}
|
||||
|
||||
/* On screens smaller than 600px → force 100% */
|
||||
@media screen and (max-width: 600px) {
|
||||
.mail-template-footer {
|
||||
@ -41,7 +62,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media screen and (max-width: 600px){
|
||||
|
||||
.header-div{
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.footer-div{
|
||||
width : 100% !important ;
|
||||
}
|
||||
}
|
||||
|
||||
.client_logo,
|
||||
.nhance_logo
|
||||
{
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@ -49,15 +85,21 @@
|
||||
|
||||
<body>
|
||||
<!-- header -->
|
||||
<div align="center">
|
||||
<div align="center" class="header-div">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mail-template-header">
|
||||
<tr style="height:90px; background-color: #ffffff !important;">
|
||||
<td align="left" valign="middle" style="padding:20px;" width="50%">
|
||||
<img src="<?= $client_logo?>"
|
||||
alt="Client Logo"
|
||||
style="max-height:80px; max-width: 160px;">
|
||||
<td align="left" class="client_logo" style="padding:5px;" width="50%">
|
||||
<div style="
|
||||
width:160px;
|
||||
height:80px;
|
||||
background-image:url('<?= $client_logo ?>');
|
||||
background-size:contain;
|
||||
background-repeat:no-repeat;
|
||||
">
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td align="right" valign="middle" style="padding:20px;" width="50%">
|
||||
<td align="right" class="nhance_logo" style="padding:5px;" width="50%">
|
||||
<img src="<?= base_url('/public/assets/images/Nhance-Logo-Final.png'); ?>"
|
||||
alt="Default Logo"
|
||||
style="height:auto; max-width: 120px;">
|
||||
@ -76,7 +118,7 @@
|
||||
|
||||
|
||||
<!-- footer -->
|
||||
<div align="center">
|
||||
<div align="center" class="footer-div">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mail-template-footer">
|
||||
<tr style="background-color: #ffffff !important;">
|
||||
<td align="center" valign="middle" style="padding-top:5px;">
|
||||
|
||||
@ -125,6 +125,7 @@
|
||||
|
||||
// print_r($notification);
|
||||
$member_welcome_mail = 0;
|
||||
$member_common_mail = 0 ;
|
||||
$member_reminder_mail = 0;
|
||||
$member_ecard_mail = 0;
|
||||
$member_review_and_summary_mail = 0;
|
||||
@ -137,6 +138,10 @@
|
||||
$member_welcome_mail = $value['enabled'];
|
||||
}
|
||||
|
||||
if ($value['template_name'] == 'member_common_mail') {
|
||||
$member_common_mail = $value['enabled'];
|
||||
}
|
||||
|
||||
if ($value['template_name'] == 'member_reminder_mail') {
|
||||
$member_reminder_mail = $value['enabled'];
|
||||
}
|
||||
@ -187,11 +192,9 @@
|
||||
<!-- mail section -->
|
||||
|
||||
|
||||
<!-- Member welcome mail row-->
|
||||
<div class="form-row">
|
||||
|
||||
<!-- Example: Member welcome mail -->
|
||||
<div class="form-group col-md-6 mail-row">
|
||||
<!-- <div class="form-group col-md-6 mail-row">
|
||||
<div class="mail-section">
|
||||
<div class="left">
|
||||
<label class="switch">
|
||||
@ -206,10 +209,9 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> -->
|
||||
<!-- Example: Member reminder mail -->
|
||||
<div class="form-group col-md-6 mail-row">
|
||||
<!-- <div class="form-group col-md-6 mail-row">
|
||||
<div class="mail-section">
|
||||
<div class="left">
|
||||
<label class="switch">
|
||||
@ -224,12 +226,12 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<!-- Member Ecard mail row-->
|
||||
|
||||
<div class="form-row">
|
||||
<!-- Member Ecard mail row-->
|
||||
<div class="form-group col-md-6 mail-row">
|
||||
<div class="mail-section">
|
||||
<div class="left">
|
||||
@ -246,7 +248,25 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6 mail-row">
|
||||
<div class="mail-section">
|
||||
<div class="left">
|
||||
<label class="switch">
|
||||
<input id="member_common_mail_btn" type="checkbox" name="member_common_mail_btn" <?= $member_common_mail == 1 ? 'checked' : '' ?>>
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
<span class="ml-2"> Common Mail </span>
|
||||
</div>
|
||||
<div class="right">
|
||||
<a href="" data-toggle="modal" id="member_common_mail" onclick="getMailTemplateData(this)" data-target="#member_common_mail_modal">
|
||||
<i class="mdi mdi-pencil"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- member review and summary mail -->
|
||||
<!-- <div class="form-group col-md-6 mail-row">
|
||||
<div class="mail-section">
|
||||
<div class="left">
|
||||
<label class="switch">
|
||||
@ -263,12 +283,13 @@
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<!-- Account Manager Summary Mail row-->
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6 mail-row">
|
||||
<!-- Account Manager Summary Mail row-->
|
||||
<!-- <div class="form-group col-md-6 mail-row">
|
||||
<div class="mail-section">
|
||||
<div class="left">
|
||||
<label class="switch">
|
||||
@ -283,8 +304,9 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-6 mail-row">
|
||||
</div> -->
|
||||
<!-- client hr summary mail -->
|
||||
<!-- <div class="form-group col-md-6 mail-row">
|
||||
<div class="mail-section">
|
||||
<div class="left">
|
||||
<label class="switch">
|
||||
@ -299,7 +321,7 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
@ -320,6 +342,110 @@
|
||||
<!-- end -->
|
||||
|
||||
|
||||
<!-- Modal content for the Large example -->
|
||||
<div class="modal fade" id="member_common_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
||||
aria-hidden="true" aria-modal="true" data-backdrop="static">
|
||||
<div class="modal-dialog modal-full-width scrollb">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myLargeModalLabel">Common mail <span id="nameOfThePolicy"></span></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="text-center" id="no_data"></div>
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="member_common_mail_form" enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" class="form-control" id="template_name" name="template_name" value="Common Mail" readonly>
|
||||
<input type="hidden" id="member_common_mail_template_name" value="member_common_mail">
|
||||
<input type="hidden" id="notification_temp_id" name="notification_temp_id">
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-2">
|
||||
<label for="emp_code">Template Name</label>
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<input type="text" id="template_name" name="template_name" class="form-control" value="Member Common Mail" readonly placeholder="Template Name">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-2">
|
||||
<label for="emp_code">Email(s)</label>
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<input type="text" id="common_mail" name="common_mail" class="form-control" placeholder="Enter Emails">
|
||||
<p style="color: black;font-size:12px;"> (* Multiple Emails Should Be Comma Seperated)</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-2">
|
||||
<label for="emp_code">Subject</label>
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2 testmail" >
|
||||
<a class="btn btn-primary waves-effect waves-light mr-1 setid" onclick="testMailSend(this)">Test Mail</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<select id="member_common_mail_modal_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;" onchange="copyToClipboard(this)">
|
||||
<option value="">PlaceHolders</option>
|
||||
<?php foreach ($placeHolders as $value): ?>
|
||||
<?php if ($value == 'member_name' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name' || $value == 'member_summary') { ?>
|
||||
<?php $valueChange = str_replace('_', ' ', $value);
|
||||
$valueChange = ucwords($valueChange); ?>
|
||||
<option value="{{<?php echo $value; ?>}}"><?php echo $valueChange; ?></option>
|
||||
<?php } ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<span id="copy-feedback" style="display: none; position: absolute; top: 50px; right: 10px; color: green; font-size: 12px;">Copied to clipboard!</span>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<!-- Unlayer editor -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<div id="member_common_mail_editor_container" style="height: 600px"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="file" id="Question_title_fileInput" style="display: none;">
|
||||
|
||||
<table data-custom-table-css="table" id="attachment_table" class="table table-sm mb-0" style="margin-top: 30px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attachments</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="attachment_tbody">
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="button" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
onclick="sendCommonMails()" > Send Common Mails </button>
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnGridSubmit_2">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
<!-- Modal content for the Large example -->
|
||||
<div class="modal fade" id="member_welcome_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
||||
@ -1221,7 +1347,7 @@
|
||||
});
|
||||
|
||||
} else {
|
||||
let alert_msg = 'Template ID not exist'
|
||||
let alert_msg = 'Template ID not exist , Kindly Save to Send Test Mails ..!!'
|
||||
toastr.warning(alert_msg, 'WARNING');
|
||||
}
|
||||
|
||||
@ -1236,6 +1362,85 @@
|
||||
|
||||
}
|
||||
|
||||
function sendCommonMails(){
|
||||
|
||||
// test mail list
|
||||
let test_mail_list = $('#common_mail').val();
|
||||
|
||||
|
||||
let test_mail = test_mail_list.split(',')[0] ?? '';
|
||||
|
||||
if (test_mail !== null || test_mail !== "") {
|
||||
|
||||
console.log("valid email or not");
|
||||
console.log(test_mail);
|
||||
|
||||
test_mail = test_mail.replace(/\s+/g, '').trim();
|
||||
|
||||
console.log("is valid email check");
|
||||
console.log(isValidEmail((test_mail)));
|
||||
|
||||
if (isValidEmail(test_mail)) {
|
||||
|
||||
var template_id = $('#notification_temp_id').val();
|
||||
|
||||
console.log("template_id");
|
||||
console.log(template_id);
|
||||
|
||||
if (template_id) {
|
||||
|
||||
console.log("testmail ..!!");
|
||||
console.log(test_mail);
|
||||
|
||||
let url = '<?= base_url('util/sendCommonTestMail') ?>';
|
||||
console.log('testing mail url:', url);
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "POST",
|
||||
data:{
|
||||
template_id,
|
||||
test_mail,
|
||||
test_mail_list
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('Test mail send function response', res)
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
if (res.status == true) {
|
||||
|
||||
let respond = res.respond;
|
||||
console.log('Parsed respond', respond)
|
||||
|
||||
if (respond.status == 'success') {
|
||||
toastr.success(respond.message, 'SUCCESS')
|
||||
} else {
|
||||
toastr.warning(respond.message, 'WARNING')
|
||||
}
|
||||
|
||||
} else {
|
||||
toastr.warning('Failed to sent mail', 'WARNING')
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function isValidEmail(email) {
|
||||
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
||||
return emailPattern.test(email);
|
||||
@ -1248,7 +1453,8 @@
|
||||
var container = '';
|
||||
if (template_name == 'member_welcome_mail') {
|
||||
container = document.getElementById('attachment_tbody');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
container = document.getElementById('attachment_tbody_ecard');
|
||||
}
|
||||
|
||||
@ -1399,6 +1605,8 @@
|
||||
submitButton.innerText = 'Submit';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function removeAttachment(id) {
|
||||
@ -1563,7 +1771,7 @@
|
||||
function getMailTemplateData(element) {
|
||||
template_name = element.id;
|
||||
const validTemplates = [
|
||||
"account_maneger_summary_mail", "member_reminder_mail", "member_ecard_mail", "member_welcome_mail", "member_review_and_summary_mail", "client_hr_summary_mail"
|
||||
"account_maneger_summary_mail", "member_reminder_mail","member_common_mail", "member_ecard_mail", "member_welcome_mail", "member_review_and_summary_mail", "client_hr_summary_mail"
|
||||
];
|
||||
|
||||
if (!validTemplates.includes(template_name)) {
|
||||
@ -1635,7 +1843,11 @@
|
||||
$('#attachment_table').toggle(!!res.id);
|
||||
$('#attachment_table_ecard').toggle(!!res.id);
|
||||
$('.setid').attr('data-id', res.id || '');
|
||||
} else {
|
||||
if (template_name == "member_common_mail"){
|
||||
$('#notification_temp_id').val(res.id);
|
||||
}
|
||||
}
|
||||
else{
|
||||
console.log("Inside else");
|
||||
let retryCount = 0;
|
||||
const initWithRetry = function() {
|
||||
@ -1660,6 +1872,13 @@
|
||||
initWithRetry();
|
||||
}
|
||||
|
||||
|
||||
if(res.comman_mails != ""){
|
||||
console.log("common mails recieved here ........!!!!!!!!!!!");
|
||||
console.log(res);
|
||||
$('#common_mail').val(res.comman_mails);
|
||||
}
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
},
|
||||
@ -1916,6 +2135,64 @@
|
||||
});
|
||||
});
|
||||
|
||||
$('#member_common_mail_form').submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
// Check if editor instance exists
|
||||
if (!editor) {
|
||||
console.error("Editor not initialized");
|
||||
toastr.error("Editor not ready. Please try again.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Use the editor instance instead of unlayer directly
|
||||
editor.exportHtml(function(data) {
|
||||
var formData = $('#member_common_mail_form').serializeArray();
|
||||
|
||||
// Append Unlayer editor data
|
||||
formData.push({
|
||||
name: 'mailContent',
|
||||
value: data.html
|
||||
});
|
||||
formData.push({
|
||||
name: 'client_id',
|
||||
value: $('#general_PrimaryKey').val()
|
||||
});
|
||||
formData.push({
|
||||
name: 'mailJson',
|
||||
value: JSON.stringify(data.design)
|
||||
});
|
||||
|
||||
// Show loading indicators
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var form_action = '<?= base_url("client/notification/create") ?>';
|
||||
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
$('#member_common_mail_modal').find('.close').click();
|
||||
toastr.success('Template saved successfully');
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Went Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('#member_review_and_summary_mail_form').submit(function(event) {
|
||||
event.preventDefault();
|
||||
@ -2082,6 +2359,7 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('click', '#notification_enable_form_submit', function() {
|
||||
var formData = [];
|
||||
console.log($('#hr_mail_id').val());
|
||||
@ -2118,6 +2396,10 @@
|
||||
name: 'member_ecard_mail_btn',
|
||||
value: $('#member_ecard_mail_btn').prop('checked')
|
||||
});
|
||||
formData.push({
|
||||
name: 'member_common_mail_btn',
|
||||
value: $('#member_common_mail_btn').prop('checked')
|
||||
});
|
||||
formData.push({
|
||||
name: 'member_review_and_summary_mail_btn',
|
||||
value: $('#member_review_and_summary_mail_btn').prop('checked')
|
||||
|
||||
@ -40,24 +40,10 @@
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label for="client_branch">Client<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="0">Select Client</option>
|
||||
<?php
|
||||
if (isset($clients) && count($clients)) {
|
||||
foreach ($clients as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="addon_policy"> Insurer <span id="base_danger"
|
||||
class="text-danger"></span></label>
|
||||
<select class="form-control" id="insurer_id" name="insurer_id">
|
||||
<label for="addon_policy"> Insurer <span
|
||||
class="text-danger">*</span></label>
|
||||
<select class="form-control" id="insurer_id" name="insurer_id" onchange="getInsurerBranch()">
|
||||
<option value="0" selected>Select Insurer</option>
|
||||
<?php if (isset($insurer) && count($insurer)) { ?>
|
||||
<?php foreach ($insurer as $value) { ?>
|
||||
@ -68,65 +54,13 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="addon_policy"> Insurer Branch<span id="base_danger"
|
||||
class="text-danger"></span></label>
|
||||
<select class="form-control" id="insurer_id" name="insurer_id">
|
||||
<label for="addon_policy"> Insurer Branch<span
|
||||
class="text-danger">*</span></label>
|
||||
<select class="form-control" id="insurer_branch_id" name="insurer_branch_id">
|
||||
<option value="0" selected>Select Insurer Branch</option>
|
||||
<?php if (isset($insurer) && count($insurer)) { ?>
|
||||
<?php foreach ($insurer as $value) { ?>
|
||||
<option value="<?= $value['id'] ?>"><?= $value['name'] ?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label for="email"> Policy Type <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="policy_type_id" name="policy_type_id">
|
||||
<option value="0">Select Policy Type</option>
|
||||
<?php
|
||||
if (isset($policy_types) && count($policy_types)) {
|
||||
foreach ($policy_types as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div> -->
|
||||
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label for="client_branch">Issuer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="issuer" name="issuer" required>
|
||||
<option value="0">Select Issure</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div> -->
|
||||
|
||||
<!-- </div>
|
||||
|
||||
<div class="form-row"> -->
|
||||
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label>Date Type<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="date_type" name="date_type"
|
||||
onchange="hideDateField()">
|
||||
<option value="0">Select Date Type</option>
|
||||
<?php
|
||||
if (isset($date_type) && count($date_type)) {
|
||||
foreach ($date_type as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-4" style="display: true;" id="date_div">
|
||||
<label>Statement Month<span class="text-danger"></span></label>
|
||||
<div class="input-icon">
|
||||
@ -242,12 +176,12 @@
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
title: 'Outstanding Report',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: '<i class="mdi mdi-file-excel " ></i><span class=" btn-custom"> EXCEL </span>',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
title: 'Outstanding Report',
|
||||
customize: function(xlsx) {
|
||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
var total = 0;
|
||||
@ -294,6 +228,7 @@
|
||||
getURLParams()
|
||||
$('#client_id').select2();
|
||||
$('#insurer_id').select2();
|
||||
$('#insurer_branch_id').select2();
|
||||
$('#policy_type_id').select2();
|
||||
})
|
||||
|
||||
@ -304,10 +239,17 @@
|
||||
var end_date = $('#endDate').val();
|
||||
var client_id = $('#client_id').val();
|
||||
var insurer_id = $('#insurer_id').val();
|
||||
var insurer_branch_id = $('#insurer_branch_id').val();
|
||||
var policy_type_id = $('#policy_type_id').val();
|
||||
var date_type = $('#date_type').val();
|
||||
var issuer = $('#issuer').val();
|
||||
|
||||
if(insurer_id == false || insurer_branch_id == false){
|
||||
alert("Please Choose Insurer and its branch to Proceed .. !!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
console.log(start_date + '-' + end_date);
|
||||
|
||||
var queryParams = {
|
||||
@ -315,6 +257,7 @@
|
||||
end_date: end_date,
|
||||
client_id: client_id,
|
||||
insurer_id: insurer_id,
|
||||
insurer_branch_id : insurer_branch_id,
|
||||
policy_type_id: policy_type_id,
|
||||
date_type: date_type,
|
||||
issuer: issuer,
|
||||
@ -338,6 +281,7 @@
|
||||
const endDate = params.get('end_date') || 0; // Default to 0 if not found
|
||||
const client_id = params.get('client_id') || 0; // Default to 0 if not found
|
||||
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
|
||||
const insurer_branch_id = params.get('insurer_branch_id') || 0 ; // Default to 0 if not found
|
||||
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
|
||||
const date_type = params.get('date_type') || 0; // Default to 0 if not found
|
||||
const issuer = params.get('issuer') || 0; // Default to 0 if not found
|
||||
@ -348,6 +292,7 @@
|
||||
console.log('endDate', endDate)
|
||||
console.log('client_id', client_id)
|
||||
console.log('insurer_id', insurer_id)
|
||||
console.log('insurer_branch_id',insurer_branch_id)
|
||||
console.log('policy_type_id', policy_type_id)
|
||||
console.log('date_type', date_type)
|
||||
console.log('issuer', issuer)
|
||||
@ -361,7 +306,8 @@
|
||||
$('#start_date').val(startDate)
|
||||
$('#end_date').val(endDate)
|
||||
$('#client_id').val(client_id).change()
|
||||
$('#insurer_id').val(insurer_id).change()
|
||||
$('#insurer_id').val(insurer_id)
|
||||
$('#insurer_branch_id').val(insurer_branch_id).change()
|
||||
$('#policy_type_id').val(policy_type_id).change()
|
||||
$('#date_type').val(date_type)
|
||||
$('#issuer').val(issuer)
|
||||
@ -415,6 +361,7 @@
|
||||
// Reset all select dropdowns to the first option
|
||||
$('#client_id').val('0').change();
|
||||
$('#insurer_id').val('0').change();
|
||||
$('#insurer_branch_id').val('0').change();
|
||||
$('#policy_type_id').val('0').change();
|
||||
$('#date_type').val('0');
|
||||
$('#issuer').val('0');
|
||||
@ -457,4 +404,68 @@
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
}
|
||||
|
||||
function getInsurerBranch(){
|
||||
|
||||
let insurer_id = $('#insurer_id').val();
|
||||
|
||||
if(insurer_id == 0){
|
||||
return;
|
||||
}
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn('slow');
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url('master/insurer/branch/getList?') ?>',
|
||||
type: 'POST',
|
||||
data: {insurer_id},
|
||||
success: function(response) {
|
||||
|
||||
console.log(response)
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
if (response.data && response.data != []) {
|
||||
|
||||
let options ="";
|
||||
let insurer_branch_list = response.data;
|
||||
|
||||
insurer_branch_list.forEach(element => {
|
||||
options += `<option value="${element['id']}"> ${element['branch_name']} </option>`;
|
||||
});
|
||||
|
||||
$('#insurer_branch_id').html('<option value="0" selected>Select Insurer Branch</option>' + options);
|
||||
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
// Handle error
|
||||
console.error('Upload error occurred:');
|
||||
console.error('Status: ', status); // Status of the request
|
||||
console.error('Error: ', error); // Specific error message
|
||||
console.error('XHR Object: ', xhr); // Full XHR object with response details
|
||||
|
||||
// Optionally log server response, if available
|
||||
if (xhr.responseText) {
|
||||
console.error('Response Text: ', xhr.responseText);
|
||||
}
|
||||
|
||||
toastr.warning('Error uploading file', 'WARNING');
|
||||
console.error('Upload error:', error);
|
||||
},
|
||||
complete: function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log("Ajax call completed successfully");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@ -243,7 +243,7 @@
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="addon_policy">Policy Issue Month<span id="base_danger" class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="month" name="month" placeholder="MM/YYYY" >
|
||||
<input type="text" class="form-control" id="month" name="month" placeholder="MM/YYYY" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
|
||||
@ -1339,6 +1339,7 @@
|
||||
let isVehicleFormSubmitting = false;
|
||||
var insurer_count_array = [];
|
||||
var redirect_url = '<?= base_url('policy_tranction/inception/list') ?>';
|
||||
let insurer_data = <?= json_encode($insurer_branch ?? []) ?>;
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
@ -1668,6 +1669,19 @@
|
||||
var value = $(this).val();
|
||||
var selectedOption = $(this).find('option:selected');
|
||||
|
||||
let category = insurer_category[value] ?? null;
|
||||
console.log('insurer_category', category);
|
||||
// console.log('insurer_data', insurer_data);
|
||||
|
||||
// loop through all select fields
|
||||
$('[name="follow_insurer_id[]"]').each(function () {
|
||||
let select = $(this);
|
||||
if(select){
|
||||
appendInsurerByCategory(insurer_data, select, category);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var ebp = selectedOption.data('ebp');
|
||||
var etp = selectedOption.data('etp');
|
||||
var etep = selectedOption.data('etep');
|
||||
@ -1924,17 +1938,19 @@
|
||||
let insurer = $(this).val();
|
||||
let unique_id = $(this).data('count');
|
||||
let client_id = $('#client_id').val();
|
||||
let policy_type_id = $('#policy_type_id').val();
|
||||
|
||||
console.log('insurer', insurer);
|
||||
console.log('policy_type_id', policy_type_id);
|
||||
console.log('follow_insurer_id client_id', client_id);
|
||||
console.log('follow_insurer_id unique_id', unique_id);
|
||||
|
||||
$('#insurer_id').val(insurer)
|
||||
|
||||
if(!client_id){
|
||||
$(this).val('').select2();
|
||||
toastr.warning('Please select the Client', 'WARNING');
|
||||
}
|
||||
if (!policy_type_id || !client_id) {
|
||||
$(this).val('').select2();
|
||||
toastr.warning(!policy_type_id ? 'Please select the Policy Type' : 'Please select the Client', 'WARNING');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@ -4379,7 +4395,7 @@
|
||||
<select class="form-control follow_insurer" data-count="${insurerCount}" id="follow_insurer_id_${insurerCount}" name="follow_insurer_id[]" onchange="getCDAccountNumber(this)">
|
||||
<option value="" selected>Select Insurer</option>
|
||||
<?php foreach ($insurer_branch as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>">
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>" data-ic="<?= $value['category'] ?>">
|
||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
@ -4521,7 +4537,7 @@
|
||||
<select class="form-control follow_insurer" data-count="${insurerCount}" id="follow_insurer_id_${insurerCount}" name="follow_insurer_id[]" onchange="getCDAccountNumber(this)">
|
||||
<option value="" selected>Select Insurer</option>
|
||||
<?php foreach ($insurer_branch as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>">
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>" data-ic="<?= $value['category'] ?>">
|
||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
@ -4620,7 +4636,16 @@
|
||||
|
||||
$(this).append(newCell);
|
||||
|
||||
$('#follow_insurer_id_' + insurerCount).select2()
|
||||
let select = $('#follow_insurer_id_' + insurerCount);
|
||||
let add_insurer_policy_type_id = $('#policy_type_id').val();
|
||||
let category = insurer_category[add_insurer_policy_type_id] ?? null;
|
||||
|
||||
if(select && category){
|
||||
appendInsurerByCategory(insurer_data, select, category);
|
||||
}
|
||||
|
||||
$('#follow_insurer_id_' + insurerCount).select2();
|
||||
|
||||
|
||||
var selectedOption = $('#policy_type_id').find('option:selected');
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ table.dataTable tbody td {
|
||||
<th>S. No</th>
|
||||
<th style="display: none;">User</th>
|
||||
<th>Month</th>
|
||||
<!-- <th style="display: none;">Business Type</th> -->
|
||||
<th style="display: none;">Business Type</th>
|
||||
<th style="display: none;">Client Type</th>
|
||||
<th>Insured Name</th>
|
||||
<th>Policy/<br>Endorsement</th>
|
||||
@ -125,7 +125,7 @@ table.dataTable tbody td {
|
||||
?>" class="mdi mdi-pencil" ></a> </td>
|
||||
<td style="display: none;"><?php echo $row['user_name'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['policy_issue_month'] ?: 'N/A'; ?></td>
|
||||
<!-- <td style="display: none;"><?php echo $row['revenue_type'] ?: 'N/A'; ?></td> -->
|
||||
<td style="display: none;"><?php echo $row['revenue_type'] ?: 'N/A'; ?></td>
|
||||
<td style="display: none;"><?php echo $row['client_type'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['client_name'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['action_type'] ?: 'N/A'; ?></td>
|
||||
@ -142,21 +142,37 @@ table.dataTable tbody td {
|
||||
<td style="display: none;"><?php echo empty($row['policy_end_date']) ? 'N/A' : date('d/m/Y', strtotime($row['policy_end_date'])); ?></td>
|
||||
<td style="display: none;"><?php echo $row['ref'] ?: 'N/A'; ?></td>
|
||||
<td style="display: none;"><?php echo $row['remarks'] ?: 'N/A'; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['bp_amt']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['tp_or_ter']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['bp_amt'] ?: '0.00'; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['tp_or_ter'] ?: '0.00'; ?></td>
|
||||
<td class="right-align-input" style="display: none;"><?php echo $row['premium_wo_gst']; ?></td>
|
||||
<!-- <td class="right-align-input" style="display: none;"><?php echo $row['gst_amount']; ?></td> -->
|
||||
<td class="right-align-input"><?php echo $row['total_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_bp_per']; ?> %</td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_tp_or_ter_per'];?> %</td>
|
||||
<td class="right-align-input"><?php echo $row['total_premium'] ?: '0.00'; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_bp_per'] ?: '0.00'; ?> %</td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_tp_or_ter_per'] ?: '0.00';?> %</td>
|
||||
<td class="right-align-input" style="display: none;"><?php echo isset($row['reward']) ? $row['reward'] : '0.00'; ?></td>
|
||||
|
||||
<?php $total_irda_amt = empty($row['total_irda_amt']) ? $row['exp_amt'] : $row['total_irda_amt']; ?>
|
||||
<?php
|
||||
// Below Line its old version i am removed. reason no value ['total_irda_amt'] means taken as ['exp_amt'] so.
|
||||
// LN156 - $total_irda_amt = empty($row['total_irda_amt']) ? $row['exp_amt'] : $row['total_irda_amt'];
|
||||
// Here i am compare [total_irda_amt] and [exp_amt] i am print the larger value.
|
||||
// both are equal, print either value.
|
||||
// both are zero , empty/null , any one is empty or null means => i am print 0.00.
|
||||
// REF : Velmurugan but he told handle in query
|
||||
// Date : 6/11/25 12:50
|
||||
$irda_amt = isset($row['total_irda_amt']) && $row['total_irda_amt'] !== '' ? (float)$row['total_irda_amt'] : 0;
|
||||
$exp_amt = isset($row['exp_amt']) && $row['exp_amt'] !== '' ? (float)$row['exp_amt'] : 0;
|
||||
$max_amount = max($irda_amt, $exp_amt);
|
||||
$total_irda_amt = number_format($max_amount, 2, '.', ''); ?>
|
||||
<td class="right-align-input" onclick="showCoShareStatementDetails(this)" data-id="<?= $row['pt_id'] ?>"><?php echo $total_irda_amt; ?></td>
|
||||
<td class="right-align-input"><?php echo empty($row['billed_amt']) ? '0.00' : $row['billed_amt'] ?></td>
|
||||
<!-- <td class="right-align-input"><?php echo empty($row['unbilled_amt']) ? '0.00' : $row['unbilled_amt']?></td> -->
|
||||
<?php
|
||||
$unbilled_amt = $row['total_irda_amt'] - $row['billed_amt'];
|
||||
// Below Line its old version so commanded reason they direct taken as ['total_irda_amt'] from array.
|
||||
// $unbilled_amt = $row['total_irda_amt'] - $row['billed_amt'];
|
||||
// now stored total_irda_amt value taken here
|
||||
// REF : Velmurugan but he told handle in query
|
||||
// Date : 6/11/25 12:50
|
||||
$unbilled_amt = $total_irda_amt - $row['billed_amt'];
|
||||
$unbilled_amt = $unbilled_amt == 0 && $row['billed_amt'] == 0 ? $total_irda_amt : $unbilled_amt ;
|
||||
?>
|
||||
<td class="right-align-input"><?php echo number_format((float)$unbilled_amt,2, '.', '')?></td>
|
||||
@ -279,18 +295,44 @@ $(document).ready(function() {
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
exportOptions: {
|
||||
columns: ':visible', // or specify exact columns [0,1,2,...]
|
||||
columns: function (idx, data, node) {
|
||||
return true; // ✅ include all columns (even hidden)
|
||||
},
|
||||
format: {
|
||||
body: function (data, row, column, node) {
|
||||
// Force K and L columns to string
|
||||
if (column === 10 || column === 11) {
|
||||
// Option 1: prepend single quote
|
||||
return '\u200C' + data;
|
||||
|
||||
// Option 2: use Excel formula trick
|
||||
// return '="' + data + '"';
|
||||
data = data.replace(/ /g, '').replace(/\s+/g, ' ').trim();
|
||||
|
||||
// If it's the first, 20th, 10th, or 11th column, clean the data
|
||||
if (column === 0 || column === 20 || column === 10 || column === 11) {
|
||||
// Remove all <a> tags and their contents first
|
||||
data = data.replace(/<a[^>]*>.*?<\/a>/gi, '');
|
||||
|
||||
// Convert any HTML entities / remaining tags to plain text
|
||||
// (jQuery used only for HTML decoding; you can replace with DOMParser if you prefer)
|
||||
data = $('<div>').html(data).text();
|
||||
|
||||
// Normalize NBSP to space
|
||||
data = data.replace(/\u00A0/g, ' ');
|
||||
|
||||
// Remove BOM, zero-width, and control characters
|
||||
data = data.replace(/[\u0000-\u001F\u007F-\u009F\u200B-\u200F\uFEFF]/g, '').trim();
|
||||
}
|
||||
|
||||
// Do NOT prepend \u200C. Return raw cleaned value.
|
||||
// If you need to force Excel as string, use the formula trick or prepend a single apostrophe.
|
||||
if (column === 10 || column === 11) {
|
||||
// Option A: return as Excel formula to preserve formatting
|
||||
// return '="' + data + '"';
|
||||
|
||||
// Option B: prepend apostrophe (visible in Excel formula bar, not in cell)
|
||||
// return "'" + data;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
return data;
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -458,32 +500,61 @@ $(document).ready(function() {
|
||||
var api = this.api();
|
||||
|
||||
// Calculate column totals (adjust indices based on VISIBLE columns)
|
||||
var totalPremium = api.column(20, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
// var totalPremium = api.column(20, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b || 0);
|
||||
// }, 0);
|
||||
|
||||
var total_rewards = api.column(23, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
// var total_rewards = api.column(23, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b || 0);
|
||||
// }, 0);
|
||||
|
||||
var totalIrda = api.column(24, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
// var totalIrda = api.column(24, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b || 0);
|
||||
// }, 0);
|
||||
|
||||
var totalBilled = api.column(25, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
// var totalBilled = api.column(25, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b || 0);
|
||||
// }, 0);
|
||||
|
||||
var totalUnbilled = api.column(26, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
// var totalUnbilled = api.column(26, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b || 0);
|
||||
// }, 0);
|
||||
|
||||
// Update the totals
|
||||
// $('#total_premium').text(totalPremium.toFixed(2));
|
||||
// $('#total_rewards').text(total_rewards.toFixed(2));
|
||||
// $('#total_irda').text(totalIrda.toFixed(2));
|
||||
// $('#total_billed').text(totalBilled.toFixed(2));
|
||||
// $('#total_unbilled').text(totalUnbilled.toFixed(2));
|
||||
|
||||
// Helper to sum numeric values safely
|
||||
var getTotal = function(colIndex) {
|
||||
return api.column(colIndex, { search: 'applied' }).data()
|
||||
.reduce(function(a, b) {
|
||||
var x = parseFloat(a) || 0;
|
||||
var y = parseFloat(
|
||||
(typeof b === 'string') ? b.replace(/[^0-9.\-]+/g, '') : b
|
||||
) || 0;
|
||||
return x + y;
|
||||
}, 0);
|
||||
};
|
||||
|
||||
// Compute totals by column index
|
||||
var totalPremium = getTotal(21);
|
||||
var totalRewards = getTotal(24);
|
||||
var totalIrda = getTotal(25);
|
||||
var totalBilled = getTotal(26);
|
||||
var totalUnbilled = getTotal(27);
|
||||
|
||||
// Update the totals section above the table
|
||||
$('#total_premium').text(totalPremium.toFixed(2));
|
||||
$('#total_rewards').text(total_rewards.toFixed(2));
|
||||
$('#total_rewards').text(totalRewards.toFixed(2));
|
||||
$('#total_irda').text(totalIrda.toFixed(2));
|
||||
$('#total_billed').text(totalBilled.toFixed(2));
|
||||
$('#total_unbilled').text(totalUnbilled.toFixed(2));
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
@ -147,7 +147,13 @@
|
||||
|
||||
<!-- end page title -->
|
||||
<div id="file_list">
|
||||
<?php include('report_bds.php'); ?>
|
||||
<?php
|
||||
if( isset($list_new) && $list_new ){
|
||||
include('report_bds_new.php');
|
||||
}else{
|
||||
include('report_bds.php');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -159,26 +159,14 @@
|
||||
$uniqueAgreedAmountPerInsurer = "$policy_no-$policy_type-$client_name-$insurer_branch_name" ;
|
||||
|
||||
|
||||
$pastMonth = explode("-",$uniqueRecord )[1] ;
|
||||
$currentMonth = $policy_updated_month ;
|
||||
|
||||
$pastStatementStatus = explode("-",$uniqueRecord )[5] ;
|
||||
$currentStatementStatus = $statement_status;
|
||||
|
||||
if(
|
||||
isset($uniquePoliciesReport[$uniqueRecord])
|
||||
&& $pastStatementStatus == $currentStatementStatus
|
||||
){
|
||||
continue ;
|
||||
}else{
|
||||
|
||||
if(isset($uniqueAgreedAmountList[$uniqueAgreedAmountPerInsurer]) ){
|
||||
|
||||
|
||||
$uniqueAgreedAmountList[$uniqueAgreedAmountPerInsurer] -= $row['billed_amt'];
|
||||
$row['total_irda_amt'] = $pastMonth == $currentMonth ? $row['total_irda_amt'] : 0 ;
|
||||
$row['total_irda_amt'] = 0 ;
|
||||
$row['outstanding_amt'] = $uniqueAgreedAmountList[$uniqueAgreedAmountPerInsurer];
|
||||
$row['multiple_months'] = $pastMonth == $currentMonth ? false : true ;
|
||||
$row['multiple_months'] = true ;
|
||||
}
|
||||
else{
|
||||
$row['outstanding_amt'] = $row['total_irda_amt'] - $row['billed_amt'];
|
||||
@ -189,7 +177,7 @@
|
||||
|
||||
|
||||
$uniquePoliciesReport[$uniqueRecord] = $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -220,7 +208,7 @@
|
||||
echo base_url('policy_tranction/endorsement/list') . '?pt_id=' . $row['id'] ;
|
||||
}
|
||||
?>" class="mdi mdi-pencil" ></a> </td>
|
||||
<td ><?php echo $row['statement_uploaded'] == 'statement uploaded' && $row['multiple_months'] == true ? 'rewards': $row['user_name']??'N/A' ; ?></td>
|
||||
<td ><?php echo $row['statement_uploaded'] == 'statement uploaded' && $row['multiple_months'] == true && $row['reward'] != "0" ? 'rewards': $row['user_name']??'N/A' ; ?></td>
|
||||
<td><?php echo $row['policy_issue_month'] ?: 'N/A'; ?></td>
|
||||
<td style="display: none;"><?php echo $row['statement_uploaded'] ?: 'N/A'; ?></td>
|
||||
<!-- <td style="display: none;"><?php echo $row['revenue_type'] ?: 'N/A'; ?></td> -->
|
||||
|
||||
@ -160,19 +160,19 @@
|
||||
<table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>S.No </th>
|
||||
<th>Client </th>
|
||||
<th>Client Branch </th>
|
||||
<th>Insurer </th>
|
||||
<th>Insurer Branch </th>
|
||||
<th>Policy </th>
|
||||
<th>Endorsement No </th>
|
||||
<th>Premium </th>
|
||||
<th>Statement Premium </th>
|
||||
<th>Premium Variance </th>
|
||||
<th>Expected Amount </th>
|
||||
<th>Statement Amount </th>
|
||||
<th>Variance </th>
|
||||
<th>S.No </th>
|
||||
<th>Client </th>
|
||||
<th>Client Branch </th>
|
||||
<th>Insurer </th>
|
||||
<th>Insurer Branch </th>
|
||||
<th>Policy </th>
|
||||
<th>Endorsement No </th>
|
||||
<th>Premium </th>
|
||||
<th>Statement Premium </th>
|
||||
<th>Premium Variance </th>
|
||||
<th>Expected Amount </th>
|
||||
<th>Statement Amount </th>
|
||||
<th>Variance </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -231,12 +231,12 @@
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
title: 'Variance-Report-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: '<i class="mdi mdi-file-excel " ></i><span class=" btn-custom"> EXCEL </span>',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
title: 'Variance-Report-List',
|
||||
customize: function(xlsx) {
|
||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
var total = 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user