@asaleh37/ui-base 1.2.3 → 1.2.5

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 (157) hide show
  1. package/dist/index.d.ts +20 -13
  2. package/dist/index.js +6 -6
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +6 -6
  5. package/dist/index.mjs.map +1 -1
  6. package/package.json +15 -3
  7. package/src/components/App.tsx +1 -1
  8. package/src/components/BaseApp.tsx +2 -19
  9. package/src/components/administration/admin/OrgMemberRoleForm.tsx +83 -0
  10. package/src/components/administration/admin/OrganizationApplicationModuleGrid.tsx +131 -0
  11. package/src/components/administration/admin/OrganizationGrid.tsx +165 -0
  12. package/src/components/administration/admin/OrganizationMemberGrid.tsx +176 -0
  13. package/src/components/administration/admin/OrganizationMemberRoleGrid.tsx +87 -0
  14. package/src/components/{admin → administration/admin}/OrganizationRankGrid.tsx +49 -19
  15. package/src/components/administration/admin/OrganizationUnitGrid.tsx +139 -0
  16. package/src/components/administration/admin/OrganizationUnitTypeGrid.tsx +121 -0
  17. package/src/components/administration/admin/PersonGrid.tsx +195 -0
  18. package/src/components/{admin → administration/admin}/RoleAuthoritiesForm.tsx +30 -11
  19. package/src/components/administration/admin/SystemApplicationAuthorityGrid.tsx +142 -0
  20. package/src/components/administration/admin/SystemApplicationGrid.tsx +161 -0
  21. package/src/components/administration/admin/SystemApplicationModuleGrid.tsx +109 -0
  22. package/src/components/administration/admin/SystemApplicationRoleAuthorityGrid.tsx +67 -0
  23. package/src/components/administration/admin/SystemApplicationRoleGrid.tsx +130 -0
  24. package/src/components/administration/dev/BluePrintGrid.tsx +129 -0
  25. package/src/components/administration/dev/DashboardGrid.tsx +173 -0
  26. package/src/components/administration/dev/DashboardWidgetGrid.tsx +164 -0
  27. package/src/components/administration/dev/DataQueryGrid.tsx +206 -0
  28. package/src/components/administration/dev/DataQueryParameterGrid.tsx +191 -0
  29. package/src/components/administration/dev/DataQueryParametersForm.tsx +84 -0
  30. package/src/components/administration/dev/DatasourceConnectionGrid.tsx +150 -0
  31. package/src/components/administration/dev/EntityParameterGrid.tsx +279 -0
  32. package/src/components/administration/dev/LookupGrid.tsx +131 -0
  33. package/src/components/administration/dev/MailAttachmentGrid.tsx +155 -0
  34. package/src/components/administration/dev/MailBodyGrid.tsx +215 -0
  35. package/src/components/{admin → administration/dev}/MailNotificationQueueGrid.tsx +114 -26
  36. package/src/components/administration/dev/MailRecipientGrid.tsx +169 -0
  37. package/src/components/administration/dev/MailSenderConfigGrid.tsx +478 -0
  38. package/src/components/administration/dev/MailTemplateGrid.tsx +388 -0
  39. package/src/components/administration/dev/ReportGrid.tsx +504 -0
  40. package/src/components/administration/dev/ReportParameterGrid.tsx +186 -0
  41. package/src/components/administration/dev/ReportParametersForm.tsx +84 -0
  42. package/src/components/administration/dev/WidgetGrid.tsx +431 -0
  43. package/src/components/administration/dev/WorkflowDocumentActionGrid.tsx +264 -0
  44. package/src/components/administration/dev/WorkflowDocumentActionHistoryGrid.tsx +172 -0
  45. package/src/components/administration/dev/WorkflowDocumentActionMailGrid.tsx +161 -0
  46. package/src/components/administration/dev/WorkflowDocumentGrid.tsx +377 -0
  47. package/src/components/{admin → administration/dev}/WorkflowDocumentMailLogGrid.tsx +87 -10
  48. package/src/components/administration/dev/WorkflowDocumentStatusGrid.tsx +243 -0
  49. package/src/components/common/ChangeOrgForm.tsx +81 -0
  50. package/src/components/common/Home.tsx +28 -22
  51. package/src/components/common/LoadingMask.tsx +9 -4
  52. package/src/components/common/Login.tsx +9 -13
  53. package/src/components/templates/DataEntryTemplates/DataEntryTypes.ts +30 -6
  54. package/src/components/templates/DataEntryTemplates/DataEntryUtil.ts +46 -5
  55. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementField.tsx +64 -5
  56. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementGroup.tsx +11 -3
  57. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/CheckBox.tsx +2 -2
  58. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/ComboBox.tsx +1 -2
  59. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/HtmlEditor.tsx +144 -0
  60. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/SystemLookupCombobox.tsx +55 -0
  61. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/TemplateTextField.tsx +9 -1
  62. package/src/components/templates/DataEntryTemplates/TemplateDataForm/TemplateForm.tsx +45 -5
  63. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/DataGridColumnsUtil.tsx +8 -7
  64. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid.tsx +38 -10
  65. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridRecordAction.tsx +4 -1
  66. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridTopBar.tsx +3 -4
  67. package/src/components/templates/TransferList.tsx +16 -6
  68. package/src/components/templates/index.ts +0 -2
  69. package/src/components/templates/report/ExcelReportViewer.tsx +65 -0
  70. package/src/components/templates/report/ReportViewer.tsx +382 -0
  71. package/src/components/templates/visuals/DashboardRouteView.tsx +9 -0
  72. package/src/components/templates/visuals/DashboardViewer.tsx +148 -0
  73. package/src/components/templates/visuals/WidgetViewer.tsx +198 -0
  74. package/src/components/templates/visuals/charts/TemplateBarChart.tsx +9 -2
  75. package/src/components/templates/visuals/charts/TemplateDataCard.tsx +6 -31
  76. package/src/components/templates/visuals/charts/TemplateGauge.tsx +8 -3
  77. package/src/components/templates/visuals/charts/TemplateLineChart.tsx +8 -2
  78. package/src/components/templates/visuals/charts/TemplateLineProgress.tsx +5 -3
  79. package/src/components/templates/visuals/charts/TemplatePieChart.tsx +1 -2
  80. package/src/components/templates/workflow/WorkflowDocumentPanel.tsx +581 -0
  81. package/src/components/templates/workflow/WorkflowDocumentTimeLine.tsx +134 -0
  82. package/src/hooks/UseSession.tsx +3 -7
  83. package/src/hooks/UseWindow.tsx +2 -1
  84. package/src/hooks/useAxios.tsx +9 -27
  85. package/src/hooks/useLookupGridColumn.tsx +35 -0
  86. package/src/layout/Layout.tsx +2 -46
  87. package/src/layout/MainContent.tsx +60 -7
  88. package/src/layout/MobileDrawer.tsx +5 -5
  89. package/src/layout/NavigationTree.tsx +0 -1
  90. package/src/layout/RouteWrapper.tsx +36 -0
  91. package/src/layout/SideBar.tsx +15 -10
  92. package/src/layout/TopBar.tsx +139 -71
  93. package/src/locales/arabic/adminLocalsAr.json +81 -344
  94. package/src/locales/arabic/common.json +11 -1
  95. package/src/locales/arabic/devLocalsAr.json +280 -0
  96. package/src/locales/arabic/index.ts +2 -0
  97. package/src/locales/english/adminLocalsEn.json +86 -346
  98. package/src/locales/english/common.json +11 -1
  99. package/src/locales/english/devLocalsEn.json +281 -0
  100. package/src/locales/english/index.ts +3 -0
  101. package/src/main.tsx +5 -6
  102. package/src/navigationItems/Administration/adminNavigationItems.tsx +65 -99
  103. package/src/navigationItems/Administration/index.tsx +10 -65
  104. package/src/redux/features/administration/AdministrationStoresMetaData.ts +45 -12
  105. package/src/redux/features/common/AppLayoutSlice.ts +0 -8
  106. package/src/redux/features/common/CommonStoreSlice.ts +4 -0
  107. package/src/redux/features/common/SideBarSlice.ts +29 -0
  108. package/src/redux/features/common/UserSessionSlice.ts +15 -23
  109. package/src/redux/store.ts +1 -1
  110. package/src/routes/administration/adminRoutes.tsx +41 -222
  111. package/src/routes/administration/devRoutes.tsx +90 -0
  112. package/src/routes/administration/index.ts +5 -1
  113. package/src/routes/index.ts +1 -0
  114. package/src/styles/index.css +3 -3
  115. package/src/util/AppUtils.ts +5 -0
  116. package/vite.config.ts +14 -0
  117. package/src/components/admin/AttachmentGrid.tsx +0 -116
  118. package/src/components/admin/AuthorityGrid.tsx +0 -88
  119. package/src/components/admin/BluePrintGrid.tsx +0 -55
  120. package/src/components/admin/BluePrintPageGrid.tsx +0 -85
  121. package/src/components/admin/BluePrintPointGrid.tsx +0 -85
  122. package/src/components/admin/DashboardGrid.tsx +0 -95
  123. package/src/components/admin/DashboardWidgetGrid.tsx +0 -75
  124. package/src/components/admin/DataQueryGrid.tsx +0 -75
  125. package/src/components/admin/DataQueryParameterGrid.tsx +0 -98
  126. package/src/components/admin/DatasourceConnectionGrid.tsx +0 -98
  127. package/src/components/admin/EmployeeGrid.tsx +0 -105
  128. package/src/components/admin/EntityParameterGrid.tsx +0 -125
  129. package/src/components/admin/ExcelUploaderDetailGrid.tsx +0 -78
  130. package/src/components/admin/ExcelUploaderHeaderGrid.tsx +0 -78
  131. package/src/components/admin/LookupGrid.tsx +0 -95
  132. package/src/components/admin/MailAttachmentGrid.tsx +0 -65
  133. package/src/components/admin/MailBodyGrid.tsx +0 -105
  134. package/src/components/admin/MailRecipientGrid.tsx +0 -75
  135. package/src/components/admin/MailTemplateGrid.tsx +0 -145
  136. package/src/components/admin/NewTableGrid.tsx +0 -65
  137. package/src/components/admin/NotificationGrid.tsx +0 -115
  138. package/src/components/admin/NotificationQueueGrid.tsx +0 -125
  139. package/src/components/admin/OrganizationApplicationGrid.tsx +0 -81
  140. package/src/components/admin/OrganizationGrid.tsx +0 -65
  141. package/src/components/admin/OrganizationUnitGrid.tsx +0 -85
  142. package/src/components/admin/OrganizationUserGrid.tsx +0 -75
  143. package/src/components/admin/OrganizationUserRoleGrid.tsx +0 -98
  144. package/src/components/admin/ReportGrid.tsx +0 -155
  145. package/src/components/admin/ReportParameterGrid.tsx +0 -95
  146. package/src/components/admin/RoleAuthorityGrid.tsx +0 -65
  147. package/src/components/admin/RoleGrid.tsx +0 -132
  148. package/src/components/admin/UserAccountGrid.tsx +0 -65
  149. package/src/components/admin/UserRequestGrid.tsx +0 -145
  150. package/src/components/admin/WidgetGrid.tsx +0 -175
  151. package/src/components/admin/WorkflowDocumentActionGrid.tsx +0 -111
  152. package/src/components/admin/WorkflowDocumentActionHistoryGrid.tsx +0 -111
  153. package/src/components/admin/WorkflowDocumentActionMailGrid.tsx +0 -71
  154. package/src/components/admin/WorkflowDocumentGrid.tsx +0 -185
  155. package/src/components/admin/WorkflowDocumentStatusGrid.tsx +0 -121
  156. package/src/components/templates/visuals/TemplateDashboard.tsx +0 -126
  157. package/src/redux/features/CounterSlice.tsx +0 -13
