fix(WarehouseTransfer).

This commit is contained in:
a.bouhuolia
2022-03-20 16:43:49 +02:00
parent 89b28903fa
commit 29fbcf1f1c
17 changed files with 129 additions and 193 deletions

View File

@@ -65,10 +65,10 @@ export const useFetchItemWarehouseQuantity = () => {
return isItemSuccess
? {
...tableRow,
warehouses: [],
warehouses: transformWarehousesQuantity(item),
}
: null;
}, [isItemSuccess, tableRow]);
}, [isItemSuccess, item, tableRow]);
// Reset the table row.
const resetTableRow = React.useCallback(() => {
@@ -84,3 +84,11 @@ export const useFetchItemWarehouseQuantity = () => {
newRowMeta,
};
};
const transformWarehousesQuantity = (item) => {
return item.item_warehouses.map((warehouse) => ({
warehouseId: warehouse.warehouse_id,
quantityOnHand: warehouse.quantity_on_hand,
quantityOnHandFormatted: warehouse.quantity_on_hand_formatted,
}));
};