ldc-showroom-bo/resources/views/bo/modules/search-bar.blade.php

54 lines
2.7 KiB
PHP

@php
$iArgs = [];
if (request()->sort_col) {
$iArgs['sort_col'] = request()->sort_col;
}
if (request()->search) {
$iArgs['search'] = request()->sort_way;
}
@endphp
<div class="row mb-3">
<div class="col-12">
<form id="searchForm" action="/{{ request()->path() }}">
<div class="input-group pt-3">
<label class="input-group-text" for="searchField">{{ $searchFields }}</label>
@if (request()->input('sort_col'))
<input class="d-none" name="sort_col" type="text" value="{{ request()->input('sort_col') }}">
@endif
@if (request()->input('sort_way'))
<input class="d-none" name="sort_way" type="text" value="{{ request()->input('sort_way') }}">
@endif
@if (request()->input('rangefilter'))
<input class="d-none" name="rangefilter" type="text" value="{{ request()->input('rangefilter') }}">
@endif
@if (request()->input('group'))
<input class="d-none" name="group" type="text" value="{{ request()->input('group') }}">
@endif
@if (request()->input('brand_id'))
<input class="d-none" name="brand_id" type="text" value="{{ request()->input('brand_id') }}">
@endif
@if (request()->input('range_id'))
<input class="d-none" name="range_id" type="text" value="{{ request()->input('range_id') }}">
@endif
<input class="form-control" id="searchField" name="search" type="search" value="{{ request()->input('search') }}"
placeholder="{{ __('crud.other.search_placeholder') }}" />
<button class="btn btn-primary" data-bs-toggle="tooltip" type="submit" title="{{ __('crud.other.search_start') }}">
<i class="fas fa-search"></i>
</button>
<button class="btn btn-danger" id="searchDelete" data-bs-toggle="tooltip" type="button"
title="{{ __('crud.other.search_delete') }}">
<i class="fas fa-backspace"></i>
</button>
@push('scripts')
<script nonce="{{ $nonce }}">
document.getElementById('searchDelete').addEventListener('click', function(e) {
document.getElementById('searchField').value = '';
document.getElementById('searchForm').submit();
});
</script>
@endpush
</div>
</form>
</div>
</div>