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
+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>