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:
5
.changeset/olive-bees-collect.md
Normal file
5
.changeset/olive-bees-collect.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/admin-ui": patch
|
||||
---
|
||||
|
||||
fix(admin-ui): remove allocate button if no more allcoations can be made
|
||||
@@ -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>
|
||||
)
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user