d064f8d28e
- Étape 6 : formulaire de saisie dynamique des relevés (piloté par source_type_fields, calendriers grégorien/julien/républicain) - Étape 7 : workflow de statut des sources + notifications mail+DB (SourceAValider, SourceRejetee) - Étape 8 : recherche fulltext PostgreSQL avec filtres type/lieu/années et CTE récursive pour les subdivisions de lieux - Étape 9 : export GEDCOM 5.5.1 (GedcomExportService + DateConversionService) - Types de lieux : CRUD admin (LieuTypeController) avec champ ordre - Composant lieu-picker : modale Alpine.js avec recherche AJAX + debounce - Filtres sources : statut, type, lieu (CTE récursive), période annee_debut/annee_fin - Filtres lieux : type, texte, lieu parent avec descendants (CTE récursive) - Migration : lieu_id + annee_debut + annee_fin sur sources Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
151 lines
7.9 KiB
PHP
151 lines
7.9 KiB
PHP
<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 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
|
|
@if(session('error'))
|
|
<div class="p-4 bg-red-50 border border-red-200 text-red-800 rounded-md">{{ session('error') }}</div>
|
|
@endif
|
|
|
|
{{-- Filtres --}}
|
|
@php $hasFilters = request()->anyFilled(['lieu_type_id', 'q', 'lieu_id']); @endphp
|
|
<div class="bg-white shadow rounded-lg p-5">
|
|
<form method="GET" action="{{ route('lieux.index') }}">
|
|
<div class="flex flex-wrap items-end gap-4">
|
|
|
|
<div class="flex-1 min-w-[200px]">
|
|
<label class="block text-xs font-medium text-gray-600 mb-1">Recherche</label>
|
|
<input type="text" name="q" value="{{ request('q') }}"
|
|
placeholder="Nom, code INSEE…"
|
|
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">
|
|
<label class="block text-xs font-medium text-gray-600 mb-1">Type de lieu</label>
|
|
<select name="lieu_type_id"
|
|
class="block w-full rounded-md border-gray-300 shadow-sm text-sm focus:border-indigo-500 focus:ring-indigo-500">
|
|
<option value="">— Tous les types —</option>
|
|
@foreach($lieuTypes as $lt)
|
|
<option value="{{ $lt->id }}" {{ request('lieu_type_id') == $lt->id ? 'selected' : '' }}>
|
|
{{ $lt->nom }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
|
|
<div class="flex items-center gap-3 self-end">
|
|
<button type="submit"
|
|
class="px-5 py-2 bg-indigo-600 text-white text-sm font-medium rounded-md hover:bg-indigo-700">
|
|
Filtrer
|
|
</button>
|
|
@if($hasFilters)
|
|
<a href="{{ route('lieux.index') }}"
|
|
class="px-4 py-2 border border-gray-300 text-gray-600 text-sm rounded-md hover:bg-gray-50">
|
|
Effacer
|
|
</a>
|
|
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-xs bg-indigo-100 text-indigo-700">
|
|
filtres actifs
|
|
</span>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Filtre par lieu parent --}}
|
|
<div class="mt-4 max-w-sm">
|
|
<x-lieu-picker
|
|
name="lieu_id"
|
|
label="Lieu (et ses subdivisions)"
|
|
:value="request('lieu_id')"
|
|
:display-value="$lieuSelectionne?->nom_long ?? $lieuSelectionne?->nom ?? ''"
|
|
placeholder="— Tous les lieux —"
|
|
/>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
{{-- Tableau --}}
|
|
<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">Type</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->lieuType?->nom ?? '—' }}</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="6" class="px-6 py-10 text-center text-gray-400">
|
|
@if($hasFilters) Aucun lieu ne correspond aux filtres.
|
|
@else Aucun lieu enregistré. @endif
|
|
</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>
|