diff --git a/client/package-lock.json b/client/package-lock.json index 999d12d..00025bf 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.0", "dependencies": { "@tailwindcss/vite": "^4.3.1", - "axios": "^1.18.0", + "axios": "^1.18.1", "lucide-react": "^1.21.0", "react": "^19.2.7", "react-dom": "^19.2.7", @@ -1463,10 +1463,9 @@ "license": "MIT" }, "node_modules/axios": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.18.0.tgz", - "integrity": "sha512-E32NzpYKp++W7XRe52rHiXV2ehxmh3wbdgO7MHeFM+vqxLBYHzt0ElkiImtOBxtOmyp0yoC8C6uESVV84Y2/hw==", - "license": "MIT", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.18.1.tgz", + "integrity": "sha512-3nTvFlvpn9Zu/RkHUqtc7/+al4UpRW5az71ap5zccp6e8RAYEzhMTecX8Dz1wWDYrPpUoB1HAQEGEAEvUr7S9g==", "dependencies": { "follow-redirects": "^1.16.0", "form-data": "^4.0.5", @@ -1498,11 +1497,10 @@ } }, "node_modules/brace-expansion": { - "version": "5.0.6", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz", - "integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==", + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.7.tgz", + "integrity": "sha512-7oFy703dxfY3/NLxC1fh2SUCQ0H9rmAY+5EpDVfXjUTTs+HEwR2nYaqLv+GWcTsumwxPfiz6CzCNkwXwBUwqCA==", "dev": true, - "license": "MIT", "dependencies": { "balanced-match": "^4.0.2" }, diff --git a/client/package.json b/client/package.json index c351e95..bc8876c 100644 --- a/client/package.json +++ b/client/package.json @@ -11,7 +11,7 @@ }, "dependencies": { "@tailwindcss/vite": "^4.3.1", - "axios": "^1.18.0", + "axios": "^1.18.1", "lucide-react": "^1.21.0", "react": "^19.2.7", "react-dom": "^19.2.7", diff --git a/client/src/assets/assets.ts b/client/src/assets/assets.ts index f43a869..6137810 100644 --- a/client/src/assets/assets.ts +++ b/client/src/assets/assets.ts @@ -100,200 +100,7 @@ export const dummyUser = { updatedAt: "2026-06-17T13:40:21.669Z", }; -export const dummyRestaurant = [ - { - _id: "6a32a3c50e88c825d8873f7d", - name: "L'Essence", - slug: "l-essence", - description: - "An intimate, Parisian-inspired fine dining chamber wrapped in dark velvet and soft golden candle glow. L'Essence specializes in meticulous plating of haute gastronomy, creating a rich sensory dialogue between modern culinary innovation and classic romance.", - cuisine: "French", - priceRange: "$$$$", - rating: 4.9, - reviewCount: 88, - location: "Manhattan, NY", - address: "115 Greenwich St, New York, NY 10006", - image: "/restaurant_5.png", - chef: "Jean-Luc Picard", - tags: ["Romantic", "Velvet Booths", "Candlelit", "Haute Cuisine"], - availableSlots: ["18:00", "19:00", "20:00", "21:00", "22:00"], - featured: true, - exclusive: false, - owner: "6a32a3c50e88c825d8873f77", - status: "approved", - totalSeats: 45, - createdAt: "2026-06-17T13:40:21.828Z", - updatedAt: "2026-06-17T13:40:21.828Z", - }, - { - _id: "6a32a3c50e88c825d8873f7a", - name: "Terraza Cielo", - slug: "terraza-cielo", - description: - "A sun-drenched rooftop oasis celebrating Italian and Mediterranean lifestyles. Featuring floor-to-ceiling foliage, white marble bistro tables, and panoramic skyline views, Terraza Cielo serves hand-crafted pastas and coastal seafood paired with bright botanical cocktails.", - cuisine: "Italian", - priceRange: "$$$", - rating: 4.7, - reviewCount: 205, - location: "Manhattan, NY", - address: "244 Fifth Ave Rooftop, New York, NY 10001", - image: "/restaurant_3.jpg", - chef: "Elena Rossi", - tags: ["Rooftop", "Skyline Views", "Handmade Pasta", "Craft Cocktails"], - availableSlots: ["12:00", "13:00", "17:00", "18:00", "19:00", "20:00", "21:00"], - featured: true, - exclusive: false, - owner: "6a32a3c50e88c825d8873f77", - status: "approved", - totalSeats: 30, - createdAt: "2026-06-17T13:40:21.828Z", - updatedAt: "2026-06-17T13:40:21.828Z", - }, - { - _id: "6a32a3c50e88c825d8873f79", - name: "Kuro Omakase", - slug: "kuro-omakase", - description: - "An atmospheric, moody sanctuary of premium Japanese gastronomy. Seated at a dark, polished basalt-stone counter, guests experience a deeply focused sushi omakase. Chef Kenji Sato translates the freshest seasonal ingredients directly from Tokyo's fish markets into elegant, edible poetry.", - cuisine: "Japanese", - priceRange: "$$$$", - rating: 4.8, - reviewCount: 92, - location: "Manhattan, NY", - address: "18 Orchard St, New York, NY 10002", - image: "/restaurant_2.jpg", - chef: "Kenji Sato", - tags: ["Omakase", "Basalt Counter", "Japanese", "Zen Atmosphere"], - availableSlots: ["18:00", "20:30"], - featured: true, - exclusive: true, - owner: "6a32a3c50e88c825d8873f77", - status: "approved", - totalSeats: 25, - createdAt: "2026-06-17T13:40:21.828Z", - updatedAt: "2026-06-17T13:40:21.828Z", - }, - { - _id: "6a32a3c50e88c825d8873f7c", - name: "Flora Garden", - slug: "flora-garden", - description: - "A bright, airy conservatory celebrating organic, plant-forward gastronomy. Nestled under glass ceilings with floor-to-ceiling botanicals, Flora Garden transforms fresh seasonal crops into delicate, high-end editorial culinary works of art.", - cuisine: "Vegetarian", - priceRange: "$$$", - rating: 4.8, - reviewCount: 110, - location: "Manhattan, NY", - address: "90 Grand St, New York, NY 10013", - image: "/restaurant_6.png", - chef: "Chloe Mercer", - tags: ["Plant-Based", "Glasshouse", "Organic", "Bright & Airy"], - availableSlots: ["11:30", "13:00", "14:30", "17:30", "19:00", "20:30"], - featured: false, - exclusive: false, - owner: "6a32a3c50e88c825d8873f77", - status: "approved", - totalSeats: 40, - createdAt: "2026-06-17T13:40:21.828Z", - updatedAt: "2026-06-17T13:40:21.828Z", - }, - { - _id: "6a32a3c50e88c825d8873f7b", - name: "Ember Grille", - slug: "ember-grille", - description: - "An upscale modern steakhouse with exposed brick walls, leather booths, and warm, industrial-chic pendant lighting. Offering Prime dry-aged cuts grilled over live hickory and cherrywood embers. Gourmet dining elevated into a sophisticated nocturnal experience.", - cuisine: "Steakhouse", - priceRange: "$$$$", - rating: 4.6, - reviewCount: 142, - location: "Manhattan, NY", - address: "320 Bowery, New York, NY 10012", - image: "/restaurant_1.png", - chef: "Marcus Vance", - tags: ["Dry-Aged Beef", "Wood Fire", "Moody Lighting", "Wine Room"], - availableSlots: ["17:00", "18:00", "19:00", "20:00", "21:00", "22:00"], - featured: false, - exclusive: false, - owner: "6a32a3c50e88c825d8873f77", - status: "approved", - totalSeats: 35, - createdAt: "2026-06-17T13:40:21.828Z", - updatedAt: "2026-06-17T13:40:21.828Z", - }, - { - _id: "6a32a3c50e88c825d8873f78", - name: "L'Artiste", - slug: "l-artiste", - description: - "An avant-garde journey through modern French gastronomy. L'Artiste blends classic French culinary foundations with contemporary visual artistry, resulting in a sensory dining experience that is both theatrical and deeply satisfying. Set in a gorgeous high-ceilinged room with minimal charcoal and gold design language.", - cuisine: "French", - priceRange: "$$$$", - rating: 4.9, - reviewCount: 124, - location: "Manhattan, NY", - address: "420 Mercer St, New York, NY 10003", - image: "/restaurant_4.png", - chef: "Jean-Pierre Dubois", - tags: ["Michelin Star", "Fine Dining", "Tasting Menu", "Romantic"], - availableSlots: ["17:00", "17:30", "18:00", "18:30", "19:00", "19:30", "20:00", "20:30", "21:00", "21:30"], - featured: true, - exclusive: true, - owner: "6a32a3c50e88c825d8873f77", - status: "approved", - totalSeats: 20, - createdAt: "2026-06-17T13:40:21.827Z", - updatedAt: "2026-06-17T13:40:21.827Z", - }, - { - _id: "6a32a3c50e88c825d8873f7d", - name: "L'Essence", - slug: "l-essence", - description: - "An intimate, Parisian-inspired fine dining chamber wrapped in dark velvet and soft golden candle glow. L'Essence specializes in meticulous plating of haute gastronomy, creating a rich sensory dialogue between modern culinary innovation and classic romance.", - cuisine: "French", - priceRange: "$$$$", - rating: 4.9, - reviewCount: 88, - location: "Manhattan, NY", - address: "115 Greenwich St, New York, NY 10006", - image: "/restaurant_5.png", - chef: "Jean-Luc Picard", - tags: ["Romantic", "Velvet Booths", "Candlelit", "Haute Cuisine"], - availableSlots: ["18:00", "19:00", "20:00", "21:00", "22:00"], - featured: true, - exclusive: false, - owner: "6a32a3c50e88c825d8873f77", - status: "pending", - totalSeats: 45, - createdAt: "2026-06-17T13:40:21.828Z", - updatedAt: "2026-06-17T13:40:21.828Z", - }, - { - _id: "6a32a3c50e88c825d8873f7a", - name: "Terraza Cielo", - slug: "terraza-cielo", - description: - "A sun-drenched rooftop oasis celebrating Italian and Mediterranean lifestyles. Featuring floor-to-ceiling foliage, white marble bistro tables, and panoramic skyline views, Terraza Cielo serves hand-crafted pastas and coastal seafood paired with bright botanical cocktails.", - cuisine: "Italian", - priceRange: "$$$", - rating: 4.7, - reviewCount: 205, - location: "Manhattan, NY", - address: "244 Fifth Ave Rooftop, New York, NY 10001", - image: "/restaurant_3.jpg", - chef: "Elena Rossi", - tags: ["Rooftop", "Skyline Views", "Handmade Pasta", "Craft Cocktails"], - availableSlots: ["12:00", "13:00", "17:00", "18:00", "19:00", "20:00", "21:00"], - featured: true, - exclusive: false, - owner: "6a32a3c50e88c825d8873f77", - status: "pending", - totalSeats: 30, - createdAt: "2026-06-17T13:40:21.828Z", - updatedAt: "2026-06-17T13:40:21.828Z", - }, -]; +export const dummyRestaurant = [ ]; export const dummyAvailability = [ { time: "18:00", availableSeats: 45, isAvailable: true }, diff --git a/client/src/components/owner/RestaurantWizard.tsx b/client/src/components/owner/RestaurantWizard.tsx index 8c545b6..244055f 100644 --- a/client/src/components/owner/RestaurantWizard.tsx +++ b/client/src/components/owner/RestaurantWizard.tsx @@ -2,7 +2,8 @@ import React, { useState } from "react"; import { Utensils, Upload, Image } from "lucide-react"; import toast from "react-hot-toast"; -import { dummyRestaurant } from "../../assets/assets.ts"; + +import api from "../../lib/api.ts"; interface RestaurantWizardProps { setRestaurant: (restaurant: any) => void; @@ -59,17 +60,23 @@ export default function RestaurantWizard({ setRestaurant }: RestaurantWizardProp }; const handleImageChange = (e: React.ChangeEvent) => { - const file = e.target.files?.[0]; - if (file) { - setImageFile(file); - setImagePreview(URL.createObjectURL(file)); - } - }; + const file = e.target.files?.[0]; + + console.log(file); + + if (file) { + setImageFile(file); + setImagePreview(URL.createObjectURL(file)); + } +} + + const handleCreateRestaurant = async (e: React.FormEvent) => { e.preventDefault(); setFormLoading(true); try { + console.log("imageFile:", imageFile); const formData = new FormData(); formData.append("name", name); formData.append("description", description); @@ -84,10 +91,19 @@ export default function RestaurantWizard({ setRestaurant }: RestaurantWizardProp if (imageFile) { formData.append("image", imageFile); } - - setRestaurant(dummyRestaurant[0]); + + const res = await api.post("/owner/restaurant", formData, { + headers: { + "Content-Type": "multipart/form-data", + }, + }); + setRestaurant(res.data) + + + toast.success("Restaurant profile submitted successfully! Awaiting Admin approval."); } catch (error: any) { + toast.error(error?.response?.data?.message || "Failed to register restaurant"); } finally { setFormLoading(false); diff --git a/client/src/components/restaurant/BookingWidget.tsx b/client/src/components/restaurant/BookingWidget.tsx index cfd331b..3eb804d 100644 --- a/client/src/components/restaurant/BookingWidget.tsx +++ b/client/src/components/restaurant/BookingWidget.tsx @@ -86,9 +86,10 @@ export default function BookingWidget({ ? slotsAvailability : (restaurant.availableSlots || []).map((s: string) => ({ time: s, - availableSeats: 20, - isAvailable: true, + available: true, + })); + return allSlots.filter((slotInfo: any) => { if (!isToday) return true; const [slotHour, slotMinute] = slotInfo.time.split(":").map(Number); @@ -100,7 +101,7 @@ export default function BookingWidget({ })().map((slotInfo: any) => { const slot = slotInfo.time; const isSelected = selectedSlot === slot; - const isFull = !slotInfo.isAvailable || slotInfo.availableSeats < Number(selectedGuests); + const isFull = !slotInfo.available; return (