'FIX_EMP_MODULE_BATCH_LIST_AMOUNT'

This commit is contained in:
sriramv 2024-04-16 14:21:20 +05:30
parent 6b1f39bbc8
commit 33fb5b8c50
7 changed files with 1431 additions and 1156 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,24 +558,31 @@ class EmployeeController extends AdminController
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'no data found'], 200);
}
}
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
@ -583,7 +591,6 @@ class EmployeeController extends AdminController
// You can return an error response here
echo $errorMessage;
}
}
@ -628,6 +635,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>';
@ -643,5 +651,26 @@ class EmployeeController extends AdminController
return $this->respond(['dataStatus' => false, 'code' => 500, 'data' => $html, 'file_data' => $file_name], 500);
}
}
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

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