Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
velz 2024-04-16 14:52:39 +05:30
commit c2db46b769
8 changed files with 1484 additions and 1197 deletions

View File

@ -215,6 +215,7 @@ $routes->group("/util", ["filter" => "authMVC"], function($routes){
$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");
$routes->get("fetch-emp-count/(:any)", "EmployeeController::getEmpCount/$1");
});

File diff suppressed because it is too large Load Diff

View File

@ -77,6 +77,7 @@ class EmployeeController extends AdminController
{
//echo $this->request->isAJAX();die();
$result = $this->clientModel->clientsWithPolicies();
// print_r($result);die();
if(!count($result))
{
@ -557,8 +558,6 @@ class EmployeeController extends AdminController
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'no data found'], 200);
}
}
// @param int $client_policy_id
@ -572,22 +571,29 @@ class EmployeeController extends AdminController
}
public function downloadFileList($fileName = null)
public function downloadFileList($file_id = null)
{
// $actionType = $this->request->getGet();
$file_data = $this->fileModel->where('id', $file_id)->first();
$fileName = $file_data['file_name'];
$error_data = json_decode($file_data['reason']);
$filePath = WRITEPATH . '/uploads/excel/' . $fileName;
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();
$data['message'] = 'The Physical File Not Found';
echo view('errors/404', $data);
}
} catch (\Exception $e) {
// Handle any exceptions
@ -596,7 +602,6 @@ class EmployeeController extends AdminController
// You can return an error response here
echo $errorMessage;
}
}
@ -641,6 +646,7 @@ class EmployeeController extends AdminController
$emp_data['tbody'] = $excel_data;
$html = view('view_file_upload_emp_list', $emp_data);
} else {
$html = '<div class="text-center">No Data Found</div>';
@ -657,5 +663,25 @@ class EmployeeController extends AdminController
}
}
public function getEmpCount($id = null){
$data = $this->employeeModel->select('employees.id')
->join('clients', 'clients.id = employees.client_id')
->where('employees.client_id', $id)
->findAll();
$emp_count = count($data);
if($data){
return $this->respond(['dataStatus' => true, 'code' => 200, 'emp_count' => $emp_count], 200);
}else{
return $this->respond(['dataStatus' => false, 'code' => 404], 404);
}
}
}

View File

