MERGE_LIVE_OPPORTUNITY_CLAIM_HISTORY&VISIT_ONBOARD_RELATED
This commit is contained in:
commit
f02e3fc968
@ -49,6 +49,7 @@ $routes->get("updatajson", "EmpDataServiceController::updatajson");
|
|||||||
$routes->get("view", "EmployeeController::viewECard/$1");
|
$routes->get("view", "EmployeeController::viewECard/$1");
|
||||||
$routes->get("checkWellnessOnboardStatus/(:any)", "EmployeeController::checkWellnessOnboardStatus/$1");
|
$routes->get("checkWellnessOnboardStatus/(:any)", "EmployeeController::checkWellnessOnboardStatus/$1");
|
||||||
$routes->get("initiateWellnessOnboard/(:any)", "EmployeeController::initiateWellnessOnboard/$1");
|
$routes->get("initiateWellnessOnboard/(:any)", "EmployeeController::initiateWellnessOnboard/$1");
|
||||||
|
$routes->get("resetWellnessOnboard/(:any)", "EmployeeController::resetWellnessOnboard/$1");
|
||||||
$routes->get("exportQCRandRFQ/(:any)", "LeadsController::exportQCRandRFQ/$1");
|
$routes->get("exportQCRandRFQ/(:any)", "LeadsController::exportQCRandRFQ/$1");
|
||||||
$routes->get("testMailAttachments", "ClientController::testMailAttachments");
|
$routes->get("testMailAttachments", "ClientController::testMailAttachments");
|
||||||
$routes->get("updatePolicyTermsKey", "ClientController::updatePolicyTermsKey");
|
$routes->get("updatePolicyTermsKey", "ClientController::updatePolicyTermsKey");
|
||||||
|
|||||||
@ -7312,6 +7312,8 @@ class ClientController extends AdminController
|
|||||||
// dd($res);
|
// dd($res);
|
||||||
|
|
||||||
$employeeController = new EmployeeController();
|
$employeeController = new EmployeeController();
|
||||||
|
// $payload = json_decode('{"client_policy_id":"6272"}', true);
|
||||||
|
// $response = $employeeController->initiateWellnessOnboardJob($payload); dd($response);
|
||||||
// $response = $employeeController->getEmployeeEcardFromTmpFolderAndZipToS3(json_decode('{"batch_no":2,"last_emp_policy_id":"13218","folder_name":"bulk_ecards_IOCL-77448855996699885555_2026-02-05_09-32-22","processed_in_this_batch_data_count":7,"pdf_count":0,"hr_id":"1"}', true));
|
// $response = $employeeController->getEmployeeEcardFromTmpFolderAndZipToS3(json_decode('{"batch_no":2,"last_emp_policy_id":"13218","folder_name":"bulk_ecards_IOCL-77448855996699885555_2026-02-05_09-32-22","processed_in_this_batch_data_count":7,"pdf_count":0,"hr_id":"1"}', true));
|
||||||
// $response = $employeeController->bulkEcardDownloadAsZipFromS3(json_decode('{"client_policy_id":"6066","hr_id":"1"}', true));
|
// $response = $employeeController->bulkEcardDownloadAsZipFromS3(json_decode('{"client_policy_id":"6066","hr_id":"1"}', true));
|
||||||
// dd($response);
|
// dd($response);
|
||||||
|
|||||||
@ -896,7 +896,7 @@ class EmployeeController extends AdminController
|
|||||||
session()->setFlashdata('success', 'File Uploaded Successfully File is being validated.');
|
session()->setFlashdata('success', 'File Uploaded Successfully File is being validated.');
|
||||||
return redirect()->to(base_url('employee/upload'));
|
return redirect()->to(base_url('employee/upload'));
|
||||||
} else {
|
} else {
|
||||||
session()->setFlashdata($return['status'], $return['message']);
|
session()->setFlashdata($return['status'] ?? 'error', $return['message'] ?? 'Something went wrong! Try Later');
|
||||||
return redirect()->to(base_url('employee/upload'));
|
return redirect()->to(base_url('employee/upload'));
|
||||||
}
|
}
|
||||||
} else if ($event_type == 'correction') {
|
} else if ($event_type == 'correction') {
|
||||||
@ -3623,6 +3623,21 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
public function checkWellnessOnboardStatus($client_policy_id)
|
public function checkWellnessOnboardStatus($client_policy_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$fetch_onboarded_employees = $this->request->getGet('fetch_onboarded_employees') ?? false;
|
||||||
|
|
||||||
|
if($fetch_onboarded_employees){
|
||||||
|
$data = $this->employeePolicyModel->select('employee_polices.*')
|
||||||
|
->where('employee_polices.is_active', 1)
|
||||||
|
->where('employee_polices.status', 'active')
|
||||||
|
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
|
->where('employee_polices.wellness_onboard !=', '0')
|
||||||
|
->findAll();
|
||||||
|
return $this->respond(['status' => true, 'code' => 200, 'data' => count($data)], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// echo $client_policy_id;die();
|
// echo $client_policy_id;die();
|
||||||
$data = $this->employeePolicyModel->select('employee_polices.*,emp.name,emp.relationship,emp.emp_code,emp.name,emp.email_corporate,emp.mobile,emp.dob,cp.policy_no,cp.wellness_plan_id,cp.wellness_vendor_id,cp.policy_start_date as cp_policy_start_date,cp.policy_end_date,cls.short_name')
|
$data = $this->employeePolicyModel->select('employee_polices.*,emp.name,emp.relationship,emp.emp_code,emp.name,emp.email_corporate,emp.mobile,emp.dob,cp.policy_no,cp.wellness_plan_id,cp.wellness_vendor_id,cp.policy_start_date as cp_policy_start_date,cp.policy_end_date,cls.short_name')
|
||||||
->join('client_policy cp', 'cp.id = employee_polices.client_policy_id')
|
->join('client_policy cp', 'cp.id = employee_polices.client_policy_id')
|
||||||
@ -3656,9 +3671,9 @@ class EmployeeController extends AdminController
|
|||||||
// return $this->respond(['status' => true, 'code' => 200, 'message' => 'Inception and Member data comparision skiped successfully!'], 200);
|
// return $this->respond(['status' => true, 'code' => 200, 'message' => 'Inception and Member data comparision skiped successfully!'], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initiateWellnessOnboard($client_policy_id)
|
public function initiateWellnessOnboard($client_policy_id, $emp_code = null)
|
||||||
{
|
{
|
||||||
$r = Jobs::addJob(['job_name' => 'initiateWellnessOnboardJob','payload' => ['client_policy_id' => $client_policy_id]]);
|
$r = Jobs::addJob(['job_name' => 'initiateWellnessOnboardJob','payload' => ['client_policy_id' => $client_policy_id, 'emp_code' => $emp_code ?? null ]]);
|
||||||
// $this->initiateWellnessOnboardJob(['client_policy_id' => $client_policy_id]);
|
// $this->initiateWellnessOnboardJob(['client_policy_id' => $client_policy_id]);
|
||||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Process started'], 200);
|
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Process started'], 200);
|
||||||
}
|
}
|
||||||
@ -3774,6 +3789,7 @@ class EmployeeController extends AdminController
|
|||||||
public function initiateWellnessOnboardJob($arr)
|
public function initiateWellnessOnboardJob($arr)
|
||||||
{
|
{
|
||||||
$client_policy_id = $arr['client_policy_id'] ?? null;
|
$client_policy_id = $arr['client_policy_id'] ?? null;
|
||||||
|
$emp_code = $arr['emp_code'] ?? null;
|
||||||
|
|
||||||
if (!$client_policy_id) {
|
if (!$client_policy_id) {
|
||||||
log_message('error', '[WellnessOnboard] Missing client_policy_id in payload');
|
log_message('error', '[WellnessOnboard] Missing client_policy_id in payload');
|
||||||
@ -3789,7 +3805,7 @@ class EmployeeController extends AdminController
|
|||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
// 1. FETCH DATA
|
// 1. FETCH DATA
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
$data = $this->employeePolicyModel
|
$query = $this->employeePolicyModel
|
||||||
->select('employee_polices.*,
|
->select('employee_polices.*,
|
||||||
emp.name, emp.relationship, emp.emp_code, emp.email_corporate,
|
emp.name, emp.relationship, emp.emp_code, emp.email_corporate,
|
||||||
emp.mobile, emp.dob, emp.gender,
|
emp.mobile, emp.dob, emp.gender,
|
||||||
@ -3817,8 +3833,13 @@ class EmployeeController extends AdminController
|
|||||||
->orWhere('cp.wellness_vendor_id =', 0)
|
->orWhere('cp.wellness_vendor_id =', 0)
|
||||||
->groupEnd()
|
->groupEnd()
|
||||||
->where('cp.policy_status', 1)
|
->where('cp.policy_status', 1)
|
||||||
->where('cp.is_active', 1)
|
->where('cp.is_active', 1);
|
||||||
->findAll($perPage, $offset);
|
|
||||||
|
if(!empty($emp_code)){
|
||||||
|
$query->where('emp.emp_code', trim($emp_code));
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $query->findAll($perPage, $offset);
|
||||||
|
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
// 2. NO DATA FOUND
|
// 2. NO DATA FOUND
|
||||||
@ -3852,7 +3873,7 @@ class EmployeeController extends AdminController
|
|||||||
foreach ($families as $empCode => $members) {
|
foreach ($families as $empCode => $members) {
|
||||||
$familiesPayload[$empCode] = $this->buildFamilyPayload($empCode, $members);
|
$familiesPayload[$empCode] = $this->buildFamilyPayload($empCode, $members);
|
||||||
}
|
}
|
||||||
log_message('error', "[WellnessOnboard] Page {$page} API calls done. Families processed: " . json_encode($familiesPayload));
|
log_message('error', "[WellnessOnboard] Page {$page} API calls done. Families processed: " . json_encode($familiesPayload));
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
// 5. SEND TO WELLNESS API
|
// 5. SEND TO WELLNESS API
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
@ -3885,6 +3906,33 @@ class EmployeeController extends AdminController
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function resetWellnessOnboard($client_policy_id, $emp_code = null)
|
||||||
|
{
|
||||||
|
if(!empty($emp_code)){
|
||||||
|
|
||||||
|
$employees = db_connect()->table('employees')
|
||||||
|
->select('id')
|
||||||
|
->where('emp_code', trim($emp_code))
|
||||||
|
->get()
|
||||||
|
->getResult();
|
||||||
|
|
||||||
|
if (!empty($employees)) {
|
||||||
|
$employeeIds = array_column($employees, 'id');
|
||||||
|
|
||||||
|
$this->employeePolicyModel
|
||||||
|
->where('client_policy_id', $client_policy_id)
|
||||||
|
->whereIn('employee_id', $employeeIds)
|
||||||
|
->set('wellness_onboard', '0')
|
||||||
|
->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$this->employeePolicyModel->where('client_policy_id', $client_policy_id)->set('wellness_onboard', '0')->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Wellness onboard resetted successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ------------------ FUNCTION TO BUILD FAMILY PAYLOAD ------------------
|
# ------------------ FUNCTION TO BUILD FAMILY PAYLOAD ------------------
|
||||||
|
|||||||
@ -3560,7 +3560,7 @@ class TicketController extends BaseController
|
|||||||
{
|
{
|
||||||
$fileId = $this->claimFilesModel->insert([
|
$fileId = $this->claimFilesModel->insert([
|
||||||
'ticket_id' => $ticketId,
|
'ticket_id' => $ticketId,
|
||||||
'ticket_type' => $ticketTypeId,
|
// 'ticket_type' => $ticketTypeId,
|
||||||
'file_type' => 3,
|
'file_type' => 3,
|
||||||
'doc_name' => $docName,
|
'doc_name' => $docName,
|
||||||
'file_name' => $uploadedFile['file_name'],
|
'file_name' => $uploadedFile['file_name'],
|
||||||
|
|||||||
@ -133,6 +133,7 @@ class UserModel extends Model
|
|||||||
->select('user_profiles.*')
|
->select('user_profiles.*')
|
||||||
->select('roles.role as user_role')
|
->select('roles.role as user_role')
|
||||||
->join('roles', 'roles.id = user_profiles.role')
|
->join('roles', 'roles.id = user_profiles.role')
|
||||||
|
->where('user_profiles.is_active', 1)
|
||||||
->get()
|
->get()
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
}
|
}
|
||||||
@ -143,6 +144,7 @@ class UserModel extends Model
|
|||||||
->select('roles.role as user_role')
|
->select('roles.role as user_role')
|
||||||
->join('roles', 'roles.id = user_profiles.role')
|
->join('roles', 'roles.id = user_profiles.role')
|
||||||
->join('user_teams', 'user_teams.user_id = user_profiles.id')
|
->join('user_teams', 'user_teams.user_id = user_profiles.id')
|
||||||
|
->where('user_profiles.is_active', 1)
|
||||||
->get()
|
->get()
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
|
|
||||||
|
|||||||
@ -361,6 +361,12 @@ $gst_total = 0;
|
|||||||
<a class="dropdown-item" onclick="showReGenerateConfirmation('<?= $employee['client_policy_id'];?>', '<?= $employee['emp_code'];?>')" ><i class="mdi mdi-refresh mr-2 text-muted font-18 vertical-middle"></i>Re-Generate E-Card</a>
|
<a class="dropdown-item" onclick="showReGenerateConfirmation('<?= $employee['client_policy_id'];?>', '<?= $employee['emp_code'];?>')" ><i class="mdi mdi-refresh mr-2 text-muted font-18 vertical-middle"></i>Re-Generate E-Card</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if(strtolower($employee['relationship']) == 'self' && $employee['wellness_onboard'] == '0') { ?>
|
||||||
|
<a class="dropdown-item" onclick="initiateWellnessOnboard('<?= $employee['client_policy_id'];?>', '<?= $employee['emp_code'];?>')" ><i class="mdi mdi-heart-pulse mr-2 text-muted font-18 vertical-middle"></i>Initiate Wellness Onboard</a>
|
||||||
|
<?php }else if(strtolower($employee['relationship']) == 'self' && $employee['wellness_onboard'] != '0') { ?>
|
||||||
|
<a class="dropdown-item" onclick="resetWellnessOnboard('<?= $employee['client_policy_id'];?>', '<?= $employee['emp_code'];?>')" ><i class="mdi mdi-restart mr-2 text-muted font-18 vertical-middle"></i>Reset Wellness Onboard</a>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -81,7 +81,7 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label>Policy</label> <br />
|
<label>Policy</label> <br />
|
||||||
<select class="form-control" id="policies">
|
<select class="form-control" id="policies" onchange="getOnboardedemployees(event)">
|
||||||
<option value="0">Select</option>
|
<option value="0">Select</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -90,7 +90,7 @@
|
|||||||
<label>Status</label> <br />
|
<label>Status</label> <br />
|
||||||
<select class="form-control" name="status2[]" id="status2" multiple>
|
<select class="form-control" name="status2[]" id="status2" multiple>
|
||||||
<option value="0">Select</option>
|
<option value="0">Select</option>
|
||||||
<?php foreach ($status as $key => $value) { ?>
|
<?php foreach ($status ?? [] as $key => $value) { ?>
|
||||||
<option value="<?= $key ?>"
|
<option value="<?= $key ?>"
|
||||||
<?php
|
<?php
|
||||||
if ((!isset($getData) || in_array('active', $getData['status'])) && $key == 'active') {
|
if ((!isset($getData) || in_array('active', $getData['status'])) && $key == 'active') {
|
||||||
@ -116,6 +116,15 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-end">
|
<div class="row justify-content-end">
|
||||||
|
|
||||||
|
<div id="resetWellnessOnboardBtn_div" class="col-auto" style="display: none;">
|
||||||
|
<!-- <div id="categoryFilter_12"> -->
|
||||||
|
<a href="#" id="resetWellnessOnboardBtn" class="btn btn-primary waves-effect waves-light"
|
||||||
|
style="background-color: #F5FFFF; color:black; border:1px solid #00999E;"
|
||||||
|
onclick="resetWellnessOnboard(this)">Wellness Onboard Reset</a>
|
||||||
|
<!-- </div> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<!-- <div id="categoryFilter_12"> -->
|
<!-- <div id="categoryFilter_12"> -->
|
||||||
<a href="#" class="btn btn-primary waves-effect waves-light"
|
<a href="#" class="btn btn-primary waves-effect waves-light"
|
||||||
@ -148,6 +157,7 @@
|
|||||||
|
|
||||||
<!-- end row -->
|
<!-- end row -->
|
||||||
<div id="loader" class="loader" style="display:none;">SPINNER</div>
|
<div id="loader" class="loader" style="display:none;">SPINNER</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// document.addEventListener("DOMContentLoaded", function () {
|
// document.addEventListener("DOMContentLoaded", function () {
|
||||||
// const table = document.getElementById("tickets-table");
|
// const table = document.getElementById("tickets-table");
|
||||||
@ -454,93 +464,6 @@
|
|||||||
$('#status2').trigger('change');
|
$('#status2').trigger('change');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// $(document).ready(function() {
|
|
||||||
// console.log("document loaded");
|
|
||||||
// //fetchClientPolicies();
|
|
||||||
// });
|
|
||||||
|
|
||||||
// $(window).on("load", function() {
|
|
||||||
// console.log("window loaded");
|
|
||||||
// fetchClientPolicies();
|
|
||||||
// });
|
|
||||||
|
|
||||||
// function fetchClientPolicies() {
|
|
||||||
// $('#loader').show();
|
|
||||||
// var apiURL = '<?php echo base_url(); ?>' + 'util/clients-with-policies';
|
|
||||||
// console.log('fetchClientPolicies');
|
|
||||||
// // console.log(apiURL);
|
|
||||||
// $.ajax({
|
|
||||||
// url: apiURL,
|
|
||||||
// method: 'GET',
|
|
||||||
// headers: {
|
|
||||||
// "Content-Type": "application/json",
|
|
||||||
// "X-Requested-With": "XMLHttpRequest"
|
|
||||||
// },
|
|
||||||
// success: function(response) {
|
|
||||||
// // console.log(response.code);
|
|
||||||
// // console.log(response.dataStatus);
|
|
||||||
// // console.log(response.data);
|
|
||||||
// if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
|
||||||
// try {
|
|
||||||
// clientPolicies = (response.data);
|
|
||||||
|
|
||||||
// response.data.forEach(policy => {
|
|
||||||
// // console.log('policies', policy.policies);
|
|
||||||
// policy.policies.forEach(p => {
|
|
||||||
// clientPoliciesWithBranch.policies.push(p);
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
|
|
||||||
// // console.log('1',clientPolicies);
|
|
||||||
// appendClients(clientPolicies);
|
|
||||||
|
|
||||||
// //this function for reselect the policy
|
|
||||||
// setTimeout(function() {
|
|
||||||
// if (client_id != 0) {
|
|
||||||
// var foundPolicies = clientPolicies.find(function(item) {
|
|
||||||
// // console.log(typeof item.id)
|
|
||||||
// return item.id == client_id;
|
|
||||||
// });
|
|
||||||
// appendBranch(foundPolicies.branchs);
|
|
||||||
// }
|
|
||||||
// }, 500);
|
|
||||||
|
|
||||||
// setTimeout(function() {
|
|
||||||
// if (client_branch_id != 0) {
|
|
||||||
|
|
||||||
// var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
|
||||||
// // console.log('item', item);
|
|
||||||
// return item.branch_id === client_branch_id;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// if (foundPolicies) {
|
|
||||||
// // console.log('foundPolicies', foundPolicies);
|
|
||||||
// appendPolicies(foundPolicies);
|
|
||||||
// } else {
|
|
||||||
// console.log('No policies found for the selected client');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }, 500);
|
|
||||||
// //end
|
|
||||||
|
|
||||||
// } catch (error) {
|
|
||||||
// console.error('Error parsing API response data:', error);
|
|
||||||
// }
|
|
||||||
// } else if (response.code === 404 && response.dataStatus === false) {
|
|
||||||
// console.error('no data found', response);
|
|
||||||
// } else {
|
|
||||||
// console.error('Something went wrong!');
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// error: function(xhr, status, error) {
|
|
||||||
// console.error('Error fetching data from API:', error);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// $('#loader').hide();
|
|
||||||
// }
|
|
||||||
|
|
||||||
function appendClients(data) {
|
function appendClients(data) {
|
||||||
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
@ -724,14 +647,12 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
document.getElementById('toggleIcon').addEventListener('click', function() {
|
document.getElementById('toggleIcon').addEventListener('click', function() {
|
||||||
var icon = document.getElementById('icon');
|
var icon = document.getElementById('icon');
|
||||||
icon.classList.toggle('mdi-chevron-down');
|
icon.classList.toggle('mdi-chevron-down');
|
||||||
icon.classList.toggle('mdi-chevron-up');
|
icon.classList.toggle('mdi-chevron-up');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function sendManualEcard(input) {
|
function sendManualEcard(input) {
|
||||||
console.log('sendManualEcard function called');
|
console.log('sendManualEcard function called');
|
||||||
|
|
||||||
@ -793,4 +714,159 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getOnboardedemployees(event)
|
||||||
|
{
|
||||||
|
console.log(event.target.id);
|
||||||
|
var policy_id = (event.target.value);
|
||||||
|
console.log('getOnboardedemployees called ' + policy_id);
|
||||||
|
if(policy_id != 0 && policy_id != " " && policy_id != undefined)
|
||||||
|
{
|
||||||
|
var apiURL = '<?php echo base_url();?>' + 'checkWellnessOnboardStatus/' + policy_id + '?fetch_onboarded_employees=true';
|
||||||
|
// console.log(apiURL);
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: apiURL,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"X-Requested-With": "XMLHttpRequest"
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
console.log('check wellness response', response);
|
||||||
|
|
||||||
|
if(response.data && response.data != 0) {
|
||||||
|
var btn_txt = 'Wellness Onboard Reset ('+ response.data +')';
|
||||||
|
$('#resetWellnessOnboardBtn').text(btn_txt);
|
||||||
|
$('#resetWellnessOnboardBtn_div').show();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.log('wellness button remains disabled');
|
||||||
|
$('#resetWellnessOnboardBtn_div').hide();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
console.error('Error fetching data from checkPolicyTermsAndRackRatesHasDefiend API:', error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetWellnessOnboard($client_policy_id = null, $emp_code = null) {
|
||||||
|
console.log('resetWellnessOnboard function called');
|
||||||
|
|
||||||
|
var client_id = $('#clients').val()
|
||||||
|
var client_branch_id = $('#branch_id').val()
|
||||||
|
var policy_id = $('#policies').val()
|
||||||
|
|
||||||
|
console.log('client_id', client_id);
|
||||||
|
console.log('client_branch_id', client_branch_id);
|
||||||
|
console.log('policy_id', policy_id);
|
||||||
|
|
||||||
|
if (client_id == 0 || client_branch_id == 0 || policy_id == 0) {
|
||||||
|
toastr.warning('Please select the Client, Client Branch and Policy.', 'WARNING');
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if($client_policy_id && $emp_code) {
|
||||||
|
var apiURL = '<?= base_url("resetWellnessOnboard/") ?>' + $client_policy_id + '/' + $emp_code;
|
||||||
|
} else {
|
||||||
|
var apiURL = '<?= base_url("resetWellnessOnboard/") ?>' + policy_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Do you want to reset Wellness Onboard?",
|
||||||
|
showDenyButton: true,
|
||||||
|
showCancelButton: false,
|
||||||
|
confirmButtonText: "Yes,Reset",
|
||||||
|
denyButtonText: "Don't Reset"
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
$.ajax({
|
||||||
|
url: apiURL,
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(res) {
|
||||||
|
console.log('resetWellnessOnboard', res)
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
toastr.success(res.message, 'Success');
|
||||||
|
setTimeout(function() {
|
||||||
|
window.location.reload();
|
||||||
|
}, 800);
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function initiateWellnessOnboard($policy_id, $emp_code)
|
||||||
|
{
|
||||||
|
|
||||||
|
if($policy_id == "" || $emp_code == "") {
|
||||||
|
toastr.error('Please select policy to initiate wellness onboard', 'Error');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($policy_id != 0 && $policy_id != " " && $policy_id != undefined)
|
||||||
|
{
|
||||||
|
|
||||||
|
var apiURL = '<?php echo base_url();?>' + 'initiateWellnessOnboard/' + $policy_id + '/' + $emp_code;
|
||||||
|
// console.log(apiURL);
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: apiURL,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"X-Requested-With": "XMLHttpRequest"
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
console.log('initiate wellness response', response);
|
||||||
|
toastr.success(response.message, 'Success');
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
window.location.reload();
|
||||||
|
}, 800);
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
console.error('Error initiate data from initiateWellnessOnboard API:', error);
|
||||||
|
toastr.error(error, 'Error');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
|
||||||
|
toastr.error('Please select policy to initiate wellness onboard', 'Error');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user