Initial scaffold : Laravel 12 + PostgreSQL + auth + domaine métier (étapes 1-5)

- Laravel 12 sur PHP 8.5, Breeze (Blade/Tailwind/Alpine.js)
- Docker Compose dev (PostgreSQL 18 + Redis) et prod (stack complète + nginx)
- Migrations et models : lieux, sections, dépôts, source_types/fields, sources, relevés
  - Colonne JSONB data sur releves avec colonnes générées indexées (nom, prenom, date_evenement)
  - Index GIN pour la recherche fulltext
- Enums : UserRole, SourceStatus (avec transitions), CalendarType, FieldType
- RoleMiddleware (alias `role`) + helpers isAdmin/isSectionManager sur User
- CRUD Lieux (arbre hiérarchique, calcul nom_long en cascade)
- CRUD admin : Sections (+ gestion membres), Dépôts, Types de sources (+ champs dynamiques, drag & drop)
- CRUD Sources : visibilité filtrée par rôle, assignation membres, workflow de statut

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-04 16:16:37 +02:00
commit 7609d35287
172 changed files with 19179 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
+7
View File
@@ -0,0 +1,7 @@
import './bootstrap';
import Alpine from 'alpinejs';
window.Alpine = Alpine;
Alpine.start();
+4
View File
@@ -0,0 +1,4 @@
import axios from 'axios';
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
@@ -0,0 +1,24 @@
<div class="space-y-5">
<div>
<label for="nom" class="block text-sm font-medium text-gray-700">Nom <span class="text-red-500">*</span></label>
<input type="text" id="nom" name="nom" value="{{ old('nom', $depot?->nom) }}" required
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
@error('nom') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label for="description" class="block text-sm font-medium text-gray-700">Description</label>
<textarea id="description" name="description" rows="3"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">{{ old('description', $depot?->description) }}</textarea>
</div>
<div>
<label for="adresse_postale" class="block text-sm font-medium text-gray-700">Adresse postale</label>
<input type="text" id="adresse_postale" name="adresse_postale" value="{{ old('adresse_postale', $depot?->adresse_postale) }}"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
</div>
<div>
<label for="url" class="block text-sm font-medium text-gray-700">Site internet</label>
<input type="url" id="url" name="url" value="{{ old('url', $depot?->url) }}"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
@error('url') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
</div>
@@ -0,0 +1,15 @@
<x-app-layout>
<x-slot name="header"><h2 class="text-xl font-semibold text-gray-800">Nouveau dépôt</h2></x-slot>
<div class="py-8 max-w-2xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="bg-white shadow rounded-lg p-6">
<form method="POST" action="{{ route('admin.depots.store') }}">
@csrf
@include('admin.depots._form', ['depot' => null])
<div class="mt-6 flex gap-4">
<button type="submit" class="px-5 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700">Créer</button>
<a href="{{ route('admin.depots.index') }}" class="text-sm text-gray-500 self-center hover:text-gray-700">Annuler</a>
</div>
</form>
</div>
</div>
</x-app-layout>
@@ -0,0 +1,15 @@
<x-app-layout>
<x-slot name="header"><h2 class="text-xl font-semibold text-gray-800">Modifier : {{ $depot->nom }}</h2></x-slot>
<div class="py-8 max-w-2xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="bg-white shadow rounded-lg p-6">
<form method="POST" action="{{ route('admin.depots.update', $depot) }}">
@csrf @method('PUT')
@include('admin.depots._form', ['depot' => $depot])
<div class="mt-6 flex gap-4">
<button type="submit" class="px-5 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700">Enregistrer</button>
<a href="{{ route('admin.depots.show', $depot) }}" class="text-sm text-gray-500 self-center hover:text-gray-700">Annuler</a>
</div>
</form>
</div>
</div>
</x-app-layout>
@@ -0,0 +1,50 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<h2 class="text-xl font-semibold text-gray-800">Dépôts d'archives</h2>
<a href="{{ route('admin.depots.create') }}" class="px-4 py-2 bg-indigo-600 text-white text-sm rounded-md hover:bg-indigo-700">+ Nouveau dépôt</a>
</div>
</x-slot>
<div class="py-8 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
@if(session('success')) <div class="mb-4 p-4 bg-green-50 border border-green-200 text-green-800 rounded-md">{{ session('success') }}</div> @endif
@if(session('error')) <div class="mb-4 p-4 bg-red-50 border border-red-200 text-red-800 rounded-md">{{ session('error') }}</div> @endif
<div class="bg-white shadow rounded-lg overflow-hidden">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Nom</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">Site</th>
<th class="px-6 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
@forelse($depots as $depot)
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 font-medium">
<a href="{{ route('admin.depots.show', $depot) }}" class="text-indigo-600 hover:underline">{{ $depot->nom }}</a>
</td>
<td class="px-6 py-4 text-sm text-gray-500">{{ $depot->sources_count }}</td>
<td class="px-6 py-4 text-sm text-gray-500">
@if($depot->url) <a href="{{ $depot->url }}" target="_blank" class="text-indigo-600 hover:underline truncate max-w-xs block">{{ $depot->url }}</a>
@else
@endif
</td>
<td class="px-6 py-4 text-right text-sm space-x-3">
<a href="{{ route('admin.depots.edit', $depot) }}" class="text-gray-600 hover:text-indigo-600">Modifier</a>
<form method="POST" action="{{ route('admin.depots.destroy', $depot) }}" class="inline"
x-data @submit.prevent="if(confirm('Supprimer ce dépôt ?')) $el.submit()">
@csrf @method('DELETE')
<button type="submit" class="text-red-500 hover:text-red-700">Supprimer</button>
</form>
</td>
</tr>
@empty
<tr><td colspan="4" class="px-6 py-10 text-center text-gray-400">Aucun dépôt.</td></tr>
@endforelse
</tbody>
</table>
@if($depots->hasPages()) <div class="px-6 py-4 border-t">{{ $depots->links() }}</div> @endif
</div>
</div>
</x-app-layout>
@@ -0,0 +1,34 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<h2 class="text-xl font-semibold text-gray-800">{{ $depot->nom }}</h2>
<a href="{{ route('admin.depots.edit', $depot) }}" class="px-4 py-2 bg-indigo-600 text-white text-sm rounded-md hover:bg-indigo-700">Modifier</a>
</div>
</x-slot>
<div class="py-8 max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 space-y-6">
<div class="bg-white shadow rounded-lg divide-y divide-gray-100 text-sm">
@if($depot->description)
<div class="px-6 py-4 grid grid-cols-3 gap-4"><dt class="font-medium text-gray-500">Description</dt><dd class="col-span-2">{{ $depot->description }}</dd></div>
@endif
@if($depot->adresse_postale)
<div class="px-6 py-4 grid grid-cols-3 gap-4"><dt class="font-medium text-gray-500">Adresse</dt><dd class="col-span-2">{{ $depot->adresse_postale }}</dd></div>
@endif
@if($depot->url)
<div class="px-6 py-4 grid grid-cols-3 gap-4"><dt class="font-medium text-gray-500">Site</dt><dd class="col-span-2"><a href="{{ $depot->url }}" target="_blank" class="text-indigo-600 hover:underline">{{ $depot->url }}</a></dd></div>
@endif
</div>
@if($depot->sources->isNotEmpty())
<div class="bg-white shadow rounded-lg overflow-hidden">
<div class="px-6 py-4 border-b font-medium text-gray-900">Sources ({{ $depot->sources->count() }})</div>
<ul class="divide-y divide-gray-100">
@foreach($depot->sources as $source)
<li class="px-6 py-3 text-sm text-gray-700">{{ $source->nom }}</li>
@endforeach
</ul>
</div>
@endif
<a href="{{ route('admin.depots.index') }}" class="text-sm text-indigo-600 hover:underline"> Retour</a>
</div>
</x-app-layout>
@@ -0,0 +1,41 @@
<div class="space-y-5">
<div>
<label for="nom" class="block text-sm font-medium text-gray-700">Nom <span class="text-red-500">*</span></label>
<input type="text" id="nom" name="nom" value="{{ old('nom', $section?->nom) }}" required
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 @error('nom') border-red-500 @enderror">
@error('nom') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label for="lieu_id" class="block text-sm font-medium text-gray-700">Lieu de rattachement</label>
<select id="lieu_id" name="lieu_id"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
<option value=""> Aucun </option>
@foreach($lieux as $lieu)
<option value="{{ $lieu->id }}" {{ old('lieu_id', $section?->lieu_id) == $lieu->id ? 'selected' : '' }}>
{{ $lieu->nom_long ?? $lieu->nom }}
</option>
@endforeach
</select>
</div>
<div>
<label for="adresse" class="block text-sm font-medium text-gray-700">Adresse</label>
<input type="text" id="adresse" name="adresse" value="{{ old('adresse', $section?->adresse) }}"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
</div>
<div>
<label for="email_contact" class="block text-sm font-medium text-gray-700">Email de contact</label>
<input type="email" id="email_contact" name="email_contact" value="{{ old('email_contact', $section?->email_contact) }}"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 @error('email_contact') border-red-500 @enderror">
@error('email_contact') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label for="url" class="block text-sm font-medium text-gray-700">Site internet</label>
<input type="url" id="url" name="url" value="{{ old('url', $section?->url) }}"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 @error('url') border-red-500 @enderror">
@error('url') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
</div>
@@ -0,0 +1,15 @@
<x-app-layout>
<x-slot name="header"><h2 class="text-xl font-semibold text-gray-800">Nouvelle section</h2></x-slot>
<div class="py-8 max-w-2xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="bg-white shadow rounded-lg p-6">
<form method="POST" action="{{ route('admin.sections.store') }}">
@csrf
@include('admin.sections._form', ['section' => null])
<div class="mt-6 flex gap-4">
<button type="submit" class="px-5 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700">Créer</button>
<a href="{{ route('admin.sections.index') }}" class="text-sm text-gray-500 hover:text-gray-700 self-center">Annuler</a>
</div>
</form>
</div>
</div>
</x-app-layout>
@@ -0,0 +1,15 @@
<x-app-layout>
<x-slot name="header"><h2 class="text-xl font-semibold text-gray-800">Modifier : {{ $section->nom }}</h2></x-slot>
<div class="py-8 max-w-2xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="bg-white shadow rounded-lg p-6">
<form method="POST" action="{{ route('admin.sections.update', $section) }}">
@csrf @method('PUT')
@include('admin.sections._form', ['section' => $section])
<div class="mt-6 flex gap-4">
<button type="submit" class="px-5 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700">Enregistrer</button>
<a href="{{ route('admin.sections.show', $section) }}" class="text-sm text-gray-500 hover:text-gray-700 self-center">Annuler</a>
</div>
</form>
</div>
</div>
</x-app-layout>
@@ -0,0 +1,52 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<h2 class="text-xl font-semibold text-gray-800">Sections locales</h2>
<a href="{{ route('admin.sections.create') }}"
class="px-4 py-2 bg-indigo-600 text-white text-sm rounded-md hover:bg-indigo-700">+ Nouvelle section</a>
</div>
</x-slot>
<div class="py-8 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
@if(session('success'))
<div class="mb-4 p-4 bg-green-50 border border-green-200 text-green-800 rounded-md">{{ session('success') }}</div>
@endif
<div class="bg-white shadow rounded-lg overflow-hidden">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Nom</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Lieu</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Contact</th>
<th class="px-6 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
@forelse($sections as $section)
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 font-medium">
<a href="{{ route('admin.sections.show', $section) }}" class="text-indigo-600 hover:underline">{{ $section->nom }}</a>
</td>
<td class="px-6 py-4 text-sm text-gray-500">{{ $section->lieu?->nom ?? '—' }}</td>
<td class="px-6 py-4 text-sm text-gray-500">{{ $section->email_contact ?? '—' }}</td>
<td class="px-6 py-4 text-right text-sm space-x-3">
<a href="{{ route('admin.sections.edit', $section) }}" class="text-gray-600 hover:text-indigo-600">Modifier</a>
<form method="POST" action="{{ route('admin.sections.destroy', $section) }}" class="inline"
x-data @submit.prevent="if(confirm('Supprimer cette section ?')) $el.submit()">
@csrf @method('DELETE')
<button type="submit" class="text-red-500 hover:text-red-700">Supprimer</button>
</form>
</td>
</tr>
@empty
<tr><td colspan="4" class="px-6 py-10 text-center text-gray-400">Aucune section.</td></tr>
@endforelse
</tbody>
</table>
@if($sections->hasPages())
<div class="px-6 py-4 border-t">{{ $sections->links() }}</div>
@endif
</div>
</div>
</x-app-layout>
@@ -0,0 +1,91 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<h2 class="text-xl font-semibold text-gray-800">{{ $section->nom }}</h2>
<a href="{{ route('admin.sections.edit', $section) }}"
class="px-4 py-2 bg-indigo-600 text-white text-sm rounded-md hover:bg-indigo-700">Modifier</a>
</div>
</x-slot>
<div class="py-8 max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 space-y-6">
@foreach(['success','error'] as $flash)
@if(session($flash))
<div class="p-4 rounded-md {{ $flash === 'success' ? 'bg-green-50 border border-green-200 text-green-800' : 'bg-red-50 border border-red-200 text-red-800' }}">
{{ session($flash) }}
</div>
@endif
@endforeach
{{-- Fiche --}}
<div class="bg-white shadow rounded-lg divide-y divide-gray-100 text-sm">
@foreach([['Lieu', $section->lieu?->nom_long ?? '—'], ['Adresse', $section->adresse ?? '—'], ['Email', $section->email_contact ?? '—'], ['Site', $section->url ?? '—']] as [$label, $val])
<div class="px-6 py-4 grid grid-cols-3 gap-4">
<dt class="font-medium text-gray-500">{{ $label }}</dt>
<dd class="col-span-2 text-gray-900">{{ $val }}</dd>
</div>
@endforeach
</div>
{{-- Membres --}}
<div class="bg-white shadow rounded-lg overflow-hidden">
<div class="px-6 py-4 border-b border-gray-200 font-medium text-gray-900">
Membres ({{ $section->membres->count() }})
</div>
@if($section->membres->isNotEmpty())
<table class="min-w-full divide-y divide-gray-200 text-sm">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Nom</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Email</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Rôle dans la section</th>
<th class="px-6 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
@foreach($section->membres as $membre)
<tr>
<td class="px-6 py-3">{{ $membre->name }}</td>
<td class="px-6 py-3 text-gray-500">{{ $membre->email }}</td>
<td class="px-6 py-3">
{{ $membre->pivot->role_in_section === 'section_manager' ? 'Responsable' : 'Membre' }}
</td>
<td class="px-6 py-3 text-right">
<form method="POST" action="{{ route('admin.sections.membres.remove', [$section, $membre]) }}"
x-data @submit.prevent="if(confirm('Retirer ce membre ?')) $el.submit()">
@csrf @method('DELETE')
<button type="submit" class="text-red-500 hover:text-red-700 text-sm">Retirer</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
@endif
{{-- Ajouter un membre --}}
<div class="px-6 py-4 bg-gray-50 border-t border-gray-200">
<form method="POST" action="{{ route('admin.sections.membres.add', $section) }}" class="flex gap-3 items-end">
@csrf
<div class="flex-1">
<label class="block text-xs font-medium text-gray-600 mb-1">Utilisateur</label>
<select name="user_id" class="block w-full rounded-md border-gray-300 shadow-sm text-sm focus:border-indigo-500 focus:ring-indigo-500">
@foreach($users as $user)
<option value="{{ $user->id }}">{{ $user->name }} ({{ $user->email }})</option>
@endforeach
</select>
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">Rôle</label>
<select name="role_in_section" class="block w-full rounded-md border-gray-300 shadow-sm text-sm focus:border-indigo-500 focus:ring-indigo-500">
<option value="member">Membre</option>
<option value="section_manager">Responsable</option>
</select>
</div>
<button type="submit" class="px-4 py-2 bg-indigo-600 text-white text-sm rounded-md hover:bg-indigo-700">Ajouter</button>
</form>
</div>
</div>
<a href="{{ route('admin.sections.index') }}" class="text-sm text-indigo-600 hover:underline"> Retour</a>
</div>
</x-app-layout>
@@ -0,0 +1,27 @@
<x-app-layout>
<x-slot name="header"><h2 class="text-xl font-semibold text-gray-800">Nouveau type de source</h2></x-slot>
<div class="py-8 max-w-2xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="bg-white shadow rounded-lg p-6">
<form method="POST" action="{{ route('admin.source-types.store') }}">
@csrf
<div class="space-y-5">
<div>
<label for="nom" class="block text-sm font-medium text-gray-700">Nom <span class="text-red-500">*</span></label>
<input type="text" id="nom" name="nom" value="{{ old('nom') }}" required
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
@error('nom') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label for="description" class="block text-sm font-medium text-gray-700">Description</label>
<textarea id="description" name="description" rows="3"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">{{ old('description') }}</textarea>
</div>
</div>
<div class="mt-6 flex gap-4">
<button type="submit" class="px-5 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700">Créer et définir les champs</button>
<a href="{{ route('admin.source-types.index') }}" class="text-sm text-gray-500 self-center hover:text-gray-700">Annuler</a>
</div>
</form>
</div>
</div>
</x-app-layout>
@@ -0,0 +1,26 @@
<x-app-layout>
<x-slot name="header"><h2 class="text-xl font-semibold text-gray-800">Modifier : {{ $sourceType->nom }}</h2></x-slot>
<div class="py-8 max-w-2xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="bg-white shadow rounded-lg p-6">
<form method="POST" action="{{ route('admin.source-types.update', $sourceType) }}">
@csrf @method('PUT')
<div class="space-y-5">
<div>
<label for="nom" class="block text-sm font-medium text-gray-700">Nom <span class="text-red-500">*</span></label>
<input type="text" id="nom" name="nom" value="{{ old('nom', $sourceType->nom) }}" required
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
</div>
<div>
<label for="description" class="block text-sm font-medium text-gray-700">Description</label>
<textarea id="description" name="description" rows="3"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">{{ old('description', $sourceType->description) }}</textarea>
</div>
</div>
<div class="mt-6 flex gap-4">
<button type="submit" class="px-5 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700">Enregistrer</button>
<a href="{{ route('admin.source-types.show', $sourceType) }}" class="text-sm text-gray-500 self-center hover:text-gray-700">Annuler</a>
</div>
</form>
</div>
</div>
</x-app-layout>
@@ -0,0 +1,46 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<h2 class="text-xl font-semibold text-gray-800">Types de sources</h2>
<a href="{{ route('admin.source-types.create') }}" class="px-4 py-2 bg-indigo-600 text-white text-sm rounded-md hover:bg-indigo-700">+ Nouveau type</a>
</div>
</x-slot>
<div class="py-8 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
@if(session('success')) <div class="mb-4 p-4 bg-green-50 border border-green-200 text-green-800 rounded-md">{{ session('success') }}</div> @endif
@if(session('error')) <div class="mb-4 p-4 bg-red-50 border border-red-200 text-red-800 rounded-md">{{ session('error') }}</div> @endif
<div class="bg-white shadow rounded-lg overflow-hidden">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Nom</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Champs</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Sources liées</th>
<th class="px-6 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
@forelse($sourceTypes as $st)
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 font-medium">
<a href="{{ route('admin.source-types.show', $st) }}" class="text-indigo-600 hover:underline">{{ $st->nom }}</a>
</td>
<td class="px-6 py-4 text-sm text-gray-500">{{ $st->fields_count ?? '—' }}</td>
<td class="px-6 py-4 text-sm text-gray-500">{{ $st->sources_count }}</td>
<td class="px-6 py-4 text-right text-sm space-x-3">
<a href="{{ route('admin.source-types.edit', $st) }}" class="text-gray-600 hover:text-indigo-600">Modifier</a>
<form method="POST" action="{{ route('admin.source-types.destroy', $st) }}" class="inline"
x-data @submit.prevent="if(confirm('Supprimer ce type ?')) $el.submit()">
@csrf @method('DELETE')
<button type="submit" class="text-red-500 hover:text-red-700">Supprimer</button>
</form>
</td>
</tr>
@empty
<tr><td colspan="4" class="px-6 py-10 text-center text-gray-400">Aucun type de source.</td></tr>
@endforelse
</tbody>
</table>
@if($sourceTypes->hasPages()) <div class="px-6 py-4 border-t">{{ $sourceTypes->links() }}</div> @endif
</div>
</div>
</x-app-layout>
@@ -0,0 +1,147 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<h2 class="text-xl font-semibold text-gray-800">{{ $sourceType->nom }}</h2>
<a href="{{ route('admin.source-types.edit', $sourceType) }}" class="px-4 py-2 bg-indigo-600 text-white text-sm rounded-md hover:bg-indigo-700">Modifier</a>
</div>
</x-slot>
<div class="py-8 max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 space-y-6">
@foreach(['success','error'] as $flash)
@if(session($flash))
<div class="p-4 rounded-md {{ $flash === 'success' ? 'bg-green-50 border border-green-200 text-green-800' : 'bg-red-50 border border-red-200 text-red-800' }}">
{{ session($flash) }}
</div>
@endif
@endforeach
@if($sourceType->description)
<div class="bg-white shadow rounded-lg px-6 py-4 text-sm text-gray-700">{{ $sourceType->description }}</div>
@endif
{{-- Champs existants --}}
<div class="bg-white shadow rounded-lg overflow-hidden">
<div class="px-6 py-4 border-b border-gray-200 flex items-center justify-between">
<h3 class="font-medium text-gray-900">Champs ({{ $sourceType->fields->count() }})</h3>
<span class="text-xs text-gray-400">Glisser-déposer pour réordonner</span>
</div>
@if($sourceType->fields->isNotEmpty())
<form method="POST" action="{{ route('admin.source-types.fields.reorder', $sourceType) }}" id="reorder-form">
@csrf
</form>
<ul id="fields-list" class="divide-y divide-gray-100">
@foreach($sourceType->fields as $field)
<li class="px-6 py-3 flex items-center gap-4" data-id="{{ $field->id }}">
<span class="cursor-move text-gray-300 hover:text-gray-500 select-none"></span>
<div class="flex-1 grid grid-cols-4 gap-3 text-sm">
<span class="font-mono text-indigo-700">{{ $field->name }}</span>
<span class="text-gray-700">{{ $field->label }}</span>
<span class="text-gray-500">{{ $field->type->value }}</span>
<span class="text-gray-400">{{ $field->required ? 'Obligatoire' : 'Optionnel' }}</span>
</div>
<div class="flex gap-2">
<button type="button"
x-data="{ open: false }"
@click="open = !open"
class="text-xs text-gray-500 hover:text-indigo-600">Modifier</button>
<form method="POST" action="{{ route('admin.source-types.fields.destroy', [$sourceType, $field]) }}"
x-data @submit.prevent="if(confirm('Supprimer ce champ ?')) $el.submit()">
@csrf @method('DELETE')
<button type="submit" class="text-xs text-red-500 hover:text-red-700">Supprimer</button>
</form>
</div>
</li>
@endforeach
</ul>
@else
<p class="px-6 py-8 text-center text-gray-400 text-sm">Aucun champ défini. Ajoutez-en ci-dessous.</p>
@endif
</div>
{{-- Ajouter un champ --}}
<div class="bg-white shadow rounded-lg p-6">
<h3 class="font-medium text-gray-900 mb-4">Ajouter un champ</h3>
<form method="POST" action="{{ route('admin.source-types.fields.store', $sourceType) }}">
@csrf
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">Nom technique <span class="text-red-500">*</span></label>
<input type="text" name="name" value="{{ old('name') }}" required
placeholder="ex: nom_pere"
class="block w-full rounded-md border-gray-300 shadow-sm text-sm focus:border-indigo-500 focus:ring-indigo-500 @error('name') border-red-500 @enderror">
@error('name') <p class="mt-1 text-xs text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">Libellé affiché <span class="text-red-500">*</span></label>
<input type="text" name="label" value="{{ old('label') }}" required
placeholder="ex: Nom du père"
class="block w-full rounded-md border-gray-300 shadow-sm text-sm focus:border-indigo-500 focus:ring-indigo-500 @error('label') border-red-500 @enderror">
@error('label') <p class="mt-1 text-xs text-red-600">{{ $message }}</p> @enderror
</div>
<div x-data="{ type: '{{ old('type', 'text') }}' }">
<label class="block text-xs font-medium text-gray-600 mb-1">Type <span class="text-red-500">*</span></label>
<select name="type" x-model="type"
class="block w-full rounded-md border-gray-300 shadow-sm text-sm focus:border-indigo-500 focus:ring-indigo-500">
@foreach(\App\Enums\FieldType::cases() as $ft)
<option value="{{ $ft->value }}" {{ old('type') === $ft->value ? 'selected' : '' }}>{{ $ft->value }}</option>
@endforeach
</select>
{{-- Options pour type=select --}}
<div x-show="type === 'select'" x-cloak class="mt-3">
<label class="block text-xs font-medium text-gray-600 mb-1">Options (une par ligne)</label>
<textarea name="options_raw" rows="3" placeholder="Option A&#10;Option B&#10;Option C"
class="block w-full rounded-md border-gray-300 shadow-sm text-sm focus:border-indigo-500 focus:ring-indigo-500">{{ old('options_raw') }}</textarea>
</div>
</div>
<div class="flex items-end">
<label class="flex items-center gap-2 text-sm text-gray-700">
<input type="checkbox" name="required" value="1" {{ old('required') ? 'checked' : '' }}
class="rounded border-gray-300 text-indigo-600 focus:ring-indigo-500">
Champ obligatoire
</label>
</div>
</div>
<div class="mt-4">
<button type="submit" class="px-4 py-2 bg-indigo-600 text-white text-sm rounded-md hover:bg-indigo-700">
Ajouter le champ
</button>
</div>
</form>
</div>
<a href="{{ route('admin.source-types.index') }}" class="text-sm text-indigo-600 hover:underline"> Retour</a>
</div>
{{-- Drag & drop reorder --}}
@if($sourceType->fields->isNotEmpty())
<script>
document.addEventListener('DOMContentLoaded', () => {
const list = document.getElementById('fields-list');
const form = document.getElementById('reorder-form');
if (!list || !form) return;
let dragged = null;
list.querySelectorAll('li').forEach(li => {
li.setAttribute('draggable', true);
li.addEventListener('dragstart', () => { dragged = li; li.classList.add('opacity-50'); });
li.addEventListener('dragend', () => {
li.classList.remove('opacity-50');
// Soumettre le nouvel ordre
const ids = [...list.querySelectorAll('li')].map(el => el.dataset.id);
ids.forEach(id => {
const input = document.createElement('input');
input.type = 'hidden'; input.name = 'ids[]'; input.value = id;
form.appendChild(input);
});
form.submit();
});
li.addEventListener('dragover', e => { e.preventDefault(); const rect = li.getBoundingClientRect(); const mid = rect.top + rect.height / 2; list.insertBefore(dragged, e.clientY < mid ? li : li.nextSibling); });
});
});
</script>
@endif
</x-app-layout>
@@ -0,0 +1,27 @@
<x-guest-layout>
<div class="mb-4 text-sm text-gray-600">
{{ __('This is a secure area of the application. Please confirm your password before continuing.') }}
</div>
<form method="POST" action="{{ route('password.confirm') }}">
@csrf
<!-- Password -->
<div>
<x-input-label for="password" :value="__('Password')" />
<x-text-input id="password" class="block mt-1 w-full"
type="password"
name="password"
required autocomplete="current-password" />
<x-input-error :messages="$errors->get('password')" class="mt-2" />
</div>
<div class="flex justify-end mt-4">
<x-primary-button>
{{ __('Confirm') }}
</x-primary-button>
</div>
</form>
</x-guest-layout>
@@ -0,0 +1,25 @@
<x-guest-layout>
<div class="mb-4 text-sm text-gray-600">
{{ __('Forgot your password? No problem. Just let us know your email address and we will email you a password reset link that will allow you to choose a new one.') }}
</div>
<!-- Session Status -->
<x-auth-session-status class="mb-4" :status="session('status')" />
<form method="POST" action="{{ route('password.email') }}">
@csrf
<!-- Email Address -->
<div>
<x-input-label for="email" :value="__('Email')" />
<x-text-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required autofocus />
<x-input-error :messages="$errors->get('email')" class="mt-2" />
</div>
<div class="flex items-center justify-end mt-4">
<x-primary-button>
{{ __('Email Password Reset Link') }}
</x-primary-button>
</div>
</form>
</x-guest-layout>
+47
View File
@@ -0,0 +1,47 @@
<x-guest-layout>
<!-- Session Status -->
<x-auth-session-status class="mb-4" :status="session('status')" />
<form method="POST" action="{{ route('login') }}">
@csrf
<!-- Email Address -->
<div>
<x-input-label for="email" :value="__('Email')" />
<x-text-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required autofocus autocomplete="username" />
<x-input-error :messages="$errors->get('email')" class="mt-2" />
</div>
<!-- Password -->
<div class="mt-4">
<x-input-label for="password" :value="__('Password')" />
<x-text-input id="password" class="block mt-1 w-full"
type="password"
name="password"
required autocomplete="current-password" />
<x-input-error :messages="$errors->get('password')" class="mt-2" />
</div>
<!-- Remember Me -->
<div class="block mt-4">
<label for="remember_me" class="inline-flex items-center">
<input id="remember_me" type="checkbox" class="rounded border-gray-300 text-indigo-600 shadow-sm focus:ring-indigo-500" name="remember">
<span class="ms-2 text-sm text-gray-600">{{ __('Remember me') }}</span>
</label>
</div>
<div class="flex items-center justify-end mt-4">
@if (Route::has('password.request'))
<a class="underline text-sm text-gray-600 hover:text-gray-900 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" href="{{ route('password.request') }}">
{{ __('Forgot your password?') }}
</a>
@endif
<x-primary-button class="ms-3">
{{ __('Log in') }}
</x-primary-button>
</div>
</form>
</x-guest-layout>
+52
View File
@@ -0,0 +1,52 @@
<x-guest-layout>
<form method="POST" action="{{ route('register') }}">
@csrf
<!-- Name -->
<div>
<x-input-label for="name" :value="__('Name')" />
<x-text-input id="name" class="block mt-1 w-full" type="text" name="name" :value="old('name')" required autofocus autocomplete="name" />
<x-input-error :messages="$errors->get('name')" class="mt-2" />
</div>
<!-- Email Address -->
<div class="mt-4">
<x-input-label for="email" :value="__('Email')" />
<x-text-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required autocomplete="username" />
<x-input-error :messages="$errors->get('email')" class="mt-2" />
</div>
<!-- Password -->
<div class="mt-4">
<x-input-label for="password" :value="__('Password')" />
<x-text-input id="password" class="block mt-1 w-full"
type="password"
name="password"
required autocomplete="new-password" />
<x-input-error :messages="$errors->get('password')" class="mt-2" />
</div>
<!-- Confirm Password -->
<div class="mt-4">
<x-input-label for="password_confirmation" :value="__('Confirm Password')" />
<x-text-input id="password_confirmation" class="block mt-1 w-full"
type="password"
name="password_confirmation" required autocomplete="new-password" />
<x-input-error :messages="$errors->get('password_confirmation')" class="mt-2" />
</div>
<div class="flex items-center justify-end mt-4">
<a class="underline text-sm text-gray-600 hover:text-gray-900 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" href="{{ route('login') }}">
{{ __('Already registered?') }}
</a>
<x-primary-button class="ms-4">
{{ __('Register') }}
</x-primary-button>
</div>
</form>
</x-guest-layout>
@@ -0,0 +1,39 @@
<x-guest-layout>
<form method="POST" action="{{ route('password.store') }}">
@csrf
<!-- Password Reset Token -->
<input type="hidden" name="token" value="{{ $request->route('token') }}">
<!-- Email Address -->
<div>
<x-input-label for="email" :value="__('Email')" />
<x-text-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email', $request->email)" required autofocus autocomplete="username" />
<x-input-error :messages="$errors->get('email')" class="mt-2" />
</div>
<!-- Password -->
<div class="mt-4">
<x-input-label for="password" :value="__('Password')" />
<x-text-input id="password" class="block mt-1 w-full" type="password" name="password" required autocomplete="new-password" />
<x-input-error :messages="$errors->get('password')" class="mt-2" />
</div>
<!-- Confirm Password -->
<div class="mt-4">
<x-input-label for="password_confirmation" :value="__('Confirm Password')" />
<x-text-input id="password_confirmation" class="block mt-1 w-full"
type="password"
name="password_confirmation" required autocomplete="new-password" />
<x-input-error :messages="$errors->get('password_confirmation')" class="mt-2" />
</div>
<div class="flex items-center justify-end mt-4">
<x-primary-button>
{{ __('Reset Password') }}
</x-primary-button>
</div>
</form>
</x-guest-layout>
@@ -0,0 +1,31 @@
<x-guest-layout>
<div class="mb-4 text-sm text-gray-600">
{{ __('Thanks for signing up! Before getting started, could you verify your email address by clicking on the link we just emailed to you? If you didn\'t receive the email, we will gladly send you another.') }}
</div>
@if (session('status') == 'verification-link-sent')
<div class="mb-4 font-medium text-sm text-green-600">
{{ __('A new verification link has been sent to the email address you provided during registration.') }}
</div>
@endif
<div class="mt-4 flex items-center justify-between">
<form method="POST" action="{{ route('verification.send') }}">
@csrf
<div>
<x-primary-button>
{{ __('Resend Verification Email') }}
</x-primary-button>
</div>
</form>
<form method="POST" action="{{ route('logout') }}">
@csrf
<button type="submit" class="underline text-sm text-gray-600 hover:text-gray-900 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
{{ __('Log Out') }}
</button>
</form>
</div>
</x-guest-layout>
@@ -0,0 +1,3 @@
<svg viewBox="0 0 316 316" xmlns="http://www.w3.org/2000/svg" {{ $attributes }}>
<path d="M305.8 81.125C305.77 80.995 305.69 80.885 305.65 80.755C305.56 80.525 305.49 80.285 305.37 80.075C305.29 79.935 305.17 79.815 305.07 79.685C304.94 79.515 304.83 79.325 304.68 79.175C304.55 79.045 304.39 78.955 304.25 78.845C304.09 78.715 303.95 78.575 303.77 78.475L251.32 48.275C249.97 47.495 248.31 47.495 246.96 48.275L194.51 78.475C194.33 78.575 194.19 78.725 194.03 78.845C193.89 78.955 193.73 79.045 193.6 79.175C193.45 79.325 193.34 79.515 193.21 79.685C193.11 79.815 192.99 79.935 192.91 80.075C192.79 80.285 192.71 80.525 192.63 80.755C192.58 80.875 192.51 80.995 192.48 81.125C192.38 81.495 192.33 81.875 192.33 82.265V139.625L148.62 164.795V52.575C148.62 52.185 148.57 51.805 148.47 51.435C148.44 51.305 148.36 51.195 148.32 51.065C148.23 50.835 148.16 50.595 148.04 50.385C147.96 50.245 147.84 50.125 147.74 49.995C147.61 49.825 147.5 49.635 147.35 49.485C147.22 49.355 147.06 49.265 146.92 49.155C146.76 49.025 146.62 48.885 146.44 48.785L93.99 18.585C92.64 17.805 90.98 17.805 89.63 18.585L37.18 48.785C37 48.885 36.86 49.035 36.7 49.155C36.56 49.265 36.4 49.355 36.27 49.485C36.12 49.635 36.01 49.825 35.88 49.995C35.78 50.125 35.66 50.245 35.58 50.385C35.46 50.595 35.38 50.835 35.3 51.065C35.25 51.185 35.18 51.305 35.15 51.435C35.05 51.805 35 52.185 35 52.575V232.235C35 233.795 35.84 235.245 37.19 236.025L142.1 296.425C142.33 296.555 142.58 296.635 142.82 296.725C142.93 296.765 143.04 296.835 143.16 296.865C143.53 296.965 143.9 297.015 144.28 297.015C144.66 297.015 145.03 296.965 145.4 296.865C145.5 296.835 145.59 296.775 145.69 296.745C145.95 296.655 146.21 296.565 146.45 296.435L251.36 236.035C252.72 235.255 253.55 233.815 253.55 232.245V174.885L303.81 145.945C305.17 145.165 306 143.725 306 142.155V82.265C305.95 81.875 305.89 81.495 305.8 81.125ZM144.2 227.205L100.57 202.515L146.39 176.135L196.66 147.195L240.33 172.335L208.29 190.625L144.2 227.205ZM244.75 114.995V164.795L226.39 154.225L201.03 139.625V89.825L219.39 100.395L244.75 114.995ZM249.12 57.105L292.81 82.265L249.12 107.425L205.43 82.265L249.12 57.105ZM114.49 184.425L96.13 194.995V85.305L121.49 70.705L139.85 60.135V169.815L114.49 184.425ZM91.76 27.425L135.45 52.585L91.76 77.745L48.07 52.585L91.76 27.425ZM43.67 60.135L62.03 70.705L87.39 85.305V202.545V202.555V202.565C87.39 202.735 87.44 202.895 87.46 203.055C87.49 203.265 87.49 203.485 87.55 203.695V203.705C87.6 203.875 87.69 204.035 87.76 204.195C87.84 204.375 87.89 204.575 87.99 204.745C87.99 204.745 87.99 204.755 88 204.755C88.09 204.905 88.22 205.035 88.33 205.175C88.45 205.335 88.55 205.495 88.69 205.635L88.7 205.645C88.82 205.765 88.98 205.855 89.12 205.965C89.28 206.085 89.42 206.225 89.59 206.325C89.6 206.325 89.6 206.325 89.61 206.335C89.62 206.335 89.62 206.345 89.63 206.345L139.87 234.775V285.065L43.67 229.705V60.135ZM244.75 229.705L148.58 285.075V234.775L219.8 194.115L244.75 179.875V229.705ZM297.2 139.625L253.49 164.795V114.995L278.85 100.395L297.21 89.825V139.625H297.2Z"/>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

