{{-- resources/views/clients/index.blade.php --}} @extends('layouts.finance.finance') @section('content')
{{-- Page Header --}}

Client Directory & Financials

{{-- Summary Cards --}}

Total Unique Clients

{{ $totalClients ?? 0 }}

Total Active Projects

{{ $activeProjectsCount ?? 0 }}

{{-- Clients Financial Table --}}

Client Overview

{{-- THIS IS THE NEW HEADER FOR THE BUTTON --}} @forelse ($clients as $clientName => $clientProjects) @php $totalProjects = $clientProjects->count(); // ADDED 'omd-active' right here: $executionProjects = $clientProjects->whereIn('status', ['active', 'in-progress', 'execution', 'Pending', 'omd-active'])->count(); $totalInvoiced = $clientProjects->flatMap->invoices->sum('amount') ?? 0; $totalCollected = $clientProjects->flatMap->receivableSchedules->where('status', 'paid')->sum('amount') ?? 0; $balanceDue = $totalInvoiced - $totalCollected; @endphp {{-- THIS IS THE NEW VIEW BUTTON --}} @empty @endforelse
Client Name Total Projects Projects in Execution Total Invoiced Total Collected Balance Due Action
{{ strtoupper(substr($clientName, 0, 1)) }}
{{ $clientName }}
{{ $totalProjects }} {{ $executionProjects }} Running Rs {{ number_format($totalInvoiced, 2) }} Rs {{ number_format($totalCollected, 2) }} Rs {{ number_format(max(0, $balanceDue), 2) }} View
No clients found.
@endsection