@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
@@ -85,9 +85,9 @@
|
|
85
85
|
"initial": false,
|
86
86
|
"entry": false,
|
87
87
|
"recorded": false,
|
88
|
-
"size":
|
88
|
+
"size": 1841106,
|
89
89
|
"sizes": {
|
90
|
-
"javascript":
|
90
|
+
"javascript": 1840896,
|
91
91
|
"consume-shared": 210
|
92
92
|
},
|
93
93
|
"names": [],
|
@@ -101,7 +101,7 @@
|
|
101
101
|
"auxiliaryFiles": [
|
102
102
|
"173.js.map"
|
103
103
|
],
|
104
|
-
"hash": "
|
104
|
+
"hash": "a8491eb316af7797",
|
105
105
|
"childrenByOrder": {}
|
106
106
|
},
|
107
107
|
{
|
@@ -109,10 +109,10 @@
|
|
109
109
|
"initial": true,
|
110
110
|
"entry": true,
|
111
111
|
"recorded": false,
|
112
|
-
"size":
|
112
|
+
"size": 5509533,
|
113
113
|
"sizes": {
|
114
114
|
"consume-shared": 252,
|
115
|
-
"javascript":
|
115
|
+
"javascript": 5487583,
|
116
116
|
"share-init": 252,
|
117
117
|
"runtime": 21446
|
118
118
|
},
|
@@ -129,7 +129,7 @@
|
|
129
129
|
"auxiliaryFiles": [
|
130
130
|
"main.js.map"
|
131
131
|
],
|
132
|
-
"hash": "
|
132
|
+
"hash": "33a6a9db8e921f65",
|
133
133
|
"childrenByOrder": {}
|
134
134
|
},
|
135
135
|
{
|
package/dist/routes.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.24.0"},"extensions":[{"name":"stock-nav-menu","slot":"stock-sidebar-slot","component":"stockNavMenu","online":true,"offline":true},{"name":"overview-db-link","slot":"stock-page-dashboard-slot","component":"stockOverviewLink","meta":{"name":"overview","slot":"overview-dashboard-slot","title":"overview"},"order":0,"online":true,"offline":true},{"name":"stock-overview-db","slot":"overview-dashboard-slot","component":"stockOverview"},{"name":"operations-db-link","slot":"stock-page-dashboard-slot","component":"stockOperationsLink","meta":{"name":"operations","slot":"operations-dashboard-slot","title":"operations"},"order":2,"online":true,"offline":true},{"name":"stock-operations-db","slot":"operations-dashboard-slot","component":"stockOperations"},{"name":"items-db-link","slot":"stock-page-dashboard-slot","component":"stockItemsLink","meta":{"name":"items","slot":"items-dashboard-slot","title":"items"},"order":1,"online":true,"offline":true},{"name":"stock-items-db","slot":"items-dashboard-slot","component":"stockItems"},{"name":"user-scopes-db-link","slot":"stock-page-dashboard-slot","component":"stockUserScopesLink","meta":{"name":"user-scopes","slot":"user-scopes-dashboard-slot","title":"user-scopes"},"order":3,"online":true,"offline":true},{"name":"stock-user-scopes-db","slot":"user-scopes-dashboard-slot","component":"stockUserScopes"},{"name":"sources-db-link","slot":"stock-page-dashboard-slot","component":"stockSourcesLink","meta":{"name":"sources","slot":"sources-dashboard-slot","title":"Sources"},"order":2,"online":true,"offline":true},{"name":"stock-sources-db","slot":"sources-dashboard-slot","component":"stockSources"},{"name":"locations-db-link","slot":"stock-page-dashboard-slot","component":"stockLocationsLink","meta":{"name":"locations","slot":"locations-dashboard-slot","title":"Locations"},"order":4,"online":true,"offline":true},{"name":"stock-locations-db","slot":"locations-dashboard-slot","component":"stockLocations"},{"name":"reports-db-link","slot":"stock-page-dashboard-slot","component":"stockReportsLink","meta":{"name":"reports","slot":"reports-dashboard-slot","title":"Reports"},"order":5,"online":true,"offline":true},{"name":"stock-reports-db","slot":"reports-dashboard-slot","component":"stockReports"},{"name":"settings-db-link","slot":"stock-page-dashboard-slot","component":"stockSettingsLink","meta":{"name":"settings","slot":"settings-dashboard-slot","title":"Settings"},"order":6,"online":true,"offline":true},{"name":"stock-settings-db","slot":"settings-dashboard-slot","component":"stockSettings"},{"name":"stock-management-admin-card-link","slot":"system-admin-page-card-link-slot","component":"stockManagementAdminCardLink"},{"name":"stock-operation-dialog","component":"stockOperationDialog"},{"name":"import-bulk-stock-items","component":"importBulkStockItemsDialog"},{"name":"delete-stock-modal","component":"deleteStockModal"},{"name":"delete-stock-user-scope-modal","component":"deleteUserScopeModal"},{"name":"stock-management-app-menu-item","component":"stockManagementAppMenuItem","slot":"app-menu-item-slot","meta":{"name":" Stock Management"}},{"name":"delete-stock-rule-modal","component":"deleteStockRuleModal"},{"name":"delete-packaging-unit-modal","component":"deletePackagingUnitModal"},{"name":"delete-packaging-unit-button","component":"deletePackagingUnitButton"}],"pages":[{"component":"root","route":"stock-management"}],"version":"1.0.1-pre.
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.24.0"},"extensions":[{"name":"stock-nav-menu","slot":"stock-sidebar-slot","component":"stockNavMenu","online":true,"offline":true},{"name":"overview-db-link","slot":"stock-page-dashboard-slot","component":"stockOverviewLink","meta":{"name":"overview","slot":"overview-dashboard-slot","title":"overview"},"order":0,"online":true,"offline":true},{"name":"stock-overview-db","slot":"overview-dashboard-slot","component":"stockOverview"},{"name":"operations-db-link","slot":"stock-page-dashboard-slot","component":"stockOperationsLink","meta":{"name":"operations","slot":"operations-dashboard-slot","title":"operations"},"order":2,"online":true,"offline":true},{"name":"stock-operations-db","slot":"operations-dashboard-slot","component":"stockOperations"},{"name":"items-db-link","slot":"stock-page-dashboard-slot","component":"stockItemsLink","meta":{"name":"items","slot":"items-dashboard-slot","title":"items"},"order":1,"online":true,"offline":true},{"name":"stock-items-db","slot":"items-dashboard-slot","component":"stockItems"},{"name":"user-scopes-db-link","slot":"stock-page-dashboard-slot","component":"stockUserScopesLink","meta":{"name":"user-scopes","slot":"user-scopes-dashboard-slot","title":"user-scopes"},"order":3,"online":true,"offline":true},{"name":"stock-user-scopes-db","slot":"user-scopes-dashboard-slot","component":"stockUserScopes"},{"name":"sources-db-link","slot":"stock-page-dashboard-slot","component":"stockSourcesLink","meta":{"name":"sources","slot":"sources-dashboard-slot","title":"Sources"},"order":2,"online":true,"offline":true},{"name":"stock-sources-db","slot":"sources-dashboard-slot","component":"stockSources"},{"name":"locations-db-link","slot":"stock-page-dashboard-slot","component":"stockLocationsLink","meta":{"name":"locations","slot":"locations-dashboard-slot","title":"Locations"},"order":4,"online":true,"offline":true},{"name":"stock-locations-db","slot":"locations-dashboard-slot","component":"stockLocations"},{"name":"reports-db-link","slot":"stock-page-dashboard-slot","component":"stockReportsLink","meta":{"name":"reports","slot":"reports-dashboard-slot","title":"Reports"},"order":5,"online":true,"offline":true},{"name":"stock-reports-db","slot":"reports-dashboard-slot","component":"stockReports"},{"name":"settings-db-link","slot":"stock-page-dashboard-slot","component":"stockSettingsLink","meta":{"name":"settings","slot":"settings-dashboard-slot","title":"Settings"},"order":6,"online":true,"offline":true},{"name":"stock-settings-db","slot":"settings-dashboard-slot","component":"stockSettings"},{"name":"stock-management-admin-card-link","slot":"system-admin-page-card-link-slot","component":"stockManagementAdminCardLink"},{"name":"stock-operation-dialog","component":"stockOperationDialog"},{"name":"import-bulk-stock-items","component":"importBulkStockItemsDialog"},{"name":"delete-stock-modal","component":"deleteStockModal"},{"name":"delete-stock-user-scope-modal","component":"deleteUserScopeModal"},{"name":"stock-management-app-menu-item","component":"stockManagementAppMenuItem","slot":"app-menu-item-slot","meta":{"name":" Stock Management"}},{"name":"delete-stock-rule-modal","component":"deleteStockRuleModal"},{"name":"delete-packaging-unit-modal","component":"deletePackagingUnitModal"},{"name":"delete-packaging-unit-button","component":"deletePackagingUnitButton"}],"pages":[{"component":"root","route":"stock-management"}],"version":"1.0.1-pre.632"}
|
package/i18next-parser.config.js
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
module.exports = {
|
2
|
-
contextSeparator:
|
2
|
+
contextSeparator: '_',
|
3
3
|
// Key separator used in your translation keys
|
4
4
|
|
5
5
|
createOldCatalogs: false,
|
6
6
|
// Save the \_old files
|
7
7
|
|
8
|
-
defaultNamespace:
|
8
|
+
defaultNamespace: 'translations',
|
9
9
|
// Default namespace used in your i18next config
|
10
10
|
|
11
|
-
defaultValue:
|
11
|
+
defaultValue: '',
|
12
12
|
// Default value to give to empty keys
|
13
13
|
// You may also specify a function accepting the locale, namespace, and key as arguments
|
14
14
|
|
@@ -18,43 +18,43 @@ module.exports = {
|
|
18
18
|
keepRemoved: false,
|
19
19
|
// Keep keys from the catalog that are no longer in code
|
20
20
|
|
21
|
-
keySeparator:
|
21
|
+
keySeparator: '.',
|
22
22
|
// Key separator used in your translation keys
|
23
23
|
// If you want to use plain english keys, separators such as `.` and `:` will conflict. You might want to set `keySeparator: false` and `namespaceSeparator: false`. That way, `t('Status: Loading...')` will not think that there are a namespace and three separator dots for instance.
|
24
24
|
|
25
25
|
// see below for more details
|
26
26
|
lexers: {
|
27
|
-
hbs: [
|
28
|
-
handlebars: [
|
27
|
+
hbs: ['HandlebarsLexer'],
|
28
|
+
handlebars: ['HandlebarsLexer'],
|
29
29
|
|
30
|
-
htm: [
|
31
|
-
html: [
|
30
|
+
htm: ['HTMLLexer'],
|
31
|
+
html: ['HTMLLexer'],
|
32
32
|
|
33
|
-
mjs: [
|
34
|
-
js: [
|
35
|
-
ts: [
|
36
|
-
jsx: [
|
37
|
-
tsx: [
|
33
|
+
mjs: ['JavascriptLexer'],
|
34
|
+
js: ['JavascriptLexer'], // if you're writing jsx inside .js files, change this to JsxLexer
|
35
|
+
ts: ['JavascriptLexer'],
|
36
|
+
jsx: ['JsxLexer'],
|
37
|
+
tsx: ['JsxLexer'],
|
38
38
|
|
39
|
-
default: [
|
39
|
+
default: ['JavascriptLexer'],
|
40
40
|
},
|
41
41
|
|
42
|
-
lineEnding:
|
42
|
+
lineEnding: 'auto',
|
43
43
|
// Control the line ending. See options at https://github.com/ryanve/eol
|
44
44
|
|
45
|
-
locales: [
|
45
|
+
locales: ['en'],
|
46
46
|
// An array of the locales in your applications
|
47
47
|
|
48
|
-
namespaceSeparator:
|
48
|
+
namespaceSeparator: ':',
|
49
49
|
// Namespace separator used in your translation keys
|
50
50
|
// If you want to use plain english keys, separators such as `.` and `:` will conflict. You might want to set `keySeparator: false` and `namespaceSeparator: false`. That way, `t('Status: Loading...')` will not think that there are a namespace and three separator dots for instance.
|
51
51
|
|
52
|
-
output:
|
52
|
+
output: '$NAMESPACE/$LOCALE.json',
|
53
53
|
// Supports $LOCALE and $NAMESPACE injection
|
54
54
|
// Supports JSON (.json) and YAML (.yml) file formats
|
55
55
|
// Where to write the locale files relative to process.cwd()
|
56
56
|
|
57
|
-
pluralSeparator:
|
57
|
+
pluralSeparator: '_',
|
58
58
|
// Plural separator used in your translation keys
|
59
59
|
// If you want to use plain english keys, separators such as `_` might conflict. You might want to set `pluralSeparator` to a different string that does not occur in your keys.
|
60
60
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@openmrs/esm-stock-management-app",
|
3
|
-
"version": "1.0.1-pre.
|
3
|
+
"version": "1.0.1-pre.632",
|
4
4
|
"license": "MPL-2.0",
|
5
5
|
"description": "Stock management microfrontend for OpenMRS 3.x",
|
6
6
|
"browser": "dist/openmrs-esm-stock-management-app.js",
|
@@ -18,7 +18,8 @@
|
|
18
18
|
"verify": "turbo run lint typescript coverage",
|
19
19
|
"coverage": "yarn test --coverage",
|
20
20
|
"prepare": "husky install",
|
21
|
-
"extract-translations": "i18next 'src/**/*.component.tsx' 'src/**/*.tsx' --config ./i18next-parser.config.js"
|
21
|
+
"extract-translations": "i18next 'src/**/*.component.tsx' 'src/**/*.tsx' --config ./i18next-parser.config.js",
|
22
|
+
"postinstall": "husky"
|
22
23
|
},
|
23
24
|
"browserslist": [
|
24
25
|
"extends browserslist-config-openmrs"
|
@@ -83,6 +84,7 @@
|
|
83
84
|
"eslint": "^8.44.0",
|
84
85
|
"eslint-plugin-react-hooks": "^4.6.2",
|
85
86
|
"eslint-plugin-testing-library": "^6.3.0",
|
87
|
+
"husky": "^9.1.6",
|
86
88
|
"i18next": "^23.2.8",
|
87
89
|
"i18next-parser": "^8.0.0",
|
88
90
|
"identity-obj-proxy": "^3.0.0",
|
@@ -23,7 +23,7 @@ export function useBatchJobs(filter: BatchJobFilter) {
|
|
23
23
|
return {
|
24
24
|
items: data.data ? data.data : [],
|
25
25
|
isLoading,
|
26
|
-
|
26
|
+
error,
|
27
27
|
};
|
28
28
|
}
|
29
29
|
|
@@ -68,6 +68,6 @@ export function useReportTypes() {
|
|
68
68
|
return {
|
69
69
|
items: data.data ? data.data : [],
|
70
70
|
isLoading,
|
71
|
-
|
71
|
+
error,
|
72
72
|
};
|
73
73
|
}
|
@@ -22,11 +22,11 @@ export function useStockInventory() {
|
|
22
22
|
});
|
23
23
|
}, []);
|
24
24
|
|
25
|
-
const { items, isLoading,
|
25
|
+
const { items, isLoading, error } = useStockBatches(stockItemFilter);
|
26
26
|
|
27
27
|
return {
|
28
28
|
items: items.results ?? [],
|
29
29
|
isLoading,
|
30
|
-
|
30
|
+
error,
|
31
31
|
};
|
32
32
|
}
|
@@ -8,7 +8,7 @@ export function useStockInventoryItems(v?: ResourceRepresentation) {
|
|
8
8
|
totalCount: true,
|
9
9
|
});
|
10
10
|
|
11
|
-
const { items, isLoading,
|
11
|
+
const { items, isLoading, error } = useStockItems(stockItemFilter);
|
12
12
|
|
13
13
|
useEffect(() => {
|
14
14
|
setStockItemFilter({
|
@@ -20,6 +20,6 @@ export function useStockInventoryItems(v?: ResourceRepresentation) {
|
|
20
20
|
return {
|
21
21
|
items: items?.results ?? [],
|
22
22
|
isLoading,
|
23
|
-
|
23
|
+
error,
|
24
24
|
};
|
25
25
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { StockOperationFilter, useStockOperations } from '../stock-operations/stock-operations.resource';
|
2
2
|
|
3
3
|
export function useStockIssuing(filter: StockOperationFilter) {
|
4
|
-
const { items, isLoading,
|
4
|
+
const { items, isLoading, error } = useStockOperations(filter);
|
5
5
|
|
6
6
|
const receivedItems = items?.results?.filter(
|
7
7
|
(item) => item?.operationType === 'stockissue' && item?.status !== 'COMPLETED',
|
@@ -9,6 +9,6 @@ export function useStockIssuing(filter: StockOperationFilter) {
|
|
9
9
|
return {
|
10
10
|
items: receivedItems,
|
11
11
|
isLoading,
|
12
|
-
|
12
|
+
error,
|
13
13
|
};
|
14
14
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { StockOperationFilter, useStockOperations } from '../stock-operations/stock-operations.resource';
|
2
2
|
|
3
3
|
export function useStockReceiving(filter: StockOperationFilter) {
|
4
|
-
const { items, isLoading,
|
4
|
+
const { items, isLoading, error } = useStockOperations(filter);
|
5
5
|
|
6
6
|
const receivedItems = items?.results?.filter(
|
7
7
|
(item) => item?.operationType === 'receipt' && item?.status !== 'COMPLETED',
|
@@ -9,6 +9,6 @@ export function useStockReceiving(filter: StockOperationFilter) {
|
|
9
9
|
return {
|
10
10
|
items: receivedItems,
|
11
11
|
isLoading,
|
12
|
-
|
12
|
+
error,
|
13
13
|
};
|
14
14
|
}
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import { StockOperationFilter, useStockOperations } from '../stock-operations/stock-operations.resource';
|
2
2
|
|
3
3
|
export function useDisposalList(filter: StockOperationFilter) {
|
4
|
-
const { items, isLoading,
|
4
|
+
const { items, isLoading, error } = useStockOperations(filter);
|
5
5
|
|
6
6
|
const receivedItems = items?.results?.filter((item) => item?.operationType === 'disposed');
|
7
7
|
|
8
8
|
return {
|
9
9
|
items: receivedItems,
|
10
10
|
isLoading,
|
11
|
-
|
11
|
+
error,
|
12
12
|
};
|
13
13
|
}
|
@@ -15,7 +15,7 @@ interface StockList {
|
|
15
15
|
const useStockList = () => {
|
16
16
|
const url = `${restBaseUrl}/stockmanagement/stockitem?v=default&totalCount=true`;
|
17
17
|
|
18
|
-
const { data, error } = useSWR<{ data: { results: Array<StockList> } }>(url, openmrsFetch);
|
18
|
+
const { data, error, isLoading } = useSWR<{ data: { results: Array<StockList> } }>(url, openmrsFetch);
|
19
19
|
|
20
20
|
const stocks = data?.data.results.map((stock) => ({
|
21
21
|
uuid: stock.uuid,
|
@@ -25,7 +25,7 @@ const useStockList = () => {
|
|
25
25
|
|
26
26
|
return {
|
27
27
|
stockList: (stocks as Array<any>) ?? [],
|
28
|
-
isLoading
|
28
|
+
isLoading,
|
29
29
|
error,
|
30
30
|
};
|
31
31
|
};
|
@@ -38,7 +38,7 @@ export function useStockItemBatchInformationHook(filter?: StockItemInventoryFilt
|
|
38
38
|
});
|
39
39
|
}, [searchString, currentPage, currentPageSize, stockItemUuid, partyUuid, locationUuid, stockBatchUuid]);
|
40
40
|
|
41
|
-
const { items, isLoading,
|
41
|
+
const { items, isLoading, error } = useStockItemInventory(stockItemFilter);
|
42
42
|
|
43
43
|
return {
|
44
44
|
items: items.results ?? [],
|
@@ -49,7 +49,7 @@ export function useStockItemBatchInformationHook(filter?: StockItemInventoryFilt
|
|
49
49
|
setPageSize,
|
50
50
|
pageSizes,
|
51
51
|
isLoading,
|
52
|
-
|
52
|
+
error,
|
53
53
|
setSearchString,
|
54
54
|
setStockItemUuid,
|
55
55
|
setLocationUuid,
|
@@ -21,13 +21,13 @@ export function useStockItemPackageUnitsHook(v?: ResourceRepresentation) {
|
|
21
21
|
});
|
22
22
|
}, [stockItemUuid]);
|
23
23
|
|
24
|
-
const { items, isLoading,
|
24
|
+
const { items, isLoading, error, mutate } = useStockItemPackagingUOMs(stockItemFilter);
|
25
25
|
|
26
26
|
return {
|
27
27
|
items: items.results,
|
28
28
|
totalCount: items.totalCount,
|
29
29
|
isLoading,
|
30
|
-
|
30
|
+
error,
|
31
31
|
setStockItemUuid,
|
32
32
|
mutate,
|
33
33
|
};
|
@@ -36,7 +36,7 @@ export function useStockItemQuantitiesHook(v?: ResourceRepresentation) {
|
|
36
36
|
});
|
37
37
|
}, [searchString, currentPage, currentPageSize, stockItemUuid, partyUuid, locationUuid, stockBatchUuid]);
|
38
38
|
|
39
|
-
const { items, isLoading,
|
39
|
+
const { items, isLoading, error } = useStockItemInventory(stockItemFilter);
|
40
40
|
|
41
41
|
return {
|
42
42
|
items: items.results ?? [],
|
@@ -47,7 +47,7 @@ export function useStockItemQuantitiesHook(v?: ResourceRepresentation) {
|
|
47
47
|
setPageSize,
|
48
48
|
pageSizes,
|
49
49
|
isLoading,
|
50
|
-
|
50
|
+
error,
|
51
51
|
setSearchString,
|
52
52
|
setStockItemUuid,
|
53
53
|
setLocationUuid,
|
package/src/stock-items/add-stock-item/stock-item-references/stock-item-references.resource.ts
CHANGED
@@ -21,13 +21,13 @@ export function useStockItemReferencesHook(v?: ResourceRepresentation) {
|
|
21
21
|
});
|
22
22
|
}, [stockItemUuid]);
|
23
23
|
|
24
|
-
const { items, isLoading,
|
24
|
+
const { items, isLoading, error } = useStockItemReferences(stockItemReferenceFilter);
|
25
25
|
|
26
26
|
return {
|
27
27
|
items: items.results,
|
28
28
|
totalCount: items.totalCount,
|
29
29
|
isLoading,
|
30
|
-
|
30
|
+
error,
|
31
31
|
setStockItemUuid,
|
32
32
|
};
|
33
33
|
}
|
@@ -3,7 +3,7 @@ import { StockRuleFilter, useStockRules } from '../../stock-items.resource';
|
|
3
3
|
import { usePagination } from '@openmrs/esm-framework';
|
4
4
|
|
5
5
|
export function useStockItemRules(filter: StockRuleFilter) {
|
6
|
-
const { items, isLoading,
|
6
|
+
const { items, isLoading, error } = useStockRules(filter);
|
7
7
|
|
8
8
|
const pageSizes = [10, 20, 30, 40, 50];
|
9
9
|
const [currentPageSize, setPageSize] = useState(10);
|
@@ -61,7 +61,7 @@ export function useStockItemRules(filter: StockRuleFilter) {
|
|
61
61
|
goTo,
|
62
62
|
pageSizes,
|
63
63
|
isLoading,
|
64
|
-
|
64
|
+
error,
|
65
65
|
setPageSize,
|
66
66
|
tableHeaders,
|
67
67
|
};
|
@@ -9,13 +9,13 @@ interface StockRulesFilterProps {
|
|
9
9
|
}
|
10
10
|
|
11
11
|
const StockRulesFilter: React.FC<StockRulesFilterProps> = ({ stockItemUuid }) => {
|
12
|
-
const { items, isLoading,
|
12
|
+
const { items, isLoading, error } = useStockRules({
|
13
13
|
v: ResourceRepresentation.Default,
|
14
14
|
totalCount: true,
|
15
15
|
stockItemUuid: stockItemUuid,
|
16
16
|
});
|
17
17
|
|
18
|
-
if (isLoading ||
|
18
|
+
if (isLoading || error) {
|
19
19
|
return <DropdownSkeleton />;
|
20
20
|
}
|
21
21
|
return (
|
@@ -17,7 +17,7 @@ export function useStockRules(filter: StockSourceFilter) {
|
|
17
17
|
return {
|
18
18
|
items: data?.data || <PageableResult<StockRule>>{},
|
19
19
|
isLoading,
|
20
|
-
|
20
|
+
error,
|
21
21
|
};
|
22
22
|
}
|
23
23
|
|
@@ -28,7 +28,7 @@ export function useStockRule(id: string) {
|
|
28
28
|
return {
|
29
29
|
items: data.data ? data.data : [],
|
30
30
|
isLoading,
|
31
|
-
|
31
|
+
error,
|
32
32
|
};
|
33
33
|
}
|
34
34
|
|
@@ -36,7 +36,7 @@ export function useStockItemsTransactions(filter?: StockItemInventoryFilter) {
|
|
36
36
|
});
|
37
37
|
}, [searchString, currentPage, currentPageSize, stockItemUuid, partyUuid, locationUuid, stockBatchUuid]);
|
38
38
|
|
39
|
-
const { items, isLoading,
|
39
|
+
const { items, isLoading, error } = useStockItemTransactions(stockItemFilter);
|
40
40
|
|
41
41
|
const tableHeaders = useMemo(
|
42
42
|
() => [
|
@@ -85,7 +85,7 @@ export function useStockItemsTransactions(filter?: StockItemInventoryFilter) {
|
|
85
85
|
setPageSize,
|
86
86
|
pageSizes,
|
87
87
|
isLoading,
|
88
|
-
|
88
|
+
error,
|
89
89
|
setSearchString,
|
90
90
|
tableHeaders,
|
91
91
|
setStockItemUuid,
|
@@ -23,7 +23,7 @@ export function useStockItemsPages(v?: ResourceRepresentation) {
|
|
23
23
|
totalCount: true,
|
24
24
|
});
|
25
25
|
|
26
|
-
const { items, isLoading,
|
26
|
+
const { items, isLoading, error } = useStockItems(stockItemFilter);
|
27
27
|
const pagination = usePagination(items.results, currentPageSize);
|
28
28
|
|
29
29
|
useEffect(() => {
|
@@ -47,7 +47,7 @@ export function useStockItemsPages(v?: ResourceRepresentation) {
|
|
47
47
|
setPageSize,
|
48
48
|
pageSizes,
|
49
49
|
isLoading,
|
50
|
-
|
50
|
+
error,
|
51
51
|
isDrug,
|
52
52
|
setDrug: (drug: string) => {
|
53
53
|
setCurrentPage(1);
|
@@ -77,7 +77,7 @@ export function useStockItems(filter: StockItemFilter) {
|
|
77
77
|
return {
|
78
78
|
items: data?.data || <PageableResult<StockItemDTO>>{},
|
79
79
|
isLoading,
|
80
|
-
|
80
|
+
error,
|
81
81
|
};
|
82
82
|
}
|
83
83
|
|
@@ -100,7 +100,7 @@ export function useStockItemTransactions(filter: StockItemTransactionFilter) {
|
|
100
100
|
return {
|
101
101
|
items: data?.data || <PageableResult<StockItemTransactionDTO>>{},
|
102
102
|
isLoading,
|
103
|
-
|
103
|
+
error,
|
104
104
|
};
|
105
105
|
}
|
106
106
|
|
@@ -117,7 +117,7 @@ export function useStockItemInventory(filter: StockItemInventoryFilter) {
|
|
117
117
|
return {
|
118
118
|
items: data?.data || <StockInventoryResult>{},
|
119
119
|
isLoading,
|
120
|
-
|
120
|
+
error,
|
121
121
|
};
|
122
122
|
}
|
123
123
|
|
@@ -133,7 +133,7 @@ export function useStockOperationItemsCost(filter: string) {
|
|
133
133
|
return {
|
134
134
|
items: data.data ? data.data : [],
|
135
135
|
isLoading,
|
136
|
-
|
136
|
+
error,
|
137
137
|
};
|
138
138
|
}
|
139
139
|
|
@@ -149,7 +149,7 @@ export function useStockBatches(filter: StockBatchFilter) {
|
|
149
149
|
return {
|
150
150
|
items: data?.data || <PageableResult<StockBatchDTO>>{},
|
151
151
|
isLoading,
|
152
|
-
|
152
|
+
error,
|
153
153
|
};
|
154
154
|
}
|
155
155
|
|
@@ -166,7 +166,7 @@ export function useStockItemPackagingUOMs(filter: StockItemPackagingUOMFilter) {
|
|
166
166
|
return {
|
167
167
|
items: data?.data || <PageableResult<StockItemPackagingUOMDTO>>{},
|
168
168
|
isLoading,
|
169
|
-
|
169
|
+
error,
|
170
170
|
mutate,
|
171
171
|
};
|
172
172
|
}
|
@@ -183,7 +183,7 @@ export function useStockItem(id: string) {
|
|
183
183
|
return {
|
184
184
|
item: data?.data || <StockItemDTO>{},
|
185
185
|
isLoading,
|
186
|
-
|
186
|
+
error,
|
187
187
|
};
|
188
188
|
}
|
189
189
|
|
@@ -312,7 +312,7 @@ export function useStockRules(filter: StockRuleFilter) {
|
|
312
312
|
return {
|
313
313
|
items: data?.data || <PageableResult<StockRule>>{},
|
314
314
|
isLoading,
|
315
|
-
|
315
|
+
error,
|
316
316
|
};
|
317
317
|
}
|
318
318
|
|
@@ -371,7 +371,7 @@ export function useStockItemReferences(filter: StockItemReferenceFilter) {
|
|
371
371
|
return {
|
372
372
|
items: data?.data || <PageableResult<StockItemReferenceDTO>>{},
|
373
373
|
isLoading,
|
374
|
-
|
374
|
+
error,
|
375
375
|
};
|
376
376
|
}
|
377
377
|
|
@@ -48,7 +48,7 @@ export function useStockLocations(filter: LocationFilterCriteria) {
|
|
48
48
|
>(apiUrl, openmrsFetch);
|
49
49
|
return {
|
50
50
|
locations: data?.data || <PageableResult<OpenMRSLocation>>{},
|
51
|
-
|
51
|
+
errorLocation: error,
|
52
52
|
isLoadingLocations: isLoading,
|
53
53
|
};
|
54
54
|
}
|
@@ -81,7 +81,7 @@ export function useLocationWithIdByUuid(id: string) {
|
|
81
81
|
return {
|
82
82
|
items: data.data ? data.data : [],
|
83
83
|
isLoading,
|
84
|
-
|
84
|
+
error,
|
85
85
|
};
|
86
86
|
}
|
87
87
|
|
@@ -110,7 +110,7 @@ export function useLocationTags(q: string) {
|
|
110
110
|
return {
|
111
111
|
items: data.data ? data.data : [],
|
112
112
|
isLoading,
|
113
|
-
|
113
|
+
error,
|
114
114
|
};
|
115
115
|
}
|
116
116
|
|
@@ -126,7 +126,7 @@ export function useRoles(filter: ResourceFilterCriteria) {
|
|
126
126
|
return {
|
127
127
|
items: data?.data || <PageableResult<Role>>{},
|
128
128
|
isLoading,
|
129
|
-
|
129
|
+
error,
|
130
130
|
};
|
131
131
|
}
|
132
132
|
|
@@ -142,7 +142,7 @@ export function useStockOperationTypes() {
|
|
142
142
|
return {
|
143
143
|
types: data?.data || <PageableResult<StockOperationType>>{},
|
144
144
|
isLoading,
|
145
|
-
|
145
|
+
error,
|
146
146
|
};
|
147
147
|
}
|
148
148
|
|
@@ -163,7 +163,7 @@ export function useUsers(filter: UserFilterCriteria) {
|
|
163
163
|
return {
|
164
164
|
items: data?.data || <PageableResult<User>>{},
|
165
165
|
isLoading,
|
166
|
-
|
166
|
+
error,
|
167
167
|
};
|
168
168
|
}
|
169
169
|
|
@@ -179,7 +179,7 @@ export function useUser(id: string) {
|
|
179
179
|
return {
|
180
180
|
data: data?.data || <User>{},
|
181
181
|
isLoading,
|
182
|
-
|
182
|
+
error,
|
183
183
|
};
|
184
184
|
}
|
185
185
|
|
@@ -194,7 +194,7 @@ export function useConcept(conceptUuid: string) {
|
|
194
194
|
return {
|
195
195
|
items: data?.data || <Concept>{},
|
196
196
|
isLoading,
|
197
|
-
|
197
|
+
error,
|
198
198
|
};
|
199
199
|
}
|
200
200
|
|
@@ -210,7 +210,7 @@ export function useParties() {
|
|
210
210
|
return {
|
211
211
|
items: data?.data || <PageableResult<Party>>{},
|
212
212
|
isLoading,
|
213
|
-
|
213
|
+
error,
|
214
214
|
};
|
215
215
|
}
|
216
216
|
|
@@ -231,7 +231,7 @@ export function useDrugs(filter: DrugFilterCriteria) {
|
|
231
231
|
return {
|
232
232
|
items: data?.data || <PageableResult<Drug>>{},
|
233
233
|
isLoading,
|
234
|
-
|
234
|
+
error,
|
235
235
|
};
|
236
236
|
}
|
237
237
|
|
@@ -247,7 +247,7 @@ export function useConcepts(filter: ConceptFilterCriteria) {
|
|
247
247
|
return {
|
248
248
|
items: data?.data || <PageableResult<Concept>>{},
|
249
249
|
isLoading,
|
250
|
-
|
250
|
+
error,
|
251
251
|
};
|
252
252
|
}
|
253
253
|
|
@@ -263,7 +263,7 @@ export function usePatients(filter: ConceptFilterCriteria) {
|
|
263
263
|
return {
|
264
264
|
items: data.data ? data.data : [],
|
265
265
|
isLoading,
|
266
|
-
|
266
|
+
error,
|
267
267
|
};
|
268
268
|
}
|
269
269
|
|
@@ -37,7 +37,7 @@ import { StockOperationLinkDTO } from '../../core/api/types/stockOperation/Stock
|
|
37
37
|
const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
|
38
38
|
const { t } = useTranslation();
|
39
39
|
const { isEditing, canEdit, canPrint } = props;
|
40
|
-
const { isLoading,
|
40
|
+
const { isLoading, error, result } = useInitializeStockOperations(props);
|
41
41
|
const [operationLinks, setOperationLinks] = useState<StockOperationLinkDTO[]>();
|
42
42
|
const [manageStockItems, setManageStockItems] = useState(props?.isEditing);
|
43
43
|
const { types } = useStockOperationTypes();
|
@@ -85,7 +85,7 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
|
|
85
85
|
}, [props?.model?.permission]);
|
86
86
|
|
87
87
|
if (isLoading) return <AccordionSkeleton />;
|
88
|
-
if (
|
88
|
+
if (error) {
|
89
89
|
closeOverlay();
|
90
90
|
showSnackbar({
|
91
91
|
kind: 'error',
|