64 lines
3.1 KiB
PHP
64 lines
3.1 KiB
PHP
@php
|
|
$route = request()->route();
|
|
$routeName = $route->getName();
|
|
$rst = !is_null(request()->rst) || !Session::has("$routeName.sorted");
|
|
$noOrder = Session::get("$routeName.sort_col") !== 'order' and (Session::has("$routeName.sort_col") or Session::has("$routeName.sort_way"));
|
|
$noOrder = Session::get("$routeName.sort_col") !== '' and (Session::has("$routeName.sort_col") or Session::has("$routeName.sort_way"));
|
|
|
|
View::share('noOrder', $noOrder);
|
|
$ignore = (isset($ignore) and is_array($ignore)) ? $ignore : [];
|
|
@endphp
|
|
<tr>
|
|
@foreach($cols as $col => $colname)
|
|
@php
|
|
$iArgs = ['sort_col' => $col];
|
|
if(request()->search) {
|
|
$iArgs['search'] = request()->search;
|
|
}
|
|
@endphp
|
|
{{-- NO Sort for order column --}}
|
|
@if($col === 'order' or in_array($col, $ignore))
|
|
@if($noOrder and !$rst and !in_array($col, $ignore)) @continue @endif
|
|
<th scope="col" @if(isset($mobileHide) and is_array($mobileHide) and in_array($col, $mobileHide)) class="d-none d-md-table-cell text-center" @endif>
|
|
<span class="text-nowrap">{{ $colname }}</span>
|
|
</th>
|
|
@continue
|
|
@endif
|
|
<th scope="col" @if(isset($mobileHide) and is_array($mobileHide) and in_array($col, $mobileHide)) class="d-none d-md-table-cell text-center" @endif>
|
|
<span class="text-nowrap">
|
|
{{ $colname }}
|
|
@if(!session("$routeName.sort_way") or session("$routeName.sort_col") !== $col or (session("$routeName.sort_way") === 'desc' and session("$routeName.sort_col") === $col))
|
|
<a class="col_sort text-info lead asc"
|
|
href="{{ request()->fullUrlWithQuery(array_merge($iArgs, ['sort_way' => 'asc', 'rst' => null])) }}"
|
|
title="{{ __('Trier :name en ordre ascendant', ['name' => Str::lower($colname)]) }}"
|
|
data-bs-toggle="tooltip">
|
|
↓
|
|
</a>
|
|
@endif
|
|
@if(!session("$routeName.sort_way") or session("$routeName.sort_col") !== $col or (session("$routeName.sort_way") === 'asc' and session("$routeName.sort_col") === $col))
|
|
<a class="col_sort text-info lead desc"
|
|
href="{{ request()->fullUrlWithQuery(array_merge($iArgs, ['sort_way' => 'desc', 'rst' => null])) }}"
|
|
title="{{ __('Trier :name en ordre descendant', ['name' => Str::lower($colname)]) }}"
|
|
data-bs-toggle="tooltip">
|
|
↑
|
|
</a>
|
|
@endif
|
|
</span>
|
|
</th>
|
|
@endforeach
|
|
{{-- Buttons Col --}}
|
|
<th scope="col">
|
|
@if($noOrder and !$rst)
|
|
<a class="btn btn-small btn-danger"
|
|
href="{{ request()->fullUrlWithQuery(['sort_col' => null, 'sort_way' => null, 'rst' => true, 'search' => null]) }}"
|
|
data-bs-toggle="tooltip"
|
|
title="{{ __('Effacer le tri') }}">
|
|
<i class="fa fa-eraser"></i>
|
|
</a>
|
|
@else
|
|
<span data-bs-toggle="tooltip" data-bs-placement="top" title="{{ __('Ici, les flèches servent à trier et non pas à filtrer') }}">
|
|
<i class="fas fa-question-circle"></i>
|
|
</span>
|
|
@endif
|
|
</th>
|
|
</tr>
|