@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif

{{ __('Billing & Plans') }}

{{ __('Manage your subscription and billing information.') }}

{{-- Tabs --}}
{{-- TAB: Plans --}}
{{-- Current plan --}}

{{ __('Current Plan') }}

{{ __('Your Plan') }}

{{ $currentPlan?->name ?? __('Free') }}

@if($subscription)

{{ ucfirst($subscription->billing_cycle ?? 'monthly') }} {{ __('billing') }} @if($subscription->current_period_end) · {{ __('Renews') }} {{ $subscription->current_period_end->format('M j, Y') }} @endif

@if($subscription->onTrial())

{{ __('Trial ends') }} {{ $subscription->trial_ends_at->diffForHumans() }}

@endif @if($subscription->onGracePeriod())

{{ __('Canceled - Access until') }} {{ $subscription->grace_period_ends_at->format('M j, Y') }}

@endif @endif
@if($subscription?->stripe_subscription_id) @endif
{{-- end plans current plan section --}} {{-- TAB: Usage --}}
@if(!empty($resourceUsage))

{{ __('Usage Overview') }}

@foreach($resourceUsage as $key => $resource) @php $used = $resource['used']; $limit = $resource['limit']; $isUnlimited = $limit === null; $percent = (!$isUnlimited && $limit > 0) ? min(100, round(($used / $limit) * 100)) : 0; $labels = [ 'contacts' => __('Contacts'), 'email_accounts' => __('Email Accounts'), 'team_members' => __('Team Members'), 'workflows' => __('Workflows'), 'kb_documents' => __('KB Documents'), 'ai_replies' => __('AI Replies / Month'), 'campaigns_per_month' => __('Campaigns / Month'), 'storage_mb' => __('Storage (MB)'), ]; $label = $labels[$key] ?? str_replace('_', ' ', ucfirst($key)); @endphp
{{ $label }} {{ number_format($used) }} @if($isUnlimited) / {{ __('Unlimited') }} @else / {{ number_format($limit) }} @endif
@if(!$isUnlimited)
@else
@endif
@endforeach
@else

{{ __('No active plan. Subscribe to see usage data.') }}

@endif
{{-- end usage tab --}} {{-- Plan comparison is visible on Plans tab --}}

{{ __('Available Plans') }}

@foreach($plans as $plan) @php $isCurrent = $currentPlan?->id === $plan->id; $price = $billingCycle === 'yearly' ? $plan->yearly_price : $plan->monthly_price; $monthlyEquiv = $billingCycle === 'yearly' ? round($price / 12, 2) : $price; @endphp @endforeach
{{-- end plans tab --}} {{-- TAB: History --}}
{{-- Billing History --}}

{{ __('Billing History') }}

@if($billingHistory->isEmpty())

{{ __('No payment history yet') }}

@else
@foreach($billingHistory as $payment) @php $statusColor = match($payment->status) { 'succeeded' => 'text-success', 'failed' => 'text-danger', 'pending' => 'text-warning', 'refunded' => 'text-info', default => 'text-muted', }; @endphp @endforeach
{{ __('Date') }} {{ __('Description') }} {{ __('Amount') }} {{ __('Status') }} {{ __('Gateway') }}
{{ $payment->created_at->format('M j, Y') }} {{ $payment->description ?? __('Payment') }} @currency($payment->amount) @if($payment->status === 'succeeded') @endif {{ ucfirst($payment->status) }} {{ ucfirst($payment->gateway_slug ?? 'stripe') }}
@endif
{{-- end history tab --}}