@php function usageFormatBytes($bytes, $isLimit = false) { if ($isLimit && ($bytes === null || $bytes <= 0)) return __('Unlimited'); if ($bytes <= 0) return '0 B'; $units = ['B', 'KB', 'MB', 'GB', 'TB']; $power = (int) floor(log($bytes, 1024)); return number_format($bytes / (1024 ** $power), 1) . ' ' . $units[$power]; } function usagePct($used, $limit) { if (!$limit || $limit <= 0) return 0; return min(100, round(($used / $limit) * 100)); } function usageBarColor($pct) { if ($pct >= 90) return 'bg-red-500'; if ($pct >= 70) return 'bg-amber-500'; return 'bg-green-500'; } @endphp
{{-- ── Plan Overview Header ──────────────────────────────────── --}}

{{ __('Current Plan:') }} {{ $usage['plan'] ? $usage['plan']->name : __('Free') }}

{{ __('Your quotas and feature access based on your active subscription.') }}

@if($usage['plan'])
{{ __('Active') }}
@if($usage['plan']->price > 0) {{ \App\Support\FormatSettings::currencyConfig()['symbol'] }}{{ number_format($usage['plan']->price, 2) }} / {{ $usage['plan']->billing_cycle ?? 'mo' }} @else {{ __('Free Tier') }} @endif @else {{ __('No Plan') }} @endif {{ __('Upgrade Plan') }}
{{-- ── Quota Bars ──────────────────────────────────────────────── --}}
{{-- Events --}} @php $pct = usagePct($usage['events']['used'], $usage['events']['limit']); @endphp

{{ __('Active Events') }}

{{ number_format($usage['events']['used']) }}

{{ __('of') }} {{ $usage['events']['limit'] ? number_format($usage['events']['limit']) : __('Unlimited') }}

@if($usage['events']['limit'])
{{ __('Used') }}{{ $pct }}%
@if($pct >= 90)

{{ __('⚠ Limit almost reached') }}

@endif @endif
{{-- Images --}} @php $pct = usagePct($usage['images']['used'], $usage['images']['limit']); @endphp

{{ __('Photos') }}

{{ number_format($usage['images']['used']) }}

{{ __('of') }} {{ $usage['images']['limit'] ? number_format($usage['images']['limit']) : __('Unlimited') }}

@if($usage['images']['limit'])
{{ __('Used') }}{{ $pct }}%
@if($pct >= 90)

{{ __('⚠ Limit almost reached') }}

@endif @endif
{{-- Videos --}} @php $pct = usagePct($usage['videos']['used'], $usage['videos']['limit']); @endphp

{{ __('Videos') }}

{{ number_format($usage['videos']['used']) }}

{{ __('of') }} {{ $usage['videos']['limit'] ? number_format($usage['videos']['limit']) : __('Unlimited') }}

@if($usage['videos']['limit'])
{{ __('Used') }}{{ $pct }}%
@if($pct >= 90)

{{ __('⚠ Limit almost reached') }}

@endif @endif
{{-- Storage --}} @php $pct = usagePct($usage['storage']['used'], $usage['storage']['limit']); @endphp

{{ __('Storage') }}

{{ usageFormatBytes($usage['storage']['used']) }}

{{ __('of') }} {{ usageFormatBytes($usage['storage']['limit'], true) }}

@if($usage['storage']['limit'] > 0)
{{ __('Used') }}{{ $pct }}%
@if($pct >= 90)

{{ __('⚠ Limit almost reached') }}

@endif @endif
{{-- Max file size info --}} @if($usage['max_file_size_mb'])
{{ __('Max upload file size:') }} {{ $usage['max_file_size_mb'] }} MB {{ __('per file') }}
@endif {{-- ── Features Grid ───────────────────────────────────────────── --}}

{{ __('Plan Features') }}

@php $features = [ ['key' => 'has_watermark', 'label' => 'Watermark', 'desc_on' => 'System watermark applied to your images.', 'desc_off' => 'No watermark on your photos.', 'invert' => true, 'icon' => ''], ['key' => 'has_design_editor', 'label' => 'Design Editor', 'desc_on' => 'Customize event pages with full design control.', 'desc_off' => 'Upgrade to access the custom design editor.','invert' => false, 'icon' => ''], ['key' => 'has_guest_upload', 'label' => 'Guest Uploads', 'desc_on' => 'Guests can contribute their own photos to events.', 'desc_off' => 'Upgrade to allow guests to upload photos.', 'invert' => false, 'icon' => ''], ['key' => 'has_google_drive_import', 'label' => 'Google Drive Import', 'desc_on' => 'Import albums directly from Google Drive.', 'desc_off' => 'Upgrade to import from Google Drive.', 'invert' => false, 'icon' => ''], ['key' => 'has_ftp_import', 'label' => 'FTP / Camera Import', 'desc_on' => 'Auto-import photos via WiFi FTP from your camera.', 'desc_off' => 'Upgrade to use FTP camera tethering.', 'invert' => false, 'icon' => ''], ['key' => 'has_custom_branding', 'label' => 'Custom Branding', 'desc_on' => 'Remove platform branding from your galleries.', 'desc_off' => 'Upgrade to remove platform branding.', 'invert' => false, 'icon' => ''], ['key' => 'has_cloud_storage', 'label' => 'Cloud Storage', 'desc_on' => 'Media stored on cloud (S3/GCS) for scalability.', 'desc_off' => 'Upgrade to enable cloud storage (S3/GCS).', 'invert' => false, 'icon' => ''], ]; @endphp @foreach($features as $feat) @php $enabled = $usage['features'][$feat['key']]; $positive = $feat['invert'] ? !$enabled : $enabled; @endphp
$positive, 'bg-red-500/10 text-red-400' => !$positive, ])> @if($positive) @else @endif

{{ $feat['label'] }}

$positive, 'bg-red-100 text-red-600' => !$positive])> {{ $positive ? __('Enabled') : __('Locked') }}

{{ $positive ? $feat['desc_on'] : $feat['desc_off'] }}

@endforeach
{{-- ── Upgrade Banner ──────────────────────────────────────────── --}} @if(!$usage['plan'] || $usage['plan']->price <= 0)

{{ __('Unlock Higher Limits & Pro Features') }}

{{ __('Upgrade to get more storage, more events, remove watermarks, guest uploads, cloud storage, and the design editor.') }}

{{ __('Upgrade Now →') }}
@endif