@ -339,8 +339,10 @@ class EmployeeRestController extends AdminController
$result = [];
foreach ($ClientPolicyData as $key => $value) {
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard( $value['client_policy_id'],$value['client_id']);
if($value['is_addon'] == 1){
$value['type'] = 'AddOn';
if($value['is_addon'] == "2"){
$value['type'] = 'SI-TopUp';
}else if($value['is_addon'] == "3"){
$value['type'] = 'Dependent-AddOn';
}else{
$value['type'] = $getSlabAndGridData['grid_master']['policy_type'];
}
@ -854,6 +856,7 @@ class EmployeeRestController extends AdminController
// $return_log = json_decode($return_log);
// $this->myLogger->logme('info', "Email Status : {mail_status}, Sender Email:{email}", ['mail_status' => $return_log->status, 'email'=> $return_log->data]);
}
return $this->respond(['status' => 'success', 'code' => 200, 'message' => "Success" ], 404);
}else{
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Client id and Client Policy id is Not Match!" ], 404);
}
@ -882,7 +885,7 @@ public function getEmployeePolicy()
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
// Retrieve employee and dependents data by passing the employee code
$employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('is_active', 1 )->where('is_addon_value',0)->findAll();
// dd($empPolicy);
if ($empPolicy) {
@ -1099,24 +1102,24 @@ public function getAddOnPolicy()
{
$PolicyData = [];
foreach ($clientPolicy as $key => $array) {
$responce = [];
$decodedArray = json_decode($array['policy_terms']);
$policy_terms = $decodedArray;
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array['id'],$array['client_id']);
if($array['is_addon'] == 1)
{
$responce['policy_name'] = $this->policesModel->where('id',$array['policy_id'])->get()->getRow()->name;
$responce['SlabRates'] = $getSlabAndGridData['slab_rates'];
$responce['GridMaster'] = $getSlabAndGridData['grid_master'];
$responce['client_id'] = $array['client_id'];
$responce['client_policy_id'] = $array['id'];
$responce['is_addon'] = $array['is_addon'];
$responce['open_for_enrollment'] = $array['open_for_enrollment'];
$responce['policy_terms'] = $decodedArray;
$responce['policy_name'] = $this->policesModel->where('id',$array['policy_id'])->get()->getRow()->name;
$responce['SlabRates'] = $getSlabAndGridData['slab_rates'];
$responce['GridMaster'] = $getSlabAndGridData['grid_master'];
$responce['client_id'] = $array['client_id'];
$responce['client_policy_id'] = $array['id'];
$responce['is_addon'] = $array['is_addon'];
$responce['open_for_enrollment'] = $array['open_for_enrollment'];
$responce['policy_terms'] = $decodedArray;
if($array['is_addon'] == 3)
{
// Map family floaters that already exist in the employee table
$familyFloates = $policy_terms->family_floaters;
@ -1213,40 +1216,52 @@ public function getAddOnPolicy()
$responce['family_floaters_of_dependent_and_si_premium_value'] = $dependent_and_si_premium_value;
$only_si_array = [];
$only_si_value = null;
$only_si_premium_value = null;
foreach ($GMCEmployeeData as $key => $value) {
$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->premium)){ $only_si_premium_value = $employee_policy->premium;}
$temp3['is_value_exist'] = true;
$temp3['data']['employee_id'] = $value['id'];
$temp3['data']['relationship'] = $value['relationship'];
$temp3['data']['name'] = $value['name'];
$temp3['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
$temp3['data']['client_policy_id'] = $array['id'];
$temp3['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
$temp3['data']['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
array_push($only_si_array,$temp3);
}
$responce['family_floaters_of_only_si_array'] = $only_si_array;
$responce['family_floaters_of_only_si_value'] = $only_si_value;
$responce['family_floaters_of_only_si_premium_value'] = $only_si_premium_value;
if($this->request->getGet('policy') == 'GMC-DEPENDENT-ADDON'){
return $this->respond(['status' => 'success','code' => 200,'data' => ['gmc_dependent_addon'=>$responce]], 200);
}
//array_push($PolicyData, $responce);
}else if($array['is_addon'] == 2){
$only_si_array = [];
$only_si_value = null;
$only_si_premium_value = null;
foreach ($GMCEmployeeData as $key => $value) {
$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->premium)){ $only_si_premium_value = $employee_policy->premium;}
$temp3['is_value_exist'] = true;
$temp3['data']['employee_id'] = $value['id'];
$temp3['data']['relationship'] = $value['relationship'];
$temp3['data']['name'] = $value['name'];
$temp3['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
$temp3['data']['client_policy_id'] = $array['id'];
$temp3['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
$temp3['data']['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
array_push($only_si_array,$temp3);
}
$responce['family_floaters_of_only_si_array'] = $only_si_array;
$responce['family_floaters_of_only_si_value'] = $only_si_value;
$responce['family_floaters_of_only_si_premium_value'] = $only_si_premium_value;
if($this->request->getGet('policy') == 'GMC-SI-TOPUP'){
return $this->respond(['status' => 'success','code' => 200,'data' => ['gmc_si_topup'=>$responce]], 200);
}
array_push($PolicyData, $responce);
}
}
return $this->respond(['status' => 'success','code' => 200,'data' => ['addon_policy'=>$responce]], 200);
// return $this->respond(['status' => 'success','code' => 200,'data' => ['addon_policy'=>$responce]], 200);
}else{
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);

View File

@ -21,6 +21,7 @@ class BatchFileModel extends Model
"created_by",
"updated_by",
"is_active",
"amount",
];
// Callbacks

View File

@ -26,6 +26,7 @@
<th class="font-weight-medium">Insurer/TPA</th>
<th class="font-weight-medium">Action</th>
<th class="font-weight-medium">Count</th>
<th class="font-weight-medium">Amount</th>
</tr>
</thead>
@ -46,6 +47,7 @@
<td><?php echo $file['insurer_or_tpa']?></td>
<td><?php echo $file['actions']?></td>
<td><?php echo $file['count']?></td>
<td><?php echo $file['amount']?></td>
</tr>
<?php }}?>

View File

