feat: dashboard
This commit is contained in:
parent
f1b619c154
commit
0b571c5fdf
32
app/Filament/Widgets/StatsOverview.php
Normal file
32
app/Filament/Widgets/StatsOverview.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use App\Filament\Resources\TrRegistrasiResource;
|
||||
use App\Filament\Resources\TrTransaksiResource;
|
||||
use App\Models\TrRegistrasi;
|
||||
use App\Models\TrTransaksi;
|
||||
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
|
||||
use Filament\Widgets\StatsOverviewWidget\Stat;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class StatsOverview extends BaseWidget
|
||||
{
|
||||
protected function getStats(): array
|
||||
{
|
||||
return [
|
||||
Stat::make('Total Pasien', TrRegistrasi::count())
|
||||
->description(new HtmlString('<a class="underline" href="' . TrRegistrasiResource::getUrl('index') . '">Lihat Semua Pasien</a>')),
|
||||
|
||||
// section 2
|
||||
//
|
||||
Stat::make('Total Tagihan', 'Rp ' . number_format(TrTransaksi::sum('total_harga'), 0, ',', '.'))
|
||||
->description(new HtmlString('<a class="underline" href="' . TrTransaksiResource::getUrl('index') . '">Lihat Semua Tagihan</a>')),
|
||||
|
||||
// Registrasi yang belum ada transaksi
|
||||
Stat::make('Total Pasien Belum Ada Transaksi', TrRegistrasi::whereDoesntHave('transaksi')->count())
|
||||
->description(new HtmlString('<a class="underline" href="' . TrRegistrasiResource::getUrl('index') . '">Lihat Semua Pasien Belum Ada Transaksi</a>')),
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Providers\Filament;
|
||||
|
||||
use App\Filament\Widgets\StatsOverview;
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
use Filament\Http\Middleware\AuthenticateSession;
|
||||
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||
@ -37,8 +38,9 @@ class AdminPanelProvider extends PanelProvider
|
||||
])
|
||||
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
|
||||
->widgets([
|
||||
Widgets\AccountWidget::class,
|
||||
Widgets\FilamentInfoWidget::class,
|
||||
StatsOverview::class,
|
||||
// Widgets\AccountWidget::class,
|
||||
// Widgets\FilamentInfoWidget::class,
|
||||
])
|
||||
->middleware([
|
||||
EncryptCookies::class,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user