@openmrs/esm-stock-management-app 1.0.1-pre.629 → 1.0.1-pre.632
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintignore +1 -1
- package/.husky/pre-commit +0 -3
- package/.husky/pre-push +1 -6
- package/dist/173.js +1 -1
- package/dist/173.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +6 -6
- package/dist/routes.json +1 -1
- package/i18next-parser.config.js +19 -19
- package/package.json +4 -2
- package/src/stock-batch/stock-batch.resource.ts +2 -2
- package/src/stock-home/stock-home-inventory-expiry.resource.tsx +2 -2
- package/src/stock-home/stock-home-inventory-items.resource.tsx +2 -2
- package/src/stock-home/stock-home-issuing.resource.tsx +2 -2
- package/src/stock-home/stock-home-receiving.resource.tsx +2 -2
- package/src/stock-home/useDisposalList.tsx +2 -2
- package/src/stock-home/useStockList.tsx +2 -2
- package/src/stock-items/add-stock-item/batch-information/batch-information.resource.tsx +2 -2
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.resource.tsx +2 -2
- package/src/stock-items/add-stock-item/quantities/quantities.resource.tsx +2 -2
- package/src/stock-items/add-stock-item/stock-item-references/stock-item-references.resource.ts +2 -2
- package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.resource.tsx +2 -2
- package/src/stock-items/add-stock-item/stock-item-rules/stock-rules-filter.component.tsx +2 -2
- package/src/stock-items/add-stock-item/stock-item-rules/stock-rules.resource.ts +2 -2
- package/src/stock-items/add-stock-item/transactions/transactions.resource.tsx +2 -2
- package/src/stock-items/stock-items-table.resource.ts +2 -2
- package/src/stock-items/stock-items.resource.ts +9 -9
- package/src/stock-lookups/stock-lookups.resource.ts +12 -12
- package/src/stock-operations/add-stock-operation/add-stock-operation.component.tsx +2 -2
- package/src/stock-operations/add-stock-operation/add-stock-operation.resource.tsx +3 -3
- package/src/stock-operations/qty-uom-selector/qty-uom-selector.component.tsx +2 -2
- package/src/stock-operations/stock-operation-operations-filter/stock-operation-operations-filter.component.tsx +2 -2
- package/src/stock-operations/stock-operation-reason-selector/stock-operation-reason-selector.component.tsx +2 -2
- package/src/stock-operations/stock-operation-sources-filter/stock-operation-sources-filter.component.tsx +2 -2
- package/src/stock-operations/stock-operation-types-selector/stock-operation-types-selector.component.tsx +2 -2
- package/src/stock-operations/stock-operations-table.resource.tsx +2 -2
- package/src/stock-operations/stock-operations.resource.ts +3 -3
- package/src/stock-reports/stock-reports.resource.ts +2 -2
- package/src/stock-sources/stock-sources-filter/stock-sources-filter.component.tsx +2 -2
- package/src/stock-sources/stock-sources-items-table.resource.ts +2 -2
- package/src/stock-sources/stock-sources.resource.ts +2 -2
- package/src/stock-user-role-scopes/stock-user-role-scopes-items-table.resource.ts +2 -2
- package/src/stock-user-role-scopes/stock-user-role-scopes.resource.ts +2 -2
@@ -4,7 +4,7 @@ import { AddStockOperationProps, InitializeResult } from './types';
|
|
4
4
|
|
5
5
|
export const useInitializeStockOperations = (props: AddStockOperationProps) => {
|
6
6
|
const [isLoading, setIsLoading] = useState(true);
|
7
|
-
const [
|
7
|
+
const [error, setError] = useState(false);
|
8
8
|
const [result, setResult] = useState<InitializeResult>();
|
9
9
|
|
10
10
|
useEffect(() => {
|
@@ -15,13 +15,13 @@ export const useInitializeStockOperations = (props: AddStockOperationProps) => {
|
|
15
15
|
setIsLoading(false);
|
16
16
|
})
|
17
17
|
.catch(() => {
|
18
|
-
|
18
|
+
setError(true);
|
19
19
|
});
|
20
20
|
}, [props.model, props.operation, props.operations]);
|
21
21
|
|
22
22
|
return {
|
23
23
|
isLoading,
|
24
|
-
|
24
|
+
error,
|
25
25
|
result,
|
26
26
|
};
|
27
27
|
};
|
@@ -20,13 +20,13 @@ interface QtyUomSelectorProps<T> {
|
|
20
20
|
}
|
21
21
|
|
22
22
|
const QtyUomSelector = <T,>(props: QtyUomSelectorProps<T>) => {
|
23
|
-
const { isLoading,
|
23
|
+
const { isLoading, error, item } = useStockItem(props.stockItemUuid ?? props['uuid']);
|
24
24
|
const initialSelectedItem = useMemo<StockItemPackagingUOMDTO | null>(
|
25
25
|
() => (item?.packagingUnits?.length > 0 ? item.packagingUnits[0] : null),
|
26
26
|
[item?.packagingUnits],
|
27
27
|
);
|
28
28
|
|
29
|
-
if (isLoading ||
|
29
|
+
if (isLoading || error) return <SkeletonText />;
|
30
30
|
|
31
31
|
return (
|
32
32
|
<div>
|
@@ -5,8 +5,8 @@ import { useStockOperationTypes } from '../../stock-lookups/stock-lookups.resour
|
|
5
5
|
|
6
6
|
const StockOperationOperationsFilter: React.FC = () => {
|
7
7
|
// get stock sources
|
8
|
-
const { types, isLoading,
|
9
|
-
if (isLoading ||
|
8
|
+
const { types, isLoading, error } = useStockOperationTypes();
|
9
|
+
if (isLoading || error) {
|
10
10
|
return <DropdownSkeleton />;
|
11
11
|
}
|
12
12
|
return (
|
@@ -25,11 +25,11 @@ const StockOperationReasonSelector = <T,>(props: StockOperationReasonSelectorPro
|
|
25
25
|
|
26
26
|
const {
|
27
27
|
isLoading,
|
28
|
-
|
28
|
+
error,
|
29
29
|
items: { answers: reasons },
|
30
30
|
} = useConcept(stockAdjustmentReasonUUID);
|
31
31
|
|
32
|
-
if (isLoading ||
|
32
|
+
if (isLoading || error) return <SelectSkeleton />;
|
33
33
|
|
34
34
|
return (
|
35
35
|
<Controller
|
@@ -9,8 +9,8 @@ const StockOperationSourcesFilter: React.FC = () => {
|
|
9
9
|
const { stockSourceTypeUUID } = useConfig<ConfigObject>();
|
10
10
|
|
11
11
|
// get stock sources
|
12
|
-
const { items, isLoading,
|
13
|
-
if (isLoading ||
|
12
|
+
const { items, isLoading, error } = useConcept(stockSourceTypeUUID);
|
13
|
+
if (isLoading || error) {
|
14
14
|
return <DropdownSkeleton />;
|
15
15
|
}
|
16
16
|
return (
|
@@ -16,7 +16,7 @@ const StockOperationTypesSelector: React.FC<StockOperationTypesSelectorProps> =
|
|
16
16
|
const {
|
17
17
|
types: { results: createOperationTypes },
|
18
18
|
isLoading,
|
19
|
-
|
19
|
+
error,
|
20
20
|
} = useStockOperationTypes();
|
21
21
|
const { userRoles } = useUserRoles();
|
22
22
|
|
@@ -31,7 +31,7 @@ const StockOperationTypesSelector: React.FC<StockOperationTypesSelectorProps> =
|
|
31
31
|
onOperationLoaded?.(filterOperationTypes);
|
32
32
|
}, [filterOperationTypes, onOperationLoaded]);
|
33
33
|
|
34
|
-
if (isLoading ||
|
34
|
+
if (isLoading || error) return <ButtonSkeleton />;
|
35
35
|
|
36
36
|
return filterOperationTypes && filterOperationTypes.length ? (
|
37
37
|
<OverflowMenu
|
@@ -4,7 +4,7 @@ import { usePagination } from '@openmrs/esm-framework';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
5
5
|
|
6
6
|
export function useStockOperationPages(filter: StockOperationFilter) {
|
7
|
-
const { items, isLoading,
|
7
|
+
const { items, isLoading, error } = useStockOperations(filter);
|
8
8
|
|
9
9
|
const pageSizes = [10, 20, 30, 40, 50];
|
10
10
|
const [currentPageSize, setPageSize] = useState(10);
|
@@ -63,7 +63,7 @@ export function useStockOperationPages(filter: StockOperationFilter) {
|
|
63
63
|
goTo,
|
64
64
|
pageSizes,
|
65
65
|
isLoading,
|
66
|
-
|
66
|
+
error,
|
67
67
|
setPageSize,
|
68
68
|
tableHeaders,
|
69
69
|
};
|
@@ -39,7 +39,7 @@ export function useStockOperations(filter: StockOperationFilter) {
|
|
39
39
|
return {
|
40
40
|
items: data?.data || <PageableResult<StockOperationDTO>>{},
|
41
41
|
isLoading,
|
42
|
-
|
42
|
+
error,
|
43
43
|
};
|
44
44
|
}
|
45
45
|
|
@@ -64,7 +64,7 @@ export function useStockOperation(id: string) {
|
|
64
64
|
return {
|
65
65
|
items: data.data ? data.data : {},
|
66
66
|
isLoading,
|
67
|
-
|
67
|
+
error,
|
68
68
|
};
|
69
69
|
} // getStockOperation
|
70
70
|
export function getStockOperation(id: string): Promise<FetchResponse<StockOperationDTO>> {
|
@@ -80,7 +80,7 @@ export function useStockOperationAndItems(id: string) {
|
|
80
80
|
return {
|
81
81
|
items: data.data ? data.data : {},
|
82
82
|
isLoading,
|
83
|
-
|
83
|
+
error,
|
84
84
|
};
|
85
85
|
}
|
86
86
|
|
@@ -9,7 +9,7 @@ export function useReportTypes() {
|
|
9
9
|
return {
|
10
10
|
reportTypes: data?.data?.results ?? [],
|
11
11
|
isLoading,
|
12
|
-
|
12
|
+
error,
|
13
13
|
};
|
14
14
|
}
|
15
15
|
export function useGetReports() {
|
@@ -22,7 +22,7 @@ export function useGetReports() {
|
|
22
22
|
return {
|
23
23
|
reports: data?.data?.results ?? [],
|
24
24
|
isLoading,
|
25
|
-
|
25
|
+
error,
|
26
26
|
items: paginatedItems,
|
27
27
|
totalItems: data?.data?.results?.length,
|
28
28
|
currentPage,
|
@@ -10,8 +10,8 @@ const StockSourcesFilter: React.FC<{
|
|
10
10
|
}> = ({ onFilterChange }) => {
|
11
11
|
const { stockSourceTypeUUID } = useConfig<ConfigObject>();
|
12
12
|
// get stock sources
|
13
|
-
const { items, isLoading,
|
14
|
-
if (isLoading ||
|
13
|
+
const { items, isLoading, error } = useConcept(stockSourceTypeUUID);
|
14
|
+
if (isLoading || error) {
|
15
15
|
return <DropdownSkeleton />;
|
16
16
|
}
|
17
17
|
return (
|
@@ -4,7 +4,7 @@ import { usePagination } from '@openmrs/esm-framework';
|
|
4
4
|
import { StockOperationFilter } from '../stock-operations/stock-operations.resource';
|
5
5
|
|
6
6
|
export default function useStockSourcesPage(filter: StockOperationFilter) {
|
7
|
-
const { items, isLoading,
|
7
|
+
const { items, isLoading, error } = useStockSources(filter);
|
8
8
|
|
9
9
|
const pageSizes = [10, 20, 30, 40, 50];
|
10
10
|
const [currentPageSize, setPageSize] = useState(10);
|
@@ -45,7 +45,7 @@ export default function useStockSourcesPage(filter: StockOperationFilter) {
|
|
45
45
|
goTo,
|
46
46
|
pageSizes,
|
47
47
|
isLoading,
|
48
|
-
|
48
|
+
error,
|
49
49
|
setPageSize,
|
50
50
|
tableHeaders,
|
51
51
|
};
|
@@ -17,7 +17,7 @@ export function useStockSources(filter: StockSourceFilter) {
|
|
17
17
|
return {
|
18
18
|
items: data?.data || <PageableResult<StockSource>>{},
|
19
19
|
isLoading,
|
20
|
-
|
20
|
+
error,
|
21
21
|
};
|
22
22
|
}
|
23
23
|
|
@@ -28,7 +28,7 @@ export function useStockSource(id: string) {
|
|
28
28
|
return {
|
29
29
|
items: data.data ? data.data : [],
|
30
30
|
isLoading,
|
31
|
-
|
31
|
+
error,
|
32
32
|
};
|
33
33
|
}
|
34
34
|
|
@@ -4,7 +4,7 @@ import { useState } from 'react';
|
|
4
4
|
import { usePagination } from '@openmrs/esm-framework';
|
5
5
|
|
6
6
|
export default function useStockUserRoleScopesPage(filter: StockOperationFilter) {
|
7
|
-
const { items, isLoading,
|
7
|
+
const { items, isLoading, error } = useUserRoleScopes(filter);
|
8
8
|
|
9
9
|
const pageSizes = [10, 20, 30, 40, 50];
|
10
10
|
const [currentPageSize, setPageSize] = useState(10);
|
@@ -19,7 +19,7 @@ export default function useStockUserRoleScopesPage(filter: StockOperationFilter)
|
|
19
19
|
goTo,
|
20
20
|
pageSizes,
|
21
21
|
isLoading,
|
22
|
-
|
22
|
+
error,
|
23
23
|
setPageSize,
|
24
24
|
};
|
25
25
|
}
|
@@ -13,7 +13,7 @@ export function useUserRoleScopes(filter: UserRoleScopeFilter) {
|
|
13
13
|
return {
|
14
14
|
items: data?.data || <PageableResult<UserRoleScope>>{},
|
15
15
|
isLoading,
|
16
|
-
|
16
|
+
error,
|
17
17
|
};
|
18
18
|
}
|
19
19
|
|
@@ -24,7 +24,7 @@ export function useUserRoleScope(id: string) {
|
|
24
24
|
return {
|
25
25
|
items: data.data ? data.data : {},
|
26
26
|
isLoading,
|
27
|
-
|
27
|
+
error,
|
28
28
|
};
|
29
29
|
}
|
30
30
|
|