Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
8dbf163247
10
.env.sample
10
.env.sample
@ -111,4 +111,12 @@ FHPL_PRIMARY_KEY_CONSTANT =
|
||||
|
||||
VIDAL_PRIMARY_KEY_CONSTANT =
|
||||
|
||||
MEDI_ASSIST_PRIMARY_KEY_CONSTANT =
|
||||
MEDI_ASSIST_PRIMARY_KEY_CONSTANT =
|
||||
|
||||
|
||||
FHPL_TOKEN_URL =
|
||||
FHPL_BASE_URL =
|
||||
FHPL_USER_NAME =
|
||||
FHPL_PASSWORD =
|
||||
FHPL_GRANT_TYPE =
|
||||
|
||||
|
||||
@ -429,6 +429,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get('proceedExcelFileDataValidation', 'EmployeeController::proceedExcelFileDataValidation');
|
||||
$routes->get('checkTpaApiEnable', 'EmployeeRestController::checkTpaApiEnable');
|
||||
$routes->get('generateDemographyDataTable', 'LeadsController::generateDemographyDataTable');
|
||||
$routes->post('insufficientCdBalanceHrMailSend', 'EmployeeController::insufficientCdBalanceHrMailSend');
|
||||
});
|
||||
|
||||
$routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
|
||||
@ -772,11 +773,11 @@ $routes->get('fetchUHIDDetails','ICICILombardController::fetchUHIDDetails');
|
||||
|
||||
//Third party - testing route
|
||||
$routes->get('FhplGetBenefDetails','FhplApiController::FhplGetBenefDetails');
|
||||
$routes->get('EcardRequest','VidalApiController::EcardRequest');
|
||||
$routes->get('EcardRequest','FhplApiController::EcardRequest');
|
||||
$routes->get('HospitalNetwork','MediAssistApiController::HospitalNetwork');
|
||||
$routes->get('VidalGetBenefDetails','VidalApiController::VidalGetBenefDetails');
|
||||
$routes->get('ClaimDetail','FhplApiController::ClaimDetail');
|
||||
$routes->get('SubmitClaim','FhplApiController::SubmitClaim');
|
||||
$routes->get('SubmitClaim','VidalApiController::SubmitClaim');
|
||||
$routes->get('IntimateClaim','MediAssistApiController::IntimateClaim');
|
||||
$routes->get('IRSubmission','MediAssistApiController::IRSubmission');
|
||||
$routes->get('ClaimStatusUpdate','MediAssistApiController::ClaimStatusUpdate');
|
||||
|
||||
@ -12,6 +12,7 @@ use App\Controllers\BaseController;
|
||||
use App\Controllers\VidalApiController;
|
||||
use App\Controllers\ICICILombardController;
|
||||
use App\Controllers\MediAssistApiController;
|
||||
use App\Controllers\FhplApiController;
|
||||
use App\Models\BatchFileModel;
|
||||
use App\Models\FileModel;
|
||||
use App\Helpers\TPADataCompareHelper;
|
||||
@ -26,6 +27,7 @@ class ApiServiceController extends BaseController
|
||||
protected $medi_assist_primary_key;
|
||||
protected $vidal_primary_key;
|
||||
protected $icici_primary_key;
|
||||
protected $fhpl_primary_key;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -34,6 +36,7 @@ class ApiServiceController extends BaseController
|
||||
$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');
|
||||
$this->fhpl_primary_key = getenv('FHPL_PRIMARY_KEY_CONSTANT');
|
||||
}
|
||||
|
||||
// Push Claims
|
||||
@ -55,6 +58,10 @@ class ApiServiceController extends BaseController
|
||||
{ // Vidal
|
||||
$vidalApiController = new VidalApiController;
|
||||
return $vidalApiController->SubmitClaim($claimId);
|
||||
}else if ($tpaID == $this->fhpl_primary_key)
|
||||
{ // fhpl
|
||||
$fhplApiController = new FhplApiController;
|
||||
return $fhplApiController->SubmitClaim($claimId);
|
||||
}else{
|
||||
log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}");
|
||||
}
|
||||
@ -130,6 +137,12 @@ class ApiServiceController extends BaseController
|
||||
$vidalApiController = new VidalApiController;
|
||||
$data['eCardDownload'] = $vidalApiController->EcardRequest( $emp_code, $policy_no , $employee_policy[0]['tpa_id'] );
|
||||
|
||||
}else if($employee_policy[0]['tpa_primary_id'] == $this->fhpl_primary_key)// Fhpl
|
||||
{
|
||||
|
||||
$fhplApiController = new FhplApiController;
|
||||
$data['eCardDownload'] = $fhplApiController->EcardRequest( $emp_code, $policy_no , $employee_policy[0]['tpa_id'] );
|
||||
|
||||
}else{
|
||||
|
||||
if($type == "download"){
|
||||
@ -266,6 +279,17 @@ class ApiServiceController extends BaseController
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Action Triggered','data' => [] ]);
|
||||
|
||||
}else if ($tpa_id == $this->fhpl_primary_key) // Fhpl
|
||||
{
|
||||
$file_id = $fileModel->insert($data);
|
||||
log_message('error', "Files table inserted successfully, File id : {$file_id}");
|
||||
// $fhplApiController = new FhplApiController;
|
||||
// $fhplApiController->FhplGetBenefDetails( [ 'polict_no' => $policy_no, 'file_id' =>$file_id ] );
|
||||
$r = Jobs::addJob(['job_name' => 'FhplGetBenefDetails', 'payload' => ['policy_no' => $policy_no, 'file_id' => $file_id, 'client_policy_id' => $policy_id, 'return_type' => 'job']]);
|
||||
log_message('error', "FhplGetBenefDetails job pushed successfully.");
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Action Triggered','data' => [] ]);
|
||||
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'code' => 200,'message' => 'TPA not found ','data' => [] ]);
|
||||
}
|
||||
@ -287,12 +311,20 @@ class ApiServiceController extends BaseController
|
||||
if ($tpaID == $this->medi_assist_primary_key) { // MediAssist
|
||||
|
||||
$mediAssistController = new MediAssistApiController();
|
||||
return $mediAssistController->ClaimDetail($claimId);
|
||||
$res = $mediAssistController->ClaimDetail($claimId);
|
||||
return $this->response->setJSON(['status' => $res['status'],'message' => $res['message'] ]);
|
||||
|
||||
}else if ($tpaID == $this->vidal_primary_key) { // vidal
|
||||
|
||||
$vidalApiController = new VidalApiController;
|
||||
return $vidalApiController->ClaimDetail($claimId);
|
||||
$res = $vidalApiController->ClaimDetail($claimId);
|
||||
return $this->response->setJSON(['status' => $res['status'],'message' => $res['message'] ]);
|
||||
|
||||
}else if ($tpaID == $this->fhpl_primary_key) { // Fhpl
|
||||
|
||||
$fhplApiController = new FhplApiController;
|
||||
$res = $fhplApiController->ClaimDetail($claimId);
|
||||
return $this->response->setJSON(['status' => $res['status'],'message' => $res['message'] ]);
|
||||
|
||||
}else{
|
||||
log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}");
|
||||
|
||||
@ -1015,10 +1015,9 @@ class ClientController extends AdminController
|
||||
]
|
||||
],
|
||||
'short_name' => [
|
||||
'rules' => 'required|alpha',
|
||||
'rules' => 'required',
|
||||
'errors' => [
|
||||
'required' => 'Client Short Name is required',
|
||||
'alpha' => 'Client Short Name can only contain alphabets.',
|
||||
]
|
||||
],
|
||||
'pan' => [
|
||||
@ -1810,7 +1809,7 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
if ($insert) {
|
||||
$branchData = $this->clientBranchModel->where('client_id', $sanitized_post_data('client_id'))->findAll();
|
||||
$branchData = $this->clientBranchModel->where('client_id', $sanitized_post_data['client_id'])->findAll();
|
||||
$branchData['role'] = get_role_id();
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
@ -1832,6 +1831,7 @@ class ClientController extends AdminController
|
||||
|
||||
$this->myLogger->logme('error', 'Client branch EDIT function called');
|
||||
$data = $this->request->getPost();
|
||||
|
||||
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
|
||||
$id = $sanitized_post_data['branch_id_primarykey'] ?? null;
|
||||
$client_id = $sanitized_post_data['client_id'] ?? null;
|
||||
@ -1839,7 +1839,7 @@ class ClientController extends AdminController
|
||||
|
||||
$data['pre_branch_id'] = $pre_branch_id;
|
||||
|
||||
$units = $sanitized_post_data['units'] ?? null;
|
||||
$raw_units = $this->request->getPost('units');
|
||||
|
||||
$emp_unit_count = 0;
|
||||
$rr_unit_count = 0;
|
||||
@ -1847,12 +1847,13 @@ class ClientController extends AdminController
|
||||
$total_count = 0;
|
||||
|
||||
$list_of_branch_units = $this->clientBranchModel->find((int)$id);
|
||||
$units = json_decode($list_of_branch_units['units']);
|
||||
$units = !empty($list_of_branch_units['units']) ? json_decode($list_of_branch_units['units'], true) : [];
|
||||
|
||||
if (!is_array($units) || empty($units)) {
|
||||
$client_data = $this->clientModel->where('id', $sanitized_post_data['client_id'])->first();
|
||||
$default_unit = trim(($client_data['short_name'] ?? '') . '-' . ($sanitized_post_data['branch_code'] ?? ''), '-');
|
||||
$sanitized_post_data['units'] = json_encode([$default_unit]);
|
||||
$units = [$default_unit]; // Update local variable for counting
|
||||
}
|
||||
|
||||
if (!empty($units)) {
|
||||
@ -1867,17 +1868,21 @@ class ClientController extends AdminController
|
||||
|
||||
$uncommonValues = [];
|
||||
|
||||
|
||||
if ($total_count > 0) {
|
||||
$units = (string) $sanitized_post_data('units'); // Assuming 'units' is an array
|
||||
|
||||
$post_units_raw = $sanitized_post_data['units'] ?? '[]';
|
||||
|
||||
$list_of_branch_units = $this->clientBranchModel->find((int)$id);
|
||||
$branch_units = json_decode($list_of_branch_units['units'], true);
|
||||
$units = json_decode($units);
|
||||
|
||||
$uncommonValues = array_diff($branch_units, $units);
|
||||
$branch_units = json_decode($list_of_branch_units['units'] ?? '[]', true);
|
||||
|
||||
// Ensure we handle both string-json and array types
|
||||
$incoming_units = is_array($post_units_raw) ? $post_units_raw : json_decode($post_units_raw, true);
|
||||
|
||||
if (is_array($branch_units) && is_array($incoming_units)) {
|
||||
$uncommonValues = array_diff($branch_units, $incoming_units);
|
||||
}
|
||||
|
||||
if (count($uncommonValues) > 0) {
|
||||
|
||||
$branchData = $this->clientBranchModel->where('client_id', $client_id)->findAll();
|
||||
|
||||
return $this->respond([
|
||||
@ -1889,7 +1894,7 @@ class ClientController extends AdminController
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!isset($sanitized_post_data['sez'])) {
|
||||
$sanitized_post_data['sez'] = 0;
|
||||
} elseif ($sanitized_post_data['sez']) {
|
||||
@ -2036,7 +2041,7 @@ class ClientController extends AdminController
|
||||
$this->myLogger->logme('error', 'Client policy CREATE function called');
|
||||
|
||||
$request_post_data = $this->request->getPost();
|
||||
$$sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data);
|
||||
$sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data);
|
||||
|
||||
$policy_type_id = $sanitized_post_data['policy_type_id'] ?? null;
|
||||
$client_branch_id = $sanitized_post_data['client_branch_id'] ?? null;
|
||||
@ -2070,10 +2075,12 @@ class ClientController extends AdminController
|
||||
$sanitized_post_data['earned_premium_date'] = change_date_format($sanitized_post_data['earned_premium_date'] ?? null, 'd-m-Y', 'Y-m-d') ?? null;
|
||||
$sanitized_post_data['claims_incurred_date'] = change_date_format($sanitized_post_data['claims_incurred_date'] ?? null, 'd-m-Y', 'Y-m-d') ?? null;
|
||||
|
||||
$sanitized_post_dataa['base_policy'] = ($sanitized_post_data['base_policy'] === '' || $sanitized_post_data['base_policy'] == 0) ? null : $sanitized_post_data['base_policy'];
|
||||
$sanitized_post_data['policy_status'] = 1;
|
||||
$sanitized_post_data['inception_type'] = $sanitized_post_data['inception_type'] ? 2 : 1;
|
||||
|
||||
$sanitized_post_data['base_policy'] = ($sanitized_post_data['base_policy'] === '' || $sanitized_post_data['base_policy'] == 0) ? null : $sanitized_post_data['base_policy'];
|
||||
$sanitized_post_data['policy_status'] = 1;
|
||||
$sanitized_post_data['inception_type'] = (isset($sanitized_post_data['inception_type']) && $sanitized_post_data['inception_type'] !== "")
|
||||
? $sanitized_post_data['inception_type']
|
||||
: 1;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -2104,7 +2111,7 @@ class ClientController extends AdminController
|
||||
$sanitized_post_data['policy_start_date'] = change_date_format($sanitized_post_data['policy_start_date'] ?? null, 'd-m-Y', 'Y-m-d');
|
||||
$sanitized_post_data['policy_end_date'] = change_date_format($sanitized_post_data['policy_end_date'] ?? null, 'd-m-Y', 'Y-m-d');
|
||||
$sanitized_post_data['policy_no'] = $sanitized_post_data['policy_no'] ?? null;
|
||||
if ($sanitized_post_data['inception_type'] == 2) {
|
||||
if (isset($sanitized_post_data['inception_type']) && $sanitized_post_data['inception_type'] == 2) {
|
||||
$sanitized_post_data['open_date'] = change_date_format($sanitized_post_data['open_date'] ?? null, 'd-m-Y', 'Y-m-d');
|
||||
$sanitized_post_data['close_date'] = change_date_format($sanitized_post_data['close_date'] ?? null, 'd-m-Y', 'Y-m-d');
|
||||
// $data['reminder_date'] = change_date_format($this->request->getPost('reminder_date'), 'd-m-Y', 'Y-m-d');
|
||||
@ -2121,7 +2128,7 @@ class ClientController extends AdminController
|
||||
if ($insert) {
|
||||
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($sanitized_post_data['client_id']);
|
||||
$clientPoliceData['role'] = get_role_id();
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $clientPoliceData, 'client_id' => $client_id, 'method' => 'CERATE', 'post_data' => $insert_data], 200);
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $clientPoliceData, 'client_id' => $client_id, 'method' => 'CERATE', 'post_data' => $insert], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||
}
|
||||
@ -5614,32 +5621,25 @@ class ClientController extends AdminController
|
||||
],
|
||||
|
||||
'type' => [
|
||||
'rules' => 'required|is_natural_no_zero',
|
||||
'rules' => 'required',
|
||||
'errors' => [
|
||||
'required' => 'Vehicle type is required'
|
||||
]
|
||||
],
|
||||
|
||||
'description' => [
|
||||
'rules' => 'required|is_natural_no_zero',
|
||||
'rules' => 'required',
|
||||
'errors' => [
|
||||
'required' => 'Vehicle description is required'
|
||||
]
|
||||
],
|
||||
'owner' => [
|
||||
'rules' => 'required|is_natural_no_zero',
|
||||
'rules' => 'required',
|
||||
'errors' => [
|
||||
'required' => 'Owner is required'
|
||||
]
|
||||
],
|
||||
|
||||
'old_onwer' => [
|
||||
'rules' => 'permit_empty|alpha_space',
|
||||
'errors' => [
|
||||
'alpha_space' => 'Old owner name can contain only letters and spaces'
|
||||
]
|
||||
],
|
||||
|
||||
];
|
||||
if (!$this->validate($rules)) {
|
||||
return $this->response->setStatusCode(400)->setJSON([
|
||||
@ -6693,27 +6693,27 @@ class ClientController extends AdminController
|
||||
|
||||
// ----------EMP DATA SERVICE CONTROLLER--------------------------------------------------------------------------------
|
||||
|
||||
$batch_data = [
|
||||
'client_id' => 51,
|
||||
'client_branch_id' => 40,
|
||||
'client_policy_id' => 63,
|
||||
'insurer_or_tpa' => "insurer",
|
||||
'event_type' => "correction",
|
||||
'actions' => "export",
|
||||
'file_name' => "deletion_enhancement_test_file.xlsx",
|
||||
];
|
||||
|
||||
// $batch_data = [
|
||||
// 'client_id' => 20,
|
||||
// 'client_policy_id' => 77,
|
||||
// 'client_branch_id' => 72,
|
||||
// 'client_id' => 51,
|
||||
// 'client_branch_id' => 40,
|
||||
// 'client_policy_id' => 63,
|
||||
// 'insurer_or_tpa' => "insurer",
|
||||
// // 'insurer_or_tpa' => "tpa",
|
||||
// 'event_type' => "si_enhancement",
|
||||
// 'file_name' => "si_enhancement_test_file.xlsx",
|
||||
// 'event_type' => "correction",
|
||||
// 'actions' => "export",
|
||||
// 'file_name' => "deletion_enhancement_test_file.xlsx",
|
||||
// ];
|
||||
|
||||
$batch_data = [
|
||||
'client_id' => 12,
|
||||
'client_policy_id' => 8063,
|
||||
'client_branch_id' => 1,
|
||||
'insurer_or_tpa' => "insurer",
|
||||
// 'insurer_or_tpa' => "tpa",
|
||||
'event_type' => "inception",
|
||||
'file_name' => "si_enhancement_test_file.xlsx",
|
||||
'actions' => "export",
|
||||
];
|
||||
|
||||
// $batch_data['insurer_or_tpa'] = 'insurer';
|
||||
// $batch_data['insurer_or_tpa'] = 'tpa';
|
||||
|
||||
@ -6768,6 +6768,21 @@ class ClientController extends AdminController
|
||||
// $EmpDataServiceController->cashDepositCalculationForDeletion($array);
|
||||
|
||||
// $result = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($batch_data);
|
||||
// $totals = 0;
|
||||
// foreach ($result as $item) {
|
||||
// $totals = $totals + $item->total;
|
||||
// }
|
||||
|
||||
// clear_cd_balance_session();
|
||||
|
||||
// $data = [
|
||||
// 'cd_balance' => session()->get('cd_balance'),
|
||||
// 'hr_data' => session()->get('hr_data'),
|
||||
// 'cd_balance_info' => session()->get('cd_balance_info'),
|
||||
// get_cd_balance()
|
||||
// ];
|
||||
|
||||
// dd($data);
|
||||
// $result = $this->employeePolicyModel->getCorrectionEmployeesDataForExportExcel($batch_data);
|
||||
// dd(db_connect()->getLastQuery());
|
||||
|
||||
|
||||
@ -33,6 +33,8 @@ use App\Models\LeadsModel;
|
||||
use App\Models\LeadInstallmentPaymentDetails;
|
||||
use App\Models\PolicyTransactionModel;
|
||||
use App\Models\PTCOShareDetailsModel;
|
||||
use App\Models\LevelContactModel;
|
||||
|
||||
|
||||
use App\Controllers\Jobs;
|
||||
use App\Controllers\JobWorker;
|
||||
@ -71,6 +73,8 @@ class EmpDataServiceController extends BaseController
|
||||
protected $leadInstallmentPaymentDetailesModel;
|
||||
protected $policyTransactionModel;
|
||||
protected $PTCOShareDetailsModel;
|
||||
protected $LevelContactModel;
|
||||
|
||||
|
||||
|
||||
public function __construct()
|
||||
@ -99,6 +103,7 @@ class EmpDataServiceController extends BaseController
|
||||
$this->leadInstallmentPaymentDetailesModel = new LeadInstallmentPaymentDetails();
|
||||
$this->policyTransactionModel = new PolicyTransactionModel();
|
||||
$this->PTCOShareDetailsModel = new PTCOShareDetailsModel();
|
||||
$this->LevelContactModel = new LevelContactModel();
|
||||
|
||||
}
|
||||
|
||||
@ -199,23 +204,28 @@ class EmpDataServiceController extends BaseController
|
||||
$totals = $totals + $item->total;
|
||||
}
|
||||
|
||||
$totals = round($totals, 2);
|
||||
$totals = round($totals);
|
||||
|
||||
//check CD amt insufficient only insurer, not tpa // DO NOT REMOVE THIS
|
||||
if($export_data['insurer_or_tpa'] == 'insurer')
|
||||
{
|
||||
if (!empty($cash_balance)) {
|
||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
||||
clear_cd_balance_session();
|
||||
if ((int) $cash_balance['balance'] == (int) $totals) {
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
|
||||
session()->set('cd_balance', false);
|
||||
session()->set('cd_amount', $cash_balance['balance']);
|
||||
session()->set('excel_file_amt', $totals);
|
||||
|
||||
$cd_session_data = json_encode(['cd_balance' => false, 'cd_amount' => $cash_balance['balance'], 'excel_file_amt' => $totals]);
|
||||
session()->set('cd_balance_info', $cd_session_data);
|
||||
session()->set('cd_balance', false);
|
||||
|
||||
$hr_data = $this->getHrdataForInsufficientMailSend($export_data['client_branch_id']);
|
||||
$session_data = json_encode(['client_id' => $export_data['client_id'], 'hr_data' => $hr_data]);
|
||||
session()->set('hr_data', $session_data);
|
||||
|
||||
}else{
|
||||
session()->set('cd_balance', true);
|
||||
session()->set('cd_amount', $cash_balance['balance']);
|
||||
session()->set('excel_file_amt', $totals);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5858,4 +5868,16 @@ class EmpDataServiceController extends BaseController
|
||||
'gst' => round($amount['gst'] ?? 0, 2)
|
||||
];
|
||||
}
|
||||
|
||||
public function getHrdataForInsufficientMailSend($ref_id)
|
||||
{
|
||||
$data = $this->LevelContactModel
|
||||
->select('id, name, email')
|
||||
->where('ref_id', $ref_id)
|
||||
->where('is_active', 1)
|
||||
->where('contact_type', 'client')
|
||||
->findAll();
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\DepositHelper;
|
||||
use App\Helpers\MailHelper;
|
||||
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
@ -29,6 +30,7 @@ use App\Models\AuditHistoryModel;
|
||||
use App\Models\UserModel;
|
||||
use App\Models\PartnerEndorsementRequestModel;
|
||||
use App\Models\TpaApiDataModel;
|
||||
use App\Models\LevelContactModel;
|
||||
|
||||
|
||||
use App\Controllers\Jobs;
|
||||
@ -74,6 +76,7 @@ class EmployeeController extends AdminController
|
||||
protected $auditHistory;
|
||||
protected $userModel;
|
||||
protected $partnerEndorsementRequestModel;
|
||||
protected $LevelContactModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -97,6 +100,7 @@ class EmployeeController extends AdminController
|
||||
$this->auditHistory = new AuditHistoryModel();
|
||||
$this->userModel = new userModel();
|
||||
$this->partnerEndorsementRequestModel = new PartnerEndorsementRequestModel();
|
||||
$this->LevelContactModel = new LevelContactModel();
|
||||
}
|
||||
|
||||
public function list()
|
||||
@ -4528,7 +4532,7 @@ class EmployeeController extends AdminController
|
||||
'details' => $result
|
||||
];
|
||||
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
// 5. Catch network or system exceptions
|
||||
$this->myLogger->logme('error', 'VISIT_OFFBOARD API Exception: ' . $e->getMessage());
|
||||
return [
|
||||
@ -4540,5 +4544,46 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function insufficientCdBalanceHrMailSend()
|
||||
{
|
||||
$post_data = $this->request->getJson(true);
|
||||
|
||||
if(empty($post_data) || (!isset($post_data['mails']) && !empty($post_data['mails'])) || (!isset($post_data['client_id']) && !empty($post_data['client_id']))){
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'No data send mail'], 200);
|
||||
}
|
||||
|
||||
$client_data = $this->clientModel->where('is_active', 1)->where('id', $post_data['client_id'])->first();
|
||||
|
||||
$common['mail_type'] = "insufficient_cd_balance_by_hr";
|
||||
$common['client_id'] = $post_data['client_id'];
|
||||
$subject = 'Insufficient CD Balance Notification';
|
||||
$mail_content = '
|
||||
Dear {{HR_NAME}},
|
||||
|
||||
Greetings from Nhance.
|
||||
|
||||
We would like to inform you that the CD balance for {{CLIENT_NAME}} is currently low / insufficient, which may impact further processing of insurance-related activities.
|
||||
|
||||
Kindly request you to credit the required amount at the earliest to avoid any service disruption.
|
||||
|
||||
Please let us know once the amount is credited, or if you need any clarification from our end.
|
||||
|
||||
Thank you for your support and cooperation.
|
||||
';
|
||||
|
||||
|
||||
foreach ($post_data['mails'] as $hr_id => $hr_data) {
|
||||
|
||||
$mail_content = str_ireplace('{{HR_NAME}}', $hr_data['name'], $mail_content);
|
||||
$mail_content = str_ireplace('{{CLIENT_NAME}}', $client_data['client_name'], $mail_content);
|
||||
|
||||
$res = MailHelper::send_email(['mail' => $hr_data['mail'], 'subject' => $subject, 'message' => $mail_content, 'common' => $common]);
|
||||
}
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Mail send successfully'], 200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -2305,8 +2305,35 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
if($this->request->getGet('policy_status') == 0){
|
||||
$emp_policy_status = 'expired';
|
||||
}else{
|
||||
$emp_policy_status = 'active';
|
||||
}
|
||||
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, client_policy.policy_type_id as policy_type_id, client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type, client_policy.policy_no as policy_no, client_policy.insurer_id as insurer_id, DATE_FORMAT(client_policy.policy_end_date, "%d-%m-%Y") AS policy_expiry_date ')
|
||||
$db = \Config\Database::connect();
|
||||
$emp_policy_status = $db->escape($emp_policy_status);
|
||||
|
||||
$ClientPolicyData = $this->clientPolicyModel
|
||||
->select("
|
||||
client_policy.id as client_policy_id ,
|
||||
client_policy.client_id as client_id,
|
||||
client_policy.policy_type_id as policy_type_id,
|
||||
client_policy.is_addon as is_addon ,
|
||||
client_policy.open_for_enrollment as OpenForEnrollment ,
|
||||
client_policy.inception_type as inception_type,
|
||||
client_policy.policy_no as policy_no,
|
||||
client_policy.insurer_id as insurer_id,
|
||||
DATE_FORMAT(client_policy.policy_start_date, '%d-%m-%Y') AS policy_start_date,
|
||||
DATE_FORMAT(client_policy.policy_end_date, '%d-%m-%Y') AS policy_expiry_date,
|
||||
(
|
||||
select COALESCE(ROUND(SUM(rata_premimum + gst)), 0)
|
||||
from employee_polices
|
||||
where is_active = 1
|
||||
and status = $emp_policy_status
|
||||
and client_policy_id = client_policy.id
|
||||
) as total_premium
|
||||
", false)
|
||||
->where('md5(client_policy.client_id)', $this->request->getGet('client_id'))
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id'))
|
||||
->where('client_policy.is_active', 1)
|
||||
@ -2443,7 +2470,13 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
if ($this->request->is('get')) {
|
||||
|
||||
$data['claim_status'] = $this->claimStatusModel->select('id,ticket_type,claim_status')->where('is_active', 1)->findAll();
|
||||
$data['claim_status'] = $this->claimStatusModel
|
||||
->select('id,ticket_type, display_name as claim_status')
|
||||
->where('is_active', 1)
|
||||
->where('display_name IS NOT NULL OR display_name <> ""')
|
||||
->groupBy('display_name')
|
||||
->findAll();
|
||||
|
||||
$data['ticket_type'] = [
|
||||
["ticket_type" => "1", "type_name" => "Claim-GMC"],
|
||||
["ticket_type" => "2", "type_name" => "Claim-GPA"],
|
||||
@ -2460,10 +2493,12 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
$client_id = isset($search_data['client_id']) ? (int) $search_data['client_id'] : 0;
|
||||
unset($search_data['client_id']);
|
||||
unset($search_data['client_branch_id']);
|
||||
|
||||
$from_date = isset($search_data['from_date']) ? $search_data['from_date'] : null;
|
||||
$to_date = isset($search_data['to_date']) ? $search_data['to_date'] : null;
|
||||
unset($search_data['from_date'], $search_data['to_date']);
|
||||
$claim_status_id = isset($search_data['claim_status_id']) ? $search_data['claim_status_id'] : null;
|
||||
unset($search_data['from_date'], $search_data['to_date'], $search_data['claim_status_id']);
|
||||
|
||||
$where = [];
|
||||
|
||||
@ -2474,6 +2509,11 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
$claim_status_ids = [];
|
||||
if(!empty($claim_status_id)){
|
||||
$claim_status_ids = $this->getTicketClaimStatusIdBasedOnTheDisplayName($claim_status_id);
|
||||
}
|
||||
|
||||
$builder = $db->table('ticket_master tm');
|
||||
$builder->select([
|
||||
'tm.id',
|
||||
@ -2485,6 +2525,12 @@ class EmployeeRestController extends AdminController
|
||||
ELSE UPPER(tcs.display_name)
|
||||
END AS status
|
||||
",
|
||||
"CASE
|
||||
WHEN tm.tpa_claim_type IS NOT NULL OR tm.tpa_claim_type != ''
|
||||
THEN tm.tpa_claim_type
|
||||
ELSE 'Reimbursement'
|
||||
END AS cl_type
|
||||
",
|
||||
'tm.claim_number AS claim_no',
|
||||
'tm.claim_status_id',
|
||||
'tm.is_head_approved',
|
||||
@ -2568,6 +2614,10 @@ class EmployeeRestController extends AdminController
|
||||
$builder->where($where);
|
||||
}
|
||||
|
||||
if (!empty($claim_status_ids)) {
|
||||
$builder->whereIn('claim_status_id', $claim_status_ids);
|
||||
}
|
||||
|
||||
$builder->orderBy('tm.id', 'DESC');
|
||||
|
||||
$data = $builder->get()->getResultArray();
|
||||
@ -5305,6 +5355,20 @@ class EmployeeRestController extends AdminController
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => 'Failed to upload the file'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function getTicketClaimStatusIdBasedOnTheDisplayName($claim_status_id)
|
||||
{
|
||||
$claim_status_data_display_name = $this->claimStatusModel->where('is_active', 1)->where('id', $claim_status_id)->first();
|
||||
$claim_status_data_id = $this->claimStatusModel
|
||||
->select('id')
|
||||
->where('is_active', 1)
|
||||
->where('display_name', $claim_status_data_display_name['display_name'])
|
||||
->findAll();
|
||||
|
||||
$claim_status_data_id = array_column($claim_status_data_id, 'id');
|
||||
return $claim_status_data_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ class FhplApiController extends BaseController
|
||||
]);
|
||||
}
|
||||
|
||||
public function SubmitClaim($claimId = 515)
|
||||
public function SubmitClaim($claimId = null) // 515
|
||||
{
|
||||
helper('api');
|
||||
|
||||
@ -99,7 +99,7 @@ class FhplApiController extends BaseController
|
||||
|
||||
if (count($data) && $data['filePath'] == null) {
|
||||
log_message('error', "TPA CLAIM PUSH FAILED FHPL | claimId: '.$claimId.' - Claim or File Missing");
|
||||
return $this->response->setJSON(['status' => false,'message' => 'Claim or File Missing', ]);
|
||||
return;
|
||||
}
|
||||
|
||||
// Build absolute file path
|
||||
@ -108,7 +108,7 @@ class FhplApiController extends BaseController
|
||||
|
||||
if (!file_exists($pdfPath)) {
|
||||
log_message('error', "TPA CLAIM PUSH FAILED FHPL | claimId: '.$claimId.' - PDF not found on server");
|
||||
return $this->response->setJSON(['status' => false,'message' => 'PDF not found on server']);
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert PDF to Base64
|
||||
@ -117,7 +117,8 @@ class FhplApiController extends BaseController
|
||||
// Generate FHPL Token
|
||||
$tokenResponse = json_decode($this->generateAuthToken()->getBody(), true);
|
||||
if (empty($tokenResponse['data']['access_token'])) {
|
||||
return $this->response->setJSON(['status' => false,'message' => 'FHPL Token generation failed']);
|
||||
log_message('error', "TPA CLAIM PUSH FAILED FHPL | claimId: '.$claimId.' - FHPL Token generation failed");
|
||||
return;
|
||||
}
|
||||
$token = $tokenResponse['data']['access_token'];
|
||||
|
||||
@ -125,10 +126,10 @@ class FhplApiController extends BaseController
|
||||
$body = [
|
||||
"IssueID" => $data['dependentUniqueId'], // this key added after seeing the error in responce have to click with fhpl team
|
||||
"Userid" => getenv('FHPL_USER_NAME'),
|
||||
"PolicyNo" => "111700-TATAMTORS", // $data['policyNo'],
|
||||
"UhidNo" => "OIC40830846", //$data['dependentUniqueId'],
|
||||
"PolicyNo" => $data['policyNo'], // "111700-TATAMTORS",
|
||||
"UhidNo" => $data['dependentUniqueId'], // "OIC40830846",
|
||||
"ClaimID" => (string) $data['id'],
|
||||
"DOA" => "2025-10-11",//date('Y-m-d', strtotime($data['admissionDate'])),
|
||||
"DOA" => date('Y-m-d', strtotime($data['admissionDate'])), //"2025-10-11",
|
||||
"DateofDischarge"=> $data['dischargeDate'] ? date('Y-m-d', strtotime($data['dischargeDate'])) : null,
|
||||
"ClaimedAmount" => (float) $data['requestedAmount'],
|
||||
"DocumentType" => 20, // Fresh Claim
|
||||
@ -155,7 +156,7 @@ class FhplApiController extends BaseController
|
||||
|
||||
$response = call_third_party_api($url, 'POST', $headers, $body);
|
||||
|
||||
log_message('error', 'FHPL RESPONSE | ' . json_encode($response));
|
||||
log_message('error', 'TPA CLAIM PUSH FHPL RESPONSE | ' . json_encode($response));
|
||||
|
||||
if($response['status'] != true){
|
||||
log_message('error', 'TPA CLAIM PUSH FAILED FHPL | claimId: '.$claimId.' | response: '.json_encode($response));
|
||||
@ -185,14 +186,17 @@ class FhplApiController extends BaseController
|
||||
|
||||
log_message('error', 'TPA CLAIM PUSH SUCCESS FHPL | claimId: '.$claimId.' | claimNO: '.$fhplClaimNo);
|
||||
|
||||
}else {
|
||||
log_message('error', 'TPA CLAIM PUSH API SUCCESS BUT claimsInfo EMPTY | response: '.json_encode($response));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
return;
|
||||
// return $this->response->setJSON($response);
|
||||
}
|
||||
|
||||
public function ClaimDetail($claimId = 515)
|
||||
public function ClaimDetail($claimId = null) //515
|
||||
{
|
||||
helper('api');
|
||||
|
||||
@ -203,13 +207,13 @@ class FhplApiController extends BaseController
|
||||
->get()->getRowArray();
|
||||
|
||||
|
||||
if(!$ticket) return $this->response->setJSON(['status'=>false,'message'=>'Invalid claim']);
|
||||
if(!$ticket) return ['status'=>false,'message'=>'Invalid claim'];
|
||||
|
||||
// Generate FHPL Token
|
||||
$tokenResponse = json_decode($this->generateAuthToken()->getBody(), true);
|
||||
|
||||
if (empty($tokenResponse['data']['access_token'])) {
|
||||
return $this->response->setJSON(['status' => false,'message' => 'FHPL Token generation failed']);
|
||||
return ['status' => false,'message' => 'FHPL Token generation failed'];
|
||||
}
|
||||
|
||||
$token = $tokenResponse['data']['access_token'];
|
||||
@ -219,9 +223,9 @@ class FhplApiController extends BaseController
|
||||
$body = [
|
||||
"UserName" => getenv('FHPL_USER_NAME'),
|
||||
"Password" => getenv('FHPL_PASSWORD'),
|
||||
"PolicyNumber" => "GHI-81-25-00087313-000",//$ticket['policy_no'],
|
||||
"Fromdate" => "2025-04-26",//$ticket['claimNo'],
|
||||
"Todate" => "2025-04-27",//$ticket['claimNo'],
|
||||
"PolicyNumber" => $ticket['policy_no'], //"GHI-81-25-00087313-000",
|
||||
"Fromdate" => $ticket['policy_start_date'],//"2025-04-26",
|
||||
"Todate" => $ticket['policy_end_date'],//"2025-04-27",
|
||||
];
|
||||
|
||||
$headers = ["Authorization: Bearer ".$token,"Content-Type: application/json"];
|
||||
@ -232,12 +236,7 @@ class FhplApiController extends BaseController
|
||||
|
||||
if (empty($response['data'][0])) {
|
||||
log_message('error', 'CLAIM STATUS FAILED | for ticket ID: ' . $claimId.' | response: '.json_encode($response));
|
||||
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'API call failed.',
|
||||
'data' => $response
|
||||
]);
|
||||
return ['status' => false,'message' => 'API call failed.','data' => $response ];
|
||||
}
|
||||
|
||||
|
||||
@ -263,18 +262,11 @@ class FhplApiController extends BaseController
|
||||
if( $status != null && isset($map[$status]))
|
||||
{
|
||||
$this->db->table('ticket_master')->where('id',$claimId)->update(['claim_status_id'=>$map[$status],'tpa_claim_status'=>$status]);
|
||||
// LOG UPDATE
|
||||
log_message('error', "CLAIM STATUS SUCCESS | Updated ticket ID $claimId with claim status: $status");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $this->response->setJSON([
|
||||
'status' => true,
|
||||
'message' => 'Claim status updated.',
|
||||
'updated_status' => $status,
|
||||
'api_response' => $response
|
||||
]);
|
||||
return ['status' => true,'message' => 'Claim status updated.','updated_status' => $status,'api_response' => $response];
|
||||
|
||||
}
|
||||
|
||||
@ -298,24 +290,16 @@ class FhplApiController extends BaseController
|
||||
return $this->response->setJSON(['status'=>true,'updated'=>$count]);
|
||||
}
|
||||
|
||||
public function EcardRequest($employeeId,$policyNo,$uhid)
|
||||
public function EcardRequest($employeeId = null,$policyNo = null,$uhid = null)
|
||||
{
|
||||
helper('api');
|
||||
|
||||
// Generate FHPL Token
|
||||
$tokenResponse = json_decode($this->generateAuthToken()->getBody(), true);
|
||||
|
||||
if (empty($tokenResponse['data']['access_token'])) {
|
||||
return $this->response->setJSON(['status' => false,'message' => 'FHPL Token generation failed']);
|
||||
log_message('error', 'Ecard Request FAILED | employeeId: '.$employeeId.' | policyNo: '.$policyNo.' | Message: FHPL Token generation failed');
|
||||
return null;
|
||||
}
|
||||
|
||||
// Generate FHPL Token
|
||||
$tokenResponse = json_decode($this->generateAuthToken()->getBody(), true);
|
||||
|
||||
if (empty($tokenResponse['data']['access_token'])) {
|
||||
return $this->response->setJSON(['status' => false,'message' => 'FHPL Token generation failed']);
|
||||
}
|
||||
|
||||
$token = $tokenResponse['data']['access_token'];
|
||||
|
||||
$url = getenv('FHPL_BASE_URL')."/api/GetEcard";
|
||||
@ -323,107 +307,402 @@ class FhplApiController extends BaseController
|
||||
$body = [
|
||||
"UserName" => getenv('FHPL_USER_NAME'),
|
||||
"Password" => getenv('FHPL_PASSWORD'),
|
||||
"PolicyNumber" => $policyNo,
|
||||
"EmployeeID" => $employeeId
|
||||
"PolicyNumber" => $policyNo, //'10/12/2025/16/17',
|
||||
"EmployeeID" => $employeeId, //'101225',
|
||||
];
|
||||
|
||||
$headers = ["Authorization: Bearer ".$token,"Content-Type: application/json"];
|
||||
|
||||
$response = call_third_party_api($url,'POST',$headers,$body);
|
||||
// dd($response);
|
||||
|
||||
if(($response['data']['STATUS'] ?? '')=='SUCCESS'){
|
||||
return $response['data']['E_Card'];
|
||||
if (($response['status'] ?? false) !== true) {
|
||||
log_message('error', 'Ecard Request FAILED | response: ' . json_encode($response));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (empty($response['data'][0])) {
|
||||
log_message('error', 'Ecard Request FAILED | Empty data | response: ' . json_encode($response));
|
||||
return null;
|
||||
}
|
||||
|
||||
$apiData = $response['data'][0];
|
||||
|
||||
if (($apiData['STATUS'] ?? '') === 'SUCCESS') {
|
||||
|
||||
$ecardUrl = $apiData['E_Card'] ?? '';
|
||||
|
||||
if (!empty($ecardUrl)) {
|
||||
log_message(
|
||||
'info',
|
||||
'Ecard Request PUSH SUCCESS | employeeId: ' . $employeeId .
|
||||
' | policyNo: ' . $policyNo .
|
||||
' | ecardUrl: ' . $ecardUrl
|
||||
);
|
||||
return $ecardUrl;
|
||||
}
|
||||
}
|
||||
|
||||
log_message('error', 'Ecard Request FAILED | response: ' . json_encode($response));
|
||||
return null;
|
||||
}
|
||||
|
||||
public function FhplGetBenefDetails($requestData = null)
|
||||
{
|
||||
helper('api');
|
||||
|
||||
$policyNo = $requestData['policy_no'] ?? "10/12/2025/16/17";
|
||||
$client_policy_id = $requestData['client_policy_id'] ?? 0;
|
||||
$function_calling_type = $requestData['return_type'] ?? 'job';
|
||||
|
||||
// Generate FHPL Token
|
||||
$tokenResponse = json_decode($this->generateAuthToken()->getBody(), true);
|
||||
if (empty($tokenResponse['data']['access_token'])) {
|
||||
return $this->response->setJSON(['status' => false,'message' => 'FHPL Token generation failed']);
|
||||
}
|
||||
$token = $tokenResponse['data']['access_token'];
|
||||
try {
|
||||
|
||||
helper('api');
|
||||
|
||||
$url = getenv('FHPL_BASE_URL')."/api/GetEnrollmentDetailsPolicy";
|
||||
$policyNo = $requestData['policy_no'] ?? null;
|
||||
$client_policy_id = $requestData['client_policy_id'] ?? null;
|
||||
|
||||
$headers = [
|
||||
"Authorization: Bearer ".$token,
|
||||
"Content-Type: application/json"
|
||||
];
|
||||
|
||||
$startIndex = 0;
|
||||
$range = 100;
|
||||
$allMembers = [];
|
||||
|
||||
do {
|
||||
$body = [
|
||||
"UserName" => getenv('FHPL_USER_NAME'),
|
||||
"Password" => getenv('FHPL_PASSWORD'),
|
||||
"PolicyNumber" => $policyNo,
|
||||
"StartIndex" => $startIndex,
|
||||
"Range" => $range
|
||||
];
|
||||
|
||||
$response = call_third_party_api($url,'POST',$headers,$body);
|
||||
|
||||
dd($response);
|
||||
|
||||
if(empty($response['data']['Members'])){
|
||||
break;
|
||||
}
|
||||
|
||||
$allMembers = array_merge($allMembers,$response['data']['Members']);
|
||||
|
||||
$startIndex += $range;
|
||||
|
||||
} while($startIndex < ($response['data']['Total'] ?? 0));
|
||||
|
||||
|
||||
dd($allMembers);
|
||||
|
||||
// Now same matching logic you already have
|
||||
$employeePolicyModel = new EmployeePolicyModel();
|
||||
|
||||
$employeePolicyData = $employeePolicyModel
|
||||
->join('employees','employees.id=employee_polices.employee_id')
|
||||
->where('employee_polices.client_policy_id',$client_policy_id)
|
||||
->where('employee_polices.tpa_id IS NULL')
|
||||
->findAll();
|
||||
|
||||
$updated = 0;
|
||||
|
||||
foreach($employeePolicyData as $policy){
|
||||
foreach($allMembers as $m){
|
||||
|
||||
if(
|
||||
strtolower(trim($policy['name']))==strtolower(trim($m['Name'])) &&
|
||||
$policy['emp_code']==$m['MemberID'] &&
|
||||
strtolower($policy['relationship'])==strtolower($m['Relation'])
|
||||
){
|
||||
$this->db->table('employee_polices')
|
||||
->where('id',$policy['emp_policy_id'])
|
||||
->update(['tpa_id'=>$m['UHID']]);
|
||||
|
||||
$updated++;
|
||||
if (empty($policyNo)) {
|
||||
log_message('error', 'TPA ID PULL | policy_no missing in request');
|
||||
if($function_calling_type == "job"){
|
||||
return ['status' => false, 'message' => 'policy_no required'];
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'message' => 'policy_no required']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'status'=>true,
|
||||
'total_fetched'=>count($allMembers),
|
||||
'updated'=>$updated
|
||||
];
|
||||
if (empty($client_policy_id)) {
|
||||
log_message('error', 'TPA ID PULL | 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', "TPA ID PULL | called for policy_no: {$policyNo} , client_policy_id: {$client_policy_id}");
|
||||
|
||||
// Fetch file download dates
|
||||
$batchFiles = $this->db->table('batch_files f')
|
||||
->select("f.created_at")
|
||||
->where('f.client_policy_id', $client_policy_id)
|
||||
->where('f.insurer_or_tpa', 'tpa')
|
||||
->where('f.actions', 'export')
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
if (empty($batchFiles)) {
|
||||
log_message('error', 'TPA ID PULL FAILED | batchFiles is empty for this tpa id pull request');
|
||||
if($function_calling_type == "job"){
|
||||
return ['status' => false, 'message' => 'batchFiles not found'];
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'message' => 'batchFiles not found']);
|
||||
}
|
||||
}
|
||||
|
||||
// Generate FHPL Token
|
||||
$tokenResponse = json_decode($this->generateAuthToken()->getBody(), true);
|
||||
if (empty($tokenResponse['data']['access_token'])) {
|
||||
log_message('error', 'TPA ID PULL | FHPL Token generation failed');
|
||||
if($function_calling_type == "job"){
|
||||
return ['status' => false, 'message' => 'FHPL Token generation failed'];
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'message' => 'FHPL Token generation failed']);
|
||||
}
|
||||
}
|
||||
$token = $tokenResponse['data']['access_token'];
|
||||
|
||||
$url = getenv('FHPL_BASE_URL') . "/api/GetEnrollmentDetailsPolicy";
|
||||
|
||||
$headers = [
|
||||
"Authorization: Bearer " . $token,
|
||||
"Content-Type: application/json"
|
||||
];
|
||||
|
||||
$startIndex = 0;
|
||||
$range = 100;
|
||||
$allMembers = [];
|
||||
|
||||
while (true) {
|
||||
|
||||
$body = [
|
||||
"UserName" => getenv('FHPL_USER_NAME'),
|
||||
"Password" => getenv('FHPL_PASSWORD'),
|
||||
"PolicyNumber" => $policyNo,
|
||||
"StartIndex" => $startIndex,
|
||||
"Range" => $range
|
||||
];
|
||||
|
||||
log_message('error', "TPA ID PULL | API parems " . json_encode([$url, 'POST', $headers, $body]));
|
||||
|
||||
$response = call_third_party_api($url, 'POST', $headers, $body);
|
||||
|
||||
if (($response['status'] ?? false) !== true) {
|
||||
log_message('error', 'FHPL API FAILED | response: ' . json_encode($response));
|
||||
break;
|
||||
}
|
||||
|
||||
if (
|
||||
!isset($response['data']) ||
|
||||
!is_array($response['data']) ||
|
||||
count($response['data']) === 0 ||
|
||||
!array_is_list($response['data']) // PHP 8+ safe check
|
||||
) {
|
||||
// STOP when data is not a valid list
|
||||
break;
|
||||
}
|
||||
|
||||
$allMembers = array_merge($allMembers, $response['data']);
|
||||
|
||||
// Move to next page
|
||||
$startIndex += $range;
|
||||
}
|
||||
|
||||
if(empty($allMembers))
|
||||
{
|
||||
|
||||
// update file table status after the tpa id failed to update
|
||||
if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
|
||||
$file_model = new BatchFileModel();
|
||||
$file_model->where('id', $requestData['file_id'])->set('status', 'failed-8')->update();
|
||||
log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
|
||||
} else {
|
||||
log_message('error', "Failed to update file table status.");
|
||||
}
|
||||
|
||||
log_message('error', 'TPA ID PULL API FAILED | API failed: Empty menber data for this pull request');
|
||||
|
||||
if($function_calling_type == "job"){
|
||||
return ['status' => false, 'message' => 'API call failed', 'data' => 'Empty menber data for this pull request'];
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'message' => 'API call failed', 'data' => 'Empty menber data for this pull request']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// dd($allMembers);
|
||||
|
||||
//save API data as JSON for analysis
|
||||
$json = json_encode($allMembers, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||
// $filename = time() . '.json';
|
||||
$filePath = WRITEPATH . 'tmp/'.time().'_'.$requestData['file_id'].'.json';
|
||||
file_put_contents($filePath, $json);
|
||||
|
||||
//call a job for dump JSON data to DB
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'saveFhplAPIData', 'payload' => [ 'file_id' => $requestData['file_id'],'json_file_path' => $filePath ]]);
|
||||
|
||||
// ================= MATCHING LOGIC =================
|
||||
|
||||
$employeePolicyModel = new EmployeePolicyModel();
|
||||
|
||||
$employeePolicyData = $employeePolicyModel
|
||||
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
->where('employee_polices.tpa_id IS NULL')
|
||||
->findAll();
|
||||
|
||||
$updated = 0;
|
||||
|
||||
foreach ($employeePolicyData as $policy) {
|
||||
$hasMatchForThisPolicy = false;
|
||||
foreach ($allMembers as $m) {
|
||||
|
||||
if (
|
||||
strtolower(trim($policy['name'])) === strtolower(trim($m['EMPLOYEE_NAME'] ?? '')) &&
|
||||
($policy['emp_code'] ?? '') == ($m['EMPLOYEE_ID'] ?? '') &&
|
||||
strtolower($policy['relationship']) === strtolower($m['RELATION'] ?? '')
|
||||
) {
|
||||
|
||||
$hasMatchForThisPolicy = true;
|
||||
|
||||
|
||||
$sql = "UPDATE employee_polices SET tpa_id = ? WHERE id = ?";
|
||||
$this->db->query($sql, [$m['TPA_TPADETAIL_ID'], $policy['emp_policy_id']]);
|
||||
|
||||
// for e-card send
|
||||
if(strtolower(trim($policy['relationship'])) == 'self'){
|
||||
$employee_policy_ids[] = $policy['emp_policy_id'];
|
||||
}
|
||||
|
||||
if ($this->db->affectedRows() > 0) {
|
||||
$updated++;
|
||||
log_message('error', "✅ Updated tpa_id={$m['TPA_TPADETAIL_ID']} for emp_policy_id={$policy['emp_policy_id']} policy={$policyNo}");
|
||||
} else {
|
||||
log_message('error', "⚠️ No update (already set or not matched) for emp_policy_id={$policy['emp_policy_id']} policy={$policyNo}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle NO MATCH for this policy
|
||||
if (!$hasMatchForThisPolicy) {
|
||||
|
||||
$nhanceSideData = [
|
||||
'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,
|
||||
];
|
||||
$batch_file_success = 'partially success';
|
||||
|
||||
log_message(
|
||||
'error',
|
||||
"❌ No match for Nhance = " . json_encode($nhanceSideData)
|
||||
);
|
||||
}
|
||||
|
||||
// send e-card
|
||||
if(!empty($employee_policy_ids)){
|
||||
log_message('error', "sendMailForDownloadingECard JOB PUSHED.");
|
||||
Jobs::addJob(['job_name' => 'sendMailForDownloadingECard', 'payload' => ['ids' => $employee_policy_ids, 'client_policy_id' => $client_policy_id]]);
|
||||
}
|
||||
|
||||
// update file table status after the tpa id successfully updated
|
||||
if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
|
||||
$file_model = new BatchFileModel();
|
||||
|
||||
$file_model->where('id', $requestData['file_id'])->set('status', $batch_file_success)->update();
|
||||
log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
|
||||
} else {
|
||||
log_message('error', "Failed to update file table status.");
|
||||
}
|
||||
|
||||
$totalCount = count($allMembers);
|
||||
|
||||
log_message('error', "TPA ID PULL SUCCESS | completed. Total fetched={$totalCount}, updated={$updated}");
|
||||
|
||||
if($function_calling_type == "job"){
|
||||
return [
|
||||
'status' => true,
|
||||
'message' => 'Updated successfully',
|
||||
'total_fetched' => $totalCount,
|
||||
'total_updated' => $updated
|
||||
];
|
||||
}else{
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'message' => 'Updated successfully',
|
||||
'total_fetched' => $totalCount,
|
||||
'total_updated' => $updated
|
||||
]);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
|
||||
// update file table status after the tpa id failed to update
|
||||
if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
|
||||
$file_model = new BatchFileModel();
|
||||
$file_model->where('id', $requestData['file_id'])->set('status', 'failed-8')->update();
|
||||
log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
|
||||
} else {
|
||||
log_message('error', "Failed to update file table status.");
|
||||
}
|
||||
|
||||
$errorData = [
|
||||
'message' => $th->getMessage(),
|
||||
'file' => $th->getFile(),
|
||||
'line' => $th->getLine(),
|
||||
'code' => $th->getCode(),
|
||||
'trace' => $th->getTraceAsString(),
|
||||
'trace_array' => $th->getTrace(), // full array version (optional)
|
||||
'function' => $th->getTrace()[0]['function'] ?? null,
|
||||
'class' => $th->getTrace()[0]['class'] ?? null,
|
||||
];
|
||||
|
||||
log_message('error', 'Exception thrown while calling GetBenefDetails API: ' . json_encode($errorData));
|
||||
if($function_calling_type == "job"){
|
||||
return ['status' => false, 'message' => 'API call failed', 'data' => $errorData];
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'message' => 'API call failed', 'data' => $errorData]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// public function FhplGetBenefDetails($requestData = null)
|
||||
// {
|
||||
// helper('api');
|
||||
|
||||
// $policyNo = $requestData['policy_no'] ?? "10/12/2025/16/17";
|
||||
// $client_policy_id = $requestData['client_policy_id'] ?? 0;
|
||||
|
||||
// // Generate FHPL Token
|
||||
// $tokenResponse = json_decode($this->generateAuthToken()->getBody(), true);
|
||||
// if (empty($tokenResponse['data']['access_token'])) {
|
||||
// return $this->response->setJSON(['status' => false,'message' => 'FHPL Token generation failed']);
|
||||
// }
|
||||
// $token = $tokenResponse['data']['access_token'];
|
||||
|
||||
// $url = getenv('FHPL_BASE_URL')."/api/GetEnrollmentDetailsPolicy";
|
||||
|
||||
// $headers = [
|
||||
// "Authorization: Bearer ".$token,
|
||||
// "Content-Type: application/json"
|
||||
// ];
|
||||
|
||||
// $startIndex = 0;
|
||||
// $range = 100;
|
||||
// $allMembers = [];
|
||||
|
||||
// do {
|
||||
// $body = [
|
||||
// "UserName" => getenv('FHPL_USER_NAME'),
|
||||
// "Password" => getenv('FHPL_PASSWORD'),
|
||||
// "PolicyNumber" => $policyNo,
|
||||
// "StartIndex" => $startIndex,
|
||||
// "Range" => $range
|
||||
// ];
|
||||
|
||||
// $response = call_third_party_api($url,'POST',$headers,$body);
|
||||
|
||||
// dd($response);
|
||||
|
||||
// if(empty($response['data']['Members'])){
|
||||
// break;
|
||||
// }
|
||||
|
||||
// $allMembers = array_merge($allMembers,$response['data']['Members']);
|
||||
|
||||
// $startIndex += $range;
|
||||
|
||||
// } while($startIndex < ($response['data']['Total'] ?? 0));
|
||||
|
||||
|
||||
// dd($allMembers);
|
||||
|
||||
// // Now same matching logic you already have
|
||||
// $employeePolicyModel = new EmployeePolicyModel();
|
||||
|
||||
// $employeePolicyData = $employeePolicyModel
|
||||
// ->join('employees','employees.id=employee_polices.employee_id')
|
||||
// ->where('employee_polices.client_policy_id',$client_policy_id)
|
||||
// ->where('employee_polices.tpa_id IS NULL')
|
||||
// ->findAll();
|
||||
|
||||
// $updated = 0;
|
||||
|
||||
// foreach($employeePolicyData as $policy){
|
||||
// foreach($allMembers as $m){
|
||||
|
||||
// if(
|
||||
// strtolower(trim($policy['name']))==strtolower(trim($m['Name'])) &&
|
||||
// $policy['emp_code']==$m['MemberID'] &&
|
||||
// strtolower($policy['relationship'])==strtolower($m['Relation'])
|
||||
// ){
|
||||
// $this->db->table('employee_polices')
|
||||
// ->where('id',$policy['emp_policy_id'])
|
||||
// ->update(['tpa_id'=>$m['UHID']]);
|
||||
|
||||
// $updated++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// return [
|
||||
// 'status'=>true,
|
||||
// 'total_fetched'=>count($allMembers),
|
||||
// 'updated'=>$updated
|
||||
// ];
|
||||
// }
|
||||
|
||||
public function syncFhplClaimsToNhance()
|
||||
{
|
||||
helper('api');
|
||||
|
||||
@ -191,6 +191,10 @@ class JobWorker extends AdminController
|
||||
'type' => 'CC', // Handler Category
|
||||
'handler' => 'App\Controllers\VidalApiController',
|
||||
],
|
||||
'FhplGetBenefDetails' => [
|
||||
'type' => 'CC', // Handler Category
|
||||
'handler' => 'App\Controllers\FhplApiController',
|
||||
],
|
||||
'bdsDumpExcelFileFormatValidation' => [
|
||||
'type' => 'CC', // Handler Category
|
||||
'handler' => 'App\Controllers\PolicyTransactionController',
|
||||
|
||||
@ -437,7 +437,7 @@ class LeadsController extends BaseController
|
||||
];
|
||||
$request_data = $this->request->getPost();
|
||||
$data = sanitizeInputArrayAdvanced($request_data);
|
||||
if($data['lead_form_type'] == 2){
|
||||
if (isset($data['lead_form_type']) && (int)$data['lead_form_type'] === 2) {
|
||||
$rules['client_type'] = [
|
||||
'rules' => 'required',
|
||||
'errors' => ['required' => 'Client Type is required']
|
||||
|
||||
@ -62,7 +62,7 @@ class LoginController extends BaseController
|
||||
set_session_data($session_data);
|
||||
|
||||
// Bind session to device
|
||||
set_session_data(['fingerprint' => generateFingerprint()]);
|
||||
// set_session_data(['fingerprint' => generateFingerprint()]);
|
||||
|
||||
log_message('error', 'Set The UserId : `'. $user->id .'` in Session');
|
||||
log_message('error', 'User Login Sucessfully');
|
||||
|
||||
@ -449,7 +449,7 @@ class MasterController extends AdminController
|
||||
$insert = $this->insurerBranchModel->insert($sanitized_post_data);
|
||||
|
||||
if($insert){
|
||||
for ($i = 0; $i < count($sanitized_post_data('name')); $i++) {
|
||||
for ($i = 0; $i < count($sanitized_post_data['name']); $i++) {
|
||||
// Prepare data to insert
|
||||
$sanitized_post_data_for_level = [
|
||||
'contact_type' => 'insurer',
|
||||
@ -465,7 +465,7 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
if($insert){
|
||||
$branchData = $this->insurerBranchModel->where('insurer_id', $sanitized_post_data_for_level['insurer_id'])->findAll();
|
||||
$branchData = $this->insurerBranchModel->where('insurer_id', $sanitized_post_data['insurer_id'])->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $branchData));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
@ -2168,72 +2168,74 @@ class MasterController extends AdminController
|
||||
public function createCDMasterData()
|
||||
{
|
||||
$this->myLogger->logme("error", 'Create CD Master Data API called.');
|
||||
$rules = [
|
||||
|
||||
// ======================
|
||||
// Client / Insurer Mapping
|
||||
// ======================
|
||||
'client_id' => [
|
||||
'rules' => 'required|is_natural_no_zero',
|
||||
'errors' => [
|
||||
'required' => 'Client is required'
|
||||
]
|
||||
],
|
||||
|
||||
'insurer_id' => [
|
||||
'rules' => 'required|is_natural_no_zero',
|
||||
'errors' => [
|
||||
'required' => 'Insurer is required'
|
||||
]
|
||||
],
|
||||
|
||||
'insurer_branch_id' => [
|
||||
'rules' => 'required|is_natural_no_zero',
|
||||
'errors' => [
|
||||
'required' => 'Insurer branch is required'
|
||||
]
|
||||
],
|
||||
|
||||
// ======================
|
||||
// CD Account Details
|
||||
// ======================
|
||||
'opening_date' => [
|
||||
'rules' => 'required|valid_date[d-m-Y]',
|
||||
'errors' => [
|
||||
'required' => 'Opening date is required',
|
||||
'valid_date' => 'Opening date must be in DD-MM-YYYY format'
|
||||
]
|
||||
],
|
||||
|
||||
'cd_ac_no' => [
|
||||
'rules' => 'required|trim',
|
||||
'errors' => [
|
||||
'required' => 'CD account number is required'
|
||||
]
|
||||
],
|
||||
|
||||
'opening_bal' => [
|
||||
'rules' => 'required|numeric|greater_than_equal_to[0]',
|
||||
'errors' => [
|
||||
'required' => 'Opening amount is required',
|
||||
'numeric' => 'Opening amount must be numeric',
|
||||
'greater_than_equal_to' => 'Opening amount cannot be negative'
|
||||
]
|
||||
],
|
||||
];
|
||||
if (!$this->validate($rules)) {
|
||||
return $this->response->setStatusCode(400)->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'Input validation failed',
|
||||
'code' => 400,
|
||||
'errors' => $this->validator->getErrors()
|
||||
]);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
|
||||
$id = $sanitized_post_data['PrimaryKey'] ?? null;
|
||||
if($id === null){
|
||||
$rules = [
|
||||
|
||||
// ======================
|
||||
// Client / Insurer Mapping
|
||||
// ======================
|
||||
'client_id' => [
|
||||
'rules' => 'required|is_natural_no_zero',
|
||||
'errors' => [
|
||||
'required' => 'Client is required'
|
||||
]
|
||||
],
|
||||
|
||||
'insurer_id' => [
|
||||
'rules' => 'required|is_natural_no_zero',
|
||||
'errors' => [
|
||||
'required' => 'Insurer is required'
|
||||
]
|
||||
],
|
||||
|
||||
'insurer_branch_id' => [
|
||||
'rules' => 'required|is_natural_no_zero',
|
||||
'errors' => [
|
||||
'required' => 'Insurer branch is required'
|
||||
]
|
||||
],
|
||||
|
||||
// ======================
|
||||
// CD Account Details
|
||||
// ======================
|
||||
'opening_date' => [
|
||||
'rules' => 'required|valid_date[d-m-Y]',
|
||||
'errors' => [
|
||||
'required' => 'Opening date is required',
|
||||
'valid_date' => 'Opening date must be in DD-MM-YYYY format'
|
||||
]
|
||||
],
|
||||
|
||||
'cd_ac_no' => [
|
||||
'rules' => 'required|trim',
|
||||
'errors' => [
|
||||
'required' => 'CD account number is required'
|
||||
]
|
||||
],
|
||||
|
||||
'opening_bal' => [
|
||||
'rules' => 'required|numeric|greater_than_equal_to[0]',
|
||||
'errors' => [
|
||||
'required' => 'Opening amount is required',
|
||||
'numeric' => 'Opening amount must be numeric',
|
||||
'greater_than_equal_to' => 'Opening amount cannot be negative'
|
||||
]
|
||||
],
|
||||
];
|
||||
if (!$this->validate($rules)) {
|
||||
return $this->response->setStatusCode(400)->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'Input validation failed',
|
||||
'code' => 400,
|
||||
'errors' => $this->validator->getErrors()
|
||||
]);
|
||||
}
|
||||
}
|
||||
$this->myLogger->logme("error", 'Received POST data: ' . json_encode($data));
|
||||
|
||||
$id = $sanitized_post_data['PrimaryKey'] ?? null;
|
||||
$date = (string) ($sanitized_post_data['opening_date'] ?? '');
|
||||
$sanitized_post_data['opening_date'] = date('Y-m-d', strtotime($date));
|
||||
$this->myLogger->logme("error", 'Formatted opening_date: ' . $data['opening_date']);
|
||||
|
||||
@ -518,7 +518,7 @@ class MediAssistApiController extends BaseController
|
||||
->getRowArray();
|
||||
|
||||
if (!$ticket) {
|
||||
return $this->response->setJSON(['status' => false,'message' => 'Invalid Claim ID' ]);
|
||||
return ['status' => false,'message' => 'Invalid Claim ID' ];
|
||||
}
|
||||
|
||||
// REQUEST BODY
|
||||
@ -548,8 +548,6 @@ class MediAssistApiController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// $body = [
|
||||
// "policyNo" => "97000063250400000031",
|
||||
// "startDate" => "01/11/2025",
|
||||
@ -568,11 +566,7 @@ class MediAssistApiController extends BaseController
|
||||
if ($response['status'] != true || empty($response['data']['claimsData'][0])) {
|
||||
log_message('error', 'CLAIM STATUS FAILED | for ticket ID: ' . $claimId.' | response: '.json_encode($response));
|
||||
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'API call failed.',
|
||||
'data' => $response
|
||||
]);
|
||||
return ['status' => false,'message' => 'API call failed.','data' => $response ];
|
||||
}
|
||||
|
||||
// Extract claim status
|
||||
@ -634,12 +628,7 @@ class MediAssistApiController extends BaseController
|
||||
// LOG UPDATE
|
||||
log_message('error', "CLAIM STATUS SUCCESS | Updated ticket ID $claimId with claim status: $currentStatus");
|
||||
|
||||
return $this->response->setJSON([
|
||||
'status' => true,
|
||||
'message' => 'Claim status updated.',
|
||||
'updated_status' => $currentStatus,
|
||||
'api_response' => $response
|
||||
]);
|
||||
return ['status' => true,'message' => 'Claim status updated.','updated_status' => $currentStatus,'api_response' => $response];
|
||||
}
|
||||
|
||||
public function IRSubmission($claimId = null) // 585 this id for test
|
||||
|
||||
@ -52,6 +52,7 @@ class NotificationController extends AdminController
|
||||
// Create Or Update the Notification
|
||||
public function createNotification()
|
||||
{
|
||||
|
||||
$form_data['template_name'] = $this->camelCaseToSnakeCase($this->request->getPost('template_name'));
|
||||
$form_data['subject'] = $this->request->getPost('subject');
|
||||
$form_data['mail_content'] = $this->request->getPost('mailContent');
|
||||
|
||||
@ -254,8 +254,8 @@ class VidalApiController extends BaseController
|
||||
|
||||
if($response['data']['status'] == 'SUCCESS')
|
||||
{
|
||||
$claimNO = $response['data']['data']['claimNO'] ?? null;
|
||||
$claimInwardNO = $response['data']['data']['claimInwardNO'] ?? null;
|
||||
$claimNO = $response['data']['data']['claimNo'] ?? null;
|
||||
$claimInwardNO = $response['data']['data']['claimInwardNo'] ?? null;
|
||||
|
||||
if(!empty($claimNO) && !empty($claimInwardNO)){
|
||||
|
||||
@ -263,7 +263,7 @@ class VidalApiController extends BaseController
|
||||
|
||||
$this->db->table('ticket_master')
|
||||
->where('id',$claimId)
|
||||
->update([ 'tpa_claim_push_reference_no' => $claimInwardNO , 'tpa_claim_id' => $claimNO ]);
|
||||
->update([ 'tpa_claim_push_reference_no' => $claimInwardNO , 'tpa_claim_id' => $claimNO , 'claim_number' => $claimNO ]);
|
||||
|
||||
return;
|
||||
|
||||
@ -442,7 +442,7 @@ class VidalApiController extends BaseController
|
||||
->getRowArray();
|
||||
|
||||
if (!$ticket) {
|
||||
return $this->response->setJSON(['status' => false,'message' => 'Invalid Claim ID' ]);
|
||||
return ['status' => false,'message' => 'Invalid Claim ID' ];
|
||||
}
|
||||
|
||||
$body = [];
|
||||
@ -467,11 +467,7 @@ class VidalApiController extends BaseController
|
||||
if ($response['status'] != true || empty($response['data']['data']['claims'][0])) {
|
||||
log_message('error', 'CLAIM STATUS FAILED | for ticket ID: ' . $claimId.' | response: '.json_encode($response));
|
||||
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'API call failed.',
|
||||
'data' => $response
|
||||
]);
|
||||
return ['status' => false, 'message' => 'API call failed.','data' => $response];
|
||||
}
|
||||
|
||||
// Extract claim status
|
||||
@ -504,12 +500,7 @@ class VidalApiController extends BaseController
|
||||
// LOG UPDATE
|
||||
log_message('error', "CLAIM STATUS SUCCESS | Updated ticket ID $claimId with claim status: $currentStatus");
|
||||
|
||||
return $this->response->setJSON([
|
||||
'status' => true,
|
||||
'message' => 'Claim status updated.',
|
||||
'updated_status' => $currentStatus,
|
||||
'api_response' => $response
|
||||
]);
|
||||
return ['status' => true,'message' => 'Claim status updated.','updated_status' => $currentStatus,'api_response' => $response];
|
||||
}
|
||||
|
||||
public function ClaimStatusUpdate()
|
||||
@ -804,7 +795,7 @@ class VidalApiController extends BaseController
|
||||
|
||||
//call a job for dump JSON data to DB
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'saveMediAssitAPIData', 'payload' => [ 'file_id' => $requestData['file_id'],'json_file_path' => $filePath ]]);
|
||||
$r = Jobs::addJob(['job_name' => 'saveVidalAPIData', 'payload' => [ 'file_id' => $requestData['file_id'],'json_file_path' => $filePath ]]);
|
||||
|
||||
|
||||
// now update DB
|
||||
|
||||
@ -3173,6 +3173,13 @@ if (!function_exists('check_rto_data')) {
|
||||
$vehicle_no = strtoupper(trim($row[2])); // Example: TN10AB1234
|
||||
$new_vehicle = strtolower(trim($row[2]));
|
||||
|
||||
if(!validate_indian_vehicle_number($vehicle_no)['status']){
|
||||
return [
|
||||
'status' => false,
|
||||
'error' => 'Invalid Vehicle Number. Format should be like TN82AX2024 (no spaces or special characters).'
|
||||
];
|
||||
};
|
||||
|
||||
// BH Series: 22BH1234AA
|
||||
$bhPattern = '/^[0-9]{2}BH[0-9]{4}[A-Z]{2}$/';
|
||||
|
||||
|
||||
@ -116,6 +116,21 @@ class sendMailNotification
|
||||
$tpa_id = $params['tpa_id'];
|
||||
$common = $params['common'];
|
||||
|
||||
$mailAttachmentModel = new MailAttachmentModel();
|
||||
$attachment_data = $mailAttachmentModel
|
||||
->select('file_path, file_name')
|
||||
->where('notification_id', $notification['id'])
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$attachments = [];
|
||||
foreach ($attachment_data as $data) {
|
||||
$attachments[] = [
|
||||
"filePath" => WRITEPATH . $data['file_path'],
|
||||
"fileName" => $data['file_name']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
$mail_content = $notification['mail_content'];
|
||||
$mail = $get_emp_email_and_other_details['email_corporate'];
|
||||
@ -160,7 +175,7 @@ class sendMailNotification
|
||||
$mail_content = view('mail_template', $data);
|
||||
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'],'attachments' => $attachments, 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
||||
|
||||
return $wholeData;
|
||||
|
||||
|
||||
@ -1101,3 +1101,33 @@ if (!function_exists('convertGoogleDriveToDownloadLink')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_cd_balance')) {
|
||||
function get_cd_balance(): array
|
||||
{
|
||||
$session = session();
|
||||
|
||||
return [
|
||||
'has_cd_balance' => $session->has('cd_balance'),
|
||||
'hr_data' => $session->get('hr_data') ?? [],
|
||||
'cd_balance_info' => $session->get('cd_balance_info') ?? [],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('clear_cd_balance_session')) {
|
||||
function clear_cd_balance_session(): void
|
||||
{
|
||||
$session = session();
|
||||
|
||||
$session->remove('cd_balance');
|
||||
$session->remove('hr_data');
|
||||
$session->remove('cd_balance_info');
|
||||
|
||||
log_message('error', 'clear_cd_balance_session clered');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -494,7 +494,6 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
) as batch_data ON employee_polices.id = batch_data.emp_policy_id
|
||||
WHERE employee_polices.client_policy_id = :client_policy_id:
|
||||
AND (employee_polices.:id: IS NULL OR employee_polices.:id: = '')
|
||||
AND employees.client_branch_id = :client_branch_id:
|
||||
AND employee_polices.is_active = 1
|
||||
AND employee_polices.status = 'active'
|
||||
@ -502,6 +501,14 @@ class EmployeePolicyModel extends Model
|
||||
AND employees.emp_status = 'active'
|
||||
";
|
||||
|
||||
if($insurer_or_tpa == 'insurer'){
|
||||
$sql .= "AND (employee_polices.uhid IS NULL OR employee_polices.uhid <> '')";
|
||||
}
|
||||
|
||||
if($insurer_or_tpa == 'tpa'){
|
||||
$sql .= "AND (employee_polices.tpa_id IS NULL OR employee_polices.tpa_id <> '')";
|
||||
}
|
||||
|
||||
$binds = ["datas" => $datas,"event" => $event
|
||||
,"insurer_or_tpa" => $insurer_or_tpa
|
||||
,"client_policy_id" => $client_policy_id
|
||||
|
||||
@ -92,6 +92,7 @@ class TicketMasterModel extends Model
|
||||
'claim_description',
|
||||
'required_docs',
|
||||
'policy_transaction_id',
|
||||
'tpa_claim_type',
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -5,6 +5,354 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.demo-button {
|
||||
/* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 16px 32px;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
border-radius: 12px;
|
||||
cursor: pointer;
|
||||
font-family: 'Manrope', sans-serif;
|
||||
box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
|
||||
transition: all 0.3s ease;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.demo-button:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 15px 30px rgba(102, 126, 234, 0.5);
|
||||
}
|
||||
|
||||
/* Modal Overlay */
|
||||
.modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: var(--bg-overlay);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition: all 0.3s ease;
|
||||
backdrop-filter: blur(4px);
|
||||
}
|
||||
|
||||
.modal-overlay.active {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
/* Modal Container */
|
||||
.modal-container {
|
||||
background: var(--bg-modal);
|
||||
border-radius: 20px;
|
||||
box-shadow: var(--shadow-lg);
|
||||
/* max-width: 600px; */
|
||||
width: 100%;
|
||||
max-height: 85vh;
|
||||
overflow: hidden;
|
||||
transform: scale(0.9) translateY(20px);
|
||||
transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.modal-overlay.active .modal-container {
|
||||
transform: scale(1) translateY(0);
|
||||
}
|
||||
|
||||
/* Modal Header */
|
||||
.modal-header {
|
||||
padding: 10px 26px;
|
||||
border-bottom: 2px solid var(--border-color);
|
||||
background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
font-family: 'Manrope', sans-serif;
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.modal-subtitle {
|
||||
font-size: 14px;
|
||||
color: var(--text-secondary);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
/* Toggle Section */
|
||||
.toggle-section {
|
||||
padding: 14px 25px;
|
||||
background: #fefefe;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.toggle-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.toggle-label {
|
||||
font-family: 'Manrope', sans-serif;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
/* Toggle Switch */
|
||||
.toggle-switch {
|
||||
position: relative;
|
||||
width: 54px;
|
||||
height: 28px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.toggle-switch input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.toggle-slider {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #cbd5e1;
|
||||
border-radius: 34px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.toggle-slider:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
height: 22px;
|
||||
width: 22px;
|
||||
left: 3px;
|
||||
bottom: 3px;
|
||||
background-color: white;
|
||||
border-radius: 50%;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.toggle-switch input:checked + .toggle-slider {
|
||||
background: #02a8b5;
|
||||
}
|
||||
|
||||
.toggle-switch input:checked + .toggle-slider:before {
|
||||
transform: translateX(26px);
|
||||
}
|
||||
|
||||
/* HR List Section */
|
||||
.hr-list-section {
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
padding: 0;
|
||||
display: none;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.hr-list-section.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.hr-item {
|
||||
padding: 5px 32px;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
transition: background 0.2s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.hr-item:hover {
|
||||
background: #f9fafb;
|
||||
}
|
||||
|
||||
.hr-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/* Checkbox Styling */
|
||||
.hr-checkbox {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 16px;
|
||||
}
|
||||
|
||||
.hr-checkbox input[type="checkbox"] {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.checkbox-custom {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border: 2px solid #cbd5e1;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.2s ease;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.hr-checkbox input:checked ~ .checkbox-custom {
|
||||
background: #02a8b5;
|
||||
border-color: #667eea;
|
||||
}
|
||||
|
||||
.checkbox-custom:after {
|
||||
content: "";
|
||||
display: none;
|
||||
width: 6px;
|
||||
height: 10px;
|
||||
border: solid white;
|
||||
border-width: 0 2px 2px 0;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.hr-checkbox input:checked ~ .checkbox-custom:after {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* HR Info */
|
||||
.hr-info {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.hr-name {
|
||||
font-family: 'Manrope', sans-serif;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.hr-email {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* Modal Footer */
|
||||
.modal-footer {
|
||||
padding: 24px 32px;
|
||||
background: #fafafa;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
justify-content: flex-end;
|
||||
flex-shrink: 0;
|
||||
border-top: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 12px 24px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
font-family: 'Manrope', sans-serif;
|
||||
transition: all 0.2s ease;
|
||||
letter-spacing: 0.3px;
|
||||
}
|
||||
|
||||
.btn-submit {
|
||||
/* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
|
||||
color: white;
|
||||
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
|
||||
}
|
||||
|
||||
.btn-submit:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
|
||||
}
|
||||
|
||||
.btn-submit:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
/* Scrollbar Styling */
|
||||
.hr-list-section::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
.hr-list-section::-webkit-scrollbar-track {
|
||||
background: #f1f5f9;
|
||||
}
|
||||
|
||||
.hr-list-section::-webkit-scrollbar-thumb {
|
||||
background: #cbd5e1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.hr-list-section::-webkit-scrollbar-thumb:hover {
|
||||
background: #94a3b8;
|
||||
}
|
||||
|
||||
/* Empty State */
|
||||
.empty-state {
|
||||
padding: 60px 32px;
|
||||
text-align: center;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.empty-state-icon {
|
||||
font-size: 48px;
|
||||
margin-bottom: 16px;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.empty-state-text {
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Animations */
|
||||
@keyframes slideIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.hr-item {
|
||||
animation: slideIn 0.3s ease;
|
||||
animation-fill-mode: backwards;
|
||||
}
|
||||
|
||||
.hr-item:nth-child(1) { animation-delay: 0.05s; }
|
||||
.hr-item:nth-child(2) { animation-delay: 0.1s; }
|
||||
.hr-item:nth-child(3) { animation-delay: 0.15s; }
|
||||
.hr-item:nth-child(4) { animation-delay: 0.2s; }
|
||||
.hr-item:nth-child(5) { animation-delay: 0.25s; }
|
||||
|
||||
</style>
|
||||
|
||||
<div class="tab-pane fade" id="KYC-DOC-tab">
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
@ -146,6 +494,10 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Demo Button -->
|
||||
<button style="display: none" class="demo-button" onclick="openModal()">Open HR Email Modal</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -159,12 +511,57 @@
|
||||
<!-- end row -->
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="payout_modal" tabindex="-1" role="dialog" aria-hidden="true" aria-modal="true" data-backdrop="static" data-backdrop="static"
|
||||
data-keyboard="false"
|
||||
tabindex="-1">
|
||||
<div class="modal-dialog modal-lg" style="max-width: 800px;">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" style="background-color: gainsboro;">
|
||||
<h5 class="modal-title" id="myCenterModalLabel"> Insufficient CD Balance HR Notification</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body" id="modal_body">
|
||||
|
||||
<!-- Form -->
|
||||
<form id="hrEmailForm">
|
||||
|
||||
<input type="hidden", id="client_id_for_hr_mail_send" name="client_id" >
|
||||
|
||||
<!-- Toggle Section -->
|
||||
<div class="toggle-section">
|
||||
<div class="toggle-container">
|
||||
<label class="toggle-label">Insufficient Balance HR Mail Send</label>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" id="mailToggle" onchange="toggleHRList()">
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- HR List Section -->
|
||||
<div class="hr-list-section" id="hrListSection">
|
||||
<!-- HR items will be dynamically generated here -->
|
||||
</div>
|
||||
|
||||
<!-- Footer Buttons -->
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-cancel" onclick="cancelModal()">Cancel</button>
|
||||
<button type="submit" class="btn btn-submit" id="submitBtn">Send Notification</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
var client_id_param2 = 0;
|
||||
var client_branch_id_param2 = 0;
|
||||
var client_policy_param2 = 0;
|
||||
var hr_data = [];
|
||||
|
||||
$(document).ready(function() {
|
||||
// Initialize select2
|
||||
@ -719,19 +1116,22 @@
|
||||
var messageShown = false; // Flag to prevent duplicate messages
|
||||
|
||||
//function for checking the session
|
||||
function checkCDBalance() {
|
||||
function checkCDBalanceOld() {
|
||||
|
||||
const get_cd_balance = <?= json_encode(get_cd_balance()) ?>;
|
||||
console.log({ get_cd_balance });
|
||||
|
||||
<?php if (session()->has('cd_balance')): ?>
|
||||
|
||||
var cdBalance = <?php echo json_encode(session()->get('cd_balance')); ?>;
|
||||
var cdAmount = <?php echo json_encode(session()->get('cd_amount')); ?>;
|
||||
var excel_file_amt = <?php echo json_encode(session()->get('excel_file_amt')); ?>;
|
||||
hr_data = <?php echo json_encode(session()->get('hr_data')); ?>;
|
||||
|
||||
console.log("cdBalance : ", cdBalance);
|
||||
console.log("cdAmount : ", cdAmount);
|
||||
console.log("excel_file_amt : ", excel_file_amt);
|
||||
console.log({cdBalance, cdAmount, excel_file_amt, hr_data})
|
||||
|
||||
// Only show message once and if status is false
|
||||
if (cdBalance === false && !messageShown) {
|
||||
if (get_cd_balance?.cd_balance === false && !messageShown) {
|
||||
// toastr.warning('Insufficient CD Balance deducated. Please wait the file will be downloaded', 'WARNING');
|
||||
var message1 = 'Insufficient CD Balance deducted. Please wait the file will be downloaded<br>' +
|
||||
'<strong>CD Amount:</strong> ₹' + (cdAmount || 0) + '<br>' +
|
||||
@ -742,8 +1142,11 @@
|
||||
timeOut: 10000,
|
||||
extendedTimeOut: 3000
|
||||
});
|
||||
|
||||
messageShown = true; // Prevent showing message again
|
||||
stopInterval();
|
||||
openModal();
|
||||
|
||||
} else if (cdBalance === true) {
|
||||
console.log("CD Balance is sufficient");
|
||||
stopInterval();
|
||||
@ -758,6 +1161,71 @@
|
||||
<?php else: ?>
|
||||
console.log("No cd_balance session found");
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
||||
function checkCDBalance() {
|
||||
|
||||
const cdData = <?= json_encode(get_cd_balance()) ?>;
|
||||
console.log(cdData, typeof cdData);
|
||||
|
||||
// cdData itself null / undefined safety
|
||||
if (!cdData || typeof cdData !== 'object') {
|
||||
console.log('CD data not available');
|
||||
return;
|
||||
}
|
||||
|
||||
let cd_balance_info = cdData.cd_balance_info
|
||||
console.log('cd_balance_info', cd_balance_info);
|
||||
cd_balance_info = JSON.parse(cd_balance_info);
|
||||
console.log('cd_balance_info', cd_balance_info);
|
||||
|
||||
let hr_data = cdData.hr_data
|
||||
console.log('hr_data', hr_data);
|
||||
hr_data = JSON.parse(hr_data);
|
||||
console.log('hr_data', hr_data);
|
||||
|
||||
|
||||
let cd_balance = cd_balance_info.cd_balance;
|
||||
let cd_amount = cd_balance_info.cd_amount;
|
||||
let excel_file_amt = cd_balance_info.excel_file_amt;
|
||||
|
||||
console.log(cd_balance ,cd_amount ,excel_file_amt);
|
||||
|
||||
window.hr_data = hr_data.hr_data;
|
||||
$('#client_id_for_hr_mail_send').val(hr_data.client_id)
|
||||
|
||||
console.log(cd_balance, typeof cd_balance);
|
||||
|
||||
if (cd_balance === false && messageShown === false) {
|
||||
|
||||
const message1 =
|
||||
'Insufficient CD Balance deducted. Please wait the file will be downloaded<br>' +
|
||||
'<strong>CD Amount:</strong> ₹' + cd_amount + '<br>' +
|
||||
'<strong>Total Amount:</strong> ₹' + excel_file_amt;
|
||||
|
||||
toastr.warning(message1, 'WARNING', {
|
||||
allowHtml: true,
|
||||
timeOut: 10000,
|
||||
extendedTimeOut: 3000
|
||||
});
|
||||
|
||||
messageShown = true;
|
||||
stopInterval();
|
||||
openModal();
|
||||
|
||||
<?php clear_cd_balance_session(); ?>
|
||||
|
||||
}
|
||||
else if (cd_balance === true) {
|
||||
|
||||
console.log('CD Balance is sufficient');
|
||||
stopInterval();
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
console.log('CD balance info not available');
|
||||
}
|
||||
}
|
||||
|
||||
// Start the interval
|
||||
@ -766,7 +1234,7 @@
|
||||
messageShown = false; // Reset message flag
|
||||
submitInterval = setInterval(function() {
|
||||
checkCDBalance();
|
||||
}, 2000);
|
||||
}, 10000);
|
||||
console.log("Checking CD balance started...");
|
||||
}
|
||||
}
|
||||
@ -796,6 +1264,7 @@
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
function togglePolicyIssueDate() {
|
||||
@ -873,4 +1342,199 @@
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
// Sample HR data (replace this with your actual data source)
|
||||
const hrData = [
|
||||
{ id: 1, name: 'Rajesh Kumar', email: 'rajesh.kumar@company.com' },
|
||||
{ id: 2, name: 'Priya Sharma', email: 'priya.sharma@company.com' },
|
||||
{ id: 3, name: 'Arun Patel', email: 'arun.patel@company.com' },
|
||||
{ id: 4, name: 'Arun Patel', email: 'arun.patel@company.com' },
|
||||
{ id: 5, name: 'Arun Patel', email: 'arun.patel@company.com' },
|
||||
];
|
||||
|
||||
// Open Modal
|
||||
function openModal() {
|
||||
// document.getElementById('hrModal').classList.add('active');
|
||||
var myModal = new bootstrap.Modal(document.getElementById('payout_modal'));
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
// Toggle HR List
|
||||
function toggleHRList() {
|
||||
const toggle = document.getElementById('mailToggle');
|
||||
const hrListSection = document.getElementById('hrListSection');
|
||||
|
||||
if (toggle.checked) {
|
||||
hrListSection.classList.add('active');
|
||||
renderHRList();
|
||||
} else {
|
||||
hrListSection.classList.remove('active');
|
||||
}
|
||||
}
|
||||
|
||||
// Render HR List
|
||||
function renderHRList() {
|
||||
const hrListSection = document.getElementById('hrListSection');
|
||||
|
||||
if (hr_data.length === 0) {
|
||||
hrListSection.innerHTML = `
|
||||
<div class="empty-state">
|
||||
<div class="empty-state-icon">📭</div>
|
||||
<div class="empty-state-text">No HR contacts available</div>
|
||||
</div>
|
||||
`;
|
||||
return;
|
||||
}
|
||||
|
||||
hrListSection.innerHTML = hr_data.map(hr => `
|
||||
<div class="hr-item" onclick="toggleCheckbox(${hr.id}, event)">
|
||||
<label class="hr-checkbox">
|
||||
<input type="checkbox" name="hr_emails[]" value="${hr.id}" data-email="${hr.email}" data-name="${hr.name}" id="hr_${hr.id}">
|
||||
<span class="checkbox-custom"></span>
|
||||
</label>
|
||||
<div class="hr-info">
|
||||
<div class="hr-name">${hr.name}</div>
|
||||
<div class="hr-email">${hr.email}</div>
|
||||
</div>
|
||||
</div>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
// Toggle checkbox when clicking on the item
|
||||
function toggleCheckbox(hrId, event) {
|
||||
// Prevent double toggle if clicking directly on checkbox
|
||||
if (event && event.target.tagName === 'INPUT') {
|
||||
return;
|
||||
}
|
||||
|
||||
const checkbox = document.getElementById(`hr_${hrId}`);
|
||||
checkbox.checked = !checkbox.checked;
|
||||
}
|
||||
|
||||
// Cancel Modal with Confirmation
|
||||
function cancelModal() {
|
||||
// document.getElementById('confirmDialog').classList.add('active');
|
||||
|
||||
Swal.fire({
|
||||
title: "Cancel Confirmation",
|
||||
text: "Are you sure you want to cancel? No emails will be sent to HR.",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#d33",
|
||||
confirmButtonText: "Yes, Procced!"
|
||||
}).then((result) => {
|
||||
|
||||
if(result.isConfirmed){
|
||||
confirmCancel()
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// Confirm Cancel
|
||||
function confirmCancel() {
|
||||
setTimeout(() => {
|
||||
$('.close').click();
|
||||
resetForm();
|
||||
}, 300);
|
||||
}
|
||||
|
||||
// Reset Form
|
||||
function resetForm() {
|
||||
document.getElementById('hrEmailForm').reset();
|
||||
document.getElementById('hrListSection').classList.remove('active');
|
||||
}
|
||||
|
||||
$('#hrEmailForm').on('submit', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const client_id = $('#client_id_for_hr_mail_send').val();
|
||||
const mailToggle = $('#mailToggle');
|
||||
const selectedHRs = $('input[name="hr_emails[]"]:checked');
|
||||
|
||||
if (!mailToggle.is(':checked')) {
|
||||
toastr.warning('Please Enable the mail option.', 'WARNING');
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedHRs.length === 0) {
|
||||
toastr.warning('Please select at least one HR.', 'WARNING');
|
||||
return;
|
||||
}
|
||||
|
||||
// Prepare mails object
|
||||
const sendingMails = {};
|
||||
selectedHRs.each(function () {
|
||||
const hrId = $(this).val();
|
||||
const hrEmail = $(this).data('email');
|
||||
const hrName = $(this).data('name');
|
||||
|
||||
sendingMails[hrId] = {
|
||||
mail: hrEmail,
|
||||
name: hrName
|
||||
};
|
||||
});
|
||||
|
||||
const formData = {
|
||||
mails: sendingMails,
|
||||
client_id: client_id,
|
||||
mail_enable_key: mailToggle.is(':checked') ? 1 : 0
|
||||
};
|
||||
|
||||
console.log('Form Data:', formData);
|
||||
|
||||
const $submitBtn = $('#submitBtn');
|
||||
$submitBtn.prop('disabled', true).text('Sending...');
|
||||
|
||||
const url = '<?= base_url('util/insufficientCdBalanceHrMailSend') ?>';
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'POST',
|
||||
data: JSON.stringify(formData),
|
||||
contentType: 'application/json',
|
||||
dataType: 'json',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') || ''
|
||||
},
|
||||
success: function (data) {
|
||||
console.log('Response Success:', data);
|
||||
|
||||
if (data.status === true) {
|
||||
toastr.success(data.message, 'SUCCESS');
|
||||
} else {
|
||||
toastr.warning(data.message, 'WARNING');
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error('Response Error:', error);
|
||||
toastr.error('Something went wrong. Please try again.', 'ERROR');
|
||||
},
|
||||
complete: function () {
|
||||
// Reset button state
|
||||
$submitBtn.prop('disabled', false).text('Send Notification');
|
||||
confirmCancel();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const modal = document.getElementById('payout_modal');
|
||||
const modalDialog = modal.querySelector('.modal-dialog');
|
||||
|
||||
modal.addEventListener('mousedown', function (e) {
|
||||
if (!modalDialog.contains(e.target)) {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
return false;
|
||||
}
|
||||
}, true); // 👈 capture phase
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@ -2156,10 +2156,9 @@
|
||||
$('.btnDiv').show();
|
||||
$('.claim-row').hide();
|
||||
|
||||
|
||||
$('.emp_title').text('No of Employees')
|
||||
$('.depnd_title').text('No of Dependents')
|
||||
$('.total_title').text('Total Lives')
|
||||
$('.emp_title_text').text('No of Employees')
|
||||
$('.depnd_title_text').text('No of Dependents')
|
||||
$('.total_title_text').text('Total Lives')
|
||||
|
||||
$('.renewalFields').find('select, input').removeAttr('required');
|
||||
$('.renewalFields').hide();
|
||||
@ -2193,9 +2192,9 @@
|
||||
$('.btnDiv').hide();
|
||||
$('.claim-row').show();
|
||||
|
||||
$('.emp_title').text('No of Employees at Inception')
|
||||
$('.depnd_title').text(' No of Dependents at Inception')
|
||||
$('.total_title').text('Total Lives at Inception')
|
||||
$('.emp_title_text').text('No of Employees at Inception')
|
||||
$('.depnd_title_text').text(' No of Dependents at Inception')
|
||||
$('.total_title_text').text('Total Lives at Inception')
|
||||
|
||||
$('.freshFields').find('select, input').removeAttr('required');
|
||||
$('.freshFields').hide();
|
||||
|
||||
@ -738,9 +738,9 @@
|
||||
$('.claim-row').hide();
|
||||
|
||||
|
||||
$('.emp_title').text('No of Employees')
|
||||
$('.depnd_title').text('No of Dependents')
|
||||
$('.total_title').text('Total Lives')
|
||||
$('.emp_title_text').text('No of Employees')
|
||||
$('.depnd_title_text').text('No of Dependents')
|
||||
$('.total_title_text').text('Total Lives')
|
||||
|
||||
$('.renewalFields').find('select, input').removeAttr('required');
|
||||
$('.renewalFields').hide();
|
||||
@ -775,9 +775,9 @@
|
||||
$('.btnDiv').hide();
|
||||
$('.claim-row').show();
|
||||
|
||||
$('.emp_title').text('No of Employees at Inception')
|
||||
$('.depnd_title').text(' No of Dependents at Inception')
|
||||
$('.total_title').text('Total Lives at Inception')
|
||||
$('.emp_title_text').text('No of Employees at Inception')
|
||||
$('.depnd_title_text').text(' No of Dependents at Inception')
|
||||
$('.total_title_text').text('Total Lives at Inception')
|
||||
|
||||
$('.freshFields').find('select, input').removeAttr('required');
|
||||
$('.freshFields').hide();
|
||||
@ -812,7 +812,6 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
var allContacts = "";
|
||||
function getBranchData(input,inputType) {
|
||||
|
||||
@ -1524,7 +1524,7 @@
|
||||
<form class="ajax" onsubmit="submitAttachmentForm(event, this)">
|
||||
<div style="display:flex; align-items:center; gap:10px; white-space:nowrap;">
|
||||
<div>
|
||||
<input type="file" name="file" required
|
||||
<input type="file" name="file"
|
||||
style="width:100%; min-width:160px;
|
||||
padding: 0 !important;
|
||||
background-color: transparent !important;
|
||||
@ -1548,7 +1548,7 @@
|
||||
newRow.innerHTML = `<td><form class="ajax" onsubmit="submitAttachmentForm(event, this)">
|
||||
<div style="display:flex; align-items:center; gap:10px; white-space:nowrap;">
|
||||
<div>
|
||||
<input type="file" name="file" required
|
||||
<input type="file" name="file"
|
||||
style="width:100%; min-width:160px;
|
||||
padding: 0 !important;
|
||||
background-color: transparent !important;
|
||||
@ -2009,6 +2009,8 @@
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
$('#account_maneger_summary_mail_modal').find('.close').click();
|
||||
toastr.success('Template saved successfully');
|
||||
@ -2069,6 +2071,8 @@
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
$('#member_welcome_mail_modal').find('.close').click();
|
||||
toastr.success('Template saved successfully');
|
||||
@ -2129,6 +2133,8 @@
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
$('#member_reminder_mail_modal').find('.close').click();
|
||||
toastr.success('Template saved successfully');
|
||||
@ -2189,6 +2195,8 @@
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
$('#member_ecard_mail_modal').find('.close').click();
|
||||
toastr.success('Template saved successfully');
|
||||
@ -2248,6 +2256,8 @@
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
$('#member_common_mail_modal').find('.close').click();
|
||||
toastr.success('Template saved successfully');
|
||||
@ -2308,6 +2318,8 @@
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
$('#member_review_and_summary_mail_modal').find('.close').click();
|
||||
toastr.success('Template saved successfully');
|
||||
@ -2368,6 +2380,8 @@
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
$('#client_hr_summary_mail_modal').find('.close').click();
|
||||
toastr.success('Template saved successfully');
|
||||
|
||||
@ -131,22 +131,28 @@
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="incept_emp_count" class="emp_title"> No of Employees at Inception <span
|
||||
class="text-danger"></span></label>
|
||||
<label for="incept_emp_count" class="emp_title">
|
||||
<span class="emp_title_text"> No of Employees at Inception </span>
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
<input value="<?= isset($lead_edit_data['incept_emp_count']) ? $lead_edit_data['incept_emp_count'] : '' ?>" type="text" class="form-control" id="incept_emp_count" name="incept_emp_count[]"
|
||||
placeholder="Enter Lives" required oninput="calculateTotalLives(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="incept_dept_count" class="depnd_title"> No of Dependents at Inception <span
|
||||
class="text-danger"></span></label>
|
||||
<label for="incept_dept_count" class="depnd_title">
|
||||
<span class="depnd_title_text"> No of Dependents at Inception </span>
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
<input value="<?= isset($lead_edit_data['incept_dept_count']) ? $lead_edit_data['incept_dept_count'] : '' ?>" type="text" class="form-control" id="incept_dept_count" name="incept_dept_count[]"
|
||||
placeholder="Enter Lives" required oninput="calculateTotalLives(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="incept_no_of_lives" class="total_title"> Total Lives at Inception <span
|
||||
class="text-danger"></span></label>
|
||||
<label for="incept_no_of_lives" class="total_title">
|
||||
<span class="total_title_text">Total Lives at Inception</span>
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
<input value="<?= isset($lead_edit_data['incept_no_of_lives']) ? $lead_edit_data['incept_no_of_lives'] : '' ?>" type="text" class="form-control" id="incept_no_of_lives" name="incept_no_of_lives[]"
|
||||
placeholder="Enter Lives" required>
|
||||
</div>
|
||||
|
||||
@ -3,12 +3,16 @@
|
||||
<div class="form-row" >
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="incept_emp_count" class="emp_title"> No of Employees at Inception <span class="text-danger">*</span></label>
|
||||
<label for="incept_emp_count" class="emp_title">
|
||||
<span class="emp_title_text"> No of Employees at Inception </span>
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
<input value="<?= isset($lead_edit_data['incept_emp_count']) ? $lead_edit_data['incept_emp_count'] : '' ?>" type="text" class="form-control" id="incept_emp_count" name="incept_emp_count[]" placeholder="Enter Lives" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="total_lives_at_incept" class="total_title"> Total Lives at Inception <span class="text-danger"></span></label>
|
||||
<label for="total_lives_at_incept" class="total_title">
|
||||
<span class="total_title_text"> Total Lives at Inception </span> <span class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['total_lives_at_incept']) ? $lead_edit_data['total_lives_at_incept'] : '' ?>" type="text" class="form-control" id="total_lives_at_incept" name="total_lives_at_incept[]" placeholder="Enter Lives" disabled>
|
||||
</div>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user