From 98e6bb2a3711aaa1fcbf1e471bb96d5084dce39d Mon Sep 17 00:00:00 2001 From: sheraj <123598317+sheraj923@users.noreply.github.com> Date: Thu, 27 Jun 2024 12:51:10 -0600 Subject: [PATCH 1/2] done with pop with --- Components/ui/spinner.jsx | 23 +++++++++++++++++++ app/restraunt/home/page.js | 21 +++++++++++++++--- app/restraunt/order/page.js | 42 +++++++++++++++++++++++++++++++++-- app/restraunt/setting/page.js | 22 ++++++++++++++---- 4 files changed, 99 insertions(+), 9 deletions(-) create mode 100644 Components/ui/spinner.jsx diff --git a/Components/ui/spinner.jsx b/Components/ui/spinner.jsx new file mode 100644 index 0000000..1d0e6a8 --- /dev/null +++ b/Components/ui/spinner.jsx @@ -0,0 +1,23 @@ +// components/ui/spinner.js +export function Spinner() { + return ( +
+ +
+ ) + } + \ No newline at end of file diff --git a/app/restraunt/home/page.js b/app/restraunt/home/page.js index 3d66da7..88dc0e6 100644 --- a/app/restraunt/home/page.js +++ b/app/restraunt/home/page.js @@ -1,7 +1,7 @@ 'use client'; import React, { useState, useEffect } from 'react'; import { useTable, useGlobalFilter } from 'react-table'; -import Image from 'next/image'; +import Swal from 'sweetalert2'; import { MoreHorizontal } from "lucide-react"; import { useUserAuth } from '@/services/utils'; import { getRestaurantInformation, getMenuInformationByUser } from '@/services/GetRequest/getRequest'; @@ -38,7 +38,7 @@ export default function SettingsRestaurant() { const [restaurantData, setRestaurantData] = useState([]); const [menuData, setMenuData] = useState([{ id: 1, - imageUrl: '/images/food.png', + imageUrl: "url(/assets/images/restCover.jpg)", name: 'Classic Burger', status: 'Available', price: 8.99, @@ -170,6 +170,7 @@ export default function SettingsRestaurant() { const columns = React.useMemo( () => [ + /* { Header: 'Image', accessor: 'imageUrl', @@ -178,7 +179,21 @@ export default function SettingsRestaurant() { alt={`Product image - ${original.name}`} className="aspect-square rounded-md object-cover" height="64" - src={value} + src={"url(/assets/images/restCover.jpg)"} + width="64" + /> + ), + }, + */ + { + Header: 'Image', + accessor: 'imageUrl', + Cell: ({ row: { original } }) => ( + {`Product ), diff --git a/app/restraunt/order/page.js b/app/restraunt/order/page.js index b70f389..2d61155 100644 --- a/app/restraunt/order/page.js +++ b/app/restraunt/order/page.js @@ -2,8 +2,8 @@ import React, { useState } from "react" import { Input } from "@/components/ui/input" import { Button } from "@/components/ui/button" -import { AlertDialog , AlertDialogContent , AlertDialogHeader , AlertDialogTitle , AlertDialogDescription , AlertDialogFooter , AlertDialogCancel ,AlertDialogAction } from "@/components/ui/alert-dialog" - +import { AlertDialog , AlertDialogContent,AlertDialogTrigger , AlertDialogHeader , AlertDialogTitle , AlertDialogDescription , AlertDialogFooter , AlertDialogCancel ,AlertDialogAction } from "@/components/ui/alert-dialog" +import { Spinner } from "@/components/ui/spinner" export default function Order() { const [orders, setOrders] = useState([ { @@ -39,6 +39,7 @@ export default function Order() { createdAt: new Date("2023-06-15T12:00:00Z"), }, ]) + const [searchQuery, setSearchQuery] = useState("") const [showCancelConfirmation, setShowCancelConfirmation] = useState(false) const [orderToCancel, setOrderToCancel] = useState(null) @@ -46,6 +47,12 @@ export default function Order() { setOrders((prevOrders) => prevOrders.map((order) => (order.id === orderId ? { ...order, status: "Waiting for Pickup" } : order)), ) + setIsDialogOpen(true) + setIsLoading(true) + setTimeout(() => { + setIsLoading(false) + setIsDialogOpen(false) + }, 4000) // Simulate a 2-second loading time } const handlePickupComplete = (orderId) => { setOrders((prevOrders) => prevOrders.filter((order) => order.id !== orderId)) @@ -64,6 +71,12 @@ export default function Order() { setOrderToCancel(null) } const filteredOrders = orders.filter((order) => order.id.toString().includes(searchQuery)) + + const [isLoading, setIsLoading] = useState(false) + const [isDialogOpen, setIsDialogOpen] = useState(false) + + + return (

Incoming Orders

@@ -131,6 +144,31 @@ export default function Order() { + + +
+ + + + {isLoading ? 'Notifying Customer...' : 'Notification Complete'} + + {isLoading ? ( +
+ +

Please wait while we notify the customer.

+
+ ) : ( + 'The customer has been successfully notified.' + )} +
+
+ {!isLoading && ( + + setIsDialogOpen(false)}>Close + + )} +
+ diff --git a/app/restraunt/setting/page.js b/app/restraunt/setting/page.js index c731eea..91f7a9c 100644 --- a/app/restraunt/setting/page.js +++ b/app/restraunt/setting/page.js @@ -6,8 +6,14 @@ import { Input } from "@/components/ui/input" import { Button } from "@/components/ui/button" import { AlertDialog , AlertDialogContent , AlertDialogHeader , AlertDialogTitle , AlertDialogDescription , AlertDialogFooter , AlertDialogCancel ,AlertDialogAction , AlertDialogTrigger} from "@/components/ui/alert-dialog" import { Dialog, DialogContent, DialogFooter, DialogClose } from "@/components/ui/dialog" - +import { deleteRestaurantData } from "@/services/PostRequest/postRequest" +import { getRestaurantInformationByUser } from "@/services/GetRequest/getRequest" +import { useUserAuth } from '@/services/utils'; +import { useEffect } from "react" export default function Component() { + const { user } = useUserAuth(); + const [restaurantData, setRestaurantData] = useState([]); + const [showCurrentPassword, setShowCurrentPassword] = useState(false) const [showNewPassword, setShowNewPassword] = useState(false) const [showConfirmPassword, setShowConfirmPassword] = useState(false) @@ -16,6 +22,14 @@ export default function Component() { setShowPasswordResetModal(true) } + useEffect(() => { + async function fetchData() { + const data = await getRestaurantInformationByUser(user); + console.log(data) + setRestaurantData(data); + } + fetchData(); + }, []); return (
@@ -29,11 +43,11 @@ export default function Component() {
- +
- +
@@ -139,7 +153,7 @@ export default function Component() {
-
From 63f9d5c987aa945546bb0ce0d73c8b39a0ea4a03 Mon Sep 17 00:00:00 2001 From: sheraj <123598317+sheraj923@users.noreply.github.com> Date: Thu, 27 Jun 2024 12:53:35 -0600 Subject: [PATCH 2/2] made the timmer longer --- app/restraunt/setting/page.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/restraunt/setting/page.js b/app/restraunt/setting/page.js index 91f7a9c..32f672c 100644 --- a/app/restraunt/setting/page.js +++ b/app/restraunt/setting/page.js @@ -43,11 +43,11 @@ export default function Component() {
- +
- +