@extends('layouts.app') @section('title', 'Clients') @section('content')
{{-- Flash messages --}} @if (session('success'))
{{ session('success') }}
@endif @if (session('error'))
{{ session('error') }}
@endif {{-- Page header --}}

Clients

{{ $totalClients }} {{ Str::plural('client', $totalClients) }}

@can('clients.manage') Add Client @endcan
{{-- Stat cards --}} @php $withOutstanding = $clients->filter(fn ($c) => !empty($c->outstanding_by_currency))->count(); @endphp

Total Clients

{{ $totalClients }}

Total Projects

@php $totalProjects = $clients->sum('projects_count'); @endphp

{{ $totalProjects }}

With Outstanding

{{ $withOutstanding }}

invoices pending

{{-- Clients table --}}
@if ($clients->isEmpty())

No clients yet

Add your first client to get started

@can('clients.manage') Add Client @endcan
@else @foreach ($clients as $client) @php $symMap = ['GBP' => '£', 'USD' => '$', 'PKR' => 'Rs', 'AED' => 'AED']; @endphp @endforeach
Name Contact Projects Proposals Outstanding Actions
{{ $client->name }}

{{ $client->email }}

@if ($client->phone)

{{ $client->phone }}

@endif
{{ $client->projects_count }} {{ $client->proposals_count }} @if (empty($client->outstanding_by_currency)) Paid up @else @foreach ($client->outstanding_by_currency as $cur => $total)

{{ $symMap[$cur] ?? $cur }} {{ number_format($total, 2) }}

@endforeach @endif
View @can('clients.manage') Edit
@csrf @method('DELETE')
@endcan
@if ($clients->hasPages())

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

{{ $clients->links() }}
@endif @endif
@endsection