Made duty hours display more simple

This commit is contained in:
noah.lancien 2023-04-18 12:48:55 +00:00
parent fa810ad17f
commit 3ba7a19cc4
3 changed files with 37 additions and 167 deletions

View file

@ -13,63 +13,43 @@
{{ __('Créer un ticket') }}
</a>
</div>
<div class="card">
<div class="card-header">
<div class="row">
<div class="col">
<h2 class="col h2">
<span class="fw-bold">{{ __('models.classes.dutyhours') }}</span>
</h2>
</div>
</div>
</div>
<div class="card-body">
@include('modules.searchBar')
<div class="row justify-content-center">
<div class="col-12 col-md-6 p-0">
{{ $dutyhourModels->withQueryString()->onEachSide(1)->links() }}
</div>
</div>
<div class="row">
<div class="col">
<div class="table-responsive">
<table class="table fix-action m-0">
<thead>
@php
$rst = !is_null(request()->rst);
$routeName = request()->route()->getName();
$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"));
$cols = ['date' => __('Date'), 'person' => __('Personne présente'), 'place' => __('Lieu de la permanence')];
@endphp
@include('modules.tableColSorter', ['cols' => $cols, 'mobileHide' => ['status']])
</thead>
<tbody>
@if($dutyhourModels->count())
@foreach ($dutyhourModels as $dutyhourModel)
<tr>
<td class="align-middle">{{ $dutyhourModel->date->formatLocalized('%d/%m/%Y') }}</td>
<td class="align-middle">{{ $dutyhourModel->person }}</td>
<td class="align-middle">{{ $dutyhourModel->place }}</td>
</tr>
@endforeach
@else
<tr>
<td colspan="5" class="text-center">
<span class="h3">{{ __('No results for :models', ['models' => __('models.classes.dutyhours') ])}}</span>
</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
<div class="row justify-content-center">
<div class="col-12 col-md-6 p-0">
{{ $dutyhourModels->withQueryString()->onEachSide(1)->links() }}
</div>
</div>
</div>
<div class="row">
<div class="col">
<h2 class="col h2 mb-3">
<span class="fw-bold">{{ __('models.classes.dutyhours') . __(' à venir') }}</span>
</h2>
</div>
</div>
<div class="row">
<div class="col">
<div class="table-responsive">
<table class="table fix-action m-0">
<thead>
<tr>
<th>{{ __('Date') }}</th>
<th>{{ __('Personne présente') }}</th>
<th>{{ __('Lieu de la permanence') }}</th>
</tr>
</thead>
<tbody>
@if($dutyhourModels->count())
@foreach ($dutyhourModels as $dutyhourModel)
<tr>
<td class="align-middle">{{ $dutyhourModel->date->formatLocalized('%d/%m/%Y') }}</td>
<td class="align-middle">{{ $dutyhourModel->person }}</td>
<td class="align-middle">{{ $dutyhourModel->place }}</td>
</tr>
@endforeach
@else
<tr>
<td colspan="5" class="text-center">
<span class="h3">{{ __('Aucune :model prévue prochainement', ['model' => Str::singular(__('models.classes.dutyhours')) ])}}</span>
</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>

View file

@ -1,46 +0,0 @@
@php
$iArgs = [];
if(request()->sort_col) {
$iArgs['sort_col'] = request()->sort_col;
}
if(request()->search) {
$iArgs['search'] = request()->sort_way;
}
@endphp
<div class="row mb-3">
<div class="col-12">
<form id="searchForm" action="/{{ request()->path() }}">
<div class="input-group">
<label class="input-group-text" for="searchField">{{ $searchFields }}</label>
@if(request()->sort_col)
<input class="d-none" type="text" name="sort_col" value="{{ request()->sort_col }}">
@endif
@if(request()->sort_way)
<input class="d-none" type="text" name="sort_way" value="{{ request()->sort_way }}">
@endif
@if(request()->rangefilter)
<input class="d-none" type="text" name="rangefilter" value="{{ request()->rangefilter }}">
@endif
@if(request()->group)
<input class="d-none" type="text" name="group" value="{{ request()->group }}">
@endif
<input type="search" id="searchField" name="search" class="form-control" value="{{ request()->search }}" placeholder="{{ __('Vos mots clés ici...') }}"/>
<button type="submit" class="btn btn-primary" data-bs-toggle="tooltip" title="{{ __('Lancer la recherche') }}">
<i class="fas fa-search"></i>
</button>
<button id="searchDelete" type="button" class="btn btn-danger" data-bs-toggle="tooltip" title="{{ __('Effacer la recherche') }}">
<i class="fas fa-backspace"></i>
</button>
@push('scripts')
<script nonce="{{ $nonce }}">
document.getElementById('searchDelete').addEventListener('click', function (e) {
document.getElementById('searchField').value = '';
document.getElementById('searchForm').submit();
});
</script>
@endpush
</div>
</form>
</div>
</div>

View file

@ -1,64 +0,0 @@
@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">
&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
<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>