@extends('backend.subscription.layout') @section('title', __('Subscription Details')) @section('sub_title', __('Subscription #:id', ['id' => $subscription->id])) @section('sub_icon', 'eye') @section('sub_subtitle', $subscription->user->name . ' - ' . $subscription->plan->name) @section('sub_action') @lang('Back to List') @endsection @section('sub_content') @php $user = $subscription->user; $plan = $subscription->plan; $billingCycleLabel = $subscription->billing_cycle?->label() ?? __('Custom'); $isLifetime = (bool) $subscription->billing_cycle?->isLifetime(); $amountPaid = $subscription->currency_code.' '.number_format($subscription->amount_paid,siteDecimalPlaces()); $transactionsTotal = $subscription->transactions->sum('amount'); $transactionsTotalFormatted = $subscription->currency_code.' '.number_format($transactionsTotal,siteDecimalPlaces()); $daysRemaining = $subscription->daysRemaining(); $periodStart = $subscription->current_period_start?->format('d M Y'); $periodEnd = $subscription->current_period_end?->format('d M Y'); $periodLabel = $isLifetime ? __('Lifetime access') : ($periodEnd ? __('Ends :date', ['date' => $periodEnd]) : __('No period set')); $periodMeta = $periodStart && $periodEnd ? __(':start to :end', ['start' => $periodStart, 'end' => $periodEnd]) : __('Period details unavailable'); $userInitials = collect(explode(' ', trim($user->name))) ->filter() ->take(2) ->map(fn (string $name): string => mb_substr($name, 0, 1)) ->implode('') ?: 'U'; @endphp
@lang('Subscription Control')

{{ $plan->name }}

{{ $user->name }} {{ $billingCycleLabel }} {{ __('ID #:id', ['id' => $subscription->id]) }}
{{ $subscription->status->label() }} @can('subscription-manage')
@if(! $subscription->isActive())
@csrf
@endif @if($subscription->isActive())
@csrf
@endif
@endcan
@lang('Amount Paid') {{ $amountPaid }}
@lang('Billing Cycle') {{ $billingCycleLabel }}
@lang('Access Window') @if($isLifetime) @lang('Lifetime') @elseif(! is_null($daysRemaining)) {{ trans_choice(':count day left|:count days left', $daysRemaining, ['count' => $daysRemaining]) }} @else @lang('Pending') @endif
@lang('Payment Total') {{ $transactionsTotalFormatted }}
@lang('Subscription Overview')
@lang('Lifecycle, billing, and renewal state')
{{ $subscription->auto_renew ? __('Auto-renew on') : __('Auto-renew off') }}
@lang('Plan') {{ $plan->name }} {{ $billingCycleLabel }}
@lang('Amount Paid') {{ $amountPaid }} {{ __('Recorded on subscription') }}
@lang('Started') {{ $subscription->started_at?->format('d M Y, H:i') ?? __('Not started') }} {{ $subscription->created_at->format('d M Y, H:i') }}
@lang('Current Period') {{ $periodLabel }} {{ $periodMeta }}
@lang('Trial Ends') {{ $subscription->trial_ends_at?->format('d M Y, H:i') ?? __('No trial') }} {{ __('Trial status tracking') }}
@lang('Grace Period Ends') {{ $subscription->grace_ends_at?->format('d M Y, H:i') ?? __('No grace period') }} {{ __('Post-expiry access window') }}
@lang('Wallet Reference') {{ $subscription->wallet_reference ?? __('Not available') }} {{ __('Payment ledger reference') }}
@lang('Cancelled At') {{ $subscription->cancelled_at?->format('d M Y, H:i') ?? __('Not cancelled') }} {{ $subscription->cancelled_by_admin ? __('Cancelled by admin') : __('No admin cancellation') }}
@if($subscription->notes)
@lang('Admin Notes')

{{ $subscription->notes }}

@endif
@lang('Payment History')
{{ trans_choice(':count transaction recorded|:count transactions recorded', $subscription->transactions->count(), ['count' => $subscription->transactions->count()]) }}
{{ $transactionsTotalFormatted }}
@forelse($subscription->transactions as $trx) @php $transactionStatusColor = match ($trx->status) { 'completed', 'success', 'paid' => 'success', 'pending', 'processing' => 'warning', 'failed', 'cancelled', 'refunded' => 'danger', default => 'secondary', }; @endphp @empty @endforelse
@lang('Type') @lang('Amount') @lang('TRX ID') @lang('Status') @lang('Date')
{{ __(ucfirst($trx->type)) }} {{ $trx->currency_code }} {{ number_format($trx->amount,siteDecimalPlaces()) }} {{ $trx->trx_id ?? __('Manual record') }} {{ __(ucfirst($trx->status)) }} {{ $trx->created_at->format('d M Y, H:i') }}
@lang('Subscriber') {{ '@'.$user->username }}
@lang('Username') {{ '@'.$user->username }}
@lang('Joined') {{ $user->created_at?->format('d M Y') ?? __('N/A') }}
@lang('Transactions') {{ $subscription->transactions->count() }}
@lang('View Profile')
@lang('Plan Features')
{{ $plan->features->count() }} @lang('configured')
@if($plan->is_featured) @lang('Featured') @endif
@forelse($plan->features as $feature)
{{ $feature->feature_label }} @if($feature->reset_cycle) {{ __('Resets :cycle', ['cycle' => $feature->reset_cycle]) }} @else {{ __(ucfirst($feature->feature_type)) }} @endif @if($feature->isUnlimited()) @lang('Unlimited') @elseif($feature->isToggle()) {{ $feature->isEnabled() ? __('On') : __('Off') }} @else {{ $feature->feature_value }} @endif
@empty @endforelse
@endsection