diff --git a/packages/admin-next/dashboard/src/routes/orders/order-detail/components/order-summary-section/order-summary-section.tsx b/packages/admin-next/dashboard/src/routes/orders/order-detail/components/order-summary-section/order-summary-section.tsx index 1d0db20711..fad330a254 100644 --- a/packages/admin-next/dashboard/src/routes/orders/order-detail/components/order-summary-section/order-summary-section.tsx +++ b/packages/admin-next/dashboard/src/routes/orders/order-detail/components/order-summary-section/order-summary-section.tsx @@ -44,6 +44,7 @@ import { getStylizedAmount, } from "../../../../../lib/money-amount-helpers" import { getTotalCaptured } from "../../../../../lib/payment.ts" +import { getReturnableQuantity } from "../../../../../lib/rma.ts" type OrderSummarySectionProps = { order: AdminOrder @@ -147,6 +148,11 @@ const Header = ({ }) => { const { t } = useTranslation() + // is ture if there is no shipped items ATM + const shouldDisableReturn = order.items.every( + (i) => !(getReturnableQuantity(i) > 0) + ) + return (
{t("fields.summary")} @@ -169,6 +175,7 @@ const Header = ({ to: `/orders/${order.id}/returns`, icon: , disabled: + shouldDisableReturn || !!orderPreview?.order_change?.exchange_id || !!orderPreview?.order_change?.claim_id, }, @@ -181,6 +188,7 @@ const Header = ({ to: `/orders/${order.id}/exchanges`, icon: , disabled: + shouldDisableReturn || (!!orderPreview?.order_change?.return_id && !!!orderPreview?.order_change?.exchange_id) || !!orderPreview?.order_change?.claim_id, @@ -194,6 +202,7 @@ const Header = ({ to: `/orders/${order.id}/claims`, icon: , disabled: + shouldDisableReturn || (!!orderPreview?.order_change?.return_id && !!!orderPreview?.order_change?.claim_id) || !!orderPreview?.order_change?.exchange_id, @@ -431,7 +440,7 @@ const ReturnBreakdown = ({ item && (
@@ -449,7 +458,7 @@ const ReturnBreakdown = ({ {item?.note && ( - + )} @@ -493,7 +502,7 @@ const ClaimBreakdown = ({ !!items.length && (
@@ -532,7 +541,7 @@ const ExchangeBreakdown = ({ !!items.length && (