@asaleh37/ui-base 1.2.30 → 25.1.9

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 (179) hide show
  1. package/.github/workflows/publish-npm.yml +49 -0
  2. package/README.md +51 -51
  3. package/__ODockerfile +14 -0
  4. package/dist/index.d.ts +92 -10
  5. package/dist/index.js +135 -7
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +135 -7
  8. package/dist/index.mjs.map +1 -1
  9. package/eslint.config.js +29 -29
  10. package/index.html +20 -13
  11. package/package-lock.json/342/200/216 +9040 -0
  12. package/package.json +122 -119
  13. package/public/bg.jpg +0 -0
  14. package/public/ezzsteel.png +0 -0
  15. package/public/logo.png +0 -0
  16. package/public/manifest.json +21 -0
  17. package/public/no_user.png +0 -0
  18. package/rollup.config-1748377725725.cjs +50 -50
  19. package/rollup.config.js +45 -45
  20. package/src/components/App.tsx +155 -123
  21. package/src/components/BaseApp.tsx +75 -53
  22. package/src/components/ExampleTrial.tsx +24 -0
  23. package/src/components/administration/admin/ChangePasswordPanel.tsx +128 -0
  24. package/src/components/administration/admin/CustomPersonGrid.tsx +361 -0
  25. package/src/components/administration/admin/OrgMemberRoleForm.tsx +83 -83
  26. package/src/components/administration/admin/OrgProvidedPersonGrid.tsx +347 -0
  27. package/src/components/administration/admin/OrganizationApplicationModuleGrid.tsx +107 -107
  28. package/src/components/administration/admin/OrganizationGrid.tsx +118 -82
  29. package/src/components/administration/admin/OrganizationMemberGrid.tsx +190 -176
  30. package/src/components/administration/admin/OrganizationMemberRoleGrid.tsx +87 -87
  31. package/src/components/administration/admin/OrganizationRankGrid.tsx +133 -133
  32. package/src/components/administration/admin/OrganizationUnitGrid.tsx +143 -143
  33. package/src/components/administration/admin/OrganizationUnitTypeGrid.tsx +108 -108
  34. package/src/components/administration/admin/PersonGrid.tsx +27 -231
  35. package/src/components/administration/admin/RoleAuthoritiesForm.tsx +82 -82
  36. package/src/components/administration/admin/SystemApplicationAuthorityGrid.tsx +117 -126
  37. package/src/components/administration/admin/SystemApplicationGrid.tsx +83 -83
  38. package/src/components/administration/admin/SystemApplicationModuleGrid.tsx +96 -96
  39. package/src/components/administration/admin/SystemApplicationRoleAuthorityGrid.tsx +75 -67
  40. package/src/components/administration/admin/SystemApplicationRoleGrid.tsx +116 -116
  41. package/src/components/administration/dev/AttachmentConfigGrid.tsx +224 -213
  42. package/src/components/administration/dev/AttachmentGrid.tsx +172 -172
  43. package/src/components/administration/dev/BluePrintGrid.tsx +129 -129
  44. package/src/components/administration/dev/DashboardGrid.tsx +173 -173
  45. package/src/components/administration/dev/DashboardWidgetGrid.tsx +164 -164
  46. package/src/components/administration/dev/DataQueryGrid.tsx +216 -206
  47. package/src/components/administration/dev/DataQueryParameterGrid.tsx +191 -191
  48. package/src/components/administration/dev/DataQueryParametersForm.tsx +84 -84
  49. package/src/components/administration/dev/DatasourceConnectionGrid.tsx +151 -150
  50. package/src/components/administration/dev/EntityParameterGrid.tsx +307 -279
  51. package/src/components/administration/dev/LookupGrid.tsx +120 -120
  52. package/src/components/administration/dev/MailAttachmentGrid.tsx +155 -155
  53. package/src/components/administration/dev/MailBodyGrid.tsx +216 -216
  54. package/src/components/administration/dev/MailNotificationQueueGrid.tsx +245 -245
  55. package/src/components/administration/dev/MailRecipientGrid.tsx +170 -169
  56. package/src/components/administration/dev/MailSenderConfigGrid.tsx +480 -478
  57. package/src/components/administration/dev/MailTemplateGrid.tsx +385 -384
  58. package/src/components/administration/dev/NotificationGrid.tsx +435 -432
  59. package/src/components/administration/dev/NotificationQueueGrid.tsx +222 -222
  60. package/src/components/administration/dev/ReportGrid.tsx +503 -504
  61. package/src/components/administration/dev/ReportParameterGrid.tsx +186 -186
  62. package/src/components/administration/dev/ReportParametersForm.tsx +84 -84
  63. package/src/components/administration/dev/WidgetGrid.tsx +380 -431
  64. package/src/components/administration/dev/WorkflowDocumentActionGrid.tsx +264 -264
  65. package/src/components/administration/dev/WorkflowDocumentActionHistoryGrid.tsx +172 -172
  66. package/src/components/administration/dev/WorkflowDocumentActionMailGrid.tsx +161 -161
  67. package/src/components/administration/dev/WorkflowDocumentGrid.tsx +357 -377
  68. package/src/components/administration/dev/WorkflowDocumentMailLogGrid.tsx +218 -218
  69. package/src/components/administration/dev/WorkflowDocumentStatusGrid.tsx +243 -243
  70. package/src/components/common/AzureLogin.tsx +222 -0
  71. package/src/components/common/ChangeOrgForm.tsx +85 -81
  72. package/src/components/common/Home.tsx +43 -44
  73. package/src/components/common/LanguageSwitcher.tsx +25 -25
  74. package/src/components/common/LayoutHandlers.tsx +11 -11
  75. package/src/components/common/LoadingMask.tsx +24 -24
  76. package/src/components/common/Login.tsx +268 -214
  77. package/src/components/common/MobileLogin.tsx +229 -0
  78. package/src/components/common/MyNotificationsPanel.tsx +109 -104
  79. package/src/components/common/NoLicenseComponent.tsx +79 -0
  80. package/src/components/common/NotificationItem.tsx +138 -138
  81. package/src/components/index.ts +10 -9
  82. package/src/components/msalConfig.ts +11 -0
  83. package/src/components/templates/DataEntryTemplates/DataEntryTypes.ts +361 -324
  84. package/src/components/templates/DataEntryTemplates/DataEntryUtil.ts +297 -248
  85. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormAction.tsx +60 -60
  86. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementField.tsx +238 -231
  87. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementGroup.tsx +108 -106
  88. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/CheckBox.tsx +66 -64
  89. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/ComboBox.tsx +164 -93
  90. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/Datefield.tsx +70 -65
  91. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/DatetimeField.tsx +71 -64
  92. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/FiltersPanel.tsx +237 -237
  93. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/SystemLookupCombobox.tsx +56 -55
  94. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/TemplateTextField.tsx +20 -17
  95. package/src/components/templates/DataEntryTemplates/TemplateDataForm/TemplateForm.tsx +431 -388
  96. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/DataGridColumnsUtil.tsx +197 -189
  97. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid.tsx +1044 -998
  98. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridMultiRecordAction.tsx +89 -89
  99. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridRecordAction.tsx +95 -95
  100. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridTopBar.tsx +234 -227
  101. package/src/components/templates/TransferList.tsx +256 -257
  102. package/src/components/templates/Window/ConfirmationWindow.tsx +55 -55
  103. package/src/components/templates/attachment/AttachmentCard.tsx +141 -141
  104. package/src/components/templates/attachment/AttachmentImageViewer.tsx +85 -45
  105. package/src/components/templates/attachment/AttachmentPanel.tsx +285 -271
  106. package/src/components/templates/index.ts +35 -33
  107. package/src/components/templates/report/ExcelReportViewer.tsx +71 -72
  108. package/src/components/templates/report/ReportViewer.tsx +272 -383
  109. package/src/components/templates/visuals/DashboardRouteView.tsx +9 -9
  110. package/src/components/templates/visuals/DashboardViewer.tsx +192 -148
  111. package/src/components/templates/visuals/WidgetViewer.tsx +208 -198
  112. package/src/components/templates/visuals/charts/TemplateBarChart.tsx +23 -23
  113. package/src/components/templates/visuals/charts/TemplateDataCard.tsx +35 -35
  114. package/src/components/templates/visuals/charts/TemplateGauge.tsx +21 -21
  115. package/src/components/templates/visuals/charts/TemplateLineChart.tsx +22 -22
  116. package/src/components/templates/visuals/charts/TemplateLineProgress.tsx +42 -42
  117. package/src/components/templates/visuals/charts/TemplatePieChart.tsx +24 -24
  118. package/src/components/templates/workflow/WorkflowDocumentPanel.tsx +611 -606
  119. package/src/components/templates/workflow/WorkflowDocumentTimeLine.tsx +145 -140
  120. package/src/components/templates/workflow/WorkflowRouteComponent.tsx +14 -14
  121. package/src/examples/ExampleGrid.tsx +134 -0
  122. package/src/hooks/UseConfirmationWindow.tsx +56 -54
  123. package/src/hooks/UseMobile.tsx +13 -13
  124. package/src/hooks/UseSession.tsx +59 -40
  125. package/src/hooks/UseWindow.tsx +111 -107
  126. package/src/hooks/index.ts +22 -7
  127. package/src/hooks/useApiActions.ts +124 -124
  128. package/src/hooks/useAxios.tsx +340 -316
  129. package/src/hooks/useCommonStore.tsx +29 -0
  130. package/src/hooks/useInterval.tsx +23 -23
  131. package/src/hooks/useLoadingMask.tsx +16 -16
  132. package/src/hooks/useLookupGridColumn.tsx +35 -35
  133. package/src/hooks/useParameterPanel.tsx +159 -0
  134. package/src/index.ts +4 -4
  135. package/src/layout/DrawerHeader.tsx +10 -10
  136. package/src/layout/Layout.tsx +102 -90
  137. package/src/layout/MainContent.tsx +115 -114
  138. package/src/layout/MobileDrawer.tsx +103 -103
  139. package/src/layout/NavigationTree.tsx +309 -291
  140. package/src/layout/NotificationButton.tsx +207 -207
  141. package/src/layout/RouteWrapper.tsx +63 -36
  142. package/src/layout/SideBar.tsx +85 -85
  143. package/src/layout/TopBar.tsx +317 -217
  144. package/src/locales/arabic/adminLocalsAr.json +94 -93
  145. package/src/locales/arabic/common.json +44 -44
  146. package/src/locales/arabic/devLocalsAr.json +317 -317
  147. package/src/locales/arabic/index.ts +9 -9
  148. package/src/locales/english/adminLocalsEn.json +97 -96
  149. package/src/locales/english/common.json +43 -43
  150. package/src/locales/english/devLocalsEn.json +318 -318
  151. package/src/locales/english/index.ts +9 -9
  152. package/src/locales/i18n.ts +8 -8
  153. package/src/locales/index.ts +9 -9
  154. package/src/main.tsx +41 -23
  155. package/src/navigationItems/Administration/adminNavigationItems.tsx +231 -222
  156. package/src/navigationItems/Administration/index.tsx +16 -16
  157. package/src/navigationItems/common/CommonNavigationItems.tsx +12 -12
  158. package/src/navigationItems/common/index.tsx +7 -7
  159. package/src/navigationItems/index.tsx +35 -34
  160. package/src/redux/features/administration/AdministrationStoresMetaData.ts +164 -126
  161. package/src/redux/features/common/AppInfoSlice.ts +93 -63
  162. package/src/redux/features/common/AppLayoutSlice.ts +29 -29
  163. package/src/redux/features/common/CommonStoreSlice.ts +44 -44
  164. package/src/redux/features/common/LoadingMaskSlice.ts +30 -30
  165. package/src/redux/features/common/SideBarSlice.ts +27 -27
  166. package/src/redux/features/common/UserSessionSlice.ts +54 -54
  167. package/src/redux/store.ts +29 -29
  168. package/src/routes/administration/adminRoutes.tsx +99 -99
  169. package/src/routes/administration/devRoutes.tsx +129 -129
  170. package/src/routes/administration/index.ts +8 -8
  171. package/src/routes/index.ts +5 -11
  172. package/src/routes/types/index.ts +6 -5
  173. package/src/styles/index.css +19 -19
  174. package/src/types/index.ts +8 -7
  175. package/src/util/AppUtils.ts +73 -53
  176. package/src/util/constants.ts +6 -6
  177. package/src/util/index.ts +5 -2
  178. package/tsconfig.json +135 -135
  179. package/vite.config.ts +24 -23
