Layout: - Removed max-w-6xl from <main> — content now fills available width - Removed padding from <main> — each page manages its own padding - Heroes go edge-to-edge (no inner margins) - Content below heroes has p-4 md:p-6 lg:p-8 padding wrapper - WhatsApp banner has its own margin so it doesn't break hero bleed - overflow-hidden on main prevents horizontal scroll from heroes All 6 pages: - Hero section sits flush against edges (no gaps) - Content below hero wrapped in padding container - Two-column grids now use the FULL available width - On a 1920px screen: sidebar 192px + content fills remaining ~1728px - Right columns are now substantial (5/12 of full width = ~720px)
96 lines
3.8 KiB
PHP
96 lines
3.8 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\DonationResource\Pages;
|
|
|
|
use App\Filament\Resources\DonationResource;
|
|
use App\Models\Donation;
|
|
use Filament\Resources\Components\Tab;
|
|
use Filament\Resources\Pages\ListRecords;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
|
class ListDonations extends ListRecords
|
|
{
|
|
protected static string $resource = DonationResource::class;
|
|
|
|
public function getHeading(): string
|
|
{
|
|
return 'Donations';
|
|
}
|
|
|
|
public function getSubheading(): string
|
|
{
|
|
$todayCount = Donation::whereHas('donationConfirmation', fn ($q) => $q->whereNotNull('confirmed_at'))
|
|
->whereDate('created_at', today())
|
|
->count();
|
|
$todayAmount = Donation::whereHas('donationConfirmation', fn ($q) => $q->whereNotNull('confirmed_at'))
|
|
->whereDate('created_at', today())
|
|
->sum('amount') / 100;
|
|
|
|
return "Today: {$todayCount} confirmed (£" . number_format($todayAmount, 0) . ")";
|
|
}
|
|
|
|
public function getTabs(): array
|
|
{
|
|
$incompleteCount = Donation::whereDoesntHave('donationConfirmation', fn ($q) => $q->whereNotNull('confirmed_at'))
|
|
->where('created_at', '>=', now()->subDays(7))
|
|
->count();
|
|
|
|
$recurring = Donation::where('reoccurrence', '!=', -1)
|
|
->whereHas('donationConfirmation', fn ($q) => $q->whereNotNull('confirmed_at'))
|
|
->count();
|
|
|
|
return [
|
|
'today' => Tab::make('Today')
|
|
->icon('heroicon-o-clock')
|
|
->modifyQueryUsing(fn (Builder $query) => $query
|
|
->whereDate('created_at', today())
|
|
->whereHas('donationConfirmation', fn ($q) => $q->whereNotNull('confirmed_at'))
|
|
),
|
|
|
|
'all_confirmed' => Tab::make('All Confirmed')
|
|
->icon('heroicon-o-check-circle')
|
|
->modifyQueryUsing(fn (Builder $query) => $query
|
|
->whereHas('donationConfirmation', fn ($q) => $q->whereNotNull('confirmed_at'))
|
|
),
|
|
|
|
'incomplete' => Tab::make('Incomplete')
|
|
->icon('heroicon-o-exclamation-triangle')
|
|
->badge($incompleteCount > 0 ? $incompleteCount : null)
|
|
->badgeColor('danger')
|
|
->modifyQueryUsing(fn (Builder $query) => $query
|
|
->whereDoesntHave('donationConfirmation', fn ($q) => $q->whereNotNull('confirmed_at'))
|
|
->where('created_at', '>=', now()->subDays(7))
|
|
),
|
|
|
|
'zakat' => Tab::make('Zakat')
|
|
->icon('heroicon-o-star')
|
|
->modifyQueryUsing(fn (Builder $query) => $query
|
|
->whereHas('donationConfirmation', fn ($q) => $q->whereNotNull('confirmed_at'))
|
|
->whereHas('donationPreferences', fn ($q) => $q->where('is_zakat', true))
|
|
),
|
|
|
|
'gift_aid' => Tab::make('Gift Aid')
|
|
->icon('heroicon-o-gift')
|
|
->modifyQueryUsing(fn (Builder $query) => $query
|
|
->whereHas('donationConfirmation', fn ($q) => $q->whereNotNull('confirmed_at'))
|
|
->whereHas('donationPreferences', fn ($q) => $q->where('is_gift_aid', true))
|
|
),
|
|
|
|
'recurring' => Tab::make('Recurring')
|
|
->icon('heroicon-o-arrow-path')
|
|
->badge($recurring > 0 ? $recurring : null)
|
|
->badgeColor('info')
|
|
->modifyQueryUsing(fn (Builder $q) => $q->where('reoccurrence', '!=', -1)
|
|
->whereHas('donationConfirmation', fn ($sub) => $sub->whereNotNull('confirmed_at'))),
|
|
|
|
'everything' => Tab::make('Everything')
|
|
->icon('heroicon-o-squares-2x2'),
|
|
];
|
|
}
|
|
|
|
public function getDefaultActiveTab(): string | int | null
|
|
{
|
|
return 'today';
|
|
}
|
|
}
|