feat: add StationResource with poll action and view page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ovidiu U
2026-04-04 14:27:22 +01:00
parent b2cc3ee0ff
commit 52dc225b3d
4 changed files with 206 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Filament\Resources\StationResource\Pages;
use App\Filament\Resources\StationResource;
use App\Jobs\PollFuelPricesJob;
use Filament\Actions\Action;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\ListRecords;
class ListStations extends ListRecords
{
protected static string $resource = StationResource::class;
protected function getHeaderActions(): array
{
return [
Action::make('triggerFullPoll')
->label('Trigger Full Poll')
->icon('heroicon-o-arrow-path')
->requiresConfirmation()
->modalHeading('Trigger full station refresh?')
->modalDescription('This dispatches a background job to refresh all ~14,500 stations from the Fuel Finder API. Results will appear in API Logs once complete.')
->action(function () {
PollFuelPricesJob::dispatch();
Notification::make()
->title('Poll dispatched to queue')
->body('Check API Logs once the job completes.')
->success()
->send();
}),
];
}
}