Filament moderne (groupes nav, 4 charts, filtres/badges) + Filament Shield (rôles/permissions) + noms exos localisés dans routines
Build & Deploy / build (push) Successful in 19s

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-19 05:09:29 +02:00
co-authored by Claude Opus 4.8
parent 3ec14f219b
commit 52fab9fbe5
47 changed files with 1644 additions and 292 deletions
@@ -0,0 +1,52 @@
<?php
namespace App\Filament\Widgets;
use Filament\Widgets\ChartWidget;
use Functional\Exercises\Models\Exercise;
/**
* Répartition du catalogue d'exercices par partie du corps ciblée (doughnut).
*/
class ExercisesByBodyPartChart extends ChartWidget
{
protected static ?int $sort = 4;
protected int|string|array $columnSpan = 1;
/** Palette "flamme" dégradée pour distinguer les parts sans dépendre de couleurs génériques. */
private const PALETTE = [
'#f59e0b', '#fb923c', '#f97316', '#ea580c', '#c2410c',
'#fbbf24', '#fcd34d', '#fde68a', '#d97706', '#b45309',
];
public function getHeading(): string
{
return 'Exercices par partie du corps';
}
protected function getData(): array
{
$countsByBodyPart = Exercise::query()
->whereNotNull('body_part')
->selectRaw('body_part, COUNT(*) as total')
->groupBy('body_part')
->orderByDesc('total')
->pluck('total', 'body_part');
return [
'datasets' => [
[
'data' => $countsByBodyPart->values()->all(),
'backgroundColor' => self::PALETTE,
],
],
'labels' => $countsByBodyPart->keys()->all(),
];
}
protected function getType(): string
{
return 'doughnut';
}
}