@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.title') }} {!! $sortIcon('name') !!}
{{ __('form.label.status') }}
{{ __('pages/admin/plan.table.duration') }}
{{ __('pages/admin/plan.table.price') }} {!! $sortIcon('price') !!}
{{ __('pages/admin/plan.table.trial_days') }} {{ __('pages/admin/plan.table.actions') }}
@foreach($data as $plan) {{ $plan->name }} @if($plan->status === 'active') {{ __('buttons.active') }} @else {{ __('pages/admin/plan.status.archive') }} @endif {{ $plan->formatted_duration }} @php $price = $plan->price; @endphp @if($price) @if($plan->hasSalePrice())
@if($plan->discount_percentage) {{ __('pages/plans.pricing.discount_off', ['percent' => $plan->discount_percentage]) }} @endif
@else @endif @else {{ __('pages/common.empty') }} @endif @if(((int) ($plan->trial_days ?? 0)) <= 0) {{ __('pages/admin/plan.table.no_trial') }} @else {{ (int) $plan->trial_days }} {{ (int) $plan->trial_days === 1 ? __('pages/plans.duration.day') : __('pages/plans.duration.days') }} @endif
@if($plan->status === 'active' && ($stripeConfigured ?? false)) @endif
@endforeach @if($data->isEmpty() && ($totalPlans ?? 0) > 0)

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

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

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