MERGE_DEV

This commit is contained in:
velz 2024-04-16 09:55:42 +05:30
parent 4c09a3286e
commit 07aef79902
29 changed files with 2809 additions and 1397 deletions

View File

@ -211,6 +211,10 @@ $routes->group("/util", ["filter" => "authMVC"], function($routes){
$routes->get("get-emp-endorsement/(:any)", "EmployeeController::getEmpEndoresmentEntry/$1"); $routes->get("get-emp-endorsement/(:any)", "EmployeeController::getEmpEndoresmentEntry/$1");
$routes->post("import-export", "EmployeeController::importExport"); $routes->post("import-export", "EmployeeController::importExport");
$routes->get("featch-client-policy-list/(:any)", "ClientController::getClientPolicyList/$1"); $routes->get("featch-client-policy-list/(:any)", "ClientController::getClientPolicyList/$1");
$routes->get("download-file-list/(:any)", "EmployeeController::downloadFileList/$1");
$routes->get("featch-emp-list", "EmployeeController::featchEmpList/$1");
$routes->get("view-success-emp-list", "EmployeeController::viewUploadedEmployeeList/$1");
$routes->get("fetch-policy-for-policy-type", "ClientController::fetchPolicyDataForPolicyType/$1");
}); });
@ -232,11 +236,14 @@ $routes->group("/api", ["filter" => "authJWT"], function($routes){
}); });
$routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/$1"); $routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/$1");
$routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile"); $routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile");
$routes->post("/calculatePremium", "EmployeeRestController::calculatePremium"); $routes->post("/calculatePremium", "EmployeeRestController::calculatePremium");
$routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
$routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile");
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload"); $routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
$routes->get("relationshipList", "EmployeeRestController::relationshipList"); $routes->get("relationshipList", "EmployeeRestController::relationshipList");
$routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence"); $routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence");

View File

