Files
fuel-price/app/Filament/Resources/Plans/Schemas/PlanForm.php
Ovidiu U 4220b1b86a
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
Add subscription tiers, notification preferences, and logging infrastructure
- Add database migrations for plans, subscriptions, notification preferences, and notification log tables
- Implement DispatchUserNotificationJob to handle channel resolution, daily limits, and logging (sent/tier_restricted/daily_limit)
- Add SendScheduledWhatsAppJob for scheduled notification delivery
- Create PlanFeatures service to resolve tier capabilities, check daily limits, and validate fuel
2026-04-14 16:20:51 +01:00

92 lines
3.4 KiB
PHP

<?php
namespace App\Filament\Resources\Plans\Schemas;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
class PlanForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
Section::make('Fuel Types')
->schema([
TextInput::make('features.fuel_types.max')
->label('Max fuel types')
->helperText('Leave blank for unlimited.')
->numeric()
->integer()
->minValue(1)
->nullable(),
]),
Section::make('Email')
->columns(2)
->schema([
Toggle::make('features.email.enabled')
->label('Enabled'),
Select::make('features.email.frequency')
->label('Frequency')
->options([
'weekly_digest' => 'Weekly digest',
'daily' => 'Daily',
'triggered' => 'Triggered',
]),
]),
Section::make('Push')
->schema([
Toggle::make('features.push.enabled')
->label('Enabled'),
]),
Section::make('WhatsApp')
->columns(3)
->schema([
Toggle::make('features.whatsapp.enabled')
->label('Enabled'),
TextInput::make('features.whatsapp.daily_limit')
->label('Daily limit')
->numeric()
->integer()
->minValue(0)
->required(),
TextInput::make('features.whatsapp.scheduled_updates')
->label('Scheduled updates per day')
->numeric()
->integer()
->minValue(0)
->required(),
]),
Section::make('SMS')
->columns(2)
->schema([
Toggle::make('features.sms.enabled')
->label('Enabled'),
TextInput::make('features.sms.daily_limit')
->label('Daily limit')
->numeric()
->integer()
->minValue(0)
->required(),
]),
Section::make('Features')
->schema([
Toggle::make('features.ai_predictions')
->label('AI predictions'),
Toggle::make('features.price_threshold')
->label('Price threshold alerts'),
Toggle::make('features.score_alerts')
->label('Score change alerts'),
]),
]);
}
}