@php $currentSort = request()->query('sort', ''); $currentDir = request()->query('dir', ''); if (! in_array($currentDir, ['asc', 'desc'], true)) { $currentDir = ''; } $showSorting = $data->isNotEmpty(); $sortIcon = function (string $col) use ($currentSort, $currentDir, $showSorting) { if (! $showSorting) { return ''; } $active = $currentSort === $col; $upActive = $active && $currentDir === 'asc'; $downActive = $active && $currentDir === 'desc'; $upClass = $upActive ? 'text-white' : 'text-white/40'; $downClass = $downActive ? 'text-white' : 'text-white/40'; return sprintf( '', $upClass, $downClass ); }; $sortableTh = function (string $col) use ($showSorting) { return $showSorting ? sprintf('data-sort="%s" class="cursor-pointer select-none"', e($col)) : ''; }; @endphp
{{ __('form.label.user') }} {!! $sortIcon('user') !!}
{{ __('pages/admin/subscription.table.plan') }} {{ __('form.label.status') }} {{ __('pages/admin/subscription.table.stripe_subscription') }}
{{ __('pages/admin/subscription.table.started') }} {!! $sortIcon('started') !!}
{{ __('buttons.action') }}
@foreach($data as $sub) @php $user = $sub->user; $plan = $sub->stripe_price ? \App\Support\SubscriptionPlanResolver::planForStripePrice($sub->stripe_price) : null; @endphp
{{ $user?->full_name ?? __('pages/common.empty') }}
{{ $user?->email ?? __('pages/common.empty') }}
{{ $plan?->name ?? __('pages/common.empty') }} {{ \App\Support\SubscriptionStatusLabel::for($sub->stripe_status) }} {{ $sub->stripe_id }} {{ $sub->created_at?->format('M d, Y') ?? __('pages/common.empty') }}
@if($user) @if(in_array($sub->stripe_status, ['active','trialing','past_due','unpaid'], true) && ! $sub->ends_at) @endif @endif
@endforeach @if($data->isEmpty() && ($totalSubscriptions ?? 0) > 0)

{{ __('pages/admin/subscription.no_records') }}

{{ __('pages/admin/subscription.no_records_filtered') }}

{{ __('buttons.filter.clear') }}
@endif
{{ $data->links('components.ajax-pagination') }}