@extends('layouts.admin') @section('title', 'Wholesale accounts') @section('content') @php $money = fn (int $cents) => 'AUD '.number_format($cents / 100); $pills = [ ['label' => 'All', 'url' => route('admin.wholesale.accounts.index'), 'active' => ! request('status') && ! request('tier')], ['label' => 'Active', 'url' => route('admin.wholesale.accounts.index', ['status' => 'approved']), 'active' => request('status') === 'approved', 'count' => $stats['accounts']], ['label' => 'Suspended', 'url' => route('admin.wholesale.accounts.index', ['status' => 'suspended']), 'active' => request('status') === 'suspended'], ]; foreach ($tiers as $tier) { $pills[] = ['label' => $tier->name, 'url' => route('admin.wholesale.accounts.index', ['tier' => $tier->id]), 'active' => (int) request('tier') === $tier->id]; } @endphp Applications @if($stats['pending_applications']){{ $stats['pending_applications'] }}@endif Tiers Volume discounts
@foreach(request()->only('status', 'tier') as $key => $value)@endforeach
@forelse($companies as $company) @php $outstanding = (int) $company->outstanding_cents; $limit = (int) $company->credit_limit_cents; $ratio = $limit > 0 ? min(1, $outstanding / $limit) : 0; @endphp @empty @endforelse
CompanyTierTermsLifetime spendCredit usedTeamStatus
{{ $company->name }}
{{ $company->email }} · since {{ $company->wholesale_approved_at?->format('M Y') ?? '—' }}
@if($company->tier) {{ $company->tier->name }} @else — @endif {{ $company->paymentTerm?->name ?? 'Proforma' }} {{ $money((int) $company->wholesale_spend_cents) }} @if($limit > 0)
{{ $money($outstanding) }}{{ $money($limit) }}
@else No credit line{{ $outstanding ? ' · '.$money($outstanding).' owing' : '' }} @endif
{{ $company->members_count }} {{ $company->wholesale_status === 'approved' ? 'active' : 'suspended' }} Open
{{ $companies->links() }}
@endsection