@openmrs/esm-stock-management-app 1.0.1-pre.327 → 1.0.1-pre.330
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/979.js +1 -1
- package/dist/979.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/package.json +1 -1
- package/src/config-schema.ts +31 -1
- package/src/constants.ts +0 -12
- package/src/stock-items/add-stock-item/dispensing-unit-selector/dispensing-unit-selector.component.tsx +5 -3
- package/src/stock-items/add-stock-item/packaging-units-concept-selector/packaging-units-concept-selector.component.tsx +6 -3
- package/src/stock-items/add-stock-item/stock-item-category-selector/stock-item-category-selector.component.tsx +5 -3
- package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.component.tsx +19 -11
- package/src/stock-lookups/stock-lookups.resource.ts +2 -3
- package/src/stock-operations/stock-operation-reason-selector/stock-operation-reason-selector.component.tsx +6 -3
- package/src/stock-operations/stock-operation-sources-filter/stock-operation-sources-filter.component.tsx +6 -5
- package/src/stock-sources/add-stock-sources/add-stock-sources.component.tsx +5 -4
- package/src/stock-sources/stock-sources-filter/stock-sources-filter.component.tsx +5 -5
@@ -86,10 +86,10 @@
|
|
86
86
|
"initial": true,
|
87
87
|
"entry": true,
|
88
88
|
"recorded": false,
|
89
|
-
"size":
|
89
|
+
"size": 4313561,
|
90
90
|
"sizes": {
|
91
91
|
"consume-shared": 252,
|
92
|
-
"javascript":
|
92
|
+
"javascript": 4291612,
|
93
93
|
"share-init": 252,
|
94
94
|
"runtime": 21445
|
95
95
|
},
|
@@ -106,7 +106,7 @@
|
|
106
106
|
"auxiliaryFiles": [
|
107
107
|
"main.js.map"
|
108
108
|
],
|
109
|
-
"hash": "
|
109
|
+
"hash": "4a8de7e5af9880bb",
|
110
110
|
"childrenByOrder": {}
|
111
111
|
},
|
112
112
|
{
|
@@ -333,9 +333,9 @@
|
|
333
333
|
"initial": false,
|
334
334
|
"entry": false,
|
335
335
|
"recorded": false,
|
336
|
-
"size":
|
336
|
+
"size": 903747,
|
337
337
|
"sizes": {
|
338
|
-
"javascript":
|
338
|
+
"javascript": 903537,
|
339
339
|
"consume-shared": 210
|
340
340
|
},
|
341
341
|
"names": [],
|
@@ -349,7 +349,7 @@
|
|
349
349
|
"auxiliaryFiles": [
|
350
350
|
"979.js.map"
|
351
351
|
],
|
352
|
-
"hash": "
|
352
|
+
"hash": "1e00550985a95c26",
|
353
353
|
"childrenByOrder": {}
|
354
354
|
}
|
355
355
|
]
|
package/dist/routes.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":"^1.2.0","webservices.rest":"^2.24.0"},"extensions":[{"name":"stock-management-dashboard","slot":"stock-management-dashboard-slot","component":"stockManagementDashboard"},{"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"}],"pages":[{"component":"stockManagement","route":"stock-management"}],"version":"1.0.1-pre.
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":"^1.2.0","webservices.rest":"^2.24.0"},"extensions":[{"name":"stock-management-dashboard","slot":"stock-management-dashboard-slot","component":"stockManagementDashboard"},{"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"}],"pages":[{"component":"stockManagement","route":"stock-management"}],"version":"1.0.1-pre.330"}
|
package/package.json
CHANGED
package/src/config-schema.ts
CHANGED
@@ -10,9 +10,39 @@ export const configSchema = {
|
|
10
10
|
_default: false,
|
11
11
|
_description: "Whether to print balance on hand on the print out",
|
12
12
|
},
|
13
|
+
packagingUnitsUUID: {
|
14
|
+
_type: Type.ConceptUuid,
|
15
|
+
_description: "UUID for the packaging unit",
|
16
|
+
_default: "bce2b1af-98b1-48a2-98a2-3e4ffb3c79c2",
|
17
|
+
},
|
18
|
+
stockAdjustmentReasonUUID: {
|
19
|
+
_type: Type.ConceptUuid,
|
20
|
+
_description: "UUID for the stock adjustment reasons",
|
21
|
+
_default: "3bbfaa44-d5b8-404d-b4c1-2bf49ad8ce25",
|
22
|
+
},
|
23
|
+
stockSourceTypeUUID: {
|
24
|
+
_type: Type.ConceptUuid,
|
25
|
+
_description: "UUID for the stock source types",
|
26
|
+
_default: "2e1e8049-9cbe-4a2d-b1e5-8a91e5d7d97d",
|
27
|
+
},
|
28
|
+
dispensingUnitsUUID: {
|
29
|
+
_type: Type.ConceptUuid,
|
30
|
+
_description: "UUID for the stock dispensing units uuid",
|
31
|
+
_default: "162402AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
|
32
|
+
},
|
33
|
+
stockItemCategoryUUID: {
|
34
|
+
_type: Type.ConceptUuid,
|
35
|
+
_description: "UUID for the stock item category",
|
36
|
+
_default: "6d24eb6e-b42f-4706-ab2d-ae4472161f6a",
|
37
|
+
},
|
13
38
|
};
|
14
39
|
|
15
|
-
export type
|
40
|
+
export type ConfigObject = {
|
16
41
|
printItemCost: boolean;
|
17
42
|
printBalanceOnHand: boolean;
|
43
|
+
packagingUnitsUUID: string;
|
44
|
+
stockAdjustmentReasonUUID: string;
|
45
|
+
stockSourceTypeUUID: string;
|
46
|
+
dispensingUnitsUUID: string;
|
47
|
+
stockItemCategoryUUID: string;
|
18
48
|
};
|
package/src/constants.ts
CHANGED
@@ -86,18 +86,6 @@ export const APP_STOCKMANAGEMENT_REPORTS = "App: stockmanagement.reports";
|
|
86
86
|
|
87
87
|
/** @type {string}: Task: stockmanagement.reports.mutate, Able to create stock reports*/
|
88
88
|
|
89
|
-
// concepts
|
90
|
-
export const STOCK_SOURCE_TYPE_CODED_CONCEPT_ID =
|
91
|
-
"2e1e8049-9cbe-4a2d-b1e5-8a91e5d7d97d";
|
92
|
-
export const STOCK_ADJUSTMENT_REASON_CODED_CONCEPT_ID =
|
93
|
-
"3bbfaa44-d5b8-404d-b4c1-2bf49ad8ce25";
|
94
|
-
export const DISPENSING_UNITS_CONCEPT_ID =
|
95
|
-
"162402AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
96
|
-
export const PACKAGING_UNITS_CODED_CONCEPT_ID =
|
97
|
-
"bce2b1af-98b1-48a2-98a2-3e4ffb3c79c2";
|
98
|
-
export const STOCK_ITEM_CATEGORY_CONCEPT_ID =
|
99
|
-
"6d24eb6e-b42f-4706-ab2d-ae4472161f6a";
|
100
|
-
|
101
89
|
export const INVENTORY_CLERK_ROLE_UUID = "d210eb66-2188-11ed-9dff-507b9dea1806";
|
102
90
|
export const INVENTORY_MANAGER_ROLE_UUID =
|
103
91
|
"cca4be4b-2188-11ed-9dff-507b9dea1806";
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import React, { ReactNode } from "react";
|
2
2
|
import { ComboBox, TextInputSkeleton } from "@carbon/react";
|
3
|
-
import {
|
4
|
-
import { DISPENSING_UNITS_CONCEPT_ID } from "../../../constants";
|
3
|
+
import { useConcept } from "../../../stock-lookups/stock-lookups.resource";
|
5
4
|
import { Concept } from "../../../core/api/types/concept/Concept";
|
6
5
|
import { Control, Controller, FieldValues } from "react-hook-form";
|
6
|
+
import { type ConfigObject } from "../../../config-schema";
|
7
|
+
import { useConfig } from "@openmrs/esm-framework";
|
7
8
|
|
8
9
|
interface DispensingUnitSelectorProps<T> {
|
9
10
|
dispensingUnitUuid?: string;
|
@@ -20,10 +21,11 @@ interface DispensingUnitSelectorProps<T> {
|
|
20
21
|
}
|
21
22
|
|
22
23
|
const DispensingUnitSelector = <T,>(props: DispensingUnitSelectorProps<T>) => {
|
24
|
+
const { dispensingUnitsUUID } = useConfig<ConfigObject>();
|
23
25
|
const {
|
24
26
|
items: { setMembers: dispensingUnits },
|
25
27
|
isLoading,
|
26
|
-
} =
|
28
|
+
} = useConcept(dispensingUnitsUUID);
|
27
29
|
|
28
30
|
if (isLoading) return <TextInputSkeleton />;
|
29
31
|
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import React, { ReactNode } from "react";
|
2
2
|
import { Concept } from "../../../core/api/types/concept/Concept";
|
3
3
|
import { Control, Controller, FieldValues } from "react-hook-form";
|
4
|
-
import {
|
5
|
-
import { PACKAGING_UNITS_CODED_CONCEPT_ID } from "../../../constants";
|
4
|
+
import { useConcept } from "../../../stock-lookups/stock-lookups.resource";
|
6
5
|
import { ComboBox, TextInputSkeleton } from "@carbon/react";
|
7
6
|
import { StockItemPackagingUOMDTO } from "../../../core/api/types/stockItem/StockItemPackagingUOM";
|
7
|
+
import { useConfig } from "@openmrs/esm-framework";
|
8
|
+
import { type ConfigObject } from "../../../config-schema";
|
8
9
|
|
9
10
|
interface PackagingUnitsConceptSelectorProps<T> {
|
10
11
|
row?: StockItemPackagingUOMDTO;
|
@@ -23,10 +24,12 @@ interface PackagingUnitsConceptSelectorProps<T> {
|
|
23
24
|
const PackagingUnitsConceptSelector = <T,>(
|
24
25
|
props: PackagingUnitsConceptSelectorProps<T>
|
25
26
|
) => {
|
27
|
+
const { packagingUnitsUUID } = useConfig<ConfigObject>();
|
28
|
+
|
26
29
|
const {
|
27
30
|
items: { answers: dispensingUnits },
|
28
31
|
isLoading,
|
29
|
-
} =
|
32
|
+
} = useConcept(packagingUnitsUUID);
|
30
33
|
|
31
34
|
if (isLoading) return <TextInputSkeleton />;
|
32
35
|
|
@@ -2,8 +2,9 @@ import React, { ReactNode } from "react";
|
|
2
2
|
import { Control, Controller, FieldValues } from "react-hook-form";
|
3
3
|
import { Concept } from "../../../core/api/types/concept/Concept";
|
4
4
|
import { ComboBox, TextInputSkeleton } from "@carbon/react";
|
5
|
-
import {
|
6
|
-
import {
|
5
|
+
import { useConcept } from "../../../stock-lookups/stock-lookups.resource";
|
6
|
+
import { type ConfigObject } from "../../../config-schema";
|
7
|
+
import { useConfig } from "@openmrs/esm-framework";
|
7
8
|
|
8
9
|
interface StockItemCategorySelectorProps<T> {
|
9
10
|
categoryUuid?: string;
|
@@ -22,10 +23,11 @@ interface StockItemCategorySelectorProps<T> {
|
|
22
23
|
const StockItemCategorySelector = <T,>(
|
23
24
|
props: StockItemCategorySelectorProps<T>
|
24
25
|
) => {
|
26
|
+
const { stockItemCategoryUUID } = useConfig<ConfigObject>();
|
25
27
|
const {
|
26
28
|
items: { answers: categories },
|
27
29
|
isLoading,
|
28
|
-
} =
|
30
|
+
} = useConcept(stockItemCategoryUUID);
|
29
31
|
|
30
32
|
if (isLoading) return <TextInputSkeleton />;
|
31
33
|
|
@@ -162,17 +162,25 @@ const StockItemDetails = forwardRef<never, StockItemDetailsProps>(
|
|
162
162
|
</FormGroup>
|
163
163
|
|
164
164
|
{hasExpiration && (
|
165
|
-
<
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
165
|
+
<FormGroup
|
166
|
+
className="clear-margin-bottom"
|
167
|
+
legendText={t("expirationNotice", "Expiration Notice (days)")}
|
168
|
+
title={t("expirationNotice", "Expiration Notice (days)")}
|
169
|
+
>
|
170
|
+
<ControlledNumberInput
|
171
|
+
id="expiryNotice"
|
172
|
+
name="expiryNotice"
|
173
|
+
control={control}
|
174
|
+
controllerName="expiryNotice"
|
175
|
+
size={"md"}
|
176
|
+
allowEmpty={true}
|
177
|
+
label={t("expiryNoticeDays", "Expiration Notice (days)")}
|
178
|
+
invalid={!!errors.expiryNotice}
|
179
|
+
invalidText={
|
180
|
+
errors.expiryNotice && errors?.expiryNotice?.message
|
181
|
+
}
|
182
|
+
/>
|
183
|
+
</FormGroup>
|
176
184
|
)}
|
177
185
|
</div>
|
178
186
|
<PreferredVendorSelector
|
@@ -191,9 +191,8 @@ export function useUser(id: string) {
|
|
191
191
|
};
|
192
192
|
}
|
193
193
|
|
194
|
-
|
195
|
-
|
196
|
-
const apiUrl = `ws/rest/v1/concept/${id}`;
|
194
|
+
export function useConcept(conceptUuid: string) {
|
195
|
+
const apiUrl = `ws/rest/v1/concept/${conceptUuid}`;
|
197
196
|
const { data, error, isLoading } = useSWR<
|
198
197
|
{
|
199
198
|
data: Concept;
|
@@ -2,8 +2,9 @@ import React, { ReactNode } from "react";
|
|
2
2
|
import { Control, Controller, FieldValues } from "react-hook-form";
|
3
3
|
import { Concept } from "../../core/api/types/concept/Concept";
|
4
4
|
import { ComboBox, SelectSkeleton } from "@carbon/react";
|
5
|
-
import {
|
6
|
-
import {
|
5
|
+
import { useConcept } from "../../stock-lookups/stock-lookups.resource";
|
6
|
+
import { type ConfigObject } from "../../config-schema";
|
7
|
+
import { useConfig } from "@openmrs/esm-framework";
|
7
8
|
|
8
9
|
interface StockOperationReasonSelectorProps<T> {
|
9
10
|
reasonUuid?: string;
|
@@ -22,11 +23,13 @@ interface StockOperationReasonSelectorProps<T> {
|
|
22
23
|
const StockOperationReasonSelector = <T,>(
|
23
24
|
props: StockOperationReasonSelectorProps<T>
|
24
25
|
) => {
|
26
|
+
const { stockAdjustmentReasonUUID } = useConfig<ConfigObject>();
|
27
|
+
|
25
28
|
const {
|
26
29
|
isLoading,
|
27
30
|
isError,
|
28
31
|
items: { answers: reasons },
|
29
|
-
} =
|
32
|
+
} = useConcept(stockAdjustmentReasonUUID);
|
30
33
|
|
31
34
|
if (isLoading || isError) return <SelectSkeleton />;
|
32
35
|
|
@@ -1,14 +1,15 @@
|
|
1
1
|
import styles from "./stock-operation-sources-filter.scss";
|
2
2
|
import { Dropdown, DropdownSkeleton } from "@carbon/react";
|
3
3
|
import React from "react";
|
4
|
-
import {
|
5
|
-
import {
|
4
|
+
import { useConcept } from "../../stock-lookups/stock-lookups.resource";
|
5
|
+
import { type ConfigObject } from "../../config-schema";
|
6
|
+
import { useConfig } from "@openmrs/esm-framework";
|
6
7
|
|
7
8
|
const StockOperationSourcesFilter: React.FC = () => {
|
9
|
+
const { stockSourceTypeUUID } = useConfig<ConfigObject>();
|
10
|
+
|
8
11
|
// get stock sources
|
9
|
-
const { items, isLoading, isError } =
|
10
|
-
STOCK_SOURCE_TYPE_CODED_CONCEPT_ID
|
11
|
-
);
|
12
|
+
const { items, isLoading, isError } = useConcept(stockSourceTypeUUID);
|
12
13
|
if (isLoading || isError) {
|
13
14
|
return <DropdownSkeleton />;
|
14
15
|
}
|
@@ -11,13 +11,13 @@ import {
|
|
11
11
|
import React, { ChangeEvent, useCallback, useState } from "react";
|
12
12
|
import { handleMutate } from "../swr-revalidation";
|
13
13
|
import styles from "./add-stock-sources.scss";
|
14
|
-
import {
|
15
|
-
import { STOCK_SOURCE_TYPE_CODED_CONCEPT_ID } from "../../constants";
|
14
|
+
import { useConcept } from "../../stock-lookups/stock-lookups.resource";
|
16
15
|
import { StockSource } from "../../core/api/types/stockOperation/StockSource";
|
17
16
|
import { createOrUpdateStockSource } from "../stock-sources.resource";
|
18
|
-
import { showNotification, showToast } from "@openmrs/esm-framework";
|
17
|
+
import { showNotification, showToast, useConfig } from "@openmrs/esm-framework";
|
19
18
|
import { useTranslation } from "react-i18next";
|
20
19
|
import { closeOverlay } from "../../core/components/overlay/hook";
|
20
|
+
import { type ConfigObject } from "../../config-schema";
|
21
21
|
|
22
22
|
interface AddStockSourceProps {
|
23
23
|
model?: StockSource;
|
@@ -25,9 +25,10 @@ interface AddStockSourceProps {
|
|
25
25
|
|
26
26
|
const StockSourcesAddOrUpdate: React.FC<AddStockSourceProps> = ({ model }) => {
|
27
27
|
const { t } = useTranslation();
|
28
|
+
const { stockSourceTypeUUID } = useConfig<ConfigObject>();
|
28
29
|
|
29
30
|
// get stock sources
|
30
|
-
const { items } =
|
31
|
+
const { items } = useConcept(stockSourceTypeUUID);
|
31
32
|
|
32
33
|
const [formModel, setFormModel] = useState<StockSource>({ ...model });
|
33
34
|
|
@@ -1,16 +1,16 @@
|
|
1
1
|
import styles from "./stock-sources-filter.scss";
|
2
2
|
import { Dropdown, DropdownSkeleton } from "@carbon/react";
|
3
3
|
import React from "react";
|
4
|
-
import {
|
5
|
-
import {
|
4
|
+
import { useConcept } from "../../stock-lookups/stock-lookups.resource";
|
5
|
+
import { type ConfigObject } from "../../config-schema";
|
6
|
+
import { useConfig } from "@openmrs/esm-framework";
|
6
7
|
|
7
8
|
const StockSourcesFilter: React.FC<{
|
8
9
|
onFilterChange: (selectedSourceType: string) => void;
|
9
10
|
}> = ({ onFilterChange }) => {
|
11
|
+
const { stockSourceTypeUUID } = useConfig<ConfigObject>();
|
10
12
|
// get stock sources
|
11
|
-
const { items, isLoading, isError } =
|
12
|
-
STOCK_SOURCE_TYPE_CODED_CONCEPT_ID
|
13
|
-
);
|
13
|
+
const { items, isLoading, isError } = useConcept(stockSourceTypeUUID);
|
14
14
|
if (isLoading || isError) {
|
15
15
|
return <DropdownSkeleton />;
|
16
16
|
}
|