@extends('layouts.portal') @section('title', 'Finance Dashboard') @section('page_title', 'Finance Dashboard') @section('page_subtitle', 'Financial overview and analytics') @section('sidebar') @include('admin.partials.sidebar', ['active' => 'finance']) @endsection @section('content')

Finance Dashboard

Financial overview and analytics

Total Revenue: RM{{ number_format($stats['total_revenue'], 2) }} System Online

Total Revenue

RM{{ number_format($stats['total_revenue'], 2) }}
This Month: RM{{ number_format($stats['current_month_revenue'], 2) }}

Commissions Paid

RM{{ number_format($stats['total_commissions_paid'], 2) }}
This Month: RM{{ number_format($stats['current_month_commissions'], 2) }}

Pending Commissions

RM{{ number_format($stats['pending_commissions'], 2) }}
Awaiting payment

Active Clients

{{ $stats['active_clients'] }} / {{ $stats['total_clients'] }}
{{ number_format(($stats['active_clients'] / max($stats['total_clients'], 1)) * 100, 1) }}% active

Total Invoices

RM{{ number_format($totalInvoices, 2) }}
All paid invoices

Lawyer Paid

RM{{ number_format($lawyerPaid, 2) }}
Lawyer invoice payments

Agent Paid

RM{{ number_format($agentPaid, 2) }}
Agent commission payments

Remaining

RM{{ number_format($remainingAmount, 2) }}
Unpaid balance

Monthly Revenue Trend

Commission Breakdown

Recent Transactions

View All
@foreach($recentTransactions as $transaction) @endforeach
Date Client Amount Status
{{ $transaction->created_at->format('M d, Y') }} {{ $transaction->client?->first_name }} {{ $transaction->client?->last_name }} RM{{ number_format($transaction->amount, 2) }} {{ ucfirst($transaction->status) }}

Top Performers

Agents

@foreach($topAgents as $agent)
{{ $agent->email }} RM{{ number_format($agent->total_commissions, 2) }}
@endforeach

Lawyers

@foreach($topLawyers as $lawyer)
{{ $lawyer->email }} RM{{ number_format($lawyer->total_commissions, 2) }}
@endforeach

Quick Actions

Per-Will Commission & Invoice Breakdown

{{ $willBreakdown->count() }} wills
@forelse($willBreakdown as $will) @empty @endforelse
Will ID Client Client Invoice Lawyer Invoice Agent Commission Lawyer Commission Total Cost Status
#{{ $will['will_id'] }}
{{ $will['client_name'] }}
{{ $will['client_email'] }}
RM{{ number_format($will['client_invoice'], 2) }} RM{{ number_format($will['lawyer_invoice'], 2) }} RM{{ number_format($will['agent_commission'], 2) }} RM{{ number_format($will['lawyer_commission'], 2) }} RM{{ number_format($will['total_cost'], 2) }} {{ ucfirst(str_replace('_', ' ', $will['status'])) }}
No will data available
Totals RM{{ number_format($willBreakdown->sum('client_invoice'), 2) }} RM{{ number_format($willBreakdown->sum('lawyer_invoice'), 2) }} RM{{ number_format($willBreakdown->sum('agent_commission'), 2) }} RM{{ number_format($willBreakdown->sum('lawyer_commission'), 2) }} RM{{ number_format($willBreakdown->sum('total_cost'), 2) }}
@endsection @push('scripts') @endpush