@openmrs/esm-stock-management-app 1.0.1-pre.357 → 1.0.1-pre.359
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/969.js +1 -1
- package/dist/969.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-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.component.tsx +28 -10
@@ -86,10 +86,10 @@
|
|
86
86
|
"initial": true,
|
87
87
|
"entry": true,
|
88
88
|
"recorded": false,
|
89
|
-
"size":
|
89
|
+
"size": 4733569,
|
90
90
|
"sizes": {
|
91
91
|
"consume-shared": 252,
|
92
|
-
"javascript":
|
92
|
+
"javascript": 4711620,
|
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": "757fd54a4b6b8756",
|
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": 975431,
|
337
337
|
"sizes": {
|
338
|
-
"javascript":
|
338
|
+
"javascript": 975221,
|
339
339
|
"consume-shared": 210
|
340
340
|
},
|
341
341
|
"names": [],
|
@@ -349,7 +349,7 @@
|
|
349
349
|
"auxiliaryFiles": [
|
350
350
|
"969.js.map"
|
351
351
|
],
|
352
|
-
"hash": "
|
352
|
+
"hash": "795b76659474cf05",
|
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","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","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.359"}
|
package/package.json
CHANGED
package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.component.tsx
CHANGED
@@ -65,6 +65,7 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
65
65
|
const [roles, setRoles] = useState<Role[]>([]);
|
66
66
|
|
67
67
|
const { data: user } = useUser(model?.uuid);
|
68
|
+
const [showItems, setShowItems] = useState(false);
|
68
69
|
|
69
70
|
// operation types
|
70
71
|
const {
|
@@ -110,6 +111,28 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
110
111
|
});
|
111
112
|
};
|
112
113
|
|
114
|
+
const [searchQuery, setSearchQuery] = useState<string>("");
|
115
|
+
const [filteredItems, setFilteredItems] = useState<any[]>([]);
|
116
|
+
|
117
|
+
const usersResults = users?.results ?? [];
|
118
|
+
|
119
|
+
const filterItems = (query: string) => {
|
120
|
+
if (query.trim() === "") {
|
121
|
+
setShowItems(false);
|
122
|
+
} else {
|
123
|
+
setShowItems(true);
|
124
|
+
const filtered = usersResults.filter((item: any) => {
|
125
|
+
const displayName = item?.person?.display ?? item?.display ?? "";
|
126
|
+
return displayName.toLowerCase().includes(query.toLowerCase());
|
127
|
+
});
|
128
|
+
setFilteredItems(filtered);
|
129
|
+
}
|
130
|
+
};
|
131
|
+
|
132
|
+
const handleSearchQueryChange = (query: string) => {
|
133
|
+
setSearchQuery(query);
|
134
|
+
filterItems(query);
|
135
|
+
};
|
113
136
|
const onStockOperationTypeChanged = (
|
114
137
|
event: React.ChangeEvent<HTMLInputElement>,
|
115
138
|
uuid: string,
|
@@ -186,7 +209,7 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
186
209
|
v: ResourceRepresentation.Default,
|
187
210
|
q: searchTerm,
|
188
211
|
} as any as UserFilterCriteria);
|
189
|
-
},
|
212
|
+
}, 3),
|
190
213
|
[]
|
191
214
|
);
|
192
215
|
|
@@ -288,7 +311,6 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
288
311
|
}
|
289
312
|
);
|
290
313
|
};
|
291
|
-
|
292
314
|
if (isLoading || loadingRoles || loadingUsers) {
|
293
315
|
return (
|
294
316
|
<InlineLoading
|
@@ -298,7 +320,6 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
298
320
|
/>
|
299
321
|
);
|
300
322
|
}
|
301
|
-
|
302
323
|
return (
|
303
324
|
<div>
|
304
325
|
<Form>
|
@@ -313,16 +334,13 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
313
334
|
id="userName"
|
314
335
|
size="md"
|
315
336
|
labelText={t("user", "User")}
|
316
|
-
items={
|
337
|
+
items={filteredItems}
|
317
338
|
onChange={onUserChanged}
|
318
|
-
shouldFilterItem={(
|
319
|
-
onFocus={() => users?.results || handleUsersSearch("")}
|
320
|
-
onToggleClick={() =>
|
321
|
-
users?.results || handleUsersSearch("")
|
322
|
-
}
|
339
|
+
shouldFilterItem={() => true}
|
323
340
|
itemToString={(item) =>
|
324
341
|
`${item?.person?.display ?? item?.display ?? ""}`
|
325
342
|
}
|
343
|
+
onInputChange={handleSearchQueryChange}
|
326
344
|
placeholder="Filter..."
|
327
345
|
/>
|
328
346
|
</>
|
@@ -429,6 +447,7 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
429
447
|
<Checkbox
|
430
448
|
value={type.uuid}
|
431
449
|
checked={isOperationChecked(type)}
|
450
|
+
className={styles.checkbox}
|
432
451
|
onChange={(event) =>
|
433
452
|
onStockOperationTypeChanged(
|
434
453
|
event,
|
@@ -436,7 +455,6 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
436
455
|
isOperationChecked(type)
|
437
456
|
)
|
438
457
|
}
|
439
|
-
className={styles.checkbox}
|
440
458
|
labelText={type.name}
|
441
459
|
id={type.uuid}
|
442
460
|
/>
|