Files
opensem/resources/views/components/datatables/search.blade.php
2021-03-22 00:47:44 +01:00

42 lines
1.1 KiB
PHP

<div class="input-group">
<div class="input-group-prepend">
@include('components.datatables.buttons.pageLength')
<span class="input-group-text"><i class="fa fa-search"></i></span>
</div>
<input type="text" class="form-control search-btn" placeholder="{{ __('search') }}" value="">
@if ((isset($with_filters) and $with_filters) || (isset($with_colvis) and $with_colvis))
<div class="input-group-append">
@if (isset($with_filters) && $with_filters)
@include('components.datatables.buttons.filters')
@endif
@if (isset($with_colvis) && $with_colvis)
@include('components.datatables.buttons.colvis')
@endif
</div>
@endif
</div>
@include('load.functions')
@push('js')
<script>
$( document ).ready(function() {
var table = getDatatable("{{ $model }}");
var $search = $('#{{ $model }}-table-header .search-btn');
var state = getDatatableState("{{ $model }}");
if (state && (typeof(state.search.search) != 'undefined')) {
$search.val(state.search.search);
}
$search.on('keyup', delay(function () {
table.search($search.val()).draw();
}, 500));
});
</script>
@endpush