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
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="ro">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Instrucțiuni transfer bancar {{ $sub->invoice_number }}</title>
<style>
body { font-family: system-ui, sans-serif; background: #f3f4f6; padding: 24px; color: #1f2937; }
.box { max-width: 600px; margin: 0 auto; background:#fff; padding:24px; border-radius:12px; box-shadow:0 4px 12px rgba(0,0,0,.05); }
h1 { font-size: 20px; margin-bottom: 12px; }
.row { padding: 8px 0; border-bottom: 1px dashed #e5e7eb; display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.row b { color:#111827; }
.row code { background: #f9fafb; padding: 4px 8px; border-radius: 4px; font-family: ui-monospace, monospace; cursor: pointer; }
.ref-box { background: #fef3c7; border-left: 4px solid #f59e0b; padding: 14px 16px; border-radius: 6px; margin-top: 16px; font-size: 13px; line-height: 1.6; }
.btn-back { display:inline-block; margin-top: 16px; padding: 10px 20px; background: {{ $themeColor }}; color: #fff; border-radius: 8px; text-decoration: none; font-size: 14px; }
</style>
</head>
<body>
<div class="box">
<h1>🏦 Instrucțiuni transfer bancar</h1>
<div class="row"><span>Beneficiar:</span> <b>{{ $bank['beneficiary'] ?? '—' }}</b></div>
<div class="row"><span>IBAN:</span> <code onclick="navigator.clipboard.writeText(this.textContent)">{{ $bank['iban'] ?? '—' }}</code></div>
<div class="row"><span>BIC / SWIFT:</span> <code>{{ $bank['bic'] ?? '—' }}</code></div>
<div class="row"><span>Banca:</span> {{ $bank['bank_name'] ?? '—' }}</div>
<div class="row"><span>Sumă:</span> <b>{{ number_format($sub->amount, 2) }} {{ $sub->currency }}</b></div>
<div class="ref-box">
<b> Important la „Detalii plată" / „Reference" scrie EXACT:</b><br>
<code style="font-size:14px;font-weight:700;display:block;margin:8px 0;padding:8px;background:#fff;border-radius:4px;">{{ $sub->invoice_number ?? 'INV-' . $sub->id }}</code>
Fără acest cod, plata va fi greu de identificat.
</div>
@if (! empty($bank['instructions']))
<p style="margin-top:16px;font-size:13px;line-height:1.6;color:#4b5563;">{{ $bank['instructions'] }}</p>
@endif
<div style="margin-top:20px;padding-top:16px;border-top:1px solid #e5e7eb;font-size:12px;color:#6b7280;line-height:1.6;">
După efectuarea transferului:
<ul style="margin: 8px 0 0 20px;">
<li>Plata apare în 1-3 zile lucrătoare</li>
<li>Operatorul confirmă manual factura ca plătită</li>
<li>Abonamentul se extinde automat</li>
</ul>
</div>
<a href="/billing" class="btn-back"> Înapoi la facturi</a>
</div>
</body>
</html>