60413bdebf
- BookingsTodayWidget, RecentBookingsTableWidget (Booking module) and RevenueChartWidget, PaymentFailureRateWidget (Payment module) dashboard widgets, auto-registered via each plugin's existing discoverWidgets(). - .gitea/workflows/tests.yml: Postgres-backed Pest run on push/PR. - Landing page (resources/views/welcome.blade.php) now shows the Famous Linnyone4 EV logo with a single admin login link, and the Filament admin panel uses the same logo as its brand logo.
37 lines
1.3 KiB
PHP
37 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Modules\Booking\Filament\Widgets;
|
|
|
|
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
|
|
use Filament\Widgets\StatsOverviewWidget\Stat;
|
|
use Modules\Booking\Enums\BookingStatus;
|
|
use Modules\Booking\Models\Booking;
|
|
|
|
/**
|
|
* Dispatch-facing snapshot of today's trips — "today" means travel_date, not
|
|
* created_at, since this is what staff care about when assigning
|
|
* drivers/vehicles (domain.md §5a), not how many bookings were made today.
|
|
*/
|
|
class BookingsTodayWidget extends BaseWidget
|
|
{
|
|
protected function getStats(): array
|
|
{
|
|
$today = Booking::query()->whereDate('travel_date', today());
|
|
|
|
$confirmedToday = (clone $today)->where('status', BookingStatus::Confirmed)->count();
|
|
$pendingToday = (clone $today)->where('status', BookingStatus::PendingPayment)->count();
|
|
|
|
return [
|
|
Stat::make('Trips Today', (clone $today)->count())
|
|
->description('Bookings scheduled for today')
|
|
->color('primary'),
|
|
Stat::make('Confirmed', $confirmedToday)
|
|
->description('Paid & ready for driver assignment')
|
|
->color('success'),
|
|
Stat::make('Awaiting Payment', $pendingToday)
|
|
->description('Still pending_payment')
|
|
->color($pendingToday > 0 ? 'warning' : 'gray'),
|
|
];
|
|
}
|
|
}
|