@extends('crm.master') @section('title', 'Booking Index') @section('content')
{{-- ══════════════════════════════════════════════════════════════════ HEADER ══════════════════════════════════════════════════════════════════ --}}

Booking Index

@if($dateRange === 'today') Today @elseif($dateRange === 'tomorrow') Tomorrow @elseif($dateRange === 'this_week') This Week @elseif($dateRange === 'next_7') Next 7 Days @elseif($dateRange === 'this_month') This Month @elseif($dateRange === 'next_30') Next 30 Days @elseif($dateRange === 'last_30') Last 30 Days @elseif($dateRange === 'custom' && $dateFrom && $dateTo) {{ \Carbon\Carbon::parse($dateFrom)->format('M j') }} – {{ \Carbon\Carbon::parse($dateTo)->format('M j, Y') }} @else All bookings @endif — {{ $bookings->total() }} result{{ $bookings->total() !== 1 ? 's' : '' }}

@include('crm.components.alerts') {{-- ══════════════════════════════════════════════════════════════════ QUICK FILTERS (pill tabs) ══════════════════════════════════════════════════════════════════ --}}
@php $qfBase = array_merge(request()->except(['date_range','date_from','date_to','page']), []); $activeQf = in_array($dateRange, ['','today','tomorrow','next_7','this_month']) ? $dateRange : ''; @endphp @foreach([ '' => 'All', 'today' => 'Today', 'tomorrow' => 'Tomorrow', 'next_7' => 'Next 7 Days', 'this_month' => 'This Month', ] as $val => $label) {{ $label }} @endforeach
{{-- ══════════════════════════════════════════════════════════════════ FILTER BAR ══════════════════════════════════════════════════════════════════ --}}
{{-- Search --}} {{-- Dropdown filters group --}}
{{-- Date group --}}
{{-- Status filter --}}
@foreach(\App\Models\Booking::STATUS_OPTIONS as $val => $label) @endforeach
{{-- Category filter --}}
@foreach($categories as $cat) @endforeach
{{-- Source filter --}} @if($sources->isNotEmpty())
@foreach($sources as $src) @endforeach
@endif
{{-- /.bki-filter-bar__dropdowns --}} {{-- Active filter chips + clear --}} @php $hasFilters = $dateRange || $status || $catId || $source || $search; @endphp @if($hasFilters) @endif
{{-- /.bki-filter-bar --}} {{-- Hidden inputs to preserve state on filter-panel submits --}} @if($search) @endif
{{-- ══════════════════════════════════════════════════════════════════ TABLE TOOLBAR ══════════════════════════════════════════════════════════════════ --}}
{{-- Left: result count + bulk-select info --}}
{{ $bookings->total() }} booking{{ $bookings->total() !== 1 ? 's' : '' }}
{{-- Right: sort + column toggle --}}
{{-- Sort control --}}
@foreach(request()->except(['sort','dir','page']) as $k => $v) @endforeach
@php $curSort = request('sort','created_at'); $curDir = request('dir','desc'); @endphp @foreach([ 'created_at' => 'Date Created', 'start_datetime' => 'Start Date', 'end_datetime' => 'End Date', 'total_amount' => 'Total Amount', 'customer_name' => 'Customer Name', ] as $col => $lbl) @endforeach
{{-- Column visibility toggle --}}
@foreach([ 'col-booking' => 'Booking #', 'col-start' => 'Start', 'col-end' => 'End', 'col-created' => 'Created', 'col-customer' => 'Customer', 'col-items' => 'Item(s)', 'col-total' => 'Amount', 'col-paid' => 'Paid', 'col-due' => 'Due', 'col-status' => 'Status', ] as $col => $label) @endforeach
{{-- ══════════════════════════════════════════════════════════════════ BOOKING TABLE ══════════════════════════════════════════════════════════════════ --}}
{{-- Checkbox --}} @forelse($bookings as $i => $booking) @php $paidAmount = (float) ($booking->deposit_amount ?? 0); $totalAmount = (float) ($booking->total_amount ?? 0); $balance = max(0, $totalAmount - $paidAmount); $firstItem = $booking->items->first(); @endphp {{-- Checkbox --}} {{-- ── Booking # ── --}} {{-- ── Start ── --}} {{-- ── End ── --}} {{-- ── Created ── --}} {{-- ── Customer ── --}} {{-- ── Items ── --}} {{-- ── Total ── --}} {{-- ── Paid ── --}} {{-- ── Due ── --}} {{-- ── Status ── --}} @empty @endforelse
Booking @if($curSort === 'booking_number') @else @endif Start @if($curSort === 'start_datetime') @else @endif End @if($curSort === 'end_datetime') @else @endif Created @if($curSort === 'created_at') @else @endif Customer @if($curSort === 'customer_name') @else @endif Item(s) Amount @if($curSort === 'total_amount') @else @endif Paid Due Status
{{ $booking->booking_number }} @if($firstItem)
{{ $firstItem->product_name }}
@endif
{{ $booking->start_datetime->format('m/d/y') }}
{{ $booking->start_datetime->format('h:i A') }}
{{ $booking->end_datetime->format('m/d/y') }}
{{ $booking->end_datetime->format('h:i A') }}
{{ $booking->created_at->format('m/d/y') }}
{{ $booking->created_at->format('h:i A') }}
{{ $booking->customer_name }}
@if($booking->customer_email)
{{ $booking->customer_email }}
@endif @if($booking->customer_phone)
{{ $booking->customer_phone }}
@endif
@forelse($booking->items as $item)
{{ $item->product_name }}
@if($item->quantity)
Qty {{ $item->quantity }}
@endif
@empty No item @endforelse
${{ number_format($totalAmount, 2) }}
${{ number_format($paidAmount, 2) }}
@if($balance > 0)
${{ number_format($balance, 2) }}
@else $0.00 @endif
{{ $booking->status_label }}

No bookings found

@if($hasFilters) Clear filters @endif
{{-- Bulk action bar (appears when rows selected) --}}
0 selected
{{-- Pagination --}} @if($bookings->hasPages())
Showing {{ $bookings->firstItem() }}–{{ $bookings->lastItem() }} of {{ $bookings->total() }}
@endif
{{-- /.bki-table-card --}}
@endsection @section('head-extra') @endsection @section('page-script') @endsection