@ -150,7 +150,6 @@ class ClientController extends AdminController
public function clientOnboarding() public function clientOnboarding()
{ {
$this->myLogger->logme('error','Client Onboarding function called'); $this->myLogger->logme('error','Client Onboarding function called');
$headerData['page_name'] = 'Client Onboarding'; $headerData['page_name'] = 'Client Onboarding';
@ -162,6 +161,7 @@ class ClientController extends AdminController
$data['state'] = $this->stateModel->getAllStates(); $data['state'] = $this->stateModel->getAllStates();
$data['RM'] = $this->userModel->findAll(); $data['RM'] = $this->userModel->findAll();
$data['policyGridData'] = $this->policyGridModel->findAll(); $data['policyGridData'] = $this->policyGridModel->findAll();
$data['policy_type'] = ['1'=>'Base Policy', '2' => 'SI Topup', '3' => 'Dependent Addon'];
// echo "<pre>"; // echo "<pre>";
// print_r($data); die; // print_r($data); die;
@ -196,7 +196,8 @@ class ClientController extends AdminController
$subTypeOptions = [ $subTypeOptions = [
1 => 'Deposit', 1 => 'Deposit',
2 => 'Adjustment', 2 => 'Adjustment',
3 => 'Deletion', 3 => 'Refund',
4 => 'Debit',
// Add more options as needed // Add more options as needed
]; ];
$data['subTypeOptions'] = $subTypeOptions; $data['subTypeOptions'] = $subTypeOptions;
@ -256,6 +257,7 @@ class ClientController extends AdminController
$editData['insurer'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames(); $editData['insurer'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
$editData['kyc_docs'] = $this->kycDocsModel->findAll(); $editData['kyc_docs'] = $this->kycDocsModel->findAll();
$editData['policyGridData'] = $this->policyGridModel->findAll(); $editData['policyGridData'] = $this->policyGridModel->findAll();
$editData['policy_type'] = ['1'=>'Base Policy', '2' => 'SI Topup', '3' => 'Dependent Addon'];
$editData['client'] = $this->clientModel->where(['id' => $id])->first(); $editData['client'] = $this->clientModel->where(['id' => $id])->first();
@ -274,9 +276,8 @@ class ClientController extends AdminController
$editData['client_policy'] = $clientPoliceData; $editData['client_policy'] = $clientPoliceData;
// echo "<pre>"; // echo "<pre>";
// print_r($clientPoliceData); die; // dd($editData); die;
echo view('layout/header', $headerData); echo view('layout/header', $headerData);
echo view('client_onboarding', $editData); echo view('client_onboarding', $editData);
@ -576,6 +577,8 @@ class ClientController extends AdminController
$insurerValue = (string) $this->request->getPost('insurer'); $insurerValue = (string) $this->request->getPost('insurer');
list($insurerBranchId, $insurerId) = explode('-', $insurerValue); list($insurerBranchId, $insurerId) = explode('-', $insurerValue);
$client_id = $this->request->getPost('client_id');
$data['insurer_branch_id'] = $insurerBranchId; $data['insurer_branch_id'] = $insurerBranchId;
$data['insurer_id'] = $insurerId; $data['insurer_id'] = $insurerId;
@ -583,12 +586,11 @@ class ClientController extends AdminController
$tpaValue = (string) $this->request->getPost('tpa'); $tpaValue = (string) $this->request->getPost('tpa');
list($tpaBranchId, $tpaId) = explode('-', $tpaValue); list($tpaBranchId, $tpaId) = explode('-', $tpaValue);
$data['client_id'] = $client_id;
$data['tpa_branch_id'] = $tpaBranchId; $data['tpa_branch_id'] = $tpaBranchId;
$data['tpa_id'] = $tpaId; $data['tpa_id'] = $tpaId;
$data['policy_id'] = $this->request->getPost('policy_id'); $data['policy_id'] = $this->request->getPost('policy_id');
$data['policy_type_id'] = $this->request->getPost('policy_type_id'); $data['policy_type_id'] = $this->request->getPost('policy_type_id');
$data['client_id'] = $this->request->getPost('client_id');
$data['no_of_lives'] = $this->request->getPost('no_of_lives'); $data['no_of_lives'] = $this->request->getPost('no_of_lives');
$data['policy_status'] = $this->request->getPost('policy_status'); $data['policy_status'] = $this->request->getPost('policy_status');
@ -603,28 +605,27 @@ class ClientController extends AdminController
$data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount'); $data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount');
$data['is_addon'] = $this->request->getPost('is_addon'); $data['is_addon'] = $this->request->getPost('is_addon');
$data['base_policy'] = $this->request->getPost('base_policy'); $data['base_policy'] = $this->request->getPost('base_policy');
$data['policy_status'] = 1;
if (!isset($data['is_addon'])) { $policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first();
$data['is_addon'] = 0;
} elseif ($data['is_addon']) { if ( $this->request->getPost('is_addon') == 2 || $this->request->getPost('is_addon') == 3) {
$data['is_addon'] = 1; $data['policy_terms'] = $policy_terms['policy_terms'];
} }
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d'); $data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
$data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d'); $data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
$data['created_by'] = get_session_userid(); $data['created_by'] = get_session_userid();
$insert = $this->clientPolicyModel->insert($data); $insert = $this->clientPolicyModel->insert($data);
if($insert){ if($insert){
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($this->request->getPost('client_id')); $clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($this->request->getPost('client_id'));
foreach ($clientPoliceData as $key => $value) { // foreach ($clientPoliceData as $key => $value) {
$clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date)); // $clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date));
$clientPoliceData[$key]->policy_end_date = date('d-M-Y', strtotime($value->policy_end_date)); // $clientPoliceData[$key]->policy_end_date = date('d-M-Y', strtotime($value->policy_end_date));
} // }
return $this->respond(['status' => true,'code' => 200,'data' => $clientPoliceData, 'method' => 'CERATE'], 200); return $this->respond(['status' => true,'code' => 200,'data' => $clientPoliceData, 'method' => 'CERATE'], 200);
}else{ }else{
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200); return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
@ -636,9 +637,12 @@ class ClientController extends AdminController
$this->myLogger->logme('error','Client policy function called'); $this->myLogger->logme('error','Client policy function called');
$id = $this->request->getPost('PrimaryKey'); $id = $this->request->getPost('PrimaryKey');
$client_id = $this->request->getPost('client_id'); $client_id = $this->request->getPost('client_id');
$insurerValue = (string) $this->request->getPost('insurer'); $insurerValue = (string) $this->request->getPost('insurer');
list($insurerBranchId, $insurerId) = explode('-', $insurerValue); list($insurerBranchId, $insurerId) = explode('-', $insurerValue);
@ -649,6 +653,7 @@ class ClientController extends AdminController
list($tpaBranchId, $tpaId) = explode('-', $tpaValue); list($tpaBranchId, $tpaId) = explode('-', $tpaValue);
$data['tpa_branch_id'] = $tpaBranchId; $data['tpa_branch_id'] = $tpaBranchId;
$data['client_id'] = $client_id;
$data['tpa_id'] = $tpaId; $data['tpa_id'] = $tpaId;
$data['policy_id'] = $this->request->getPost('policy_id'); $data['policy_id'] = $this->request->getPost('policy_id');
$data['policy_type_id'] = $this->request->getPost('policy_type_id'); $data['policy_type_id'] = $this->request->getPost('policy_type_id');
@ -669,29 +674,30 @@ class ClientController extends AdminController
$data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount'); $data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount');
$data['is_addon'] = $this->request->getPost('is_addon'); $data['is_addon'] = $this->request->getPost('is_addon');
$data['base_policy'] = $this->request->getPost('base_policy'); $data['base_policy'] = $this->request->getPost('base_policy');
$data['policy_status'] = 1;
$policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first();
if ( $this->request->getPost('is_addon') == 2 || $this->request->getPost('is_addon') == 3) {
if (!isset($data['is_addon'])) { $data['policy_terms'] = $policy_terms['policy_terms'];
$data['is_addon'] = 0;
} elseif ($data['is_addon']) {
$data['is_addon'] = 1;
} }
// dd($data);
$data['updated_by'] = get_session_userid(); $data['updated_by'] = get_session_userid();
$insert = $this->clientPolicyModel->update($id,$data); $insert = $this->clientPolicyModel->update($id,$data);
$lastQuery = $this->clientPolicyModel->getLastQuery(); $lastQuery = $this->clientPolicyModel->getLastQuery();
// echo '<pre>'; // echo '<pre>';
// print_r($lastQuery); die; // print_r($data); die;
if($insert){ if($insert){
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($client_id); $clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($client_id);
foreach ($clientPoliceData as $key => $value) {
$clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date)); // foreach ($clientPoliceData as $key => $value) {
$clientPoliceData[$key]->policy_end_date = date('d-M-Y', strtotime($value->policy_end_date));
} // $clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date));
// $clientPoliceData[$key]->policy_end_date = date('d-M-Y', strtotime($value->policy_end_date));
// }
return $this->respond(['status' => true,'code' => 200,'data' => $clientPoliceData, 'method' => 'EDIT'], 200); return $this->respond(['status' => true,'code' => 200,'data' => $clientPoliceData, 'method' => 'EDIT'], 200);
}else{ }else{
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200); return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
@ -704,6 +710,7 @@ class ClientController extends AdminController
$policy_type = $this->request->getPost('policy_type'); $policy_type = $this->request->getPost('policy_type');
$client_id = $this->request->getPost('client_id'); $client_id = $this->request->getPost('client_id');
$client_policy_id = $this->request->getPost('client_policy_id'); $client_policy_id = $this->request->getPost('client_policy_id');
$premium_type = $this->request->getPost('premium_type');
if(!empty($client_id) && $client_id != null){ if(!empty($client_id) && $client_id != null){
$client_policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first(); $client_policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
$client_id = $client_policy_data['client_id']; $client_id = $client_policy_data['client_id'];
@ -719,6 +726,7 @@ class ClientController extends AdminController
$data['client_id'] = $client_id; $data['client_id'] = $client_id;
$data['client_policy_id'] = $client_policy_id; $data['client_policy_id'] = $client_policy_id;
$data['policy_grid_id'] = $policy_grid_id; $data['policy_grid_id'] = $policy_grid_id;
$data['premium_type'] = $premium_type;
$premium = []; $premium = [];
@ -943,10 +951,9 @@ class ClientController extends AdminController
$insurer_id = $client_policy_data['insurer_id']; $insurer_id = $client_policy_data['insurer_id'];
$client_id = $client_policy_data['client_id']; $client_id = $client_policy_data['client_id'];
$polices = $this->policesModel->where(['insurer_id' => $insurer_id, 'is_active' => 1])->findAll(); $polices = $this->policesModel->where(['insurer_id' => $insurer_id, 'is_active' => 1])->findAll();
$client_policy_list = $this->clientPolicyModel->select('policies.*') $client_policy_list = $this->clientPolicyModel->getpolicyWithPattern( $client_id );
->join('policies', 'policies.id = client_policy.policy_id')
->where('client_id', $client_id)
->findAll();
return $this->respond(['status' => true,'code' => 200, 'client_policy_list' => $client_policy_list, 'data' => $client_policy_data, "insurer_id" => $client_policy_data['insurer_id'], 'policy' => $polices], 200); return $this->respond(['status' => true,'code' => 200, 'client_policy_list' => $client_policy_list, 'data' => $client_policy_data, "insurer_id" => $client_policy_data['insurer_id'], 'policy' => $polices], 200);
}else{ }else{
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200); return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
@ -970,7 +977,7 @@ class ClientController extends AdminController
->where("employees.emp_status",'active') ->where("employees.emp_status",'active')
->countAllResults(); ->countAllResults();
if($emp_count = 0){ if($emp_count == 0){
$emp_count = true; $emp_count = true;
}else{ }else{
$emp_count = false; $emp_count = false;
@ -1252,7 +1259,7 @@ class ClientController extends AdminController
->where("employees.emp_status",'active') ->where("employees.emp_status",'active')
->countAllResults(); ->countAllResults();
if($emp_count = 0){ if($emp_count == 0){
$emp_count = true; $emp_count = true;
}else{ }else{
$emp_count = false; $emp_count = false;
@ -1366,7 +1373,8 @@ class ClientController extends AdminController
} }
public function updateClientPolicyStatus(){ public function updateClientPolicyStatus()
{
$client_policy_id = $this->request->getGet('client_policy_id'); $client_policy_id = $this->request->getGet('client_policy_id');
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first(); $record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
@ -1437,12 +1445,10 @@ class ClientController extends AdminController
} }
public function getClientPolicyList($client_id = null){ public function getClientPolicyList($client_id = null)
{
$record = $this->clientPolicyModel->select('policies.*') $record = $this->clientPolicyModel->getpolicyWithPattern( $client_id);
->join('policies', 'policies.id = client_policy.policy_id')
->where('client_id', $client_id)
->findAll();
if ($record) { if ($record) {
return $this->respond(['Status' => true,'code' => 200,'data' => $record], 200); return $this->respond(['Status' => true,'code' => 200,'data' => $record], 200);
@ -1451,4 +1457,38 @@ class ClientController extends AdminController
} }
} }
public function fetchPolicyDataForPolicyType($client_policy_id){
$client_policy_id = $this->request->getGet('client_policy_id');
$policy_type = $this->request->getGet('policy_type');
$client_id = $this->clientPolicyModel->where('id', $client_policy_id)->first();
$insurer_id = $client_id['insurer_id'];
if( $policy_type == 2 ){
$polices = $this->policesModel
->select('policies.*')
->join('policy_type', 'policy_type.id = policies.policy_type_id')
->where('policy_type.policy_type', 'GMC - Top-up')
->where(['policies.insurer_id' => $insurer_id, 'policies.is_active' => 1])->findAll();
}else if( $policy_type == 3 ){
$polices = $this->policesModel
->select('policies.*')
->join('policy_type', 'policy_type.id = policies.policy_type_id')
->whereIn('policy_type.policy_type', ['GMC - Parents', 'GMC - Top-up(Parents)'])
->where(['policies.insurer_id' => $insurer_id, 'policies.is_active' => 1])->findAll();
}
$data = $this->clientPolicyModel->getClientPolicyByPolicyType($client_id['client_id'], $policy_type);
return $this->respond(['Status' => true,'code' => 200,'data' => $data, 'client_policy_id' => $client_policy_id, 'policy' => $polices], 200);
}
} }

View File

@ -22,7 +22,8 @@ use App\Models\ClientDepositModel;
use App\Controllers\Jobs ; use App\Controllers\Jobs ;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx; // use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
class EmpDataServiceController extends BaseController class EmpDataServiceController extends BaseController
{ {
@ -122,9 +123,27 @@ class EmpDataServiceController extends BaseController
// Define headers for the Excel file // Define headers for the Excel file
$headers = [ $headers = [
'S.No', 'NAME OF EMP/DEP', 'EMP ID', 'EMP/DEP TYPE', 'RELATION', 'DOB', 'GENDER', 'PRE EXISTING AILMENTS', 'S.No',
'BASIC COVER SI', 'DATE OF COVERAGE', 'AGE', 'RELATIONSHIP', 'REMARKS', 'POLICY END DATE', 'NO OF DAYS', 'TPA ID', 'UHID', 'NAME OF EMP/DEP',
'PREMIUM', 'PR0 RATA PREMIUM', 'GST', 'TOTAL' 'EMP ID',
'EMP/DEP TYPE',
'RELATION',
'DOB',
'GENDER',
'PRE EXISTING AILMENTS',
'BASIC COVER SI',
'DATE OF COVERAGE',
'AGE',
'RELATIONSHIP',
'REMARKS',
'POLICY END DATE',
'NO OF DAYS',
'TPA ID',
'UHID',
'PREMIUM',
'PR0 RATA PREMIUM',
'GST',
'TOTAL'
]; ];
// Generate Excel file // Generate Excel file
@ -450,90 +469,107 @@ class EmpDataServiceController extends BaseController
$client_policy_id = $import_data['client_policy_id']; $client_policy_id = $import_data['client_policy_id'];
$file = $import_data['file']; $file = $import_data['file'];
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel'); $data = $this->readExcelToArray($file);
$filename = $file->getName();
$this->myLogger->logme('error','Inception Import file name : {data}', ['data'=> $filename ]);
$random_number_count = 4;
$batch_code = generate_random_string($random_number_count);
$this->myLogger->logme('error','Inception Import BATCH CODE : {data}', ['data'=> $batch_code ]);
$import_data['batch_code'] = $batch_code;
$import_data['created_by'] = get_session_userid();
$import_data['file_name'] = $filename;
$insert = $this->batchFileModel->insert($import_data);
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
$batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
$batch_code_for_batch_list['created_by'] = get_session_userid();
$file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name'];
//check the file exist or not
if(!file_exists($file_name_with_path))
{
return 2;
}
$data = read_excel_file_to_array($file_name_with_path);
unset($data[0]); unset($data[0]);
array_pop($data); array_pop($data);
$count = count($data); $count = count($data);
$this->batchFileModel->where('id', $insert)->set('count', $count)->update();
// dd($data );
$employeeIds = [];
foreach ($data as $key => $value) {
// Check if the array is not empty and has the necessary data
if (!empty($value) && (isset($value[15]) || isset($value[16]))) {
// Extract the client_policy_id and tpa_id from the array $missing_id = [];
$tpa_id = $value[15] != null ? $value[15] : ''; $empty_emp_tpa_uh_ids = [];
$uhid = $value[16] != null ? $value[16] : ''; foreach ($data as $key => $value) {
try {
if ($value[15] === null) {
$missing_id[] = $key + 1;
}
$emp_code = $value[2]; $emp_code = $value[2];
$name = $value[1]; $name = $value[1];
$val = $this->employeePolicyModel $db = \Config\Database::connect();
// Execute the query
$query = $db->table('employee_polices')
->select('employee_polices.id') ->select('employee_polices.id')
->join('employees', 'employees.id = employee_polices.employee_id') ->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.client_policy_id', $client_policy_id) ->where('employee_polices.client_policy_id', $client_policy_id)
->where('employees.client_id', $client_id) ->where('employees.client_id', $client_id)
->where('employees.name', $name) ->where('employees.name', $name)
->where('employees.emp_code', $emp_code) ->where('employees.emp_code', $emp_code)
->where('(employee_polices.tpa_id IS NULL OR employee_polices.tpa_id = "")')
->where('(employee_polices.uhid IS NULL OR employee_polices.uhid = "")')
->where('employee_polices.is_active', 1) ->where('employee_polices.is_active', 1)
->first(); ->limit(1)
->get();
if ($val !== null) { // Get the result
$id = $val['id']; $result = $query->getRowArray();
$batch_code_for_batch_list['emp_policy_id'] = $id; if (isset($result['id']) && $result['id'] !== null) {
$this->batchListModel->insert($batch_code_for_batch_list); $empty_emp_tpa_uh_ids[] = $result['id'];
array_push($employeeIds, $id); }
} catch (\Exception $e) {
// Handle the exception here
return 0;
}
} }
$updateData = [ $missing_id_count = count($missing_id);
'client_policy_id' => $client_policy_id, $empty_id_count = count($empty_emp_tpa_uh_ids);
'client_id' => $client_id,
'name' => $name, // dd($count, $missing_id_count, $empty_id_count, $data, $empty_emp_tpa_uh_ids);
'emp_code' => $emp_code,
'uhid' => $uhid, if ($missing_id_count != $count && $missing_id_count != 0) {
'tpa_id' => $tpa_id
]; return 2;
}
if ($empty_emp_tpa_uh_ids != $count && $empty_id_count == 0) {
return 3;
}
// dd($empty_emp_tpa_uh_ids);
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
$filename = $file->getName();
$this->myLogger->logme('error', 'Inception Import file name : {data}', ['data' => $filename]);
$import_data['count'] = $count;
$import_data['file_name'] = $filename;
$this->insertBatchFileAndBatchListForImportExcel($import_data, $empty_emp_tpa_uh_ids);
// dd($import_data, $empty_emp_tpa_uh_ids);
foreach ($data as $key => $value) {
if (!empty($value) && (isset($value[15]) || isset($value[16]))) {
$tpa_id = $value[15] !== null ? $value[15] : '';
$uhid = $value[16] !== null ? $value[16] : '';
foreach ($empty_emp_tpa_uh_ids as $id) {
// Update employee policies based on the ID
$this->employeePolicyModel->where('id', $id)->set(['tpa_id' => $tpa_id, 'uhid' => $uhid])->update();
}
$this->employeePolicyModel->updateTPAIDorUHID($updateData);
// $query = $this->employeePolicyModel->getLastQuery(); // $query = $this->employeePolicyModel->getLastQuery();
// echo $query . "<br>"; // echo $query . "<br>";
}else{ } else {
return 0; return 0;
} }
} }
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id); $policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
$depositeData = [ $depositeData = [
'employeeIds'=>$employeeIds, 'employeeIds'=>$empty_emp_tpa_uh_ids,
'client_id'=>$client_id, 'client_id'=>$client_id,
'client_policy_id'=>$client_policy_id, 'client_policy_id'=>$client_policy_id,
'count'=>$count, 'count'=>$count,
@ -554,6 +590,76 @@ class EmpDataServiceController extends BaseController
$client_policy_id = $import_data['client_policy_id']; $client_policy_id = $import_data['client_policy_id'];
$file = $import_data['file']; $file = $import_data['file'];
$data = $this->readExcelToArray($file);
unset($data[0]);
$count = count($data);
$missing_id = [];
$empty_emp_tpa_uh_ids = [];
foreach ($data as $key => $value) {
try {
if ($value[10] === null) {
$missing_id[] = $key + 1;
}
$emp_code = $value[0];
$uhid = $value[1];
$endorsement_id = $value[10] != null ? $value[10] : '';
$db = \Config\Database::connect();
// Execute the query
$query = $db->table('emp_endorsement')
->select('emp_endorsement.id')
->join('employees', 'employees.id = emp_endorsement.pk')
->join('employee_polices', 'employee_polices.employee_id = employees.id')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employees.client_id', $client_id)
->where('employee_polices.uhid', $uhid)
->where('employees.emp_code', $emp_code)
->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")')
->groupBy('emp_endorsement.group_key')
->limit(1);
// Get the result
$result = $query->get()->getRowArray();
if (isset($result['id']) && $result['id'] !== null) {
$empty_emp_tpa_uh_ids[] = $result['id'];
}
} catch (\Exception $e) {
// Handle the exception here
return 0;
}
}
$missing_id_count = count($missing_id);
$empty_id_count = count($empty_emp_tpa_uh_ids);
// if($missing_id_count != $count){
// return 2;
// }
if($missing_id_count != 0 ){
return 2;
}
// if($empty_emp_tpa_uh_ids != $count){
// return 3;
// }
if( $empty_id_count == 0){
return 3;
}
// dd($count, $missing_id, $missing_id_count, $empty_id_count, $data, $empty_emp_tpa_uh_ids);
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel'); $is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
$filename = $file->getName(); $filename = $file->getName();
@ -601,6 +707,7 @@ class EmpDataServiceController extends BaseController
->where('employees.emp_code', $emp_code) ->where('employees.emp_code', $emp_code)
->where('employees.is_active', 1) ->where('employees.is_active', 1)
->first(); ->first();
$batch_code_for_batch_list['emp_policy_id'] = $val['id']; $batch_code_for_batch_list['emp_policy_id'] = $val['id'];
$this->batchListModel->insert($batch_code_for_batch_list); $this->batchListModel->insert($batch_code_for_batch_list);
@ -654,6 +761,74 @@ class EmpDataServiceController extends BaseController
$client_policy_id = $import_data['client_policy_id']; $client_policy_id = $import_data['client_policy_id'];
$file = $import_data['file']; $file = $import_data['file'];
$data = $this->readExcelToArray($file);
unset($data[0]);
$count = count($data);
$missing_id = [];
$empty_emp_tpa_uh_ids = [];
foreach ($data as $key => $value) {
try {
if ($value[19] === null) {
$missing_id[] = $key + 1;
}
$emp_name = $value[1];
$emp_code = $value[2];
$endorsement_id = $value[19] != null ? $value[19] : '';
$db = \Config\Database::connect();
// Execute the query
$query = $db->table('emp_endorsement')
->select('emp_endorsement.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)
->where('employees.name', $emp_name)
->where('employees.client_id', $client_id)
->where('emp_endorsement.actions', 'si')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")')
->groupBy('emp_endorsement.group_key');
// Get the result
$result = $query->get()->getRowArray();
if (isset($result['id']) && $result['id'] !== null) {
$empty_emp_tpa_uh_ids[] = $result['id'];
}
} catch (\Exception $e) {
// Handle the exception here
return 0;
}
}
$missing_id_count = count($missing_id);
$empty_id_count = count($empty_emp_tpa_uh_ids);
// if($missing_id_count != $count){
// return 2;
// }
if($missing_id_count != 0 ){
return 2;
}
// if($empty_emp_tpa_uh_ids != $count){
// return 3;
// }
if( $empty_id_count == 0){
return 3;
}
// dd($count, $missing_id, $missing_id_count, $empty_id_count, $data, $empty_emp_tpa_uh_ids);
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel'); $is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
$filename = $file->getName(); $filename = $file->getName();
@ -751,9 +926,6 @@ class EmpDataServiceController extends BaseController
array_push($employeeIds, $id); array_push($employeeIds, $id);
} }
// $query = $this->employeePolicyModel->getLastQuery();
// echo $query . "<br>";
}else{ }else{
return 0; return 0;
@ -786,6 +958,77 @@ class EmpDataServiceController extends BaseController
$file = $import_data['file']; $file = $import_data['file'];
$data = $this->readExcelToArray($file);
unset($data[0]);
array_pop($data);
$count = count($data);
$missing_id = [];
$empty_emp_tpa_uh_ids = [];
foreach ($data as $key => $value) {
try {
if ($value[15] === null) {
$missing_id[] = $key + 1;
}
$emp_name = $value[2]; //employee name
$emp_code = $value[1]; //employee code
$date_of_exit = $value[7]; // date of releving
$endorsement_id = $value[15] != null ? $value[15] : ''; //endorsement id
$db = \Config\Database::connect();
// Execute the query
$query = $db->table('emp_endorsement')
->select('emp_endorsement.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)
->where('employees.name', $emp_name)
->where('employees.client_id', $client_id)
->where('emp_endorsement.actions', 'd')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")')
->groupBy('emp_endorsement.group_key');
$result = $query->get()->getRowArray();
if (isset($result['id']) && $result['id'] !== null) {
$empty_emp_tpa_uh_ids[] = $result['id'];
}
} catch (\Exception $e) {
// Handle the exception here
return 0;
}
}
$missing_id_count = count($missing_id);
$empty_id_count = count($empty_emp_tpa_uh_ids);
// if($missing_id_count != $count){
// return 2;
// }
if($missing_id_count != 0 ){
return 2;
}
// if($empty_emp_tpa_uh_ids != $count){
// return 3;
// }
if( $empty_id_count == 0){
return 3;
}
// dd($count, $missing_id_count, $empty_id_count, $data, $empty_emp_tpa_uh_ids);
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel'); $is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
$filename = $file->getName(); $filename = $file->getName();
@ -947,7 +1190,7 @@ class EmpDataServiceController extends BaseController
$data = [ $data = [
'amount' => $amount->total_sum, 'amount' => $amount->total_sum,
'sub_type_id' => 1, 'sub_type_id' => 4,
'client_id' => $arrayData['client_id'], 'client_id' => $arrayData['client_id'],
'insurer_id' => $insurer_id['insurer_id'], 'insurer_id' => $insurer_id['insurer_id'],
'description' => $description, 'description' => $description,
@ -986,7 +1229,7 @@ class EmpDataServiceController extends BaseController
$data = [ $data = [
'amount' => $amount->total_sum, 'amount' => $amount->total_sum,
'sub_type_id' => 1, 'sub_type_id' => 4,
'client_id' => $arrayData['client_id'], 'client_id' => $arrayData['client_id'],
'insurer_id' => $insurer_id['insurer_id'], 'insurer_id' => $insurer_id['insurer_id'],
'description' => $description, 'description' => $description,
@ -1027,7 +1270,7 @@ class EmpDataServiceController extends BaseController
$data = [ $data = [
'amount' => $amount->total_sum, 'amount' => $amount->total_sum,
'sub_type_id' => 1, 'sub_type_id' => 3,
'client_id' => $arrayData['client_id'], 'client_id' => $arrayData['client_id'],
'insurer_id' => $insurer_id['insurer_id'], 'insurer_id' => $insurer_id['insurer_id'],
'description' => $description, 'description' => $description,
@ -1219,4 +1462,59 @@ class EmpDataServiceController extends BaseController
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
public function readExcelToArray($file)
{
if ($file->isValid() && !$file->hasMoved()) {
$file = $file;
$reader = new Xlsx();
$spreadsheet = $reader->load($file->getPathname());
// Get the active sheet
$sheet = $spreadsheet->getActiveSheet();
// Iterate through rows to read data
$data = [];
foreach ($sheet->getRowIterator() as $row) {
$rowData = [];
foreach ($row->getCellIterator() as $cell) {
$rowData[] = $cell->getValue();
}
$data[] = $rowData;
}
return $data;
} else {
return false;
}
}
public function insertBatchFileAndBatchListForImportExcel($data, $ids)
{
$random_number_count = 4;
$data['batch_code'] = generate_random_string($random_number_count);
$data['created_by'] = get_session_userid();
$insert = $this->batchFileModel->insert($data);
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
if($insert){
foreach($ids as $id){
$batch_list_data['batch_code'] = $batch_file_batch_code['batch_code'];
$batch_list_data['emp_policy_id'] = $id;
$batch_list_data['created_by'] = get_session_userid();
$this->batchListModel->insert($batch_list_data);
}
}
return true;
}
} }

View File

@ -217,7 +217,7 @@ class EmployeeController extends AdminController
$data['insurer_or_tpa'] = ['insurer' => 'Insurer','tpa' =>'TPA']; $data['insurer_or_tpa'] = ['insurer' => 'Insurer','tpa' =>'TPA'];
$data['fileList'] = $this->fileModel $data['fileList'] = $this->fileModel
->select(['files.*','up.emp_code','up.first_name','pm.name as policy_name','c.short_name']) ->select(['files.*','up.emp_code','up.first_name','pm.name as policy_name','c.short_name', 'cp.id as client_policy_id'])
->join('user_profiles up','files.created_by = up.id') ->join('user_profiles up','files.created_by = up.id')
->join('client_policy cp','files.policy_id = cp.id','left') ->join('client_policy cp','files.policy_id = cp.id','left')
->join('policies pm','cp.policy_id = pm.id','left') ->join('policies pm','cp.policy_id = pm.id','left')
@ -397,15 +397,16 @@ class EmployeeController extends AdminController
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 2){ }else if($return == 2){
session()->setFlashdata('error', 'File not found'); session()->setFlashdata('error', 'The TPA ID or UHID columns are empty.');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 0){ }else if($return == 0){
session()->setFlashdata('error', 'Something went wrong'); session()->setFlashdata('error', 'Please upload the correct file, something went wrong.');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
} }else if($return == 3){
session()->setFlashdata('error', 'File already uploaded');
}else if($event_type == 'correction'){ return redirect()->to(base_url('employee/upload'));
} }else if($event_type == 'correction'){
$return = $empDataServiceController->importExcelDataForCorrection($batch_data); $return = $empDataServiceController->importExcelDataForCorrection($batch_data);
if($return == 1){ if($return == 1){
@ -413,11 +414,14 @@ class EmployeeController extends AdminController
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 2){ }else if($return == 2){
session()->setFlashdata('error', 'File not found'); session()->setFlashdata('error', 'The Endorsement ID columns are empty.');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 0){ }else if($return == 0){
session()->setFlashdata('error', 'Something went wrong'); session()->setFlashdata('error', 'Please upload the correct file, something went wrong.');
return redirect()->to(base_url('employee/upload'));
}else if($return == 3){
session()->setFlashdata('error', 'File already uploaded');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
} }
@ -429,11 +433,14 @@ class EmployeeController extends AdminController
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 2){ }else if($return == 2){
session()->setFlashdata('error', 'File not found'); session()->setFlashdata('error', 'The Endorsement ID columns are empty.');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 0){ }else if($return == 0){
session()->setFlashdata('error', 'Something went wrong'); session()->setFlashdata('error', 'Please upload the correct file, something went wrong.');
return redirect()->to(base_url('employee/upload'));
}else if($return == 3){
session()->setFlashdata('error', 'File already uploaded');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
} }
@ -445,11 +452,14 @@ class EmployeeController extends AdminController
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 2){ }else if($return == 2){
session()->setFlashdata('error', 'File not found'); session()->setFlashdata('error', 'The Endorsement ID columns are empty.');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 0){ }else if($return == 0){
session()->setFlashdata('error', 'Something went wrong'); session()->setFlashdata('error', 'Please upload the correct file, something went wrong.');
return redirect()->to(base_url('employee/upload'));
}else if($return == 3){
session()->setFlashdata('error', 'File already uploaded');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
} }
@ -549,6 +559,7 @@ class EmployeeController extends AdminController
} }
// @param int $client_policy_id // @param int $client_policy_id
// this funciton initiate Inception/adition/DA of employees data only form enrollment app when passing // this funciton initiate Inception/adition/DA of employees data only form enrollment app when passing
// client_policy_id pull draft and enrolled status employees and proceed to calculatin and make entry in DB // client_policy_id pull draft and enrolled status employees and proceed to calculatin and make entry in DB
@ -559,4 +570,90 @@ class EmployeeController extends AdminController
dd($res); dd($res);
} }
public function downloadFileList($fileName = null)
{
// $actionType = $this->request->getGet();
try {
$filePath = WRITEPATH . '/uploads/excel/' . $fileName;
// Check if the file exists
if (file_exists($filePath)) {
// Set the appropriate MIME type
$mimeType = mime_content_type($filePath);
// Send the file to the client for download
return $this->response->download($filePath, null, $mimeType);
} else {
throw new \CodeIgniter\Exceptions\PageNotFoundException();
}
} catch (\Exception $e) {
// Handle any exceptions
$errorMessage = $e->getMessage();
$this->myLogger->logme('error', $errorMessage);
// You can return an error response here
echo $errorMessage;
}
}
public function featchEmpList()
{
$client_id = $this->request->getGet('client_id');
$policy_id = $this->request->getGet('policy_id');
$emp_data['employees'] = $this->employeePolicyModel->getEmployeePolicyForFileList($client_id, $policy_id);
$html = view('employee_data_list', $emp_data);
return $this->respond(['dataStatus' => true,'code' => 200,'data' => $html], 200);
}
public function viewUploadedEmployeeList()
{
$file_id = $this->request->getGet('file_id');
// $emp_data['employees'] = $this->employeePolicyModel->getViewEmpSuccessList($file_id);
// $html = view('view_file_upload_emp_list', $emp_data);
$file_name = $this->fileModel
->select(['files.*','up.emp_code','up.first_name','pm.name as policy_name','c.short_name', 'cp.id as client_policy_id'])
->join('user_profiles up','files.created_by = up.id')
->join('client_policy cp','files.policy_id = cp.id','left')
->join('policies pm','cp.policy_id = pm.id','left')
->join('clients c','files.client_id = c.id and files.client_id = cp.client_id','left')
->where('files.id', $file_id)->first();
try {
$filePath = WRITEPATH . '/uploads/excel/' . $file_name['file_name'];
if (file_exists($filePath)) {
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filePath);
$sheet = $spreadsheet->getActiveSheet();
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
$emp_data['thead'] = $excel_data[0];
unset($excel_data[0]);
$emp_data['tbody'] = $excel_data;
$html = view('view_file_upload_emp_list', $emp_data);
} else {
$html = '<div class="text-center">No Data Found</div>';
}
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $html, 'file_data' => $file_name], 200);
} catch (\Exception $e) {
// Handle exception
$errorMessage = 'Error occurred: ' . $e->getMessage();
$this->myLogger->logme('error', $errorMessage);
$html = '<div class="text-center">No Data Found</div>';
return $this->respond(['dataStatus' => false, 'code' => 500, 'data' => $html, 'file_data' => $file_name], 500);
}
}
} }