@@ -0,0 +1,7 @@
@props(['status'])
@if ($status)
<div {{ $attributes->merge(['class' => 'font-medium text-sm text-green-600']) }}>
{{ $status }}
</div>
@endif
@@ -0,0 +1,3 @@
<button {{ $attributes->merge(['type' => 'submit', 'class' => 'inline-flex items-center px-4 py-2 bg-red-600 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-red-500 active:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 transition ease-in-out duration-150']) }}>
{{ $slot }}
</button>
@@ -0,0 +1 @@
<a {{ $attributes->merge(['class' => 'block w-full px-4 py-2 text-start text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out']) }}>{{ $slot }}</a>
@@ -0,0 +1,35 @@
@props(['align' => 'right', 'width' => '48', 'contentClasses' => 'py-1 bg-white'])
@php
$alignmentClasses = match ($align) {
'left' => 'ltr:origin-top-left rtl:origin-top-right start-0',
'top' => 'origin-top',
default => 'ltr:origin-top-right rtl:origin-top-left end-0',
};
$width = match ($width) {
'48' => 'w-48',
default => $width,
};
@endphp
<div class="relative" x-data="{ open: false }" @click.outside="open = false" @close.stop="open = false">
<div @click="open = ! open">
{{ $trigger }}
</div>
<div x-show="open"
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0 scale-95"
x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="transition ease-in duration-75"
x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-95"
class="absolute z-50 mt-2 {{ $width }} rounded-md shadow-lg {{ $alignmentClasses }}"
style="display: none;"
@click="open = false">
<div class="rounded-md ring-1 ring-black ring-opacity-5 {{ $contentClasses }}">
{{ $content }}
</div>
</div>
</div>
@@ -0,0 +1,9 @@
@props(['messages'])
@if ($messages)
<ul {{ $attributes->merge(['class' => 'text-sm text-red-600 space-y-1']) }}>
@foreach ((array) $messages as $message)
<li>{{ $message }}</li>
@endforeach
</ul>
@endif
@@ -0,0 +1,5 @@
@props(['value'])
<label {{ $attributes->merge(['class' => 'block font-medium text-sm text-gray-700']) }}>
{{ $value ?? $slot }}
</label>
@@ -0,0 +1,78 @@
@props([
'name',
'show' => false,
'maxWidth' => '2xl'
])
@php
$maxWidth = [
'sm' => 'sm:max-w-sm',
'md' => 'sm:max-w-md',
'lg' => 'sm:max-w-lg',
'xl' => 'sm:max-w-xl',
'2xl' => 'sm:max-w-2xl',
][$maxWidth];
@endphp
<div
x-data="{
show: @js($show),
focusables() {
// All focusable element types...
let selector = 'a, button, input:not([type=\'hidden\']), textarea, select, details, [tabindex]:not([tabindex=\'-1\'])'
return [...$el.querySelectorAll(selector)]
// All non-disabled elements...
.filter(el => ! el.hasAttribute('disabled'))
},
firstFocusable() { return this.focusables()[0] },
lastFocusable() { return this.focusables().slice(-1)[0] },
nextFocusable() { return this.focusables()[this.nextFocusableIndex()] || this.firstFocusable() },
prevFocusable() { return this.focusables()[this.prevFocusableIndex()] || this.lastFocusable() },
nextFocusableIndex() { return (this.focusables().indexOf(document.activeElement) + 1) % (this.focusables().length + 1) },
prevFocusableIndex() { return Math.max(0, this.focusables().indexOf(document.activeElement)) -1 },
}"
x-init="$watch('show', value => {
if (value) {
document.body.classList.add('overflow-y-hidden');
{{ $attributes->has('focusable') ? 'setTimeout(() => firstFocusable().focus(), 100)' : '' }}
} else {
document.body.classList.remove('overflow-y-hidden');
}
})"
x-on:open-modal.window="$event.detail == '{{ $name }}' ? show = true : null"
x-on:close-modal.window="$event.detail == '{{ $name }}' ? show = false : null"
x-on:close.stop="show = false"
x-on:keydown.escape.window="show = false"
x-on:keydown.tab.prevent="$event.shiftKey || nextFocusable().focus()"
x-on:keydown.shift.tab.prevent="prevFocusable().focus()"
x-show="show"
class="fixed inset-0 overflow-y-auto px-4 py-6 sm:px-0 z-50"
style="display: {{ $show ? 'block' : 'none' }};"
>
<div
x-show="show"
class="fixed inset-0 transform transition-all"
x-on:click="show = false"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
>
<div class="absolute inset-0 bg-gray-500 opacity-75"></div>
</div>
<div
x-show="show"
class="mb-6 bg-white rounded-lg overflow-hidden shadow-xl transform transition-all sm:w-full {{ $maxWidth }} sm:mx-auto"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
x-transition:leave-end="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
{{ $slot }}
</div>
</div>
@@ -0,0 +1,11 @@
@props(['active'])
@php
$classes = ($active ?? false)
? 'inline-flex items-center px-1 pt-1 border-b-2 border-indigo-400 text-sm font-medium leading-5 text-gray-900 focus:outline-none focus:border-indigo-700 transition duration-150 ease-in-out'
: 'inline-flex items-center px-1 pt-1 border-b-2 border-transparent text-sm font-medium leading-5 text-gray-500 hover:text-gray-700 hover:border-gray-300 focus:outline-none focus:text-gray-700 focus:border-gray-300 transition duration-150 ease-in-out';
@endphp
<a {{ $attributes->merge(['class' => $classes]) }}>
{{ $slot }}
</a>
@@ -0,0 +1,3 @@
<button {{ $attributes->merge(['type' => 'submit', 'class' => 'inline-flex items-center px-4 py-2 bg-gray-800 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-gray-700 focus:bg-gray-700 active:bg-gray-900 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition ease-in-out duration-150']) }}>
{{ $slot }}
</button>
@@ -0,0 +1,11 @@
@props(['active'])
@php
$classes = ($active ?? false)
? 'block w-full ps-3 pe-4 py-2 border-l-4 border-indigo-400 text-start text-base font-medium text-indigo-700 bg-indigo-50 focus:outline-none focus:text-indigo-800 focus:bg-indigo-100 focus:border-indigo-700 transition duration-150 ease-in-out'
: 'block w-full ps-3 pe-4 py-2 border-l-4 border-transparent text-start text-base font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 hover:border-gray-300 focus:outline-none focus:text-gray-800 focus:bg-gray-50 focus:border-gray-300 transition duration-150 ease-in-out';
@endphp
<a {{ $attributes->merge(['class' => $classes]) }}>
{{ $slot }}
</a>
@@ -0,0 +1,3 @@
<button {{ $attributes->merge(['type' => 'button', 'class' => 'inline-flex items-center px-4 py-2 bg-white border border-gray-300 rounded-md font-semibold text-xs text-gray-700 uppercase tracking-widest shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:opacity-25 transition ease-in-out duration-150']) }}>
{{ $slot }}
</button>
@@ -0,0 +1,3 @@
@props(['disabled' => false])
<input @disabled($disabled) {{ $attributes->merge(['class' => 'border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm']) }}>
+17
View File
@@ -0,0 +1,17 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Dashboard') }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 text-gray-900">
{{ __("You're logged in!") }}
</div>
</div>
</div>
</div>
</x-app-layout>
+36
View File
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
<!-- Scripts -->
@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<body class="font-sans antialiased">
<div class="min-h-screen bg-gray-100">
@include('layouts.navigation')
<!-- Page Heading -->
@isset($header)
<header class="bg-white shadow">
<div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
{{ $header }}
</div>
</header>
@endisset
<!-- Page Content -->
<main>
{{ $slot }}
</main>
</div>
</body>
</html>
+30
View File
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
<!-- Scripts -->
@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<body class="font-sans text-gray-900 antialiased">
<div class="min-h-screen flex flex-col sm:justify-center items-center pt-6 sm:pt-0 bg-gray-100">
<div>
<a href="/">
<x-application-logo class="w-20 h-20 fill-current text-gray-500" />
</a>
</div>
<div class="w-full sm:max-w-md mt-6 px-6 py-4 bg-white shadow-md overflow-hidden sm:rounded-lg">
{{ $slot }}
</div>
</div>
</body>
</html>
@@ -0,0 +1,100 @@
<nav x-data="{ open: false }" class="bg-white border-b border-gray-100">
<!-- Primary Navigation Menu -->
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex">
<!-- Logo -->
<div class="shrink-0 flex items-center">
<a href="{{ route('dashboard') }}">
<x-application-logo class="block h-9 w-auto fill-current text-gray-800" />
</a>
</div>
<!-- Navigation Links -->
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
<x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
{{ __('Dashboard') }}
</x-nav-link>
</div>
</div>
<!-- Settings Dropdown -->
<div class="hidden sm:flex sm:items-center sm:ms-6">
<x-dropdown align="right" width="48">
<x-slot name="trigger">
<button class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 bg-white hover:text-gray-700 focus:outline-none transition ease-in-out duration-150">
<div>{{ Auth::user()->name }}</div>
<div class="ms-1">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
</svg>
</div>
</button>
</x-slot>
<x-slot name="content">
<x-dropdown-link :href="route('profile.edit')">
{{ __('Profile') }}
</x-dropdown-link>
<!-- Authentication -->
<form method="POST" action="{{ route('logout') }}">
@csrf
<x-dropdown-link :href="route('logout')"
onclick="event.preventDefault();
this.closest('form').submit();">
{{ __('Log Out') }}
</x-dropdown-link>
</form>
</x-slot>
</x-dropdown>
</div>
<!-- Hamburger -->
<div class="-me-2 flex items-center sm:hidden">
<button @click="open = ! open" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out">
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path :class="{'hidden': open, 'inline-flex': ! open }" class="inline-flex" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
<path :class="{'hidden': ! open, 'inline-flex': open }" class="hidden" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
</div>
<!-- Responsive Navigation Menu -->
<div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden">
<div class="pt-2 pb-3 space-y-1">
<x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
{{ __('Dashboard') }}
</x-responsive-nav-link>
</div>
<!-- Responsive Settings Options -->
<div class="pt-4 pb-1 border-t border-gray-200">
<div class="px-4">
<div class="font-medium text-base text-gray-800">{{ Auth::user()->name }}</div>
<div class="font-medium text-sm text-gray-500">{{ Auth::user()->email }}</div>
</div>
<div class="mt-3 space-y-1">
<x-responsive-nav-link :href="route('profile.edit')">
{{ __('Profile') }}
</x-responsive-nav-link>
<!-- Authentication -->
<form method="POST" action="{{ route('logout') }}">
@csrf
<x-responsive-nav-link :href="route('logout')"
onclick="event.preventDefault();
this.closest('form').submit();">
{{ __('Log Out') }}
</x-responsive-nav-link>
</form>
</div>
</div>
</div>
</nav>
+63
View File
@@ -0,0 +1,63 @@
<div class="space-y-5">
{{-- Nom --}}
<div>
<label for="nom" class="block text-sm font-medium text-gray-700">Nom <span class="text-red-500">*</span></label>
<input type="text" id="nom" name="nom"
value="{{ old('nom', $lieu?->nom) }}"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 @error('nom') border-red-500 @enderror"
required>
@error('nom') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
{{-- Code --}}
<div>
<label for="code" class="block text-sm font-medium text-gray-700">Code (INSEE, postal…)</label>
<input type="text" id="code" name="code"
value="{{ old('code', $lieu?->code) }}"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500"
maxlength="20">
</div>
{{-- Parent --}}
<div>
<label for="lieu_parent_id" class="block text-sm font-medium text-gray-700">Lieu parent</label>
<select id="lieu_parent_id" name="lieu_parent_id"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
<option value=""> Aucun (lieu racine) </option>
@foreach($parents as $parent)
<option value="{{ $parent->id }}"
{{ old('lieu_parent_id', $lieu?->lieu_parent_id) == $parent->id ? 'selected' : '' }}>
{{ $parent->nom_long ?? $parent->nom }}
</option>
@endforeach
</select>
@error('lieu_parent_id') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
{{-- Coordonnées --}}
<div class="grid grid-cols-2 gap-4">
<div>
<label for="latitude" class="block text-sm font-medium text-gray-700">Latitude</label>
<input type="number" id="latitude" name="latitude" step="0.0000001"
value="{{ old('latitude', $lieu?->latitude) }}"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500"
placeholder="48.8566">
@error('latitude') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label for="longitude" class="block text-sm font-medium text-gray-700">Longitude</label>
<input type="number" id="longitude" name="longitude" step="0.0000001"
value="{{ old('longitude', $lieu?->longitude) }}"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500"
placeholder="2.3522">
@error('longitude') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
</div>
{{-- Note --}}
<div>
<label for="note" class="block text-sm font-medium text-gray-700">Note</label>
<textarea id="note" name="note" rows="3"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">{{ old('note', $lieu?->note) }}</textarea>
</div>
</div>
+22
View File
@@ -0,0 +1,22 @@
<x-app-layout>
<x-slot name="header">
<h2 class="text-xl font-semibold text-gray-800">Nouveau lieu</h2>
</x-slot>
<div class="py-8 max-w-2xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="bg-white shadow rounded-lg p-6">
<form method="POST" action="{{ route('lieux.store') }}">
@csrf
@include('lieux._form', ['lieu' => null, 'parents' => $parents])
<div class="mt-6 flex items-center gap-4">
<button type="submit"
class="px-5 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700">
Créer
</button>
<a href="{{ route('lieux.index') }}" class="text-sm text-gray-500 hover:text-gray-700">Annuler</a>
</div>
</form>
</div>
</div>
</x-app-layout>
+22
View File
@@ -0,0 +1,22 @@
<x-app-layout>
<x-slot name="header">
<h2 class="text-xl font-semibold text-gray-800">Modifier : {{ $lieu->nom }}</h2>
</x-slot>
<div class="py-8 max-w-2xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="bg-white shadow rounded-lg p-6">
<form method="POST" action="{{ route('lieux.update', $lieu) }}">
@csrf @method('PUT')
@include('lieux._form', ['lieu' => $lieu, 'parents' => $parents])
<div class="mt-6 flex items-center gap-4">
<button type="submit"
class="px-5 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700">
Enregistrer
</button>
<a href="{{ route('lieux.show', $lieu) }}" class="text-sm text-gray-500 hover:text-gray-700">Annuler</a>
</div>
</form>
</div>
</div>
</x-app-layout>
+92
View File
@@ -0,0 +1,92 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<h2 class="text-xl font-semibold text-gray-800">Lieux</h2>
@can('create', App\Models\Lieu::class)
<a href="{{ route('lieux.create') }}"
class="px-4 py-2 bg-indigo-600 text-white text-sm rounded-md hover:bg-indigo-700">
+ Nouveau lieu
</a>
@endcan
</div>
</x-slot>
<div class="py-8 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
@if(session('success'))
<div class="mb-4 p-4 bg-green-50 border border-green-200 text-green-800 rounded-md">
{{ session('success') }}
</div>
@endif
@if(session('error'))
<div class="mb-4 p-4 bg-red-50 border border-red-200 text-red-800 rounded-md">
{{ session('error') }}
</div>
@endif
<div class="bg-white shadow rounded-lg overflow-hidden">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Lieu</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Code</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Parent</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Coordonnées</th>
<th class="px-6 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
@forelse($lieux as $lieu)
<tr class="hover:bg-gray-50">
<td class="px-6 py-4">
<a href="{{ route('lieux.show', $lieu) }}" class="font-medium text-indigo-600 hover:underline">
{{ $lieu->nom }}
</a>
</td>
<td class="px-6 py-4 text-sm text-gray-500">{{ $lieu->code ?? '—' }}</td>
<td class="px-6 py-4 text-sm text-gray-500">
@if($lieu->parent)
<a href="{{ route('lieux.show', $lieu->parent) }}" class="text-indigo-600 hover:underline">
{{ $lieu->parent->nom }}
</a>
@else
@endif
</td>
<td class="px-6 py-4 text-sm text-gray-500">
@if($lieu->latitude && $lieu->longitude)
{{ number_format($lieu->latitude, 4) }}, {{ number_format($lieu->longitude, 4) }}
@else
@endif
</td>
<td class="px-6 py-4 text-right text-sm space-x-3">
@can('update', $lieu)
<a href="{{ route('lieux.edit', $lieu) }}" class="text-gray-600 hover:text-indigo-600">Modifier</a>
@endcan
@can('delete', $lieu)
<form method="POST" action="{{ route('lieux.destroy', $lieu) }}" class="inline"
x-data
@submit.prevent="if(confirm('Supprimer ce lieu ?')) $el.submit()">
@csrf @method('DELETE')
<button type="submit" class="text-red-500 hover:text-red-700">Supprimer</button>
</form>
@endcan
</td>
</tr>
@empty
<tr>
<td colspan="5" class="px-6 py-10 text-center text-gray-400">Aucun lieu enregistré.</td>
</tr>
@endforelse
</tbody>
</table>
@if($lieux->hasPages())
<div class="px-6 py-4 border-t border-gray-200">
{{ $lieux->links() }}
</div>
@endif
</div>
</div>
</x-app-layout>
+97
View File
@@ -0,0 +1,97 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<h2 class="text-xl font-semibold text-gray-800">{{ $lieu->nom }}</h2>
<div class="flex gap-3">
@can('update', $lieu)
<a href="{{ route('lieux.edit', $lieu) }}"
class="px-4 py-2 bg-indigo-600 text-white text-sm rounded-md hover:bg-indigo-700">
Modifier
</a>
@endcan
@can('delete', $lieu)
<form method="POST" action="{{ route('lieux.destroy', $lieu) }}"
x-data @submit.prevent="if(confirm('Supprimer ce lieu ?')) $el.submit()">
@csrf @method('DELETE')
<button type="submit"
class="px-4 py-2 bg-red-600 text-white text-sm rounded-md hover:bg-red-700">
Supprimer
</button>
</form>
@endcan
</div>
</div>
</x-slot>
<div class="py-8 max-w-4xl 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 rounded-md">
{{ session('success') }}
</div>
@endif
{{-- Fiche --}}
<div class="bg-white shadow rounded-lg divide-y divide-gray-100">
<div class="px-6 py-4 grid grid-cols-3 gap-4 text-sm">
<dt class="font-medium text-gray-500">Nom complet</dt>
<dd class="col-span-2 text-gray-900">{{ $lieu->nom_long ?? $lieu->nom }}</dd>
</div>
@if($lieu->code)
<div class="px-6 py-4 grid grid-cols-3 gap-4 text-sm">
<dt class="font-medium text-gray-500">Code</dt>
<dd class="col-span-2 text-gray-900">{{ $lieu->code }}</dd>
</div>
@endif
<div class="px-6 py-4 grid grid-cols-3 gap-4 text-sm">
<dt class="font-medium text-gray-500">Lieu parent</dt>
<dd class="col-span-2">
@if($lieu->parent)
<a href="{{ route('lieux.show', $lieu->parent) }}" class="text-indigo-600 hover:underline">
{{ $lieu->parent->nom_long ?? $lieu->parent->nom }}
</a>
@else
<span class="text-gray-400">Lieu racine</span>
@endif
</dd>
</div>
@if($lieu->latitude && $lieu->longitude)
<div class="px-6 py-4 grid grid-cols-3 gap-4 text-sm">
<dt class="font-medium text-gray-500">Coordonnées</dt>
<dd class="col-span-2 text-gray-900">{{ $lieu->latitude }}, {{ $lieu->longitude }}</dd>
</div>
@endif
@if($lieu->note)
<div class="px-6 py-4 grid grid-cols-3 gap-4 text-sm">
<dt class="font-medium text-gray-500">Note</dt>
<dd class="col-span-2 text-gray-900 whitespace-pre-line">{{ $lieu->note }}</dd>
</div>
@endif
</div>
{{-- Enfants --}}
@if($lieu->enfants->isNotEmpty())
<div class="bg-white shadow rounded-lg overflow-hidden">
<div class="px-6 py-4 border-b border-gray-200">
<h3 class="font-medium text-gray-900">Subdivisions ({{ $lieu->enfants->count() }})</h3>
</div>
<ul class="divide-y divide-gray-100">
@foreach($lieu->enfants->sortBy('nom') as $enfant)
<li class="px-6 py-3">
<a href="{{ route('lieux.show', $enfant) }}" class="text-indigo-600 hover:underline">
{{ $enfant->nom }}
</a>
@if($enfant->code)
<span class="ml-2 text-xs text-gray-400">({{ $enfant->code }})</span>
@endif
</li>
@endforeach
</ul>
</div>
@endif
<div>
<a href="{{ route('lieux.index') }}" class="text-sm text-indigo-600 hover:underline"> Retour à la liste</a>
</div>
</div>
</x-app-layout>
+29
View File
@@ -0,0 +1,29 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Profile') }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
<div class="p-4 sm:p-8 bg-white shadow sm:rounded-lg">
<div class="max-w-xl">
@include('profile.partials.update-profile-information-form')
</div>
</div>
<div class="p-4 sm:p-8 bg-white shadow sm:rounded-lg">
<div class="max-w-xl">
@include('profile.partials.update-password-form')
</div>
</div>
<div class="p-4 sm:p-8 bg-white shadow sm:rounded-lg">
<div class="max-w-xl">
@include('profile.partials.delete-user-form')
</div>
</div>
</div>
</div>
</x-app-layout>
@@ -0,0 +1,55 @@
<section class="space-y-6">
<header>
<h2 class="text-lg font-medium text-gray-900">
{{ __('Delete Account') }}
</h2>
<p class="mt-1 text-sm text-gray-600">
{{ __('Once your account is deleted, all of its resources and data will be permanently deleted. Before deleting your account, please download any data or information that you wish to retain.') }}
</p>
</header>
<x-danger-button
x-data=""
x-on:click.prevent="$dispatch('open-modal', 'confirm-user-deletion')"
>{{ __('Delete Account') }}</x-danger-button>
<x-modal name="confirm-user-deletion" :show="$errors->userDeletion->isNotEmpty()" focusable>
<form method="post" action="{{ route('profile.destroy') }}" class="p-6">
@csrf
@method('delete')
<h2 class="text-lg font-medium text-gray-900">
{{ __('Are you sure you want to delete your account?') }}
</h2>
<p class="mt-1 text-sm text-gray-600">
{{ __('Once your account is deleted, all of its resources and data will be permanently deleted. Please enter your password to confirm you would like to permanently delete your account.') }}
</p>
<div class="mt-6">
<x-input-label for="password" value="{{ __('Password') }}" class="sr-only" />
<x-text-input
id="password"
name="password"
type="password"
class="mt-1 block w-3/4"
placeholder="{{ __('Password') }}"
/>
<x-input-error :messages="$errors->userDeletion->get('password')" class="mt-2" />
</div>
<div class="mt-6 flex justify-end">
<x-secondary-button x-on:click="$dispatch('close')">
{{ __('Cancel') }}
</x-secondary-button>
<x-danger-button class="ms-3">
{{ __('Delete Account') }}
</x-danger-button>
</div>
</form>
</x-modal>
</section>
@@ -0,0 +1,48 @@
<section>
<header>
<h2 class="text-lg font-medium text-gray-900">
{{ __('Update Password') }}
</h2>
<p class="mt-1 text-sm text-gray-600">
{{ __('Ensure your account is using a long, random password to stay secure.') }}
</p>
</header>
<form method="post" action="{{ route('password.update') }}" class="mt-6 space-y-6">
@csrf
@method('put')
<div>
<x-input-label for="update_password_current_password" :value="__('Current Password')" />
<x-text-input id="update_password_current_password" name="current_password" type="password" class="mt-1 block w-full" autocomplete="current-password" />
<x-input-error :messages="$errors->updatePassword->get('current_password')" class="mt-2" />
</div>
<div>
<x-input-label for="update_password_password" :value="__('New Password')" />
<x-text-input id="update_password_password" name="password" type="password" class="mt-1 block w-full" autocomplete="new-password" />
<x-input-error :messages="$errors->updatePassword->get('password')" class="mt-2" />
</div>
<div>
<x-input-label for="update_password_password_confirmation" :value="__('Confirm Password')" />
<x-text-input id="update_password_password_confirmation" name="password_confirmation" type="password" class="mt-1 block w-full" autocomplete="new-password" />
<x-input-error :messages="$errors->updatePassword->get('password_confirmation')" class="mt-2" />
</div>
<div class="flex items-center gap-4">
<x-primary-button>{{ __('Save') }}</x-primary-button>
@if (session('status') === 'password-updated')
<p
x-data="{ show: true }"
x-show="show"
x-transition
x-init="setTimeout(() => show = false, 2000)"
class="text-sm text-gray-600"
>{{ __('Saved.') }}</p>
@endif
</div>
</form>
</section>
@@ -0,0 +1,64 @@
<section>
<header>
<h2 class="text-lg font-medium text-gray-900">
{{ __('Profile Information') }}
</h2>
<p class="mt-1 text-sm text-gray-600">
{{ __("Update your account's profile information and email address.") }}
</p>
</header>
<form id="send-verification" method="post" action="{{ route('verification.send') }}">
@csrf
</form>
<form method="post" action="{{ route('profile.update') }}" class="mt-6 space-y-6">
@csrf
@method('patch')
<div>
<x-input-label for="name" :value="__('Name')" />
<x-text-input id="name" name="name" type="text" class="mt-1 block w-full" :value="old('name', $user->name)" required autofocus autocomplete="name" />
<x-input-error class="mt-2" :messages="$errors->get('name')" />
</div>
<div>
<x-input-label for="email" :value="__('Email')" />
<x-text-input id="email" name="email" type="email" class="mt-1 block w-full" :value="old('email', $user->email)" required autocomplete="username" />
<x-input-error class="mt-2" :messages="$errors->get('email')" />
@if ($user instanceof \Illuminate\Contracts\Auth\MustVerifyEmail && ! $user->hasVerifiedEmail())
<div>
<p class="text-sm mt-2 text-gray-800">
{{ __('Your email address is unverified.') }}
<button form="send-verification" class="underline text-sm text-gray-600 hover:text-gray-900 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
{{ __('Click here to re-send the verification email.') }}
</button>
</p>
@if (session('status') === 'verification-link-sent')
<p class="mt-2 font-medium text-sm text-green-600">
{{ __('A new verification link has been sent to your email address.') }}
</p>
@endif
</div>
@endif
</div>
<div class="flex items-center gap-4">
<x-primary-button>{{ __('Save') }}</x-primary-button>
@if (session('status') === 'profile-updated')
<p
x-data="{ show: true }"
x-show="show"
x-transition
x-init="setTimeout(() => show = false, 2000)"
class="text-sm text-gray-600"
>{{ __('Saved.') }}</p>
@endif
</div>
</form>
</section>
+56
View File
@@ -0,0 +1,56 @@
<div class="space-y-5">
<div>
<label for="nom" class="block text-sm font-medium text-gray-700">Nom <span class="text-red-500">*</span></label>
<input type="text" id="nom" name="nom" value="{{ old('nom', $source?->nom) }}" required
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 @error('nom') border-red-500 @enderror">
@error('nom') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label for="description" class="block text-sm font-medium text-gray-700">Description</label>
<textarea id="description" name="description" rows="3"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">{{ old('description', $source?->description) }}</textarea>
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label for="source_type_id" class="block text-sm font-medium text-gray-700">Type de source <span class="text-red-500">*</span></label>
<select id="source_type_id" name="source_type_id" required
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 @error('source_type_id') border-red-500 @enderror">
<option value=""> Choisir </option>
@foreach($sourceTypes as $st)
<option value="{{ $st->id }}" {{ old('source_type_id', $source?->source_type_id) == $st->id ? 'selected' : '' }}>
{{ $st->nom }}
</option>
@endforeach
</select>
@error('source_type_id') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label for="depot_id" class="block text-sm font-medium text-gray-700">Dépôt d'archives</label>
<select id="depot_id" name="depot_id"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
<option value=""> Aucun </option>
@foreach($depots as $depot)
<option value="{{ $depot->id }}" {{ old('depot_id', $source?->depot_id) == $depot->id ? 'selected' : '' }}>
{{ $depot->nom }}
</option>
@endforeach
</select>
</div>
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label for="cote" class="block text-sm font-medium text-gray-700">Cote</label>
<input type="text" id="cote" name="cote" value="{{ old('cote', $source?->cote) }}"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
</div>
<div>
<label for="auteur" class="block text-sm font-medium text-gray-700">Auteur</label>
<input type="text" id="auteur" name="auteur" value="{{ old('auteur', $source?->auteur) }}"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
</div>
</div>
</div>
+15
View File
@@ -0,0 +1,15 @@
<x-app-layout>
<x-slot name="header"><h2 class="text-xl font-semibold text-gray-800">Nouvelle source</h2></x-slot>
<div class="py-8 max-w-2xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="bg-white shadow rounded-lg p-6">
<form method="POST" action="{{ route('sources.store') }}">
@csrf
@include('sources._form', ['source' => null])
<div class="mt-6 flex gap-4">
<button type="submit" class="px-5 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700">Créer</button>
<a href="{{ route('sources.index') }}" class="text-sm text-gray-500 self-center hover:text-gray-700">Annuler</a>
</div>
</form>
</div>
</div>
</x-app-layout>
+15
View File
@@ -0,0 +1,15 @@
<x-app-layout>
<x-slot name="header"><h2 class="text-xl font-semibold text-gray-800">Modifier : {{ $source->nom }}</h2></x-slot>
<div class="py-8 max-w-2xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="bg-white shadow rounded-lg p-6">
<form method="POST" action="{{ route('sources.update', $source) }}">
@csrf @method('PUT')
@include('sources._form', ['source' => $source])
<div class="mt-6 flex gap-4">
<button type="submit" class="px-5 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700">Enregistrer</button>
<a href="{{ route('sources.show', $source) }}" class="text-sm text-gray-500 self-center hover:text-gray-700">Annuler</a>
</div>
</form>
</div>
</div>
</x-app-layout>
+65
View File
@@ -0,0 +1,65 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<h2 class="text-xl font-semibold text-gray-800">Sources</h2>
@can('create', App\Models\Source::class)
<a href="{{ route('sources.create') }}"
class="px-4 py-2 bg-indigo-600 text-white text-sm rounded-md hover:bg-indigo-700">+ Nouvelle source</a>
@endcan
</div>
</x-slot>
<div class="py-8 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
@if(session('success')) <div class="mb-4 p-4 bg-green-50 border border-green-200 text-green-800 rounded-md">{{ session('success') }}</div> @endif
<div class="bg-white shadow rounded-lg overflow-hidden">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Nom</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Type</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Statut</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Relevés</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Dépôt</th>
<th class="px-6 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
@forelse($sources as $source)
@php
$statusColors = [
'a_faire' => 'bg-gray-100 text-gray-600',
'en_cours' => 'bg-blue-100 text-blue-700',
'a_valider' => 'bg-yellow-100 text-yellow-700',
'termine' => 'bg-green-100 text-green-700',
];
$color = $statusColors[$source->status->value] ?? 'bg-gray-100 text-gray-600';
@endphp
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 font-medium">
<a href="{{ route('sources.show', $source) }}" class="text-indigo-600 hover:underline">{{ $source->nom }}</a>
@if($source->cote) <span class="ml-2 text-xs text-gray-400">{{ $source->cote }}</span> @endif
</td>
<td class="px-6 py-4 text-sm text-gray-500">{{ $source->sourceType->nom }}</td>
<td class="px-6 py-4">
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium {{ $color }}">
{{ $source->status->label() }}
</span>
</td>
<td class="px-6 py-4 text-sm text-gray-500">{{ $source->releves_count }}</td>
<td class="px-6 py-4 text-sm text-gray-500">{{ $source->depot?->nom ?? '—' }}</td>
<td class="px-6 py-4 text-right text-sm space-x-3">
@can('update', $source)
<a href="{{ route('sources.edit', $source) }}" class="text-gray-600 hover:text-indigo-600">Modifier</a>
@endcan
</td>
</tr>
@empty
<tr><td colspan="6" class="px-6 py-10 text-center text-gray-400">Aucune source disponible.</td></tr>
@endforelse
</tbody>
</table>
@if($sources->hasPages()) <div class="px-6 py-4 border-t">{{ $sources->links() }}</div> @endif
</div>
</div>
</x-app-layout>
+149
View File
@@ -0,0 +1,149 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<div>
<h2 class="text-xl font-semibold text-gray-800">{{ $source->nom }}</h2>
@if($source->cote)
<p class="text-sm text-gray-500 mt-0.5">Cote : {{ $source->cote }}</p>
@endif
</div>
<div class="flex items-center gap-3">
@can('update', $source)
<a href="{{ route('sources.edit', $source) }}"
class="px-4 py-2 bg-white border border-gray-300 text-gray-700 text-sm rounded-md hover:bg-gray-50">Modifier</a>
@endcan
@can('delete', $source)
<form method="POST" action="{{ route('sources.destroy', $source) }}"
x-data @submit.prevent="if(confirm('Supprimer cette source et tous ses relevés ?')) $el.submit()">
@csrf @method('DELETE')
<button type="submit" class="px-4 py-2 bg-red-600 text-white text-sm rounded-md hover:bg-red-700">Supprimer</button>
</form>
@endcan
</div>
</div>
</x-slot>
<div class="py-8 max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 space-y-6">
@foreach(['success','error'] as $flash)
@if(session($flash))
<div class="p-4 rounded-md {{ $flash === 'success' ? 'bg-green-50 border border-green-200 text-green-800' : 'bg-red-50 border border-red-200 text-red-800' }}">
{{ session($flash) }}
</div>
@endif
@endforeach
<div class="grid grid-cols-3 gap-6">
{{-- Fiche source --}}
<div class="col-span-2 bg-white shadow rounded-lg divide-y divide-gray-100 text-sm">
@foreach([
['Type', $source->sourceType->nom],
['Dépôt', $source->depot?->nom ?? '—'],
['Auteur', $source->auteur ?? '—'],
] as [$label, $val])
<div class="px-6 py-4 grid grid-cols-3 gap-4">
<dt class="font-medium text-gray-500">{{ $label }}</dt>
<dd class="col-span-2 text-gray-900">{{ $val }}</dd>
</div>
@endforeach
@if($source->description)
<div class="px-6 py-4 grid grid-cols-3 gap-4">
<dt class="font-medium text-gray-500">Description</dt>
<dd class="col-span-2 text-gray-900 whitespace-pre-line">{{ $source->description }}</dd>
</div>
@endif
</div>
{{-- Statut + transitions --}}
<div class="bg-white shadow rounded-lg p-6 space-y-4">
@php
$statusColors = ['a_faire'=>'gray','en_cours'=>'blue','a_valider'=>'yellow','termine'=>'green'];
$color = $statusColors[$source->status->value] ?? 'gray';
@endphp
<div>
<p class="text-xs font-medium text-gray-500 uppercase mb-2">Statut</p>
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-{{ $color }}-100 text-{{ $color }}-700">
{{ $source->status->label() }}
</span>
</div>
@can('transition', $source)
@php $transitions = $source->status->transitions(); @endphp
@if(count($transitions))
<div class="space-y-2">
<p class="text-xs font-medium text-gray-500 uppercase">Changer le statut</p>
@foreach($transitions as $next)
@if($source->canTransitionTo($next, auth()->user()))
<form method="POST" action="{{ route('sources.transition', $source) }}">
@csrf
<input type="hidden" name="status" value="{{ $next->value }}">
<button type="submit"
class="w-full text-left px-3 py-2 text-sm border border-gray-200 rounded-md hover:bg-gray-50 hover:border-indigo-300 transition-colors">
{{ $next->label() }}
</button>
</form>
@endif
@endforeach
</div>
@endif
@endcan
</div>
</div>
{{-- Membres assignés --}}
@can('assignMembre', $source)
<div class="bg-white shadow rounded-lg overflow-hidden">
<div class="px-6 py-4 border-b border-gray-200 font-medium text-gray-900">
Membres assignés ({{ $source->membres->count() }})
</div>
@if($source->membres->isNotEmpty())
<table class="min-w-full divide-y divide-gray-200 text-sm">
<tbody class="divide-y divide-gray-200">
@foreach($source->membres as $membre)
<tr>
<td class="px-6 py-3">{{ $membre->name }}</td>
<td class="px-6 py-3 text-gray-500">{{ $membre->email }}</td>
<td class="px-6 py-3 text-right">
<form method="POST" action="{{ route('sources.membres.remove', [$source, $membre]) }}"
x-data @submit.prevent="if(confirm('Retirer ce membre ?')) $el.submit()">
@csrf @method('DELETE')
<button type="submit" class="text-red-500 hover:text-red-700 text-xs">Retirer</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
@endif
<div class="px-6 py-4 bg-gray-50 border-t border-gray-200">
<form method="POST" action="{{ route('sources.membres.add', $source) }}" class="flex gap-3 items-end">
@csrf
<div class="flex-1">
<label class="block text-xs font-medium text-gray-600 mb-1">Ajouter un membre</label>
<select name="user_id" class="block w-full rounded-md border-gray-300 shadow-sm text-sm focus:border-indigo-500 focus:ring-indigo-500">
@foreach($availableUsers as $u)
<option value="{{ $u->id }}">{{ $u->name }} ({{ $u->email }})</option>
@endforeach
</select>
</div>
<button type="submit" class="px-4 py-2 bg-indigo-600 text-white text-sm rounded-md hover:bg-indigo-700">Assigner</button>
</form>
</div>
</div>
@endcan
{{-- Liste des relevés (aperçu) --}}
<div class="bg-white shadow rounded-lg overflow-hidden">
<div class="px-6 py-4 border-b border-gray-200 flex items-center justify-between">
<h3 class="font-medium text-gray-900">Relevés ({{ $source->releves->count() }})</h3>
{{-- Lien activé à l'étape 6 --}}
</div>
@if($source->releves->isEmpty())
<p class="px-6 py-8 text-center text-gray-400 text-sm">Aucun relevé pour cette source.</p>
@else
<p class="px-6 py-4 text-sm text-gray-500">{{ $source->releves->count() }} relevé(s) enregistré(s).</p>
@endif
</div>
<a href="{{ route('sources.index') }}" class="text-sm text-indigo-600 hover:underline"> Retour aux sources</a>
</div>
</x-app-layout>
File diff suppressed because one or more lines are too long