@openmrs/esm-stock-management-app 1.0.1-pre.448 → 1.0.1-pre.451
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-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.component.tsx +12 -8
- package/src/stock-user-role-scopes/stock-user-role-scopes-items-table.component.tsx +9 -8
@@ -86,10 +86,10 @@
|
|
86
86
|
"initial": true,
|
87
87
|
"entry": true,
|
88
88
|
"recorded": false,
|
89
|
-
"size":
|
89
|
+
"size": 4776371,
|
90
90
|
"sizes": {
|
91
91
|
"consume-shared": 252,
|
92
|
-
"javascript":
|
92
|
+
"javascript": 4754422,
|
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": "a0d720ed4bc49f02",
|
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": 1085190,
|
168
168
|
"sizes": {
|
169
|
-
"javascript":
|
169
|
+
"javascript": 1084980,
|
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": "a82fbdde638d7656",
|
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.451"}
|
package/package.json
CHANGED
package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.component.tsx
CHANGED
@@ -32,6 +32,7 @@ import {
|
|
32
32
|
restBaseUrl,
|
33
33
|
showNotification,
|
34
34
|
showToast,
|
35
|
+
useSession,
|
35
36
|
} from "@openmrs/esm-framework";
|
36
37
|
import { UserRoleScopeOperationType } from "../../core/api/types/identity/UserRoleScopeOperationType";
|
37
38
|
import { UserRoleScopeLocation } from "../../core/api/types/identity/UserRoleScopeLocation";
|
@@ -61,12 +62,13 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
61
62
|
model,
|
62
63
|
}) => {
|
63
64
|
const { t } = useTranslation();
|
64
|
-
|
65
|
+
const currentUser = useSession();
|
65
66
|
const [formModel, setFormModel] = useState<UserRoleScope>({ ...model });
|
66
67
|
|
67
68
|
const [roles, setRoles] = useState<Role[]>([]);
|
68
69
|
|
69
70
|
const [showItems, setShowItems] = useState(false);
|
71
|
+
const loggedInUserUuid = currentUser?.user?.uuid;
|
70
72
|
|
71
73
|
// operation types
|
72
74
|
const {
|
@@ -125,10 +127,12 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
125
127
|
setShowItems(false);
|
126
128
|
} else {
|
127
129
|
setShowItems(true);
|
128
|
-
const filtered = usersResults
|
129
|
-
|
130
|
-
|
131
|
-
|
130
|
+
const filtered = usersResults
|
131
|
+
.filter((item: any) => item.uuid !== loggedInUserUuid)
|
132
|
+
.filter((item: any) => {
|
133
|
+
const displayName = item?.person?.display ?? item?.display ?? "";
|
134
|
+
return displayName.toLowerCase().includes(query.toLowerCase());
|
135
|
+
});
|
132
136
|
setFilteredItems(filtered);
|
133
137
|
}
|
134
138
|
};
|
@@ -215,9 +219,9 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
215
219
|
INVENTORY_ADMNISTRATOR_ROLE_UUID,
|
216
220
|
];
|
217
221
|
|
218
|
-
const filteredStockRoles = data.selectedItem?.roles
|
219
|
-
stockRolesUUIDs.includes(role.uuid)
|
220
|
-
|
222
|
+
const filteredStockRoles = data.selectedItem?.roles
|
223
|
+
.filter((role) => stockRolesUUIDs.includes(role.uuid))
|
224
|
+
.filter((role) => role.uuid !== loggedInUserUuid);
|
221
225
|
setFormModel({ ...formModel, userUuid: data.selectedItem?.uuid });
|
222
226
|
setRoles(filteredStockRoles ?? []);
|
223
227
|
setSelectedUserUuid(data?.selectedItem?.uuid);
|
@@ -108,6 +108,7 @@ function StockUserRoleScopesItems() {
|
|
108
108
|
|
109
109
|
const tableRows = useMemo(() => {
|
110
110
|
return items?.map((userRoleScope, index) => {
|
111
|
+
const isCurrentUser = currentUser.user.uuid === userRoleScope.userUuid;
|
111
112
|
return {
|
112
113
|
...userRoleScope,
|
113
114
|
id: userRoleScope?.uuid,
|
@@ -141,18 +142,18 @@ function StockUserRoleScopesItems() {
|
|
141
142
|
return operation?.operationTypeName;
|
142
143
|
})
|
143
144
|
?.join(", "),
|
144
|
-
permanent: userRoleScope?.permanent
|
145
|
-
? t("stockmanagement.yes", "Yes")
|
146
|
-
: t("stockmanagement.no", "No"),
|
145
|
+
permanent: userRoleScope?.permanent ? t("yes", "Yes") : t("no", "No"),
|
147
146
|
activeFrom: formatDisplayDate(userRoleScope?.activeFrom) ?? "Not Set",
|
148
147
|
activeTo: formatDisplayDate(userRoleScope?.activeTo) ?? "Not Set",
|
149
|
-
enabled: userRoleScope?.enabled
|
150
|
-
? t("stockmanagement.yes", "Yes")
|
151
|
-
: t("stockmanagement.no", "No"),
|
148
|
+
enabled: userRoleScope?.enabled ? t("yes", "Yes") : t("no", "No"),
|
152
149
|
actions: (
|
153
150
|
<div style={{ display: "flex" }}>
|
154
|
-
|
155
|
-
|
151
|
+
{!isCurrentUser && (
|
152
|
+
<>
|
153
|
+
<EditStockUserRoleActionsMenu data={items[index]} />
|
154
|
+
<StockUserScopeDeleteActionMenu uuid={items[index].uuid} />
|
155
|
+
</>
|
156
|
+
)}
|
156
157
|
</div>
|
157
158
|
),
|
158
159
|
};
|