Merge remote-tracking branch 'origin/dev' into dev
@ -89,6 +89,8 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get('deposit/(:num)', 'ClientController::deposit/$1');
|
||||
$routes->get('remove/(:num)', 'ClientController::removeClient/$1');
|
||||
$routes->get("list/(:any)", "ClientController::editClientOnboarding/$1");
|
||||
$routes->post('wipe', 'ClientController::wipeDemoClient');
|
||||
|
||||
// application/config/routes.php
|
||||
|
||||
// Add a route for the view_Deposit method
|
||||
@ -591,7 +593,9 @@ $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("getPoliciesbyEmpID","TicketController::getPoliciesbyEmpID");
|
||||
$routes->post("getMoreInfo","TicketController::getMoreInfo");
|
||||
$routes->get("getMoreInfo","TicketController::getMoreInfo");
|
||||
// $routes->post('ticket_messages','TicketController::getTicketMessage');
|
||||
$routes->post('upload_url',"TicketController::upload_url");
|
||||
$routes->post('getUrlDataByTicketId',"TicketController::getUrlDataByTicketId");
|
||||
$routes->get('remove_url',"TicketController::remove_url");
|
||||
});
|
||||
|
||||
$routes->group("clientApi",["filter" => "AuthClientApi"], function ($routes){
|
||||
|
||||
@ -608,6 +608,8 @@ class ClientController extends AdminController
|
||||
$data['policy_types'] = $this->policyTypeModel->findAll();
|
||||
$data['policy_type'] = ['1' => 'Base Policy', '2' => 'SI Topup', '3' => 'Dependent Addon'];
|
||||
$data['client_type'] = ['1' => 'Group', '2' => 'Retail'];
|
||||
$data['clients'] = $this->clientModel->where('is_active', 1)->findAll();
|
||||
$data['insurers'] = $this->insurerModel->where('is_active', 1)->findAll();
|
||||
|
||||
// echo "<pre>";
|
||||
// print_r($data); die;
|
||||
@ -809,7 +811,12 @@ class ClientController extends AdminController
|
||||
$data['is_download_btn'] = 1;
|
||||
}
|
||||
|
||||
if(empty($data['parent_client_id'])){
|
||||
$data['parent_client_id'] = null;
|
||||
}
|
||||
|
||||
$insert = $this->clientModel->insert($data);
|
||||
|
||||
if ($insert) {
|
||||
$client_data = $this->clientModel->where(['id' => $insert, 'is_active' => 1])->first();
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $client_data], 200);
|
||||
@ -838,6 +845,9 @@ class ClientController extends AdminController
|
||||
$data['is_download_btn'] = 1;
|
||||
}
|
||||
|
||||
if(empty($data['parent_client_id'])){
|
||||
$data['parent_client_id'] = null;
|
||||
}
|
||||
// print_r($data);die;
|
||||
|
||||
$update = $this->clientModel->update($id, $data);
|
||||
@ -2170,6 +2180,7 @@ class ClientController extends AdminController
|
||||
|
||||
$insurer_id = $client_policy_data['insurer_id'];
|
||||
$client_id = $client_policy_data['client_id'];
|
||||
$insurer_branch_id = $client_policy_data['insurer_branch_id'];
|
||||
|
||||
if (!empty($client_policy_data['policy_start_date'])) {
|
||||
$client_policy_data['source_policy_start_date'] = change_date_format($client_policy_data['policy_start_date'], 'Y-m-d', 'd/m/Y');
|
||||
@ -2190,7 +2201,8 @@ class ClientController extends AdminController
|
||||
->findAll();
|
||||
|
||||
$client_policy_list = $this->clientPolicyModel->getPolicyTypeForPolicyBinding($client_id);
|
||||
$cd_data = $this->CDMasterModel->where('client_id', $client_id)->where('insurer_id', $insurer_id)->where('is_active', 1)->findAll();
|
||||
// $cd_data = $this->CDMasterModel->where('client_id', $client_id)->where('insurer_id', $insurer_id)->where('is_active', 1)->findAll();
|
||||
$cd_data = $this->get_cd_ac($client_id, $insurer_id, $insurer_branch_id, "internal");
|
||||
// $client_policy_data['policy_end_date'] = date('d/m/Y', strtotime($client_policy_data['policy_end_date']));
|
||||
$fromDate = new \DateTime($client_policy_data['policy_end_date']);
|
||||
$fromDate->modify('+1 year');
|
||||
@ -2549,6 +2561,7 @@ class ClientController extends AdminController
|
||||
// $data['special_condition_label'] = str_replace(',', '', $this->request->getPost("special_condition_label")) ?? [];
|
||||
// $data['special_condition_input'] = str_replace(',', '', $this->request->getPost("special_condition_input")) ?? [];
|
||||
// $data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? [];
|
||||
|
||||
$fields = [
|
||||
'waiverofpreexistingdiseases' => false,
|
||||
'waiverof1,2,3&4thyearexclusions' => false,
|
||||
@ -2595,18 +2608,17 @@ class ClientController extends AdminController
|
||||
'special_condition_input' => true,
|
||||
'multiple_sum_insured' => true,
|
||||
];
|
||||
|
||||
// $data = [];
|
||||
|
||||
|
||||
foreach ($fields as $field => $needsCleanup) {
|
||||
$value = $this->request->getPost($field);
|
||||
|
||||
if ($value !== null && $value !== '') {
|
||||
$data[$field] = $needsCleanup ? str_replace(',', '', $value) : $value;
|
||||
}else{
|
||||
$data[$field] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$data['enrollment_display_key'] = $this->enrollmentGMCDisplayValueTransform();
|
||||
|
||||
// print_r($data);die;
|
||||
@ -2869,6 +2881,8 @@ class ClientController extends AdminController
|
||||
try {
|
||||
$this->myLogger->logme('error', 'Policy GPA Terms CREATE function called');
|
||||
|
||||
// print_r($this->request->getPost()); die;
|
||||
|
||||
/*** Client Policy Table Primary Key(ID) ***/
|
||||
$client_policy_id = $this->request->getPost("client_policy_id");
|
||||
|
||||
@ -2940,6 +2954,8 @@ class ClientController extends AdminController
|
||||
$value = $this->request->getPost($field);
|
||||
if ($value !== null) {
|
||||
$data[$field] = str_replace(',', '', $value);
|
||||
}else{
|
||||
$data[$field] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2948,6 +2964,8 @@ class ClientController extends AdminController
|
||||
$value = $this->request->getPost($field);
|
||||
if ($value !== null) {
|
||||
$data[$field] = $value;
|
||||
}else{
|
||||
$data[$field] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3555,23 +3573,64 @@ class ClientController extends AdminController
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Additionaly Rack Rate Data Remove Successfully'], 200);
|
||||
}
|
||||
|
||||
public function get_cd_ac($client_id, $insurer_id, $insurer_branch_id)
|
||||
public function get_cd_ac($client_id, $insurer_id, $insurer_branch_id, $return_type = null)
|
||||
{
|
||||
// Get client data
|
||||
$client_data = $this->clientModel
|
||||
->where('is_active', 1)
|
||||
->where('id', $client_id)
|
||||
->first();
|
||||
|
||||
$cd_data = $this->CDMasterModel
|
||||
$cd_data = [];
|
||||
|
||||
// If client has a parent, fetch parent client CD data
|
||||
if (!empty($client_data['parent_client_id'])) {
|
||||
$parent_cd_data = $this->CDMasterModel
|
||||
->where('client_id', $client_data['parent_client_id'])
|
||||
->where('insurer_id', $insurer_id)
|
||||
->where('insurer_branch_id', $insurer_branch_id)
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$cd_data = array_merge($cd_data, $parent_cd_data);
|
||||
}
|
||||
|
||||
// Fetch current client CD data
|
||||
$client_cd_data = $this->CDMasterModel
|
||||
->where('client_id', $client_id)
|
||||
->where('insurer_id', $insurer_id)
|
||||
->where('insurer_branch_id', $insurer_branch_id)
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
if ($cd_data) {
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $cd_data], 200);
|
||||
$cd_data = array_merge($cd_data, $client_cd_data);
|
||||
|
||||
if($return_type == "internal"){
|
||||
if(!empty($cd_data)){
|
||||
return $cd_data;
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($cd_data)) {
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'data' => $cd_data
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'insurer_id' => $insurer_id, 'client_id' => $client_id], 200);
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 404,
|
||||
'client_id' => $client_id,
|
||||
'insurer_id' => $insurer_id,
|
||||
'insurer_branch_id' => $insurer_branch_id
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function otherPolicyTermsFormSubmit()
|
||||
{
|
||||
|
||||
@ -4100,22 +4159,60 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getCDAccNoByClientAndInsurer($client, $insurer, $insurer_branch_id)
|
||||
public function getCDAccNoByClientAndInsurer($client_id, $insurer_id, $insurer_branch_id)
|
||||
{
|
||||
$cdmData = $this->CDMasterModel
|
||||
->where('client_id', $client)
|
||||
->where('insurer_id', $insurer)
|
||||
->where('insurer_branch_id', $insurer_branch_id)
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
// Get client data
|
||||
$client_data = $this->clientModel
|
||||
->where('is_active', 1)
|
||||
->where('id', $client_id)
|
||||
->first();
|
||||
|
||||
if ($cdmData) {
|
||||
return $this->respond(['status' => true, 'data' => $cdmData], 200);
|
||||
$cd_data = [];
|
||||
|
||||
// If client has a parent, fetch parent client CD data
|
||||
if (!empty($client_data['parent_client_id'])) {
|
||||
$parent_cd_data = $this->CDMasterModel
|
||||
->where('client_id', $client_data['parent_client_id'])
|
||||
->where('insurer_id', $insurer_id)
|
||||
->where('insurer_branch_id', $insurer_branch_id)
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$cd_data = array_merge($cd_data, $parent_cd_data);
|
||||
}
|
||||
|
||||
// Fetch current client CD data
|
||||
$client_cd_data = $this->CDMasterModel
|
||||
->where('client_id', $client_id)
|
||||
->where('insurer_id', $insurer_id)
|
||||
->where('insurer_branch_id', $insurer_branch_id)
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$cd_data = array_merge($cd_data, $client_cd_data);
|
||||
|
||||
if (!empty($cd_data)) {
|
||||
return $this->respond([ 'status' => true,'code' => 200, 'data' => $cd_data], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false], 200);
|
||||
return $this->respond(['status' => false,'code' => 404,'client_id' => $client_id,'insurer_id' => $insurer_id,'insurer_branch_id' => $insurer_branch_id ], 200);
|
||||
}
|
||||
}
|
||||
|
||||
// public function getCDAccNoByClientAndInsurer($client, $insurer, $insurer_branch_id)
|
||||
// {
|
||||
// $cdmData = $this->CDMasterModel
|
||||
// ->where('client_id', $client)
|
||||
// ->where('insurer_id', $insurer)
|
||||
// ->where('insurer_branch_id', $insurer_branch_id)
|
||||
// ->where('is_active', 1)
|
||||
// ->findAll();
|
||||
|
||||
// if ($cdmData) {
|
||||
// return $this->respond(['status' => true, 'data' => $cdmData], 200);
|
||||
// } else {
|
||||
// return $this->respond(['status' => false], 200);
|
||||
// }
|
||||
// }
|
||||
|
||||
public function createClientWithMinimalData()
|
||||
{
|
||||
@ -4125,7 +4222,7 @@ class ClientController extends AdminController
|
||||
$client_data = [
|
||||
'client_type' => $postData['client_type'],
|
||||
'client_name' => $postData['client_name'],
|
||||
'short_name' => $postData['short_name'],
|
||||
'short_name' => $postData['short_name'] ?? $postData['client_name'],
|
||||
'pan' => $postData['pan'],
|
||||
'client_code' => generate_client_code(),
|
||||
];
|
||||
@ -4943,24 +5040,24 @@ class ClientController extends AdminController
|
||||
|
||||
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
|
||||
|
||||
$employeeRestController = new EmployeeServiceController();
|
||||
// $employeeRestController->excelFileDataValidation(['file_id' => 1629]); die;
|
||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 726]);
|
||||
// $employeeRestController->employeesOnboardProcess(['file_id' => 835]);
|
||||
// $employeeRestController->employeesEnrollmentInsert(['file_id' => 836]);
|
||||
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
|
||||
$empServiceController = new EmployeeServiceController();
|
||||
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '865']);
|
||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '865']);
|
||||
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 726]);
|
||||
// $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]);
|
||||
// $res = $empServiceController->employeesEnrollmentInsert(['file_id' => 836]);
|
||||
// $res = $empServiceController->employeesSIEnhanceProcess(['file_id' => '978']);
|
||||
// $res = $empServiceController->employeeDisembark(['file_id' => '1681']); dd( $res);
|
||||
// $res = $empServiceController->employeeDisembark(['file_id' => '1681']);
|
||||
// $res = $empServiceController->employeesCorrectionProcess(['file_id' => '1681']);
|
||||
// dd( $res);
|
||||
|
||||
// ---------- POLICY TRANSACTION CONTROLLER --------------------------------------------------------------------------------
|
||||
|
||||
$policyTransactionController = new PolicyTransactionController();
|
||||
// $res = $policyTransactionController->validateInsurerStatement(['file_id' => '17']);
|
||||
// $res = $policyTransactionController->updateInsurerStatement(['file_id' => '22']);
|
||||
// dd('-----', $res);
|
||||
|
||||
|
||||
// ----------EMP DATA SERVICE CONTROLLER--------------------------------------------------------------------------------
|
||||
|
||||
$batch_data = [
|
||||
@ -4991,44 +5088,26 @@ class ClientController extends AdminController
|
||||
// $client_policy_data = $this->clientPolicyModel->getPolicyDetailsForRemainder($client_id=159, $client_branch_id=126);
|
||||
// $dashBoardController->sendRemainderMail($client_policy_data);
|
||||
|
||||
// $EmpDataServiceController = new EmpDataServiceController();
|
||||
// $emp_data = $this->employeePolicyModel->getEmployeePolicyForEcard(12);
|
||||
// $ids = array_column($emp_data, 'id');
|
||||
// $EmpDataServiceController->sendMailForDownloadingECard($ids);
|
||||
|
||||
$EmpDataServiceController = new EmpDataServiceController();
|
||||
// $return = $EmpDataServiceController->generateExcelForDeletion($batch_data); dd($return); die;
|
||||
// $EmpDataServiceController->generateExcelForSIEnhancement($batch_data); die;
|
||||
// $EmpDataServiceController->importInceptionFileValidation(['file_id' => 1932]); die;
|
||||
// $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live
|
||||
// $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 1199]); //for live
|
||||
// $result = $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 2496]); //for live
|
||||
// $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 214]); //for live
|
||||
|
||||
// $result = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data, 1); dd($result);
|
||||
// $result = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($batch_data, 1);
|
||||
// $res = $EmpDataServiceController->generateExcelForDeletion($batch_data); dd($return); die;
|
||||
// $res = $EmpDataServiceController->generateExcelForSIEnhancement($batch_data); die;
|
||||
// $res = $EmpDataServiceController->importInceptionFileValidation(['file_id' => 1932]); die;
|
||||
// $res = $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live
|
||||
// $res = $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 1199]); //for live
|
||||
// $res = $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 2496]); //for live
|
||||
// $res = $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 214]); //for live
|
||||
// $res = $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 310]); dd($res);//for live
|
||||
// $res = $EmpDataServiceController->getInceptionBasePremium(["13332","13333","13334","13335","13336"]); dd($res);//for live
|
||||
// $res = $EmpDataServiceController->getDeletionBasePremium(["13248","13250","13249","13247"], json_decode('{"employeeIds":["13248","13250","13249","13247"],"client_id":"3927","client_policy_id":"6183","client_branch_id":"1874","cd_ac_no":"CD9751909505","endorsement_no":"END1238","count":4,"event_name":"deletion","policy_name":"GMC","user_id":"48"}', true)); dd($res);//for live
|
||||
// $res = $EmpDataServiceController->makeEntryForBDSPolicyTransaction(json_decode('{"client_policy_id":"6187","endorsement_no":null,"emp_count":5,"action_type":"inception","no_of_insured":3,"no_of_dependent":0}', true)); dd($res);//for live
|
||||
// $res = $EmpDataServiceController->sendMailForDownloadingECard($ids);
|
||||
// $res = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data, 1); dd($result);
|
||||
// $res = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($batch_data, 1);
|
||||
// return $this->downloadInsurerExcelExport($batch_data);
|
||||
// dd($result); die;
|
||||
|
||||
// $empServiceController = new EmployeeServiceController();
|
||||
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => '741']);
|
||||
|
||||
// $PolicyTransactionController = new PolicyTransactionController();
|
||||
// $res = $PolicyTransactionController->validateInsurerStatement(['file_id' => '36']);
|
||||
|
||||
// $empServiceController = new EmployeeServiceController();
|
||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '1101']);
|
||||
// dd($res);
|
||||
|
||||
// $EmpDataServiceController = new EmpDataServiceController();
|
||||
// $EmpDataServiceController->importInceptionFileValidation(['file_id' => 160]);
|
||||
|
||||
// $EmpDataServiceController = new EmpDataServiceController();
|
||||
// $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 162]);
|
||||
// $EmpDataServiceController->importInceptionFileValidation(['file_id' => 162]);
|
||||
// $EmpDataServiceController->importDeletionValidation(['file_id' => 171]);
|
||||
// $EmpDataServiceController->importDeletionUpdateEndorsementID(['file_id' => 171]);
|
||||
// $EmpDataServiceController->importCorrectionUpdateEndorsementID(['file_id' => 188]);
|
||||
// dd($res); die;
|
||||
|
||||
// $params = [
|
||||
// 'client_policy_id' => 6090,
|
||||
@ -6147,7 +6226,7 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------
|
||||
// ---------------- HR ACCESS CONTROL -----------------------------------------------------------------------------------
|
||||
|
||||
public function viewHrAccessData()
|
||||
{
|
||||
@ -6493,8 +6572,585 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------- DEMO CLIENT FUNCTION --------------------------------------------------------------------------------
|
||||
|
||||
// public function wipeDemoClient()
|
||||
// {
|
||||
// // $this->myLogger->logme('error', "Wipe Demo Client function called");
|
||||
// $this->myLogger->logme('error', "Wipe Demo Client function called"); // Red text
|
||||
|
||||
// $this->myLogger->logme('error', "Wipe Demo client Payload : " . json_encode($this->request->getPost() ?? []));
|
||||
// $client_id = $this->request->getPost('client_id');
|
||||
|
||||
// if (empty($client_id)) {
|
||||
// return $this->respond(['status' => false, 'message' => 'Client id required'], 404);
|
||||
// }
|
||||
|
||||
// // 1. Client Model
|
||||
// $client_data = $this->clientModel->where('id', $client_id)->where('is_active', 1)->first();
|
||||
// $this->myLogger->logme('error', "Client data : " . json_encode($client_data ?? []));
|
||||
|
||||
// if (!empty($client_data)) {
|
||||
// $is_deleted = $this->clientModel->where('id', $client_id)->delete();
|
||||
|
||||
// if ($is_deleted) {
|
||||
// $this->myLogger->logme('error', "Client data removed successfully.");
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Client record does not exist.");
|
||||
// }
|
||||
// } else {
|
||||
// return $this->respond(['status' => false, 'message' => 'Client not found'], 404);
|
||||
// }
|
||||
|
||||
// // 2. Client RM Model
|
||||
// $client_rm_data = $this->clientRMModel->where('client_id', $client_id)->first();
|
||||
// $this->myLogger->logme('error', "Client Relationship Manager data : " . json_encode($client_rm_data ?? []));
|
||||
|
||||
// if (!empty($client_rm_data)) {
|
||||
// $is_deleted = $this->clientRMModel->where('client_id', $client_id)->delete();
|
||||
|
||||
// if ($is_deleted) {
|
||||
// $this->myLogger->logme('error', "Client Relationship Manager data removed successfully.");
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Client Relationship Manager record does not exist. To delete");
|
||||
// }
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Client Relationship Manager data not found.");
|
||||
// }
|
||||
|
||||
// // 3. Client KYC Docs Model
|
||||
// $client_kyc_data = $this->clientKYCDocsModel->where('client_id', $client_id)->findAll();
|
||||
// $this->myLogger->logme('error', "Client KYC Docs data : " . json_encode($client_kyc_data ?? []));
|
||||
|
||||
// if (!empty($client_kyc_data)) {
|
||||
// $is_deleted = $this->clientKYCDocsModel->where('client_id', $client_id)->delete();
|
||||
// if ($is_deleted) {
|
||||
// $this->myLogger->logme('error', "Client KYC Docs data removed successfully.");
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Client KYC Docs record does not exist. To delete");
|
||||
// }
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Client KYC Docs data not found.");
|
||||
// }
|
||||
|
||||
// // 4. Client Branch Model
|
||||
// $client_branch_data = $this->clientBranchModel->where('client_id', $client_id)->findAll();
|
||||
// $this->myLogger->logme('error', "Client Branch data : " . json_encode($client_branch_data ?? []));
|
||||
|
||||
// $branch_ids = array_column($client_branch_data, 'id') ?? [];
|
||||
// $this->myLogger->logme('error', "Client Branch id count : " . count($branch_ids ?? []));
|
||||
|
||||
// if (!empty($client_branch_data)) {
|
||||
|
||||
// $is_deleted = $this->clientBranchModel->where('client_id', $client_id)->delete();
|
||||
|
||||
// if ($is_deleted) {
|
||||
// $this->myLogger->logme('error', "Client Branch data removed successfully.");
|
||||
|
||||
// if(!empty($branch_ids)){
|
||||
|
||||
// $level_contact_data = $this->levelContactModel->where('contact_type', 'client')->whereIn('ref_id', $branch_ids)->findAll();
|
||||
// $this->myLogger->logme('error', "Level Contact data : " . json_encode($level_contact_data ?? []));
|
||||
|
||||
// $is_deleted = $this->levelContactModel->where('contact_type', 'client')->whereIn('ref_id', $branch_ids)->delete();
|
||||
// if ($is_deleted) {
|
||||
// $this->myLogger->logme('error', "Level Contact data removed successfully.");
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Level Contact record does not exist. To delete");
|
||||
// }
|
||||
|
||||
// }else{
|
||||
// $this->myLogger->logme('error', "Level Contact data not found.");
|
||||
// }
|
||||
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Client Branch record does not exist. To delete");
|
||||
// }
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Client Branch data not found.");
|
||||
// }
|
||||
|
||||
// // 5. Client Policy Model
|
||||
// $client_policy_data = $this->clientPolicyModel->where('client_id', $client_id)->findAll();
|
||||
// $this->myLogger->logme('error', "Client Policy data : " . json_encode($client_policy_data ?? []));
|
||||
|
||||
// $policy_ids = array_column($client_policy_data, 'id') ?? [];
|
||||
// $this->myLogger->logme('error', "Client Policy id count : " . count($policy_ids ?? []));
|
||||
|
||||
// if (!empty($client_policy_data)) {
|
||||
// $is_deleted = $this->clientPolicyModel->where('client_id', $client_id)->delete();
|
||||
// if ($is_deleted) {
|
||||
|
||||
// $this->myLogger->logme('error', "Client Policy data removed successfully.");
|
||||
|
||||
// if(!empty($policy_ids)){
|
||||
|
||||
// $employee_policy_data = $this->employeePolicyModel->whereIn('client_policy_id', $policy_ids)->findAll();
|
||||
// $this->myLogger->logme('error', "Employee Policy data count : " . count($employee_policy_data ?? []));
|
||||
|
||||
// $is_deleted = $this->employeePolicyModel->whereIn('client_policy_id', $policy_ids)->delete();
|
||||
// if ($is_deleted) {
|
||||
// $this->myLogger->logme('error', "Employee policy data removed successfully.");
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Employee policy record does not exist. To delete");
|
||||
// }
|
||||
|
||||
// }else{
|
||||
// $this->myLogger->logme('error', "Employee policy data not found.");
|
||||
// }
|
||||
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Client Policy record does not exist. To delete");
|
||||
// }
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Client Policy data not found.");
|
||||
// }
|
||||
|
||||
// // 6. Employee Model
|
||||
// $employee_data = $this->employeeModel->where('client_id', $client_id)->findAll();
|
||||
// $this->myLogger->logme('error', "Employee data count : " . count($employee_data ?? []));
|
||||
|
||||
// if (!empty($employee_data)) {
|
||||
|
||||
// $is_deleted = $this->employeeModel->where('client_id', $client_id)->delete();
|
||||
// if ($is_deleted) {
|
||||
// $this->myLogger->logme('error', "Employee data removed successfully.");
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Employee record does not exist. To delete");
|
||||
// }
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Employee data not found.");
|
||||
// }
|
||||
|
||||
// // 7. Client Deposit Model
|
||||
// $client_deposit_data = $this->clientDepositModel->where('client_id', $client_id)->findAll();
|
||||
// $this->myLogger->logme('error', "Client Deposit data : " . json_encode($client_deposit_data ?? []));
|
||||
|
||||
// if (!empty($client_deposit_data)) {
|
||||
// $is_deleted = $this->clientDepositModel->where('client_id', $client_id)->delete();
|
||||
// if ($is_deleted) {
|
||||
// $this->myLogger->logme('error', "Client Deposit data removed successfully.");
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Client Deposit record does not exist. To delete");
|
||||
// }
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Client Deposit data not found.");
|
||||
// }
|
||||
|
||||
// // 8. Policy Premium 1 Model
|
||||
// $policy_premium1_data = $this->policyPremium1Model->where('client_id', $client_id)->findAll();
|
||||
// $this->myLogger->logme('error', "Policy Premium 1 data count : " . count($policy_premium1_data ?? []));
|
||||
|
||||
// if (!empty($policy_premium1_data)) {
|
||||
// $is_deleted = $this->policyPremium1Model->where('client_id', $client_id)->delete();
|
||||
// if ($is_deleted) {
|
||||
// $this->myLogger->logme('error', "Policy Premium 1 data removed successfully.");
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Policy Premium 1 record does not exist. To delete");
|
||||
// }
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Policy Premium 1 data not found.");
|
||||
// }
|
||||
|
||||
// // 9. Policy Premium 2 Model
|
||||
// $policy_premium2_data = $this->policyPremium2Model->where('client_id', $client_id)->findAll();
|
||||
// $this->myLogger->logme('error', "Policy Premium 2 data count: " . count($policy_premium2_data ?? []));
|
||||
|
||||
// if (!empty($policy_premium2_data)) {
|
||||
// $is_deleted = $this->policyPremium2Model->where('client_id', $client_id)->delete();
|
||||
// if ($is_deleted) {
|
||||
// $this->myLogger->logme('error', "Policy Premium 2 data removed successfully.");
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Policy Premium 2 record does not exist. To delete");
|
||||
// }
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Policy Premium 2 data not found.");
|
||||
// }
|
||||
|
||||
// // 10. Notification Model
|
||||
// $notification_data = $this->notificationModel->where('client_id', $client_id)->findAll();
|
||||
// $this->myLogger->logme('error', "Notification data : " . json_encode($notification_data ?? []));
|
||||
|
||||
// if (!empty($notification_data)) {
|
||||
// $is_deleted = $this->notificationModel->where('client_id', $client_id)->delete();
|
||||
// if ($is_deleted) {
|
||||
// $this->myLogger->logme('error', "Notification data removed successfully.");
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Notification record does not exist. To delete");
|
||||
// }
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Notification data not found.");
|
||||
// }
|
||||
|
||||
// // 11. CD Master Model
|
||||
// $cd_master_data = $this->CDMasterModel->where('client_id', $client_id)->findAll();
|
||||
// $this->myLogger->logme('error', "CD Master data : " . json_encode($cd_master_data ?? []));
|
||||
|
||||
// if (!empty($cd_master_data)) {
|
||||
// $is_deleted = $this->CDMasterModel->where('client_id', $client_id)->delete();
|
||||
// if ($is_deleted) {
|
||||
// $this->myLogger->logme('error', "CD Master data removed successfully.");
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "CD Master record does not exist. To delete");
|
||||
// }
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "CD Master data not found.");
|
||||
// }
|
||||
|
||||
// // 12. Policy Transaction Model
|
||||
// $policy_transaction_data = $this->policyTransactionModel->where('client_id', $client_id)->findAll();
|
||||
// $this->myLogger->logme('error', "Policy Transaction data : " . json_encode($policy_transaction_data ?? []));
|
||||
|
||||
// $pt_ids = array_column($policy_transaction_data, 'id') ?? [];
|
||||
// $this->myLogger->logme('error', "Policy Transaction id count : " . count($pt_ids ?? []));
|
||||
|
||||
// if (!empty($policy_transaction_data)) {
|
||||
// $is_deleted = $this->policyTransactionModel->where('client_id', $client_id)->delete();
|
||||
// if ($is_deleted) {
|
||||
// $this->myLogger->logme('error', "Policy Transaction data removed successfully.");
|
||||
|
||||
// if(!empty($pt_ids)){
|
||||
|
||||
// $pt_co_share_data = $this->PTCOShareDetailsModel->whereIn('pt_id', $pt_ids)->findAll();
|
||||
// $this->myLogger->logme('error', "PT CO Share data : " . json_encode($pt_co_share_data ?? []));
|
||||
|
||||
// $is_deleted = $this->PTCOShareDetailsModel->whereIn('pt_id', $pt_ids)->delete();
|
||||
// if ($is_deleted) {
|
||||
// $this->myLogger->logme('error', "PT CO Share data removed successfully.");
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "PT CO Share record does not exist. To delete");
|
||||
// }
|
||||
|
||||
// }else{
|
||||
// $this->myLogger->logme('error', "PT CO Share data not found.");
|
||||
// }
|
||||
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Policy Transaction record does not exist. To delete");
|
||||
// }
|
||||
// } else {
|
||||
// $this->myLogger->logme('error', "Policy Transaction data not found.");
|
||||
// }
|
||||
|
||||
// $this->myLogger->logme('error', "Wipe Demo Client function closed");
|
||||
// return $this->respond(['status' => true, 'message' => 'Demo client data wiped successfully'], 200);
|
||||
// }
|
||||
|
||||
public function wipeDemoClient()
|
||||
{
|
||||
$this->myLogger->logme('error', "========================================");
|
||||
$this->myLogger->logme('error', "WIPE DEMO CLIENT FUNCTION STARTED");
|
||||
$this->myLogger->logme('error', "========================================");
|
||||
|
||||
$this->myLogger->logme('error', "Request Payload: " . json_encode($this->request->getPost() ?? []));
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
|
||||
if (empty($client_id)) {
|
||||
$this->myLogger->logme('error', "ERROR: Client ID is required");
|
||||
return $this->respond(['status' => false, 'message' => 'Client id required'], 404);
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', "Client ID to wipe: " . $client_id);
|
||||
$this->myLogger->logme('error', "----------------------------------------");
|
||||
|
||||
// ========================================
|
||||
// 1. CLIENT MODEL DELETION
|
||||
// ========================================
|
||||
$this->myLogger->logme('error', "1. PROCESSING CLIENT MODEL");
|
||||
$client_data = $this->clientModel->where('id', $client_id)->where('is_active', 1)->first();
|
||||
$this->myLogger->logme('error', " Found Client Data: " . json_encode($client_data ?? []));
|
||||
|
||||
if (!empty($client_data)) {
|
||||
$is_deleted = $this->clientModel->where('id', $client_id)->delete();
|
||||
if ($is_deleted) {
|
||||
$this->myLogger->logme('error', " ✓ Client data removed successfully");
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ✗ Failed to delete client record");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ✗ Client not found or inactive");
|
||||
return $this->respond(['status' => false, 'message' => 'Client not found'], 404);
|
||||
}
|
||||
$this->myLogger->logme('error', "----------------------------------------");
|
||||
|
||||
// ========================================
|
||||
// 2. CLIENT RM MODEL DELETION
|
||||
// ========================================
|
||||
$this->myLogger->logme('error', "2. PROCESSING CLIENT RM MODEL");
|
||||
$client_rm_data = $this->clientRMModel->where('client_id', $client_id)->first();
|
||||
$this->myLogger->logme('error', " Found Client RM Data: " . json_encode($client_rm_data ?? []));
|
||||
|
||||
if (!empty($client_rm_data)) {
|
||||
$is_deleted = $this->clientRMModel->where('client_id', $client_id)->delete();
|
||||
if ($is_deleted) {
|
||||
$this->myLogger->logme('error', " ✓ Client RM data removed successfully");
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ✗ Failed to delete Client RM record");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ℹ No Client RM data found");
|
||||
}
|
||||
$this->myLogger->logme('error', "----------------------------------------");
|
||||
|
||||
// ========================================
|
||||
// 3. CLIENT KYC DOCS MODEL DELETION
|
||||
// ========================================
|
||||
$this->myLogger->logme('error', "3. PROCESSING CLIENT KYC DOCS MODEL");
|
||||
$client_kyc_data = $this->clientKYCDocsModel->where('client_id', $client_id)->findAll();
|
||||
$this->myLogger->logme('error', " Found Client KYC Records: " . count($client_kyc_data ?? []));
|
||||
$this->myLogger->logme('error', " Client KYC Data: " . json_encode($client_kyc_data ?? []));
|
||||
|
||||
if (!empty($client_kyc_data)) {
|
||||
$is_deleted = $this->clientKYCDocsModel->where('client_id', $client_id)->delete();
|
||||
if ($is_deleted) {
|
||||
$this->myLogger->logme('error', " ✓ Client KYC Docs data removed successfully");
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ✗ Failed to delete Client KYC Docs records");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ℹ No Client KYC Docs data found");
|
||||
}
|
||||
$this->myLogger->logme('error', "----------------------------------------");
|
||||
|
||||
// ========================================
|
||||
// 4. CLIENT BRANCH MODEL DELETION
|
||||
// ========================================
|
||||
$this->myLogger->logme('error', "4. PROCESSING CLIENT BRANCH MODEL");
|
||||
$client_branch_data = $this->clientBranchModel->where('client_id', $client_id)->findAll();
|
||||
$branch_ids = array_column($client_branch_data, 'id') ?? [];
|
||||
$this->myLogger->logme('error', " Found Client Branch Records: " . count($client_branch_data ?? []));
|
||||
$this->myLogger->logme('error', " Branch IDs: " . json_encode($branch_ids));
|
||||
$this->myLogger->logme('error', " Client Branch Data: " . json_encode($client_branch_data ?? []));
|
||||
|
||||
if (!empty($client_branch_data)) {
|
||||
$is_deleted = $this->clientBranchModel->where('client_id', $client_id)->delete();
|
||||
if ($is_deleted) {
|
||||
$this->myLogger->logme('error', " ✓ Client Branch data removed successfully");
|
||||
|
||||
// Delete related Level Contact data
|
||||
if (!empty($branch_ids)) {
|
||||
$this->myLogger->logme('error', " 4a. PROCESSING RELATED LEVEL CONTACT DATA");
|
||||
$level_contact_data = $this->levelContactModel->where('contact_type', 'client')->whereIn('ref_id', $branch_ids)->findAll();
|
||||
$this->myLogger->logme('error', " Found Level Contact Records: " . count($level_contact_data ?? []));
|
||||
$this->myLogger->logme('error', " Level Contact Data: " . json_encode($level_contact_data ?? []));
|
||||
|
||||
$is_deleted = $this->levelContactModel->where('contact_type', 'client')->whereIn('ref_id', $branch_ids)->delete();
|
||||
if ($is_deleted) {
|
||||
$this->myLogger->logme('error', " ✓ Level Contact data removed successfully");
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ✗ Failed to delete Level Contact records");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ℹ No Branch IDs available for Level Contact deletion");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ✗ Failed to delete Client Branch records");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ℹ No Client Branch data found");
|
||||
}
|
||||
$this->myLogger->logme('error', "----------------------------------------");
|
||||
|
||||
// ========================================
|
||||
// 5. CLIENT POLICY MODEL DELETION
|
||||
// ========================================
|
||||
$this->myLogger->logme('error', "5. PROCESSING CLIENT POLICY MODEL");
|
||||
$client_policy_data = $this->clientPolicyModel->where('client_id', $client_id)->findAll();
|
||||
$policy_ids = array_column($client_policy_data, 'id') ?? [];
|
||||
$this->myLogger->logme('error', " Found Client Policy Records: " . count($client_policy_data ?? []));
|
||||
$this->myLogger->logme('error', " Policy IDs: " . json_encode($policy_ids));
|
||||
$this->myLogger->logme('error', " Client Policy Data: " . json_encode($client_policy_data ?? []));
|
||||
|
||||
if (!empty($client_policy_data)) {
|
||||
$is_deleted = $this->clientPolicyModel->where('client_id', $client_id)->delete();
|
||||
if ($is_deleted) {
|
||||
$this->myLogger->logme('error', " ✓ Client Policy data removed successfully");
|
||||
|
||||
// Delete related Employee Policy data
|
||||
if (!empty($policy_ids)) {
|
||||
$this->myLogger->logme('error', " 5a. PROCESSING RELATED EMPLOYEE POLICY DATA");
|
||||
$employee_policy_data = $this->employeePolicyModel->whereIn('client_policy_id', $policy_ids)->findAll();
|
||||
$this->myLogger->logme('error', " Found Employee Policy Records: " . count($employee_policy_data ?? []));
|
||||
|
||||
$is_deleted = $this->employeePolicyModel->whereIn('client_policy_id', $policy_ids)->delete();
|
||||
if ($is_deleted) {
|
||||
$this->myLogger->logme('error', " ✓ Employee Policy data removed successfully");
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ✗ Failed to delete Employee Policy records");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ℹ No Policy IDs available for Employee Policy deletion");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ✗ Failed to delete Client Policy records");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ℹ No Client Policy data found");
|
||||
}
|
||||
$this->myLogger->logme('error', "----------------------------------------");
|
||||
|
||||
// ========================================
|
||||
// 6. EMPLOYEE MODEL DELETION
|
||||
// ========================================
|
||||
$this->myLogger->logme('error', "6. PROCESSING EMPLOYEE MODEL");
|
||||
$employee_data = $this->employeeModel->where('client_id', $client_id)->findAll();
|
||||
$this->myLogger->logme('error', " Found Employee Records: " . count($employee_data ?? []));
|
||||
|
||||
if (!empty($employee_data)) {
|
||||
$is_deleted = $this->employeeModel->where('client_id', $client_id)->delete();
|
||||
if ($is_deleted) {
|
||||
$this->myLogger->logme('error', " ✓ Employee data removed successfully");
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ✗ Failed to delete Employee records");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ℹ No Employee data found");
|
||||
}
|
||||
$this->myLogger->logme('error', "----------------------------------------");
|
||||
|
||||
// ========================================
|
||||
// 7. CLIENT DEPOSIT MODEL DELETION
|
||||
// ========================================
|
||||
$this->myLogger->logme('error', "7. PROCESSING CLIENT DEPOSIT MODEL");
|
||||
$client_deposit_data = $this->clientDepositModel->where('client_id', $client_id)->findAll();
|
||||
$this->myLogger->logme('error', " Found Client Deposit Records: " . count($client_deposit_data ?? []));
|
||||
$this->myLogger->logme('error', " Client Deposit Data: " . json_encode($client_deposit_data ?? []));
|
||||
|
||||
if (!empty($client_deposit_data)) {
|
||||
$is_deleted = $this->clientDepositModel->where('client_id', $client_id)->delete();
|
||||
if ($is_deleted) {
|
||||
$this->myLogger->logme('error', " ✓ Client Deposit data removed successfully");
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ✗ Failed to delete Client Deposit records");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ℹ No Client Deposit data found");
|
||||
}
|
||||
$this->myLogger->logme('error', "----------------------------------------");
|
||||
|
||||
// ========================================
|
||||
// 8. POLICY PREMIUM 1 MODEL DELETION
|
||||
// ========================================
|
||||
$this->myLogger->logme('error', "8. PROCESSING POLICY PREMIUM 1 MODEL");
|
||||
$policy_premium1_data = $this->policyPremium1Model->where('client_id', $client_id)->findAll();
|
||||
$this->myLogger->logme('error', " Found Policy Premium 1 Records: " . count($policy_premium1_data ?? []));
|
||||
|
||||
if (!empty($policy_premium1_data)) {
|
||||
$is_deleted = $this->policyPremium1Model->where('client_id', $client_id)->delete();
|
||||
if ($is_deleted) {
|
||||
$this->myLogger->logme('error', " ✓ Policy Premium 1 data removed successfully");
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ✗ Failed to delete Policy Premium 1 records");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ℹ No Policy Premium 1 data found");
|
||||
}
|
||||
$this->myLogger->logme('error', "----------------------------------------");
|
||||
|
||||
// ========================================
|
||||
// 9. POLICY PREMIUM 2 MODEL DELETION
|
||||
// ========================================
|
||||
$this->myLogger->logme('error', "9. PROCESSING POLICY PREMIUM 2 MODEL");
|
||||
$policy_premium2_data = $this->policyPremium2Model->where('client_id', $client_id)->findAll();
|
||||
$this->myLogger->logme('error', " Found Policy Premium 2 Records: " . count($policy_premium2_data ?? []));
|
||||
|
||||
if (!empty($policy_premium2_data)) {
|
||||
$is_deleted = $this->policyPremium2Model->where('client_id', $client_id)->delete();
|
||||
if ($is_deleted) {
|
||||
$this->myLogger->logme('error', " ✓ Policy Premium 2 data removed successfully");
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ✗ Failed to delete Policy Premium 2 records");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ℹ No Policy Premium 2 data found");
|
||||
}
|
||||
$this->myLogger->logme('error', "----------------------------------------");
|
||||
|
||||
// ========================================
|
||||
// 10. NOTIFICATION MODEL DELETION
|
||||
// ========================================
|
||||
$this->myLogger->logme('error', "10. PROCESSING NOTIFICATION MODEL");
|
||||
$notification_data = $this->notificationModel->where('client_id', $client_id)->findAll();
|
||||
$this->myLogger->logme('error', " Found Notification Records: " . count($notification_data ?? []));
|
||||
$this->myLogger->logme('error', " Notification Data: " . json_encode($notification_data ?? []));
|
||||
|
||||
if (!empty($notification_data)) {
|
||||
$is_deleted = $this->notificationModel->where('client_id', $client_id)->delete();
|
||||
if ($is_deleted) {
|
||||
$this->myLogger->logme('error', " ✓ Notification data removed successfully");
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ✗ Failed to delete Notification records");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ℹ No Notification data found");
|
||||
}
|
||||
$this->myLogger->logme('error', "----------------------------------------");
|
||||
|
||||
// ========================================
|
||||
// 11. CD MASTER MODEL DELETION
|
||||
// ========================================
|
||||
$this->myLogger->logme('error', "11. PROCESSING CD MASTER MODEL");
|
||||
$cd_master_data = $this->CDMasterModel->where('client_id', $client_id)->findAll();
|
||||
$this->myLogger->logme('error', " Found CD Master Records: " . count($cd_master_data ?? []));
|
||||
$this->myLogger->logme('error', " CD Master Data: " . json_encode($cd_master_data ?? []));
|
||||
|
||||
if (!empty($cd_master_data)) {
|
||||
$is_deleted = $this->CDMasterModel->where('client_id', $client_id)->delete();
|
||||
if ($is_deleted) {
|
||||
$this->myLogger->logme('error', " ✓ CD Master data removed successfully");
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ✗ Failed to delete CD Master records");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ℹ No CD Master data found");
|
||||
}
|
||||
$this->myLogger->logme('error', "----------------------------------------");
|
||||
|
||||
// ========================================
|
||||
// 12. POLICY TRANSACTION MODEL DELETION
|
||||
// ========================================
|
||||
$this->myLogger->logme('error', "12. PROCESSING POLICY TRANSACTION MODEL");
|
||||
$policy_transaction_data = $this->policyTransactionModel->where('client_id', $client_id)->findAll();
|
||||
$pt_ids = array_column($policy_transaction_data, 'id') ?? [];
|
||||
$this->myLogger->logme('error', " Found Policy Transaction Records: " . count($policy_transaction_data ?? []));
|
||||
$this->myLogger->logme('error', " Policy Transaction IDs: " . json_encode($pt_ids));
|
||||
$this->myLogger->logme('error', " Policy Transaction Data: " . json_encode($policy_transaction_data ?? []));
|
||||
|
||||
if (!empty($policy_transaction_data)) {
|
||||
$is_deleted = $this->policyTransactionModel->where('client_id', $client_id)->delete();
|
||||
if ($is_deleted) {
|
||||
$this->myLogger->logme('error', " ✓ Policy Transaction data removed successfully");
|
||||
|
||||
// Delete related PT CO Share data
|
||||
if (!empty($pt_ids)) {
|
||||
$this->myLogger->logme('error', " 12a. PROCESSING RELATED PT CO SHARE DATA");
|
||||
$pt_co_share_data = $this->PTCOShareDetailsModel->whereIn('pt_id', $pt_ids)->findAll();
|
||||
$this->myLogger->logme('error', " Found PT CO Share Records: " . count($pt_co_share_data ?? []));
|
||||
$this->myLogger->logme('error', " PT CO Share Data: " . json_encode($pt_co_share_data ?? []));
|
||||
|
||||
$is_deleted = $this->PTCOShareDetailsModel->whereIn('pt_id', $pt_ids)->delete();
|
||||
if ($is_deleted) {
|
||||
$this->myLogger->logme('error', " ✓ PT CO Share data removed successfully");
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ✗ Failed to delete PT CO Share records");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ℹ No Policy Transaction IDs available for PT CO Share deletion");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ✗ Failed to delete Policy Transaction records");
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', " ℹ No Policy Transaction data found");
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', "========================================");
|
||||
$this->myLogger->logme('error', "WIPE DEMO CLIENT FUNCTION COMPLETED");
|
||||
$this->myLogger->logme('error', "Client ID: " . $client_id . " - Successfully processed");
|
||||
$this->myLogger->logme('error', "========================================");
|
||||
|
||||
return $this->respond(['status' => true, 'message' => 'Demo client data wiped successfully'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -36,13 +36,13 @@ use App\Models\PTCOShareDetailsModel;
|
||||
|
||||
use App\Controllers\Jobs;
|
||||
use App\Controllers\JobWorker;
|
||||
|
||||
|
||||
use App\Models\PolicyTypeModel;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Exception as SpreadsheetReaderException;
|
||||
use PhpParser\Node\Expr\Cast\Double;
|
||||
use Kint\Kint;
|
||||
|
||||
use function PHPUnit\Framework\returnSelf;
|
||||
|
||||
@ -199,13 +199,21 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$totals = round($totals, 2);
|
||||
|
||||
if($export_data['insurer_or_tpa'] == 'insurer') //check CD amt related issue for only insurer, not tpa
|
||||
//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) {
|
||||
$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]);
|
||||
return 0;
|
||||
session()->set('cd_balance', false);
|
||||
session()->set('cd_amount', $cash_balance['balance']);
|
||||
session()->set('excel_file_amt', $totals);
|
||||
}else{
|
||||
session()->set('cd_balance', true);
|
||||
session()->set('cd_amount', $cash_balance['balance']);
|
||||
session()->set('excel_file_amt', $totals);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -700,13 +708,21 @@ class EmpDataServiceController extends BaseController
|
||||
// echo '<pre>';
|
||||
// print_r($ids); die;
|
||||
|
||||
if($export_data['insurer_or_tpa'] == 'insurer') //check CD amt related issue for only insurer, not tpa
|
||||
//check CD amt insufficiend for 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) $rounded_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]);
|
||||
return 0;
|
||||
session()->set('cd_balance', false);
|
||||
session()->set('cd_amount', $cash_balance['balance']);
|
||||
session()->set('excel_file_amt', $rounded_totals);
|
||||
}else{
|
||||
session()->set('cd_balance', true);
|
||||
session()->set('cd_amount', $cash_balance['balance']);
|
||||
session()->set('excel_file_amt', $rounded_totals);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1003,22 +1019,29 @@ class EmpDataServiceController extends BaseController
|
||||
$cash_balance['balance'] = $balance['opening_bal'];
|
||||
}
|
||||
|
||||
// Calculate the total amount from the objects
|
||||
$totals = 0;
|
||||
foreach ($inceptionData as $item) {
|
||||
$totals = $totals + $item->total;
|
||||
}
|
||||
|
||||
|
||||
// Calculate the total amount from the objects
|
||||
$totals = 0;
|
||||
foreach ($inceptionData as $item) {
|
||||
$totals = $totals + $item->total;
|
||||
}
|
||||
$totals = round($totals, 2);
|
||||
|
||||
if($export_data['insurer_or_tpa'] != 'tpa')// check overal emp premium amt with cd balance only for insurer export, not tpa export
|
||||
|
||||
if($export_data['insurer_or_tpa'] != 'tpa')// check overal emp premium amt with cd balance only for insurer export, not tpa export
|
||||
{
|
||||
if (!empty($cash_balance)) {
|
||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
||||
$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]);
|
||||
return 0;
|
||||
session()->set('cd_balance', false);
|
||||
session()->set('cd_amount', $cash_balance['balance']);
|
||||
session()->set('excel_file_amt', $totals);
|
||||
}else{
|
||||
session()->set('cd_balance', true);
|
||||
session()->set('cd_amount', $cash_balance['balance']);
|
||||
session()->set('excel_file_amt', $totals);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1359,6 +1382,8 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_code = $file['batch_code'];
|
||||
$user_id = $file['created_by'];
|
||||
|
||||
$client_policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
|
||||
$insurer_or_tpa = $file['insurer_or_tpa'];
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
$id = 'tpa_id';
|
||||
@ -1516,38 +1541,42 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
//--- TPA ID Duplicate check start ---
|
||||
|
||||
$current_tpa_id = $excel_data[$key][13];
|
||||
// Duplicate checking for only GMC's and GPA
|
||||
if(in_array($client_policy_data['policy_type_id'], [1,2,3,4,5])){
|
||||
$current_tpa_id = $excel_data[$key][13];
|
||||
|
||||
if (isset($tpa_id_all[$current_tpa_id])) {
|
||||
if (isset($tpa_id_all[$current_tpa_id])) {
|
||||
|
||||
// Add the current row to errors
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 13,
|
||||
'db_data' => "Duplicate TPA ID Found",
|
||||
'excel_data' => $current_tpa_id
|
||||
];
|
||||
|
||||
// Add all existing rows with the same TPA ID to errors
|
||||
foreach ($tpa_id_all[$current_tpa_id] as $existing_row) {
|
||||
$errors[$existing_row][] = [
|
||||
'row' => $existing_row,
|
||||
// Add the current row to errors
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 13,
|
||||
'db_data' => "Duplicate TPA ID Found",
|
||||
'excel_data' => $current_tpa_id
|
||||
];
|
||||
}
|
||||
|
||||
// Add all existing rows with the same TPA ID to errors
|
||||
foreach ($tpa_id_all[$current_tpa_id] as $existing_row) {
|
||||
$errors[$existing_row][] = [
|
||||
'row' => $existing_row,
|
||||
'column' => 13,
|
||||
'db_data' => "Duplicate TPA ID Found",
|
||||
'excel_data' => $current_tpa_id
|
||||
];
|
||||
}
|
||||
|
||||
} else {
|
||||
if($current_tpa_id != "" && $current_tpa_id != null){
|
||||
$tpa_id_all[$current_tpa_id][] = $key;
|
||||
}
|
||||
} else {
|
||||
if($current_tpa_id != "" && $current_tpa_id != null){
|
||||
$tpa_id_all[$current_tpa_id][] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--- TPA ID Duplicate check end ---
|
||||
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
if ($insurer_or_tpa == 'tpa' && in_array($client_policy_data['policy_type_id'], [1,2,3,4,5])) {
|
||||
|
||||
//verify the TPA ID is not null
|
||||
if ($excel_data[$key][13] === null) {
|
||||
$missing_id[$key][] = [
|
||||
'row' => $key,
|
||||
@ -1557,6 +1586,8 @@ class EmpDataServiceController extends BaseController
|
||||
];
|
||||
}
|
||||
} else if ($insurer_or_tpa == 'insurer') {
|
||||
|
||||
//verify the UHID or Risk ID is not null
|
||||
if ($excel_data[$key][14] === null) {
|
||||
$missing_id[$key][] = [
|
||||
'row' => $key,
|
||||
@ -1699,7 +1730,7 @@ class EmpDataServiceController extends BaseController
|
||||
];
|
||||
}
|
||||
|
||||
} else if ($insurer_or_tpa == 'insurer') {
|
||||
} else if ($insurer_or_tpa == 'insurer' && in_array($client_policy_data['policy_type_id'], [1,2,3,4,5])) {
|
||||
|
||||
if ($emp_value['tpa_id'] != $excel_data[$key][13]) {
|
||||
$errors[$key][] = [
|
||||
@ -1867,6 +1898,9 @@ class EmpDataServiceController extends BaseController
|
||||
$emp_endorsement_table_data = [];
|
||||
$enrollment_file_id = null;
|
||||
$endorsement_id = null;
|
||||
$no_of_insured = [];
|
||||
$no_of_dependent = [];
|
||||
|
||||
|
||||
$emp_count = count($excel_data);
|
||||
$db = \Config\Database::connect();
|
||||
@ -1886,7 +1920,7 @@ class EmpDataServiceController extends BaseController
|
||||
$totals = $totals + floatval($amount);
|
||||
|
||||
$query = $db->table('employee_polices');
|
||||
$query->select('employee_polices.id');
|
||||
$query->select('employee_polices.id, employees.id as emp_id, employees.emp_code, employees.name as emp_name, employees.relationship');
|
||||
$query->join('employees', 'employees.id = employee_polices.employee_id');
|
||||
$query->where('employee_polices.client_policy_id', $client_policy_id);
|
||||
$query->where('employees.client_id', $client_id);
|
||||
@ -1907,11 +1941,20 @@ class EmpDataServiceController extends BaseController
|
||||
$query->limit(1);
|
||||
|
||||
$result = $query->get()->getRowArray();
|
||||
// Kint::dump($result);
|
||||
|
||||
if (isset($result['id']) && $result['id'] !== null) {
|
||||
$emp_policy_ids[] = $result['id']; //for cash deposite
|
||||
$emp_details[] = array('id' => $result['id'], 'tpa_id' => $value[13], 'uhid' => $value[14]);
|
||||
if (strtolower($result['relationship']) == 'self') {
|
||||
$no_of_insured[] = ['emp_id' => $result['emp_id'], 'emp_code' => $result['emp_code'], 'emp_name' => $result['emp_name'] ];
|
||||
}else{
|
||||
$no_of_dependent[] = ['emp_id' => $result['emp_id'], 'emp_code' => $result['emp_code'], 'emp_name' => $result['emp_name'] ];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(in_array($file['event_type'], ['missed_inception']) && isset($value[18])){
|
||||
$endorsement_id = $value[18];
|
||||
|
||||
@ -1973,7 +2016,7 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
// dd($emp_endorsement_table_data, $enrollment_file_id);
|
||||
// dd($emp_endorsement_table_data, $enrollment_file_id, $no_of_insured, $no_of_dependent);
|
||||
|
||||
//update the employee policy data (TPAID or UHID)
|
||||
$return = $this->employeePolicyModel->bulkUpdate($emp_details);
|
||||
@ -1993,6 +2036,10 @@ class EmpDataServiceController extends BaseController
|
||||
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- batch file status : {data}', ['data' => $status_val]);
|
||||
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- total amount for cash deposite : {data}', ['data' => $totals]);
|
||||
|
||||
//get the BASE PREMIUM and GST for BDS Entry
|
||||
$base_bremium_and_gst = $this->getInceptionBasePremium($emp_policy_ids);
|
||||
$this->myLogger->logme('error', 'Inception Base Premium and GST :'. json_encode($base_bremium_and_gst ?? []));
|
||||
|
||||
//update CD transaction entry if only insurer
|
||||
if ($file['insurer_or_tpa'] == 'insurer') {
|
||||
|
||||
@ -2035,6 +2082,10 @@ class EmpDataServiceController extends BaseController
|
||||
'endorsement_no' => $endorsement_id ?? null,
|
||||
'emp_count' => $emp_count ?? null,
|
||||
'action_type' => $file['event_type'] ?? null,
|
||||
'no_of_insured' => count($no_of_insured ?? []) ?? null,
|
||||
'no_of_dependent' => count($no_of_dependent ?? []) ?? null,
|
||||
'base_premium' => $base_bremium_and_gst['base_premium'] ?? null,
|
||||
'gst' => $base_bremium_and_gst['gst'] ?? null,
|
||||
]]);
|
||||
|
||||
// $this->cashDepositCalculationForInception($depositeData);
|
||||
@ -2977,6 +3028,8 @@ class EmpDataServiceController extends BaseController
|
||||
$endorsement_id = '';
|
||||
$enrollment_file_id = '';
|
||||
$endorsement_details = [];
|
||||
$no_of_insured = [];
|
||||
$no_of_dependent = [];
|
||||
$totals = 0;
|
||||
|
||||
foreach ($excel_data as $key => $value) {
|
||||
@ -2989,7 +3042,14 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$result = $this->empEndorsementModel
|
||||
|
||||
->select('emp_endorsement.*, employees.id as emp_id, employee_polices.id as emp_policy_id')
|
||||
->select('
|
||||
emp_endorsement.*,
|
||||
employees.id as emp_id,
|
||||
employees.name as emp_name,
|
||||
employees.emp_code,
|
||||
employees.relationship,
|
||||
employee_polices.id as emp_policy_id
|
||||
')
|
||||
->join('employee_polices', 'employee_polices.id = emp_endorsement.pk')
|
||||
->join('employees', 'employees.emp_code = emp_endorsement.emp_code')
|
||||
->where('employees.emp_code', $emp_code)
|
||||
@ -3015,6 +3075,11 @@ class EmpDataServiceController extends BaseController
|
||||
$emp_policy_ids[] = array('id' => $result['emp_policy_id'], 'is_active' => 0);
|
||||
$employeeIds[] = $result['emp_policy_id'];
|
||||
$endorsement_details[] = array('id' => $result['id'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[19], 'status' => 'complete');
|
||||
if (strtolower($result['relationship']) == 'self') {
|
||||
$no_of_insured[] = ['emp_id' => $result['emp_id'], 'emp_code' => $result['emp_code'], 'emp_name' => $result['emp_name'] ];
|
||||
}else{
|
||||
$no_of_dependent[] = ['emp_id' => $result['emp_id'], 'emp_code' => $result['emp_code'], 'emp_name' => $result['emp_name'] ];
|
||||
}
|
||||
}
|
||||
|
||||
$empData = $this->employeePolicyModel
|
||||
@ -3082,6 +3147,11 @@ class EmpDataServiceController extends BaseController
|
||||
$this->myLogger->logme('error', 'SI Enhancement Update Endorsement ID -- Employee count : {data}', ['data' => $emp_count]);
|
||||
$this->myLogger->logme('error', 'SI Enhancement Update Endorsement ID -- Batch File status : {data}', ['data' => $status_val]);
|
||||
|
||||
//get the BASE PREMIUM and GST for BDS Entry
|
||||
$base_bremium_and_gst = $this->getInceptionBasePremium($employeeIds);
|
||||
$this->myLogger->logme('error', 'SI Enhancement Base Premium and GST :'. json_encode($base_bremium_and_gst ?? []));
|
||||
|
||||
|
||||
//call the cash deposite function
|
||||
if ($file['insurer_or_tpa'] == 'insurer') {
|
||||
|
||||
@ -3105,6 +3175,10 @@ class EmpDataServiceController extends BaseController
|
||||
'endorsement_no' => $endorsement_id ?? null,
|
||||
'emp_count' => $emp_count ?? null,
|
||||
'action_type' => $file['event_type'] ?? null,
|
||||
'no_of_insured' => count($no_of_insured ?? []) ?? null,
|
||||
'no_of_dependent' => count($no_of_dependent ?? []) ?? null,
|
||||
'base_premium' => $base_bremium_and_gst['base_premium'] ?? null,
|
||||
'gst' => $base_bremium_and_gst['gst'] ?? null,
|
||||
]]);
|
||||
|
||||
}
|
||||
@ -3493,6 +3567,8 @@ class EmpDataServiceController extends BaseController
|
||||
$employee_policy_table_primaryKey = [];
|
||||
$endorsement_id = '';
|
||||
$enrollment_file_id = null; //files table primary key
|
||||
$no_of_insured = [];
|
||||
$no_of_dependent = [];
|
||||
|
||||
$totals = 0;
|
||||
|
||||
@ -3526,6 +3602,12 @@ class EmpDataServiceController extends BaseController
|
||||
$employee_policy_table_data[] = array('id' => $result['emp_policy_primarykey'], 'date_of_exit' => change_date_format($result['date_of_exit']), 'reason_for_exit' => $result['reason_for_exit'], 'claim_status' => $result['claim_status'], 'status' => $result['status']);
|
||||
// $employees_table_data[] = array('id' => $result['employees_id'], 'emp_status' => $result['status']);
|
||||
$emp_endorsement_table_data[] = array('id' => $result['emp_endorsement_primarykey'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[15], 'status' => 'complete');
|
||||
|
||||
if (strtolower($result['relationship']) == 'self') {
|
||||
$no_of_insured[] = ['emp_id' => $result['employees_primarykey'], 'emp_code' => $result['emp_code'], 'emp_name' => $result['emp_name'] ];
|
||||
}else{
|
||||
$no_of_dependent[] = ['emp_id' => $result['employees_primarykey'], 'emp_code' => $result['emp_code'], 'emp_name' => $result['emp_name'] ];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -3575,6 +3657,9 @@ class EmpDataServiceController extends BaseController
|
||||
$this->myLogger->logme('error', 'Deletion Update Endorsement ID -- Employee count : {data}', ['data' => $emp_count]);
|
||||
$this->myLogger->logme('error', 'Deletion Update Endorsement ID -- Batch File status : {data}', ['data' => $status_val]);
|
||||
|
||||
$base_bremium_and_gst = $this->getDeletionBasePremium($employee_policy_table_primaryKey, ['client_policy_id' => $client_policy_id]);
|
||||
$this->myLogger->logme('error', 'Deletion Base Premium and GST :'. json_encode($base_bremium_and_gst ?? []));
|
||||
|
||||
//call the cash deposite function
|
||||
if ($file['insurer_or_tpa'] == 'insurer') {
|
||||
|
||||
@ -3598,6 +3683,10 @@ class EmpDataServiceController extends BaseController
|
||||
'endorsement_no' => $endorsement_id ?? null,
|
||||
'emp_count' => $emp_count ?? null,
|
||||
'action_type' => $file['event_type'] ?? null,
|
||||
'no_of_insured' => count($no_of_insured ?? []) ?? null,
|
||||
'no_of_dependent' => count($no_of_dependent ?? []) ?? null,
|
||||
'base_premium' => $base_bremium_and_gst['base_premium'] ?? null,
|
||||
'gst' => $base_bremium_and_gst['gst'] ?? null,
|
||||
]]);
|
||||
}
|
||||
|
||||
@ -4262,8 +4351,6 @@ class EmpDataServiceController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Below function retrieves the policy name associated with a given client policy ID.
|
||||
*
|
||||
@ -4280,8 +4367,6 @@ class EmpDataServiceController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Below function converts row data into column data format for SI enhancement.
|
||||
*
|
||||
@ -4838,8 +4923,8 @@ class EmpDataServiceController extends BaseController
|
||||
$this->myLogger->logme("error", "Policy transaction inserted successfully: " . json_encode(['insert_id' => $insert_id]));
|
||||
|
||||
//do not remove this commented item
|
||||
// $coShareDetails = $this->ConstructPTShareData($policy_data, $insert_id);
|
||||
// $pt_co_share_id = $this->PTCOShareDetailsModel->insert($coShareDetails);
|
||||
$coShareDetails = $this->ConstructPTShareData($policy_data, $insert_id, $params);
|
||||
$pt_co_share_id = $this->PTCOShareDetailsModel->insert($coShareDetails);
|
||||
|
||||
// $this->myLogger->logme("error", "PT Co share data inserted successfully: " . json_encode(['pt_co_share_id' => $pt_co_share_id]));
|
||||
|
||||
@ -4875,11 +4960,12 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
private function constructBDSData($policy_data, $lead_data, $params)
|
||||
{
|
||||
|
||||
|
||||
$this->myLogger->logme("error", "constructBDSData Params: " . json_encode(['policy_data' => $policy_data, 'lead_data' => $lead_data, 'params' => $params]));
|
||||
$action_type_string = $params['action_type'];
|
||||
if(in_array($params['action_type'], ['dependent_addition', 'missed_inception'])){
|
||||
if(in_array($params['action_type'], ['dependent_addition', 'missed_inception'])){
|
||||
$action_type_string = "addition";
|
||||
}
|
||||
}
|
||||
|
||||
$policyTransactionData = [
|
||||
|
||||
@ -4900,9 +4986,9 @@ class EmpDataServiceController extends BaseController
|
||||
'policy_end_date' => $policy_data['policy_end_date'] ?? null,
|
||||
'data_received_date' => $policy_data['data_received_date'] ?? null,
|
||||
'closure_date' => $policy_data['closure_date'] ?? null,
|
||||
'emp_count' => $policy_data['emp_count'] ?? null,
|
||||
'dependent_count' => $policy_data['dependent_count'] ?? null,
|
||||
'revenue_type' => ($lead_data['lead_type'] == 1 ? "NA" : ($lead_data['lead_type'] == 2 ? "EA" : "EANR") ) ?? null,
|
||||
'emp_count' => $params['no_of_insured'] ?? null,
|
||||
'dependent_count' => $params['no_of_dependent'] ?? null,
|
||||
'revenue_type' => isset($lead_data['lead_type']) ?($lead_data['lead_type'] == 1 ? "NA" : ($lead_data['lead_type'] == 2 ? "EA" : "EANR") ) : null,
|
||||
'co_share' => $policy_data['co_share'] ?? 0,
|
||||
'pre_payable_by' => $policy_data['pre_payable_by'] ?? 1,
|
||||
'renewal_date' => $policy_data['policy_end_date'] ?? null,
|
||||
@ -4910,8 +4996,10 @@ class EmpDataServiceController extends BaseController
|
||||
'ct_type' => 1,
|
||||
'is_cd_reduce_from_bds' => 0,
|
||||
'client_type_id' => 0,
|
||||
'bro_payable_by' => 1,
|
||||
|
||||
'status' => "co_insurer_pending",
|
||||
// 'status' => "co_insurer_pending",
|
||||
'status' => "completed",
|
||||
'action_type' => $action_type_string ?? null,
|
||||
'endorsement_no' => $params['endorsement_no'] ?? null,
|
||||
|
||||
@ -4926,17 +5014,29 @@ class EmpDataServiceController extends BaseController
|
||||
return $policyTransactionData;
|
||||
}
|
||||
|
||||
private function ConstructPTShareData($policy_data, $pt_id)
|
||||
private function ConstructPTShareData($policy_data, $pt_id, $params)
|
||||
{
|
||||
$policyTypeModel = new PolicyTypeModel();
|
||||
$policy_type_data = $policyTypeModel->where('is_active', 1)->where('id', $policy_data['policy_type_id'])->first();
|
||||
|
||||
$coShareData = [
|
||||
'pt_id' => $pt_id,
|
||||
'insurer_id' => $policy_data['insurer_id'],
|
||||
'insurer_branch_id' => $policy_data['insurer_branch_id'],
|
||||
'bp_amt' => $params['base_premium'],
|
||||
'cop_amt' => $params['base_premium'],
|
||||
'bp_gst_amt' => $params['gst'],
|
||||
'bp_sgst' => 9,
|
||||
'bp_cgst' => 9,
|
||||
'co_share_type' => 1,
|
||||
'co_share_per' => 100,
|
||||
'standerd_bp_per' => $policy_type_data['ebp'],
|
||||
'amount' => ($params['base_premium'] ?? 0) + ($params['gst'] ?? 0),
|
||||
];
|
||||
|
||||
$this->myLogger->logme("error", "Constructed PT co-share data: " . json_encode($coShareData));
|
||||
$coShareData['exp_amt'] = (($params['base_premium'] ?? 0) * ($policy_type_data['ebp'] ?? 0)) / 100;
|
||||
|
||||
$this->myLogger->logme("error", "Constructed PT co-share data: " . json_encode($coShareData));
|
||||
|
||||
return $coShareData;
|
||||
}
|
||||
@ -5085,8 +5185,117 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public function getInceptionBasePremium($ids)
|
||||
{
|
||||
$this->myLogger->logme('error', 'getInceptionBasePremium called with the params : ' . json_encode($ids ?? ""));
|
||||
|
||||
// Validate input
|
||||
if (empty($ids) || !is_array($ids)) {
|
||||
return ['base_premium' => 0, 'gst' => 0];
|
||||
}
|
||||
|
||||
// Sanitize IDs to ensure they are integers
|
||||
$sanitizedIds = array_filter(array_map('intval', $ids), function ($id) {
|
||||
return $id > 0;
|
||||
});
|
||||
|
||||
if (empty($sanitizedIds)) {
|
||||
return ['base_premium' => 0, 'gst' => 0];
|
||||
}
|
||||
|
||||
// Use parameter binding for security
|
||||
$placeholders = str_repeat('?,', count($sanitizedIds) - 1) . '?';
|
||||
|
||||
$amount = $this->employeePolicyModel->query("
|
||||
SELECT SUM(employee_polices.rata_premimum) AS base_premium,
|
||||
SUM(employee_polices.gst) AS gst
|
||||
FROM employee_polices
|
||||
JOIN employees ON employees.id = employee_polices.employee_id
|
||||
WHERE employee_polices.id IN ($placeholders)
|
||||
", $sanitizedIds)->getRowArray();
|
||||
|
||||
$this->myLogger->logme('error', 'Get Last Executed Query : '.db_connect()->getLastQuery());
|
||||
|
||||
// Ensure we return proper numeric values
|
||||
return [
|
||||
'base_premium' => round($amount['base_premium'] ?? 0, 2),
|
||||
'gst' => round($amount['gst'] ?? 0, 2)
|
||||
];
|
||||
}
|
||||
|
||||
public function getDeletionBasePremium($ids, $params)
|
||||
{
|
||||
$this->myLogger->logme('error', 'getDeletionBasePremium called with the params : ' . json_encode(['emp_policy_id' => $ids ?? [], 'params' => $params ?? []] ?? ""));
|
||||
|
||||
// Validate input
|
||||
if (empty($ids) || !is_array($ids)) {
|
||||
return ['base_premium' => 0, 'gst' => 0];
|
||||
}
|
||||
|
||||
// Sanitize IDs to ensure they are integers
|
||||
$sanitizedIds = array_filter(array_map('intval', $ids), function ($id) {
|
||||
return $id > 0;
|
||||
});
|
||||
|
||||
if (empty($sanitizedIds)) {
|
||||
return ['base_premium' => 0, 'gst' => 0];
|
||||
}
|
||||
|
||||
// Validate client_policy_id parameter
|
||||
if (empty($params['client_policy_id'])) {
|
||||
return ['base_premium' => 0, 'gst' => 0];
|
||||
}
|
||||
|
||||
$get_insurer_id_from_client_policy = $this->clientPolicyModel
|
||||
->select('insurers.deletion_add_day')
|
||||
->join('insurers', 'client_policy.insurer_id = insurers.id')
|
||||
->where('client_policy.id', intval($params['client_policy_id']))
|
||||
->first();
|
||||
|
||||
$add_one_day = 0;
|
||||
if (isset($get_insurer_id_from_client_policy['deletion_add_day']) && $get_insurer_id_from_client_policy['deletion_add_day'] == 1) {
|
||||
$add_one_day = 1;
|
||||
}
|
||||
|
||||
// Use parameter binding for security
|
||||
$placeholders = str_repeat('?,', count($sanitizedIds) - 1) . '?';
|
||||
|
||||
// Prepare parameters array (ids repeated twice for both IN clauses)
|
||||
$queryParams = array_merge($sanitizedIds, $sanitizedIds);
|
||||
|
||||
$amount = $this->employeePolicyModel->query("
|
||||
SELECT
|
||||
SUM(ROUND(
|
||||
((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, emp_endorsement.new_value) + ?)) / 365),
|
||||
2
|
||||
)) AS base_premium,
|
||||
SUM(ROUND(
|
||||
(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, emp_endorsement.new_value) + ?)) / 365) * 0.18),
|
||||
2
|
||||
)) AS gst
|
||||
FROM
|
||||
employee_polices
|
||||
JOIN
|
||||
employees ON employees.id = employee_polices.employee_id
|
||||
JOIN
|
||||
emp_endorsement ON emp_endorsement.pk = employee_polices.id
|
||||
WHERE
|
||||
employee_polices.id IN ($placeholders)
|
||||
AND emp_endorsement.pk IN ($placeholders)
|
||||
AND employee_polices.claim_status = 0
|
||||
AND emp_endorsement.field_name = 'date_of_exit'
|
||||
AND emp_endorsement.is_active = 1
|
||||
AND emp_endorsement.actions = 'd'
|
||||
AND emp_endorsement.status != 'truncated'
|
||||
", array_merge([$add_one_day, $add_one_day], $queryParams))->getRowArray();
|
||||
|
||||
$this->myLogger->logme('error', 'Get Last Executed Query : '.db_connect()->getLastQuery());
|
||||
// Ensure we return proper numeric values with rounding
|
||||
return [
|
||||
'base_premium' => round($amount['base_premium'] ?? 0, 2),
|
||||
'gst' => round($amount['gst'] ?? 0, 2)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -302,9 +302,11 @@ class EmployeeController extends AdminController
|
||||
//for TPA/insurer upload
|
||||
$data['events'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
|
||||
//for inception upload
|
||||
$data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement','enrollment' => 'Enrolment'];
|
||||
|
||||
$data['import_or_export'] = ['import' => 'Import', 'export' => 'Export'];
|
||||
$data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
|
||||
// $data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement','enrollment' => 'Enrolment'];
|
||||
|
||||
// $data['import_or_export'] = ['import' => 'Import', 'export' => 'Export'];
|
||||
$data['import_or_export'] = ['import' => 'Upload', 'export' => 'Download'];
|
||||
$data['insurer_or_tpa'] = ['insurer' => 'Insurer', 'tpa' => 'TPA'];
|
||||
|
||||
// $data['fileList'] = $this->fileModel
|
||||
|
||||
@ -1319,6 +1319,7 @@ class EmployeeServiceController extends AdminController
|
||||
//get file name
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->fileModel->find($file_id);
|
||||
// dd($file);
|
||||
|
||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
||||
|
||||
@ -1330,6 +1331,7 @@ class EmployeeServiceController extends AdminController
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
|
||||
// $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
|
||||
// dd($excel_data);
|
||||
unset($excel_data[0]);
|
||||
// kint::dump($excel_data);
|
||||
$endorsement_data = [];
|
||||
@ -1379,10 +1381,14 @@ class EmployeeServiceController extends AdminController
|
||||
->where('employee_polices.client_policy_id',$file['policy_id'])
|
||||
->where('employees.emp_status !=','truncated')
|
||||
->where('employees.is_active', 1)
|
||||
->where('employee_polices.status !=','truncated')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->first();
|
||||
|
||||
// $employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->first();
|
||||
// dd($employee);
|
||||
// kint::dump($employee);
|
||||
|
||||
if(is_array($employee) && count($employee))
|
||||
{
|
||||
// dd($employee);
|
||||
@ -1406,7 +1412,13 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
if(!in_array($employee['id'],$endorsement_data))//make entry in endorsement firsttime only with checking that PK of emp exisintg in variable $endorsement_data
|
||||
{
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
|
||||
$employee_policy = $this->employeePolicyModel
|
||||
->where('employee_id',$employee['id'])
|
||||
->where('client_policy_id',$file['policy_id'])
|
||||
->where('status !=','truncated')
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
$data = ['emp_id' => $employee['id'],'name' => $employee['name'],'emp_status' => $employee['emp_status'],'emp_policy_id' => $employee_policy['id'],'emp_code' => $employee['emp_code'],'change_event' => $employee['change_event'],'date_of_exit' => $employee_policy['date_of_exit'],'reason_for_exit' => $employee_policy['reason_for_exit'],'status' => $employee_policy['status'],'claim_status' => $employee_policy['claim_status']];
|
||||
$endorsement($data,$file,$row);
|
||||
$endorsement_data[] = $employee['id'];
|
||||
@ -1447,7 +1459,7 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
//set success msg to pull notifications
|
||||
$this->setPullNotification($this->getFileMetaDataByFileId($file_id,'success'));
|
||||
return $endorsement_data;
|
||||
return $endorsement_data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -121,6 +121,7 @@ class LeadsController extends BaseController
|
||||
];
|
||||
|
||||
$this->claim_type_for_gpa = [
|
||||
'nil' => 'Nil',
|
||||
'accident_death' => 'Accident Death',
|
||||
'permanent_total_disablement' => 'Permanent Total Disablement',
|
||||
'permanent_partial_disablement' => 'Permanent Partial Disablement',
|
||||
@ -1823,6 +1824,72 @@ class LeadsController extends BaseController
|
||||
$filename = "{$rfq_data['client_name']}_{$rfq_data['policy_type']}_{$string}_" . $policy_year . '_' . '.xlsx';
|
||||
}
|
||||
|
||||
//claim history new sheet;
|
||||
if (!empty($rfq_data['fin_years_claims'])) {
|
||||
|
||||
$claim_details = json_decode($rfq_data['fin_years_claims'], true) ?? [];
|
||||
|
||||
if (!empty($claim_details['finyear'])) {
|
||||
|
||||
// Get headers dynamically
|
||||
$headers = array_map(function ($key) {
|
||||
return ucwords(str_replace('_', ' ', $key));
|
||||
}, array_keys($claim_details['finyear'][0]));
|
||||
|
||||
$newSheet = new Worksheet($spreadsheet, 'Claims Experience');
|
||||
$spreadsheet->addSheet($newSheet);
|
||||
$spreadsheet->setActiveSheetIndexByName('Claims Experience');
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
// Set headers
|
||||
$sheet->fromArray($headers, NULL, 'A1');
|
||||
|
||||
// Apply background color and bold style to headers
|
||||
$headerCellRange = 'A1:' . chr(64 + count($headers)) . '1'; // e.g., A1:G1
|
||||
|
||||
$sheet->getStyle($headerCellRange)->getFont()->setBold(true);
|
||||
$sheet->getStyle($headerCellRange)->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setRGB('ADD8E6');
|
||||
|
||||
// Add border to header
|
||||
$sheet->getStyle($headerCellRange)->getBorders()->getAllBorders()->setBorderStyle(Border::BORDER_THIN);
|
||||
|
||||
// Fill data and apply borders
|
||||
$row = 2;
|
||||
foreach ($claim_details['finyear'] as $record) {
|
||||
$col = 'A';
|
||||
foreach ($record as $value) {
|
||||
$label = ucwords(str_replace('_', ' ', ($value ?? "")));
|
||||
$sheet->setCellValue($col . $row, $label);
|
||||
$col++;
|
||||
}
|
||||
|
||||
// Apply border to each data row
|
||||
$sheet->getStyle('A' . $row . ':' . chr(64 + count($headers)) . $row)
|
||||
->getBorders()->getAllBorders()->setBorderStyle(Border::BORDER_THIN);
|
||||
|
||||
$row++;
|
||||
}
|
||||
// Auto-size all columns based on header count
|
||||
for ($i = 0; $i < count($headers); $i++) {
|
||||
$colLetter = chr(65 + $i); // 'A', 'B', etc.
|
||||
$sheet->getColumnDimension($colLetter)->setAutoSize(true);
|
||||
}
|
||||
|
||||
// Enable wrap text for all cells
|
||||
$maxColLetter = chr(64 + count($headers)); // Last column letter
|
||||
$sheet->getStyle("A2:{$maxColLetter}{$row}")->getAlignment()->setWrapText(true);
|
||||
|
||||
// Optional: center vertically for neatness
|
||||
$sheet->getStyle("A2:{$maxColLetter}{$row}")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
||||
|
||||
// Optional: Make row height auto (helps when wrap text is on)
|
||||
for ($i = 2; $i < $row; $i++) {
|
||||
$sheet->getRowDimension($i)->setRowHeight(-1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Save to temporary location
|
||||
$uploadFilePath = WRITEPATH . 'tmp/' . $filename;
|
||||
$writer = new Xlsx($spreadsheet);
|
||||
|
||||
@ -1209,6 +1209,10 @@ class PolicyTransactionController extends BaseController
|
||||
$client_branch_id = $issue_type['client_branch_id'];
|
||||
}
|
||||
|
||||
// if($data['bro_payable_by'] == ""){
|
||||
// $data['bro_payable_by'] = $issue_type['bro_payable_by'];
|
||||
// }
|
||||
|
||||
if (!$data['id']) {
|
||||
|
||||
$data += [
|
||||
@ -1224,7 +1228,7 @@ class PolicyTransactionController extends BaseController
|
||||
'policy_end_date' => $issue_type['policy_end_date'] ?? null,
|
||||
'revenue_type' => $issue_type['revenue_type'] ?? null,
|
||||
'co_share' => $issue_type['co_share'] ?? 0,
|
||||
'bro_payable_by' => $issue_type['bro_payable_by'] ?? 0,
|
||||
'bro_payable_by' => $data['bro_payable_by'] == "" ? $issue_type['bro_payable_by'] ?? 0 : $data['bro_payable_by'],
|
||||
'installment' => $issue_type['installment'] ?? null,
|
||||
'installment_data' => $issue_type['installment_data'] ?? null,
|
||||
'location' => $issue_type['location'] ?? null,
|
||||
@ -2279,7 +2283,9 @@ class PolicyTransactionController extends BaseController
|
||||
// if all good return true, otherwise return false with messssage
|
||||
foreach ($excel_data as $excel_key => $excel_row) {
|
||||
$is_row_empty = check_row_is_empty_or_null($excel_row);
|
||||
|
||||
if (!$is_row_empty) {
|
||||
|
||||
// $excel_row = ExcelSanitizeHelper::sanitizeArrayData($excel_row);
|
||||
$is_source_found = 0;
|
||||
// Kint::dump($excel_key,$excel_row[1],$excel_row[2]);
|
||||
@ -2297,8 +2303,17 @@ class PolicyTransactionController extends BaseController
|
||||
// Kint::dump($excel_key,$policy_no,$endorsement_no,$policy_start_date,$policy_end_date);//die();
|
||||
foreach ($source_data as $source_key => $source_row) {
|
||||
$source_endorsement_no = $source_row['endorsement_no'] !== null ? $source_row['endorsement_no'] : null;
|
||||
// Kint::dump($source_endorsement_no);
|
||||
if (($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no && change_date_format($policy_start_date, 'd-m-Y', 'Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date, 'd-m-Y', 'Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name'])
|
||||
// Kint::dump($source_row, $source_endorsement_no, $policy_no, $endorsement_no);
|
||||
|
||||
// if (($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no && change_date_format($policy_start_date, 'd-m-Y', 'Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date, 'd-m-Y', 'Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name'])
|
||||
// {
|
||||
// $is_source_found = 1;
|
||||
// $line_items = $line_items + 1;
|
||||
// unset($source_data[$source_key]);
|
||||
// continue 2;
|
||||
// }
|
||||
|
||||
if (($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no)
|
||||
{
|
||||
$is_source_found = 1;
|
||||
$line_items = $line_items + 1;
|
||||
@ -2395,7 +2410,8 @@ class PolicyTransactionController extends BaseController
|
||||
foreach ($source_data as $source_key => $source_row) {
|
||||
// Kint::dump(change_date_format($excel_row[3],'d-m-Y','Y-m-d'));
|
||||
$source_endorsement_no = $source_row['endorsement_no'] !== null ? $source_row['endorsement_no'] : null;
|
||||
if (($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no && change_date_format($policy_start_date, 'd-m-Y', 'Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date, 'd-m-Y', 'Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name']) {
|
||||
// if (($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no && change_date_format($policy_start_date, 'd-m-Y', 'Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date, 'd-m-Y', 'Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name']) {
|
||||
if (($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no) {
|
||||
$is_source_found = 1;
|
||||
|
||||
//calculate percentage first
|
||||
|
||||
@ -20,6 +20,7 @@ use App\Models\EmployeePolicyModel;
|
||||
use App\Models\InsurerModel;
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\TPAModel;
|
||||
use App\Models\ClaimFilesModel;
|
||||
|
||||
use DOMDocument;
|
||||
use Psr\Log\LoggerInterface;
|
||||
@ -58,6 +59,7 @@ class TicketController extends BaseController
|
||||
protected $extraFieldsDisplayForFrontend;
|
||||
protected $insurerModel;
|
||||
protected $TPAModel;
|
||||
protected $claimFilesModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -341,6 +343,7 @@ class TicketController extends BaseController
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
$this->insurerModel = new InsurerModel();
|
||||
$this->TPAModel = new TPAModel();
|
||||
$this->claimFilesModel = new ClaimFilesModel();
|
||||
}
|
||||
|
||||
public function ticketList()
|
||||
@ -825,8 +828,12 @@ class TicketController extends BaseController
|
||||
// dd($data);
|
||||
$data['ticket_data'] = $ticket_data;
|
||||
$data['acms'] = $this->employeeModel->getAcmUsingClientID($ticket_data['client_id']);
|
||||
|
||||
$raw_json = $this->ticketMasterModel->getPolicyTermsJson($ticket_id) ;
|
||||
|
||||
$decoded_top = json_decode($raw_json ?? "", true) ?? [];
|
||||
$data['policy_terms'] = $this->recursive_json_decode($decoded_top);
|
||||
|
||||
// dd($data);
|
||||
|
||||
return $this->loadLayout('ticket_edit_onbording', $data);
|
||||
}
|
||||
@ -2135,7 +2142,117 @@ class TicketController extends BaseController
|
||||
$date = \DateTime::createFromFormat($format, $value);
|
||||
return $date && $date->format($format) === $value;
|
||||
}
|
||||
|
||||
public function upload_url(){
|
||||
|
||||
$data = $this->request->getPost();
|
||||
|
||||
$insertArr = [];
|
||||
|
||||
foreach ($data['docs_name'] as $key => $eachData) {
|
||||
|
||||
if (!empty($eachData) ) {
|
||||
|
||||
$insertData = [
|
||||
'doc_name' => $data['docs_name'][$key]??'',
|
||||
'url' => $data['url'][$key]??'',
|
||||
'ticket_id'=> $data['ticket_id_url']??'',
|
||||
'created_by' => get_session_userid(),
|
||||
'is_active' => 1
|
||||
];
|
||||
|
||||
$insertArr[] = $insertData;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($insertArr)){
|
||||
// Insert into database
|
||||
$insert = $this->claimFilesModel->insertBatch($insertArr);
|
||||
}
|
||||
|
||||
|
||||
if (isset($insert) && !empty($insert)) {
|
||||
return $this->respond(['status' => true, 'message' => 'File uploaded successfully ']);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'message' => 'Failed to upload file ']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getUrlDataByTicketId()
|
||||
{
|
||||
$ticket_id = $this->request->getPost('ticket_id');
|
||||
|
||||
if (!$ticket_id) {
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'Ticket ID is required',
|
||||
'data' => []
|
||||
]);
|
||||
}
|
||||
|
||||
$urlData = $this->claimFilesModel
|
||||
->where('ticket_id', $ticket_id)
|
||||
->where('is_active',1)
|
||||
->findAll();
|
||||
|
||||
return $this->response->setJSON([
|
||||
'status' => true,
|
||||
'data' => $urlData
|
||||
]);
|
||||
}
|
||||
|
||||
public function remove_url()
|
||||
{
|
||||
$id = $this->request->getGet('id');
|
||||
|
||||
if (empty(trim($id))) {
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'Invalid ID'
|
||||
]);
|
||||
}
|
||||
|
||||
$updated = $this->claimFilesModel
|
||||
->where('id', $id)
|
||||
->set(['is_active' => 0])
|
||||
->update();
|
||||
|
||||
if ($updated) {
|
||||
return $this->response->setJSON([
|
||||
'status' => true,
|
||||
'message' => 'URL successfully marked inactive.'
|
||||
]);
|
||||
} else {
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'Failed to update record.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function recursive_json_decode($input) {
|
||||
if (is_string($input)) {
|
||||
$decoded = json_decode($input, true);
|
||||
if (json_last_error() === JSON_ERROR_NONE) {
|
||||
return $this->recursive_json_decode($decoded); // continue decoding recursively
|
||||
} else {
|
||||
return $input;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($input)) {
|
||||
foreach ($input as $key => $value) {
|
||||
$input[$key] = $this->recursive_json_decode($value);
|
||||
}
|
||||
}
|
||||
|
||||
return $input;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -664,12 +664,18 @@ if(!function_exists('generate_insurer_based_excel')){
|
||||
|
||||
$rowData = [];
|
||||
foreach ($excel_header_array as $header) {
|
||||
|
||||
$fieldName = $header['db_column_name'];
|
||||
$defaultValue = isset($header['default_value']) ? $header['default_value'] : null;
|
||||
|
||||
if ($fieldName === 'index') {
|
||||
$value = $serialNumber;
|
||||
} else {
|
||||
$value = $row->$fieldName ?? '';
|
||||
if(empty($fieldName) && !empty($defaultValue)){
|
||||
$value = $defaultValue;
|
||||
}else{
|
||||
$value = $row->$fieldName ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
$rowData[] = $value;
|
||||
|
||||
55
app/Models/ClaimFilesModel.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class ClaimFilesModel extends Model
|
||||
{
|
||||
protected $table = 'claim_files';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
'id',
|
||||
'ticket_id',
|
||||
'doc_name',
|
||||
'url',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'is_active'
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
protected function checkAndADDCreatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['created_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['created_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['updated_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@ -40,6 +40,7 @@ class ClientModel extends Model
|
||||
"reply_to",
|
||||
"mail_domain",
|
||||
"addon_subheading",
|
||||
"parent_client_id",
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -1085,10 +1085,10 @@ class EmployeePolicyModel extends Model
|
||||
}
|
||||
|
||||
$status_condition = "{$insurer_or_tpa}" === 'tpa'
|
||||
? "employee_polices.status = 'inactive' AND employees.emp_status = 'active'"
|
||||
? "employee_polices.status = 'active' AND employees.emp_status = 'active'"
|
||||
: "employee_polices.status = 'active' AND employees.emp_status = 'active'";
|
||||
|
||||
$endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NOT NULL OR a.endorsement_id != '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
$endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
|
||||
$query = $this->db->query("
|
||||
SELECT DISTINCT
|
||||
@ -1251,6 +1251,9 @@ class EmployeePolicyModel extends Model
|
||||
ee.id as emp_endorsement_primarykey,
|
||||
ep.id as emp_policy_primarykey,
|
||||
e.id as employees_primarykey,
|
||||
e.relationship,
|
||||
e.emp_code,
|
||||
e.name as emp_name,
|
||||
ee.file_id,
|
||||
ee.group_key,
|
||||
(
|
||||
@ -2098,4 +2101,6 @@ class EmployeePolicyModel extends Model
|
||||
// var_dump($this->db->getLastQuery());
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -765,7 +765,12 @@ class PolicyTransactionModel extends Model
|
||||
),
|
||||
2
|
||||
) AS unbilled_amt,
|
||||
created_user.first_name as user_name
|
||||
created_user.first_name as user_name,
|
||||
CASE
|
||||
WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
|
||||
WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
|
||||
ELSE `policy_transaction`.`policy_no` -- Default fallback
|
||||
END AS `policy_no`
|
||||
|
||||
")
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
@ -986,7 +991,12 @@ class PolicyTransactionModel extends Model
|
||||
pt_co_share_details.tp_amt AS tp,
|
||||
clients.pan,
|
||||
DATE_FORMAT(policy_transaction.created_at, '%d %b %Y %h:%i %p') AS created_at,
|
||||
user_profiles.first_name as user_name
|
||||
user_profiles.first_name as user_name,
|
||||
CASE
|
||||
WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
|
||||
WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
|
||||
ELSE `policy_transaction`.`policy_no` -- Default fallback
|
||||
END AS `policy_no`
|
||||
")
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||
@ -1049,8 +1059,8 @@ class PolicyTransactionModel extends Model
|
||||
|
||||
// Optimize Query Execution
|
||||
$builder->orderBy('policy_transaction.id', 'desc');
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
$data = $builder->get()->getResultArray();
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
@ -1065,7 +1075,12 @@ class PolicyTransactionModel extends Model
|
||||
client_branch.branch_name as client_branch_name,
|
||||
insurers.name AS insurer_name,
|
||||
insurers.short_name AS insurer_short_name,
|
||||
policy_type.policy_type
|
||||
policy_type.policy_type ,
|
||||
CASE
|
||||
WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
|
||||
WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
|
||||
ELSE `policy_transaction`.`policy_no` -- Default fallback
|
||||
END AS `policy_no`
|
||||
')
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('clients', 'policy_transaction.client_id = clients.id', 'left')
|
||||
@ -1228,7 +1243,12 @@ class PolicyTransactionModel extends Model
|
||||
AND co_share_stmt_details.is_active = 1
|
||||
),
|
||||
2
|
||||
) AS variance_amt
|
||||
) AS variance_amt,
|
||||
CASE
|
||||
WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
|
||||
WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
|
||||
ELSE `policy_transaction`.`policy_no` -- Default fallback
|
||||
END AS `policy_no`
|
||||
|
||||
|
||||
")
|
||||
@ -1317,7 +1337,6 @@ class PolicyTransactionModel extends Model
|
||||
'clients.client_name',
|
||||
'insurers.name AS insurer_name',
|
||||
'policy_type.policy_type',
|
||||
'policy_transaction.policy_no',
|
||||
'policy_transaction.endorsement_no',
|
||||
"CASE
|
||||
WHEN policy_transaction.action_type = 'inception' THEN 'I'
|
||||
@ -1327,7 +1346,12 @@ class PolicyTransactionModel extends Model
|
||||
'pt_co_share_details.bp_amt',
|
||||
'pt_co_share_details.tp_amt',
|
||||
'pt_co_share_details.tep_amt',
|
||||
'policy_transaction.status'
|
||||
'policy_transaction.status',
|
||||
'CASE
|
||||
WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
|
||||
WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
|
||||
ELSE `policy_transaction`.`policy_no` -- Default fallback
|
||||
END AS `policy_no`'
|
||||
])
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||
@ -1417,7 +1441,12 @@ class PolicyTransactionModel extends Model
|
||||
policy_transaction.action_type AS action_type_full,
|
||||
pt_co_share_details.exp_amt,
|
||||
pt_co_share_details.variance,
|
||||
policy_transaction.status
|
||||
policy_transaction.status,
|
||||
CASE
|
||||
WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
|
||||
WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
|
||||
ELSE `policy_transaction`.`policy_no` -- Default fallback
|
||||
END AS `policy_no`
|
||||
")
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||
@ -1490,7 +1519,6 @@ class PolicyTransactionModel extends Model
|
||||
clients.client_name,
|
||||
insurers.name AS insurer_name,
|
||||
policy_type.policy_type,
|
||||
policy_transaction.policy_no,
|
||||
policy_transaction.endorsement_no,
|
||||
CASE
|
||||
WHEN policy_transaction.action_type = 'inception' THEN 'I'
|
||||
@ -1525,7 +1553,12 @@ class PolicyTransactionModel extends Model
|
||||
inv_payment_details.statement_id = insurer_statements.id
|
||||
AND inv_payment_details.is_active = 1
|
||||
),
|
||||
2) AS outstanding_amount
|
||||
2) AS outstanding_amount,
|
||||
CASE
|
||||
WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
|
||||
WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
|
||||
ELSE `policy_transaction`.`policy_no` -- Default fallback
|
||||
END AS `policy_no`
|
||||
")
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id', 'left')
|
||||
|
||||
@ -953,4 +953,29 @@ class TicketMasterModel extends Model
|
||||
'ticket_ids' => $ticketIdsString
|
||||
];
|
||||
}
|
||||
|
||||
public function getPolicyTermsJson($ticket_id)
|
||||
{
|
||||
$sql = " SELECT cp.policy_terms
|
||||
FROM ticket_master tm
|
||||
JOIN client_policy cp ON cp.id = tm.client_policy_id
|
||||
WHERE tm.id = ?
|
||||
AND tm.is_active = 1
|
||||
AND cp.is_active = 1
|
||||
";
|
||||
|
||||
$binds = [$ticket_id];
|
||||
$query = $this->db->query($sql, $binds);
|
||||
|
||||
if ($query && $query->getNumRows() > 0) {
|
||||
$row = $query->getRowArray();
|
||||
return json_encode(['policy_terms' => $row['policy_terms']]);
|
||||
}
|
||||
|
||||
return json_encode(['policy_terms' => null]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<style>
|
||||
<!-- <style>
|
||||
body {
|
||||
.multiselect-native-select {
|
||||
position: relative;
|
||||
@ -34,7 +34,197 @@ body {
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
</style> -->
|
||||
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.multiselect-native-select {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.multiselect-native-select select {
|
||||
border: 0 !important;
|
||||
clip: rect(0 0 0 0) !important;
|
||||
height: 1px !important;
|
||||
margin: -1px -1px -1px -3px !important;
|
||||
overflow: hidden !important;
|
||||
padding: 0 !important;
|
||||
position: absolute !important;
|
||||
width: 1px !important;
|
||||
left: 50%;
|
||||
top: 30px;
|
||||
}
|
||||
|
||||
.multiselect-container {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.multiselect-selected-text {
|
||||
float: left !important;
|
||||
}
|
||||
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
/* Tooltip Styles */
|
||||
.tooltip-trigger {
|
||||
color: #007bff;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.tooltip-trigger:hover {
|
||||
color: #0056b3;
|
||||
}
|
||||
|
||||
.tooltip-container {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
pointer-events: none;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
|
||||
.tooltip {
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
background-color: white;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||||
padding: 15px;
|
||||
transition: opacity 0.3s, visibility 0.3s;
|
||||
max-width: 600px;
|
||||
min-width: 500px;
|
||||
max-height: 600px; /* Limits height */
|
||||
overflow-y: auto; /* Enables scrolling */
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
/* Optional: Custom scrollbar styling */
|
||||
.tooltip::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
.tooltip::-webkit-scrollbar-track {
|
||||
background: #f1f1f1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.tooltip::-webkit-scrollbar-thumb {
|
||||
background: #c1c1c1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.tooltip::-webkit-scrollbar-thumb:hover {
|
||||
background: #a8a8a8;
|
||||
}
|
||||
|
||||
/* .tooltip {
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
background-color: white;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||||
padding: 15px;
|
||||
transition: opacity 0.3s, visibility 0.3s;
|
||||
max-width: 600px;
|
||||
min-width: 500px;
|
||||
pointer-events: auto;
|
||||
} */
|
||||
|
||||
.tooltip::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
border-width: 5px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
.tooltip.show {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.tooltip-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.tooltip-table th {
|
||||
background-color: #f8f9fa;
|
||||
font-weight: bold;
|
||||
padding: 8px;
|
||||
border: 1px solid #dee2e6;
|
||||
text-align: left;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.tooltip-table td {
|
||||
padding: 6px 8px;
|
||||
border: 1px solid #dee2e6;
|
||||
vertical-align: top;
|
||||
font-size: 11px;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.tooltip-table tbody tr:nth-child(even) {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
.tooltip-table tbody tr:hover {
|
||||
background-color: #e3f2fd;
|
||||
}
|
||||
|
||||
.team-cell {
|
||||
font-weight: bold;
|
||||
background-color: #e7f3ff !important;
|
||||
}
|
||||
|
||||
/* Form styling for demo */
|
||||
.form-group {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.form-control {
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: 0.375rem 0.75rem;
|
||||
font-size: 1rem;
|
||||
line-height: 1.5;
|
||||
color: #495057;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ced4da;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
|
||||
label {
|
||||
display: inline-block;
|
||||
margin-bottom: 0.5rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.text-danger {
|
||||
color: #dc3545;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- End ADD and EDIT Page HTML -->
|
||||
<div class="row" id="List-page">
|
||||
<div class="col-12">
|
||||
@ -96,7 +286,7 @@ table.dataTable tbody td {
|
||||
|
||||
<!-- modal content -->
|
||||
|
||||
<div id="con-close-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
|
||||
<div id="con-close-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;" data-backdrop="static">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -142,7 +332,9 @@ table.dataTable tbody td {
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="emp_code">User Role<span class="text-danger">*</span></label>
|
||||
<label for="emp_code">User Role<span class="text-danger">*</span>
|
||||
<span class="tooltip-trigger fa fa-info-circle" id="roleAccessMatrixTrigger"></span>
|
||||
</label>
|
||||
<select class="form-control" id="role" name="role" required>
|
||||
<option value="">Select Role</option>
|
||||
<?php foreach($roleData as $value) { ?>
|
||||
@ -153,7 +345,9 @@ table.dataTable tbody td {
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="profile">User Team<span class="text-danger">*</span></label>
|
||||
<label for="profile">User Team<span class="text-danger">*</span>
|
||||
<span class="tooltip-trigger fa fa-info-circle" id="accessMatrixTrigger"></span>
|
||||
</label>
|
||||
<select hidden class="form-control" id="team" name="team[]" multiple required>
|
||||
<?php foreach($teamData as $value) { ?>
|
||||
<option value="<?= $value['id'] ?>"><?= $value['name'] ?></option>
|
||||
@ -175,145 +369,449 @@ table.dataTable tbody td {
|
||||
</div>
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<!-- Tooltip container separate from trigger -->
|
||||
<div class="tooltip-container" id="tooltipContainer">
|
||||
<div class="tooltip" id="accessMatrixTooltip">
|
||||
<table class="tooltip-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Team</th>
|
||||
<th>Module</th>
|
||||
<th>Access Rights</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="team-cell">Management</td>
|
||||
<td>BDS - All access</td>
|
||||
<td>All access</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="team-cell" rowspan="5">Finance</td>
|
||||
<td>BDS - Policy Transaction</td>
|
||||
<td>Policy | Endorsement | Statement Upload</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BDS - Report</td>
|
||||
<td>TAT wise | ACM Status wise | ACM TAT wise</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BDS - Pending Actions</td>
|
||||
<td>Finance Team</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BDS - Masters</td>
|
||||
<td>Vehicle | CD</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BDS - Documents</td>
|
||||
<td>✓</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="team-cell" rowspan="5">Business</td>
|
||||
<td>BDS - Policy Transaction</td>
|
||||
<td>Policy | Endorsement</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BDS - Report</td>
|
||||
<td>TAT wise | ACM Status wise | ACM TAT wise</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BDS - Pending Actions</td>
|
||||
<td>Business Team</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BDS - Masters</td>
|
||||
<td>Vehicle | CD</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BDS - Documents</td>
|
||||
<td>✓</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="team-cell" rowspan="2">POS</td>
|
||||
<td>BDS - Policy Transaction</td>
|
||||
<td>Policy | Endorsement</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BDS - Report</td>
|
||||
<td>BDS, TAT wise | ACM Status wise | ACM TAT wise</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="team-cell">Enrollment</td>
|
||||
<td>Inception File Upload</td>
|
||||
<td>All access</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="team-cell">Claims</td>
|
||||
<td>Claims</td>
|
||||
<td>All access</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="team-cell">Sales</td>
|
||||
<td>LEAD</td>
|
||||
<td>Lead creation | RFQ creation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="team-cell">Business Support</td>
|
||||
<td>LEAD</td>
|
||||
<td>All access</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tooltip-container" id="roleTooltipContainer">
|
||||
<div class="tooltip" id="roleAccessMatrixTooltip">
|
||||
<table class="tooltip-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Team</th>
|
||||
<th>Module</th>
|
||||
<th>Access Rights</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="team-cell">Head</td>
|
||||
<td>All modules</td>
|
||||
<td>All access</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="team-cell">Admin</td>
|
||||
<td>All modules</td>
|
||||
<td>All access</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="team-cell">Manager</td>
|
||||
<td>Access to all modules except the "Masters" module</td>
|
||||
<td>All access</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="team-cell">Account Manager</td>
|
||||
<td>Access to all modules except the "Masters" module</td>
|
||||
<td>All access without "Delete option"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="team-cell">Staff</td>
|
||||
<td>Based on the "Teams"</td>
|
||||
<td>Based on the "Teams"</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function () {
|
||||
|
||||
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" + // Keep your original alignment for the search and buttons
|
||||
"<'row'<'col-sm-12'tr>>" + // Table rows
|
||||
"<'row'<'col-sm-6'i><'col-sm-6'p>>",
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'UserList',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" + // Keep your original alignment for the search and buttons
|
||||
"<'row'<'col-sm-12'tr>>" + // Table rows
|
||||
"<'row'<'col-sm-6'i><'col-sm-6'p>>",
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'UserList',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
],
|
||||
|
||||
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('#team').multiselect({
|
||||
nonSelectedText: 'Select Team',
|
||||
enableFiltering: false,
|
||||
enableCaseInsensitiveFiltering: false,
|
||||
includeSelectAllOption : false,
|
||||
buttonWidth:'100%'
|
||||
});
|
||||
|
||||
|
||||
$('#btnAdd').click(function(){
|
||||
$('#first_name').val('');
|
||||
$('#last_name').val('');
|
||||
$('#email').val('');
|
||||
$('#mobile').val('');
|
||||
$('#emp_code').val('');
|
||||
$('#UserForm').attr('action', '<?php echo base_url('/user/create');?>');
|
||||
})
|
||||
|
||||
|
||||
$('.close').click(function(){
|
||||
$('#UserId').val('');
|
||||
$('#first_name').val('');
|
||||
$('#email').val('');
|
||||
$('#mobile').val('');
|
||||
$('#emp_code').val('');
|
||||
$('#role').val('')
|
||||
})
|
||||
|
||||
|
||||
$('body').on('click', '.btnEdit', function () {
|
||||
var user_id = $(this).attr('data-id');
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('user/getuser/');?>'+user_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
console.log(res)
|
||||
$('#updateModal').modal('show');
|
||||
$('#role').val('')
|
||||
$('#UserForm').attr('action', '<?php echo base_url('user/edit');?>');
|
||||
$('#UserId').val(res.data.id);
|
||||
$('#first_name').val(res.data.first_name);
|
||||
$('#last_name').val(res.data.last_name);
|
||||
$('#email').val(res.data.email);
|
||||
$('#mobile').val(res.data.mobile);
|
||||
$('#emp_code').val(res.data.emp_code);
|
||||
$('#role option[value="' + res.data.role + '"]').prop('selected', true);
|
||||
$('#btnSubmit').html('Update');
|
||||
|
||||
$.each(res.userTeamData, function(index, item) {
|
||||
$('#team option[value="' + item.team_id + '"]').prop('selected', true);
|
||||
$('#team').multiselect('refresh');
|
||||
});
|
||||
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error("Error Details:");
|
||||
console.error("Status Code:", xhr.status);
|
||||
console.error("Status Text:", xhr.statusText);
|
||||
console.error("Response Text:", xhr.responseText);
|
||||
console.error("Ready State:", xhr.readyState);
|
||||
console.error("Response Headers:", xhr.getAllResponseHeaders());
|
||||
console.error("Error Thrown:", error);
|
||||
console.error("Status:", status);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('#team').multiselect({
|
||||
nonSelectedText: 'Select Team',
|
||||
enableFiltering: false,
|
||||
enableCaseInsensitiveFiltering: false,
|
||||
includeSelectAllOption : false,
|
||||
buttonWidth:'100%'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '.btnDelete', function () {
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this user",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
|
||||
var student_id = $(this).attr('data-id');
|
||||
$.get('<?php echo base_url('user/deactive/');?>'+student_id, function (data) {
|
||||
console.log(data);
|
||||
toastr.success('User removed successfully', 'success');
|
||||
window.location.reload()
|
||||
})
|
||||
}
|
||||
$('#btnAdd').click(function(){
|
||||
$('#first_name').val('');
|
||||
$('#last_name').val('');
|
||||
$('#email').val('');
|
||||
$('#mobile').val('');
|
||||
$('#emp_code').val('');
|
||||
$('#UserForm').attr('action', '<?php echo base_url('/user/create');?>');
|
||||
})
|
||||
|
||||
|
||||
$('.close').click(function(){
|
||||
$('#UserId').val('');
|
||||
$('#first_name').val('');
|
||||
$('#email').val('');
|
||||
$('#mobile').val('');
|
||||
$('#emp_code').val('');
|
||||
$('#role').val('')
|
||||
})
|
||||
|
||||
|
||||
$('body').on('click', '.btnEdit', function () {
|
||||
var user_id = $(this).attr('data-id');
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('user/getuser/');?>'+user_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
console.log(res)
|
||||
$('#updateModal').modal('show');
|
||||
$('#role').val('')
|
||||
$('#UserForm').attr('action', '<?php echo base_url('user/edit');?>');
|
||||
$('#UserId').val(res.data.id);
|
||||
$('#first_name').val(res.data.first_name);
|
||||
$('#last_name').val(res.data.last_name);
|
||||
$('#email').val(res.data.email);
|
||||
$('#mobile').val(res.data.mobile);
|
||||
$('#emp_code').val(res.data.emp_code);
|
||||
$('#role option[value="' + res.data.role + '"]').prop('selected', true);
|
||||
$('#btnSubmit').html('Update');
|
||||
|
||||
$.each(res.userTeamData, function(index, item) {
|
||||
$('#team option[value="' + item.team_id + '"]').prop('selected', true);
|
||||
$('#team').multiselect('refresh');
|
||||
});
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error("Error Details:");
|
||||
console.error("Status Code:", xhr.status);
|
||||
console.error("Status Text:", xhr.statusText);
|
||||
console.error("Response Text:", xhr.responseText);
|
||||
console.error("Ready State:", xhr.readyState);
|
||||
console.error("Response Headers:", xhr.getAllResponseHeaders());
|
||||
console.error("Error Thrown:", error);
|
||||
console.error("Status:", status);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '.btnDelete', function () {
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this user",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
|
||||
});
|
||||
var student_id = $(this).attr('data-id');
|
||||
$.get('<?php echo base_url('user/deactive/');?>'+student_id, function (data) {
|
||||
console.log(data);
|
||||
toastr.success('User removed successfully', 'success');
|
||||
window.location.reload()
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function onlyNumbers(event){
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if(charcode>= 48 && charcode <= 57)return true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
var form = document.getElementById("UserForm");
|
||||
function onlyNumbers(event){
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if(charcode>= 48 && charcode <= 57)return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add submit event listener to the form
|
||||
form.addEventListener("submit", function(event) {
|
||||
// Disable the submit button to avoid multiple submissions
|
||||
// document.getElementById("btnSubmit").disabled = true;
|
||||
});
|
||||
var form = document.getElementById("UserForm");
|
||||
|
||||
// Add submit event listener to the form
|
||||
form.addEventListener("submit", function(event) {
|
||||
// Disable the submit button to avoid multiple submissions
|
||||
// document.getElementById("btnSubmit").disabled = true;
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
function initializeTooltip() {
|
||||
|
||||
const trigger = document.getElementById('accessMatrixTrigger');
|
||||
console.log(trigger);
|
||||
const tooltip = document.getElementById('accessMatrixTooltip');
|
||||
console.log(tooltip);
|
||||
const tooltipContainer = document.getElementById('tooltipContainer');
|
||||
console.log(tooltipContainer);
|
||||
|
||||
if (!trigger || !tooltip || !tooltipContainer) {
|
||||
console.error('Tooltip elements not found');
|
||||
return;
|
||||
}
|
||||
|
||||
function positionTooltip(event) {
|
||||
const triggerRect = trigger.getBoundingClientRect();
|
||||
const tooltipRect = tooltip.getBoundingClientRect();
|
||||
const viewportWidth = window.innerWidth;
|
||||
const viewportHeight = window.innerHeight;
|
||||
|
||||
let left = triggerRect.right + 10; // 10px to the right of trigger
|
||||
let top = triggerRect.top;
|
||||
|
||||
// Check if tooltip goes off-screen to the right
|
||||
if (left + tooltipRect.width > viewportWidth) {
|
||||
left = triggerRect.left - tooltipRect.width - 10; // Show to the left instead
|
||||
}
|
||||
|
||||
// Check if tooltip goes off-screen at the bottom
|
||||
if (top + tooltipRect.height > viewportHeight) {
|
||||
top = viewportHeight - tooltipRect.height - 10;
|
||||
}
|
||||
|
||||
// Ensure tooltip doesn't go above viewport
|
||||
if (top < 10) {
|
||||
top = 10;
|
||||
}
|
||||
|
||||
tooltipContainer.style.left = left + 'px';
|
||||
tooltipContainer.style.top = top + 'px';
|
||||
|
||||
// Position arrow
|
||||
const arrow = tooltip.querySelector('::after');
|
||||
if (left < triggerRect.left) {
|
||||
// Tooltip is to the left, arrow should point right
|
||||
tooltip.style.setProperty('--arrow-position', 'right');
|
||||
} else {
|
||||
// Tooltip is to the right, arrow should point left
|
||||
tooltip.style.setProperty('--arrow-position', 'left');
|
||||
}
|
||||
}
|
||||
|
||||
// Show tooltip on hover
|
||||
trigger.addEventListener('mouseenter', function(event) {
|
||||
positionTooltip(event);
|
||||
tooltip.classList.add('show');
|
||||
});
|
||||
|
||||
// Hide tooltip when mouse leaves trigger
|
||||
trigger.addEventListener('mouseleave', function() {
|
||||
tooltip.classList.remove('show');
|
||||
});
|
||||
|
||||
// Keep tooltip visible when hovering over the tooltip itself
|
||||
tooltip.addEventListener('mouseenter', function() {
|
||||
tooltip.classList.add('show');
|
||||
});
|
||||
|
||||
tooltip.addEventListener('mouseleave', function() {
|
||||
tooltip.classList.remove('show');
|
||||
});
|
||||
|
||||
// Reposition on window resize
|
||||
window.addEventListener('resize', function() {
|
||||
if (tooltip.classList.contains('show')) {
|
||||
positionTooltip();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initializeRoleTooltip() {
|
||||
|
||||
const trigger = document.getElementById('roleAccessMatrixTrigger');
|
||||
console.log(trigger);
|
||||
const tooltip = document.getElementById('roleAccessMatrixTooltip');
|
||||
console.log(tooltip);
|
||||
const tooltipContainer = document.getElementById('roleTooltipContainer');
|
||||
console.log(tooltipContainer);
|
||||
|
||||
if (!trigger || !tooltip || !tooltipContainer) {
|
||||
console.error('Tooltip elements not found');
|
||||
return;
|
||||
}
|
||||
|
||||
function positionTooltip(event) {
|
||||
const triggerRect = trigger.getBoundingClientRect();
|
||||
const tooltipRect = tooltip.getBoundingClientRect();
|
||||
const viewportWidth = window.innerWidth;
|
||||
const viewportHeight = window.innerHeight;
|
||||
|
||||
let left = triggerRect.right + 10; // 10px to the right of trigger
|
||||
let top = triggerRect.top;
|
||||
|
||||
// Check if tooltip goes off-screen to the right
|
||||
if (left + tooltipRect.width > viewportWidth) {
|
||||
left = triggerRect.left - tooltipRect.width - 10; // Show to the left instead
|
||||
}
|
||||
|
||||
// Check if tooltip goes off-screen at the bottom
|
||||
if (top + tooltipRect.height > viewportHeight) {
|
||||
top = viewportHeight - tooltipRect.height - 10;
|
||||
}
|
||||
|
||||
// Ensure tooltip doesn't go above viewport
|
||||
if (top < 10) {
|
||||
top = 10;
|
||||
}
|
||||
|
||||
tooltipContainer.style.left = left + 'px';
|
||||
tooltipContainer.style.top = top + 'px';
|
||||
|
||||
// Position arrow
|
||||
const arrow = tooltip.querySelector('::after');
|
||||
if (left < triggerRect.left) {
|
||||
// Tooltip is to the left, arrow should point right
|
||||
tooltip.style.setProperty('--arrow-position', 'right');
|
||||
} else {
|
||||
// Tooltip is to the right, arrow should point left
|
||||
tooltip.style.setProperty('--arrow-position', 'left');
|
||||
}
|
||||
}
|
||||
|
||||
// Show tooltip on hover
|
||||
trigger.addEventListener('mouseenter', function(event) {
|
||||
positionTooltip(event);
|
||||
tooltip.classList.add('show');
|
||||
});
|
||||
|
||||
// Hide tooltip when mouse leaves trigger
|
||||
trigger.addEventListener('mouseleave', function() {
|
||||
tooltip.classList.remove('show');
|
||||
});
|
||||
|
||||
// Keep tooltip visible when hovering over the tooltip itself
|
||||
tooltip.addEventListener('mouseenter', function() {
|
||||
tooltip.classList.add('show');
|
||||
});
|
||||
|
||||
tooltip.addEventListener('mouseleave', function() {
|
||||
tooltip.classList.remove('show');
|
||||
});
|
||||
|
||||
// Reposition on window resize
|
||||
window.addEventListener('resize', function() {
|
||||
if (tooltip.classList.contains('show')) {
|
||||
positionTooltip();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Initialize when DOM is ready
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', initializeTooltip);
|
||||
document.addEventListener('DOMContentLoaded', initializeRoleTooltip);
|
||||
} else {
|
||||
initializeTooltip();
|
||||
initializeRoleTooltip();
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -62,8 +62,8 @@
|
||||
<!-- <td><?php echo isset($file['policy_name']) ? $file['policy_name'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?> - <?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?></td> -->
|
||||
<td><?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?></td>
|
||||
<td><?php echo $file['event_type'] ?></td>
|
||||
<td><?php echo $file['insurer_or_tpa'] ?></td>
|
||||
<td><?php echo $file['actions'] ?></td>
|
||||
<td><?php echo $insurer_or_tpa[$file['insurer_or_tpa']] ?></td>
|
||||
<td><?php echo $import_or_export[$file['actions']] ?></td>
|
||||
<td><?php echo $file['count'] == null ? '-' : $file['count'] ?></td>
|
||||
|
||||
<td><?php echo format_indian_number($file['amount'])?></td>
|
||||
|
||||
@ -81,7 +81,7 @@
|
||||
</div>
|
||||
|
||||
<div id="cdButtonWrapper" class="form-group text-right m-b-0">
|
||||
<button class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
|
||||
<button class="btn btn-primary waves-effect waves-light mr-1" id="cd_master_btn_Submit">Submit</button>
|
||||
<!-- <button type="button" class="btn btn-secondry waves-effect waves-light mr-1" data-dismiss="modal" aria-hidden="true">Close</button> -->
|
||||
</div>
|
||||
</form>
|
||||
@ -129,10 +129,10 @@
|
||||
if(res.status == true){
|
||||
toastr.warning(res.message, 'warning');
|
||||
// $('#cd_ac_no').val('');
|
||||
$('#btnSubmit').prop('disabled',true);
|
||||
$('#cd_master_btn_Submit').prop('disabled',true);
|
||||
return;
|
||||
}
|
||||
$('#btnSubmit').prop('disabled',false);
|
||||
$('#cd_master_btn_Submit').prop('disabled',false);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
@ -283,7 +283,7 @@
|
||||
$('#opening_bal').val('');
|
||||
// $('#CDMasterForm').attr('action', '<?php echo base_url('master/cash_deposite/create');?>');
|
||||
$('#title').html('Add Opening Amount');
|
||||
$('#btnSubmit').html('Submit');
|
||||
$('#cd_master_btn_Submit').html('Submit');
|
||||
|
||||
var myModal = new bootstrap.Modal(document.getElementById('con-close-modal'));
|
||||
myModal.show();
|
||||
|
||||
@ -280,15 +280,15 @@ table.dataTable thead th {
|
||||
$('#insurer_branch_id').val(res.data.insurer_id).change();
|
||||
$('#insurer_branch_id').prop("disabled", true);
|
||||
$('#opening_date').val(res.data.opening_date);
|
||||
$('#cd_ac_no').val(res.data.cd_ac_no);
|
||||
//$('#cd_ac_no').prop("disabled", true);
|
||||
$('#cd_ac_no_for_cd_master').val(res.data.cd_ac_no);
|
||||
//$('#cd_ac_no_for_cd_master').prop("disabled", true);
|
||||
$('#opening_bal').val(res.data.opening_bal);
|
||||
if(res.cd_transaction_count <= 1){
|
||||
$('#opening_bal').prop("disabled", false)
|
||||
}else{
|
||||
$('#opening_bal').prop("disabled", true)
|
||||
}
|
||||
$('#btnSubmit').html('Update');
|
||||
$('#cd_master_btn_Submit').html('Update');
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
|
||||
329
app/Views/claim_files_upload.php
Normal file
@ -0,0 +1,329 @@
|
||||
|
||||
<div class="tab-pane" id="fileupload">
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card mb-1">
|
||||
<h5 class="m-1">
|
||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
|
||||
aria-expanded="true">
|
||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;color:black;"></i>
|
||||
</a>
|
||||
</h5>
|
||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<form class="parsley-examples" id="drive_file_upload_form" method="post"
|
||||
enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" id="ticket_id_url" name="ticket_id_url">
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<div id="dynamic-form-container"></div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="g_drive_file_upload_sbt_btn">Submit</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="file_table" class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">File List</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="table-responsive" style="overflow-x: auto;">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>S.No</th>
|
||||
<th>Docs Name</th>
|
||||
<th>File Name</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="table_bd">
|
||||
</tbody>
|
||||
</table>
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- edit modal -->
|
||||
<div class="modal fade" id="edit_url_modal" tabindex="-1" role="dialog" aria-labelledby="editUrlModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<form id="edit_url_form">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Edit URL</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<input type="hidden" id="edit_url_id" name="id">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="edit_doc_name">Document Name</label>
|
||||
<input type="text" class="form-control" id="edit_doc_name" name="doc_name">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="edit_url_link">URL</label>
|
||||
<input type="text" class="form-control" id="edit_url_link" name="url">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Save Changes</button>
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
|
||||
let ticket_id = $('#ticket_master_id').val();
|
||||
|
||||
$('#ticket_id_url').val(ticket_id);
|
||||
|
||||
let urlData = getUrlDataByTicketId(ticket_id);
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
$("#drive_file_upload_form").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var isValid = $('#drive_file_upload_form').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return ;
|
||||
}
|
||||
|
||||
form_action = '<?php echo base_url() . 'ticket/upload_url' ?>';
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var formData = new FormData($('#drive_file_upload_form')[0]);
|
||||
|
||||
|
||||
|
||||
$.ajax({
|
||||
data:formData,
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
if(res.status == true){
|
||||
toastr.success(res.message, 'Success');
|
||||
window.location.reload();
|
||||
}else{
|
||||
toastr.error(res.message, 'Error');
|
||||
}
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.log("error in submission of url data");
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
},
|
||||
complete : function(){
|
||||
console.log("ajax call is completed for submission of url data..!!");
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function addHTMLInput()
|
||||
{
|
||||
const container = document.getElementById('dynamic-form-container');
|
||||
const newRow = document.createElement('div');
|
||||
newRow.className = 'form-row dynamic-form-row';
|
||||
newRow.innerHTML = `
|
||||
<div class="form-group col-md-5">
|
||||
<label for="file_name">Document Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="docs_name" name="docs_name[]" placeholder="Enter file name" required
|
||||
value=""
|
||||
>
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<label for="file">URL<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="url_name" name="url[]" required
|
||||
value=""
|
||||
>
|
||||
</div>
|
||||
<div class="form-group col-md-2" style="position: relative;top: 28px;">
|
||||
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)">x</a>
|
||||
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="addHTMLInput(this)">+</a>
|
||||
</div>
|
||||
`;
|
||||
container.appendChild(newRow);
|
||||
|
||||
}
|
||||
|
||||
function removeHTMLInput(element)
|
||||
{
|
||||
const container = document.getElementById('dynamic-form-container');
|
||||
const rows = container.querySelectorAll('.dynamic-form-row');
|
||||
|
||||
if (rows.length > 1) {
|
||||
const row = element.closest('.dynamic-form-row');
|
||||
row.remove();
|
||||
}
|
||||
}
|
||||
|
||||
function getUrlDataByTicketId(ticket_id) {
|
||||
|
||||
// Show loader
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: "<?= base_url('ticket/getUrlDataByTicketId')?>", // base_url must be defined in JS
|
||||
type: "POST",
|
||||
data: { ticket_id: ticket_id },
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log('Form submitted response:', response);
|
||||
|
||||
if (response.status === true) {
|
||||
create_url_list(response.data);
|
||||
addHTMLInput();
|
||||
return ;
|
||||
} else {
|
||||
addHTMLInput();
|
||||
console.warn("No Data");
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log("error in get urldata api");
|
||||
console.error("AJAX Error:", error);
|
||||
},
|
||||
complete: function() {
|
||||
// Hide loader
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log("Ajax is completed for get url data..!!");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function openEditModal(id, docName, url) {
|
||||
$('#edit_url_id').val(id);
|
||||
$('#edit_doc_name').val(docName);
|
||||
$('#edit_url_link').val(url);
|
||||
$('#edit_url_modal').modal('show'); // Bootstrap modal
|
||||
}
|
||||
|
||||
|
||||
function create_url_list(data) {
|
||||
$('#table_bd').empty(); // clear existing rows
|
||||
|
||||
let base_url = "<?php echo base_url() ?>";
|
||||
|
||||
if (data && data.length > 0) {
|
||||
let html = "";
|
||||
|
||||
data.forEach((item, index) => {
|
||||
html += `
|
||||
<tr>
|
||||
<td>${index + 1}</td>
|
||||
<td>${item.doc_name}</td>
|
||||
<td><a href="${item.url}" target="_blank">${item.url}</a></td>
|
||||
<td>
|
||||
<a href="javascript:void(0);" class="delete-url"
|
||||
style="bacolor:black;"
|
||||
data-href="${base_url}/ticket/remove_url?id=${item.id}">
|
||||
<i class="mdi mdi-delete mr-1"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
|
||||
$('#table_bd').append(html);
|
||||
} else {
|
||||
$('#table_bd').html('<tr><td colspan="4">No Data Found</td></tr>');
|
||||
}
|
||||
}
|
||||
$(document).on('click', '.delete-url', function (e) {
|
||||
e.preventDefault();
|
||||
const url = $(this).data('href');
|
||||
const $row = $(this).closest('tr'); // capture the row before async execution
|
||||
|
||||
confirmActionSweertAlert("Do you want to delete?", "Yes, Proceed!", "No, Cancel")
|
||||
.then((confirmed) => {
|
||||
if (confirmed) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
beforeSend: function () {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.status === true) {
|
||||
toastr.success('Removed Successfully');
|
||||
$row.remove();
|
||||
} else {
|
||||
toastr.error(response.message || 'Deletion failed');
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.log("error ");
|
||||
console.error("AJAX Error:", error);
|
||||
toastr.error('AJAX request failed');
|
||||
},
|
||||
complete: function () {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log("Ajax is completed for get url data..!!");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@ -111,6 +111,17 @@ input:checked + .slider:before {
|
||||
<label for="gst">GST<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="gst" placeholder="Enter GST Number" data-parsley-error-message="Invalid GST Number. Example: 12ABCDE1234F5Z6" value="<?= isset($client['gst']) ? $client['gst'] : '' ?>" name="gst" data-parsley-trigger="change" data-parsley-pattern="^\d{2}[A-Z]{5}\d{4}[A-Z]{1}[A-Z\d]{1}[Z]{1}[A-Z\d]{1}$" required>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="parent_client_id">Parent Group<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="parent_client_id" name="parent_client_id">
|
||||
<option value="" >Select Parent</option>
|
||||
<?php foreach($clients as $value) { ?>
|
||||
<option value="<?= $value['id'] ?>" <?= isset($client['parent_client_id']) && $client['parent_client_id'] == $value['id'] ? "selected" : '' ?>><?= $value['client_name'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
@ -171,9 +182,10 @@ input:checked + .slider:before {
|
||||
var form_action = '';
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#client_logo').change(function() {
|
||||
validateFile(this);
|
||||
});
|
||||
$('#client_logo').change(function() {
|
||||
validateFile(this);
|
||||
});
|
||||
$('#parent_client_id').select2();
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
@ -93,7 +93,7 @@ table.dataTable thead th {
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="<?= base_url("client/list/"); ?><?= $row->id;?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" href="<?= base_url("client/deposit/{$row->id}"); ?>"><i class="mdi mdi-cash mr-2 text-muted font-18 vertical-middle"></i>CD Transactions</a>
|
||||
<?php if(get_role_id() != 3 && get_role_id() != 4) { ?>
|
||||
<?php if(in_array(get_role_id(), [1, 5])) { ?>
|
||||
<a class="dropdown-item" data-id="<?= $row->id;?>" onclick="removeClient(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
@ -316,39 +316,105 @@ $(document).ready(function()
|
||||
});
|
||||
})
|
||||
|
||||
//DO NOT REMOVE THIS FUNCTION >>> THI FUNCTION FOR CLIENT SOFT DELETE
|
||||
// function removeClient(element)
|
||||
// {
|
||||
|
||||
// Swal.fire({
|
||||
// title: "Are you sure?",
|
||||
// text: "You need to remove this client.",
|
||||
// icon: "info",
|
||||
// showCancelButton: true,
|
||||
// confirmButtonColor: "#3085d6",
|
||||
// confirmButtonText: "Yes",
|
||||
// }).then((result) => {
|
||||
|
||||
// if (result.isConfirmed) {
|
||||
|
||||
// $('.loader').fadeIn();
|
||||
// $('.loader-mask').fadeIn();
|
||||
|
||||
// var id = element.getAttribute('data-id');
|
||||
// var form_action = '<?= base_url("client/remove/") ?>' + id;
|
||||
// $.ajax({
|
||||
// url: form_action,
|
||||
// type: "GET",
|
||||
// dataType: 'json',
|
||||
// processData: false,
|
||||
// contentType: false,
|
||||
// success: function(res) {
|
||||
|
||||
// $('.loader').fadeOut();
|
||||
// $('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
// if(res){
|
||||
// if (res.status == true) {
|
||||
// toastr.success('Client removed successfully.', 'success');
|
||||
// location.reload();
|
||||
// } else {
|
||||
// Swal.fire({
|
||||
// title: "warning!",
|
||||
// text: res.message,
|
||||
// icon: "warning"
|
||||
// });
|
||||
// // toastr.warning(res.message, 'warning');
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// error: function (xhr, status, error) {
|
||||
// console.error(xhr.responseText);
|
||||
// console.error(status, error);
|
||||
// $('.loader').fadeOut();
|
||||
// $('.loader-mask').delay(350).fadeOut('slow');
|
||||
// console.log('Something Wrong!', 'warning');
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// });
|
||||
|
||||
// }
|
||||
|
||||
function removeClient(element)
|
||||
{
|
||||
{
|
||||
console.log("Remove client function called")
|
||||
console.log('element', element);
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this client.",
|
||||
icon: "info",
|
||||
html: `Is this a Demo Client?, Please reconfirm by clicking Yes to delete. <br> <span style = "color : red; font-size : 14px;">Note : This data will be deleted permanently and cannot be recovered.</span>`,
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
|
||||
console.log('Print the result : ', result)
|
||||
if (result.isConfirmed) {
|
||||
|
||||
console.log('Click Yes : ', result.isConfirmed);
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("client/remove/") ?>' + id;
|
||||
console.log('client_id', id);
|
||||
|
||||
var form_action = '<?= base_url("/client/wipe") ?>';
|
||||
console.log('URL : ', form_action);
|
||||
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "GET",
|
||||
type: "POST",
|
||||
data: {client_id : id},
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log('Client remove function response : ', res);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
if(res){
|
||||
if (res.status == true) {
|
||||
toastr.success('Client removed successfully.', 'success');
|
||||
toastr.success(res.message, 'success');
|
||||
location.reload();
|
||||
} else {
|
||||
Swal.fire({
|
||||
@ -358,7 +424,6 @@ function removeClient(element)
|
||||
});
|
||||
// toastr.warning(res.message, 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
@ -371,7 +436,6 @@ function removeClient(element)
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$(document).on('click', '.client_info', function() {
|
||||
|
||||
@ -1,5 +1,26 @@
|
||||
<div class="tab-pane fade" id="police-tab">
|
||||
<style>
|
||||
|
||||
.save-indicator {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
background: #28a745;
|
||||
color: white;
|
||||
padding: 2px 8px;
|
||||
border-radius: 10px;
|
||||
font-size: 11px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s;
|
||||
}
|
||||
|
||||
.save-indicator.show {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="save-indicator" id="saveIndicator">Saved</div>
|
||||
<div class="tab-pane fade" id="police-tab">
|
||||
|
||||
<div class="row float-right" style="padding-bottom: 10px; position: relative;right: 13px;">
|
||||
<button type="button" id="BtnAdd" class="btn btn-primary waves-effect waves-light btnAdd btn-sm" style="position: relative;right: 10px;"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policy</button>
|
||||
@ -7,9 +28,8 @@
|
||||
</div>
|
||||
|
||||
<div class="table-responsive" id="table_list">
|
||||
|
||||
<table class="table table-borderless table mb-0" id="table-client-policy">
|
||||
<thead class="thead-light">
|
||||
<table class="table table-borderless table mb-0" id="table-client-policy">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Insurer</th>
|
||||
<th>Policy</th>
|
||||
@ -127,6 +147,7 @@
|
||||
<label for="cd_ac_no">CD Account Number<span id="tpa_danger" class="text-danger">*</span></label>
|
||||
<select class="form-control" id="cd_ac_no" name="cd_ac_no" required>
|
||||
<option value="">Select CD Account Number</option>
|
||||
<option value="add_cd">+ Add New CD</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -198,6 +219,7 @@
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
@ -237,8 +259,7 @@
|
||||
</div>
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<script>
|
||||
|
||||
<script>
|
||||
// $('#inception_type').change(function () {
|
||||
// var open_data = $('#open_date').parent();
|
||||
// var close_data = $('#close_date').parent();
|
||||
@ -259,6 +280,8 @@
|
||||
|
||||
var policy_PrimaryKey = $('#client_id_policy').val();
|
||||
var policy_client = $('#policy_PrimaryKey').val();
|
||||
var submitInterval = null;
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
// Initialize select2
|
||||
@ -325,6 +348,7 @@
|
||||
|
||||
|
||||
if (policy_PrimaryKey !== '') {
|
||||
|
||||
var policyTable = '';
|
||||
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
||||
console.log('client_policy_data',data)
|
||||
@ -395,7 +419,7 @@
|
||||
<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="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><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 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>`;
|
||||
|
||||
// Conditionally render the delete option based on the role
|
||||
@ -639,7 +663,7 @@
|
||||
<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="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><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 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>`;
|
||||
|
||||
// Conditionally render the delete option based on the role
|
||||
@ -1106,7 +1130,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkDateStatus(inputDate, bg = false) {
|
||||
|
||||
var givenDate = new Date(inputDate);
|
||||
@ -1250,7 +1273,6 @@
|
||||
return result.trim();
|
||||
}
|
||||
|
||||
|
||||
function onlyNumbers(event) {
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
@ -1258,7 +1280,6 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function formatNumber(input, maxLength) {
|
||||
|
||||
//console.log("input", input);
|
||||
@ -1350,7 +1371,6 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
$('#policy_type').change(function() {
|
||||
|
||||
$('#insurer').val('').change();
|
||||
@ -2110,6 +2130,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
// for CD master
|
||||
$('#cd_ac_no').change(function(){
|
||||
|
||||
let cd_ac_no = $(this).val();
|
||||
@ -2138,5 +2159,119 @@
|
||||
$('#insurer_branch_id').val(firstPart).trigger('change');
|
||||
$('#insurer_id_for_cd').val(secondPart).trigger('change');
|
||||
}
|
||||
// End
|
||||
|
||||
function numberToWordsIndian(num) {
|
||||
|
||||
num = num.toString();
|
||||
if (typeof num === 'string') {
|
||||
// Remove all commas and convert to number
|
||||
num = parseFloat(num.replace(/,/g, ''));
|
||||
// Check if conversion resulted in NaN
|
||||
if (isNaN(num)) {
|
||||
return "invalid number";
|
||||
}
|
||||
}
|
||||
|
||||
if (num === 0) return "zero";
|
||||
if (num < 0) return "minus " + numberToWordsIndian(-num);
|
||||
|
||||
const ones = [
|
||||
"", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
|
||||
"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen",
|
||||
"seventeen", "eighteen", "nineteen"
|
||||
];
|
||||
|
||||
const tens = [
|
||||
"", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"
|
||||
];
|
||||
|
||||
function convertHundreds(n) {
|
||||
let result = "";
|
||||
|
||||
if (n >= 100) {
|
||||
result += ones[Math.floor(n / 100)] + " hundred";
|
||||
n %= 100;
|
||||
if (n > 0) result += " ";
|
||||
}
|
||||
|
||||
if (n >= 20) {
|
||||
result += tens[Math.floor(n / 10)];
|
||||
n %= 10;
|
||||
if (n > 0) result += " " + ones[n];
|
||||
} else if (n > 0) {
|
||||
result += ones[n];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
let result = "";
|
||||
let crores = Math.floor(num / 10000000);
|
||||
num %= 10000000;
|
||||
|
||||
let lakhs = Math.floor(num / 100000);
|
||||
num %= 100000;
|
||||
|
||||
let thousands = Math.floor(num / 1000);
|
||||
num %= 1000;
|
||||
|
||||
let hundreds = num;
|
||||
|
||||
if (crores > 0) {
|
||||
result += convertHundreds(crores) + " crore";
|
||||
if (lakhs > 0 || thousands > 0 || hundreds > 0) result += " ";
|
||||
}
|
||||
|
||||
if (lakhs > 0) {
|
||||
result += convertHundreds(lakhs) + " lakh";
|
||||
if (thousands > 0 || hundreds > 0) result += " ";
|
||||
}
|
||||
|
||||
if (thousands > 0) {
|
||||
result += convertHundreds(thousands) + " thousand";
|
||||
if (hundreds > 0) result += " ";
|
||||
}
|
||||
|
||||
if (hundreds > 0) {
|
||||
result += convertHundreds(hundreds);
|
||||
}
|
||||
|
||||
return result.trim();
|
||||
}
|
||||
|
||||
// Start the interval
|
||||
function startAutoSubmit(attrId) {
|
||||
if (!submitInterval) {
|
||||
submitInterval = setInterval(function() {
|
||||
if(attrId == "GMC"){
|
||||
autoSaveGmcTerms();
|
||||
}else if(attrId == "GPA"){
|
||||
autoSaveGpaTerms();
|
||||
}else if(attrId == "OTHERS"){
|
||||
autoSaveOtherTerms();
|
||||
}
|
||||
}, 20000);
|
||||
console.log("Auto-submit started.");
|
||||
}
|
||||
}
|
||||
|
||||
// Stop the interval
|
||||
function stopAutoSubmit() {
|
||||
if (submitInterval) {
|
||||
clearInterval(submitInterval);
|
||||
submitInterval = null;
|
||||
console.log("Auto-submit stopped.");
|
||||
}
|
||||
}
|
||||
|
||||
//Tiny Toastr
|
||||
function showTinyToast(attrId = "saveIndicator"){
|
||||
const saveIndicator = document.getElementById(attrId);
|
||||
saveIndicator.classList.add('show');
|
||||
setTimeout(() => {
|
||||
saveIndicator.classList.remove('show');
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -106,6 +106,8 @@
|
||||
<th class="font-weight-medium">EMP Code</th>
|
||||
<th class="font-weight-medium">Relationship</th>
|
||||
<th class="font-weight-medium">Gender</th>
|
||||
<th class="font-weight-medium">Email</th>
|
||||
<th class="font-weight-medium">Mobile</th>
|
||||
<th class="font-weight-medium">Date of Birth</th>
|
||||
<th class="font-weight-medium">Policy name</th>
|
||||
<th class="font-weight-medium">Insurer name</th>
|
||||
@ -141,6 +143,8 @@
|
||||
<td><?php echo $employee['emp_code']; ?></td>
|
||||
<td><?php echo $employee['relationship']; ?></td>
|
||||
<td><?php echo $employee['gender']; ?></td>
|
||||
<td><?php echo $employee['email_corporate']; ?></td>
|
||||
<td><?php echo $employee['mobile']; ?></td>
|
||||
<td><?php echo date('d/m/Y', strtotime($employee['dob'])); ?></td>
|
||||
<td><?php echo isset($employee['policy_type']) ? $employee['policy_type'] : ''; ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : ''; ?></td>
|
||||
<td><?php echo $employee['insurer_short_name']; ?></td>
|
||||
|
||||
@ -89,7 +89,7 @@ input:checked + .slider:before {
|
||||
<input id="addition_add_day" type="checkbox" name="addition_add_day" <?= (isset($insurer['addition_add_day']) && $insurer['addition_add_day'] == 1) ? 'checked' : '' ?>>
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="addition_add_day" style="position: relative;top: 30px;left: 82px;">Add one day to date of coverage when Addition/Dependent addition</label>
|
||||
<label for="addition_add_day" style="position: relative;top: 30px;left: 82px;">Add one day to date of coverage when <br> Addition/Dependent addition</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
|
||||
@ -80,7 +80,7 @@
|
||||
<th>S.NO</th>
|
||||
<th>Policy Type</th>
|
||||
<th>Event Type</th>
|
||||
<th>Import/Export</th>
|
||||
<th>Upload/Download</th>
|
||||
<th>Template</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
@ -92,7 +92,7 @@
|
||||
<td><?= $key+1; ?></td>
|
||||
<td><?= $value['policy_type']; ?></td>
|
||||
<td><?= $events[$value['event_name']]; ?></td>
|
||||
<td><?= $value['type_name']; ?></td>
|
||||
<td><?= $value['type_name'] == 'import' ? 'Upload' : 'Download'; ?></td>
|
||||
<td style="overflow: hidden;" class="truncate" ><?= $value['jsoncolumns']; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
@ -471,13 +471,10 @@
|
||||
const newRow = document.createElement('div');
|
||||
newRow.className = 'form-row dynamic-form-row';
|
||||
newRow.innerHTML = `
|
||||
<div class="form-group col-md-5">
|
||||
<label for="excel_column_name">Header Name<span class="text-danger">*</span></label>
|
||||
<input id="excel_column_name" value="${data !== null && data !== undefined && data !== '' ? data.column_name : ''}" class="form-control" type="text" name="excel_column_name[]" placeholder="Excel Header Column Name">
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="db_column_name">DataBase Column Name<span class="text-danger"></span></label>
|
||||
<select class="form-control db-column-name-select" name="db_column_name[]" onchange="checkForDuplicates(this)">
|
||||
<select class="form-control db-column-name-select dbColumn" name="db_column_name[]" onchange="checkForDuplicates(this); handleDbColumnChange(this)" ${data !== null && data !== undefined && data !== '' && data.default_value != "" && data.default_value != null ? 'disabled' : ''}>
|
||||
<option value="" selected >Select</option>
|
||||
<?php if (!empty($db_column_name)){ ?>
|
||||
<?php foreach ($db_column_name as $key => $value) { ?>
|
||||
@ -486,17 +483,30 @@
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="excel_column_name">Header Name<span class="text-danger">*</span></label>
|
||||
<input id="excel_column_name" value="${data !== null && data !== undefined && data !== '' ? data.column_name : ''}" class="form-control" type="text" name="excel_column_name[]" placeholder="Excel Header Column Name">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="default_value">Default Value<span class="text-danger"></span></label>
|
||||
<input id="default_value" value="${data != null && data != undefined && data != '' && data.default_value != "" && data.default_value != null ? data.default_value : ''}" class="form-control" type="text" name="default_value[]" placeholder="Excel Default value">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2" style="position: relative;top: 28px;">
|
||||
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="addHTMLInput(this)">+</a>
|
||||
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)">x</a>
|
||||
</div>
|
||||
`;
|
||||
container.appendChild(newRow);
|
||||
|
||||
if (data !== null && data.db_column_name !== undefined) {
|
||||
if (data != null && data.db_column_name != undefined) {
|
||||
const selectElement = newRow.querySelector('.db-column-name-select');
|
||||
selectElement.value = data.db_column_name;
|
||||
$('.dbColumn').select2();
|
||||
}
|
||||
|
||||
$('.dbColumn').select2();
|
||||
}
|
||||
|
||||
// function removeHTMLInput(element)
|
||||
@ -523,6 +533,7 @@
|
||||
|
||||
try {
|
||||
var columnNames = $('input[name="excel_column_name[]"]');
|
||||
var defaultValues = $('input[name="default_value[]"]');
|
||||
var dbColumnNames = $('select[name="db_column_name[]"]');
|
||||
|
||||
// Check if both arrays are of the same length
|
||||
@ -534,6 +545,7 @@
|
||||
columnNames.each(function(index) {
|
||||
var columnName = $(this).val();
|
||||
var dbColumnName = dbColumnNames.eq(index).val() ?? null;
|
||||
var defaultValue = defaultValues.eq(index).val() ?? null;
|
||||
|
||||
// if (!columnName) {
|
||||
// throw new Error(`Column name at index ${index} is empty.`);
|
||||
@ -545,7 +557,8 @@
|
||||
var columnObj = {
|
||||
'column_index': index,
|
||||
'column_name': columnName,
|
||||
'db_column_name': dbColumnName
|
||||
'db_column_name': dbColumnName,
|
||||
'default_value': defaultValue
|
||||
};
|
||||
formArray.push(columnObj);
|
||||
});
|
||||
@ -695,4 +708,55 @@
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('input', 'input[name="default_value[]"]', function () {
|
||||
let $defaultInput = $(this);
|
||||
let $row = $defaultInput.closest('.form-row, .row'); // Adjust based on your actual container
|
||||
let $dbSelect = $row.find('select[name="db_column_name[]"]');
|
||||
|
||||
if ($defaultInput.val().trim() !== '') {
|
||||
$dbSelect.val('').trigger('change').prop('disabled', true);
|
||||
} else {
|
||||
$dbSelect.prop('disabled', false);
|
||||
}
|
||||
});
|
||||
|
||||
function handleDbColumnChange(element) {
|
||||
console.log('=== SELECT CHANGE EVENT TRIGGERED ===');
|
||||
|
||||
let $defaultInput = $(element);
|
||||
console.log('1. Current select element:', $defaultInput);
|
||||
console.log('2. Current select value:', $defaultInput.val());
|
||||
|
||||
let $row = $defaultInput.closest('.form-row, .row');
|
||||
console.log('3. Found row element:', $row);
|
||||
console.log('4. Row exists:', $row.length > 0);
|
||||
|
||||
// Updated to find input instead of select for excel_column_name
|
||||
let $excelInput = $row.find('input[name="excel_column_name[]"]');
|
||||
console.log('5. Target input element:', $excelInput);
|
||||
console.log('6. Target input exists:', $excelInput.length > 0);
|
||||
console.log('7. Current target input value:', $excelInput.val());
|
||||
|
||||
// Get the selected option's text (the display text, not the value)
|
||||
let selectedText = $defaultInput.find('option:selected').text().trim();
|
||||
console.log('8. Selected option text:', selectedText);
|
||||
console.log('9. Selected text length:', selectedText.length);
|
||||
|
||||
// Also get the selected value for comparison
|
||||
let selectedValue = $defaultInput.val();
|
||||
console.log('10. Selected option value:', selectedValue);
|
||||
|
||||
if (selectedText !== '' && selectedText !== 'Select') {
|
||||
console.log('11. Setting target input value to:', selectedText);
|
||||
$excelInput.val(selectedText);
|
||||
console.log('12. Target input value after setting:', $excelInput.val());
|
||||
} else {
|
||||
console.log('11. Selected text is empty or "Select", clearing target input');
|
||||
// $excelInput.val("");
|
||||
console.log('12. Target input value after clearing:', $excelInput.val());
|
||||
}
|
||||
|
||||
console.log('=== EVENT HANDLING COMPLETE ===');
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -33,7 +33,7 @@
|
||||
<li class="nav-item">
|
||||
<a href="#template-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="insurer_export_templete">
|
||||
<span class="mr-1"><i class="mdi mdi-file-export font-16"></i></span>
|
||||
<span class="d-none d-sm-inline-block">Insurer Export Templete</span>
|
||||
<span class="d-none d-sm-inline-block">Insurer Download Templete</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
@ -653,10 +653,8 @@
|
||||
|
||||
});
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
$('#import_excel_download').click(function() {
|
||||
|
||||
// Check if the element with ID "import_excel_download" has the href attribute set
|
||||
@ -682,4 +680,87 @@
|
||||
}
|
||||
});
|
||||
|
||||
//------------- CHECK CD BALANCE in SESSION -----------------------------------------------------------------------------------------
|
||||
|
||||
// Global variables
|
||||
var submitInterval = null;
|
||||
var messageShown = false; // Flag to prevent duplicate messages
|
||||
|
||||
//function for checking the session
|
||||
function checkCDBalance() {
|
||||
|
||||
<?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')); ?>;
|
||||
|
||||
console.log("cdBalance : ", cdBalance);
|
||||
console.log("cdAmount : ", cdAmount);
|
||||
console.log("excel_file_amt : ", excel_file_amt);
|
||||
|
||||
// Only show message once and if status is false
|
||||
if (cdBalance === 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>' +
|
||||
'<strong>Total Amount:</strong> ₹' + (excel_file_amt || 0);
|
||||
|
||||
toastr.warning(message1, 'WARNING', {
|
||||
allowHtml: true,
|
||||
timeOut: 10000,
|
||||
extendedTimeOut: 3000
|
||||
});
|
||||
messageShown = true; // Prevent showing message again
|
||||
stopInterval();
|
||||
} else if (cdBalance === true) {
|
||||
console.log("CD Balance is sufficient");
|
||||
stopInterval();
|
||||
}
|
||||
|
||||
<?php
|
||||
session()->remove('cd_balance');
|
||||
session()->remove('cd_amount');
|
||||
session()->remove('excel_file_amt');
|
||||
?>
|
||||
|
||||
<?php else: ?>
|
||||
console.log("No cd_balance session found");
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
||||
// Start the interval
|
||||
function startInterval() {
|
||||
if (!submitInterval) {
|
||||
messageShown = false; // Reset message flag
|
||||
submitInterval = setInterval(function() {
|
||||
checkCDBalance();
|
||||
}, 2000);
|
||||
console.log("Checking CD balance started...");
|
||||
}
|
||||
}
|
||||
|
||||
// Stop the interval
|
||||
function stopInterval() {
|
||||
if (submitInterval) {
|
||||
clearInterval(submitInterval);
|
||||
submitInterval = null;
|
||||
<?php
|
||||
session()->remove('cd_balance');
|
||||
session()->remove('cd_amount');
|
||||
session()->remove('excel_file_amt');
|
||||
?>
|
||||
console.log("Interval stopped.");
|
||||
}
|
||||
}
|
||||
|
||||
// When click the button to start the interval
|
||||
$(document).ready(function() {
|
||||
$('#emp_form_submit_button_2').on('click', function() {
|
||||
console.log("Submit button clicked, starting interval...");
|
||||
startInterval();
|
||||
});
|
||||
});
|
||||
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
|
||||
</script>
|
||||
@ -209,9 +209,11 @@ table.dataTable tbody td {
|
||||
<i class="mdi mdi-note-text mr-2 text-muted font-18 vertical-middle"></i>RFQ
|
||||
</a>
|
||||
<?php if(!in_array($row['status'], ['queued', 'rfq_created', 'rfq_sent'])) { ?>
|
||||
<a href="<?= base_url('/rfq/list/').$row['id'] . '/' . 2; ?>" class="dropdown-item btnEdit3" data-id="<?= $row['id']; ?>">
|
||||
<i class="mdi mdi-note-text mr-2 text-muted font-18 vertical-middle"></i>QCR
|
||||
</a>
|
||||
<?php if(in_array(get_role_id(), [1, 5, 2, 3]) || in_array(BUSINESS_SUPPORT_TEAM_ID, user_team()) ) { ?>
|
||||
<a href="<?= base_url('/rfq/list/').$row['id'] . '/' . 2; ?>" class="dropdown-item btnEdit3" data-id="<?= $row['id']; ?>">
|
||||
<i class="mdi mdi-note-text mr-2 text-muted font-18 vertical-middle"></i>QCR
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="cost_center">Mobile<span class="text-danger">*</span></label>
|
||||
<label for="cost_center">Mobile<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="phone" placeholder="Enter Mobile Number" maxlength="10" name="phone"
|
||||
onkeypress="return onlyNumbers(event)" onchange="validateInputForClient(this, 'clients', 'phone')">
|
||||
</div>
|
||||
@ -47,7 +47,7 @@
|
||||
<input type="email" class="form-control" id="email2" placeholder="Enter Email" name="email2">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="aadhar">Aadhar</label>
|
||||
<label for="aadhar">Aadhar</label>
|
||||
<input type="text" class="form-control" id="aadhar" placeholder="Enter Aadher No" name="aadhar" maxlength="12" onchange="validateInputForClient(this, 'clients', 'aadhar')">
|
||||
</div>
|
||||
|
||||
@ -86,7 +86,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branch_code">Mobile<span class="text-danger">*</span></label>
|
||||
<label for="branch_code">Mobile<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="mobile" maxlength="10" name="mobile" onkeypress="return onlyNumbers(event)">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
|
||||
@ -97,8 +97,6 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<div id="policyGMCTerms" style="display:none">
|
||||
<span id="policyGMCTermsClose"
|
||||
style="float: right;font-size: 26px;color: red;margin-top: -42px;margin-left: 3px;margin-right: 7px;">x</span>
|
||||
@ -878,7 +876,6 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
var policy_grid_id = $('#client_id').val();
|
||||
var grid_html = '';
|
||||
@ -1012,7 +1009,6 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var specialConditions = [];
|
||||
|
||||
$(".removeDom").each(function() {
|
||||
@ -1086,7 +1082,6 @@
|
||||
}, 500);
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '.btnPolicyMaster', function() {
|
||||
// alert("HELLO");
|
||||
|
||||
@ -1127,302 +1122,303 @@
|
||||
}, 1000);
|
||||
// $('#nameOfThePolicyInGMC').html(' - ' + response.policy_name.name);
|
||||
$('gmc_emp_count').val(response.count);
|
||||
|
||||
|
||||
|
||||
if (response) {
|
||||
|
||||
if (response.emp_count_by_policy != 0) {
|
||||
|
||||
$('#btnGridSubmit1').hide();
|
||||
$('#myButtonSpecialCondition').hide();
|
||||
|
||||
} else {
|
||||
$('#btnGridSubmit1').show();
|
||||
$('#myButtonSpecialCondition').show();
|
||||
startAutoSubmit('GMC');
|
||||
}
|
||||
|
||||
let jsonObject = JSON.parse(response.data);
|
||||
disableUnwantedTerms(jsonObject);
|
||||
Object.keys(jsonObject).forEach(function(key) {
|
||||
if(jsonObject){
|
||||
Object.keys(jsonObject).forEach(function(key) {
|
||||
|
||||
if (key.includes("special_condition_label") || key.includes(
|
||||
"special_condition_input")) {
|
||||
if (key.includes("special_condition_label")) {
|
||||
for (let index = 0; index < jsonObject[key]
|
||||
.length; index++) {
|
||||
specialCondition();
|
||||
}
|
||||
}
|
||||
|
||||
//console.log('key', key)
|
||||
let elements = document.getElementsByName(`${key}[]`);
|
||||
//console.log(elements)
|
||||
|
||||
if (elements) {
|
||||
elements.forEach((element, index) => {
|
||||
//console.log()
|
||||
if (jsonObject[key][index] == undefined) {
|
||||
element.value = " ";
|
||||
if (key.includes("special_condition_label") || key.includes("special_condition_input")) {
|
||||
if (key.includes("special_condition_label")) {
|
||||
if (jsonObject[key] && Array.isArray(jsonObject[key])) {
|
||||
for (let index = 0; index < jsonObject[key].length; index++) {
|
||||
specialCondition();
|
||||
}
|
||||
} else {
|
||||
element.value = jsonObject[key][index];
|
||||
console.warn(`jsonObject[${key}] is not a valid array.`);
|
||||
}
|
||||
}
|
||||
|
||||
if (key.includes("special_condition_label")) {
|
||||
let checkbox = $(element).closest('.form-group').find('input[name="special_condition_display[]"]');
|
||||
console.log("First element:", element);
|
||||
//console.log('key', key)
|
||||
let elements = document.getElementsByName(`${key}[]`);
|
||||
//console.log(elements)
|
||||
|
||||
if (checkbox.length) {
|
||||
console.log("Checkbox found:", checkbox);
|
||||
if (elements) {
|
||||
elements.forEach((element, index) => {
|
||||
//console.log()
|
||||
if (jsonObject[key][index] == undefined) {
|
||||
element.value = " ";
|
||||
} else {
|
||||
element.value = jsonObject[key][index];
|
||||
|
||||
// Correct way to set the 'id' attribute
|
||||
let formattedValue = jsonObject[key][index].replace(/[\s\-\/,&]+/g, '').toLowerCase();
|
||||
console.log('formattedValue', formattedValue);
|
||||
checkbox.attr('id', formattedValue + '_display');
|
||||
if (key.includes("special_condition_label")) {
|
||||
let checkbox = $(element).closest('.form-group').find('input[name="special_condition_display[]"]');
|
||||
console.log("First element:", element);
|
||||
|
||||
console.log("Updated Checkbox:", checkbox);
|
||||
} else {
|
||||
console.log("Checkbox not found for:", element);
|
||||
if (checkbox.length) {
|
||||
console.log("Checkbox found:", checkbox);
|
||||
|
||||
// Correct way to set the 'id' attribute
|
||||
let formattedValue = jsonObject[key][index].replace(/[\s\-\/,&]+/g, '').toLowerCase();
|
||||
console.log('formattedValue', formattedValue);
|
||||
checkbox.attr('id', formattedValue + '_display');
|
||||
|
||||
console.log("Updated Checkbox:", checkbox);
|
||||
} else {
|
||||
console.log("Checkbox not found for:", element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (key.includes("multiple_sum_insured")) {
|
||||
// jsonObject[key].forEach((value, index) => {
|
||||
// appendGMCSIAddMore(value);
|
||||
// });
|
||||
// }
|
||||
|
||||
if (key.includes("multiple_sum_insured") && key != "") {
|
||||
|
||||
if (Array.isArray(jsonObject[key])) {
|
||||
jsonObject[key].forEach((value, index) => {
|
||||
appendGMCSIAddMore(value);
|
||||
});
|
||||
} else {
|
||||
console.log(`${key} is not an array.`);
|
||||
}
|
||||
}
|
||||
|
||||
if (key === "family_floater") {
|
||||
|
||||
if (jsonObject[key] === "Floater") {
|
||||
setTimeout(() => {
|
||||
|
||||
$("#familyFloaterYes").prop("checked", true);
|
||||
}, 100); // delay in milliseconds
|
||||
|
||||
} else {
|
||||
|
||||
$("#familyFloaterNo").prop("checked", true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (key.includes("multiple_sum_insured")) {
|
||||
// jsonObject[key].forEach((value, index) => {
|
||||
// appendGMCSIAddMore(value);
|
||||
// });
|
||||
// }
|
||||
|
||||
if (key.includes("multiple_sum_insured") && key != "") {
|
||||
|
||||
if (Array.isArray(jsonObject[key])) {
|
||||
jsonObject[key].forEach((value, index) => {
|
||||
appendGMCSIAddMore(value);
|
||||
});
|
||||
} else {
|
||||
console.log(`${key} is not an array.`);
|
||||
}
|
||||
}
|
||||
|
||||
if (key === "family_floater") {
|
||||
|
||||
if (jsonObject[key] === "Floater") {
|
||||
setTimeout(() => {
|
||||
|
||||
$("#familyFloaterYes").prop("checked", true);
|
||||
}, 100); // delay in milliseconds
|
||||
|
||||
} else {
|
||||
|
||||
$("#familyFloaterNo").prop("checked", true);
|
||||
}
|
||||
|
||||
|
||||
if (key.includes("family_floaters")) {
|
||||
|
||||
let checkboxes = document.querySelectorAll(
|
||||
`input[name="${key}[]"]`);
|
||||
if (jsonObject[key]) {
|
||||
|
||||
console.log(jsonObject[key]);
|
||||
if (jsonObject[key].childrens) {
|
||||
$('#children').val(jsonObject[key].childrens);
|
||||
}
|
||||
|
||||
if (jsonObject[key].self == 0) {
|
||||
$('#self').prop('checked', false);
|
||||
}
|
||||
|
||||
if (jsonObject[key].spouse == 0) {
|
||||
$('#spouse').prop('checked', false);
|
||||
} else {
|
||||
$('#spouse').prop('checked', true);
|
||||
}
|
||||
|
||||
|
||||
if (jsonObject[key]['either-parents-pil'] == 1) {
|
||||
$('#family_floaters').val('EPORPIL');
|
||||
} else if (jsonObject[key].parents == 1 && jsonObject[key][
|
||||
'parents-in-law'
|
||||
] == 1) {
|
||||
$('#family_floaters').val('2EPORPIL');
|
||||
} else if (jsonObject[key].parents == 2 && jsonObject[key][
|
||||
'parents-in-law'
|
||||
] == 2) {
|
||||
$('#family_floaters').val('4EPORPIL');
|
||||
} else if (jsonObject[key].parents == 1) {
|
||||
$('#family_floaters').val('1P');
|
||||
} else if (jsonObject[key].parents == 2) {
|
||||
$('#family_floaters').val('2P');
|
||||
} else if (jsonObject[key]['parents-in-law'] == 1) {
|
||||
$('#family_floaters').val('1PIL');
|
||||
} else if (jsonObject[key]['parents-in-law'] == 2) {
|
||||
$('#family_floaters').val('2PIL');
|
||||
} else if (jsonObject[key]['either-parents-pil'] == 2) {
|
||||
$('#family_floaters').val('2EPORPIL');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (key.includes("family_floaters")) {
|
||||
|
||||
let checkboxes = document.querySelectorAll(
|
||||
`input[name="${key}[]"]`);
|
||||
if (jsonObject[key]) {
|
||||
|
||||
console.log(jsonObject[key]);
|
||||
console.log(jsonObject[key]);
|
||||
if (jsonObject[key].childrens) {
|
||||
$('#children').val(jsonObject[key].childrens);
|
||||
}
|
||||
|
||||
if (jsonObject[key].self == 0) {
|
||||
$('#self').prop('checked', false);
|
||||
}
|
||||
|
||||
if (jsonObject[key].spouse == 0) {
|
||||
$('#spouse').prop('checked', false);
|
||||
} else {
|
||||
$('#spouse').prop('checked', true);
|
||||
}
|
||||
let elements = document.getElementsByName(key);
|
||||
if (elements && elements.length > 0) {
|
||||
let element = elements[
|
||||
0]; // Assuming you want to update the first element with the name
|
||||
|
||||
|
||||
if (jsonObject[key]['either-parents-pil'] == 1) {
|
||||
$('#family_floaters').val('EPORPIL');
|
||||
} else if (jsonObject[key].parents == 1 && jsonObject[key][
|
||||
'parents-in-law'
|
||||
] == 1) {
|
||||
$('#family_floaters').val('2EPORPIL');
|
||||
} else if (jsonObject[key].parents == 2 && jsonObject[key][
|
||||
'parents-in-law'
|
||||
] == 2) {
|
||||
$('#family_floaters').val('4EPORPIL');
|
||||
} else if (jsonObject[key].parents == 1) {
|
||||
$('#family_floaters').val('1P');
|
||||
} else if (jsonObject[key].parents == 2) {
|
||||
$('#family_floaters').val('2P');
|
||||
} else if (jsonObject[key]['parents-in-law'] == 1) {
|
||||
$('#family_floaters').val('1PIL');
|
||||
} else if (jsonObject[key]['parents-in-law'] == 2) {
|
||||
$('#family_floaters').val('2PIL');
|
||||
} else if (jsonObject[key]['either-parents-pil'] == 2) {
|
||||
$('#family_floaters').val('4EPORPIL');
|
||||
}
|
||||
}
|
||||
if (element.tagName === 'INPUT' && (element.type ===
|
||||
'checkbox' || element.type === 'radio')) {
|
||||
|
||||
}
|
||||
if (element.type === 'checkbox') {
|
||||
element.checked = jsonObject[key] ===
|
||||
'1'; // Assuming jsonObject[key] is '1' or '0' for checkbox
|
||||
} else if (element.type === 'radio') {
|
||||
|
||||
if (element.value === jsonObject[key]) {
|
||||
element.checked = element.value === jsonObject[key];
|
||||
|
||||
if (element.name === "family_floater") {
|
||||
element.parentElement.nextElementSibling.style
|
||||
.display = '';
|
||||
element.parentElement.parentElement
|
||||
.parentElement.nextElementSibling.style
|
||||
.display = '';
|
||||
// alert('family floater');
|
||||
} else if (element.name ===
|
||||
"waiverofpreexistingdiseases") {
|
||||
element.parentElement.parentElement
|
||||
.nextElementSibling.style.display = '';
|
||||
element.parentElement.parentElement
|
||||
.nextElementSibling.nextElementSibling.style
|
||||
.display = '';
|
||||
element.parentElement.parentElement
|
||||
.nextElementSibling.nextElementSibling
|
||||
.nextElementSibling.style.display = '';
|
||||
element.parentElement.parentElement
|
||||
.nextElementSibling.nextElementSibling
|
||||
.nextElementSibling.nextElementSibling.style
|
||||
.display = '';
|
||||
|
||||
} else if (element.name === "ayudhtreatmentcover") {
|
||||
element.parentElement.parentElement
|
||||
.nextElementSibling.style.display = '';
|
||||
} else if (element.name === "ailmentcapping") {
|
||||
element.parentElement.parentElement
|
||||
.nextElementSibling.style.display = '';
|
||||
} else if (element.name === "copayzonewisecopay") {
|
||||
element.parentElement.parentElement
|
||||
.nextElementSibling.style.display = '';
|
||||
} else if (element.name === "cataract") {
|
||||
element.parentElement.parentElement
|
||||
.nextElementSibling.style.display = '';
|
||||
}
|
||||
|
||||
|
||||
let elements = document.getElementsByName(key);
|
||||
if (elements && elements.length > 0) {
|
||||
let element = elements[
|
||||
0]; // Assuming you want to update the first element with the name
|
||||
|
||||
|
||||
if (element.tagName === 'INPUT' && (element.type ===
|
||||
'checkbox' || element.type === 'radio')) {
|
||||
|
||||
if (element.type === 'checkbox') {
|
||||
element.checked = jsonObject[key] ===
|
||||
'1'; // Assuming jsonObject[key] is '1' or '0' for checkbox
|
||||
} else if (element.type === 'radio') {
|
||||
|
||||
if (element.value === jsonObject[key]) {
|
||||
element.checked = element.value === jsonObject[key];
|
||||
|
||||
if (element.name === "family_floater") {
|
||||
element.parentElement.nextElementSibling.style
|
||||
.display = '';
|
||||
element.parentElement.parentElement
|
||||
.parentElement.nextElementSibling.style
|
||||
.display = '';
|
||||
// alert('family floater');
|
||||
} else if (element.name ===
|
||||
"waiverofpreexistingdiseases") {
|
||||
element.parentElement.parentElement
|
||||
.nextElementSibling.style.display = '';
|
||||
element.parentElement.parentElement
|
||||
.nextElementSibling.nextElementSibling.style
|
||||
.display = '';
|
||||
element.parentElement.parentElement
|
||||
.nextElementSibling.nextElementSibling
|
||||
.nextElementSibling.style.display = '';
|
||||
element.parentElement.parentElement
|
||||
.nextElementSibling.nextElementSibling
|
||||
.nextElementSibling.nextElementSibling.style
|
||||
.display = '';
|
||||
|
||||
} else if (element.name === "ayudhtreatmentcover") {
|
||||
element.parentElement.parentElement
|
||||
.nextElementSibling.style.display = '';
|
||||
} else if (element.name === "ailmentcapping") {
|
||||
element.parentElement.parentElement
|
||||
.nextElementSibling.style.display = '';
|
||||
} else if (element.name === "copayzonewisecopay") {
|
||||
element.parentElement.parentElement
|
||||
.nextElementSibling.style.display = '';
|
||||
} else if (element.name === "cataract") {
|
||||
element.parentElement.parentElement
|
||||
.nextElementSibling.style.display = '';
|
||||
} else {
|
||||
element.nextElementSibling.checked = element.value;
|
||||
}
|
||||
}
|
||||
} else if (key === "Wellness" || key ===
|
||||
"additionalsicknessbenefit") {
|
||||
let wysiwygElement = element.previousElementSibling
|
||||
.querySelector('.jodit-wysiwyg');
|
||||
|
||||
|
||||
if (wysiwygElement) {
|
||||
let pTag = wysiwygElement.querySelector(
|
||||
'p'); // Find the <p> tag inside the wysiwyg element
|
||||
if (pTag) {
|
||||
// pTag.innerHTML = ''; // Clear the content inside the <p> tag
|
||||
pTag.innerHTML = jsonObject[
|
||||
key]; // Add your new content inside the <p> tag
|
||||
}
|
||||
}
|
||||
console.log(jsonObject[key]);
|
||||
} else {
|
||||
console.log(jsonObject[key]);
|
||||
|
||||
if (jsonObject[key] === undefined || jsonObject[key] === "" || jsonObject[key] === null) {
|
||||
element.value = " ";
|
||||
|
||||
|
||||
} else {
|
||||
element.nextElementSibling.checked = element.value;
|
||||
element.value = jsonObject[key];
|
||||
}
|
||||
}
|
||||
} else if (key === "Wellness" || key ===
|
||||
"additionalsicknessbenefit") {
|
||||
let wysiwygElement = element.previousElementSibling
|
||||
.querySelector('.jodit-wysiwyg');
|
||||
|
||||
|
||||
if (wysiwygElement) {
|
||||
let pTag = wysiwygElement.querySelector(
|
||||
'p'); // Find the <p> tag inside the wysiwyg element
|
||||
if (pTag) {
|
||||
// pTag.innerHTML = ''; // Clear the content inside the <p> tag
|
||||
pTag.innerHTML = jsonObject[
|
||||
key]; // Add your new content inside the <p> tag
|
||||
}
|
||||
}
|
||||
console.log(jsonObject[key]);
|
||||
} else {
|
||||
console.log(jsonObject[key]);
|
||||
|
||||
if (jsonObject[key] === undefined || jsonObject[key] === "" || jsonObject[key] === null) {
|
||||
element.value = " ";
|
||||
|
||||
|
||||
} else {
|
||||
element.value = jsonObject[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (key.includes("age_ratio")) {
|
||||
if (key.includes("age_ratio")) {
|
||||
|
||||
$('#self_min_age').val(jsonObject[key].self.min);
|
||||
$('#self_max_age').val(jsonObject[key].self.max);
|
||||
$('#self_min_age').val(jsonObject[key].self.min);
|
||||
$('#self_max_age').val(jsonObject[key].self.max);
|
||||
|
||||
$('#spouse_min_age').val(jsonObject[key].spouse.min);
|
||||
$('#spouse_max_age').val(jsonObject[key].spouse.max);
|
||||
$('#spouse_min_age').val(jsonObject[key].spouse.min);
|
||||
$('#spouse_max_age').val(jsonObject[key].spouse.max);
|
||||
|
||||
$('#child_min_age').val(jsonObject[key].child.min);
|
||||
$('#child_max_age').val(jsonObject[key].child.max);
|
||||
$('#child_min_age').val(jsonObject[key].child.min);
|
||||
$('#child_max_age').val(jsonObject[key].child.max);
|
||||
|
||||
$('#other_member_min_age').val(jsonObject[key].elders.min);
|
||||
$('#other_member_max_age').val(jsonObject[key].elders.max);
|
||||
}
|
||||
$('#other_member_min_age').val(jsonObject[key].elders.min);
|
||||
$('#other_member_max_age').val(jsonObject[key].elders.max);
|
||||
}
|
||||
|
||||
// if (key.includes("is_payable_employee")) {
|
||||
// if (key.includes("is_payable_employee")) {
|
||||
|
||||
// if (jsonObject[key]) {
|
||||
// if (jsonObject[key]) {
|
||||
|
||||
// if (jsonObject[key].self == 0) {
|
||||
// $('#is_payable_employee_for_self').prop('checked',
|
||||
// false);
|
||||
// } else {
|
||||
// $('#is_payable_employee_for_self').prop('checked',
|
||||
// true);
|
||||
// }
|
||||
// if (jsonObject[key].self == 0) {
|
||||
// $('#is_payable_employee_for_self').prop('checked',
|
||||
// false);
|
||||
// } else {
|
||||
// $('#is_payable_employee_for_self').prop('checked',
|
||||
// true);
|
||||
// }
|
||||
|
||||
// if (jsonObject[key].spouse == 0) {
|
||||
// $('#is_payable_employee_for_spouse').prop('checked',
|
||||
// false);
|
||||
// } else {
|
||||
// $('#is_payable_employee_for_spouse').prop('checked',
|
||||
// true);
|
||||
// }
|
||||
// if (jsonObject[key].spouse == 0) {
|
||||
// $('#is_payable_employee_for_spouse').prop('checked',
|
||||
// false);
|
||||
// } else {
|
||||
// $('#is_payable_employee_for_spouse').prop('checked',
|
||||
// true);
|
||||
// }
|
||||
|
||||
// if (jsonObject[key].childern == 0) {
|
||||
// $('#is_payable_employee_for_child').prop('checked',
|
||||
// false);
|
||||
// } else {
|
||||
// $('#is_payable_employee_for_child').prop('checked',
|
||||
// true);
|
||||
// }
|
||||
// if (jsonObject[key].childern == 0) {
|
||||
// $('#is_payable_employee_for_child').prop('checked',
|
||||
// false);
|
||||
// } else {
|
||||
// $('#is_payable_employee_for_child').prop('checked',
|
||||
// true);
|
||||
// }
|
||||
|
||||
// // if (jsonObject[key].elders == 0) {
|
||||
// // $('#is_payable_employee_for_elders').prop('checked',
|
||||
// // false);
|
||||
// // } else {
|
||||
// // $('#is_payable_employee_for_elders').prop('checked',
|
||||
// // true);
|
||||
// // }
|
||||
// // if (jsonObject[key].elders == 0) {
|
||||
// // $('#is_payable_employee_for_elders').prop('checked',
|
||||
// // false);
|
||||
// // } else {
|
||||
// // $('#is_payable_employee_for_elders').prop('checked',
|
||||
// // true);
|
||||
// // }
|
||||
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
if (key.includes("enrollment_display_key") && key != "") {
|
||||
if (key.includes("enrollment_display_key") && key != "") {
|
||||
|
||||
console.log('enrollment_display_key');
|
||||
console.log(jsonObject[key]);
|
||||
console.log('enrollment_display_key');
|
||||
console.log(jsonObject[key]);
|
||||
|
||||
processJsonObject(jsonObject);
|
||||
}
|
||||
processJsonObject(jsonObject);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$("#sum_insured").trigger("keyup");
|
||||
@ -1457,6 +1453,11 @@
|
||||
}
|
||||
|
||||
var family_floaters = $('#family_floaters').val();
|
||||
|
||||
console.log("========================================================");
|
||||
console.log("family_floaters", family_floaters);
|
||||
console.log("========================================================");
|
||||
|
||||
if (family_floaters != 0) {
|
||||
$('.other-member-age').css('display', '');
|
||||
} else {
|
||||
@ -1558,27 +1559,12 @@
|
||||
$("#numberToWordGMC").text("");
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<!-- Jodit RTE -->
|
||||
<script>
|
||||
// $(document).ready(function() {
|
||||
// var editor = new Jodit('#additionalsicknessbenefit', {
|
||||
// buttons: 'bold,italic,underline,|,align,alignCenter,alignRight,alignJustify',
|
||||
// });
|
||||
|
||||
// var editor = new Jodit('#Wellness', {
|
||||
// buttons: 'bold,italic,underline,|,align,alignCenter,alignRight,alignJustify',
|
||||
// });
|
||||
// });
|
||||
//
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<!-- Policy terms Add Special Condition -->
|
||||
<script>
|
||||
|
||||
document.getElementById('myButtonSpecialCondition').addEventListener('click', function(event) {
|
||||
//console.log('specialCondition callback clicked')
|
||||
event.preventDefault();
|
||||
@ -1632,7 +1618,6 @@
|
||||
'multiple_sum_insured'
|
||||
];
|
||||
|
||||
|
||||
function specialCondition(count = 0) {
|
||||
|
||||
//console.log('specialCondition function called')
|
||||
@ -1670,6 +1655,10 @@
|
||||
|
||||
// Close the Policy terms
|
||||
$(document).on('click', '#policyGMCTermsClose', function() {
|
||||
|
||||
//clear the intervel for the autosave
|
||||
stopAutoSubmit();
|
||||
|
||||
$('#policyGMCTerms').css('display', 'none');
|
||||
$('#police-tab').css('display', '');
|
||||
$('.nav.nav-pills.navtab-bg').css('display', '');
|
||||
@ -1899,35 +1888,99 @@
|
||||
}
|
||||
|
||||
function disableUnwantedTerms(jsonObject) {
|
||||
// alert("Disabling unwanted terms");
|
||||
|
||||
fields.forEach(function(key) {
|
||||
// If key NOT in jsonObject, then hide and disable its associated elements
|
||||
if (!jsonObject.hasOwnProperty(key)) {
|
||||
const elements = document.getElementsByName(key);
|
||||
console.log("Disabling unwanted terms");
|
||||
console.log("jsonObject : ", jsonObject);
|
||||
|
||||
elements.forEach(element => {
|
||||
element.style.display = "none";
|
||||
element.disabled = true;
|
||||
if(jsonObject){
|
||||
fields.forEach(function(key) {
|
||||
// If key NOT in jsonObject, then hide and disable its associated elements
|
||||
if (!jsonObject?.hasOwnProperty(key)) {
|
||||
const elements = document.getElementsByName(key);
|
||||
|
||||
const label = document.querySelector(`label[for="${element.id}"]`);
|
||||
if (label) {
|
||||
label.style.display = "none";
|
||||
}
|
||||
elements.forEach(element => {
|
||||
element.style.display = "none";
|
||||
element.disabled = true;
|
||||
|
||||
const displayElement = document.getElementById(`${element.id}_display`);
|
||||
if (displayElement) {
|
||||
displayElement.checked = false;
|
||||
displayElement.disabled = true;
|
||||
displayElement.style.display = "none";
|
||||
}
|
||||
const label = document.querySelector(`label[for="${element.id}"]`);
|
||||
if (label) {
|
||||
label.style.display = "none";
|
||||
}
|
||||
|
||||
const rowDiv = element.closest('.row');
|
||||
if (rowDiv) {
|
||||
rowDiv.style.display = "none";
|
||||
}
|
||||
const displayElement = document.getElementById(`${element.id}_display`);
|
||||
if (displayElement) {
|
||||
displayElement.checked = false;
|
||||
displayElement.disabled = true;
|
||||
displayElement.style.display = "none";
|
||||
}
|
||||
|
||||
const rowDiv = element.closest('.row');
|
||||
if (rowDiv) {
|
||||
rowDiv.style.display = "none";
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function autoSaveGmcTerms()
|
||||
{
|
||||
|
||||
console.log("autoSaveGmcTerms function called");
|
||||
|
||||
var specialConditions = [];
|
||||
|
||||
$(".removeDom").each(function() {
|
||||
var isChecked = $(this).find("input[name='special_condition_display[]']").is(":checked");
|
||||
|
||||
if (isChecked) {
|
||||
var label = $(this).find("input[name='special_condition_label[]']").val();
|
||||
var input = $(this).find("input[name='special_condition_input[]']").val();
|
||||
|
||||
specialConditions.push({
|
||||
[label]: input
|
||||
});
|
||||
}
|
||||
});
|
||||
console.log("specialConditions", specialConditions);
|
||||
|
||||
var formData = new FormData($('#policyJsonForm')[0]);
|
||||
console.log("formData", formData);
|
||||
|
||||
var policy_form_action = '<?= base_url("client/policy/policyGMCTerms") ?>';
|
||||
console.log("policy_form_action", policy_form_action);
|
||||
|
||||
formData.append("special_condition_display_value", JSON.stringify(specialConditions));
|
||||
// console.log('formData', formData);
|
||||
formData.forEach((value, key) => {
|
||||
// console.log(key + ':', value);
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: policy_form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log('Auto Save Response : ', res);
|
||||
|
||||
if (res.status == true) {
|
||||
showTinyToast();
|
||||
}else{
|
||||
console.log('Policy terms Dose Not save', 'Error');
|
||||
return;
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -189,6 +189,7 @@ $(document).on('click', '.close', function() {
|
||||
|
||||
var rarc_rate_json_array = [];
|
||||
|
||||
//Submit function
|
||||
$(document).on('submit', 'form[id^="GridForm_"]', function(event) {
|
||||
console.log('submitted function called')
|
||||
event.preventDefault(); // Prevent the default form submission
|
||||
@ -619,8 +620,6 @@ $('body').on('click', '.btnPolicyModel', function()
|
||||
$('#no_data').html('The policy has no Policy Rack Rate');
|
||||
toastr.warning("The policy has no Policy Rack Rate", "Warning")
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$(document).on('change', 'select[id^="grid_"]', function(event)
|
||||
|
||||
@ -193,7 +193,7 @@
|
||||
<div id="collapseThree" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion_2">
|
||||
<div class="row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<div class="form-group col-md-3" id="tpa_endorse_div">
|
||||
<label for="tpa"> TPA <span id="tpa_danger"class="text-danger"></span></label>
|
||||
<select class="form-control readonly-select" id="tpa" name="tpa" >
|
||||
<option value="" selected>Select TPA</option>
|
||||
@ -259,12 +259,12 @@
|
||||
<input type="text" class="form-control" id="endorse_eff_date" name="endorse_eff_date" placeholder="DD/MM/YYYY" >
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<div class="form-group col-md-3" id="no_of_insured_endorse_div">
|
||||
<label for="addon_policy">No of Insured<span id="base_danger"class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="emp_count" name="emp_count" placeholder="Enter Employeee" onkeypress="return onlyNumbers(event)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<div class="form-group col-md-3" id="no_of_dependents_endorse_div">
|
||||
<label for="addon_policy">No of Dependents<span id="base_danger" class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="dependent_count" name="dependent_count" placeholder="Enter Dependent" onkeypress="return onlyNumbers(event)">
|
||||
</div>
|
||||
@ -427,7 +427,7 @@
|
||||
<td id="agree_tp_td">Agreed TEP %</td>
|
||||
</tr>
|
||||
|
||||
<?php if (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team())) { ?>
|
||||
<?php if (in_array(get_role_id(), [1,5]) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<tr id="table_tr_17" <?= in_array(FINANCE_TEAM_ID, user_team()) ? 'style="display:none"' : '' ?>>
|
||||
<td>Agreed Amount</td>
|
||||
@ -445,7 +445,7 @@
|
||||
<td>Standard TEP %</td>
|
||||
</tr>
|
||||
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
<?php if (in_array(in_array(get_role_id(), [1,5]) || FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<tr id="table_tr_21">
|
||||
<td>Actual BP Amount</td>
|
||||
@ -520,6 +520,8 @@
|
||||
<script>
|
||||
|
||||
var team_id = [];
|
||||
var role_id = <?php echo get_role_id(); ?>;
|
||||
console.log(" role_id : ", role_id);
|
||||
var insurer_count_array = [];
|
||||
|
||||
$(document).ready(function(){
|
||||
@ -606,6 +608,16 @@ $(document).ready(function(){
|
||||
$('#is_cd_reduce_from_bds').prop('disabled',false)
|
||||
}
|
||||
|
||||
if( policy_type_id > 7 ){
|
||||
$('#tpa_endorse_div').hide();
|
||||
$('#no_of_insured_endorse_div').hide();
|
||||
$('#no_of_dependents_endorse_div').hide();
|
||||
}else{
|
||||
$('#tpa_endorse_div').show();
|
||||
$('#no_of_insured_endorse_div').show();
|
||||
$('#no_of_dependents_endorse_div').show();
|
||||
}
|
||||
|
||||
|
||||
// console.log('client_id', client_id);
|
||||
// console.log('client_policy_id', client_policy_id);
|
||||
@ -643,7 +655,7 @@ $(document).ready(function(){
|
||||
$('#ct_type').val(2)
|
||||
$('#cd_ac_pk').val(res.is_copay_yes.cd_ac_pk);
|
||||
$('#cd_ac_no').val(res.cd_master_data.cd_ac_no ?? "");
|
||||
$('#bro_payable_by').val(res.data[0].bro_payable_by)
|
||||
$('#bro_payable_by').val(res.data[0].bro_payable_by);
|
||||
|
||||
if(res.is_copay_yes && res.is_copay_yes.co_share == 1){
|
||||
// console.log('copay yes', res.is_copay_yes);
|
||||
@ -1034,14 +1046,18 @@ function amountCalculation(input) {
|
||||
console.log('############################## AMOUNT CALCULATION ############################################')
|
||||
console.log('amountCalculation : ' + input);
|
||||
let selectedOption = $('#client_policy_id').find('option:selected');
|
||||
console.log("selectedOption", selectedOption);
|
||||
let bap = selectedOption.data('bap');
|
||||
console.log("bap", bap);
|
||||
|
||||
const event = window.event;
|
||||
console.log("Event id:", event.target.id);
|
||||
|
||||
// Retrieve and parse the values or default to 0 if not a number
|
||||
let bp = parseFloat($('#base_premium_' + input).val()) || 0;
|
||||
console.log("bp base premium", bp);
|
||||
let ncpa = parseFloat($('#non_comm_per_amt_' + input).val()) || 0;
|
||||
console.log("ncpa non comm base premium", ncpa);
|
||||
|
||||
var tp = 0;
|
||||
if(bap == 'Motor'){
|
||||
@ -1683,7 +1699,7 @@ function addInsurerColumn() {
|
||||
$('#insurerTable tbody tr').each(function(index) {
|
||||
let newCell = '';
|
||||
|
||||
if(team_id.includes('6') || team_id.includes('4')){
|
||||
if(role_id == 1 || role_id == 5 || team_id.includes('6') || team_id.includes('4')){
|
||||
|
||||
switch(index) {
|
||||
|
||||
@ -2082,7 +2098,7 @@ function populateTable(dataArray, status = false) {
|
||||
|
||||
let insurer = data.insurer_branch_id + '-' + data.insurer_id;
|
||||
|
||||
if(team_id.includes('6') || team_id.includes('4')){
|
||||
if(role_id == 1 || role_id == 5 || team_id.includes('6') || team_id.includes('4')){
|
||||
switch (rowIndex) {
|
||||
case 0: // Insurer selection
|
||||
cell.find('select').val(insurer);
|
||||
|
||||
@ -421,15 +421,15 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label for="bp_cgst">Latest Action Date</label>
|
||||
<input id="last_action_date" type="text" class="form-control" name="last_action_date" placeholder="DD/MM/YYYY">
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label for="fund_received">Fund Recd / Sent to Insurer</label>
|
||||
<input id="fund_received" value="" type="text" class="form-control" name="fund_received">
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label class="switch" style="position: relative;top: 32px;left: 20px;">
|
||||
@ -521,12 +521,12 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<div class="form-group col-md-3" id="no_of_insured_div">
|
||||
<label for="addon_policy">No of Insured<span id="base_danger"class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="emp_count" name="emp_count" placeholder="Enter Employeee" onkeypress="return onlyNumbers(event)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<div class="form-group col-md-3" id="no_of_dependents_div">
|
||||
<label for="addon_policy">No of Dependents<span id="base_danger" class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="dependent_count" name="dependent_count" placeholder="Enter Dependent" onkeypress="return onlyNumbers(event)">
|
||||
</div>
|
||||
@ -718,7 +718,7 @@
|
||||
<td id="agree_tp_td">Agreed TEP %</td>
|
||||
</tr>
|
||||
|
||||
<?php if (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team())) { ?>
|
||||
<?php if (in_array(get_role_id(), [1,5]) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<tr id="table_tr_17" <?= in_array(FINANCE_TEAM_ID, user_team()) ? 'style="display:none"' : '' ?>>
|
||||
<td>Agreed Amount</td>
|
||||
@ -736,7 +736,7 @@
|
||||
<td>Standard TEP %</td>
|
||||
</tr>
|
||||
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
<?php if (in_array(get_role_id(), [1,5]) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<tr id="table_tr_21">
|
||||
<td>Actual BP Amount</td>
|
||||
@ -1168,6 +1168,7 @@
|
||||
|
||||
|
||||
var team_id = [];
|
||||
var role_id = <?php echo get_role_id(); ?>;
|
||||
let isClientFormSubmitting = false;
|
||||
let isVehicleFormSubmitting = false;
|
||||
var insurer_count_array = [];
|
||||
@ -1389,16 +1390,19 @@ $(document).ready(function(){
|
||||
$('#client_branch_id').prop('required', false);
|
||||
$('#branch_code').prop('required', false);
|
||||
$('#name').prop('required', false);
|
||||
$('#mobile').prop('required', false);
|
||||
// $('#mobile').prop('required', false);
|
||||
$('#gst').prop('required', false);
|
||||
$('#email').prop('required', false);
|
||||
|
||||
|
||||
$('#dob').prop('required', true);
|
||||
$('#phone').prop('required', true);
|
||||
// $('#phone').prop('required', true)
|
||||
$('#email2').prop('required', true);
|
||||
$('#aadhar').prop('required', true);
|
||||
|
||||
$('#short_name').closest('.form-group').hide();
|
||||
$('#short_name').removeAttr('required');
|
||||
|
||||
} else {
|
||||
|
||||
$('.branchdiv').show();
|
||||
@ -1408,15 +1412,18 @@ $(document).ready(function(){
|
||||
$('#client_branch_id').prop('required', true);
|
||||
$('#branch_code').prop('required', true);
|
||||
$('#name').prop('required', true);
|
||||
$('#mobile').prop('required', true);
|
||||
// $('#mobile').prop('required', false);
|
||||
$('#gst').prop('required', true);
|
||||
$('#email').prop('required', true);
|
||||
|
||||
$('#dob').prop('required', false);
|
||||
$('#phone').prop('required', false);
|
||||
// $('#phone').prop('required', false);
|
||||
$('#email2').prop('required', false);
|
||||
$('#aadhar').prop('required', false);
|
||||
|
||||
$('#short_name').closest('.form-group').show();
|
||||
$('#short_name').attr('required', 'required');
|
||||
|
||||
}
|
||||
|
||||
var myModal = new bootstrap.Modal(document.getElementById('upload_enrollment_model'));
|
||||
@ -1561,12 +1568,28 @@ $(document).ready(function(){
|
||||
$('#client_type option[value="2"]').show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(value == 1 || value == 2 || value == 3 || value == 4 || value == 5 || value == 38 || value == 40){
|
||||
$('#tpa_div').hide();
|
||||
}else{
|
||||
$('#tpa_div').show();
|
||||
}
|
||||
|
||||
if( value == 38 || value == 40 ){
|
||||
$('#tpa_div').hide();
|
||||
}
|
||||
else if(value > 7){
|
||||
$('#tpa_div').hide();
|
||||
$('#no_of_insured_div').hide();
|
||||
$('#no_of_dependents_div').hide();
|
||||
}
|
||||
else{
|
||||
$('#tpa_div').show();
|
||||
$('#no_of_insured_div').show();
|
||||
$('#no_of_dependents_div').show();
|
||||
}
|
||||
|
||||
if(value == 1 || value == 2 || value == 3 || value == 4 || value == 5 || value == 6 || value == 7){
|
||||
$('#is_cd_reduce_from_bds').prop('disabled',true).prop('checked', false)
|
||||
}else{
|
||||
@ -3686,12 +3709,12 @@ $('#client_type').change(function() {
|
||||
$('#client_branch_id').prop('required', false);
|
||||
$('#branch_code').prop('required', false);
|
||||
$('#name').prop('required', false);
|
||||
$('#mobile').prop('required', false);
|
||||
// $('#mobile').prop('required', false);
|
||||
$('#gst').prop('required', false);
|
||||
$('#email').prop('required', false);
|
||||
|
||||
$('#dob').prop('required', true);
|
||||
$('#phone').prop('required', true);
|
||||
// $('#phone').prop('required', true);
|
||||
$('#email2').prop('required', true);
|
||||
$('#aadhar').prop('required', true);
|
||||
|
||||
@ -3713,12 +3736,12 @@ $('#client_type').change(function() {
|
||||
$('#client_branch_id').prop('required', true);
|
||||
$('#branch_code').prop('required', true);
|
||||
$('#name').prop('required', true);
|
||||
$('#mobile').prop('required', true);
|
||||
// $('#mobile').prop('required', false);
|
||||
$('#gst').prop('required', true);
|
||||
$('#email').prop('required', true);
|
||||
|
||||
$('#dob').prop('required', false);
|
||||
$('#phone').prop('required', false);
|
||||
// $('#phone').prop('required', false);
|
||||
$('#email2').prop('required', false);
|
||||
$('#aadhar').prop('required', false);
|
||||
|
||||
@ -4033,7 +4056,7 @@ function addInsurerColumn() {
|
||||
|
||||
let newCell = '';
|
||||
|
||||
if(team_id.includes('6') || team_id.includes('4')){
|
||||
if(role_id == 1 || role_id == 5 || team_id.includes('6') || team_id.includes('4')){
|
||||
|
||||
switch(index) {
|
||||
|
||||
@ -4445,7 +4468,7 @@ function populateTable(dataArray, cd_ac_pk) {
|
||||
|
||||
let insurer = data.insurer_branch_id + '-' + data.insurer_id;
|
||||
|
||||
if(team_id.includes('6') || team_id.includes('4')){
|
||||
if(role_id == 1 || role_id == 5 || team_id.includes('6') || team_id.includes('4')){
|
||||
switch (rowIndex) {
|
||||
case 0: // Insurer selection
|
||||
cell.find('select').val(insurer).change().toggleClass('readonly-select', !!disable_td);
|
||||
|
||||
@ -188,9 +188,9 @@ table.dataTable tbody td {
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<!-- <div class="form-group col-md-3" style="display: none;">
|
||||
<label for="client_branch">Issuer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="issuer_for_search" name="issuer" required>
|
||||
<select class="form-control" id="issuer_for_search" name="issuer">
|
||||
<option value="0">Select Issuer</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
@ -200,10 +200,7 @@ table.dataTable tbody td {
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="email"> Status <span class="text-danger"></span></label>
|
||||
@ -217,7 +214,13 @@ table.dataTable tbody td {
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label>Date Type<span class="text-danger"></span></label>
|
||||
@ -1216,6 +1219,15 @@ $(document).ready(function(){
|
||||
|
||||
if($('#client_type').val()){
|
||||
$('#client_id').val('').change();
|
||||
|
||||
if($('#client_type').val() == 2){
|
||||
$('#short_name').closest('.form-group').hide();
|
||||
$('#short_name').removeAttr('required');
|
||||
} else {
|
||||
$('#short_name').closest('.form-group').show();
|
||||
$('#short_name').attr('required', 'required');
|
||||
}
|
||||
|
||||
var myModal = new bootstrap.Modal(document.getElementById('upload_enrollment_model'));
|
||||
myModal.show();
|
||||
}else{
|
||||
@ -1512,7 +1524,7 @@ function fetchEmpolyeeList(event)
|
||||
var insurer_id = $('#insurer_id_for_search').val();
|
||||
var policy_type_id = $('#policy_type_for_search').val();
|
||||
var date_type = $('#date_type').val();
|
||||
var issuer = $('#issuer_for_search').val();
|
||||
var issuer = $('#issuer_for_search').val() || 0;
|
||||
var status = $('#policy_status_for_search').val();
|
||||
|
||||
console.log(start_date + '-' + end_date);
|
||||
|
||||
@ -56,6 +56,20 @@
|
||||
<span class="d-none d-sm-inline-block">Auto Query Content</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#uploads-tab" data-toggle="tab" class="nav-link px-2 py-1" id="uploads_tab"
|
||||
aria-expanded="false">
|
||||
<i class="mdi mdi-file mr-1"></i>
|
||||
<span class="d-none d-sm-inline-block">Claim Files</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#viewpolicyterms-tab" data-toggle="tab" class="nav-link px-2 py-1" id="viewpolicyterms_tab"
|
||||
aria-expanded="false">
|
||||
<i class="mdi mdi-eye mr-1"></i>
|
||||
<span class="d-none d-sm-inline-block">View Policy Terms</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- Tab Content -->
|
||||
@ -82,6 +96,12 @@
|
||||
<div class="tab-pane fade" id="autoQuery-tab">
|
||||
<?php include('ticket_auto_query.php'); ?>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="uploads-tab">
|
||||
<?php include('claim_files_upload.php'); ?>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="viewpolicyterms-tab">
|
||||
<?php include('view_policy_terms.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -109,7 +109,12 @@ table.dataTable tbody td {
|
||||
|
||||
|
||||
<th>TAT</th>
|
||||
|
||||
<!-- role based delete option -->
|
||||
<?php if(in_array(get_role_id(), [1,2,5]) ) { ?>
|
||||
<th>ACTION</th>
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -217,16 +222,21 @@ table.dataTable tbody td {
|
||||
|
||||
|
||||
<td><?php echo $row['tat']; ?></td>
|
||||
<td>
|
||||
<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 class="dropdown-item delete" data-id="<?= $row['id'];?>" onclick="removeClaim(this, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
||||
</a>
|
||||
|
||||
<!-- role based delete option -->
|
||||
<?php if(in_array(get_role_id(), [1,2,5]) ) { ?>
|
||||
<td>
|
||||
<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 class="dropdown-item delete" data-id="<?= $row['id'];?>" onclick="removeClaim(this, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</td>
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
@ -301,7 +311,7 @@ function viewTicket(ticket_id){
|
||||
// $('.loader-mask').fadeIn();
|
||||
|
||||
let url = '<?= base_url('ticket/view/'); ?>' + ticket_id;
|
||||
window.open(url, '_blank');
|
||||
window.location.href = url;
|
||||
|
||||
|
||||
}
|
||||
|
||||
97
app/Views/view_policy_terms.php
Normal file
@ -0,0 +1,97 @@
|
||||
<br>
|
||||
<p style="color:black;">
|
||||
<b>Policy Terms</b>
|
||||
</p>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
// ✅ Format keys: underscores to spaces, each word capitalized
|
||||
function readable_key($key) {
|
||||
$key = str_replace('_', ' ', $key);
|
||||
return ucwords($key);
|
||||
}
|
||||
|
||||
// ✅ Format values: 0 = NO, 1 = YES, >1 = number as-is
|
||||
function format_value($value) {
|
||||
if (is_numeric($value)) {
|
||||
if ($value == 0) return 'No';
|
||||
if ($value == 1) return 'Yes';
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
// ✅ Recursively render nested key–value pairs
|
||||
function nestedKeyValuePair($data) {
|
||||
$output = '';
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
$label = readable_key($key);
|
||||
$output .= "<span style='color:black;'> : <b>$label</b>";
|
||||
|
||||
if (is_array($value)) {
|
||||
$output .= "<span style='margin-left: 10px;'>" . nestedKeyValuePair($value) . "</span>";
|
||||
} else {
|
||||
$formattedValue = format_value($value);
|
||||
$output .= " : " . htmlspecialchars($formattedValue) ;
|
||||
}
|
||||
|
||||
$output .= "</span>";
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
if (isset($policy_terms['policy_terms']) && is_array($policy_terms['policy_terms'])) {
|
||||
|
||||
// ✅ Merge multiple_sum_insured with sum_insured
|
||||
if (
|
||||
isset($policy_terms['policy_terms']['multiple_sum_insured']) &&
|
||||
is_array($policy_terms['policy_terms']['multiple_sum_insured'])
|
||||
) {
|
||||
$sum_insured_values = implode(' , ', $policy_terms['policy_terms']['multiple_sum_insured']);
|
||||
$original_sum = isset($policy_terms['policy_terms']['sum_insured'])
|
||||
? $policy_terms['policy_terms']['sum_insured']
|
||||
: '';
|
||||
$policy_terms['policy_terms']['sum_insured'] = $original_sum . " , " . $sum_insured_values;
|
||||
unset($policy_terms['policy_terms']['multiple_sum_insured']);
|
||||
}
|
||||
|
||||
// ✅ Display each policy term
|
||||
foreach ($policy_terms['policy_terms'] as $key => $value) {
|
||||
if ($key === "age_ratio" || $key === "enrollment_display_key") {
|
||||
continue; // Skip excluded keys
|
||||
}
|
||||
|
||||
// Normalize specific raw keys (if needed)
|
||||
if ($key === 'waiverof30dayswaitingperiod') {
|
||||
$key = 'Waiver_of_30_days_waiting_period';
|
||||
}
|
||||
if ($key === 'suminsuredenhancement') {
|
||||
$key = 'sum_insured_enhancement';
|
||||
}
|
||||
|
||||
// Readable label
|
||||
$label = readable_key($key);
|
||||
$nesetedValues = "";
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="form-group col-3">
|
||||
<p style="color:black;"><b><?php echo htmlspecialchars($label); ?>:</b></p>
|
||||
</div>
|
||||
<div class="form-group col-6">
|
||||
<?php
|
||||
if (is_array($value)) {
|
||||
$nesetedValues .= nestedKeyValuePair($value) .",";
|
||||
echo "$nesetedValues";
|
||||
|
||||
} else {
|
||||
$formattedValue = format_value($value);
|
||||
echo "<p style='color:black;'>: " . htmlspecialchars($formattedValue) . "</p>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
BIN
public/assets/images/action_on_policies_sb.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
public/assets/images/app_content_mng_sb.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
public/assets/images/claims_sb.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
public/assets/images/clients_sb.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
public/assets/images/leads_sb.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
public/assets/images/masters_sb.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
public/assets/images/policy_transactions_sb.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
public/assets/images/user_manual_sb.png
Normal file
|
After Width: | Height: | Size: 15 KiB |