feat(setup preprod)
All checks were successful
Deploy Roxane to Preprod / deploy (push) Successful in 26h10m32s
All checks were successful
Deploy Roxane to Preprod / deploy (push) Successful in 26h10m32s
This commit is contained in:
48
app/Filament/Widgets/DashboardStatsWidget.php
Normal file
48
app/Filament/Widgets/DashboardStatsWidget.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use App\Models\Member;
|
||||
use App\Models\Membership;
|
||||
use Filament\Support\Enums\IconPosition;
|
||||
use Filament\Widgets\StatsOverviewWidget;
|
||||
use Filament\Widgets\StatsOverviewWidget\Stat;
|
||||
|
||||
class DashboardStatsWidget extends StatsOverviewWidget
|
||||
{
|
||||
protected static ?int $sort = 1;
|
||||
|
||||
protected function getStats(): array
|
||||
{
|
||||
$activeMembers = Member::where('status', 'valid')->count();
|
||||
$activeMemberships = Membership::where('status', 'active')->count();
|
||||
$newThisMonth = Membership::whereMonth('created_at', now()->month)
|
||||
->whereYear('created_at', now()->year)
|
||||
->count();
|
||||
$unpaidMemberships = Membership::where('payment_status', 'unpaid')
|
||||
->where('status', 'active')
|
||||
->count();
|
||||
|
||||
return [
|
||||
Stat::make('Membres actifs', $activeMembers)
|
||||
->description('Statut "Valide"')
|
||||
->descriptionIcon('heroicon-o-user-group', IconPosition::Before)
|
||||
->color('success'),
|
||||
|
||||
Stat::make('Adhésions actives', $activeMemberships)
|
||||
->description('En cours')
|
||||
->descriptionIcon('heroicon-o-identification', IconPosition::Before)
|
||||
->color('primary'),
|
||||
|
||||
Stat::make('Nouvelles adhésions', $newThisMonth)
|
||||
->description('Ce mois-ci')
|
||||
->descriptionIcon('heroicon-o-calendar', IconPosition::Before)
|
||||
->color('info'),
|
||||
|
||||
Stat::make('Paiements en attente', $unpaidMemberships)
|
||||
->description('Adhésions actives non réglées')
|
||||
->descriptionIcon('heroicon-o-banknotes', IconPosition::Before)
|
||||
->color($unpaidMemberships > 0 ? 'warning' : 'success'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user