fix(admin-ui): Inventory nitpicking (#4316)
* minor fixes * add changeset * add search by sku placeholder
This commit is contained in:
5
.changeset/soft-doors-marry.md
Normal file
5
.changeset/soft-doors-marry.md
Normal file
@@ -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 }}
|
||||
onInputChange={setItemSearchTerm}
|
||||
options={options}
|
||||
placeholder="Choose an item"
|
||||
placeholder="Search by sku..."
|
||||
isSearchable={true}
|
||||
noOptionsMessage={() => "No items found"}
|
||||
openMenuOnClick={!!inventory_items?.length}
|
||||
|
||||
@@ -146,7 +146,9 @@ const InventoryTable: React.FC<InventoryTableProps> = () => {
|
||||
refreshWithFilters()
|
||||
}, [representationObject])
|
||||
|
||||
const [columns] = useInventoryTableColumn()
|
||||
const [columns] = useInventoryTableColumn({
|
||||
location_id: queryObject.location_id,
|
||||
})
|
||||
|
||||
const {
|
||||
getTableProps,
|
||||
|
||||
@@ -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 { Column } from "@tanstack/react-table"
|
||||
import { DecoratedInventoryItemDTO } from "@medusajs/medusa"
|
||||
import ImagePlaceholder from "../../fundamentals/image-placeholder"
|
||||
import { InventoryLevelDTO } from "@medusajs/types"
|
||||
import Tooltip from "../../atoms/tooltip"
|
||||
import { useMemo } from "react"
|
||||
import { useNavigate } from "react-router-dom"
|
||||
|
||||
const useInventoryTableColumn = () => {
|
||||
const useInventoryTableColumn = ({
|
||||
location_id,
|
||||
}: {
|
||||
location_id: string
|
||||
}): [Column<DecoratedInventoryItemDTO>[]] => {
|
||||
const columns = useMemo(
|
||||
() => [
|
||||
{
|
||||
@@ -59,7 +62,9 @@ const useInventoryTableColumn = () => {
|
||||
variant="ghost"
|
||||
onClick={() => {
|
||||
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
|
||||
|
||||
@@ -139,7 +139,7 @@ const EditReservationDrawer = ({
|
||||
{
|
||||
quantity: data.item.quantity,
|
||||
location_id: data.location.value,
|
||||
description: data.item.description || undefined,
|
||||
description: data.item.description,
|
||||
metadata: hasMetadata
|
||||
? getSubmittableMetadata(data.metadata)
|
||||
: undefined,
|
||||
|
||||
Reference in New Issue
Block a user