@extends('layouts.front.app') @section('title', __('pages/subscription.dashboard.title')) @section('content')

{{ __('pages/subscription.dashboard.billing') }}

{{ __('pages/subscription.dashboard.title') }}

{{ __('pages/subscription.dashboard.subtitle') }}

{{ __('pages/subscription.dashboard.current.title') }}

@if($activeSubscription) {{ __('pages/subscription.dashboard.current.subtitle_active') }} @else {{ __('pages/subscription.dashboard.current.subtitle_empty') }} @endif

@if($activeSubscription) @if($onTrial ?? false)
{!! __('pages/subscription.dashboard.current.trial_ends', [ 'date' => ''.e($trialEndsAt?->format('M d, Y') ?? __('pages/common.empty')).'', ]) !!}
@endif @if($pendingPlan ?? null)
{!! __('pages/subscription.dashboard.current.pending_switch', [ 'plan' => ''.e($pendingPlan->name).'', 'date' => ''.e($activeSubscription->pending_plan_effective_at?->format('M d, Y') ?? __('pages/subscription.dashboard.current.next_billing_fallback')).'', 'current' => ''.e($currentPlan?->name ?? __('pages/subscription.dashboard.current.current_plan_fallback')).'', ]) !!}
@endif
{{ __('pages/subscription.buttons.current_plan') }}
{{ $currentPlan?->name ?? __('pages/common.empty') }}
@if($pendingPlan ?? null)
{{ __('pages/plans.cards.next_plan') }}
{{ $pendingPlan->name }}
{{ __('pages/subscription.dashboard.current.labels.starts', [ 'date' => $activeSubscription->pending_plan_effective_at?->format('M d, Y') ?? __('pages/subscription.dashboard.current.next_billing_date_fallback'), ]) }}
@endif
{{ __('form.label.status') }}
{{ \App\Support\SubscriptionStatusLabel::for($activeSubscription->stripe_status) }}
{{ ($onTrial ?? false) ? __('pages/subscription.dashboard.current.labels.first_charge') : __('pages/subscription.dashboard.current.labels.next_billing') }}
{{ $nextBilling?->format('M d, Y') ?? __('pages/common.empty') }}
{{ __('pages/subscription.dashboard.current.labels.amount') }}
@if($currentPrice && $currentPlan) @else {{ __('pages/common.empty') }} @endif
{{ __('pages/subscription.dashboard.current.labels.started') }}
{{ $activeSubscription->created_at?->format('M d, Y') ?? __('pages/common.empty') }}
@if($activeSubscription->onGracePeriod())
{{ __('pages/subscription.dashboard.current.labels.access_until') }}
{{ $activeSubscription->ends_at?->format('M d, Y') ?? __('pages/common.empty') }}
@endif
@if($activeSubscription->valid() && ! $activeSubscription->canceled())
@csrf
@endif @if($activeSubscription->onGracePeriod())
@csrf
@endif
@if($activeSubscription->onGracePeriod())
{!! __('pages/subscription.dashboard.current.grace_period_notice', [ 'date' => ''.e($activeSubscription->ends_at?->format('M d, Y') ?? __('pages/subscription.dashboard.current.grace_period_fallback')).'', ]) !!}
@endif @else

{{ __('pages/subscription.dashboard.current.empty.title') }}

{{ __('pages/subscription.dashboard.current.empty.description') }}

{{ __('pages/subscription.buttons.choose_plan') }}
@endif
@if($activeSubscription)

{{ __('pages/subscription.dashboard.change_plan.title') }}

@if($onTrial ?? false) {{ __('pages/subscription.dashboard.change_plan.subtitle_trial') }} @elseif($hasScheduledPlanChange ?? false) {{ __('pages/subscription.dashboard.change_plan.subtitle_scheduled') }} @elseif($activeSubscription->onGracePeriod()) {{ __('pages/subscription.dashboard.change_plan.subtitle_grace') }} @elseif($canChangePlan ?? false) {{ __('pages/subscription.dashboard.change_plan.subtitle_available') }} @else {{ __('pages/subscription.dashboard.change_plan.subtitle_unavailable') }} @endif