@@ -0,0 +1,87 @@
1
+ import { useState } from "react";
2
+ import TemplateGrid from "../../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
+ import {useApiActions} from "../../../hooks";
4
+ import { FormElementProps } from "../../templates/DataEntryTemplates/DataEntryTypes";
5
+ import { useTranslation } from "react-i18next";
6
+
7
+ const OrganizationMemberRoleGrid: React.FC = () => {
8
+ const { t } = useTranslation();
9
+ const [data, setData] = useState([]);
10
+ const apiActions = useApiActions({
11
+ findAll: "api/v1/admin/organizationmemberrole/all",
12
+ deleteById: "api/v1/admin/organizationmemberrole",
13
+ save: "api/v1/admin/organizationmemberrole",
14
+ findById: "api/v1/admin/organizationmemberrole",
15
+ setData: setData,
16
+ });
17
+
18
+ const formElements: Array<FormElementProps> = [
19
+ {
20
+ type: "field",
21
+ mode: "props",
22
+ props: {
23
+ fieldLabel: "ORGANIZATION_MEMBER_ROLE_IS_ACTIVE",
24
+ fieldName: "isActive",
25
+ required: false,
26
+ fieldType: "checkbox",
27
+ },
28
+ },
29
+ {
30
+ type: "field",
31
+ mode: "props",
32
+ props: {
33
+ fieldLabel: "ORGANIZATION_MEMBER_ROLE_END_DATE",
34
+ fieldName: "endDate",
35
+ required: false,
36
+ fieldType: "datetime",
37
+ },
38
+ },
39
+ {
40
+ type: "field",
41
+ mode: "props",
42
+ props: {
43
+ fieldLabel: "ORGANIZATION_MEMBER_ROLE_ORGANIZATION_MEMBER_ID",
44
+ fieldName: "organizationMemberId",
45
+ required: true,
46
+ fieldType: "text",
47
+ },
48
+ },
49
+ {
50
+ type: "field",
51
+ mode: "props",
52
+ props: {
53
+ fieldLabel: "ORGANIZATION_MEMBER_ROLE_START_DATE",
54
+ fieldName: "startDate",
55
+ required: false,
56
+ fieldType: "datetime",
57
+ },
58
+ },
59
+ {
60
+ type: "field",
61
+ mode: "props",
62
+ props: {
63
+ fieldLabel: "ORGANIZATION_MEMBER_ROLE_SYSTEM_APPLICATION_ROLE_ID",
64
+ fieldName: "systemApplicationRoleId",
65
+ required: true,
66
+ fieldType: "text",
67
+ },
68
+ },
69
+ ];
70
+
71
+ return (
72
+ <TemplateGrid
73
+ apiActions={apiActions}
74
+ data={data}
75
+ setData={setData}
76
+ editMode={{ editMode: "row"}}
77
+ formElements={formElements}
78
+ keyColumnName={"id"}
79
+ gridTitle="ORGANIZATION_MEMBER_ROLE_PLURAL"
80
+ girdIcon="table-cells"
81
+ editAction={{ isEnabled: true, authority: "ORGANIZATION_MEMBER_ROLE_EDIT" }}
82
+ deleteAction={{ isEnabled: true, authority: "ORGANIZATION_MEMBER_ROLE_DELETE" }}
83
+ />
84
+ );
85
+ };
86
+
87
+ export default OrganizationMemberRoleGrid;
@@ -1,9 +1,15 @@
1
1
  import { useState } from "react";
