@extends('layouts.app') @section('content')
Clients Management

Manage {{ $isSuperAdmin ? 'all' : '' }} clients for {{ $company->name ?? 'your company' }}

@if(session('success')) @endif
{{ $isSuperAdmin ? 'All Clients' : 'Clients' }}
@if($isSuperAdmin)
@endif
@if($selectedCompanyId) @endif
@if($clients->count() > 0)
@if($isSuperAdmin) @endif @foreach($clients as $client) @php // Calculate overdue and late payment info $overdueCount = $client->billings() ->where('status', '!=', 'paid') ->where('due_date', '<', now()) ->where('balance', '>', 0) ->count(); $latePaymentCount = \App\Models\BillingCharge::where('client_id', $client->id) ->lateFees()->where('status', '!=', 'voided')->count(); @endphp @if($isSuperAdmin) @endif @endforeach
NameCompanyAccount # Block # Lot # Meter # City Status Overdue Late Pay Actions
{{ $client->name }}{{ $client->company->name }}{{ $client->account_number }} {{ $client->block_number ?? 'N/A' }} {{ $client->lot_number ?? 'N/A' }} {{ $client->meter_number ?? 'N/A' }} {{ $client->city }} @if($client->status === 'active') Active @elseif($client->status === 'inactive') Inactive @else Disconnected @endif @if($overdueCount > 0) {{ $overdueCount }} @else None @endif @if($latePaymentCount > 0) {{ $latePaymentCount }} @else None @endif @if(Auth::user()->hasCompanyAdminAccess() || Auth::user()->isSuperAdmin())
@csrf @method('DELETE')
@endif
@else
No clients found. Add your first client
@endif
@endsection