Merge branch 'dev' of bitbucket.org:jubilian/nhance-enrollment into dev
This commit is contained in:
commit
a828337c9a
@ -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 = [
|
||||||
@ -897,7 +907,29 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data['created_by'] = get_session_userid();
|
$data['created_by'] = get_session_userid();
|
||||||
|
|
||||||
|
// before updating check if post_branch_id is already existing in the current db
|
||||||
|
|
||||||
|
if(isset($data['post_branch_id']) && !empty($data['post_branch_id']))
|
||||||
|
{
|
||||||
|
$existing_pre_branch = $this->clientBranchModel
|
||||||
|
->where('post_branch_id',$data['post_branch_id'])
|
||||||
|
// ->where('id !=',$pre_branch_id)
|
||||||
|
->where('is_active',1)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if($existing_pre_branch)
|
||||||
|
{
|
||||||
|
return $this->respond([
|
||||||
|
'status' => false,
|
||||||
|
'code' => 409,
|
||||||
|
'message' => 'The branch is already mapped with another branch. Please check.',
|
||||||
|
], 409);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$insert = $this->clientBranchModel->insert($data);
|
$insert = $this->clientBranchModel->insert($data);
|
||||||
|
$pre_branch_id = $insert;
|
||||||
|
|
||||||
if ($insert) {
|
if ($insert) {
|
||||||
$level_contact_data = $this->request->getPost('level_contect_data');
|
$level_contact_data = $this->request->getPost('level_contect_data');
|
||||||
@ -905,6 +937,16 @@ class ClientController extends AdminController
|
|||||||
$this->saveLevelContacts($level_contact_data, $insert);
|
$this->saveLevelContacts($level_contact_data, $insert);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($pre_branch_id && isset($data['post_branch_id']) && !empty($data['post_branch_id']))
|
||||||
|
{
|
||||||
|
// need to update the client_branch in the pre
|
||||||
|
$result = $this->updatePostClientBranch($data['post_branch_id'],$pre_branch_id , "create");
|
||||||
|
|
||||||
|
log_message('error','Post client_branch update result for post_branch_id '.$data['post_branch_id'].' and pre_branch_id '.$pre_branch_id.' is '.json_encode($result));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if ($insert) {
|
// if ($insert) {
|
||||||
// for ($i = 0; $i < count($this->request->getPost('name')); $i++) {
|
// for ($i = 0; $i < count($this->request->getPost('name')); $i++) {
|
||||||
// // Prepare data to insert
|
// // Prepare data to insert
|
||||||
@ -945,7 +987,11 @@ class ClientController extends AdminController
|
|||||||
$this->myLogger->logme('error', 'Client branch EDIT function called');
|
$this->myLogger->logme('error', 'Client branch EDIT function called');
|
||||||
$id = $this->request->getPost('branch_id_primarykey');
|
$id = $this->request->getPost('branch_id_primarykey');
|
||||||
$client_id = $this->request->getPost('client_id');
|
$client_id = $this->request->getPost('client_id');
|
||||||
|
$post_branch_id = $this->request->getPost('post_branch_id') ?? "";
|
||||||
|
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
|
$data['post_branch_id'] = $post_branch_id;
|
||||||
|
|
||||||
$units = $this->request->getPost('units');
|
$units = $this->request->getPost('units');
|
||||||
|
|
||||||
$emp_unit_count = 0;
|
$emp_unit_count = 0;
|
||||||
@ -1004,7 +1050,44 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data['updated_by'] = get_session_userid();
|
$data['updated_by'] = get_session_userid();
|
||||||
|
|
||||||
|
$pre_branch_id = $id;
|
||||||
|
|
||||||
|
// before updating check if post_branch_id is already existing in the current db
|
||||||
|
|
||||||
|
if(isset($data['post_branch_id']) && !empty($data['post_branch_id']))
|
||||||
|
{
|
||||||
|
$existing_pre_branch = $this->clientBranchModel
|
||||||
|
->where('post_branch_id',$data['post_branch_id'])
|
||||||
|
->where('id !=',$pre_branch_id)
|
||||||
|
->where('is_active',1)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if($existing_pre_branch)
|
||||||
|
{
|
||||||
|
return $this->respond([
|
||||||
|
'status' => false,
|
||||||
|
'code' => 409,
|
||||||
|
'message' => 'The branch is already mapped with another branch. Please check.',
|
||||||
|
], 409);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$insert = $this->clientBranchModel->update($id, $data);
|
$insert = $this->clientBranchModel->update($id, $data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if($pre_branch_id && isset($data['post_branch_id']) && !empty($data['post_branch_id']))
|
||||||
|
{
|
||||||
|
// need to update the client_branch in the post
|
||||||
|
$result = $this->updatePostClientBranch($data['post_branch_id'],$pre_branch_id , "update");
|
||||||
|
|
||||||
|
log_message('error','Post client_branch update result for post_branch_id '.$data['post_branch_id'].' and pre_branch_id '.$pre_branch_id.' is '.json_encode($result));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'Client branch EDITED by {data}', ['data' => get_session_userid()]);
|
$this->myLogger->logme('error', 'Client branch EDITED by {data}', ['data' => get_session_userid()]);
|
||||||
|
|
||||||
if ($insert) {
|
if ($insert) {
|
||||||
@ -5229,6 +5312,29 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function updatePostClientBranch($post_branch_id,$pre_branch_id , $operation){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$postDB = \Config\Database::connect('postDB');
|
||||||
|
|
||||||
|
if($operation != 'create'){
|
||||||
|
|
||||||
|
$builder = $postDB->table('client_branch');
|
||||||
|
$builder->where('pre_branch_id', $pre_branch_id);
|
||||||
|
$builder->update(['pre_branch_id' => null]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$builder = $postDB->table('client_branch');
|
||||||
|
$builder->where('id', $post_branch_id);
|
||||||
|
$builder->update(['pre_branch_id' => $pre_branch_id]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -761,32 +761,41 @@ 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'];
|
||||||
|
|
||||||
@ -802,14 +811,14 @@ class EmployeeController extends AdminController
|
|||||||
'emp_status' => $employeeEmpStatus,
|
'emp_status' => $employeeEmpStatus,
|
||||||
'user_type' => $employeeUserType
|
'user_type' => $employeeUserType
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
$employeeId = $row['employee_id'];
|
$employeeId = $row['employee_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// print_r($groupedData); die;
|
||||||
|
|
||||||
return json_encode($groupedData);
|
return json_encode($groupedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -91,10 +91,14 @@
|
|||||||
|
|
||||||
|
|
||||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||||
|
|
||||||
|
<!-- pre_client_id as client_id -->
|
||||||
<input type="hidden" name="client_id" id="client_id_branch"
|
<input type="hidden" name="client_id" id="client_id_branch"
|
||||||
value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
||||||
|
<!-- post_branch_id -->
|
||||||
<input type="hidden" name="post_branch_id" id="post_branch_id"
|
<input type="hidden" name="post_branch_id" id="post_branch_id"
|
||||||
value="<?= isset($post_branch_id) ? $post_branch_id : '' ?>" />
|
value="<?= isset($post_branch_id) ? $post_branch_id : '' ?>" />
|
||||||
|
<!-- pre_branch_id as branch_id_primarykey -->
|
||||||
<input type="hidden" name="branch_id_primarykey" id="branch_id_primarykey" />
|
<input type="hidden" name="branch_id_primarykey" id="branch_id_primarykey" />
|
||||||
|
|
||||||
|
|
||||||
@ -203,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."
|
||||||
@ -308,7 +312,9 @@ $('#btnBranchAdd').click(function() {
|
|||||||
$('#district').val('');
|
$('#district').val('');
|
||||||
$('#branch_city').val('');
|
$('#branch_city').val('');
|
||||||
$('#branch_form')[0].reset();
|
$('#branch_form')[0].reset();
|
||||||
|
$('#branch_form').parsley().reset();
|
||||||
$('.ac').css('display', 'block');
|
$('.ac').css('display', 'block');
|
||||||
|
$('#post_branch_id').val('');
|
||||||
contactCount = 1
|
contactCount = 1
|
||||||
|
|
||||||
var addButton = document.getElementById('add');
|
var addButton = document.getElementById('add');
|
||||||
@ -379,7 +385,7 @@ $("#branch_form").submit(function(event) {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
branch_PrimaryKey = $('#client_id_branch').val();
|
branch_PrimaryKey = $('#client_id_branch').val();
|
||||||
|
|
||||||
console.log('branch_PrimaryKey', branch_PrimaryKey)
|
console.log('branch_PrimaryKey', branch_PrimaryKey);
|
||||||
|
|
||||||
if (branch_PrimaryKey === '') {
|
if (branch_PrimaryKey === '') {
|
||||||
toastr.error('Client is required', 'Error');
|
toastr.error('Client is required', 'Error');
|
||||||
@ -398,6 +404,7 @@ $("#branch_form").submit(function(event) {
|
|||||||
|
|
||||||
var formData = new FormData($('#branch_form')[0]);
|
var formData = new FormData($('#branch_form')[0]);
|
||||||
|
|
||||||
|
|
||||||
const jsonString = JSON.stringify(selectedValues);
|
const jsonString = JSON.stringify(selectedValues);
|
||||||
const level_contect_data_json_string = JSON.stringify(level_contect_data);
|
const level_contect_data_json_string = JSON.stringify(level_contect_data);
|
||||||
console.log('jsonString', jsonString);
|
console.log('jsonString', jsonString);
|
||||||
@ -488,6 +495,10 @@ $("#branch_form").submit(function(event) {
|
|||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
console.log('Something Wrong!', 'warning');
|
console.log('Something Wrong!', 'warning');
|
||||||
|
if(xhr.status === 409){
|
||||||
|
alert('The Current Branch is Already Existing..!!');
|
||||||
|
}
|
||||||
|
|
||||||
}, 300);
|
}, 300);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -640,11 +651,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;">
|
||||||
@ -934,6 +945,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 = [];
|
||||||
|
|
||||||
|
|||||||
@ -126,7 +126,7 @@ body {
|
|||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label for="auto_fetch_client">Client List<span class="text-danger">*</span></label>
|
<label for="auto_fetch_client">Client List<span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="auto_fetch_client" name="auto_fetch_client" required>
|
<select class="form-control select2" id="auto_fetch_client" name="auto_fetch_client" required>
|
||||||
<option value="">Select Client</option>
|
<option value="">Select Client</option>
|
||||||
<?php if (!empty($auto_fetch_client_list)): ?>
|
<?php if (!empty($auto_fetch_client_list)): ?>
|
||||||
<?php foreach ($auto_fetch_client_list as $client_list): ?>
|
<?php foreach ($auto_fetch_client_list as $client_list): ?>
|
||||||
@ -142,7 +142,7 @@ body {
|
|||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label for="auto_fetch_branch">Branch List<span class="text-danger">*</span></label>
|
<label for="auto_fetch_branch">Branch List<span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="auto_fetch_branch" name="auto_fetch_branch" required>
|
<select class="form-control select2" id="auto_fetch_branch" name="auto_fetch_branch" required>
|
||||||
<option value="">Select Branch</option>
|
<option value="">Select Branch</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
@ -313,10 +313,19 @@ body {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$('#auto_fetch_client').select2();
|
||||||
|
$('#auto_fetch_branch').select2();
|
||||||
|
|
||||||
$('#auto_fetch_client').change(function() {
|
$('#auto_fetch_client').change(function() {
|
||||||
|
|
||||||
$('#auto_fetch_branch').html(`<option value="">Select Branch</option>`);
|
$('#auto_fetch_branch').html(`<option value="">Select Branch</option>`);
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "<?php echo base_url('client/branch/auto_fetch_branch'); ?>",
|
url: "<?php echo base_url('client/branch/auto_fetch_branch'); ?>",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@ -341,10 +350,18 @@ body {
|
|||||||
console.error("Error occurred:", status, error);
|
console.error("Error occurred:", status, error);
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
console.log("auto_fetch_client call is completed..!!");
|
console.log("auto_fetch_client call is completed..!!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@ -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{
|
||||||
@ -370,7 +371,12 @@
|
|||||||
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