Reconciles tier docs with `PlanSeeder` reality (basic has price_threshold and score_alerts; schema is stripe_price_id_monthly + stripe_price_id_annual) and introduces the display-name layer from pricing-plan.md v2. - PlanTier::label() + Plan::displayName() + PlanFeatures::displayName() expose user-facing names (Free/Daily/Smart/Pro); backend identifiers stay basic/plus/pro so every call site, Stripe mapping, and test keeps working. - push.frequency key added to features JSON (none/daily/triggered), mirroring email.frequency so Daily's daily push is distinguishable from Smart/Pro's triggered push. Seeder, factory, free-tier stubs, and Filament form updated. - Homepage pricing cards renamed: Basic→Daily, Plus→Smart; badge "Most Popular"→"Most pick this"; CTAs refreshed. - docs/tiers.md change log records the full diff. Fleet tier, 14-day trial copy, and Smart dark-card treatment deferred. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
100 lines
3.8 KiB
PHP
100 lines
3.8 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')
|
|
->columns(2)
|
|
->schema([
|
|
Toggle::make('features.push.enabled')
|
|
->label('Enabled'),
|
|
Select::make('features.push.frequency')
|
|
->label('Frequency')
|
|
->options([
|
|
'none' => 'None (disabled)',
|
|
'daily' => 'Daily',
|
|
'triggered' => 'Triggered',
|
|
]),
|
|
]),
|
|
|
|
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'),
|
|
]),
|
|
]);
|
|
}
|
|
}
|