Merge branch 'dev' of bitbucket.org:jubilian/nhance-enrollment into dev
This commit is contained in:
commit
9f58343f0a
@ -144,6 +144,7 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
|||||||
|
|
||||||
$routes->group("others", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("others", ["filter" => "authMVC"], function ($routes) {
|
||||||
$routes->post("create", "ClientController::createOtherTabContent");
|
$routes->post("create", "ClientController::createOtherTabContent");
|
||||||
|
$routes->post('check-duplicate', 'ClientController::validateDuplicateByClientBranch');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -151,6 +151,16 @@ class ClientController extends AdminController
|
|||||||
return $this->response->setJSON(['isDuplicate' => $isDuplicate]);
|
return $this->response->setJSON(['isDuplicate' => $isDuplicate]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function validateDuplicateByClientBranch()
|
||||||
|
{
|
||||||
|
$value = $this->request->getPost('value');
|
||||||
|
$clientId = $this->request->getPost('client_id');
|
||||||
|
$branchId = $this->request->getPost('branch_id');
|
||||||
|
$field = $this->request->getPost('field');
|
||||||
|
$isDuplicate = $this->clientModel->isDuplicateByClientBranch($value, $field, $clientId, $branchId);
|
||||||
|
return $this->response->setJSON(['isDuplicate' => $isDuplicate]);
|
||||||
|
}
|
||||||
|
|
||||||
public function smapletest()
|
public function smapletest()
|
||||||
{
|
{
|
||||||
$headers = [
|
$headers = [
|
||||||
|
|||||||
@ -761,36 +761,45 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function empby_client_clientbranch($client_id, $branch_id)
|
public function empby_client_clientbranch($client_id, $branch_id, $client_policy_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
$results = $this->clientModel->select('employees.id as employee_id, employees.name as employee_name,
|
$results = $this->clientModel->select('
|
||||||
employees.relationship, employees.emp_code,
|
employees.id as employee_id,
|
||||||
employees.emp_status, auth_history.user_type')
|
employees.name as employee_name,
|
||||||
->join('employees', $client_id .'= employees.client_id AND ' . $branch_id . '= employees.client_branch_id', 'left')
|
employees.relationship,
|
||||||
->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left')
|
employees.emp_code,
|
||||||
->where('employees.is_active', 1)
|
employees.emp_status,
|
||||||
->where('employees.emp_status !=', 'truncated')
|
auth_history.user_type
|
||||||
->groupBy('employees.id')
|
')
|
||||||
->findAll();
|
->join('employees', $client_id . '= employees.client_id AND ' . $branch_id . '= employees.client_branch_id', 'left')
|
||||||
|
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||||
|
->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left')
|
||||||
|
->where('employees.is_active', 1)
|
||||||
|
->where('employees.emp_status !=', 'truncated')
|
||||||
|
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
|
->where('employee_polices.is_active', 1)
|
||||||
|
->where('employee_polices.status !=', 'truncated')
|
||||||
|
->groupBy('employees.id')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
$groupedData = [];
|
$groupedData = [];
|
||||||
$employeeId = '';
|
$employeeId = '';
|
||||||
|
|
||||||
foreach ($results as $row) {
|
foreach ($results as $row) {
|
||||||
|
|
||||||
if($employeeId != $row['employee_id']){
|
if ($employeeId != $row['employee_id']) {
|
||||||
$employeeId = $row['employee_id'];
|
$employeeId = $row['employee_id'];
|
||||||
}else{
|
} else {
|
||||||
$employeeId = null;
|
$employeeId = null;
|
||||||
}
|
}
|
||||||
$employeeName = $row['employee_name'] ;
|
$employeeName = $row['employee_name'];
|
||||||
$employeeRelationship = $row['relationship'] ;
|
$employeeRelationship = $row['relationship'];
|
||||||
$employeeEmpCode = $row['emp_code'] ;
|
$employeeEmpCode = $row['emp_code'];
|
||||||
$employeeEmpStatus = $row['emp_status'];
|
$employeeEmpStatus = $row['emp_status'];
|
||||||
$employeeUserType = $row['user_type'];
|
$employeeUserType = $row['user_type'];
|
||||||
|
|
||||||
|
|
||||||
// if ($employeeId !== null && $employeeRelationship == 'Self') {
|
// if ($employeeId !== null && $employeeRelationship == 'Self') {
|
||||||
if ($employeeId !== null) {
|
if ($employeeId !== null) {
|
||||||
// Append employee info to the branch's employees list
|
// Append employee info to the branch's employees list
|
||||||
@ -802,16 +811,16 @@ class EmployeeController extends AdminController
|
|||||||
'emp_status' => $employeeEmpStatus,
|
'emp_status' => $employeeEmpStatus,
|
||||||
'user_type' => $employeeUserType
|
'user_type' => $employeeUserType
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
$employeeId = $row['employee_id'];
|
$employeeId = $row['employee_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return json_encode($groupedData);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// print_r($groupedData); die;
|
||||||
|
|
||||||
|
return json_encode($groupedData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1774,53 +1774,28 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
public function getClientDetails()
|
public function getClientDetails()
|
||||||
{
|
{
|
||||||
log_message('error', 'STEP 1: getClientDetails called');
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// STEP 2: Extract Authorization header
|
$pre_client_id = $this->request->getGet('pre_client_id');
|
||||||
$jwt = $this->request->getHeaderLine('Authorization');
|
$pre_branch_id = $this->request->getGet('pre_branch_id');
|
||||||
log_message('error', 'STEP 2: Authorization header: ' . $jwt);
|
$post_client_id = $this->request->getGet('post_client_id');
|
||||||
|
$post_branch_id = $this->request->getGet('post_branch_id');
|
||||||
|
|
||||||
|
|
||||||
$jwtParts = explode(' ', $jwt);
|
if ($pre_client_id != null) {
|
||||||
if (count($jwtParts) < 2) {
|
|
||||||
log_message('error', 'STEP 2.1: Invalid Authorization header format');
|
|
||||||
return $this->respond(['status' => 'failed', 'code' => 400, 'data' => 'Invalid Authorization header'], 400);
|
|
||||||
}
|
|
||||||
|
|
||||||
$token = $jwtParts[1];
|
$client = $this->clientModel->where('id', $pre_client_id)->first();
|
||||||
log_message('error', 'STEP 3: Extracted JWT token');
|
|
||||||
|
|
||||||
$tokenParts = explode('.', $token);
|
|
||||||
if (count($tokenParts) !== 3) {
|
|
||||||
log_message('error', 'STEP 3.1: Invalid JWT structure');
|
|
||||||
return $this->respond(['status' => 'failed', 'code' => 400, 'data' => 'Invalid JWT token'], 400);
|
|
||||||
}
|
|
||||||
|
|
||||||
$decodedPayload = json_decode(base64_decode($tokenParts[1]), true);
|
|
||||||
log_message('error', 'STEP 4: Decoded JWT payload: ' . json_encode($decodedPayload));
|
|
||||||
|
|
||||||
$token_type = $decodedPayload['token_type'] ?? null;
|
|
||||||
log_message('error', 'STEP 5: Token type = ' . $token_type);
|
|
||||||
|
|
||||||
$client_id = $this->request->getGet('client_id');
|
|
||||||
$client_branch_id = $this->request->getGet('client_branch_id');
|
|
||||||
log_message('error', 'STEP 6: Query params - client_id: ' . $client_id . ', client_branch_id: ' . $client_branch_id);
|
|
||||||
|
|
||||||
if ($token_type === 'pre') {
|
|
||||||
log_message('error', 'STEP 7: Handling "pre" token type');
|
|
||||||
|
|
||||||
$client = $this->clientModel->where('id', $client_id)->first();
|
|
||||||
if ($client) {
|
if ($client) {
|
||||||
log_message('error', 'STEP 8: Found client: ' . json_encode($client));
|
|
||||||
|
|
||||||
$client['client_logo'] = base_url() . 'public/uploads/logo/' . $client['client_logo'];
|
$client['client_logo'] = base_url() . 'public/uploads/logo/' . $client['client_logo'];
|
||||||
|
|
||||||
$clientPolicy = $this->clientPolicyModel
|
$clientPolicy = $this->clientPolicyModel
|
||||||
->where('client_id', $client_id)
|
->where('client_id', $pre_client_id)
|
||||||
->where('client_branch_id', $client_branch_id)
|
->where('client_branch_id', $pre_branch_id)
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
log_message('error', 'STEP 9: Found client policy count: ' . count($clientPolicy));
|
|
||||||
|
|
||||||
return $this->respond([
|
return $this->respond([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
@ -1831,33 +1806,34 @@ class EmployeeRestController extends AdminController
|
|||||||
]
|
]
|
||||||
], 200);
|
], 200);
|
||||||
} else {
|
} else {
|
||||||
log_message('error', 'STEP 10: No client found for client_id: ' . $client_id);
|
|
||||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);
|
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);
|
||||||
}
|
}
|
||||||
} elseif ($token_type === 'post') {
|
} elseif ($post_client_id != null) {
|
||||||
log_message('error', 'STEP 11: Handling "post" token type');
|
|
||||||
|
|
||||||
$restAuthController = new RestAuthenticationController;
|
$restAuthController = new RestAuthenticationController;
|
||||||
|
|
||||||
$queryParams = [
|
$queryParams = [
|
||||||
'client_id' => $client_id,
|
'client_id' => $post_client_id,
|
||||||
'client_branch_id' => $client_branch_id
|
'client_branch_id' => $post_branch_id
|
||||||
];
|
];
|
||||||
|
|
||||||
log_message('error', 'STEP 12: Calling post enrollment API with params: ' . json_encode($queryParams));
|
return $restAuthController->callThirdPartyGETAPI($queryParams, 'getClientDetails');
|
||||||
|
|
||||||
return $restAuthController->callThirdPartyGETAPI($queryParams, 'getClientDetails', ['token' => $jwt]);
|
|
||||||
} else {
|
} else {
|
||||||
log_message('error', 'STEP 13: Unknown token_type: ' . $token_type);
|
|
||||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);
|
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
log_message('error', 'STEP 14: Exception occurred - ' . $e->getMessage());
|
|
||||||
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500);
|
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getSiMappedArray($policy_id,$base_policy_id)
|
public function getSiMappedArray($policy_id,$base_policy_id)
|
||||||
{
|
{
|
||||||
$selfGMC = $this->employeeModel->select('employees.name , employee_polices.basic_cover_si')
|
$selfGMC = $this->employeeModel->select('employees.name , employee_polices.basic_cover_si')
|
||||||
|
|||||||
@ -214,5 +214,19 @@ class ClientModel extends Model
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isDuplicateByClientBranch($value, $field, $clientId, $branchId)
|
||||||
|
{
|
||||||
|
$builder = $this->db->table('level_contacts lc')
|
||||||
|
->select('lc.id')
|
||||||
|
->join('client_branch cb', 'lc.ref_id = cb.id', 'left')
|
||||||
|
->where('lc.'.$field, $value)
|
||||||
|
->where('lc.contact_type', 'client')
|
||||||
|
->where('cb.client_id', $clientId)
|
||||||
|
->where('lc.ref_id', $branchId)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return $builder->getNumRows() > 0 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -207,12 +207,12 @@
|
|||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="last_name">Email<span class="text-danger">*</span></label>
|
<label for="last_name">Email<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Email"
|
<input value="" type="text" class="form-control" placeholder="Enter Contact Email"
|
||||||
name="email[]" id="email" data-parsley-trigger="change" data-parsley-type="email" onkeyup="validateInput(this, 'level_contacts', 'email', 'branchBtnSubmit')" required>
|
name="email[]" id="email" data-parsley-trigger="change" data-parsley-type="email" onchange="validateDuplicateByClientBranch(this, 'email','branchBtnSubmit')" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="mobile">Mobile<span class="text-danger">*</span></label>
|
<label for="mobile">Mobile<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Mobile"
|
<input value="" type="text" class="form-control" placeholder="Enter Contact Mobile"
|
||||||
name="mobile[]" id="mobile" onkeyup="validateInput(this, 'level_contacts', 'mobile', 'branchBtnSubmit')"
|
name="mobile[]" id="mobile" onchange="validateDuplicateByClientBranch(this, 'mobile', 'branchBtnSubmit')"
|
||||||
onkeypress="return onlyNumbers(event)" maxlength="10" minlength="10"
|
onkeypress="return onlyNumbers(event)" maxlength="10" minlength="10"
|
||||||
data-parsley-type-message="Please enter a valid 10-digit mobile number."
|
data-parsley-type-message="Please enter a valid 10-digit mobile number."
|
||||||
data-parsley-required-message="Please enter a valid 10-digit mobile number."
|
data-parsley-required-message="Please enter a valid 10-digit mobile number."
|
||||||
@ -315,6 +315,7 @@ $('#btnBranchAdd').click(function() {
|
|||||||
$('#branch_form').parsley().reset();
|
$('#branch_form').parsley().reset();
|
||||||
$('.ac').css('display', 'block');
|
$('.ac').css('display', 'block');
|
||||||
$('#post_branch_id').val('');
|
$('#post_branch_id').val('');
|
||||||
|
$('#branch_id_primarykey').val('');
|
||||||
contactCount = 1
|
contactCount = 1
|
||||||
|
|
||||||
var addButton = document.getElementById('add');
|
var addButton = document.getElementById('add');
|
||||||
@ -378,6 +379,8 @@ $("#branch_form").submit(function(event) {
|
|||||||
|
|
||||||
var selectedValues = $("#selected").val();
|
var selectedValues = $("#selected").val();
|
||||||
console.log(selectedValues, selectedValues);
|
console.log(selectedValues, selectedValues);
|
||||||
|
console.log("branch_id_primarykey", $('#branch_id_primarykey').val());
|
||||||
|
|
||||||
|
|
||||||
let level_contect_data = getContactsData();
|
let level_contect_data = getContactsData();
|
||||||
console.log('level_contect_data', level_contect_data);
|
console.log('level_contect_data', level_contect_data);
|
||||||
@ -651,11 +654,11 @@ function appendContactHtml(contact = false, reset = false) {
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
|
<label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
|
||||||
<input value="${contact !== undefined && contact !== false ? contact.email : ''}" type="text" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" data-parsley-trigger="change" data-parsley-type="email" onchange="validateInput(this, 'level_contacts', 'email', 'branchBtnSubmit')" required>
|
<input value="${contact !== undefined && contact !== false ? contact.email : ''}" type="text" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" data-parsley-trigger="change" data-parsley-type="email" onchange="validateDuplicateByClientBranch(this, 'email','branchBtnSubmit')" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
|
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
|
||||||
<input value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" onkeyup="validateInput(this, 'level_contacts', 'mobile', 'branchBtnSubmit')" onkeypress = "return onlyNumbers(event)" maxlength="10" min="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
|
<input value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" onchange="validateDuplicateByClientBranch(this, 'mobile', 'branchBtnSubmit')" onkeypress = "return onlyNumbers(event)" maxlength="10" min="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" style="display: flex;">
|
<div class="form-group" style="display: flex;">
|
||||||
@ -945,6 +948,66 @@ function validateInput(input, table, field, submitBtnId){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function validateDuplicateByClientBranch(input, field, submitButId) {
|
||||||
|
let value = $(input).val().trim();
|
||||||
|
let clientId = $('#client_id_branch').val();
|
||||||
|
let branchId = $('#branch_id_primarykey').val();
|
||||||
|
let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
|
||||||
|
let message = label ? label + " is duplicate!" : "Value is duplicate!";
|
||||||
|
|
||||||
|
console.log(`cId: ${clientId} | bId: ${branchId}`);
|
||||||
|
|
||||||
|
// Don't forgot be careful
|
||||||
|
// 1 Local duplication check (User entered)
|
||||||
|
let isLocalDuplicate = false;
|
||||||
|
$('input[name="' + field + '[]"]').each(function(index) {
|
||||||
|
console.log(`Entered value: ${value} | Contact ${index+1} value: ${$(this).val()}`);
|
||||||
|
if (this !== input && $(this).val().trim() === value) {
|
||||||
|
isLocalDuplicate = true;
|
||||||
|
return false; // break loop
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isLocalDuplicate) {
|
||||||
|
console.log(`r u n Local`);
|
||||||
|
console.log(`btn Dis - true`);
|
||||||
|
toastr.warning(message, 'WARNING');
|
||||||
|
$('#' + submitButId).prop('disabled', true);
|
||||||
|
return; // don’t call server if duplicate in UI
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't forgot be careful
|
||||||
|
// 2 Server-side duplicate check (DB)
|
||||||
|
if (!isLocalDuplicate && value !== '') {
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '<?= base_url("client/others/check-duplicate") ?>',
|
||||||
|
type: 'POST',
|
||||||
|
data: {
|
||||||
|
client_id: clientId,
|
||||||
|
branch_id: branchId,
|
||||||
|
value: value,
|
||||||
|
field: field
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(response) {
|
||||||
|
if (response.isDuplicate) {
|
||||||
|
console.log(`r u n Server`);
|
||||||
|
console.log(`btn Dis - true`);
|
||||||
|
toastr.warning(message, 'WARNING');
|
||||||
|
$('#' + submitButId).prop('disabled', true);
|
||||||
|
} else {
|
||||||
|
console.log(`btn Dis - false`);
|
||||||
|
$('#' + submitButId).prop('disabled', false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error('AJAX Error:', error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getContactsData() {
|
function getContactsData() {
|
||||||
const contacts = [];
|
const contacts = [];
|
||||||
|
|
||||||
|
|||||||
@ -314,17 +314,18 @@
|
|||||||
|
|
||||||
var client_id = $('#clients').val();
|
var client_id = $('#clients').val();
|
||||||
var branch_id = $('#branch_id').val();
|
var branch_id = $('#branch_id').val();
|
||||||
if (client_id == '0' || branch_id == '0') {
|
var client_policy_id = $('#client_policy_id').val();
|
||||||
|
if (client_id == '0' || branch_id == '0' || client_policy_id == '0') {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "warning!",
|
title: "warning!",
|
||||||
text: 'Please select the Client and Client Branch.',
|
text: 'Please select the Client, Client Branch and Client Policy.',
|
||||||
icon: "warning"
|
icon: "warning"
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?php echo base_url(); ?>' + '/employee/empby_client_clientbranch/' + client_id + '/' + branch_id,
|
url: '<?php echo base_url(); ?>' + '/employee/empby_client_clientbranch/' + client_id + '/' + branch_id + '/' + client_policy_id,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@ -359,7 +360,7 @@
|
|||||||
var loggedIn_count = 0;
|
var loggedIn_count = 0;
|
||||||
data.forEach(function(employee, index) {
|
data.forEach(function(employee, index) {
|
||||||
|
|
||||||
if(employee.emp_status !== 'draft'){
|
if(employee.emp_status === 'enrolled'){
|
||||||
var enrolled = 'Yes';
|
var enrolled = 'Yes';
|
||||||
enrolled_count++;
|
enrolled_count++;
|
||||||
}else{
|
}else{
|
||||||
@ -369,8 +370,13 @@
|
|||||||
if(employee.user_type === 'employee'){
|
if(employee.user_type === 'employee'){
|
||||||
var loggedIn = 'Yes';
|
var loggedIn = 'Yes';
|
||||||
loggedIn_count++;
|
loggedIn_count++;
|
||||||
}else{
|
}else{
|
||||||
var loggedIn = 'No';
|
|
||||||
|
if (employee.relationship && employee.relationship.toLowerCase() === "self") {
|
||||||
|
var loggedIn = 'No';
|
||||||
|
}else{
|
||||||
|
var loggedIn = '-';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
table.row.add([
|
table.row.add([
|
||||||
@ -485,6 +491,8 @@
|
|||||||
|
|
||||||
|
|
||||||
$('#emp_enrolled_view_click').on('click', function() {
|
$('#emp_enrolled_view_click').on('click', function() {
|
||||||
|
|
||||||
|
console.log($(this).hasClass('click_hover'));
|
||||||
if ($(this).hasClass('click_hover')) {
|
if ($(this).hasClass('click_hover')) {
|
||||||
// $(this).removeClass('click_hover');
|
// $(this).removeClass('click_hover');
|
||||||
$('.click_hover').each(function() {
|
$('.click_hover').each(function() {
|
||||||
@ -496,7 +504,7 @@
|
|||||||
$(this).removeClass('click_hover');
|
$(this).removeClass('click_hover');
|
||||||
});
|
});
|
||||||
$('#emp_enrolled_view_click').addClass('click_hover');
|
$('#emp_enrolled_view_click').addClass('click_hover');
|
||||||
filterTable(3, 'Yes'); // Filter "Enrolled" column (4th column, index 3)
|
filterTable(4, 'Yes'); // Filter "Enrolled" column (4th column, index 3)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -512,7 +520,7 @@
|
|||||||
$(this).removeClass('click_hover');
|
$(this).removeClass('click_hover');
|
||||||
});
|
});
|
||||||
$('#emp_not_enrolled_view_click').addClass('click_hover');
|
$('#emp_not_enrolled_view_click').addClass('click_hover');
|
||||||
filterTable(3, 'No'); // Filter "Enrolled" column (4th column, index 3)
|
filterTable(4, 'No'); // Filter "Enrolled" column (4th column, index 3)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -528,7 +536,7 @@
|
|||||||
$(this).removeClass('click_hover');
|
$(this).removeClass('click_hover');
|
||||||
});
|
});
|
||||||
$('#emp_logged_in_view_click').addClass('click_hover');
|
$('#emp_logged_in_view_click').addClass('click_hover');
|
||||||
filterTable(4, 'Yes'); // Filter "Logged-In" column (5th column, index 4)
|
filterTable(5, 'Yes'); // Filter "Logged-In" column (5th column, index 4)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -544,7 +552,7 @@
|
|||||||
$(this).removeClass('click_hover');
|
$(this).removeClass('click_hover');
|
||||||
});
|
});
|
||||||
$('#emp_not_logged_in_view_click').addClass('click_hover');
|
$('#emp_not_logged_in_view_click').addClass('click_hover');
|
||||||
filterTable(4, 'No'); // Filter "Logged-In" column (5th column, index 4)
|
filterTable(5, 'No'); // Filter "Logged-In" column (5th column, index 4)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -738,7 +746,6 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function sendManualReminder(input)
|
function sendManualReminder(input)
|
||||||
{
|
{
|
||||||
console.log('sendManualReminder function called');
|
console.log('sendManualReminder function called');
|
||||||
@ -779,44 +786,45 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Do you want to send reminder mail?",
|
title: "Do you want to send reminder mail?",
|
||||||
showDenyButton: true,
|
showDenyButton: true,
|
||||||
showCancelButton: false,
|
showCancelButton: false,
|
||||||
confirmButtonText: "Yes,Send",
|
confirmButtonText: "Yes,Send",
|
||||||
denyButtonText: "Don't Send"
|
denyButtonText: "Don't Send"
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
|
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?= base_url("util/send_manual_reminder/") ?>' + client_id + '/' + client_branch_id + '/' + client_policy_id,
|
url: '<?= base_url("util/send_manual_reminder/") ?>' + client_id + '/' + client_branch_id + '/' + client_policy_id,
|
||||||
type: "GET",
|
type: "GET",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
console.log('send_manual_reminder', res)
|
console.log('send_manual_reminder', res)
|
||||||
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
if(res.status == false){
|
if(res.status == false){
|
||||||
toastr.info(res.message, 'INFO');
|
toastr.info(res.message, 'INFO');
|
||||||
}else{
|
}else{
|
||||||
toastr.success(res.message, 'SUCCESS');
|
toastr.success(res.message, 'SUCCESS');
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
// Swal.fire("Saved!", "", "success");
|
||||||
error: function(xhr, status, error) {
|
}
|
||||||
console.error(xhr.responseText);
|
});
|
||||||
console.error(status, error);
|
|
||||||
$('.loader').fadeOut();
|
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// Swal.fire("Saved!", "", "success");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user