@extends('layouts.dashboard') @section('title', trans('dashboard.nav_subscription')) @section('header_title', trans('dashboard.nav_subscription')) @section('content')
{{-- Current Plan Status Card --}}
{{ trans('dashboard.current_plan') }}
{{ ucfirst($tenant->plan) }} {{ $currentInterval->label() }} @if($tenant->is_active) {{ trans('admin.active') }} @else {{ trans('admin.inactive') }} @endif
{{ trans('admin.env_label') }}
{{ $tenant->is_sandbox ? trans('dashboard.env_sandbox') : trans('dashboard.env_production') }}
{{ trans('dashboard.package_usage', ['used' => $used, 'limit' => $limit]) }} {{ $limit > 0 ? min(100, round(($used / $limit) * 100)) : 0 }}%
{{ trans('dashboard.documents_remaining', ['remaining' => $remaining]) }} @if($tenant->plan_expires_at) {{ trans('admin.expires_at') }}: {{ $tenant->plan_expires_at->format('Y-m-d') }} @endif
{{-- Pending Upgrade Request Notice --}} @if($pendingRequest)
{{ trans('dashboard.pending_upgrade_request_badge') }}
{{ trans('dashboard.pending_upgrade_notice', ['plan' => ucfirst($pendingRequest->requested_plan)]) }} @if($pendingRequest->billing_interval) — {{ $pendingRequest->billing_interval->label() }} @endif
@csrf @method('DELETE')
@endif {{-- Available Plans --}}
@forelse($plans as $plan) @php $isCurrent = $tenant->plan === $plan->slug && $currentInterval === $interval; $planName = $plan->displayName(); $planPrice = $plan->formattedPriceFor($interval); $invoiceLimit = $plan->monthly_invoice_limit; $deviceLimit = $plan->device_limit; $features = is_array($plan->features) ? $plan->features : []; $isPopular = $plan->is_popular; $isPendingTarget = $pendingRequest && $pendingRequest->requested_plan === $plan->slug && optional($pendingRequest->billing_interval)->value === $interval->value; $checkoutUrl = route('dashboard.subscription.checkout', ['plan' => $plan->slug, 'interval' => $interval->value]); @endphp
@if($isPopular)
{{ trans('dashboard.popular_badge') }}
@endif @if($isPendingTarget)
{{ trans('dashboard.upgrade_req_pending') }}
@endif

{{ $planName }}

@if($isCurrent) {{ trans('dashboard.current_plan') }} @endif
{{ $planPrice }}
{{ $interval->value === 'yearly' ? trans('dashboard.billed_yearly') : trans('dashboard.billed_monthly') }}
{{ trans('dashboard.invoice_limit_label') }} {{ $invoiceLimit < 0 ? trans('dashboard.unlimited') : number_format($invoiceLimit) }}
@if($deviceLimit)
{{ trans('dashboard.devices_limit_label') }} {{ $deviceLimit < 0 ? trans('dashboard.unlimited') : $deviceLimit }}
@endif
@if(count($features) > 0)
    @foreach($features as $feat)
  • ✓ {{ $feat }}
  • @endforeach
@endif
@if($isCurrent) @elseif($isPendingTarget) @elseif($pendingRequest) @else {{ trans('dashboard.select_this_plan') }} @endif
@empty
{{ trans('dashboard.no_plans_available') }}
@endforelse
{{-- Upgrade Request History --}} @if($upgradeRequests->isNotEmpty())

{{ trans('dashboard.upgrade_request_history_title') }}

@foreach($upgradeRequests as $req) @endforeach
{{ trans('dashboard.upgrade_req_date') }} {{ trans('dashboard.upgrade_req_from') }} {{ trans('dashboard.upgrade_req_to') }} {{ trans('dashboard.billing_interval') }} {{ trans('dashboard.upgrade_req_notes') }} {{ trans('dashboard.upgrade_req_status') }}
{{ $req->created_at->format('Y-m-d') }} {{ $req->current_plan }} {{ $req->requested_plan }} {{ $req->billing_interval?->label() ?? '—' }} {{ $req->client_notes ?: '—' }} @php $statusColors = [ 'pending' => 'bg-amber-500/10 text-amber-400', 'approved' => 'bg-emerald-500/10 text-emerald-400', 'rejected' => 'bg-rose-500/10 text-rose-400', 'cancelled' => 'bg-slate-700/40 text-slate-400', ]; @endphp {{ $req->statusLabel() }} @if($req->admin_notes)
{{ $req->admin_notes }}
@endif
@endif
@endsection