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

This commit is contained in:
VENKATESHWARAN 2024-08-07 09:30:35 +05:30
commit a71f4c91ce
14 changed files with 267 additions and 69 deletions

View File

@ -49,7 +49,7 @@ $routes->group("/user", ["filter" => "authMVC"], function ($routes) {
$routes->group("/dashboard", ["filter" => "authMVC"], function ($routes) {
$routes->match(['get','post'],'view','DashboardController::dashboard');
$routes->get("view", "DashboardController::dashboard");
$routes->get('get-notification', 'DashboardController::getDashboardNotifications');
$routes->get('acknowledge-notification/(:segment)', 'DashboardController::acknowledgeMessage/$1');
$routes->get('get-pending-action', 'PendingActionsController::getPendingActions');
@ -146,7 +146,6 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
$routes->get("truncate/(:any)", "EmployeeController::truncateFileData/$1");
$routes->get("test-rack-rate", "EmployeeController::testRackRate");
$routes->post("test-rack-rate", "EmployeeController::testRackRate");
$routes->post("test-dependent", "EmployeeController::testCheckDependentConflict");
});
@ -272,16 +271,11 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
$routes->get("get_policy_type_for_base_policy/(:any)", "ClientController::getPolicyTypeForBasePolicy/$1");
$routes->get("get_client_details/(:any)", "ClientController::getClientDetails/$1");
$routes->get("featch_dashboard_data/(:any)", "DashboardController::featch_dashboard_data/$1");
$routes->get("remove_rack_rate/(:any)", "ClientController::removeRackRate/$1");
$routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1");
$routes->get("send_manual_remainder/(:any)", "DashboardController::sendManualRemainder/$1");
$routes->get("get_insurer_by_export_templete", "MasterController::getInsurerByExportTemplete");
$routes->get("copy_insurer_templete/(:any)", "MasterController::copyInsurerTemplete/$1");
});
$routes->cli('cli/processjob', 'JobWorker::processJob');
$routes->cli('cli/processjobs', 'JobWorker::processJobs');
$routes->cli('cli/updatePolicyEnrollmentStatus', 'DashboardController::updatePolicyEnrollmentStatus');
$routes->cli('cli/enrollment_status', 'JobWorker::enrollment_status');
$routes->get("processjob", "JobWorker::processJob");

View File

