From d571d564c3d0bcefce841d17f5abff77abcf384b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frane=20Poli=C4=87?= <16856471+fPolic@users.noreply.github.com> Date: Mon, 19 Aug 2024 12:30:56 +0200 Subject: [PATCH] fix(dashboard): disable RMAs if there is no shipped items (#8652) --- .../order-summary-section.tsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) 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 (