feat: ✨ add a display page for users
This commit is contained in:
parent
18ca71d29f
commit
9b8d457360
9 changed files with 680 additions and 542 deletions
|
|
@ -74,6 +74,17 @@ class UserController extends Controller
|
|||
return view('bo.pages.users.create', ['userModel' => $user]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a specific resource.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function show(User $user): \Illuminate\Contracts\View\View
|
||||
{
|
||||
return view('bo.pages.users.show', ['userModel' => $user]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -272,6 +272,7 @@ return [
|
|||
'publication' => 'publication',
|
||||
'publish_at' => 'publish at',
|
||||
'published' => 'published',
|
||||
'published_at' => 'published at',
|
||||
'route_name' => 'name of the route',
|
||||
'seo_description' => 'seo description',
|
||||
'seo_title' => 'seo title',
|
||||
|
|
|
|||
|
|
@ -274,6 +274,7 @@ return [
|
|||
'publication' => 'publication',
|
||||
'publish_at' => 'date de publication',
|
||||
'published' => 'publié',
|
||||
'published_at' => 'publié le',
|
||||
'route_name' => 'nom de la route',
|
||||
'seo_description' => 'description SEO',
|
||||
'seo_title' => 'titre SEO',
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -15,6 +15,12 @@
|
|||
</div>
|
||||
<div class="mb-md-0 mb-2">
|
||||
<form class="btn-group confirmDeleteTS" action="{{ route('bo.users.destroy', $userModel) }}" method="POST" novalidate>
|
||||
@can('view', $userModel)
|
||||
<a class="btn btn-warning" data-bs-toggle="tooltip" href="{{ route('bo.users.show', ['user' => $userModel]) }}"
|
||||
title="{{ str(__('crud.actions.view'))->ucfirst() }}">
|
||||
<i class="fa-solid fa-eye"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('duplicate', $userModel)
|
||||
<a class="btn btn-secondary" data-bs-toggle="tooltip" href="{{ route('bo.users.duplicate', ['user' => $userModel]) }}"
|
||||
title="{{ str(__('crud.actions.duplicate'))->ucfirst() }}">
|
||||
|
|
|
|||
|
|
@ -30,6 +30,13 @@
|
|||
@canAny(['delete', 'duplicate', 'update'], $userModel)
|
||||
<form class="btn-group confirmDeleteTS" action="{{ route('bo.users.destroy', $userModel) }}" method="POST"
|
||||
novalidate>
|
||||
@can('view', $userModel)
|
||||
<a class="btn btn-sm btn-warning" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.users.show', ['user' => $userModel]) }}"
|
||||
title="{{ str(__('crud.actions.show'))->ucfirst() }}">
|
||||
<i class="fa-solid fa-eye"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('duplicate', $userModel)
|
||||
<a class="btn btn-sm btn-secondary" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.users.duplicate', ['user' => $userModel]) }}"
|
||||
|
|
|
|||
92
resources/views/bo/pages/users/show.blade.php
Normal file
92
resources/views/bo/pages/users/show.blade.php
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
@extends('bo.layout', ['brParam' => $userModel])
|
||||
|
||||
@section('title', __('Édition d\'un :model', ['model' => __('models.classes.user')]))
|
||||
@section('description', __('Édition d\'un :model déjà existant', ['model' => __('models.classes.user')]))
|
||||
@section('breadcrumb', request()->route()->getName())
|
||||
|
||||
@section('content')
|
||||
<div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap pb-3">
|
||||
<div class="d-flex align-items-start flex-row">
|
||||
<a class="btn btn-primary text-decoration-none m-0 me-2" data-bs-toggle="tooltip" href="{{ route('bo.users.index') }}"
|
||||
title="{{ __('crud.helpers.list_all', ['model' => str(__('models.classes.user'))->plural()]) }}">
|
||||
<i class="fa-solid fa-arrow-left"></i>
|
||||
</a>
|
||||
@include('modules.breadcrumbs.breadcrumb-body', ['brParam' => $userModel])
|
||||
</div>
|
||||
<div class="btn-group mb-md-0 mb-2">
|
||||
@canAny(['view', 'duplicate', 'update', 'delete'], $userModel)
|
||||
<form class="btn-group confirmDeleteTS" action="{{ route('bo.users.destroy', $userModel) }}" method="POST" novalidate>
|
||||
@can('duplicate', $userModel)
|
||||
<a class="btn btn-secondary" data-bs-toggle="tooltip" href="{{ route('bo.users.duplicate', ['user' => $userModel]) }}"
|
||||
title="{{ str(__('crud.actions.duplicate'))->ucfirst() }}">
|
||||
<i class="fa-solid fa-copy"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('update', $userModel)
|
||||
<a class="btn btn-primary" data-bs-toggle="tooltip" href="{{ route('bo.users.edit', ['user' => $userModel]) }}"
|
||||
title="{{ str(__('crud.actions.update'))->ucfirst() }}">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('delete', $userModel)
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button class="btn btn-danger" data-bs-toggle="tooltip" type="submit" title="{{ str(__('crud.actions.delete'))->ucfirst() }}">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
@endcan
|
||||
</form>
|
||||
@endcan
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="table-responsive mb-3">
|
||||
<table class="table-hover m-0 table">
|
||||
<tbody>
|
||||
<tr class="border-bottom">
|
||||
<td class="w-50 fw-bold text-center align-middle">
|
||||
{{ str(sprintf('%s/%s', __('validation.attributes.first_name'), __('validation.attributes.last_name')))->ucFirst() }}
|
||||
</td>
|
||||
<td class="w-50 text-center align-middle">
|
||||
{{ sprintf('%s %s', $userModel->first_name, $userModel->last_name) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-bottom">
|
||||
<td class="w-50 fw-bold text-center align-middle">{{ str(__('validation.attributes.email'))->ucFirst() }}</td>
|
||||
<td class="w-50 text-center align-middle">
|
||||
{{ $userModel->email }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-bottom">
|
||||
<td class="w-50 fw-bold text-center align-middle">{{ str(__('validation.attributes.role'))->ucFirst() }}</td>
|
||||
<td class="w-50 text-center align-middle">
|
||||
{{ str($userModel->role->label())->ucFirst() }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-bottom">
|
||||
<td class="w-50 fw-bold text-center align-middle">
|
||||
{{ str(__('validation.custom.published_at'))->ucFirst() }}
|
||||
</td>
|
||||
<td class="w-50 text-center align-middle">
|
||||
{{ $userModel->published ? $userModel->published_at->isoFormat('LLLL') : __('Utilisateur non publié') }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-bottom">
|
||||
<td class="w-50 fw-bold text-center align-middle">{{ str(__('validation.attributes.created_at'))->ucFirst() }}</td>
|
||||
<td class="w-50 text-center align-middle">
|
||||
{{ $userModel->created_at->isoFormat('LLLL') }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-bottom">
|
||||
<td class="w-50 fw-bold text-center align-middle">{{ str(__('validation.attributes.updated_at'))->ucFirst() }}</td>
|
||||
<td class="w-50 text-center align-middle">
|
||||
{{ $userModel->updated_at->isoFormat('LLLL') }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -49,6 +49,10 @@ Breadcrumbs::for('bo.users.create', function (Generator $trail) {
|
|||
$trail->parent('bo.users.index');
|
||||
$trail->push(Str::ucfirst(trans('crud.actions.create')), route('bo.users.create'));
|
||||
});
|
||||
Breadcrumbs::for('bo.users.show', function (Generator $trail, User $user) {
|
||||
$trail->parent('bo.users.index');
|
||||
$trail->push(Str::ucfirst(trans('crud.actions.view')), route('bo.users.show', $user));
|
||||
});
|
||||
Breadcrumbs::for('bo.users.edit', function (Generator $trail, User $user) {
|
||||
$trail->parent('bo.users.index');
|
||||
$trail->push(Str::ucfirst(trans('crud.actions.edit')), route('bo.users.edit', $user));
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ Route::prefix('bo')
|
|||
Route::get('/', [DashboardController::class, 'index'])->name('dashboard');
|
||||
|
||||
// * USERS.
|
||||
Route::resource('users', UserController::class)->except('show');
|
||||
Route::resource('users', UserController::class);
|
||||
Route::patch('/users/{user}/change-published', [
|
||||
UserController::class, 'changePublished'
|
||||
])->name('users.change-published');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue