From 1e761345be9fd179b03682b8291158147485135d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frane=20Poli=C4=87?= <16856471+fPolic@users.noreply.github.com> Date: Tue, 25 Nov 2025 20:37:45 +0100 Subject: [PATCH] feat(dashboard): show promo tooltip on the edit flows (#14121) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary **What** — What changes are introduced in this PR? Display a tootlipt on line items when creating OrderEdit/Exchange to show which promotions are applied on the items. --- ## Checklist Please ensure the following before requesting a review: - [x] I have added a **changeset** for this PR - Every non-breaking change should be marked as a **patch** - To add a changeset, run `yarn changeset` and follow the prompts - [ ] The changes are covered by relevant **tests** - [x] I have verified the code works as intended locally - [ ] I have linked the related issue(s) if applicable Screenshot 2025-11-25 at 14 11 22 Screenshot 2025-11-25 at 14 23 26 --- .changeset/cozy-candles-work.md | 5 +++ .../order-edit-item.tsx | 31 +++++++++++++++-- .../exchange-inbound-item.tsx | 33 ++++++++++++++++--- .../exchange-outbound-item.tsx | 27 ++++++++++++--- 4 files changed, 85 insertions(+), 11 deletions(-) create mode 100644 .changeset/cozy-candles-work.md diff --git a/.changeset/cozy-candles-work.md b/.changeset/cozy-candles-work.md new file mode 100644 index 0000000000..441e79a511 --- /dev/null +++ b/.changeset/cozy-candles-work.md @@ -0,0 +1,5 @@ +--- +"@medusajs/dashboard": patch +--- + +feat(dashboard): show promo tooltip on edit flows diff --git a/packages/admin/dashboard/src/routes/orders/order-create-edit/components/order-edit-create-form/order-edit-item.tsx b/packages/admin/dashboard/src/routes/orders/order-create-edit/components/order-edit-create-form/order-edit-item.tsx index fd164a19ed..126239bb81 100644 --- a/packages/admin/dashboard/src/routes/orders/order-create-edit/components/order-edit-create-form/order-edit-item.tsx +++ b/packages/admin/dashboard/src/routes/orders/order-create-edit/components/order-edit-create-form/order-edit-item.tsx @@ -1,6 +1,11 @@ -import { ArrowUturnLeft, DocumentSeries, XCircle } from "@medusajs/icons" +import { + ArrowUturnLeft, + DocumentSeries, + ReceiptPercent, + XCircle, +} from "@medusajs/icons" import { AdminOrderLineItem } from "@medusajs/types" -import { Badge, Input, Text, toast } from "@medusajs/ui" +import { Badge, Input, Text, toast, Tooltip } from "@medusajs/ui" import { useTranslation } from "react-i18next" import { ActionMenu } from "../../../../../components/common/action-menu" @@ -45,6 +50,10 @@ function OrderEditItem({ item, currencyCode, orderId }: OrderEditItemProps) { return !!updateAction && item.quantity === item.detail.fulfilled_quantity }, [item]) + const appliedPromoCodes = useMemo(() => { + return (item.adjustments || []).map((adjustment) => adjustment.code) + }, [item]) + /** * HANDLERS */ @@ -166,7 +175,7 @@ function OrderEditItem({ item, currencyCode, orderId }: OrderEditItemProps) { )} -
+
{t("fields.qty")} + + {appliedPromoCodes.length > 0 && ( +
+ + {appliedPromoCodes.map((code) => ( +
{code}
+ ))} + + } + > + +
+
+ )}
diff --git a/packages/admin/dashboard/src/routes/orders/order-create-exchange/components/exchange-create-form/exchange-inbound-item.tsx b/packages/admin/dashboard/src/routes/orders/order-create-exchange/components/exchange-create-form/exchange-inbound-item.tsx index e9ae7f4403..cd4b0efdd6 100644 --- a/packages/admin/dashboard/src/routes/orders/order-create-exchange/components/exchange-create-form/exchange-inbound-item.tsx +++ b/packages/admin/dashboard/src/routes/orders/order-create-exchange/components/exchange-create-form/exchange-inbound-item.tsx @@ -1,6 +1,12 @@ -import { ChatBubble, DocumentText, XCircle, XMark } from "@medusajs/icons" +import { + ChatBubble, + DocumentText, + ReceiptPercent, + XCircle, + XMark, +} from "@medusajs/icons" import { AdminOrderLineItem, HttpTypes } from "@medusajs/types" -import { IconButton, Input, Text } from "@medusajs/ui" +import { IconButton, Input, Text, Tooltip } from "@medusajs/ui" import { UseFormReturn } from "react-hook-form" import { useTranslation } from "react-i18next" @@ -39,13 +45,17 @@ function ExchangeInboundItem({ const showReturnReason = typeof formItem.reason_id === "string" const showNote = typeof formItem.note === "string" + const appliedPromoCodes = (previewItem.adjustments || []).map( + (adjustment) => adjustment.code + ) + return (
-
+
-
+
{item.title}{" "} @@ -57,6 +67,21 @@ function ExchangeInboundItem({ {item.product_title}
+ {appliedPromoCodes.length > 0 && ( +
+ + {appliedPromoCodes.map((code) => ( +
{code}
+ ))} + + } + > + +
+
+ )}
diff --git a/packages/admin/dashboard/src/routes/orders/order-create-exchange/components/exchange-create-form/exchange-outbound-item.tsx b/packages/admin/dashboard/src/routes/orders/order-create-exchange/components/exchange-create-form/exchange-outbound-item.tsx index 8a7de14abc..36372bd8ce 100644 --- a/packages/admin/dashboard/src/routes/orders/order-create-exchange/components/exchange-create-form/exchange-outbound-item.tsx +++ b/packages/admin/dashboard/src/routes/orders/order-create-exchange/components/exchange-create-form/exchange-outbound-item.tsx @@ -1,6 +1,6 @@ -import { XCircle } from "@medusajs/icons" +import { ReceiptPercent, XCircle } from "@medusajs/icons" import { AdminOrderLineItem, HttpTypes } from "@medusajs/types" -import { Input, Text } from "@medusajs/ui" +import { Input, Text, Tooltip } from "@medusajs/ui" import { UseFormReturn } from "react-hook-form" import { useTranslation } from "react-i18next" @@ -32,13 +32,17 @@ function ExchangeOutboundItem({ }: ExchangeOutboundItemProps) { const { t } = useTranslation() + const appliedPromoCodes = (previewItem.adjustments || []).map( + (adjustment) => adjustment.code + ) + return (
-
+
-
+
{previewItem.title}{" "} @@ -52,6 +56,21 @@ function ExchangeOutboundItem({ {previewItem.subtitle}
+ {appliedPromoCodes.length > 0 && ( +
+ + {appliedPromoCodes.map((code) => ( +
{code}
+ ))} + + } + > + +
+
+ )}