ldc-le-gaulois-pro/resources/views/bo/pages/advice/index.blade.php
2026-04-13 15:35:33 +02:00

81 lines
4.6 KiB
PHP

@extends('bo.layout', ['brParam' => $currentType])
@section('title', Str::singular($currentType->label()))
@section('description', __('Liste de tous les :model', ['model' => Str::singular($currentType->label())]))
@section('breadcrumb', request()->route()->getName())
@section('content')
<div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap">
@include('modules.breadcrumbs.breadcrumb-body', ['brParam' => $currentType])
@if ($currentType != App\Enums\Advices\AdviceTypeEnum::all())
<a class="btn btn-primary float-right" data-bs-toggle="tooltip" data-bs-placement="top"
href="{{ route('bo.advice.create', ['type' => $currentType->value]) }}"
title="{{ __('crud.helpers.create_model', ['model' => Str::singular($currentType->label())]) }}">
<i class="fa-solid fa-plus"></i>
</a>
@endif
</div>
@include('bo.modules.search-bar')
<div class="table-responsive mb-3">
<table class="table-hover table-fix-action m-0 table">
@if (count($adviceModels) > 0)
<thead>
@include('bo.modules.table-col-sorter', [
'cols' => [
'priority_order' => Str::ucfirst(__('validation.custom.priority')),
'title' => __('validation.attributes.title'),
'picture' => __('validation.attributes.picture'),
'published' => __('validation.attributes.published'),
'updated_at' => __('validation.attributes.updated_at'),
],
])
</thead>
<tbody>
@foreach ($adviceModels as $adviceModel)
<tr class="border-bottom">
@include('bo.modules.change-model-order-select', [
'model' => $adviceModel,
'value' => $adviceModel->priority_order,
'route' => route('bo.advice.change-priority', $adviceModel)
])
<td class="text-center align-middle">{{ $adviceModel->title }}</td>
<td class="text-center align-middle">
@if($adviceModel->picture)
<x-uwil-common::markup.img class="bo-image-preview" alt="{{ __('Preview advice picture') }}"
url="{{ asset($adviceModel->picture) }}" />
@else
<p>{{ __('Pas d\'image') }}</p>
@endif
</td>
@include('bo.modules.change-published-status', [
'routeName' => 'advice',
'model' => $adviceModel,
])
<td class="text-center align-middle"><span class="badge bg-secondary">{{ $adviceModel->updated_at }}</span></td>
<td class="text-end align-middle">
<form class="btn-group confirmDeleteTS" action="{{ route('bo.advice.destroy', $adviceModel->id) }}"
method="POST" novalidate>
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip" data-bs-placement="top"
href="{{ route('bo.advice.edit', $adviceModel->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">{{ trans_choice('crud.other.no_model_found', 2, ['model' => $currentType->label()]) }}</td>
</tr>
@endif
</table>
</div>
{!! $adviceModels->links() !!}
@endsection