@ -1034,7 +1034,7 @@ class ClientController extends AdminController
'parents-in-law'=> $this->request->getPost('parents-in-law'),
];
if ($policy_grid_id == 1 || $policy_grid_id == 2 || $policy_grid_id == 6 || $policy_grid_id == 7) {
if ($policy_grid_id == 1 || $policy_grid_id == 2 ) {
$relation_data = [
'self' => 1,
'spouse' => 'NA',
@ -1220,7 +1220,6 @@ class ClientController extends AdminController
$age_from = $this->request->getPost('5_age_from[]');
$age_to = $this->request->getPost('5_age_to[]');
$unit = $this->request->getPost('5_unit[]');
for ($i = 0; $i < count($premium); $i++) {
$data['premium'] = str_replace(',', '', $premium[$i]);
$data['si'] = str_replace(',', '', $sum_insure[$i]);
@ -1427,7 +1426,7 @@ class ClientController extends AdminController
}
} catch (\Exception $e) {
echo 'Error: ' . $e->getMessage();
echo 'Error: ' . $e->getMessage(). ' at line no ' . $e->getLine();
}
}
@ -2038,10 +2037,10 @@ class ClientController extends AdminController
if ($record['open_for_enrollment'] == 0) {
$open_for_enrollment_update_value = 1;
$message = 'Enrollment Opened Successfully';
$message = 'Enrolment Opened Successfully';
} else if ($record['open_for_enrollment'] == 1) {
$open_for_enrollment_update_value = 0;
$message = 'Enrollment Closed Successfully';
$message = 'Enrolment Closed Successfully';
}
$data = $this->policesModel->getPolicyPremium($record['policy_id']);
@ -2219,7 +2218,7 @@ class ClientController extends AdminController
CASE
WHEN client_policy.inception_type = 1 THEN "File Upload"
WHEN client_policy.inception_type = 2 THEN "Enrollment"
WHEN client_policy.inception_type = 2 THEN "Enrolment"
ELSE "n/a"
END as inception_type,

View File

@ -1511,8 +1511,11 @@ class EmployeeController extends AdminController
$client_id = $json->client_id;
$policy_id = $json->policy_id;
$branch_id = $json->branch_id;
$unit_id = $json->unit_id;
$action = $json->action;
$family_code = $json->emp_code;
$tabledata = $json->data;
$existing_famility_details = [];
if(count($tabledata))
{
$family_details = [];
@ -1523,7 +1526,7 @@ class EmployeeController extends AdminController
{
$temp[0] = $row['column1'];//sno
$temp[1] = $row['column2'];//emp code
$temp[1] = $family_code != "" ? $family_code : $row['column2'];//emp code
$temp[2] = $row['column3'];//name
$temp[3] = $row['column4'];//DOB
$temp[4] = strtoupper($row['column5']);//Gender
@ -1540,14 +1543,29 @@ class EmployeeController extends AdminController
$temp[15] = '';//RFE
$temp[16] = '';//DOE
$temp[17] = '';//Unit
$temp[18] = $row['column11'];//unit
$temp[18] = $unit_id;//unit
$family_details[] = $temp;
}
}
}
// print_r($family_details);
// return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $family_details], 200);
if($action == 'dependent_addition')
{
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $family_code,client_id: $client_id,client_policy_id: $policy_id,emp_status: ['active'],policy_status:['active'],client_branch_id: [ $branch_id ]);
// ~dd($this->employeeModel->getLastQuery());
if(!count($existing_famility_details))
{
return $this->respond(['dataStatus' => false, 'code' => 404, 'data' => [],'messgae' => "No Data found for emp code $family_code"], 200);
}
//transsform familiy details from db columns to exxcel row with column indexs for checking remaining functionalitites
$existing_famility_details = transform_db_data_to_excel($existing_famility_details,[]);
// Kint::dump($existing_famility_details);
$family_details = array_merge($family_details,$existing_famility_details);
$family_details = data_group_by_family($family_details)[ $family_code ];// reason to call this again is bring self to first index of the array
// dd($family);
}
//get policy details
$policy_details = $this->clientPolicyModel->getPolicyDetails($client_id,$policy_id);
$policy_details = (array)$policy_details[0];
@ -1570,7 +1588,7 @@ class EmployeeController extends AdminController
}
}
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $data], 200);
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => ['new' => $data,'old' => $existing_famility_details], 200]);
}
}

View File

