@openmrs/esm-stock-management-app 1.0.1-pre.418 → 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 -0
- package/dist/314.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-stock-management-app.js +1 -1
- package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +31 -31
- package/dist/openmrs-esm-stock-management-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/core/api/types/stockItem/StockItemReference.ts +18 -0
- package/src/core/components/carbon/controlled-number-input/controlled-number-input.component.tsx +2 -0
- package/src/core/components/carbon/controlled-text-input/controlled-text-input.component.tsx +2 -2
- package/src/core/components/tabs/vertical-tabs.scss +6 -3
- package/src/stock-items/add-stock-item/add-stock-item.component.tsx +8 -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-details/stock-item-details.component.tsx +3 -2
- package/src/stock-items/add-stock-item/stock-item-references/stock-item-references.component.tsx +264 -0
- package/src/stock-items/add-stock-item/stock-item-references/stock-item-references.resource.ts +39 -0
- package/src/stock-items/add-stock-item/stock-item-references/stock-item-references.scss +23 -0
- package/src/stock-items/add-stock-item/stock-item-references/stock-references-selector.component.tsx +66 -0
- package/src/stock-items/add-stock-item/stock-item-references/validation-schema.ts +8 -0
- package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.component.tsx +5 -2
- package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.component.tsx +0 -1
- package/src/stock-items/stock-items.resource.ts +72 -1
- package/src/stock-operations/stock-operation.utils.tsx +1 -1
- package/src/stock-operations/stock-operations-dialog/stock-operations-dialog.component.tsx +1 -1
- package/src/stock-operations/stock-operations-table.component.tsx +8 -1
- package/src/stock-sources/add-stock-sources/add-stock-sources.component.tsx +8 -3
- package/src/stock-sources/stock-sources-delete/stock-sources-delete.component.tsx +8 -3
- package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.component.tsx +7 -4
- package/src/stock-user-role-scopes/delete-stock-user-scope/delete-stock-user-scope.component.tsx +8 -3
- package/src/utils.ts +7 -0
- package/dist/39.js +0 -1
- package/dist/39.js.map +0 -1
- package/src/stock-items/add-stock-item/stock-rules/stock-rules.component.tsx +0 -16
- package/src/stock-items/add-stock-item/stock-rules/stock-rules.resource.tsx +0 -0
- package/src/stock-items/add-stock-item/stock-rules/stock-rules.scss +0 -0
- package/src/stock-operations/swr-revalidation.ts +0 -7
- package/src/stock-sources/swr-revalidation.ts +0 -7
- package/src/stock-user-role-scopes/swr-revalidation.ts +0 -7
package/src/stock-user-role-scopes/delete-stock-user-scope/delete-stock-user-scope.component.tsx
CHANGED
@@ -3,8 +3,13 @@ import { Button, InlineLoading } from "@carbon/react";
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
4
4
|
import { TrashCan } from "@carbon/react/icons";
|
5
5
|
import { deleteUserRoleScopes } from "../stock-user-role-scopes.resource";
|
6
|
-
import {
|
7
|
-
|
6
|
+
import {
|
7
|
+
restBaseUrl,
|
8
|
+
showModal,
|
9
|
+
showNotification,
|
10
|
+
showToast,
|
11
|
+
} from "@openmrs/esm-framework";
|
12
|
+
import { handleMutate } from "../../utils";
|
8
13
|
|
9
14
|
interface StockUserScopDeleteActionMenuProps {
|
10
15
|
uuid: string;
|
@@ -27,7 +32,7 @@ const StockUserScopeDeleteActionMenu: React.FC<
|
|
27
32
|
deleteUserRoleScopes(ids)
|
28
33
|
.then(
|
29
34
|
() => {
|
30
|
-
handleMutate(
|
35
|
+
handleMutate(`${restBaseUrl}/stockmanagement/userrolescope`);
|
31
36
|
setDeletingUserScope(false);
|
32
37
|
showToast({
|
33
38
|
critical: true,
|
package/src/utils.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { showNotification } from "@openmrs/esm-framework";
|
2
|
+
import { mutate } from "swr";
|
2
3
|
|
3
4
|
export function errorAlert(msg: string, error?: Error) {
|
4
5
|
showNotification({
|
@@ -8,3 +9,9 @@ export function errorAlert(msg: string, error?: Error) {
|
|
8
9
|
description: error?.message,
|
9
10
|
});
|
10
11
|
}
|
12
|
+
|
13
|
+
export const handleMutate = (url: string) => {
|
14
|
+
mutate((key) => typeof key === "string" && key.startsWith(url), undefined, {
|
15
|
+
revalidate: true,
|
16
|
+
});
|
17
|
+
};
|