diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 54b05f32..bbddfdec 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -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'); diff --git a/app/Controllers/ApiServiceController.php b/app/Controllers/ApiServiceController.php new file mode 100644 index 00000000..5b32cec1 --- /dev/null +++ b/app/Controllers/ApiServiceController.php @@ -0,0 +1,299 @@ +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(); + } + } +} diff --git a/app/Controllers/BDSReportController.php b/app/Controllers/BDSReportController.php index 38c5ecd4..b9844e96 100644 --- a/app/Controllers/BDSReportController.php +++ b/app/Controllers/BDSReportController.php @@ -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); } diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index ed26bc95..73149423 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -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 ]); diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index b57ad0f0..dfaac349 100755 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -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'], ]); diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index ab00bd40..57a05395 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -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); } diff --git a/app/Controllers/EmployeeMultiEventServiceController.php b/app/Controllers/EmployeeMultiEventServiceController.php index 78216f37..782a189b 100644 --- a/app/Controllers/EmployeeMultiEventServiceController.php +++ b/app/Controllers/EmployeeMultiEventServiceController.php @@ -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; diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 83015c20..e0ea1eb5 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -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){ + + } } } \ No newline at end of file diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index 95940c90..4b71694c 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -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(); diff --git a/app/Controllers/ICICILombardController.php b/app/Controllers/ICICILombardController.php index 5c5bc627..a91cc147 100644 --- a/app/Controllers/ICICILombardController.php +++ b/app/Controllers/ICICILombardController.php @@ -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); diff --git a/app/Controllers/JobWorker.php b/app/Controllers/JobWorker.php index 1dbf51b5..eadca406 100755 --- a/app/Controllers/JobWorker.php +++ b/app/Controllers/JobWorker.php @@ -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', + ], ]; diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 3ead1911..92fa8a52 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -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); diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 58618abf..6191007c 100755 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -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'); diff --git a/app/Controllers/MediAssistApiController.php b/app/Controllers/MediAssistApiController.php new file mode 100644 index 00000000..4e13298c --- /dev/null +++ b/app/Controllers/MediAssistApiController.php @@ -0,0 +1,674 @@ +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); + } + + + + +} diff --git a/app/Controllers/NotificationController.php b/app/Controllers/NotificationController.php index b497e958..ee50a0fd 100755 --- a/app/Controllers/NotificationController.php +++ b/app/Controllers/NotificationController.php @@ -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(); diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 2719ae7f..6e721f81 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -3283,6 +3283,8 @@ $where ?? '' ); + $data['list_new'] = true; + // 🧩 Load View $this->loadLayout('report_bds_filter', $data); } diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index 24f22283..11b1a8fc 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -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); + } + } } \ No newline at end of file diff --git a/app/Controllers/TestingController.php b/app/Controllers/TestingController.php index 98257f4e..75d4d578 100644 --- a/app/Controllers/TestingController.php +++ b/app/Controllers/TestingController.php @@ -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); } diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index eb7e894b..c8adbcbb 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -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, diff --git a/app/Helpers/api_helper.php b/app/Helpers/api_helper.php index 95096fdb..ad25d3b4 100644 --- a/app/Helpers/api_helper.php +++ b/app/Helpers/api_helper.php @@ -58,6 +58,8 @@ if (!function_exists('call_third_party_api')) { ]; } + // echo ($response); die; + $decoded = json_decode($response, true); return [ diff --git a/app/Helpers/sendMailNotification.php b/app/Helpers/sendMailNotification.php index a726fe16..fae31ef5 100755 --- a/app/Helpers/sendMailNotification.php +++ b/app/Helpers/sendMailNotification.php @@ -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}}"], "Nhance Logo", $mail_content); + $mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "Client Logo", $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}}"], "Review Details", $mail_content); + $mail_content = str_replace(["[[post_enrollment_app_link]]", "{{post_enrollment_app_link}}"], "Review Details", $mail_content); + // $mail_content = str_replace("[[tpa_id]]", $tpa_id, $mail_content); + $mail_content = str_replace(["[[ecard_download_link]]", "{{ecard_download_link}}"], "Download Insurance Card", $mail_content); + $mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content); + + $mail_content = preg_replace('/]*>( |\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}}"], "Nhance Logo", $mail_content); + $mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "Client Logo", $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}}"], "Review Details", $mail_content); + $mail_content = str_replace(["[[post_enrollment_app_link]]", "{{post_enrollment_app_link}}"], "Review Details", $mail_content); + $mail_content = str_replace(["[[ecard_download_link]]", "{{ecard_download_link}}"], "Download Insurance Card", $mail_content); + $mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content); + + $mail_content = preg_replace('/]*>( |\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 = [ diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php index 034de8ce..9095986c 100755 --- a/app/Helpers/utility_helper.php +++ b/app/Helpers/utility_helper.php @@ -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']; + } + } +} + diff --git a/app/Models/ClaimFilesModel.php b/app/Models/ClaimFilesModel.php index 8e22ae01..0e0a987c 100644 --- a/app/Models/ClaimFilesModel.php +++ b/app/Models/ClaimFilesModel.php @@ -19,7 +19,9 @@ class ClaimFilesModel extends Model 'updated_by', 'created_at', 'updated_at', - 'is_active' + 'is_active', + 'file_name', + 'mime_type', ]; // Callbacks diff --git a/app/Models/CommonEMailModel.php b/app/Models/CommonEMailModel.php new file mode 100644 index 00000000..4b96f7ee --- /dev/null +++ b/app/Models/CommonEMailModel.php @@ -0,0 +1,42 @@ +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, diff --git a/app/Models/EndorsementModel.php b/app/Models/EndorsementModel.php index 60b675cb..30c7a01f 100644 --- a/app/Models/EndorsementModel.php +++ b/app/Models/EndorsementModel.php @@ -25,7 +25,8 @@ class EndorsementModel extends Model 'updated_by', 'updated_at', 'file_id', - 'is_active' + 'is_active', + 'batch_file_id', ]; } diff --git a/app/Models/NotificationModel.php b/app/Models/NotificationModel.php index edc3069d..a39df3b3 100755 --- a/app/Models/NotificationModel.php +++ b/app/Models/NotificationModel.php @@ -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']; } \ No newline at end of file diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php index 4882bd8a..7f3ca607 100644 --- a/app/Models/PolicyTransactionModel.php +++ b/app/Models/PolicyTransactionModel.php @@ -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') diff --git a/app/Models/TpaApiSeviceModel.php b/app/Models/TpaApiSeviceModel.php new file mode 100644 index 00000000..9801614a --- /dev/null +++ b/app/Models/TpaApiSeviceModel.php @@ -0,0 +1,19 @@ + - - + @@ -140,6 +140,10 @@ failed + + + failed + diff --git a/app/Views/bds_multi_report.php b/app/Views/bds_multi_report.php index fac8a2e0..b2cbb84f 100644 --- a/app/Views/bds_multi_report.php +++ b/app/Views/bds_multi_report.php @@ -39,7 +39,7 @@ // Get headers dynamically $headers = array_keys($data[0]); foreach ($headers as $header): ?> - + TOTAL diff --git a/app/Views/bds_renewal_report_list.php b/app/Views/bds_renewal_report_list.php index e9cbb1c6..a3147bd1 100644 --- a/app/Views/bds_renewal_report_list.php +++ b/app/Views/bds_renewal_report_list.php @@ -154,35 +154,18 @@ $(document).ready(function() { // Global DataTables defaults $.extend(true, $.fn.dataTable.defaults, { language: { - search: "", // remove "Search:" label + search: ` +
+ _INPUT_ + +
`, 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('
'); - - // Append icon - $input.after(` - - - - `); - - // Align to right - $filter.addClass('text-right custom-search'); - } -}); \ No newline at end of file diff --git a/app/Views/bds_report_Insurer_wise_Data.php b/app/Views/bds_report_Insurer_wise_Data.php index cbc717a2..835f48d6 100644 --- a/app/Views/bds_report_Insurer_wise_Data.php +++ b/app/Views/bds_report_Insurer_wise_Data.php @@ -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; +}
@@ -84,6 +88,7 @@ table.dataTable tbody td { text: ' CSV ', 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 } ] } diff --git a/app/Views/bds_report_bap_wise_data.php b/app/Views/bds_report_bap_wise_data.php index 12c6e8a2..3b2175db 100644 --- a/app/Views/bds_report_bap_wise_data.php +++ b/app/Views/bds_report_bap_wise_data.php @@ -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; +} + +
@@ -84,6 +90,7 @@ table.dataTable tbody td { text: ' CSV ', 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 } ] } diff --git a/app/Views/bds_tat_wise_report.php b/app/Views/bds_tat_wise_report.php index 8173ee3c..1c30125d 100644 --- a/app/Views/bds_tat_wise_report.php +++ b/app/Views/bds_tat_wise_report.php @@ -26,11 +26,11 @@
-
+
@@ -40,7 +40,7 @@ // Get headers dynamically $headers = array_keys($data[0]); foreach ($headers as $header): ?> - + @@ -108,13 +108,6 @@ // ], buttons: [ - { - text: ' Add ', - className: 'btn app-btn-primary mr-2', - action: function(e, dt, node, config) { - openTicket(); - } - }, { extend: 'collection', text: ' Export ', diff --git a/app/Views/business_team_list.php b/app/Views/business_team_list.php index 481268cb..4329ecb6 100644 --- a/app/Views/business_team_list.php +++ b/app/Views/business_team_list.php @@ -106,7 +106,7 @@
+
+ + +
@@ -129,6 +136,7 @@
+ @@ -429,7 +437,9 @@ $.each(data, function(index, item) { var option = $(' - + @@ -299,12 +303,14 @@ $(document).ready(function() { buttons: [ { extend: 'csv', + footer:true, text: ' CSV ', className: 'app-btn-primary ', title: 'IRDA-BAP-INSURER-List', }, { extend: 'excel', + footer:true, text: ' EXCEL ', className: 'app-btn-primary ', title: 'IRDA-BAP-INSURER-List', diff --git a/app/Views/layout/footer.php b/app/Views/layout/footer.php index cf7417e3..d6a2de8e 100755 --- a/app/Views/layout/footer.php +++ b/app/Views/layout/footer.php @@ -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 }); }); + + diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index 5fe38d18..ffaba0a3 100755 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -355,6 +355,7 @@ .content-page { padding: 80px 15px 65px 15px !important; + min-height: 1000px ; } /* Media query for small screens */ @@ -1861,25 +1862,6 @@ - - -
  • - - /assets/images/leads_sb.png" alt="Logo" height="20"> - Leads - -
  • - - - -
  • - - /assets/images/ticket.png" alt="Logo" height="20"> - Tickets - -
  • -
  • @@ -2034,6 +2016,26 @@
  • + + +
  • + + /assets/images/leads_sb.png" alt="Logo" height="20"> + Leads + +
  • + + + +
  • + + /assets/images/ticket.png" alt="Logo" height="20"> + Tickets + +
  • + +
  • diff --git a/app/Views/mail_template.php b/app/Views/mail_template.php index 22582cf5..e4f6f20f 100644 --- a/app/Views/mail_template.php +++ b/app/Views/mail_template.php @@ -1,3 +1,20 @@ + + @@ -10,7 +27,7 @@ @@ -49,15 +85,21 @@ -
    +
  • TOTAL
    Grand Total
    - -
    - Client Logo + +