@extends('layouts.app') @section('content')
Dashboard Welcome back, {{ Auth::user()->name }}!
{{ \App\Models\Client::count() }}
Total Clients
{{ \App\Models\Billing::count() }}
Billings
${{ number_format(\App\Models\Billing::sum('total_amount_due') ?? 0, 0) }}
Total Revenue
${{ number_format(\App\Models\Payment::sum('amount') ?? 0, 0) }}
Collected
${{ number_format(\App\Models\Payment::where('status', 'completed')->sum('amount') ?? 0, 0) }}
Completed Payments
Recent Billings
@if(\App\Models\Billing::count() > 0)
@foreach(\App\Models\Billing::latest()->limit(5)->get() as $billing) @endforeach
Client Amount Status Date
{{ $billing->client->name ?? 'N/A' }} ${{ number_format($billing->total_amount_due, 2) }} @if($billing->is_paid) Paid @elseif($billing->is_overdue) Overdue @else Pending @endif {{ $billing->created_at->format('M d, Y') }}
@else

No billings yet

@endif
Completed Payments
@php $completedPayments = \App\Models\Payment::where('status', 'completed')->latest()->limit(5)->get(); @endphp @if($completedPayments->count() > 0) @foreach($completedPayments as $payment)
@php $clientName = $payment->client->name ?? 'Unknown'; $typeLabel = match($payment->payment_type) { 'installation' => 'Installation Fee', 'reconnection' => 'Reconnection Fee', 'late_fee' => 'Late Fee', 'deposit' => 'Deposit', 'other' => 'Other', default => 'Billing Payment' }; @endphp

{{ $typeLabel }}

{{ $clientName }} - ${{ number_format($payment->amount, 2) }}

{{ $payment->created_at->diffForHumans() }}
@endforeach @else

No completed payments yet

@endif
Companies Overview
@if(auth()->user()->role->name === 'super_admin') @if(\App\Models\Company::count() > 0) @foreach(\App\Models\Company::latest()->limit(5)->get() as $company)

{{ $company->name }}

{{ $company->clients->count() }} clients • {{ $company->billings->count() }} billings

{{ $company->created_at->format('M d') }}
@endforeach @else

No companies yet

@endif @else

{{ auth()->user()->company->name }}

{{ auth()->user()->company->clients->count() }} clients • {{ auth()->user()->company->billings->count() }} billings

@endif
@endsection @section('styles') @endsection
System Info
Laravel Version:
12.44.0
PHP Version:
{{ phpversion() }}
Environment:
{{ config('app.env') }}
@endsection