@asaleh37/ui-base 25.8.1-4 → 25.8.1-6

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