2
- import TemplateGrid from "../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import useApiActions from "../../hooks/useApiActions";
4
- import { FormElementProps } from "../templates/DataEntryTemplates/DataEntryTypes";
2
+ import TemplateGrid from "../../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
+ import { useApiActions } from "../../../hooks";
4
+ import { FormElementProps } from "../../templates/DataEntryTemplates/DataEntryTypes";
5
+ import { useTranslation } from "react-i18next";
5
6
 
6
- const OrganizationRankGrid: React.FC = () => {
7
+ type OrganizationRankGridProps = {
8
+ selectedOrganization: any;
9
+ };
10
+
11
+ const OrganizationRankGrid: React.FC<OrganizationRankGridProps> = (props) => {
12
+ const { t } = useTranslation();
7
13
  const [data, setData] = useState([]);
8
14
  const apiActions = useApiActions({
9
15
  findAll: "api/v1/admin/organizationrank/all",
@@ -18,19 +24,21 @@ const OrganizationRankGrid: React.FC = () => {
18
24
  type: "field",
19
25
  mode: "props",
20
26
  props: {
21
- fieldLabel: "ORGANIZATION_RANK_ENABLED",
22
- fieldName: "enabled",
27
+ hidden: true,
28
+ gridProps: { hidden: true },
29
+ fieldLabel: "ORGANIZATION_RANK_ORGANIZATION_ID",
30
+ fieldName: "organizationId",
23
31
  required: false,
24
- fieldType: "checkbox",
32
+ fieldType: "text",
25
33
  },
26
34
  },
27
35
  {
28
36
  type: "field",
29
37
  mode: "props",
30
38
  props: {
31
- fieldLabel: "ORGANIZATION_RANK_ORGANIZATION_CODE",
32
- fieldName: "organizationCode",
33
- required: false,
39
+ fieldLabel: "ORGANIZATION_RANK_RANK_ORDER",
40
+ fieldName: "rankOrder",
41
+ required: true,
34
42
  fieldType: "text",
35
43
  },
36
44
  },
@@ -40,7 +48,7 @@ const OrganizationRankGrid: React.FC = () => {
40
48
  props: {
41
49
  fieldLabel: "ORGANIZATION_RANK_RANK_CODE",
42
50
  fieldName: "rankCode",
43
- required: false,
51
+ required: true,
44
52
  fieldType: "text",
45
53
  },
46
54
  },
@@ -48,35 +56,57 @@ const OrganizationRankGrid: React.FC = () => {
48
56
  type: "field",
49
57
  mode: "props",
50
58
  props: {
51
- fieldLabel: "ORGANIZATION_RANK_RANK_NAME",
52
- fieldName: "rankName",
53
- required: false,
59
+ fieldLabel: "ORGANIZATION_RANK_RANK_AR_NAME",
60
+ fieldName: "rankArName",
61
+ required: true,
54
62
  fieldType: "text",
55
63
  },
56
64
  },
65
+
57
66
  {
58
67
  type: "field",
59
68
  mode: "props",
60
69
  props: {
61
- fieldLabel: "ORGANIZATION_RANK_RANK_ORDER",
62
- fieldName: "rankOrder",
63
- required: false,
70
+ fieldLabel: "ORGANIZATION_RANK_RANK_EN_NAME",
71
+ fieldName: "rankEnName",
72
+ required: true,
64
73
  fieldType: "text",
65
74
  },
66
75
  },
76
+ {
77
+ type: "field",
78
+ mode: "props",
79
+ props: {
80
+ fieldLabel: "ORGANIZATION_RANK_ENABLED",
81
+ fieldName: "enabled",
82
+ required: false,
83
+ fieldType: "checkbox",
84
+ },
85
+ },
67
86
  ];
68
87
 
69
88
  return (
70
89
  <TemplateGrid
71
90
  apiActions={apiActions}
72
91
  data={data}
92
+ hideInfoBar={true}
93
+ gridLoadParametersValues={{
94
+ organizationId: props?.selectedOrganization?.id,
95
+ }}
73
96
  setData={setData}
74
97
  editMode={{ editMode: "row" }}
75
98
  formElements={formElements}
76
99
  keyColumnName={"id"}
77
100
  gridTitle="ORGANIZATION_RANK_PLURAL"
78
- girdIcon="table-cells"
79
- editAction={{ isEnabled: true, authority: "ORGANIZATION_RANK_EDIT" }}
101
+ girdIcon="street-view"
102
+ editAction={{
103
+ isEnabled: true,
104
+ authority: "ORGANIZATION_RANK_EDIT",
105
+ preActionValidation: async (data) => {
106
+ data.organizationId = props?.selectedOrganization?.id;
107
+ return true;
108
+ },
109
+ }}
80
110
  deleteAction={{ isEnabled: true, authority: "ORGANIZATION_RANK_DELETE" }}
81
111
  />
82
112
  );
@@ -0,0 +1,139 @@
1
+ import { useEffect, useState } from "react";
2
+ import TemplateGrid from "../../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
+ import { useApiActions, useAxios } from "../../../hooks";
4
+ import { FormElementProps } from "../../templates/DataEntryTemplates/DataEntryTypes";
5
+ import { useTranslation } from "react-i18next";
6
+
7
+ type OrganizationUnitGridProps = {
8
+ selectedOrganization: any;
9
+ };
10
+
11
+ const OrganizationUnitGrid: React.FC<OrganizationUnitGridProps> = (props) => {
12
+ const { t } = useTranslation();
13
+ const [data, setData] = useState([]);
14
+ const apiActions = useApiActions({
15
+ findAll: "api/v1/admin/organizationunit/all",
16
+ deleteById: "api/v1/admin/organizationunit",
17
+ save: "api/v1/admin/organizationunit",
18
+ findById: "api/v1/admin/organizationunit",
19
+ setData: setData,
20
+ });
21
+ const [organizationUnitTypes, setOrganizationUnitTypes] = useState([]);
22
+ const { handleGetRequest } = useAxios();
23
+ const getOrganizationUnitTypes = async () => {
24
+ await handleGetRequest({
25
+ endPointURI: "api/v1/admin/organizationunittype/all",
26
+ showMask: true,
27
+ parameters: {
28
+ organizationId: props.selectedOrganization.id,
29
+ },
30
+ successCallBkFn: (response: any) => {
31
+ setOrganizationUnitTypes(response.data);
32
+ },
33
+ });
34
+ };
35
+
36
+ useEffect(() => {
37
+ getOrganizationUnitTypes();
38
+ }, []);
39
+
40
+ const formElements: Array<FormElementProps> = [
41
+ {
42
+ type: "field",
43
+ mode: "props",
44
+ props: {
45
+ hidden: true,
46
+ gridProps: { hidden: true },
47
+ fieldLabel: "ORGANIZATION_UNIT_ORGANIZATION_ID",
48
+ fieldName: "organizationId",
49
+ required: false,
50
+ fieldType: "text",
51
+ },
52
+ },
53
+
54
+ {
55
+ type: "field",
56
+ mode: "props",
57
+ props: {
58
+ fieldLabel: "ORGANIZATION_UNIT_ORGANIZATION_UNIT_TYPE_ID",
59
+ fieldName: "organizationUnitTypeId",
60
+ required: true,
61
+ fieldType: "combobox",
62
+ options: organizationUnitTypes,
63
+ optionValueField: "id",
64
+ optionDisplayField: "unitTypeEnName",
65
+ },
66
+ },
67
+ {
68
+ type: "field",
69
+ mode: "props",
70
+ props: {
71
+ fieldLabel: "ORGANIZATION_UNIT_ORGANIZATION_UNIT_AR_NAME",
72
+ fieldName: "organizationUnitArName",
73
+ required: true,
74
+ fieldType: "text",
75
+ },
76
+ },
77
+ {
78
+ type: "field",
79
+ mode: "props",
80
+ props: {
81
+ fieldLabel: "ORGANIZATION_UNIT_ORGANIZATION_UNIT_EN_NAME",
82
+ fieldName: "organizationUnitEnName",
83
+ required: true,
84
+ fieldType: "text",
85
+ },
86
+ },
87
+ {
88
+ type: "field",
89
+ mode: "props",
90
+ props: {
91
+ fieldLabel: "ORGANIZATION_UNIT_ORGANIZATION_UNIT_PARENT_ID",
92
+ fieldName: "organizationUnitParentId",
93
+ required: false,
94
+ fieldType: "combobox",
95
+ options: data,
96
+ optionValueField: "id",
97
+ optionDisplayField: "organizationUnitEnName",
98
+ },
99
+ },
100
+ {
101
+ type: "field",
102
+ mode: "props",
103
+ props: {
104
+ fieldLabel: "ORGANIZATION_UNIT_ENABLED",
105
+ fieldName: "enabled",
106
+ required: false,
107
+ fieldType: "checkbox",
108
+ },
109
+ },
110
+ ];
111
+
112
+ return (
113
+ <TemplateGrid
114
+ apiActions={apiActions}
115
+ data={data}
116
+ hideInfoBar={true}
117
+ gridLoadParametersValues={{
118
+ organizationId: props?.selectedOrganization?.id,
119
+ }}
120
+ setData={setData}
121
+ editMode={{ editMode: "row" }}
122
+ formElements={formElements}
123
+ keyColumnName={"id"}
124
+ gridTitle="ORGANIZATION_UNIT_PLURAL"
125
+ girdIcon="folder-tree"
126
+ editAction={{
127
+ isEnabled: true,
128
+ authority: "ORGANIZATION_UNIT_EDIT",
129
+ preActionValidation: async (data) => {
130
+ data.organizationId = props?.selectedOrganization?.id;
131
+ return true;
132
+ },
133
+ }}
134
+ deleteAction={{ isEnabled: true, authority: "ORGANIZATION_UNIT_DELETE" }}
135
+ />
136
+ );
137
+ };
138
+
139
+ export default OrganizationUnitGrid;
@@ -0,0 +1,121 @@
1
+ import { useState } from "react";
2
+ import TemplateGrid from "../../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
+ import { useApiActions } from "../../../hooks";
4
+ import { FormElementProps } from "../../templates/DataEntryTemplates/DataEntryTypes";
5
+ import { useTranslation } from "react-i18next";
6
+
7
+ type OrganizationUnitTypeGridProps = {
8
+ selectedOrganization: any;
9
+ };
10
+
11
+ const OrganizationUnitTypeGrid: React.FC<OrganizationUnitTypeGridProps> = (
12
+ props
13
+ ) => {
14
+ const { t } = useTranslation();
15
+ const [data, setData] = useState([]);
16
+ const apiActions = useApiActions({
17
+ findAll: "api/v1/admin/organizationunittype/all",
18
+ deleteById: "api/v1/admin/organizationunittype",
19
+ save: "api/v1/admin/organizationunittype",
20
+ findById: "api/v1/admin/organizationunittype",
21
+ setData: setData,
22
+ });
23
+
24
+ const formElements: Array<FormElementProps> = [
25
+ {
26
+ type: "field",
27
+ mode: "props",
28
+ props: {
29
+ fieldLabel: "ORGANIZATION_UNIT_TYPE_ORGANIZATION_ID",
30
+ hidden: true,
31
+ gridProps: {
32
+ hidden: true,
33
+ },
34
+ fieldName: "organizationId",
35
+ required: false,
36
+ fieldType: "number",
37
+ },
38
+ },
39
+ {
40
+ type: "field",
41
+ mode: "props",
42
+ props: {
43
+ fieldLabel: "ORGANIZATION_UNIT_TYPE_ORGANIZATION_UNIT_TYPE_ORDER",
44
+ fieldName: "organizationUnitTypeOrder",
45
+ required: false,
46
+ fieldType: "number",
47
+ },
48
+ },
49
+ {
50
+ type: "field",
51
+ mode: "props",
52
+ props: {
53
+ fieldLabel: "ORGANIZATION_UNIT_TYPE_UNIT_TYPE_CODE",
54
+ fieldName: "unitTypeCode",
55
+ required: true,
56
+ fieldType: "text",
57
+ },
58
+ },
59
+ {
60
+ type: "field",
61
+ mode: "props",
62
+ props: {
63
+ fieldLabel: "ORGANIZATION_UNIT_TYPE_UNIT_TYPE_AR_NAME",
64
+ fieldName: "unitTypeArName",
65
+ required: true,
66
+ fieldType: "text",
67
+ },
68
+ },
69
+ {
70
+ type: "field",
71
+ mode: "props",
72
+ props: {
73
+ fieldLabel: "ORGANIZATION_UNIT_TYPE_UNIT_TYPE_EN_NAME",
74
+ fieldName: "unitTypeEnName",
75
+ required: true,
76
+ fieldType: "text",
77
+ },
78
+ },
79
+ {
80
+ type: "field",
81
+ mode: "props",
82
+ props: {
83
+ fieldLabel: "ORGANIZATION_UNIT_TYPE_IS_ACTIVE",
84
+ fieldName: "isActive",
85
+ required: false,
86
+ fieldType: "checkbox",
87
+ },
88
+ },
89
+ ];
90
+
91
+ return (
92
+ <TemplateGrid
93
+ apiActions={apiActions}
94
+ data={data}
95
+ hideInfoBar={true}
96
+ gridLoadParametersValues={{
97
+ organizationId: props?.selectedOrganization?.id,
98
+ }}
99
+ setData={setData}
100
+ editMode={{ editMode: "row" }}
101
+ formElements={formElements}
102
+ keyColumnName={"id"}
103
+ gridTitle="ORGANIZATION_UNIT_TYPE_PLURAL"
104
+ girdIcon="tags"
105
+ editAction={{
106
+ isEnabled: true,
107
+ authority: "ORGANIZATION_UNIT_TYPE_EDIT",
108
+ preActionValidation: async (data) => {
109
+ data.organizationId = props?.selectedOrganization?.id;
110
+ return true;
111
+ },
112
+ }}
113
+ deleteAction={{
114
+ isEnabled: true,
115
+ authority: "ORGANIZATION_UNIT_TYPE_DELETE",
116
+ }}
117
+ />
118
+ );
119
+ };
120
+
121
+ export default OrganizationUnitTypeGrid;
@@ -0,0 +1,195 @@
1
+ import { useState } from "react";
2
+ import TemplateGrid from "../../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
+ import { useApiActions, useWindow } from "../../../hooks";
4
+ import { FormElementProps } from "../../templates/DataEntryTemplates/DataEntryTypes";
5
+ import { useTranslation } from "react-i18next";
6
+ import { toast } from "react-toastify";
7
+ import OrganizationMemberGrid from "./OrganizationMemberGrid";
8
+
9
+ const PersonGrid: React.FC = () => {
10
+ const { t } = useTranslation();
11
+ const [selectedPerson, setSelectedPerson] = useState<any>(null);
12
+ const [data, setData] = useState([]);
13
+ const apiActions = useApiActions({
14
+ findAll: "api/v1/admin/person/all",
15
+ deleteById: "api/v1/admin/person",
16
+ save: "api/v1/admin/person",
17
+ findById: "api/v1/admin/person",
18
+ setData: setData,
19
+ });
20
+ const {
21
+ Window: OrganizationMembersWindow,
22
+ setWindowState: setOrganizationMemberWindowState,
23
+ } = useWindow({
24
+ windowTitle: "Organizations Membership",
25
+ windowIcon: "globe",
26
+ });
27
+
28
+ const formElements: Array<FormElementProps> = [
29
+ {
30
+ type: "field",
31
+ mode: "props",
32
+ props: {
33
+ hidden: true,
34
+ fieldLabel: "Ref Source",
35
+ fieldName: "refSource",
36
+ required: false,
37
+ fieldType: "text",
38
+ },
39
+ },
40
+ {
41
+ type: "field",
42
+ mode: "props",
43
+ props: {
44
+ hidden: true,
45
+ fieldLabel: "PERSON_EMPLOYEE_NUMBER",
46
+ fieldName: "refSyncNumber",
47
+ required: false,
48
+ fieldType: "text",
49
+ },
50
+ },
51
+ {
52
+ type: "field",
53
+ mode: "props",
54
+ props: {
55
+ fieldLabel: "PERSON_EMPLOYEE_AR_NAME",
56
+ fieldName: "employeeArName",
57
+ required: true,
58
+ fieldType: "text",
59
+ },
60
+ },
61
+ {
62
+ type: "field",
63
+ mode: "props",
64
+ props: {
65
+ fieldLabel: "PERSON_EMPLOYEE_EN_NAME",
66
+ fieldName: "employeeEnName",
67
+ required: true,
68
+ fieldType: "text",
69
+ },
70
+ },
71
+ {
72
+ type: "field",
73
+ mode: "props",
74
+ props: {
75
+ fieldLabel: "PERSON_EMAIL",
76
+ fieldName: "email",
77
+ required: false,
78
+ fieldType: "text",
79
+ },
80
+ },
81
+ {
82
+ type: "field",
83
+ mode: "props",
84
+ props: {
85
+ fieldLabel: "PERSON_MOBILE_NUMBER",
86
+ fieldName: "mobileNumber",
87
+ required: false,
88
+ fieldType: "text",
89
+ },
90
+ },
91
+ {
92
+ type: "field",
93
+ mode: "props",
94
+ props: {
95
+ hidden: true,
96
+ gridProps: { hidden: true },
97
+ fieldLabel: "PERSON_PASSWORD",
98
+ fieldName: "password",
99
+ required: false,
100
+ fieldType: "text",
101
+ },
102
+ },
103
+ {
104
+ type: "field",
105
+ mode: "props",
106
+ props: {
107
+ fieldLabel: "PERSON_USERNAME",
108
+ fieldName: "username",
109
+ required: false,
110
+ fieldType: "text",
111
+ },
112
+ },
113
+ {
114
+ type: "field",
115
+ mode: "props",
116
+ props: {
117
+ fieldLabel: "PERSON_IS_ACTIVE",
118
+ fieldName: "isActive",
119
+ required: false,
120
+ fieldType: "checkbox",
121
+ },
122
+ },
123
+ ];
124
+
125
+ return (
126
+ <>
127
+ <OrganizationMembersWindow>
128
+ <OrganizationMemberGrid selectedPerson={selectedPerson} />
129
+ </OrganizationMembersWindow>
130
+ <TemplateGrid
131
+ apiActions={apiActions}
132
+ data={data}
133
+ setData={setData}
134
+ editMode={{
135
+ editMode: "modal",
136
+ specs: {
137
+ modalIcon: "user",
138
+ modalTitle: "Person Profile",
139
+ modalWidth: 300,
140
+ },
141
+ }}
142
+ formElements={formElements}
143
+ keyColumnName={"id"}
144
+ gridTitle="PERSON_PLURAL"
145
+ rowActions={[
146
+ {
147
+ icon: "globe",
148
+ label: "User Organizations",
149
+ actionFn: async (data) => {
150
+ setSelectedPerson(data);
151
+ setOrganizationMemberWindowState(true);
152
+ },
153
+ },
154
+ ]}
155
+ girdIcon="users"
156
+ editAction={{
157
+ isEnabled: true,
158
+ authority: "PERSON_EDIT",
159
+ preActionValidation: (data) => {
160
+ if (
161
+ data.refSource != undefined &&
162
+ data.refSource != null &&
163
+ data.refSource != ""
164
+ ) {
165
+ toast.error(
166
+ "This Person Was synced from other system therefore you can't modify this record"
167
+ );
168
+ return false;
169
+ }
170
+ return true;
171
+ },
172
+ }}
173
+ deleteAction={{
174
+ isEnabled: true,
175
+ authority: "PERSON_DELETE",
176
+ preActionValidation: (data) => {
177
+ if (
178
+ data.refSource != undefined &&
179
+ data.refSource != null &&
180
+ data.refSource != ""
181
+ ) {
182
+ toast.error(
183
+ "This Person Was synced from other system therefore you can't modify this record"
184
+ );
185
+ return false;
186
+ }
187
+ return true;
188
+ },
189
+ }}
190
+ />
191
+ </>
192
+ );
193
+ };
194
+
195
+ export default PersonGrid;