ldc-agis/resources/views/bo/pages/commitments/index-list.blade.php
2024-02-07 12:15:42 +01:00

80 lines
4.5 KiB
PHP

<table class="table-hover table-fix-action m-0 table">
@if (count($commitmentModels) > 0)
<thead>
@include('bo.modules.table-col-sorter', [
'cols' => [
'title' => Str::ucfirst(__('validation.attributes.title')),
'picture' => Str::ucfirst(__('validation.custom.picture')),
'order' => Str::ucfirst(__('validation.custom.order')),
'published' => Str::ucfirst(__('validation.custom.activated')),
'updated_at' => Str::ucfirst(__('validation.attributes.updated_at')),
],
])
</thead>
<tbody>
@foreach ($commitmentModels as $commitmentModel)
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ $commitmentModel->title }}</td>
<td class="text-center align-middle">
<img src="{{ asset($commitmentModel->picture) }}" title="{{ $commitmentModel->picture_title }}"
alt="{{ $commitmentModel->picture_alt }}" height="50px">
</td>
@php
$routeName = request()->route()->getName();
@endphp
@if (empty(request()->search) && Session::get("$routeName.sort_col") === 'order')
@include('bo.modules.change-model-order', [
'routeName' => 'commitments',
'model' => $commitmentModel,
'models' => $commitmentModels,
])
@endif
@include('bo.modules.change-published-status', [
'routeName' => 'commitments',
'model' => $commitmentModel,
])
<td class="text-center align-middle">
<span class="badge bg-secondary">{{ $commitmentModel->updated_at->isoFormat('LLLL') }}</span>
</td>
<td class="text-end align-middle">
@canAny(['delete', 'duplicate', 'update'], $commitmentModel)
<form class="btn-group confirmDeleteTS" action="{{ route('bo.commitments.destroy', $commitmentModel) }}"
method="POST" novalidate>
@can('duplicate', $commitmentModel)
<a class="btn btn-sm btn-secondary" data-bs-toggle="tooltip"
href="{{ route('bo.commitments.duplicate', ['commitment' => $commitmentModel]) }}"
title="{{ Str::ucfirst(__('crud.actions.duplicate')) }}">
<i class="fa-solid fa-copy"></i>
</a>
@endcan
@can('update', $commitmentModel)
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip"
href="{{ route('bo.commitments.edit', ['commitment' => $commitmentModel]) }}"
title="{{ Str::ucfirst(__('crud.actions.update')) }}">
<i class="fa-solid fa-pencil"></i>
</a>
@endcan
@can('delete', $commitmentModel)
@csrf
@method('DELETE')
<button class="btn btn-sm btn-danger" data-bs-toggle="tooltip" type="submit"
title="{{ Str::ucfirst(__('crud.actions.delete')) }}">
<i class="fa-solid fa-trash"></i>
</button>
@endcan
</form>
@else
<span class="text-danger" data-bs-toggle="tooltip" title="{{ __('list.right') }}">
<i class="fa-solid fa-ban"></i>
</span>
@endcan
</td>
</tr>
@endforeach
</tbody>
@else
<tr>
<td class="border-0">{{ __('crud.other.no_model_found', ['model' => __('models.classes.commitment')]) }}</td>
</tr>
@endif
</table>