@asaleh37/ui-base 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/.env +4 -0
  2. package/.env.development +1 -0
  3. package/.env.production +1 -0
  4. package/dist/index.d.ts +18 -37
  5. package/dist/index.js +5 -5
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +5 -5
  8. package/dist/index.mjs.map +1 -1
  9. package/index.html +13 -0
  10. package/package.json +1 -1
  11. package/public/__logo.png +0 -0
  12. package/public/logo.png +0 -0
  13. package/public/vite.svg +1 -0
  14. package/rollup.config-1748377725725.cjs +16 -16
  15. package/src/assets/logo.png +0 -0
  16. package/src/components/App.tsx +39 -9
  17. package/src/components/BaseApp.tsx +37 -25
  18. package/src/components/admin/AttachmentGrid.tsx +1 -1
  19. package/src/components/admin/AuthorityGrid.tsx +1 -1
  20. package/src/components/admin/BluePrintGrid.tsx +1 -1
  21. package/src/components/admin/BluePrintPageGrid.tsx +1 -1
  22. package/src/components/admin/BluePrintPointGrid.tsx +1 -1
  23. package/src/components/admin/DashboardGrid.tsx +1 -1
  24. package/src/components/admin/DashboardWidgetGrid.tsx +1 -1
  25. package/src/components/admin/DataQueryGrid.tsx +1 -1
  26. package/src/components/admin/DataQueryParameterGrid.tsx +1 -1
  27. package/src/components/admin/DatasourceConnectionGrid.tsx +1 -1
  28. package/src/components/admin/EmployeeGrid.tsx +1 -1
  29. package/src/components/admin/EntityParameterGrid.tsx +1 -1
  30. package/src/components/admin/ExcelUploaderDetailGrid.tsx +1 -1
  31. package/src/components/admin/ExcelUploaderHeaderGrid.tsx +1 -1
  32. package/src/components/admin/LookupGrid.tsx +1 -1
  33. package/src/components/admin/MailAttachmentGrid.tsx +1 -1
  34. package/src/components/admin/MailBodyGrid.tsx +1 -1
  35. package/src/components/admin/MailNotificationQueueGrid.tsx +1 -1
  36. package/src/components/admin/MailRecipientGrid.tsx +1 -1
  37. package/src/components/admin/MailTemplateGrid.tsx +1 -1
  38. package/src/components/admin/NewTableGrid.tsx +1 -1
  39. package/src/components/admin/NotificationGrid.tsx +1 -1
  40. package/src/components/admin/NotificationQueueGrid.tsx +1 -1
  41. package/src/components/admin/OrganizationApplicationGrid.tsx +1 -1
  42. package/src/components/admin/OrganizationGrid.tsx +1 -1
  43. package/src/components/admin/OrganizationRankGrid.tsx +1 -1
  44. package/src/components/admin/OrganizationUnitGrid.tsx +1 -1
  45. package/src/components/admin/OrganizationUserGrid.tsx +1 -1
  46. package/src/components/admin/OrganizationUserRoleGrid.tsx +1 -1
  47. package/src/components/admin/ReportGrid.tsx +1 -1
  48. package/src/components/admin/ReportParameterGrid.tsx +1 -1
  49. package/src/components/admin/RoleAuthoritiesForm.tsx +65 -0
  50. package/src/components/admin/RoleAuthorityGrid.tsx +1 -1
  51. package/src/components/admin/RoleGrid.tsx +68 -14
  52. package/src/components/admin/UserAccountGrid.tsx +1 -1
  53. package/src/components/admin/UserRequestGrid.tsx +1 -1
  54. package/src/components/admin/WidgetGrid.tsx +1 -1
  55. package/src/components/admin/WorkflowDocumentActionGrid.tsx +1 -1
  56. package/src/components/admin/WorkflowDocumentActionHistoryGrid.tsx +1 -1
  57. package/src/components/admin/WorkflowDocumentActionMailGrid.tsx +1 -1
  58. package/src/components/admin/WorkflowDocumentGrid.tsx +1 -1
  59. package/src/components/admin/WorkflowDocumentMailLogGrid.tsx +1 -1
  60. package/src/components/admin/WorkflowDocumentStatusGrid.tsx +1 -1
  61. package/src/components/common/Home.tsx +3 -0
  62. package/src/components/common/Login.tsx +10 -3
  63. package/src/components/templates/DataEntryTemplates/DataEntryTypes.ts +1 -1
  64. package/src/components/templates/TransferList.tsx +4 -7
  65. package/src/hooks/index.ts +1 -0
  66. package/src/{components/templates/DataEntryTemplates → hooks}/useApiActions.ts +4 -5
  67. package/src/layout/Layout.tsx +36 -29
  68. package/src/main.tsx +25 -0
  69. package/src/redux/features/CounterSlice.tsx +13 -0
  70. package/src/redux/features/common/AppInfoSlice.ts +1 -1
  71. package/src/redux/features/common/CommonStoreSlice.ts +19 -5
  72. package/src/redux/store.ts +25 -24
  73. package/src/util/constants.ts +5 -1
  74. package/vite.config.ts +10 -0
