diff --git a/src/pages/cart/components/CartDesktopLayout.tsx b/src/pages/cart/components/CartDesktopLayout.tsx index f69ffa4..6c09ad9 100644 --- a/src/pages/cart/components/CartDesktopLayout.tsx +++ b/src/pages/cart/components/CartDesktopLayout.tsx @@ -9,25 +9,21 @@ import ImageWithFallback from "components/ImageWithFallback"; import ArabicPrice from "components/ArabicPrice"; import CartActionsButtons from "components/CartActionsButtons/CartActionsButtons.tsx"; import { CartItem } from "utils/types/appTypes.ts"; -import ProInputCard from "components/ProInputCard/ProInputCard.tsx"; -import ProInModalMultiSelect from "components/ProSelect/ProInModalMultiSelect.tsx"; -import { - updateTables, - removeTable, - selectCart, - selectCartTotal, -} from "features/order/orderSlice.ts"; +import { selectCart, selectCartTotal } from "features/order/orderSlice.ts"; import { useTranslation } from "react-i18next"; import { useAppSelector } from "redux/hooks.ts"; -import { getTableOptions } from "pages/cart/page.tsx"; import SpecialRequestCard from "pages/cart/components/SpecialRequestCard.tsx"; import CouponCard from "pages/cart/components/CouponCard.tsx"; import RewardWaiterCard from "pages/cart/components/RewardWaiterCard.tsx"; +import TableNumberCard from "pages/cart/components/TableNumberCard.tsx"; +import CarPlateCard from "pages/cart/components/CarPlateCard.tsx"; export default function CartDesktopLayout() { const { t } = useTranslation(); - const { items, tables } = useAppSelector(selectCart); + const { items } = useAppSelector(selectCart); + const orderType = localStorage.getItem("orderType"); + const subtotal = useAppSelector(selectCartTotal); const tax = subtotal * 0.1; // 10% tax const total = subtotal + tax; @@ -184,6 +180,9 @@ export default function CartDesktopLayout() { > + + {orderType === "pickup" && } +
{/* Table Number */} -
- - { - updateTables(value); - }} - onClear={() => { - removeTable(); - }} - /> - -
+ {orderType === "dine-in" && ( +
+ +
+ )} {/* Order Summary */} {/* Table Number */} - {orderType === "dine-in" && ( - - { - updateTables(value); - }} - onClear={() => { - removeTable(); - }} - /> - - )} + {orderType === "dine-in" && } {/* Invoice Summary */} diff --git a/src/pages/cart/components/TableNumberCard.tsx b/src/pages/cart/components/TableNumberCard.tsx new file mode 100644 index 0000000..0bf7f3c --- /dev/null +++ b/src/pages/cart/components/TableNumberCard.tsx @@ -0,0 +1,56 @@ +import styles from "pages/cart/cart.module.css"; +import ProInModalMultiSelect from "components/ProSelect/ProInModalMultiSelect.tsx"; +import { + updateTables, + removeTable, + selectCart, +} from "features/order/orderSlice.ts"; +import ProInputCard from "components/ProInputCard/ProInputCard.tsx"; +import { useAppSelector } from "redux/hooks.ts"; +import { useTranslation } from "react-i18next"; +import i18n from "i18n/i18n.ts"; + +// Function to get translated table names +export const getTableOptions = () => [ + { id: "1", name: i18n.t("table1") }, + { id: "2", name: i18n.t("table2") }, + { id: "3", name: i18n.t("table3") }, + { id: "4", name: i18n.t("table4") }, + { id: "5", name: i18n.t("table5") }, + { id: "6", name: i18n.t("table6") }, + { id: "7", name: i18n.t("table7") }, + { id: "8", name: i18n.t("table8") }, + { id: "9", name: i18n.t("table9") }, + { id: "10", name: i18n.t("table10") }, +]; + +export default function TableNumberCard() { + const { t } = useTranslation(); + const { tables } = useAppSelector(selectCart); + return ( + <> + + { + updateTables(value); + }} + onClear={() => { + removeTable(); + }} + /> + + + ); +} diff --git a/src/pages/cart/page.tsx b/src/pages/cart/page.tsx index 6c74e67..80686c6 100644 --- a/src/pages/cart/page.tsx +++ b/src/pages/cart/page.tsx @@ -1,24 +1,9 @@ import { useEffect } from "react"; import CartDesktopLayout from "pages/cart/components/CartDesktopLayout.tsx"; -import i18n from "i18n/i18n.ts"; import CartMobileTabletLayout from "pages/cart/components/CartMobileTabletLayout.tsx"; import useBreakPoint from "hooks/useBreakPoint.ts"; -// Function to get translated table names -export const getTableOptions = () => [ - { id: "1", name: i18n.t("table1") }, - { id: "2", name: i18n.t("table2") }, - { id: "3", name: i18n.t("table3") }, - { id: "4", name: i18n.t("table4") }, - { id: "5", name: i18n.t("table5") }, - { id: "6", name: i18n.t("table6") }, - { id: "7", name: i18n.t("table7") }, - { id: "8", name: i18n.t("table8") }, - { id: "9", name: i18n.t("table9") }, - { id: "10", name: i18n.t("table10") }, -]; - export default function CartPage() { const { isDesktop } = useBreakPoint(); // Prevent keyboard from appearing automatically on mobile