|
|
@@ -143,7 +143,41 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
-@dump($filters, $ranges, $dates)
|
|
|
+<!-- Модальное окно поиска -->
|
|
|
+<div class="modal fade" id="table_{{ $id }}_modal_search" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
|
|
+ <div class="modal-dialog modal-fullscreen-sm-down modal-lg">
|
|
|
+ <div class="modal-content">
|
|
|
+ <div class="modal-header">
|
|
|
+ <h1 class="modal-title fs-5" id="exampleModalLabel">Поиск</h1>
|
|
|
+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
|
|
|
+ </div>
|
|
|
+ <div class="modal-body">
|
|
|
+ <div>
|
|
|
+ Поиск ведётся по следующим колонкам:
|
|
|
+ <span class="fst-italic">
|
|
|
+ @foreach($searchFields as $searchField)
|
|
|
+ {{ $header[$searchField] }}
|
|
|
+ @if(!$loop->last),@endif
|
|
|
+ @endforeach
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <form class="search-form">
|
|
|
+ @include('partials.input', [
|
|
|
+ 'name' => 's',
|
|
|
+ 'title' => 'Поиск',
|
|
|
+ 'placeholder' => 'что ищем?',
|
|
|
+ 'value' => request()->s ?? '',
|
|
|
+ ])
|
|
|
+ </form>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ <div class="modal-footer">
|
|
|
+ <button type="button" class="btn btn-primary accept-search" data-bs-dismiss="modal">Найти</button>
|
|
|
+ <button type="button" class="btn btn-outline-secondary reset-search" data-bs-dismiss="modal">Сбросить</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
|
|
|
@push('scripts')
|
|
|
<script type="module">
|
|
|
@@ -202,6 +236,7 @@
|
|
|
currentUrl.searchParams.delete(filter.name);
|
|
|
}
|
|
|
});
|
|
|
+ currentUrl.searchParams.delete('page');
|
|
|
document.location.href = currentUrl.href;
|
|
|
});
|
|
|
|
|
|
@@ -211,10 +246,27 @@
|
|
|
$.each(filters, function (id, filter) {
|
|
|
currentUrl.searchParams.delete(filter.name);
|
|
|
});
|
|
|
+ currentUrl.searchParams.delete('page');
|
|
|
document.location.href = currentUrl.href;
|
|
|
});
|
|
|
|
|
|
+ $('.accept-search').on('click', function () {
|
|
|
+ let s = $('.search-form input').val();
|
|
|
+ let currentUrl = new URL(document.location.href);
|
|
|
+ if(s !== '') {
|
|
|
+ currentUrl.searchParams.set('s', s);
|
|
|
+ } else {
|
|
|
+ currentUrl.searchParams.delete('s');
|
|
|
+ }
|
|
|
+ currentUrl.searchParams.delete('page');
|
|
|
+ document.location.href = currentUrl.href;
|
|
|
+ });
|
|
|
|
|
|
-
|
|
|
+ $('.reset-search').on('click', function () {
|
|
|
+ let currentUrl = new URL(document.location.href);
|
|
|
+ currentUrl.searchParams.delete('s');
|
|
|
+ currentUrl.searchParams.delete('page');
|
|
|
+ document.location.href = currentUrl.href;
|
|
|
+ });
|
|
|
</script>
|
|
|
@endpush
|