package/index.html ADDED
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/logo.png" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Loading...</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asaleh37/ui-base",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "Ahmed Saleh Mohamed",
Binary file
Binary file
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -1,16 +1,16 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var resolve = require('@rollup/plugin-node-resolve');
6
- var commonjs = require('@rollup/plugin-commonjs');
7
- var typescript = require('@rollup/plugin-typescript');
8
- var dts = require('rollup-plugin-dts');
9
- var terser = require('@rollup/plugin-terser');
10
- var json = require('@rollup/plugin-json');
11
- var peerDepsExternal = require('rollup-plugin-peer-deps-external');
12
- var postcss = require('rollup-plugin-postcss');
13
-
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var resolve = require('@rollup/plugin-node-resolve');
6
+ var commonjs = require('@rollup/plugin-commonjs');
7
+ var typescript = require('@rollup/plugin-typescript');
8
+ var dts = require('rollup-plugin-dts');
9
+ var terser = require('@rollup/plugin-terser');
10
+ var json = require('@rollup/plugin-json');
11
+ var peerDepsExternal = require('rollup-plugin-peer-deps-external');
12
+ var postcss = require('rollup-plugin-postcss');
13
+
14
14
  const packageJson = require("./package.json");
15
15
 
16
16
  var rollup_config = [
@@ -45,6 +45,6 @@ var rollup_config = [
45
45
  plugins: [dts.default()],
46
46
  external: [/\.css$/],
47
47
  },
48
- ];
49
-
50
- exports.default = rollup_config;
48
+ ];
49
+
50
+ exports.default = rollup_config;
Binary file
@@ -2,12 +2,20 @@ import { useDispatch, useSelector } from "react-redux";
2
2
  import { createTheme, ThemeOptions } from "@mui/material";
3
3
  import { ThemeProvider } from "@emotion/react";
4
4
  import React, { useEffect } from "react";
5
- import { RootState } from "../redux/store";
6
5
  import Layout from "../layout/Layout";
7
6
  import { AppInfo, AppInfoActions } from "../redux/features/common/AppInfoSlice";
8
7
  import { LicenseInfo } from "@mui/x-license";
8
+ import {
9
+ DARK_THEME_INITIAL_MAIN_COLOR,
10
+ DARK_THEME_INITIAL_SECANDARY_COLOR,
11
+ LIGHT_THEME_INITIAL_MAIN_COLOR,
12
+ LIGHT_THEME_INITIAL_SECANDARY_COLOR,
13
+ } from "../util";
14
+ import { setStoresMetaData } from "../redux/features/common/CommonStoreSlice";
15
+ import { ADMINISTRATION_STORES } from "../redux/features/administration/AdministrationStoresMetaData";
9
16
 
