@include('Partials.sidebar') @php $role = $role ?? session('admin_role', 'super_admin'); $period = $period ?? 'monthly'; $currency = \App\Models\Setting::get('currency_symbol', '₹'); @endphp
@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, ['super_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 === 'super_admin')

Team

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

{{ $total_brokers ?? 0 }} brokers • {{ $total_sales ?? 0 }} sales
@endif @if($role === 'sales')

Revenue This Year

{{ $currency }}{{ number_format($revenue_this_year ?? 0, 0) }}

{{ now()->year }}
@endif {{-- Broker commission cards --}} @if($role === 'broker')

Commission Pending

{{$currency}}{{ number_format($commission_pending ?? 0, 0) }}

Awaiting approval

Commission Paid

{{$currency}}{{ number_format($commission_paid ?? 0, 0) }}

{{$currency}}{{ number_format($commission_approved ?? 0, 0) }} 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','super_admin'])) Commission @endif
{{-- Status Doughnut --}}

Booking Status

Pending ({{ $pending_bookings ?? 0 }}) Confirmed ({{ $confirmed_bookings ?? 0 }}) Cancelled ({{ $cancelled_bookings ?? 0 }})
{{-- ════════════════════════════════════════════════════════ CHARTS — Row 2: Broker performance (super_admin only) + Commission breakdown (broker/super_admin) ════════════════════════════════════════════════════════ --}} @if($role === 'super_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}}{{ $commission_pending??0 }} ({{ $pctPend }}%)
Approved {{$currency}}{{ $commission_approved??0 }} ({{ $pctAppr }}%)
Paid Out {{$currency}}{{ $commission_paid??0 }} ({{ $pctPaid }}%)
Total Commission {{$currency}}{{ $totalCom }}
@endif {{-- Broker: Commission trend line --}} @if($role === 'broker')
Rate
{{ Auth::guard('admin')->user()->commission_rate ?? '2.00' }}%
Pending
{{$currency}}{{ number_format($commission_pending??0,0) }}
Approved
{{$currency}}{{ number_format($commission_approved??0,0) }}
Paid Out
{{$currency}}{{ number_format($commission_paid??0,0) }}
Total Earned
{{$currency}}{{ number_format($total_earned??0,0) }}
@endif {{-- ════════════════════════════════════════════════════════ DOWNLOAD REPORTS PANEL ════════════════════════════════════════════════════════ --}}

Download Reports

{{-- Bookings report --}}
Bookings Report
All booking details
{{-- Revenue report — sales + super_admin --}} @if(in_array($role, ['super_admin','sales']))
Revenue Report
Confirmed booking revenue
@endif {{-- Commission report — broker + super_admin --}} @if(in_array($role, ['super_admin','broker']))
Commission Report
Broker commission details
@endif
{{-- /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','super_admin']))@endif @forelse($recent_bookings ?? [] as $b) @if($role !== 'broker') @endif @if(in_array($role, ['broker','super_admin'])) @endif @empty @endforelse
# Unit ClientBrokerPriceCommissionStatus Date
{{ $b->id }}
{{ $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: ₹{{ number_format($b->total_amount,2) }}
@endif
@if($b->commission_amount) {{$currency}}{{ $b->commission_amount }} @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')