@ -478,15 +478,75 @@ $(document).ready(function() {
$('#client_id').on('change', function() {
var selectedClient = $(this).val();
console.log(selectedClient);
console.log('selectedClient', selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData
var foundPolicies = clientPolicies.find(function(item) {
return item.id === selectedClient;
});
console.log(foundPolicies.policies);
appendPolicies(foundPolicies.policies);
var apiURL = '<?php echo base_url();?>' + 'util/fetch-emp-count/' + selectedClient;
console.log(apiURL);
$.ajax({
url: apiURL,
method: 'GET',
headers: {
"Content-Type": "application/json",
"X-Requested-With": "XMLHttpRequest"
},
success: function(response) {
console.log('responce data emp_count', response);
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
try {
console.log(response.emp_count.length)
if(response.emp_count > 0){
var select = document.getElementById("upload-action-type");
for (var i = 0; i < select.options.length; i++) {
if (select.options[i].value === "inception") {
select.options[i].disabled = true;
break;
}
}
}else{
var select = document.getElementById("upload-action-type");
for (var i = 0; i < select.options.length; i++) {
if (select.options[i].value === "inception") {
select.options[i].disabled = false;
break;
}
}
}
} catch (error) {
console.error('Error parsing API response data:', error);
}
} else if (response.code === 404 && response.dataStatus === false) {
console.error('no data found', response);
} else {
console.error('Something went wrong!');
}
},
error: function(xhr, status, error) {
console.error('Error fetching data from API:', error);
var select = document.getElementById("upload-action-type");
for (var i = 0; i < select.options.length; i++) {
if (select.options[i].value === "inception") {
select.options[i].disabled = false;
break;
}
}
}
});
});
});
@ -573,7 +633,9 @@ document.getElementById('toggleIcon1').addEventListener('click', function() {
icon.classList.toggle('mdi-chevron-up');
});
$('#fetch_enrolled_data').click(function() {
$('#fetch_enrolled_data').click(function()
{
$('#emp_data').empty();
var client_id = $('#client_id').val();
@ -637,5 +699,6 @@ $('#fetch_enrolled_data').click(function() {
});
})
//--------------------------------------------------------------------------------------
</script>

175
app/Views/errors/404.php Normal file
View File

@ -0,0 +1,175 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><?= isset($page_name) ? $page_name : 'NHance'; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="" name="description" />
<meta content="NHANCE" name="NHANCE" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- App favicon -->
<link rel="shortcut icon" href="<?= base_url()."public"; ?>/assets/images/Nhance_Favi.svg">
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
position: relative;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: #22232e;
font-family: 'Poppins', sans-serif;
}
a {
text-decoration: none;
}
ul {
list-style: disc;
color: #e0ffff;
}
section {
width: 100%;
}
.container {
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
column-gap: 20px;
}
.container img {
width: 420px;
}
.text {
display: block;
padding: 40px 40px;
width: 450px;
}
.text h1 {
color: #00c2cb;
font-size: 35px;
font-weight: 700;
margin-bottom: 15px;
}
.text p {
font-size: 15px;
color: #e0ffff;
margin-bottom: 15px;
line-height: 1.5rem;
margin-bottom: 15px;
}
.text .input-box {
position: relative;
display: flex;
width: 100%;
}
.input-box input {
width: 85%;
height: 40px;
padding: 5px 15px;
font-family: 'Jost', sans-serif;
font-size: 16px;
color: #22232e;
border-radius: 5px 0px 0px 5px;
border: 2px solid #42455a;
outline: none;
}
.input-box button {
display: flex;
width: 15%;
border: 1px solid #004958;
border-radius: 0px 5px 5px 0px;
background: #004958;
color: #e0ffff;
font-size: 22px;
align-items: center;
justify-content: center;
cursor: pointer;
}
.menu {
display: flex;
flex-direction: column;
margin-top: 15px;
margin-left: 30px;
}
.menu li a {
display: flex;
font-size: 1rem;
color: #00c2cb;
transition: 0.1s;
}
@media screen and (max-width:600px) {
.container {
display: flex;
flex-direction: column-reverse;
}
.text,
.image {
width: 100%;
}
.container {
min-width: 200px;
padding: 40px 0px;
}
.text {
display: block;
width: 100%;
padding: 20px 40px;
}
.image {
display: flex;
width: 200px;
align-self: center;
justify-content: center;
margin: auto;
}
}
</style>
</head>
<body>
<section>
<div class="container">
<div class="text">
<h1><?= isset($message) && !empty($message) ? $message : '404 PAGE NOT FOUND' ?></h1>
</div>
<div><img class="image" src="https://omjsblog.files.wordpress.com/2023/07/errorimg.png" alt=""></div>
</div>
</div>
</section>
</body>
</html>