diff --git a/src/components/productChoicesCard/ProductChoicesCard.tsx b/src/components/productChoicesCard/ProductChoicesCard.tsx
new file mode 100644
index 0000000..86a4803
--- /dev/null
+++ b/src/components/productChoicesCard/ProductChoicesCard.tsx
@@ -0,0 +1,162 @@
+import { Space, Divider } from "antd";
+import ProText from "components/ProText.tsx";
+import styles from "pages/cart/cart.module.css";
+import ArabicPrice from "components/ArabicPrice";
+import ImageWithFallback from "components/ImageWithFallback";
+import CartActionsButtons from "components/CartActionsButtons/CartActionsButtons.tsx";
+import { CartItem } from "utils/types/appTypes.ts";
+import { useAppSelector } from "redux/hooks.ts";
+import useBreakPoint from "hooks/useBreakPoint.ts";
+import { OrderItem } from "pages/checkout/hooks/types.ts";
+
+type ProductChoicesCardProps = {
+ product: CartItem | OrderItem;
+ addDividerAfter: boolean;
+};
+export default function ProductChoicesCard({
+ product,
+ addDividerAfter,
+}: ProductChoicesCardProps) {
+ const { isRTL } = useAppSelector((state) => state.locale);
+ const { isMobile, isTablet } = useBreakPoint();
+
+ const getMenuItemImageStyle = () => {
+ if (isMobile) {
+ return {
+ width: 115,
+ height: 96,
+ };
+ }
+ return {
+ width: 120,
+ height: 120,
+ };
+ };
+
+ return (
+
+
+
+
+
+ {product.name}
+
+
+
+ {product.type === "CartItem" &&
+ (isRTL
+ ? product.variant?.optionsAR.map((o) => o.value).join(", ")
+ : product.variant?.options.map((o) => o.value).join(", "))}
+ {product.type === "OrderItem" && product.variantName}
+
+
+ {product.type === "CartItem"
+ ? product.extrasgroupnew?.map((o) => (
+
+ {isRTL ? o.extrasStringAR : o.extrasString}
+
+ ))
+ : // ToDo
+ product.itemline}
+
+
+
+
+
+ {product.type === "CartItem" && (
+
+
+
+ )}
+
+
+
+ {addDividerAfter &&
}
+
+ );
+}
diff --git a/src/pages/cart/components/CartMobileTabletLayout.tsx b/src/pages/cart/components/CartMobileTabletLayout.tsx
index b937f7a..1dbff65 100644
--- a/src/pages/cart/components/CartMobileTabletLayout.tsx
+++ b/src/pages/cart/components/CartMobileTabletLayout.tsx
@@ -1,9 +1,6 @@
import { Card, Divider, Space, Layout, Button, Popconfirm } from "antd";
-import ArabicPrice from "components/ArabicPrice";
-import CartActionsButtons from "components/CartActionsButtons/CartActionsButtons.tsx";
-import ImageWithFallback from "components/ImageWithFallback";
+
import ProHeader from "components/ProHeader/ProHeader.tsx";
-import ProText from "components/ProText.tsx";
import ProTitle from "components/ProTitle.tsx";
import { clearCart, selectCart } from "features/order/orderSlice.ts";
import styles from "pages/cart/cart.module.css";
@@ -20,10 +17,10 @@ import SpecialRequestCard from "pages/cart/components/specialRequest/SpecialRequ
import TableNumberCard from "pages/cart/components/TableNumberCard.tsx";
import { OrderType } from "pages/checkout/hooks/types";
import { useTranslation } from "react-i18next";
-import { Variant } from "utils/types/appTypes";
import DeleteIcon from "components/Icons/DeleteIcon";
import PlusIcon from "components/Icons/PlusIcon";
import { GiftItemsCard } from "pages/redeem/components/GiftItemsCard";
+import ProductChoicesCard from "components/productChoicesCard/ProductChoicesCard.tsx";
interface CartMobileTabletLayoutProps {
form: FormInstance;
@@ -41,18 +38,6 @@ export default function CartMobileTabletLayout({
const getResponsiveClass = () => (isTablet ? "tablet" : "mobile");
const navigate = useNavigate();
const dispatch = useAppDispatch();
- const getMenuItemImageStyle = () => {
- if (isMobile) {
- return {
- width: 115,
- height: 96,
- };
- }
- return {
- width: 120,
- height: 120,
- };
- };
return (
@@ -137,112 +122,11 @@ export default function CartMobileTabletLayout({
)}
{items.map((item, index) => (
-
-
-
-
-
- {item.name}{" "}
-
- {isRTL
- ? (item.variant as Variant)?.optionsAR?.[0]?.value
- : (item.variant as Variant)?.options?.[0]?.value}
-
-
-
-
- {item.description}
-
-
-
-
-
-
-
- {index !== items.length - 1 && (
-
- )}
-
+
))}
+
+ }
+ onClick={handleAddToCart}
+ disabled={!isValid}
+ style={{
+ flex: 1,
+ height: 48,
+ fontSize: isMobile ? "1rem" : "16px",
+ transition: "all 0.3s ease",
+ width: "100%",
+ borderRadius: 888,
+ boxShadow: "none",
+ backgroundColor: isValid
+ ? colors.primary
+ : "rgba(233, 233, 233, 1)",
+ color: isValid ? "#FFF" : "#999",
+ cursor: isValid ? "pointer" : "not-allowed",
+ }}
+ onMouseEnter={(e) => {
+ if (!isMobile && isValid) {
+ e.currentTarget.style.transform = "translateY(-2px)";
+ }
+ }}
+ onMouseLeave={(e) => {
+ if (!isMobile) {
+ e.currentTarget.style.transform = "translateY(0)";
+ }
+ }}
+ >
+ {isValid ? t("menu.addToCart") : t("menu.selectRequiredOptions")}
+
diff --git a/src/utils/types/appTypes.ts b/src/utils/types/appTypes.ts
index 99151d2..bb1404f 100644
--- a/src/utils/types/appTypes.ts
+++ b/src/utils/types/appTypes.ts
@@ -314,24 +314,29 @@ export interface Translation {
// #################################################
-export interface CartItem {
+export type CartItem = {
+ type: "CartItem";
id: number | string;
name: string;
price: number;
image: string;
quantity: number;
description: string;
- variant?: Variant | string;
+ variant?: Variant;
extras?: Extra[];
- extrasgroupnew?: Array<{ groupid: string; extrasid: Array }>;
+ extrasgroupnew?: Array<{
+ groupid: string;
+ extrasid: Array;
+ extrasString: string;
+ extrasStringAR: string;
+ }>;
extrasgroup?: Array;
isHasLoyalty?: boolean;
no_of_stamps_give?: number;
comment?: string;
// Unique identifier for cart items with the same product but different variants/extras/comments
uniqueId?: string;
-
-}
+};
export interface UserType {
id: number;
@@ -616,8 +621,17 @@ export interface Option {
export interface Extra {
id: number;
+ item_id: number;
price: number;
name: string;
+ nameAR: string;
+ created_at: string;
+ updated_at: string;
+ deleted_at: any;
+ extra_for_all_variants: number;
+ is_custome: number;
+ is_available: number;
+ modifier_id: any;
}
export interface TheExtrasGroup {