79 lines
4.5 KiB
PHP
79 lines
4.5 KiB
PHP
@php
|
|
$selectedBrand = request()->brand ?? (isset($modelTable) ? Session::get("crud.$modelTable.brand") : null);
|
|
$selectedQuestion = request()->question ?? (isset($modelTable) ? Session::get("crud.$modelTable.question") : null);
|
|
$selectedAnswer = request()->answer ?? (isset($modelTable) ? Session::get("crud.$modelTable.answer") : null);
|
|
$search = request()->search ?? (isset($modelTable) ? Session::get("crud.$modelTable.search") : null);
|
|
$sortCol = request()->sort_col ?? (isset($modelTable) ? Session::get("crud.$modelTable.sort_col") : null);
|
|
$sortWay = request()->sort_way ?? (isset($modelTable) ? Session::get("crud.$modelTable.sort_way") : null);
|
|
$routes = !request()->routeIs('bo.activity_logs.*')
|
|
&& !request()->routeIs('bo.users.*')
|
|
&& !request()->routeIs('bo.brands.*')
|
|
&& !request()->routeIs('bo.questions.answers*');
|
|
@endphp
|
|
|
|
<form action="{{ request()->fullUrlWithQuery(['rstFltrs' => null]) }}" class="row gx-2 mb-2">
|
|
@if ($routes)
|
|
@php $routeCondition = request()->routeIs('bo.single_optins.*') || request()->routeIs('bo.customers.*'); @endphp
|
|
<div class="col-12 col-lg-6">
|
|
{{-- BRAND SELECT --}}
|
|
<select class="form-select mb-1 {{ $routeCondition && $selectedBrand && $questionModels ? 'mb-lg-1' : 'mb-lg-0' }}"
|
|
id="brandSelect" role="button" name="brand">
|
|
<option value="0" @selected(!$selectedBrand)>{{ __('Sélectionnez une marque...') }}</option>
|
|
@foreach (\App\Models\Brand::getUserAssociatedBrands() as $brand)
|
|
<option value="{{ $brand->getKey() }}" @selected($selectedBrand == $brand->getKey())>
|
|
{{ $brand->name }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
|
|
{{-- QUESTION SELECT --}}
|
|
@if ($routeCondition && $selectedBrand && isset($questionModels) && !$questionModels->isEmpty())
|
|
<select id="questionSelect" role="button" class="form-select mb-1 {{ $selectedQuestion && $answerModels ? 'mb-lg-1' : 'mb-lg-0' }}"
|
|
name="question">
|
|
<option value="0" @selected(!$selectedQuestion)>{{ __('Sélectionnez une question...') }}</option>
|
|
@foreach ($questionModels as $question)
|
|
<option value="{{ $question->getKey() }}" @selected($selectedQuestion == $question->getKey())>
|
|
{{ $question->question }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
@endif
|
|
|
|
{{-- ANSWER SELECT --}}
|
|
@if ($routeCondition && $selectedQuestion && isset($questionModels) && !$questionModels->isEmpty() && isset($answerModels) && !$answerModels->isEmpty())
|
|
<select id="answerSelect" class="form-select mb-1 mb-lg-0" role="button" name="answer">
|
|
<option value="0" @selected(!$selectedAnswer)>{{ __('Sélectionnez une réponse...') }}</option>
|
|
@foreach ($answerModels as $answer)
|
|
<option value="{{ $answer->getKey() }}" @selected($selectedAnswer == $answer->getKey())>
|
|
{{ $answer->answer }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
<div class="col-12 {{ $routes ? 'col-lg-6' : '' }} d-flex justify-content-center align-items-start">
|
|
<div class="input-group">
|
|
{{-- SEARCH FIELD --}}
|
|
<label class="input-group-text" for="searchField">{{ str($searchFields)->ucfirst() }}</label>
|
|
<input class="form-control" id="searchField" name="search" type="search" value="{{ $search }}" placeholder="Recherche.." />
|
|
|
|
{{-- ACTION BUTTONS --}}
|
|
<button class="btn btn-primary" data-bs-tooltip="tooltip" type="submit"
|
|
title="{{ __('Lancer la recherche') }}">
|
|
<i class="fas fa-search"></i>
|
|
</button>
|
|
</div>
|
|
@php
|
|
$parameters = ['rstFltrs' => 'true', 'search' => null, 'page' => null];
|
|
if ($routes) {
|
|
$parameters = array_merge($parameters, ['brand' => null, 'question' => null, 'answer' => null, 'subject' => null]);
|
|
}
|
|
@endphp
|
|
<a class="btn btn-danger ms-2" data-bs-tooltip="tooltip"
|
|
href="{{ request()->fullUrlWithQuery($parameters) }}"
|
|
title="{{ __('Supprimer la recherche') }}">
|
|
<i class="fas fa-backspace"></i>
|
|
</a>
|
|
</div>
|
|
</form>
|