@openmrs/esm-stock-management-app 1.0.1-pre.435 → 1.0.1-pre.438
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/699.js +1 -1
- package/dist/699.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 +1 -0
- package/src/stock-items/add-stock-item/packaging-units/packaging-units-delete-modal.component.tsx +14 -5
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.component.tsx +5 -16
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.resource.tsx +2 -1
- package/src/stock-items/add-stock-item/stock-item-units-edit/stock-item-units-edit.component.tsx +5 -2
- package/src/stock-items/stock-items.resource.ts +2 -1
@@ -86,10 +86,10 @@
|
|
86
86
|
"initial": true,
|
87
87
|
"entry": true,
|
88
88
|
"recorded": false,
|
89
|
-
"size":
|
89
|
+
"size": 4766459,
|
90
90
|
"sizes": {
|
91
91
|
"consume-shared": 252,
|
92
|
-
"javascript":
|
92
|
+
"javascript": 4744510,
|
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": "99c6ba951bc1fc50",
|
110
110
|
"childrenByOrder": {}
|
111
111
|
},
|
112
112
|
{
|
@@ -255,9 +255,9 @@
|
|
255
255
|
"initial": false,
|
256
256
|
"entry": false,
|
257
257
|
"recorded": false,
|
258
|
-
"size":
|
258
|
+
"size": 1075278,
|
259
259
|
"sizes": {
|
260
|
-
"javascript":
|
260
|
+
"javascript": 1075068,
|
261
261
|
"consume-shared": 210
|
262
262
|
},
|
263
263
|
"names": [],
|
@@ -271,7 +271,7 @@
|
|
271
271
|
"auxiliaryFiles": [
|
272
272
|
"699.js.map"
|
273
273
|
],
|
274
|
-
"hash": "
|
274
|
+
"hash": "09aacd80fa7bd83c",
|
275
275
|
"childrenByOrder": {}
|
276
276
|
},
|
277
277
|
{
|
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.438"}
|
package/package.json
CHANGED
package/src/core/components/carbon/controlled-number-input/controlled-number-input.component.tsx
CHANGED
@@ -19,6 +19,7 @@ const ControlledNumberInput = <T,>(props: ControlledNumberInputProps<T>) => {
|
|
19
19
|
control={props.control}
|
20
20
|
render={({ field: { onChange, value, ref } }) => (
|
21
21
|
<NumberInput
|
22
|
+
label={props.label}
|
22
23
|
id={`${props.name}-${props.row?.id}-${props.row?.uuid}`}
|
23
24
|
value={props.row?.factor ?? value}
|
24
25
|
min={props.min}
|
package/src/stock-items/add-stock-item/packaging-units/packaging-units-delete-modal.component.tsx
CHANGED
@@ -1,9 +1,5 @@
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
1
2
|
import { showNotification, showToast } from "@openmrs/esm-framework";
|
2
|
-
import React, { useState } from "react";
|
3
|
-
import { deleteStockItemPackagingUnit } from "../../stock-items.resource";
|
4
|
-
import { useTranslation } from "react-i18next";
|
5
|
-
import { StockItemPackagingUOMDTO } from "../../../core/api/types/stockItem/StockItemPackagingUOM";
|
6
|
-
import styles from "../packaging-units/packaging-units.scss";
|
7
3
|
import {
|
8
4
|
Button,
|
9
5
|
ModalHeader,
|
@@ -11,6 +7,12 @@ import {
|
|
11
7
|
ModalFooter,
|
12
8
|
TextArea,
|
13
9
|
} from "@carbon/react";
|
10
|
+
import { deleteStockItemPackagingUnit } from "../../stock-items.resource";
|
11
|
+
import { useStockItemPackageUnitsHook } from "./packaging-units.resource";
|
12
|
+
import { useTranslation } from "react-i18next";
|
13
|
+
import { StockItemPackagingUOMDTO } from "../../../core/api/types/stockItem/StockItemPackagingUOM";
|
14
|
+
|
15
|
+
import styles from "../packaging-units/packaging-units.scss";
|
14
16
|
|
15
17
|
interface DeletePackagingUnitProps {
|
16
18
|
row?: StockItemPackagingUOMDTO;
|
@@ -22,6 +24,11 @@ const DeletePackagingUnit: React.FC<DeletePackagingUnitProps> = ({
|
|
22
24
|
closeModal,
|
23
25
|
}) => {
|
24
26
|
const { t } = useTranslation();
|
27
|
+
const { mutate, setStockItemUuid } = useStockItemPackageUnitsHook();
|
28
|
+
|
29
|
+
useEffect(() => {
|
30
|
+
setStockItemUuid(row.stockItemUuid);
|
31
|
+
}, [row.stockItemUuid, setStockItemUuid]);
|
25
32
|
|
26
33
|
const [reason, setReason] = useState("");
|
27
34
|
|
@@ -33,6 +40,8 @@ const DeletePackagingUnit: React.FC<DeletePackagingUnitProps> = ({
|
|
33
40
|
e.preventDefault();
|
34
41
|
deleteStockItemPackagingUnit(row.uuid).then(
|
35
42
|
() => {
|
43
|
+
mutate();
|
44
|
+
closeModal();
|
36
45
|
showToast({
|
37
46
|
critical: true,
|
38
47
|
title: t("deletePackagingUnitTitle", `Delete packing item `),
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { useEffect, useMemo } from "react";
|
2
|
-
import { showSnackbar
|
2
|
+
import { showSnackbar } from "@openmrs/esm-framework";
|
3
3
|
import { useTranslation } from "react-i18next";
|
4
4
|
import { useStockItemPackageUnitsHook } from "./packaging-units.resource";
|
5
5
|
import {
|
@@ -23,8 +23,6 @@ import { PackageUnitFormData, packageUnitSchema } from "./validationSchema";
|
|
23
23
|
import { StockItemPackagingUOMDTO } from "../../../core/api/types/stockItem/StockItemPackagingUOM";
|
24
24
|
import { createStockItemPackagingUnit } from "../../stock-items.resource";
|
25
25
|
import DeleteModalButton from "./packaging-units-delete-modal-button.component";
|
26
|
-
import { handleMutate } from "../../../utils";
|
27
|
-
import { toQueryParams, ResourceRepresentation } from "../../../core/api/api";
|
28
26
|
|
29
27
|
import styles from "./packaging-units.scss";
|
30
28
|
|
@@ -39,7 +37,8 @@ const PackagingUnits: React.FC<PackagingUnitsProps> = ({
|
|
39
37
|
stockItemUuid,
|
40
38
|
handleTabChange,
|
41
39
|
}) => {
|
42
|
-
const { items, isLoading, setStockItemUuid } =
|
40
|
+
const { items, isLoading, setStockItemUuid, mutate } =
|
41
|
+
useStockItemPackageUnitsHook();
|
43
42
|
useEffect(() => {
|
44
43
|
setStockItemUuid(stockItemUuid);
|
45
44
|
}, [stockItemUuid, setStockItemUuid]);
|
@@ -81,20 +80,9 @@ const PackagingUnits: React.FC<PackagingUnitsProps> = ({
|
|
81
80
|
stockItemUuid,
|
82
81
|
};
|
83
82
|
|
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
|
-
|
95
83
|
createStockItemPackagingUnit(payload).then(
|
96
84
|
() => {
|
97
|
-
|
85
|
+
mutate();
|
98
86
|
|
99
87
|
showSnackbar({
|
100
88
|
title: t("savePackingUnitTitle", "Package Unit"),
|
@@ -204,6 +192,7 @@ const PackagingUnitRow: React.FC<{
|
|
204
192
|
row={row}
|
205
193
|
controllerName={"packagingUomUuid"}
|
206
194
|
name="packagingUomUuid"
|
195
|
+
placeholder="Filter"
|
207
196
|
control={control}
|
208
197
|
invalid={!!errors.packagingUomUuid}
|
209
198
|
/>
|
@@ -25,7 +25,7 @@ export function useStockItemPackageUnitsHook(v?: ResourceRepresentation) {
|
|
25
25
|
});
|
26
26
|
}, [stockItemUuid]);
|
27
27
|
|
28
|
-
const { items, isLoading, isError } =
|
28
|
+
const { items, isLoading, isError, mutate } =
|
29
29
|
useStockItemPackagingUOMs(stockItemFilter);
|
30
30
|
|
31
31
|
return {
|
@@ -34,5 +34,6 @@ export function useStockItemPackageUnitsHook(v?: ResourceRepresentation) {
|
|
34
34
|
isLoading,
|
35
35
|
isError,
|
36
36
|
setStockItemUuid,
|
37
|
+
mutate,
|
37
38
|
};
|
38
39
|
}
|
package/src/stock-items/add-stock-item/stock-item-units-edit/stock-item-units-edit.component.tsx
CHANGED
@@ -109,7 +109,7 @@ const StockItemUnitsEdit: React.FC<StockItemUnitsEditProps> = ({
|
|
109
109
|
controllerName="purchasePrice"
|
110
110
|
size={"md"}
|
111
111
|
allowEmpty={true}
|
112
|
-
label={t("purchasePrice", "Purchase Price")}
|
112
|
+
label={t("purchasePrice", "Purchase Price:")}
|
113
113
|
value={stockItem.purchasePrice ?? ""}
|
114
114
|
invalid={!!errors.purchasePrice}
|
115
115
|
invalidText={errors.purchasePrice && errors?.purchasePrice?.message}
|
@@ -120,7 +120,10 @@ const StockItemUnitsEdit: React.FC<StockItemUnitsEditProps> = ({
|
|
120
120
|
name="purchasePriceUoMUuid"
|
121
121
|
controllerName="purchasePriceUoMUuid"
|
122
122
|
control={control}
|
123
|
-
title={t(
|
123
|
+
title={t(
|
124
|
+
"purchasePricePackagingUnit",
|
125
|
+
"Purchase price packaging unit:"
|
126
|
+
)}
|
124
127
|
placeholder={t("notSet", "Not Set")}
|
125
128
|
isLoading={isLoading}
|
126
129
|
packagingUnits={stockItem.packagingUnits}
|
@@ -167,7 +167,7 @@ export function useStockItemPackagingUOMs(filter: StockItemPackagingUOMFilter) {
|
|
167
167
|
const apiUrl = `${restBaseUrl}/stockmanagement/stockitempackaginguom${toQueryParams(
|
168
168
|
filter
|
169
169
|
)}`;
|
170
|
-
const { data, error, isLoading } = useSWR<
|
170
|
+
const { data, error, isLoading, mutate } = useSWR<
|
171
171
|
{
|
172
172
|
data: PageableResult<StockItemPackagingUOMDTO>;
|
173
173
|
},
|
@@ -178,6 +178,7 @@ export function useStockItemPackagingUOMs(filter: StockItemPackagingUOMFilter) {
|
|
178
178
|
items: data?.data || <PageableResult<StockItemPackagingUOMDTO>>{},
|
179
179
|
isLoading,
|
180
180
|
isError: error,
|
181
|
+
mutate,
|
181
182
|
};
|
182
183
|
}
|
183
184
|
|