feat(Admin Panel & Charts)

This commit is contained in:
2025-10-23 11:41:56 +02:00
parent bd268f9b7f
commit 07160656f5
26 changed files with 840 additions and 7 deletions

View File

@@ -18,6 +18,8 @@ class MembershipResource extends Resource
{
protected static ?string $model = Membership::class;
protected static string|null|\UnitEnum $navigationGroup = 'Administration';
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedIdentification;
public static function form(Schema $schema): Schema

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Filament\Resources\Memberships\Widgets;
use App\Models\Membership;
use Filament\Widgets\ChartWidget;
class MembershipsChart extends ChartWidget
{
protected ?string $heading = 'Adhésions';
protected function getData(): array
{
$memberships = Membership::query()
->selectRaw('status, count(*) as total')
->groupBy('status')
->get();
return [
'datasets' => [
[
'data' => $memberships->pluck('total')->toArray(),
'backgroundColor' => [
'rgb(54, 162, 235)',
'rgb(255, 99, 132)',
'rgb(255, 205, 86)',
],
],
],
'labels' => $memberships->pluck('status')->toArray(),
];
}
protected function getType(): string
{
return 'doughnut';
}
}