@extends('layouts.app') @section('title', 'Client Management') @section('content') @php $qParams = request()->query(); $hasFilters = filled($filters['q']) || filled($filters['status']); @endphp

Client Management

All clients, their projects and invoice history

Excel PDF
Clear
@if($importSummary)

Last import

{{ ($importSummary['created'] ?? 0) }} created, {{ ($importSummary['updated'] ?? 0) }} updated, {{ ($importSummary['skipped'] ?? 0) }} skipped.

@if(!empty($importSummary['errors'])) @endif
@endif

Total Clients

{{ $totalClients }}

Active Contracts

{{ $activeContracts }}

Total Receivable

{{ \App\Support\Format::mwk($totalReceivable) }}

Overdue

{{ \App\Support\Format::mwk($overdueAmount) }}

@if($clients->total() === 0)
@if($hasFilters)

No clients match your filters

Try changing your search or status filter.

Clear filters @else

No clients found

Add your first client or import clients from Excel.

@endif
@else

All Clients

@foreach($clients as $c) @php $overdue = (float) ($c->overdue_amount ?? 0); $displayStatus = $overdue > 0 ? 'Overdue' : 'Good Standing'; @endphp @endforeach
Client NameContact PersonPhone TIN NumberProjectsOutstanding Status

{{ $c->company_name }}

@if($c->email)

{{ $c->email }}

@endif
{{ $c->contact_person ?: 'Not provided' }} {{ $c->phone ?: 'Not provided' }} {{ $c->tin_number ?: 'Not provided' }} {{ (int) ($c->projects_count ?? 0) }} {{ \App\Support\Format::mwk($c->outstanding_balance ?? 0) }} {{ $displayStatus }} View
@if($clients->hasPages())

Showing {{ $clients->firstItem() }}–{{ $clients->lastItem() }} of {{ $clients->total() }}

@if ($clients->onFirstPage()) Previous @else Previous @endif @if ($clients->hasMorePages()) Next @else Next @endif
@endif @endif
@include('clients.partials.import-clients-modal', ['overlayId' => 'modal-import-clients-page']) @endsection @push('scripts') @endpush