CHANGE_EMP_FILTER_ADD_2_FIELDS_CHECK_HR_NO_DATATABLE_CSV : RV
This commit is contained in:
parent
644a525976
commit
b32e9f80ac
@ -248,6 +248,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get("check_policy_type/(:any)", "ClientController::checkPolicyType/$1");
|
$routes->get("check_policy_type/(:any)", "ClientController::checkPolicyType/$1");
|
||||||
$routes->get("getPolicyTerms/(:any)", "ClientController::getPolicyTerms/$1");
|
$routes->get("getPolicyTerms/(:any)", "ClientController::getPolicyTerms/$1");
|
||||||
$routes->get("getPolicyTermsFormJson/(:any)", "ClientController::getPolicyTermsFormJson/$1");
|
$routes->get("getPolicyTermsFormJson/(:any)", "ClientController::getPolicyTermsFormJson/$1");
|
||||||
|
$routes->get("checkHRNumber/(:any)", "ClientController::checkHRNumber/$1");
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||||
|
|||||||
@ -2283,4 +2283,16 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function checkHRNumber($mobileNumber)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$mobileNumberCount = $this->levelContactModel->where('mobile', $mobileNumber)->countAllResults();
|
||||||
|
return $this->respond(['status' => true, 'data' => $mobileNumberCount], 200);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
log_message('error', 'Error checking mobile number: ' . $e->getMessage());
|
||||||
|
return $this->respond(['status' => false, 'data' => 0, 'message' => 'An error occurred while checking the mobile number. Please try again later.'], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -79,13 +79,16 @@ class EmployeeController extends AdminController
|
|||||||
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(
|
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(
|
||||||
client_id: $filterData['client_id'],
|
client_id: $filterData['client_id'],
|
||||||
policy_id: $filterData['policy_id'],
|
policy_id: $filterData['policy_id'],
|
||||||
status: $filterData['status'],
|
branch_id: $filterData['branch_id'],
|
||||||
branch_id: $filterData['branch_id']
|
emp_code : $filterData['emp_code'],
|
||||||
|
emp_name : $filterData['emp_name'],
|
||||||
|
status : $filterData['status'],
|
||||||
);
|
);
|
||||||
|
|
||||||
$data['getData'] = $filterData;
|
$data['getData'] = $filterData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// dd($this->request->getGet());
|
||||||
$this->myLogger->logme('error', 'list called');
|
$this->myLogger->logme('error', 'list called');
|
||||||
$this->loadLayout('employee_list', $data);
|
$this->loadLayout('employee_list', $data);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,31 +76,68 @@ class EmployeePolicyModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
public function getEmployeePolicy($client_id,$policy_id,$status,$branch_id)
|
public function getEmployeePolicy($client_id = 0, $policy_id=0, $status=0, $branch_id=0, $emp_code="", $emp_name="")
|
||||||
{
|
{
|
||||||
$result = $this->select(['employee_polices.*','pm.name as policy_name','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active','emp.mobile as mobile'])
|
|
||||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
$result = $this->select([
|
||||||
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
|
'employee_polices.*',
|
||||||
->join('policies pm', 'cp.policy_id = pm.id') //pm - policy master
|
'pm.name as policy_name',
|
||||||
->join('insurers im', 'cp.insurer_id = im.id') //im - insurar master
|
'im.short_name as insurer_short_name',
|
||||||
->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id') //ib - insurar branch
|
'ib.branch_name as insurer_branch_name',
|
||||||
->join('tpa tpam', 'cp.tpa_id = tpam.id','left') //tpam - tpa master
|
'ib.branch_code as insurer_branch_code',
|
||||||
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id','left') //tpab - tpa brach
|
'tpam.name as tpa_name',
|
||||||
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
'tpam.short_name as tpa_short_name',
|
||||||
->where('emp.client_id',$client_id)
|
'tpab.branch_code as tpa_branch_code',
|
||||||
->where('emp.client_branch_id',$branch_id)
|
'cm.client_name',
|
||||||
->where('employee_polices.is_active',1)
|
'cm.short_name as client_short_name',
|
||||||
->where('emp.is_active',1)
|
'emp.relationship',
|
||||||
->where('employee_polices.client_policy_id',$policy_id)
|
'emp.relationship_code',
|
||||||
->orderBy('emp.emp_code','ASC')->orderBy('employee_polices.employee_id','ASC');
|
'emp.change_event',
|
||||||
|
'emp.emp_code',
|
||||||
|
'emp.name',
|
||||||
if($status != 0 && !empty($status)){
|
'emp.email_corporate',
|
||||||
|
'emp.dob',
|
||||||
|
'emp.gender',
|
||||||
|
'emp.emp_status',
|
||||||
|
'emp.is_active as emp_is_active',
|
||||||
|
'emp.mobile as mobile'
|
||||||
|
])
|
||||||
|
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||||
|
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
|
||||||
|
->join('policies pm', 'cp.policy_id = pm.id') //pm - policy master
|
||||||
|
->join('insurers im', 'cp.insurer_id = im.id') //im - insurer master
|
||||||
|
->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id') //ib - insurer branch
|
||||||
|
->join('tpa tpam', 'cp.tpa_id = tpam.id', 'left') //tpam - tpa master
|
||||||
|
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id', 'left') //tpab - tpa branch
|
||||||
|
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
||||||
|
->orderBy('emp.emp_code', 'ASC')
|
||||||
|
->orderBy('employee_polices.employee_id', 'ASC');
|
||||||
|
|
||||||
|
// Conditionally add where clauses
|
||||||
|
if ($client_id !=0 && !empty($client_id)) {
|
||||||
|
$result->where('emp.client_id', $client_id);
|
||||||
|
}
|
||||||
|
if ($branch_id !=0 && !empty($branch_id)) {
|
||||||
|
$result->where('emp.client_branch_id', $branch_id);
|
||||||
|
}
|
||||||
|
if ($policy_id !=0 && !empty($policy_id)) {
|
||||||
|
$result->where('employee_polices.client_policy_id', $policy_id);
|
||||||
|
}
|
||||||
|
if ($status !=0 && !empty($status)) {
|
||||||
$result->where('employee_polices.status', $status);
|
$result->where('employee_polices.status', $status);
|
||||||
}
|
}
|
||||||
|
if (!empty($emp_code)) {
|
||||||
|
$result->where('emp.emp_code', $emp_code);
|
||||||
|
}
|
||||||
|
if (!empty($emp_name)) {
|
||||||
|
$result->like('emp.name', $emp_name);
|
||||||
|
}
|
||||||
|
|
||||||
$result = $result->findAll();
|
// Always check these conditions
|
||||||
return ($result);
|
$result->where('employee_polices.is_active', 1)
|
||||||
|
->where('emp.is_active', 1);
|
||||||
|
|
||||||
|
return $result->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -89,7 +89,7 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<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" name="mobile[]" id="mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" minlength="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="" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="mobile" onchange="checkMobileNumber(this)" onkeypress = "return onlyNumbers(event)" maxlength="10" minlength="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 class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="designation">Designation<span class="text-danger">*</span></label>
|
<label for="designation">Designation<span class="text-danger">*</span></label>
|
||||||
@ -423,7 +423,7 @@ $(document).ready(function () {
|
|||||||
<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}_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" 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="checkMobileNumber(this)" 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 class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
|
<label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
|
||||||
@ -563,6 +563,33 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function checkMobileNumber(input){
|
||||||
|
|
||||||
|
console.log('function called')
|
||||||
|
console.log(input);
|
||||||
|
console.log('Input Value', input.value);
|
||||||
|
|
||||||
|
var mobileNumber = input.value;
|
||||||
|
var url = '<?php echo base_url('util/checkHRNumber/') ?>' + mobileNumber;
|
||||||
|
|
||||||
|
$.get(url, function(response){
|
||||||
|
|
||||||
|
console.log(response)
|
||||||
|
console.log(response.data)
|
||||||
|
|
||||||
|
if(response.data > 0){
|
||||||
|
toastr.warning('The Mobile Number Already Exist.', 'Warning');
|
||||||
|
input.value = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}).fail(function(xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -59,6 +59,16 @@ table.dataTable tbody td {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label>Employee Code</label> <br />
|
||||||
|
<input type="text" class="form-control" id="emp_code" name="emp_code" value="<?= isset($getData['emp_code']) && !empty($getData['emp_code']) ? $getData['emp_code'] : '' ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label>Employee Name</label> <br />
|
||||||
|
<input type="text" class="form-control" id="emp_name" name="emp_name" value="<?= isset($getData['emp_name']) && !empty($getData['emp_name']) ? $getData['emp_name'] : '' ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12" style="text-align: right;">
|
<div class="col-12" style="text-align: right;">
|
||||||
@ -318,18 +328,22 @@ function fetchEmpolyeeList(event) {
|
|||||||
var policy_id = $('#policies').val();
|
var policy_id = $('#policies').val();
|
||||||
var status = $('#status2').val();
|
var status = $('#status2').val();
|
||||||
var branch_id = $('#branch_id').val();
|
var branch_id = $('#branch_id').val();
|
||||||
|
var emp_code = $('#emp_code').val();
|
||||||
|
var emp_name = $('#emp_name').val();
|
||||||
|
|
||||||
// console.log(client_id + '-' + policy_id);
|
// console.log(client_id + '-' + policy_id);
|
||||||
if (client_id == '0' || policy_id == '0') {
|
// if (client_id == '0' || policy_id == '0') {
|
||||||
alert('Please select values in both dropdowns.');
|
// alert('Please select values in both dropdowns.');
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
var queryParams = {
|
var queryParams = {
|
||||||
|
|
||||||
client_id: client_id,
|
client_id: client_id,
|
||||||
policy_id: policy_id,
|
policy_id: policy_id,
|
||||||
branch_id: branch_id,
|
branch_id: branch_id,
|
||||||
|
emp_code : emp_code,
|
||||||
|
emp_name : emp_name,
|
||||||
status : status,
|
status : status,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -587,16 +587,25 @@
|
|||||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
||||||
"<'row'<'col-sm-12'tr>>" +
|
"<'row'<'col-sm-12'tr>>" +
|
||||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||||
"buttons": [{
|
buttons: [{
|
||||||
"extend": 'csv',
|
extend: 'csv',
|
||||||
"text": 'CSV',
|
text: 'CSV',
|
||||||
"title": 'Endorsement-List',
|
title: 'Endorsement-List',
|
||||||
"className": 'my_class',
|
className: 'my_class',
|
||||||
"exportOptions": {
|
exportOptions: {
|
||||||
"columns": ':not(:last-child)'
|
columns: ':not(:last-child)',
|
||||||
},
|
format: {
|
||||||
|
body: function (data, row, column, node) {
|
||||||
|
// Convert data to string to avoid scientific notation in CSV
|
||||||
|
if (!isNaN(data) && parseFloat(data) > 1e20) {
|
||||||
|
return `'${data}`;
|
||||||
|
}
|
||||||
|
return data.toString();// Ensures all data is treated as strings
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}],
|
}],
|
||||||
"initComplete": function(settings, json) {
|
initComplete: function(settings, json) {
|
||||||
$('.my_class').css({
|
$('.my_class').css({
|
||||||
"position": "relative",
|
"position": "relative",
|
||||||
"left": "79px"
|
"left": "79px"
|
||||||
@ -608,7 +617,12 @@
|
|||||||
},
|
},
|
||||||
paging: true,
|
paging: true,
|
||||||
// pagingType: 'full_numbers'
|
// pagingType: 'full_numbers'
|
||||||
|
columnDefs: [
|
||||||
|
{ type: 'scientific', targets: 0 } // Apply custom sorting type to the first column
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -136,6 +136,7 @@
|
|||||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="https://cdn.datatables.net/plug-ins/2.0.8/sorting/scientific.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
toastr.options = {
|
toastr.options = {
|
||||||
|
|||||||
@ -377,13 +377,18 @@ function generateTable(rack_rate_type) {
|
|||||||
$('#excel_table').html(table);
|
$('#excel_table').html(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($('.duplicate').length > 0) {
|
|
||||||
//console.log('test');
|
if(secondKey != 2){
|
||||||
toastr.warning("Duplicates found!", "warning");
|
console.log(secondKey)
|
||||||
$('.excel_table_class').empty();
|
if ($('.duplicate').length > 0) {
|
||||||
$('.excel_textarea').val('');
|
//console.log('test');
|
||||||
|
toastr.warning("Duplicates found!", "warning");
|
||||||
|
$('.excel_table_class').empty();
|
||||||
|
$('.excel_textarea').val('');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (emptyCellCount > 0) {
|
if (emptyCellCount > 0) {
|
||||||
toastr.warning('Number of empty cells: ' + emptyCellCount);
|
toastr.warning('Number of empty cells: ' + emptyCellCount);
|
||||||
$('.excel_table_class').empty();
|
$('.excel_table_class').empty();
|
||||||
@ -566,4 +571,5 @@ function submitData(rack_rate_type) {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user