@php // ── Get tenant slug for URLs ── $tenantSlug = request()->segment(1); // ── Role and period ── $role = $role ?? session('admin_role', 'company_admin'); $period = $period ?? 'monthly'; @endphp @include('Partials.sidebar')
@include('Partials.header')
{{-- ── Page Title ──────────────────────────────────────────── --}}
@if($role === 'broker')

My Dashboard

@elseif($role === 'sales')

Sales Dashboard

@else

Admin Dashboard

@endif
{{-- Period switcher --}}
@foreach(['weekly' => 'This Week', 'monthly' => 'Monthly', 'yearly' => 'Yearly'] as $p => $label) {{ $label }} @endforeach
{{-- ════════════════════════════════════════════════════════ STAT CARDS ════════════════════════════════════════════════════════ --}}
{{-- Total Bookings --}}

{{ $role === 'broker' ? 'My Bookings' : 'Total Bookings' }}

{{ $total_bookings ?? 0 }}

{{ $bookings_this_week ?? 0 }} this week • {{ $bookings_this_month ?? 0 }} this month
{{-- Confirmed --}}

Confirmed

{{ $confirmed_bookings ?? 0 }}

{{ $pending_bookings ?? 0 }} pending • {{ $cancelled_bookings ?? 0 }} cancelled
{{-- Revenue --}} @if(in_array($role, ['company_admin', 'sales']))

Revenue (Confirmed)

{{ $currency }}{{ number_format((float) ($total_revenue ?? 0), 2, '.', ',') }}

{{ $currency }}{{ number_format((float) ($revenue_this_month ?? 0), 2, '.', ',') }} this month
@endif {{-- Commission / Team --}} @if($role === 'company_admin')

Team

{{ ($total_brokers ?? 0) + ($total_sales ?? 0) }}

{{ $total_brokers ?? 0 }} brokers • {{ $total_sales ?? 0 }} sales
@endif {{-- Sales: Revenue This Year --}} @if($role === 'sales')

Revenue This Year

{{ $currency }}{{ number_format($revenue_this_year ?? 0, 2, '.', ',') }}

{{ now()->year }}
@endif {{-- Sales: Commission cards --}} @if($role === 'sales')

Commission Pending

{{ $currency }}{{ number_format($commission_pending ?? 0, 2, '.', ',') }}

Awaiting approval

Commission Paid

{{ $currency }}{{ number_format($commission_paid ?? 0, 2, '.', ',') }}

{{ $currency }}{{ number_format($commission_approved ?? 0, 2, '.', ',') }} approved
@endif {{-- Broker commission cards --}} @if($role === 'broker')

Commission Pending

{{$currency}}{{ number_format($commission_pending ?? 0, 2, '.', ',') }}

Awaiting approval

Commission Paid

{{$currency}}{{ number_format($commission_paid ?? 0, 2, '.', ',') }}

{{$currency}}{{ number_format($commission_approved ?? 0, 2, '.', ',') }} approved
@endif
{{-- /stat cards --}} {{-- ════════════════════════════════════════════════════════ CHARTS — Row 1: Main line/bar + Status pie ════════════════════════════════════════════════════════ --}}
{{-- Main multi-line chart --}}

{{ $role === 'broker' ? 'My Activity' : 'Bookings & Revenue' }} — {{ ucfirst($period) }}

Bookings @if($role !== 'broker') Revenue @endif @if(in_array($role, ['broker', 'company_admin', 'sales'])) Commission @endif
{{-- Status Doughnut --}}

Booking Status

Pending ({{ $pending_bookings ?? 0 }}) Confirmed ({{ $confirmed_bookings ?? 0 }}) Cancelled ({{ $cancelled_bookings ?? 0 }})
{{-- ════════════════════════════════════════════════════════ CHARTS — Row 2: Broker performance (company_admin only) + Commission Pipeline (company_admin / sales) ════════════════════════════════════════════════════════ --}} @if($role === 'company_admin')
{{-- Top brokers bar chart --}}

Top Brokers by Bookings

{{-- Commission status bar --}}

Commission Pipeline

@php $totalCom = ($commission_pending ?? 0) + ($commission_approved ?? 0) + ($commission_paid ?? 0); $pctPend = $totalCom > 0 ? ($commission_pending ?? 0) / $totalCom * 100 : 0; $pctAppr = $totalCom > 0 ? ($commission_approved ?? 0) / $totalCom * 100 : 0; $pctPaid = $totalCom > 0 ? ($commission_paid ?? 0) / $totalCom * 100 : 0; @endphp
Pending {{ $currency }}{{ number_format($commission_pending ?? 0, 2, '.', ',') }} ({{ round($pctPend, 1) }}%)
Approved {{ $currency }}{{ number_format($commission_approved ?? 0, 2, '.', ',') }} ({{ round($pctAppr, 1) }}%)
Paid Out {{ $currency }}{{ number_format($commission_paid ?? 0, 2, '.', ',') }} ({{ round($pctPaid, 1) }}%)
Total Commission {{ $currency }}{{ number_format($totalCom, 2, '.', ',') }}
@endif {{-- Sales: Commission Pipeline (personal) --}} @if($role === 'sales')

