@asaleh37/ui-base 25.6.2-0.1 → 25.6.2-0.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.
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/administration/admin/OrgMemberRoleForm.tsx +1 -1
- package/src/components/administration/admin/OrganizationRankGrid.tsx +1 -1
- package/src/components/administration/admin/PersonGrid.tsx +119 -16
- package/src/components/administration/admin/SystemApplicationAuthorityGrid.tsx +6 -15
- package/src/components/administration/admin/SystemApplicationModuleGrid.tsx +1 -1
- package/src/components/administration/admin/SystemApplicationRoleAuthorityGrid.tsx +64 -56
- package/src/components/administration/admin/SystemApplicationRoleGrid.tsx +2 -2
- package/src/components/templates/DataEntryTemplates/DataEntryUtil.ts +5 -5
- package/src/hooks/UseSession.tsx +20 -1
- package/src/layout/MainContent.tsx +4 -1
- package/src/layout/NavigationTree.tsx +8 -5
- package/src/layout/RouteWrapper.tsx +28 -1
- package/src/main.tsx +1 -1
- package/src/navigationItems/Administration/adminNavigationItems.tsx +13 -12
- package/src/navigationItems/index.tsx +2 -1
- package/src/redux/features/administration/AdministrationStoresMetaData.ts +22 -0
- package/src/routes/types/index.ts +1 -0
- package/vite.config.ts +1 -13
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ const OrganizationRankGrid: React.FC = () => {
|
|
|
10
10
|
const { t } = useTranslation();
|
|
11
11
|
const [data, setData] = useState([]);
|
|
12
12
|
const apiActions = useApiActions({
|
|
13
|
-
|
|
13
|
+
commonStoreKey: "CurrentOrganizationRanks",
|
|
14
14
|
deleteById: "api/v1/admin/organizationrank",
|
|
15
15
|
save: "api/v1/admin/organizationrank",
|
|
16
16
|
findById: "api/v1/admin/organizationrank",
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import TemplateGrid from "../../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
|
|
3
|
-
import { useApiActions, useWindow } from "../../../hooks";
|
|
3
|
+
import { useApiActions, useSession, useWindow } from "../../../hooks";
|
|
4
4
|
import { FormElementProps } from "../../templates/DataEntryTemplates/DataEntryTypes";
|
|
5
5
|
import { useTranslation } from "react-i18next";
|
|
6
6
|
import { toast } from "react-toastify";
|
|
7
7
|
import OrganizationMemberGrid from "./OrganizationMemberGrid";
|
|
8
8
|
import { Box } from "@mui/material";
|
|
9
9
|
import AttachmentImageViewer from "../../templates/attachment/AttachmentImageViewer";
|
|
10
|
+
import { useSelector } from "react-redux";
|
|
11
|
+
import OrgMemberRoleForm from "./OrgMemberRoleForm";
|
|
10
12
|
|
|
11
13
|
const PersonGrid: React.FC = () => {
|
|
12
14
|
const { t } = useTranslation();
|
|
13
15
|
const [selectedPerson, setSelectedPerson] = useState<any>(null);
|
|
16
|
+
const { UserInfo } = useSession();
|
|
17
|
+
const CurrentOrganizationRanks = useSelector(
|
|
18
|
+
(state: any) => state.commonStores.stores.CurrentOrganizationRanks.data
|
|
19
|
+
);
|
|
20
|
+
const CurrentOrganizationUnits = useSelector(
|
|
21
|
+
(state: any) => state.commonStores.stores.CurrentOrganizationUnits.data
|
|
22
|
+
);
|
|
14
23
|
const [data, setData] = useState([]);
|
|
15
24
|
const apiActions = useApiActions({
|
|
16
25
|
findAll: "api/v1/public/person/all",
|
|
@@ -19,6 +28,7 @@ const PersonGrid: React.FC = () => {
|
|
|
19
28
|
findById: "api/v1/admin/person",
|
|
20
29
|
setData: setData,
|
|
21
30
|
});
|
|
31
|
+
const [selectedRecord, setSelectedRecord] = useState<any>(null);
|
|
22
32
|
const {
|
|
23
33
|
Window: OrganizationMembersWindow,
|
|
24
34
|
setWindowState: setOrganizationMemberWindowState,
|
|
@@ -26,6 +36,14 @@ const PersonGrid: React.FC = () => {
|
|
|
26
36
|
windowTitle: "Organizations Membership",
|
|
27
37
|
windowIcon: "globe",
|
|
28
38
|
});
|
|
39
|
+
const {
|
|
40
|
+
Window: OrganizationMemberRolesWindow,
|
|
41
|
+
setWindowState: setOrganizationMemberRolesWindowState,
|
|
42
|
+
} = useWindow({
|
|
43
|
+
windowIcon: "tag",
|
|
44
|
+
windowTitle: "Organization Member Roles",
|
|
45
|
+
width: "50%",
|
|
46
|
+
});
|
|
29
47
|
|
|
30
48
|
const formElements: Array<FormElementProps> = [
|
|
31
49
|
{
|
|
@@ -33,17 +51,34 @@ const PersonGrid: React.FC = () => {
|
|
|
33
51
|
mode: "props",
|
|
34
52
|
props: {
|
|
35
53
|
hidden: true,
|
|
36
|
-
fieldLabel: "
|
|
37
|
-
fieldName: "
|
|
54
|
+
fieldLabel: "id",
|
|
55
|
+
fieldName: "id",
|
|
56
|
+
gridProps: {
|
|
57
|
+
hidden: true,
|
|
58
|
+
},
|
|
38
59
|
required: false,
|
|
39
|
-
fieldType: "
|
|
60
|
+
fieldType: "number",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
type: "field",
|
|
65
|
+
mode: "props",
|
|
66
|
+
props: {
|
|
67
|
+
hidden: true,
|
|
68
|
+
fieldLabel: "organizationMemberId",
|
|
69
|
+
fieldName: "organizationMemberId",
|
|
70
|
+
gridProps: {
|
|
71
|
+
hidden: true,
|
|
72
|
+
},
|
|
73
|
+
required: false,
|
|
74
|
+
fieldType: "number",
|
|
40
75
|
},
|
|
41
76
|
},
|
|
42
77
|
{
|
|
43
78
|
type: "field",
|
|
44
79
|
mode: "props",
|
|
45
80
|
props: {
|
|
46
|
-
fieldLabel: "",
|
|
81
|
+
fieldLabel: "Image",
|
|
47
82
|
fieldName: "custom",
|
|
48
83
|
fieldType: "custom",
|
|
49
84
|
gridProps: {
|
|
@@ -72,17 +107,6 @@ const PersonGrid: React.FC = () => {
|
|
|
72
107
|
},
|
|
73
108
|
},
|
|
74
109
|
},
|
|
75
|
-
{
|
|
76
|
-
type: "field",
|
|
77
|
-
mode: "props",
|
|
78
|
-
props: {
|
|
79
|
-
hidden: true,
|
|
80
|
-
fieldLabel: "PERSON_EMPLOYEE_NUMBER",
|
|
81
|
-
fieldName: "refSyncNumber",
|
|
82
|
-
required: false,
|
|
83
|
-
fieldType: "text",
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
110
|
{
|
|
87
111
|
type: "field",
|
|
88
112
|
mode: "props",
|
|
@@ -123,6 +147,41 @@ const PersonGrid: React.FC = () => {
|
|
|
123
147
|
fieldType: "text",
|
|
124
148
|
},
|
|
125
149
|
},
|
|
150
|
+
{
|
|
151
|
+
type: "field",
|
|
152
|
+
mode: "props",
|
|
153
|
+
props: {
|
|
154
|
+
fieldLabel: "ORGANIZATION_MEMBER_ORGANIZATION_RANK_ID",
|
|
155
|
+
fieldName: "organizationRankId",
|
|
156
|
+
required: false,
|
|
157
|
+
fieldType: "combobox",
|
|
158
|
+
options: CurrentOrganizationRanks,
|
|
159
|
+
optionValueField: "id",
|
|
160
|
+
optionDisplayField: "rankEnName",
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
type: "field",
|
|
165
|
+
mode: "props",
|
|
166
|
+
props: {
|
|
167
|
+
fieldLabel: "ORGANIZATION_MEMBER_ORGANIZATION_UNIT_ID",
|
|
168
|
+
fieldName: "organizationUnitId",
|
|
169
|
+
required: false,
|
|
170
|
+
fieldType: "combobox",
|
|
171
|
+
options: CurrentOrganizationUnits,
|
|
172
|
+
optionValueField: "id",
|
|
173
|
+
optionDisplayField: "organizationUnitEnName",
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
type: "field",
|
|
178
|
+
mode: "props",
|
|
179
|
+
props: {
|
|
180
|
+
fieldLabel: "Membership number",
|
|
181
|
+
fieldName: "organizationMembershipNumber",
|
|
182
|
+
fieldType: "text",
|
|
183
|
+
},
|
|
184
|
+
},
|
|
126
185
|
{
|
|
127
186
|
type: "field",
|
|
128
187
|
mode: "props",
|
|
@@ -145,6 +204,28 @@ const PersonGrid: React.FC = () => {
|
|
|
145
204
|
fieldType: "text",
|
|
146
205
|
},
|
|
147
206
|
},
|
|
207
|
+
{
|
|
208
|
+
type: "field",
|
|
209
|
+
mode: "props",
|
|
210
|
+
props: {
|
|
211
|
+
hidden: true,
|
|
212
|
+
fieldLabel: "Ref Source",
|
|
213
|
+
fieldName: "refSource",
|
|
214
|
+
required: false,
|
|
215
|
+
fieldType: "text",
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
type: "field",
|
|
220
|
+
mode: "props",
|
|
221
|
+
props: {
|
|
222
|
+
hidden: true,
|
|
223
|
+
fieldLabel: "PERSON_EMPLOYEE_NUMBER",
|
|
224
|
+
fieldName: "refSyncNumber",
|
|
225
|
+
required: false,
|
|
226
|
+
fieldType: "text",
|
|
227
|
+
},
|
|
228
|
+
},
|
|
148
229
|
{
|
|
149
230
|
type: "field",
|
|
150
231
|
mode: "props",
|
|
@@ -159,6 +240,14 @@ const PersonGrid: React.FC = () => {
|
|
|
159
240
|
|
|
160
241
|
return (
|
|
161
242
|
<>
|
|
243
|
+
<OrganizationMemberRolesWindow>
|
|
244
|
+
<OrgMemberRoleForm
|
|
245
|
+
selectedRecord={selectedRecord}
|
|
246
|
+
closeModalFn={() => {
|
|
247
|
+
setOrganizationMemberRolesWindowState(false);
|
|
248
|
+
}}
|
|
249
|
+
/>
|
|
250
|
+
</OrganizationMemberRolesWindow>
|
|
162
251
|
<OrganizationMembersWindow>
|
|
163
252
|
<OrganizationMemberGrid selectedPerson={selectedPerson} />
|
|
164
253
|
</OrganizationMembersWindow>
|
|
@@ -179,6 +268,20 @@ const PersonGrid: React.FC = () => {
|
|
|
179
268
|
keyColumnName={"id"}
|
|
180
269
|
gridTitle="PERSON_PLURAL"
|
|
181
270
|
rowActions={[
|
|
271
|
+
{
|
|
272
|
+
icon: "tags",
|
|
273
|
+
label: "Current Organization User Roles",
|
|
274
|
+
isActionDisabledForRecord: (data) => {
|
|
275
|
+
return !data?.organizationMemberId;
|
|
276
|
+
},
|
|
277
|
+
actionFn: async (data) => {
|
|
278
|
+
setSelectedRecord({
|
|
279
|
+
organizationId: UserInfo?.currentOrganization?.id,
|
|
280
|
+
id: data?.organizationMemberId,
|
|
281
|
+
});
|
|
282
|
+
setOrganizationMemberRolesWindowState(true);
|
|
283
|
+
},
|
|
284
|
+
},
|
|
182
285
|
{
|
|
183
286
|
icon: "globe",
|
|
184
287
|
label: "User Organizations",
|
|
@@ -3,33 +3,24 @@ import TemplateGrid from "../../templates/DataEntryTemplates/TemplateDataGrid/Te
|
|
|
3
3
|
import { useApiActions, useAxios } from "../../../hooks";
|
|
4
4
|
import { FormElementProps } from "../../templates/DataEntryTemplates/DataEntryTypes";
|
|
5
5
|
import { useTranslation } from "react-i18next";
|
|
6
|
+
import { useSelector } from "react-redux";
|
|
6
7
|
|
|
7
8
|
const SystemApplicationAuthorityGrid: React.FC = () => {
|
|
8
9
|
const { t } = useTranslation();
|
|
9
10
|
const [data, setData] = useState([]);
|
|
10
11
|
const apiActions = useApiActions({
|
|
11
|
-
|
|
12
|
+
commonStoreKey: "SystemApplicationAuthorities",
|
|
12
13
|
deleteById: "api/v1/admin/systemapplicationauthority",
|
|
13
14
|
save: "api/v1/admin/systemapplicationauthority",
|
|
14
15
|
findById: "api/v1/admin/systemapplicationauthority",
|
|
15
16
|
setData: setData,
|
|
16
17
|
});
|
|
17
|
-
const [systemApplicationModules, setSystemApplicationModules] = useState([]);
|
|
18
18
|
|
|
19
|
+
const SystemApplicationModules = useSelector(
|
|
20
|
+
(state: any) => state.commonStores.stores.SystemApplicationModules.data
|
|
21
|
+
);
|
|
19
22
|
const { handleGetRequest } = useAxios();
|
|
20
|
-
const getSystemApplicationModules = async () => {
|
|
21
|
-
await handleGetRequest({
|
|
22
|
-
endPointURI: "api/v1/admin/systemapplicationmodule/application/all",
|
|
23
|
-
showMask: true,
|
|
24
|
-
successCallBkFn: (response: any) => {
|
|
25
|
-
setSystemApplicationModules(response.data);
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
23
|
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
getSystemApplicationModules();
|
|
32
|
-
}, []);
|
|
33
24
|
const formElements: Array<FormElementProps> = [
|
|
34
25
|
{
|
|
35
26
|
type: "field",
|
|
@@ -51,7 +42,7 @@ const SystemApplicationAuthorityGrid: React.FC = () => {
|
|
|
51
42
|
fieldName: "systemModuleId",
|
|
52
43
|
required: false,
|
|
53
44
|
fieldType: "combobox",
|
|
54
|
-
options:
|
|
45
|
+
options: SystemApplicationModules,
|
|
55
46
|
optionValueField: "id",
|
|
56
47
|
optionDisplayField: "moduleName",
|
|
57
48
|
},
|
|
@@ -75,7 +75,7 @@ const SystemApplicationModuleGrid: React.FC = () => {
|
|
|
75
75
|
apiActions={apiActions}
|
|
76
76
|
data={data}
|
|
77
77
|
setData={setData}
|
|
78
|
-
editMode={{ editMode: "row" }}
|
|
78
|
+
editMode={{ editMode: "row", reloadAfterSave: true }}
|
|
79
79
|
formElements={formElements}
|
|
80
80
|
keyColumnName={"id"}
|
|
81
81
|
hideInfoBar={true}
|
|
@@ -1,66 +1,74 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import TemplateGrid from "../../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
|
|
3
|
-
import {useApiActions} from "../../../hooks";
|
|
3
|
+
import { useApiActions } from "../../../hooks";
|
|
4
4
|
import { FormElementProps } from "../../templates/DataEntryTemplates/DataEntryTypes";
|
|
5
5
|
import { useTranslation } from "react-i18next";
|
|
6
6
|
|
|
7
7
|
const SystemApplicationRoleAuthorityGrid: React.FC = () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const formElements: Array<FormElementProps> = [
|
|
19
|
-
{
|
|
20
|
-
type: "field",
|
|
21
|
-
mode: "props",
|
|
22
|
-
props: {
|
|
23
|
-
fieldLabel: "SYSTEM_APPLICATION_ROLE_AUTHORITY_IS_ACTIVE",
|
|
24
|
-
fieldName: "isActive",
|
|
25
|
-
required: false,
|
|
26
|
-
fieldType: "checkbox",
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: "field",
|
|
31
|
-
mode: "props",
|
|
32
|
-
props: {
|
|
33
|
-
fieldLabel: "SYSTEM_APPLICATION_ROLE_AUTHORITY_SYSTEM_APPLICATION_AUTHORITY_ID",
|
|
34
|
-
fieldName: "systemApplicationAuthorityId",
|
|
35
|
-
required: true,
|
|
36
|
-
fieldType: "text",
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
type: "field",
|
|
41
|
-
mode: "props",
|
|
42
|
-
props: {
|
|
43
|
-
fieldLabel: "SYSTEM_APPLICATION_ROLE_AUTHORITY_SYSTEM_APPLICATION_ROLE_ID",
|
|
44
|
-
fieldName: "systemApplicationRoleId",
|
|
45
|
-
required: true,
|
|
46
|
-
fieldType: "text",
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
];
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
const [data, setData] = useState([]);
|
|
10
|
+
const apiActions = useApiActions({
|
|
11
|
+
findAll: "api/v1/admin/systemapplicationroleauthority/all",
|
|
12
|
+
deleteById: "api/v1/admin/systemapplicationroleauthority",
|
|
13
|
+
save: "api/v1/admin/systemapplicationroleauthority",
|
|
14
|
+
findById: "api/v1/admin/systemapplicationroleauthority",
|
|
15
|
+
setData: setData,
|
|
16
|
+
});
|
|
50
17
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
18
|
+
const formElements: Array<FormElementProps> = [
|
|
19
|
+
{
|
|
20
|
+
type: "field",
|
|
21
|
+
mode: "props",
|
|
22
|
+
props: {
|
|
23
|
+
fieldLabel: "SYSTEM_APPLICATION_ROLE_AUTHORITY_IS_ACTIVE",
|
|
24
|
+
fieldName: "isActive",
|
|
25
|
+
required: false,
|
|
26
|
+
fieldType: "checkbox",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: "field",
|
|
31
|
+
mode: "props",
|
|
32
|
+
props: {
|
|
33
|
+
fieldLabel:
|
|
34
|
+
"SYSTEM_APPLICATION_ROLE_AUTHORITY_SYSTEM_APPLICATION_AUTHORITY_ID",
|
|
35
|
+
fieldName: "systemApplicationAuthorityId",
|
|
36
|
+
required: true,
|
|
37
|
+
fieldType: "text",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: "field",
|
|
42
|
+
mode: "props",
|
|
43
|
+
props: {
|
|
44
|
+
fieldLabel:
|
|
45
|
+
"SYSTEM_APPLICATION_ROLE_AUTHORITY_SYSTEM_APPLICATION_ROLE_ID",
|
|
46
|
+
fieldName: "systemApplicationRoleId",
|
|
47
|
+
required: true,
|
|
48
|
+
fieldType: "text",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<TemplateGrid
|
|
55
|
+
apiActions={apiActions}
|
|
56
|
+
data={data}
|
|
57
|
+
setData={setData}
|
|
58
|
+
editMode={{ editMode: "row" }}
|
|
59
|
+
formElements={formElements}
|
|
60
|
+
keyColumnName={"id"}
|
|
61
|
+
gridTitle="SYSTEM_APPLICATION_ROLE_AUTHORITY_PLURAL"
|
|
62
|
+
girdIcon="table-cells"
|
|
63
|
+
editAction={{
|
|
64
|
+
isEnabled: true,
|
|
65
|
+
authority: "SYSTEM_APPLICATION_ROLE_AUTHORITY_EDIT",
|
|
66
|
+
}}
|
|
67
|
+
deleteAction={{
|
|
68
|
+
isEnabled: true,
|
|
69
|
+
authority: "SYSTEM_APPLICATION_ROLE_AUTHORITY_DELETE",
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
64
72
|
);
|
|
65
73
|
};
|
|
66
74
|
|
|
@@ -18,7 +18,7 @@ const SystemApplicationRoleGrid: React.FC = () => {
|
|
|
18
18
|
width: "50%",
|
|
19
19
|
});
|
|
20
20
|
const apiActions = useApiActions({
|
|
21
|
-
findAll: "
|
|
21
|
+
findAll: "SystemApplicationRoles",
|
|
22
22
|
deleteById: "api/v1/admin/systemapplicationrole",
|
|
23
23
|
save: "api/v1/admin/systemapplicationrole",
|
|
24
24
|
findById: "api/v1/admin/systemapplicationrole",
|
|
@@ -85,7 +85,7 @@ const SystemApplicationRoleGrid: React.FC = () => {
|
|
|
85
85
|
data={data}
|
|
86
86
|
hideInfoBar={true}
|
|
87
87
|
setData={setData}
|
|
88
|
-
editMode={{ editMode: "row" }}
|
|
88
|
+
editMode={{ editMode: "row", reloadAfterSave: true }}
|
|
89
89
|
formElements={formElements}
|
|
90
90
|
keyColumnName={"id"}
|
|
91
91
|
gridTitle="SYSTEM_APPLICATION_ROLE_PLURAL"
|
|
@@ -66,7 +66,7 @@ export const constructGridColumnsFromFields: (
|
|
|
66
66
|
align: "center",
|
|
67
67
|
hidden: tableField?.hidden,
|
|
68
68
|
searchable: tableField?.gridProps?.searchable,
|
|
69
|
-
flex: 1,
|
|
69
|
+
flex: tableField?.gridProps?.muiProps?.width ? undefined : 1,
|
|
70
70
|
minWidth: 200,
|
|
71
71
|
};
|
|
72
72
|
|
|
@@ -84,7 +84,7 @@ export const constructGridColumnsFromFields: (
|
|
|
84
84
|
align: "center",
|
|
85
85
|
hidden: tableField?.hidden,
|
|
86
86
|
searchable: tableField?.gridProps?.searchable,
|
|
87
|
-
flex: 1,
|
|
87
|
+
flex: tableField?.gridProps?.muiProps?.width ? undefined : 1,
|
|
88
88
|
minWidth: 200,
|
|
89
89
|
});
|
|
90
90
|
columns.push(column);
|
|
@@ -101,7 +101,7 @@ export const constructGridColumnsFromFields: (
|
|
|
101
101
|
align: "center",
|
|
102
102
|
hidden: tableField?.hidden,
|
|
103
103
|
searchable: tableField?.gridProps?.searchable,
|
|
104
|
-
flex: 1,
|
|
104
|
+
flex: tableField?.gridProps?.muiProps?.width ? undefined : 1,
|
|
105
105
|
minWidth: 200,
|
|
106
106
|
});
|
|
107
107
|
columns.push(column);
|
|
@@ -139,7 +139,7 @@ export const constructGridColumnsFromFields: (
|
|
|
139
139
|
valueField: tableField?.optionValueField || "value",
|
|
140
140
|
displayField: tableField?.optionDisplayField || "display",
|
|
141
141
|
options: tableField?.options || [],
|
|
142
|
-
flex: 1,
|
|
142
|
+
flex: tableField?.gridProps?.muiProps?.width ? undefined : 1,
|
|
143
143
|
minWidth: 200,
|
|
144
144
|
});
|
|
145
145
|
columns.push(column);
|
|
@@ -160,7 +160,7 @@ export const constructGridColumnsFromFields: (
|
|
|
160
160
|
valueField: tableField?.optionValueField || "value",
|
|
161
161
|
displayField: tableField?.optionDisplayField || "display",
|
|
162
162
|
options: tableField?.options || [],
|
|
163
|
-
flex: 1,
|
|
163
|
+
flex: tableField?.gridProps?.muiProps?.width ? undefined : 1,
|
|
164
164
|
minWidth: 200,
|
|
165
165
|
});
|
|
166
166
|
columns.push(column);
|
package/src/hooks/UseSession.tsx
CHANGED
|
@@ -3,6 +3,20 @@ import { useSelector } from "react-redux";
|
|
|
3
3
|
const useSession = () => {
|
|
4
4
|
const UserSession = useSelector((state: any) => state.UserSession);
|
|
5
5
|
const UserInfo = UserSession.value;
|
|
6
|
+
|
|
7
|
+
const isCurrentOrganizationAuthorizedToModule = (
|
|
8
|
+
moduleCode: string
|
|
9
|
+
): Boolean => {
|
|
10
|
+
if (UserInfo?.currentOrganization?.systemApplicationModules) {
|
|
11
|
+
for (const subscripedModule of UserInfo.currentOrganization
|
|
12
|
+
.systemApplicationModules) {
|
|
13
|
+
if (subscripedModule.toLowerCase() == moduleCode.toLowerCase()) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
};
|
|
6
20
|
const isUserAuthorized = (authorityCode: string): boolean => {
|
|
7
21
|
if (UserSession?.value?.authorities) {
|
|
8
22
|
for (let grantedAuthority of UserSession.value.authorities) {
|
|
@@ -34,7 +48,12 @@ const useSession = () => {
|
|
|
34
48
|
}
|
|
35
49
|
return false;
|
|
36
50
|
};
|
|
37
|
-
return {
|
|
51
|
+
return {
|
|
52
|
+
UserSession,
|
|
53
|
+
isUserAuthorized,
|
|
54
|
+
isCurrentOrganizationAuthorizedToModule,
|
|
55
|
+
UserInfo,
|
|
56
|
+
};
|
|
38
57
|
};
|
|
39
58
|
|
|
40
59
|
export default useSession;
|
|
@@ -81,7 +81,10 @@ const MainContent: React.FC = () => {
|
|
|
81
81
|
key={"adm" + index}
|
|
82
82
|
path={route.path}
|
|
83
83
|
element={
|
|
84
|
-
<RouteWrapper
|
|
84
|
+
<RouteWrapper
|
|
85
|
+
authority={route.authority}
|
|
86
|
+
applicationModule={route.applicationModule}
|
|
87
|
+
>
|
|
85
88
|
<route.component />
|
|
86
89
|
</RouteWrapper>
|
|
87
90
|
}
|
|
@@ -234,14 +234,18 @@ export default function NavigationTree() {
|
|
|
234
234
|
const AppInfo = useSelector((state: any) => state.AppInfo.value);
|
|
235
235
|
const dispatch = useDispatch();
|
|
236
236
|
const isMobile = useIsMobile();
|
|
237
|
-
const { isUserAuthorized } =
|
|
237
|
+
const { isUserAuthorized, isCurrentOrganizationAuthorizedToModule } =
|
|
238
|
+
useSession();
|
|
238
239
|
const filterData = (data) => {
|
|
239
240
|
const parentItems = [];
|
|
240
241
|
for (let parentItem of data) {
|
|
241
242
|
if (
|
|
242
|
-
parentItem.authority === undefined ||
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
(parentItem.authority === undefined ||
|
|
244
|
+
parentItem.authority == null ||
|
|
245
|
+
isUserAuthorized(parentItem.authority)) &&
|
|
246
|
+
(parentItem.applicationModule === undefined ||
|
|
247
|
+
parentItem.applicationModule === null ||
|
|
248
|
+
isCurrentOrganizationAuthorizedToModule(parentItem.applicationModule))
|
|
245
249
|
) {
|
|
246
250
|
let newParentItem = structuredClone(parentItem);
|
|
247
251
|
if (parentItem?.children) {
|
|
@@ -261,7 +265,6 @@ export default function NavigationTree() {
|
|
|
261
265
|
...structuredClone(AppInfo.businessNavigationItems)
|
|
262
266
|
);
|
|
263
267
|
const authoriedNavigationItems = filterData(mergedNavigationItems);
|
|
264
|
-
console.log("authoriedNavigationItems", authoriedNavigationItems);
|
|
265
268
|
return (
|
|
266
269
|
<RichTreeView
|
|
267
270
|
items={authoriedNavigationItems}
|
|
@@ -4,10 +4,37 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
4
4
|
|
|
5
5
|
type RouteWrapperProps = {
|
|
6
6
|
authority?: string;
|
|
7
|
+
applicationModule?: string;
|
|
7
8
|
children?: React.ReactNode;
|
|
8
9
|
};
|
|
9
10
|
const RouteWrapper: React.FC<RouteWrapperProps> = (props) => {
|
|
10
|
-
const { isUserAuthorized } =
|
|
11
|
+
const { isUserAuthorized, isCurrentOrganizationAuthorizedToModule } =
|
|
12
|
+
useSession();
|
|
13
|
+
if (
|
|
14
|
+
props?.applicationModule &&
|
|
15
|
+
!isCurrentOrganizationAuthorizedToModule(props?.applicationModule)
|
|
16
|
+
) {
|
|
17
|
+
return (
|
|
18
|
+
<Box
|
|
19
|
+
sx={{
|
|
20
|
+
flex: 1,
|
|
21
|
+
display: "flex",
|
|
22
|
+
flexDirection: "column",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
justifyContent: "center",
|
|
25
|
+
color: "red",
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<h2>
|
|
29
|
+
<FontAwesomeIcon
|
|
30
|
+
style={{ marginRight: 10, marginLeft: 10 }}
|
|
31
|
+
icon="cancel"
|
|
32
|
+
/>
|
|
33
|
+
Your organization didn't subscribe for this system module
|
|
34
|
+
</h2>
|
|
35
|
+
</Box>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
11
38
|
if (props?.authority && !isUserAuthorized(props.authority)) {
|
|
12
39
|
return (
|
|
13
40
|
<Box
|
package/src/main.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { BaseApp } from "./components";
|
|
|
4
4
|
|
|
5
5
|
createRoot(document.getElementById("root")!).render(
|
|
6
6
|
<BaseApp
|
|
7
|
-
apiBaseUrl="http://
|
|
7
|
+
apiBaseUrl="http://localhost:8080/api-base"
|
|
8
8
|
appLogo={"/logo.png"}
|
|
9
9
|
appName="UI Base Library"
|
|
10
10
|
appVersion="0.0"
|
|
@@ -9,12 +9,11 @@ export const adminNavigationItems: TreeViewBaseItem<ExtendedTreeItemProps>[] = [
|
|
|
9
9
|
icon: "cog",
|
|
10
10
|
children: [
|
|
11
11
|
{
|
|
12
|
-
id: "
|
|
13
|
-
label: "
|
|
14
|
-
|
|
15
|
-
icon: "globe",
|
|
12
|
+
id: "system_admin.Person",
|
|
13
|
+
label: "PERSON_PLURAL",
|
|
14
|
+
icon: "users",
|
|
16
15
|
action: "NAVIGATION",
|
|
17
|
-
actionPayload: { path: "admin/
|
|
16
|
+
actionPayload: { path: "admin/persons" },
|
|
18
17
|
},
|
|
19
18
|
{
|
|
20
19
|
id: "development_admin.SystemApplication",
|
|
@@ -24,6 +23,14 @@ export const adminNavigationItems: TreeViewBaseItem<ExtendedTreeItemProps>[] = [
|
|
|
24
23
|
action: "NAVIGATION",
|
|
25
24
|
actionPayload: { path: "admin/systemapplications" },
|
|
26
25
|
},
|
|
26
|
+
{
|
|
27
|
+
id: "development_admin.organizations",
|
|
28
|
+
label: "ORGANIZATION_PLURAL",
|
|
29
|
+
authority: "ORGANIZATION_ADMIN",
|
|
30
|
+
icon: "globe",
|
|
31
|
+
action: "NAVIGATION",
|
|
32
|
+
actionPayload: { path: "admin/organizations" },
|
|
33
|
+
},
|
|
27
34
|
{
|
|
28
35
|
id: "development_admin.organization",
|
|
29
36
|
label: "Organization Info",
|
|
@@ -61,13 +68,7 @@ export const adminNavigationItems: TreeViewBaseItem<ExtendedTreeItemProps>[] = [
|
|
|
61
68
|
},
|
|
62
69
|
],
|
|
63
70
|
},
|
|
64
|
-
|
|
65
|
-
id: "system_admin.Person",
|
|
66
|
-
label: "PERSON_PLURAL",
|
|
67
|
-
icon: "users",
|
|
68
|
-
action: "NAVIGATION",
|
|
69
|
-
actionPayload: { path: "admin/persons" },
|
|
70
|
-
},
|
|
71
|
+
|
|
71
72
|
{
|
|
72
73
|
id: "system_admin.devtools",
|
|
73
74
|
label: "DEVELOPMENT_TOOLS",
|