@php // Computed once per row from the already-loaded relations, so a wide grid // does not turn into a query per column. $status = $customer->licenseStatus(); $expiry = $customer->expiresAt(); $lastSeen = $customer->lastVerificationAt(); $current = $customer->currentLicense(); $domain = $customer->domains->first()?->domain; $revenue = $customer->revenue(); @endphp {{-- data-id is what "select all on this page" reads, so selection stays scoped to the rows actually shown rather than to every id ever loaded. --}} {{-- Company: identity in one cell — logo, name, and the domain it runs on. --}} {{-- Contact: a person, with their own initials so the eye separates them from the company in the cell to the left. --}} {{ $customer->name }} {{ $customer->mobile ?: '—' }} {{ $customer->email }} @if ($expiry) {{ $expiry->format('d M Y') }} $status === 'expiring', 'text-red-600 dark:text-red-400' => $status === 'expired', 'text-slate-500 dark:text-slate-400' => ! in_array($status, ['expiring', 'expired']), ])>{{ $expiry->diffForHumans(short: true) }} @else — @endif @if ($lastSeen) {{ $lastSeen->diffForHumans(short: true) }} @else Never @endif {{-- Revenue reads as money earned, so it carries the positive colour. Zero stays neutral: nothing has been earned, and green would overstate it. --}} @if ($revenue > 0) Rs {{ number_format($revenue) }} @else Rs 0 @endif {{ $customer->created_at?->format('d M Y') }} View profile Edit
{{-- Domains and licences are filtered to this customer rather than dropping the user on an unfiltered list to find them again. --}} Domains Licences @if ($current)
{{-- Each licence action is its own form: they are POSTs that change state on a live installation, so none of them can be a link. --}}
@csrf Renew
@if ($current->status === \App\Models\License::STATUS_ACTIVE)
@csrf Suspend
@elseif ($current->status === \App\Models\License::STATUS_SUSPENDED)
@csrf Activate
@else Activate @endif @else
Renew Suspend @endif
@csrf @method('DELETE') Delete