Demo plan + Payment integrations (Stripe/PayPal/Bank)

Models & migrations:
- platform_settings table (key/value JSON store + Cache::remember 5min)
- plans: is_demo bool + trial_days int
- companies: is_demo bool

Plans:
- Demo plan seeded (is_demo=true, is_public=false, all features, 14 trial days)
- Trial 14-day plan seeded (is_public=true, basic features)
- Plan form: is_demo toggle + trial_days field
- Plan table: badge 🎬 Demo / 🎁 N zile trial

Central panel:
- PaymentSettings page (heroicon-credit-card, sort 90)
  Form sections: General, Date legale, Stripe, PayPal, Transfer bancar
  Each gateway collapsible, fields hidden until enabled toggle
  Saves to platform_settings keyed by `payments.{gateway}`
- CompanyResource: is_demo toggle + table description

Payment flow (PaymentController):
- GET  /billing                 — tenant invoices list with Pay button
- POST /pay/{sub}               — start checkout (stripe/paypal/bank)
- GET  /pay/{sub}/{success,cancel}
- POST /payments/stripe/webhook — mark paid + extend company.active_until
- POST /payments/paypal/webhook — same

Views:
- site/billing.blade.php       — invoices list with payment modal (3 methods)
- site/bank-instructions       — IBAN/BIC/reference for manual transfer
- site/checkout-stub           — placeholder until composer require stripe-php
- site/payment-{success,cancel}

Tenant panel:
- userMenuItems → "Facturile mele" link to /billing
This commit is contained in:
2026-05-08 05:55:30 +00:00
parent d1a18848d3
commit 827bf12d89
16 changed files with 904 additions and 3 deletions
@@ -53,6 +53,14 @@ class PlanResource extends Resource
Forms\Components\TextInput::make('name')->required()->maxLength(60),
Forms\Components\Toggle::make('is_active')->label('Activ')->default(true),
Forms\Components\Toggle::make('is_public')->label('Public (afișat la signup)')->default(true),
Forms\Components\Toggle::make('is_demo')
->label('Demo (pentru demonstrații sales)')
->helperText('Plan ascuns public, folosit pentru tenant-i demo cu features deblocate.')
->default(false),
Forms\Components\TextInput::make('trial_days')
->label('Perioadă trial (zile)')
->numeric()->placeholder('null = fără trial')
->helperText('Numărul de zile gratis după ce un tenant alege acest plan.'),
]),
Schemas\Components\Section::make('Preț')
->columns(3)
@@ -86,7 +94,10 @@ class PlanResource extends Resource
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')->searchable()->sortable(),
Tables\Columns\TextColumn::make('name')
->searchable()->sortable()
->weight('bold')
->description(fn ($record) => $record->is_demo ? '🎬 Demo' : ($record->trial_days ? "🎁 {$record->trial_days} zile trial" : null)),
Tables\Columns\TextColumn::make('price_monthly')
->money(fn ($record) => $record->currency)
->label('Lunar')