%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64 User : addictionfreeind ( 1003) PHP Version : 7.2.34 Disable Function : exec,passthru,shell_exec,system Directory : /home/addictionfreeind/public_html/admin1/resources/views/employees/ |
Upload File : |
@extends('layouts.app')
@push('datatable-styles')
@include('sections.datatable_css')
@endpush
@section('content')
<!-- CONTENT WRAPPER START -->
<div class="content-wrapper">
<!-- Add Task Export Buttons Start -->
<div class="d-flex justify-content-between action-bar">
<div id="table-actions" class="d-block d-lg-flex align-items-center">
{{-- @if ($addEmployeePermission == 'all')--}}
<x-forms.link-primary :link="route('employees.create')" class="mr-3 openRightModal" icon="plus">
@lang('app.add')
@lang('app.employee')
</x-forms.link-primary>
{{-- @endif--}}
</div>
<x-datatable.actions>
</x-datatable.actions>
</div>
<!-- Add Task Export Buttons End -->
<!-- Task Box Start -->
<div class="d-flex flex-column w-tables rounded mt-3 bg-white table-responsive">
{!! $dataTable->table(['class' => 'table table-hover border-0 w-100']) !!}
</div>
<!-- Task Box End -->
</div>
<!-- CONTENT WRAPPER END -->
@endsection
@push('scripts')
@include('sections.datatable_js')
<script>
var startDate = null;
var endDate = null;
var lastStartDate = null;
var lastEndDate = null;
@if(request('startDate') != '' && request('endDate') != '' )
startDate = '{{ request("startDate") }}';
endDate = '{{ request("endDate") }}';
@endif
@if(request('lastStartDate') !=='' && request('lastEndDate') !=='' )
lastStartDate = '{{ request("lastStartDate") }}';
lastEndDate = '{{ request("lastEndDate") }}';
@endif
$('#employees-table').on('preXhr.dt', function (e, settings, data) {
const status = $('#status').val();
const employee = $('#employee').val();
const role = $('#role').val();
const gender = $('#gender').val();
const skill = $('#skill').val();
const designation = $('#designation').val();
const department = $('#department').val();
const searchText = $('#search-text-field').val();
data['status'] = status;
data['employee'] = employee;
data['role'] = role;
data['gender'] = gender;
data['skill'] = skill;
data['designation'] = designation;
data['department'] = department;
data['searchText'] = searchText;
/* If any of these following filters are applied, then dashboard conditions will not work */
if (status == "all" || employee == "all" || role == "all" || designation == "all" || searchText == "") {
data['startDate'] = startDate;
data['endDate'] = endDate;
data['lastStartDate'] = lastStartDate;
data['lastEndDate'] = lastEndDate;
}
});
const showTable = () => {
window.LaravelDataTables["employees-table"].draw(false);
}
$('#employee, #status, #role, #gender, #skill, #designation, #department').on('change keyup',
function () {
if ($('#status').val() != "all") {
$('#reset-filters').removeClass('d-none');
} else if ($('#employee').val() != "all") {
$('#reset-filters').removeClass('d-none');
} else if ($('#role').val() != "all") {
$('#reset-filters').removeClass('d-none');
} else if ($('#gender').val() != "all") {
$('#reset-filters').removeClass('d-none');
} else if ($('#designation').val() != "all") {
$('#reset-filters').removeClass('d-none');
} else if ($('#department').val() != "all") {
$('#reset-filters').removeClass('d-none');
} else {
$('#reset-filters').addClass('d-none');
}
showTable();
});
$('#search-text-field').on('keyup', function () {
if ($('#search-text-field').val() != "") {
$('#reset-filters').removeClass('d-none');
showTable();
}
});
$('#reset-filters, #reset-filters-2').click(function () {
$('#filter-form')[0].reset();
$('.filter-box .select-picker').selectpicker("refresh");
$('#reset-filters').addClass('d-none');
showTable();
});
$('#quick-action-type').change(function () {
const actionValue = $(this).val();
if (actionValue != '') {
$('#quick-action-apply').removeAttr('disabled');
if (actionValue == 'change-status') {
$('.quick-action-field').addClass('d-none');
$('#change-status-action').removeClass('d-none');
} else {
$('.quick-action-field').addClass('d-none');
}
} else {
$('#quick-action-apply').attr('disabled', true);
$('.quick-action-field').addClass('d-none');
}
});
$('#quick-action-apply').click(function () {
const actionValue = $('#quick-action-type').val();
if (actionValue == 'delete') {
Swal.fire({
title: "@lang('messages.sweetAlertTitle')",
text: "@lang('messages.recoverRecord')",
icon: 'warning',
showCancelButton: true,
focusConfirm: false,
confirmButtonText: "@lang('messages.confirmDelete')",
cancelButtonText: "@lang('app.cancel')",
customClass: {
confirmButton: 'btn btn-primary mr-3',
cancelButton: 'btn btn-secondary'
},
showClass: {
popup: 'swal2-noanimation',
backdrop: 'swal2-noanimation'
},
buttonsStyling: false
}).then((result) => {
if (result.isConfirmed) {
applyQuickAction();
}
});
} else {
applyQuickAction();
}
});
$('body').on('click', '.delete-table-row', function () {
var id = $(this).data('user-id');
Swal.fire({
title: "@lang('messages.sweetAlertTitle')",
text: "@lang('messages.recoverRecord')",
icon: 'warning',
showCancelButton: true,
focusConfirm: false,
confirmButtonText: "@lang('messages.confirmDelete')",
cancelButtonText: "@lang('app.cancel')",
customClass: {
confirmButton: 'btn btn-primary mr-3',
cancelButton: 'btn btn-secondary'
},
showClass: {
popup: 'swal2-noanimation',
backdrop: 'swal2-noanimation'
},
buttonsStyling: false
}).then((result) => {
if (result.isConfirmed) {
var url = "{{ route('employees.destroy', ':id') }}";
url = url.replace(':id', id);
var token = "{{ csrf_token() }}";
$.easyAjax({
type: 'POST',
url: url,
blockUI: true,
data: {
'_token': token,
'_method': 'DELETE'
},
success: function (response) {
if (response.status == "success") {
showTable();
}
}
});
}
});
});
const applyQuickAction = () => {
var rowdIds = $("#employees-table input:checkbox:checked").map(function () {
return $(this).val();
}).get();
var url = "{{ route('employees.apply_quick_action') }}?row_ids=" + rowdIds;
$.easyAjax({
url: url,
container: '#quick-action-form',
type: "POST",
disableButton: true,
buttonSelector: "#quick-action-apply",
data: $('#quick-action-form').serialize(),
blockUI: true,
success: function (response) {
if (response.status == 'success') {
showTable();
resetActionButtons();
deSelectAll();
$('#quick-action-form').hide();
}
}
})
};
$('body').on('change', '.assign_role', function () {
var id = $(this).data('user-id');
var role = $(this).val();
var token = "{{ csrf_token() }}";
if (typeof id !== 'undefined') {
$.easyAjax({
url: "{{ route('employees.assign_role') }}",
type: "POST",
blockUI: true,
container: '#employees-table',
data: {
role: role,
userId: id,
_token: token
},
success: function (response) {
if (response.status == "success") {
window.LaravelDataTables["employees-table"].draw(false);
}
}
})
}
});
$('#designation-setting').click(function () {
const url = "{{ route('designations.create') }}";
$(MODAL_LG + ' ' + MODAL_HEADING).html('...');
$.ajaxModal(MODAL_LG, url);
})
$('.department-setting').click(function () {
const url = "{{ route('departments.create') }}";
$(MODAL_LG + ' ' + MODAL_HEADING).html('...');
$.ajaxModal(MODAL_LG, url);
});
</script>
@endpush