{{-- resources/views/bookings/edit.blade.php --}} @extends('layouts.app') @section('title', 'Edit Booking — ' . ($booking->reference ?? 'Booking')) @section('content')
{{-- Header --}}

Edit Booking @if(!empty($booking->reference)) {{ $booking->reference }} @endif

Update core details, dates, and payments. Amount fields are in NZD (dollars).

Cancel {{-- Optional: delete button if you have a destroy route --}} {{--
@csrf @method('DELETE')
--}}
{{-- Flash message --}} @if(session('status'))
{{ session('status') }}
@endif {{-- Form --}}
@csrf @method('PUT')
{{-- Main column --}}
{{-- Customer summary (read-only) --}}

Customer

Name
{{ $booking->customer->name ?? trim(($booking->customer->first_name ?? '') . ' ' . ($booking->customer->last_name ?? '')) ?: '—' }}
Email
{{ $booking->customer->email ?? '—' }}
Phone
{{ $booking->customer->phone ?? '—' }}
{{-- keep customer_id if you allow reassigning elsewhere --}}
{{-- Booking details --}}

Booking

{{-- Reference --}}
@error('reference')

{{ $message }}

@enderror
{{-- Status --}}
@php $statusOptions = ['pending' => 'Pending', 'paid' => 'Paid', 'cancelled' => 'Cancelled']; @endphp @error('status')

{{ $message }}

@enderror
{{-- Currency --}}
@error('currency')

{{ $message }}

@enderror
{{-- Vehicle (optional) --}}
@error('vehicle')

{{ $message }}

@enderror
{{-- Start at --}}
@error('start_at')

{{ $message }}

@enderror
{{-- End at --}}
@error('end_at')

{{ $message }}

@enderror
{{-- Money --}}

Payment & Amounts (NZD)

@php $toDollars = fn($cents) => number_format((int)($cents ?? 0) / 100, 2, '.', ''); @endphp
{{-- Total --}}
@error('total_amount')

{{ $message }}

@enderror
{{-- Deposit --}}
@error('deposit_amount')

{{ $message }}

@enderror
{{-- Bond / Hold --}}
@error('hold_amount')

{{ $message }}

@enderror
{{-- Already Paid (new) --}}
@error('paid_amount')

{{ $message }}

@enderror
{{-- Optional note about cents handling --}}

These fields accept dollars (e.g. “409.00”). They’ll be stored as cents in the database.

{{-- Actions --}}
Cancel
{{-- Sidebar summary --}}
{{-- Lightweight live summary updater (no dependencies) --}} @endsection