10
17
  const App: React.FC<AppInfo> = (props: AppInfo) => {
18
+ const dispatch = useDispatch();
11
19
  LicenseInfo.setLicenseKey(props.muiPremiumKey);
12
20
  const LightThemeOptions: ThemeOptions = {
13
21
  components: {
@@ -16,7 +24,10 @@ const App: React.FC<AppInfo> = (props: AppInfo) => {
16
24
  /* Custom Scrollbar */
17
25
  * {
18
26
  scrollbar-width: thin;
19
- scrollbar-color: ${props.appTheme.light.primaryColor} #ffffff;
27
+ scrollbar-color: ${
28
+ props.appTheme?.light?.primaryColor ||
29
+ LIGHT_THEME_INITIAL_MAIN_COLOR
30
+ } #ffffff;
20
31
  }
21
32
 
22
33
  /* Webkit Browsers */
@@ -30,10 +41,13 @@ const App: React.FC<AppInfo> = (props: AppInfo) => {
30
41
  palette: {
31
42
  mode: "light",
32
43
  primary: {
33
- main: props.appTheme.light.primaryColor,
44
+ main:
45
+ props.appTheme?.light?.primaryColor || LIGHT_THEME_INITIAL_MAIN_COLOR,
34
46
  },
35
47
  secondary: {
36
- main: props.appTheme.light.secondaryColor,
48
+ main:
49
+ props.appTheme?.light?.secondaryColor ||
50
+ LIGHT_THEME_INITIAL_SECANDARY_COLOR,
37
51
  },
38
52
  background: {
39
53
  default: "#f5f5f5",
@@ -48,7 +62,9 @@ const App: React.FC<AppInfo> = (props: AppInfo) => {
48
62
  /* Custom Scrollbar */
49
63
  * {
50
64
  scrollbar-width: thin;
51
- scrollbar-color: ${props.appTheme.dark.primaryColor} #121212;
65
+ scrollbar-color: ${
66
+ props.appTheme?.dark?.primaryColor || DARK_THEME_INITIAL_MAIN_COLOR
67
+ } #121212;
52
68
  }
53
69
 
54
70
  /* Webkit Browsers */
@@ -62,15 +78,29 @@ const App: React.FC<AppInfo> = (props: AppInfo) => {
62
78
  palette: {
63
79
  mode: "dark",
64
80
  primary: {
65
- main: props.appTheme.dark.primaryColor,
81
+ main:
82
+ props.appTheme?.dark?.primaryColor || DARK_THEME_INITIAL_MAIN_COLOR,
66
83
  },
67
84
  secondary: {
68
- main: props.appTheme.dark.secondaryColor,
85
+ main:
86
+ props.appTheme?.dark?.secondaryColor ||
87
+ DARK_THEME_INITIAL_SECANDARY_COLOR,
69
88
  },
70
89
  },
71
90
  };
72
- const dispatch = useDispatch();
73
- const AppLayoutState = useSelector((state: RootState) => state.AppLayout);
91
+
92
+ let commonStores = {};
93
+ if (props.enableAdministrationModule) {
94
+ commonStores = { ...ADMINISTRATION_STORES };
95
+ }
96
+ if (props.businessCommonStoresMetaData) {
97
+ commonStores = {
98
+ ...commonStores,
99
+ ...props.businessCommonStoresMetaData,
100
+ };
101
+ }
102
+ dispatch(setStoresMetaData(commonStores));
103
+ const AppLayoutState = useSelector((state: any) => state.AppLayout);
74
104
  let themeOptions = { ...LightThemeOptions };
75
105
  if (AppLayoutState.themeMode === "dark") {
76
106
  themeOptions = { ...DarkThemeOptions };
@@ -1,5 +1,4 @@
1
1
  import { Provider } from "react-redux";
2
- import { addReducer, store } from "../redux/store";
3
2
  import { library } from "@fortawesome/fontawesome-svg-core";
4
3
  import { fab } from "@fortawesome/free-brands-svg-icons";
5
4
  import { far } from "@fortawesome/free-regular-svg-icons";
@@ -8,36 +7,49 @@ import "../styles/index.css";
8
7
  import "react-toastify/dist/ReactToastify.css";
9
8
  import App from "./App";
10
9
  import { AppInfo } from "../redux/features/common/AppInfoSlice";
11
- import { commonStoresInitialState } from "../redux/features/common/CommonStoreSlice";
12
- import { ADMINISTRATION_STORES } from "../redux/features/administration/AdministrationStoresMetaData";
10
+ import AppLayoutReducer from "../redux/features/common/AppLayoutSlice";
11
+ import UserSessionReducer from "../redux/features/common/UserSessionSlice";
12
+ import LoadingMaskReducer from "../redux/features/common/LoadingMaskSlice";
13
+ import CommonStoreReducer from "../redux/features/common/CommonStoreSlice";
14
+ import AppInfoReducer from "../redux/features/common/AppInfoSlice";
15
+ import { configureStore } from "@reduxjs/toolkit";
13
16
 
14
17
  library.add(fab);
15
18
  library.add(far);
16
19
  library.add(fas);
17
20
 
18
21
  export const BaseApp: React.FC<AppInfo> = (props) => {
19
- if (props.enableAdministrationModule) {
20
- for (let adminStoreKey of Object.keys(ADMINISTRATION_STORES)) {
21
- commonStoresInitialState[adminStoreKey] =
22
- ADMINISTRATION_STORES[adminStoreKey];
23
- }
24
- }
25
- if (props?.businessCommonStoresMetaData) {
26
- for (let businessStoreKey of Object.keys(
27
- props.businessCommonStoresMetaData
28
- )) {
29
- commonStoresInitialState[businessStoreKey] =
30
- props.businessCommonStoresMetaData[businessStoreKey];
31
- }
32
- }
33
- if (props?.businessReduxReducers) {
34
- for (let businessReducerKey of Object.keys(props.businessReduxReducers)) {
35
- addReducer(
36
- businessReducerKey,
37
- props.businessReduxReducers[businessReducerKey]
38
- );
39
- }
40
- }
22
+ const systemReducers = {
23
+ AppLayout: AppLayoutReducer,
24
+ UserSession: UserSessionReducer,
25
+ loadingMask: LoadingMaskReducer,
26
+ commonStores: CommonStoreReducer,
27
+ AppInfo: AppInfoReducer,
28
+ ...props.businessReduxReducers,
29
+ };
30
+ const store = configureStore({
31
+ reducer: systemReducers,
32
+ });
33
+ // let csInitialState: CommonStoresInterface = {};
34
+ // if (props.enableAdministrationModule) {
35
+ // for (let adminStoreKey of Object.keys(ADMINISTRATION_STORES)) {
36
+ // csInitialState[adminStoreKey] = ADMINISTRATION_STORES[adminStoreKey];
37
+ // addCommonStore(adminStoreKey, ADMINISTRATION_STORES[adminStoreKey]);
38
+ // }
39
+ // }
40
+ // if (props?.businessCommonStoresMetaData) {
41
+ // for (let businessStoreKey of Object.keys(
42
+ // props.businessCommonStoresMetaData
43
+ // )) {
44
+ // csInitialState[businessStoreKey] =
45
+ // props.businessCommonStoresMetaData[businessStoreKey];
46
+ // addCommonStore(
47
+ // businessStoreKey,
48
+ // props.businessCommonStoresMetaData[businessStoreKey]
49
+ // );
50
+ // }
51
+ // }
52
+
41
53
  return (
42
54
  <Provider store={store}>
43
55
  <App {...props} />
@@ -1,5 +1,5 @@
1
1
  import { useState } from "react";
2
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
2
+ import useApiActions from "../../hooks/useApiActions";
3
3
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
4
4
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
5
5
 
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const AuthorityGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const BluePrintGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const BluePrintPageGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const BluePrintPointGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const DashboardGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const DashboardWidgetGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const DataQueryGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const DataQueryParameterGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const DatasourceConnectionGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const EmployeeGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const EntityParameterGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const ExcelUploaderDetailGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const ExcelUploaderHeaderGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const LookupGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const MailAttachmentGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const MailBodyGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const MailNotificationQueueGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const MailRecipientGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const MailTemplateGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const NewTableGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const NotificationGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const NotificationQueueGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const OrganizationApplicationGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const OrganizationGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const OrganizationRankGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const OrganizationUnitGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const OrganizationUserGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const OrganizationUserRoleGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const ReportGrid: React.FC = () => {
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const ReportParameterGrid: React.FC = () => {
@@ -0,0 +1,65 @@
1
+ import { useState } from "react";
2
+ import { Box, Button } from "@mui/material";
3
+ import { toast } from "react-toastify";
4
+ import { useAxios } from "../../hooks";
5
+ import { TransferList } from "../templates";
6
+
7
+ type RoleAuthoritiesFormProps = {
8
+ roleId: number;
9
+ availableAuthorities: Array<any>;
10
+ currentRoleAuthorities: Array<any>;
11
+ closeModalFn: () => void;
12
+ };
13
+
14
+ const RoleAuthoritiesForm: React.FC<RoleAuthoritiesFormProps> = (props) => {
15
+ const [selectedOptions, setSelectedOptions] = useState([
16
+ ...props.currentRoleAuthorities,
17
+ ]);
18
+ const { handlePostRequest } = useAxios();
19
+ const saveRoleAuthorities = async () => {
20
+ await handlePostRequest({
21
+ endPointURI: "api/v1/admin/role/authorities",
22
+ showMask: true,
23
+ parameters: { roleId: props.roleId },
24
+ data: selectedOptions,
25
+ successCallBkFn: () => {
26
+ toast.success("Your request has been proccesed successfully");
27
+ if (props.closeModalFn) {
28
+ props.closeModalFn();
29
+ }
30
+ },
31
+ });
32
+ };
33
+ return (
34
+ <>
35
+ <TransferList
36
+ displayField="authorityName"
37
+ options={props.availableAuthorities}
38
+ valueField="id"
39
+ selectedOptions={selectedOptions}
40
+ setSelection={setSelectedOptions}
41
+ />
42
+ <Box
43
+ sx={{
44
+ display: "flex",
45
+ alignItems: "center",
46
+ justifyContent: "flex-end",
47
+ width: "100%",
48
+ }}
49
+ >
50
+ <Button
51
+ variant="contained"
52
+ onClick={saveRoleAuthorities}
53
+ sx={{ marginRight: 1, marginLeft: 1 }}
54
+ >
55
+ Save
56
+ </Button>
57
+ <Button variant="contained" color="error" onClick={props.closeModalFn}>
58
+ Cancel
59
+ </Button>
60
+ </Box>
61
+ </>
62
+ );
63
+ };
64
+
65
+ export default RoleAuthoritiesForm;
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../templates/DataEntryTemplates/useApiActions";
3
+ import useApiActions from "../../hooks/useApiActions";
4
4
  import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
5
5
 
6
6
  const RoleAuthorityGrid: React.FC = () => {