From 784723a039a4d9c5184f41eda9d0a36a215567c8 Mon Sep 17 00:00:00 2001 From: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com> Date: Thu, 9 Mar 2023 13:05:56 +0100 Subject: [PATCH] Fix/disable allocate button (#3426) * remove allocate option from order editing summary if no further allocations can be made * add changeset * add minor button styles to badge component --- .changeset/olive-bees-collect.md | 5 +++++ .../src/components/fundamentals/status-indicator/index.tsx | 6 ++++-- .../ui/src/domain/orders/details/detail-cards/summary.tsx | 5 +++-- 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 .changeset/olive-bees-collect.md diff --git a/.changeset/olive-bees-collect.md b/.changeset/olive-bees-collect.md new file mode 100644 index 0000000000..faca157068 --- /dev/null +++ b/.changeset/olive-bees-collect.md @@ -0,0 +1,5 @@ +--- +"@medusajs/admin-ui": patch +--- + +fix(admin-ui): remove allocate button if no more allcoations can be made diff --git a/packages/admin-ui/ui/src/components/fundamentals/status-indicator/index.tsx b/packages/admin-ui/ui/src/components/fundamentals/status-indicator/index.tsx index 4a2993cd01..25a4915dbf 100644 --- a/packages/admin-ui/ui/src/components/fundamentals/status-indicator/index.tsx +++ b/packages/admin-ui/ui/src/components/fundamentals/status-indicator/index.tsx @@ -22,10 +22,12 @@ const StatusIndicator: React.FC = ({ }) return (
-
+
{title && {title}}
) 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 5906ca11d5..c47079171a 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 @@ -117,14 +117,14 @@ const SummaryCard: React.FC = ({ onClick: showModal, }) } - if (isFeatureEnabled("inventoryService")) { + if (isFeatureEnabled("inventoryService") && !allItemsReserved) { actionables.push({ label: "Allocate", onClick: showAllocationModal, }) } return actionables - }, [showModal, isFeatureEnabled, showAllocationModal]) + }, [showModal, isFeatureEnabled, showAllocationModal, allItemsReserved]) return ( = ({ isFeatureEnabled("inventoryService") && Array.isArray(reservations) && (