Edit Booking {#if booking}
ID: {booking.id}
{/if}
{#if loading}
Loading booking...
{:else if booking}

Customer

Name
{formatUserName( booking.user?.full_name || '—', booking.user?.previous_first_name, booking.user?.previous_last_name )}
Email
{booking.user?.email || '—'}
Phone
{booking.user?.phone || '—'}
Time
{(() => { const date = parseWallClockDate(booking.start_time); return date.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit', hour12: true }); })()}

Services ({services.length})

{#if services.length === 0}
No services added yet. Click "Add Service" to begin.
{:else}
{#each services as service, index (index)}
{service.service_name}
{formatDuration( service.override_duration_minutes ?? service.duration_minutes ?? 0 )} • £{(service.override_price ?? service.price ?? 0).toFixed(2)}
{#if service.override_price !== undefined || service.override_duration_minutes !== undefined}
Modified
{/if}
{/each}
Total: {formatDuration(totalDuration)} £{totalPrice.toFixed(2)}
{/if}
{#if booking?.payments && booking.payments.length > 0}

Payments ({booking.payments.length})

{#each booking.payments as payment, index (index)}
{payment.payment_type === 'deposit' ? 'Deposit' : payment.payment_type === 'full' ? 'Full Payment' : payment.payment_type} {#if payment.payment_method} via {payment.payment_method} {/if}
{payment.status} | £{(payment.amount / 100).toFixed(2)} {#if payment.invoice_number} | Inv: {payment.invoice_number} {/if} {#if payment.is_vat_applicable && payment.net_amount != null} | Net: £{payment.net_amount.toFixed(2)} | VAT ({payment.vat_rate || 0}%): £{payment.vat_amount?.toFixed(2)} {/if}
{parseWallClockDate(payment.created_at).toLocaleDateString('en-GB', { day: 'numeric', month: 'short', year: 'numeric' })}
{#if payment.status === 'completed' && payment.payment_method !== 'discount' && payment.payment_method !== 'on_the_house'} {/if}
{/each}
{/if}