@extends('layouts.customer') @section('title', 'Usage') @section('page-title', 'Usage') @section('content')
@php $metricLabels = [ 'emails_sent_this_month' => 'Emails sent (this month)', 'email_validation_emails_this_month' => 'Email validation', 'lists_count' => 'Email Lists', 'subscribers_count' => 'Subscribers', 'campaigns_count' => 'Campaigns', 'bounce_servers_count' => 'Bounce Servers', 'tracking_domains_count' => 'Tracking Domains', 'sending_domains_count' => 'Sending Domains', 'ai_tokens_used' => 'AI tokens', ]; $metricDescriptions = [ 'emails_sent_this_month' => 'Emails sent in the current month.', 'email_validation_emails_this_month' => 'Emails validated in the current month.', 'lists_count' => 'Total email lists you have created.', 'subscribers_count' => 'Confirmed subscribers across all lists.', 'campaigns_count' => 'Total campaigns you have created.', 'bounce_servers_count' => 'Bounce servers you have added.', 'tracking_domains_count' => 'Tracking domains you have added.', 'sending_domains_count' => 'Sending domains you have added.', 'ai_tokens_used' => 'AI tokens used under your plan limits (admin keys only).', ]; $metricSubtitles = [ 'emails_sent_this_month' => 'Monthly usage', 'email_validation_emails_this_month' => 'Monthly usage', 'lists_count' => 'Count', 'subscribers_count' => 'Count', 'campaigns_count' => 'Count', 'bounce_servers_count' => 'Count', 'tracking_domains_count' => 'Count', 'sending_domains_count' => 'Count', 'ai_tokens_used' => 'Plan usage', ]; @endphp

Current Plan

@if($subscription)
{{ $subscription->plan_name }} ({{ ucfirst($subscription->status) }})
@else
No subscription found.
@endif
@if(isset($accessBoxes) && is_array($accessBoxes) && count($accessBoxes) > 0)

Access

@foreach($accessBoxes as $box) @php $label = (string) ($box['label'] ?? ''); $hasAccess = (bool) ($box['has_access'] ?? false); @endphp
{{ $label }}
@if($hasAccess) Access @else No access @endif
@endforeach
@endif

Usage

Your usage is renewed every month

@forelse($usageWithLimits as $row) @php $metric = $row['metric']; $label = $metricLabels[$metric] ?? ucwords(str_replace('_', ' ', $metric)); $desc = $metricDescriptions[$metric] ?? ''; $subtitle = $metricSubtitles[$metric] ?? ''; $hasAccess = array_key_exists('has_access', $row) ? (bool) $row['has_access'] : true; $current = (int) ($row['current'] ?? 0); $limit = $row['limit'] ?? null; $percent = null; if ($hasAccess && $limit !== null && (int) $limit > 0) { $percent = min(100, max(0, ($current / (int) $limit) * 100)); } @endphp
@switch($metric) @case('emails_sent_this_month') @break @case('email_validation_emails_this_month') @break @case('lists_count') @break @case('subscribers_count') @break @case('campaigns_count') @break @case('bounce_servers_count') @break @case('tracking_domains_count') @break @case('sending_domains_count') @break @default @endswitch
{{ $label }}
@if($subtitle !== '')
{{ $subtitle }}
@endif
@if(!$hasAccess)
You have no access here
@else
{{ $current }} of {{ $limit !== null ? $limit : 'Unlimited' }}
@if($percent !== null)
{{ number_format($percent, 1) }}% used
@endif @endif
@empty
No usage logged for this period.
@endforelse
@endsection