@ -560,7 +560,7 @@ class EmployeeRestController extends AdminController
// Set the header for download
$filename = $empData[0]['policy_name'].'-Enrollment.xlsx';
$filename = $empData[0]['policy_name'].'-Enrolment.xlsx';
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="' . $filename . '"');
header('Cache-Control: max-age=0');
@ -1015,6 +1015,17 @@ class EmployeeRestController extends AdminController
$self['data']['basic_cover_si'] = $employee_policy->basic_cover_si;
$array->mapped_family_floaters = $self;
$res = [];
array_push($res,$array);
$EDLIPolicy = $this->getAdditionalGPAPolicy($employeeData,6,$emp_code,$client_id,$client_branch_id);
if($EDLIPolicy){ array_push($res,$EDLIPolicy); }
$GTLIPolicy = $this->getAdditionalGPAPolicy($employeeData,7,$emp_code,$client_id,$client_branch_id);
if($GTLIPolicy){ array_push($res,$GTLIPolicy); }
return $this->respond(['status' => 'success','code' => 200,'data' => $res ], 200);
// Return result
if($this->request->getGet('policy') == 'GPA')
@ -1133,8 +1144,8 @@ class EmployeeRestController extends AdminController
$array->mapped_family_floaters = $data;
$array->type = "Group Medical Coverage";
$checkGmcParentsPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, policies.id as PolicyId , client_policy.policy_type_id as policy_type_id, policies.name as Policy_Name , client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type , client_policy.policy_terms as Policy_Terms')
->join('policies', 'client_policy.policy_id = policies.id', 'left')
$checkGmcParentsPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, policy_type.long_name as Policy_Name , client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type , client_policy.policy_terms as Policy_Terms')
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
->where('client_policy.policy_type_id', 3 )
->where('client_policy.is_addon', 1 )
->where('client_policy.client_id', $this->request->getGet('client_id') )
@ -1328,6 +1339,70 @@ class EmployeeRestController extends AdminController
}
public function getAdditionalGPAPolicy($empData,$policy_type,$emp_code,$client_id,$client_branch_id)
{
$checkPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type , client_policy.policy_terms as Policy_Terms , client_policy.enrolment_visibility')
->where('client_policy.policy_type_id', $policy_type )
->where('client_policy.is_addon', 1 )
->where('client_policy.client_id', $client_id )
->where('client_policy.client_branch_id', $client_branch_id )
->where('client_policy.is_active', 1 )
->get()
->getResult();
if($checkPolicyExist){
foreach ($checkPolicyExist as $key => $array) {
$decodedArray = json_decode($array->Policy_Terms);
$array->Policy_Terms = $decodedArray;
// Filter employee data where the family_floater_key is 'self'
$selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self');
$employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
$policyTypeData = $this->policyTypeModel->where('id',$policy_type)->get()->getRow();
$array->type = $policyTypeData->policy_type;
$array->Policy_Name = $policyTypeData->long_name;
if($employee_policy){
if($employee_policy->tpa_id != null){
$array->eCardDownload = base_url('download-e-card/') . $employee_policy->rand_string;
}else{ $array->eCardDownload = null; }
$self['is_value_exist'] = true;
$self['data']['family_floater_key'] = 'self';
$self['data']['employee_id'] = $selfData[0]['id'];
$self['data']['relationship'] = 'Self';
$self['data']['name'] = $selfData[0]['name'];
$self['data']['dob'] = $this->convertDateFormatDMY($selfData[0]['dob']);
$self['data']['mobile'] = $selfData[0]['mobile'];
$self['data']['client_policy_id'] = $array->ClientPolicyId;
$self['data']['basic_cover_si'] = $employee_policy->basic_cover_si;
$array->mapped_family_floaters = $self;
if($array->enrolment_visibility == 1)
return $array;
else
return false;
}else{
return false;
}
}
}
}
public function getGTLIPolicy($empData,$emp_code,$client_id,$client_branch_id)
{
}
public function FloterConvertion($array){
$result = [];
@ -1473,8 +1548,9 @@ class EmployeeRestController extends AdminController
}
$responce['policy_name'] = $this->policesModel->where('id',$array['policy_id'])->get()->getRow()->name;
$policyTypeData = $this->policyTypeModel->where('id',$array['policy_type_id'])->get()->getRow();
$responce['policy_name'] = $policyTypeData->long_name;
$responce['type'] = $policyTypeData->policy_type;
$responce['SlabRates'] = $uniqueData;
$responce['GridMaster'] = $getSlabAndGridData['grid_master'];
$responce['client_id'] = $array['client_id'];
@ -1934,8 +2010,8 @@ class EmployeeRestController extends AdminController
$data['balance'] = count($data['depositData']) ? $data['depositData'][0]->balance : 0;
$data['policyDetails'] = [];
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, policies.id as policy_id , client_policy.policy_type_id as policy_type_id, policies.name as policy_name , client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type ')
->join('policies', 'client_policy.policy_id = policies.id', 'left')
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, client_policy.policy_type_id as policy_type_id, client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type ')
->where('client_policy.insurer_id', $value['insurerId'] )
->where('client_policy.client_id', $this->request->getGet('client_id') )
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
@ -1945,8 +2021,9 @@ class EmployeeRestController extends AdminController
// dd( $ClientPolicyData);
foreach ($ClientPolicyData as $key => $value)
{
$value['type'] = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow()->policy_type;
$policyTypeData = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow();
$value['type'] = $policyTypeData->policy_type;
$value['policy_name'] = $policyTypeData->long_name;
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0,branch_id:$this->request->getGet('client_branch_id'));
$enrolledCount = 0;
$draftCount = 0;

