diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index 007d80c1..36bb3868 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -211,6 +211,9 @@ $routes->group("/util", ["filter" => "authMVC"], function($routes){
$routes->get("get-emp-endorsement/(:any)", "EmployeeController::getEmpEndoresmentEntry/$1");
$routes->post("import-export", "EmployeeController::importExport");
$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");
});
diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php
index 5aa1b072..28566852 100644
--- a/app/Controllers/EmployeeController.php
+++ b/app/Controllers/EmployeeController.php
@@ -217,7 +217,7 @@ class EmployeeController extends AdminController
$data['insurer_or_tpa'] = ['insurer' => 'Insurer','tpa' =>'TPA'];
$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('client_policy cp','files.policy_id = cp.id','left')
->join('policies pm','cp.policy_id = pm.id','left')
@@ -548,5 +548,90 @@ class EmployeeController extends AdminController
}
}
+
+ 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 = '
No Data Found
';
+ }
+
+ 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 = 'No Data Found
';
+ return $this->respond(['dataStatus' => false, 'code' => 500, 'data' => $html, 'file_data' => $file_name], 500);
+ }
+ }
}
\ No newline at end of file
diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php
index 3cdd2177..a86eaeb8 100644
--- a/app/Models/EmployeePolicyModel.php
+++ b/app/Models/EmployeePolicyModel.php
@@ -643,4 +643,40 @@ 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();
+ }
}
\ No newline at end of file
diff --git a/app/Views/employee_data_list.php b/app/Views/employee_data_list.php
new file mode 100644
index 00000000..a1efb23c
--- /dev/null
+++ b/app/Views/employee_data_list.php
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+ SNO
+
+ Name/code
+ Policy name
+ Insurer name
+ TPA ID
+ UHID ID
+ Policy status
+ Premium
+ Action
+
+
+
+
+ $employee) { ?>
+
+
+
+
+ ( )
+
+
+
+
+
+ ' . $employee['status'] . '';
+ } elseif ($employee['status'] == 'active') {
+ echo '' . $employee['status'] . ' ';
+ } elseif ($employee['status'] == 'inactive') {
+ echo '' . $employee['status'] . ' ';
+ }elseif ($employee['status'] == 'expired') {
+ echo '' . $employee['status'] . ' ';
+ }else{
+ echo $employee['status'];
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/employee_list.php b/app/Views/employee_list.php
index 02b28c13..4b1e6633 100644
--- a/app/Views/employee_list.php
+++ b/app/Views/employee_list.php
@@ -68,89 +68,9 @@ table.dataTable tbody td {
-
-
-
-
-
-
-
-
- SNO
-
- Name/code
- Policy name
- Insurer name
- TPA ID
- UHID ID
- Policy status
- Premium
- Action
-
-
-
- $employee) { ?>
-
-
-
-
- ( )
-
-
-
-
-
- ' . $employee['status'] . '';
- } elseif ($employee['status'] == 'active') {
- echo '' . $employee['status'] . ' ';
- } elseif ($employee['status'] == 'inactive') {
- echo '' . $employee['status'] . ' ';
- }elseif ($employee['status'] == 'expired') {
- echo '' . $employee['status'] . ' ';
- }
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
SPINNER
diff --git a/app/Views/employee_upload.php b/app/Views/employee_upload.php
index f068f4cc..4a06336f 100644
--- a/app/Views/employee_upload.php
+++ b/app/Views/employee_upload.php
@@ -20,7 +20,7 @@
@@ -107,6 +116,25 @@
+
+
+
@@ -153,6 +181,13 @@ $(document).ready(function() {
event.preventDefault(); // Prevent default form submission
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 policy_id = $('#policy_id').val();
console.log('action_item - ' + action_item);
@@ -161,8 +196,10 @@ $(document).ready(function() {
// $('#policy_id').prop('title', 'plz choose policy');
// $('#policy_id').mouseover();
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;
+
} else {
$('#policy_id').attr('required', false);
@@ -230,9 +267,6 @@ $(document).ready(function() {
$(window).on("load", function() {
console.log("window loaded");
fetchClientPolicies();
-
-
-
});
@@ -281,72 +315,91 @@ function fetchFileError(file_id) {
console.log('fetchFileError');
console.log(apiURL);
$.ajax({
- url: apiURL,
- method: 'GET',
- headers: {
- "X-Requested-With": "XMLHttpRequest"
- },
- success: function(response) {
-
- $(this).find(".modal-body").html("");
- if (response.code === 200 && response.dataStatus === true && response.data !== "")
- {
- try {
- console.log((JSON.parse(response.data)));
- var file_error_data = (JSON.parse(response.data));
- var file_error_html = "";
-
- for (var key in file_error_data['error_summary']) {
- // console.log(key);
- var err_id = parseInt(key);
- var err_count = file_error_data['error_summary'][key];
- switch (err_id) {
- case 1:
- file_error_html += "
Mandatory values missing " + err_count + " ";
- break;
- case 2:
- file_error_html += "
Values not in expected format " + err_count + " ";
- break;
- case 3:
- file_error_html += "
Field contains not allowed values " + err_count + " ";
- break;
- case 4:
- file_error_html += "
Rule Conflict " + err_count + " ";
- break;
- case 5:
- file_error_html += "
" + file_error_data['error_data'] + " ";
- break;
- case 6:
- file_error_html += "
" + file_error_data['error_data'] + " ";
- break;
- case 7:
- file_error_html += "
Duplicate entry in file " + err_count + " ";
- break;
- case 8:
- file_error_html += "to be config";
- break;
- case 9:
- file_error_html += "
Duplicate entry " + err_count + " ";
- break;
- case 10:
- file_error_html += "
Duplicate entry in file " + err_count + " ";
- break;
- case 11:
- file_error_html += "
Rule conflict: Dependents not allowed " + err_count + " ";
- break;
- case 12:
- file_error_html += "
Rule conflict: Dependent count greater than allowed dependent count " + err_count + " ";
- break;
- case 13:
- file_error_html += "
Rule conflict: Twofold relationship found within family " + err_count + " ";
- break;
+ url: apiURL,
+ method: 'GET',
+ headers: {
+ "X-Requested-With": "XMLHttpRequest"
+ },
+ success: function(response) {
- default:
- file_error_html += "";
- break;
- }
+ $(this).find(".modal-body").html("");
+ if (response.code === 200 && response.dataStatus === true && response.data !== "") {
+ try {
+ console.log((JSON.parse(response.data)));
+ var file_error_data = (JSON.parse(response.data));
+ var file_error_html = "";
- // console.log('file_error_html_1', file_error_html)
+ for (var key in file_error_data['error_summary']) {
+ // console.log(key);
+ var err_id = parseInt(key);
+ var err_count = file_error_data['error_summary'][key];
+ switch (err_id) {
+ case 1:
+ file_error_html +=
+ "
Mandatory values missing " +
+ err_count + " ";
+ break;
+ case 2:
+ file_error_html +=
+ "
Values not in expected format " +
+ err_count + " ";
+ break;
+ case 3:
+ file_error_html +=
+ "
Field contains not allowed values " +
+ err_count + " ";
+ break;
+ case 4:
+ file_error_html +=
+ "
Rule Conflict " +
+ err_count + " ";
+ break;
+ case 5:
+ file_error_html += "
" + file_error_data['error_data'] + " ";
+ break;
+ case 6:
+ file_error_html += "
" + file_error_data['error_data'] + " ";
+ break;
+ case 7:
+ file_error_html +=
+ "
Duplicate entry in file " +
+ err_count + " ";
+ break;
+ case 8:
+ file_error_html += "to be config";
+ break;
+ case 9:
+ file_error_html +=
+ "
Duplicate entry " +
+ err_count + " ";
+ break;
+ case 10:
+ file_error_html +=
+ "
Duplicate entry in file " +
+ err_count + " ";
+ break;
+ case 11:
+ file_error_html +=
+ "
Rule conflict: Dependents not allowed " +
+ err_count + " ";
+ break;
+ case 12:
+ file_error_html +=
+ "
Rule conflict: Dependent count greater than allowed dependent count " +
+ err_count + " ";
+ break;
+ case 13:
+ file_error_html +=
+ "
Rule conflict: Twofold relationship found within family " +
+ err_count + " ";
+ break;
+
+ default:
+ file_error_html += "";
+ break;
+ }
+
+ // console.log('file_error_html_1', file_error_html)
// file_error_html += (err_id == 1 ?
// "
Mandatory values missing " +
@@ -444,7 +497,7 @@ function fetchEmpolyeeList(event) {
var policy_id = $('#policy_id').val();
console.log(client_id + '-' + policy_id);
if (client_id == '0' || policy_id == '0') {
- alert('Please select values in both dropdowns.');
+ toastr.warning('Please select values in both dropdowns.');
return;
}
@@ -513,5 +566,70 @@ document.getElementById('toggleIcon1').addEventListener('click', function() {
icon.classList.toggle('mdi-chevron-down');
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);
+ }
+ });
+
+})
//--------------------------------------------------------------------------------------
\ No newline at end of file
diff --git a/app/Views/excel_errors.php b/app/Views/excel_errors.php
index 25b100ad..0e8b070e 100644
--- a/app/Views/excel_errors.php
+++ b/app/Views/excel_errors.php
@@ -1,3 +1,5 @@
+ /assets/images/Nhance_Favi.svg">
+Excel Error Report
diff --git a/app/Views/file_list.php b/app/Views/file_list.php
index 508cf00e..f0518ffb 100644
--- a/app/Views/file_list.php
+++ b/app/Views/file_list.php
@@ -1,14 +1,26 @@
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
+
SNO
File name
@@ -17,11 +29,12 @@
Event
User/Time
Status
+ Action
-
+
-
-
+ $file) { //print_r((json_decode($file['reason'])));
@@ -29,23 +42,258 @@
// $reason = "{'date':'value data kbckl kcn/aksl'}";
// echo $reason;
?>
-
-
-
-
-
-
-
- '.$file['first_name'].''?>
- ";
- }?>
-
-
-
-
-
-
+
+
+
+
+
+
+
+ '.$file['first_name'].''?>
+
+
+ ";
+
+ }else if( $file['status'] == 'inprogress'){
+
+ echo '' . $file['status'] . ' ';
+
+ }else{
+ echo $file['status'];
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php
index 80132a74..650b1a7d 100644
--- a/app/Views/layout/header.php
+++ b/app/Views/layout/header.php
@@ -238,6 +238,7 @@
+
+
\ No newline at end of file
diff --git a/public/assets/images/nhance-loader-fast.gif b/public/assets/images/nhance-loader-fast.gif
new file mode 100644
index 00000000..2ecd8e3a
Binary files /dev/null and b/public/assets/images/nhance-loader-fast.gif differ