refactor: restructure Stripe pricing config to support monthly and annual tiers
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled

- Nest price IDs under `monthly` and `annual` keys for each tier (basic, plus, pro)
This commit is contained in:
Ovidiu U
2026-04-14 19:26:01 +01:00
parent 486f0e689c
commit aec547cd86
6 changed files with 499 additions and 6 deletions

View File

@@ -4,7 +4,10 @@ namespace App\Filament\Resources\BrentPriceResource\Pages;
use App\Filament\Resources\BrentPriceResource;
use App\Filament\Widgets\BrentPriceChartWidget;
use Filament\Actions\Action;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\ListRecords;
use Illuminate\Support\Facades\Artisan;
class ListBrentPrices extends ListRecords
{
@@ -12,7 +15,30 @@ class ListBrentPrices extends ListRecords
protected function getHeaderActions(): array
{
return [];
return [
Action::make('fetchPrices')
->label('Fetch Prices Now')
->icon('heroicon-o-arrow-down-tray')
->requiresConfirmation()
->modalHeading('Fetch latest Brent prices?')
->modalDescription('Pulls the latest Brent crude prices from EIA (falls back to FRED if EIA is unavailable).')
->action(function () {
$result = Artisan::call('oil:fetch');
if ($result === 0) {
Notification::make()
->title('Brent prices fetched successfully')
->success()
->send();
} else {
Notification::make()
->title('Fetch failed')
->body('Both EIA and FRED failed. Check API Logs for details.')
->danger()
->send();
}
}),
];
}
protected function getHeaderWidgets(): array

View File

@@ -20,9 +20,9 @@ class ListOilPredictions extends ListRecords
->icon('heroicon-o-cpu-chip')
->requiresConfirmation()
->modalHeading('Run oil price prediction?')
->modalDescription('This will fetch the latest FRED prices and generate a new prediction. May take a few seconds.')
->modalDescription('Generates a new prediction from the stored Brent prices. Runs even if a prediction already exists for the latest price.')
->action(function () {
$result = Artisan::call('oil:predict', ['--fetch' => true]);
$result = Artisan::call('oil:predict', ['--force' => true]);
if ($result === 0) {
Notification::make()