@extends('layouts.app') @section('header')

Dashboard Overview

@endsection @section('content')

Total Properties

{{ $stats['total_properties'] ?? 0 }}

+{{ $stats['properties_change'] ?? 0 }}% from last month

Total Utility Bills

Ksh {{ number_format($stats['total_bills'] ?? 0) }}

{{ ($stats['bills_change'] ?? 0) >= 0 ? '+' : '' }}{{ $stats['bills_change'] ?? 0 }}% from last month

Monthly Payments

Ksh {{ number_format($stats['monthly_payments'] ?? 0) }}

{{ ($stats['payment_change'] ?? 0) >= 0 ? '+' : '' }}{{ $stats['payment_change'] ?? 0 }}% from last month

Monthly Rent and Service Bill

Ksh {{ number_format($stats['total_rent'] ?? 0) }}

{{ ($stats['rent_change'] ?? 0) >= 0 ? '+' : '' }}{{ $stats['rent_change'] ?? 0 }}% from last month

Property Portfolio

View All Properties
@php $displayProperties = array_slice($stats['recent_properties'], 0, 4); @endphp @forelse($displayProperties as $property)

{{ $property['name'] }}

{{ $property['location'] }}

{{ $property['occupancy_rate'] }}%
occupancy

Units

{{ $property['units_occupied'] ?? 0 }}/{{ $property['units_total'] ?? 0 }}

Monthly Rent

Ksh {{ number_format($property['rent'] ?? 0) }}

@empty

No properties

Get started by adding a new property.

@endforelse @if(count($stats['recent_properties']) > 4) @endif

Recent Payments

View All
@forelse($stats['recent_payments'] as $payment) @empty @endforelse
Customer Payment # Amount Date Status
{{ $payment->customer->CustomerName ?? 'N/A' }}
{{ $payment->customer->PhoneNumber ?? '' }}
#{{ $payment->PaymentID }}
Ksh {{ number_format($payment->TotalPayment, 2) }}
{{ \Carbon\Carbon::parse($payment->PaymentDate)->format('M d, Y') }}
{{ \Carbon\Carbon::parse($payment->PaymentDate)->diffForHumans() }}
@php $statusClass = [ 'Completed' => 'bg-green-50 text-green-700', 'Pending' => 'bg-yellow-50 text-yellow-700', 'Failed' => 'bg-red-50 text-red-700', 'Refunded' => 'bg-blue-50 text-blue-700', ][$payment->PaymentStatus ?? 'Completed'] ?? 'bg-gray-50 text-gray-700'; @endphp {{ $payment->PaymentStatus ?? 'Completed' }}

No recent payments found

Payments will appear here when available

Recent Rent Bills

View Details
@forelse($stats['recent_bills'] as $bill) @php $isOverdue = isset($bill['due_date']) && \Carbon\Carbon::parse($bill['due_date'])->isPast() && $bill['status'] !== 'Paid'; $statusClass = [ 'Paid' => 'bg-green-50 text-green-700', 'Overdue' => 'bg-red-50 text-red-700', 'Pending' => 'bg-yellow-50 text-yellow-700', 'Draft' => 'bg-gray-50 text-gray-700', ][$isOverdue ? 'Overdue' : $bill['status']] ?? 'bg-blue-50 text-blue-700'; $statusIcon = [ 'Paid' => 'fa-check-circle', 'Overdue' => 'fa-exclamation-circle', 'Pending' => 'fa-clock', 'Draft' => 'fa-file-alt', ][$isOverdue ? 'Overdue' : $bill['status']] ?? 'fa-file-invoice'; @endphp @empty @endforelse
Bill # Customer Type Amount Due Date Status
#{{ $bill['id'] }}
{{ $bill['customer_name'] ?? 'N/A' }}
{{ $bill['customer_phone'] ?? '' }}
{{ $bill['type'] ?? 'N/A' }}
Ksh {{ number_format($bill['amount'] ?? 0, 2) }}
{{ $bill['due_date'] ?? 'N/A' }} @if(isset($bill['due_date'])) {{ \Carbon\Carbon::parse($bill['due_date'])->diffForHumans() }} @endif
{{ $isOverdue ? 'Overdue' : ($bill['status'] ?? 'N/A') }}

No recent bills found

Bills will appear here when available

@endsection