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,34 @@
<x-filament-panels::page>
<form wire:submit="save">
{{ $this->form }}
<div style="margin-top: 16px; display: flex; gap: 8px; justify-content: flex-end;">
<button type="submit"
class="fi-btn fi-btn-color-primary"
style="padding: 10px 24px; background: #6366f1; color: white; border-radius: 8px; border: none; cursor: pointer; font-weight: 500;"
wire:loading.attr="disabled">
<span wire:loading.remove>💾 Salvează setările</span>
<span wire:loading>Se salvează...</span>
</button>
</div>
</form>
<div style="margin-top:24px;background:#f9fafb;border:1px dashed #e5e7eb;border-radius:8px;padding:16px;font-size:13px;line-height:1.7;">
<b style="color:#6366f1;">📚 Cum se face plata în sistem:</b>
<ol style="margin:8px 0 0 18px;padding:0;">
<li>Operatorul (tu) creezi factură: <code>/admin/companies/{id}</code> „Generează factură"</li>
<li>Tenantul vede factura în interiorul lui la <code>https://{slug}.service.mir.md/billing</code></li>
<li>Click „Plătește" → opțiuni: card (Stripe), PayPal, sau transfer manual</li>
<li>La succes: webhook automat status=paid + extends company.active_until</li>
<li>La transfer manual: tenant trimite confirmare; operator click „Marchează plătit" în /admin/subscriptions</li>
</ol>
<div style="margin-top:12px;padding-top:12px;border-top:1px solid #e5e7eb;">
<b> Pentru a primi plăți LIVE:</b>
<ul style="margin:4px 0 0 18px;padding:0;font-size:12px;">
<li>Stripe: înregistrează cont la <a href="https://dashboard.stripe.com" target="_blank" style="color:#6366f1;">dashboard.stripe.com</a> ia keys setează webhook la URL-ul de mai sus</li>
<li>PayPal: <a href="https://developer.paypal.com/dashboard/applications" target="_blank" style="color:#6366f1;">developer.paypal.com</a> creează aplicație live ia credentials</li>
<li>Transfer bancar: pune doar IBAN-ul tău, fără cont gateway</li>
</ul>
</div>
</div>
</x-filament-panels::page>