@asaleh37/ui-base 25.6.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.
Files changed (161) hide show
  1. package/.github/workflows/publish-npm.yml +31 -0
  2. package/README.md +51 -51
  3. package/dist/index.d.ts +3 -0
  4. package/dist/index.js +6 -6
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +6 -6
  7. package/dist/index.mjs.map +1 -1
  8. package/eslint.config.js +29 -29
  9. package/index.html +13 -13
  10. package/package.json +120 -120
  11. package/rollup.config-1748377725725.cjs +50 -50
  12. package/rollup.config.js +45 -45
  13. package/src/components/App.tsx +123 -123
  14. package/src/components/BaseApp.tsx +53 -53
  15. package/src/components/administration/admin/OrgMemberRoleForm.tsx +83 -83
  16. package/src/components/administration/admin/OrganizationApplicationModuleGrid.tsx +107 -107
  17. package/src/components/administration/admin/OrganizationGrid.tsx +82 -82
  18. package/src/components/administration/admin/OrganizationMemberGrid.tsx +176 -176
  19. package/src/components/administration/admin/OrganizationMemberRoleGrid.tsx +87 -87
  20. package/src/components/administration/admin/OrganizationRankGrid.tsx +133 -133
  21. package/src/components/administration/admin/OrganizationUnitGrid.tsx +143 -143
  22. package/src/components/administration/admin/OrganizationUnitTypeGrid.tsx +108 -108
  23. package/src/components/administration/admin/PersonGrid.tsx +334 -231
  24. package/src/components/administration/admin/RoleAuthoritiesForm.tsx +82 -82
  25. package/src/components/administration/admin/SystemApplicationAuthorityGrid.tsx +117 -126
  26. package/src/components/administration/admin/SystemApplicationGrid.tsx +83 -83
  27. package/src/components/administration/admin/SystemApplicationModuleGrid.tsx +96 -96
  28. package/src/components/administration/admin/SystemApplicationRoleAuthorityGrid.tsx +75 -67
  29. package/src/components/administration/admin/SystemApplicationRoleGrid.tsx +116 -116
  30. package/src/components/administration/dev/AttachmentConfigGrid.tsx +223 -223
  31. package/src/components/administration/dev/AttachmentGrid.tsx +172 -172
  32. package/src/components/administration/dev/BluePrintGrid.tsx +129 -129
  33. package/src/components/administration/dev/DashboardGrid.tsx +173 -173
  34. package/src/components/administration/dev/DashboardWidgetGrid.tsx +164 -164
  35. package/src/components/administration/dev/DataQueryGrid.tsx +206 -206
  36. package/src/components/administration/dev/DataQueryParameterGrid.tsx +191 -191
  37. package/src/components/administration/dev/DataQueryParametersForm.tsx +84 -84
  38. package/src/components/administration/dev/DatasourceConnectionGrid.tsx +150 -150
  39. package/src/components/administration/dev/EntityParameterGrid.tsx +279 -279
  40. package/src/components/administration/dev/LookupGrid.tsx +120 -120
  41. package/src/components/administration/dev/MailAttachmentGrid.tsx +155 -155
  42. package/src/components/administration/dev/MailBodyGrid.tsx +216 -216
  43. package/src/components/administration/dev/MailNotificationQueueGrid.tsx +245 -245
  44. package/src/components/administration/dev/MailRecipientGrid.tsx +169 -169
  45. package/src/components/administration/dev/MailSenderConfigGrid.tsx +478 -478
  46. package/src/components/administration/dev/MailTemplateGrid.tsx +384 -384
  47. package/src/components/administration/dev/NotificationGrid.tsx +432 -432
  48. package/src/components/administration/dev/NotificationQueueGrid.tsx +222 -222
  49. package/src/components/administration/dev/ReportGrid.tsx +506 -506
  50. package/src/components/administration/dev/ReportParameterGrid.tsx +186 -186
  51. package/src/components/administration/dev/ReportParametersForm.tsx +84 -84
  52. package/src/components/administration/dev/WidgetGrid.tsx +431 -431
  53. package/src/components/administration/dev/WorkflowDocumentActionGrid.tsx +264 -264
  54. package/src/components/administration/dev/WorkflowDocumentActionHistoryGrid.tsx +172 -172
  55. package/src/components/administration/dev/WorkflowDocumentActionMailGrid.tsx +161 -161
  56. package/src/components/administration/dev/WorkflowDocumentGrid.tsx +377 -377
  57. package/src/components/administration/dev/WorkflowDocumentMailLogGrid.tsx +218 -218
  58. package/src/components/administration/dev/WorkflowDocumentStatusGrid.tsx +243 -243
  59. package/src/components/common/ChangeOrgForm.tsx +81 -81
  60. package/src/components/common/Home.tsx +43 -43
  61. package/src/components/common/LanguageSwitcher.tsx +25 -25
  62. package/src/components/common/LayoutHandlers.tsx +11 -11
  63. package/src/components/common/LoadingMask.tsx +24 -24
  64. package/src/components/common/Login.tsx +214 -214
  65. package/src/components/common/MyNotificationsPanel.tsx +103 -103
  66. package/src/components/common/NotificationItem.tsx +138 -138
  67. package/src/components/index.ts +9 -9
  68. package/src/components/templates/DataEntryTemplates/DataEntryTypes.ts +324 -324
  69. package/src/components/templates/DataEntryTemplates/DataEntryUtil.ts +248 -248
  70. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormAction.tsx +60 -60
  71. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementField.tsx +231 -231
  72. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementGroup.tsx +106 -106
  73. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/CheckBox.tsx +64 -64
  74. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/ComboBox.tsx +93 -93
  75. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/Datefield.tsx +65 -65
  76. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/DatetimeField.tsx +64 -64
  77. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/FiltersPanel.tsx +237 -237
  78. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/SystemLookupCombobox.tsx +55 -55
  79. package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/TemplateTextField.tsx +17 -17
  80. package/src/components/templates/DataEntryTemplates/TemplateDataForm/TemplateForm.tsx +387 -387
  81. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/DataGridColumnsUtil.tsx +189 -189
  82. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid.tsx +998 -998
  83. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridMultiRecordAction.tsx +89 -89
  84. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridRecordAction.tsx +95 -95
  85. package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridTopBar.tsx +227 -227
  86. package/src/components/templates/TransferList.tsx +257 -257
  87. package/src/components/templates/Window/ConfirmationWindow.tsx +55 -55
  88. package/src/components/templates/attachment/AttachmentCard.tsx +141 -141
  89. package/src/components/templates/attachment/AttachmentImageViewer.tsx +45 -45
  90. package/src/components/templates/attachment/AttachmentPanel.tsx +271 -271
  91. package/src/components/templates/index.ts +33 -33
  92. package/src/components/templates/report/ExcelReportViewer.tsx +71 -71
  93. package/src/components/templates/report/ReportViewer.tsx +382 -382
  94. package/src/components/templates/visuals/DashboardRouteView.tsx +9 -9
  95. package/src/components/templates/visuals/DashboardViewer.tsx +148 -148
  96. package/src/components/templates/visuals/WidgetViewer.tsx +198 -198
  97. package/src/components/templates/visuals/charts/TemplateBarChart.tsx +23 -23
  98. package/src/components/templates/visuals/charts/TemplateDataCard.tsx +35 -35
  99. package/src/components/templates/visuals/charts/TemplateGauge.tsx +21 -21
  100. package/src/components/templates/visuals/charts/TemplateLineChart.tsx +22 -22
  101. package/src/components/templates/visuals/charts/TemplateLineProgress.tsx +42 -42
  102. package/src/components/templates/visuals/charts/TemplatePieChart.tsx +24 -24
  103. package/src/components/templates/workflow/WorkflowDocumentPanel.tsx +606 -606
  104. package/src/components/templates/workflow/WorkflowDocumentTimeLine.tsx +140 -140
  105. package/src/components/templates/workflow/WorkflowRouteComponent.tsx +14 -14
  106. package/src/hooks/UseConfirmationWindow.tsx +54 -54
  107. package/src/hooks/UseMobile.tsx +13 -13
  108. package/src/hooks/UseSession.tsx +59 -40
  109. package/src/hooks/UseWindow.tsx +107 -107
  110. package/src/hooks/index.ts +7 -7
  111. package/src/hooks/useApiActions.ts +124 -124
  112. package/src/hooks/useAxios.tsx +316 -316
  113. package/src/hooks/useInterval.tsx +23 -23
  114. package/src/hooks/useLoadingMask.tsx +16 -16
  115. package/src/hooks/useLookupGridColumn.tsx +35 -35
  116. package/src/index.ts +4 -4
  117. package/src/layout/DrawerHeader.tsx +10 -10
  118. package/src/layout/Layout.tsx +90 -90
  119. package/src/layout/MainContent.tsx +117 -114
  120. package/src/layout/MobileDrawer.tsx +103 -103
  121. package/src/layout/NavigationTree.tsx +298 -295
  122. package/src/layout/NotificationButton.tsx +207 -207
  123. package/src/layout/RouteWrapper.tsx +63 -36
  124. package/src/layout/SideBar.tsx +85 -85
  125. package/src/layout/TopBar.tsx +215 -215
  126. package/src/locales/arabic/adminLocalsAr.json +93 -93
  127. package/src/locales/arabic/common.json +44 -44
  128. package/src/locales/arabic/devLocalsAr.json +317 -317
  129. package/src/locales/arabic/index.ts +9 -9
  130. package/src/locales/english/adminLocalsEn.json +96 -96
  131. package/src/locales/english/common.json +43 -43
  132. package/src/locales/english/devLocalsEn.json +318 -318
  133. package/src/locales/english/index.ts +9 -9
  134. package/src/locales/i18n.ts +8 -8
  135. package/src/locales/index.ts +9 -9
  136. package/src/main.tsx +23 -23
  137. package/src/navigationItems/Administration/adminNavigationItems.tsx +223 -222
  138. package/src/navigationItems/Administration/index.tsx +16 -16
  139. package/src/navigationItems/common/CommonNavigationItems.tsx +12 -12
  140. package/src/navigationItems/common/index.tsx +7 -7
  141. package/src/navigationItems/index.tsx +35 -34
  142. package/src/redux/features/administration/AdministrationStoresMetaData.ts +148 -126
  143. package/src/redux/features/common/AppInfoSlice.ts +63 -63
  144. package/src/redux/features/common/AppLayoutSlice.ts +29 -29
  145. package/src/redux/features/common/CommonStoreSlice.ts +44 -44
  146. package/src/redux/features/common/LoadingMaskSlice.ts +30 -30
  147. package/src/redux/features/common/SideBarSlice.ts +27 -27
  148. package/src/redux/features/common/UserSessionSlice.ts +54 -54
  149. package/src/redux/store.ts +29 -29
  150. package/src/routes/administration/adminRoutes.tsx +99 -99
  151. package/src/routes/administration/devRoutes.tsx +129 -129
  152. package/src/routes/administration/index.ts +8 -8
  153. package/src/routes/index.ts +11 -11
  154. package/src/routes/types/index.ts +6 -5
  155. package/src/styles/index.css +19 -19
  156. package/src/types/index.ts +8 -8
  157. package/src/util/AppUtils.ts +53 -53
  158. package/src/util/constants.ts +6 -6
  159. package/src/util/index.ts +2 -2
  160. package/tsconfig.json +135 -135
  161. package/vite.config.ts +24 -36
@@ -1,478 +1,478 @@
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
+ 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;