feat: add finance dashboard statistics and budget realization chart for Admin Keuangan role
This commit is contained in:
parent
fbb0f92b37
commit
ddfd1ab340
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Filament\Widgets\Charts\BudgetRealizationChart;
|
||||
use App\Filament\Widgets\Charts\CooperationStatusChart;
|
||||
use App\Filament\Widgets\Stats\OverviewStats;
|
||||
use BezhanSalleh\FilamentShield\Traits\HasPageShield;
|
||||
@ -24,6 +25,7 @@ public function getWidgets(): array
|
||||
{
|
||||
return [
|
||||
OverviewStats::class,
|
||||
BudgetRealizationChart::class,
|
||||
CooperationStatusChart::class,
|
||||
];
|
||||
}
|
||||
|
||||
@ -38,6 +38,10 @@ protected function getStats(): array
|
||||
return $this->getCompanyStats($user);
|
||||
}
|
||||
|
||||
if ($user && $user->hasRole(RoleEnum::ADMIN_KEUANGAN->value)) {
|
||||
return $this->getFinanceStats();
|
||||
}
|
||||
|
||||
$totalJournalists = Journalist::count();
|
||||
$totalMedia = PartnerMedia::count();
|
||||
$average = $totalMedia > 0 ? round($totalJournalists / $totalMedia, 1) : 0;
|
||||
@ -168,4 +172,29 @@ private function getCompanyStats($user): array
|
||||
->color($this->getRandomColor()),
|
||||
];
|
||||
}
|
||||
|
||||
private function getFinanceStats(): array
|
||||
{
|
||||
return [
|
||||
Stat::make('Total Anggaran', 'Rp '.number_format(CooperationPayment::sum('amount'), 0, ',', '.'))
|
||||
->description('Total Nilai Kerjasama')
|
||||
->descriptionIcon('heroicon-o-banknotes')
|
||||
->color('success'),
|
||||
|
||||
Stat::make('Realisasi Pembayaran', CooperationPayment::accepted()->count())
|
||||
->description('Pembayaran Selesai')
|
||||
->descriptionIcon('heroicon-o-check-circle')
|
||||
->color('success'),
|
||||
|
||||
Stat::make('Menunggu Pembayaran', CooperationPayment::pending()->count())
|
||||
->description('Menunggu Tindakan')
|
||||
->descriptionIcon('heroicon-o-clock')
|
||||
->color('warning'),
|
||||
|
||||
Stat::make('Pembayaran Ditolak', CooperationPayment::rejected()->count())
|
||||
->description('Perlu Perhatian')
|
||||
->descriptionIcon('heroicon-o-x-circle')
|
||||
->color('danger'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -680,12 +680,12 @@ public function run(): void
|
||||
"name": "Admin Keuangan",
|
||||
"guard_name": "web",
|
||||
"permissions": [
|
||||
"View:Analytic",
|
||||
|
||||
"ViewAny:Cooperation",
|
||||
"View:Cooperation",
|
||||
|
||||
"View:Dashboard"
|
||||
"View:Dashboard",
|
||||
|
||||
"View:OverviewStats"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user