Conflit resolved : GWM

This commit is contained in:
Gowtham M 2026-01-30 10:53:18 +05:30
commit 2308a77179
42 changed files with 5171 additions and 715 deletions

View File

@ -109,9 +109,14 @@ R_CARE_PRIMARY_KEY_CONSTANT =
FHPL_PRIMARY_KEY_CONSTANT =
VIDAL_PRIMARY_KEY_CONSTANT =
MEDI_ASSIST_PRIMARY_KEY_CONSTANT =
FHPL_TOKEN_URL =
FHPL_BASE_URL =
FHPL_USER_NAME =
FHPL_PASSWORD =
FHPL_GRANT_TYPE =
FHPL_GRANT_TYPE =

View File

@ -16,6 +16,7 @@ class Acl
'#^/getVerifiedPosUserData#' => ['public' => true],
'#^/swagger#' => ['roles' => [ADMIN_ROLE_ID]],
'#^/fedeploy#' => ['roles' => [ADMIN_ROLE_ID]],
'#^/visitOffBoardCheck#' => ['roles' => [ADMIN_ROLE_ID]],
// ===================== PUBLIC DOWNLOADS / FORMS =====================
'#^/download-#' => ['public' => true],

View File

@ -21,6 +21,7 @@ $routes->get('/chatbot', 'ChatbotControllerNew::chatbot');
$routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']);
$routes->get('/fedeploy', 'DeployController::fedeploy_view', ['filter' => 'authMVC']);
$routes->post('/fedeploy', 'DeployController::fedeploy', ['filter' => 'authMVC']);
$routes->get('/visitOffBoardCheck', 'EmployeeController::visitOffBoardCheck');
// Reminder Mail Notification
@ -428,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");

View File