@@ -1,478 +1,480 @@
1
- import { useState } from "react";
2
- import TemplateGrid from "../../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
- import {
4
- FormActionProps,
5
- FormElementProps,
6
- } from "../../templates/DataEntryTemplates/DataEntryTypes";
7
- import { useTranslation } from "react-i18next";
8
- import { useApiActions } from "../../../hooks";
9
- import { UseFormReturn } from "react-hook-form";
10
-
11
- type ValidationCritria = {
12
- isVisible: boolean;
13
- isMandatory: boolean;
14
- };
15
-
16
- export type EngineType = "Gmail" | "Azure";
17
-
18
- type ReportValidationOptions = {
19
- mailHost: ValidationCritria;
20
- mailPort: ValidationCritria;
21
- mailUsername: ValidationCritria;
22
- mailPassword: ValidationCritria;
23
- mailProtocol: ValidationCritria;
24
- isMailSmtpAuthEnabled: ValidationCritria;
25
- isMailStarttlsEnabled: ValidationCritria;
26
- isSmtpSSlEnabled: ValidationCritria;
27
- azureGraphApiClientId: ValidationCritria;
28
- azureGraphApiClientSecret: ValidationCritria;
29
- azureGraphApiTenantId: ValidationCritria;
30
- azureGraphApiScope: ValidationCritria;
31
- azureGraphApiEmailId: ValidationCritria;
32
- };
33
-
34
- type validationObjectType = {
35
- [key in EngineType]: ReportValidationOptions;
36
- };
37
-
38
- const validationObject: validationObjectType = {
39
- Gmail: {
40
- mailHost: { isMandatory: true, isVisible: true },
41
- mailPort: { isMandatory: true, isVisible: true },
42
- mailUsername: { isMandatory: true, isVisible: true },
43
- mailPassword: { isMandatory: true, isVisible: true },
44
- mailProtocol: { isMandatory: true, isVisible: true },
45
- isMailSmtpAuthEnabled: { isMandatory: true, isVisible: true },
46
- isMailStarttlsEnabled: { isMandatory: true, isVisible: true },
47
- isSmtpSSlEnabled: { isMandatory: true, isVisible: true },
48
- azureGraphApiClientId: { isMandatory: false, isVisible: false },
49
- azureGraphApiClientSecret: { isMandatory: false, isVisible: false },
50
- azureGraphApiTenantId: { isMandatory: false, isVisible: false },
51
- azureGraphApiScope: { isMandatory: false, isVisible: false },
52
- azureGraphApiEmailId: { isMandatory: false, isVisible: false },
53
- },
54
- Azure: {
55
- mailHost: { isMandatory: false, isVisible: false },
56
- mailPort: { isMandatory: false, isVisible: false },
57
- mailUsername: { isMandatory: false, isVisible: false },
58
- mailPassword: { isMandatory: false, isVisible: false },
59
- mailProtocol: { isMandatory: false, isVisible: false },
60
- isMailSmtpAuthEnabled: { isMandatory: false, isVisible: false },
61
- isMailStarttlsEnabled: { isMandatory: false, isVisible: false },
62
- isSmtpSSlEnabled: { isMandatory: false, isVisible: false },
63
- azureGraphApiClientId: { isMandatory: true, isVisible: true },
64
- azureGraphApiClientSecret: { isMandatory: true, isVisible: true },
65
- azureGraphApiTenantId: { isMandatory: true, isVisible: true },
66
- azureGraphApiScope: { isMandatory: true, isVisible: true },
67
- azureGraphApiEmailId: { isMandatory: true, isVisible: true },
68
- },
69
- };
70
-
71
- const adjustFormAccordingToEngineType = (
72
- value: any,
73
- formActions: FormActionProps,
74
- formManager: UseFormReturn
75
- ) => {
76
- if (value && validationObject[value]) {
77
- const validationObjects: ReportValidationOptions = validationObject[value];
78
- const fields = Object.keys(validationObjects);
79
- for (const field of fields) {
80
- const validationCritria: ValidationCritria = validationObjects[field];
81
- if (validationCritria.isVisible) {
82
- formActions.showField(field);
83
- } else {
84
- formActions.hideField(field);
85
- formManager.setValue(field, null);
86
- }
87
- }
88
- } else {
89
- formActions.hideField("mailHost");
90
- formManager.setValue("mailHost", null);
91
- formActions.hideField("mailPort");
92
- formManager.setValue("mailPort", null);
93
- formActions.hideField("mailUsername");
94
- formManager.setValue("mailUsername", null);
95
- formActions.hideField("mailPassword");
96
- formManager.setValue("mailPassword", null);
97
- formActions.hideField("mailProtocol");
98
- formManager.setValue("mailProtocol", null);
99
- formActions.hideField("isMailSmtpAuthEnabled");
100
- formManager.setValue("isMailSmtpAuthEnabled", null);
101
- formActions.hideField("isMailStarttlsEnabled");
102
- formManager.setValue("isMailStarttlsEnabled", null);
103
- formActions.hideField("isSmtpSSlEnabled");
104
- formManager.setValue("isSmtpSSlEnabled", null);
105
- formActions.hideField("azureGraphApiClientId");
106
- formManager.setValue("azureGraphApiClientId", null);
107
- formActions.hideField("azureGraphApiClientSecret");
108
- formManager.setValue("azureGraphApiClientSecret", null);
109
- formActions.hideField("azureGraphApiTenantId");
110
- formManager.setValue("azureGraphApiTenantId", null);
111
- formActions.hideField("azureGraphApiScope");
112
- formManager.setValue("azureGraphApiScope", null);
113
- formActions.hideField("azureGraphApiEmailId");
114
- formManager.setValue("azureGraphApiEmailId", null);
115
- }
116
- };
117
-
118
- const MailSenderConfigGrid: React.FC = () => {
119
- const { t } = useTranslation();
120
- const [data, setData] = useState([]);
121
- const apiActions = useApiActions({
122
- findAll: "api/v1/dev/mailsenderconfig/all",
123
- deleteById: "api/v1/dev/mailsenderconfig",
124
- save: "api/v1/dev/mailsenderconfig",
125
- findById: "api/v1/dev/mailsenderconfig",
126
- setData: setData,
127
- });
128
-
129
- const formElements: Array<FormElementProps> = [
130
- {
131
- type: "field",
132
- mode: "props",
133
- props: {
134
- fieldLabel: "id",
135
- fieldName: "id",
136
- fieldType: "number",
137
- hidden: true,
138
- gridProps: {
139
- hidden: true,
140
- },
141
- },
142
- },
143
- {
144
- type: "field",
145
- mode: "props",
146
- props: {
147
- fieldLabel: "createTime",
148
- fieldName: "createTime",
149
- fieldType: "datetime",
150
- hidden: true,
151
- gridProps: {
152
- hidden: true,
153
- },
154
- },
155
- },
156
- {
157
- type: "field",
158
- mode: "props",
159
- props: {
160
- fieldLabel: "createdBy",
161
- fieldName: "createdBy",
162
- fieldType: "text",
163
- hidden: true,
164
- gridProps: {
165
- hidden: true,
166
- },
167
- },
168
- },
169
- {
170
- type: "field",
171
- mode: "props",
172
- props: {
173
- fieldLabel: "lastUpdateBy",
174
- fieldName: "lastUpdateBy",
175
- fieldType: "text",
176
- hidden: true,
177
- gridProps: {
178
- hidden: true,
179
- },
180
- },
181
- },
182
- {
183
- type: "field",
184
- mode: "props",
185
- props: {
186
- fieldLabel: "lastUpdateTime",
187
- fieldName: "lastUpdateTime",
188
- fieldType: "datetime",
189
- hidden: true,
190
- gridProps: {
191
- hidden: true,
192
- },
193
- },
194
- },
195
- {
196
- type: "field",
197
- mode: "props",
198
- props: {
199
- fieldLabel: "Name",
200
- fieldName: "configName",
201
- required: true,
202
- fieldType: "text",
203
- },
204
- },
205
- {
206
- type: "field",
207
- mode: "props",
208
- props: {
209
- fieldLabel: "Engine",
210
- fieldName: "mailEngine",
211
- required: true,
212
- fieldType: "combobox",
213
- options: [{ value: "Gmail" }, { value: "Azure" }],
214
- optionDisplayField: "value",
215
- optionValueField: "value",
216
- formProps: {
217
- onValueChangeCallBack(
218
- value,
219
- formManager,
220
- formActions,
221
- selectedRecord
222
- ) {
223
- adjustFormAccordingToEngineType(value, formActions, formManager);
224
- },
225
- },
226
- },
227
- },
228
- {
229
- type: "field",
230
- mode: "props",
231
- props: {
232
- fieldLabel: "Hostname",
233
- fieldName: "mailHost",
234
- required: false,
235
- fieldType: "text",
236
- hidden: true,
237
- gridProps: {
238
- hidden: true,
239
- },
240
- },
241
- },
242
- {
243
- type: "field",
244
- mode: "props",
245
- props: {
246
- fieldLabel: "port",
247
- fieldName: "mailPort",
248
- required: false,
249
- fieldType: "number",
250
- hidden: true,
251
- gridProps: {
252
- hidden: true,
253
- },
254
- },
255
- },
256
- {
257
- type: "field",
258
- mode: "props",
259
- props: {
260
- fieldLabel: "username",
261
- fieldName: "mailUsername",
262
- required: false,
263
- fieldType: "text",
264
- hidden: true,
265
- gridProps: {
266
- hidden: true,
267
- },
268
- },
269
- },
270
- {
271
- type: "field",
272
- mode: "props",
273
- props: {
274
- fieldLabel: "password",
275
- fieldName: "mailPassword",
276
- required: false,
277
- fieldType: "text",
278
- hidden: true,
279
- gridProps: {
280
- hidden: true,
281
- },
282
- },
283
- },
284
-
285
- {
286
- type: "field",
287
- mode: "props",
288
- props: {
289
- fieldLabel: "Workflow Approval Receive Email",
290
- fieldName: "workFlowApprovalReceiveEmail",
291
- required: true,
292
- fieldType: "text",
293
- },
294
- },
295
- {
296
- type: "field",
297
- mode: "props",
298
- props: {
299
- fieldLabel: "Protocol",
300
- fieldName: "mailProtocol",
301
- required: false,
302
- fieldType: "text",
303
- hidden: true,
304
- gridProps: {
305
- hidden: true,
306
- },
307
- },
308
- },
309
-
310
- {
311
- type: "field",
312
- mode: "props",
313
- props: {
314
- fieldLabel: "Enable Smtp Auth",
315
- fieldName: "isMailSmtpAuthEnabled",
316
- required: false,
317
- fieldType: "checkbox",
318
- hidden: true,
319
- gridProps: {
320
- hidden: true,
321
- },
322
- },
323
- },
324
- {
325
- type: "field",
326
- mode: "props",
327
- props: {
328
- fieldLabel: "Enable Start TLS",
329
- fieldName: "isMailStarttlsEnabled",
330
- required: false,
331
- fieldType: "checkbox",
332
- hidden: true,
333
- gridProps: {
334
- hidden: true,
335
- },
336
- },
337
- },
338
- {
339
- type: "field",
340
- mode: "props",
341
- props: {
342
- fieldLabel: "Enable SSL",
343
- fieldName: "isSmtpSSlEnabled",
344
- required: false,
345
- fieldType: "checkbox",
346
- hidden: true,
347
- gridProps: {
348
- hidden: true,
349
- },
350
- },
351
- },
352
- {
353
- type: "field",
354
- mode: "props",
355
- props: {
356
- fieldLabel: "Azure Graph API Client Id",
357
- fieldName: "azureGraphApiClientId",
358
- required: false,
359
- fieldType: "text",
360
- hidden: true,
361
- gridProps: {
362
- hidden: true,
363
- },
364
- },
365
- },
366
- {
367
- type: "field",
368
- mode: "props",
369
- props: {
370
- fieldLabel: "Azure Graph API Secret",
371
- fieldName: "azureGraphApiClientSecret",
372
- required: false,
373
- fieldType: "text",
374
- hidden: true,
375
- gridProps: {
376
- hidden: true,
377
- },
378
- },
379
- },
380
- {
381
- type: "field",
382
- mode: "props",
383
- props: {
384
- fieldLabel: "Azure Graph API Tenant Id",
385
- fieldName: "azureGraphApiTenantId",
386
- required: false,
387
- fieldType: "text",
388
- hidden: true,
389
- gridProps: {
390
- hidden: true,
391
- },
392
- },
393
- },
394
- {
395
- type: "field",
396
- mode: "props",
397
- props: {
398
- fieldLabel: "Azure Graph API Scope",
399
- fieldName: "azureGraphApiScope",
400
- required: false,
401
- fieldType: "text",
402
- hidden: true,
403
- gridProps: {
404
- hidden: true,
405
- },
406
- },
407
- },
408
- {
409
- type: "field",
410
- mode: "props",
411
- props: {
412
- fieldLabel: "Azure Graph API Email Id",
413
- fieldName: "azureGraphApiEmailId",
414
- required: false,
415
- fieldType: "text",
416
- hidden: true,
417
- gridProps: {
418
- hidden: true,
419
- },
420
- },
421
- },
422
- {
423
- type: "field",
424
- mode: "props",
425
- props: {
426
- fieldLabel: "Default",
427
- fieldName: "isDefault",
428
- required: false,
429
- fieldType: "checkbox",
430
- },
431
- },
432
- {
433
- type: "field",
434
- mode: "props",
435
- props: {
436
- fieldLabel: "Active",
437
- fieldName: "isActive",
438
- required: false,
439
- fieldType: "checkbox",
440
- },
441
- },
442
- ];
443
-
444
- return (
445
- <TemplateGrid
446
- apiActions={apiActions}
447
- data={data}
448
- setData={setData}
449
- editMode={{
450
- editMode: "modal",
451
- specs: {
452
- modalIcon: { iconName: "paper-plane", prefix: "fas" },
453
- modalTitle: "Mail Sender Configuration",
454
- modalWidth: 300,
455
- },
456
- }}
457
- formElements={formElements}
458
- keyColumnName={"id"}
459
- gridTitle={t("Mail Sender Configuration")}
460
- girdIcon={{ iconName: "paper-plane", prefix: "fas" }}
461
- editAction={{ isEnabled: true, authority: "MAIL_SENDER_CONFIG_EDIT" }}
462
- deleteAction={{ isEnabled: true, authority: "MAIL_SENDER_CONFIG_DELETE" }}
463
- formLoadCallBk={(
464
- formActions: FormActionProps,
465
- formManager: UseFormReturn,
466
- record: any
467
- ) => {
468
- adjustFormAccordingToEngineType(
469
- record.mailEngine,
470
- formActions,
471
- formManager
472
- );
473
- }}
474
- />
475
- );
476
- };
477
-
478
- export default MailSenderConfigGrid;
1
+ import { useState } from "react";
2
+ import TemplateGrid from "../../templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid";
3
+ import {
4
+ FormActionProps,
5
+ FormElementProps,
6
+ } from "../../templates/DataEntryTemplates/DataEntryTypes";
7
+ import { useTranslation } from "react-i18next";
8
+ import { useApiActions } from "../../../hooks";
9
+ import { UseFormReturn } from "react-hook-form";
10
+
11
+ type ValidationCritria = {
12
+ isVisible: boolean;
13
+ isMandatory: boolean;
14
+ };
15
+
16
+ export type EngineType = "Gmail" | "Azure";
17
+
18
+ type ReportValidationOptions = {
19
+ mailHost: ValidationCritria;
20
+ mailPort: ValidationCritria;
21
+ mailUsername: ValidationCritria;
22
+ mailPassword: ValidationCritria;
23
+ mailProtocol: ValidationCritria;
24
+ isMailSmtpAuthEnabled: ValidationCritria;
25
+ isMailStarttlsEnabled: ValidationCritria;
26
+ isSmtpSSlEnabled: ValidationCritria;
27
+ azureGraphApiClientId: ValidationCritria;
28
+ azureGraphApiClientSecret: ValidationCritria;
29
+ azureGraphApiTenantId: ValidationCritria;
30
+ azureGraphApiScope: ValidationCritria;
31
+ azureGraphApiEmailId: ValidationCritria;
32
+ };
33
+
34
+ type validationObjectType = {
35
+ [key in EngineType]: ReportValidationOptions;
36
+ };
37
+
38
+ const validationObject: validationObjectType = {
39
+ Gmail: {
40
+ mailHost: { isMandatory: true, isVisible: true },
41
+ mailPort: { isMandatory: true, isVisible: true },
42
+ mailUsername: { isMandatory: true, isVisible: true },
43
+ mailPassword: { isMandatory: true, isVisible: true },
44
+ mailProtocol: { isMandatory: true, isVisible: true },
45
+ isMailSmtpAuthEnabled: { isMandatory: true, isVisible: true },
46
+ isMailStarttlsEnabled: { isMandatory: true, isVisible: true },
47
+ isSmtpSSlEnabled: { isMandatory: true, isVisible: true },
48
+ azureGraphApiClientId: { isMandatory: false, isVisible: false },
49
+ azureGraphApiClientSecret: { isMandatory: false, isVisible: false },
50
+ azureGraphApiTenantId: { isMandatory: false, isVisible: false },
51
+ azureGraphApiScope: { isMandatory: false, isVisible: false },
52
+ azureGraphApiEmailId: { isMandatory: false, isVisible: false },
53
+ },
54
+ Azure: {
55
+ mailHost: { isMandatory: false, isVisible: false },
56
+ mailPort: { isMandatory: false, isVisible: false },
57
+ mailUsername: { isMandatory: false, isVisible: false },
58
+ mailPassword: { isMandatory: false, isVisible: false },
59
+ mailProtocol: { isMandatory: false, isVisible: false },
60
+ isMailSmtpAuthEnabled: { isMandatory: false, isVisible: false },
61
+ isMailStarttlsEnabled: { isMandatory: false, isVisible: false },
62
+ isSmtpSSlEnabled: { isMandatory: false, isVisible: false },
63
+ azureGraphApiClientId: { isMandatory: true, isVisible: true },
64
+ azureGraphApiClientSecret: { isMandatory: true, isVisible: true },
65
+ azureGraphApiTenantId: { isMandatory: true, isVisible: true },
66
+ azureGraphApiScope: { isMandatory: true, isVisible: true },
67
+ azureGraphApiEmailId: { isMandatory: true, isVisible: true },
68
+ },
69
+ };
70
+
71
+ const adjustFormAccordingToEngineType = (
72
+ value: any,
73
+ formActions: FormActionProps,
74
+ formManager: UseFormReturn
75
+ ) => {
76
+ if (value && validationObject[value]) {
77
+ const validationObjects: ReportValidationOptions = validationObject[value];
78
+ const fields = Object.keys(validationObjects);
79
+ for (const field of fields) {
80
+ const validationCritria: ValidationCritria = validationObjects[field];
81
+ if (validationCritria.isVisible) {
82
+ formActions.showField(field);
83
+ } else {
84
+ formActions.hideField(field);
85
+ formManager.setValue(field, null);
86
+ }
87
+ }
88
+ } else {
89
+ formActions.hideField("mailHost");
90
+ formManager.setValue("mailHost", null);
91
+ formActions.hideField("mailPort");
92
+ formManager.setValue("mailPort", null);
93
+ formActions.hideField("mailUsername");
94
+ formManager.setValue("mailUsername", null);
95
+ formActions.hideField("mailPassword");
96
+ formManager.setValue("mailPassword", null);
97
+ formActions.hideField("mailProtocol");
98
+ formManager.setValue("mailProtocol", null);
99
+ formActions.hideField("isMailSmtpAuthEnabled");
100
+ formManager.setValue("isMailSmtpAuthEnabled", null);
101
+ formActions.hideField("isMailStarttlsEnabled");
102
+ formManager.setValue("isMailStarttlsEnabled", null);
103
+ formActions.hideField("isSmtpSSlEnabled");
104
+ formManager.setValue("isSmtpSSlEnabled", null);
105
+ formActions.hideField("azureGraphApiClientId");
106
+ formManager.setValue("azureGraphApiClientId", null);
107
+ formActions.hideField("azureGraphApiClientSecret");
108
+ formManager.setValue("azureGraphApiClientSecret", null);
109
+ formActions.hideField("azureGraphApiTenantId");
110
+ formManager.setValue("azureGraphApiTenantId", null);
111
+ formActions.hideField("azureGraphApiScope");
112
+ formManager.setValue("azureGraphApiScope", null);
113
+ formActions.hideField("azureGraphApiEmailId");
114
+ formManager.setValue("azureGraphApiEmailId", null);
115
+ }
116
+ };
117
+
118
+ const MailSenderConfigGrid: React.FC = () => {
119
+ const { t } = useTranslation();
120
+ const [data, setData] = useState([]);
121
+ const apiActions = useApiActions({
122
+ findAll: "api/v1/dev/mailsenderconfig/all",
123
+ deleteById: "api/v1/dev/mailsenderconfig",
124
+ save: "api/v1/dev/mailsenderconfig",
125
+ findById: "api/v1/dev/mailsenderconfig",
126
+ setData: setData,
127
+ });
128
+
129
+ const formElements: Array<FormElementProps> = [
130
+ {
131
+ type: "field",
132
+ mode: "props",
133
+ props: {
134
+ fieldLabel: "id",
135
+ fieldName: "id",
136
+ fieldType: "number",
137
+ hidden: true,
138
+ gridProps: {
139
+ hidden: true,
140
+ },
141
+ },
142
+ },
143
+ {
144
+ type: "field",
145
+ mode: "props",
146
+ props: {
147
+ fieldLabel: "createTime",
148
+ fieldName: "createTime",
149
+ fieldType: "datetime",
150
+ hidden: true,
151
+ gridProps: {
152
+ hidden: true,
153
+ },
154
+ },
155
+ },
156
+ {
157
+ type: "field",
158
+ mode: "props",
159
+ props: {
160
+ fieldLabel: "createdBy",
161
+ fieldName: "createdBy",
162
+ fieldType: "text",
163
+ hidden: true,
164
+ gridProps: {
165
+ hidden: true,
166
+ },
167
+ },
168
+ },
169
+ {
170
+ type: "field",
171
+ mode: "props",
172
+ props: {
173
+ fieldLabel: "lastUpdateBy",
174
+ fieldName: "lastUpdateBy",
175
+ fieldType: "text",
176
+ hidden: true,
177
+ gridProps: {
178
+ hidden: true,
179
+ },
180
+ },
181
+ },
182
+ {
183
+ type: "field",
184
+ mode: "props",
185
+ props: {
186
+ fieldLabel: "lastUpdateTime",
187
+ fieldName: "lastUpdateTime",
188
+ fieldType: "datetime",
189
+ hidden: true,
190
+ gridProps: {
191
+ hidden: true,
192
+ },
193
+ },
194
+ },
195
+ {
196
+ type: "field",
197
+ mode: "props",
198
+ props: {
199
+ fieldLabel: "Name",
200
+ fieldName: "configName",
201
+ required: true,
202
+ fieldType: "text",
203
+ },
204
+ },
205
+ {
206
+ type: "field",
207
+ mode: "props",
208
+ props: {
209
+ fieldLabel: "Engine",
210
+ fieldName: "mailEngine",
211
+ required: true,
212
+ fieldType: "combobox",
213
+ comboboxValueDataType: "string",
214
+ options: [{ value: "Gmail" }, { value: "Azure" }],
215
+ optionDisplayField: "value",
216
+ optionValueField: "value",
217
+ formProps: {
218
+ onValueChangeCallBack(
219
+ formValues,
220
+ value,
221
+ formManager,
222
+ formActions,
223
+ selectedRecord
224
+ ) {
225
+ adjustFormAccordingToEngineType(value, formActions, formManager);
226
+ },
227
+ },
228
+ },
229
+ },
230
+ {
231
+ type: "field",
232
+ mode: "props",
233
+ props: {
234
+ fieldLabel: "Hostname",
235
+ fieldName: "mailHost",
236
+ required: false,
237
+ fieldType: "text",
238
+ hidden: true,
239
+ gridProps: {
240
+ hidden: true,
241
+ },
242
+ },
243
+ },
244
+ {
245
+ type: "field",
246
+ mode: "props",
247
+ props: {
248
+ fieldLabel: "port",
249
+ fieldName: "mailPort",
250
+ required: false,
251
+ fieldType: "number",
252
+ hidden: true,
253
+ gridProps: {
254
+ hidden: true,
255
+ },
256
+ },
257
+ },
258
+ {
259
+ type: "field",
260
+ mode: "props",
261
+ props: {
262
+ fieldLabel: "username",
263
+ fieldName: "mailUsername",
264
+ required: false,
265
+ fieldType: "text",
266
+ hidden: true,
267
+ gridProps: {
268
+ hidden: true,
269
+ },
270
+ },
271
+ },
272
+ {
273
+ type: "field",
274
+ mode: "props",
275
+ props: {
276
+ fieldLabel: "password",
277
+ fieldName: "mailPassword",
278
+ required: false,
279
+ fieldType: "text",
280
+ hidden: true,
281
+ gridProps: {
282
+ hidden: true,
283
+ },
284
+ },
285
+ },
286
+
287
+ {
288
+ type: "field",
289
+ mode: "props",
290
+ props: {
291
+ fieldLabel: "Workflow Approval Receive Email",
292
+ fieldName: "workFlowApprovalReceiveEmail",
293
+ required: true,
294
+ fieldType: "text",
295
+ },
296
+ },
297
+ {
298
+ type: "field",
299
+ mode: "props",
300
+ props: {
301
+ fieldLabel: "Protocol",
302
+ fieldName: "mailProtocol",
303
+ required: false,
304
+ fieldType: "text",
305
+ hidden: true,
306
+ gridProps: {
307
+ hidden: true,
308
+ },
309
+ },
310
+ },
311
+
312
+ {
313
+ type: "field",
314
+ mode: "props",
315
+ props: {
316
+ fieldLabel: "Enable Smtp Auth",
317
+ fieldName: "isMailSmtpAuthEnabled",
318
+ required: false,
319
+ fieldType: "checkbox",
320
+ hidden: true,
321
+ gridProps: {
322
+ hidden: true,
323
+ },
324
+ },
325
+ },
326
+ {
327
+ type: "field",
328
+ mode: "props",
329
+ props: {
330
+ fieldLabel: "Enable Start TLS",
331
+ fieldName: "isMailStarttlsEnabled",
332
+ required: false,
333
+ fieldType: "checkbox",
334
+ hidden: true,
335
+ gridProps: {
336
+ hidden: true,
337
+ },
338
+ },
339
+ },
340
+ {
341
+ type: "field",
342
+ mode: "props",
343
+ props: {
344
+ fieldLabel: "Enable SSL",
345
+ fieldName: "isSmtpSSlEnabled",
346
+ required: false,
347
+ fieldType: "checkbox",
348
+ hidden: true,
349
+ gridProps: {
350
+ hidden: true,
351
+ },
352
+ },
353
+ },
354
+ {
355
+ type: "field",
356
+ mode: "props",
357
+ props: {
358
+ fieldLabel: "Azure Graph API Client Id",
359
+ fieldName: "azureGraphApiClientId",
360
+ required: false,
361
+ fieldType: "text",
362
+ hidden: true,
363
+ gridProps: {
364
+ hidden: true,
365
+ },
366
+ },
367
+ },
368
+ {
369
+ type: "field",
370
+ mode: "props",
371
+ props: {
372
+ fieldLabel: "Azure Graph API Secret",
373
+ fieldName: "azureGraphApiClientSecret",
374
+ required: false,
375
+ fieldType: "text",
376
+ hidden: true,
377
+ gridProps: {
378
+ hidden: true,
379
+ },
380
+ },
381
+ },
382
+ {
383
+ type: "field",
384
+ mode: "props",
385
+ props: {
386
+ fieldLabel: "Azure Graph API Tenant Id",
387
+ fieldName: "azureGraphApiTenantId",
388
+ required: false,
389
+ fieldType: "text",
390
+ hidden: true,
391
+ gridProps: {
392
+ hidden: true,
393
+ },
394
+ },
395
+ },
396
+ {
397
+ type: "field",
398
+ mode: "props",
399
+ props: {
400
+ fieldLabel: "Azure Graph API Scope",
401
+ fieldName: "azureGraphApiScope",
402
+ required: false,
403
+ fieldType: "text",
404
+ hidden: true,
405
+ gridProps: {
406
+ hidden: true,
407
+ },
408
+ },
409
+ },
410
+ {
411
+ type: "field",
412
+ mode: "props",
413
+ props: {
414
+ fieldLabel: "Azure Graph API Email Id",
415
+ fieldName: "azureGraphApiEmailId",
416
+ required: false,
417
+ fieldType: "text",
418
+ hidden: true,
419
+ gridProps: {
420
+ hidden: true,
421
+ },
422
+ },
423
+ },
424
+ {
425
+ type: "field",
426
+ mode: "props",
427
+ props: {
428
+ fieldLabel: "Default",
429
+ fieldName: "isDefault",
430
+ required: false,
431
+ fieldType: "checkbox",
432
+ },
433
+ },
434
+ {
435
+ type: "field",
436
+ mode: "props",
437
+ props: {
438
+ fieldLabel: "Active",
439
+ fieldName: "isActive",
440
+ required: false,
441
+ fieldType: "checkbox",
442
+ },
443
+ },
444
+ ];
445
+
446
+ return (
447
+ <TemplateGrid
448
+ apiActions={apiActions}
449
+ data={data}
450
+ setData={setData}
451
+ editMode={{
452
+ editMode: "modal",
453
+ specs: {
454
+ modalIcon: { iconName: "paper-plane", prefix: "fas" },
455
+ modalTitle: "Mail Sender Configuration",
456
+ modalWidth: 300,
457
+ },
458
+ }}
459
+ formElements={formElements}
460
+ keyColumnName={"id"}
461
+ gridTitle={t("Mail Sender Configuration")}
462
+ girdIcon={{ iconName: "paper-plane", prefix: "fas" }}
463
+ editAction={{ isEnabled: true, authority: "MAIL_SENDER_CONFIG_EDIT" }}
464
+ deleteAction={{ isEnabled: true, authority: "MAIL_SENDER_CONFIG_DELETE" }}
465
+ formLoadCallBk={(
466
+ formActions: FormActionProps,
467
+ formManager: UseFormReturn,
468
+ record: any
469
+ ) => {
470
+ adjustFormAccordingToEngineType(
471
+ record.mailEngine,
472
+ formActions,
473
+ formManager
474
+ );
475
+ }}
476
+ />
477
+ );
478
+ };
479
+
480
+ export default MailSenderConfigGrid;