@openmrs/esm-stock-management-app 1.0.1-pre.453 → 1.0.1-pre.455
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/457.js +1 -1
- package/dist/457.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/stock-items/add-stock-item/stock-item-category-selector/stock-item-category-selector.component.tsx +6 -1
- package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.component.tsx +20 -0
@@ -86,10 +86,10 @@
|
|
86
86
|
"initial": true,
|
87
87
|
"entry": true,
|
88
88
|
"recorded": false,
|
89
|
-
"size":
|
89
|
+
"size": 4778213,
|
90
90
|
"sizes": {
|
91
91
|
"consume-shared": 252,
|
92
|
-
"javascript":
|
92
|
+
"javascript": 4756264,
|
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": "39f7c5ec0dbf836c",
|
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": 1087032,
|
168
168
|
"sizes": {
|
169
|
-
"javascript":
|
169
|
+
"javascript": 1086822,
|
170
170
|
"consume-shared": 210
|
171
171
|
},
|
172
172
|
"names": [],
|
@@ -180,7 +180,7 @@
|
|
180
180
|
"auxiliaryFiles": [
|
181
181
|
"457.js.map"
|
182
182
|
],
|
183
|
-
"hash": "
|
183
|
+
"hash": "163eee371c885016",
|
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.455"}
|
package/package.json
CHANGED
@@ -14,6 +14,7 @@ interface StockItemCategorySelectorProps<T> {
|
|
14
14
|
placeholder?: string;
|
15
15
|
invalid?: boolean;
|
16
16
|
invalidText?: ReactNode;
|
17
|
+
itemType?: string;
|
17
18
|
|
18
19
|
// Control
|
19
20
|
controllerName: string;
|
@@ -32,6 +33,10 @@ const StockItemCategorySelector = <T,>(
|
|
32
33
|
isLoading,
|
33
34
|
} = useConcept(stockItemCategoryUUID);
|
34
35
|
|
36
|
+
const filteredCategories = props.itemType
|
37
|
+
? categories?.filter((c) => c.display === props?.itemType)
|
38
|
+
: categories;
|
39
|
+
|
35
40
|
if (isLoading) return <TextInputSkeleton />;
|
36
41
|
|
37
42
|
return (
|
@@ -46,7 +51,7 @@ const StockItemCategorySelector = <T,>(
|
|
46
51
|
controllerName={props.controllerName}
|
47
52
|
id={props.name}
|
48
53
|
size={"md"}
|
49
|
-
items={
|
54
|
+
items={filteredCategories || []}
|
50
55
|
onChange={(data: { selectedItem: Concept }) => {
|
51
56
|
props.onCategoryUuidChange?.(data.selectedItem);
|
52
57
|
onChange(data.selectedItem?.uuid);
|
@@ -61,10 +61,18 @@ const StockItemDetails = forwardRef<never, StockItemDetailsProps>(
|
|
61
61
|
|
62
62
|
const [isSaving, setIsSaving] = useState(false);
|
63
63
|
const [isDrug, setIsDrug] = useState(false);
|
64
|
+
const [selectedItemType, setSelectedItemType] = useState("");
|
64
65
|
const [hasExpiration, setHasExpiration] = useState(false);
|
65
66
|
|
66
67
|
useEffect(() => {
|
67
68
|
setIsDrug(model.isDrug ?? false);
|
69
|
+
setSelectedItemType(
|
70
|
+
model.isDrug === true
|
71
|
+
? "Pharmaceuticals"
|
72
|
+
: model.isDrug === false
|
73
|
+
? "Non Pharmaceuticals"
|
74
|
+
: undefined
|
75
|
+
);
|
68
76
|
setHasExpiration(model.hasExpiration ?? false);
|
69
77
|
}, [model.hasExpiration, model.isDrug]);
|
70
78
|
|
@@ -85,7 +93,12 @@ const StockItemDetails = forwardRef<never, StockItemDetailsProps>(
|
|
85
93
|
invalid={!!errors.isDrug}
|
86
94
|
invalidText={errors.isDrug && errors?.isDrug?.message}
|
87
95
|
onChange={(selection: boolean) => {
|
96
|
+
const selectedOption = radioOptions.find(
|
97
|
+
(option) => option.value === selection
|
98
|
+
);
|
99
|
+
const selectedLabel = selectedOption ? selectedOption.label : "";
|
88
100
|
setIsDrug(selection);
|
101
|
+
setSelectedItemType(selectedLabel);
|
89
102
|
}}
|
90
103
|
options={radioOptions} // Pass radioOptions directly
|
91
104
|
/>
|
@@ -201,6 +214,13 @@ const StockItemDetails = forwardRef<never, StockItemDetailsProps>(
|
|
201
214
|
name="categoryUuid"
|
202
215
|
controllerName="categoryUuid"
|
203
216
|
control={control}
|
217
|
+
itemType={
|
218
|
+
selectedItemType === "Pharmaceuticals"
|
219
|
+
? "Drugs"
|
220
|
+
: selectedItemType === "Non Pharmaceuticals"
|
221
|
+
? "Non Drugs"
|
222
|
+
: undefined
|
223
|
+
}
|
204
224
|
title={t("category:", "Category") + ":"}
|
205
225
|
placeholder={t("chooseACategory", "Choose a category")}
|
206
226
|
invalid={!!errors.categoryUuid}
|