744 lines
29 KiB
PHP
Executable File
744 lines
29 KiB
PHP
Executable File
<style>
|
||
.table th,
|
||
.table td {
|
||
padding: 8px;
|
||
}
|
||
|
||
table.dataTable tbody td {
|
||
padding: 4px 4px !important;
|
||
}
|
||
|
||
.btn .btn-secondary .buttons-csv .buttons-html5 .my_class {
|
||
position: relative;
|
||
left: 79px;
|
||
}
|
||
|
||
.visa_status_count_view .card-header {
|
||
/* background-color: #eb7a76; */
|
||
background-color: darkgrey;
|
||
/* padding-bottom: 1px; */
|
||
padding-top: 10px;
|
||
}
|
||
|
||
#tickets-table_filter {
|
||
float: right;
|
||
}
|
||
|
||
.click_hover {
|
||
background: #1aa79c !important;
|
||
color: #fff !important;
|
||
border-radius: 5px;
|
||
box-shadow: 6px 5px 8px 0 #00000036;
|
||
cursor: pointer;
|
||
}
|
||
.click_hover .text-muted{
|
||
color: #fff !important;
|
||
}
|
||
.click_hover span{
|
||
color: #fff !important;
|
||
}
|
||
.card {
|
||
border-radius: 10px;
|
||
}
|
||
</style>
|
||
|
||
<div class="row visa_status_count_view">
|
||
<div class="col-12">
|
||
<div class="card">
|
||
<div class="card-header">
|
||
<div class="row" style="margin-bottom: -22px;">
|
||
<div class="col-3">
|
||
<div id="categoryFilter" style="display: flex;">
|
||
<select class="form-control" id="clients" onchange="populateBranches()">
|
||
<option value="0">Select Client</option>
|
||
<?php foreach ($client_list as $client) { ?>
|
||
<option value="<?= $client['id'] ?>"><?= $client['client_name'] ?></option>
|
||
<?php } ?>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="col-3">
|
||
<div id="categoryFilter_11">
|
||
<select name="branch_id" class="form-control" id="branch_id">
|
||
<option value="0">Select Branch</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="col-1">
|
||
<div id="categoryFilter_11">
|
||
<a href="#" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Search</a>
|
||
</div>
|
||
</div>
|
||
<div class="col-2">
|
||
<div id="categoryFilter_12">
|
||
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="sendManualReminder(this)">Send Reminder</a>
|
||
</div>
|
||
</div>
|
||
<div class="col-2">
|
||
<div id="categoryFilter_13">
|
||
<a class="btn btn-primary waves-effect waves-light" onclick="uploadEnrollmentFile(this)" >Upload File</a>
|
||
</div>
|
||
</div>
|
||
<div class="col-1 text-right view-status-btn" style="position: relative;bottom: 7px;">
|
||
<button type="button" class="btn btn-link visa_status_button" onclick="toggleContent()" style="color: #000;">
|
||
Status <i id="toggleIcon" class="fas fa-minus"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="card-body status-option" id="statusContent" style="padding: 1.5rem !important;background-color: darkgrey;">
|
||
|
||
<div class="text-center">
|
||
|
||
<div class="row" style="margin-left: 125px; margin-bottom: -11px;">
|
||
<div class="col-xl-2 col-md-2">
|
||
<div class="card cardWidth">
|
||
<div class="card-body" id="emp_count_view_click">
|
||
<div class="d-flex justify-content-between" style="justify-content: center !important;">
|
||
<div>
|
||
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Emp Count">Emp Count</h5>
|
||
<h3 class="my-2 py-1"><span data-plugin="counterup" id="emp_count_view">0</span></h3>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div><!-- end col -->
|
||
<div class="col-xl-2 col-md-2">
|
||
<div class="card">
|
||
<div class="card-body" id="emp_enrolled_view_click">
|
||
<div class="d-flex justify-content-between" style="justify-content: center !important;">
|
||
<div>
|
||
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Enrolled">Enroled</h5>
|
||
<h3 class="my-2 py-1"><span data-plugin="counterup" id="emp_enrolled_view">0</span></h3>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div><!-- end col -->
|
||
<div class="col-xl-2 col-md-2">
|
||
<div class="card">
|
||
<div class="card-body" id="emp_not_enrolled_view_click">
|
||
<div class="d-flex justify-content-between" style="justify-content: center !important;">
|
||
<div>
|
||
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Not Enrolled">Not Enroled</h5>
|
||
<h3 class="my-2 py-1"><span data-plugin="counterup" id="emp_not_enrolled_view">0</span></h3>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div><!-- end col -->
|
||
<div class="col-xl-2 col-md-2">
|
||
<div class="card">
|
||
<div class="card-body" id="emp_logged_in_view_click">
|
||
<div class="d-flex justify-content-between" style="justify-content: center !important;">
|
||
<div>
|
||
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Logged-In">Logged-In</h5>
|
||
<h3 class="my-2 py-1"><span data-plugin="counterup" id="emp_logged_in_view">0</span></h3>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div><!-- end col -->
|
||
<div class="col-xl-2 col-md-2">
|
||
<div class="card">
|
||
<div class="card-body" id="emp_not_logged_in_view_click">
|
||
<div class="d-flex justify-content-between" style="justify-content: center !important;">
|
||
<div>
|
||
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Not Logged-In">Not Logged-In</h5>
|
||
<h3 class="my-2 py-1"><span data-plugin="counterup" id="emp_not_logged_in_view">0</span></h3>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div><!-- end col -->
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="row" id="client_list">
|
||
<div class="col-12">
|
||
<div class="card">
|
||
<div class="card-body">
|
||
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="tickets-table">
|
||
<thead class="bg-light">
|
||
<tr>
|
||
<th class="font-weight-medium">SNO</th>
|
||
<th class="font-weight-medium">Name</th>
|
||
<th class="font-weight-medium">Emp Code</th>
|
||
<th class="font-weight-medium">Enroled</th>
|
||
<th class="font-weight-medium">Logged-In</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody class="font-12">
|
||
<!-- Table body -->
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Center modal content -->
|
||
<div class="modal fade" id="upload_enrollment_model" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false">
|
||
<div class="modal-dialog modal-dialog-centered">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title" id="myCenterModalLabel">Upload Enrolment File</h4>
|
||
<button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<form class="parsley-examples" method="post" id="uploadForm" action="<?php echo base_url().'employee/upload'?>" enctype="multipart/form-data">
|
||
<input type="hidden" id="file_client_id" name="client_id">
|
||
<input type="hidden" id="file_branch_id" name="branch_id">
|
||
<input type="hidden" id="file_upload_actions" name="upload-action-type" value="enrollment">
|
||
<div class="form-group">
|
||
<div class="form-row">
|
||
<div class="form-group col-md-12">
|
||
<label for="policy_id">Client Policy<span class="text-danger">*</span></label>
|
||
<select class="form-control" id="policy_id" name="policy_id" required>
|
||
<option selected >Select Client Policy</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group col-md-6">
|
||
<label for="file">File<span class="text-danger">*</span></label>
|
||
<input type="file" id="fileInput" name="emplist" required
|
||
accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1">Upload</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div><!-- /.modal-content -->
|
||
</div><!-- /.modal-dialog -->
|
||
</div><!-- /.modal -->
|
||
|
||
<script>
|
||
function populateBranches()
|
||
{
|
||
var clientId = document.getElementById('clients').value;
|
||
var branchDropdown = document.getElementById('branch_id');
|
||
|
||
branchDropdown.innerHTML = '<option value="0">Select Branch</option>';
|
||
|
||
if (clientId == 0) {
|
||
return;
|
||
}
|
||
|
||
var branches = <?= json_encode($branch_list) ?>;
|
||
|
||
branches.forEach(branch => {
|
||
if (branch.client_id == clientId) {
|
||
var option = document.createElement('option');
|
||
option.value = branch.id;
|
||
option.textContent = branch.branch_name;
|
||
branchDropdown.appendChild(option);
|
||
}
|
||
});
|
||
}
|
||
|
||
function filterTable(columnIndex, filterValue)
|
||
{
|
||
var table = $('#tickets-table').DataTable();
|
||
|
||
// Reset the search filter for all columns
|
||
table.columns().search('').draw();
|
||
|
||
// Apply the filter to the specified column
|
||
table.column(columnIndex).search(filterValue).draw();
|
||
}
|
||
|
||
function fetchEmpolyeeList(event)
|
||
{
|
||
event.preventDefault();
|
||
|
||
var client_id = $('#clients').val();
|
||
var branch_id = $('#branch_id').val();
|
||
if (client_id == '0' || branch_id == '0') {
|
||
Swal.fire({
|
||
title: "warning!",
|
||
text: 'Please select the Client and Client Branch.',
|
||
icon: "warning"
|
||
});
|
||
return false;
|
||
}
|
||
|
||
$.ajax({
|
||
url: '<?php echo base_url(); ?>' + '/employee/empby_client_clientbranch/' + client_id + '/' + branch_id,
|
||
method: 'GET',
|
||
headers: {
|
||
"Content-Type": "application/json",
|
||
"X-Requested-With": "XMLHttpRequest"
|
||
},
|
||
beforeSend: function() {
|
||
$('.loader').fadeIn();
|
||
$('.loader-mask').fadeIn();
|
||
},
|
||
success: function(response) {
|
||
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
|
||
var data = JSON.parse(response);
|
||
console.log(data);
|
||
var table = $('#tickets-table').DataTable();
|
||
table.clear();
|
||
|
||
if (data.length === 0) {
|
||
table.row.add([
|
||
'',
|
||
'',
|
||
'No data available',
|
||
'',
|
||
'',
|
||
''
|
||
]).draw();
|
||
return;
|
||
}
|
||
var enrolled_count = 0;
|
||
var loggedIn_count = 0;
|
||
data.forEach(function(employee, index) {
|
||
|
||
if(employee.emp_status !== 'draft'){
|
||
var enrolled = 'Yes';
|
||
enrolled_count++;
|
||
}else{
|
||
var enrolled = 'No';
|
||
}
|
||
|
||
if(employee.user_type === 'employee'){
|
||
var loggedIn = 'Yes';
|
||
loggedIn_count++;
|
||
}else{
|
||
var loggedIn = 'No';
|
||
}
|
||
|
||
table.row.add([
|
||
index + 1,
|
||
employee.employee_name,
|
||
employee.emp_code,
|
||
enrolled,
|
||
loggedIn
|
||
]);
|
||
|
||
$('#emp_count_view').html(data.length);
|
||
$('#emp_enrolled_view').html(enrolled_count);
|
||
$('#emp_not_enrolled_view').html(data.length - enrolled_count);
|
||
$('#emp_logged_in_view').html(loggedIn_count);
|
||
$('#emp_not_logged_in_view').html(data.length - loggedIn_count);
|
||
|
||
});
|
||
|
||
table.draw();
|
||
|
||
function getUrlParameter(name) {
|
||
var params = new URLSearchParams(window.location.search);
|
||
return params.get(name);
|
||
}
|
||
|
||
},
|
||
error: function(xhr, status, error) {
|
||
console.error(xhr.responseText);
|
||
console.error(status, error);
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
}
|
||
});
|
||
}
|
||
|
||
$(document).ready(function()
|
||
{
|
||
|
||
function getUrlParameter(name) {
|
||
var params = new URLSearchParams(window.location.search);
|
||
return params.get(name);
|
||
}
|
||
|
||
// Check for URL parameters and set form values
|
||
var client_id = getUrlParameter('client_id');
|
||
var branch_id = getUrlParameter('branch_id');
|
||
var type = getUrlParameter('type');
|
||
|
||
if (client_id) {
|
||
$('#clients').val(client_id).trigger('change'); // Set client ID and trigger change event to populate branches
|
||
}
|
||
|
||
if (branch_id) {
|
||
setTimeout(function() { // Ensure branches are populated before setting branch ID
|
||
$('#branch_id').val(branch_id).trigger('change');
|
||
if($('#branch_id').val() != 0){
|
||
$('#get-emp-list').click().trigger();
|
||
}
|
||
}, 500);
|
||
|
||
}
|
||
if (history.pushState) {
|
||
var newUrl = window.location.protocol + "//" + window.location.host + window.location.pathname;
|
||
window.history.pushState({path: newUrl}, '', newUrl);
|
||
}
|
||
|
||
setTimeout(() => {
|
||
// var type = getUrlParameter('type');
|
||
console.log("------------------------");
|
||
console.log(type);
|
||
$('#' + type).click().trigger();
|
||
}, 1000);
|
||
|
||
$('#clients').select2();
|
||
$('#policy_id').select2();
|
||
$('#branch_id').select2();
|
||
var table = $('#tickets-table').DataTable({
|
||
dom: 'fBrtip',
|
||
buttons: [
|
||
{
|
||
extend: 'copy',
|
||
text: '<i class="fa fa-copy"></i>',
|
||
titleAttr: 'Copy',
|
||
filename: 'Enrolment List'
|
||
},
|
||
{
|
||
extend: 'print',
|
||
text: '<i class="fa fa-print"></i>',
|
||
titleAttr: 'Print',
|
||
filename: 'Enrolment List'
|
||
},
|
||
{
|
||
extend: 'pdf',
|
||
text: '<i class="fa fa-file-pdf"></i>',
|
||
titleAttr: 'PDF',
|
||
filename: 'Enrolment List'
|
||
},
|
||
{
|
||
extend: 'csv',
|
||
text: '<i class="fa fa-file-csv"></i>',
|
||
titleAttr: 'CSV',
|
||
filename: 'Enrolment List'
|
||
}
|
||
],
|
||
initComplete: function() {
|
||
// Add custom class to the print button
|
||
$('.buttons-print').addClass('buttons-html5');
|
||
}
|
||
});
|
||
|
||
|
||
$('#emp_enrolled_view_click').on('click', function() {
|
||
if ($(this).hasClass('click_hover')) {
|
||
// $(this).removeClass('click_hover');
|
||
$('.click_hover').each(function() {
|
||
$(this).removeClass('click_hover');
|
||
});
|
||
table.columns().search('').draw(); // Clear all filters and show all data
|
||
}else{
|
||
$('.click_hover').each(function() {
|
||
$(this).removeClass('click_hover');
|
||
});
|
||
$('#emp_enrolled_view_click').addClass('click_hover');
|
||
filterTable(3, 'Yes'); // Filter "Enrolled" column (4th column, index 3)
|
||
}
|
||
});
|
||
|
||
$('#emp_not_enrolled_view_click').on('click', function() {
|
||
if ($(this).hasClass('click_hover')) {
|
||
// $(this).removeClass('click_hover');
|
||
$('.click_hover').each(function() {
|
||
$(this).removeClass('click_hover');
|
||
});
|
||
table.columns().search('').draw(); // Clear all filters and show all data
|
||
}else{
|
||
$('.click_hover').each(function() {
|
||
$(this).removeClass('click_hover');
|
||
});
|
||
$('#emp_not_enrolled_view_click').addClass('click_hover');
|
||
filterTable(3, 'No'); // Filter "Enrolled" column (4th column, index 3)
|
||
}
|
||
});
|
||
|
||
$('#emp_logged_in_view_click').on('click', function() {
|
||
if ($(this).hasClass('click_hover')) {
|
||
// $(this).removeClass('click_hover');
|
||
$('.click_hover').each(function() {
|
||
$(this).removeClass('click_hover');
|
||
});
|
||
table.columns().search('').draw(); // Clear all filters and show all data
|
||
}else{
|
||
$('.click_hover').each(function() {
|
||
$(this).removeClass('click_hover');
|
||
});
|
||
$('#emp_logged_in_view_click').addClass('click_hover');
|
||
filterTable(4, 'Yes'); // Filter "Logged-In" column (5th column, index 4)
|
||
}
|
||
});
|
||
|
||
$('#emp_not_logged_in_view_click').on('click', function() {
|
||
if ($(this).hasClass('click_hover')) {
|
||
// $(this).removeClass('click_hover');
|
||
$('.click_hover').each(function() {
|
||
$(this).removeClass('click_hover');
|
||
});
|
||
table.columns().search('').draw(); // Clear all filters and show all data
|
||
}else{
|
||
$('.click_hover').each(function() {
|
||
$(this).removeClass('click_hover');
|
||
});
|
||
$('#emp_not_logged_in_view_click').addClass('click_hover');
|
||
filterTable(4, 'No'); // Filter "Logged-In" column (5th column, index 4)
|
||
}
|
||
});
|
||
|
||
$('#emp_count_view_click').on('click', function() {
|
||
if ($(this).hasClass('click_hover')) {
|
||
// $(this).removeClass('click_hover');
|
||
$('.click_hover').each(function() {
|
||
$(this).removeClass('click_hover');
|
||
});
|
||
table.columns().search('').draw(); // Clear all filters and show all data
|
||
}else{
|
||
$('.click_hover').each(function() {
|
||
$(this).removeClass('click_hover');
|
||
});
|
||
$('#emp_count_view_click').addClass('click_hover');
|
||
table.columns().search('').draw(); // Clear all filters and show all data
|
||
}
|
||
});
|
||
|
||
toggleContent();
|
||
});
|
||
|
||
function toggleContent()
|
||
{
|
||
var content = document.getElementById("statusContent");
|
||
var toggleIcon = document.getElementById("toggleIcon");
|
||
if (content.style.display === "none") {
|
||
content.style.display = "block";
|
||
toggleIcon.classList.remove("fa-plus");
|
||
toggleIcon.classList.add("fa-minus");
|
||
} else {
|
||
content.style.display = "none";
|
||
toggleIcon.classList.remove("fa-minus");
|
||
toggleIcon.classList.add("fa-plus");
|
||
}
|
||
}
|
||
|
||
//----------------------------------------------------------------------------------------------------
|
||
|
||
|
||
function uploadEnrollmentFile(input)
|
||
{
|
||
console.log('uploadEnrollmentFile called');
|
||
|
||
var client_id = $('#clients').val()
|
||
var client_branch_id = $('#branch_id').val()
|
||
|
||
console.log('input', input);
|
||
console.log('client_id', client_id);
|
||
console.log('client_branch_id', client_branch_id);
|
||
|
||
if(client_id == 0 && client_branch_id == 0){
|
||
|
||
Swal.fire({
|
||
title: "warning!",
|
||
text: 'Please select the Client and Client Branch.',
|
||
icon: "warning"
|
||
});
|
||
return false
|
||
}
|
||
|
||
// $('#upload_enrollment_model').modal('show');
|
||
var myModal = new bootstrap.Modal(document.getElementById('upload_enrollment_model'));
|
||
myModal.show();
|
||
|
||
$('#file_client_id').val(client_id);
|
||
$('#file_branch_id').val(client_branch_id);
|
||
|
||
$.ajax({
|
||
url: '<?= base_url("util/get_client_policy_list_for_remainder/") ?>' + client_id + '/' + client_branch_id,
|
||
type: "GET",
|
||
dataType: 'json',
|
||
success: function(res) {
|
||
|
||
console.log('uploadEnrollmentFile policy list', res)
|
||
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
|
||
if (res.status === false) {
|
||
toastr.error(res.status);
|
||
return;
|
||
}
|
||
|
||
appendpolicy(res.data)
|
||
|
||
},
|
||
error: function(xhr, status, error) {
|
||
console.error(xhr.responseText);
|
||
console.error(status, error);
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
}
|
||
});
|
||
|
||
}
|
||
|
||
function appendpolicy(data)
|
||
{
|
||
|
||
$('#policy_id').empty();
|
||
$('#policy_id').append($('<option>', {
|
||
value: '',
|
||
text: 'Select',
|
||
selected: true
|
||
}));
|
||
|
||
$.each(data, function(index, item) {
|
||
var option = $('<option>', {
|
||
value: item.id,
|
||
text:`${item.policy_name ?? ''} - ${item.policy_no ?? ''}`
|
||
});
|
||
$('#policy_id').append(option);
|
||
});
|
||
|
||
}
|
||
|
||
$(document).ready(function() {
|
||
$("#uploadForm").submit(function(event) {
|
||
event.preventDefault(); // Prevent the default form submission
|
||
|
||
var client_id = $('#clients').val()
|
||
var client_branch_id = $('#branch_id').val()
|
||
|
||
var isValid = $('#uploadForm').parsley().validate();
|
||
if (!isValid) {
|
||
console.log('Form is Empty', 'Warning');
|
||
return;
|
||
}
|
||
|
||
if(client_id == 0 && client_branch_id == 0){
|
||
toastr.warning('Select Client and Client Branch');
|
||
return false;
|
||
}
|
||
|
||
var formData = new FormData($(this)[0]);
|
||
|
||
$.ajax({
|
||
url: $(this).attr("action"),
|
||
type: 'POST',
|
||
data: formData,
|
||
processData: false, // Prevent jQuery from automatically processing the data
|
||
contentType: false, // Let jQuery handle the content type
|
||
headers: {
|
||
"X-Requested-With": "XMLHttpRequest"
|
||
},
|
||
beforeSend: function() {
|
||
$('.loader').fadeIn();
|
||
$('.loader-mask').fadeIn();
|
||
},
|
||
success: function(response) {
|
||
// Request successful, handle response
|
||
console.log('Enrollment list:', response);
|
||
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
|
||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||
toastr.success('File upload success, Data validation is in-progress', 'success');
|
||
setTimeout(function() {
|
||
window.location.href = '<?= base_url("employee/upload/") ?>';
|
||
}, 600);
|
||
} else if (response.code === 404 && response.dataStatus === false) {
|
||
console.error('No data found', response);
|
||
toastr.error(response.message, 'error');
|
||
setTimeout(function() {
|
||
window.location.href = '<?= base_url("employee/upload/") ?>';
|
||
}, 600);
|
||
} else {
|
||
console.error('Something went wrong!');
|
||
// toastr.error('Something went wrong! Try later', 'Error');
|
||
setTimeout(function() {
|
||
window.location.href = '<?= base_url("employee/upload/") ?>';
|
||
}, 600);
|
||
}
|
||
},
|
||
error: function(xhr, status, error) {
|
||
// Request failed, handle error
|
||
console.error("Request failed:", status, error);
|
||
console.error('Response:', xhr.responseText);
|
||
// toastr.error('Something went wrong! Try later', 'Error');
|
||
setTimeout(function() {
|
||
window.location.href = '<?= base_url("employee/upload/") ?>';
|
||
}, 1000);
|
||
},
|
||
complete: function() {
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
}
|
||
});
|
||
});
|
||
});
|
||
|
||
|
||
function sendManualReminder(input)
|
||
{
|
||
console.log('sendManualReminder function called');
|
||
|
||
var client_id = $('#clients').val()
|
||
var client_branch_id = $('#branch_id').val()
|
||
|
||
console.log('input', input);
|
||
console.log('client_id', client_id);
|
||
console.log('client_branch_id', client_branch_id);
|
||
|
||
if(client_id == 0 && client_branch_id == 0)
|
||
{
|
||
Swal.fire({
|
||
title: "warning!",
|
||
text: 'Please select the Client and Client Branch.',
|
||
icon: "warning"
|
||
});
|
||
|
||
return false
|
||
}
|
||
|
||
$.ajax({
|
||
url: '<?= base_url("util/send_manual_remainder/") ?>' + client_id + '/' + client_branch_id,
|
||
type: "GET",
|
||
dataType: 'json',
|
||
success: function(res) {
|
||
|
||
console.log('send_manual_remainder', res)
|
||
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
|
||
if(res.status == false){
|
||
toastr.info(res.message, 'INFO');
|
||
}else{
|
||
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');
|
||
}
|
||
});
|
||
|
||
}
|
||
</script>
|