Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(admin-ui): Hide create fulfilment button when nothing left to fulfil #3515

Merged
merged 4 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions packages/admin-ui/ui/src/domain/orders/details/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { Address, ClaimOrder, Fulfillment, Swap } from "@medusajs/medusa"
import {
Address,
ClaimOrder,
Fulfillment,
LineItem,
Swap,
} from "@medusajs/medusa"
import {
DisplayTotal,
FormattedAddress,
Expand Down Expand Up @@ -261,6 +267,10 @@ const OrderDetails = () => {
navigate("/404")
}

const anyItemsToFulfil = order.items.some(
(item: LineItem) => item.quantity > (item.fulfilled_quantity ?? 0)
)

return (
<div>
<OrderEditProvider orderId={id!}>
Expand Down Expand Up @@ -415,9 +425,8 @@ const OrderDetails = () => {
/>
}
customActionable={
order.fulfillment_status !== "fulfilled" &&
order.status !== "canceled" &&
order.fulfillment_status !== "shipped" && (
anyItemsToFulfil && (
<Button
variant="secondary"
size="small"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export const FulfillmentStatusComponent = ({ status }) => {
return <StatusDot title="Requires Action" variant="danger" />
case "not_fulfilled":
return <StatusDot title="Awaiting fulfillment" variant="danger" />
case "partially_shipped":
return <StatusDot title="Partially Shipped" variant="warning" />
default:
return null
}
Expand Down