@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,581 @@
1
+ import { useEffect, useState } from "react";
2
+ import { useAxios, useSession, useWindow } from "../../../hooks";
3
+ import { Avatar, Box, Button, Divider, Grid2, Paper } from "@mui/material";
4
+ import TemplateTextField from "../DataEntryTemplates/TemplateDataForm/FormFields/TemplateTextField";
5
+ import ComboBox from "../DataEntryTemplates/TemplateDataForm/FormFields/ComboBox";
6
+ import { useSelector } from "react-redux";
7
+ import { useTranslation } from "react-i18next";
8
+ import WorkflowDocumentTimeLine from "./WorkflowDocumentTimeLine";
9
+ import { toast } from "react-toastify";
10
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
11
+ import ReportViewer from "../report/ReportViewer";
12
+
13
+ type WorkflowDocumentPanelProps = {
14
+ workFlowDocumentCode: string;
15
+ refDocumentId: any;
16
+ postActionCallBk?: () => void;
17
+ cancelActionCallBk?: () => void;
18
+ };
19
+
20
+ export type workflowDocumentAction = {
21
+ id: number;
22
+ document_action_code: string;
23
+ document_action_ar_name: string;
24
+ document_action_en_name: string;
25
+ post_action_endpoint?: string;
26
+ pre_action_endpoint?: string;
27
+ next_document_status_id?: number;
28
+ next_action_takers?: Array<person>;
29
+ require_comment: any;
30
+ };
31
+
32
+ export type person = {
33
+ id: number;
34
+ email: string;
35
+ employeeArName: string;
36
+ employeeEnName: string;
37
+ mobileNumber: string;
38
+ username: string;
39
+ };
40
+
41
+ export type workflowDocumentActionHistory = {
42
+ id: number;
43
+ actionTime: string;
44
+ actionMethod: string;
45
+ actionComment: string;
46
+ documentActionArName: string;
47
+ documentActionEnName: string;
48
+ employeeArName: string;
49
+ employeeEnName: string;
50
+ };
51
+
52
+ type WorkflowDocumentInfo = {
53
+ workflowDocument: any;
54
+ referencedDocument: any;
55
+ workflowDocumentReport: any;
56
+ workflowDocumentStatus: any;
57
+ actionsHistory: Array<workflowDocumentActionHistory>;
58
+ nextActions: Array<workflowDocumentAction>;
59
+ nextActionTakers: any;
60
+ };
61
+
62
+ const WorkflowDocumentPanel: React.FC<WorkflowDocumentPanelProps> = (props) => {
63
+ const AppLayout = useSelector((state: any) => state.AppLayout);
64
+ const { isUserAuthorized, UserInfo } = useSession();
65
+ const { handleGetRequest, handlePostRequest } = useAxios();
66
+ const [action, setAction] = useState<workflowDocumentAction>(null);
67
+ const [authorizedActions, setAuthorizedActions] = useState<
68
+ Array<workflowDocumentAction>
69
+ >([]);
70
+ const { t } = useTranslation();
71
+ const [actionComment, setActionComment] = useState(null);
72
+ const [workflowDocumentInfo, setWorkflowDocumentInfo] =
73
+ useState<WorkflowDocumentInfo>({
74
+ referencedDocument: null,
75
+ workflowDocumentReport: null,
76
+ workflowDocument: null,
77
+ workflowDocumentStatus: null,
78
+ actionsHistory: [],
79
+ nextActionTakers: null,
80
+ nextActions: [],
81
+ });
82
+ const { Window: ReporTViewWindow, setWindowState: setReportViewWindowState } =
83
+ useWindow({
84
+ windowTitle:
85
+ AppLayout.appDirection === "ltr"
86
+ ? workflowDocumentInfo?.workflowDocument &&
87
+ workflowDocumentInfo?.referencedDocument
88
+ ? `${workflowDocumentInfo?.workflowDocument?.documentEnName} # ${
89
+ workflowDocumentInfo?.referencedDocument[
90
+ workflowDocumentInfo?.workflowDocument?.documentNumberField
91
+ ]
92
+ }`
93
+ : "Document"
94
+ : workflowDocumentInfo?.workflowDocument &&
95
+ workflowDocumentInfo?.referencedDocument
96
+ ? `${workflowDocumentInfo?.workflowDocument?.documentArName} # ${
97
+ workflowDocumentInfo?.referencedDocument[
98
+ workflowDocumentInfo?.workflowDocument?.documentNumberField
99
+ ]
100
+ }`
101
+ : "وثيقة",
102
+ windowIcon: "eye",
103
+ width: "80%",
104
+ });
105
+ const loadWorkFlowDocumentInfo = async () => {
106
+ await handleGetRequest({
107
+ endPointURI: "api/v1/dev/workflow/doc/info",
108
+ showMask: true,
109
+ parameters: {
110
+ workflowDocumentCode: props.workFlowDocumentCode,
111
+ refDocumentId: props.refDocumentId,
112
+ },
113
+ successCallBkFn: (response: any) => {
114
+ setWorkflowDocumentInfo(response.data);
115
+ },
116
+ failureCallBkFn: () => {
117
+ setWorkflowDocumentInfo({
118
+ referencedDocument: null,
119
+ workflowDocumentReport: null,
120
+ workflowDocument: null,
121
+ workflowDocumentStatus: null,
122
+ actionsHistory: [],
123
+ nextActions: [],
124
+ nextActionTakers: null,
125
+ });
126
+ },
127
+ });
128
+ };
129
+
130
+ const validateBeforeProcessWorkflowDocumentAction = async () => {
131
+ if (
132
+ action === undefined ||
133
+ action === null ||
134
+ action?.id === undefined ||
135
+ action?.id === null
136
+ ) {
137
+ toast.error("You must select action to process");
138
+ return;
139
+ }
140
+ if (
141
+ (action.require_comment === true ||
142
+ action.require_comment === 1 ||
143
+ action.require_comment === "true") &&
144
+ (actionComment === null || actionComment === "")
145
+ ) {
146
+ toast.error("You must enter comment for the action to be processed");
147
+ return;
148
+ }
149
+ if (action?.pre_action_endpoint) {
150
+ await handlePostRequest({
151
+ endPointURI: action.pre_action_endpoint,
152
+ showMask: true,
153
+ loadingMessage: "Processing pre action validation ... please wait",
154
+ parameters: {
155
+ refDocumentId: props.refDocumentId,
156
+ actionId: action.id,
157
+ },
158
+ successCallBkFn: () => {
159
+ processWorkflowDocumentAction();
160
+ },
161
+ });
162
+ return;
163
+ }
164
+ processWorkflowDocumentAction();
165
+ };
166
+ const processWorkflowDocumentAction = async () => {
167
+ await handlePostRequest({
168
+ endPointURI: "api/v1/dev/workflow/doc/action",
169
+ showMask: true,
170
+ data: {
171
+ workflowDocumentId: workflowDocumentInfo?.workflowDocument?.id,
172
+ refDocumentId: props.refDocumentId,
173
+ actionId: action.id,
174
+ refDocumentStatus:
175
+ workflowDocumentInfo?.workflowDocumentStatus?.documentStatusCode,
176
+ actionComment: actionComment,
177
+ },
178
+ successCallBkFn: async (response) => {
179
+ if (action?.post_action_endpoint) {
180
+ await handlePostRequest({
181
+ endPointURI: action.post_action_endpoint,
182
+ showMask: true,
183
+ loadingMessage: "Processing post action process ... please wait",
184
+ parameters: {
185
+ refDocumentId: props.refDocumentId,
186
+ actionId: action.id,
187
+ },
188
+ successCallBkFn: () => {
189
+ loadWorkFlowDocumentInfo();
190
+ },
191
+ });
192
+ return;
193
+ }
194
+ loadWorkFlowDocumentInfo();
195
+ },
196
+ });
197
+ };
198
+
199
+ const adjustAuthorizedActions = () => {
200
+ if (workflowDocumentInfo?.nextActions?.length > 0) {
201
+ setAuthorizedActions(
202
+ workflowDocumentInfo.nextActions.filter((action) => {
203
+ if (
204
+ !(
205
+ workflowDocumentInfo?.workflowDocumentStatus
206
+ ?.nextActionTakersAuthority ||
207
+ workflowDocumentInfo?.nextActionTakers
208
+ )
209
+ ) {
210
+ return true;
211
+ }
212
+ if (
213
+ workflowDocumentInfo?.workflowDocumentStatus
214
+ ?.nextActionTakersAuthority
215
+ ) {
216
+ if (
217
+ isUserAuthorized(
218
+ workflowDocumentInfo.workflowDocumentStatus
219
+ .nextActionTakersAuthority
220
+ )
221
+ ) {
222
+ return true;
223
+ }
224
+ }
225
+ if (workflowDocumentInfo?.nextActionTakers) {
226
+ for (const actionTaker of workflowDocumentInfo.nextActionTakers) {
227
+ if (
228
+ UserInfo?.username === actionTaker?.username ||
229
+ UserInfo?.username === actionTaker?.USERNAME
230
+ ) {
231
+ return true;
232
+ }
233
+ }
234
+ }
235
+ return false;
236
+ })
237
+ );
238
+ } else {
239
+ setAuthorizedActions([]);
240
+ }
241
+ };
242
+
243
+ useEffect(() => {
244
+ if (props.refDocumentId && props.workFlowDocumentCode) {
245
+ loadWorkFlowDocumentInfo();
246
+ }
247
+ }, [props.refDocumentId, props.workFlowDocumentCode]);
248
+
249
+ useEffect(() => {
250
+ if (workflowDocumentInfo?.nextActions) {
251
+ adjustAuthorizedActions();
252
+ } else {
253
+ setAuthorizedActions([]);
254
+ }
255
+ }, [workflowDocumentInfo.nextActions, workflowDocumentInfo.nextActionTakers]);
256
+ return (
257
+ <>
258
+ {workflowDocumentInfo?.workflowDocumentReport?.id ? (
259
+ <ReporTViewWindow>
260
+ <ReportViewer
261
+ reportCode={
262
+ workflowDocumentInfo?.workflowDocumentReport?.reportCode
263
+ }
264
+ resultMode="App"
265
+ byPassParameterEntry={true}
266
+ reportParametersValues={{ doc_id: props.refDocumentId+'' }}
267
+ />
268
+ </ReporTViewWindow>
269
+ ) : (
270
+ <></>
271
+ )}
272
+
273
+ {workflowDocumentInfo?.workflowDocument ? (
274
+ <Box
275
+ sx={{
276
+ width: "100%",
277
+ textAlign: "center",
278
+ fontSize: 20,
279
+ fontWeight: "bold",
280
+ display: "flex",
281
+ alignItems: "center",
282
+ justifyContent: "center",
283
+ }}
284
+ >
285
+ <Box sx={{ flex: 1 }}></Box>
286
+ <FontAwesomeIcon
287
+ icon="file"
288
+ style={{ marginRight: 10, marginLeft: 10 }}
289
+ />
290
+ {AppLayout.appDirection === "ltr"
291
+ ? `${workflowDocumentInfo?.workflowDocument?.documentEnName} # ${
292
+ workflowDocumentInfo?.referencedDocument[
293
+ workflowDocumentInfo?.workflowDocument?.documentNumberField
294
+ ]
295
+ }`
296
+ : `${workflowDocumentInfo?.workflowDocument?.documentArName} # ${
297
+ workflowDocumentInfo?.referencedDocument[
298
+ workflowDocumentInfo?.workflowDocument?.documentNumberField
299
+ ]
300
+ }`}
301
+ {workflowDocumentInfo?.workflowDocumentStatus
302
+ ? AppLayout.appDirection === "ltr"
303
+ ? ` ( ${workflowDocumentInfo?.workflowDocumentStatus?.documentStatusEnName} )`
304
+ : ` ( ${workflowDocumentInfo?.workflowDocumentStatus?.documentStatusArName} )`
305
+ : ""}
306
+ <Box sx={{ flex: 1 }}></Box>
307
+ {workflowDocumentInfo?.workflowDocumentReport?.id ? (
308
+ <Button
309
+ onClick={() => {
310
+ setReportViewWindowState(true);
311
+ }}
312
+ variant="outlined"
313
+ startIcon={<FontAwesomeIcon icon="eye" />}
314
+ >
315
+ {t("VIEW_LABEL")}
316
+ </Button>
317
+ ) : (
318
+ <></>
319
+ )}
320
+ </Box>
321
+ ) : (
322
+ <></>
323
+ )}
324
+
325
+ <Box
326
+ sx={{
327
+ flex: 1,
328
+ width: "100%",
329
+ overflow: "hidden",
330
+ display: "flex",
331
+ // flexDirection: "column",
332
+ }}
333
+ >
334
+ {authorizedActions?.length > 0 ? (
335
+ <Paper
336
+ sx={{
337
+ padding: 2,
338
+ display: "flex",
339
+ flex: 1,
340
+ margin: 1,
341
+ flexDirection: "column",
342
+ alignItems: "center",
343
+ justifyContent: "flex-start",
344
+ overflow: "hidden",
345
+ }}
346
+ >
347
+ <ComboBox
348
+ sx={{ marginBottom: 2, width: 400 }}
349
+ label={t("WE_AVAILABLE_ACTIONS_LABEL")}
350
+ displayField={
351
+ AppLayout.appDirection === "ltr"
352
+ ? "document_action_en_name"
353
+ : "document_action_ar_name"
354
+ }
355
+ valueField={"id"}
356
+ value={action?.id}
357
+ options={authorizedActions}
358
+ onChangeCallBack={(v, selectedRecord) => {
359
+ setAction(selectedRecord);
360
+ }}
361
+ />
362
+ {/* <ComboBox
363
+ sx={{ marginBottom: 2, width: 400 }}
364
+ label={t("WE_NEXT_APPROVER_LABEL")}
365
+ displayField={
366
+ AppLayout.appDirection === "ltr"
367
+ ? "employeeEnName"
368
+ : "employeeArName"
369
+ }
370
+ valueField={"id"}
371
+ value={nextActionTaker?.id}
372
+ options={action?.nextActionTakers || []}
373
+ onChangeCallBack={(v, selectedRecord) => {
374
+ setNextActionTaker(selectedRecord);
375
+ }}
376
+ /> */}
377
+ <TemplateTextField
378
+ sx={{ width: 400 }}
379
+ rows={3}
380
+ value={actionComment}
381
+ onChange={(event) => {
382
+ setActionComment(event.target.value);
383
+ }}
384
+ multiline={true}
385
+ label={t("WF_COMMENT_LABEL")}
386
+ />
387
+ <Box
388
+ sx={{
389
+ display: "flex",
390
+ alignItems: "center",
391
+ justifyContent: "center",
392
+ }}
393
+ >
394
+ <Button
395
+ color="success"
396
+ variant="contained"
397
+ sx={{ width: 200, m: 1 }}
398
+ onClick={validateBeforeProcessWorkflowDocumentAction}
399
+ >
400
+ {t("WF_TAKE_ACTION_BTN_LABEL")}
401
+ </Button>
402
+ {props?.cancelActionCallBk ? (
403
+ <Button
404
+ variant="contained"
405
+ sx={{ width: 200, m: 1 }}
406
+ color="error"
407
+ onClick={() => {
408
+ if (props?.cancelActionCallBk) {
409
+ props.cancelActionCallBk();
410
+ }
411
+ }}
412
+ >
413
+ {t("WF_CANCEL_BTN_LABEL")}
414
+ </Button>
415
+ ) : (
416
+ <></>
417
+ )}
418
+ </Box>
419
+ {workflowDocumentInfo?.nextActionTakers &&
420
+ workflowDocumentInfo.nextActionTakers.length > 0 ? (
421
+ <>
422
+ <Divider
423
+ variant="fullWidth"
424
+ flexItem
425
+ sx={{ marginTop: 1, marginBottom: 1 }}
426
+ >
427
+ <Box
428
+ sx={{
429
+ width: "100%",
430
+ display: "flex",
431
+ alignItems: "center",
432
+ justifyContent: "center",
433
+ fontSize: 18,
434
+ fontWeight: "bold",
435
+ }}
436
+ >
437
+ <FontAwesomeIcon
438
+ icon="users"
439
+ style={{ marginRight: 10, marginLeft: 10 }}
440
+ />{" "}
441
+ {t("WF_WAITING_FOR_LABEL")}
442
+ </Box>
443
+ </Divider>
444
+
445
+ <Box
446
+ sx={{
447
+ flex: 1,
448
+ display: "flex",
449
+ flexDirection: "column",
450
+ alignItems: "center",
451
+ overflow: "auto",
452
+ padding: 1,
453
+ width: "100%",
454
+ }}
455
+ >
456
+ {workflowDocumentInfo.nextActionTakers.map(
457
+ (nextActionTaker: any) => {
458
+ return (
459
+ <Box
460
+ sx={{
461
+ display: "flex",
462
+ alignItems: "center",
463
+ justifyContent: "center",
464
+ border: "1px dotted black",
465
+ width: 400,
466
+ marginBottom: 2,
467
+ padding: 2,
468
+ }}
469
+ >
470
+ <Avatar
471
+ sx={{
472
+ marginRight: 2,
473
+ marginLeft: 2,
474
+ width: 60,
475
+ height: 60,
476
+ }}
477
+ />
478
+ <Box
479
+ sx={{
480
+ flex: 2,
481
+ display: "flex",
482
+ flexDirection: "column",
483
+ alignItems: "flex-start",
484
+ justifyContent: "center",
485
+ }}
486
+ >
487
+ <div>
488
+ {AppLayout.appDirection === "ltr"
489
+ ? nextActionTaker?.employee_en_name
490
+ : nextActionTaker?.employee_ar_name}
491
+ </div>
492
+ <div>
493
+ {nextActionTaker?.email ? (
494
+ <>
495
+ <FontAwesomeIcon
496
+ icon="envelope"
497
+ style={{ marginRight: 10, marginLeft: 10 }}
498
+ />
499
+ {nextActionTaker?.email}
500
+ </>
501
+ ) : (
502
+ <></>
503
+ )}
504
+ </div>
505
+ <div>
506
+ {nextActionTaker?.mobile_number ? (
507
+ <>
508
+ <FontAwesomeIcon
509
+ icon="mobile"
510
+ style={{ marginRight: 10, marginLeft: 10 }}
511
+ />
512
+ {nextActionTaker?.mobile_number}
513
+ </>
514
+ ) : (
515
+ <></>
516
+ )}
517
+ </div>
518
+ </Box>
519
+ </Box>
520
+ );
521
+ }
522
+ )}
523
+ </Box>
524
+ </>
525
+ ) : (
526
+ <></>
527
+ )}
528
+ </Paper>
529
+ ) : (
530
+ <></>
531
+ )}
532
+ {workflowDocumentInfo?.actionsHistory.length > 0 ? (
533
+ <WorkflowDocumentTimeLine
534
+ actionHistory={workflowDocumentInfo.actionsHistory}
535
+ />
536
+ ) : (
537
+ <Paper
538
+ sx={{
539
+ display: "flex",
540
+ flexDirection: "column",
541
+ flexGrow: 1,
542
+ padding: 2,
543
+ margin: 1,
544
+ alignItems: "center",
545
+ justifyContent: "center",
546
+ }}
547
+ >
548
+ <Box
549
+ sx={{
550
+ width: "100%",
551
+ display: "flex",
552
+ alignItems: "center",
553
+ justifyContent: "center",
554
+ fontSize: 18,
555
+ fontWeight: "bold",
556
+ }}
557
+ >
558
+ <FontAwesomeIcon
559
+ icon="history"
560
+ style={{ marginRight: 10, marginLeft: 10 }}
561
+ />
562
+ {t("WF_ACTION_HISTORY_LABEL")}
563
+ </Box>
564
+ <Box
565
+ sx={{
566
+ flex: 1,
567
+ display: "flex",
568
+ alignItems: "center",
569
+ justifyContent: "center",
570
+ }}
571
+ >
572
+ No Action Log available
573
+ </Box>
574
+ </Paper>
575
+ )}
576
+ </Box>
577
+ </>
578
+ );
579
+ };
580
+
581
+ export default WorkflowDocumentPanel;
@@ -0,0 +1,134 @@
1
+ import Typography from "@mui/material/Typography";
2
+ import { workflowDocumentActionHistory } from "./WorkflowDocumentPanel";
3
+ import { useSelector } from "react-redux";
4
+ import { Avatar, Box, Divider, Paper, Stack } from "@mui/material";
5
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
6
+ import { useTranslation } from "react-i18next";
7
+
8
+ type WorkflowDocumentTimeLineProp = {
9
+ actionHistory: Array<workflowDocumentActionHistory>;
10
+ };
11
+
12
+ const WorkflowDocumentTimeLine: React.FC<WorkflowDocumentTimeLineProp> = (
13
+ props
14
+ ) => {
15
+ const AppLayout = useSelector((state: any) => state.AppLayout);
16
+ const { t } = useTranslation();
17
+ return (
18
+ <Paper
19
+ sx={{
20
+ display: "flex",
21
+ flexDirection: "column",
22
+ flexGrow: 1,
23
+ padding: 1,
24
+ margin: 1,
25
+ alignItems: "center",
26
+ justifyContent: "center",
27
+ }}
28
+ >
29
+ <Box
30
+ sx={{
31
+ width: "100%",
32
+ display: "flex",
33
+ alignItems: "center",
34
+ justifyContent: "center",
35
+ fontSize: 18,
36
+ fontWeight: "bold",
37
+ }}
38
+ >
39
+ <FontAwesomeIcon
40
+ icon="history"
41
+ style={{ marginRight: 10, marginLeft: 10 }}
42
+ />
43
+ {t("WF_ACTION_HISTORY_LABEL")}
44
+ </Box>
45
+ <Box
46
+ sx={{
47
+ flexGrow: 1,
48
+ width: "100%",
49
+ display: "flex",
50
+ flexDirection: "column",
51
+ overflowY: "auto",
52
+ alignItems: "center",
53
+ justifyContent: "flex-start",
54
+ }}
55
+ >
56
+ {props.actionHistory.map((actionHistoryRecord, index) => {
57
+ return (
58
+ <>
59
+ <Box
60
+ sx={{
61
+ display: "flex",
62
+ alignItems: "center",
63
+ justifyContent: "center",
64
+ width: "100%",
65
+ marginBottom: 2,
66
+ }}
67
+ >
68
+ <Box
69
+ sx={{
70
+ display: "flex",
71
+ flex: 1,
72
+ flexDirection: "column",
73
+ alignItems: "flex-end",
74
+ justifyContent: "center",
75
+ }}
76
+ >
77
+ <Box sx={{ marginBottom: 0.2 }}>
78
+ {actionHistoryRecord.actionTime}
79
+ </Box>
80
+ <Typography>
81
+ via {actionHistoryRecord.actionMethod}
82
+ </Typography>
83
+ </Box>
84
+ <Box
85
+ sx={{
86
+ display: "flex",
87
+ flexDirection: "column",
88
+ alignItems: "center",
89
+ justifyContent: "center",
90
+ position: "relative",
91
+ marginRight: 2,
92
+ marginLeft: 2,
93
+ }}
94
+ >
95
+ <Avatar sx={{ m: 1, width: 70, height: 70 }} />
96
+ {index !== props.actionHistory.length - 1 ? (
97
+ <Box sx={{ marginTop: 11, position: "absolute" }}>|</Box>
98
+ ) : (
99
+ <></>
100
+ )}
101
+ </Box>
102
+ <Box
103
+ sx={{
104
+ display: "flex",
105
+ flex: 1,
106
+ flexDirection: "column",
107
+ alignItems: "flex-start",
108
+ justifyContent: "center",
109
+ }}
110
+ >
111
+ <Box sx={{ width: "100%" }}>
112
+ {AppLayout.appDirection === "ltr"
113
+ ? `${actionHistoryRecord?.documentActionEnName}`
114
+ : `${actionHistoryRecord?.documentActionArName}`}
115
+ {actionHistoryRecord?.actionComment
116
+ ? " - " + actionHistoryRecord.actionComment
117
+ : ""}
118
+ </Box>
119
+ <Box sx={{ width: "100%" }}>
120
+ {AppLayout.appDirection === "ltr"
121
+ ? `${actionHistoryRecord?.employeeEnName}`
122
+ : `${actionHistoryRecord?.employeeArName}`}
123
+ </Box>
124
+ </Box>
125
+ </Box>
126
+ </>
127
+ );
128
+ })}
129
+ </Box>
130
+ </Paper>
131
+ );
132
+ };
133
+
134
+ export default WorkflowDocumentTimeLine;