View File

@ -1654,6 +1654,10 @@ class EmployeeServiceController extends AdminController
}// if end
}// is array check end
else
{
$this->myLogger->logme('error','######Incoming value is not an array');
}
}// for end
}//function end

View File

@ -6,6 +6,7 @@ namespace App\Controllers;
use App\Models\JobModel;
use App\Models\FileModel;
class JobWorker extends AdminController
{
const STATUS_DONE = 'done';
@ -287,23 +288,24 @@ class JobWorker extends AdminController
try
{
$response = $jobHandler($payload,$job->id);
$job_status = self::STATUS_DONE;
}
catch(\Exception $e)
{
$job_status = self::STATUS_FAILED;
$runtime = $runtime === null ? microtime(true) - $start : $runtime;
$response = ['file_name' => $e->getFile(),'error' => $e->getMessage(),'line_no' => $e->getLine(),'info' => $e->getTraceAsString()];
$response = ['file_name' => $e->getFile(),'error' => $e->getMessage(),'line_no' => $e->getLine(),'info' => $e->getTraceAsString(),'scope' => 'task failed'];
}
$runtime = microtime(true) - $start;
$job_status = self::STATUS_DONE;
}
catch (\Exception $e)
{
//die();
$job_status = self::STATUS_FAILED;
$runtime = $runtime === null ? microtime(true) - $start : $runtime;
$response = ['file_name' => $e->getFile(),'error' => $e->getMessage(),'line_no' => $e->getLine(),'info' => $e->getTraceAsString()];
$response = ['file_name' => $e->getFile(),'error' => $e->getMessage(),'line_no' => $e->getLine(),'info' => $e->getTraceAsString(),'scope' => 'worker failed'];
}
$db->query("UPDATE jobs SET status=?, run_time=?, response=? WHERE id=? AND uuid=?", [
@ -313,6 +315,21 @@ class JobWorker extends AdminController
$job->id,$job->uuid
]);
//update file status if this job is directly linked with a file id
if($job_status == self::STATUS_FAILED)
{
//get file from job payload
if(array_key_exists('file_id', $payload) && $payload['file_id'] != NULL && $payload['file_id'] != "" && is_numeric($payload['file_id']) && count($payload) == 1)
{
$fileModel = new FileModel();
$fileModel->where('id', $payload['file_id'])
->set(['status' => 'failed','reason' => json_encode(['error_type' => 0,'error_summary' => [0],'error_data' => 'System Error, please contact Admin/Support team']) ])
->update();
}
}
// echo "Job $job->id $job_status. Response - $response \n";
// echo "Job $job->id $job_status \n";
SELF::streamOutput("Job $job->id $job_status \n");

View File

