622 lines
25 KiB
PHP
622 lines
25 KiB
PHP
<?php
|
||
helper('datatable_view');
|
||
$hr_header_labels = ['S.No', 'File name', 'Client', 'Client Branch', 'Policy', 'Event', 'User/Time', 'Status', 'Action'];
|
||
$hr_col_count = count($hr_header_labels);
|
||
$hr_col_max_len = array_fill(0, $hr_col_count, 0);
|
||
for ($i = 0; $i < $hr_col_count; $i++) {
|
||
$hr_col_max_len[$i] = mb_strlen($hr_header_labels[$i]);
|
||
}
|
||
$hr_col_max_len[1] = max($hr_col_max_len[1], 28);
|
||
$hr_col_max_len[2] = max($hr_col_max_len[2], 12);
|
||
$hr_col_max_len[3] = max($hr_col_max_len[3], 14);
|
||
$hr_col_max_len[4] = max($hr_col_max_len[4], 16);
|
||
$hr_col_max_len[5] = max($hr_col_max_len[5], 14);
|
||
$hr_col_max_len[6] = max($hr_col_max_len[6], 28);
|
||
$hr_col_min_px = [48, 120, 88, 96, 120, 88, 200, 96, 52];
|
||
$hr_col_max_px = [64, 480, 240, 240, 360, 200, 520, 200, 72];
|
||
$hr_col_width_px = nhance_dt_column_widths_px($hr_header_labels, $hr_col_max_len, $hr_col_min_px, $hr_col_max_px);
|
||
?>
|
||
<style>
|
||
.select2-container .select2-selection--multiple .select2-selection__choice {
|
||
padding: 5px 7px 5px 0 !important;
|
||
color: #000000;
|
||
}
|
||
.dataTables_length label {height: 21px !important;}
|
||
|
||
/* Compact table + buttons — match file_list.php / Data From Client */
|
||
#hr_tickets_table tbody td {
|
||
padding: 6px 12px !important;
|
||
font-size: 13px;
|
||
line-height: 1.25;
|
||
}
|
||
#hr_tickets_table_wrapper .dataTables_scrollHead table thead th,
|
||
#hr_tickets_table thead th {
|
||
padding: 6px 2.35rem 6px 12px !important;
|
||
font-size: 13px;
|
||
line-height: 1.25;
|
||
}
|
||
#hr_tickets_table .font-12 {
|
||
font-size: 12px;
|
||
}
|
||
#hr_tickets_table .dropdown-toggle.btn-sm {
|
||
padding: 4px 9px !important;
|
||
font-size: 13px;
|
||
line-height: 1.2;
|
||
}
|
||
#hr_tickets_table_wrapper .dt-buttons .btn {
|
||
padding: 6px 13px !important;
|
||
font-size: 13px;
|
||
}
|
||
#hr_tickets_table_wrapper .dt-buttons .btn .btn-custom {
|
||
font-size: 13px;
|
||
}
|
||
#hr_tickets_table {
|
||
width: 100% !important;
|
||
/* Tighter row gap than global card spacing (header.php uses 8px) */
|
||
border-spacing: 0 4px !important;
|
||
}
|
||
#hr_tickets_table thead th {
|
||
white-space: nowrap;
|
||
vertical-align: middle;
|
||
}
|
||
#hr_tickets_table_wrapper .datatable-search-wrapper {
|
||
width: auto !important;
|
||
}
|
||
#hr_tickets_table_wrapper .dataTables_filter {
|
||
margin-bottom: 0;
|
||
}
|
||
#hr_tickets_table_wrapper .dataTables_filter input {
|
||
width: 220px !important;
|
||
padding-right: 34px !important;
|
||
}
|
||
#hr_tickets_table_wrapper .row.align-items-center {
|
||
flex-wrap: nowrap;
|
||
}
|
||
#hr_tickets_table_wrapper .dataTables_info,
|
||
#hr_tickets_table_wrapper .dataTables_length,
|
||
#hr_tickets_table_wrapper .dataTables_paginate {
|
||
white-space: nowrap;
|
||
}
|
||
#hr_tickets_table_wrapper .datatable-search-icon,
|
||
#hr_tickets_table_wrapper .datatable-clear-icon {
|
||
right: 11px !important;
|
||
}
|
||
#hr_tickets_table_wrapper .dt-buttons {
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
align-items: center;
|
||
}
|
||
#hr_tickets_table_wrapper .dataTables_scrollHeadInner,
|
||
#hr_tickets_table_wrapper .dataTables_scrollHeadInner table,
|
||
#hr_tickets_table_wrapper .dataTables_scrollBody table {
|
||
width: 100% !important;
|
||
}
|
||
#hr_tickets_table tbody tr:hover {
|
||
background-color: #e0e0e0;
|
||
}
|
||
#hr-file-list-page .card-body > .table-responsive:not(:has(.dataTables_scrollBody)) {
|
||
overflow-x: auto !important;
|
||
-webkit-overflow-scrolling: touch;
|
||
max-width: 100%;
|
||
}
|
||
#hr-file-list-page .card-body > .table-responsive:has(.dataTables_scrollBody) {
|
||
overflow-x: visible !important;
|
||
-webkit-overflow-scrolling: auto;
|
||
max-width: 100%;
|
||
}
|
||
|
||
<?php for ($i = 0; $i < $hr_col_count; $i++) : ?>
|
||
#hr_tickets_table_wrapper .dataTables_scrollHead table thead th:nth-child(<?= $i + 1 ?>),
|
||
#hr_tickets_table thead th:nth-child(<?= $i + 1 ?>) {
|
||
min-width: <?= (int) $hr_col_width_px[$i] ?>px;
|
||
width: <?= (int) $hr_col_width_px[$i] ?>px;
|
||
box-sizing: border-box;
|
||
vertical-align: middle;
|
||
overflow: visible !important;
|
||
}
|
||
#hr_tickets_table tbody td:nth-child(<?= $i + 1 ?>) {
|
||
width: <?= (int) $hr_col_width_px[$i] ?>px;
|
||
max-width: <?= (int) $hr_col_width_px[$i] ?>px;
|
||
min-width: <?= (int) $hr_col_width_px[$i] ?>px;
|
||
box-sizing: border-box;
|
||
vertical-align: middle;
|
||
}
|
||
<?php endfor; ?>
|
||
#hr_tickets_table tbody td:nth-child(1),
|
||
#hr_tickets_table tbody td:nth-child(2),
|
||
#hr_tickets_table tbody td:nth-child(3),
|
||
#hr_tickets_table tbody td:nth-child(4),
|
||
#hr_tickets_table tbody td:nth-child(5),
|
||
#hr_tickets_table tbody td:nth-child(6),
|
||
#hr_tickets_table tbody td:nth-child(7),
|
||
#hr_tickets_table tbody td:nth-child(8) {
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
}
|
||
#hr_tickets_table tbody td:nth-child(9) {
|
||
overflow: visible;
|
||
text-overflow: clip;
|
||
}
|
||
|
||
</style>
|
||
|
||
<div class="tab-pane fade" id="HR-DOC-tab">
|
||
<div class="row">
|
||
<div class="col-xl-12">
|
||
<div id="accordion" class="mb-3">
|
||
<div class="card mb-1">
|
||
|
||
<h4 class="m-1">
|
||
<span>Filters</span>
|
||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true">
|
||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||
</a>
|
||
</h4>
|
||
|
||
<!-- <h5 class="m-1">
|
||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true">
|
||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||
</a>
|
||
</h5>
|
||
<label id="filterAccordion" class="m-1 d-flex justify-content-between align-items-center">
|
||
<span class="font-color-black">Filters</span>
|
||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true">
|
||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||
</a>
|
||
</label> -->
|
||
|
||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||
<div class="card-body">
|
||
<!-- <div class="text-center"> -->
|
||
<form class="parsley-examples" id="hr_file_upload_search" >
|
||
<input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>" id="csrf_token">
|
||
<input type="hidden" name="hr_file_type" value="CRM">
|
||
|
||
<div class="form-group">
|
||
<div class="form-row">
|
||
<div class="form-group col-md-4">
|
||
<label>Client</label> <br />
|
||
<select name="client_id" class="form-control" id="client2" >
|
||
<option value="">Select</option>
|
||
</select>
|
||
</div>
|
||
|
||
<div class="form-group col-md-4">
|
||
<label>Branch</label> <br />
|
||
<select name="client_branch_id" class="form-control" id="client_branch_id2" >
|
||
<option value="0">Select</option>
|
||
</select>
|
||
</div>
|
||
|
||
<div class="form-group col-md-4">
|
||
<label>Policy</label> <br />
|
||
<select name="policy_id" class="form-control" id="policy2" >
|
||
<option value="">Select</option>
|
||
</select>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="form-row">
|
||
|
||
<div class="form-group col-md-4">
|
||
<label>Event<span class="text-danger">*</span></label> <br />
|
||
<select name="file_action" class="form-control" id="event_type" required>
|
||
<option value="">Select</option>
|
||
<?php
|
||
if (isset($events) && count($events)) {
|
||
foreach ($events as $key => $action) {
|
||
if($key != "inception"){
|
||
echo "<option value='$key'" . ($key == "si_enhancement" ? " class='si-enhancement-option'" : "") . ">$action</option>";
|
||
}
|
||
}
|
||
}
|
||
?>
|
||
</select>
|
||
</div>
|
||
|
||
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<div class="form-row" id="">
|
||
<div class="d-flex align-items-center justify-content-start" style="margin-top: 18px;">
|
||
<div class="form-group col-md-3">
|
||
<button type="submit" class="btn btn-primary waves-effect waves-light justify-content-end">Search</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- end page title -->
|
||
<div class="row" id="hr_file_list">
|
||
<div class="col-12" id="hr-file-list-page">
|
||
<div class="card">
|
||
<div class="card-body">
|
||
<div class="row" style="padding-bottom: 10px;">
|
||
<div class="col-6" style="align-self: center;">
|
||
<h4 style="position: relative;">Files</h4>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="table-responsive">
|
||
<table data-custom-table-css="table" class="table mb-0 nowrap w-100 table-centered" cellspacing="0"
|
||
id="hr_tickets_table">
|
||
<thead class="bg-light">
|
||
<tr>
|
||
<th class="font-weight-medium"><div class="column-header">S.No</div></th>
|
||
<th class="font-weight-medium"><div class="column-header">File name</div></th>
|
||
<th class="font-weight-medium"><div class="column-header">Client</div></th>
|
||
<th class="font-weight-medium"><div class="column-header">Client Branch</div></th>
|
||
<th class="font-weight-medium"><div class="column-header">Policy</div></th>
|
||
<th class="font-weight-medium"><div class="column-header">Event</div></th>
|
||
<th class="font-weight-medium"><div class="column-header">User/Time</div></th>
|
||
<th class="font-weight-medium"><div class="column-header">Status</div></th>
|
||
<th class="font-weight-medium"><div class="column-header">Action</div></th>
|
||
</tr>
|
||
</thead>
|
||
|
||
<tbody class="font-12">
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div><!-- end col -->
|
||
|
||
</div>
|
||
<!-- end row -->
|
||
</div>
|
||
|
||
<!-- Center modal content for reupload file-->
|
||
<div class="modal fade" id="hr-file-upload-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||
<div class="modal-dialog modal-dialog-centered">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title" id="myCenterModalLabel">Endorsement Upload</h4>
|
||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<form class="parsley-examples" id="hrUploadForm" enctype="multipart/form-data">
|
||
<input type="hidden" id="hr_file_client_id" name="client_id">
|
||
<input type="hidden" id="hr_file_policy_id" name="policy_id">
|
||
<input type="hidden" id="hr_file_branch_id" name="branch_id">
|
||
<input type="hidden" id="hr_file_hr_file_id" name="hr_file_id">
|
||
<input type="hidden" id="hr_file_upload_actions" name="upload-action-type">
|
||
<input type="file" id="fileInput" name="emplist" required
|
||
accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet">
|
||
<small class="text-muted d-block">Allowed: XLS, XLSX. Size : 25MB</small>
|
||
<button type="submit" class="btn btn-primary">Upload</button>
|
||
</form>
|
||
</div>
|
||
</div><!-- /.modal-content -->
|
||
</div><!-- /.modal-dialog -->
|
||
</div><!-- /.modal -->
|
||
|
||
|
||
<script>
|
||
|
||
$(document).ready(function(){
|
||
|
||
//client change to get the Client Branch
|
||
$('#client2').change(function(){
|
||
let client_id = $(this).val();
|
||
console.log('client_id', client_id);
|
||
|
||
if(branch_list != '') {
|
||
// console.log(branch_list[client_id]);
|
||
let data = branch_list[client_id];
|
||
appendBranch3(data);
|
||
}
|
||
})
|
||
|
||
//change the client branch than change the client policy
|
||
$('#client_branch_id2').change(function(){
|
||
|
||
let branch_id = $(this).val();
|
||
console.log("branch_id", branch_id);
|
||
|
||
if(policy_list != '' && branch_id != '') {
|
||
let data = policy_list[branch_id];
|
||
appendPolicy3(data);
|
||
}
|
||
});
|
||
})
|
||
|
||
$(document).ready(function() {
|
||
// Initialize select2
|
||
$("#client2").select2();
|
||
$("#policy2").select2();
|
||
$("#client_branch_id2").select2();
|
||
|
||
// Form submit event — reload server-side DataTable with HR form filters
|
||
$("#hr_file_upload_search").on("submit", function (e) {
|
||
e.preventDefault();
|
||
|
||
window.hrFileListFilters = window.hrFileListFilters || {};
|
||
window.hrFileListFilters.client_id = $('#client2').val() || '';
|
||
window.hrFileListFilters.client_branch_id = $('#client_branch_id2').val() || '';
|
||
window.hrFileListFilters.policy_id = $('#policy2').val() || '';
|
||
window.hrFileListFilters.file_action = $('#hr_file_upload_search #event_type').val() || '';
|
||
window.hrFileListFilters.event_type = $('#hr_file_upload_search #event_type').val() || '';
|
||
window.hrFileListFilters.use_default_date = '0';
|
||
|
||
if (window.hrFileTableInstance) {
|
||
window.hrFileTableInstance.ajax.reload();
|
||
}
|
||
});
|
||
});
|
||
|
||
// ------------ Append Functions are Below ----------------------------------------------------------------------------------
|
||
|
||
function appendClients3(data)
|
||
{
|
||
$('#client2').empty();
|
||
|
||
$('#client2').append($('<option>', {
|
||
value: '',
|
||
text: 'Select Client'
|
||
}));
|
||
|
||
$.each(data, function(index, item) {
|
||
|
||
let client_show_name = item.client_name;
|
||
if (item.client_type == 2) {
|
||
client_show_name = item.client_name + (item.dob ? ('- (' + item.dob + ' )' ) : '') + (item.pan ? ('- ' + item.pan ) : '');
|
||
// console.log(client_show_name);
|
||
}
|
||
|
||
var option = $('<option>', {
|
||
value: item.id,
|
||
text: client_show_name,
|
||
'data-cn': item.client_name,
|
||
'data-ct': item.client_type,
|
||
});
|
||
|
||
$('#client2').append(option);
|
||
});
|
||
}
|
||
|
||
function appendBranch3(data)
|
||
{
|
||
|
||
$('#client_branch_id2').empty();
|
||
$('#client_branch_id2').append($('<option>', {
|
||
value: '',
|
||
text: 'Select Branch'
|
||
}));
|
||
|
||
$.each(data, function(index, item) {
|
||
|
||
var option = $('<option>', {
|
||
value: item.id,
|
||
text: item.branch_name
|
||
});
|
||
$('#client_branch_id2').append(option);
|
||
});
|
||
}
|
||
|
||
function appendPolicy3(data)
|
||
{
|
||
$('#policy2').empty();
|
||
$('#policy2').append($('<option>', {
|
||
value: '',
|
||
text: 'Select Policy',
|
||
}));
|
||
|
||
$.each(data, function(index, item) {
|
||
var option = $('<option>', {
|
||
value: item.id,
|
||
text: item.policy_type + '-' + item.policy_no,
|
||
});
|
||
$('#policy2').append(option);
|
||
});
|
||
}
|
||
|
||
// ----------------------------------------------------------------------------------------------
|
||
|
||
// for datatable
|
||
window.hrFileTableInstance = window.hrFileTableInstance || null;
|
||
function fixHrUploadTableHeaderWidth() {
|
||
const $wrapper = $('#hr_tickets_table_wrapper');
|
||
if (!$wrapper.length) {
|
||
return;
|
||
}
|
||
$wrapper.find('.dataTables_scrollHeadInner, .dataTables_scrollHeadInner table, .dataTables_scrollBody table')
|
||
.css('width', '100%');
|
||
|
||
if (window.hrFileTableInstance) {
|
||
window.hrFileTableInstance.columns.adjust().draw(false);
|
||
}
|
||
}
|
||
|
||
$(document).ready(function() {
|
||
if (window.hrFileTableInstance) {
|
||
return;
|
||
}
|
||
|
||
window.hrFileListFilters = window.hrFileListFilters || {
|
||
client_id: '',
|
||
client_branch_id: '',
|
||
policy_id: '',
|
||
file_action: '',
|
||
event_type: '',
|
||
use_default_date: '1'
|
||
};
|
||
|
||
nhanceListDataTableBeforeInit();
|
||
window.hrFileTableInstance = $('#hr_tickets_table').DataTable(nhanceMergeListDataTableOptions({
|
||
processing: true,
|
||
serverSide: true,
|
||
deferRender: true,
|
||
searchDelay: 400,
|
||
pageLength: 10,
|
||
scrollX: false,
|
||
scrollY: false,
|
||
scrollCollapse: false,
|
||
autoWidth: false,
|
||
responsive: false,
|
||
columns: (function() {
|
||
var cols = [];
|
||
for (var i = 0; i < <?= (int) $hr_col_count ?>; i++) {
|
||
cols.push({ data: String(i), orderable: false });
|
||
}
|
||
return cols;
|
||
})(),
|
||
ajax: {
|
||
url: '<?= base_url("employee/upload/hr-file-list/datatable") ?>',
|
||
type: 'POST',
|
||
data: function(d) {
|
||
return $.extend({}, d, window.hrFileListFilters || {}, {
|
||
// Also allow sidebar filters to apply when present
|
||
start_date: (window.uploadListFilters && window.uploadListFilters.start_date) || '',
|
||
end_date: (window.uploadListFilters && window.uploadListFilters.end_date) || ''
|
||
});
|
||
}
|
||
},
|
||
dom: "<'row'<'col-sm-7'f><'col-sm-5 text-right'B>>" +
|
||
"<'row'<'col-sm-12'tr>>" +
|
||
"<'row align-items-center'<'col-5 text-start'i><'col-7 d-flex justify-content-end align-items-center'<'me-2'l>p>>",
|
||
lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]],
|
||
buttons: [{
|
||
extend: 'collection',
|
||
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
||
className: 'btn app-btn-secondary mr-2',
|
||
buttons: [
|
||
{
|
||
extend: 'csv',
|
||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||
title: 'HR-Uploaded-Files',
|
||
className: 'app-btn-primary ',
|
||
exportOptions: {
|
||
columns: ':not(:last-child)'
|
||
},
|
||
}
|
||
]
|
||
}
|
||
],
|
||
language: {
|
||
search: `
|
||
<div class="datatable-search-wrapper" style="position:relative; display:inline-block;">
|
||
_INPUT_
|
||
<i class="mdi mdi-magnify datatable-search-icon"
|
||
style="position:absolute; right:10px; top:50%; transform:translateY(-50%); color:#666;"></i>
|
||
<i class="mdi mdi-close-circle datatable-clear-icon"
|
||
style="position:absolute; right:10px; top:50%; transform:translateY(-50%); color:#666; display:none;"></i>
|
||
</div>`,
|
||
searchPlaceholder: "Search",
|
||
emptyTable: '<div class="text-center text-muted">No Data found</div>'
|
||
},
|
||
paging: true,
|
||
ordering: false,
|
||
columnDefs: [
|
||
<?php for ($i = 0; $i < $hr_col_count; $i++) : ?>
|
||
{ targets: <?= $i ?>, width: '<?= (int) $hr_col_width_px[$i] ?>px' },
|
||
<?php endfor; ?>
|
||
],
|
||
initComplete: function () {
|
||
$(this.api().table().container()).closest('.table-responsive').addClass('nh-dt-no-outer-scroll');
|
||
},
|
||
}));
|
||
nhanceListDataTableAfterInit();
|
||
nhanceListDataTableBindAdjust(window.hrFileTableInstance);
|
||
setTimeout(fixHrUploadTableHeaderWidth, 0);
|
||
});
|
||
|
||
$(document).on('shown.bs.tab shown.bs.collapse shown.bs.modal', function() {
|
||
setTimeout(fixHrUploadTableHeaderWidth, 50);
|
||
});
|
||
|
||
//for initialize the file upload for the files table
|
||
function uploadEndorsementFile(client_id, branch_id, policy_id, file_id, event){
|
||
|
||
console.log(client_id, branch_id, policy_id, file_id, event);
|
||
|
||
$('#hr_file_client_id').val(client_id);
|
||
$('#hr_file_branch_id').val(branch_id);
|
||
$('#hr_file_policy_id').val(policy_id);
|
||
$('#hr_file_upload_actions').val(event);
|
||
$('#hr_file_hr_file_id').val(file_id);
|
||
|
||
var myModal = new bootstrap.Modal(document.getElementById('hr-file-upload-modal'));
|
||
myModal.show();
|
||
}
|
||
|
||
//hr file upload reupload to the files table
|
||
$('#hrUploadForm').submit(function(e) {
|
||
|
||
e.preventDefault();
|
||
|
||
var isValid = $('#hrUploadForm').parsley().validate();
|
||
if (!isValid) {
|
||
console.log('Form is Empty', 'Warning');
|
||
return;
|
||
}
|
||
|
||
// Create FormData object
|
||
var formData = new FormData($(this)[0]);
|
||
for (var pair of formData.entries()) {
|
||
console.log(pair[0] + ', ' + pair[1]);
|
||
}
|
||
|
||
// return false;
|
||
$.ajax({
|
||
url: `<?= base_url('employee/upload') ?>`,
|
||
type: "POST",
|
||
data: formData,
|
||
processData: false, // Prevent jQuery from automatically processing the data
|
||
contentType: false, // Let jQuery handle the content type
|
||
headers: {
|
||
// "Content-Type":"multipart/form-data",
|
||
"X-Requested-With": "XMLHttpRequest"
|
||
},
|
||
success: function(response) {
|
||
|
||
console.log(response);
|
||
$('#hrUploadForm')[0].reset();
|
||
|
||
if (response.code === 200 && response.dataStatus === true && response
|
||
.data !== "") {
|
||
toastr.success(
|
||
'File upload successs, Data validation is in-progress',
|
||
'Success');
|
||
$('.close').click()
|
||
window.location.reload(true);
|
||
} else if (response.code === 404 && response.dataStatus === false) {
|
||
console.error('no data found', response);
|
||
// alert(response.message);
|
||
toastr.error(response.message, 'Failed');
|
||
window.location.reload(true);
|
||
} else {
|
||
console.error('Something went wrong!');
|
||
// alert('Something went wrong! Try later');
|
||
toastr.error('Something went wrong! Try later', 'Error');
|
||
window.location.reload(true);
|
||
}
|
||
|
||
$('.close').click();
|
||
|
||
},
|
||
error: function(xhr, status, error) {
|
||
// Request failed, handle error
|
||
console.error("Request failed:", status, error);
|
||
toastr.error('Something went wrong! Try later', 'Error');
|
||
$('#hrUploadForm')[0].reset();
|
||
$('.close').click();
|
||
window.location.reload(true);
|
||
}
|
||
});
|
||
})
|
||
|
||
</script>
|