120 lines
4.7 KiB
PHP
120 lines
4.7 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('content')
|
|
<div class="container-fluid">
|
|
<x-dashboard.breadcumb />
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="row g-2">
|
|
<div class="col-sm-4">
|
|
<div class="search-box">
|
|
<input type="text" name="searchMemberList" class="form-control" id="searchMemberList"
|
|
placeholder="Search for name...">
|
|
<i class="ri-search-line search-icon"></i>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-auto ms-auto">
|
|
<div class="list-grid-nav hstack gap-1">
|
|
<button type="button" id="grid-view-button"
|
|
class="btn btn-soft-info nav-link btn-icon fs-14 active filter-button"><i
|
|
class="ri-grid-fill"></i></button>
|
|
<button type="button" id="list-view-button"
|
|
class="btn btn-soft-info nav-link btn-icon fs-14 filter-button"><i
|
|
class="ri-list-unordered"></i></button>
|
|
@can('employee.create')
|
|
<a class="btn btn-primary" href="{{ route('employee.create') }}"><i
|
|
class="ri-add-fill me-1 align-bottom"></i> Create</a>
|
|
@endcan
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div>
|
|
<div id="teamlist">
|
|
<div class="text-center mb-3 auto-load" style="display: none">
|
|
<a href="javascript:void(0);" class="text-success"><i
|
|
class="mdi mdi-loading mdi-spin fs-20 align-middle me-2"></i> Load More </a>
|
|
</div>
|
|
<div class="team-list grid-view-filter row" id="team-member-list">
|
|
</div>
|
|
<div class="py-4 mt-4 text-center" id="noresult" style="display: none">
|
|
<lord-icon src="https://cdn.lordicon.com/msoeawqm.json" trigger="loop"
|
|
colors="primary:#405189,secondary:#0ab39c" style="width:72px;height:72px"></lord-icon>
|
|
<h5 class="mt-4">Sorry! No Result Found</h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@include('user::user.modal.assign-role')
|
|
@endsection
|
|
|
|
@push('js')
|
|
<script>
|
|
window.addEventListener('DOMContentLoaded', function() {
|
|
|
|
const debounce = (func, delay) => {
|
|
let timer;
|
|
return function(...args) {
|
|
const context = this;
|
|
clearTimeout(timer);
|
|
timer = setTimeout(() => {
|
|
func.apply(context, args);
|
|
}, delay);
|
|
};
|
|
};
|
|
|
|
function performSearch(page) {
|
|
const input = $("#searchMemberList").val();
|
|
$.ajax({
|
|
url: '{{ route('employee.index') }}',
|
|
method: 'GET',
|
|
data: {
|
|
search: input,
|
|
page: page
|
|
},
|
|
beforeSend: function() {
|
|
$(".auto-load").toggle();
|
|
$('.team-list').html("");
|
|
$("#noresult").hide();
|
|
},
|
|
success: function(response) {
|
|
if (response.html) {
|
|
$('.team-list').html(response.html);
|
|
}
|
|
$('[data-bs-toggle="tooltip"]').tooltip('dispose').tooltip();
|
|
},
|
|
error: function(error) {
|
|
console.log(error);
|
|
$("#noresult").show();
|
|
},
|
|
complete: function() {
|
|
$(".auto-load").toggle();
|
|
}
|
|
});
|
|
}
|
|
|
|
const debouncedSearch = debounce(performSearch, 500);
|
|
|
|
performSearch(1);
|
|
|
|
$('#searchMemberList').on('keyup', function() {
|
|
debouncedSearch(1);
|
|
});
|
|
|
|
$(document).on('click', '.pagination a', function(e) {
|
|
e.preventDefault();
|
|
const page = $(this).attr('href').split('page=')[1];
|
|
performSearch(page);
|
|
});
|
|
});
|
|
</script>
|
|
@endpush
|