Gestion des Commandes
+ {orders.length === 0 ? ( +Aucune commande en attente.
+ ) : ( +diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index dc46369..e39c98d 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -2,12 +2,153 @@ import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; import ReactLenis from "lenis/react"; -import FaqDouble from '@/components/sections/faq/FaqDouble'; -import FooterBase from '@/components/sections/footer/FooterBase'; import NavbarLayoutFloatingOverlay from '@/components/navbar/NavbarLayoutFloatingOverlay/NavbarLayoutFloatingOverlay'; -import TextAbout from '@/components/sections/about/TextAbout'; +import FooterBase from '@/components/sections/footer/FooterBase'; +import CardStack from '@/components/cardStack/CardStack'; +import ButtonShiftHover from '@/components/button/ButtonShiftHover/ButtonShiftHover'; +import { useState, useEffect, useCallback } from 'react'; +import { Phone, MessageCircle } from 'lucide-react'; // For call and WhatsApp icons + + +// Mock data for orders +interface OrderItem { + name: string; + quantity: number; + price: number; +} + +interface Order { + id: string; + customerName: string; + customerPhone: string; // E.g., "0550123456" + customerAddress: string; + items: OrderItem[]; + totalPrice: number; + timestamp: string; // ISO string or similar +} + +const mockOrders: Order[] = [ + { + id: "ORD001", customerName: "Ahmed Benali", customerPhone: "0550123456", customerAddress: "Rue Didouche Mourad, Alger Centre", items: [ + { name: "Burger Classique", quantity: 2, price: 450 }, + { name: "Frites XXL", quantity: 1, price: 200 }, + ], + totalPrice: 1100, + timestamp: new Date().toISOString(), + }, + { + id: "ORD002", customerName: "Fatima Zahra", customerPhone: "0770987654", customerAddress: "Cité El Wouroud, Bab Ezzouar", items: [ + { name: "Pizza Pepperoni", quantity: 1, price: 850 }, + { name: "Boisson Gazeuse", quantity: 2, price: 100 }, + ], + totalPrice: 1050, + timestamp: new Date(Date.now() - 5 * 60 * 1000).toISOString(), // 5 mins ago + }, + { + id: "ORD003", customerName: "Rachid Khelifa", customerPhone: "0660112233", customerAddress: "Boulevard Krim Belkacem, Oran", items: [ + { name: "Taco Poulet", quantity: 1, price: 500 }, + { name: "Chicken Nuggets (6pcs)", quantity: 1, price: 600 }, + { name: "Boisson Gazeuse", quantity: 1, price: 100 }, + ], + totalPrice: 1200, + timestamp: new Date(Date.now() - 10 * 60 * 1000).toISOString(), // 10 mins ago + }, +]; + +const OrderCard: React.FC<{ order: Order; onOrderReady: (id: string) => void }> = ({ order, onOrderReady }) => { + const formatPhoneNumberForWhatsApp = (phone: string) => { + // Remove leading '0' if present and add country code "+213" + let formatted = phone.startsWith('0') ? phone.substring(1) : phone; + if (!formatted.startsWith('213')) { + formatted = '213' + formatted; + } + return formatted; + }; + + return ( +
Client: {order.customerName}
+Téléphone: {order.customerPhone}
+Adresse: {order.customerAddress}
+Heure: {new Date(order.timestamp).toLocaleTimeString('fr-FR')}
+Total: {order.totalPrice} DA
+ +Aucune commande en attente.
+ ) : ( +