ldc-startcoq/resources/views/modules/table-col-sorter.blade.php

82 lines
3.5 KiB
PHP

@php
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 ($col === 'multi_pdf')
<th scope="col" class="text-center @if(isset($mobileHide) and is_array($mobileHide) and in_array($col, $mobileHide)) d-none d-md-table-cell @endif">
<span>{{ $colname }}</span>
<a class="btn btn-sm btn-outline-dark"
href="{{ route('products.multipdf.show') }}"
target="_blank"
data-bs="tooltip"
title="{{ __('Générer le .pdf de la sélection') }}">
<i class="fa fa-print"></i>
</a>
<a class="btn btn-sm btn-outline-dark"
href="{{ route('products.multipdf.destroy') }}"
data-bs="tooltip"
title="{{ __('Supprimer la sélection') }}">
<i class="fa fa-delete-left"></i>
</a>
</th>
@else
<th scope="col" class="text-center @if(isset($mobileHide) and is_array($mobileHide) and in_array($col, $mobileHide)) d-none d-md-table-cell @endif">
<span>{{ $colname }}</span>
</th>
@endif
@continue
@endif
<th scope="col" class="text-center @if(isset($mobileHide) and is_array($mobileHide) and in_array($col, $mobileHide)) d-none d-md-table-cell @endif">
<span class="text-nowrap">
{{ $colname }}
</span>
@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="text-decoration-none"
href="{{ request()->fullUrlWithQuery(array_merge($iArgs, ['sort_way' => 'asc', 'rst' => null])) }}">
<button
class="btn btn-sm btn-outline-dark"
title="{{ __('Trier :name dans l\'ordre ascendant', ['name' => Str::lower($colname)]) }}"
data-bs="tooltip">
<i class="fas fa-arrow-up 2xs"></i>
</button>
</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="text-decoration-none"
href="{{ request()->fullUrlWithQuery(array_merge($iArgs, ['sort_way' => 'desc', 'rst' => null])) }}">
<button
class="btn btn-sm btn-outline-dark"
title="{{ __('Trier :name dans l\'ordre descendant', ['name' => Str::lower($colname)]) }}"
data-bs="tooltip">
<i class="fas fa-arrow-down 2xs"></i>
</button>
</a>
@endif
</th>
@endforeach
{{-- Buttons Col --}}
<th class="text-end" scope="col">
@if($noOrder and !$rst)
<a class="btn btn-sm btn-danger"
href="{{ request()->fullUrlWithQuery(['sort_col' => null, 'sort_way' => null, 'rst' => true, 'search' => null]) }}"
data-bs="tooltip"
title="{{ __('Effacer le tri') }}">
<i class="fa fa-eraser"></i>
</a>
@else
<span data-bs="tooltip" data-bs-placement="top" title="{{ __('Ici, les flèches sont utilisées pour trier et non pour filtrer') }}">
<i class="fas fa-question-circle"></i>
</span>
@endif
</th>
</tr>