My Commission Pipeline

@php $totalCom = ($commission_pending ?? 0) + ($commission_approved ?? 0) + ($commission_paid ?? 0); $pctPend = $totalCom > 0 ? ($commission_pending ?? 0) / $totalCom * 100 : 0; $pctAppr = $totalCom > 0 ? ($commission_approved ?? 0) / $totalCom * 100 : 0; $pctPaid = $totalCom > 0 ? ($commission_paid ?? 0) / $totalCom * 100 : 0; @endphp
Pending {{ $currency }}{{ number_format($commission_pending ?? 0, 2, '.', ',') }} ({{ round($pctPend, 1) }}%)
Approved {{ $currency }}{{ number_format($commission_approved ?? 0, 2, '.', ',') }} ({{ round($pctAppr, 1) }}%)
Paid Out {{ $currency }}{{ number_format($commission_paid ?? 0, 2, '.', ',') }} ({{ round($pctPaid, 1) }}%)
Total Commission {{ $currency }}{{ number_format($totalCom, 2, '.', ',') }}
@endif {{-- Broker: Commission trend line --}} @if($role === 'broker')
Rate
{{ Auth::guard('admin')->user()->commission_rate ?? '2.00' }}%
Pending
{{$currency}}{{ number_format($commission_pending ?? 0, 2, '.', ',') }}
Approved
{{$currency}}{{ number_format($commission_approved ?? 0, 2, '.', ',') }}
Paid Out
{{$currency}}{{ number_format($commission_paid ?? 0, 2, '.', ',') }}
Total Earned
{{$currency}}{{ number_format($total_earned ?? 0, 2, '.', ',') }}
@endif {{-- ════════════════════════════════════════════════════════ DOWNLOAD REPORTS PANEL ════════════════════════════════════════════════════════ --}}

Download Reports

{{-- Bookings report --}}
Bookings Report
All booking details
{{-- Revenue report — sales + company_admin --}} @if(in_array($role, ['company_admin', 'sales']))
Revenue Report
Confirmed booking revenue
@endif {{-- Commission report — broker + company_admin + sales --}} @if(in_array($role, ['company_admin', 'broker', 'sales']))
Commission Report
{{ $role === 'sales' ? 'My commission details' : 'Broker commission details' }}
@endif {{-- Leads report — All roles --}}
Leads
All lead details
{{-- /row --}}
{{-- ════════════════════════════════════════════════════════ RECENT BOOKINGS TABLE ════════════════════════════════════════════════════════ --}}

{{ $role === 'broker' ? 'My Recent Bookings' : 'Recent Bookings' }}

@if($role === 'broker') View All @else View All @endif
@if($role !== 'broker') @endif @if(in_array($role, ['broker', 'company_admin', 'sales'])) @endif @forelse($recent_bookings ?? [] as $b) @if($role !== 'broker') @endif @if(in_array($role, ['broker', 'company_admin', 'sales'])) @endif @empty @endforelse
# Unit ClientBrokerPriceCommissionStatus Date
{{ $loop->iteration }}
{{ $b->plot_number }}
{{ $b->plot_type }}
{{ $b->isBrokerBooking() ? ($b->client_name ?: $b->name) : $b->name }}
{{ $b->isBrokerBooking() ? ($b->client_phone ?: $b->phone) : $b->phone }}
@if($b->isBrokerBooking() && $b->broker) 🤝 {{ $b->broker->name }} @else Direct @endif
{{ $b->price }}
@if($b->total_amount)
Total: {{ $currency }}{{ number_format($b->total_amount, 2, '.', ',') }}
@endif
@if($b->commission_amount) {{ $currency }}{{ number_format($b->commission_amount, 2, '.', ',') }} @php $cs = $b->commission_status; $cc = ['pending' => 'warning', 'approved' => 'success', 'paid' => 'primary', 'rejected' => 'danger']; @endphp
{{ ucfirst($cs) }} @else — @endif
{!! $b->bookingStatusBadge() !!} {{ $b->created_at->format('d M Y') }}
No bookings yet.
{{-- ── Styles ──────────────────────────────────────────────── --}} {{-- ── Scripts ─────────────────────────────────────────────── --}} @include('Partials.footer')