This commit is contained in:
Vincent BRIDIER 2023-11-06 17:19:21 +01:00
parent a2401de135
commit 5333945267
No known key found for this signature in database
GPG key ID: 8571BFA20420D512

View file

@ -4,80 +4,74 @@
@section('description', __('Liste de tous les :model', ['model' => __('models.classes.products')]))
@section('content')
<div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap">
@include('modules.breadcrumbs.breadcrumb-body')
<a class="btn btn-primary float-right" data-bs-toggle="tooltip" data-bs-placement="top" href="{{ route('bo.products.create') }}"
title="{{ __('crud.helpers.create_model', ['model' => Str::singular(__('models.classes.products'))]) }}">
<i class="fa-solid fa-plus"></i>
</a>
</div>
@include('bo.modules.search-bar')
<div class="table-responsive mb-3">
<table class="table-hover table-fix-action m-0 table">
@if (count($productModels) > 0)
<thead>
@include('bo.modules.table-col-sorter', [
'cols' => [
'label' => __('validation.attributes.label'),
'species' => __('validation.attributes.species'),
'picture' => __('validation.attributes.picture'),
'status' => __('validation.attributes.status'),
'updated_at' => __('validation.attributes.updated_at'),
'order' => __('validation.attributes.order'),
],
])
</thead>
<tbody>
@foreach ($productModels as $productModel)
<tr class="border-bottom">
<td class="text-center align-middle">{{ $productModel->label }}</td>
<td class="text-center align-middle">{{ $productModel->species->label() }}</td>
<td class="text-center align-middle">
<img class="bo-image-preview" src="{{ asset($productModel->picture) }}"
alt="{{ __('Preview product picture') }}">
</td>
@include('bo.modules.change-published-status', [
'routeName' => 'products',
'model' => $productModel,
])
<td class="text-center align-middle"><span class="badge bg-secondary">{{ $productModel->updated_at }}</span></td>
@php
$routeName = request()
->route()
->getName();
@endphp
@if (empty(request()->search) && Session::get("$routeName.sort_col") === 'order')
@include('bo.modules.change-model-order', [
'routeName' => 'products',
'models' => $productModels,
'model' => $productModel,
])
@endif
<td class="text-end align-middle">
<form class="btn-group confirmDeleteTS" action="{{ route('bo.products.destroy', $productModel->id) }}"
method="POST" novalidate>
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip" data-bs-placement="top"
href="{{ route('bo.products.edit', ['product' => $productModel->id]) }}"
title="{{ __('crud.actions.update') }}">
<i class="fa-solid fa-pencil"></i>
</a>
@csrf
@method('DELETE')
<button class="btn btn-sm btn-danger" data-bs-toggle="tooltip" data-bs-placement="top" type="submit"
title="{{ __('crud.actions.delete') }}">
<i class="fa-solid fa-trash"></i>
</button>
</form>
</td>
</tr>
@endforeach
</tbody>
@else
<tr>
<td class="border-0">{{ __('crud.other.no_model_found', ['model' => __('models.classes.products')]) }}</td>
</tr>
@endif
</table>
</div>
{!! $productModels->links() !!}
@endsection
<div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap">
@include('modules.breadcrumbs.breadcrumb-body')
<a class="btn btn-primary float-right" data-bs-toggle="tooltip" data-bs-placement="top" href="{{ route('bo.products.create') }}" title="{{ __('crud.helpers.create_model', ['model' => Str::singular(__('models.classes.products'))]) }}">
<i class="fa-solid fa-plus"></i>
</a>
</div>
@include('bo.modules.search-bar')
<div class="table-responsive mb-3">
<table class="table-hover table-fix-action m-0 table">
@if (count($productModels) > 0)
<thead>
@include('bo.modules.table-col-sorter', [
'cols' => [
'label' => __('validation.attributes.label'),
'species' => __('validation.attributes.species'),
'picture' => __('validation.attributes.picture'),
'status' => __('validation.attributes.status'),
'updated_at' => __('validation.attributes.updated_at'),
'order' => __('validation.attributes.order'),
],
])
</thead>
<tbody>
@foreach ($productModels as $productModel)
<tr class="border-bottom">
<td class="text-center align-middle">{{ $productModel->label }}</td>
<td class="text-center align-middle">{{ $productModel->species->label() }}</td>
<td class="text-center align-middle">
<img class="bo-image-preview" src="{{ asset($productModel->sticker_sm) }}" alt="{{ __('Preview product picture') }}">
</td>
@include('bo.modules.change-published-status', [
'routeName' => 'products',
'model' => $productModel,
])
<td class="text-center align-middle"><span class="badge bg-secondary">{{ $productModel->updated_at }}</span></td>
@php
$routeName = request()
->route()
->getName();
@endphp
@if (empty(request()->search) && Session::get("$routeName.sort_col") === 'order')
@include('bo.modules.change-model-order', [
'routeName' => 'products',
'models' => $productModels,
'model' => $productModel,
])
@endif
<td class="text-end align-middle">
<form class="btn-group confirmDeleteTS" action="{{ route('bo.products.destroy', $productModel->id) }}" method="POST" novalidate>
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip" data-bs-placement="top" href="{{ route('bo.products.edit', ['product' => $productModel->id]) }}" title="{{ __('crud.actions.update') }}">
<i class="fa-solid fa-pencil"></i>
</a>
@csrf
@method('DELETE')
<button class="btn btn-sm btn-danger" data-bs-toggle="tooltip" data-bs-placement="top" type="submit" title="{{ __('crud.actions.delete') }}">
<i class="fa-solid fa-trash"></i>
</button>
</form>
</td>
</tr>
@endforeach
</tbody>
@else
<tr>
<td class="border-0">{{ __('crud.other.no_model_found', ['model' => __('models.classes.products')]) }}</td>
</tr>
@endif
</table>
</div>
{!! $productModels->links() !!}
@endsection