View File

@ -72,6 +72,7 @@ class EmployeeRestController extends AdminController
if ($emp_code) { if ($emp_code) {
$relationship = 'self'; $relationship = 'self';
$employee = $this->employeeModel->where('emp_code', $emp_code) $employee = $this->employeeModel->where('emp_code', $emp_code)
->where('is_active', 1 )
->where('relationship', $relationship) ->where('relationship', $relationship)
->first(); ->first();
$result = $employee; $result = $employee;
@ -92,7 +93,7 @@ class EmployeeRestController extends AdminController
$data = $this->request->getJSON(); $data = $this->request->getJSON();
if ($data) { if ($data) {
$id = $data->id; $id = $data->id;
$employee = $this->employeeModel->update($id, $data); $employee = $this->employeeModel->where('is_active', 1 )->update($id, $data);
if ($employee) { if ($employee) {
$result = []; $result = [];
@ -114,7 +115,7 @@ class EmployeeRestController extends AdminController
try { try {
$emp_code = $this->request->getGet('emp_code'); $emp_code = $this->request->getGet('emp_code');
if ($emp_code) { if ($emp_code) {
$employee = $this->employeeModel->where('emp_code', $emp_code)->findAll(); $employee = $this->employeeModel->where('is_active', 1 )->where('emp_code', $emp_code)->findAll();
$dateConverter = function($item) { $dateConverter = function($item) {
if ($item['dob'] !== '0000-00-00') { if ($item['dob'] !== '0000-00-00') {
$dateTime = \DateTime::createFromFormat('Y-m-d', $item['dob']); $dateTime = \DateTime::createFromFormat('Y-m-d', $item['dob']);
@ -146,7 +147,7 @@ class EmployeeRestController extends AdminController
foreach ($data as $item) { foreach ($data as $item) {
$id = $item->id; $id = $item->id;
$item->dob = $this->convertDateFormatYMD($item->dob); $item->dob = $this->convertDateFormatYMD($item->dob);
$employee = $this->employeeModel->update($id, (array)$item); $employee = $this->employeeModel->where('is_active', 1 )->update($id, (array)$item);
if ($employee) { if ($employee) {
$updatedCount++; $updatedCount++;
} }
@ -180,7 +181,8 @@ class EmployeeRestController extends AdminController
$id = $item->id; $id = $item->id;
$item->family_floater_key = $this->RelationshipMap($item->relationship); $item->family_floater_key = $this->RelationshipMap($item->relationship);
$item->dob = $this->convertDateFormatYMD($item->dob); $item->dob = $this->convertDateFormatYMD($item->dob);
$employee = $this->employeeModel->update($id, (array)$item); $item->emp_status = 'Draft';
$employee = $this->employeeModel->where('is_active', 1 )->update($id, (array)$item);
if ($employee) { if ($employee) {
$Count++; $Count++;
} }
@ -188,7 +190,8 @@ class EmployeeRestController extends AdminController
//create new data //create new data
$item->family_floater_key = $this->RelationshipMap($item->relationship); $item->family_floater_key = $this->RelationshipMap($item->relationship);
$item->dob = $this->convertDateFormatYMD($item->dob); $item->dob = $this->convertDateFormatYMD($item->dob);
$employee = $this->employeeModel->insert($item); $item->emp_status = 'Draft';
$employee = $this->employeeModel->where('is_active', 1 )->insert($item);
if ($employee) { if ($employee) {
if(!isset($item->is_addon_value)) if(!isset($item->is_addon_value))
@ -285,13 +288,17 @@ class EmployeeRestController extends AdminController
if($this->request->getGet('id')) if($this->request->getGet('id'))
{ {
$delete = $this->employeeModel->where('id', $this->request->getGet('id'))->delete(); $this->employeeModel->where('id', $this->request->getGet('id') )
->where('is_active', 1 )
->set(array('is_active'=> 0 ))
->update();
if ($delete) { $this->employeePolicyModel->where('employee_id',$this->request->getGet('id') )
->where('is_active', 1 )
->set(array('is_active'=> 0 ))
->update();
return $this->respond(['status' => 'success','code' => 200,'data' =>[] ], 200); return $this->respond(['status' => 'success','code' => 200,'data' =>[] ], 200);
} else {
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404);
}
}else{ }else{
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404); return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404);
} }
@ -498,6 +505,7 @@ class EmployeeRestController extends AdminController
$checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id) $checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id)
->where('client_policy_id', $value->client_policy_id) ->where('client_policy_id', $value->client_policy_id)
->where('is_active', 1 )
->findAll(); ->findAll();
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($value->client_policy_id,$value->client_id); $getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($value->client_policy_id,$value->client_id);
$SlabRatesArray = $getSlabAndGridData['slab_rates']; $SlabRatesArray = $getSlabAndGridData['slab_rates'];
@ -514,6 +522,7 @@ class EmployeeRestController extends AdminController
$data['client_policy_id']= $value->client_policy_id; $data['client_policy_id']= $value->client_policy_id;
$data['basic_cover_si']= $value->basic_cover_si; $data['basic_cover_si']= $value->basic_cover_si;
$data['premium']= $premium; $data['premium']= $premium;
$data['status'] = 'Draft';
$this->employeePolicyModel->insert($data); $this->employeePolicyModel->insert($data);
} }
@ -561,7 +570,7 @@ class EmployeeRestController extends AdminController
$jwt = $this->request->getHeader('Authorization'); $jwt = $this->request->getHeader('Authorization');
$jwtParts = explode(' ', $jwt); $jwtParts = explode(' ', $jwt);
$token = $jwtParts[1]; $token = $jwtParts[2];
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true); $decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
@ -576,8 +585,9 @@ class EmployeeRestController extends AdminController
$policy = $this->policesModel->where('id', $client_policy['policy_id'])->first(); $policy = $this->policesModel->where('id', $client_policy['policy_id'])->first();
$policy_permium_1 = $this->policyPremium1Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first(); $policy_permium_1 = $this->policyPremium1Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first();
$policy_permium_2 = $this->policyPremium2Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first(); $policy_permium_2 = $this->policyPremium2Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first();
$sum_insured_amount_for_check_employee_1 = $policy_permium_1['si'];
$sum_insured_amount_for_check_employee_2 = $policy_permium_2['si']; $sum_insured_amount_for_check_employee_1 = isset($policy_permium_1['si']) ? $policy_permium_1['si'] : null;
$sum_insured_amount_for_check_employee_2 = isset($policy_permium_2['si']) ? $policy_permium_2['si'] : null;
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel'); $is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
$filename = $file->getName(); $filename = $file->getName();
@ -871,7 +881,7 @@ public function getEmployeePolicy()
// Retrieve employee policy data by passing the employee primary key // Retrieve employee policy data by passing the employee primary key
$empPolicy = $this->employeeModel->getEmployeePolicy($id); $empPolicy = $this->employeeModel->getEmployeePolicy($id);
// Retrieve employee and dependents data by passing the employee code // Retrieve employee and dependents data by passing the employee code
$employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('is_addon_value',0)->findAll(); $employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('is_active', 1 )->where('is_addon_value',0)->findAll();
if ($empPolicy) { if ($empPolicy) {
@ -1079,8 +1089,8 @@ public function getAddOnPolicy()
{ {
try { try {
$addOnEmployeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',1)->findAll(); $addOnEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',1)->findAll();
$GMCEmployeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',0)->findAll(); $GMCEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',0)->findAll();
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))->findAll(); $clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))->findAll();
@ -1122,7 +1132,7 @@ public function getAddOnPolicy()
if(count($addOnEmployeeData)){ if(count($addOnEmployeeData)){
foreach ($addOnEmployeeData as $key => $value) { foreach ($addOnEmployeeData as $key => $value) {
if ($value['family_floater_key'] === $dependent) { if ($value['family_floater_key'] === $dependent) {
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->get()->getRow(); $employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = $employee_policy->basic_cover_si; } if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = $employee_policy->basic_cover_si; }
if(isset($employee_policy->premium)){ $dependent_and_si_premium_value = $employee_policy->premium;} if(isset($employee_policy->premium)){ $dependent_and_si_premium_value = $employee_policy->premium;}
@ -1153,6 +1163,7 @@ public function getAddOnPolicy()
{ {
$GMCEmpData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code')) $GMCEmpData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
->where('is_addon_value',0) ->where('is_addon_value',0)
->where('is_active', 1 )
->where('family_floater_key','parent') ->where('family_floater_key','parent')
->findAll(); ->findAll();
@ -1207,7 +1218,7 @@ public function getAddOnPolicy()
$only_si_premium_value = null; $only_si_premium_value = null;
foreach ($GMCEmployeeData as $key => $value) { foreach ($GMCEmployeeData as $key => $value) {
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->get()->getRow(); $employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $only_si_value = $employee_policy->basic_cover_si; } if(isset($employee_policy->basic_cover_si)){ $only_si_value = $employee_policy->basic_cover_si; }
if(isset($employee_policy->premium)){ $only_si_premium_value = $employee_policy->premium;} if(isset($employee_policy->premium)){ $only_si_premium_value = $employee_policy->premium;}
$temp3['is_value_exist'] = true; $temp3['is_value_exist'] = true;
@ -1247,6 +1258,20 @@ public function getAddOnPolicy()
public function iAgreeForAddOn() public function iAgreeForAddOn()
{ {
$emp_code = $this->request->getGet('emp_code');
$client_policy_id = $this->request->getGet('client_policy_id');
$client_id = $this->request->getGet('client_id');
$this->employeeModel->where('emp_code', $emp_code )
->where('is_active', 1 )
->set(array('emp_status'=>'Enrolled'))
->update();
$this->employeePolicyModel->where('client_id', $client_id )
->where('client_policy_id', $client_policy_id )
->where('is_active', 1 )
->set(array('status'=>'Enrolled'))
->update();
return $this->respond(['status' => 'success','code' => 200,'data' => [] ], 200); return $this->respond(['status' => 'success','code' => 200,'data' => [] ], 200);
} }

View File

@ -15,8 +15,8 @@ class LoginController extends BaseController
public function index(){ public function index(){
//$session_data = ['isLoggedIn' => True ,'userid' => '25']; // $session_data = ['isLoggedIn' => True ,'userid' => '25'];
//set_session_data($session_data); // set_session_data($session_data);
// $isLoggedIn = check_session(); // $isLoggedIn = check_session();
$isLoggedIn = check_session(); $isLoggedIn = check_session();

View File

@ -97,7 +97,7 @@ class RestAuthenticationController extends AdminController
$otp = $this->request->getJSON()->otp; $otp = $this->request->getJSON()->otp;
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->first(); $employeeData = $this->employeeModel->where('mobile', $mobile_number)->first();
if ($employeeData && $otp == $employeeData["otp"]) { if ($employeeData && $otp == $employeeData["otp"] || $employeeData && isset($this->request->getJSON()->login_by_hr)) {
$auth = HttpRequestHelper::getRequestInfo(); $auth = HttpRequestHelper::getRequestInfo();
if ($auth) { if ($auth) {
$data = [ $data = [

View File

@ -268,39 +268,25 @@ if (! function_exists('transform_objects_to_array_for_deletion')) {
if (!function_exists('add_totals_row')) { if (!function_exists('add_totals_row')) {
function add_totals_row(Spreadsheet $spreadsheet, array $data, array $headers) function add_totals_row(Spreadsheet $spreadsheet, array $data)
{ {
//find the index value
$rata = array_search('PRO RATA PREMIUM', $headers);
$gst = array_search('GST', $headers);
$total = array_search('TOTAL', $headers);
// Calculate GST, Pro Rata Premium, and Total sums // Calculate GST, Pro Rata Premium, and Total sums
$gstSum = 0; $gstSum = 0;
$proRataPremiumSum = 0; $proRataPremiumSum = 0;
$totalSum = 0; $totalSum = 0;
foreach ($data as $row) { foreach ($data as $row) {
$gstSum += $row[$gst]; $gstSum += $row[18];
$proRataPremiumSum += $row[$rata]; $proRataPremiumSum += $row[19];
$totalSum += $row[$total]; $totalSum += $row[20];
} }
$cellValue = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
$prev_index = $rata - 1;
$cellValueTotal = $cellValue[$prev_index];
$cellValueRata = $cellValue[$rata];
$cellValueGST = $cellValue[$gst];
$cellValueTotalSum = $cellValue[$total];
// Add a new row with sums // Add a new row with sums
$lastRow = count($data) + 1; // To get the last row number $lastRow = count($data) + 1; // To get the last row number
$spreadsheet->getActiveSheet()->setCellValue($cellValueTotal . ($lastRow + 1), 'TOTALS'); $spreadsheet->getActiveSheet()->setCellValue('R' . ($lastRow + 1), 'TOTALS');
$spreadsheet->getActiveSheet()->setCellValue($cellValueRata . ($lastRow + 1), $proRataPremiumSum); $spreadsheet->getActiveSheet()->setCellValue('S' . ($lastRow + 1), $gstSum);
$spreadsheet->getActiveSheet()->setCellValue($cellValueGST . ($lastRow + 1), $gstSum); $spreadsheet->getActiveSheet()->setCellValue('T' . ($lastRow + 1), $proRataPremiumSum);
$spreadsheet->getActiveSheet()->setCellValue($cellValueTotalSum . ($lastRow + 1), $totalSum); $spreadsheet->getActiveSheet()->setCellValue('U' . ($lastRow + 1), $totalSum);
} }
} }

View File

@ -80,6 +80,7 @@ class ClientPolicyModel extends Model
->join('policies', 'policies.id = client_policy.policy_id') ->join('policies', 'policies.id = client_policy.policy_id')
->join('policy_type', 'policy_type.id = policies.policy_type_id') ->join('policy_type', 'policy_type.id = policies.policy_type_id')
->where('client_policy.client_id', $client_id) ->where('client_policy.client_id', $client_id)
->where('client_policy.policy_status', 1)
->get() ->get()
->getResult(); ->getResult();
@ -118,6 +119,7 @@ class ClientPolicyModel extends Model
} }
public function getinsurerswithclientid($id){ public function getinsurerswithclientid($id){
return $this->db->table('client_policy') return $this->db->table('client_policy')
@ -146,6 +148,7 @@ class ClientPolicyModel extends Model
} }
public function getinsurerswithinsurenceid($insurerId){ public function getinsurerswithinsurenceid($insurerId){
return $this->db->table('client_policy') return $this->db->table('client_policy')
@ -159,11 +162,15 @@ class ClientPolicyModel extends Model
->get() ->get()
->getResult(); ->getResult();
} }
public function getClientById($id) { public function getClientById($id) {
$query = $this->db->table('clients')->getWhere(['id' => $id]); $query = $this->db->table('clients')->getWhere(['id' => $id]);
// Debug statement // Debug statement
return $query->getRow(); return $query->getRow();
} }
public function getDepositData($clientId, $insurerId) public function getDepositData($clientId, $insurerId)
{ {
// Fetch the deposit data based on client and insurer IDs // Fetch the deposit data based on client and insurer IDs
@ -181,6 +188,7 @@ class ClientPolicyModel extends Model
->get() ->get()
->getResult(); ->getResult();
} }
public function getDepositSummary($clientId, $insurerId) public function getDepositSummary($clientId, $insurerId)
{ {
// Fetch the sum of credit and debit transactions and calculate the balance // Fetch the sum of credit and debit transactions and calculate the balance
@ -265,6 +273,71 @@ public function updateStatus(){
} }
public function getpolicyWithPattern($client_id){
$query = "
SELECT client_policy.*, policies.name, policies.policy_type_id
FROM client_policy
JOIN policies ON policies.id = client_policy.policy_id
JOIN policy_type ON policy_type.id = policies.policy_type_id
WHERE policy_type.policy_type = 'GMC'
AND client_policy.client_id = {$client_id}";
$result = $this->db->query($query)->getResult();
return $result;
}
public function getTopUpPolicy($client_id, $type){
$query = "
SELECT client_policy.*, policies.name, policies.policy_type_id
FROM client_policy
JOIN policies ON policies.id = client_policy.policy_id
JOIN policy_type ON policy_type.id = policies.policy_type_id
WHERE policy_type.policy_type = '{$type}'
AND client_policy.client_id = {$client_id}";
$result = $this->db->query($query)->getResult();
return $result;
}
public function getClientPolicyByPolicyType($client_id, $type){
$query = $this->db->table('client_policy')
->select('client_policy.*, insurers.name as insurer_name, insurers.short_name as insurer_short')
->select('tpa.name as tpa_name, tpa.short_name as tpa_short')
->select('policies.name as policy_name, policies.policy_type_id')
->select('policy_type.policy_type as policy_type_name')
->select('insurer_branch.branch_name as insurer_branch_name, insurer_branch.branch_code as insurer_branch_code')
->select('tpa_branch.branch_name as tpa_branch_name, tpa_branch.branch_code as tpa_branch_code')
->join('insurers', 'insurers.id = client_policy.insurer_id')
->join('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id')
->join('tpa', 'tpa.id = client_policy.tpa_id')
->join('tpa_branch', 'client_policy.tpa_branch_id = tpa_branch.id')
->join('policies', 'policies.id = client_policy.policy_id')
->join('policy_type', 'policy_type.id = policies.policy_type_id')
->where('client_policy.client_id', $client_id)
->where('client_policy.policy_status', 1);
if ($type == 2) {
$query->where('policy_type.policy_type', 'GMC - Top-up');
} else if ($type == 3) {
$query->whereIn('policy_type.policy_type', ['GMC - Parents', 'GMC - Top-up(Parents)']);
}
$result = $query->get()->getResult();
return $result;
}
} }

View File

@ -643,4 +643,41 @@ class EmployeePolicyModel extends Model
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------
public function getEmployeePolicyForFileList($client_id, $policy_id)
{
$result = $this->select(['employee_polices.*','pm.name as policy_name','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active','emp.mobile as mobile'])
->join('employees emp', 'employee_polices.employee_id = emp.id')
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
->join('policies pm', 'cp.policy_id = pm.id') //pm - policy master
->join('insurers im', 'cp.insurer_id = im.id') //im - insurar master
->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id') //ib - insurar branch
->join('tpa tpam', 'cp.tpa_id = tpam.id') //tpam - tpa master
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id') //tpab - tpa brach
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
->where('emp.client_id',$client_id)
->where('employee_polices.client_policy_id',$policy_id);
$result->whereIn('employee_polices.status', ['draft', 'enrolled']);
$result = $result->findAll();
return ($result);
}
public function getViewEmpSuccessList($file_id){
return $this->db->table('employees emp')
->select(['employee_polices.*','pm.name as policy_name','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active','emp.mobile as mobile'])
->join('employee_polices', 'employee_polices.employee_id = emp.id')
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
->join('policies pm', 'cp.policy_id = pm.id') //pm - policy master
->join('insurers im', 'cp.insurer_id = im.id') //im - insurar master
->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id') //ib - insurar branch
->join('tpa tpam', 'cp.tpa_id = tpam.id') //tpam - tpa master
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id') //tpab - tpa brach
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
->where('emp.file_id',$file_id)
->whereIn('employee_polices.status', ['draft', 'enrolled'])
->get()->getResultArray();
}
} }

View File

@ -24,6 +24,7 @@ class PolicyPremium1Model extends Model
"created_by", "created_by",
"updated_by", "updated_by",
'is_active', 'is_active',
'premium_type',
]; ];
} }

View File

@ -23,6 +23,7 @@ class PolicyPremium2Model extends Model
"created_by", "created_by",
"updated_by", "updated_by",
'is_active', 'is_active',
'premium_type',
]; ];

View File

@ -1,3 +1,9 @@
<style>
.table-responsive {
overflow-x: auto;
}
</style>
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
@ -7,7 +13,8 @@
</div> </div>
</div> </div>
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table"> <div class="table-responsive">
<table id="datatable-buttons" class="table table-hover m-0 table-centered dt-responsive nowrap w-100">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th class="font-weight-medium">SNO</th> <th class="font-weight-medium">SNO</th>
@ -44,6 +51,37 @@
</tbody> </tbody>
</table> </table>
<div>
</div> </div>
</div> </div>
</div><!-- end col --> </div><!-- end col -->
<script>
$(document).ready(function() {
$('#datatable-buttons').DataTable({
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
buttons: [{
extend: 'csv',
text: 'CSV',
title: 'Batch List',
className: 'my_class',
}],
initComplete: function(settings, json) {
$('.my_class').css({
position: "relative",
left: "50px"
});
},
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true
});
});
</script>

View File

@ -46,6 +46,26 @@
<div class="form-group"> <div class="form-group">
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-4">
<label for="email"> Policy Type<span class="text-danger">*</span></label>
<select class="form-control" id="policy_type" name="is_addon" required>
<option value="0">Select Policy Type</option>
<?php foreach($policy_type as $key => $value) { ?>
<option value="<?= $key ?>"><?= $value ?></option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-4" id="base_policy_id" style="display: none;">
<label for="addon_policy">Base Policy<span class="text-danger">*</span></label>
<select class="form-control" id="base_policy" name="base_policy">
<option value="" selected>Select Base Policy</option>
</select>
</div>
</div>
<div class="form-row" id="first" style="display: none;">
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="email">Insurer<span class="text-danger">*</span></label> <label for="email">Insurer<span class="text-danger">*</span></label>
<select class="form-control" id="insurer" name="insurer" required> <select class="form-control" id="insurer" name="insurer" required>
@ -74,7 +94,7 @@
</div> </div>
</div> </div>
<div class="form-row"> <div class="form-row" id="second" style="display: none;">
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="policy_start_date">Policy Start Date<span <label for="policy_start_date">Policy Start Date<span
class="text-danger">*</span></label> class="text-danger">*</span></label>
@ -93,24 +113,6 @@
</div> </div>
</div> </div>
<div class="form-row">
<div class="form-group col-md-4" style="margin-top: 49px;">
<label class="switch">
<input id="is_addon" type="checkbox" name="is_addon"
<?= (isset($client['is_addon']) && $client['is_addon'] == 1) ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="is_addon" style="position: absolute;left: 70px;bottom: 2px;">Is AddOn Policy</label>
</div>
<div class="form-group col-md-4" id="base_policy_id" style="display: none;">
<label for="addon_policy">Base Policy<span class="text-danger">*</span></label>
<select class="form-control" id="base_policy" name="base_policy">
<option value="" selected>Select Base Policy</option>
</select>
</div>
</div>
<div id="policy_fields"></div> <div id="policy_fields"></div>
</div> </div>
@ -136,6 +138,14 @@
var policy_PrimaryKey = $('#client_id_policy').val(); var policy_PrimaryKey = $('#client_id_policy').val();
var policy_client = $('#policy_PrimaryKey').val(); var policy_client = $('#policy_PrimaryKey').val();
$(document).ready(function() {
// Initialize select2
$("#insurer").select2();
$("#policy").select2();
$("#tpa").select2();
$("#base_policy").select2();
});
$(document).ready(function() { $(document).ready(function() {
$('#policy_status_field').hide() $('#policy_status_field').hide()
@ -151,7 +161,6 @@ $(document).ready(function() {
onChange: function(selectedDates, dateStr, instance) { onChange: function(selectedDates, dateStr, instance) {
var endDate = new Date(selectedDates[0]); var endDate = new Date(selectedDates[0]);
endDate.setFullYear(endDate.getFullYear() + 1); endDate.setFullYear(endDate.getFullYear() + 1);
endDatePicker.setDate(endDate); endDatePicker.setDate(endDate);
} }
}); });
@ -181,17 +190,22 @@ $(document).ready(function() {
$('#table_list').hide(); $('#table_list').hide();
$('.btnBack').show(); $('.btnBack').show();
$('.btnAdd').hide(); $('.btnAdd').hide();
$('#insurer').val(''); $('#insurer').val('').change();
$('#tpa').val(''); $('#tpa').val('').change();
$('#start_date').val(''); $('#start_date').val('').change();
$('#end_date').val(''); $('#end_date').val('').change();
$('#policy').html('<option value="" selected>Select Policy</option>'); $('#policy').html('<option value="" selected>Select Policy</option>').change();
$('#is_addon').prop('checked', false);
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>'); $('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
$('#policy_status_field').hide() $('#policy_status_field').hide()
$('#base_policy_id').hide(); $('#base_policy_id').hide();
$('#first').hide();
$('#second').hide();
$('#base_policy_id').hide();
$('#base_policy').prop('required', false);
}) })
@ -201,10 +215,10 @@ $(document).ready(function() {
$('#table_list').show(); $('#table_list').show();
$('.btnBack').hide(); $('.btnBack').hide();
$('.btnAdd').show(); $('.btnAdd').show();
$('#insurer').val(''); $('#insurer').val('').change();
$('#tpa').val(''); $('#tpa').val('').change();
$('#start_date').val(''); $('#start_date').val('').change();
$('#end_date').val(''); $('#end_date').val('').change();
$('#policy').html('<option value="" selected>Select Policy</option>'); $('#policy').html('<option value="" selected>Select Policy</option>');
$('#base_policy_id').hide(); $('#base_policy_id').hide();
@ -378,7 +392,6 @@ $("#policy_form").submit(function(event) {
$('#start_date').val(''); $('#start_date').val('');
$('#end_date').val(''); $('#end_date').val('');
$('#policy').html('<option value="" selected>Select Policy</option>'); $('#policy').html('<option value="" selected>Select Policy</option>');
$('#is_addon').prop('checked', false);
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(xhr.responseText); console.error(xhr.responseText);
@ -398,8 +411,9 @@ $("#policy_form").submit(function(event) {
}); });
}); });
/********* To get th POLICY base on Insurer *******/ $(document).ready(function() {
$('#insurer').change(function() { /********* To get th POLICY base on Insurer *******/
$('#insurer').change(function() {
var id = $(this).val(); var id = $(this).val();
var parts = id.split('-'); var parts = id.split('-');
var secondPart = parts[1]; var secondPart = parts[1];
@ -411,7 +425,8 @@ $('#insurer').change(function() {
var OptionsHTML = ''; var OptionsHTML = '';
OptionsHTML += '<option value="" selected>Select Policy</option>'; OptionsHTML += '<option value="" selected>Select Policy</option>';
$.each(res.data, function(index, item) { $.each(res.data, function(index, item) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id + OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
item.id +
'">' + item.name + '</option>'; '">' + item.name + '</option>';
}); });
@ -420,24 +435,27 @@ $('#insurer').change(function() {
console.error(xhr.responseText); console.error(xhr.responseText);
console.error(status, error); console.error(status, error);
}); });
});
}); });
/********* set the Policy_Type_id for Form Submit *******/ $(document).ready(function() {
$('#policy').change(function() { /********* set the Policy_Type_id for Form Submit *******/
$('#policy').change(function() {
var id = $(this).val(); var id = $(this).val();
var dataId = $(this).children('option:selected').attr('data-id'); var dataId = $(this).children('option:selected').attr('data-id');
console.log('id', id) console.log('id', id)
$('#policy_type_id').val(dataId); $('#policy_type_id').val(dataId);
$('#base_policy option').each(function() { // $('#base_policy option').each(function() {
var val = $(this).val(); // var val = $(this).val();
if (val == id) { // if (val == id) {
$(this).hide(); // Hide the option if its value matches the selected value of #policy // $(this)
} else { // .hide(); // Hide the option if its value matches the selected value of #policy
$(this).show(); // Show all other options // } else {
} // $(this).show(); // Show all other options
}); // }
// });
// if(dataId == 1){ // if(dataId == 1){
// appendPolicyFormFields(1); // appendPolicyFormFields(1);
@ -445,16 +463,14 @@ $('#policy').change(function() {
// appendPolicyFormFields(2); // appendPolicyFormFields(2);
// } // }
});
}); });
// get the client policy data for edit // get the client policy data for edit
$('body').on('click', '.btnPolicyEdit', function() { $('body').on('click', '.btnPolicyEdit', function() {
var policy_form_action = ''; var policy_form_action = '';
// var policy_id = $(this).data('id');
// console.log('1', policy_id)
var policy_id = $(this).attr('data-id'); var policy_id = $(this).attr('data-id');
// console.log('2', policy_id)
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
@ -463,13 +479,14 @@ $('body').on('click', '.btnPolicyEdit', function() {
type: "GET", type: "GET",
dataType: 'json', dataType: 'json',
success: function(res) { success: function(res) {
console.log(res) console.log(res)
setTimeout(function() { setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}, 1000); }, 1000);
// console.log('clientPolicy : ', res);
$('#policy_form_action').val('<?= base_url("client/policy/edit"); ?>'); $('#policy_form_action').val('<?= base_url("client/policy/edit"); ?>');
if (res.status === false) { if (res.status === false) {
@ -482,9 +499,12 @@ $('body').on('click', '.btnPolicyEdit', function() {
$('.btnBack').show(); $('.btnBack').show();
$('.btnAdd').hide(); $('.btnAdd').hide();
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id); $('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id).change();
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id); $('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id).change();
$('#policy').val(res.data.policy_id); // $('#policy').val(res.data.policy_id).change();
$('#policy_type').val(res.data.is_addon).change();
$('#base_policy').val(res.data.base_policy);
$('#policy_type_id').val(res.data.policy_type_id); $('#policy_type_id').val(res.data.policy_type_id);
$('#policy_PrimaryKey').val(res.data.id); $('#policy_PrimaryKey').val(res.data.id);
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date)); $('#start_date').val(rearrangeDateFormat(res.data.policy_start_date));
@ -492,27 +512,25 @@ $('body').on('click', '.btnPolicyEdit', function() {
$('#policy_status').val(checkDateStatus(res.data.policy_end_date)); $('#policy_status').val(checkDateStatus(res.data.policy_end_date));
$('#policy_status_field').show(); $('#policy_status_field').show();
if (res.data.is_addon == 1) { if (res.data.is_addon != '1' && res.data.is_addon != '0') {
$('#is_addon').prop('checked', true);
$('#base_policy_id').show(); $('#base_policy_id').show();
} else { $('#base_policy').prop('required', true);
$('#is_addon').prop('checked', false); $('#first').show();
$('#second').show();
} else if (res.data.is_addon == '0') {
$('#first').hide();
$('#second').hide();
$('#base_policy_id').hide(); $('#base_policy_id').hide();
$('#base_policy').prop('required', false);
} else if (res.data.is_addon == '1') {
$('#first').show();
$('#second').show();
$('#base_policy_id').hide();
$('#base_policy').prop('required', false);
} }
/** do not delete this comment condition
// if(res.data.policy_type_id == 1){
// appendPolicyFormFields(1, res.data);
// }else if(res.data.policy_type_id >= 2) {
// appendPolicyFormFields(2, res.data);
// }
do not delete this comment condition **/
var policeOptionHTML = ''; var policeOptionHTML = '';
$.each(res.policy, function(index, item) { $.each(res.policy, function(index, item) {
// console.log(item)
policeOptionHTML += '<option data-id="' + item.policy_type_id + policeOptionHTML += '<option data-id="' + item.policy_type_id +
'" value="' + item.id + '" ' + (res.data.policy_id === item.id ? '" value="' + item.id + '" ' + (res.data.policy_id === item.id ?
'selected="selected"' : '') + '>' + item.name + '</option>'; 'selected="selected"' : '') + '>' + item.name + '</option>';
@ -522,13 +540,16 @@ $('body').on('click', '.btnPolicyEdit', function() {
var OptionsHTML = ''; var OptionsHTML = '';
OptionsHTML += '<option value="" selected>Select Base Policy</option>'; OptionsHTML += '<option value="" selected>Select Base Policy</option>';
$.each(res.client_policy_list, function(index, item) { $.each(res.client_policy_list, function(index, item) {
if (res.data.policy_id !== item.id) {
OptionsHTML += '<option data-id="' + item.policy_type_id + OptionsHTML += '<option data-id="' + item.policy_type_id +
'" value="' + item.id + '" ' + (res.data.base_policy === item.id ? '" value="' + item.id + '" ' + (res.data.base_policy === item.id ?
'selected="selected"' : '') + '>' + item.name + '</option>'; 'selected="selected"' : '') + '>' + item.name + '</option>';
}
}); });
$('#base_policy').html(OptionsHTML); $('#base_policy').html(OptionsHTML);
setTimeout(function() {
$('#policy').val(res.data.policy_id).change();
}, 3000);
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(xhr.responseText); console.error(xhr.responseText);
@ -542,6 +563,7 @@ $('body').on('click', '.btnPolicyEdit', function() {
}); });
}); });
$('body').on('click', '.btnOpenEnroll', function() { $('body').on('click', '.btnOpenEnroll', function() {
var client_policy_id = $(this).attr('data-id'); var client_policy_id = $(this).attr('data-id');
@ -959,19 +981,41 @@ function removeClientPolicy(element) {
} }
$('#is_addon').change(function() { $('#policy_type').change(function() {
$('#insurer').val('').change();
$('#tpa').val('').change();
$('#start_date').val('');
$('#end_date').val('');
$('#base_policy').val('0');
if ($(this).val() != '1' && $(this).val() != '0') {
if ($(this).is(':checked')) {
$('#base_policy_id').show(); $('#base_policy_id').show();
$('#base_policy').prop('required', true); $('#base_policy').prop('required', true);
}else{ $('#first').show();
$('#second').show();
} else if ($(this).val() == '0'){
$('#first').hide();
$('#second').hide();
$('#base_policy_id').hide();
$('#base_policy').prop('required', false);
} else if ($(this).val() == '1'){
$('#first').show();
$('#second').show();
$('#base_policy_id').hide(); $('#base_policy_id').hide();
$('#base_policy').prop('required', false); $('#base_policy').prop('required', false);
} }
}) })
function fetchClientPolicyList(){ function fetchClientPolicyList() {
var client_id = $('#client_id_policy').val() var client_id = $('#client_id_policy').val()
@ -980,7 +1024,8 @@ function fetchClientPolicyList(){
type: "GET", type: "GET",
dataType: 'json', dataType: 'json',
success: function(res) { success: function(res) {
console.log(res)
console.log('one',res)
setTimeout(function() { setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
@ -1012,4 +1057,75 @@ function fetchClientPolicyList(){
} }
$(document).ready(function(){
$('#base_policy').change(function() {
var client_policy_id = $(this).val()
var policy_type = $('#policy_type').val()
console.log(client_policy_id);
var queryParams = {
client_policy_id: client_policy_id,
policy_type: policy_type,
};
const queryString = objectToQueryString(queryParams);
// var uri = '<?= base_url('util/fetch-policy-for-policy-type')?>?' + queryString
var uri = '<?= base_url('client/policy/list/')?>' + client_policy_id
console.log('uri', uri)
console.log('queryString', queryString)
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
$.ajax({
url: uri,
type: "GET",
dataType: 'json',
processData: false,
contentType: false,
success: function(res) {
console.log(res)
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 500);
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id).change();
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id).change();
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date)).change();
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date)).change();
var policeOptionHTML = '';
$.each(res.policy, function(index, item) {
console.log(item)
policeOptionHTML += '<option data-id="' + item.policy_type_id +
'" value="' + item.id + '" ' + (res.data.policy_id === item.id ?
'selected="selected"' : '') + '>' + item.name + '</option>';
});
$('#policy').html(policeOptionHTML);
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 500);
}
});
});
})
function objectToQueryString(obj) {
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
}
</script> </script>

View File

@ -0,0 +1,151 @@
<style>
.badge2 {
box-shadow: none;
}
.badge2-secondary2 {
color: #fff;
background-color: #187607;
}
.badge2 {
display: inline-block;
padding: .25em .4em;
font-size: 75%;
font-weight: 700;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25rem;
transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
</style>
<div class="row" id="client_list">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Employees</h4>
</div>
</div>
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
id="tickets-table">
<thead class="bg-light">
<tr>
<th class="font-weight-medium">SNO</th>
<!-- <th class="font-weight-medium">Employee code</th> -->
<th class="font-weight-medium">Name/code</th>
<th class="font-weight-medium">Policy name</th>
<th class="font-weight-medium">Insurer name</th>
<th class="font-weight-medium">TPA ID</th>
<th class="font-weight-medium">UHID ID</th>
<th class="font-weight-medium">Policy status</th>
<th class="font-weight-medium">Sum Insured</th>
<th class="font-weight-medium">Premium</th>
<th class="font-weight-medium">Action</th>
</tr>
</thead>
<tbody class="font-12">
<?php
if(isset($employees))
{
foreach ($employees as $key => $employee) { ?>
<tr>
<td><b><?php echo ($key + 1)?></b></td>
<!-- <td><?php echo $employee['emp_code']?></td> -->
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> )</td>
<td><?php echo $employee['policy_name']?></td>
<td><?php echo $employee['insurer_short_name']?></td>
<td><?php echo $employee['tpa_id']?></td>
<td><?php echo $employee['uhid']?></td>
<td>
<?php
if ($employee['status'] == 'draft') {
echo '<span class="badge badge-secondary">' . $employee['status'] . '</span>';
} elseif ($employee['status'] == 'active') {
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
} elseif ($employee['status'] == 'inactive') {
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
}elseif ($employee['status'] == 'expired') {
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
}elseif ($employee['status'] == 'enrolled') {
echo '<span class="badge2 badge2-secondary2">' . $employee['status'] . '</span>';
}else{
echo $employee['status'];
}
?>
</td>
<td> <?php echo $employee['basic_cover_si']?> </td>
<td><?php echo $employee['premium']?></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" href="#"><i
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
Ticket</a>
<a class="dropdown-item" href="#"><i
class="mdi mdi-check-all mr-2 text-muted font-18 vertical-middle"></i>Close</a>
<a class="dropdown-item" href="#"><i
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Remove</a>
<a class="dropdown-item" href="#"><i
class="mdi mdi-star mr-2 font-18 text-muted vertical-middle"></i>Mark as
Unread</a>
</div>
</div>
</td>
</tr>
<?php }}?>
</tbody>
</table>
</div>
</div>
</div><!-- end col -->
</div>
<script>
$(document).ready(function(){
$('#tickets-table').DataTable({
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
"buttons": [{
"extend": 'csv',
"text": 'CSV',
"title": 'Employee-List',
"className": 'my_class',
"exportOptions": {
"columns": ':not(:last-child)'
},
}],
"initComplete": function(settings, json) {
$('.my_class').css({
"position": "relative",
"left": "82px"
});
},
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true ,
// pagingType: 'full_numbers'
});
});
</script>

View File

@ -10,7 +10,7 @@ table.dataTable tbody td {
</style> </style>
<div class="row"> <div class="row">
<div class="col-xl-6"> <div class="col-xl-12">
<div id="accordion" class="mb-3"> <div id="accordion" class="mb-3">
<div class="card mb-1"> <div class="card mb-1">
<h5 class="m-1"> <h5 class="m-1">
@ -68,93 +68,24 @@ table.dataTable tbody td {
<div class="row" id="client_list"> <?php include('employee_data_list.php');?>
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Employees</h4>
</div>
</div>
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
id="tickets-table">
<thead class="bg-light">
<tr>
<th class="font-weight-medium">SNO</th>
<!-- <th class="font-weight-medium">Employee code</th> -->
<th class="font-weight-medium">Name/code</th>
<th class="font-weight-medium">Policy name</th>
<th class="font-weight-medium">Insurer name</th>
<th class="font-weight-medium">TPA ID</th>
<th class="font-weight-medium">UHID ID</th>
<th class="font-weight-medium">Policy status</th>
<th class="font-weight-medium">Premium</th>
<th class="font-weight-medium">Action</th>
</tr>
</thead>
<tbody class="font-12">
<?php
if(isset($employees))
{
foreach ($employees as $key => $employee) { ?>
<tr>
<td><b><?php echo ($key + 1)?></b></td>
<!-- <td><?php echo $employee['emp_code']?></td> -->
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> )</td>
<td><?php echo $employee['policy_name']?></td>
<td><?php echo $employee['insurer_short_name']?></td>
<td><?php echo $employee['tpa_id']?></td>
<td><?php echo $employee['uhid']?></td>
<td>
<?php
if ($employee['status'] == 'draft') {
echo '<span class="badge badge-secondary">' . $employee['status'] . '</span>';
} elseif ($employee['status'] == 'active') {
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
} elseif ($employee['status'] == 'inactive') {
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
}elseif ($employee['status'] == 'expired') {
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
}
?>
</td>
<td><?php echo $employee['premium']?></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" href="#"><i
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
Ticket</a>
<a class="dropdown-item" href="#"><i
class="mdi mdi-check-all mr-2 text-muted font-18 vertical-middle"></i>Close</a>
<a class="dropdown-item" href="#"><i
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Remove</a>
<a class="dropdown-item" href="#"><i
class="mdi mdi-star mr-2 font-18 text-muted vertical-middle"></i>Mark as
Unread</a>
</div>
</div>
</td>
</tr>
<?php }}?>
</tbody>
</table>
</div>
</div>
</div><!-- end col -->
</div>
<!-- end row --> <!-- end row -->
<div id="loader" class="loader" style="display:none;">SPINNER</div> <div id="loader" class="loader" style="display:none;">SPINNER</div>
<script> <script>
$(document).ready(function() {
// Initialize select2
$("#clients").select2();
$("#policies").select2();
// if ($('.select2-selection__arrow').length > 0) {
// $('.select2-selection__arrow').removeClass('select2-selection__arrow').addClass('fa fa-chevron-down');
// }
});
// Declare a global variable to store API response data // Declare a global variable to store API response data
var clientPolicies = []; var clientPolicies = [];
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>'; var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
@ -261,10 +192,10 @@ function appendPolicies(data) {
}); });
} }
$(document).ready(function() {
$('#clients').on('change', function() { $('#clients').on('change', function() {
var selectedClient = $(this).val(); var selectedClient = $(this).val();
console.log(selectedClient); console.log('selectedClient', selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption); // $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData // Check if the selected option exists in apiData
@ -273,6 +204,7 @@ $('#clients').on('change', function() {
}); });
console.log(foundPolicies.policies); console.log(foundPolicies.policies);
appendPolicies(foundPolicies.policies); appendPolicies(foundPolicies.policies);
});
}); });
@ -332,4 +264,6 @@ document.getElementById('toggleIcon').addEventListener('click', function() {
icon.classList.toggle('mdi-chevron-up'); icon.classList.toggle('mdi-chevron-up');
}); });
</script> </script>

View File

@ -1,14 +1,7 @@
<?php //echo fancy_date_time_format('2024-01-01 15:40:32');echo '<br>';?>
<?php //echo fancy_date_time_format('2024-02-01 15:40:32');echo '<br>';?>
<!-- <?php echo fancy_date_time_format('2024-02-10 15:40:32');echo '<br>';?> -->
<!-- <?php echo fancy_date_time_format('2024-02-13 14:40:32');echo '<br>';?> -->
<!-- <?php echo fancy_date_time_format('2024-02-13 14:58:00');echo '<br>';?> -->
<div class="tab-pane fade active show" id="general-q-tab"> <div class="tab-pane fade active show" id="general-q-tab">
<div class="row"> <div class="row">
<div class="col-xl-6"> <div class="col-xl-12">
<div id="accordion1" class="mb-3"> <div id="accordion1" class="mb-3">
<div class="card mb-1"> <div class="card mb-1">
<h5 class="m-1"> <h5 class="m-1">
@ -20,7 +13,8 @@
<div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion1"> <div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion1">
<div class="card-body"> <div class="card-body">
<!-- <div class="text-center"> --> <!-- <div class="text-center"> -->
<form id="emp-upload-form" action="<?php echo base_url().'employee/upload'?>" method="post"> <form class="parsley-examples" id="emp-upload-form"
action="<?php echo base_url().'employee/upload'?>" method="post">
<input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>" <input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>"
id="csrf_token"> id="csrf_token">
@ -31,14 +25,14 @@
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label>Client</label> <br /> <label>Client</label> <br />
<select name="client_id" class="form-control" id="client_id" required> <select name="client_id" class="form-control" id="client_id" required>
<option value="">Select</option> <option value="0">Select</option>
</select> </select>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label>Policy</label> <br /> <label>Policy</label> <br />
<select name="policy_id" class="form-control" id="policy_id"> <select name="policy_id" class="form-control" id="policy_id">
<option value="">Select</option> <option value="0">Select</option>
</select> </select>
</div> </div>
@ -85,6 +79,17 @@
</div> </div>
<div class="form-group col-md-2"
style="margin-top: 26px;position: relative;left: 65px;"> OR </div>
<div class="form-group col-md-4" style="margin-top: 18px;">
<a class="btn btn-primary waves-effect waves-light justify-content-end"
id="fetch_enrolled_data" data-toggle="modal"
data-target="#full-width-modal" title="Download Sample Excel">Featch
Enrolled Data</a>
</div>
</div> </div>
</div> </div>
@ -107,6 +112,25 @@
</div> </div>
<div id="full-width-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="fullWidthModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-full-width">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="fullWidthModalLabel">Enrolled Employee List</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body" id="emp_data">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Center modal content --> <!-- Center modal content -->
<div class="modal fade" id="file-err-modal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal fade" id="file-err-modal" tabindex="-1" role="dialog" aria-hidden="true">
@ -127,6 +151,12 @@
<script> <script>
$('#file_upload').hide(); $('#file_upload').hide();
$(document).ready(function() {
// Initialize select2
$("#client_id").select2();
$("#policy_id").select2();
});
// Declare a global variable to store API response data // Declare a global variable to store API response data
var clientPolicies = []; var clientPolicies = [];
@ -153,6 +183,13 @@ $(document).ready(function() {
event.preventDefault(); // Prevent default form submission event.preventDefault(); // Prevent default form submission
console.log('submit called'); console.log('submit called');
var isValid = $('#emp-upload-form').parsley().validate();
if (!isValid) {
console.log('Form is Empty', 'Warning');
return;
}
var action_item = $('#upload-action-type').val(); var action_item = $('#upload-action-type').val();
var policy_id = $('#policy_id').val(); var policy_id = $('#policy_id').val();
console.log('action_item - ' + action_item); console.log('action_item - ' + action_item);
@ -161,8 +198,10 @@ $(document).ready(function() {
// $('#policy_id').prop('title', 'plz choose policy'); // $('#policy_id').prop('title', 'plz choose policy');
// $('#policy_id').mouseover(); // $('#policy_id').mouseover();
console.log('required'); console.log('required');
alert('please choose policy for this uploaing event '); // alert('please choose policy for this uploaing event ');
toastr.warning('please choose policy for this uploaing event', 'warning')
return false; return false;
} else { } else {
$('#policy_id').attr('required', false); $('#policy_id').attr('required', false);
@ -230,9 +269,6 @@ $(document).ready(function() {
$(window).on("load", function() { $(window).on("load", function() {
console.log("window loaded"); console.log("window loaded");
fetchClientPolicies(); fetchClientPolicies();
}); });
@ -289,8 +325,7 @@ function fetchFileError(file_id) {
success: function(response) { success: function(response) {
$(this).find(".modal-body").html(""); $(this).find(".modal-body").html("");
if (response.code === 200 && response.dataStatus === true && response.data !== "") if (response.code === 200 && response.dataStatus === true && response.data !== "") {
{
try { try {
console.log((JSON.parse(response.data))); console.log((JSON.parse(response.data)));
var file_error_data = (JSON.parse(response.data)); var file_error_data = (JSON.parse(response.data));
@ -302,16 +337,24 @@ function fetchFileError(file_id) {
var err_count = file_error_data['error_summary'][key]; var err_count = file_error_data['error_summary'][key];
switch (err_id) { switch (err_id) {
case 1: case 1:
file_error_html += "<strong>Mandatory values missing</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>"; file_error_html +=
"<strong>Mandatory values missing</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span>";
break; break;
case 2: case 2:
file_error_html += "<strong>Values not in expected format</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>"; file_error_html +=
"<strong>Values not in expected format</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span>";
break; break;
case 3: case 3:
file_error_html += "<strong>Field contains not allowed values</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>"; file_error_html +=
"<strong>Field contains not allowed values</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span>";
break; break;
case 4: case 4:
file_error_html += "<strong>Rule Conflict</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>"; file_error_html +=
"<strong>Rule Conflict</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span>";
break; break;
case 5: case 5:
file_error_html += "<strong>" + file_error_data['error_data'] + "</strong>"; file_error_html += "<strong>" + file_error_data['error_data'] + "</strong>";
@ -320,28 +363,37 @@ function fetchFileError(file_id) {
file_error_html += "<strong>" + file_error_data['error_data'] + "</strong>"; file_error_html += "<strong>" + file_error_data['error_data'] + "</strong>";
break; break;
case 7: case 7:
file_error_html += "<strong>Duplicate entry in file</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>"; file_error_html +=
"<strong>Duplicate entry in file</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span>";
break; break;
case 8: case 8:
file_error_html += "to be config"; file_error_html += "to be config";
break; break;
case 9: case 9:
file_error_html += "<strong>Duplicate entry</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>"; file_error_html +=
"<strong>Duplicate entry</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span>";
break; break;
case 10: case 10:
file_error_html += "<strong>Record Not Found</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>"; file_error_html +=
"<strong>Duplicate entry in file</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span>";
break; break;
case 11: case 11:
file_error_html += "<strong>Rule conflict: Dependents not allowed</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>"; file_error_html +=
"<strong>Rule conflict: Dependents not allowed</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span>";
break; break;
case 12: case 12:
file_error_html += "<strong>Rule conflict: Dependent count greater than allowed dependent count</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>"; file_error_html +=
"<strong>Rule conflict: Dependent count greater than allowed dependent count</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span>";
break; break;
case 13: case 13:
file_error_html += "<strong>Rule conflict: Twofold relationship found within family</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>"; file_error_html +=
break; "<strong>Rule conflict: Twofold relationship found within family</strong> <span class='badge badge-danger float-right'>" +
case 14: err_count + "</span>";
file_error_html += "<strong>Self Not found</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
break; break;
default: default:
@ -422,7 +474,9 @@ function appendPolicies(data) {
}); });
} }
$('#client_id').on('change', function() { $(document).ready(function() {
$('#client_id').on('change', function() {
var selectedClient = $(this).val(); var selectedClient = $(this).val();
console.log(selectedClient); console.log(selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption); // $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
@ -433,6 +487,8 @@ $('#client_id').on('change', function() {
}); });
console.log(foundPolicies.policies); console.log(foundPolicies.policies);
appendPolicies(foundPolicies.policies); appendPolicies(foundPolicies.policies);
});
}); });
// Function to convert object to query parameters // Function to convert object to query parameters
@ -447,7 +503,7 @@ function fetchEmpolyeeList(event) {
var policy_id = $('#policy_id').val(); var policy_id = $('#policy_id').val();
console.log(client_id + '-' + policy_id); console.log(client_id + '-' + policy_id);
if (client_id == '0' || policy_id == '0') { if (client_id == '0' || policy_id == '0') {
alert('Please select values in both dropdowns.'); toastr.warning('Please select values in both dropdowns.');
return; return;
} }
@ -516,5 +572,70 @@ document.getElementById('toggleIcon1').addEventListener('click', function() {
icon.classList.toggle('mdi-chevron-down'); icon.classList.toggle('mdi-chevron-down');
icon.classList.toggle('mdi-chevron-up'); icon.classList.toggle('mdi-chevron-up');
}); });
$('#fetch_enrolled_data').click(function() {
$('#emp_data').empty();
var client_id = $('#client_id').val();
var policy_id = $('#policy_id').val();
var action = $('#upload-action-type').val();
console.log(client_id + '-' + policy_id);
if (client_id == '0' || policy_id == '0') {
toastr.warning('please select the client and policy for this uploaing event', 'warning')
$('#full-width-modal').modal('hide');
return;
}
var queryParams = {
client_id: client_id,
policy_id: policy_id,
action: action
};
console.log('queryParams', queryParams)
const queryString = objectToQueryString(queryParams);
console.log('queryString', queryString)
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var uri = '<?= base_url('util/featch-emp-list')?>?' + queryString
console.log(uri)
$.ajax({
url: uri,
data: {
client_id: client_id,
policy_id: policy_id
},
type: "GET",
dataType: 'json',
processData: false,
contentType: false,
success: function(res) {
console.log(res);
if (res) {
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
}
$('#emp_data').html(res.data);
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something went wrong', 'Warning');
}, 1000);
}
});
})
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
</script> </script>

View File

@ -7,10 +7,16 @@
table.dataTable tbody td { table.dataTable tbody td {
padding: 4px 4px !important; padding: 4px 4px !important;
} }
.btn .btn-secondary .buttons-csv .buttons-html5 .my_class{
position: relative;
left: 79px;
}
</style> </style>
<div class="row"> <div class="row">
<div class="col-xl-6"> <div class="col-xl-12">
<div id="accordion" class="mb-3"> <div id="accordion" class="mb-3">
<div class="card mb-1"> <div class="card mb-1">
<h5 class="m-1"> <h5 class="m-1">
@ -173,6 +179,13 @@ table.dataTable tbody td {
<script> <script>
$(document).ready(function() {
// Initialize select2
$("#clients").select2();
$("#policies").select2();
});
// Declare a global variable to store API response data // Declare a global variable to store API response data
var clientPolicies = []; var clientPolicies = [];
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>'; var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
@ -274,7 +287,9 @@ function appendPolicies(data) {
}); });
} }
$('#clients').on('change', function() { $(document).ready(function() {
$('#clients').on('change', function() {
var selectedClient = $(this).val(); var selectedClient = $(this).val();
console.log(selectedClient); console.log(selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption); // $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
@ -285,6 +300,8 @@ $('#clients').on('change', function() {
}); });
console.log(foundPolicies.policies); console.log(foundPolicies.policies);
appendPolicies(foundPolicies.policies); appendPolicies(foundPolicies.policies);
});
}); });
// Function to convert object to query parameters // Function to convert object to query parameters
@ -478,4 +495,35 @@ $('.close').click(function(){
$('#table_data').empty(); $('#table_data').empty();
}) })
$(document).ready(function(){
$('#tickets-table').DataTable({
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
"buttons": [{
"extend": 'csv',
"text": 'CSV',
"title": 'Endorsement-List',
"className": 'my_class',
"exportOptions": {
"columns": ':not(:last-child)'
},
}],
"initComplete": function(settings, json) {
$('.my_class').css({
"position": "relative",
"left": "79px"
});
},
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true ,
// pagingType: 'full_numbers'
});
});
</script> </script>

View File

@ -1,3 +1,5 @@
<link rel="shortcut icon" href="<?= base_url()."public"; ?>/assets/images/Nhance_Favi.svg">
<title>Excel Error Report</title>
<!-- Include DataTables CSS --> <!-- Include DataTables CSS -->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css"> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css">
<!-- Include DataTables Buttons CSS --> <!-- Include DataTables Buttons CSS -->

View File

@ -1,3 +1,14 @@
<style>
.modal-full-width {
width: 95% !important;
max-width: none;
}
.reload:hover {
cursor: pointer;
}
</style>
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
@ -7,16 +18,18 @@
</div> </div>
</div> </div>
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table"> <table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
id="tickets-table">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th class="font-weight-medium">SNO</th> <th class="font-weight-medium">SNO</th>
<th class="font-weight-medium">File name</th> <th class="font-weight-medium">File name</th>
<th class="font-weight-medium">Client</th> <th class="font-weight-medium">Client</th>
<th class="font-weight-medium">policy</th> <th class="font-weight-medium">Policy</th>
<th class="font-weight-medium">Event</th> <th class="font-weight-medium">Event</th>
<th class="font-weight-medium">User/Time</th> <th class="font-weight-medium">User/Time</th>
<th class="font-weight-medium">Status</th> <th class="font-weight-medium">Status</th>
<th class="font-weight-medium">Action</th>
</tr> </tr>
</thead> </thead>
@ -36,11 +49,47 @@
<td><?php echo $file['short_name']?></td> <td><?php echo $file['short_name']?></td>
<td><?php echo $file['policy_name']?></td> <td><?php echo $file['policy_name']?></td>
<td><?php echo $file['action']?></td> <td><?php echo $file['action']?></td>
<td><?php echo fancy_date_time_format($file['created_at']).' by <strong>'.$file['first_name'].'</strong>'?></td> <td><?php echo fancy_date_time_format($file['created_at']).' by <strong>'.$file['first_name'].'</strong>'?>
<td><?php echo $file['status']; if($file['status'] == 'failed') </td>
<td>
<?php
if($file['status'] == 'failed')
{ {
echo "<span class='col-xl-3 col-lg-4 col-sm-6'> <i class='fe-alert-circle' data-toggle='modal' data-target='#file-err-modal' data-err=".$file['id']."></i></span>"; echo $file['status'] . " <span class='col-xl-3 col-lg-4 col-sm-6'> <i class='fe-alert-circle' data-toggle='modal' data-target='#file-err-modal' data-err=".$file['id']."></i></span>";
}?></td>
}else if( $file['status'] == 'inprogress'){
echo '<a data-toggle="tooltip" data-placement="top" data-id="' . $file['status'] . '" class="reload" title="Click to reload" href="#">' . $file['status'] . '</a>';
}else{
echo $file['status'];
}
?>
</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">
<?php if($file['status'] == 'failed') { ?>
<a data-id="<?= htmlspecialchars(json_encode($file)) ?>" data-toggle="modal"
data-target="#file-upload-modal" class="dropdown-item upload_button" href="#"><i
class="mdi mdi-upload mr-2 text-muted font-18 vertical-middle"></i>Re-Upload</a>
<?php } ?>
<a class="dropdown-item"
href="<?= base_url("util/download-file-list/").$file['id']; ?>"><i
class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download</a>
<a data-id="<?php echo $file['id']?>" data-toggle="modal"
data-target="#full-width-modal-emp-list" class="dropdown-item view_emp_list"
href="#"><i
class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View</a>
</div>
</div>
</td>
</tr> </tr>
<?php }}?> <?php }}?>
@ -48,4 +97,233 @@
</table> </table>
</div> </div>
</div> </div>
</div><!-- end col --> </div><!-- end col -->
<div id="full-width-modal-emp-list" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="fullWidthModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-full-width">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="fullWidthModalLabel">Upload Employee List <span id="title_header_name"></span></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body" id="emp_data_success">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Center modal content for reupload file-->
<div class="modal fade" id="file-upload-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myCenterModalLabel">Reupload the file</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<form class="parsley-examples" id="uploadForm" action="<?php echo base_url().'employee/upload'?>"
enctype="multipart/form-data">
<input type="hidden" id="file_client_id" name="client_id">
<input type="hidden" id="file_policy_id" name="policy_id">
<input type="hidden" id="file_upload_actions" name="upload-action-type">
<input type="file" id="fileInput" name="emplist" required
accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet">
<button type="submit" class="btn btn-primary">Upload</button>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
$('body').on('click', '.view_emp_list', function() {
console.log('file_id');
$('#emp_data_success').empty();
$('#title').html(' ');
var file_id = $(this).attr('data-id');
console.log(file_id);
var queryParams = {
file_id: file_id,
};
console.log('queryParams', queryParams)
const queryString = objectToQueryString(queryParams);
console.log('queryString', queryString)
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var uri = '<?= base_url('util/view-success-emp-list')?>?' + queryString
console.log(uri)
$.ajax({
url: uri,
data: {
file_id: file_id,
},
type: "GET",
dataType: 'json',
processData: false,
contentType: false,
success: function(res) {
console.log(res);
if (res) {
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
}
var title = " - ";
if (res.file_data) {
title += (res.file_data.file_name || "") + " - ";
title += (res.file_data.short_name || "") + " - ";
title += (res.file_data.policy_name || "") + " - ";
title += (res.file_data.action || "") + " - ";
title += (res.file_data.status || "");
}
$('#title_header_name').html(title);
$('#emp_data_success').html(res.data);
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something went wrong', 'Warning');
}, 1000);
}
});
})
$('body').on('click', '.upload_button', function() {
$('#uploadForm')[0].reset();
console.log('file_id');
var fileId = JSON.parse(this.getAttribute('data-id'));
console.log(fileId); // Use fileId as needed
$('#file_client_id').val(fileId.client_id)
$('#file_policy_id').val(fileId.client_policy_id)
$('#file_upload_actions').val(fileId.action)
})
$('#uploadForm').submit(function() {
var isValid = $('#uploadForm').parsley().validate();
if (!isValid) {
console.log('Form is Empty', 'Warning');
return;
}
// Create FormData object
var formData = new FormData($(this)[0]);
for (var pair of formData.entries()) {
console.log(pair[0] + ', ' + pair[1]);
}
// return false;
$.ajax({
url: $(this).attr("action"),
type: "POST",
data: formData,
processData: false, // Prevent jQuery from automatically processing the data
contentType: false, // Let jQuery handle the content type
headers: {
// "Content-Type":"multipart/form-data",
"X-Requested-With": "XMLHttpRequest"
},
success: function(response) {
console.log(response);
$('#uploadForm')[0].reset();
if (response.code === 200 && response.dataStatus === true && response
.data !== "") {
toastr.success(
'File upload successs, Data validation is in-progress',
'success');
window.location.reload(true);
} else if (response.code === 404 && response.dataStatus === false) {
console.error('no data found', response);
// alert(response.message);
toastr.error(response.message, 'Failed');
window.location.reload(true);
} else {
console.error('Something went wrong!');
// alert('Something went wrong! Try later');
toastr.error('Something went wrong! Try later', 'Error');
window.location.reload(true);
}
},
error: function(xhr, status, error) {
// Request failed, handle error
console.error("Request failed:", status, error);
toastr.error('Something went wrong! Try later', 'Error');
$('#uploadForm')[0].reset();
window.location.reload(true);
}
});
})
$('body').on('click', '.reload', function() {
console.log('status');
status = this.getAttribute('data-id')
console.log(status);
if (status == 'inprogress') {
window.location.reload(true);
}
})
$(document).ready(function(){
$('#tickets-table').DataTable({
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
"buttons": [{
"extend": 'csv',
"text": 'CSV',
"title": 'Employee-Upload-List',
"className": 'my_class',
"exportOptions": {
"columns": ':not(:last-child)'
},
}],
"initComplete": function(settings, json) {
$('.my_class').css({
"position": "relative",
"left": "79px"
});
},
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true ,
});
});
</script>

View File

@ -1,7 +1,7 @@
<div class="tab-pane fade" id="KYC-DOC-tab"> <div class="tab-pane fade" id="KYC-DOC-tab">
<div class="row"> <div class="row">
<div class="col-xl-6"> <div class="col-xl-12">
<div id="accordion" class="mb-3"> <div id="accordion" class="mb-3">
<div class="card mb-1"> <div class="card mb-1">
<h5 class="m-1"> <h5 class="m-1">
@ -20,21 +20,21 @@
<div class="form-group"> <div class="form-group">
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label>Client</label> <br /> <label>Client<span class="text-danger">*</span></label> <br />
<select name="client_id" class="form-control" id="client" required> <select name="client_id" class="form-control" id="client" required>
<option value="">Select</option> <option value="">Select</option>
</select> </select>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label>Policy</label> <br /> <label>Policy<span class="text-danger">*</span></label> <br />
<select name="client_policy_id" class="form-control" id="policy" required> <select name="client_policy_id" class="form-control" id="policy" required>
<option value="">Select</option> <option value="">Select</option>
</select> </select>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label>Insurer/TPA Data</label> <br /> <label>Insurer/TPA Data<span class="text-danger">*</span></label> <br />
<select name="insurer_or_tpa" class="form-control" id="insurer_or_tpa" <select name="insurer_or_tpa" class="form-control" id="insurer_or_tpa"
required> required>
<option value="">Select</option> <option value="">Select</option>
@ -54,7 +54,7 @@
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label>Action</label> <br /> <label>Action<span class="text-danger">*</span></label> <br />
<select name="action_type" class="form-control" id="action_type" required> <select name="action_type" class="form-control" id="action_type" required>
<option value="">Select</option> <option value="">Select</option>
<?php <?php
@ -70,7 +70,7 @@
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label>Event</label> <br /> <label>Event<span class="text-danger">*</span></label> <br />
<select name="event_type" class="form-control" id="upload-action-type" <select name="event_type" class="form-control" id="upload-action-type"
required> required>
<option value="">Select</option> <option value="">Select</option>
@ -134,6 +134,14 @@
<script> <script>
$(document).ready(function() {
// Initialize select2
$("#client").select2();
$("#policy").select2();
});
// Declare a global variable to store API response data // Declare a global variable to store API response data
var clientPolicies = []; var clientPolicies = [];
@ -288,6 +296,8 @@ function appendPolicies2(data) {
}); });
} }
$(document).ready(function() {
$('#client').on('change', function() { $('#client').on('change', function() {
var selectedClient = $(this).val(); var selectedClient = $(this).val();
console.log(selectedClient); console.log(selectedClient);
@ -301,6 +311,8 @@ $('#client').on('change', function() {
appendPolicies2(foundPolicies.policies); appendPolicies2(foundPolicies.policies);
}); });
});
// Function to convert object to query parameters // Function to convert object to query parameters
function objectToQueryString2(obj) { function objectToQueryString2(obj) {
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&'); return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');

View File

@ -496,6 +496,8 @@
<!-- Jodit Js --> <!-- Jodit Js -->
<script src="<?= base_url()."public"; ?>/assets/js/jodit.min.js"></script> <script src="<?= base_url()."public"; ?>/assets/js/jodit.min.js"></script>
<!-- select2 -->
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>

View File

@ -50,6 +50,9 @@
<!-- Sweet Alert CDN --> <!-- Sweet Alert CDN -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.10.4/dist/sweetalert2.all.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.10.4/dist/sweetalert2.all.min.js"></script>
<!-- select2 -->
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" type="text/css">
<link rel="manifest" href="../manifest.json"> <link rel="manifest" href="../manifest.json">
@ -215,12 +218,26 @@
</style> </style>
<style>
.select2-container--default .select2-selection--single {
height: 37px !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 35px !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
top: 7px !important;
}
</style>
<script> <script>
$(window).on('load', function() { $(window).on('load', function() {
setTimeout(function() { setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').fadeOut('slow');
}, 1000); }, 2000);
}); });
</script> </script>
@ -233,11 +250,11 @@
<!-- Preloader --> <!-- Preloader -->
<div class="loader-mask"> <div class="loader-mask">
<div class="loader"> <div class="loader">
<div></div> <img src="<?= base_url()."public" ?>/assets/images/nhance-loader-fast.gif" height="40" width="40" alt="Loading...">
<div></div>
</div> </div>
</div> </div>
<!-- <img src="<?= base_url()."public" ?>/assets/images/nhance-loader-fast.gif" height="40" width="40" alt="Loading..."> -->
<!-- Begin page --> <!-- Begin page -->
<div id="wrapper"> <div id="wrapper">
@ -515,7 +532,7 @@
<a href="<?= base_url('/dashboard/view')?>" class="logo logo-light text-center"> <a href="<?= base_url('/dashboard/view')?>" class="logo logo-light text-center">
<span class="logo-sm"> <span class="logo-sm">
<img src="<?= base_url()."public"; ?>/assets/images/Nhance_Favi_white.png" alt="" width="30" height="30"> <img src="<?= base_url()."public"; ?>/assets/images/Nhance_Favi_white_2.png" alt="" width="30" height="30">
</span> </span>
<!-- <span class="logo-lg"> <!-- <span class="logo-lg">
<img src="<?= base_url()."public"; ?>./assets/images/logo-light.png" alt="" height="20"> <img src="<?= base_url()."public"; ?>./assets/images/logo-light.png" alt="" height="20">

View File

@ -69,6 +69,11 @@
<script> <script>
$(document).ready(function() {
$("#insurer_id").select2();
});
$(document).ready(function () { $(document).ready(function () {
var policy_type_PrimaryKey = $('#policy_type_id').val(); var policy_type_PrimaryKey = $('#policy_type_id').val();
@ -288,7 +293,7 @@ $(document).ready(function () {
$('#branch_table').hide(); $('#branch_table').hide();
$('.btnBack').show(); $('.btnBack').show();
$('#btnBranchAdd').hide(); $('#btnBranchAdd').hide();
$('#insurer_id').val(res.policies.insurer_id); $('#insurer_id').val(res.policies.insurer_id).change();
$('#name').val(res.policies.name); $('#name').val(res.policies.name);
$('#policy_type_PrimaryKey').val(res.policies.id); $('#policy_type_PrimaryKey').val(res.policies.id);

View File

@ -495,19 +495,16 @@
</div> </div>
</div> </div>
<!-- <hr> --> <!-- <hr> -->
<!-- <div class="form-row" id="grid_content_input"> <!-- <div class="form-row" id="grid_content_input">
</div> --> </div> -->
<br>
</div> </div>
<div class="form-group text-right m-b-0" style="margin-top: -49px;"> <div class="form-group text-right m-b-0" style="margin-top: -49px;" id="group_btn_1">
<a href="#" class="button-like" id="myButtonSpecialCondition" title="Special Condition">Special Condition</a> <a href="#" class="button-like" id="myButtonSpecialCondition" title="Special Condition">Special Condition</a>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGridSubmit" style="margin-top: 100px;">Submit</button> <button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGridSubmit1" style="margin-top: 100px;">Submit</button>
</div> </div>
</form> </form>
</div> </div>
@ -660,7 +657,7 @@ var grid_html = '';
data: {client_policy_id: client_policy_id}, data: {client_policy_id: client_policy_id},
success: function(response) { success: function(response) {
console.log('response',response); console.log('response',response);
console.log('count', response.count);
setTimeout(function() { setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
@ -668,16 +665,23 @@ var grid_html = '';
$('#nameOfThePolicyInGMC').html(' - ' + response.policy_name.name); $('#nameOfThePolicyInGMC').html(' - ' + response.policy_name.name);
$('gmc_emp_count').val(response.count); $('gmc_emp_count').val(response.count);
if(response.count){ console.log('count--1', response.count);
$('emp_count').val(response.count) $('emp_count').val(response.count)
if(response.count === false){ if (response && response.hasOwnProperty('count')) {
$("#btnGPATermsSubmit").prop("disabled", true); if (response.count === false) {
}else{ console.log('count -- 2', response.count);
$("#btnGPATermsSubmit").prop("disabled", false); console.log(document.getElementById('btnGridSubmit1'))
$("#btnGridSubmit1").hide();
$("#myButtonSpecialCondition").hide();
} else {
$("#btnGridSubmit1").show();
$("#myButtonSpecialCondition").show();
console.log('count -- ', response.count);
}
} else {
console.error('Response object does not have a "count" property or is invalid.');
} }
}
if (response) { if (response) {
let jsonObject = JSON.parse(response.data); let jsonObject = JSON.parse(response.data);

View File

@ -279,8 +279,7 @@
</div> </div>
</div> </div>
<br>
<div class="form-group text-right m-b-0" style="margin-top: -49px;"> <div class="form-group text-right m-b-0" style="margin-top: -49px;">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGPATermsSubmit" style="margin-top: 100px;">Submit</button> <button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGPATermsSubmit" style="margin-top: 100px;">Submit</button>
</div> </div>
@ -464,22 +463,21 @@
success: function(res) { success: function(res) {
console.log(res); console.log(res);
console.log('count', res.count);
setTimeout(function() { setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}, 1000); }, 1000);
$('#nameOfThePolicyInGPA').html(' - ' + res.policy_name.name); $('#nameOfThePolicyInGPA').html(' - ' + res.policy_name.name);
if(res.count){
$('#emp_count').val(res.count) $('#emp_count').val(res.count)
if(res.count === false){ if(res.count === false){
$("#btnGPATermsSubmit").prop("disabled", true); $("#btnGPATermsSubmit").hide();
}else{ }else{
$("#btnGPATermsSubmit").prop("disabled", false); $("#btnGPATermsSubmit").show();
} }
}
if (res) { if (res) {

View File

@ -1,5 +1,6 @@
<!-- Modal content for the Large example --> <!-- Modal content for the Large example -->
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" aria-modal="true" data-backdrop="static"> <div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true" aria-modal="true" data-backdrop="static">
<div class="modal-dialog modal-full-width"> <div class="modal-dialog modal-full-width">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -11,18 +12,31 @@
<div class="text-center" id="no_data"></div> <div class="text-center" id="no_data"></div>
<form role="form" class="parsley-examples" method="post" id="GridForm" enctype="multipart/form-data"> <form role="form" class="parsley-examples" method="post" id="GridForm" enctype="multipart/form-data">
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>"/> <input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<input type="hidden" name="client_id" id="Client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/> <input type="hidden" name="client_id" id="Client_id"
value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
<input type="hidden" name="client_policy_id" id="client_policy_id" /> <input type="hidden" name="client_policy_id" id="client_policy_id" />
<input type="hidden" id="grid_emp_count"/> <input type="hidden" id="grid_emp_count" />
<div class="form-group"> <div class="form-group">
<div class="form-row" id="rac_rate_dropdown"> <div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label for="emp_code">Policy Premium Type<span class="text-danger">*</span></label> <label for="emp_code">Policy Premium Type<span class="text-danger">*</span></label>
<select class="form-control" id="grid" name="policy_grid_id" onchange="addGridHTML(event)" required> <select class="form-control" id="grid" name="policy_grid_id"
onchange="addGridHTML(event)" required>
</select> </select>
</div> </div>
<div class="form-group col-md-4">
<label for="css"> Premium Calculation </label>
<input type="radio" id="individual" name="premium_type" value="2">
<label for="html" style="position: absolute;bottom: 2px;">Individual </label>&nbsp;
<input type="radio" id="single" name="premium_type" value="1"
style="margin-left: 85px;" checked>
<label for="css" style="position: absolute;left: 134px;bottom: 2px;"> Single Insurance
</label>
</div>
</div> </div>
<hr> <hr>
@ -33,7 +47,8 @@
</div> </div>
<div class="form-group text-right m-b-0"> <div class="form-group text-right m-b-0">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGridSubmit">Submit</button> <button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnGridSubmit_2">Submit</button>
</div> </div>
</form> </form>
</div> </div>
@ -43,31 +58,31 @@
<script> <script>
var policy_grid_id = $('#client_id').val(); var policy_grid_id = $('#client_id').val();
var grid_html = ''; var grid_html = '';
// $('#gmc_remove').hide(); // $('#gmc_remove').hide();
$('#btnGridSubmit').hide(); $('#btnGridSubmit').hide();
$('.close').click(function(){ $('.close').click(function() {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 11; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
} }
}); });
function addGridHTML(event = false, data = false, ui_type = false, si_or_bp=false){ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = false) {
$('#grid_content_input').empty(); $('#grid_content_input').empty();
var grid_container = document.getElementById('grid_content_input'); var grid_container = document.getElementById('grid_content_input');
var dataIdValue = '' var dataIdValue = ''
if(event === false){ if (event === false) {
var dataIdValue = ui_type var dataIdValue = ui_type
}else{ } else {
var selectElement = event.target; var selectElement = event.target;
var selectedOption = selectElement.options[selectElement.selectedIndex]; var selectedOption = selectElement.options[selectElement.selectedIndex];
dataIdValue = selectedOption.getAttribute('data-id'); dataIdValue = selectedOption.getAttribute('data-id');
@ -76,7 +91,7 @@
} }
if(dataIdValue == '1'){ if (dataIdValue == '1') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 11; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
} }
@ -148,7 +163,7 @@
</div> </div>
</div>`; </div>`;
} else if(dataIdValue == '2'){ } else if (dataIdValue == '2') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 11; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
} }
@ -168,7 +183,7 @@
</div> </div>
</div>`; </div>`;
} else if(dataIdValue == '3'){ } else if (dataIdValue == '3') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 11; i++) {
@ -193,7 +208,7 @@
</div> </div>
</div>`; </div>`;
} else if(dataIdValue == '4'){ } else if (dataIdValue == '4') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 11; i++) {
@ -227,7 +242,7 @@
</div> </div>
</div>`; </div>`;
} else if(dataIdValue == '5'){ } else if (dataIdValue == '5') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 11; i++) {
@ -260,7 +275,7 @@
</div> </div>
</div>`; </div>`;
} else if(dataIdValue == '6'){ } else if (dataIdValue == '6') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 11; i++) {
@ -295,7 +310,7 @@
</div>`; </div>`;
} else if(dataIdValue == '7'){ } else if (dataIdValue == '7') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 11; i++) {
@ -328,7 +343,7 @@
</div> </div>
</div>`; </div>`;
} else if(dataIdValue == '8'){ } else if (dataIdValue == '8') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 11; i++) {
@ -359,7 +374,7 @@
</div> </div>
</div>`; </div>`;
} else if(dataIdValue == '9'){ } else if (dataIdValue == '9') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 11; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
@ -388,7 +403,7 @@
</div> </div>
</div>`; </div>`;
} else if(dataIdValue == '10'){ } else if (dataIdValue == '10') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 11; i++) {
@ -421,7 +436,7 @@
</div> </div>
</div>`; </div>`;
} else if(dataIdValue == '11'){ } else if (dataIdValue == '11') {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 11; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
@ -454,10 +469,7 @@
</div> </div>
</div>`; </div>`;
} } else {
else
{
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 11; i++) {
$('#grid_' + i).remove(); $('#grid_' + i).remove();
} }
@ -470,7 +482,7 @@
grid_container.insertAdjacentHTML('beforeend', grid_html); grid_container.insertAdjacentHTML('beforeend', grid_html);
if(dataIdValue == '1'){ if (dataIdValue == '1') {
$('#gpa_sum_si').trigger('keyup'); $('#gpa_sum_si').trigger('keyup');
// $('input[name="gpa_sum_si[]"]').each(function() { // $('input[name="gpa_sum_si[]"]').each(function() {
// console.log($(this)); // console.log($(this));
@ -485,17 +497,17 @@
$('#si_or_bp').trigger('change'); $('#si_or_bp').trigger('change');
}, 300); }, 300);
}; };
$("#GridForm").submit(function(event) { $("#GridForm").submit(function(event) {
var check = checkDuplicate(); var check = checkDuplicate();
event.preventDefault(); event.preventDefault();
if($('#grid_emp_count').val() == 'true'){ if ($('#grid_emp_count').val() == 'false') {
toastr.warning('Client has active employees', 'Warning'); toastr.warning('Client has active employees', 'Warning');
return; return;
} }
@ -503,7 +515,7 @@
var isValid = $('#GridForm').parsley().validate(); var isValid = $('#GridForm').parsley().validate();
if (!isValid) { if (!isValid) {
console.log('Form is Empty', 'Warning'); console.log('Form is Empty', 'Warning');
return ; return;
} }
$('.loader').fadeIn(); $('.loader').fadeIn();
@ -514,10 +526,10 @@
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
if(check){ if (check) {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}else{ } else {
$.ajax({ $.ajax({
data: formData, data: formData,
url: policy_form_action, url: policy_form_action,
@ -527,7 +539,7 @@
contentType: false, contentType: false,
success: function(res) { success: function(res) {
console.log("Response",res); console.log("Response", res);
if (res.status === false) { if (res.status === false) {
toastr.error('Policy Dose Not Create', 'Error'); toastr.error('Policy Dose Not Create', 'Error');
@ -537,7 +549,9 @@
setTimeout(function() { setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
var message = (policy_PrimaryKey === '') ? 'Policy Premium Added successfully' : 'Policy Premium Added Successfully'; var message = (policy_PrimaryKey === '') ?
'Policy Premium Added successfully' :
'Policy Premium Added Successfully';
toastr.success(message, 'Success'); toastr.success(message, 'Success');
$('.close').click(); $('.close').click();
}, 1000); }, 1000);
@ -561,19 +575,21 @@
}); });
} }
}); });
$('body').on('click', '.btnPolicyModel', function () { $('body').on('click', '.btnPolicyModel', function() {
// $('#grid').empty();
var client_policy_id = $(this).data('id'); var client_policy_id = $(this).data('id');
$('#client_policy_id').val(client_policy_id); $('#client_policy_id').val(client_policy_id);
console.log('client_policy_id',client_policy_id) console.log('client_policy_id', client_policy_id)
var policy_type_string = $(this).attr('id'); var policy_type_string = $(this).attr('id');
console.log('policy_type_string', policy_type_string) console.log('policy_type_string', policy_type_string)
if(policy_type_string == 'GPA' || policy_type_string == 'GMC'){ if (policy_type_string == 'GPA' || policy_type_string == 'GMC') {
$('#GridForm').show(); $('#GridForm').show();
$('#no_data').html(''); $('#no_data').html('');
@ -582,23 +598,36 @@
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
$.ajax({ $.ajax({
url: '<?= base_url("util/policy-premium") ?>' , url: '<?= base_url("util/policy-premium") ?>',
type: "GET", type: "GET",
data: { client_policy_id: client_policy_id}, data: {
client_policy_id: client_policy_id
},
dataType: 'json', dataType: 'json',
success: function (res) { success: function(res) {
$('#GridForm')[0].reset();
setTimeout(function() { setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}, 1000); }, 1000);
console.log('policy grid responce',res); console.log('policy grid responce', res);
var temp_for_premiumData = JSON.parse(res.premiumData); var temp_for_premiumData = JSON.parse(res.premiumData);
res.premiumData= JSON.parse(res.premiumData); res.premiumData = JSON.parse(res.premiumData);
$('#nameOfThePolicy').html(' - ' + res.policy_name); $('#nameOfThePolicy').html(' - ' + res.policy_name);
$('#grid_emp_count').val(res.count); $('#grid_emp_count').val(res.count);
if (res.count == false) {
console.log('count -- 2', res.count);
$("#btnGridSubmit_2").hide();
} else {
$("#btnGridSubmit_2").show();
console.log('count -- ', res.count);
}
if (res.status === false) { if (res.status === false) {
toastr.error(res.status); toastr.error(res.status);
return; return;
@ -613,24 +642,45 @@
var policeGridOptionHTML = ''; var policeGridOptionHTML = '';
policeGridOptionHTML += ` <option value="">Select Premium Type</option>`; policeGridOptionHTML += ` <option value="">Select Premium Type</option>`;
$.each(res.data, function(index, item) { $.each(res.data, function(index, item) {
policeGridOptionHTML += '<option data-id="'+ item.ui_type +'" value="' + item.id + '" ' + (policy_grid_id_value === item.id ? 'selected="selected"' : '') + '>' + item.policy_grid_type + '</option>'; policeGridOptionHTML += '<option data-id="' + item.ui_type +
'" value="' + item.id + '" ' + (policy_grid_id_value === item.id ?
'selected="selected"' : '') + '>' + item.policy_grid_type +
'</option>';
}); });
$('#grid').html(policeGridOptionHTML); $('#grid').html(policeGridOptionHTML);
if(res.premiumData[0].hasOwnProperty('premium_type')){
if (res.premiumData[0].premium_type == '2') {
$('#individual').prop('checked', true)
$('#single').prop('checked', false)
} else if (res.premiumData[0].premium_type == '1') {
$('#single').prop('checked', true)
$('#individual').prop('checked', false)
}
}
var si_or_bp_value = ''; var si_or_bp_value = '';
if (res.premiumData && res.premiumData.length > 0) { if (res.premiumData && res.premiumData.length > 0) {
if(res.premiumData[0].si_or_bp){ if (res.premiumData[0].si_or_bp) {
si_or_bp_value = res.premiumData[0].si_or_bp; si_or_bp_value = res.premiumData[0].si_or_bp;
} }
addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id, si_or_bp_value); addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id,
si_or_bp_value);
res.premiumData.shift(); res.premiumData.shift();
$.each(res.premiumData, function(index, item){ $.each(res.premiumData, function(index, item) {
if (item.si_or_bp == '1') { if (item.si_or_bp == '1') {
appendGridtHtml('1', item); appendGridtHtml('1', item);
}else{ } else {
appendGridtHtml(item.policy_grid_id, item); appendGridtHtml(item.policy_grid_id, item);
} }
}); });
@ -655,7 +705,7 @@
$(this).trigger('keyup'); $(this).trigger('keyup');
}); });
var id_for_trigger =temp_for_premiumData[0].policy_grid_id; var id_for_trigger = temp_for_premiumData[0].policy_grid_id;
$(`input[name="${id_for_trigger}_si[]"]`).each(function() { $(`input[name="${id_for_trigger}_si[]"]`).each(function() {
console.log($(this)); console.log($(this));
$(this).trigger('keyup'); $(this).trigger('keyup');
@ -666,7 +716,7 @@
$(this).trigger('keyup'); $(this).trigger('keyup');
}); });
}, },
error: function (xhr, status, error) { error: function(xhr, status, error) {
console.error(xhr.responseText); console.error(xhr.responseText);
console.error(status, error); console.error(status, error);
setTimeout(function() { setTimeout(function() {
@ -677,7 +727,7 @@
} }
}); });
} else{ } else {
$('#grid').empty(); $('#grid').empty();
$('#nameOfThePolicy').html(''); $('#nameOfThePolicy').html('');
@ -687,12 +737,12 @@
} }
}); });
$('#grid').change(function(){ $('#grid').change(function() {
var grid_id=$(this)[0].value; var grid_id = $(this)[0].value;
var client_policy_id =$('#client_policy_id')[0].value; var client_policy_id = $('#client_policy_id')[0].value;
$('.loader').fadeIn(); $('.loader').fadeIn();
@ -701,9 +751,12 @@
$.ajax({ $.ajax({
url: '<?= base_url("util/policy-premium") ?>', url: '<?= base_url("util/policy-premium") ?>',
type: "GET", type: "GET",
data: { client_policy_id: client_policy_id}, data: {
client_policy_id: client_policy_id
},
dataType: 'json', dataType: 'json',
success: function (res) { success: function(res) {
console.log('responce :', res); console.log('responce :', res);
setTimeout(function() { setTimeout(function() {
@ -715,13 +768,22 @@
$('#nameOfThePolicy').html(' - ' + res.policy_name); $('#nameOfThePolicy').html(' - ' + res.policy_name);
$('#grid_emp_count').val(res.count); $('#grid_emp_count').val(res.count);
if (res.count == false) {
console.log('count -- 2', res.count);
$("#btnGridSubmit_2").hide();
} else {
$("#btnGridSubmit_2").show();
console.log('count -- ', res.count);
}
if (res.status === false) { if (res.status === false) {
toastr.error(res.status); toastr.error(res.status);
return; return;
} }
var policy_grid_id_value = ''; var policy_grid_id_value = '';
if (res.premiumData && res.premiumData.length > 0 && res.premiumData[0].policy_grid_id) { if (res.premiumData && res.premiumData.length > 0 && res.premiumData[0]
.policy_grid_id) {
policy_grid_id_value = res.premiumData[0].policy_grid_id; policy_grid_id_value = res.premiumData[0].policy_grid_id;
} }
@ -729,13 +791,16 @@
var policeGridOptionHTML = ''; var policeGridOptionHTML = '';
policeGridOptionHTML += ` <option value="">Select Premium Type</option>`; policeGridOptionHTML += ` <option value="">Select Premium Type</option>`;
$.each(res.data, function(index, item) { $.each(res.data, function(index, item) {
policeGridOptionHTML += '<option data-id="'+ item.ui_type +'" value="' + item.id + '" ' + (policy_grid_id_value === item.id ? 'selected="selected"' : '') + '>' + item.policy_grid_type + '</option>'; policeGridOptionHTML += '<option data-id="' + item.ui_type +
'" value="' + item.id + '" ' + (policy_grid_id_value === item.id ?
'selected="selected"' : '') + '>' + item.policy_grid_type +
'</option>';
}); });
// $('#grid').html(policeGridOptionHTML); // $('#grid').html(policeGridOptionHTML);
var si_or_bp_value = ''; var si_or_bp_value = '';
if (res.premiumData && res.premiumData.length > 0) { if (res.premiumData && res.premiumData.length > 0) {
if(res.premiumData[0].si_or_bp){ if (res.premiumData[0].si_or_bp) {
si_or_bp_value = res.premiumData[0].si_or_bp; si_or_bp_value = res.premiumData[0].si_or_bp;
$('#si_or_bp').val(si_or_bp_value); $('#si_or_bp').val(si_or_bp_value);
@ -744,17 +809,18 @@
addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id, si_or_bp_value); addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id,
si_or_bp_value);
res.premiumData.shift(); res.premiumData.shift();
$.each(res.premiumData, function(index, item){ $.each(res.premiumData, function(index, item) {
appendGridtHtml(item.policy_grid_id, item); appendGridtHtml(item.policy_grid_id, item);
}); });
} else { } else {
console.log("res.premiumData is undefined, null, or empty."); console.log("res.premiumData is undefined, null, or empty.");
} }
}else if(res.data[0].policy_type == "GPA"){ } else if (res.data[0].policy_type == "GPA") {
$('#si_or_bp').val('2'); $('#si_or_bp').val('2');
setTimeout(() => { setTimeout(() => {
@ -762,7 +828,7 @@
}, 300); }, 300);
} }
}, },
error: function (xhr, status, error) { error: function(xhr, status, error) {
console.error(xhr.responseText); console.error(xhr.responseText);
console.error(status, error); console.error(status, error);
setTimeout(function() { setTimeout(function() {
@ -772,18 +838,18 @@
}, 1000); }, 1000);
} }
}); });
}) })
var Count = 1 var Count = 1
function appendGridtHtml(ui_type = false, data = false,) {
function appendGridtHtml(ui_type = false, data = false, ) {
var html = ''; var html = '';
// console.log('Grid Content',data) // console.log('Grid Content',data)
Count++; Count++;
var container = document.getElementById('grid_content_input'); var container = document.getElementById('grid_content_input');
if(ui_type == '1') if (ui_type == '1') {
{
html = `<div class="form-row gpa_sum_insure_remove" style="width:84%" id="removeChild_${Count}"> html = `<div class="form-row gpa_sum_insure_remove" style="width:84%" id="removeChild_${Count}">
<div class="form-group col-md-4" id=""> <div class="form-group col-md-4" id="">
<label for="mobile">Sum Insured<span class="text-danger">*</span></label> <label for="mobile">Sum Insured<span class="text-danger">*</span></label>
@ -801,8 +867,7 @@
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml('1')">+</button> <button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml('1')">+</button>
</div> </div>
</div>`; </div>`;
} } else if (ui_type == '3') {
else if(ui_type == '3'){
html = ` html = `
<div class="form-row" id="removeChild_${Count}" style="width:84%"> <div class="form-row" id="removeChild_${Count}" style="width:84%">
@ -823,10 +888,10 @@
</div> </div>
`; `;
}else if(ui_type == '4'){ } else if (ui_type == '4') {
html =` html = `
<div class="form-row" id="removeChild_${Count}" style="width:84%"> <div class="form-row" id="removeChild_${Count}" style="width:84%">
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="mobile">From Age<span class="text-danger">*</span></label> <label for="mobile">From Age<span class="text-danger">*</span></label>
@ -847,7 +912,7 @@
</div> </div>
</div>`; </div>`;
}else if(ui_type == '5'){ } else if (ui_type == '5') {
html = ` html = `
@ -876,9 +941,9 @@
</div> </div>
</div>`; </div>`;
}else if(ui_type == '6'){ } else if (ui_type == '6') {
html =` html = `
<div class="form-row" id="removeChild_${Count}" style="width:84%"> <div class="form-row" id="removeChild_${Count}" style="width:84%">
<div class="form-group col-md-3"> <div class="form-group col-md-3">
@ -905,7 +970,7 @@
</div> </div>
</div>`; </div>`;
}else if(ui_type == '7'){ } else if (ui_type == '7') {
html = ` html = `
<div class="form-row" id="removeChild_${Count}" style="width:84%"> <div class="form-row" id="removeChild_${Count}" style="width:84%">
@ -933,7 +998,7 @@
</div> </div>
</div>`; </div>`;
}else if(ui_type == '8'){ } else if (ui_type == '8') {
html = ` html = `
<div class="form-row" id="removeChild_${Count}" style="width:84%"> <div class="form-row" id="removeChild_${Count}" style="width:84%">
@ -957,7 +1022,7 @@
</div> </div>
</div>`; </div>`;
}else if(ui_type == '9'){ } else if (ui_type == '9') {
html = ` html = `
<div class="form-row" id="removeChild_${Count}" style="width:84%"> <div class="form-row" id="removeChild_${Count}" style="width:84%">
@ -981,7 +1046,7 @@
</div> </div>
</div>`; </div>`;
}else if(ui_type == '10'){ } else if (ui_type == '10') {
html = ` html = `
<div class="form-row" id="removeChild_${Count}" style="width:84%"> <div class="form-row" id="removeChild_${Count}" style="width:84%">
@ -1009,7 +1074,7 @@
</div> </div>
</div>`; </div>`;
}else if(ui_type == '11'){ } else if (ui_type == '11') {
html = ` html = `
<div class="form-row" id="removeChild_${Count}" style="width:84%"> <div class="form-row" id="removeChild_${Count}" style="width:84%">
@ -1044,7 +1109,7 @@
$('#gmc_add_more').hide(); $('#gmc_add_more').hide();
$('#gmc_remove').show(); $('#gmc_remove').show();
Count-- Count--
$('#gmc_add_more_'+Count).hide() $('#gmc_add_more_' + Count).hide()
Count++ Count++
@ -1061,37 +1126,36 @@
} }
}); });
} }
function removebutton(index, type) { function removebutton(index, type) {
if(index == 0){ if (index == 0) {
var inputs = document.querySelectorAll('#grid_'+ type +' input'); var inputs = document.querySelectorAll('#grid_' + type + ' input');
inputs.forEach(function(input) { inputs.forEach(function(input) {
input.value = ''; input.value = '';
}); });
}else{ } else {
var element = document.getElementById('removeChild_'+ index); var element = document.getElementById('removeChild_' + index);
var gridContentDiv = document.getElementById('grid_content_input'); var gridContentDiv = document.getElementById('grid_content_input');
var count = gridContentDiv.childElementCount; var count = gridContentDiv.childElementCount;
if (element) { if (element) {
element.remove(); element.remove();
} }
if(count == 2){ if (count == 2) {
$('#gmc_add_more').show(); $('#gmc_add_more').show();
} }
index--; index--;
$('#gmc_add_more_'+index).show(); $('#gmc_add_more_' + index).show();
} }
} }
function checkDuplicate() function checkDuplicate() {
{
if ($('#grid')[0].value === '3') { if ($('#grid')[0].value === '3') {
var siInputs = $('input[name="3_si[]"]'); var siInputs = $('input[name="3_si[]"]');
var premiumInputs = $('input[name="3_premium[]"]'); var premiumInputs = $('input[name="3_premium[]"]');
@ -1124,7 +1188,7 @@
} else { } else {
return false; return false;
} }
}else if($('#grid')[0].value === '4'){ } else if ($('#grid')[0].value === '4') {
var ageFrom = $('input[name="4_age_from[]"]'); var ageFrom = $('input[name="4_age_from[]"]');
var ageTo = $('input[name="4_age_to[]"]'); var ageTo = $('input[name="4_age_to[]"]');
@ -1158,7 +1222,7 @@
return false; return false;
} }
}else if ($('#grid')[0].value === '5') { } else if ($('#grid')[0].value === '5') {
var si = $('input[name="5_si[]"]'); var si = $('input[name="5_si[]"]');
var ageFrom = $('input[name="5_age_from[]"]'); var ageFrom = $('input[name="5_age_from[]"]');
var ageTo = $('input[name="5_age_to[]"]'); var ageTo = $('input[name="5_age_to[]"]');
@ -1183,7 +1247,8 @@
for (var i = 0; i < ageFrom_array.length; i++) { for (var i = 0; i < ageFrom_array.length; i++) {
for (var j = i + 1; j < ageFrom_array.length; j++) { for (var j = i + 1; j < ageFrom_array.length; j++) {
if (ageFrom_array[i] === ageFrom_array[j] && ageTo_array[i] === ageTo_array[j] && si_array[i] === si_array[j]) { if (ageFrom_array[i] === ageFrom_array[j] && ageTo_array[i] === ageTo_array[j] && si_array[i] ===
si_array[j]) {
ageDuplicates = true; ageDuplicates = true;
} }
} }
@ -1195,7 +1260,7 @@
} else { } else {
return false; return false;
} }
}else if($('#grid')[0].value === '6'){ } else if ($('#grid')[0].value === '6') {
var ageFrom = $('input[name="6_age_from[]"]'); var ageFrom = $('input[name="6_age_from[]"]');
var ageTo = $('input[name="6_age_to[]"]'); var ageTo = $('input[name="6_age_to[]"]');
@ -1227,7 +1292,7 @@
} else { } else {
return false; return false;
} }
}else if($('#grid')[0].value === '7'){ } else if ($('#grid')[0].value === '7') {
var si = $('input[name="7_si[]"]'); var si = $('input[name="7_si[]"]');
var ageFrom = $('input[name="7_age_from[]"]'); var ageFrom = $('input[name="7_age_from[]"]');
var ageTo = $('input[name="7_age_to[]"]'); var ageTo = $('input[name="7_age_to[]"]');
@ -1252,7 +1317,8 @@
for (var i = 0; i < ageFrom_array.length; i++) { for (var i = 0; i < ageFrom_array.length; i++) {
for (var j = i + 1; j < ageFrom_array.length; j++) { for (var j = i + 1; j < ageFrom_array.length; j++) {
if (ageFrom_array[i] === ageFrom_array[j] && ageTo_array[i] === ageTo_array[j] && si_array[i] === si_array[j]) { if (ageFrom_array[i] === ageFrom_array[j] && ageTo_array[i] === ageTo_array[j] && si_array[i] ===
si_array[j]) {
ageDuplicates = true; ageDuplicates = true;
} }
} }
@ -1264,7 +1330,7 @@
} else { } else {
return false; return false;
} }
}else if($('#grid')[0].value === '10'){ } else if ($('#grid')[0].value === '10') {
var si = $('input[name="10_si[]"]'); var si = $('input[name="10_si[]"]');
var ageFrom = $('input[name="10_age_from[]"]'); var ageFrom = $('input[name="10_age_from[]"]');
var ageTo = $('input[name="10_age_to[]"]'); var ageTo = $('input[name="10_age_to[]"]');
@ -1289,7 +1355,8 @@
for (var i = 0; i < ageFrom_array.length; i++) { for (var i = 0; i < ageFrom_array.length; i++) {
for (var j = i + 1; j < ageFrom_array.length; j++) { for (var j = i + 1; j < ageFrom_array.length; j++) {
if (ageFrom_array[i] === ageFrom_array[j] && ageTo_array[i] === ageTo_array[j] && si_array[i] === si_array[j]) { if (ageFrom_array[i] === ageFrom_array[j] && ageTo_array[i] === ageTo_array[j] && si_array[i] ===
si_array[j]) {
ageDuplicates = true; ageDuplicates = true;
} }
@ -1302,7 +1369,7 @@
} else { } else {
return false; return false;
} }
}else if($('#grid')[0].value === '8'){ } else if ($('#grid')[0].value === '8') {
var siInputs = $('input[name="8_si[]"]'); var siInputs = $('input[name="8_si[]"]');
var gradeInputs = $('input[name="8_grade[]"]'); var gradeInputs = $('input[name="8_grade[]"]');
@ -1334,7 +1401,7 @@
} else { } else {
return false; return false;
} }
}else if($('#grid')[0].value === '9'){ } else if ($('#grid')[0].value === '9') {
var siInputs = $('input[name="9_si[]"]'); var siInputs = $('input[name="9_si[]"]');
var gradeInputs = $('input[name="9_grade[]"]'); var gradeInputs = $('input[name="9_grade[]"]');
@ -1366,7 +1433,7 @@
} else { } else {
return false; return false;
} }
}else if ($('#grid')[0].value === '11') { } else if ($('#grid')[0].value === '11') {
var siInputs = $('input[name="11_si[]"]'); var siInputs = $('input[name="11_si[]"]');
var gradeInputs = $('input[name="11_grade[]"]'); var gradeInputs = $('input[name="11_grade[]"]');
var maxSiInputs = $('input[name="11_max_si[]"]'); var maxSiInputs = $('input[name="11_max_si[]"]');
@ -1394,7 +1461,8 @@
// console.log(maxSiValues); // console.log(maxSiValues);
// console.log("maxSiValues[i] ", maxSiValues[i] ); // console.log("maxSiValues[i] ", maxSiValues[i] );
// console.log("maxSiValues[j]", maxSiValues[j]); // console.log("maxSiValues[j]", maxSiValues[j]);
if (siValues[i] === siValues[j] && gradeValues[i] === gradeValues[j] && maxSiValues[i] === maxSiValues[j]) { if (siValues[i] === siValues[j] && gradeValues[i] === gradeValues[j] && maxSiValues[i] === maxSiValues[
j]) {
duplicatesFound = true; duplicatesFound = true;
} }
} }
@ -1407,46 +1475,44 @@
return false; return false;
} }
} }
} }
function basicPayMultiple(input) { function basicPayMultiple(input) {
if(input.id == 'basic_pay') if (input.id == 'basic_pay') {
{
var multi = $('#basic_multiplier')[0].value.replace(/,/g, '') * input.value.replace(/,/g, ''); var multi = $('#basic_multiplier')[0].value.replace(/,/g, '') * input.value.replace(/,/g, '');
$('#gpa_basic_si').val(multi).trigger('keyup'); $('#gpa_basic_si').val(multi).trigger('keyup');
var multi_2 = $('#gpa_basic_si')[0].value.replace(/,/g, '') * $('#premium_multiplier')[0].value.replace(/,/g, ''); var multi_2 = $('#gpa_basic_si')[0].value.replace(/,/g, '') * $('#premium_multiplier')[0].value.replace(/,/g,
'');
$('#gpa_basic_premium').val(multi_2).trigger('keyup'); $('#gpa_basic_premium').val(multi_2).trigger('keyup');
}else if(input.id == 'basic_multiplier') } else if (input.id == 'basic_multiplier') {
{ var multi = input.value * $('#basic_pay')[0].value.replace(/,/g, '');
var multi =input.value * $('#basic_pay')[0].value.replace(/,/g, '');
$('#gpa_basic_si').val(multi).trigger('keyup'); $('#gpa_basic_si').val(multi).trigger('keyup');
var multi_2 = $('#gpa_basic_si')[0].value.replace(/,/g, '') * $('#premium_multiplier')[0].value.replace(/,/g, ''); var multi_2 = $('#gpa_basic_si')[0].value.replace(/,/g, '') * $('#premium_multiplier')[0].value.replace(/,/g,
'');
$('#gpa_basic_premium').val(multi_2).trigger('keyup'); $('#gpa_basic_premium').val(multi_2).trigger('keyup');
}else if(input.id == 'premium_multiplier') } else if (input.id == 'premium_multiplier') {
{
var multi = input.value.replace(/,/g, '') * $('#gpa_basic_si')[0].value.replace(/,/g, ''); var multi = input.value.replace(/,/g, '') * $('#gpa_basic_si')[0].value.replace(/,/g, '');
$('#gpa_basic_premium').val(multi).trigger('keyup'); $('#gpa_basic_premium').val(multi).trigger('keyup');
}else if(input.id == 'gpa_basic_si') } else if (input.id == 'gpa_basic_si') {
{
var multi = input.value.replace(/,/g, '') * $('#premium_multiplier')[0].value.replace(/,/g, ''); var multi = input.value.replace(/,/g, '') * $('#premium_multiplier')[0].value.replace(/,/g, '');
$('#gpa_basic_premium').val(multi).trigger('keyup'); $('#gpa_basic_premium').val(multi).trigger('keyup');
} }
} }
function gpaSumInsureMultiplier(element) { function gpaSumInsureMultiplier(element) {
console.log(element); console.log(element);
var element = $('#gpa_sum_multiplier')[0]; var element = $('#gpa_sum_multiplier')[0];
var sumInsured = $('input[name="gpa_sum_si[]"]'); var sumInsured = $('input[name="gpa_sum_si[]"]');
@ -1460,7 +1526,7 @@
sumInsured.each(function(index) { sumInsured.each(function(index) {
var siValue = $(this).val().replace(/,/g, ''); var siValue = $(this).val().replace(/,/g, '');
var premiumValue = siValue * element.value; var premiumValue = siValue * element.value;
var premiumValuedata=premium[index]; var premiumValuedata = premium[index];
if (premiumValuedata) { if (premiumValuedata) {
premiumValuedata.value = Math.floor(premiumValue); premiumValuedata.value = Math.floor(premiumValue);
} }
@ -1468,18 +1534,24 @@
$(premium[index]).trigger('keyup'); $(premium[index]).trigger('keyup');
// premium.eq(index).val(Math.floor(premiumValue)); // premium.eq(index).val(Math.floor(premiumValue));
}); });
} }
function si_orbp_change_function() { function si_orbp_change_function() {
var selectedValue = $('#si_or_bp').val(); var selectedValue = $('#si_or_bp').val();
if (selectedValue == 2) { if (selectedValue == 2) {
$('#si_or_bp_full_div').css({'display':'',}); $('#si_or_bp_full_div').css({
$('#si_or_bp_sum_insure').css({'display':'none'}); 'display': '',
$('#si_or_bp_basic_pay').css({'display':''}); });
$('#si_or_bp_sum_insure').css({
'display': 'none'
});
$('#si_or_bp_basic_pay').css({
'display': ''
});
$('#gpa_sum_multiplier').removeAttr('required'); $('#gpa_sum_multiplier').removeAttr('required');
$('#gpa_sum_si').removeAttr('required'); $('#gpa_sum_si').removeAttr('required');
@ -1499,10 +1571,16 @@
elementsToHide.hide(); elementsToHide.hide();
}else if(selectedValue == 1){ } else if (selectedValue == 1) {
$('#si_or_bp_full_div').css({'display':'',}); $('#si_or_bp_full_div').css({
$('#si_or_bp_sum_insure').css({'display':''}); 'display': '',
$('#si_or_bp_basic_pay').css({'display':'none'}); });
$('#si_or_bp_sum_insure').css({
'display': ''
});
$('#si_or_bp_basic_pay').css({
'display': 'none'
});
$('#basic_multiplier').removeAttr('required'); $('#basic_multiplier').removeAttr('required');
@ -1522,13 +1600,18 @@
elementsToUnhide.show(); elementsToUnhide.show();
}else{ } else {
$('#si_or_bp_full_div').css({'display':'none',}); $('#si_or_bp_full_div').css({
$('#si_or_bp_sum_insure').css({'display':''}); 'display': 'none',
$('#si_or_bp_basic_pay').css({'display':''}); });
$('#si_or_bp_sum_insure').css({
'display': ''
});
$('#si_or_bp_basic_pay').css({
'display': ''
});
} }
} }
</script> </script>

View File

@ -0,0 +1,38 @@
<style>
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
</style>
<div class="responsive-table-plugin">
<div class="table-rep-plugin">
<div class="table-responsive" data-pattern="priority-columns">
<table id="tech-companies-1" class="table table-striped">
<thead class="bg-light">
<?php foreach ($thead as $header): ?>
<th><?php echo $header; ?></th>
<?php endforeach; ?>
</thead>
<tbody class="font-12">
<?php for ($i = 1; $i < count($tbody); $i++): ?>
<tr>
<?php foreach ($tbody[$i] as $data): ?>
<td>
<?php echo $data;?>
</td>
<?php endforeach; ?>
</tr>
<?php endfor; ?>
</tbody>
</table>
</div> <!-- end .table-responsive -->
</div> <!-- end .table-rep-plugin-->
</div> <!-- end .responsive-table-plugin-->

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB