Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
5f99271492
@ -506,6 +506,7 @@ $routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController
|
||||
$routes->post("/employeeRest/verifyEmployeeEmailId", "RestAuthenticationController::verifyEmployeeWithEmailId");
|
||||
$routes->post("/employeeRest/updateEmpOTP", "RestAuthenticationController::updateEmpOTP");
|
||||
|
||||
// MPIN api's
|
||||
$routes->post("employeeRest/saveMpin", "RestAuthenticationController::saveMpin");
|
||||
$routes->post("employeeRest/updateMpin", "RestAuthenticationController::updateMpin");
|
||||
$routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyMpin");
|
||||
@ -513,8 +514,13 @@ $routes->post("/employeeRest/checkMpin", "RestAuthenticationController::checkMpi
|
||||
$routes->post("/employeeRest/updateEmpMPIN", "RestAuthenticationController::updateEmpMPIN");
|
||||
$routes->post("employeeRest/forgotMPIN", "RestAuthenticationController::forgotMPIN");
|
||||
$routes->post("employeeRest/updateMobileNumber", "RestAuthenticationController::updateMobileNumber");
|
||||
// $routes->post("/employeeRest/saveMpin", "RestAuthenticationController::saveMpin");
|
||||
|
||||
// PASSWORD api's
|
||||
$routes->post("employeeRest/savePassword", "RestAuthenticationController::savePassword");
|
||||
$routes->post("employeeRest/changePassword", "RestAuthenticationController::changePassword");
|
||||
$routes->post("employeeRest/verifyPassword", "RestAuthenticationController::verifyPassword");
|
||||
$routes->post("employeeRest/verifyOtp", "RestAuthenticationController::verifyOtp");
|
||||
$routes->post("employeeRest/checkPassword", "RestAuthenticationController::checkPassword");
|
||||
|
||||
//HR login api's
|
||||
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
|
||||
@ -540,6 +546,7 @@ $routes->post("employeeRest/getPostEmployeeDataForAuth", "RestAuthenticationCont
|
||||
// $routes->post("logHrActivity", "RestAuthenticationController::logHrActivity");
|
||||
|
||||
$routes->get("employeeRest/getClientDetails", "EmployeeRestController::getClientDetails");
|
||||
$routes->get("employeeRest/getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
||||
|
||||
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ use App\Controllers\BaseController;
|
||||
use App\Controllers\VidalApiController;
|
||||
use App\Controllers\ICICILombardController;
|
||||
use App\Controllers\MediAssistApiController;
|
||||
use App\Models\BatchFileModel;
|
||||
use App\Models\FileModel;
|
||||
|
||||
class ApiServiceController extends BaseController
|
||||
@ -20,11 +21,17 @@ class ApiServiceController extends BaseController
|
||||
// protected $format = 'json';
|
||||
protected $db;
|
||||
protected $employeePolicyModel;
|
||||
protected $medi_assist_primary_key;
|
||||
protected $vidal_primary_key;
|
||||
protected $icici_primary_key;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->db = \Config\Database::connect();
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
$this->medi_assist_primary_key = getenv('MEDI_ASSIST_PRIMARY_KEY_CONSTANT');
|
||||
$this->vidal_primary_key = getenv('VIDAL_PRIMARY_KEY_CONSTANT');
|
||||
$this->icici_primary_key = getenv('ICICI_PRIMARY_KEY_CONSTANT');
|
||||
}
|
||||
|
||||
// Push Claims
|
||||
@ -38,7 +45,7 @@ class ApiServiceController extends BaseController
|
||||
|
||||
$tpaID = $data['tpa_id'];
|
||||
|
||||
if ($tpaID == 2) { // MediAssist
|
||||
if ($tpaID == $this->medi_assist_primary_key) { // MediAssist
|
||||
$mediAssistController = new MediAssistApiController();
|
||||
return $mediAssistController->SubmitClaim($claimId);
|
||||
}else{
|
||||
@ -90,7 +97,7 @@ class ApiServiceController extends BaseController
|
||||
{
|
||||
if($employee_policy[0]['tpa_id'] != null)
|
||||
{
|
||||
if($employee_policy[0]['tpa_primary_id'] == 2)//Medi assist
|
||||
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 );
|
||||
@ -104,7 +111,10 @@ class ApiServiceController extends BaseController
|
||||
$data['eCardDownload'] = base_url('download-e-card/') . $employee_policy[0]['rand_string'].'/0/1';
|
||||
}
|
||||
}
|
||||
$data['message'] = "E-card generated";
|
||||
$data['message'] = "E-card generated";
|
||||
if(empty($data['eCardDownload'])){
|
||||
$data['message'] = "E-card not generated";
|
||||
}
|
||||
|
||||
} else {
|
||||
$data['eCardDownload'] = null;
|
||||
@ -139,14 +149,35 @@ class ApiServiceController extends BaseController
|
||||
$branch_id = $this->request->getPost('client_branch_id') ?? null;
|
||||
$policy_id = $this->request->getPost('client_policy_id') ?? null;
|
||||
|
||||
$fileModel = new FileModel();
|
||||
$filesData = $fileModel->where('is_active', 1)->where('action', 'api')->where('status', 'inprogress')->countAllResults();
|
||||
$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']);
|
||||
@ -154,21 +185,24 @@ class ApiServiceController extends BaseController
|
||||
|
||||
$data = [
|
||||
'file_name' => "API",
|
||||
'action' => "api",
|
||||
'event_type' => "api",
|
||||
'actions' => "fetch",
|
||||
'insurer_or_tpa' => "tpa",
|
||||
'batch_code' => generate_random_string(4),
|
||||
'status' => "inprogress",
|
||||
'client_id' => $client_id,
|
||||
'policy_id' => $policy_id,
|
||||
'client_policy_id'=> $policy_id,
|
||||
'client_branch_id'=> $branch_id,
|
||||
'created_by'=> get_session_userid(),
|
||||
];
|
||||
|
||||
if ($tpa_id == 2) // MediAssist
|
||||
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, 'return_type' => 'job']]);
|
||||
$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' => [] ]);
|
||||
|
||||
@ -181,8 +181,8 @@ class BDSReportController extends AdminController
|
||||
'Client' => 'client'
|
||||
];
|
||||
|
||||
$data['tab_name'] = "IRDA Reports";
|
||||
$data['page_name'] = "IRDA Report";
|
||||
|
||||
return $this->loadLayout('irba_report', $data);
|
||||
} else {
|
||||
|
||||
@ -926,7 +926,7 @@ class BDSReportController extends AdminController
|
||||
$data['default_end'] = $default_start->format('d-m-Y');
|
||||
$data['default_start'] = $default_start->modify('-60 days')->format('d-m-Y');
|
||||
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
|
||||
$data['tab_name'] = "Renewal Report";
|
||||
$data['tab_name'] = "Renewal Reports";
|
||||
$data['page_name'] = "Renewal Report";
|
||||
return $this->loadLayout('renewal_search', $data);
|
||||
} else {
|
||||
@ -1027,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);
|
||||
}
|
||||
|
||||
@ -1150,21 +1152,23 @@ class BDSReportController extends AdminController
|
||||
|
||||
public function getMultiReport($report_type){
|
||||
|
||||
$data['tab_name'] = "BDS Report";
|
||||
$data['page_name'] = "BDS Report";
|
||||
$data['tab_name'] = "BDS Reports";
|
||||
|
||||
if ($report_type == 1){
|
||||
|
||||
$data['page_title'] = "BDS TAT Report";
|
||||
$data['page_name'] = "BDS TAT Report";
|
||||
$data['page_title'] = "";
|
||||
$data['data'] = $this->bdsTATReport(true); // Functional Based called means True
|
||||
}else if ($report_type == 2){
|
||||
|
||||
$data['page_title'] = "Account Manager Status Report";
|
||||
$data['page_name'] = "Account Manager Status Report";
|
||||
$data['page_title'] = "";
|
||||
$data['data'] = $this->accountMangerStatusBDSReport();
|
||||
|
||||
}else{
|
||||
|
||||
$data['page_title'] = "Account Manager TAT Report";
|
||||
$data['page_name'] = "Account Manager TAT Report";
|
||||
$data['page_title'] = "";
|
||||
$data['data'] = $this->accountManagerTatBDSReport();
|
||||
|
||||
}
|
||||
|
||||
@ -478,7 +478,7 @@ class ClientController extends AdminController
|
||||
public function index()
|
||||
{
|
||||
$this->myLogger->logme('error', 'Client list function called');
|
||||
$headerData['tab_name'] = 'Client List';
|
||||
$headerData['tab_name'] = 'Clients';
|
||||
$headerData['page_name'] = 'Clients'; // Both Browser Tab name And Page name are same.
|
||||
$data['clientList'] = $this->clientModel->getCreatedByUserName(1); // passing client_type
|
||||
$data['client_rm'] = $this->clientRMModel->getAllClientRM();
|
||||
@ -5644,7 +5644,7 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
public function sendextraparam()
|
||||
{
|
||||
{
|
||||
// $data = db_connect()->table('jobs')->where('id', 1677)->get()->getRowArray();
|
||||
// // dd($data);
|
||||
// $return = $this->updatePolicyTransactionDataWhileClinetPolicyUpdate(json_decode($data['payload'], true));
|
||||
@ -5654,9 +5654,14 @@ class ClientController extends AdminController
|
||||
// $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');
|
||||
// $res = $this->getHrAccessData(4005); dd($res);
|
||||
|
||||
// ---------- TICKET SERVICE CONTROLLER --------------------------------------------------------------------------------
|
||||
|
||||
@ -5697,7 +5702,7 @@ class ClientController extends AdminController
|
||||
// ---------- POLICY TRANSACTION CONTROLLER --------------------------------------------------------------------------------
|
||||
|
||||
$policyTransactionController = new PolicyTransactionController();
|
||||
// $res = $policyTransactionController->validateInsurerStatement(['file_id' => '57']);
|
||||
// $res = $policyTransactionController->validateInsurerStatement(['file_id' => '60']);
|
||||
// $res = $policyTransactionController->updateInsurerStatement(['file_id' => '22']);
|
||||
// dd('-----', $res);
|
||||
|
||||
@ -7196,6 +7201,7 @@ class ClientController extends AdminController
|
||||
public function saveHrAccessData()
|
||||
{
|
||||
try {
|
||||
|
||||
// Step 1: Fetch and decode the JSON data
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$jsonData = $this->request->getPost('json');
|
||||
@ -7203,11 +7209,7 @@ class ClientController extends AdminController
|
||||
|
||||
if (!$data || !is_array($data)) {
|
||||
log_message('error', 'Invalid or empty JSON in saveHrAccessData: ' . $jsonData);
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 400,
|
||||
'message' => 'Invalid JSON data provided.',
|
||||
], 400);
|
||||
return $this->respond(['status' => false,'code' => 400,'message' => 'Invalid JSON data provided.',], 400);
|
||||
}
|
||||
|
||||
$success = [];
|
||||
@ -7233,16 +7235,13 @@ class ClientController extends AdminController
|
||||
$post_branch_id = $value['post_branch_id'];
|
||||
$post_hr_id = $value['post_hr_id'];
|
||||
|
||||
$preBranchId = $this->getPreBranchIdByPostBranchId($post_branch_id);
|
||||
|
||||
if (!empty($preBranchId)) {
|
||||
$value['pre_branch_id'] = $preBranchId;
|
||||
$value['pre_client_id'] = $this->getPreClientIdByPreBranchId($preBranchId);
|
||||
$value["pre_hr_id"] = $this->getPreHrIdByPreBranchId($preBranchId);
|
||||
}
|
||||
// $preBranchId = $this->getPreBranchIdByPostBranchId($post_branch_id);
|
||||
// if (!empty($preBranchId)) {
|
||||
// $value['pre_branch_id'] = $preBranchId;
|
||||
// $value['pre_client_id'] = $this->getPreClientIdByPreBranchId($preBranchId);
|
||||
// $value["pre_hr_id"] = $this->getPreHrIdByPreBranchId($preBranchId);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// INSERT or UPDATE
|
||||
if (empty($value['pk']) || (int)$value['pk'] === 0) {
|
||||
|
||||
@ -7260,6 +7259,7 @@ class ClientController extends AdminController
|
||||
}
|
||||
$success[] = "Updated row with ID {$value['pk']}.";
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
log_message('error', 'HRAccess Save Error at index ' . $index . ': ' . $e->getMessage());
|
||||
$errors[] = "Error at index {$index}: " . $e->getMessage();
|
||||
@ -7650,84 +7650,84 @@ class ClientController extends AdminController
|
||||
return $this->respond(['status' => true, 'message' => 'Demo client data wiped successfully'], 200);
|
||||
}
|
||||
|
||||
private function getClientlistFromPre (){
|
||||
private function getClientlistFromPre()
|
||||
{
|
||||
$db2 = \Config\Database::connect('preDB');
|
||||
|
||||
$auto_fetch_client_list = $db2->table('clients')
|
||||
->select('id,client_name')
|
||||
->where('is_active',1)
|
||||
->get()->getResultArray()??[];
|
||||
->select('id,client_name')
|
||||
->where('is_active', 1)
|
||||
->get()->getResultArray() ?? [];
|
||||
|
||||
return $auto_fetch_client_list;
|
||||
|
||||
}
|
||||
|
||||
public function auto_fetch_branch(){
|
||||
public function auto_fetch_branch()
|
||||
{
|
||||
|
||||
$data = $this->request->getPost();
|
||||
|
||||
$db2 = \Config\Database::connect('preDB');
|
||||
|
||||
$auto_fetch_branch_list = $db2->table('client_branch')
|
||||
->select('id,branch_name')
|
||||
->where('client_id',$data['client_id'])
|
||||
->where('is_active',1)
|
||||
->get()->getResultArray()??[];
|
||||
->select('id,branch_name')
|
||||
->where('client_id', $data['client_id'])
|
||||
->where('is_active', 1)
|
||||
->get()->getResultArray() ?? [];
|
||||
|
||||
return
|
||||
return
|
||||
|
||||
empty($auto_fetch_branch_list)
|
||||
empty($auto_fetch_branch_list)
|
||||
|
||||
? $this->response->setJSON([
|
||||
? $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'branch list is empty',
|
||||
'data' => []
|
||||
])->setStatusCode(400)
|
||||
|
||||
: $this->response->setJSON([
|
||||
|
||||
: $this->response->setJSON([
|
||||
'status' => true,
|
||||
'message' => 'branch list is found' ,
|
||||
'data' => $auto_fetch_branch_list
|
||||
'message' => 'branch list is found',
|
||||
'data' => $auto_fetch_branch_list
|
||||
])->setStatusCode(200);
|
||||
}
|
||||
|
||||
public function auto_fetch_branch_details(){
|
||||
public function auto_fetch_branch_details()
|
||||
{
|
||||
|
||||
$data = $this->request->getPost();
|
||||
|
||||
$db2 = \Config\Database::connect('preDB');
|
||||
|
||||
$auto_fetch_branch_details = $db2->table('client_branch')
|
||||
->where('client_id',$data['client_id'])
|
||||
->where('id',$data['branch_id'])
|
||||
->where('is_active',1)
|
||||
->get()->getResultArray()??[];
|
||||
->where('client_id', $data['client_id'])
|
||||
->where('id', $data['branch_id'])
|
||||
->where('is_active', 1)
|
||||
->get()->getResultArray() ?? [];
|
||||
|
||||
return empty($auto_fetch_branch_details)
|
||||
|
||||
? $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'branch details is empty',
|
||||
'data' => []
|
||||
])->setStatusCode(400)
|
||||
|
||||
: $this->response->setJSON([
|
||||
'status' => true,
|
||||
'message' => 'branch details found' ,
|
||||
'data' => $auto_fetch_branch_details
|
||||
])->setStatusCode(200);
|
||||
? $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'branch details is empty',
|
||||
'data' => []
|
||||
])->setStatusCode(400)
|
||||
|
||||
: $this->response->setJSON([
|
||||
'status' => true,
|
||||
'message' => 'branch details found',
|
||||
'data' => $auto_fetch_branch_details
|
||||
])->setStatusCode(200);
|
||||
}
|
||||
|
||||
|
||||
private function updatePreClientBranch($pre_branch_id,$post_branch_id ,$operation)
|
||||
private function updatePreClientBranch($pre_branch_id, $post_branch_id, $operation)
|
||||
{
|
||||
|
||||
|
||||
|
||||
$preDB = \Config\Database::connect('preDB');
|
||||
|
||||
if($operation != 'create'){
|
||||
if ($operation != 'create') {
|
||||
|
||||
$builder = $preDB->table('client_branch');
|
||||
$builder->where('post_branch_id', $post_branch_id);
|
||||
@ -7741,87 +7741,88 @@ class ClientController extends AdminController
|
||||
return true;
|
||||
}
|
||||
|
||||
public function createDefaultMailTemplate($client_id , $client_data){
|
||||
public function createDefaultMailTemplate($client_id, $client_data)
|
||||
{
|
||||
|
||||
$member_welcome_mail_template = $this->notificationModel->where('client_id',NULL)->where('template_name','member_welcome_mail')->get()->getResultArray()[0]??[];
|
||||
$member_welcome_mail_template = $this->notificationModel->where('client_id', NULL)->where('template_name', 'member_welcome_mail')->get()->getResultArray()[0] ?? [];
|
||||
|
||||
$member_remainder_mail_template = $this->notificationModel->where('client_id',NULL)->where('template_name','member_reminder_mail')->get()->getResultArray()[0]??[];
|
||||
$member_remainder_mail_template = $this->notificationModel->where('client_id', NULL)->where('template_name', 'member_reminder_mail')->get()->getResultArray()[0] ?? [];
|
||||
|
||||
$member_review_and_summary_mail_template = $this->notificationModel->where('client_id',NULL)->where('template_name','member_review_and_summary_mail')->get()->getResultArray()[0]??[];
|
||||
$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_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]??[];
|
||||
$member_common_mail_template = $this->notificationModel->where('client_id', NULL)->where('template_name', 'member_common_mail')->get()->getResultArray()[0] ?? [];
|
||||
|
||||
$default_member_welcome_mail_template = [
|
||||
$default_member_welcome_mail_template = [
|
||||
'client_id' => $client_id,
|
||||
'template_name' => 'member_welcome_mail',
|
||||
'subject' => $member_welcome_mail_template['subject']??'',
|
||||
'mail_content' => $member_welcome_mail_template['mail_content']??'',
|
||||
'mail_content_json'=> $member_welcome_mail_template['mail_content_json']??'',
|
||||
|
||||
'subject' => $member_welcome_mail_template['subject'] ?? '',
|
||||
'mail_content' => $member_welcome_mail_template['mail_content'] ?? '',
|
||||
'mail_content_json' => $member_welcome_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
|
||||
];
|
||||
'mail_content_copy' => null
|
||||
];
|
||||
|
||||
$default_member_remainder_mail_template = [
|
||||
$default_member_remainder_mail_template = [
|
||||
'client_id' => $client_id,
|
||||
'template_name' => 'member_reminder_mail',
|
||||
'subject' => $member_remainder_mail_template['subject']??'',
|
||||
'mail_content' => $member_remainder_mail_template['mail_content']??'',
|
||||
'mail_content_json'=> $member_remainder_mail_template['mail_content_json']??'',
|
||||
|
||||
'subject' => $member_remainder_mail_template['subject'] ?? '',
|
||||
'mail_content' => $member_remainder_mail_template['mail_content'] ?? '',
|
||||
'mail_content_json' => $member_remainder_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
|
||||
];
|
||||
'mail_content_copy' => null
|
||||
];
|
||||
|
||||
$default_member_review_and_summary_mail_template = [
|
||||
$default_member_review_and_summary_mail_template = [
|
||||
'client_id' => $client_id,
|
||||
'template_name' => 'member_review_and_summary_mail',
|
||||
'subject' => $member_review_and_summary_mail_template['subject']??'',
|
||||
'mail_content' => $member_review_and_summary_mail_template['mail_content']??'',
|
||||
'mail_content_json'=> $member_review_and_summary_mail_template['mail_content_json']??'',
|
||||
|
||||
'subject' => $member_review_and_summary_mail_template['subject'] ?? '',
|
||||
'mail_content' => $member_review_and_summary_mail_template['mail_content'] ?? '',
|
||||
'mail_content_json' => $member_review_and_summary_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
|
||||
];
|
||||
'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']??'',
|
||||
|
||||
'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
|
||||
];
|
||||
'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']??'',
|
||||
|
||||
'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
|
||||
];
|
||||
'mail_content_copy' => null
|
||||
];
|
||||
|
||||
$this->myLogger->logme('error', 'Default Mail Template Data ' . json_encode([
|
||||
$default_member_welcome_mail_template,
|
||||
@ -7831,18 +7832,16 @@ class ClientController extends AdminController
|
||||
|
||||
|
||||
|
||||
$default_templates_inserted = $this->notificationModel->insertBatch([
|
||||
$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_ecard_mail_template,
|
||||
$default_member_common_mail_template
|
||||
]);
|
||||
|
||||
|
||||
return $default_templates_inserted ? true : false;
|
||||
]);
|
||||
|
||||
|
||||
return $default_templates_inserted ? true : false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -136,7 +136,7 @@ class EmployeeController extends AdminController
|
||||
|
||||
// dd($this->request->getGet());
|
||||
$this->myLogger->logme('error', 'list called');
|
||||
|
||||
$data['tab_name'] = 'Members';
|
||||
$data['page_name'] = "Members";
|
||||
|
||||
$this->loadLayout('employee_list', $data);
|
||||
@ -795,7 +795,8 @@ class EmployeeController extends AdminController
|
||||
|
||||
$this->myLogger->logme('error', 'list called');
|
||||
|
||||
$data['page_name'] = "Endorsement";
|
||||
$data['tab_name'] = "Endorsements";
|
||||
$data['page_name'] = "Endorsements";
|
||||
|
||||
$this->loadLayout('endorsement_list', $data);
|
||||
}
|
||||
@ -2810,6 +2811,9 @@ class EmployeeController extends AdminController
|
||||
$data['employees'] = $employee_data;
|
||||
$data['clients'] = $this->clientModel->findAll();
|
||||
// dd($data);
|
||||
$data['tab_name'] = "Employees";
|
||||
$data['page_name'] = "Employees";
|
||||
|
||||
return $this->loadLayout('test_members_list',$data);
|
||||
}
|
||||
|
||||
@ -3107,6 +3111,7 @@ class EmployeeController extends AdminController
|
||||
// print_r($data); die;
|
||||
// }
|
||||
|
||||
$data['tab_name'] = "Retail Endorsement";
|
||||
$data['page_name'] = "Retail Endorsement";
|
||||
|
||||
$this->loadLayout('retail_endorsement_list', $data);
|
||||
|
||||
@ -506,7 +506,8 @@ class EmployeeRestController extends AdminController
|
||||
if ($dateTime instanceof \DateTime) {
|
||||
return $dateTime->format('Y-m-d');
|
||||
} else {
|
||||
return null;
|
||||
// return null;
|
||||
return change_date_format($dateString);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ class MasterController extends AdminController
|
||||
public function insurerList()
|
||||
{
|
||||
$this->myLogger->logme('error','Insurer list function called');
|
||||
$headerData['tab_name'] = 'Insurer List';
|
||||
$headerData['tab_name'] = 'Insurer Masters';
|
||||
$headerData['page_name'] = 'Insurers';
|
||||
$data['insurerList'] = $this->insurerModel->where('is_active',1)->findAll();
|
||||
$data['insurer_rm'] = $this->insurerRMModel->getAllClientRM();
|
||||
@ -250,7 +250,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Insurer Onboarding function called');
|
||||
$headerData['tab_name'] = 'Insurer Master';
|
||||
$headerData['tab_name'] = 'Insurer Masters';
|
||||
$headerData['page_name'] = 'Insurers';
|
||||
|
||||
$types = array(
|
||||
@ -519,7 +519,7 @@ class MasterController extends AdminController
|
||||
public function tpaList()
|
||||
{
|
||||
$this->myLogger->logme('error','TPA list function called');
|
||||
$headerData['tab_name'] = 'TPA List';
|
||||
$headerData['tab_name'] = 'TPA Masters';
|
||||
$headerData['page_name'] = 'TPA';
|
||||
$data['tpaList'] = $this->tpaModel->where('is_active',1)->findAll();
|
||||
// $data['insurer_rm'] = $this->insurerRMModel->getAllClientRM();
|
||||
@ -566,7 +566,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','TPA Onboarding function called');
|
||||
$headerData['tab_name'] = 'TPA Master';
|
||||
$headerData['tab_name'] = 'TPA Masters';
|
||||
$headerData['page_name'] = 'TPA';
|
||||
|
||||
|
||||
@ -851,7 +851,7 @@ class MasterController extends AdminController
|
||||
public function kycList()
|
||||
{
|
||||
$this->myLogger->logme('error','KYC list function called');
|
||||
$headerData['tab_name'] = 'KYC List';
|
||||
$headerData['tab_name'] = 'KYC Masters';
|
||||
$headerData['page_name'] = 'KYC';
|
||||
$data['kycList'] = $this->kycEntityTypeModel->where('is_active',1)->findAll();
|
||||
// $data['insurer_rm'] = $this->insurerRMModel->getAllClientRM();
|
||||
@ -898,7 +898,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','KYC Onboarding function called');
|
||||
$headerData['tab_name'] = 'KYC Master';
|
||||
$headerData['tab_name'] = 'KYC Masters';
|
||||
$headerData['page_name'] = 'KYC';
|
||||
|
||||
|
||||
@ -1043,7 +1043,7 @@ class MasterController extends AdminController
|
||||
public function policyTypeList()
|
||||
{
|
||||
$this->myLogger->logme('error','Policy Type list function called');
|
||||
$headerData['tab_name'] = 'Policy Type List';
|
||||
$headerData['tab_name'] = 'Policy Type Masters';
|
||||
$headerData['page_name'] = 'Policy Type';
|
||||
$data['policyList'] = $this->policyTypeModel->where('is_active',1)->findAll();
|
||||
// $data['insurer_rm'] = $this->insurerRMModel->getAllClientRM();
|
||||
@ -1090,7 +1090,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Policy Type Onboarding function called');
|
||||
$headerData['tab_name'] = 'Policy Type Master';
|
||||
$headerData['tab_name'] = 'Policy Type Masters';
|
||||
$headerData['page_name'] = 'Policy Type';
|
||||
|
||||
|
||||
@ -1246,7 +1246,7 @@ class MasterController extends AdminController
|
||||
//start CD Master list
|
||||
public function CDMasterList()
|
||||
{
|
||||
$data['tab_name'] = 'CD Master List';
|
||||
$data['tab_name'] = 'CD Masters';
|
||||
$data['page_name'] = 'CD Master';
|
||||
$data['CD_Master_Data'] = $this->CDMasterModel->getCDMasterList();
|
||||
$data['insurers'] = $this->insurerModel->where('is_active', 1)->findAll();
|
||||
@ -1668,7 +1668,7 @@ class MasterController extends AdminController
|
||||
|
||||
public function VehicleMasterList()
|
||||
{
|
||||
$data['tab_name'] = 'Vehicle Master';
|
||||
$data['tab_name'] = 'Vehicle Masters';
|
||||
$data['page_name'] = 'Vehicles';
|
||||
$data['vehicle_type'] = [
|
||||
'two_wheeler' => 'Two Wheeler',
|
||||
@ -2076,9 +2076,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
$nhanceBranchModel = new NhanceBranchModel();
|
||||
$method = $this->request->getMethod();
|
||||
$data['tab_name'] = 'Nhance Branch';
|
||||
$data['page_name'] = 'Nhance Branchs';
|
||||
|
||||
|
||||
if ($method === 'post') {
|
||||
|
||||
$id = $this->request->getPost('pk') ?? null;
|
||||
@ -2120,7 +2118,7 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
$data = $nhanceBranchModel->where('is_active', 1)->orderBy('id', 'DESC')->findAll();
|
||||
return $this->loadLayout('nhance_branch_list', ['data' => $data]);
|
||||
return $this->loadLayout('nhance_branch_list', ['data' => $data,'tab_name' => 'Nhance Branchs','page_name' => 'Nhance Branchs']);
|
||||
|
||||
} elseif ($method === 'delete') {
|
||||
|
||||
@ -2160,8 +2158,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
$vehicleTypeModel = new VehicleTypeModel();
|
||||
$method = $this->request->getMethod();
|
||||
$data['tab_name'] = 'Vehicle Type';
|
||||
$data['page_name'] = 'Vehicle Types';
|
||||
|
||||
if ($method === 'post') {
|
||||
|
||||
$id = $this->request->getPost('pk') ?? null;
|
||||
@ -2203,7 +2200,7 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
$data = $vehicleTypeModel->where('is_active', 1)->orderBy('id', 'DESC')->findAll();
|
||||
return $this->loadLayout('vehicle_type_master_list', ['data' => $data]);
|
||||
return $this->loadLayout('vehicle_type_master_list', ['data' => $data,'tab_name' => 'Vehicle Types','page_name' => 'Vehicle Types']);
|
||||
|
||||
} elseif ($method === 'delete') {
|
||||
|
||||
@ -2242,8 +2239,6 @@ class MasterController extends AdminController
|
||||
{
|
||||
$rtoModel = new RTOModel();
|
||||
$method = $this->request->getMethod();
|
||||
$data['tab_name'] = 'RTO';
|
||||
$data['page_name'] = 'RTO';
|
||||
|
||||
if ($method === 'post') {
|
||||
|
||||
@ -2286,7 +2281,7 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
$data = $rtoModel->where('is_active', 1)->orderBy('id', 'DESC')->findAll();
|
||||
return $this->loadLayout('rto_master_list', ['data' => $data]);
|
||||
return $this->loadLayout('rto_master_list', ['data' => $data,'tab_name' => 'RTO Masters','page_name' => 'RTO']);
|
||||
|
||||
} elseif ($method === 'delete') {
|
||||
|
||||
|
||||
@ -3,7 +3,8 @@
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\FileModel;
|
||||
use App\Models\BatchFileModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
@ -19,17 +20,18 @@ class MediAssistApiController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
public function SubmitClaim ($claimId = 458){
|
||||
public function SubmitClaim ($claimId = null){
|
||||
|
||||
helper('api');
|
||||
|
||||
$url = ''. getenv('MEDI_ASSIST_API_BASE_URL_DEV').'/SubmitClaim';
|
||||
// $url = ''. getenv('MEDI_ASSIST_API_BASE_URL').'/SubmitClaim';
|
||||
$url = getenv('MEDI_ASSIST_API_BASE_URL_CLAIMSUBMIT');
|
||||
$method = 'POST';
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Username:'. getenv('MEDI_ASSIST_API_USERNAME_DEV').'',
|
||||
'Password:'. getenv('MEDI_ASSIST_API_PASSWORD_DEV').'',
|
||||
'Username:'. getenv('MEDI_ASSIST_API_USERNAME').'',
|
||||
'Password:'. getenv('MEDI_ASSIST_API_PASSWORD').'',
|
||||
];
|
||||
|
||||
|
||||
@ -53,7 +55,7 @@ class MediAssistApiController extends BaseController
|
||||
e.emp_code as memberId,
|
||||
tn.note as disease,
|
||||
tn.note as reasonForHospitalization,
|
||||
cf.doc_name as fileName,
|
||||
cf.url as fileName,
|
||||
cf.url as filePath
|
||||
')
|
||||
->join('employees e', 'e.id = tm.emp_id', 'left')
|
||||
@ -83,7 +85,7 @@ class MediAssistApiController extends BaseController
|
||||
|
||||
$body = [
|
||||
"policyNo" => $data['policyNo'] ?? "",
|
||||
"memberId" => $data['empId'] ?? "",
|
||||
"memberId" => $data['memberId'] ?? "",
|
||||
"mobileNo" => $data['mobileNo'] ?? "",
|
||||
"emailId" => $data['emailId'] ?? "",
|
||||
"claimDateOfAdmission" => $data['claimDateOfAdmission'] ?? "",
|
||||
@ -158,13 +160,14 @@ class MediAssistApiController extends BaseController
|
||||
|
||||
helper('api');
|
||||
|
||||
$url = ''. getenv('MEDI_ASSIST_API_BASE_URL_LIVE').'/EcardUrl';
|
||||
// $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_LIVE').'',
|
||||
'Password:'. getenv('MEDI_ASSIST_API_PASSWORD_LIVE').'',
|
||||
'Username:'. getenv('MEDI_ASSIST_API_USERNAME').'',
|
||||
'Password:'. getenv('MEDI_ASSIST_API_PASSWORD').'',
|
||||
];
|
||||
|
||||
$body = [
|
||||
@ -206,16 +209,18 @@ class MediAssistApiController extends BaseController
|
||||
|
||||
try {
|
||||
|
||||
$url = getenv('MEDI_ASSIST_API_BASE_URL_LIVE') . '/GetBenefDetails';
|
||||
// $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_LIVE'),
|
||||
'Password:' . getenv('MEDI_ASSIST_API_PASSWORD_LIVE'),
|
||||
'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');
|
||||
@ -226,14 +231,48 @@ class MediAssistApiController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
@ -246,6 +285,7 @@ class MediAssistApiController extends BaseController
|
||||
];
|
||||
|
||||
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);
|
||||
|
||||
@ -253,8 +293,8 @@ class MediAssistApiController extends BaseController
|
||||
|
||||
// update file table status after the tpa id failed to update
|
||||
if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
|
||||
$file_model = new FileModel();
|
||||
$file_model->where('id', $requestData['file_id'])->set('status', 'failed')->update();
|
||||
$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.");
|
||||
@ -291,41 +331,62 @@ class MediAssistApiController extends BaseController
|
||||
$db = \Config\Database::connect();
|
||||
$updated = 0;
|
||||
|
||||
foreach ($employeePolicyData as $policy_data) {
|
||||
foreach ($allBenef as $row) {
|
||||
|
||||
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,
|
||||
// ],
|
||||
// ])
|
||||
// );
|
||||
|
||||
// $update = $db->table('employee_polices')
|
||||
// ->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.policy_no = ' . $db->escape($row['polNo']), 'left')
|
||||
// ->join(
|
||||
// 'employees',
|
||||
// 'employee_polices.employee_id = employees.id
|
||||
// AND employees.emp_code = ' . $db->escape($row['priBenefEmpCode']) . '
|
||||
// AND employees.relationship = ' . $db->escape($row['relName']),
|
||||
// 'left'
|
||||
// )
|
||||
// ->where('employee_polices.tpa_id IS NULL')
|
||||
// ->update(['employee_polices.tpa_id' => $row['benefMediAssistID']]);
|
||||
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']}");
|
||||
|
||||
$update = $db->table('employee_polices')
|
||||
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id', 'left')
|
||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||
->where('client_policy.policy_no', $row['polNo'])
|
||||
->where('employees.emp_code', $row['priBenefEmpCode'])
|
||||
->where('employees.relationship', $row['relName'])
|
||||
->where('employee_polices.tpa_id IS NULL', null, false)
|
||||
->update(['employee_polices.tpa_id' => $row['benefMediAssistID']]);
|
||||
$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']}");
|
||||
}
|
||||
|
||||
|
||||
if ($db->affectedRows() > 0) {
|
||||
$updated++;
|
||||
log_message('error', "Updated tpa_id 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 FileModel();
|
||||
$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 {
|
||||
@ -355,8 +416,8 @@ class MediAssistApiController extends BaseController
|
||||
|
||||
// update file table status after the tpa id failed to update
|
||||
if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
|
||||
$file_model = new FileModel();
|
||||
$file_model->where('id', $requestData['file_id'])->set('status', 'failed')->update();
|
||||
$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.");
|
||||
@ -389,13 +450,13 @@ class MediAssistApiController extends BaseController
|
||||
|
||||
// helper('api');
|
||||
|
||||
// $url = ''. getenv('MEDI_ASSIST_API_BASE_URL_LIVE').'/GetBenefDetails';
|
||||
// $url = ''. getenv('MEDI_ASSIST_API_BASE_URL').'/GetBenefDetails';
|
||||
// $method = 'POST';
|
||||
|
||||
// $headers = [
|
||||
// 'Content-Type: application/json',
|
||||
// 'Username:'. getenv('MEDI_ASSIST_API_USERNAME_LIVE').'',
|
||||
// 'Password:'. getenv('MEDI_ASSIST_API_PASSWORD_LIVE').'',
|
||||
// 'Username:'. getenv('MEDI_ASSIST_API_USERNAME').'',
|
||||
// 'Password:'. getenv('MEDI_ASSIST_API_PASSWORD').'',
|
||||
// ];
|
||||
|
||||
// $body = [
|
||||
@ -438,13 +499,13 @@ class MediAssistApiController extends BaseController
|
||||
|
||||
helper('api');
|
||||
|
||||
$url = ''. getenv('MEDI_ASSIST_API_BASE_URL_LIVE').'/ClaimDetail';
|
||||
$url = ''. getenv('MEDI_ASSIST_API_BASE_URL').'/ClaimDetail';
|
||||
$method = 'POST';
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Username:'. getenv('MEDI_ASSIST_API_USERNAME_LIVE').'',
|
||||
'Password:'. getenv('MEDI_ASSIST_API_PASSWORD_LIVE').'',
|
||||
'Username:'. getenv('MEDI_ASSIST_API_USERNAME').'',
|
||||
'Password:'. getenv('MEDI_ASSIST_API_PASSWORD').'',
|
||||
];
|
||||
|
||||
$body = [
|
||||
@ -483,13 +544,13 @@ class MediAssistApiController extends BaseController
|
||||
|
||||
helper('api');
|
||||
|
||||
$url = ''. getenv('MEDI_ASSIST_API_BASE_URL_LIVE').'/NetworkHospital';
|
||||
$url = ''. getenv('MEDI_ASSIST_API_BASE_URL').'/NetworkHospital';
|
||||
$method = 'POST';
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Username:'. getenv('MEDI_ASSIST_API_USERNAME_LIVE').'',
|
||||
'Password:'. getenv('MEDI_ASSIST_API_PASSWORD_LIVE').'',
|
||||
'Username:'. getenv('MEDI_ASSIST_API_USERNAME').'',
|
||||
'Password:'. getenv('MEDI_ASSIST_API_PASSWORD').'',
|
||||
];
|
||||
|
||||
$body = [
|
||||
|
||||
@ -115,8 +115,8 @@
|
||||
public function viewInception()
|
||||
{
|
||||
$bds_edit_pt_id = $this->request->getGet('pt_id') ?? null;
|
||||
$data['tab_name'] = 'Policy';
|
||||
$data['page_name'] = 'Policy';
|
||||
$data['tab_name'] = 'Policies';
|
||||
$data['page_name'] = 'Policies';
|
||||
|
||||
// Static arrays for dropdowns
|
||||
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
|
||||
@ -2187,6 +2187,8 @@
|
||||
->join('insurer_branch', 'insurer_statements.branch_id = insurer_branch.id')
|
||||
->join('user_profiles', 'insurer_statements.created_by = user_profiles.id')
|
||||
->where('insurer_statements.is_active', 1)
|
||||
->where('insurers.is_active', 1)
|
||||
->where('insurer_branch.is_active', 1)
|
||||
// ->where('insurer_statements.file_status','success')
|
||||
->where('date(insurer_statements.created_at) >= ', $from_date)
|
||||
->where('date(insurer_statements.created_at) <= ', $today)
|
||||
@ -2382,7 +2384,7 @@
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
unset($excel_data[0]);
|
||||
$excel_data = ExcelSanitizeHelper::sanitizeArrayData($excel_data);
|
||||
// Kint::dump($excel_data);die();
|
||||
// Kint::dump($excel_data); // die();
|
||||
//get no of line items and update in DB
|
||||
$line_items = 0;
|
||||
// get uploaded month transactions data
|
||||
|
||||
@ -546,11 +546,11 @@ class RestAuthenticationController extends AdminController
|
||||
}
|
||||
|
||||
public function verifyHrWithEmail()
|
||||
{
|
||||
{
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyHrWithEmail: Received payload = " . json_encode($this->request->getJSON() ?? []));
|
||||
try {
|
||||
|
||||
$data = $this->request->getJSON();
|
||||
|
||||
$email = $data->email;
|
||||
$otp = $data->otp;
|
||||
|
||||
@ -604,7 +604,17 @@ class RestAuthenticationController extends AdminController
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||
$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,
|
||||
];
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th, 'error_data' => $errorData],500);
|
||||
}
|
||||
}
|
||||
|
||||
@ -648,9 +658,9 @@ class RestAuthenticationController extends AdminController
|
||||
|
||||
if (isset($mobile_number))
|
||||
{
|
||||
$hrData = $this->hrModel->where('mobile', $mobile_number)->where('contact_type', 'client')->where('otp', $otp)->first();
|
||||
$hrData = $this->hrModel->where('mobile', $mobile_number)->where('contact_type', 'client')->where('is_active', 1)->where('otp', $otp)->first();
|
||||
}else{
|
||||
$hrData = $this->hrModel->where('email', $email)->where('contact_type', 'client')->where('otp', $otp)->first();
|
||||
$hrData = $this->hrModel->where('email', $email)->where('contact_type', 'client')->where('is_active', 1)->where('otp', $otp)->first();
|
||||
}
|
||||
|
||||
if ($hrData)
|
||||
@ -678,6 +688,9 @@ class RestAuthenticationController extends AdminController
|
||||
->join('clients', 'client_branch.client_id = clients.id', 'left')
|
||||
->where('level_contacts.mobile', $mobile_number )
|
||||
->where('level_contacts.contact_type', 'client')
|
||||
->where('level_contacts.is_active', 1)
|
||||
->where('clients.is_active', 1)
|
||||
->where('client_branch.is_active', 1)
|
||||
->findAll();
|
||||
//set otp value null
|
||||
$this->hrModel->where('mobile', $mobile_number)->where('otp', $otp)->where('contact_type', 'client')->set(['otp'=>null])->update();
|
||||
@ -689,6 +702,9 @@ class RestAuthenticationController extends AdminController
|
||||
->join('clients', 'client_branch.client_id = clients.id', 'left')
|
||||
->where('level_contacts.email', $email )
|
||||
->where('level_contacts.contact_type', 'client')
|
||||
->where('level_contacts.is_active', 1)
|
||||
->where('clients.is_active', 1)
|
||||
->where('client_branch.is_active', 1)
|
||||
->findAll();
|
||||
//set otp value null
|
||||
$this->hrModel->where('email', $email)->where('otp', $otp)->where('contact_type', 'client')->set(['otp'=>null])->update();
|
||||
@ -1515,9 +1531,116 @@ class RestAuthenticationController extends AdminController
|
||||
$email_id = $payload->email_id ?? null;
|
||||
$client_id = $payload->client_id ?? null;
|
||||
$plain_password = $payload->password ?? null;
|
||||
$confirm_password = $payload->confirm_password ?? null;
|
||||
|
||||
if (empty($plain_password)) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'message' => 'Password cannot be empty'], 400);
|
||||
if (empty($plain_password) || empty($confirm_password)) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'message' => 'Both password cannot be empty'], 400);
|
||||
}
|
||||
|
||||
if($plain_password !== $confirm_password){
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'message' => 'Password and confirm password not matched'], 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());
|
||||
$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,
|
||||
];
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'message' => $th->getMessage(), 'errorData' => $errorData], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function changePassword()
|
||||
{
|
||||
$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;
|
||||
$old_password = $payload['old_password'] ?? null;
|
||||
$new_password = $payload['new_password'] ?? null;
|
||||
$confirm_password = $payload['confirm_password'] ?? null;
|
||||
|
||||
if (!$mobile_number && !$email_id) {
|
||||
return $this->respond(['status' => 'failed','code' => 400,'message' => 'Mobile number or Email ID is required'], 400);
|
||||
}
|
||||
|
||||
if (empty($new_password) || empty($confirm_password) || empty($old_password)) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'message' => 'old_password , New password and Confirm password are required' ], 400);
|
||||
}
|
||||
|
||||
if($new_password !== $confirm_password){
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'message' => 'New password and confirm password not matched'], 400);
|
||||
}
|
||||
|
||||
// Build employee query
|
||||
@ -1555,161 +1678,57 @@ class RestAuthenticationController extends AdminController
|
||||
$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);
|
||||
if ($employeeData && password_verify($old_password, $employeeData['password'])) {
|
||||
|
||||
$updateData = [
|
||||
'password' => $hashedPassword,
|
||||
];
|
||||
// Hash new password
|
||||
// $newHashedPassword = password_hash($new_password, PASSWORD_DEFAULT);
|
||||
$newHashedPassword = $new_password;
|
||||
|
||||
$updated = $this->employeeModel->where('id', $id)->set($updateData)->update();
|
||||
// Update password and clear OTP
|
||||
$updated = $this->employeeModel->update($employeeData['id'], [
|
||||
'password' => $newHashedPassword,
|
||||
]);
|
||||
|
||||
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);
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - changePassword: Password updated successfully");
|
||||
return $this->respond(['status' => 'success','code' => 200,'message' => 'Password changed successfully'], 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);
|
||||
return $this->respond(['status' => 'failed','code' => 500,'message' => 'Failed to update password' ], 500);
|
||||
}
|
||||
} 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);
|
||||
}else{
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => 'Old password is incorrect'], 404);
|
||||
}
|
||||
|
||||
} 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);
|
||||
|
||||
$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(!$mobile_number && !$email_id){
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'data' => "", 'message' => 'Mobile number or Email ID is required'], 400);
|
||||
}
|
||||
|
||||
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')
|
||||
@ -1725,7 +1744,9 @@ class RestAuthenticationController extends AdminController
|
||||
}
|
||||
|
||||
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||
|
||||
} elseif ($email_id) {
|
||||
|
||||
$builder = $this->employeeModel
|
||||
->select('employees.*')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
@ -1741,9 +1762,8 @@ class RestAuthenticationController extends AdminController
|
||||
}
|
||||
|
||||
$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);
|
||||
@ -1770,11 +1790,8 @@ class RestAuthenticationController extends AdminController
|
||||
$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', ' ');
|
||||
@ -1783,6 +1800,7 @@ class RestAuthenticationController extends AdminController
|
||||
|
||||
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', ' ');
|
||||
@ -1792,89 +1810,162 @@ class RestAuthenticationController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function sendChangePasswordOTP()
|
||||
public function verifyOtp()
|
||||
{
|
||||
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() ?? []));
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyOtp: Received payload = " . json_encode($this->request->getJSON() ?? []));
|
||||
|
||||
try {
|
||||
$requestData = $this->request->getJSON(true);
|
||||
|
||||
$requestData = $this->request->getJSON(true);
|
||||
$mobile_number = $requestData['mobile_number'] ?? null;
|
||||
$email_id = $requestData['email_id'] ?? null;
|
||||
$client_id = $requestData['client_id'] ?? null;
|
||||
$otp = $requestData['otp'] ?? null;
|
||||
|
||||
if (!$email_id) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'data' => "", 'message' => 'Email ID is required'], 400);
|
||||
if(!$mobile_number && !$email_id){
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'message' => 'Mobile number or 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 (!$otp) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'message' => 'OTP is required'], 400);
|
||||
}
|
||||
|
||||
if ($email_id) {
|
||||
$builder->where('employees.email_corporate', $email_id);
|
||||
// 🔹 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();
|
||||
|
||||
} 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'])
|
||||
->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();
|
||||
|
||||
}
|
||||
|
||||
$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 otp
|
||||
if ($employeeData && $employeeData['otp'] == $otp) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyOtp: OTP Verified employee found");
|
||||
$this->employeeModel->where('id', $employeeData['id'])->where('otp', $otp)->where('relationship', 'self')->set(['otp'=>null])->update();
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'message' => "OTP verified succesfully"], 200);
|
||||
} else {
|
||||
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyOtp: OTP verification failed, OTP not found in the post db");
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'message' => "OTP verification failed"], 200);
|
||||
}
|
||||
|
||||
$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', ' ');
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyOtp: Exception: " . $e->getMessage() . " --- Line: " . $e->getLine());
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => "", 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function checkPassword()
|
||||
{
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - checkPassword: Request payload = " . json_encode($this->request->getJSON() ?? []));
|
||||
|
||||
try {
|
||||
|
||||
$payload = $this->request->getJSON() ?? [];
|
||||
$mobile_number = $payload->mobile_number ?? null;
|
||||
$email_id = $payload->email_id ?? null;
|
||||
|
||||
if(!$mobile_number && !$email_id){
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'message' => 'Mobile number or Email ID 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();
|
||||
|
||||
} 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'])
|
||||
->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();
|
||||
|
||||
}
|
||||
|
||||
$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 ?? []));
|
||||
|
||||
if ($employeeData && $employeeData["password"] != null) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - checkPassword: Mpin - Exist");
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => "", 'message' => "Password - exist"],200);
|
||||
} else {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - checkPassword: Password - not found in PRE so call the thirdpartapi to the POST to check the MPIN");
|
||||
return $this->respond(['status' => 'failed','code' => 200,'data' => "", 'message' => "Password - not exist"],200);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - Exception: " . $e->getMessage() . " --- Line: " . $e->getLine() . " --- Trace: " . $e->getTraceAsString());
|
||||
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);
|
||||
@ -1943,9 +2034,6 @@ class RestAuthenticationController extends AdminController
|
||||
}
|
||||
} 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,
|
||||
|
||||
@ -102,8 +102,6 @@ class ThzController extends BaseController
|
||||
public function ticketList()
|
||||
{
|
||||
|
||||
$data['tab_name'] = "Tickets";
|
||||
$data['page_name'] = "Tickets";
|
||||
try {
|
||||
$returnType = strtolower($this->request->getGet('return_type') ?? 'api');
|
||||
|
||||
@ -130,7 +128,8 @@ class ThzController extends BaseController
|
||||
// 3,4 remain person varannum.
|
||||
$data['client_list'] = $this->clientModel->getCreatedByUserName();
|
||||
$data['ticket_type'] = $this->thzTypeModel->where('is_active', 1)->findAll();
|
||||
|
||||
$data['tab_name'] = "Tickets";
|
||||
$data['page_name'] = "Tickets";
|
||||
return $this->loadLayout('thz_list', $data);
|
||||
}
|
||||
|
||||
@ -267,6 +266,8 @@ class ThzController extends BaseController
|
||||
$result['policy_terms'] = $toGetPolicyId ? $this->getPolicyTerms($toGetPolicyId) : '';
|
||||
|
||||
$result['ticket_type'] = $this->thzTypeModel->where('is_active', 1)->findAll();
|
||||
$result['tab_name'] = "Tickets";
|
||||
$result['page_name'] = "Ticket Details";
|
||||
|
||||
return $this->loadLayout('thz_notes', $result);
|
||||
}
|
||||
|
||||
@ -647,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);
|
||||
}
|
||||
@ -656,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
|
||||
}
|
||||
@ -671,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;
|
||||
|
||||
@ -45,6 +45,7 @@ class EmployeeModel extends Model
|
||||
"mpin",
|
||||
"is_mpin_skipped",
|
||||
"is_biometric_enabled",
|
||||
"password",
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
|
||||
@ -29,6 +29,8 @@ class InsurerBranchModel extends Model
|
||||
{
|
||||
$query = $this->select('insurer_branch.*, I.short_name as insurer_name, I.category')
|
||||
->join('insurers I', 'insurer_branch.insurer_id = I.id', 'left')
|
||||
->where('I.is_active', 1)
|
||||
->where('insurer_branch.is_active', 1)
|
||||
->find();
|
||||
return $query;
|
||||
}
|
||||
|
||||
@ -22,16 +22,18 @@ table.dataTable thead th {
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
<!-- <div class="row" style="margin-bottom:1rem;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Advertisement Images</h4>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 5px;">
|
||||
<a data-toggle="modal" data-target="#bike_make_login-modal" href="#" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
|
||||
</div>
|
||||
</div>
|
||||
<table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
||||
id="tickets-table">
|
||||
</div> -->
|
||||
<!-- <table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
||||
id="tickets-table"> -->
|
||||
<div class="table-responsive">
|
||||
<table data-custom-table-css="table" class="table mb-0 nowrap w-100 table-centered" cellspacing="0" id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">Advertisement Image Name</th>
|
||||
@ -62,6 +64,7 @@ table.dataTable thead th {
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
@ -110,6 +113,40 @@ table.dataTable thead th {
|
||||
|
||||
<script>
|
||||
|
||||
var table;
|
||||
$(document).ready(function()
|
||||
{
|
||||
table = $('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-1'f><'col-sm-11 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||
buttons: [
|
||||
{
|
||||
text: '<i class="mdi mdi-plus" ></i><span class=" btn-custom"> Add </span>',
|
||||
className: 'btn app-btn-primary',
|
||||
action: function (e, dt, node, config) {
|
||||
// your previous click logic here
|
||||
$('#add_image_id').val(0);
|
||||
$('#advertise_add_edit').html('Add Advertise Image');
|
||||
$('#uploadPreview').attr('src', '<?= base_url()."public/assets/images/avatar_2x.png" ?>');
|
||||
$('#bike_make_login-modal').modal('show');
|
||||
}
|
||||
}
|
||||
],
|
||||
language: {
|
||||
search: `
|
||||
<div class="datatable-search-wrapper">
|
||||
_INPUT_
|
||||
<i class="mdi mdi-magnify datatable-search-icon"></i>
|
||||
</div>`,
|
||||
searchPlaceholder: "Search",
|
||||
emptyTable: '<div class="text-center text-muted">No Data found</div>'
|
||||
},
|
||||
paging: true ,
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function submitBranch(params) {
|
||||
|
||||
// if ($('#add_image_id').val()) {
|
||||
@ -181,12 +218,12 @@ table.dataTable thead th {
|
||||
}
|
||||
|
||||
|
||||
$('#btnAdd').click(function () {
|
||||
$('#add_image_id').val(0);
|
||||
$('#advertise_add_edit').html('Add Advertise Image');
|
||||
$('#uploadPreview').attr('src', '<?= base_url()."public/assets/images/avatar_2x.png" ?>');
|
||||
// $('#btnAdd').click(function () {
|
||||
// $('#add_image_id').val(0);
|
||||
// $('#advertise_add_edit').html('Add Advertise Image');
|
||||
// $('#uploadPreview').attr('src', '<?= base_url()."public/assets/images/avatar_2x.png" ?>');
|
||||
|
||||
})
|
||||
// })
|
||||
|
||||
$('.advertise_image_edit').click(function (params) {
|
||||
// console.log($(this).data('id'));
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
<td><?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?></td>
|
||||
<td><?php echo $file['event_type'] ?></td>
|
||||
<td><?php echo $insurer_or_tpa[$file['insurer_or_tpa']] ?></td>
|
||||
<td><?php echo $import_or_export[$file['actions']] ?></td>
|
||||
<td><?php echo $import_or_export[$file['actions']] ?? ucfirst($file['actions']) ?></td>
|
||||
<td><?php echo $file['count'] == null ? '-' : $file['count'] ?></td>
|
||||
|
||||
<td><?php echo format_indian_number($file['amount'])?></td>
|
||||
@ -140,6 +140,10 @@
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top" title="<?= $file['error_data'] ?>"></a>
|
||||
|
||||
<?php } else if ($file['status'] == 'failed-8') { ?>
|
||||
|
||||
failed
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<?php echo $file['status']; ?>
|
||||
|
||||
@ -7,6 +7,13 @@
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
.column-header {
|
||||
margin-right: 10px; /* Adjust this value as needed */
|
||||
}
|
||||
|
||||
table[data-custom-table-css="table"].dataTable thead th {
|
||||
padding-right: 20px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="col-12" id="inception_list">
|
||||
|
||||
@ -26,11 +26,11 @@
|
||||
<div class="col-12" id="second_page">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<!-- <div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">BDS TAT Band Wise Report</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="table-responsive">
|
||||
<table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
@ -40,7 +40,7 @@
|
||||
// Get headers dynamically
|
||||
$headers = array_keys($data[0]);
|
||||
foreach ($headers as $header): ?>
|
||||
<th><?= esc($header) ?></th>
|
||||
<th><?= esc(str_replace('_', ' ', $header)) ?></th>
|
||||
<?php endforeach; ?>
|
||||
<th>TOTAL</th>
|
||||
</tr>
|
||||
@ -108,13 +108,6 @@
|
||||
|
||||
// ],
|
||||
buttons: [
|
||||
{
|
||||
text: '<i class="mdi mdi-plus" ></i><span class=" btn-custom"> Add </span>',
|
||||
className: 'btn app-btn-primary mr-2',
|
||||
action: function(e, dt, node, config) {
|
||||
openTicket();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'collection',
|
||||
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
||||
|
||||
@ -106,7 +106,7 @@
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Issuer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="issuer" name="issuer" required>
|
||||
<option value="0">Select Issure</option>
|
||||
<option value="0">Select Issuer</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
@ -390,7 +390,8 @@
|
||||
_INPUT_
|
||||
<i class="mdi mdi-magnify datatable-search-icon"></i>
|
||||
</div>`,
|
||||
searchPlaceholder: "Search"
|
||||
searchPlaceholder: "Search",
|
||||
emptyTable: '<div class="text-center text-muted">No Data found</div>'
|
||||
},
|
||||
paging: true,
|
||||
pageLength: 10,
|
||||
|
||||
@ -684,6 +684,7 @@ input:checked + .slider_blue::before {
|
||||
var message = (policy_PrimaryKey === '') ?
|
||||
'Policy Created successfully' : 'Policy Updated Successfully';
|
||||
toastr.success(message, 'Success');
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
|
||||
@ -87,7 +87,7 @@
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Endorsement List</h4>
|
||||
<h4 style="position: relative;">Endorsements</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -484,13 +484,24 @@
|
||||
if(policy_value == 0 || insurer_or_tpa == 'tpa' || action_type == 'import'){
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
if ($.fn.select2 && $('#event_type').data('select2')) {
|
||||
$('#event_type').select2('destroy');
|
||||
}
|
||||
$("#event_type").select2('destroy');
|
||||
}
|
||||
})
|
||||
|
||||
/**This function updates the download link based on the selected option in the dropdown menu. **/
|
||||
$('#event_type').on('change', function() {
|
||||
|
||||
var selectedValue = $(this).val();
|
||||
if (selectedValue !== '') {
|
||||
$('#import_excel_download').show();
|
||||
var fullURL = '<?= base_url("util/download_import_excel/"); ?>' + selectedValue;
|
||||
$('#import_excel_download').attr('href', fullURL);
|
||||
} else {
|
||||
$('#import_excel_download').hide();
|
||||
$('#import_excel_download').removeAttr('href');
|
||||
}
|
||||
});
|
||||
|
||||
$('#event_type').on('change', function() {
|
||||
|
||||
var selectedVal = $(this).val();
|
||||
@ -517,6 +528,34 @@
|
||||
console.log('tpa_api_sevice type', typeof tpa_api_sevice);
|
||||
});
|
||||
|
||||
$('#action_type').on('change', function() {
|
||||
|
||||
var selectedValue = $(this).val();
|
||||
var insurer_or_tpa = $('#insurer_or_tpa').val()
|
||||
// console.log(selectedValue);
|
||||
|
||||
if (selectedValue == '') {
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').hide();
|
||||
} else if (selectedValue == 'import') {
|
||||
$('#import_file').prop('required', true);
|
||||
$('#import_file').attr('name', 'import_file_data');
|
||||
$('#import_excel_btn').show();
|
||||
$('#export_excel_btn').hide();
|
||||
} else if (selectedValue == 'export') {
|
||||
$('#import_file').removeAttr('name');
|
||||
$('#import_file').prop('required', false);
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').show();
|
||||
}
|
||||
|
||||
if (tpa_api_sevice == 0 || selectedValue == 'export' || insurer_or_tpa == "insurer") {
|
||||
$('.fetch_tpa').hide();
|
||||
} else {
|
||||
$('.fetch_tpa').show();
|
||||
}
|
||||
});
|
||||
|
||||
$('#insurer_or_tpa').on('change', function() {
|
||||
|
||||
var insurer_or_tpa = $(this).val()
|
||||
@ -538,18 +577,12 @@
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
if ($.fn.select2 && $('#event_type').data('select2')) {
|
||||
$('#event_type').select2('destroy');
|
||||
}
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
}else if(insurer_or_tpa == 'insurer' && action_type == 'import'){
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
if ($.fn.select2 && $('#event_type').data('select2')) {
|
||||
$('#event_type').select2('destroy');
|
||||
}
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
}else if(insurer_or_tpa == 'insurer' && action_type == 'export' && event_type_data == 1){
|
||||
@ -562,9 +595,6 @@
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
if ($.fn.select2 && $('#event_type').data('select2')) {
|
||||
$('#event_type').select2('destroy');
|
||||
}
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
}else{
|
||||
@ -596,18 +626,12 @@
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
if ($.fn.select2 && $('#event_type').data('select2')) {
|
||||
$('#event_type').select2('destroy');
|
||||
}
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
} else if(action_type == 'export' && insurer_or_tpa == 'tpa'){
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
if ($.fn.select2 && $('#event_type').data('select2')) {
|
||||
$('#event_type').select2('destroy');
|
||||
}
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
}else if(action_type == 'export' && insurer_or_tpa == 'insurer' && event_type_data == 1){
|
||||
@ -620,9 +644,6 @@
|
||||
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
if ($.fn.select2 && $('#event_type').data('select2')) {
|
||||
$('#event_type').select2('destroy');
|
||||
}
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
}else{
|
||||
@ -634,48 +655,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
/**This function updates the download link based on the selected option in the dropdown menu. **/
|
||||
$('#event_type').on('change', function() {
|
||||
|
||||
var selectedValue = $(this).val();
|
||||
if (selectedValue !== '') {
|
||||
$('#import_excel_download').show();
|
||||
var fullURL = '<?= base_url("util/download_import_excel/"); ?>' + selectedValue;
|
||||
$('#import_excel_download').attr('href', fullURL);
|
||||
} else {
|
||||
$('#import_excel_download').hide();
|
||||
$('#import_excel_download').removeAttr('href');
|
||||
}
|
||||
});
|
||||
|
||||
$('#action_type').on('change', function() {
|
||||
|
||||
var selectedValue = $(this).val();
|
||||
var insurer_or_tpa = $('#insurer_or_tpa').val()
|
||||
// console.log(selectedValue);
|
||||
|
||||
if (selectedValue == '') {
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').hide();
|
||||
} else if (selectedValue == 'import') {
|
||||
$('#import_file').prop('required', true);
|
||||
$('#import_file').attr('name', 'import_file_data');
|
||||
$('#import_excel_btn').show();
|
||||
$('#export_excel_btn').hide();
|
||||
} else if (selectedValue == 'export') {
|
||||
$('#import_file').removeAttr('name');
|
||||
$('#import_file').prop('required', false);
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').show();
|
||||
}
|
||||
|
||||
if (tpa_api_sevice == 0 || selectedValue == 'export' || insurer_or_tpa == "insurer") {
|
||||
$('.fetch_tpa').hide();
|
||||
} else {
|
||||
$('.fetch_tpa').show();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Function to convert object to query parameters
|
||||
|
||||
@ -190,6 +190,14 @@
|
||||
// "box-shadow": "0px 4px 4px 0px #00000040"
|
||||
// });
|
||||
});
|
||||
|
||||
const observer = new MutationObserver(() => {
|
||||
document.querySelectorAll('.select2-search__field').forEach(el => {
|
||||
el.style.setProperty('box-shadow', 'none', 'important');
|
||||
});
|
||||
});
|
||||
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
|
||||
@ -1953,6 +1953,7 @@
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<!-- This Menu Hide because of Role Merge REF : SVM,SVR,KV.
|
||||
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
|
||||
<li>
|
||||
<a href="#policyPendingActions" data-toggle="collapse" class="waves-effect">
|
||||
@ -1976,6 +1977,7 @@
|
||||
</div>
|
||||
</li>
|
||||
<?php } ?>
|
||||
-->
|
||||
|
||||
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
|
||||
<li>
|
||||
|
||||
@ -21,6 +21,18 @@
|
||||
.center-align-input {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.column-header {
|
||||
margin-right: 10px; /* Adjust this value as needed */
|
||||
}
|
||||
|
||||
/* Center align header text and icons */
|
||||
table[data-custom-table-css="table"].dataTable thead th {
|
||||
padding-top: 3px !important;
|
||||
padding-bottom: 4px !important;
|
||||
padding-right: 15px !important;
|
||||
padding-left: 15px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="container-fluid-min">
|
||||
@ -107,21 +119,21 @@
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table mb-0 nowrap w-100 table-centered" cellspacing="0" >
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>S.No </th>
|
||||
<th><div class="column-header">S.No</div></th>
|
||||
<!-- <th>Client Name</th> -->
|
||||
<th>Insurer </th>
|
||||
<th>Insurer<br> Branch </th>
|
||||
<th>Statement<br> Month </th>
|
||||
<th>Statement<br> No </th>
|
||||
<th>Invoice No </th>
|
||||
<th>Invoice Status </th>
|
||||
<th>Invoice Date </th>
|
||||
<th>Invoice Amount </th>
|
||||
<th>Realization <br>Amount </th>
|
||||
<th>Outstanding <br>Amount </th>
|
||||
<th><div class="column-header">Insurer</div></th>
|
||||
<th><div class="column-header">Insurer<br> Branch</div></th>
|
||||
<th><div class="column-header">Statement<br> Month</div></th>
|
||||
<th><div class="column-header">Statement<br> No</div></th>
|
||||
<th><div class="column-header">Invoice No</div></th>
|
||||
<th><div class="column-header">Invoice Status</div></th>
|
||||
<th><div class="column-header">Invoice Date</div></th>
|
||||
<th><div class="column-header">Invoice Amount</div></th>
|
||||
<th><div class="column-header">Realization <br>Amount</div></th>
|
||||
<th><div class="column-header">Outstanding <br>Amount</div></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
@ -213,8 +225,12 @@
|
||||
]
|
||||
}],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
search: `
|
||||
<div class="datatable-search-wrapper">
|
||||
_INPUT_
|
||||
<i class="mdi mdi-magnify datatable-search-icon"></i>
|
||||
</div>`,
|
||||
searchPlaceholder: "Search"
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 25 // Set default number of rows per page (optional)
|
||||
|
||||
@ -243,7 +243,7 @@
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="addon_policy">Policy Issue Month<span id="base_danger" class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="month" name="month" placeholder="MM/YYYY" >
|
||||
<input type="text" class="form-control" id="month" name="month" placeholder="MM/YYYY" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
|
||||
@ -813,7 +813,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr id="table_tr_1">
|
||||
<td>Insurer</td>
|
||||
<td>Insurer<span id="premium_details_insurer" class="text-danger">*</span></td>
|
||||
</tr>
|
||||
<tr id="table_tr_2" style="display: none;">
|
||||
<td>Is Leader?</td>
|
||||
@ -3588,7 +3588,7 @@
|
||||
|
||||
$("#inception_form_id").submit(function(event) {
|
||||
|
||||
|
||||
if (!this.checkValidity()) { return; }
|
||||
event.preventDefault();
|
||||
|
||||
let policy_type_id = $('#policy_type_id').val();
|
||||
@ -3607,6 +3607,53 @@
|
||||
return;
|
||||
}
|
||||
|
||||
let hasEmptyInsurer = false;
|
||||
let firstEmptyField = null;
|
||||
|
||||
// $('select[name="follow_insurer_id[]"]').each(function() {
|
||||
// const $field = $(this);
|
||||
// const errorId = 'error-' + $field.attr('id');
|
||||
|
||||
// // Remove any old message
|
||||
// $('#' + errorId).remove();
|
||||
|
||||
// if ($field.val().trim() === "") {
|
||||
// hasEmptyInsurer = true;
|
||||
// $field.addClass('is-invalid');
|
||||
|
||||
// // Add error message only once
|
||||
// if (!$field.next('.text-danger').length) {
|
||||
// $field.after(`<small id="${errorId}" class="text-danger">This value is required.</small>`);
|
||||
// }
|
||||
|
||||
// if (!firstEmptyField) {
|
||||
// firstEmptyField = this; // store first empty field
|
||||
// }
|
||||
// } else {
|
||||
// $field.removeClass('is-invalid');
|
||||
// $('#' + errorId).remove(); // remove if filled
|
||||
// }
|
||||
// });
|
||||
$('select[name="follow_insurer_id[]"]').each(function() {
|
||||
if ($(this).val().trim() === "") {
|
||||
hasEmptyInsurer = true;
|
||||
$(this).addClass('is-invalid');
|
||||
if (!firstEmptyField) {
|
||||
firstEmptyField = this; // store the first invalid field
|
||||
}
|
||||
} else {
|
||||
$(this).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
|
||||
if (hasEmptyInsurer) {
|
||||
if (firstEmptyField) {
|
||||
$(firstEmptyField).focus();
|
||||
}
|
||||
toastr.warning('Please select all Insurers before submitting', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
if(pt_form_sumbit_handler == 0){
|
||||
toastr.warning('Base premium greater than CD Amount', 'WARNING');
|
||||
return;
|
||||
@ -4392,7 +4439,7 @@
|
||||
|
||||
case 0: // Insurer selection
|
||||
newCell = `<td>
|
||||
<select class="form-control follow_insurer" data-count="${insurerCount}" id="follow_insurer_id_${insurerCount}" name="follow_insurer_id[]" onchange="getCDAccountNumber(this)">
|
||||
<select class="form-control follow_insurer" data-count="${insurerCount}" id="follow_insurer_id_${insurerCount}" name="follow_insurer_id[]" onchange="getCDAccountNumber(this)" required>
|
||||
<option value="" selected>Select Insurer</option>
|
||||
<?php foreach ($insurer_branch as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>" data-ic="<?= $value['category'] ?>">
|
||||
@ -4534,7 +4581,7 @@
|
||||
switch(index) {
|
||||
case 0: // Insurer selection
|
||||
newCell = `<td>
|
||||
<select class="form-control follow_insurer" data-count="${insurerCount}" id="follow_insurer_id_${insurerCount}" name="follow_insurer_id[]" onchange="getCDAccountNumber(this)">
|
||||
<select class="form-control follow_insurer" data-language="1" data-count="${insurerCount}" id="follow_insurer_id_${insurerCount}" name="follow_insurer_id[]" onchange="getCDAccountNumber(this)" required>
|
||||
<option value="" selected>Select Insurer</option>
|
||||
<?php foreach ($insurer_branch as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>" data-ic="<?= $value['category'] ?>">
|
||||
@ -4555,7 +4602,7 @@
|
||||
break;
|
||||
case 2: // CD Account Number selectionclass="std_tp_td"
|
||||
newCell = `<td>
|
||||
<select class="form-control follow_insurer_cd" data-count="${insurerCount}" id="cd_ac_no_${insurerCount}" name="cd_ac_no_for_child[]" onchange="addCDAccountNumber(this); restrictCDACNO(this)">
|
||||
<select class="form-control follow_insurer_cd" data-language="2" data-count="${insurerCount}" id="cd_ac_no_${insurerCount}" name="cd_ac_no_for_child[]" onchange="addCDAccountNumber(this); restrictCDACNO(this)">
|
||||
<option value="" selected>Select CD No</option>
|
||||
<option value="add_cd"> + Add CD No</option>
|
||||
</select>
|
||||
@ -4747,11 +4794,11 @@
|
||||
$('[name="standard_tp[]"]').val(std_tp);
|
||||
$('[name="standard_ter[]"]').val(std_tep);
|
||||
|
||||
if(insurerCount > 1){
|
||||
$('.follow_insurer').prop('required', true);
|
||||
}else{
|
||||
$('.follow_insurer').prop('required', false);
|
||||
}
|
||||
// if(insurerCount > 1){
|
||||
// $('.follow_insurer').prop('required', true);
|
||||
// }else{
|
||||
// $('.follow_insurer').prop('required', false);
|
||||
// }
|
||||
|
||||
});
|
||||
|
||||
@ -4768,6 +4815,12 @@
|
||||
// });
|
||||
|
||||
co_share_percentage_calculation(insurerCount, "add");
|
||||
|
||||
if (insurerCount === 0) {
|
||||
$('.follow_insurer').prop('required', false);
|
||||
} else {
|
||||
$('.follow_insurer').prop('required', true);
|
||||
}
|
||||
}
|
||||
|
||||
function removeInsurerColumn(index, count_index) {
|
||||
@ -4798,6 +4851,11 @@
|
||||
insurer_count_array = insurer_count_array.filter(item => item !== count_index);
|
||||
co_share_percentage_calculation(null, "remove");
|
||||
insurerCount--;
|
||||
if (insurerCount === 0) {
|
||||
$('.follow_insurer').prop('required', false);
|
||||
} else {
|
||||
$('.follow_insurer').prop('required', true);
|
||||
}
|
||||
|
||||
console.log('#################################### END Remove Insurer Column ####################################');
|
||||
|
||||
|
||||
@ -142,13 +142,13 @@ table.dataTable tbody td {
|
||||
<td style="display: none;"><?php echo empty($row['policy_end_date']) ? 'N/A' : date('d/m/Y', strtotime($row['policy_end_date'])); ?></td>
|
||||
<td style="display: none;"><?php echo $row['ref'] ?: 'N/A'; ?></td>
|
||||
<td style="display: none;"><?php echo $row['remarks'] ?: 'N/A'; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['bp_amt']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['tp_or_ter']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['bp_amt'] ?: '0.00'; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['tp_or_ter'] ?: '0.00'; ?></td>
|
||||
<td class="right-align-input" style="display: none;"><?php echo $row['premium_wo_gst']; ?></td>
|
||||
<!-- <td class="right-align-input" style="display: none;"><?php echo $row['gst_amount']; ?></td> -->
|
||||
<td class="right-align-input"><?php echo $row['total_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_bp_per']; ?> %</td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_tp_or_ter_per'];?> %</td>
|
||||
<td class="right-align-input"><?php echo $row['total_premium'] ?: '0.00'; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_bp_per'] ?: '0.00'; ?> %</td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_tp_or_ter_per'] ?: '0.00';?> %</td>
|
||||
<td class="right-align-input" style="display: none;"><?php echo isset($row['reward']) ? $row['reward'] : '0.00'; ?></td>
|
||||
|
||||
<?php
|
||||
@ -500,32 +500,61 @@ $(document).ready(function() {
|
||||
var api = this.api();
|
||||
|
||||
// Calculate column totals (adjust indices based on VISIBLE columns)
|
||||
var totalPremium = api.column(20, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
// var totalPremium = api.column(20, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b || 0);
|
||||
// }, 0);
|
||||
|
||||
var total_rewards = api.column(23, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
// var total_rewards = api.column(23, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b || 0);
|
||||
// }, 0);
|
||||
|
||||
var totalIrda = api.column(24, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
// var totalIrda = api.column(24, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b || 0);
|
||||
// }, 0);
|
||||
|
||||
var totalBilled = api.column(25, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
// var totalBilled = api.column(25, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b || 0);
|
||||
// }, 0);
|
||||
|
||||
var totalUnbilled = api.column(26, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b || 0);
|
||||
}, 0);
|
||||
// var totalUnbilled = api.column(26, {search: 'applied'}).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b || 0);
|
||||
// }, 0);
|
||||
|
||||
// Update the totals
|
||||
// $('#total_premium').text(totalPremium.toFixed(2));
|
||||
// $('#total_rewards').text(total_rewards.toFixed(2));
|
||||
// $('#total_irda').text(totalIrda.toFixed(2));
|
||||
// $('#total_billed').text(totalBilled.toFixed(2));
|
||||
// $('#total_unbilled').text(totalUnbilled.toFixed(2));
|
||||
|
||||
// Helper to sum numeric values safely
|
||||
var getTotal = function(colIndex) {
|
||||
return api.column(colIndex, { search: 'applied' }).data()
|
||||
.reduce(function(a, b) {
|
||||
var x = parseFloat(a) || 0;
|
||||
var y = parseFloat(
|
||||
(typeof b === 'string') ? b.replace(/[^0-9.\-]+/g, '') : b
|
||||
) || 0;
|
||||
return x + y;
|
||||
}, 0);
|
||||
};
|
||||
|
||||
// Compute totals by column index
|
||||
var totalPremium = getTotal(21);
|
||||
var totalRewards = getTotal(24);
|
||||
var totalIrda = getTotal(25);
|
||||
var totalBilled = getTotal(26);
|
||||
var totalUnbilled = getTotal(27);
|
||||
|
||||
// Update the totals section above the table
|
||||
$('#total_premium').text(totalPremium.toFixed(2));
|
||||
$('#total_rewards').text(total_rewards.toFixed(2));
|
||||
$('#total_rewards').text(totalRewards.toFixed(2));
|
||||
$('#total_irda').text(totalIrda.toFixed(2));
|
||||
$('#total_billed').text(totalBilled.toFixed(2));
|
||||
$('#total_unbilled').text(totalUnbilled.toFixed(2));
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
@ -169,8 +169,6 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
getClientAndBranchAndPolicy()
|
||||
getURLParams()
|
||||
$('#client_id').select2();
|
||||
$('#client_branch_id').select2();
|
||||
$('#insurer_id').select2();
|
||||
@ -179,7 +177,9 @@
|
||||
$('#client_policy_id').select2();
|
||||
$('#user_id').select2();
|
||||
|
||||
})
|
||||
getClientAndBranchAndPolicy();
|
||||
});
|
||||
|
||||
|
||||
function fetchEmpolyeeList(event) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
@ -223,21 +223,30 @@
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
|
||||
function getSafeParam(params, paramName) {
|
||||
const val = params.get(paramName);
|
||||
if (val === null || val === '' || val === 'null' || val === 'undefined' || val === undefined) {
|
||||
return '';
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
function getURLParams() {
|
||||
const url = new URL(window.location.href);
|
||||
const params = new URLSearchParams(url.search);
|
||||
|
||||
const startDate = params.get('start_date') || 0; // Default to 0 if not found
|
||||
const endDate = params.get('end_date') || 0; // Default to 0 if not found
|
||||
const client_id = params.get('client_id') || 0; // Default to 0 if not found
|
||||
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
|
||||
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
|
||||
const date_type = params.get('date_type') || 0; // Default to 0 if not found
|
||||
const issuer = params.get('issuer') || 0; // Default to 0 if not found
|
||||
const client_branch_id = params.get('client_branch_id') || 0; // Default to 0 if not found
|
||||
const insurer_branch_id = params.get('insurer_branch_id') || 0; // Default to 0 if not found
|
||||
const client_policy_id = params.get('client_policy_id') || 0; // Default to 0 if not found
|
||||
const user_id = params.get('user_id') || 0; // Default to 0 if not found
|
||||
const startDate = getSafeParam(params, 'start_date');
|
||||
const endDate = getSafeParam(params, 'end_date');
|
||||
const client_id = getSafeParam(params, 'client_id');
|
||||
const insurer_id = getSafeParam(params, 'insurer_id');
|
||||
const policy_type_id = getSafeParam(params, 'policy_type_id');
|
||||
const date_type = getSafeParam(params, 'date_type');
|
||||
const issuer = getSafeParam(params, 'issuer');
|
||||
const client_branch_id = getSafeParam(params, 'client_branch_id');
|
||||
const insurer_branch_id = getSafeParam(params, 'insurer_branch_id');
|
||||
const client_policy_id = getSafeParam(params, 'client_policy_id');
|
||||
const user_id = getSafeParam(params, 'user_id');
|
||||
|
||||
hideDateField(date_type)
|
||||
|
||||
@ -258,24 +267,38 @@
|
||||
console.log('End Date:', endDate);
|
||||
|
||||
if (startDate != 0 && endDate != 0) {
|
||||
setTimeout(function() {
|
||||
$('#start_date').val(startDate)
|
||||
$('#end_date').val(endDate)
|
||||
$('#client_id').val(client_id).select2()
|
||||
$('#insurer_id').val(insurer_id).select2()
|
||||
$('#user_id').val(user_id).select2()
|
||||
$('#policy_type_id').val(policy_type_id).select2()
|
||||
$('#date_type').val(date_type).trigger('change');
|
||||
$('#issuer').val(issuer)
|
||||
setTimeout(function() {
|
||||
$('#client_branch_id').val(client_branch_id).select2()
|
||||
$('#insurer_branch_id').val(insurer_branch_id).select2()
|
||||
// wait for dropdowns (Select2) to be loaded
|
||||
setTimeout(function() {
|
||||
$('#client_policy_id').val(client_policy_id).select2();
|
||||
}, 1000);
|
||||
}, 2000)
|
||||
}, 1000)
|
||||
// Step 1: Set top-level fields first
|
||||
$('#startDate').val(startDate);
|
||||
$('#endDate').val(endDate);
|
||||
$('#client_id').val(client_id).trigger('change.select2');
|
||||
$('#insurer_id').val(insurer_id).trigger('change.select2');
|
||||
$('#user_id').val(user_id).trigger('change.select2');
|
||||
$('#policy_type_id').val(policy_type_id).trigger('change.select2');
|
||||
$('#date_type').val(date_type).trigger('change');
|
||||
$('#issuer').val(issuer);
|
||||
|
||||
// Step 2: Wait a bit to let change events happen
|
||||
setTimeout(function() {
|
||||
// populate branch dropdowns manually if data exists
|
||||
if (client_id && branch_list[client_id]) {
|
||||
appendBranch(branch_list[client_id]);
|
||||
}
|
||||
if (insurer_id && insurer_branch_list[insurer_id]) {
|
||||
appendInsurerBranch(insurer_branch_list[insurer_id]);
|
||||
}
|
||||
|
||||
// Step 3: Set branch selections
|
||||
$('#client_branch_id').val(client_branch_id).trigger('change.select2');
|
||||
$('#insurer_branch_id').val(insurer_branch_id).trigger('change.select2');
|
||||
|
||||
// Step 4: After branches, handle client policies
|
||||
setTimeout(function() {
|
||||
$('#client_policy_id').val(client_policy_id).trigger('change.select2');
|
||||
}, 500);
|
||||
}, 500);
|
||||
}, 500);
|
||||
}
|
||||
|
||||
}
|
||||
@ -370,6 +393,7 @@
|
||||
insurer_branch_list = res.insurer_branch_data;
|
||||
appendClients(res.client_data);
|
||||
appendInsurer(res.insurer_data);
|
||||
getURLParams();
|
||||
} else {
|
||||
console.log('No data found');
|
||||
}
|
||||
@ -401,6 +425,7 @@
|
||||
});
|
||||
|
||||
$('#client_id').append(option);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
@ -469,7 +494,6 @@
|
||||
function appendPolicies(data) {
|
||||
// console.log('appendPolicies', data);
|
||||
// console.log('appendPolicies', $('#client_policy_id'));
|
||||
|
||||
$('#client_policy_id').empty();
|
||||
$('#client_policy_id').append($('<option>', {
|
||||
value: '',
|
||||
@ -560,9 +584,10 @@
|
||||
let val = $(input).val();
|
||||
if (val == 'statement_month') {
|
||||
$('#bds_title').text(' - Statement Month Wise List')
|
||||
} else {
|
||||
$('#bds_title').text(' - Policy Wise List')
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// $('#bds_title').text(' - Policy Wise List')
|
||||
// }
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -130,11 +130,11 @@ th:first-child, td:first-child {
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<!-- <div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h3 style="position: relative;">Employees</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<table data-custom-table-css="table" class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
|
||||
@ -160,19 +160,19 @@
|
||||
<table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>S.No </th>
|
||||
<th>Client </th>
|
||||
<th>Client Branch </th>
|
||||
<th>Insurer </th>
|
||||
<th>Insurer Branch </th>
|
||||
<th>Policy </th>
|
||||
<th>Endorsement No </th>
|
||||
<th>Premium </th>
|
||||
<th>Statement Premium </th>
|
||||
<th>Premium Variance </th>
|
||||
<th>Expected Amount </th>
|
||||
<th>Statement Amount </th>
|
||||
<th>Variance </th>
|
||||
<th>S.No </th>
|
||||
<th>Client </th>
|
||||
<th>Client Branch </th>
|
||||
<th>Insurer </th>
|
||||
<th>Insurer Branch </th>
|
||||
<th>Policy </th>
|
||||
<th>Endorsement No </th>
|
||||
<th>Premium </th>
|
||||
<th>Statement Premium </th>
|
||||
<th>Premium Variance </th>
|
||||
<th>Expected Amount </th>
|
||||
<th>Statement Amount </th>
|
||||
<th>Variance </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user