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
This commit is contained in:
Philip Korsholm
2023-03-09 13:05:56 +01:00
committed by GitHub
parent 478d1af8d0
commit 784723a039
3 changed files with 12 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/admin-ui": patch
---
fix(admin-ui): remove allocate button if no more allcoations can be made

View File

@@ -22,10 +22,12 @@ const StatusIndicator: React.FC<StatusIndicatorProps> = ({
})
return (
<div
className={clsx("flex items-center inter-small-regular", className)}
className={clsx("inter-small-regular flex items-center", className, {
"hover:bg-grey-5 cursor-pointer": !!props.onClick,
})}
{...props}
>
<div className={clsx("w-1.5 h-1.5 self-center rounded-full", dotClass)} />
<div className={clsx("h-1.5 w-1.5 self-center rounded-full", dotClass)} />
{title && <span className="ml-2">{title}</span>}
</div>
)

View File

@@ -117,14 +117,14 @@ const SummaryCard: React.FC<SummaryCardProps> = ({
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 (
<BodyCard
@@ -134,6 +134,7 @@ const SummaryCard: React.FC<SummaryCardProps> = ({
isFeatureEnabled("inventoryService") &&
Array.isArray(reservations) && (
<StatusIndicator
onClick={allItemsReserved ? undefined : showAllocationModal}
variant={allItemsReserved ? "success" : "danger"}
title={allItemsReserved ? "Allocated" : "Awaits allocation"}
className="rounded-rounded border px-3 py-1.5"