Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 4x 4x 4x 4x 4x 4x 2x 4x | import { useEffect, useState } from 'react';
import { ResourceRepresentation } from '../../../core/api/api';
import { type StockBatchFilter, useStockBatches } from '../../../stock-items/stock-items.resource';
export function useStockItemBatchNumbers(stockItemUuid: string) {
const [conceptFilter, setConceptFilter] = useState<StockBatchFilter>({
v: ResourceRepresentation.Default,
limit: 10,
startIndex: 0,
stockItemUuid,
});
const {
items: { results: stockItemBatchNos },
isLoading,
} = useStockBatches(conceptFilter);
const [searchString, setSearchString] = useState(null);
// Drug filter type
const [limit, setLimit] = useState(10);
const [representation, setRepresentation] = useState(ResourceRepresentation.Default);
useEffect(() => {
setConceptFilter({
startIndex: 0,
v: representation,
limit: limit,
q: searchString,
stockItemUuid,
});
}, [searchString, limit, representation, stockItemUuid]);
return {
stockItemBatchNos,
setLimit,
setRepresentation,
setSearchString,
isLoading,
};
}
|