@extends('central.super.layout') @section('title', __('super.subscriptions.title')) @section('content') {{-- Summary cards --}}
@php $statuses = ['active', 'trial', 'pending', 'suspended', 'cancelled']; $statusIcons = ['active' => 'check-circle-fill', 'trial' => 'hourglass-split', 'pending' => 'clock-fill', 'suspended' => 'pause-circle-fill', 'cancelled' => 'x-circle-fill']; $statusIconBg = ['active' => 'stat-icon-success', 'trial' => 'stat-icon-info', 'pending' => 'stat-icon-warning', 'suspended' => 'stat-icon-warning', 'cancelled' => '']; @endphp @foreach($statuses as $st) @php $count = $subscriptions->where('status', $st)->count(); @endphp

{{ $count }}

{{ __('super.status.' . $st) }}

@endforeach
{{ $subscriptions->total() }} {{ Str::plural('subscription', $subscriptions->total()) }}
@forelse($subscriptions as $s) @php $tenantName = $s->tenant->company_name ?? $s->tenant_id; $tenantEmail = $s->tenant->admin_email ?? null; $colors = ['purple', 'blue', 'green', 'amber', 'rose']; $color = $colors[crc32($s->tenant_id) % count($colors)]; $initial = strtoupper(mb_substr($tenantName, 0, 1)); @endphp @empty @endforelse
{{ __('super.subscriptions.tenant') }} {{ __('super.subscriptions.plan') }} {{ __('super.common.status') }} {{ __('super.subscriptions.trial_ends') }} {{ __('super.subscriptions.ends_at') }} {{ __('super.payments.latest_payment') }}
{{ $initial }}
{{ $tenantName }} @if($tenantEmail) {{ $tenantEmail }} @endif
@if($s->plan)
{{ $s->plan->name }} {{ $currencySymbol }}{{ number_format($s->plan->price, 2) }}/{{ __('super.plans.mo') }} ยท {{ $currencySymbol }}{{ number_format($s->plan->yearly_price, 2) }}/{{ __('super.plans.yr') }}
@else โ€” @endif
{{ __('super.status.' . $s->status) }} @if($pendingUpgradeSubIds->contains($s->id)) {{ __('super.subscriptions.pending_upgrade') }} @endif @if($s->trial_ends_at) {{ $s->trial_ends_at->format('M d, Y') }} @if($s->trial_ends_at->isFuture()) {{ $s->trial_ends_at->diffForHumans() }} @else {{ __('super.status.expired') }} @endif @else โ€” @endif @if($s->ends_at) {{ $s->ends_at->format('M d, Y') }} @else {{ __('super.status.ongoing') }} @endif @php $latestPayment = $s->payments->first(); @endphp @if($latestPayment) {{ ucfirst($latestPayment->status) }} {{ $currencySymbol }}{{ number_format($latestPayment->amount, 2) }} · {{ $latestPayment->gateway_label }} @else โ€” @endif {{ __('super.common.view') }} {{ __('super.common.edit') }}

{{ __('super.subscriptions.no_subs') }}

{{ __('super.subscriptions.no_subs_desc') }}

@if($subscriptions->hasPages())
{{ $subscriptions->links('vendor.pagination.bootstrap-5') }}
@endif @push('scripts') @endpush @endsection