@ -62,7 +62,7 @@ class AppContentManagementController extends AdminController
$data = $this->request->getPost();
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
$id = (int) $sanitized_post_data['add_image_id'];
$id = ((int) $sanitized_post_data['add_image_id']) ?? null;
$rules = [
'client_id' => [
@ -100,7 +100,7 @@ class AppContentManagementController extends AdminController
$file = $this->request->getFile('advertise_image');
$client_id = $sanitized_post_data['client_id'];
$client_id = $sanitized_post_data['client_id'] ?? null;
//1) original file name for vaildations
$fileName = $file->getClientName(); //original file name for vaildations
$existing = $this->addImgModel->where('name', $fileName)->where('client_id', $fileName)->where('is_active', 1)->first();
@ -120,7 +120,7 @@ class AppContentManagementController extends AdminController
$file->move($uploadPath, $fileName);
$id = $sanitized_post_data['add_image_id'];
$id = $sanitized_post_data['add_image_id'] ?? null;
$details = ['name' => $fileName,'client_id'=>$client_id];
if ($id == 0) {

View File

@ -194,10 +194,10 @@ class BDSReportController extends AdminController
$request_post_data = $this->request->getPost();
$sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data);
$fromDate = $sanitized_post_data['fromDate'];
$toDate = $sanitized_post_data['toDate'];
$category = $sanitized_post_data['category'];
$report_type = $sanitized_post_data['report_type'];
$fromDate = $sanitized_post_data['fromDate'] ?? null;
$toDate = $sanitized_post_data['toDate'] ?? null;
$category = $sanitized_post_data['category'] ?? null;
$report_type = $sanitized_post_data['report_type'] ?? null;
// log_message('error',json_encode($_POST));die();
if ($report_type == 'insurer') {
$life = $category == 'life' ? 1 : 0;
@ -942,11 +942,11 @@ class BDSReportController extends AdminController
$request_post_data = $this->request->getPost();
$sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data);
$fromDate = $sanitized_post_data['fromDate'];
$toDate = $sanitized_post_data['toDate'];
$client_id = $sanitized_post_data['client_id'];
$client_type = $sanitized_post_data['client_type'];
$issuer_branch = $sanitized_post_data['issuer_branch'];
$fromDate = $sanitized_post_data['fromDate'] ?? null;
$toDate = $sanitized_post_data['toDate'] ?? null;
$client_id = $sanitized_post_data['client_id'] ?? null;
$client_type = $sanitized_post_data['client_type'] ?? null;
$issuer_branch = $sanitized_post_data['issuer_branch'] ?? null;
$data['issuer_branch'] = $this->nhanceBranchModel->where('is_active', 1)->findAll();
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];

View File

@ -480,11 +480,28 @@ class ClientController extends AdminController
$this->myLogger->logme('error', 'Client list function called');
$headerData['tab_name'] = 'Clients';
$headerData['page_name'] = 'Clients'; // Both Browser Tab name And Page name are same.
$data['clientList'] = $this->clientModel->getCreatedByUserName(1); // passing client_type
// $data['clientList'] = $this->clientModel->getCreatedByUserName(1); // passing client_type
$data['client_rm'] = $this->clientRMModel->getAllClientRM();
$data['lead_data'] = $this->leadsModel->getLeadForInsertClientList();
$rawList = $this->clientModel->getCreatedByUserName(1);
$clientRM = $data['client_rm'];
$rmMap = [];
foreach ($clientRM as $rm) {
$rmMap[$rm->client_id][] = $rm->account_manager;
}
$data['clientList'] = (!empty($rawList) && is_array($rawList)) ? array_map(function($item) use ($rmMap) {
$managers = isset($rmMap[$item->id]) ? implode(", ", $rmMap[$item->id]) : "N/A";
return (object) [
'id' => $item->id,
'client_name' => $item->client_name,
'short_name' => $item->short_name,
'account_managers' => $managers
];
}, $rawList) : [];
// dd($data);
// dd($data['clientList']);
echo view('layout/header', $headerData);
echo view('client_list', $data);
@ -497,7 +514,22 @@ class ClientController extends AdminController
public function typeList($id = null)
{
try {
$data = $this->clientModel->getCreatedByUserName($id); // passing client_type
$rawList = $this->clientModel->getCreatedByUserName($id); // passing client_type
$clientRM = $this->clientRMModel->getAllClientRM();;
$rmMap = [];
foreach ($clientRM as $rm) {
$rmMap[$rm->client_id][] = $rm->account_manager;
}
$data['clientList'] = (!empty($rawList) && is_array($rawList)) ? array_map(function($item) use ($rmMap) {
$managers = isset($rmMap[$item->id]) ? implode(", ", $rmMap[$item->id]) : "N/A";
return (object) [
'id' => $item->id,
'client_name' => $item->client_name,
'short_name' => $item->short_name,
'account_managers' => $managers
];
}, $rawList) : [];
if (empty($data)) {
return $this->response
->setJSON(['status' => 'error', 'message' => 'No Records found'])
@ -832,11 +864,11 @@ class ClientController extends AdminController
// Retrieve form data from POST request
$loggedInUserID = get_session_userid();
// print_rr($sanitized_post_data);die();
$client_id = $sanitized_post_data['client_id'];
$insurer_id = $sanitized_post_data['insurer_id'];
$record_date = $sanitized_post_data['record_date'];
$cd_ac_pk = $sanitized_post_data['cd_ac_pk'];
$cd_ac_no = $sanitized_post_data['cd_ac_no'];
$client_id = $sanitized_post_data['client_id'] ?? null;
$insurer_id = $sanitized_post_data['insurer_id'] ?? null;
$record_date = $sanitized_post_data['record_date'] ?? null;
$cd_ac_pk = $sanitized_post_data['cd_ac_pk'] ?? null;
$cd_ac_no = $sanitized_post_data['cd_ac_no'] ?? null;
@ -856,15 +888,15 @@ class ClientController extends AdminController
}
$data = [
'amount' => $sanitized_post_data['amount'],
'sub_type_id' => $sanitized_post_data['sub_type_id'],
'client_id' => $sanitized_post_data['client_id'],
'amount' => $sanitized_post_data['amount'] ?? null,
'sub_type_id' => $sanitized_post_data['sub_type_id'] ?? null,
'client_id' => $sanitized_post_data['client_id'] ?? null,
'client_policy_id' => null,
'cd_ac_no' => $cd_ac_no ?? null,
'cd_ac_pk' => $cd_ac_pk ?? null,
'endorsement_no' => null,
'insurer_id' => $sanitized_post_data['insurer_id'],
'description' => $sanitized_post_data['description'],
'insurer_id' => $sanitized_post_data['insurer_id'] ?? null,
'description' => $sanitized_post_data['description'] ?? null,
'transaction_type' => $sanitized_post_data['transaction_type'] ?: 'Credit',
'updated_by' => 1,
'record_date' => $record_date
@ -925,6 +957,29 @@ class ClientController extends AdminController
}
$editData['client_policy'] = $clientPoliceData;
//Notes : $editData['client_policy'] this on called in client_policy page
$rawList = $editData['client_policy'];
$editData['client_policy'] = (!empty($rawList) && is_array($rawList))
? array_values(array_map(function ($item) {
return (object) [
'id' => $item->id,
'policy_no' => $item->policy_no,
'policy_type_name' => $item->policy_type_name,
'policy_start_date' => $item->policy_start_date,
'policy_end_date' => $item->policy_end_date,
'insurer_short' => $item->insurer_short,
'insurer_branch_name' => $item->insurer_branch_name,
'branch_name' => $item->branch_name ?? ' - ',
'tpa_short' => $item->tpa_short,
'policy_type_name' => $item->policy_type_name,
'policy_type_id' => $item->policy_type_id,
'lead_cd_amount' => $item->lead_cd_amount,
'tpa_branch_code' => $item->tpa_branch_code,
'branch_name' => $item->branch_name ?? ' - ',
'policy_type_id' => $item->policy_type_id,
];
}, $rawList)) : [];
$editData['client_policy']['role'] = get_role_id();
$editData['notification'] = $this->notificationModel->select('template_name,enabled')->where('client_id', $id)->findAll();
$editData['placeHolders'] = ['member_name', 'member_mobile', 'nhance_logo', 'tpa_id', 'ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
@ -960,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' => [
@ -1778,13 +1832,13 @@ 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'];
$client_id = $sanitized_post_data['client_id'];
$id = $sanitized_post_data['branch_id_primarykey'] ?? null;
$client_id = $sanitized_post_data['client_id'] ?? null;
$pre_branch_id = $sanitized_post_data['pre_branch_id'] ?? '';
$data['pre_branch_id'] = $pre_branch_id;
$units = $sanitized_post_data['units'];
$units = $sanitized_post_data['units'] ?? null;
$emp_unit_count = 0;
$rr_unit_count = 0;
@ -1980,23 +2034,23 @@ class ClientController extends AdminController
$this->myLogger->logme('error', 'Client policy CREATE function called');
$data = $this->request->getPost();
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
$request_post_data = $this->request->getPost();
$$sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data);
$policy_type_id = $sanitized_post_data['policy_type_id'];
$client_branch_id = $sanitized_post_data['client_branch_id'];
$client_id = $sanitized_post_data['client_id'];
$base_policy = $sanitized_post_data['base_policy'];
$policy_type_id = $sanitized_post_data['policy_type_id'] ?? null;
$client_branch_id = $sanitized_post_data['client_branch_id'] ?? null;
$client_id = $sanitized_post_data['client_id'] ?? null;
$base_policy = $sanitized_post_data['base_policy'] ?? null;
$insurerValue = (string) $sanitized_post_data['insurer'];
$insurerValue = (string) $sanitized_post_data['insurer'] ?? null;
list($insurerBranchId, $insurerId) = explode('-', $insurerValue);
$data['insurer_branch_id'] = $insurerBranchId;
$data['insurer_id'] = $insurerId;
$sanitized_post_data['insurer_branch_id'] = $insurerBranchId;
$sanitized_post_data['insurer_id'] = $insurerId;
$tpaValue = (string) $sanitized_post_data['tpa'];
$tpaValue = (string) $sanitized_post_data['tpa'] ?? null;
if ($tpaValue === null || $tpaValue === '') {
$tpaBranchId = null;
@ -2006,76 +2060,67 @@ class ClientController extends AdminController
}
$insert_data['client_id'] = $client_id;
$insert_data['tpa_branch_id'] = $tpaBranchId;
$insert_data['tpa_id'] = $tpaId;
$insert_data['policy_type_id'] = $sanitized_post_data['policy_type_id'];
$sanitized_post_data['client_id'] = $client_id;
$sanitized_post_data['tpa_branch_id'] = $tpaBranchId;
$sanitized_post_data['tpa_id'] = $tpaId;
$sanitized_post_data['policy_type_id'] = $sanitized_post_data['policy_type_id'] ?? null;
$insert_data['no_of_lives'] = $sanitized_post_data['no_of_lives'];
$insert_data['policy_status'] = $sanitized_post_data['policy_status'];
$insert_data['no_of_employees'] = $sanitized_post_data['no_of_employees'];
$insert_data['earned_premium_date'] = change_date_format($sanitized_post_data['earned_premium_date'], 'd-m-Y', 'Y-m-d') ?? null;
$insert_data['claims_incurred_date'] = change_date_format($sanitized_post_data['claims_incurred_date'], 'd-m-Y', 'Y-m-d') ?? null;
$insert_data['incurred_claims_ratio'] = $sanitized_post_data['incurred_claims_ratio'];
$insert_data['no_lives_at_inception'] = $sanitized_post_data['no_lives_at_inception'];
$insert_data['premium_paid_at_inception'] = $sanitized_post_data['premium_paid_at_inception'];
$insert_data['claims_experience_for_last_3_years'] = $sanitized_post_data['claims_experience_for_last_3_years'];
$insert_data['earned_premium_amount'] = $sanitized_post_data['earned_premium_amount'];
$insert_data['claims_incurred_amount'] = $sanitized_post_data['claims_incurred_amount'];
$insert_data['base_policy'] = ($sanitized_post_data['base_policy'] === '' || $sanitized_post_data['base_policy'] == 0) ? null : $sanitized_post_data['base_policy'];
$insert_data['policy_status'] = 1;
$insert_data['inception_type'] = $sanitized_post_data['inception_type'] ? 2 : 1;
$insert_data['client_branch_id'] = $sanitized_post_data['client_branch_id'];
$insert_data['cd_ac_pk'] = $sanitized_post_data['cd_ac_no'];
$insert_data['gst'] = $sanitized_post_data['gst'];
$insert_data['disclaimer'] = $sanitized_post_data['disclaimer'];
$insert_data['is_member_modify_allowed'] = $sanitized_post_data['is_member_modify_allowed'] ? 1 : 0;
$insert_data['enrolment_visibility'] = $sanitized_post_data['enrolment_visibility'] ? 1 : 0;
$insert_data['is_lgbtq'] = $sanitized_post_data['is_lgbtq'] ? 1 : 0;
$insert_data['wellness_plan_id'] = $sanitized_post_data['wellness_plan_id'];
$insert_data['wellness_vendor_id'] = $sanitized_post_data['wellness_vendor_id'];
$insert_data['wellness_vendor_id'] = !empty($insert_data['wellness_vendor_id']) ? $insert_data['wellness_vendor_id'] : null;
$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['is_member_modify_allowed'] = $sanitized_post_data['is_member_modify_allowed'] ?? null ? 1 : 0;
$sanitized_post_data['enrolment_visibility'] = $sanitized_post_data['enrolment_visibility'] ?? null ? 1 : 0;
$sanitized_post_data['is_lgbtq'] = $sanitized_post_data['is_lgbtq'] ?? null ? 1 : 0;
$sanitized_post_data['wellness_vendor_id'] = !empty($sanitized_post_data['wellness_vendor_id']) ? $sanitized_post_data['wellness_vendor_id'] : null;
if ($policy_type_id == 1 || $policy_type_id == 2 || $policy_type_id == 6 || $policy_type_id == 7) {
$insert_data['is_addon'] = 1; // Base Policy
$sanitized_post_data['is_addon'] = 1; // Base Policy
} else if ($policy_type_id == 4 || $policy_type_id == 5) {
$insert_data['is_addon'] = 2; // SI TOPUP
$sanitized_post_data['is_addon'] = 2; // SI TOPUP
} else if ($policy_type_id == 3) {
if ($base_policy) {
$insert_data['is_addon'] = 3; // Dependent Addon
$sanitized_post_data['is_addon'] = 3; // Dependent Addon
} else {
$insert_data['is_addon'] = 1;
$sanitized_post_data['is_addon'] = 1;
}
}
$insert_data['policy_start_date'] = change_date_format($sanitized_post_data['policy_start_date'], 'd-m-Y', 'Y-m-d');
$insert_data['policy_end_date'] = change_date_format($sanitized_post_data['policy_end_date'], 'd-m-Y', 'Y-m-d');
$insert_data['policy_no'] = $sanitized_post_data['policy_no'];
if ($insert_data['inception_type'] == 2) {
$insert_data['open_date'] = change_date_format($sanitized_post_data['open_date'], 'd-m-Y', 'Y-m-d');
$insert_data['close_date'] = change_date_format($sanitized_post_data['close_date'], 'd-m-Y', 'Y-m-d');
$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) {
$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');
$insert_data['reminder_date'] = $sanitized_post_data['reminder_date'];
$sanitized_post_data['reminder_date'] = $sanitized_post_data['reminder_date'] ?? null;
} else {
$insert_data['open_date'] = null;
$insert_data['closedate'] = null;
$insert_data['reminder_date'] = null;
$sanitized_post_data['open_date'] = null;
$sanitized_post_data['closedate'] = null;
$sanitized_post_data['reminder_date'] = null;
}
$insert_data['created_by'] = get_session_userid();
$sanitized_post_data['created_by'] = get_session_userid();
$insert = $this->clientPolicyModel->insert($insert_data);
$insert = $this->clientPolicyModel->insert($sanitized_post_data);
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, '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_data], 200);
} else {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200);
}
@ -2088,19 +2133,19 @@ class ClientController extends AdminController
$data = $this->request->getPost();
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
$id = $sanitized_post_data['PrimaryKey'];
$client_id = $sanitized_post_data['client_id'];
$policy_type_id = $sanitized_post_data['policy_type_id'];
$base_policy = $sanitized_post_data['base_policy'];
$id = $sanitized_post_data['PrimaryKey'] ?? null;
$client_id = $sanitized_post_data['client_id'] ?? null;
$policy_type_id = $sanitized_post_data['policy_type_id'] ?? null;
$base_policy = $sanitized_post_data['base_policy'] ?? null;
$insurerValue = (string) $sanitized_post_data['insurer'];
list($insurerBranchId, $insurerId) = explode('-', $insurerValue);
$data['insurer_branch_id'] = $insurerBranchId;
$data['insurer_id'] = $insurerId;
$sanitized_post_data['insurer_branch_id'] = $insurerBranchId ?? null;
$sanitized_post_data['insurer_id'] = $insurerId ?? null;
$tpaValue = (string) $sanitized_post_data['tpa'];
$tpaValue = (string) $sanitized_post_data['tpa'] ?? null;
if (!empty($tpaValue) || $tpaValue !== '') {
list($tpaBranchId, $tpaId) = explode('-', $tpaValue);
} else {
@ -2108,73 +2153,73 @@ class ClientController extends AdminController
$tpaId = null;
}
$update_data['tpa_branch_id'] = $tpaBranchId;
$update_data['client_id'] = $client_id;
$update_data['tpa_id'] = $tpaId;
$update_data['policy_type_id'] = $sanitized_post_data['policy_type_id'];
$update_data['policy_no'] = $sanitized_post_data['policy_no'];
$sanitized_post_data['tpa_branch_id'] = $tpaBranchId ?? null;
$sanitized_post_data['client_id'] = $client_id ?? null;
$sanitized_post_data['tpa_id'] = $tpaId ?? null;
$sanitized_post_data['policy_type_id'] = $sanitized_post_data['policy_type_id'] ?? null;
$sanitized_post_data['policy_no'] = $sanitized_post_data['policy_no'] ?? null;
$update_data['insured'] = $sanitized_post_data['insured'];
$update_data['no_of_lives'] = $sanitized_post_data['no_of_lives'];
$update_data['policy_status'] = $sanitized_post_data['policy_status'];
$update_data['no_of_employees'] = $sanitized_post_data['no_of_employees'];
$update_data['earned_premium_date'] = change_date_format($sanitized_post_data['earned_premium_date'], 'd-m-Y', 'Y-m-d') ?? null;
$update_data['claims_incurred_date'] = change_date_format($sanitized_post_data['claims_incurred_date'], 'd-m-Y', 'Y-m-d') ?? null;
$update_data['incurred_claims_ratio'] = $sanitized_post_data['incurred_claims_ratio'];
$update_data['no_lives_at_inception'] = $sanitized_post_data['no_lives_at_inception'];
$update_data['premium_paid_at_inception'] = $sanitized_post_data['premium_paid_at_inception'];
$update_data['claims_experience_for_last_3_years'] = $sanitized_post_data['claims_experience_for_last_3_years'];
$update_data['earned_premium_amount'] = $sanitized_post_data['earned_premium_amount'];
$update_data['claims_incurred_amount'] = $sanitized_post_data['claims_incurred_amount'];
$update_data['base_policy'] = ($sanitized_post_data['base_policy'] === '' || $sanitized_post_data['base_policy'] == 0) ? null : $sanitized_post_data['base_policy'];
$update_data['policy_status'] = 1;
$update_data['inception_type'] = $sanitized_post_data['inception_type'] ? 2 : 1;
$update_data['enrolment_visibility'] = $sanitized_post_data['enrolment_visibility'] ? 1 : 0;
$update_data['client_branch_id'] = $sanitized_post_data['client_branch_id'];
$update_data['cd_ac_pk'] = $sanitized_post_data['cd_ac_no'];
$update_data['gst'] = $sanitized_post_data['gst'];
$update_data['disclaimer'] = $sanitized_post_data['disclaimer'];
$update_data['policy_start_date'] = change_date_format($sanitized_post_data['policy_start_date'], 'd-m-Y', 'Y-m-d');
$update_data['policy_end_date'] = change_date_format($sanitized_post_data['policy_end_date'], 'd-m-Y', 'Y-m-d');
$update_data['is_member_modify_allowed'] = $sanitized_post_data['is_member_modify_allowed'] ? 1 : 0;
$update_data['is_lgbtq'] = $sanitized_post_data['is_lgbtq'] ? 1 : 0;
$update_data['wellness_plan_id'] = $sanitized_post_data['wellness_plan_id'];
$update_data['wellness_vendor_id'] = $sanitized_post_data['wellness_vendor_id'];
$update_data['wellness_vendor_id'] = !empty($update_data['wellness_vendor_id']) ? $update_data['wellness_vendor_id'] : null;
// $sanitized_post_data['insured'] = $sanitized_post_data['insured'];
$sanitized_post_data['no_of_lives'] = $sanitized_post_data['no_of_lives'] ?? null;
$sanitized_post_data['policy_status'] = $sanitized_post_data['policy_status'] ?? null;
$sanitized_post_data['no_of_employees'] = $sanitized_post_data['no_of_employees'] ?? null;
$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_data['incurred_claims_ratio'] = $sanitized_post_data['incurred_claims_ratio'] ?? null;
$sanitized_post_data['no_lives_at_inception'] = $sanitized_post_data['no_lives_at_inception'] ?? null;
$sanitized_post_data['premium_paid_at_inception'] = $sanitized_post_data['premium_paid_at_inception'] ?? null;
$sanitized_post_data['claims_experience_for_last_3_years'] = $sanitized_post_data['claims_experience_for_last_3_years'] ?? null;
$sanitized_post_data['earned_premium_amount'] = $sanitized_post_data['earned_premium_amount'] ?? null;
$sanitized_post_data['claims_incurred_amount'] = $sanitized_post_data['claims_incurred_amount'] ?? null;
$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'] = $sanitized_post_data['inception_type'] ?? null ? 2 : 1;
$sanitized_post_data['enrolment_visibility'] = $sanitized_post_data['enrolment_visibility'] ?? null ? 1 : 0;
$sanitized_post_data['client_branch_id'] = $sanitized_post_data['client_branch_id'] ?? null;
$sanitized_post_data['cd_ac_pk'] = $sanitized_post_data['cd_ac_no'] ?? null;
$sanitized_post_data['gst'] = $sanitized_post_data['gst'] ?? null;
$sanitized_post_data['disclaimer'] = $sanitized_post_data['disclaimer'] ?? null;
$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['is_member_modify_allowed'] = $sanitized_post_data['is_member_modify_allowed'] ?? null ? 1 : 0;
$sanitized_post_data['is_lgbtq'] = $sanitized_post_data['is_lgbtq'] ?? null ? 1 : 0;
$sanitized_post_data['wellness_plan_id'] = $sanitized_post_data['wellness_plan_id'] ?? null;
$sanitized_post_data['wellness_vendor_id'] = $sanitized_post_data['wellness_vendor_id'] ?? null;
$sanitized_post_data['wellness_vendor_id'] = !empty($sanitized_post_data['wellness_vendor_id']) ? $sanitized_post_data['wellness_vendor_id'] : null;
if ($update_data['inception_type'] == 2) {
$update_data['open_date'] = change_date_format($sanitized_post_data['open_date'], 'd-m-Y', 'Y-m-d');
$update_data['close_date'] = change_date_format($sanitized_post_data['close_date'], 'd-m-Y', 'Y-m-d');
// $data['reminder_date'] = change_date_format($sanitized_post_data['reminder_date'), 'd-m-Y', 'Y-m-d');
$update_data['reminder_date'] = $sanitized_post_data['reminder_date'];
if ($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');
// $sanitized_post_data['reminder_date'] = change_date_format($sanitized_post_data['reminder_date'), 'd-m-Y', 'Y-m-d');
$sanitized_post_data['reminder_date'] = $sanitized_post_data['reminder_date'] ?? null;
} else {
$update_data['open_date'] = null;
$update_data['close_date'] = null;
$update_data['reminder_date'] = null;
$sanitized_post_data['open_date'] = null;
$sanitized_post_data['close_date'] = null;
$sanitized_post_data['reminder_date'] = null;
}
if ($policy_type_id == 1 || $policy_type_id == 2 || $policy_type_id == 6 || $policy_type_id == 7) {
$update_data['is_addon'] = 1; // Base Policy
$sanitized_post_data['is_addon'] = 1; // Base Policy
} else if ($policy_type_id == 4 || $policy_type_id == 5) {
$update_data['is_addon'] = 2; // SI TOPUP
$sanitized_post_data['is_addon'] = 2; // SI TOPUP
} else if ($policy_type_id == 3) {
if ($base_policy) {
$update_data['is_addon'] = 3; // Dependent Addon
$sanitized_post_data['is_addon'] = 3; // Dependent Addon
} else {
$update_data['is_addon'] = 1;
$sanitized_post_data['is_addon'] = 1;
}
}
$policy_terms = $this->clientPolicyModel->where('id', $sanitized_post_data['base_policy'])->first();
$old_client_policy_data = $this->clientPolicyModel->where('is_active', 1)->where('id', $id)->first();
$update_data['updated_by'] = get_session_userid();
$update = $this->clientPolicyModel->update($id, $update_data);
$sanitized_post_data['updated_by'] = get_session_userid();
$update = $this->clientPolicyModel->update($id, $sanitized_post_data);
if ($update) {
@ -2190,7 +2235,7 @@ class ClientController extends AdminController
]]);
}
return $this->respond(['status' => true, 'code' => 200, 'data' => $clientPoliceData, 'method' => 'EDIT'], 200);
return $this->respond(['status' => true, 'code' => 200, 'data' => $clientPoliceData, 'client_id' => $client_id, 'method' => 'EDIT'], 200);
} else {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200);
}
@ -2269,20 +2314,20 @@ class ClientController extends AdminController
$data = $this->request->getPost();
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
$client_id = $sanitized_post_data['client_id'];
$client_policy_id = $sanitized_post_data['client_policy_id'];
$client_id = $sanitized_post_data['client_id'] ?? null;
$client_policy_id = $sanitized_post_data['client_policy_id'] ?? null;
$record = $this->clientPolicyModel->where('client_policy.id', $client_policy_id)->first();
$premium_type = $sanitized_post_data['premium_type'];
$premium_type = $sanitized_post_data['premium_type'] ?? null;
if (!empty($client_id) && $client_id != null) {
$client_policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
$client_id = $client_policy_data['client_id'];
$client_id = $client_policy_data['client_id'] ?? null;
}
$branch_units = $this->getBranchUnitsByBranchId($record['client_branch_id']);
$branch_units = json_decode($branch_units);
$policy_grid_id = $sanitized_post_data['policy_grid_id'];
$rack_rate_name = $sanitized_post_data['rack_rate_name'];
$policy_grid_id = $sanitized_post_data['policy_grid_id'] ?? null;
$rack_rate_name = $sanitized_post_data['rack_rate_name'] ?? null;
$relation_data = [
'self' => $sanitized_post_data['self'] ?? 'NA',
@ -2316,7 +2361,7 @@ class ClientController extends AdminController
$jsonDataForRelation = json_encode($relation_data);
$json_data_relation_data_for_form_submit_check = json_encode($relation_data_for_form_submit_check);
$si_or_bp = $sanitized_post_data['si_or_bp'];
$si_or_bp = $sanitized_post_data['si_or_bp'] ?? null;
$basic_multiplier = str_replace(',', '', $sanitized_post_data['basic_multiplier']);
$premium_multiplier = str_replace(',', '', $sanitized_post_data['premium_multiplier']);
$multiplier = str_replace(',', '', $sanitized_post_data['multiplier']);
@ -2344,14 +2389,14 @@ class ClientController extends AdminController
$premium = str_replace(',', '', $sanitized_post_data['gpa_sum_premium[]']);
$sum_insure = str_replace(',', '', $sanitized_post_data['gpa_sum_si[]']);
$multiplier = $sanitized_post_data['gpa_sum_multiplier'];
$unit = $sanitized_post_data['gpa_unit_1[]'];
$multiplier = $sanitized_post_data['gpa_sum_multiplier'] ?? null;
$unit = $sanitized_post_data['gpa_unit_1[]'] ?? null;
for ($i = 0; $i < count($premium); $i++) {
$data['si'] = $sum_insure[$i];
$data['premium'] = $premium[$i];
$data['multiplier'] = $multiplier;
$data['si_or_bp'] = $sanitized_post_data['si_or_bp'];
$data['si_or_bp'] = $sanitized_post_data['si_or_bp'] ?? null;
if (empty($unit) || !isset($unit[$i]) || empty($unit[$i])) {
$data['unit'] = $branch_units[0];
} else {
@ -2364,9 +2409,9 @@ class ClientController extends AdminController
$premium = str_replace(',', '', $sanitized_post_data['gpa_sum_premium2[]']);
$sum_insure = str_replace(',', '', $sanitized_post_data['gpa_sum_si2[]']);
$multiplier = $sanitized_post_data['gpa_sum_multiplier2'];
$grade = $sanitized_post_data['gpa_band[]'];
$unit = $sanitized_post_data['gpa_unit_3[]'];
$multiplier = $sanitized_post_data['gpa_sum_multiplier2'] ?? null;
$grade = $sanitized_post_data['gpa_band[]'] ?? null;
$unit = $sanitized_post_data['gpa_unit_3[]'] ?? null;
for ($i = 0; $i < count($premium); $i++) {
@ -2374,7 +2419,7 @@ class ClientController extends AdminController
$data['premium'] = $premium[$i];
$data['grade'] = $grade[$i];
$data['multiplier'] = $multiplier;
$data['si_or_bp'] = $sanitized_post_data['si_or_bp'];
$data['si_or_bp'] = $sanitized_post_data['si_or_bp'] ?? null;
if (empty($unit) || !isset($unit[$i]) || empty($unit[$i])) {
$data['unit'] = $branch_units[0];
} else {
@ -2388,14 +2433,14 @@ class ClientController extends AdminController
$premium = str_replace(',', '', $sanitized_post_data['gpa_basic_premium[]']);
$sum_insure = str_replace(',', '', $sanitized_post_data['gpa_basic_si[]']);
$basic_pay = str_replace(',', '', $sanitized_post_data['basic_pay[]']);
$unit = $sanitized_post_data['gpa_unit[]'];
$unit = $sanitized_post_data['gpa_unit[]'] ?? null;
for ($i = 0; $i < count($premium); $i++) {
$data['si_or_bp'] = $sanitized_post_data['si_or_bp'];
$data['si_or_bp'] = $sanitized_post_data['si_or_bp'] ?? null;
$data['basic_multiplier'] = str_replace(',', '', $sanitized_post_data['basic_multiplier']);
$data['multiplier'] = $sanitized_post_data['premium_multiplier'];
$data['multiplier'] = $sanitized_post_data['premium_multiplier'] ?? null;
$data['basic_pay'] = $basic_pay[$i];
$data['si'] = $sum_insure[$i];
$data['premium'] = $premium[$i];
@ -2412,9 +2457,9 @@ class ClientController extends AdminController
$data['premium'] = str_replace(',', '', $sanitized_post_data['gpa_basic_premium']);
$data['si'] = str_replace(',', '', $sanitized_post_data['gpa_basic_si']);
$data['basic_multiplier'] = str_replace(',', '', $sanitized_post_data['basic_multiplier']);
$data['multiplier'] = $sanitized_post_data['premium_multiplier'];
$data['multiplier'] = $sanitized_post_data['premium_multiplier'] ?? null;
$data['basic_pay'] = str_replace(',', '', $sanitized_post_data['basic_pay']);
$data['si_or_bp'] = $sanitized_post_data['si_or_bp'];
$data['si_or_bp'] = $sanitized_post_data['si_or_bp'] ?? null;
$policyPremium = $this->policyPremium1Model->insert($data);
}
@ -2423,9 +2468,9 @@ class ClientController extends AdminController
$insert = true;
} else if ($policy_grid_id == '2') {
$premium = $sanitized_post_data['gpa_premium29[]'];
$sum_insure = $sanitized_post_data['gpa_si29[]'];
$unit = $sanitized_post_data['gpa_unit29[]'];
$premium = $sanitized_post_data['gpa_premium29[]'] ?? null;
$sum_insure = $sanitized_post_data['gpa_si29[]'] ?? null;
$unit = $sanitized_post_data['gpa_unit29[]'] ?? null;
for ($i = 0; $i < count($premium); $i++) {
$data['premium'] = str_replace(',', '', $premium[$i]);
@ -2442,9 +2487,9 @@ class ClientController extends AdminController
$insert = true;
} else if ($policy_grid_id == '3') {
$premium = $sanitized_post_data['3_premium[]'];
$sum_insure = $sanitized_post_data['3_si[]'];
$unit = $sanitized_post_data['3_unit[]'];
$premium = $sanitized_post_data['3_premium[]'] ?? null;
$sum_insure = $sanitized_post_data['3_si[]'] ?? null;
$unit = $sanitized_post_data['3_unit[]'] ?? null;
for ($i = 0; $i < count($premium); $i++) {
$data['premium'] = str_replace(',', '', $premium[$i]);
@ -2460,11 +2505,11 @@ class ClientController extends AdminController
$insert = true;
} else if ($policy_grid_id == '4') {
$premium = $sanitized_post_data['4_premium[]'];
$sum_insure = $sanitized_post_data['4_si'];
$age_from = $sanitized_post_data['4_age_from[]'];
$age_to = $sanitized_post_data['4_age_to[]'];
$unit = $sanitized_post_data['4_unit[]'];
$premium = $sanitized_post_data['4_premium[]'] ?? null;
$sum_insure = $sanitized_post_data['4_si'] ?? null;
$age_from = $sanitized_post_data['4_age_from[]'] ?? null;
$age_to = $sanitized_post_data['4_age_to[]'] ?? null;
$unit = $sanitized_post_data['4_unit[]'] ?? null;
for ($i = 0; $i < count($premium); $i++) {
$data['premium'] = str_replace(',', '', $premium[$i]);
@ -2483,11 +2528,11 @@ class ClientController extends AdminController
$insert = true;
} else if ($policy_grid_id == '5') {
$premium = $sanitized_post_data['5_premium[]'];
$sum_insure = $sanitized_post_data['5_si[]'];
$age_from = $sanitized_post_data['5_age_from[]'];
$age_to = $sanitized_post_data['5_age_to[]'];
$unit = $sanitized_post_data['5_unit[]'];
$premium = $sanitized_post_data['5_premium[]'] ?? null;
$sum_insure = $sanitized_post_data['5_si[]']?? null;
$age_from = $sanitized_post_data['5_age_from[]']?? null;
$age_to = $sanitized_post_data['5_age_to[]']?? null;
$unit = $sanitized_post_data['5_unit[]']?? null;
for ($i = 0; $i < count($premium); $i++) {
$data['premium'] = str_replace(',', '', $premium[$i]);
@ -2507,11 +2552,11 @@ class ClientController extends AdminController
$insert = true;
} else if ($policy_grid_id == '6') {
$premium = $sanitized_post_data['6_premium[]'];
$sum_insure = $sanitized_post_data['6_si'];
$age_from = $sanitized_post_data['6_age_from[]'];
$age_to = $sanitized_post_data['6_age_to[]'];
$unit = $sanitized_post_data['6_unit[]'];
$premium = $sanitized_post_data['6_premium[]']?? null;
$sum_insure = $sanitized_post_data['6_si']?? null;
$age_from = $sanitized_post_data['6_age_from[]']?? null;
$age_to = $sanitized_post_data['6_age_to[]']?? null;
$unit = $sanitized_post_data['6_unit[]']?? null;
for ($i = 0; $i < count($premium); $i++) {
$data['premium'] = str_replace(',', '', $premium[$i]);
@ -2529,11 +2574,11 @@ class ClientController extends AdminController
$data = $sanitized_post_data;
$insert = true;
} else if ($policy_grid_id == '7') {
$premium = $sanitized_post_data['7_premium[]'];
$sum_insure = $sanitized_post_data['7_si[]'];
$age_from = $sanitized_post_data['7_age_from[]'];
$age_to = $sanitized_post_data['7_age_to[]'];
$unit = $sanitized_post_data['7_unit[]'];
$premium = $sanitized_post_data['7_premium[]'] ?? null;
$sum_insure = $sanitized_post_data['7_si[]'] ?? null;
$age_from = $sanitized_post_data['7_age_from[]'] ?? null;
$age_to = $sanitized_post_data['7_age_to[]'] ?? null;
$unit = $sanitized_post_data['7_unit[]'] ?? null;
for ($i = 0; $i < count($premium); $i++) {
$data['premium'] = str_replace(',', '', $premium[$i]);
@ -2551,10 +2596,10 @@ class ClientController extends AdminController
$data = $sanitized_post_data;
$insert = true;
} else if ($policy_grid_id == '8') {
$premium = $sanitized_post_data['8_premium[]'];
$sum_insure = $sanitized_post_data['8_si[]'];
$grade = $sanitized_post_data['8_grade[]'];
$unit = $sanitized_post_data['8_unit[]'];
$premium = $sanitized_post_data['8_premium[]']?? null;
$sum_insure = $sanitized_post_data['8_si[]']?? null;
$grade = $sanitized_post_data['8_grade[]']?? null;
$unit = $sanitized_post_data['8_unit[]']?? null;
for ($i = 0; $i < count($premium); $i++) {
$data['premium'] = str_replace(',', '', $premium[$i]);
@ -2572,9 +2617,9 @@ class ClientController extends AdminController
$insert = true;
} else if ($policy_grid_id == '9') {
$premium = $sanitized_post_data['gpa_premium29[]'];
$sum_insure = $sanitized_post_data['gpa_si29[]'];
$unit = $sanitized_post_data['gpa_unit29[]'];
$premium = $sanitized_post_data['gpa_premium29[]']?? null;
$sum_insure = $sanitized_post_data['gpa_si29[]']?? null;
$unit = $sanitized_post_data['gpa_unit29[]']?? null;
for ($i = 0; $i < count($premium); $i++) {
$data['premium'] = str_replace(',', '', $premium[$i]);
@ -2590,11 +2635,11 @@ class ClientController extends AdminController
$data = $sanitized_post_data;
$insert = true;
} else if ($policy_grid_id == '10') {
$premium = $sanitized_post_data['10_premium[]'];
$sum_insure = $sanitized_post_data['10_si[]'];
$age_from = $sanitized_post_data['10_age_from[]'];
$age_to = $sanitized_post_data['10_age_to[]'];
$unit = $sanitized_post_data['10_unit[]'];
$premium = $sanitized_post_data['10_premium[]']?? null;
$sum_insure = $sanitized_post_data['10_si[]']?? null;
$age_from = $sanitized_post_data['10_age_from[]']?? null;
$age_to = $sanitized_post_data['10_age_to[]']?? null;
$unit = $sanitized_post_data['10_unit[]']?? null;
for ($i = 0; $i < count($premium); $i++) {
$data['premium'] = str_replace(',', '', $premium[$i]);
@ -2614,11 +2659,11 @@ class ClientController extends AdminController
$insert = true;
} else if ($policy_grid_id == '11') {
$premium = $sanitized_post_data['11_premium[]'];
$sum_insure = $sanitized_post_data['11_si[]'];
$grade = $sanitized_post_data['11_grade[]'];
$max_sum_insure = $sanitized_post_data['11_max_si[]'];
$unit = $sanitized_post_data['11_unit[]'];
$premium = $sanitized_post_data['11_premium[]']?? null;
$sum_insure = $sanitized_post_data['11_si[]']?? null;
$grade = $sanitized_post_data['11_grade[]']?? null;
$max_sum_insure = $sanitized_post_data['11_max_si[]']?? null;
$unit = $sanitized_post_data['11_unit[]']?? null;
for ($i = 0; $i < count($premium); $i++) {
$data['premium'] = str_replace(',', '', $premium[$i]);
@ -2637,10 +2682,10 @@ class ClientController extends AdminController
$insert = true;
} else if ($policy_grid_id == '12') {
$premium = $sanitized_post_data['12_premium[]'];
$sum_insure = $sanitized_post_data['12_si[]'];
$relationship = $sanitized_post_data['12_relationship[]'];
$unit = $sanitized_post_data['12_unit[]'];
$premium = $sanitized_post_data['12_premium[]']?? null;
$sum_insure = $sanitized_post_data['12_si[]']?? null;
$relationship = $sanitized_post_data['12_relationship[]']?? null;
$unit = $sanitized_post_data['12_unit[]']?? null;
for ($i = 0; $i < count($premium); $i++) {
$data['premium'] = str_replace(',', '', $premium[$i]);
@ -2658,12 +2703,12 @@ class ClientController extends AdminController
$insert = true;
} else if ($policy_grid_id == '13') {
$premium = $sanitized_post_data['13_premium[]'];
$sum_insure = $sanitized_post_data['13_si[]'];
$age_from = $sanitized_post_data['13_age_from[]'];
$age_to = $sanitized_post_data['13_age_to[]'];
$relationship = $sanitized_post_data['13_relationship[]'];
$unit = $sanitized_post_data['13_unit[]'];
$premium = $sanitized_post_data['13_premium[]']?? null;
$sum_insure = $sanitized_post_data['13_si[]']?? null;
$age_from = $sanitized_post_data['13_age_from[]']?? null;
$age_to = $sanitized_post_data['13_age_to[]']?? null;
$relationship = $sanitized_post_data['13_relationship[]']?? null;
$unit = $sanitized_post_data['13_unit[]']?? null;
for ($i = 0; $i < count($premium); $i++) {
$data['premium'] = str_replace(',', '', $premium[$i]);
@ -5605,7 +5650,7 @@ class ClientController extends AdminController
}
$data = $this->request->getPost();
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
$id = $sanitized_post_data['vehicle_primary_key'];
$id = $sanitized_post_data['vehicle_primary_key'] ?? null;
if ($id) {
@ -5632,9 +5677,9 @@ class ClientController extends AdminController
return $this->respond([
'status' => true,
'vehicle_id' => $vehicle_insert,
'owner_id' => $sanitized_post_data['owner'],
'owner_id' => $sanitized_post_data['owner'] ?? null,
'owner_branch_id' => $sanitized_post_data['branch_id'] ?? null,
'owner_type' => $sanitized_post_data['Owner_type'],
'owner_type' => $sanitized_post_data['Owner_type']?? null,
'vehicles' => $vehicles,
'message' => 'Vehicle created successfully
'
@ -6597,6 +6642,7 @@ class ClientController extends AdminController
// $response = $ticketServiceController->tpaClaimDumpImporter(["file_id" => 51]); //abhi
// $response = $ticketServiceController->tpaClaimDumpImporter(["file_id" => 48]); //vidal
// $response = $ticketServiceController->tpaClaimDumpImporter(["file_id" => 53]); //icici
// $response = $ticketServiceController->tpaClaimDumpImporter(["file_id" => 54]); //mediassist
// $response = $ticketServiceController->tpaClaimDumpToTicketMasterImporters(["file_id" => 48]);
// $response = $ticketServiceController->tpaClaimDumpToTicketMasterImporters(["file_id" => 48]);
// dd($response);
@ -6641,31 +6687,32 @@ class ClientController extends AdminController
$policyTransactionController = new PolicyTransactionController();
// $res = $policyTransactionController->validateInsurerStatement(['file_id' => '281']);
// $res = $policyTransactionController->updateInsurerStatement(['file_id' => '62']);
// dd('-----', $res);
// $res = $policyTransactionController->bdsDumpExcelFileFormatValidation(['file_id' => '73']);
// dd($res);
// ----------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';
@ -6720,6 +6767,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());

View File

@ -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;
}
}

View File

@ -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()
@ -841,6 +845,7 @@ class EmployeeController extends AdminController
{
$data = [];
$data['status'] = ['pending' => 'Pending', 'inprogress' => 'In-Progress', 'complete' => 'Complete'];
if (count($this->request->getGet())) {
$filterData = $this->request->getGet();
@ -850,9 +855,9 @@ class EmployeeController extends AdminController
status: $filterData['status'],
branch_id: $filterData['branch_id']
);
$data['getData'] = $filterData;
$data['getData'] = $filterData;
// echo "<pre>";
// print_r($data); die;
}
$this->myLogger->logme('error', 'list called');
@ -1108,7 +1113,39 @@ class EmployeeController extends AdminController
try {
$filePath = WRITEPATH . '/uploads/excel/' . $file_name['file_name'];
if (!$file_name) {
return $this->respond([
'dataStatus' => false,
'code' => 200,
'data' => '<div class="text-center">No Data Found</div>',
'file_data' => null
], 200);
}
$filePath = WRITEPATH . 'uploads/excel/' . $file_name['file_name'];
// ✅ File not exists on disk
if (!file_exists($filePath)) {
return $this->respond([
'dataStatus' => false,
'code' => 200,
'data' => '<div class="text-center">No Data Found</div>',
'file_data' => $file_name
], 200);
}
$excel_data = $empDataServiceController->readExcelFileToArray($filePath);
// ✅ Excel empty or header only
if (empty($excel_data) || count($excel_data) <= 1) {
return $this->respond([
'dataStatus' => false,
'code' => 200,
'data' => '<div class="text-center">No Data Found</div>',
'file_data' => $file_name
], 200);
}
if (file_exists($filePath)) {
@ -1144,8 +1181,7 @@ class EmployeeController extends AdminController
$errorMessage = 'Error occurred:' . PHP_EOL . json_encode($errorData, JSON_PRETTY_PRINT);
$this->myLogger->logme('error', $errorMessage);
$html = '<div class="text-center">No Data Found</div>';
return $this->respond(['dataStatus' => false, 'code' => 500, 'data' => $html, 'file_data' => $file_name], 500);
return $this->respond(['dataStatus' => false, 'code' => 500, 'data' => '<div class="text-center">Something went wrong</div>', 'file_data' => $file_name ?? null], 500);
}
}
@ -3035,12 +3071,12 @@ class EmployeeController extends AdminController
$request_post_data = $this->request->getPost();
$sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data);
$client_id = $sanitized_post_data['client_id'];
$branch_id = $sanitized_post_data['branch_id'];
$policy_id = $sanitized_post_data['client_policy_id'];
$selected_employees = (array)$sanitized_post_data['selected'];
$si_amt = $sanitized_post_data['si_amt'];
$policy_start_date_unformatted = $sanitized_post_data['policy_start_date'];
$client_id = $sanitized_post_data['client_id'] ?? null;
$branch_id = $sanitized_post_data['branch_id'] ?? null;
$policy_id = $sanitized_post_data['client_policy_id'] ?? null;
$selected_employees = (array)$sanitized_post_data['selected'] ?? [];
$si_amt = $sanitized_post_data['si_amt'] ?? null;
$policy_start_date_unformatted = $sanitized_post_data['policy_start_date'] ?? null;
$policy_start_date = change_date_format($policy_start_date_unformatted, 'd/M/Y', 'Y-m-d');
@ -3079,7 +3115,7 @@ class EmployeeController extends AdminController
public function unmapEmployees($actionType){
$request_post_data = $this->request->getPost();
$sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data);
$selected_employees = (array)$sanitized_post_data['selected'];
$selected_employees = (array)$sanitized_post_data['selected'] ?? [];
if($actionType == 0){
for($i = 0;$i<count($selected_employees);$i++){log_message('error',$selected_employees[$i]);
$result1 = $this->employeeModel->set(['client_id' => null, 'client_branch_id' => null])->where('id',$selected_employees[$i])->update();log_message('error',$result1);
@ -4421,6 +4457,133 @@ class EmployeeController extends AdminController
$this->myLogger->logme('error', "$log_search_context". "END Batch {$batch_no}");
}
public function visitOffBoardCheck()
{
$params = [
"memberIds" => ["adi_1034292323", "EMPENHANCE-M1", "EMPENHANCE-M3"],
// "policyNumber" => "570000/48/2026/290",
"policyNumber" => "09823428509239",
"source" => "NHANCE"
];
print_rr($this->visitOffBoard($params));
}
/**
* Executes the Delete Policy API call.
*
* @param array $params Contains 'memberIds', 'policyNumber', and 'source'.
* @return array
*/
public function visitOffBoard(array $params)
{
// 1. Load credentials from .env
$apiUrl = env('WELLNESS_ONBOARD_ENDPOINT_URL');
$apiToken = env('WELLNESS_ONBOARD_AUTHORIZATION');
// 2. Initialize the CI4 CURL service
$client = \Config\Services::curlrequest([
'base_uri' => $apiUrl,
'timeout' => 30,
]);
// $client = Services::curlrequest([
// 'base_uri' => $apiUrl,
// 'timeout' => 30,
// ]);
$params['source'] = 'NHANCE';
try {
// Log the start of the request for traceability
$this->myLogger->logme('error', 'VISIT_OFFBOARD: ' . ($params['policyNumber'] ?? 'N/A'));
// 3. Perform the POST request
$response = $client->request('POST', '', [
'headers' => [
'Authorization' => 'JWT ' . $apiToken,
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'memberIds' => $params['memberIds'] ?? [],
'policyNumber' => $params['policyNumber'] ?? '',
'source' => $params['source'] ?? '',
],
'http_errors' => false, // Prevents throwing exceptions on 4xx/5xx responses
]);
$statusCode = $response->getStatusCode();
$rawBody = $response->getBody();
$result = json_decode($rawBody, true);
// 4. Handle based on HTTP Status Code
if ($statusCode >= 200 && $statusCode < 300) {
$this->myLogger->logme('error', "VISIT_OFFBOARD API Success (Code $statusCode): Policy deleted.");
return [
'status' => true,
'data' => $result
];
}
// Log API-level errors (4xx or 5xx)
$this->myLogger->logme('error', "VISIT_OFFBOARD API Failure (Code $statusCode): " . json_encode($rawBody));
return [
'status' => false,
'message' => 'The API returned an error response.',
'code' => $statusCode,
'details' => $result
];
} catch (\Exception $e) {
// 5. Catch network or system exceptions
$this->myLogger->logme('error', 'VISIT_OFFBOARD API Exception: ' . $e->getMessage());
return [
'status' => false,
'message' => 'A critical error occurred while contacting the API.',
'error' => $e->getMessage()
];
}
}
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);
}
}

View File

@ -2305,8 +2305,32 @@ 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 ')
$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 round(sum(rata_premimum + gst))
from employee_polices
where is_active = 1
and status = $emp_policy_status
and client_policy_id = client_policy_id
) as total_premium
")
->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 +2467,12 @@ 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)
->groupBy('display_name')
->findAll();
$data['ticket_type'] = [
["ticket_type" => "1", "type_name" => "Claim-GMC"],
["ticket_type" => "2", "type_name" => "Claim-GPA"],
@ -2463,7 +2492,8 @@ class EmployeeRestController extends AdminController
$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 +2504,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 +2520,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 +2609,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 +5350,18 @@ 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();
return $claim_status_data_id;
}
}

View File

@ -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']

View File

@ -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');

View File

@ -322,13 +322,13 @@ class MasterController extends AdminController
$data = $this->request->getPost();
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
$insert_data['addition_add_day'] = (!empty($sanitized_post_data['addition_add_day'])) ? 1 : 0;
$insert_data['deletion_add_day'] = (!empty($sanitized_post_data['deletion_add_day'])) ? 1 : 0;
$insert_data['is_multi_event'] = (!empty($sanitized_post_data['is_multi_event'])) ? 1 : 0;
$insert_data['created_by'] = get_session_userid();
$insert_data['insurer_logo'] = $file_name;
$sanitized_post_data['addition_add_day'] = (!empty($sanitized_post_data['addition_add_day'])) ? 1 : 0;
$sanitized_post_data['deletion_add_day'] = (!empty($sanitized_post_data['deletion_add_day'])) ? 1 : 0;
$sanitized_post_data['is_multi_event'] = (!empty($sanitized_post_data['is_multi_event'])) ? 1 : 0;
$sanitized_post_data['created_by'] = get_session_userid();
$sanitized_post_data['insurer_logo'] = $file_name;
$insert = $this->insurerModel->insert($insert_data);
$insert = $this->insurerModel->insert($sanitized_post_data);
if($insert){
$insurer_data = $this->insurerModel->where(['id' => $insert, 'is_active' => 1])->first();
@ -455,10 +455,10 @@ class MasterController extends AdminController
'contact_type' => 'insurer',
'ref_id' => $insert,
'created_by' => get_session_userid(),
'name' => $sanitized_post_data['name'][$i],
'email' => $sanitized_post_data['email'][$i],
'mobile' => $sanitized_post_data['mobile'][$i],
'designation' => $sanitized_post_data['designation'][$i]
'name' => $sanitized_post_data['name'][$i] ?? null,
'email' => $sanitized_post_data['email'][$i] ?? null,
'mobile' => $sanitized_post_data['mobile'][$i] ?? null,
'designation' => $sanitized_post_data['designation'][$i] ?? null
];
$contacts = $this->levelContactModel->insert($sanitized_post_data_for_level);
}
@ -537,19 +537,19 @@ class MasterController extends AdminController
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
$id = $sanitized_post_data['PrimaryKey'];
$update_data['addition_add_day'] = (!empty($sanitized_post_data['addition_add_day'])) ? 1 : 0;
$update_data['deletion_add_day'] = (!empty($sanitized_post_data['deletion_add_day'])) ? 1 : 0;
$update_data['is_multi_event'] = (!empty($sanitized_post_data['is_multi_event'])) ? 1 : 0;
$update_data['updated_by'] = get_session_userid();
$sanitized_post_data['addition_add_day'] = (!empty($sanitized_post_data['addition_add_day'])) ? 1 : 0;
$sanitized_post_data['deletion_add_day'] = (!empty($sanitized_post_data['deletion_add_day'])) ? 1 : 0;
$sanitized_post_data['is_multi_event'] = (!empty($sanitized_post_data['is_multi_event'])) ? 1 : 0;
$sanitized_post_data['updated_by'] = get_session_userid();
if(!empty($file_name)){
$update_data['insurer_logo'] = $file_name;
$sanitized_post_data['insurer_logo'] = $file_name;
}
$update = $this->insurerModel->update($id,$update_data);
$update = $this->insurerModel->update($id,$sanitized_post_data);
if($update){
echo json_encode(array("status" => true , 'data' => $data));
echo json_encode(array("status" => true , 'data' => $sanitized_post_data));
}else{
echo json_encode(array("status" => false));
}
@ -673,7 +673,7 @@ class MasterController extends AdminController
}
$data = $this->request->getPost();
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
$id = $sanitized_post_data['PrimaryKey'];
$id = $sanitized_post_data['PrimaryKey'] ?? null;
$update = $this->insurerBranchModel->update($id, $sanitized_post_data);
if($update){
@ -687,11 +687,11 @@ class MasterController extends AdminController
'contact_type' => 'insurer',
'ref_id' => $id,
'created_by' => get_session_userid(),
'name' => $sanitized_post_data['name'][$i],
'email' => $sanitized_post_data['email'][$i],
'mobile' => $sanitized_post_data['mobile'][$i],
'designation' => $sanitized_post_data['designation'][$i]
];
'name' => $sanitized_post_data['name'][$i] ?? null,
'email' => $sanitized_post_data['email'][$i] ?? null,
'mobile' => $sanitized_post_data['mobile'][$i] ?? null,
'designation' => $sanitized_post_data['designation'][$i] ?? null
];
$contacts = $this->levelContactModel->insert($sanitized_post_data_for_level);
}
}
@ -922,16 +922,16 @@ class MasterController extends AdminController
$eCardTemplate = $sanitized_post_data['ecard_content'];
$insert_data['created_by'] = get_session_userid();
$insert_data['tpa_logo'] = $file_name;
$insert_data['front_card'] = $front_card_file_name;
$insert_data['back_card'] = $back_card_file_name;
$insert_data['network_hospitals'] = $sanitized_post_data['network_hospitals'];
$sanitized_post_data['created_by'] = get_session_userid();
$sanitized_post_data['tpa_logo'] = $file_name;
$sanitized_post_data['front_card'] = $front_card_file_name;
$sanitized_post_data['back_card'] = $back_card_file_name;
$sanitized_post_data['network_hospitals'] = $sanitized_post_data['network_hospitals'];
$insert = $this->tpaModel->insert($insert_data);
$insert = $this->tpaModel->insert($sanitized_post_data);
$tpa_name = (string) $sanitized_post_data['name'];
$short_name = (string) $sanitized_post_data['short_name'];
$tpa_name = ((string) $sanitized_post_data['name']) ?? null;
$short_name = ((string) $sanitized_post_data['short_name']) ?? null;
$filename = strtolower(str_replace(' ', '_', $short_name)) . '.html';
$file_directory = WRITEPATH . 'e_card_template/';
@ -1080,10 +1080,10 @@ class MasterController extends AdminController
'contact_type' => 'tpa',
'ref_id' => $insert,
'created_by' => get_session_userid(),
'name' => $sanitized_post_data['name'][$i],
'email' => $sanitized_post_data['email'][$i],
'mobile' => $sanitized_post_data['mobile'][$i],
'designation' => $sanitized_post_data['designation'][$i]
'name' => $sanitized_post_data['name'][$i] ?? null,
'email' => $sanitized_post_data['email'][$i] ?? null,
'mobile' => $sanitized_post_data['mobile'][$i] ?? null,
'designation' => $sanitized_post_data['designation'][$i] ?? null
];
$contacts = $this->levelContactModel->insert($sanitized_post_data_for_level);
}
@ -1209,29 +1209,29 @@ class MasterController extends AdminController
$front_card_file_name = file_Upload($this->request->getFile('fc'), $template_bg_path);
$back_card_file_name = file_Upload($this->request->getFile('bc'), $template_bg_path);
$id = $sanitized_post_data['PrimaryKey'];
$id = $sanitized_post_data['PrimaryKey'] ?? null;
$update_data['updated_by'] = get_session_userid();
$sanitized_post_data['updated_by'] = get_session_userid();
if(!empty($file_name)){
$update_data['tpa_logo'] = $file_name;
$sanitized_post_data['tpa_logo'] = $file_name;
}
if(!empty($front_card_file_name)){
$update_data['front_card'] = $front_card_file_name;
$sanitized_post_data['front_card'] = $front_card_file_name;
}
if(!empty($back_card_file_name)){
$update_data['back_card'] = $back_card_file_name;
$sanitized_post_data['back_card'] = $back_card_file_name;
}
$update_data['network_hospitals'] = $sanitized_post_data['network_hospitals'];
$update = $this->tpaModel->update($id,$update_data);
$sanitized_post_data['network_hospitals'] = $sanitized_post_data['network_hospitals'] ?? null;
$update = $this->tpaModel->update($id,$sanitized_post_data);
$tpa_name = (string) $sanitized_post_data['name'];
$short_name = (string) $sanitized_post_data['short_name'];
$eCardTemplate = $sanitized_post_data['ecard_content'];
$tpa_name = ((string) $sanitized_post_data['name']) ?? null;
$short_name = ((string) $sanitized_post_data['short_name']) ?? null;
$eCardTemplate = $sanitized_post_data['ecard_content'] ?? null;
$filename = strtolower(str_replace(' ', '_', $short_name)) . '.html';
$file_directory = WRITEPATH . 'e_card_template/';
@ -1258,7 +1258,7 @@ class MasterController extends AdminController
if($update){
echo json_encode(array("status" => true , 'data' => $update_data));
echo json_encode(array("status" => true , 'data' => $sanitized_post_data));
}else{
echo json_encode(array("status" => false));
}
@ -1383,7 +1383,7 @@ class MasterController extends AdminController
}
$data = $this->request->getPost();
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
$id = $sanitized_post_data['PrimaryKey'];
$id = $sanitized_post_data['PrimaryKey'] ?? null;
$update = $this->tpaBranchModel->update($id, $sanitized_post_data);
// print_r($this->request->getPost('name[]'));
@ -1402,10 +1402,10 @@ class MasterController extends AdminController
'contact_type' => 'tpa',
'ref_id' => $id,
'created_by' => get_session_userid(),
'name' => $sanitized_post_data['name'][$i],
'email' => $sanitized_post_data['email'][$i],
'mobile' => $sanitized_post_data['mobile'][$i],
'designation' => $sanitized_post_data['designation'][$i]
'name' => $sanitized_post_data['name'][$i] ?? null,
'email' => $sanitized_post_data['email'][$i] ?? null,
'mobile' => $sanitized_post_data['mobile'][$i] ?? null,
'designation' => $sanitized_post_data['designation'][$i] ?? null
];
$contacts = $this->levelContactModel->insert($sanitized_post_data_for_level);
}
@ -1644,7 +1644,7 @@ class MasterController extends AdminController
$data = $this->request->getPost();
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
$id = $sanitized_post_data['PrimaryKey'];
$id = $sanitized_post_data['PrimaryKey'] ?? null;
$sanitized_post_data['updated_by'] = get_session_userid();
$update = $this->kycEntityTypeModel->update($id,$sanitized_post_data);
if($update){
@ -1995,7 +1995,7 @@ class MasterController extends AdminController
$data = $this->request->getPost();
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
$id = $sanitized_post_data['PrimaryKey'];
$id = $sanitized_post_data['PrimaryKey'] ?? null;
$sanitized_post_data['updated_by'] = get_session_userid();
$update = $this->policyTypeModel->update($id,$sanitized_post_data);
if($update){
@ -2048,8 +2048,10 @@ class MasterController extends AdminController
public function editPolicies()
{
$this->myLogger->logme('error','edit Policy general info function called');
$id = $this->request->getPost('PrimaryKey');
$data = $this->request->getPost();
$request_post_data = $this->request->getPost();
$data = sanitizeInputArrayAdvanced($request_post_data);
$id = $data['PrimaryKey'] ?? null;
$data['updated_by'] = get_session_userid();
$update = $this->policesModel->update($id,$data);
if($update){
@ -2196,10 +2198,10 @@ class MasterController extends AdminController
// CD Account Details
// ======================
'opening_date' => [
'rules' => 'required|valid_date[Y-m-d]',
'rules' => 'required|valid_date[d-m-Y]',
'errors' => [
'required' => 'Opening date is required',
'valid_date' => 'Opening date must be in YYYY-MM-DD format'
'valid_date' => 'Opening date must be in DD-MM-YYYY format'
]
],
@ -2259,13 +2261,13 @@ class MasterController extends AdminController
if ($insert) {
$cd_tranction_data = [
'amount' => $sanitized_post_data['opening_bal'],
'amount' => $sanitized_post_data['opening_bal'] ?? null,
'sub_type_id' => 7,
'client_id' => $sanitized_post_data['client_id'],
'client_id' => $sanitized_post_data['client_id'] ?? null,
'client_policy_id' => null,
'cd_ac_no' => $sanitized_post_data['cd_ac_no'],
'cd_ac_no' => $sanitized_post_data['cd_ac_no'] ?? null,
'endorsement_no' => null,
'insurer_id' => $sanitized_post_data['insurer_id'],
'insurer_id' => $sanitized_post_data['insurer_id'] ?? null,
'description' => 'Opening Amount',
'transaction_type' => 'Credit',
'event_name' => null,
@ -2377,10 +2379,10 @@ class MasterController extends AdminController
// CD Account Details
// ======================
'opening_date' => [
'rules' => 'required|valid_date[Y-m-d]',
'rules' => 'required|valid_date[d-m-Y]',
'errors' => [
'required' => 'Opening date is required',
'valid_date' => 'Opening date must be in YYYY-MM-DD format'
'valid_date' => 'Opening date must be in DD-MM-YYYY format'
]
],
@ -2410,8 +2412,8 @@ class MasterController extends AdminController
}
$data = $this->request->getPost();
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
$id = $sanitized_post_data['PrimaryKey'];
$date = (string) $sanitized_post_data['opening_date'];
$id = $sanitized_post_data['PrimaryKey'] ?? null;
$date = ((string) $sanitized_post_data['opening_date']) ?? null;
$sanitized_post_data['opening_date'] = date('Y-m-d', strtotime($date));
if ($data) {
@ -2713,11 +2715,11 @@ class MasterController extends AdminController
$fetch_data = [
'insurer_id' => $sanitized_post_data['insurer_id'],
'policy_type_id' => $sanitized_post_data['policy_type'],
'event_name' => $sanitized_post_data['event'],
'insurer_id' => $sanitized_post_data['insurer_id'] ?? null ,
'policy_type_id' => $sanitized_post_data['policy_type'] ?? null,
'event_name' => $sanitized_post_data['event'] ?? null,
'type_name' => 'export',
'jsoncolumns' => $sanitized_post_data['json_data'],
'jsoncolumns' => $sanitized_post_data['json_data'] ?? null,
'is_active' => 1,
'created_by' => get_session_userid(),
];

View File

@ -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');

View File

@ -309,7 +309,7 @@
'format' => null,
'allowed_values' => null,
'custom' => 'check_agent_exist',
'params' => ['row', 'agent_data']
'params' => ['row', 'pos_data']
],
'base_premium' => [
@ -4944,6 +4944,7 @@
$pt_data = $this->policyTransactionModel->where('is_active', 1)->findAll();
$user_data = $this->userModel->where('is_active', 1)->findAll();
$agent_data = db_connect()->table('partner_agent')->where('is_active', 1)->get()->getResultArray();
$pos_data = db_connect()->table('partner_pos')->where('is_active', 1)->get()->getResultArray();
$rto_master = db_connect()->table('rto_master')->where('is_active', 1)->get()->getResultArray();
$vehicle_type = db_connect()->table('vehicle_type')->where('is_active', 1)->get()->getResultArray();
$nhance_branch_data = db_connect()->table('nhance_branch')->where('is_active', 1)->get()->getResultArray();
@ -5109,6 +5110,7 @@
$vehicle_data = $this->vehicleModel->where('is_active', 1)->findAll();
$user_data = $this->userModel->where('is_active', 1)->findAll();
$agent_data = db_connect()->table('partner_agent')->where('is_active', 1)->get()->getResultArray();
$pos_data = db_connect()->table('partner_pos')->where('is_active', 1)->get()->getResultArray();
$rto_master = db_connect()->table('rto_master')->where('is_active', 1)->get()->getResultArray();
$vehicle_type_data = db_connect()->table('vehicle_type')->where('is_active', 1)->get()->getResultArray();
$nhance_branch_data = db_connect()->table('nhance_branch')->where('is_active', 1)->get()->getResultArray();
@ -5191,7 +5193,8 @@
$current_insurer_branch_data = check_insurer_branch_exist($row, $insurer_branch_data, $current_insurer_data)['branch'] ?? null;
$current_nhance_branch = check_nhance_branch($row, $nhance_branch_data)['branch'] ?? null;
$current_agent_data = check_agent_exist($row, $agent_data)['agent'] ?? null;
// $current_agent_data = check_agent_exist($row, $agent_data)['agent'] ?? null;
$current_agent_data = check_agent_exist($row, $pos_data)['agent'] ?? null;
$salse = check_user_exist($row, 13, $user_data)['user'] ?? null;
$service = check_user_exist($row, 14, $user_data)['user'] ?? null;
@ -5229,8 +5232,9 @@
'salse_person_manager_id' => $salse['rm_id'] ?? null,
'service_person_manager_id' => $service['rm_id'] ?? null,
'service_person_branch_id' => $service['nhance_branch_id'] ?? null,
'agent_id' => $current_agent_data['id'] ?? null,
'agent_code' => $current_agent_data['agent_code'] ?? null,
// 'agent_id' => $current_agent_data['id'] ?? null,
// 'agent_code' => $current_agent_data['agent_code'] ?? null,
'pos_id' => $current_agent_data['id'] ?? null,
'file_id' => $params['file_id'],
'endorsement_no' => null,
'client_branch_id' => null,

View File

@ -424,7 +424,6 @@ class TicketController extends BaseController
return $this->loadLayout('ticket_search', $data);
} else {
$isFromDashboard = $this->request->getPost("is_dashboard");
log_message('error', 'Is From Dashboard: ' . $isFromDashboard);
@ -446,7 +445,6 @@ class TicketController extends BaseController
}
$data['claim_status'] = $this->claimStatus->select('id,ticket_type,claim_status')->where('is_active', 1)->findAll();
$data['client_list'] = $this->clientModel->select('id,client_name')->where('is_active', 1)->findAll();
// dd($data);
return $this->loadLayout('ticket_search', $data);
}

View File

@ -23,11 +23,11 @@ class AuthMVC implements FilterInterface
// }
// Fingerprint validation
$fp = generateFingerprint();
// log_message('error',$fp);
if (session()->get('fingerprint') !== $fp) {
return AuthLogout::logout();
}
// $fp = generateFingerprint();
// // log_message('error',$fp);
// if (session()->get('fingerprint') !== $fp) {
// return AuthLogout::logout();
// }
}

View File

@ -3149,7 +3149,7 @@ if (!function_exists('check_agent_exist')) {
// Loop agent data from DB
foreach ($agent_data as $agent) {
// Assuming DB keys: agent_code
if (isset($agent['agent_code']) && $agent['agent_code'] == $agent_code) {
if (isset($agent['pos_code']) && (strtolower($agent['pos_code']) == strtolower($agent_code))) {
return [
'status' => true,
'error' => null,
@ -3173,6 +3173,24 @@ 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}$/';
if (preg_match($bhPattern, $vehicle_no)) {
return [
'status' => true,
'error' => null,
'rto_data' => []
];
}
if($new_vehicle == "new"){
return [
'status' => true,

View File

@ -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;

View File

@ -640,6 +640,8 @@ if (!function_exists('change_date_format')) {
'd/m/Y', // 01/01/2025
'd-m-Y', // 01-01-2025
'm/d/Y h:i:s A', // 01-01-2025
'm/d/Y', // 25-05-2025
];
@ -1099,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');
}
}

View File

@ -82,7 +82,6 @@ class AbhiClaimImportService extends BaseTpaClaimImportService
["excel_column" => ["col_name" => "CORPORATE_EMPLOYEE_CODE", "col_index" => 63], "db_column" => "corporate_employee_code"],
];
protected $ticketMasterMapping = [
// Employee / Member details
@ -115,19 +114,31 @@ class AbhiClaimImportService extends BaseTpaClaimImportService
// Misc
'diagnosis' => 'claim_description',
'healthcard_id' => 'tpa_no',
'priority' => 1,
'mode_of_intimation' => 5,
'ticket_type_id' => 1,
];
protected $statusMapping = [
'Settled' => 11,
'Rejected' => 8,
'Cancelled' => 13,
];
protected $dateColumns = [
'policy_from',
'policy_upto',
'intimation_date',
'date_of_doc_rec',
'doa',
'dod',
'repudiation_date',
'settled_date',
'expected_doa',
'expected_dod',
];
/**
* ABSTRACT FUNCTIONs
@ -215,14 +226,13 @@ class AbhiClaimImportService extends BaseTpaClaimImportService
$dbColumn = $map['db_column'];
$value = $row[$excelColumn] ?? null;
if ($this->isDateValue($value)) {
$value = $this->normalizeDate($value);
}
$item[$dbColumn] = trim($value);
}
foreach ($this->dateColumns as $key => $value) {
$item[$value] = change_date_format($item[$value] ?? null, 'm/d/Y h:i:s A', 'Y-m-d');
}
$params = [
'doa' => $item['doa'] ?? null,
'member_code' => $item['member_code'] ?? null,
@ -346,6 +356,10 @@ class AbhiClaimImportService extends BaseTpaClaimImportService
$item['claim_dump_ref_id'] = $row['id'];
$item['created_by'] = $file_data['created_by'] ?? null;
$item['claim_type'] = isset($row['mainclaim_prepost_type']) && !empty($row['mainclaim_prepost_type']) && strtolower($row['mainclaim_prepost_type']) == 'normal' ? 1 : 3;
$item['priority'] = 1;
$item['mode_of_intimation'] = 5;
$item['ticket_type_id'] = 1;
$mapped[] = $item;
}

View File

@ -4,8 +4,6 @@ namespace App\Libraries\TPAClaimsImportServices;
use App\Models\TicketMasterModel;
use App\Models\ClientPolicyModel;
use App\Models\ClientRMModel;
use App\Models\EmployeeModel;
use App\Models\ClaimDumpFileModel;
use App\Models\ClaimsDumpFhplModel;
@ -140,39 +138,45 @@ class FhplClaimImportService extends BaseTpaClaimImportService
protected $ticketMasterMapping = [
// Employee / Member details
'member_code' => 'emp_code',
'relation' => 'relationship',
// Claim / Reference
'claim_id' => 'claim_number',
// Policy / Claim identifiers
'policy_number' => 'policy_no',
'certificate_no' => 'claim_number',
'abhi_claim_no' => 'tpa_claim_id',
// Policy
'policy_no' => 'policy_no',
// Dates
'doa' => 'doa',
'dod' => 'dod',
'intimation_date' => 'date_of_intimat',
// Employee / Member
'employee_id' => 'emp_code',
'relationship' => 'relationship',
// Claim info
'claim_type' => 'claim_type',
'claim_status' => 'tpa_claim_status',
'claimed_amount' => 'claim_amount',
'abhi_amount_less_coins_current_month' => 'approved_amount',
// Claim Dates
'admission_date' => 'doa',
'discharge_date' => 'dod',
'claim_received_date' => 'date_of_intimat',
'claim_passed_date' => 'approved_date',
'settled_date' => 'settled_date',
// Hospital details
'hospital_name' => 'hospital_name',
'hospital_city' => 'hospital_city',
'hospital_state' => 'hospital_state',
'current_claim_status' => 'tpa_claim_status',
// Settlement / decision
'repudiation_date' => 'denial_date',
'settled_date' => 'settled_date',
'rejection_category' => 'denial_reason',
// Amounts
'claim_amount' => 'claim_amount',
'settled_amount' => 'settled_amount',
'disallowed_amount' => 'denial_reason',
'coverage_amount' => 'si_amt',
// Misc
'diagnosis' => 'claim_description',
'healthcard_id' => 'tpa_no',
// Hospital
'provider_name' => 'hospital_name',
'provider_address' => 'hospital_address',
'provider_state' => 'hospital_state',
'provider_place' => 'hospital_city',
'provider_pincode' => 'hospital_pin_code',
// Remarks / Description
'diagnosis' => 'claim_description',
'rejection_remarks' => 'return_remark',
// Payment
'cheque_no' => 'utr_details',
'uhid_no' => 'tpa_no',
'priority' => 1,
'mode_of_intimation' => 5,
@ -184,6 +188,33 @@ class FhplClaimImportService extends BaseTpaClaimImportService
'Rejected' => 8,
];
protected $dateColumns = [
'intimation_date',
'policy_start_date',
'policy_commencing_date',
'policy_expiry_date',
'claim_received_date',
'admission_date',
'discharge_date',
'cheque_date',
'claim_passed_date',
'settled_date',
'ir_date',
'ir_retrieval_date',
'first_reminder',
'second_reminder',
'date_of_joining',
'nidb_removed_date',
'investigation_date',
'investigation_retrieval_date',
'reopened_date',
'refer_to_insurer_date',
'received_date_from_insurer',
'claim_created_datetime',
'last_modified_date'
];
/**
* ABSTRACT FUNCTIONs
*/
@ -260,27 +291,26 @@ class FhplClaimImportService extends BaseTpaClaimImportService
$dbColumn = $map['db_column'];
$value = $row[$excelColumn] ?? null;
if ($this->isDateValue($value)) {
$value = $this->normalizeDate($value);
}
$item[$dbColumn] = trim($value);
}
// $params = [
// 'admission_date' => change_date_format($item['admission_date'] ?? '') ?? null,
// 'employee_number' => $item['employee_number'] ?? null,
// 'claim_amount' => $item['claim_amount'] ?? null,
// 'primary_policy_holder_card_id' => $item['primary_policy_holder_card_id'] ?? null
// ];
foreach ($this->dateColumns as $key => $value) {
$item[$value] = change_date_format($item[$value] ?? null, 'd-M-y', 'Y-m-d');
}
// $is_duplicate = $this->checkDuplicateTpaClaim('claims_dump_fhpl', $params);
$params = [
'admission_date' => $item['admission_date'] ?? null,
'employee_id' => $item['employee_id'] ?? null,
'claim_amount' => $item['claim_amount'] ?? null,
'uhid_no' => $item['uhid_no'] ?? null
];
// if ($is_duplicate) {
// $item = [];
// continue;
// }
$is_duplicate = $this->checkDuplicateTpaClaim('claims_dump_fhpl', $params);
if ($is_duplicate) {
$item = [];
continue;
}
$item['file_id'] = $file_id ?? null;
$item['client_id'] = $file_data['client_id'] ?? null;
@ -332,10 +362,10 @@ class FhplClaimImportService extends BaseTpaClaimImportService
foreach ($tpaClaimDumpData as $row) {
$params = [
'doa' => change_date_format($row['date_of_admission'] ?? '') ?? null,
'emp_code' => $row['employee_number'] ?? null,
'doa' => change_date_format($row['admission_date'] ?? '') ?? null,
'emp_code' => $row['employee_id'] ?? null,
'claim_amount' => $row['claim_amount'] ?? null,
'tpa_no' => $row['primary_policy_holder_card_id'] ?? null
'tpa_no' => $row['uhid_no'] ?? null
];
$isduplicate = $this->checkDublicateTicketMasterClaim($params);
@ -354,9 +384,9 @@ class FhplClaimImportService extends BaseTpaClaimImportService
$item['tpa_id'] = $client_policy_data['tpa_id'] ?? null;
$item['acm_id'] = $client_policy_data['acm_id'] ?? null;
$item['policy_no'] = $client_policy_data['policy_no'] ?? null;
$item['relationship'] = $this->convertRelation($row['relation'] ?? null, $row['gender'] ?? null);
$item['relationship'] = $this->convertRelation($row['relationship'] ?? null);
$employee_data = $this->getEmployeeDetails($file_data['client_id'], $file_data['client_policy_id'], $row['employee_number'], $item['relationship']);
$employee_data = $this->getEmployeeDetails($file_data['client_id'], $file_data['client_policy_id'], $row['employee_id'], $item['relationship']);
if (!empty($employee_data)) {
$item['emp_id'] = $employee_data['id'] ?? null;
@ -390,7 +420,10 @@ class FhplClaimImportService extends BaseTpaClaimImportService
$item['file_id'] = $file_id;
$item['claim_dump_ref_id'] = $row['id'];
$item['created_by'] = $file_data['created_by'] ?? null;
$item['claim_type'] = isset($row['mainclaim_prepost_type']) && !empty($row['mainclaim_prepost_type']) && strtolower($row['mainclaim_prepost_type']) == 'normal' ? 1 : 3;
$item['claim_type'] = 1;
$item['priority'] = 1;
$item['mode_of_intimation'] = 5;
$item['ticket_type_id'] = 1;
$mapped[] = $item;
}
@ -419,83 +452,47 @@ class FhplClaimImportService extends BaseTpaClaimImportService
* HELPER FUNCTIONs
*/
public function isDateValue($value): bool
{
if (empty($value)) {
return false;
}
// Excel numeric date (e.g. 44927)
if (is_numeric($value) && $value > 30000) {
return true;
}
// Common date formats
return preg_match(
'/^\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}$|^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/',
(string) $value
) === 1;
}
public function normalizeDate($value): ?string
{
try {
// Excel numeric date
if (is_numeric($value)) {
return date('Y-m-d', \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($value));
}
// String date
return date('Y-m-d', strtotime(str_replace('/', '-', $value)));
} catch (\Throwable $e) {
return null;
}
}
public function convertRelation(string $relation, string $gender): ?string
public function convertRelation(?string $relation): ?string
{
if (empty($relation)) {
return null;
}
$relation = strtolower($relation);
$gender = strtolower($gender);
if ($relation == 'self') {
return $relation;
if (str_contains($relation, 'self')) {
return 'self';
}
if ($relation == 'spouse') {
return $relation;
if (str_contains($relation, 'spouse') || str_contains($relation, 'wife') || str_contains($relation, 'husband')) {
return 'spouse';
}
if ($relation == 'child' && $gender == 'male') {
return 'son';
}
if ($relation == 'child' && $gender == 'female') {
if (str_contains($relation, 'daughter')) {
return 'daughter';
}
if ($relation == 'parents' && $gender == 'male') {
return 'father';
if (str_contains($relation, 'son')) {
return 'son';
}
if ($relation == 'parents' && $gender == 'female') {
return 'mother';
}
if ($relation == 'parents-in-law' && $gender == 'male') {
if (str_contains($relation, 'father in law') || str_contains($relation, 'father-in-law')) {
return 'father-in-law';
}
if ($relation == 'parents-in-law' && $gender == 'female') {
if (str_contains($relation, 'mother in law') || str_contains($relation, 'mother-in-law')) {
return 'mother-in-law';
}
return null;
if (str_contains($relation, 'father')) {
return 'father';
}
if (str_contains($relation, 'mother')) {
return 'mother';
}
return null; // unmatched case
}

View File

@ -99,7 +99,7 @@ class IciciClaimImportService extends BaseTpaClaimImportService
'hospital_state' => 'hospital_state',
'cheque_number' => 'utr_details',
'tpa_no' => 'uhid',
'uhid' => 'tpa_no',
'rejected_query_desc' => 'claim_description',
];
@ -108,6 +108,23 @@ class IciciClaimImportService extends BaseTpaClaimImportService
'REJECTED' => 8,
];
protected $dateColumns = [
'policy_start_date',
'policy_end_date',
'dt_of_deficiencies_sent',
'dt_of_deficiencies_received',
'payment_date',
'doa',
'dod',
'rejected_query_closed_date',
'rejreopen_closure_date',
];
/**
* ABSTRACT FUNCTIONs
@ -203,14 +220,13 @@ class IciciClaimImportService extends BaseTpaClaimImportService
$dbColumn = $map['db_column'];
$value = $row[$excelColumn] ?? null;
if ($this->isDateValue($value)) {
$value = $this->normalizeDate($value);
}
$item[$dbColumn] = $value;
}
foreach ($this->dateColumns as $key => $value) {
$item[$value] = change_date_format($item[$value] ?? null);
}
$params = [
'doa' => change_date_format($item['doa'] ?? '') ?? null,
'employee_member_id' => $item['employee_member_id'] ?? null,
@ -297,9 +313,9 @@ class IciciClaimImportService extends BaseTpaClaimImportService
$item['tpa_id'] = $client_policy_data['tpa_id'] ?? null;
$item['acm_id'] = $client_policy_data['acm_id'] ?? null;
$item['policy_no'] = $client_policy_data['policy_no'] ?? null;
$item['relationship'] = strtolower($row['relation_group'] ?? '');
$item['relationship'] = $this->convertRelation($row['relation_group'] ?? '');
$employee_data = $this->getEmployeeDetails($file_data['client_id'], $file_data['client_policy_id'], $row['employee_number'], $item['relationship']);
$employee_data = $this->getEmployeeDetails($file_data['client_id'], $file_data['client_policy_id'], $row['employee_member_id'], $item['relationship']);
if (!empty($employee_data)) {
$item['emp_id'] = $employee_data['id'] ?? null;
@ -330,9 +346,13 @@ class IciciClaimImportService extends BaseTpaClaimImportService
// Meta fields
$item['claim_status_id'] = $statusMapping[$row['updated_status']] ?? 61;
$item['claim_dump_ref_id'] = $row['id'];
$item['file_id'] = $file_id;
$item['created_by'] = $file_data['created_by'] ?? null;
$item['claim_type'] = 1;
$item['priority'] = 1;
$item['mode_of_intimation'] = 5;
$item['ticket_type_id'] = 1;
$mapped[] = $item;
}
@ -361,83 +381,48 @@ class IciciClaimImportService extends BaseTpaClaimImportService
* HELPER FUNCTIONs
*/
public function isDateValue($value): bool
{
if (empty($value)) {
return false;
}
// Excel numeric date (e.g. 44927)
if (is_numeric($value) && $value > 30000) {
return true;
}
// Common date formats
return preg_match(
'/^\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}$|^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/',
(string) $value
) === 1;
}
public function normalizeDate($value): ?string
{
try {
// Excel numeric date
if (is_numeric($value)) {
return date('Y-m-d', \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($value));
}
// String date
return date('Y-m-d', strtotime(str_replace('/', '-', $value)));
} catch (\Throwable $e) {
return null;
}
}
public function convertRelation(string $relation, string $gender): ?string
public function convertRelation(?string $relation): ?string
{
if (empty($relation)) {
return null;
}
$relation = strtolower($relation);
$gender = strtolower($gender);
if ($relation == 'self') {
return $relation;
if (str_contains($relation, 'self')) {
return 'self';
}
if ($relation == 'spouse') {
return $relation;
if (str_contains($relation, 'spouse') || str_contains($relation, 'wife') || str_contains($relation, 'husband')) {
return 'spouse';
}
if ($relation == 'child' && $gender == 'male') {
return 'son';
}
if ($relation == 'child' && $gender == 'female') {
if (str_contains($relation, 'daughter')) {
return 'daughter';
}
if ($relation == 'parents' && $gender == 'male') {
return 'father';
if (str_contains($relation, 'son')) {
return 'son';
}
if ($relation == 'parents' && $gender == 'female') {
return 'mother';
}
if ($relation == 'parents-in-law' && $gender == 'male') {
if (str_contains($relation, 'father in law') || str_contains($relation, 'father-in-law')) {
return 'father-in-law';
}
if ($relation == 'parents-in-law' && $gender == 'female') {
if (str_contains($relation, 'mother in law') || str_contains($relation, 'mother-in-law')) {
return 'mother-in-law';
}
return null;
if (str_contains($relation, 'father')) {
return 'father';
}
if (str_contains($relation, 'mother')) {
return 'mother';
}
return null; // unmatched case
}

View File

@ -112,7 +112,6 @@ class MediAssistClaimImportService extends BaseTpaClaimImportService
["excel_column" => ["col_name" => "balance_sum_insured_exhausted", "col_index" => 93], "db_column" => "balance_sum_insured_exhausted"],
];
protected $ticketMasterMapping = [
// Employee / Beneficiary details
@ -121,12 +120,11 @@ class MediAssistClaimImportService extends BaseTpaClaimImportService
// Policy / Claim identifiers
'policy_no' => 'policy_no',
'claim_id' => 'tpa_claim_id',
'insurer_claim_ref_no' => 'tpa_no',
'claim_id' => 'claim_number',
'event_id' => 'tpa_no',
'claim_pre_auths' => 'tpa_claim_push_reference_no',
// Claim type & status
'claim_type' => 'claim_type',
'claim_status' => 'tpa_claim_status',
// Dates
@ -155,12 +153,8 @@ class MediAssistClaimImportService extends BaseTpaClaimImportService
// Payment
'utr_no' => 'utr_details',
'priority' => 1,
'mode_of_intimation' => 5,
'ticket_type_id' => 1,
];
protected $statusMapping = [
'Settled' => 11,
'Rejected' => 8,
@ -248,19 +242,14 @@ class MediAssistClaimImportService extends BaseTpaClaimImportService
$dbColumn = $map['db_column'];
$value = $row[$excelColumn] ?? null;
if ($this->isDateValue($value)) {
$value = $this->normalizeDate($value);
}
$item[$dbColumn] = $value;
}
$params = [
'date_of_admission' => change_date_format($item['date_of_admission'] ?? '') ?? null,
'employee_number' => $item['employee_number'] ?? null,
'pribenef_employee_code' => $item['pribenef_employee_code'] ?? null,
'claim_amount' => $item['claim_amount'] ?? null,
'primary_policy_holder_card_id' => $item['primary_policy_holder_card_id'] ?? null
'event_id' => $item['event_id'] ?? null
];
$is_duplicate = $this->checkDuplicateTpaClaim('claims_dump_medi_assist', $params);
@ -321,9 +310,9 @@ class MediAssistClaimImportService extends BaseTpaClaimImportService
$params = [
'doa' => change_date_format($row['date_of_admission'] ?? '') ?? null,
'emp_code' => $row['employee_number'] ?? null,
'emp_code' => $row['pribenef_employee_code'] ?? null,
'claim_amount' => $row['claim_amount'] ?? null,
'tpa_no' => $row['primary_policy_holder_card_id'] ?? null
'tpa_no' => $row['event_id'] ?? null
];
$isduplicate = $this->checkDublicateTicketMasterClaim($params);
@ -342,9 +331,9 @@ class MediAssistClaimImportService extends BaseTpaClaimImportService
$item['tpa_id'] = $client_policy_data['tpa_id'] ?? null;
$item['acm_id'] = $client_policy_data['acm_id'] ?? null;
$item['policy_no'] = $client_policy_data['policy_no'] ?? null;
$item['relationship'] = $this->convertRelation($row['relation'] ?? null, $row['gender'] ?? null);
$item['relationship'] = $this->convertRelation($row['benef_relation'] ?? null);
$employee_data = $this->getEmployeeDetails($file_data['client_id'], $file_data['client_policy_id'], $row['employee_number'], $item['relationship']);
$employee_data = $this->getEmployeeDetails($file_data['client_id'], $file_data['client_policy_id'], $row['pribenef_employee_code'], $item['relationship']);
if (!empty($employee_data)) {
$item['emp_id'] = $employee_data['id'] ?? null;
@ -378,7 +367,10 @@ class MediAssistClaimImportService extends BaseTpaClaimImportService
$item['file_id'] = $file_id;
$item['claim_status_id'] = $statusMapping[$row['claim_status']] ?? 61;
$item['created_by'] = $file_data['created_by'] ?? null;
$item['claim_type'] = isset($row['mainclaim_prepost_type']) && !empty($row['mainclaim_prepost_type']) && strtolower($row['mainclaim_prepost_type']) == 'normal' ? 1 : 3;
$item['claim_type'] = 1;
$item['priority'] = 1;
$item['mode_of_intimation'] = 5;
$item['ticket_type_id'] = 1;
$mapped[] = $item;
}
@ -407,85 +399,48 @@ class MediAssistClaimImportService extends BaseTpaClaimImportService
* HELPER FUNCTIONs
*/
public function isDateValue($value): bool
{
if (empty($value)) {
return false;
}
// Excel numeric date (e.g. 44927)
if (is_numeric($value) && $value > 30000) {
return true;
}
// Common date formats
return preg_match(
'/^\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}$|^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/',
(string) $value
) === 1;
}
public function normalizeDate($value): ?string
{
try {
// Excel numeric date
if (is_numeric($value)) {
return date('Y-m-d', \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($value));
}
// String date
return date('Y-m-d', strtotime(str_replace('/', '-', $value)));
} catch (\Throwable $e) {
return null;
}
}
public function convertRelation(string $relation, string $gender): ?string
public function convertRelation(?string $relation): ?string
{
if (empty($relation)) {
return null;
}
$relation = strtolower($relation);
$gender = strtolower($gender);
if ($relation == 'self') {
return $relation;
if (str_contains($relation, 'self')) {
return 'self';
}
if ($relation == 'spouse') {
return $relation;
if (str_contains($relation, 'spouse') || str_contains($relation, 'wife') || str_contains($relation, 'husband')) {
return 'spouse';
}
if ($relation == 'child' && $gender == 'male') {
return 'son';
}
if ($relation == 'child' && $gender == 'female') {
if (str_contains($relation, 'daughter')) {
return 'daughter';
}
if ($relation == 'parents' && $gender == 'male') {
return 'father';
if (str_contains($relation, 'son')) {
return 'son';
}
if ($relation == 'parents' && $gender == 'female') {
return 'mother';
}
if ($relation == 'parents-in-law' && $gender == 'male') {
if (str_contains($relation, 'father in law') || str_contains($relation, 'father-in-law')) {
return 'father-in-law';
}
if ($relation == 'parents-in-law' && $gender == 'female') {
if (str_contains($relation, 'mother in law') || str_contains($relation, 'mother-in-law')) {
return 'mother-in-law';
}
return null;
if (str_contains($relation, 'father')) {
return 'father';
}
if (str_contains($relation, 'mother')) {
return 'mother';
}
return null; // unmatched case
}
}

View File

@ -60,8 +60,6 @@ class RcareClaimImportService extends BaseTpaClaimImportService
// Employee / Member
'employee_member_id' => 'emp_code',
'insured_name' => 'insured_name',
'patient_name' => 'emp_name',
'relation' => 'relationship',
// Policy
@ -95,10 +93,6 @@ class RcareClaimImportService extends BaseTpaClaimImportService
// References
'cl_inward_no' => 'claim_number',
'priority' => 1,
'mode_of_intimation' => 5,
'ticket_type_id' => 1,
];
protected $statusMapping = [
@ -112,6 +106,17 @@ class RcareClaimImportService extends BaseTpaClaimImportService
'Cashless Document Awaited' => 3,
];
protected $dateColumns = [
'inward_date',
'policy_start_date',
'policy_end_date',
'doa_opd_treatment_from',
'dod_opd_treatment_to',
'approved_date',
'cheque_neft_date'
];
/**
* ABSTRACT FUNCTIONs
*/
@ -205,14 +210,13 @@ class RcareClaimImportService extends BaseTpaClaimImportService
$dbColumn = $map['db_column'];
$value = $row[$excelColumn] ?? null;
if ($this->isDateValue($value)) {
$value = $this->normalizeDate($value);
}
$item[$dbColumn] = $value;
}
foreach ($this->dateColumns as $key => $value) {
$item[$value] = change_date_format($item[$value] ?? null, 'd-M-y', 'Y-m-d');
}
$params = [
'doa_opd_treatment_from' => $item['doa_opd_treatment_from'] ?? null,
'employee_member_id' => $item['employee_member_id'] ?? null,
@ -299,7 +303,7 @@ class RcareClaimImportService extends BaseTpaClaimImportService
$item['tpa_id'] = $client_policy_data['tpa_id'] ?? null;
$item['acm_id'] = $client_policy_data['acm_id'] ?? null;
$item['policy_no'] = $client_policy_data['policy_no'] ?? null;
$item['relationship'] = $this->convertRelation($row['relation'] ?? null, $row['gender'] ?? null);
$item['relationship'] = $this->convertRelation($row['relation'] ?? null);
$employee_data = $this->getEmployeeDetails($file_data['client_id'], $file_data['client_policy_id'], $row['employee_member_id'], $item['relationship']);
@ -334,7 +338,12 @@ class RcareClaimImportService extends BaseTpaClaimImportService
$item['claim_status_id'] = $statusMapping[$row['final_status']] ?? 61;
$item['file_id'] = $file_id;
$item['created_by'] = $file_data['created_by'] ?? null;
$item['claim_dump_ref_id'] = $row['id'];
$item['claim_type'] = 1;
$item['priority'] = 1;
$item['mode_of_intimation'] = 5;
$item['ticket_type_id'] = 1;
$mapped[] = $item;
}
@ -363,83 +372,47 @@ class RcareClaimImportService extends BaseTpaClaimImportService
* HELPER FUNCTIONs
*/
public function isDateValue($value): bool
{
if (empty($value)) {
return false;
}
// Excel numeric date (e.g. 44927)
if (is_numeric($value) && $value > 30000) {
return true;
}
// Common date formats
return preg_match(
'/^\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}$|^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/',
(string) $value
) === 1;
}
public function normalizeDate($value): ?string
{
try {
// Excel numeric date
if (is_numeric($value)) {
return date('Y-m-d', \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($value));
}
// String date
return date('Y-m-d', strtotime(str_replace('/', '-', $value)));
} catch (\Throwable $e) {
return null;
}
}
public function convertRelation(string $relation, string $gender): ?string
public function convertRelation(?string $relation): ?string
{
if (empty($relation)) {
return null;
}
$relation = strtolower($relation);
$gender = strtolower($gender);
if ($relation == 'self') {
return $relation;
if (str_contains($relation, 'self')) {
return 'self';
}
if ($relation == 'spouse') {
return $relation;
if (str_contains($relation, 'spouse') || str_contains($relation, 'wife') || str_contains($relation, 'husband')) {
return 'spouse';
}
if ($relation == 'child' && $gender == 'male') {
return 'son';
}
if ($relation == 'child' && $gender == 'female') {
if (str_contains($relation, 'daughter')) {
return 'daughter';
}
if ($relation == 'parents' && $gender == 'male') {
return 'father';
if (str_contains($relation, 'son')) {
return 'son';
}
if ($relation == 'parents' && $gender == 'female') {
return 'mother';
}
if ($relation == 'parents-in-law' && $gender == 'male') {
if (str_contains($relation, 'father in law') || str_contains($relation, 'father-in-law')) {
return 'father-in-law';
}
if ($relation == 'parents-in-law' && $gender == 'female') {
if (str_contains($relation, 'mother in law') || str_contains($relation, 'mother-in-law')) {
return 'mother-in-law';
}
return null;
if (str_contains($relation, 'father')) {
return 'father';
}
if (str_contains($relation, 'mother')) {
return 'mother';
}
return null; // unmatched case
}

View File

@ -346,9 +346,6 @@ class VidalClaimImportService extends BaseTpaClaimImportService
// Meta
'file_id' => 'file_id',
'priority' => 1,
'mode_of_intimation' => 5,
'ticket_type_id' => 1,
];
@ -566,6 +563,9 @@ class VidalClaimImportService extends BaseTpaClaimImportService
$item['claim_dump_ref_id'] = $row['id'];
$item['created_by'] = $file_data['created_by'] ?? null;
$item['claim_type'] = isset($row['mainclaim_prepost_type']) && !empty($row['mainclaim_prepost_type']) && strtolower($row['mainclaim_prepost_type']) == 'normal' ? 1 : 3;
$item['priority'] = 1;
$item['mode_of_intimation'] = 5;
$item['ticket_type_id'] = 1;
$mapped[] = $item;
}

View File

@ -118,7 +118,16 @@ class ClientPolicyModel extends Model
return $this->db->table('client_policy')
->select('client_policy.*')
->select('
client_policy.*,
CASE
WHEN client_policy.policy_entry_from = 3
AND client_policy.cd_ac_pk IS NULL
THEN leads.cd_amount
ELSE NULL
END AS lead_cd_amount
', false)
->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
->select('tpa.name as tpa_name, tpa.short_name as tpa_short')
->select('policy_type.policy_type as policy_type_name')
@ -132,6 +141,7 @@ class ClientPolicyModel extends Model
->join('tpa_branch', 'client_policy.tpa_branch_id = tpa_branch.id', 'left')
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
->join('leads', 'client_policy.is_from_lead = leads.id', 'left')
->where('client_policy.client_id', $client_id)
// ->where('client_policy.policy_status', 1)
->where('client_policy.is_active', 1)

View File

@ -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

View File

@ -92,6 +92,7 @@ class TicketMasterModel extends Model
'claim_description',
'required_docs',
'policy_transaction_id',
'tpa_claim_type',
];

View File

@ -289,7 +289,6 @@
$('#opening_date').val('');
$('#cd_ac_no_for_cd_master').val('');
$('#opening_bal').val('');
// $('#CDMasterForm').attr('action', '<?php echo base_url('master/cash_deposite/create');?>');
$('#title').html('Add Opening Amount');
$('#cd_master_btn_Submit').html('Submit');

View File

@ -57,7 +57,7 @@
<td>Get Branch Wise Employee Data</td>
<td><?= base_url("getClientBranchEmpData") ?></td>
</tr>
</table>
</table>-->
<!-- Enter Token Section -->

View File

@ -102,7 +102,7 @@ table.dataTable thead th {
<tr >
<td class="text-center"><?=$index+1?></td>
<td class="client_info" data-id="<?php echo $row->id; ?>"><?php echo $row->client_name; ?> ( <?php echo $row->short_name; ?> ) </td>
<td>
<!-- <td>
<?php $account_managers = ''; ?>
<?php foreach ($client_rm as $client): ?>
<?php if ($client->client_id == $row->id): ?>
@ -112,6 +112,9 @@ table.dataTable thead th {
<?php
$account_managers = rtrim($account_managers, ', ');
echo $account_managers !== '' ? $account_managers : 'N/A'; ?>
</td> -->
<td>
<?= $row->account_managers ?>
</td>
<td>
<div class="btn-group dropdown">
@ -389,8 +392,10 @@ $(document).ready(function()
method: 'GET',
success: function(response) {
if (response.status === "success" && Array.isArray(response.data)) {
console.error("#CL 1 : ", response.data);
renderRows(response.data);
} else {
console.error("#CL 2 : ", response.data);
renderRows([]);
}
},
@ -407,21 +412,21 @@ $(document).ready(function()
table.clear();
if (Array.isArray(data) && data.length) {
data.forEach((row, index) => {
let clientrm = <?= json_encode($client_rm) ?>;
let account_managers = "";
clientrm.forEach(client => {
if (client.client_id == row.id) {
account_managers += client.account_manager + ", ";
}
});
account_managers = account_managers.replace(/,\s*$/, "");
if (account_managers === "") account_managers = "N/A";
// let clientrm = json_encode($client_rm)
// let account_managers = "";
//
// clientrm.forEach(client => {
// if (client.client_id == row.id) {
// account_managers += client.account_manager + ", ";
// }
// });
// account_managers = account_managers.replace(/,\s*$/, "");
// if (account_managers === "") account_managers = "N/A";
let rowData = [
index + 1,
`<span class="client_info" data-id="${row.id}">${row.client_name} (${row.short_name})</span>`,
account_managers,
row.account_managers,
`<div class="btn-group dropdown">
<a href="javascript:void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown">
<i class="mdi mdi-dots-horizontal"></i>
@ -645,7 +650,11 @@ function featchClient(){
$('.loader-mask').delay(350).fadeOut('slow');
if(res.status == true){
let client_url = '<?= base_url('client/list/') ?>' + res.client_id + '?client_policy_id=' + res.client_policy_id+'#police-tab';
let client_url = '<?= base_url('client/list/') ?>'
+ res.client_id
+ '?cd_amt=' + (res.cd_amount ?? 0)
+ '&client_policy_id=' + res.client_policy_id
+ '#police-tab';
toastr.success(res.message, 'SUCCESS')
window.location.href = client_url
}else{

View File

@ -527,7 +527,7 @@ input:checked + .slider_blue::before {
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<a href="#" data-id="${item.id}" id="${item.policy_id}" data-cdamt="${item.lead_cd_amount}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" ><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>`;
@ -794,7 +794,7 @@ input:checked + .slider_blue::before {
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<a href="#" data-id="${item.id}" id="${item.policy_id}" data-cdamt="${item.lead_cd_amount}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" ><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>`;
@ -825,6 +825,13 @@ input:checked + .slider_blue::before {
$('#open_date').val('');
$('#close_date').val('');
$('#policy').html('<option value="" selected>Select Policy</option>');
const urlParams = new URLSearchParams(window.location.search);
const clientPolicyId = urlParams.get('client_policy_id');
if (clientPolicyId) {
let client_url = '<?= base_url('client/list/') ?>' + res.client_id ;
window.location.href = client_url
}
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
@ -851,6 +858,7 @@ input:checked + .slider_blue::before {
}, 1000);
},
complete :function(){
$('#opening_bal').val("")
console.log('AJAX request completed');
}
});
@ -935,6 +943,14 @@ input:checked + .slider_blue::before {
var policy_form_action = '';
var policy_id = $(this).attr('data-id');
var opening_bal = $(this).attr('data-cdamt') ?? "";
console.log('opening_bal', opening_bal)
console.log('opening_bal', $('#opening_bal'))
if(opening_bal != "null"){
$('#opening_bal').val(opening_bal);
}
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
@ -2031,6 +2047,7 @@ input:checked + .slider_blue::before {
// Get the `client_policy_id` from the URL
const urlParams = new URLSearchParams(window.location.search);
const clientPolicyId = urlParams.get('client_policy_id');
const cd_amt = urlParams.get('cd_amt');
if (clientPolicyId) {
// Call your function with the `client_policy_id`
@ -2038,6 +2055,10 @@ input:checked + .slider_blue::before {
getClientPolicyDataForEdit(clientPolicyId);
}, 3000);
}
if(cd_amt){
$('#opening_bal').val(cd_amt);
}
}
});
@ -2498,7 +2519,7 @@ $(document).ready(function () {
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<a href="#" data-id="${item.id}" id="${item.policy_id}" data-cdamt="${item.lead_cd_amount}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" ><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>`;
@ -2534,7 +2555,7 @@ $(document).ready(function () {
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<a href="#" data-id="${item.id}" id="${item.policy_id}" data-cdamt="${item.lead_cd_amount}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" ><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>`;

View File

@ -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>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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();

View File

@ -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) {

View File

@ -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');

View File

@ -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>

View File

@ -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>

View File

@ -270,6 +270,7 @@ th:first-child, td:first-child {
<th><?php echo format_indian_number($gst_total); ?></th> -->
<th></th>
</tr> */ ?>
</tr>
</tfoot>
</table>
</div>

View File

@ -22,7 +22,7 @@
<div class="modal-body">
<div class="form-row">
<div class="form-group col-md-12">
<label for="ticket_type"> Policy Type <span class="text-danger"></span></label>
<label> Policy Type <span class="text-danger"></span></label>
<select class="form-control" id="openTicketTypeAskModal">
<option value="1">Claim-GMC</option>
<option value="2">Claim-GPA</option>