fix(admin-ui): Fix effect check in inventory table and overflow UI (#3577)
* Fix effect check in inventory table and overflow UI * Create ten-berries-rest.md * Fix edit stock&inventory modal to use the right form * Fix faulty merge conflict resolution * Fix inventory item creation * Add redirect to locations tab if no locations, toast * Revert redirect and toast, add message in table --------- Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
co-authored by
Oliver Windall Juhl
parent
feaf8d2e19
commit
95c9fbfdd5
@@ -47,7 +47,7 @@ const LocationDropdown = ({
|
||||
const { stock_locations: locations, isLoading } = useAdminStockLocations()
|
||||
|
||||
useEffect(() => {
|
||||
if (!selectedLocation && !isLoading && locations) {
|
||||
if (!selectedLocation && !isLoading && locations?.length) {
|
||||
onChange(locations[0].id)
|
||||
}
|
||||
}, [isLoading, locations, onChange, selectedLocation])
|
||||
@@ -85,6 +85,9 @@ const InventoryTable: React.FC<InventoryTableProps> = () => {
|
||||
|
||||
const location = useLocation()
|
||||
|
||||
const { stock_locations, isLoading: locationsLoading } =
|
||||
useAdminStockLocations()
|
||||
|
||||
const defaultQuery = useMemo(() => {
|
||||
if (store) {
|
||||
return {
|
||||
@@ -284,6 +287,11 @@ const InventoryTable: React.FC<InventoryTableProps> = () => {
|
||||
})}
|
||||
</Table.Body>
|
||||
</Table>
|
||||
{!rows.length && !locationsLoading && !stock_locations?.length && (
|
||||
<div className="text-grey-50 w-full py-8 text-center">
|
||||
You don't have any stock locations. Add one to see inventory.
|
||||
</div>
|
||||
)}
|
||||
</TableContainer>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user