// vehicle.jsx — Vehicle Detail page + booking widget function VehicleDetail({ car, t, locale, onBack, onOpenCar }) { const [tab, setTab] = React.useState("specs"); const [gIdx, setGIdx] = React.useState(0); // Demo: we have 1 image per car. Fake a small gallery using the same image with different crops/zooms. const galleryImgs = [car.image, car.image, car.image, car.image]; const similar = window.FLEET.filter(c => c.id !== car.id && c.available).slice(0, 3); return (
Fleet / {car.body.split("·")[0].trim()} / {car.make} {car.model}
{car.year}

{car.make} {car.model}

{car.body} · {car.colour} · {car.seats}-seat
Power{car.power}
0–100{car.accel}
Top{car.topSpeed}
{t.fleet.from}{car.daily}/{t.fleet.day}
{/* Left: media + content */}
{`${car.make}
{car.colour} · frame {gIdx + 1} / {galleryImgs.length}
{galleryImgs.map((src, i) => ( ))}
{tab === "specs" && (
{[ ["Body", car.body], ["Seats", car.seats], ["Transmission", car.transmission], ["Drivetrain", car.drivetrain], ["Engine", car.engine], ["Power", car.power], ["Torque", car.torque], ["Top speed", car.topSpeed], ["0–100 km/h", car.accel], [t.detail.colour, car.colour], ].map(([k, v], i) => (
{k} {v}
))} {car.note &&

{car.note}

}
)} {tab === "incl" && (

{t.detail.included}

    {t.detail.included_items.map((x, i) => (
  • {x}
  • ))}

{t.detail.not_included}

    {t.detail.not_included_items.map((x, i) => (
  • {x}
  • ))}
)} {tab === "rate" && (
Daily {car.daily} 200 km / day
Weekly {car.weekly} 1,500 km / wk
Monthly {car.monthly} {t.fleet.enquire}

{t.detail.rate_note}

)}
{/* Right: sticky booking widget */}
{/* Similar */}
{t.detail.similar}

Also from the floor

{similar.map((c, i) => ( onOpenCar(c.id)} idx={i + 10} /> ))}
); } // ──── Booking widget (inline, builds a WhatsApp deep link) ───────────────── function BookingWidget({ car, t, locale }) { const today = new Date(); const fmt = (d) => d.toISOString().slice(0, 10); const defaultPickup = fmt(new Date(today.getTime() + 86400000)); const defaultReturn = fmt(new Date(today.getTime() + 4 * 86400000)); const [pickup, setPickup] = React.useState(defaultPickup); const [ret, setRet] = React.useState(defaultReturn); const [delivery, setDelivery] = React.useState("dubai"); const [chauffeur, setChauffeur] = React.useState(false); const [name, setName] = React.useState(""); const [phone, setPhone] = React.useState(""); const [open, setOpen] = React.useState(false); const days = Math.max(1, Math.round((new Date(ret) - new Date(pickup)) / 86400000)); const dailyNum = parseInt(car.daily.replace(/[^\d]/g, ""), 10) || 0; const subtotal = dailyNum * days; const chauffeurFee = chauffeur ? 350 * days : 0; const total = subtotal + chauffeurFee; const totalStr = "AED " + total.toLocaleString(); const deliveryLabel = t.booking.delivery_opts.find(o => o.id === delivery)?.label || ""; const message = [ `Hi Paddock,`, ``, `I'd like to book the ${car.year} ${car.make} ${car.model}.`, `• Pick-up: ${pickup}`, `• Return: ${ret} (${days} day${days > 1 ? "s" : ""})`, `• Hand-over: ${deliveryLabel}`, chauffeur ? `• Chauffeur: yes` : null, name ? `• Name: ${name}` : null, phone ? `• My number: ${phone}` : null, ].filter(Boolean).join("\n"); const waHref = `https://wa.me/971545265555?text=${encodeURIComponent(message)}`; return (
{t.booking.title}
{car.daily} / {t.fleet.day}
{t.booking.delivery_label}
{t.booking.delivery_opts.map(o => ( ))}
{car.daily} × {days} {days > 1 ? "days" : "day"}AED {subtotal.toLocaleString()}
{chauffeur &&
Chauffeur × {days}AED {chauffeurFee.toLocaleString()}
}
{t.booking.total_label}{totalStr}
{t.booking.total_note}
setName(e.target.value)} /> setPhone(e.target.value)} />
{open && (
{message}
)} {t.booking.open_whatsapp} {t.booking.or_call}

{t.booking.privacy}

); } Object.assign(window, { VehicleDetail, BookingWidget });