@ -149,9 +149,9 @@ class EmployeeModel extends Model
{
return $this->db->table('employee_polices')
->select(' policies.name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string') // Select all columns from both tables
->select(' policy_type.long_name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string') // Select all columns from both tables
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
->join('policies', 'policies.id = client_policy.policy_id')
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
->where('client_policy.policy_status', 1)
->where('employee_polices.employee_id', $id)
->get()

View File

@ -241,6 +241,10 @@ table.dataTable thead th {
$('#opening_bal').val('');
$('#CDMasterForm')[0].reset();
$('#CDMasterForm').parsley().reset();
$('#client_id').prop("disabled", false);
$('#insurer_id').prop("disabled", false);
$('#cd_ac_no').prop("disabled", false);
})
@ -261,9 +265,12 @@ table.dataTable thead th {
$('#CDMasterForm').attr('action', '<?php echo base_url('master/cash_deposite/edit');?>');
$('#CD_Master_ID').val(res.data.id);
$('#client_id').val(res.data.client_id).change();
$('#client_id').prop("disabled", true);
$('#insurer_id').val(res.data.insurer_id).change();
$('#insurer_id').prop("disabled", true);
$('#opening_date').val(res.data.opening_date);
$('#cd_ac_no').val(res.data.cd_ac_no);
$('#cd_ac_no').prop("disabled", true);
$('#opening_bal').val(res.data.opening_bal);
$('#btnSubmit').html('Update');
@ -279,6 +286,10 @@ table.dataTable thead th {
$('#cd_ac_no').change(function(){
var cd_ac_no = $(this).val();
console.log(cd_ac_no +'-'+cd_ac_no.length);
cd_ac_no = cd_ac_no.trim();
console.log(cd_ac_no +'-'+cd_ac_no.length);
$.ajax({
url: '<?php echo base_url('util/check_cd_ac_no/');?>'+cd_ac_no,

View File

@ -129,7 +129,7 @@
<th class="font-weight-medium"><label> Insurer </label></th>
<th class="font-weight-medium"><label> TPA </label></th>
<th class="font-weight-medium"><label> Policy Validity </label></th>
<th class="font-weight-medium"><label> Enrollment Status </label></th>
<th class="font-weight-medium"><label> Enrolment Status </label></th>
<th class="font-weight-medium"><label> Policy Status </label></th>
</tr>
</thead>

View File

@ -312,13 +312,13 @@
if (item.open_for_enrollment == 1) {
enrollmentStatus = '<a href="#" data-id="' + item.id + '" id="' + item.policy_id +
'" class="btnOpenEnroll" data-toggle="tooltip" data-placement="left" title="Click To Close Enrollment">Open</a>'
'" class="btnOpenEnroll" data-toggle="tooltip" data-placement="left" title="Click To Close Enrolment">Open</a>'
} else if (item.open_for_enrollment == 0) {
enrollmentStatus =
'<a href="#" data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" data-id="' +
'<a href="#" data-toggle="tooltip" data-placement="top" title="Click To Open Enrolment" data-id="' +
item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
}
@ -341,7 +341,7 @@
<td>${policy_name_data}</td>
<td>${item.branch_name ? item.branch_name : ' - '}</td>
<td>${tpaValue}</td>
<td>${(item.open_date)} / ${(item.close_date)}</td>
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
<td style="text-align: center;">${(enrollmentStatus)}</td>
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
<td>
@ -551,7 +551,7 @@
if (item.open_for_enrollment == 1) {
enrollmentStatus =
'<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrollment" href="#" data-id="' +
'<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrolment" href="#" data-id="' +
item.id + '" id="' + item.policy_id +
'" class="btnOpenEnroll">Open</a>'
@ -559,7 +559,7 @@
} else if (item.open_for_enrollment == 0) {
enrollmentStatus =
'<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" href="#" data-id="' +
'<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrolment" href="#" data-id="' +
item.id + '" id="' + item.policy_id +
'" class="btnOpenEnroll">Closed</a>'
@ -982,7 +982,7 @@
$('.btnOpenEnroll').each(function(index, element) {
if ($(element).data('id') == client_policy_id) {
$(element).html(
'<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrollment" href="#" data-id="' +
'<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrolment" href="#" data-id="' +
res.client_policy_data.id +
'" id="' + res.client_policy_data
.policy_id +
@ -995,7 +995,7 @@
$('.btnOpenEnroll').each(function(index, element) {
if ($(element).data('id') == client_policy_id) {
$(element).html(
'<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" href="#" data-id="' +
'<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrolment" href="#" data-id="' +
res.client_policy_data.id +
'" id="' + res.client_policy_data
.policy_id +

View File

@ -476,6 +476,10 @@ function fetchFileError(file_id) {
var err_id = parseInt(key);
var err_count = file_error_data['error_summary'][key];
switch (err_id) {
case 0:
file_error_html +=
"<strong>"+file_error_data['error_data']+"</strong>";
break;
case 1:
file_error_html +=
"<strong>Mandatory values missing</strong> <span class='badge badge-danger float-right'>" +
@ -562,7 +566,7 @@ function fetchFileError(file_id) {
// console.log('file_error_html_2', file_error_html)
}
if (err_id != 5 && err_id != 6) {
if (err_id != 5 && err_id != 6 && err_id != 0) {
file_error_html += (file_error_html != "" ?
"<a href ='<?php echo base_url()?>" +
"employee/excel_error/" + file_id +
@ -1000,7 +1004,12 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
}else{
$("#event_type").removeAttr("multiple");
$("#event_type").attr("name", "event_type");
$("#event_type").select2('destroy');
if ($('event_type').data('select2')) {
$('event_type').select2('destroy');
}
// $("#event_type").select2('destroy');
}

View File

@ -100,7 +100,7 @@
<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>
<?php if ($file['status'] == 'success') { ?>
<a data-id="<?php echo $file['id'] ?>" class="dropdown-item truncate" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Truncate</a>
<a data-id="<?php echo $file['id'] ?>" class="dropdown-item truncate2" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Truncate</a>
<?php } ?>
</div>
@ -246,7 +246,7 @@ $('body').on('click', '.upload_button', function() {
})
$('body').on('click', '.truncate', function(event) {
$('body').on('click', '.truncate2', function(event) {
event.preventDefault();
// console.log(event);
var fileId = JSON.parse(this.getAttribute('data-id'));

View File

@ -36,91 +36,91 @@ const excel_headers = {
1: {
1: {
"unit": "Units",
"unit": "Unit",
"sum_insured": "Sum Insured",
},
2: {
"unit": "Units",
"unit": "Unit",
"basic_pay": "Basic Pay",
},
3: {
"unit": "Units",
"unit": "Unit",
"band_or_grade": "Band or Grade",
"sum_insured": "Sum Insured",
}
},
2: {
"unit": "Units",
"unit": "Unit",
"sum_insured": "Sum Insured",
"premium": "Premium"
},
3: {
"unit": "Units",
"unit": "Unit",
"sum_insured": "Sum Insured",
"premium": "Premium"
},
4: {
"unit": "Units",
"unit": "Unit",
"sum_insured": "Sum Insured",
"from_age": "From Age",
"to_age": "To Age",
"premium": "Premium"
},
5: {
"unit": "Units",
"unit": "Unit",
"sum_insured": "Sum Insured",
"from_age": "From Age",
"to_age": "To Age",
"premium": "Premium"
},
6: {
"unit": "Units",
"unit": "Unit",
"sum_insured": "Sum Insured",
"from_age": "From Age",
"to_age": "To Age",
"premium": "Premium"
},
7: {
"unit": "Units",
"unit": "Unit",
"sum_insured": "Sum Insured",
"from_age": "From Age",
"to_age": "To Age",
"premium": "Premium"
},
8: {
"unit": "Units",
"unit": "Unit",
"sum_insured": "Sum Insured",
"grade": "Grade",
"premium": "Premium"
},
9: {
"unit": "Units",
"unit": "Unit",
"sum_insured": "Sum Insured",
"premium": "Premium"
},
10: {
"unit": "Units",
"unit": "Unit",
"sum_insured": "Sum Insured",
"from_age": "From Age",
"to_age": "To Age",
"premium": "Premium"
},
11: {
"unit": "Units",
"unit": "Unit",
"sum_insured": "Sum Insured",
"grade": "Grade",
"premium": "Premium",
"max_si": "Max Si"
},
12: {
"unit": "Units",
"unit": "Unit",
"sum_insured": "Sum Insured",
"relationship": "Relationship",
"premium": "Premium"
},
13: {
"unit": "Units",
"unit": "Unit",
"sum_insured": "Sum Insured",
"relationship": "Relationship",
"from_age": "From Age",
@ -286,8 +286,10 @@ function generateTable(unique_id) {
// console.log('Excepted HEADERS' , JSON.stringify(expectedHeader))
if (secondKey != 2) {
if (secondKey != 2 && secondKey != undefined) {
console.log('expectedHeader' + secondKey + '-' + formatType);
console.log(expectedHeader);
console.log(excel_headers[formatType]);
if (JSON.stringify(header) !== JSON.stringify(expectedHeader)) {
const expectedHeaders = JSON.stringify(Object.values(excel_headers[formatType][secondKey]));
const receivedHeaders = JSON.stringify(columnsToKeep.map(i => rows[0].split("\t")[i]));

View File

@ -78,10 +78,21 @@
</div>
<div class="row">
<!-- <div class="col-6" style="text-align: right;">
<a href="<?= base_url("employee/endorsement-list"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
</div> -->
<div class="col-12" style="text-align: right;">
<div class="form-group col-md-3">
<label>Action</label> <br />
<select name="action" class="form-control" id="action">
<!-- <option value="0">Select</option> -->
<option value="inception" selected="selected">Inception/Addition</option>
<option value="dependent_addition">Dependent Addition</option>
</select>
</div>
<div class="form-group col-md-2">
<label>Employee Code</label> <br />
<input type="text" class="form-control" id="emp_code" name="emp_code" value="">
</div>
<div class="col-6" style="text-align: right;">
<a href="<?= base_url("#"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="checkDependentConflict(event);" >Check Dependent conflict</a>
<a href="<?= base_url("#"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="calculatePremium(event);" >calc premium</a>
<a href="#" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="addRowToTable();">+</a>
@ -147,6 +158,34 @@
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="oldrestable" style="display: none;">
<thead class="bg-light">
<tr>
<th class="small-width">SNO</th>
<th class="small-width">Emp code</th>
<th class="large-width">Name</th>
<th class="medium-width">DOB</th>
<th class="medium-width">Relation</th>
<th class="large-width">Rack rate name</th>
<th class="small-width">Grid ID</th>
<th class="small-width">Is Self</th>
<th class="small-width">Premium type</th>
<th class="large-width">SI</th>
<th class="medium-width">premium</th>
<th class="small-width">Policy days</th>
<th class="small-width">no of days</th>
<th class="medium-width">Rata premium</th>
<th class="medium-width">GST</th>
</tr>
</thead>
<tbody id='oldrestablebody'>
</tbody>
</table>
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="restable">
<thead class="bg-light">
<tr>
@ -540,16 +579,31 @@
var policy_id = $('#policies').val();
var branch_id = $('#branch_id').val();
var unit_id = $('#unit_id').val();
var action = $('#action').val();
var emp_code = $('#emp_code').val();
console.log(client_id + '-' + policy_id);
if (client_id == '0' || policy_id == '0') {
alert('Please select all values in dropdowns.');
return;
}
if (action == 'dependent_addition') {
if(emp_code.trim() == "")
{
alert('Enter emp code');
return;
}
}
// return;
var queryParams = {
client_id: client_id,
policy_id: policy_id,
branch_id: branch_id,
unit_id: unit_id,
action: action,
emp_code: emp_code,
data: tabledata,
};
@ -577,8 +631,10 @@
displayData(response.data);
} else if (response.code === 404 && response.dataStatus === false) {
console.error('no data found', response);
alert(response.messgae);
} else {
console.error('Something went wrong!');
alert('Something went wrong!');
}
},
error: function(xhr, status, error) {
@ -659,8 +715,19 @@
function displayData(data)
{
const tableBody = document.getElementById("restablebody");
$("#restablebody").empty();
displayTable(data.new,"restablebody");
if(data.old.length())
{
$('#oldrestablebody').prop('display','block');
displayTable(data.new,"oldrestablebody");
}
}
function displayTable(data,tableID)
{
var old_data = data.old;
const tableBody = document.getElementById(tableID);
$(("#".tableID)).empty();
const existingRowCount = tableBody.rows.length;
for(i = 0; i < data.length; i++)
{