@extends('layouts.finance')
@section('title', 'Expenses')
@section('subtitle', 'Monthly running costs and breakdown')
@section('content')
@php
$dateFilter = $dateFilter ?? ['active' => false, 'from' => null, 'to' => null, 'label' => now()->startOfMonth()->format('d M Y').' to '.now()->endOfMonth()->format('d M Y')];
$expenseRouteParams = ($dateFilter['active'] ?? false) ? ['from' => $dateFilter['from'], 'to' => $dateFilter['to']] : [];
@endphp
@include('dashboard.cards._date-filter', ['dateFilter' => $dateFilter, 'filterRoute' => 'finance.expenses'])
@include('partials.kpi', ['label' => ($dateFilter['active'] ?? false) ? 'Filtered Total (PKR)' : 'Month Total (PKR)', 'value' => $metrics->money($monthTotal, 'PKR'), 'color' => '#ef4444'])
@include('partials.kpi', ['label' => 'Active Categories', 'value' => $categories->count()])
@include('partials.kpi', ['label' => 'Period', 'value' => ($dateFilter['active'] ?? false) ? $dateFilter['label'] : now()->format('M Y')])
@include('partials.kpi', ['label' => 'Click a tile to add entries', 'value' => ''])
@if($errors->any())
@foreach($errors->all() as $error)
{{ $error }}
@endforeach
@endif
@if(session('status'))
@endif
any()) open @endif>
Categories
+ Add Category
@php
$categoryIcons = [
'zap' => '',
'flame' => '',
'home' => '',
'users' => '',
'receipt' => '',
];
@endphp
@forelse($categories as $category)
@php
$categoryTotalPkr = (float) ($categoryTotalsPkr[$category->id] ?? 0);
@endphp
@empty
No expense categories yet. Click + Add Category above to create your first one.
@endforelse
Click any category to view entries and add new expenses
@endsection