fix column sorter

This commit is contained in:
Jérémy Munsch 2021-09-15 10:56:46 +02:00
parent c818ac6935
commit 1182dcfb52

View file

@ -1,71 +1,72 @@
<th scope="col">
@php $colname = 'customers.email' @endphp
@php function _genUrl($q) { return url()->current().(!empty(request()->all())?"?":"").http_build_query(array_merge(request()->query(), $q)); } @endphp
{{ __('Email')}}
@if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname))
<a class="col_sort text-secondary lead asc" href="{{ request()->fullUrlWithQuery(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">&nbsp;&darr;&nbsp;</a>
<a class="col_sort text-secondary lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">&nbsp;&darr;&nbsp;</a>
@endif
@if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname))
<a class="col_sort text-secondary lead desc" href="{{ request()->fullUrlWithQuery(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">&nbsp;&uarr;&nbsp;</a>
<a class="col_sort text-secondary lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">&nbsp;&uarr;&nbsp;</a>
@endif
</th>
<th scope="col">
@php $colname = 'customer_infos.lastname' @endphp
{{ __('Nom')}}
@if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname))
<a class="col_sort text-secondary lead asc" href="{{ request()->fullUrlWithQuery(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">&nbsp;&darr;&nbsp;</a>
<a class="col_sort text-secondary lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">&nbsp;&darr;&nbsp;</a>
@endif
@if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname))
<a class="col_sort text-secondary lead desc" href="{{ request()->fullUrlWithQuery(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">&nbsp;&uarr;&nbsp;</a>
<a class="col_sort text-secondary lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">&nbsp;&uarr;&nbsp;</a>
@endif
</th>
<th scope="col">
@php $colname = 'customer_infos.firstname' @endphp
{{ __('Prénom')}}
@if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname))
<a class="col_sort text-secondary lead asc" href="{{ request()->fullUrlWithQuery(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">&nbsp;&darr;&nbsp;</a>
<a class="col_sort text-secondary lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">&nbsp;&darr;&nbsp;</a>
@endif
@if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname))
<a class="col_sort text-secondary lead desc" href="{{ request()->fullUrlWithQuery(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">&nbsp;&uarr;&nbsp;</a>
<a class="col_sort text-secondary lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">&nbsp;&uarr;&nbsp;</a>
@endif
</th>
<th scope="col">
@php $colname = 'customer_infos.opt_in' @endphp
{{ __('Opt-In')}}
@if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname))
<a class="col_sort text-secondary lead asc" href="{{ request()->fullUrlWithQuery(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">&nbsp;&darr;&nbsp;</a>
<a class="col_sort text-secondary lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">&nbsp;&darr;&nbsp;</a>
@endif
@if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname))
<a class="col_sort text-secondary lead desc" href="{{ request()->fullUrlWithQuery(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">&nbsp;&uarr;&nbsp;</a>
<a class="col_sort text-secondary lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">&nbsp;&uarr;&nbsp;</a>
@endif
</th>
<th scope="col">
@php $colname = 'brands.name' @endphp
{{ __('Marque')}}
@if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname))
<a class="col_sort text-secondary lead asc" href="{{ request()->fullUrlWithQuery(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">&nbsp;&darr;&nbsp;</a>
<a class="col_sort text-secondary lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">&nbsp;&darr;&nbsp;</a>
@endif
@if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname))
<a class="col_sort text-secondary lead desc" href="{{ request()->fullUrlWithQuery(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">&nbsp;&uarr;&nbsp;</a>
<a class="col_sort text-secondary lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">&nbsp;&uarr;&nbsp;</a>
@endif
</th>
<th scope="col">
@php $colname = 'customer_logins.status' @endphp
{{ __('Activé ?')}}
@if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname))
<a class="col_sort text-secondary lead asc" href="{{ request()->fullUrlWithQuery(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">&nbsp;&darr;&nbsp;</a>
<a class="col_sort text-secondary lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">&nbsp;&darr;&nbsp;</a>
@endif
@if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname))
<a class="col_sort text-secondary lead desc" href="{{ request()->fullUrlWithQuery(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">&nbsp;&uarr;&nbsp;</a>
<a class="col_sort text-secondary lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">&nbsp;&uarr;&nbsp;</a>
@endif
</th>
<th scope="col">
@php $colname = 'customer_logins.last_connection' @endphp
{{ __('Dernière connexion')}}
@if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname))
<a class="col_sort text-secondary lead asc" href="{{ request()->fullUrlWithQuery(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">&nbsp;&darr;&nbsp;</a>
<a class="col_sort text-secondary lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">&nbsp;&darr;&nbsp;</a>
@endif
@if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname))
<a class="col_sort text-secondary lead desc" href="{{ request()->fullUrlWithQuery(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">&nbsp;&uarr;&nbsp;</a>
<a class="col_sort text-secondary lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">&nbsp;&uarr;&nbsp;</a>
@endif
</th>
<th scope="col">