@if($hasScheduledPlanChange ?? false)

{{ __('pages/subscription.dashboard.change_plan.scheduled_notice', [ 'plan' => $pendingPlan?->name, 'date' => $activeSubscription->pending_plan_effective_at?->format('M d, Y') ?? __('pages/subscription.dashboard.current.next_billing_fallback'), ]) }}

{{ __('pages/subscription.buttons.view_all_plans') }}
@elseif($activeSubscription->onGracePeriod())

{!! __('pages/subscription.dashboard.change_plan.grace_notice', [ 'resume' => ''.e(__('pages/subscription.buttons.resume_subscription')).'', ]) !!}

{{ __('pages/subscription.buttons.view_plans') }}
@elseif(! ($canChangePlan ?? false))

{{ __('pages/subscription.dashboard.change_plan.unavailable_notice') }}

{{ __('pages/subscription.buttons.view_plans') }}
@elseif($availablePlans->isEmpty())

{{ __('pages/subscription.dashboard.change_plan.no_other_plans') }}

@else
@foreach($availablePlans as $plan) @php $switchMode = \App\Support\SubscriptionPlanChange::switchMode($activeSubscription, $plan); $changeLabel = \App\Support\SubscriptionPlanChange::changeButtonLabel( $activeSubscription, $plan, __('pages/subscription.buttons.switch_plan') ); @endphp
{{ $plan->name }}
@if($plan->price) @else {{ __('pages/common.empty') }} @endif
@csrf
@endforeach
@endif
@endif

{{ __('pages/subscription.dashboard.history.title') }}

{{ __('pages/subscription.dashboard.history.subtitle') }}

{{ __('pages/subscription.dashboard.history.subscriptions') }}

@forelse($history as $sub) @php $planName = $sub->stripe_price ? \App\Support\SubscriptionPlanResolver::planForStripePrice($sub->stripe_price)?->name : null; @endphp @empty @endforelse
{{ __('pages/admin/subscription.table.plan') }} {{ __('form.label.status') }} {{ __('pages/admin/subscription.table.started') }} {{ __('pages/admin/subscription.table.ends') }}
{{ $planName ?? __('pages/common.empty') }} {{ \App\Support\SubscriptionStatusLabel::for($sub->stripe_status) }} {{ $sub->created_at?->format('M d, Y') ?? __('pages/common.empty') }} {{ $sub->ends_at?->format('M d, Y') ?? __('pages/common.empty') }}
{{ __('pages/subscription.dashboard.history.empty') }}

{{ __('pages/subscription.dashboard.invoices.title') }}

{{ __('pages/subscription.dashboard.invoices.subtitle') }}

@forelse($invoices as $invoice) @empty @endforelse
{{ __('pages/subscription.dashboard.invoices.table.invoice') }} {{ __('pages/subscription.dashboard.invoices.table.date') }} {{ __('pages/subscription.dashboard.invoices.table.amount') }} {{ __('form.label.status') }} {{ __('pages/subscription.dashboard.invoices.table.pdf') }}
{{ $invoice['number'] }} {{ $invoice['billing_date']->format('M d, Y') }} {{ $invoice['amount'] }} @php $invoiceStatusClass = match ($invoice['status']) { 'paid' => 'border-emerald-500/40 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200', 'open' => 'border-amber-500/40 bg-amber-500/10 text-amber-900 dark:text-amber-200', 'uncollectible', 'void' => 'border-red-500/40 bg-red-500/10 text-red-800 dark:text-red-200', default => 'border-border bg-muted/40 text-muted-foreground', }; @endphp {{ $invoice['status_label'] }} @if($invoice['can_download']) {{ __('pages/subscription.buttons.pdf') }} @else {{ __('pages/common.empty') }} @endif
{{ __('pages/subscription.dashboard.invoices.empty') }}
@endsection @push('before-app-js') @vite(['resources/js/user/subscription-actions.js']) @endpush