From 0c30d05cf3805515086dc589a0332b59b6df045f Mon Sep 17 00:00:00 2001 From: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com> Date: Mon, 1 May 2023 09:48:51 +0200 Subject: [PATCH] fix(admin-ui): allocated badge for orders with statuses cancelled and archived (#3950) * fix allocated badge for orders with statuses cancelled and archived * add changeset --- .changeset/quiet-wombats-hug.md | 5 +++++ .../orders/details/detail-cards/summary.tsx | 17 ++++++++++++++--- .../domain/orders/details/order-line/index.tsx | 10 ++++++++-- 3 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 .changeset/quiet-wombats-hug.md diff --git a/.changeset/quiet-wombats-hug.md b/.changeset/quiet-wombats-hug.md new file mode 100644 index 0000000000..3db6427d93 --- /dev/null +++ b/.changeset/quiet-wombats-hug.md @@ -0,0 +1,5 @@ +--- +"@medusajs/admin-ui": patch +--- + +fix(admin-ui): allocation status for cancelled and archived orders diff --git a/packages/admin-ui/ui/src/domain/orders/details/detail-cards/summary.tsx b/packages/admin-ui/ui/src/domain/orders/details/detail-cards/summary.tsx index 509239788f..64cb77dea5 100644 --- a/packages/admin-ui/ui/src/domain/orders/details/detail-cards/summary.tsx +++ b/packages/admin-ui/ui/src/domain/orders/details/detail-cards/summary.tsx @@ -164,6 +164,8 @@ const SummaryCard: React.FC = ({ order, reservations }) => { return actionables }, [showModal, isFeatureEnabled, showAllocationModal, allItemsReserved]) + const isAllocatable = !["canceled", "archived"].includes(order.status) + return ( = ({ order, reservations }) => { isFeatureEnabled("inventoryService") && Array.isArray(reservations) && ( ) @@ -188,6 +198,7 @@ const SummaryCard: React.FC = ({ order, reservations }) => { item={item} currencyCode={order.currency_code} reservations={reservationItemsMap[item.id]} + isAllocatable={isAllocatable} /> ))} { +const OrderLine = ({ + item, + currencyCode, + reservations, + isAllocatable = true, +}: OrderLineProps) => { const { isFeatureEnabled } = useFeatureFlag() return (
@@ -50,7 +56,7 @@ const OrderLine = ({ item, currencyCode, reservations }: OrderLineProps) => {
x {item.quantity}
- {isFeatureEnabled("inventoryService") && ( + {isFeatureEnabled("inventoryService") && isAllocatable && ( )}