setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
@@ -242,7 +203,7 @@ const ProductCard = ({
{showFavoriteButton && (
:
}
)}
+
{showAddToCart && (
<>
{localQuantity > 0 ? (
@@ -337,4 +306,4 @@ const ProductCard = ({
);
};
-export default ProductCard;
+export default ProductCard;
\ No newline at end of file
diff --git a/src/pages/Cart/CartPage.module.scss b/src/pages/Cart/CartPage.module.scss
index 718e103..3b9d384 100644
--- a/src/pages/Cart/CartPage.module.scss
+++ b/src/pages/Cart/CartPage.module.scss
@@ -16,10 +16,9 @@
.cartHeader {
display: flex;
align-items: center;
- margin-bottom: 12px;
justify-content: space-between;
background-color: #f3f4f6;
- padding-bottom: 15px;
+ padding-top: 10px;
h2 {
font-size: 24px;
font-weight: 700;
@@ -27,6 +26,7 @@
@media screen and (max-width: 768px) {
font-size: 16px;
font-weight: 500;
+
}
}
}
@@ -226,7 +226,7 @@
@media screen and (max-width: 1023px) {
width: 100%;
position: static;
- margin-top: 16px;
+ margin-bottom: 16px;
}
h3 {
diff --git a/src/pages/Cart/index.jsx b/src/pages/Cart/index.jsx
index b2dfac7..1778aeb 100644
--- a/src/pages/Cart/index.jsx
+++ b/src/pages/Cart/index.jsx
@@ -2,13 +2,10 @@ import React, { useState, useRef, useEffect, useMemo } from "react";
import styles from "./CartPage.module.scss";
import { FaTrashAlt } from "react-icons/fa";
import Checkout from "../../components/Checkout";
-import { ChevronDown, ChevronUp } from "lucide-react";
import { Modal } from "antd";
import { useTranslation } from "react-i18next";
import EmptyCartState from "./emptyCart";
import {
- useGetCartQuery,
- useAddToCartMutation,
useRemoveFromCartMutation,
useUpdateCartItemMutation,
useCleanCartMutation,
@@ -17,9 +14,9 @@ import { useCart } from "../../app/api/useCart";
import { DecreaseIcon, IncreaseIcon } from "../../components/Icons";
import Loader from "../../components/Loader/index";
-const TruncatedDescription = ({ description, maxLength = 100 }) => {
- const [isExpanded, setIsExpanded] = useState(false);
+const isPriceZero = (price) => !price || parseFloat(price) === 0;
+const TruncatedDescription = ({ description, maxLength = 100 }) => {
const stripHtml = (html) => {
const doc = new DOMParser().parseFromString(html, "text/html");
return doc.body.textContent || "";
@@ -32,11 +29,9 @@ const TruncatedDescription = ({ description, maxLength = 100 }) => {
@@ -44,20 +39,16 @@ const TruncatedDescription = ({ description, maxLength = 100 }) => {
};
const CartPage = () => {
- const { cartData, cartItems, isLoading, isError, error } = useCart();
+ const { cartData, cartItems, isLoading } = useCart();
+ const { t } = useTranslation();
- const { t, i18n } = useTranslation();
const [checkoutStores, setCheckoutStores] = useState({});
- const [addToCart] = useAddToCartMutation();
const [removeFromCart] = useRemoveFromCartMutation();
const [updateCartItem] = useUpdateCartItemMutation();
const [cleanCart] = useCleanCartMutation();
- const [isExpanded, setIsExpanded] = useState(false);
- const expandedRef = useRef(null);
const [deleteModalVisible, setDeleteModalVisible] = useState(false);
const [emptyCartModalVisible, setEmptyCartModalVisible] = useState(false);
const [itemToDelete, setItemToDelete] = useState(null);
-
const [localQuantities, setLocalQuantities] = useState({});
const [pendingQuantities, setPendingQuantities] = useState({});
const [loadingItems, setLoadingItems] = useState({});
@@ -70,43 +61,35 @@ const CartPage = () => {
width: 400,
};
- // Convert grouped data to stores array
const stores = useMemo(() => {
return Object.entries(cartData)
.map(([storeSlug, items]) => {
- if (!items || !items.length) return null;
-
- // Get store info from first item
+ if (!items?.length) return null;
const storeInfo = items[0]?.product?.channel?.[0];
-
return {
id: storeInfo?.id || storeSlug,
name: storeInfo?.name || storeSlug,
slug: storeSlug,
shipping_price: storeInfo?.shipping_price,
- items: items,
+ items,
};
})
.filter(Boolean);
}, [cartData]);
- // ✅ Initialize local quantities from cart items
useEffect(() => {
- const newLocalQuantities = {};
- const newPendingQuantities = {};
-
+ const newLocal = {};
+ const newPending = {};
cartItems.forEach((item) => {
- const productId = item.product.id;
- const quantity = parseInt(item.product_quantity, 10) || 0;
- newLocalQuantities[productId] = quantity;
- newPendingQuantities[productId] = quantity;
+ const id = item.product.id;
+ const qty = parseInt(item.product_quantity, 10) || 0;
+ newLocal[id] = qty;
+ newPending[id] = qty;
});
-
- setLocalQuantities(newLocalQuantities);
- setPendingQuantities(newPendingQuantities);
+ setLocalQuantities(newLocal);
+ setPendingQuantities(newPending);
}, [cartItems]);
- // ✅ Debounced Cart Update - Her ürün için ayrı debounce
useEffect(() => {
const timers = {};
@@ -114,141 +97,94 @@ const CartPage = () => {
const serverItem = cartItems.find(
(item) => String(item.product.id) === String(productId),
);
- const serverQuantity = serverItem
+ const serverQty = serverItem
? parseInt(serverItem.product_quantity, 10)
: 0;
- const pendingQuantity = pendingQuantities[productId];
+ const pendingQty = pendingQuantities[productId];
- // Değişiklik yoksa veya 0 ise (Delete modalı tetikler) bir şey yapma
if (
- pendingQuantity === undefined ||
- pendingQuantity === serverQuantity ||
- pendingQuantity <= 0
- ) {
+ pendingQty === undefined ||
+ pendingQty === serverQty ||
+ pendingQty <= 0
+ )
return;
- }
timers[productId] = setTimeout(async () => {
try {
setLoadingItems((prev) => ({ ...prev, [productId]: true }));
- await updateCartItem({
- productId,
- quantity: pendingQuantity,
- }).unwrap();
- } catch (error) {
- console.error("Failed to update cart:", error);
- // Hata durumunda rollback
- setLocalQuantities((prev) => ({
- ...prev,
- [productId]: serverQuantity,
- }));
- setPendingQuantities((prev) => ({
- ...prev,
- [productId]: serverQuantity,
- }));
+ await updateCartItem({ productId, quantity: pendingQty }).unwrap();
+ } catch {
+ setLocalQuantities((prev) => ({ ...prev, [productId]: serverQty }));
+ setPendingQuantities((prev) => ({ ...prev, [productId]: serverQty }));
} finally {
setLoadingItems((prev) => ({ ...prev, [productId]: false }));
}
}, 500);
});
- return () => {
- Object.values(timers).forEach((timer) => clearTimeout(timer));
- };
+ return () => Object.values(timers).forEach(clearTimeout);
}, [pendingQuantities, cartItems, updateCartItem]);
const handleQuantityIncrease = (productId) => (event) => {
event.preventDefault();
event.stopPropagation();
-
if (loadingItems[productId]) return;
- const item = cartItems.find((item) => item.product.id === productId);
- if (!item) return;
+ const item = cartItems.find((i) => i.product.id === productId);
+ if (!item || localQuantities[productId] >= item.product.stock) return;
- if (localQuantities[productId] >= item.product.stock) {
- return;
- }
-
- const newQuantity = (localQuantities[productId] || 0) + 1;
- setLocalQuantities((prev) => ({
- ...prev,
- [productId]: newQuantity,
- }));
- setPendingQuantities((prev) => ({
- ...prev,
- [productId]: newQuantity,
- }));
+ const newQty = (localQuantities[productId] || 0) + 1;
+ setLocalQuantities((prev) => ({ ...prev, [productId]: newQty }));
+ setPendingQuantities((prev) => ({ ...prev, [productId]: newQty }));
};
const handleQuantityDecrease = (productId) => (event) => {
event.preventDefault();
event.stopPropagation();
-
if (loadingItems[productId]) return;
- const currentQuantity = localQuantities[productId] || 0;
-
- if (currentQuantity <= 1) {
+ const currentQty = localQuantities[productId] || 0;
+ if (currentQty <= 1) {
showDeleteConfirm(productId);
return;
}
- const newQuantity = currentQuantity - 1;
- setLocalQuantities((prev) => ({
- ...prev,
- [productId]: newQuantity,
- }));
- setPendingQuantities((prev) => ({
- ...prev,
- [productId]: newQuantity,
- }));
+ const newQty = currentQty - 1;
+ setLocalQuantities((prev) => ({ ...prev, [productId]: newQty }));
+ setPendingQuantities((prev) => ({ ...prev, [productId]: newQty }));
};
- const calculateStoreTotal = (storeItems) => {
- return storeItems.reduce((sum, item) => {
- const itemPrice = parseFloat(item.product.price_amount) || 0;
- const itemQuantity = parseInt(item.product_quantity, 10) || 0;
- return sum + itemPrice * itemQuantity;
+ const getStoreShippingPrice = (store) =>
+ store.shipping_price != null ? parseFloat(store.shipping_price) : 20;
+
+ // Store içinde fiyatsız ürün var mı?
+ const storeHasZeroPriceItem = (storeItems) =>
+ storeItems.some((item) => isPriceZero(item.product.price_amount));
+
+ const calculateStoreTotal = (storeItems) =>
+ storeItems.reduce((sum, item) => {
+ return (
+ sum +
+ (parseFloat(item.product.price_amount) || 0) *
+ (parseInt(item.product_quantity, 10) || 0)
+ );
}, 0);
- };
- const getStoreShippingPrice = (store) => {
- return store.shipping_price !== null && store.shipping_price !== undefined
- ? parseFloat(store.shipping_price)
- : 20;
- };
-
- const handleCheckout = (storeId) => {
+ const handleCheckout = (storeId) =>
setCheckoutStores((prev) => ({ ...prev, [storeId]: true }));
- };
- const handleBackToCart = (storeId) => {
+ const handleBackToCart = (storeId) =>
setCheckoutStores((prev) => ({ ...prev, [storeId]: false }));
- };
- const handleOrderSubmit = async (storeId, storeItems) => {
+ const handleOrderSubmit = async (storeId) => {
if (checkoutStores[storeId] && checkoutRefs.current[storeId]) {
const success = await checkoutRefs.current[storeId]();
- if (success) {
- setCheckoutStores((prev) => ({ ...prev, [storeId]: false }));
- }
+ if (success) setCheckoutStores((prev) => ({ ...prev, [storeId]: false }));
} else {
handleCheckout(storeId);
}
};
- useEffect(() => {
- const handleClickOutside = (event) => {
- if (expandedRef.current && !expandedRef.current.contains(event.target)) {
- setIsExpanded(false);
- }
- };
-
- document.addEventListener("mousedown", handleClickOutside);
- return () => document.removeEventListener("mousedown", handleClickOutside);
- }, []);
-
const showDeleteConfirm = (productId) => {
setItemToDelete(productId);
setDeleteModalVisible(true);
@@ -258,48 +194,41 @@ const CartPage = () => {
if (itemToDelete) {
try {
await removeFromCart({ productId: itemToDelete }).unwrap();
-
setLocalQuantities((prev) => {
- const newState = { ...prev };
- delete newState[itemToDelete];
- return newState;
+ const s = { ...prev };
+ delete s[itemToDelete];
+ return s;
});
setPendingQuantities((prev) => {
- const newState = { ...prev };
- delete newState[itemToDelete];
- return newState;
+ const s = { ...prev };
+ delete s[itemToDelete];
+ return s;
});
- } catch (error) {
- console.error("Failed to remove item:", error);
+ } catch (e) {
+ console.error("Failed to remove item:", e);
}
}
setDeleteModalVisible(false);
setItemToDelete(null);
};
- const showEmptyCartConfirm = () => {
- setEmptyCartModalVisible(true);
- };
-
const handleEmptyCartConfirm = async () => {
try {
await cleanCart().unwrap();
-
setLocalQuantities({});
setPendingQuantities({});
setCheckoutStores({});
- } catch (error) {
- console.error("Failed to clean cart:", error);
+ } catch (e) {
+ console.error("Failed to clean cart:", e);
}
setEmptyCartModalVisible(false);
};
- const getTotalItemCount = () => {
- return cartItems.reduce(
+ const getTotalItemCount = () =>
+ cartItems.reduce(
(sum, item) => sum + parseInt(item.product_quantity, 10),
0,
);
- };
return (
@@ -339,21 +268,20 @@ const CartPage = () => {
{t("cart.basket")} ({getTotalItemCount()})
-
-
-
+
{stores.map((store) => {
const shippingPrice = getStoreShippingPrice(store);
const storeTotal = calculateStoreTotal(store.items);
const totalWithShipping = storeTotal + shippingPrice;
+ const hasZeroPrice = storeHasZeroPriceItem(store.items);
return (
@@ -363,8 +291,8 @@ const CartPage = () => {
shippingPrice={shippingPrice}
productIds={store.items.map((item) => item.product.id)}
onBackToCart={() => handleBackToCart(store.id)}
- onPlaceOrder={(placeOrderFn) => {
- checkoutRefs.current[store.id] = placeOrderFn;
+ onPlaceOrder={(fn) => {
+ checkoutRefs.current[store.id] = fn;
}}
/>
) : (
@@ -391,10 +319,9 @@ const CartPage = () => {
- {(
- parseFloat(item.product.price_amount) || 0
- ).toFixed(2)}{" "}
- m.
+ {isPriceZero(item.product.price_amount)
+ ? "Bahasyny anyklamaly"
+ : `${parseFloat(item.product.price_amount).toFixed(2)} m.`}
)}
+ {/* ✅ Store Summary - fiyatsız ürün varsa "Baha anyklamak" */}
{store.name} - {t("cart.basket")}:
-
- {t("cart.price")}:
- {storeTotal.toFixed(2)} m.
-
-
- {t("cart.delivery")}:
- {shippingPrice.toFixed(2)} m.
-
-
- {t("cart.total")}:
- {totalWithShipping.toFixed(2)} m.
-
+ {hasZeroPrice ? (
+ <>
+
+ {t("cart.price")}:
+ Bahasyny anyklamaly
+
+
+ {t("cart.delivery")}:
+ Bahasyny anyklamaly
+
+
+ {t("cart.total")}:
+ Bahasyny anyklamaly
+
+ >
+ ) : (
+ <>
+
+ {t("cart.price")}:
+ {storeTotal.toFixed(2)} m.
+
+
+ {t("cart.delivery")}:
+ {shippingPrice.toFixed(2)} m.
+
+
+ {t("cart.total")}:
+ {totalWithShipping.toFixed(2)} m.
+
+ >
+ )}
-
{/* Mobile sticky summary */}
{/*
diff --git a/src/pages/OrderDetail/OrderDetail.module.scss b/src/pages/OrderDetail/OrderDetail.module.scss
index 535428d..19c1186 100644
--- a/src/pages/OrderDetail/OrderDetail.module.scss
+++ b/src/pages/OrderDetail/OrderDetail.module.scss
@@ -127,6 +127,7 @@
border-radius: 4px;
margin-bottom: 20px;
display: flex;
+
@media screen and (max-width: 640px) {
flex-direction: column;
}
@@ -140,6 +141,7 @@
.row {
display: flex;
margin-bottom: 10px;
+ gap: 12px;
@media screen and (max-width: 640px) {
justify-content: space-between;
}
@@ -157,10 +159,10 @@
&:first-child {
font-weight: 600;
color: #000;
- width: 25%;
- @media screen and (max-width: 640px) {
- width: 50%;
- }
+ // width: 25%;
+ // @media screen and (max-width: 640px) {
+ // width: 50%;
+ // }
}
&:last-child {
@@ -295,3 +297,106 @@
}
}
}
+
+.pendingPriceBadgeWrapper {
+ position: relative;
+ display: inline-flex;
+ align-items: center;
+}
+
+.pendingPriceBadge {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 20px;
+ height: 20px;
+ border-radius: 50%;
+ background: #faeeda;
+ border: 0.5px solid #ef9f27;
+ color: #854f0b;
+ font-size: 12px;
+ font-weight: 500;
+ cursor: pointer;
+ user-select: none;
+}
+
+.pendingPriceTooltip {
+ position: absolute;
+ bottom: calc(100% + 6px);
+ left: 50%;
+ transform: translateX(-50%);
+ background: var(--color-background-primary, #ffffff);
+ border: 0.5px solid var(--color-border-secondary, #e2e2e2);
+ border-radius: var(--border-radius-md, 6px);
+ padding: 8px 12px;
+ width: 220px;
+ font-size: 13px;
+ color: var(--color-text-primary, #333333);
+ line-height: 1.5;
+ z-index: 100;
+ white-space: normal;
+ pointer-events: none;
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
+
+ @media (max-width: 767px) {
+ display: none;
+ }
+
+ strong {
+ display: block;
+ margin-bottom: 4px;
+ color: var(--color-text-primary, #000000);
+ }
+}
+
+:global {
+ .pending-price-modal {
+ .ant-modal-content {
+ border-radius: 12px;
+ padding: 24px;
+ @media (max-width: 767px) {
+ padding: 20px;
+ }
+ }
+
+ .ant-modal-header {
+ margin-bottom: 12px;
+ .ant-modal-title {
+ font-size: 18px;
+ font-weight: 600;
+ color: #333;
+ @media (max-width: 767px) {
+ font-size: 16px;
+ }
+ }
+ }
+
+ .ant-modal-body {
+ p {
+ font-size: 14px;
+ line-height: 1.6;
+ color: #555;
+ margin: 0;
+ @media (max-width: 767px) {
+ font-size: 13px;
+ }
+ }
+ }
+
+ .ant-modal-footer {
+ margin-top: 20px;
+ .ant-btn-primary {
+ background-color: #888888;
+ border-color: #888888;
+ border-radius: 6px;
+ height: 36px;
+ padding: 0 20px;
+ font-weight: 500;
+ &:hover {
+ background-color: #666666;
+ border-color: #666666;
+ }
+ }
+ }
+ }
+}
diff --git a/src/pages/OrderDetail/index.jsx b/src/pages/OrderDetail/index.jsx
index 252f4d8..70d1ad8 100644
--- a/src/pages/OrderDetail/index.jsx
+++ b/src/pages/OrderDetail/index.jsx
@@ -1,63 +1,128 @@
-import { useParams } from "react-router-dom";
+import { useParams, useNavigate } from "react-router-dom";
+import { useState } from "react";
import styles from "./OrderDetail.module.scss";
-import { Ban, CircleCheck, X } from "lucide-react";
import { useTranslation } from "react-i18next";
-import { useGetOrderByIdQuery } from "../../app/api/orderApi"; // Update with your correct path
-import track from "../../assets/track.jpg"; // Keep for delivery service icon
+import { useGetOrderByIdQuery } from "../../app/api/orderApi";
+import track from "../../assets/track.jpg";
import Loader from "../../components/Loader/index";
-import { Result, Button } from "antd";
-import { useNavigate } from "react-router-dom";
+import { Result, Button, Modal } from "antd";
+
+const isPriceZero = (price) => !price || parseFloat(price) === 0;
+
+const PendingPriceModal = ({ open, onClose, t }) => (
+
+
+ Bu sargytdaky bir ýa-da birnäçe harydyň bahasy entek kesgitlenmedik.
+ Operatorymyz siziň bilen habarlaşyp, goşmaça maglumat berer.
+
+
+);
+
+const PendingPriceBadge = ({ t }) => {
+ const [tooltipVisible, setTooltipVisible] = useState(false);
+ const [modalVisible, setModalVisible] = useState(false);
+ const [isMobile] = useState(() => /Mobi|Android/i.test(navigator.userAgent));
+
+ const handleClick = (e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ if (isMobile) setModalVisible(true);
+ };
+
+ const stopPropagation = (e) => {
+ e.stopPropagation();
+ };
+
+ return (
+
+ !isMobile && setTooltipVisible(true)}
+ onMouseLeave={() => setTooltipVisible(false)}
+ onClick={handleClick}
+ onTouchEnd={(e) => {
+ e.stopPropagation();
+ }}
+ >
+ !
+
+ {tooltipVisible && (
+
+ Bahasyny anyklamaly
+ Bu sargytdaky harydyň bahasy kesgitlenmedik. Operator size jaň edip
+ goşmaça maglumat berer.
+
+ )}
+
+
+ setModalVisible(false)}
+ t={t}
+ />
+
+ );
+};
+
const OrderDetail = () => {
const { t } = useTranslation();
- const { id } = useParams(); // Get the order ID from URL params
- const { data: orderData, isLoading, error } = useGetOrderByIdQuery(id);
+ const { id } = useParams();
const navigate = useNavigate();
- // Format date function
+ const { data: orderData, isLoading, error } = useGetOrderByIdQuery(id);
+
const formatDate = (dateString) => {
try {
- const date = new Date(dateString);
- return date.toLocaleString("tk-TM", {
+ return new Date(dateString).toLocaleString("tk-TM", {
day: "2-digit",
month: "2-digit",
year: "numeric",
hour: "2-digit",
minute: "2-digit",
});
- } catch (e) {
+ } catch {
return dateString;
}
};
- // Format delivery time for display
const formatDeliveryTime = (time, date) => {
try {
- const deliveryDate = new Date(date);
- const formattedDate = deliveryDate.toLocaleDateString("tk-TM", {
+ const formatted = new Date(date).toLocaleDateString("tk-TM", {
day: "2-digit",
month: "2-digit",
year: "numeric",
});
- return `${time} (${formattedDate})`;
- } catch (e) {
- return `${time}`;
+ return `${time} (${formatted})`;
+ } catch {
+ return time;
}
};
- // Calculate total order amount
const calculateTotal = (orderItems) => {
- if (!orderItems || !orderItems.length) return 0;
+ if (!orderItems?.length) return null;
+ const hasZero = orderItems.some((item) =>
+ isPriceZero(item.unit_price_amount),
+ );
+ if (hasZero) return null;
return orderItems
.reduce(
(sum, item) => sum + parseFloat(item.unit_price_amount) * item.quantity,
- 0
+ 0,
)
.toFixed(2);
};
- // Handle loading state
if (isLoading) return
;
- // Handle error state
if (error)
return (
{
/>
);
- // Handle case where order data is not available
if (!orderData) return Order not found
;
- // Calculate total
const totalAmount = calculateTotal(orderData.orderItems);
return (
@@ -84,39 +147,10 @@ const OrderDetail = () => {
{t("order.orderNumber")}: {orderData.id}
-
- {/*
*/}
- {/*
*/}
-
+
-
- {/* Order Status */}
- {/*
-
-
-
- {" "}
- {t("order.Your_order_has_been_accepted")}
-
-
-
-
-
*/}
- {/* Order Details */}
+
@@ -132,7 +166,7 @@ const OrderDetail = () => {
{formatDeliveryTime(
orderData.delivery_time,
- orderData.delivery_at
+ orderData.delivery_at,
)}
@@ -144,11 +178,26 @@ const OrderDetail = () => {
{t("order.sum")}:
-
{totalAmount} m.
+
+ {totalAmount === null ? (
+
+
+
+ ) : (
+ `${totalAmount} m.`
+ )}
+
+ {/* Desktop table */}
@@ -165,9 +214,12 @@ const OrderDetail = () => {
{orderData.orderItems.map((item, index) => {
const product = item.product;
- const itemTotal = (
- parseFloat(item.unit_price_amount) * item.quantity
- ).toFixed(2);
+ const zeroPriceItem = isPriceZero(item.unit_price_amount);
+ const itemTotal = zeroPriceItem
+ ? null
+ : (
+ parseFloat(item.unit_price_amount) * item.quantity
+ ).toFixed(2);
return (
@@ -181,27 +233,50 @@ const OrderDetail = () => {
| {product.name} |
{product.brand || "-"} |
{product.id || "-"} |
- {item.unit_price_amount} m. |
+
+ {zeroPriceItem ? (
+
+
+
+ ) : (
+ `${item.unit_price_amount} m.`
+ )}
+ |
{item.quantity} |
- {itemTotal} m. |
+
+ {itemTotal === null ? (
+
+
+
+ ) : (
+ `${itemTotal} m.`
+ )}
+ |
);
})}
- {/* Add delivery service row if shipping method exists */}
+
{orderData.shipping_method && (
-
+
|
Eltip bermek hyzmaty |
Beýleki |
DELIVERY |
- 10.00 m. | {" "}
- {/* You may need to get actual delivery cost from API */}
+ 10.00 m. |
1 |
10.00 m. |
@@ -210,13 +285,15 @@ const OrderDetail = () => {
- {/* Mobile View */}
+
+ {/* Mobile cards */}
{orderData.orderItems.map((item, index) => {
const product = item.product;
- const itemTotal = (
- parseFloat(item.unit_price_amount) * item.quantity
- ).toFixed(2);
+ const zeroPriceItem = isPriceZero(item.unit_price_amount);
+ const itemTotal = zeroPriceItem
+ ? null
+ : (parseFloat(item.unit_price_amount) * item.quantity).toFixed(2);
return (
@@ -233,18 +310,30 @@ const OrderDetail = () => {
{t("order.quantity")}: {item.quantity}
- {item.unit_price_amount} m.
+ {zeroPriceItem ? (
+
+
+
+ ) : (
+ `${item.unit_price_amount} m.`
+ )}
);
})}
- {/* Add delivery service card if shipping method exists */}
- {orderData.shipping_method && (
+
+ {/* {orderData.shipping_method && (
-

+
Beýleki
@@ -257,7 +346,7 @@ const OrderDetail = () => {
- )}
+ )} */}