Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f4c5d9a95b | |||
| bccae5505b | |||
| 66cbad4957 | |||
| 2376eb5281 | |||
| a1a648b518 | |||
| c94b4a1c21 | |||
| 0e6eef1ea7 | |||
| 7255f17957 | |||
| f0917a5baa |
@@ -19,9 +19,27 @@ export default function LandingPage() {
|
||||
const [name, setName] = useState("");
|
||||
const [guests, setGuests] = useState("2");
|
||||
|
||||
const handleReserve = () => {
|
||||
const handleReserve = async () => {
|
||||
const message = encodeURIComponent(`Hello, I would like to book a table at Shaffa. \nName: ${name}\nEmail: ${email}\nMobile: ${mobile}\nGuests: ${guests}`);
|
||||
window.open(`https://wa.me/919876543210?text=${message}`, '_blank');
|
||||
|
||||
// Send email via API request
|
||||
try {
|
||||
const response = await fetch('/api/send-booking', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ name, email, mobile, guests, to: 'isittrueorjust@gmail.com' }),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
console.error("Server error during booking submission");
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed to send email", e);
|
||||
}
|
||||
|
||||
window.open(`https://wa.me/919592524646?text=${message}`, '_blank');
|
||||
setIsReserving(false);
|
||||
};
|
||||
|
||||
@@ -90,6 +108,9 @@ export default function LandingPage() {
|
||||
className="w-full p-2 mb-4 border rounded text-black"
|
||||
onChange={(e) => setMobile(e.target.value)}
|
||||
/>
|
||||
<select className="w-full p-2 mb-4 border rounded text-black" onChange={(e) => setGuests(e.target.value)} value={guests}>
|
||||
{[1,2,3,4,5,6].map(i => <option key={i} value={i}>{i} Guests</option>)}
|
||||
</select>
|
||||
<div className="flex gap-2">
|
||||
<button onClick={() => setIsReserving(false)} className="flex-1 p-2 bg-gray-200 rounded text-black">Cancel</button>
|
||||
<button onClick={handleReserve} className="flex-1 p-2 bg-blue-600 text-white rounded">Confirm Reservation</button>
|
||||
@@ -105,7 +126,7 @@ export default function LandingPage() {
|
||||
gridVariant="three-columns-all-equal-width"
|
||||
useInvertedBackground={false}
|
||||
buttons={[
|
||||
{ text: "Reserve on WhatsApp", onClick: () => setIsReserving(true) }
|
||||
{ text: "Book a Table", onClick: () => setIsReserving(true) }
|
||||
]}
|
||||
products={[
|
||||
{ id: "m1", name: "Butter Chicken", price: "₹450", variant: "Popular", imageSrc: "http://img.b2bpic.net/free-photo/top-close-view-delicious-bright-cake-with-cream-cracker-cookies-dark-wall-cake-biscuit-pie-sugar-sweet-photo-cookie_140725-53987.jpg?_wi=1" },
|
||||
@@ -174,7 +195,7 @@ export default function LandingPage() {
|
||||
title="Shaffa - Sec 26B, Chandigarh"
|
||||
description="Visit us for an unforgettable North Indian dining experience. Use WhatsApp to reserve your table today."
|
||||
imageSrc="http://img.b2bpic.net/free-photo/miami-bayside-landscape_23-2151636382.jpg"
|
||||
buttonText="Reserve Now"
|
||||
buttonText="Book a Table"
|
||||
onSubmit={() => setIsReserving(true)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user