@openmrs/esm-stock-management-app 1.0.1-pre.420 → 1.0.1-pre.433
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/314.js +1 -1
- package/dist/314.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/core/components/carbon/controlled-number-input/controlled-number-input.component.tsx +2 -0
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.component.tsx +26 -6
- package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.component.tsx +5 -2
@@ -86,10 +86,10 @@
|
|
86
86
|
"initial": true,
|
87
87
|
"entry": true,
|
88
88
|
"recorded": false,
|
89
|
-
"size":
|
89
|
+
"size": 4751716,
|
90
90
|
"sizes": {
|
91
91
|
"consume-shared": 252,
|
92
|
-
"javascript":
|
92
|
+
"javascript": 4729767,
|
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": "248aca6a795c0e5b",
|
110
110
|
"childrenByOrder": {}
|
111
111
|
},
|
112
112
|
{
|
@@ -164,9 +164,9 @@
|
|
164
164
|
"initial": false,
|
165
165
|
"entry": false,
|
166
166
|
"recorded": false,
|
167
|
-
"size":
|
167
|
+
"size": 1060535,
|
168
168
|
"sizes": {
|
169
|
-
"javascript":
|
169
|
+
"javascript": 1060325,
|
170
170
|
"consume-shared": 210
|
171
171
|
},
|
172
172
|
"names": [],
|
@@ -180,7 +180,7 @@
|
|
180
180
|
"auxiliaryFiles": [
|
181
181
|
"314.js.map"
|
182
182
|
],
|
183
|
-
"hash": "
|
183
|
+
"hash": "358551833bfc986b",
|
184
184
|
"childrenByOrder": {}
|
185
185
|
},
|
186
186
|
{
|
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-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"},{"name":"delete-packaging-unit-modal","component":"deletePackagingUnitModal"},{"name":"delete-packaging-unit-button","component":"deletePackagingUnitButton"}],"pages":[{"component":"stockManagement","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-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"},{"name":"delete-packaging-unit-modal","component":"deletePackagingUnitModal"},{"name":"delete-packaging-unit-button","component":"deletePackagingUnitButton"}],"pages":[{"component":"stockManagement","route":"stock-management"}],"version":"1.0.1-pre.433"}
|
package/package.json
CHANGED
package/src/core/components/carbon/controlled-number-input/controlled-number-input.component.tsx
CHANGED
@@ -9,6 +9,7 @@ interface ControlledNumberInputProps<T> extends NumberInputProps {
|
|
9
9
|
controllerName: string;
|
10
10
|
name: string;
|
11
11
|
control: Control<FieldValues, T>;
|
12
|
+
hideSteppers?: boolean;
|
12
13
|
}
|
13
14
|
|
14
15
|
const ControlledNumberInput = <T,>(props: ControlledNumberInputProps<T>) => {
|
@@ -21,6 +22,7 @@ const ControlledNumberInput = <T,>(props: ControlledNumberInputProps<T>) => {
|
|
21
22
|
id={`${props.name}-${props.row?.id}-${props.row?.uuid}`}
|
22
23
|
value={props.row?.factor ?? value}
|
23
24
|
min={props.min}
|
25
|
+
hideSteppers={props.hideSteppers || false}
|
24
26
|
ref={ref}
|
25
27
|
onChange={(
|
26
28
|
event: React.MouseEvent<HTMLButtonElement>,
|
@@ -1,4 +1,6 @@
|
|
1
1
|
import React, { useEffect, useMemo } from "react";
|
2
|
+
import { showSnackbar, restBaseUrl } from "@openmrs/esm-framework";
|
3
|
+
import { useTranslation } from "react-i18next";
|
2
4
|
import { useStockItemPackageUnitsHook } from "./packaging-units.resource";
|
3
5
|
import {
|
4
6
|
Button,
|
@@ -20,10 +22,11 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
|
20
22
|
import { PackageUnitFormData, packageUnitSchema } from "./validationSchema";
|
21
23
|
import { StockItemPackagingUOMDTO } from "../../../core/api/types/stockItem/StockItemPackagingUOM";
|
22
24
|
import { createStockItemPackagingUnit } from "../../stock-items.resource";
|
23
|
-
import { showSnackbar } from "@openmrs/esm-framework";
|
24
|
-
import { useTranslation } from "react-i18next";
|
25
|
-
import styles from "./packaging-units.scss";
|
26
25
|
import DeleteModalButton from "./packaging-units-delete-modal-button.component";
|
26
|
+
import { handleMutate } from "../../../utils";
|
27
|
+
import { toQueryParams, ResourceRepresentation } from "../../../core/api/api";
|
28
|
+
|
29
|
+
import styles from "./packaging-units.scss";
|
27
30
|
|
28
31
|
interface PackagingUnitsProps {
|
29
32
|
isEditing?: boolean;
|
@@ -70,15 +73,29 @@ const PackagingUnits: React.FC<PackagingUnitsProps> = ({
|
|
70
73
|
});
|
71
74
|
|
72
75
|
const handleSavePackageUnits = () => {
|
73
|
-
const { getValues } = packageUnitForm;
|
76
|
+
const { getValues, setValue } = packageUnitForm;
|
74
77
|
const { factor, packagingUomUuid } = getValues();
|
75
78
|
const payload: StockItemPackagingUOMDTO = {
|
76
79
|
factor: factor,
|
77
80
|
packagingUomUuid,
|
78
81
|
stockItemUuid,
|
79
82
|
};
|
83
|
+
|
84
|
+
const filters = {
|
85
|
+
startIndex: 0,
|
86
|
+
v: ResourceRepresentation.Default,
|
87
|
+
totalCount: true,
|
88
|
+
stockItemUuid,
|
89
|
+
};
|
90
|
+
|
91
|
+
const fetchUrl = `${restBaseUrl}/stockmanagement/stockitempackaginguom${toQueryParams(
|
92
|
+
filters
|
93
|
+
)}`;
|
94
|
+
|
80
95
|
createStockItemPackagingUnit(payload).then(
|
81
|
-
() =>
|
96
|
+
() => {
|
97
|
+
handleMutate(fetchUrl);
|
98
|
+
|
82
99
|
showSnackbar({
|
83
100
|
title: t("savePackingUnitTitle", "Package Unit"),
|
84
101
|
subtitle: t(
|
@@ -86,7 +103,9 @@ const PackagingUnits: React.FC<PackagingUnitsProps> = ({
|
|
86
103
|
"Package Unit saved successfully"
|
87
104
|
),
|
88
105
|
kind: "success",
|
89
|
-
})
|
106
|
+
});
|
107
|
+
setValue("factor", 0);
|
108
|
+
},
|
90
109
|
() => {
|
91
110
|
showSnackbar({
|
92
111
|
title: t("savePackagingUnitErrorTitle", "Package Unit"),
|
@@ -203,6 +222,7 @@ const PackagingUnitRow: React.FC<{
|
|
203
222
|
control={control}
|
204
223
|
id={`${row.uuid}-${key}`}
|
205
224
|
invalid={!!errors.factor}
|
225
|
+
hideSteppers={true}
|
206
226
|
/>
|
207
227
|
|
208
228
|
<DeleteModalButton closeModal={() => true} row={row} />
|
@@ -67,7 +67,10 @@ const StockRulesAddOrUpdate: React.FC<AddStockRuleProps> = ({
|
|
67
67
|
isLoading: loadingRoles,
|
68
68
|
} = useRoles({ v: ResourceRepresentation.Default });
|
69
69
|
|
70
|
-
const [formModel, setFormModel] = useState<StockRule>(
|
70
|
+
const [formModel, setFormModel] = useState<StockRule>({
|
71
|
+
enabled: true,
|
72
|
+
...model,
|
73
|
+
});
|
71
74
|
|
72
75
|
useEffect(() => {
|
73
76
|
if (model != null && Object.keys(model).length != 0) {
|
@@ -190,7 +193,7 @@ const StockRulesAddOrUpdate: React.FC<AddStockRuleProps> = ({
|
|
190
193
|
)
|
191
194
|
.catch();
|
192
195
|
},
|
193
|
-
[formModel, model, t]
|
196
|
+
[formModel, model, t, stockItemUuid]
|
194
197
|
);
|
195
198
|
|
196
199
|
return (
|