@extends('layouts.admin') @section('title', 'Tenant Billing — ' . $user->name) @push('styles') @endpush @section('content') @if (session('success'))
{{ session('success') }}
@endif @if (session('error'))
{{ session('error') }}
@endif @forelse ($tenants as $tenant) @php $plan = $plans[$tenant->plan] ?? null; $u = $usage[$tenant->id] ?? ['products' => 0, 'staff' => 0, 'orders_total' => 0, 'max_products' => $tenant->max_products, 'max_staff' => $tenant->max_staff]; $maxProducts = max(1, (int) ($u['max_products'] ?: 1)); $maxStaff = max(1, (int) ($u['max_staff'] ?: 1)); $productsPct = min(100, round(($u['products'] / $maxProducts) * 100)); $staffPct = min(100, round(($u['staff'] / $maxStaff) * 100)); @endphp

{{ $tenant->name }} ({{ $tenant->slug }})

Current Plan
{{ $plan->name ?? ucfirst($tenant->plan ?? 'free') }}
Status
{{ ucfirst($tenant->status) }}
Monthly Price
{{ $plan ? '$' . number_format($plan->price_monthly, 2) : '—' }}
Subscription Ends
{{ $tenant->subscription_ends_at ? \Carbon\Carbon::parse($tenant->subscription_ends_at)->format('M d, Y') : '—' }}

Usage vs Limits

Products: {{ $u['products'] }} / {{ $u['max_products'] }} {{ $productsPct }}%
Staff: {{ $u['staff'] }} / {{ $u['max_staff'] }} {{ $staffPct }}%
Total orders: {{ $u['orders_total'] }}

Grant Complimentary Plan

Instantly activate a plan at no charge — for manual payments, comped accounts, or one-off support. User will be emailed as "Complimentary" and the billing history will show it.

Billing History

@php $tenantInvoices = $invoicesByTenant[$tenant->id] ?? collect(); @endphp @if ($tenantInvoices->isEmpty())

No billing history on record.

@else @foreach ($tenantInvoices as $inv) @php $isComp = ($inv->gateway ?? '') === 'admin_override'; @endphp @endforeach
Date Plan Cycle Amount Status Gateway Reference Invoice
{{ \Carbon\Carbon::parse($inv->created_at)->format('M d, Y') }} {{ optional($inv->plan)->name ?? '—' }} {{ ucfirst($inv->billing_cycle ?? 'monthly') }} @if($isComp) Complimentary @else ${{ number_format($inv->amount ?? 0, 2) }} @endif {{ ucfirst($inv->status ?? 'unknown') }} {{ $isComp ? 'Admin override' : ucfirst($inv->gateway ?? '—') }} {{ $inv->reference ?? $inv->id }} @if(($inv->status ?? '') === 'completed') PDF @else @endif
@endif
@empty

This user has no inventory tenants.

@endforelse @endsection