@php $fmt = fn ($v) => '$'.number_format((float) $v, 2); $cycleLabel = ['monthly' => '/mo', 'quarterly' => '/qtr', 'semiannual' => '/6mo', 'yearly' => '/yr', 'lifetime' => ' lifetime']; $statusBadge = [ 'trial' => 'bg-blue-500/15 text-blue-400', 'active' => 'bg-green-500/15 text-green-400', 'renewing' => 'bg-brand/20 text-brand-500', 'grace' => 'bg-amber-500/15 text-amber-400', 'suspended' => 'bg-amber-500/15 text-amber-400', 'expired' => 'bg-slate-500/15 text-slate-400', 'cancelled' => 'bg-red-500/15 text-red-400', ]; // Same platform colors as the dashboard (validated set). $platformMeta = \App\Services\UserDashboardMetrics::PLATFORM_META; // Edition-aware quota labels; rows not in the plan (limit 0, unused) are skipped below. $quotaLabels = collect(\App\Support\PlanLimits::QUOTA_LABELS)->except('max_storage_mb')->all(); $bar = function ($used, $limit) { if ($limit === null) return ['pct' => 6, 'text' => number_format($used).' / ∞', 'full' => false, 'warn' => false]; if ($limit == 0) return ['pct' => 0, 'text' => number_format($used).' / 0', 'full' => false, 'warn' => false]; $pct = min(100, round($used / $limit * 100)); return ['pct' => $pct, 'text' => number_format($used).' / '.number_format($limit), 'full' => $pct >= 100, 'warn' => $pct >= 85]; }; @endphp
{{-- Title row --}}

Billing & Subscription

Manage your plan, usage and invoices.

@if ($sub && $plan) @endif
{{-- Current plan --}} @if ($sub && $plan) @php($end = $sub->accessEndsAt()) @php($remaining = $sub->remainingDays())

{{ $plan->name }} plan

{{ $plan->productLabel() }} {{ ucfirst($sub->status) }}

{{ $fmt($sub->amount) }}{{ $cycleLabel[$sub->billing_cycle] ?? '' }}

{{ $remaining === null ? '∞' : $remaining }}
{{ $remaining === null ? 'lifetime access' : 'days remaining' }}
@if ($sub->onGrace())
Your subscription expired and is in a grace period — {{ $sub->graceRemainingDays() }} day(s) left. Renew now to avoid losing access.
@endif
Billing cycle
{{ ucfirst($sub->billing_cycle) }}
{{ $sub->onGrace() ? 'Grace ends' : 'Renews / expires' }}
{{ $end ? $end->format('M j, Y') : 'Never (lifetime)' }}
Auto-renew
{{ $sub->auto_renew ? 'On' : 'Off' }}
@if (in_array($sub->status, ['active', 'trial', 'grace', 'renewing'])) @endif
@else

You don't have an active plan

Choose a plan to unlock publishing, scheduling and automation.

@endif {{-- Usage --}}

Usage & Limits

Connected accounts
@forelse (collect($platformMeta)->filter(function ($meta, $key) use ($usage) { $a = $usage['accounts'][$key] ?? null; return $a && ! ($a['limit'] === 0 && $a['used'] === 0); }) as $key => [$label, $color, $short]) @php($b = $bar($usage['accounts'][$key]['used'], $usage['accounts'][$key]['limit']))
{{ $short }} {{ $label }} {{ $b['text'] }}
@empty

No platform accounts in your plan yet.

@endforelse
Publishing
@foreach ($quotaLabels as $key => $label) @php($q = $usage['quotas'][$key] ?? null) @continue(! $q || ($q['limit'] === 0 && $q['used'] === 0)) @php($b = $bar($q['used'], $q['limit']))
{{ $label }} {{ $b['text'] }}
@endforeach
{{-- Invoices --}}

Invoices

@forelse ($invoices as $inv)
{{ $inv->invoice_number }}
{{ optional($inv->issued_at)->format('M j, Y') }} · {{ ucfirst(str_replace('_', ' ', $inv->status)) }}
{{ $fmt($inv->total) }} PDF
@empty

No invoices yet.

@endforelse
{{-- Payment history --}}

Payment History

@forelse ($payments as $pay)
{{ $fmt($pay->amount) }}
{{ ucfirst(str_replace('_', ' ', $pay->gateway)) }} · {{ $pay->created_at->format('M j, Y') }}
{{ str_replace('_', ' ', $pay->status) }}
@empty

No payments yet.

@endforelse
{{-- Change plan modal --}} @if ($showChange)

Choose your plan

@foreach (['cloud' => ['cloud', 'Web Cloud', 'Runs on our servers'], 'desktop' => ['monitor', 'Desktop', 'Runs on your PC or VPS']] as $key => [$ic, $label, $sub2]) @endforeach
@error('selectedCycle')

{{ $message }}

@enderror
@if ($plans->isEmpty())

No {{ $productTab === 'cloud' ? 'Web Cloud' : 'Desktop' }} packages are available yet.

@endif
@foreach ($plans as $p) @php($price = $p->priceFor($selectedCycle)) @endforeach
@error('selectedPlanId')

{{ $message }}

@enderror {{-- Payment method (hidden entirely for free orders) --}} @if ($freeOrder)
Free plan — no payment method needed. Confirm and your plan activates instantly.
@else
@if (count($paymentMethods))
@foreach ($paymentMethods as $method) @endforeach
@php($chosen = collect($paymentMethods)->firstWhere('key', $selectedMethod)) @if ($chosen && $chosen['offline'] && $chosen['details'])
Pay to:
@if ($chosen['details']['account_name'])
Name: {{ $chosen['details']['account_name'] }}
@endif @if ($chosen['details']['account_number'])
{{ $chosen['details']['account_label'] }}: {{ $chosen['details']['account_number'] }}
@endif @if ($chosen['details']['instructions'])
{{ $chosen['details']['instructions'] }}
@endif
After paying, share your receipt — we'll confirm and activate your plan.
@endif @else

No payment methods are available yet. Please contact support.

@endif
@endif @unless ($freeOrder)

An invoice is emailed to you. Card methods activate instantly; manual methods activate once we confirm your payment.

@endunless
@endif {{-- Payment instructions for a pending offline order --}} @if (! empty($pendingOrder))

Complete your payment

Send {{ $pendingOrder['amount'] }} using the details below, then share your receipt. We'll confirm and activate your plan.

@if (! empty($pendingOrder['method']))
{{ $pendingOrder['method']['label'] }}
@if ($pendingOrder['method']['account_name'])
Name: {{ $pendingOrder['method']['account_name'] }}
@endif @if ($pendingOrder['method']['account_number'])
{{ $pendingOrder['method']['account_label'] }}: {{ $pendingOrder['method']['account_number'] }}
@endif @if ($pendingOrder['method']['instructions'])
{{ $pendingOrder['method']['instructions'] }}
@endif
@endif
Payment reference: {{ $pendingOrder['invoice'] }} — include this so we can match your payment.
@endif