Files
mesreleves-php/resources/views/admin/sections/show.blade.php
T
yann64 7609d35287 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>
2026-06-04 16:16:37 +02:00

92 lines
5.0 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">{{ $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>