Import/export CSV utilisateurs, filtre statut et titre du site modifiable
Utilisateurs :
- Filtre actif/inactif dans la liste (status=active|inactive)
- Export CSV avec les filtres actifs — séparateur ;, BOM UTF-8 (compatible Excel)
- Import CSV : détection auto du séparateur, validation ligne par ligne,
mot de passe temporaire généré + affiché une seule fois dans les résultats
- Téléchargement d'un fichier modèle CSV
Paramètres du site :
- Champ "Titre du site" (site_name dans site_settings.json)
- Titre partagé via SiteSettingsService::siteName() et injecté dans config('app.name')
au boot — s'applique partout sans modifier .env
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,24 +1,59 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="text-xl font-semibold text-gray-800">Gestion des utilisateurs</h2>
|
||||
<div class="flex items-center justify-between">
|
||||
<h2 class="text-xl font-semibold text-gray-800">Gestion des utilisateurs</h2>
|
||||
<div class="flex items-center gap-3">
|
||||
<a href="{{ route('admin.utilisateurs.import') }}"
|
||||
class="flex items-center gap-1.5 px-4 py-2 border border-gray-300 text-sm text-gray-700 rounded-md hover:bg-gray-50 transition-colors">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/>
|
||||
</svg>
|
||||
Importer CSV
|
||||
</a>
|
||||
<a href="{{ route('admin.utilisateurs.export', request()->only(['role', 'status', 'q'])) }}"
|
||||
class="flex items-center gap-1.5 px-4 py-2 border border-gray-300 text-sm text-gray-700 rounded-md hover:bg-gray-50 transition-colors">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4 4m0 0l4 4m-4-4h12"/>
|
||||
</svg>
|
||||
Exporter CSV
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-8 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 space-y-6">
|
||||
|
||||
@if(session('success'))
|
||||
<div class="p-4 bg-green-50 border border-green-200 text-green-800 text-sm rounded-md">
|
||||
{{ session('success') }}
|
||||
</div>
|
||||
@endif
|
||||
@if(session('error'))
|
||||
<div class="p-4 bg-red-50 border border-red-200 text-red-800 text-sm rounded-md">
|
||||
{{ session('error') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- Filtres --}}
|
||||
@php $hasFilters = request()->anyFilled(['role', 'q']); @endphp
|
||||
@php $hasFilters = request()->anyFilled(['role', 'q', 'status']); @endphp
|
||||
<div class="bg-white shadow rounded-lg p-5">
|
||||
<form method="GET" action="{{ route('admin.utilisateurs.index') }}" class="flex flex-wrap items-end gap-4">
|
||||
<div class="flex-1 min-w-[200px]">
|
||||
<form method="GET" action="{{ route('admin.utilisateurs.index') }}"
|
||||
class="flex flex-wrap items-end gap-4">
|
||||
<div class="flex-1 min-w-[180px]">
|
||||
<label class="block text-xs font-medium text-gray-600 mb-1">Recherche</label>
|
||||
<input type="text" name="q" value="{{ request('q') }}"
|
||||
placeholder="Nom ou e-mail…"
|
||||
class="block w-full rounded-md border-gray-300 shadow-sm text-sm focus:border-indigo-500 focus:ring-indigo-500">
|
||||
class="block w-full rounded-md border-gray-300 shadow-sm text-sm
|
||||
focus:border-indigo-500 focus:ring-indigo-500">
|
||||
</div>
|
||||
<div class="w-52">
|
||||
|
||||
<div class="w-44">
|
||||
<label class="block text-xs font-medium text-gray-600 mb-1">Rôle</label>
|
||||
<select name="role"
|
||||
class="block w-full rounded-md border-gray-300 shadow-sm text-sm focus:border-indigo-500 focus:ring-indigo-500">
|
||||
class="block w-full rounded-md border-gray-300 shadow-sm text-sm
|
||||
focus:border-indigo-500 focus:ring-indigo-500">
|
||||
<option value="">— Tous —</option>
|
||||
@foreach(\App\Enums\UserRole::cases() as $r)
|
||||
<option value="{{ $r->value }}" {{ request('role') === $r->value ? 'selected' : '' }}>
|
||||
@@ -27,6 +62,18 @@
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="w-40">
|
||||
<label class="block text-xs font-medium text-gray-600 mb-1">Statut</label>
|
||||
<select name="status"
|
||||
class="block w-full rounded-md border-gray-300 shadow-sm text-sm
|
||||
focus:border-indigo-500 focus:ring-indigo-500">
|
||||
<option value="">— Tous —</option>
|
||||
<option value="active" {{ request('status') === 'active' ? 'selected' : '' }}>Actifs</option>
|
||||
<option value="inactive" {{ request('status') === 'inactive' ? 'selected' : '' }}>Inactifs</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-3">
|
||||
<button type="submit"
|
||||
class="px-5 py-2 bg-indigo-600 text-white text-sm font-medium rounded-md hover:bg-indigo-700">
|
||||
@@ -51,7 +98,7 @@
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">E-mail</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Rôle</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Sections</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Sources assignées</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Sources</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Inscrit le</th>
|
||||
<th class="px-6 py-3"></th>
|
||||
</tr>
|
||||
@@ -85,11 +132,7 @@
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 text-gray-500">
|
||||
@if($user->sections->isNotEmpty())
|
||||
{{ $user->sections->pluck('nom')->join(', ') }}
|
||||
@else
|
||||
—
|
||||
@endif
|
||||
{{ $user->sections->isNotEmpty() ? $user->sections->pluck('nom')->join(', ') : '—' }}
|
||||
</td>
|
||||
<td class="px-6 py-4 text-gray-500">{{ $user->sources_assignees_count ?: '—' }}</td>
|
||||
<td class="px-6 py-4 text-gray-500 whitespace-nowrap">
|
||||
@@ -98,10 +141,9 @@
|
||||
<td class="px-6 py-4 text-right space-x-3">
|
||||
@if($user->id !== auth()->id())
|
||||
<a href="{{ route('admin.utilisateurs.edit', $user) }}"
|
||||
class="text-indigo-600 hover:underline text-sm">
|
||||
Modifier
|
||||
</a>
|
||||
<form method="POST" action="{{ route('admin.utilisateurs.toggle-active', $user) }}"
|
||||
class="text-indigo-600 hover:underline text-sm">Modifier</a>
|
||||
<form method="POST"
|
||||
action="{{ route('admin.utilisateurs.toggle-active', $user) }}"
|
||||
class="inline" x-data
|
||||
@submit.prevent="if(confirm('{{ $user->is_active ? 'Désactiver' : 'Activer' }} ce compte ?')) $el.submit()">
|
||||
@csrf
|
||||
@@ -126,5 +168,6 @@
|
||||
<div class="px-6 py-4 border-t">{{ $users->links() }}</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</x-app-layout>
|
||||
|
||||
Reference in New Issue
Block a user