ldc-loue/resources/views/back/modules/tableColSorter.blade.php
Jérémy Munsch 0751114f4a
BO News, Tags, Sliders
CKeditor + word counter + Image Input + Taggable VUE3
Better Xss Sanitizer
Handle Video Youtube + Image Upload + Inline Image from url
Better Image Input component with reset, easizer resize
Full Responsive BO
2022-06-04 15:55:36 +02:00

52 lines
2.8 KiB
PHP

@php
$route = request()->route();
$routeName = $route->getName();
$rst = !is_null(request()->rst);
$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">
<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" @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">&nbsp;&darr;&nbsp;</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">&nbsp;&uarr;&nbsp;</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
@php $text = 'Ici, les flèches servent à trier et non pas à filtrer'; @endphp
<span data-bs-toggle="tooltip" data-bs-placement="top" title="{{ __($text) }}"><i class="fas fa-question-circle"></i></span>
@endif
</th>
</tr>