Files
yann64 f530f55577 Mode sombre, option désactivation mises à jour, user-picker avec recherche
- Dark mode complet : darkMode:'class' Tailwind, sélecteur clair/sombre/auto
  dans la navigation (mémorisé dans localStorage, sans flash au chargement) ;
  53 vues et 8 composants Breeze mis à jour avec classes dark:
- Composant user-picker : fenêtre modale avec recherche temps réel (nom/email)
  remplace les <select> d'ajout de membres dans sections et sources
- Paramètres : option "Désactiver la vérification automatique des mises à jour"
  (case à cochage auto-soumise, route POST parametres/updates)
- Panneau "Paramètres généraux" remonté en tête de la page de paramètres
- README recentré sur l'installation manuelle hébergement PHP+MySQL
- VERSION 1.0.1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 19:46:22 +02:00

212 lines
14 KiB
PHP

<x-app-layout>
<x-slot name="header">
<h2 class="text-xl font-semibold text-gray-800 dark:text-gray-200">Tableau de bord</h2>
</x-slot>
<div class="py-8 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 space-y-8">
@php $user = auth()->user(); @endphp
{{-- Bloc admin : lien vers le dashboard admin --}}
@if($user->isAdmin())
<div class="bg-indigo-50 dark:bg-indigo-900/30 border border-indigo-200 dark:border-indigo-700 rounded-xl p-5 flex items-center justify-between">
<div>
<p class="text-sm font-semibold text-indigo-800 dark:text-indigo-200">Accès administrateur</p>
<p class="text-xs text-indigo-600 mt-0.5">Statistiques globales, gestion des utilisateurs et des sections.</p>
</div>
<a href="{{ route('admin.dashboard') }}"
class="px-4 py-2 bg-indigo-600 text-white text-sm font-medium rounded-md hover:bg-indigo-700">
Tableau de bord admin
</a>
</div>
@endif
{{-- ── Stats de section (membres et responsables) ───────────────────── --}}
@if($sectionsStats && $sectionsStats->isNotEmpty())
@foreach($sectionsStats as $stat)
@php
$statusColors = [
'a_faire' => ['bg' => 'bg-gray-100 dark:bg-gray-700', 'text' => 'text-gray-700 dark:text-gray-300'],
'en_cours' => ['bg' => 'bg-blue-100 dark:bg-blue-900/50', 'text' => 'text-blue-700'],
'a_valider' => ['bg' => 'bg-yellow-100 dark:bg-yellow-900/50', 'text' => 'text-yellow-700'],
'termine' => ['bg' => 'bg-green-100 dark:bg-green-900/50', 'text' => 'text-green-700'],
];
$statusLabels = [
'a_faire' => 'À faire',
'en_cours' => 'En cours',
'a_valider' => 'À valider',
'termine' => 'Terminé',
];
@endphp
<div class="space-y-4">
<h3 class="text-base font-semibold text-gray-800 dark:text-gray-200 flex items-center gap-2">
<span>Section {{ $stat['section']->nom }}</span>
@if($user->isManagerOfSection($stat['section']))
<span class="text-xs px-2 py-0.5 bg-blue-100 dark:bg-blue-900/50 text-blue-700 rounded-full">Responsable</span>
@endif
</h3>
{{-- Compteurs par statut --}}
<div class="grid grid-cols-2 sm:grid-cols-4 gap-3">
@foreach($stat['by_status'] as $statusVal => $count)
@php $c = $statusColors[$statusVal] ?? ['bg' => 'bg-gray-100 dark:bg-gray-700', 'text' => 'text-gray-700 dark:text-gray-300']; @endphp
<a href="{{ route('sources.index', ['status' => $statusVal]) }}"
class="rounded-xl border p-4 flex flex-col gap-1 hover:shadow-md transition-shadow
{{ $c['bg'] }} border-transparent">
<span class="text-2xl font-bold {{ $c['text'] }}">{{ $count }}</span>
<span class="text-xs font-medium {{ $c['text'] }}">{{ $statusLabels[$statusVal] ?? $statusVal }}</span>
<span class="text-xs opacity-60 {{ $c['text'] }}">source{{ $count > 1 ? 's' : '' }}</span>
</a>
@endforeach
</div>
{{-- Métriques globales section --}}
<div class="grid grid-cols-2 gap-4">
<div class="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl px-5 py-4 flex items-center gap-4">
<div class="p-2 bg-indigo-100 dark:bg-indigo-900/50 rounded-lg">
<svg class="w-5 h-5 text-indigo-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8"/>
</svg>
</div>
<div>
<p class="text-xl font-bold text-gray-900 dark:text-white">{{ $stat['total_sources'] }}</p>
<p class="text-xs text-gray-500 dark:text-gray-400">source{{ $stat['total_sources'] > 1 ? 's' : '' }} au total</p>
</div>
</div>
<div class="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl px-5 py-4 flex items-center gap-4">
<div class="p-2 bg-green-100 dark:bg-green-900/50 rounded-lg">
<svg class="w-5 h-5 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
</svg>
</div>
<div>
<p class="text-xl font-bold text-gray-900 dark:text-white">{{ number_format($stat['total_releves']) }}</p>
<p class="text-xs text-gray-500 dark:text-gray-400">relevé{{ $stat['total_releves'] > 1 ? 's' : '' }} saisi{{ $stat['total_releves'] > 1 ? 's' : '' }}</p>
</div>
</div>
</div>
{{-- Sources récentes de la section --}}
@if($stat['sources_recentes']->isNotEmpty())
<div class="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-5">
<p class="text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase mb-3">Sources récentes</p>
<div class="divide-y divide-gray-100 dark:divide-gray-700">
@foreach($stat['sources_recentes'] as $src)
@php
$sc = $statusColors[$src->status->value] ?? ['bg' => 'bg-gray-100 dark:bg-gray-700', 'text' => 'text-gray-600 dark:text-gray-400'];
@endphp
<div class="flex items-center justify-between py-2.5">
<div class="min-w-0">
<a href="{{ route('sources.show', $src) }}"
class="text-sm font-medium text-indigo-600 hover:underline truncate block">
{{ $src->nom }}
</a>
<p class="text-xs text-gray-400 dark:text-gray-500">
{{ $src->sourceType->nom }} · {{ $src->releves_count }} relevé{{ $src->releves_count > 1 ? 's' : '' }}
</p>
</div>
<span class="ml-4 shrink-0 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium {{ $sc['bg'] }} {{ $sc['text'] }}">
{{ $src->status->label() }}
</span>
</div>
@endforeach
</div>
</div>
@endif
</div>
@endforeach
@endif
{{-- ── Mes sources assignées ────────────────────────────────────────── --}}
@if($mesSources->isNotEmpty())
<div class="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6">
<div class="flex items-center justify-between mb-4">
<h3 class="text-sm font-semibold text-gray-700 dark:text-gray-300 uppercase tracking-wide">Mes sources assignées</h3>
<a href="{{ route('sources.index') }}" class="text-xs text-indigo-600 hover:underline">Voir toutes</a>
</div>
<div class="overflow-x-auto">
<table class="min-w-full text-sm divide-y divide-gray-100 dark:divide-gray-700">
<thead>
<tr>
<th class="pb-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Source</th>
<th class="pb-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Type</th>
<th class="pb-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Statut</th>
<th class="pb-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Relevés</th>
<th class="pb-2"></th>
</tr>
</thead>
<tbody class="divide-y divide-gray-50 dark:divide-gray-700">
@foreach($mesSources as $source)
@php
$colors = [
'a_faire' => 'bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400',
'en_cours' => 'bg-blue-100 dark:bg-blue-900/50 text-blue-700',
'a_valider' => 'bg-yellow-100 dark:bg-yellow-900/50 text-yellow-700',
'termine' => 'bg-green-100 dark:bg-green-900/50 text-green-700',
];
$c = $colors[$source->status->value] ?? 'bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400';
@endphp
<tr class="hover:bg-gray-50 dark:hover:bg-gray-700">
<td class="py-2.5 pr-4">
<a href="{{ route('sources.show', $source) }}"
class="font-medium text-indigo-600 hover:underline">{{ $source->nom }}</a>
</td>
<td class="py-2.5 pr-4 text-gray-500 dark:text-gray-400">{{ $source->sourceType->nom }}</td>
<td class="py-2.5 pr-4">
<span class="inline-flex px-2 py-0.5 rounded-full text-xs font-medium {{ $c }}">
{{ $source->status->label() }}
</span>
</td>
<td class="py-2.5 pr-4 text-gray-500 dark:text-gray-400">{{ $source->releves_count }}</td>
<td class="py-2.5 text-right">
<a href="{{ route('sources.releves.index', $source) }}"
class="text-xs text-indigo-600 hover:underline">Saisir </a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@elseif(! $sectionsStats || $sectionsStats->isEmpty())
<div class="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-10 text-center text-gray-400 dark:text-gray-500">
<svg class="mx-auto w-10 h-10 mb-3 text-gray-300 dark:text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"
d="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8"/>
</svg>
<p class="text-sm">Vous n'êtes assigné à aucune source pour l'instant.</p>
<a href="{{ route('sources.index') }}" class="mt-2 inline-block text-sm text-indigo-600 hover:underline">
Voir les sources disponibles
</a>
</div>
@endif
{{-- ── Mes derniers relevés ─────────────────────────────────────────── --}}
@if($mesReleves->isNotEmpty())
<div class="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6">
<div class="flex items-center justify-between mb-4">
<h3 class="text-sm font-semibold text-gray-700 dark:text-gray-300 uppercase tracking-wide">Mes derniers relevés</h3>
<a href="{{ route('recherche') }}" class="text-xs text-indigo-600 hover:underline">Recherche</a>
</div>
<div class="space-y-0 divide-y divide-gray-100 dark:divide-gray-700">
@foreach($mesReleves as $releve)
<div class="flex items-center justify-between py-2.5">
<div class="min-w-0">
<a href="{{ route('releves.show', $releve) }}"
class="text-sm font-medium text-gray-900 dark:text-white hover:text-indigo-600">
{{ $releve->nom ?? '—' }}{{ $releve->prenom ? ', ' . $releve->prenom : '' }}
</a>
<p class="text-xs text-gray-400 dark:text-gray-500">{{ $releve->source->nom }}</p>
</div>
<span class="text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap ml-4">
{{ $releve->created_at->diffForHumans() }}
</span>
</div>
@endforeach
</div>
</div>
@endif
</div>
</x-app-layout>