ldc-com-app-bo/resources/views/bo/pages/users/index-list.blade.php
2025-05-28 17:25:44 +02:00

97 lines
5.2 KiB
PHP

<div class="table-responsive">
<table class="table fix-action">
<thead>
@php
$cols = [
'lastname' => str(__('validation.attributes.last_name'))->ucFirst(),
'firstname' => str(__('validation.attributes.first_name'))->ucFirst(),
'email' => str(__('validation.attributes.email'))->ucFirst(),
'tenants' => str(__('models.classes.tenant'))->ucFirst()->plural(),
'updated_at' => str(__('validation.attributes.updated_at'))->ucFirst(),
];
@endphp
@include('bo.modules.table-col-sorter', [
'cols' => $cols,
'mobileHide' => [],
])
</thead>
<tbody>
@if ($userModels->count())
@foreach ($userModels as $userModel)
<tr>
<td class="text-center align-middle">
{{ $userModel->last_name }}
</td>
<td class="text-center align-middle">
{{ $userModel->first_name }}
</td>
<td class="text-center align-middle">
{{ $userModel->email }}
</td>
<td class="text-center align-middle">
@if ($userModel->can('isAdmin') || $userModel->tenants->count())
@if ($userModel->can('isAdmin'))
<small class="fst-italic text-secondary">{{ $userModel->role->label() }}</small>
@else
@foreach($userModel->tenants as $tenant)
<a href="{{ route('bo.tenants.edit', $tenant) }}" class="badge bg-primary">{{ $tenant->name }}</a>
@endforeach
@endif
@else
<small class="fst-italic text-secondary">{{ __('No tenants') }}</small>
@endif
</td>
<td class="text-center align-middle">
<span class="badge bg-secondary">{{ $userModel->updated_at->isoFormat('LLLL') }}</span>
</td>
<td class="text-end">
@can('delete', $userModel)
<form
action="{{ route('bo.users.destroy', ['user' => $userModel]) }}"
method="POST" class="d-inline confirmDeleteTS">
@endcan
<div class="btn-group" role="group">
@can('duplicate', $userModel)
<a class="btn btn-sm btn-secondary" data-bs-toggle="tooltip"
href="{{ route('bo.users.duplicate', $userModel) }}"
title="{{ __('Dupliquer l\':model', ['model' => __('models.classes.user')]) }}">
<i class="fa-solid fa-copy"></i>
</a>
@endcan
@can('update', $userModel)
<a id="formSubmitClone"
href="{{ route('bo.users.edit', ['user' => $userModel]) }}"
class="btn btn-sm btn-primary" role="button"
title="{{ __('Modifier l\':model', ['model' => __('models.classes.user')]) }}"
data-bs-toggle="tooltip">
<i class="fa-solid fa-pencil"></i>
</a>
@endcan
@can('delete', $userModel)
@csrf
@method('DELETE')
<button class="btn btn-sm btn-danger"
title="{{ __('Supprimer l\':model', ['model' => __('models.classes.user')]) }}"
data-bs-toggle="tooltip">
<i class="fa-solid fa-trash"></i>
</button>
@endcan
</div>
@can('delete', $userModel)
</form>
@endcan
</td>
</tr>
@endforeach
@else
<tr>
<td colspan="{{ count($cols) + 1 }}" class="text-center">
<span class="h3">
{{ __('Aucun résultat pour les :models', ['models' => str(__('models.classes.user'))->plural()]) }}
</span>
</td>
</tr>
@endif
</tbody>
</table>
</div>