MERGE_CLIENT_FILE_UPLOAD_ISSUE,CHANGES_CLIENT_ONBOARD
This commit is contained in:
commit
ff4323b4c8
@ -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");
|
||||
|
||||
});
|
||||
|
||||
@ -232,10 +235,10 @@ $routes->group("/api", ["filter" => "authJWT"], function($routes){
|
||||
});
|
||||
|
||||
|
||||
$routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/$1");
|
||||
$routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile");
|
||||
|
||||
$routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
|
||||
|
||||
$routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile");
|
||||
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
||||
$routes->get("relationshipList", "EmployeeRestController::relationshipList");
|
||||
$routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence");
|
||||
|
||||
@ -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 = '<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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -72,6 +72,7 @@ class EmployeeRestController extends AdminController
|
||||
if ($emp_code) {
|
||||
$relationship = 'self';
|
||||
$employee = $this->employeeModel->where('emp_code', $emp_code)
|
||||
->where('is_active', 1 )
|
||||
->where('relationship', $relationship)
|
||||
->first();
|
||||
$result = $employee;
|
||||
@ -92,7 +93,7 @@ class EmployeeRestController extends AdminController
|
||||
$data = $this->request->getJSON();
|
||||
if ($data) {
|
||||
$id = $data->id;
|
||||
$employee = $this->employeeModel->update($id, $data);
|
||||
$employee = $this->employeeModel->where('is_active', 1 )->update($id, $data);
|
||||
|
||||
if ($employee) {
|
||||
$result = [];
|
||||
@ -114,7 +115,7 @@ class EmployeeRestController extends AdminController
|
||||
try {
|
||||
$emp_code = $this->request->getGet('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) {
|
||||
if ($item['dob'] !== '0000-00-00') {
|
||||
$dateTime = \DateTime::createFromFormat('Y-m-d', $item['dob']);
|
||||
@ -146,7 +147,7 @@ class EmployeeRestController extends AdminController
|
||||
foreach ($data as $item) {
|
||||
$id = $item->id;
|
||||
$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) {
|
||||
$updatedCount++;
|
||||
}
|
||||
@ -180,7 +181,8 @@ class EmployeeRestController extends AdminController
|
||||
$id = $item->id;
|
||||
$item->family_floater_key = $this->RelationshipMap($item->relationship);
|
||||
$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) {
|
||||
$Count++;
|
||||
}
|
||||
@ -188,7 +190,8 @@ class EmployeeRestController extends AdminController
|
||||
//create new data
|
||||
$item->family_floater_key = $this->RelationshipMap($item->relationship);
|
||||
$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(!isset($item->is_addon_value))
|
||||
@ -285,13 +288,17 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
if($this->request->getGet('id'))
|
||||
{
|
||||
$delete = $this->employeeModel->where('id', $this->request->getGet('id'))->delete();
|
||||
|
||||
if ($delete) {
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' =>[] ], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404);
|
||||
}
|
||||
$this->employeeModel->where('id', $this->request->getGet('id') )
|
||||
->where('is_active', 1 )
|
||||
->set(array('is_active'=> 0 ))
|
||||
->update();
|
||||
|
||||
$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);
|
||||
|
||||
}else{
|
||||
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)
|
||||
->where('client_policy_id', $value->client_policy_id)
|
||||
->where('is_active', 1 )
|
||||
->findAll();
|
||||
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($value->client_policy_id,$value->client_id);
|
||||
$SlabRatesArray = $getSlabAndGridData['slab_rates'];
|
||||
@ -514,6 +522,7 @@ class EmployeeRestController extends AdminController
|
||||
$data['client_policy_id']= $value->client_policy_id;
|
||||
$data['basic_cover_si']= $value->basic_cover_si;
|
||||
$data['premium']= $premium;
|
||||
$data['status'] = 'Draft';
|
||||
|
||||
$this->employeePolicyModel->insert($data);
|
||||
}
|
||||
@ -561,7 +570,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
$jwt = $this->request->getHeader('Authorization');
|
||||
$jwtParts = explode(' ', $jwt);
|
||||
$token = $jwtParts[1];
|
||||
$token = $jwtParts[2];
|
||||
|
||||
|
||||
$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_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();
|
||||
$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');
|
||||
$filename = $file->getName();
|
||||
@ -871,7 +881,7 @@ public function getEmployeePolicy()
|
||||
// Retrieve employee policy data by passing the employee primary key
|
||||
$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_addon_value',0)->findAll();
|
||||
$employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('is_active', 1 )->where('is_addon_value',0)->findAll();
|
||||
|
||||
|
||||
if ($empPolicy) {
|
||||
@ -1079,8 +1089,8 @@ public function getAddOnPolicy()
|
||||
{
|
||||
try {
|
||||
|
||||
$addOnEmployeeData = $this->employeeModel->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();
|
||||
$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('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();
|
||||
@ -1122,7 +1132,7 @@ public function getAddOnPolicy()
|
||||
if(count($addOnEmployeeData)){
|
||||
foreach ($addOnEmployeeData as $key => $value) {
|
||||
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->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'))
|
||||
->where('is_addon_value',0)
|
||||
->where('is_active', 1 )
|
||||
->where('family_floater_key','parent')
|
||||
->findAll();
|
||||
|
||||
@ -1207,7 +1218,7 @@ public function getAddOnPolicy()
|
||||
$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'])->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->premium)){ $only_si_premium_value = $employee_policy->premium;}
|
||||
$temp3['is_value_exist'] = true;
|
||||
@ -1247,6 +1258,20 @@ public function getAddOnPolicy()
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ class RestAuthenticationController extends AdminController
|
||||
$otp = $this->request->getJSON()->otp;
|
||||
|
||||
$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();
|
||||
if ($auth) {
|
||||
$data = [
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
85
app/Views/employee_data_list.php
Normal file
85
app/Views/employee_data_list.php
Normal file
@ -0,0 +1,85 @@
|
||||
<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">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>';
|
||||
}else{
|
||||
echo $employee['status'];
|
||||
}
|
||||
?>
|
||||
</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>
|
||||
@ -68,89 +68,9 @@ table.dataTable tbody td {
|
||||
|
||||
|
||||
|
||||
<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>
|
||||
<?php include('employee_data_list.php');?>
|
||||
|
||||
</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 -->
|
||||
<div id="loader" class="loader" style="display:none;">SPINNER</div>
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion1">
|
||||
<div class="card-body">
|
||||
<!-- <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() ?>"
|
||||
id="csrf_token">
|
||||
|
||||
@ -31,14 +31,14 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label>Client</label> <br />
|
||||
<select name="client_id" class="form-control" id="client_id" required>
|
||||
<option value="">Select</option>
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Policy</label> <br />
|
||||
<select name="policy_id" class="form-control" id="policy_id">
|
||||
<option value="">Select</option>
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -85,6 +85,15 @@
|
||||
</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>
|
||||
@ -107,6 +116,25 @@
|
||||
</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 -->
|
||||
<div class="modal fade" id="file-err-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
@ -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,75 +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 += "<strong>Mandatory values missing</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
case 2:
|
||||
file_error_html += "<strong>Values not in expected format</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
case 3:
|
||||
file_error_html += "<strong>Field contains not allowed values</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
case 4:
|
||||
file_error_html += "<strong>Rule Conflict</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
case 5:
|
||||
file_error_html += "<strong>" + file_error_data['error_data'] + "</strong>";
|
||||
break;
|
||||
case 6:
|
||||
file_error_html += "<strong>" + file_error_data['error_data'] + "</strong>";
|
||||
break;
|
||||
case 7:
|
||||
file_error_html += "<strong>Duplicate entry in file</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
case 8:
|
||||
file_error_html += "to be config";
|
||||
break;
|
||||
case 9:
|
||||
file_error_html += "<strong>Duplicate entry</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
case 10:
|
||||
file_error_html += "<strong>Record Not Found</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
case 11:
|
||||
file_error_html += "<strong>Rule conflict: Dependents not allowed</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
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>";
|
||||
break;
|
||||
case 13:
|
||||
file_error_html += "<strong>Rule conflict: Twofold relationship found within family</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
case 14:
|
||||
file_error_html += "<strong>Self Not found</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
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 +=
|
||||
"<strong>Mandatory values missing</strong> <span class='badge badge-danger float-right'>" +
|
||||
err_count + "</span>";
|
||||
break;
|
||||
case 2:
|
||||
file_error_html +=
|
||||
"<strong>Values not in expected format</strong> <span class='badge badge-danger float-right'>" +
|
||||
err_count + "</span>";
|
||||
break;
|
||||
case 3:
|
||||
file_error_html +=
|
||||
"<strong>Field contains not allowed values</strong> <span class='badge badge-danger float-right'>" +
|
||||
err_count + "</span>";
|
||||
break;
|
||||
case 4:
|
||||
file_error_html +=
|
||||
"<strong>Rule Conflict</strong> <span class='badge badge-danger float-right'>" +
|
||||
err_count + "</span>";
|
||||
break;
|
||||
case 5:
|
||||
file_error_html += "<strong>" + file_error_data['error_data'] + "</strong>";
|
||||
break;
|
||||
case 6:
|
||||
file_error_html += "<strong>" + file_error_data['error_data'] + "</strong>";
|
||||
break;
|
||||
case 7:
|
||||
file_error_html +=
|
||||
"<strong>Duplicate entry in file</strong> <span class='badge badge-danger float-right'>" +
|
||||
err_count + "</span>";
|
||||
break;
|
||||
case 8:
|
||||
file_error_html += "to be config";
|
||||
break;
|
||||
case 9:
|
||||
file_error_html +=
|
||||
"<strong>Duplicate entry</strong> <span class='badge badge-danger float-right'>" +
|
||||
err_count + "</span>";
|
||||
break;
|
||||
case 10:
|
||||
file_error_html +=
|
||||
"<strong>Duplicate entry in file</strong> <span class='badge badge-danger float-right'>" +
|
||||
err_count + "</span>";
|
||||
break;
|
||||
case 11:
|
||||
file_error_html +=
|
||||
"<strong>Rule conflict: Dependents not allowed</strong> <span class='badge badge-danger float-right'>" +
|
||||
err_count + "</span>";
|
||||
break;
|
||||
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>";
|
||||
break;
|
||||
case 13:
|
||||
file_error_html +=
|
||||
"<strong>Rule conflict: Twofold relationship found within family</strong> <span class='badge badge-danger float-right'>" +
|
||||
err_count + "</span>";
|
||||
break;
|
||||
|
||||
default:
|
||||
file_error_html += "";
|
||||
break;
|
||||
}
|
||||
|
||||
// console.log('file_error_html_1', file_error_html)
|
||||
|
||||
// file_error_html += (err_id == 1 ?
|
||||
// "<strong>Mandatory values missing</strong> <span class='badge badge-danger float-right'>" +
|
||||
@ -447,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;
|
||||
}
|
||||
|
||||
@ -516,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);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
//--------------------------------------------------------------------------------------
|
||||
</script>
|
||||
@ -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 -->
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css">
|
||||
<!-- Include DataTables Buttons CSS -->
|
||||
|
||||
@ -1,14 +1,26 @@
|
||||
<style>
|
||||
.modal-full-width {
|
||||
width: 95% !important;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.reload:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
<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;">Files</h4>
|
||||
</div>
|
||||
|
||||
<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;">Files</h4>
|
||||
</div>
|
||||
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
|
||||
</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">File name</th>
|
||||
@ -17,11 +29,12 @@
|
||||
<th class="font-weight-medium">Event</th>
|
||||
<th class="font-weight-medium">User/Time</th>
|
||||
<th class="font-weight-medium">Status</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</thead>
|
||||
|
||||
<tbody class="font-12">
|
||||
<?php
|
||||
<tbody class="font-12">
|
||||
<?php
|
||||
if(isset($fileList))
|
||||
{
|
||||
foreach ($fileList as $key => $file) { //print_r((json_decode($file['reason'])));
|
||||
@ -29,23 +42,258 @@
|
||||
// $reason = "{'date':'value data kbckl kcn/aksl'}";
|
||||
// echo $reason;
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1)?></b></td>
|
||||
<td><?php echo $file['file_name']?></td>
|
||||
<td><?php echo $file['short_name']?></td>
|
||||
<td><?php echo $file['policy_name']?></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 $file['status']; 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>";
|
||||
}?></td>
|
||||
</tr>
|
||||
<?php }}?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1)?></b></td>
|
||||
<td><?php echo $file['file_name']?></td>
|
||||
<td><?php echo $file['short_name']?></td>
|
||||
<td><?php echo $file['policy_name']?></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
|
||||
if($file['status'] == 'failed')
|
||||
{
|
||||
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>";
|
||||
|
||||
}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['file_name']; ?>"><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>
|
||||
<?php }}?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
</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);
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@ -238,6 +238,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <img src="<?= base_url()."public" ?>/assets/images/nhance-loader-fast.gif" height="40" width="40" alt="Loading..."> -->
|
||||
<!-- Begin page -->
|
||||
<div id="wrapper">
|
||||
|
||||
@ -515,7 +516,7 @@
|
||||
|
||||
<a href="<?= base_url('/dashboard/view')?>" class="logo logo-light text-center">
|
||||
<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 class="logo-lg">
|
||||
<img src="<?= base_url()."public"; ?>./assets/images/logo-light.png" alt="" height="20">
|
||||
|
||||
38
app/Views/view_file_upload_emp_list.php
Normal file
38
app/Views/view_file_upload_emp_list.php
Normal 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-->
|
||||
BIN
public/assets/images/nhance-loader-fast.gif
Normal file
BIN
public/assets/images/nhance-loader-fast.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
Loading…
Reference in New Issue
Block a user