ff615ca0a1
- Routes export.source et export.recherche supprimées - ExportController : méthodes source() et recherche() supprimées, imports GedcomExportService/DbCompat/Releve/SourceStatus/DB retirés - Boutons GEDCOM retirés de sources/show, releves/index et recherche/index Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
166 lines
9.4 KiB
PHP
166 lines
9.4 KiB
PHP
<x-app-layout>
|
|
<x-slot name="header">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<h2 class="text-xl font-semibold text-gray-800 dark:text-gray-200">{{ $source->nom }}</h2>
|
|
@if($source->cote)
|
|
<p class="text-sm text-gray-500 dark:text-gray-400 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 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 text-sm rounded-md hover:bg-gray-50 dark:hover:bg-gray-700">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 dark:bg-green-900/30 border border-green-200 dark:border-green-700 text-green-800 dark:text-green-200' : 'bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-700 text-red-800 dark:text-red-200' }}">
|
|
{{ session($flash) }}
|
|
</div>
|
|
@endif
|
|
@endforeach
|
|
|
|
<div class="grid grid-cols-3 gap-6">
|
|
{{-- Fiche source --}}
|
|
<div class="col-span-2 bg-white dark:bg-gray-800 shadow rounded-lg divide-y divide-gray-100 dark:divide-gray-700 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 dark:text-gray-400">{{ $label }}</dt>
|
|
<dd class="col-span-2 text-gray-900 dark:text-white">{{ $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 dark:text-gray-400">Description</dt>
|
|
<dd class="col-span-2 text-gray-900 dark:text-white whitespace-pre-line">{{ $source->description }}</dd>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
{{-- Statut + transitions --}}
|
|
<div class="bg-white dark:bg-gray-800 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 dark:text-gray-400 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 dark:text-gray-400 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 dark:border-gray-700 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 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 dark:bg-gray-800 shadow rounded-lg overflow-hidden">
|
|
<div class="px-6 py-4 border-b border-gray-200 dark:border-gray-700 font-medium text-gray-900 dark:text-white">
|
|
Membres assignés ({{ $source->membres->count() }})
|
|
</div>
|
|
@if($source->membres->isNotEmpty())
|
|
<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700 text-sm">
|
|
<tbody class="divide-y divide-gray-200 dark:divide-gray-700">
|
|
@foreach($source->membres as $membre)
|
|
<tr>
|
|
<td class="px-6 py-3">{{ $membre->name }}</td>
|
|
<td class="px-6 py-3 text-gray-500 dark:text-gray-400">{{ $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 dark:bg-gray-700 border-t border-gray-200 dark:border-gray-700">
|
|
<form method="POST" action="{{ route('sources.membres.add', $source) }}"
|
|
@submit.prevent="if ($el.querySelector('[name=user_id]').value) $el.submit()">
|
|
@csrf
|
|
<div class="flex flex-col sm:flex-row gap-3 items-stretch sm:items-end">
|
|
<div class="flex-1">
|
|
<label class="block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1">Ajouter un membre</label>
|
|
<x-user-picker :users="$availableUsers" placeholder="Rechercher un membre à assigner…" required />
|
|
</div>
|
|
<button type="submit" class="px-4 py-2 bg-indigo-600 text-white text-sm rounded-md hover:bg-indigo-700 shrink-0">Assigner</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
@endcan
|
|
|
|
{{-- Liste des relevés (aperçu) --}}
|
|
<div class="bg-white dark:bg-gray-800 shadow rounded-lg overflow-hidden">
|
|
<div class="px-6 py-4 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between">
|
|
<h3 class="font-medium text-gray-900 dark:text-white">Relevés ({{ $source->releves->count() }})</h3>
|
|
<div class="flex items-center gap-2">
|
|
@if($source->releves->isNotEmpty())
|
|
<a href="{{ route('export.source.csv', $source) }}"
|
|
class="px-3 py-1.5 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 text-xs rounded-md hover:bg-gray-50 dark:hover:bg-gray-600">
|
|
↓ CSV
|
|
</a>
|
|
@endif
|
|
@can('create', [App\Models\Releve::class, $source])
|
|
<a href="{{ route('sources.releves.create', $source) }}"
|
|
class="px-3 py-1.5 bg-indigo-600 text-white text-xs rounded-md hover:bg-indigo-700">
|
|
+ Nouveau relevé
|
|
</a>
|
|
@endcan
|
|
</div>
|
|
</div>
|
|
@if($source->releves->isEmpty())
|
|
<p class="px-6 py-8 text-center text-gray-400 dark:text-gray-500 text-sm">Aucun relevé pour cette source.</p>
|
|
@else
|
|
<p class="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">
|
|
<a href="{{ route('sources.releves.index', $source) }}" class="text-indigo-600 hover:underline">
|
|
Voir les {{ $source->releves->count() }} relevé(s) →
|
|
</a>
|
|
</p>
|
|
@endif
|
|
</div>
|
|
|
|
<a href="{{ route('sources.index') }}" class="text-sm text-indigo-600 hover:underline">← Retour aux sources</a>
|
|
</div>
|
|
</x-app-layout>
|