@include('Partials.sidebar')
@include('Partials.header')

Booking #{{ $booking->id }}

  1. Bookings
  2. #{{ $booking->id }}
@foreach(['success','error'] as $t) @if(session($t))
{{ session($t) }}
@endif @endforeach
{{-- ── Left: booking details ── --}}
{{-- Unit info --}}
Unit Details
@foreach([ ['Unit No', $booking->plot_number], ['Type', $booking->plot_type], ['Block', optional($booking->block)->block_name ?? $booking->block ?? '—'], ['Direction', $booking->direction], ['Area', $booking->area], ['Price', $booking->price], ['Project ID', $booking->project_id], ] as [$lbl, $val])
{{ $lbl }}
{{ $val ?: '—' }}
@endforeach
@if($booking->paymentPlan)
Payment Plan: {{ $booking->paymentPlan->name }} @if($booking->total_amount)  · Total: ₹{{ number_format($booking->total_amount, 2) }} @endif @if($booking->down_payment_amount)  · Down Payment: ₹{{ number_format($booking->down_payment_amount, 2) }} @endif
@endif
{{-- Client info --}}
@if($booking->isBrokerBooking()) Client Details Broker Booking @else Buyer Details @endif
Client Name
{{ $booking->displayClientName() }}
Phone
{{ $booking->displayClientPhone() }}
@if($booking->client_email)
Email
{{ $booking->client_email }}
@endif
@if($booking->isBrokerBooking() && $booking->broker)
Broker Name
{{ $booking->broker->name }}
Company
{{ $booking->broker->broker_company ?? '—' }}
Broker Phone
{{ $booking->broker->phone ?? '—' }}
@endif @if($booking->notes)
Notes: {{ $booking->notes }}
@endif
{{-- ── Payment Schedule (booking_milestones) ── --}} @php $milestones = \App\Models\BookingMilestone::where('booking_id', $booking->id) ->orderBy('sort_order') ->get(); $totalAmount = $milestones->sum('total_with_tax'); $paidAmount = $milestones->where('status', 'paid')->sum('total_with_tax'); $balanceDue = $totalAmount - $paidAmount; $pendingCount = $milestones->filter(fn($m) => $m->status !== 'paid' && $m->status !== 'waived')->count(); @endphp @if($milestones->isNotEmpty())
Payment Schedule @if($pendingCount > 0) {{ $pendingCount }} pending @endif
Paid: ₹{{ $paidAmount }}  ·  Balance: ₹{{ $balanceDue }}
{{-- Progress bar --}} @if($totalAmount > 0) @php $pct = min(100, round(($paidAmount / $totalAmount) * 100)); @endphp
Payment Progress {{ $pct }}% complete
@endif {{-- Milestone rows --}} @foreach($milestones as $m) @php $isOverdue = $m->status === 'pending' && $m->due_date && $m->due_date->isPast(); $effStatus = $m->status === 'paid' ? 'paid' : ($m->status === 'waived' ? 'waived' : ($isOverdue ? 'overdue' : 'pending')); $dotColor = match($effStatus) { 'paid' => '#22c55e', 'overdue' => '#ef4444', 'waived' => '#94a3b8', default => '#f59e0b', }; $rowBg = $effStatus === 'paid' ? 'rgba(34,197,94,0.04)' : ($effStatus === 'overdue' ? 'rgba(239,68,68,0.04)' : ''); @endphp
{{-- Status dot --}}
{{-- Milestone number --}}
{{ $effStatus === 'paid' ? '✓' : $loop->iteration }}
{{-- Label + dates --}}
{{ $m->label }} @if($m->percentage) ({{ $m->percentage }}%) @endif
@if($m->due_date) Due: {{ $m->due_date->format('d M Y') }} @if($isOverdue) ⚠ Overdue by {{ $m->due_date->diffForHumans() }} @endif @endif @if($m->paid_at) · Paid {{ $m->paid_at->format('d M Y') }} @endif @if($m->notes) · {{ $m->notes }} @endif
{{-- Amount --}}
₹{{$m->total_with_tax }}
{{ $effStatus }}
{{-- Remind bell (only for pending/overdue if user exists) --}} @if(in_array($effStatus, ['pending','overdue']) && $booking->user)
@csrf
@endif {{-- Mark as paid button (only for pending/overdue) --}} @if(in_array($effStatus, ['pending','overdue']))
@csrf
@endif
@endforeach {{-- Summary footer --}}
Total: ₹{{ $totalAmount }}
Paid: ₹{{ $paidAmount }}  ·  Balance: ₹{{ $balanceDue }}
@elseif($booking->paymentPlan && $booking->booking_status === 'confirmed') {{-- Plan exists but milestones not yet snapshotted --}}
Payment plan milestones not yet generated for this booking. They are created automatically when the user pays via the online gateway. For manual bookings, use the button below.
@csrf
@endif
{{-- ── Right: actions ── --}}
{{-- Booking status --}}
Booking Status
Current: {!! $booking->bookingStatusBadge() !!}
Booked on {{ $booking->created_at->format('d M Y, h:i A') }}
@csrf
{{-- Commission (broker bookings only) --}} @if($booking->isBrokerBooking())
Commission
Rate
{{ $booking->commission_rate }}%
Amount
₹{{ number_format($booking->commission_amount, 2) }}
Current: {!! $booking->commissionStatusBadge() !!} @if($booking->commission_paid_at)
Paid on {{ $booking->commission_paid_at->format('d M Y') }}
@endif
@csrf
@endif {{-- Payment Reminder (pending bookings — no plan) --}} @if($booking->booking_status === 'pending' && $booking->user)
Payment Reminder

Send a payment reminder to {{ $booking->user->name }} ({{ $booking->user->email }}). This creates an in-app notification and sends an email.

@csrf
@endif {{-- Quick stats for confirmed bookings with plan --}} @if($booking->booking_status === 'confirmed' && $milestones->isNotEmpty())
Payment Summary
@foreach([ ['Paid', $paidAmount, '#22c55e', 'fas fa-check-circle'], ['Balance', $balanceDue, $balanceDue > 0 ? '#f59e0b' : '#22c55e', 'fas fa-clock'], ['Total', $totalAmount, '#c9a96e', 'fas fa-file-invoice-dollar'], ] as [$lbl, $val, $col, $icon])
{{ $lbl }}
₹{{ $val }}
@endforeach {{-- Overdue alert --}} @php $overdueCount = $milestones->filter(fn($m) => $m->status === 'pending' && $m->due_date && $m->due_date->isPast() )->count(); @endphp @if($overdueCount > 0)
{{ $overdueCount }} overdue milestone{{ $overdueCount > 1 ? 's' : '' }}
@endif
@endif {{-- Danger zone --}}
Danger Zone
@csrf @method('DELETE')
@include('Partials.footer')