feat(core-flows,types,medusa): validate deleting location level when quantities exist (#9086)
what: - adds validation in workflow to prevent deleting a location level when reserved or stocked quantity exists - disabled delete button when quantities exist - consolidate delete workflows <img width="1079" alt="Screenshot 2024-09-10 at 16 39 02" src="https://github.com/user-attachments/assets/cf1f4b2e-75ea-4f7c-9b97-24622396c632"> RESOLVES CC-120
This commit is contained in:
+4
-2
@@ -1,10 +1,10 @@
|
||||
import { PencilSquare, Trash } from "@medusajs/icons"
|
||||
|
||||
import { ActionMenu } from "../../../../../components/common/action-menu"
|
||||
import { InventoryTypes } from "@medusajs/types"
|
||||
import { useDeleteInventoryItemLevel } from "../../../../../hooks/api/inventory"
|
||||
import { usePrompt } from "@medusajs/ui"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { ActionMenu } from "../../../../../components/common/action-menu"
|
||||
import { useDeleteInventoryItemLevel } from "../../../../../hooks/api/inventory"
|
||||
|
||||
export const LocationActions = ({
|
||||
level,
|
||||
@@ -51,6 +51,8 @@ export const LocationActions = ({
|
||||
icon: <Trash />,
|
||||
label: t("actions.delete"),
|
||||
onClick: handleDelete,
|
||||
disabled:
|
||||
level.reserved_quantity > 0 || level.stocked_quantity > 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user