fix(admin-ui): Inventory nitpicking (#4316)
* minor fixes * add changeset * add search by sku placeholder
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/admin-ui": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(admin-ui): minor fixes for reservation management
|
||||||
@@ -64,7 +64,7 @@ const ItemSearch = ({ onItemSelect, clearOnSelect, filters = {} }: Props) => {
|
|||||||
components={{ Option: ProductOption, Control: SearchControl }}
|
components={{ Option: ProductOption, Control: SearchControl }}
|
||||||
onInputChange={setItemSearchTerm}
|
onInputChange={setItemSearchTerm}
|
||||||
options={options}
|
options={options}
|
||||||
placeholder="Choose an item"
|
placeholder="Search by sku..."
|
||||||
isSearchable={true}
|
isSearchable={true}
|
||||||
noOptionsMessage={() => "No items found"}
|
noOptionsMessage={() => "No items found"}
|
||||||
openMenuOnClick={!!inventory_items?.length}
|
openMenuOnClick={!!inventory_items?.length}
|
||||||
|
|||||||
@@ -146,7 +146,9 @@ const InventoryTable: React.FC<InventoryTableProps> = () => {
|
|||||||
refreshWithFilters()
|
refreshWithFilters()
|
||||||
}, [representationObject])
|
}, [representationObject])
|
||||||
|
|
||||||
const [columns] = useInventoryTableColumn()
|
const [columns] = useInventoryTableColumn({
|
||||||
|
location_id: queryObject.location_id,
|
||||||
|
})
|
||||||
|
|
||||||
const {
|
const {
|
||||||
getTableProps,
|
getTableProps,
|
||||||
|
|||||||
+12
-7
@@ -1,14 +1,17 @@
|
|||||||
import * as RadixPopover from "@radix-ui/react-popover"
|
|
||||||
|
|
||||||
import { Navigate, useNavigate } from "react-router-dom"
|
|
||||||
|
|
||||||
import Button from "../../fundamentals/button"
|
import Button from "../../fundamentals/button"
|
||||||
|
import { Column } from "@tanstack/react-table"
|
||||||
|
import { DecoratedInventoryItemDTO } from "@medusajs/medusa"
|
||||||
import ImagePlaceholder from "../../fundamentals/image-placeholder"
|
import ImagePlaceholder from "../../fundamentals/image-placeholder"
|
||||||
import { InventoryLevelDTO } from "@medusajs/types"
|
import { InventoryLevelDTO } from "@medusajs/types"
|
||||||
import Tooltip from "../../atoms/tooltip"
|
import Tooltip from "../../atoms/tooltip"
|
||||||
import { useMemo } from "react"
|
import { useMemo } from "react"
|
||||||
|
import { useNavigate } from "react-router-dom"
|
||||||
|
|
||||||
const useInventoryTableColumn = () => {
|
const useInventoryTableColumn = ({
|
||||||
|
location_id,
|
||||||
|
}: {
|
||||||
|
location_id: string
|
||||||
|
}): [Column<DecoratedInventoryItemDTO>[]] => {
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
@@ -59,7 +62,9 @@ const useInventoryTableColumn = () => {
|
|||||||
variant="ghost"
|
variant="ghost"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
navigate(
|
navigate(
|
||||||
`/a/inventory/reservations?inventory_item_id%5B0%5D=${original.id}`
|
`/a/inventory/reservations?inventory_item_id%5B0%5D=${
|
||||||
|
original.id
|
||||||
|
}${location_id ? `&location_id=${location_id}` : ""}`
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -95,7 +100,7 @@ const useInventoryTableColumn = () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[]
|
[location_id]
|
||||||
)
|
)
|
||||||
|
|
||||||
return [columns] as const
|
return [columns] as const
|
||||||
|
|||||||
+1
-1
@@ -139,7 +139,7 @@ const EditReservationDrawer = ({
|
|||||||
{
|
{
|
||||||
quantity: data.item.quantity,
|
quantity: data.item.quantity,
|
||||||
location_id: data.location.value,
|
location_id: data.location.value,
|
||||||
description: data.item.description || undefined,
|
description: data.item.description,
|
||||||
metadata: hasMetadata
|
metadata: hasMetadata
|
||||||
? getSubmittableMetadata(data.metadata)
|
? getSubmittableMetadata(data.metadata)
|
||||||
: undefined,
|
: undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user