/* SAFRI — interactive hero booking widget (tabs → prefilled WhatsApp, no pricing) */ const { useState, useRef, useEffect } = React; function Stepper({ value, set, min=1, max=40 }){ return (
{value}
); } function BookingWidget(){ const [tab, setTab] = useState("rent"); const tabs = [ { id:"rent", label:"Rent a Car", icon:"car" }, { id:"tour", label:"Tours", icon:"mountain" }, { id:"umrah", label:"Umrah", icon:"kaaba" }, ]; const indRef = useRef(null); useEffect(()=>{ const i = tabs.findIndex(t=>t.id===tab); if(indRef.current){ indRef.current.style.transform = `translateX(calc(${i*100}% + ${i*6}px))`; indRef.current.style.background = tab==="umrah" ? "linear-gradient(120deg,#186060,#0E3F3F)" : tab==="tour" ? "linear-gradient(120deg,#00A8F0,#0078b0)" : "linear-gradient(120deg,#F04800,#D84800)"; } },[tab]); const today = new Date().toISOString().split("T")[0]; // rent const [veh, setVeh] = useState(0); const [driver, setDriver] = useState(true); const [rcity, setRcity] = useState("Lahore"); const [rdays, setRdays] = useState(3); const [rdate, setRdate] = useState(""); // tour const [tour, setTour] = useState(0); const [tppl, setTppl] = useState(2); const [tdate, setTdate] = useState(""); const [priv, setPriv] = useState(false); // umrah const [um, setUm] = useState(1); const [ucity, setUcity] = useState("Lahore"); const [uppl, setUppl] = useState(2); const [umonth, setUmonth] = useState(""); function send(){ let m; if(tab==="rent"){ m = `As-salam alaikum Safri Travels 👋\n\nI'd like a quote to *RENT A CAR*:\n• Vehicle: ${VEHICLES[veh].name} (${VEHICLES[veh].seats}-seat)\n• Driver: ${driver?"With driver":"Self-drive"}\n• City: ${rcity}\n• Duration: ${rdays} day${rdays>1?"s":""}\n• Start date: ${rdate||"flexible"}\n\nPlease share availability & your best package. Thank you!`; } else if(tab==="tour"){ m = `As-salam alaikum Safri Travels 👋\n\nI'm interested in a *TOUR*:\n• Destination: ${TOURS[tour].name}\n• Type: ${priv?"Private trip":"Group departure"}\n• Travellers: ${tppl}\n• Duration: ${TOURS[tour].days}\n• Preferred date: ${tdate||"flexible"}\n\nPlease share the itinerary & package. Thank you!`; } else { m = `As-salam alaikum Safri Travels 👋\n\nI'd like details on an *UMRAH PACKAGE* for 1447 H:\n• Package: ${UMRAH[um].name} (${UMRAH[um].tier})\n• Departure city: ${ucity}\n• Pilgrims: ${uppl}\n• Duration: ${UMRAH[um].nights}\n• Preferred month: ${umonth||"flexible"}\n\nPlease share the next departure & package. Thank you!`; } openWA(m); } return (
Plan in 30 seconds — get a reply in 24 hours
{tabs.map(t=>{ const Ic = Icons[t.icon]; return ( ); })}
{tab==="rent" && (<>
setDriver(true)}>With driver setDriver(false)}>Self-drive
setRdate(e.target.value)}/>
)} {tab==="tour" && (<>
setPriv(false)}>Group departure setPriv(true)}>Private trip
setTdate(e.target.value)}/>
)} {tab==="umrah" && (<>
)}
Free & no-obligation · a real human replies within 24h
); } window.BookingWidget = BookingWidget;