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}
+ ))} + + } + > + +
+
+ )}