{{ __('Financial Dashboard') }}

{{-- Flash Messages --}} @if (session('success'))

{{ session('success') }}

@endif @if (session('error'))

{{ session('error') }}

@endif {{-- ============================================================ --}} {{-- Summary Cards --}} {{-- ============================================================ --}}
{{-- Total Revenue --}}

Total Revenue

Rs{{ number_format($totalRevenue, 2) }}

Across all projects

{{-- Total Expenses --}}

Total Expenses

Rs{{ number_format($totalExpenses, 2) }}

All operational costs

{{-- Profit --}}
@if($profit >= 0) @else @endif

Net Profit

{{ $profit >= 0 ? '' : '-' }}Rs{{ number_format(abs($profit), 2) }}

{{ $profit >= 0 ? 'Profitable' : 'Operating at a loss' }}

@if($profit > 0) @endif
{{-- Profit Distribution Modal --}} @if($profit > 0) @endif {{-- ============================================================ --}} {{-- Date Filter for Payments --}} {{-- ============================================================ --}}

Payment Report

@if($filteredPayments->count() > 0)
@foreach($filteredPayments as $payment) @endforeach
Date Project Client Amount Status
{{ $payment->paid_at->format('M d, Y') }} {{ $payment->project->name ?? '—' }} {{ $payment->client->name ?? '—' }} Rs{{ number_format($payment->amount, 2) }} {{ ucfirst($payment->status) }}
Total: Rs{{ number_format($filteredPayments->where('status', 'confirmed')->sum('amount'), 2) }}
@else

No payments found for this date range.

@endif
{{-- ============================================================ --}} {{-- Add Expense Form --}} {{-- ============================================================ --}}

Add New Expense

@csrf
{{-- ============================================================ --}} {{-- Expenses Table --}} {{-- ============================================================ --}}

Expenses

@if($expenses->count() > 0) @foreach($expenses as $expense) @endforeach
Date Category Description Amount
{{ \Carbon\Carbon::parse($expense->date)->format('M d, Y') }} @php $catStyles = [ 'server' => 'bg-blue-100 text-blue-800', 'facebook_marketing' => 'bg-purple-100 text-purple-800', 'google_ads' => 'bg-indigo-100 text-indigo-800', 'salary' => 'bg-green-100 text-green-800', 'software' => 'bg-cyan-100 text-cyan-800', 'office' => 'bg-amber-100 text-amber-800', 'other' => 'bg-gray-100 text-gray-700', ]; $catStyle = $catStyles[$expense->category] ?? 'bg-gray-100 text-gray-700'; @endphp {{ ucfirst(str_replace('_', ' ', $expense->category)) }} {{ $expense->description ?? '—' }} Rs{{ number_format($expense->amount, 2) }}
@else

No expenses recorded

Use the form above to add your first expense.

@endif
{{-- ============================================================ --}} {{-- Project Financials Table --}} {{-- ============================================================ --}}

Project Financials

@if($projectFinancials->count() > 0) @foreach($projectFinancials as $pf) @php $confirmedPaid = $pf->payments->where('status', 'confirmed')->sum('amount'); $balance = ($pf->budget ?? 0) - $confirmedPaid; @endphp @endforeach
Project Client Budget Amount Paid Balance Due Status
{{ $pf->name }} {{ $pf->client->name ?? '—' }} Rs{{ number_format($pf->budget ?? 0, 2) }} Rs{{ number_format($confirmedPaid, 2) }} Rs{{ number_format($balance, 2) }} @php $finStatusStyles = [ 'paid' => 'bg-green-100 text-green-800', 'partial' => 'bg-yellow-100 text-yellow-800', 'unpaid' => 'bg-red-100 text-red-800', ]; $finStyle = $finStatusStyles[$pf->payment_status ?? 'unpaid'] ?? 'bg-gray-100 text-gray-700'; @endphp {{ ucfirst($pf->payment_status ?? 'Unpaid') }}
@else

No project financials

Financial data will appear here once projects are created.

@endif