@asaleh37/ui-base 1.2.16 → 1.2.18
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.
- package/.env.development +1 -1
- package/dist/index.d.ts +27 -5
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/public/no_image.png +0 -0
- package/src/components/administration/admin/OrganizationApplicationModuleGrid.tsx +10 -34
- package/src/components/administration/admin/OrganizationGrid.tsx +4 -87
- package/src/components/administration/admin/OrganizationRankGrid.tsx +34 -16
- package/src/components/administration/admin/OrganizationUnitGrid.tsx +34 -30
- package/src/components/administration/admin/OrganizationUnitTypeGrid.tsx +3 -16
- package/src/components/administration/admin/PersonGrid.tsx +38 -1
- package/src/components/administration/admin/RoleAuthoritiesForm.tsx +2 -4
- package/src/components/administration/admin/SystemApplicationAuthorityGrid.tsx +2 -18
- package/src/components/administration/admin/SystemApplicationGrid.tsx +5 -83
- package/src/components/administration/admin/SystemApplicationModuleGrid.tsx +2 -15
- package/src/components/administration/admin/SystemApplicationRoleGrid.tsx +1 -15
- package/src/components/administration/dev/AttachmentConfigGrid.tsx +213 -0
- package/src/components/administration/dev/AttachmentGrid.tsx +172 -0
- package/src/components/administration/dev/LookupGrid.tsx +1 -12
- package/src/components/common/Home.tsx +24 -22
- package/src/components/index.ts +0 -4
- package/src/components/templates/DataEntryTemplates/DataEntryTypes.ts +13 -1
- package/src/components/templates/DataEntryTemplates/DataEntryUtil.ts +6 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementField.tsx +1 -3
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/SystemLookupCombobox.tsx +1 -1
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/TemplateForm.tsx +100 -8
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid.tsx +105 -4
- package/src/components/templates/attachment/AttachmentCard.tsx +126 -0
- package/src/components/templates/attachment/AttachmentImageViewer.tsx +44 -0
- package/src/components/templates/attachment/AttachmentPanel.tsx +269 -0
- package/src/components/templates/workflow/WorkflowDocumentPanel.tsx +4 -4
- package/src/hooks/UseSession.tsx +20 -2
- package/src/hooks/useAxios.tsx +71 -11
- package/src/hooks/useLookupGridColumn.tsx +2 -2
- package/src/layout/MainContent.tsx +49 -46
- package/src/layout/TopBar.tsx +6 -1
- package/src/locales/arabic/devLocalsAr.json +13 -1
- package/src/locales/english/devLocalsEn.json +13 -1
- package/src/main.tsx +3 -3
- package/src/navigationItems/Administration/adminNavigationItems.tsx +77 -3
- package/src/redux/features/administration/AdministrationStoresMetaData.ts +14 -6
- package/src/routes/administration/adminRoutes.tsx +21 -0
- package/src/routes/administration/devRoutes.tsx +24 -0
- package/public/icons/LICENSE.md +0 -5
- package/public/icons/arrow-clockwise.svg +0 -4
- package/public/icons/arrow-counterclockwise.svg +0 -4
- package/public/icons/journal-text.svg +0 -5
- package/public/icons/justify.svg +0 -3
- package/public/icons/text-center.svg +0 -3
- package/public/icons/text-left.svg +0 -3
- package/public/icons/text-paragraph.svg +0 -3
- package/public/icons/text-right.svg +0 -3
- package/public/icons/type-bold.svg +0 -3
- package/public/icons/type-italic.svg +0 -3
- package/public/icons/type-strikethrough.svg +0 -3
- package/public/icons/type-underline.svg +0 -3
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { useAxios, useSession } from "../../../hooks";
|
|
3
|
+
import { toast } from "react-toastify";
|
|
4
|
+
import { Box, Button, Grid2, Paper } from "@mui/material";
|
|
5
|
+
import ComboBox from "../DataEntryTemplates/TemplateDataForm/FormFields/ComboBox";
|
|
6
|
+
import TemplateTextField from "../DataEntryTemplates/TemplateDataForm/FormFields/TemplateTextField";
|
|
7
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
8
|
+
import AttachmentCard from "./AttachmentCard";
|
|
9
|
+
|
|
10
|
+
export type AttachmentPanelProps = {
|
|
11
|
+
attachmentCode: string;
|
|
12
|
+
enableAttachment?: boolean;
|
|
13
|
+
refKey: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type AttachmentConfig = {
|
|
17
|
+
id: number;
|
|
18
|
+
attachmentCode: string;
|
|
19
|
+
uploadDirectory: string;
|
|
20
|
+
storageType: "FILE_SYSTEM" | "SFTP";
|
|
21
|
+
maxAllowedNumberOfFiles: number;
|
|
22
|
+
isCategoryRequired?: boolean;
|
|
23
|
+
attachmentCategories?: string;
|
|
24
|
+
uploadAuthorityKey?: string;
|
|
25
|
+
downloadAuthorityKey?: string;
|
|
26
|
+
allowedFileTypes?: string;
|
|
27
|
+
refKeyAttachments?: Array<any>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const AttachmentPanel: React.FC<AttachmentPanelProps> = (props) => {
|
|
31
|
+
const { handleUploadRequest, handleGetRequest } = useAxios();
|
|
32
|
+
const [files, setFiles] = useState<FileList | null>(null);
|
|
33
|
+
const [attachmentCategories, setAttachmentCategories] = useState<
|
|
34
|
+
Array<string>
|
|
35
|
+
>([]);
|
|
36
|
+
const [remark, setRemark] = useState(null);
|
|
37
|
+
const [selectedCategory, setSelectedCategory] = useState(null);
|
|
38
|
+
const [allowedTypes, setAllowedTypes] = useState<Array<string>>([]);
|
|
39
|
+
const [attachmentConfig, setAttachmentConfig] =
|
|
40
|
+
useState<AttachmentConfig>(null);
|
|
41
|
+
|
|
42
|
+
const loadAttachmentConfig = async () => {
|
|
43
|
+
await handleGetRequest({
|
|
44
|
+
endPointURI: "api/v1/attachment/info",
|
|
45
|
+
showMask: true,
|
|
46
|
+
parameters: {
|
|
47
|
+
attachmentCode: props.attachmentCode,
|
|
48
|
+
refKey: props.refKey,
|
|
49
|
+
},
|
|
50
|
+
successCallBkFn: (response: any) => {
|
|
51
|
+
setAttachmentConfig(response.data);
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
57
|
+
if (e.target.files) {
|
|
58
|
+
for (const file of e.target.files) {
|
|
59
|
+
const fileExt = getFileExtension(file.name);
|
|
60
|
+
if (allowedTypes.length > 0 && !allowedTypes.includes(fileExt)) {
|
|
61
|
+
toast.error(fileExt + " is not allowed");
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
setFiles(e.target.files);
|
|
67
|
+
};
|
|
68
|
+
const { isUserAuthorized } = useSession();
|
|
69
|
+
|
|
70
|
+
const handleUpload = async () => {
|
|
71
|
+
let existingAttachments = attachmentConfig?.refKeyAttachments.length || 0;
|
|
72
|
+
if (
|
|
73
|
+
attachmentConfig?.maxAllowedNumberOfFiles &&
|
|
74
|
+
files.length + existingAttachments >
|
|
75
|
+
attachmentConfig.maxAllowedNumberOfFiles
|
|
76
|
+
) {
|
|
77
|
+
toast.error(
|
|
78
|
+
"Maximum number of attachments is " +
|
|
79
|
+
attachmentConfig.maxAllowedNumberOfFiles
|
|
80
|
+
);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (
|
|
84
|
+
attachmentConfig?.isCategoryRequired === true &&
|
|
85
|
+
attachmentCategories.length > 0 &&
|
|
86
|
+
(selectedCategory == null ||
|
|
87
|
+
selectedCategory === undefined ||
|
|
88
|
+
selectedCategory === "")
|
|
89
|
+
) {
|
|
90
|
+
toast.error("You must selected document type to process your request");
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (!files) {
|
|
94
|
+
toast.error("You must add files to upload");
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
await handleUploadRequest({
|
|
98
|
+
endPointURI: "api/v1/attachment/upload",
|
|
99
|
+
showMask: true,
|
|
100
|
+
loadingMessage: "Uploading files ... please wait",
|
|
101
|
+
parameters: {
|
|
102
|
+
refKey: props.refKey,
|
|
103
|
+
attachmentCode: props.attachmentCode,
|
|
104
|
+
remark,
|
|
105
|
+
category: selectedCategory,
|
|
106
|
+
},
|
|
107
|
+
files,
|
|
108
|
+
successCallBkFn: (response) => {
|
|
109
|
+
setAttachmentConfig(response.data);
|
|
110
|
+
setFiles(null);
|
|
111
|
+
setSelectedCategory(null);
|
|
112
|
+
setRemark(null);
|
|
113
|
+
toast.success("Your request has been process successfully");
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
const getFileExtension = (name: string) => {
|
|
118
|
+
return name.split(".").pop()?.toLowerCase() || "";
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
loadAttachmentConfig();
|
|
123
|
+
}, [props.refKey, props.attachmentCode]);
|
|
124
|
+
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
if (attachmentConfig?.allowedFileTypes) {
|
|
127
|
+
setAllowedTypes(attachmentConfig.allowedFileTypes.split(","));
|
|
128
|
+
} else {
|
|
129
|
+
setAllowedTypes([]);
|
|
130
|
+
}
|
|
131
|
+
if (attachmentConfig?.attachmentCategories) {
|
|
132
|
+
const cats = [];
|
|
133
|
+
for (const category of attachmentConfig.attachmentCategories.split(",")) {
|
|
134
|
+
cats.push({ value: category });
|
|
135
|
+
}
|
|
136
|
+
setAttachmentCategories(cats);
|
|
137
|
+
} else {
|
|
138
|
+
setAttachmentCategories([]);
|
|
139
|
+
}
|
|
140
|
+
}, [attachmentConfig]);
|
|
141
|
+
let showAttachments = true;
|
|
142
|
+
if (
|
|
143
|
+
attachmentConfig?.downloadAuthorityKey &&
|
|
144
|
+
!isUserAuthorized(attachmentConfig?.downloadAuthorityKey)
|
|
145
|
+
) {
|
|
146
|
+
showAttachments = false;
|
|
147
|
+
}
|
|
148
|
+
let allowUpload = true;
|
|
149
|
+
if (props?.enableAttachment === false) {
|
|
150
|
+
allowUpload = false;
|
|
151
|
+
}
|
|
152
|
+
if (
|
|
153
|
+
attachmentConfig?.uploadAuthorityKey &&
|
|
154
|
+
!isUserAuthorized(attachmentConfig.uploadAuthorityKey)
|
|
155
|
+
) {
|
|
156
|
+
allowUpload = false;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<Paper
|
|
161
|
+
sx={{
|
|
162
|
+
display: "flex",
|
|
163
|
+
flexDirection: "column",
|
|
164
|
+
width: "100%",
|
|
165
|
+
alignItems: "center",
|
|
166
|
+
justifyContent: "flex-start",
|
|
167
|
+
overflow: "hidden",
|
|
168
|
+
flexGrow: 1,
|
|
169
|
+
}}
|
|
170
|
+
>
|
|
171
|
+
{allowUpload ? (
|
|
172
|
+
<>
|
|
173
|
+
{attachmentConfig?.maxAllowedNumberOfFiles === undefined ||
|
|
174
|
+
attachmentConfig?.maxAllowedNumberOfFiles === null ||
|
|
175
|
+
attachmentConfig?.maxAllowedNumberOfFiles <
|
|
176
|
+
attachmentConfig.refKeyAttachments.length ? (
|
|
177
|
+
<>
|
|
178
|
+
<h3>
|
|
179
|
+
<FontAwesomeIcon
|
|
180
|
+
icon="paperclip"
|
|
181
|
+
style={{ marginRight: 10, marginLeft: 10 }}
|
|
182
|
+
/>
|
|
183
|
+
Attachment Uploader
|
|
184
|
+
</h3>
|
|
185
|
+
<input
|
|
186
|
+
type="file"
|
|
187
|
+
style={{ margin: 20 }}
|
|
188
|
+
accept={attachmentConfig?.allowedFileTypes}
|
|
189
|
+
multiple
|
|
190
|
+
onChange={handleChange}
|
|
191
|
+
/>
|
|
192
|
+
{attachmentCategories.length > 0 ? (
|
|
193
|
+
<ComboBox
|
|
194
|
+
label="Attachment Type"
|
|
195
|
+
sx={{ width: 300, m: 1 }}
|
|
196
|
+
options={attachmentCategories}
|
|
197
|
+
displayField="value"
|
|
198
|
+
valueField="value"
|
|
199
|
+
value={selectedCategory}
|
|
200
|
+
onChangeCallBack={(v) => {
|
|
201
|
+
setSelectedCategory(v);
|
|
202
|
+
}}
|
|
203
|
+
/>
|
|
204
|
+
) : (
|
|
205
|
+
<></>
|
|
206
|
+
)}
|
|
207
|
+
|
|
208
|
+
<TemplateTextField
|
|
209
|
+
label="Remark"
|
|
210
|
+
value={remark}
|
|
211
|
+
onChange={(event) => setRemark(event.target.value)}
|
|
212
|
+
multiline={true}
|
|
213
|
+
sx={{ width: 300, m: 1 }}
|
|
214
|
+
rows={3}
|
|
215
|
+
/>
|
|
216
|
+
<Button sx={{ m: 1 }} variant="contained" onClick={handleUpload}>
|
|
217
|
+
Upload
|
|
218
|
+
</Button>
|
|
219
|
+
</>
|
|
220
|
+
) : (
|
|
221
|
+
<></>
|
|
222
|
+
)}
|
|
223
|
+
</>
|
|
224
|
+
) : (
|
|
225
|
+
<></>
|
|
226
|
+
)}
|
|
227
|
+
|
|
228
|
+
{showAttachments && attachmentConfig?.refKeyAttachments?.length > 0 ? (
|
|
229
|
+
<>
|
|
230
|
+
<h3>
|
|
231
|
+
<FontAwesomeIcon
|
|
232
|
+
style={{ marginRight: 10, marginLeft: 10 }}
|
|
233
|
+
icon="paperclip"
|
|
234
|
+
/>
|
|
235
|
+
Attachments
|
|
236
|
+
</h3>
|
|
237
|
+
<Grid2
|
|
238
|
+
container
|
|
239
|
+
spacing={2}
|
|
240
|
+
sx={{ overflow: "auto", padding: 1, justifyContent: "center" }}
|
|
241
|
+
>
|
|
242
|
+
{attachmentConfig?.refKeyAttachments.map((refKeyAttachment) => {
|
|
243
|
+
return (
|
|
244
|
+
<Grid2
|
|
245
|
+
sx={{
|
|
246
|
+
display: "flex",
|
|
247
|
+
flexDirection: "column",
|
|
248
|
+
alignItems: "center",
|
|
249
|
+
justifyContent: "center",
|
|
250
|
+
}}
|
|
251
|
+
>
|
|
252
|
+
<AttachmentCard
|
|
253
|
+
{...refKeyAttachment}
|
|
254
|
+
attachmentCode={props.attachmentCode}
|
|
255
|
+
setAttachmentConfig={setAttachmentConfig}
|
|
256
|
+
/>
|
|
257
|
+
</Grid2>
|
|
258
|
+
);
|
|
259
|
+
})}
|
|
260
|
+
</Grid2>
|
|
261
|
+
</>
|
|
262
|
+
) : (
|
|
263
|
+
<></>
|
|
264
|
+
)}
|
|
265
|
+
</Paper>
|
|
266
|
+
);
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
export default AttachmentPanel;
|
|
@@ -10,7 +10,7 @@ import { toast } from "react-toastify";
|
|
|
10
10
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
11
11
|
import ReportViewer from "../report/ReportViewer";
|
|
12
12
|
|
|
13
|
-
type WorkflowDocumentPanelProps = {
|
|
13
|
+
export type WorkflowDocumentPanelProps = {
|
|
14
14
|
workFlowDocumentCode: string;
|
|
15
15
|
refDocumentId: any;
|
|
16
16
|
postActionCallBk?: () => void;
|
|
@@ -104,7 +104,7 @@ const WorkflowDocumentPanel: React.FC<WorkflowDocumentPanelProps> = (props) => {
|
|
|
104
104
|
});
|
|
105
105
|
const loadWorkFlowDocumentInfo = async () => {
|
|
106
106
|
await handleGetRequest({
|
|
107
|
-
endPointURI: "api/v1/
|
|
107
|
+
endPointURI: "api/v1/public/workflow/doc/info",
|
|
108
108
|
showMask: true,
|
|
109
109
|
parameters: {
|
|
110
110
|
workflowDocumentCode: props.workFlowDocumentCode,
|
|
@@ -165,7 +165,7 @@ const WorkflowDocumentPanel: React.FC<WorkflowDocumentPanelProps> = (props) => {
|
|
|
165
165
|
};
|
|
166
166
|
const processWorkflowDocumentAction = async () => {
|
|
167
167
|
await handlePostRequest({
|
|
168
|
-
endPointURI: "api/v1/
|
|
168
|
+
endPointURI: "api/v1/public/workflow/doc/action",
|
|
169
169
|
showMask: true,
|
|
170
170
|
data: {
|
|
171
171
|
workflowDocumentId: workflowDocumentInfo?.workflowDocument?.id,
|
|
@@ -263,7 +263,7 @@ const WorkflowDocumentPanel: React.FC<WorkflowDocumentPanelProps> = (props) => {
|
|
|
263
263
|
}
|
|
264
264
|
resultMode="App"
|
|
265
265
|
byPassParameterEntry={true}
|
|
266
|
-
reportParametersValues={{ doc_id: props.refDocumentId+
|
|
266
|
+
reportParametersValues={{ doc_id: props.refDocumentId + "" }}
|
|
267
267
|
/>
|
|
268
268
|
</ReporTViewWindow>
|
|
269
269
|
) : (
|
package/src/hooks/UseSession.tsx
CHANGED
|
@@ -7,10 +7,28 @@ const useSession = () => {
|
|
|
7
7
|
if (UserSession?.value?.authorities) {
|
|
8
8
|
for (let grantedAuthority of UserSession.value.authorities) {
|
|
9
9
|
if (
|
|
10
|
-
|
|
11
|
-
grantedAuthority?.authority ===
|
|
10
|
+
authorityCode === "DEVELOPMENT_ADMIN" &&
|
|
11
|
+
(grantedAuthority?.authority === "DEVELOPMENT_ADMIN" ||
|
|
12
|
+
grantedAuthority?.authority === "ORGANIZATION_ADMIN")
|
|
12
13
|
) {
|
|
13
14
|
return true;
|
|
15
|
+
} else if (
|
|
16
|
+
authorityCode === "ORGANIZATION_ADMIN" &&
|
|
17
|
+
grantedAuthority?.authority === "ORGANIZATION_ADMIN"
|
|
18
|
+
) {
|
|
19
|
+
return true;
|
|
20
|
+
} else if (
|
|
21
|
+
authorityCode !== "DEVELOPMENT_ADMIN" &&
|
|
22
|
+
authorityCode !== "ORGANIZATION_ADMIN"
|
|
23
|
+
) {
|
|
24
|
+
if (
|
|
25
|
+
grantedAuthority?.authority === "ORGANIZATION_ADMIN" ||
|
|
26
|
+
grantedAuthority?.authority === "DEVELOPMENT_ADMIN" ||
|
|
27
|
+
grantedAuthority?.authority === "SYSTEM_ADMIN" ||
|
|
28
|
+
grantedAuthority?.authority === authorityCode
|
|
29
|
+
) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
14
32
|
}
|
|
15
33
|
}
|
|
16
34
|
}
|
package/src/hooks/useAxios.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toast } from "react-toastify";
|
|
2
|
-
import axios from "axios";
|
|
2
|
+
import axios, { ResponseType } from "axios";
|
|
3
3
|
import { useSelector } from "react-redux";
|
|
4
4
|
import useLoadingMask from "./useLoadingMask";
|
|
5
5
|
|
|
@@ -11,6 +11,18 @@ export interface APIRequest {
|
|
|
11
11
|
loadingMessage?: string;
|
|
12
12
|
successCallBkFn?: Function;
|
|
13
13
|
failureCallBkFn?: Function;
|
|
14
|
+
headers?: any;
|
|
15
|
+
responseType?: ResponseType;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface UploadAttachmentRequest {
|
|
19
|
+
endPointURI: string;
|
|
20
|
+
showMask?: Boolean;
|
|
21
|
+
parameters?: any;
|
|
22
|
+
loadingMessage?: string;
|
|
23
|
+
successCallBkFn?: Function;
|
|
24
|
+
failureCallBkFn?: Function;
|
|
25
|
+
files: FileList;
|
|
14
26
|
}
|
|
15
27
|
|
|
16
28
|
const useAxios = () => {
|
|
@@ -77,9 +89,7 @@ const useAxios = () => {
|
|
|
77
89
|
return "ERROR";
|
|
78
90
|
}
|
|
79
91
|
);
|
|
80
|
-
const handleGetRequest = async (
|
|
81
|
-
props: APIRequest = { endPointURI: "", parameters: {} }
|
|
82
|
-
) => {
|
|
92
|
+
const handleGetRequest = async (props: APIRequest) => {
|
|
83
93
|
if (
|
|
84
94
|
props.showMask !== undefined &&
|
|
85
95
|
props.showMask != null &&
|
|
@@ -90,7 +100,8 @@ const useAxios = () => {
|
|
|
90
100
|
const response: any = await axiosInstance.get(props.endPointURI, {
|
|
91
101
|
params: { ...props.parameters },
|
|
92
102
|
withCredentials: true,
|
|
93
|
-
|
|
103
|
+
headers: props.headers,
|
|
104
|
+
responseType: props?.responseType,
|
|
94
105
|
});
|
|
95
106
|
if (
|
|
96
107
|
props.showMask !== undefined &&
|
|
@@ -160,9 +171,7 @@ const useAxios = () => {
|
|
|
160
171
|
return "ERROR";
|
|
161
172
|
}
|
|
162
173
|
};
|
|
163
|
-
const handlePostRequest = async (
|
|
164
|
-
props: APIRequest = { endPointURI: "", parameters: {}, data: {} }
|
|
165
|
-
) => {
|
|
174
|
+
const handlePostRequest = async (props: APIRequest) => {
|
|
166
175
|
if (
|
|
167
176
|
props.showMask !== undefined &&
|
|
168
177
|
props.showMask != null &&
|
|
@@ -175,6 +184,8 @@ const useAxios = () => {
|
|
|
175
184
|
props.data,
|
|
176
185
|
{
|
|
177
186
|
params: props.parameters,
|
|
187
|
+
responseType: props?.responseType,
|
|
188
|
+
headers: props?.headers,
|
|
178
189
|
}
|
|
179
190
|
);
|
|
180
191
|
if (
|
|
@@ -202,9 +213,7 @@ const useAxios = () => {
|
|
|
202
213
|
return "ERROR";
|
|
203
214
|
}
|
|
204
215
|
};
|
|
205
|
-
const handleDeleteRequest = async (
|
|
206
|
-
props: APIRequest = { endPointURI: "", parameters: {} }
|
|
207
|
-
) => {
|
|
216
|
+
const handleDeleteRequest = async (props: APIRequest) => {
|
|
208
217
|
if (
|
|
209
218
|
props.showMask !== undefined &&
|
|
210
219
|
props.showMask != null &&
|
|
@@ -216,6 +225,56 @@ const useAxios = () => {
|
|
|
216
225
|
params: {
|
|
217
226
|
...props.parameters,
|
|
218
227
|
},
|
|
228
|
+
responseType: props?.responseType,
|
|
229
|
+
headers: props?.headers,
|
|
230
|
+
});
|
|
231
|
+
if (
|
|
232
|
+
props.showMask !== undefined &&
|
|
233
|
+
props.showMask != null &&
|
|
234
|
+
props.showMask === true
|
|
235
|
+
) {
|
|
236
|
+
mask.hide();
|
|
237
|
+
}
|
|
238
|
+
if (response !== "ERROR") {
|
|
239
|
+
if (
|
|
240
|
+
props.successCallBkFn !== undefined &&
|
|
241
|
+
props.successCallBkFn != null
|
|
242
|
+
) {
|
|
243
|
+
props.successCallBkFn(response);
|
|
244
|
+
}
|
|
245
|
+
return response;
|
|
246
|
+
} else {
|
|
247
|
+
if (
|
|
248
|
+
props.failureCallBkFn !== undefined &&
|
|
249
|
+
props.failureCallBkFn != null
|
|
250
|
+
) {
|
|
251
|
+
props.failureCallBkFn(response);
|
|
252
|
+
}
|
|
253
|
+
return "ERROR";
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
const handleUploadRequest = async (props: UploadAttachmentRequest) => {
|
|
258
|
+
if (props.files === null || props.files.length === 0) {
|
|
259
|
+
toast.error("You must add files to upload");
|
|
260
|
+
return "ERROR";
|
|
261
|
+
}
|
|
262
|
+
const formData = new FormData();
|
|
263
|
+
for (const file of props.files) {
|
|
264
|
+
formData.append("files", file);
|
|
265
|
+
}
|
|
266
|
+
if (
|
|
267
|
+
props.showMask !== undefined &&
|
|
268
|
+
props.showMask != null &&
|
|
269
|
+
props.showMask === true
|
|
270
|
+
) {
|
|
271
|
+
mask.show(props.loadingMessage);
|
|
272
|
+
}
|
|
273
|
+
let response: any = await axiosInstance.post(props.endPointURI, formData, {
|
|
274
|
+
params: props?.parameters,
|
|
275
|
+
headers: {
|
|
276
|
+
"Content-Type": "multipart/form-data",
|
|
277
|
+
},
|
|
219
278
|
});
|
|
220
279
|
if (
|
|
221
280
|
props.showMask !== undefined &&
|
|
@@ -247,6 +306,7 @@ const useAxios = () => {
|
|
|
247
306
|
handlePostRequest,
|
|
248
307
|
handleDeleteRequest,
|
|
249
308
|
HandleDownloadHTTPPostPDF,
|
|
309
|
+
handleUploadRequest,
|
|
250
310
|
};
|
|
251
311
|
};
|
|
252
312
|
|
|
@@ -8,7 +8,7 @@ const useLookupGridColumn = () => {
|
|
|
8
8
|
const getLookupOptions = async (lookupType: string) => {
|
|
9
9
|
let options = [];
|
|
10
10
|
await handleGetRequest({
|
|
11
|
-
endPointURI: "api/v1/
|
|
11
|
+
endPointURI: "api/v1/public/system/lookup",
|
|
12
12
|
showMask: true,
|
|
13
13
|
parameters: { lookupType },
|
|
14
14
|
successCallBkFn: (response: any) => {
|
|
@@ -17,7 +17,7 @@ const useLookupGridColumn = () => {
|
|
|
17
17
|
});
|
|
18
18
|
return options;
|
|
19
19
|
};
|
|
20
|
-
const generateLookupGridColumn = async (props: TemplateGridColDef) => {
|
|
20
|
+
const generateLookupGridColumn = async (props: TemplateGridColDef) => {
|
|
21
21
|
let options = await getLookupOptions(props.lookupType);
|
|
22
22
|
return {
|
|
23
23
|
...props,
|
|
@@ -16,6 +16,7 @@ const MainContent: React.FC = () => {
|
|
|
16
16
|
const businessRoutes = useSelector(
|
|
17
17
|
(state: any) => state.AppInfo.value.businessRoutes
|
|
18
18
|
);
|
|
19
|
+
const { UserInfo } = useSession();
|
|
19
20
|
const dispatch = useDispatch();
|
|
20
21
|
const { show, hide } = useLoadingMask();
|
|
21
22
|
const commonStores = useSelector((state: any) => state.commonStores);
|
|
@@ -24,6 +25,7 @@ const MainContent: React.FC = () => {
|
|
|
24
25
|
const { handleGetRequest } = useAxios();
|
|
25
26
|
const loadCommonStores = async () => {
|
|
26
27
|
show("Loading ... please wait");
|
|
28
|
+
setAutoLoadLoaded(false);
|
|
27
29
|
const stores = commonStores.stores;
|
|
28
30
|
const storeKeys = commonStores.storeKeys;
|
|
29
31
|
for (let storeKey of storeKeys) {
|
|
@@ -46,6 +48,7 @@ const MainContent: React.FC = () => {
|
|
|
46
48
|
});
|
|
47
49
|
}
|
|
48
50
|
}
|
|
51
|
+
setAutoLoadLoaded(true);
|
|
49
52
|
hide();
|
|
50
53
|
};
|
|
51
54
|
|
|
@@ -53,57 +56,57 @@ const MainContent: React.FC = () => {
|
|
|
53
56
|
if (commonStores?.storeKeys) {
|
|
54
57
|
loadCommonStores();
|
|
55
58
|
}
|
|
56
|
-
}, [commonStores.storeKeys]);
|
|
59
|
+
}, [commonStores.storeKeys, UserInfo?.currentOrganization]);
|
|
57
60
|
return (
|
|
58
61
|
<CacheProvider
|
|
59
62
|
value={AppLayoutState.appDirection === "ltr" ? cacheLtr : cacheRtl}
|
|
60
63
|
>
|
|
61
|
-
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
64
|
+
{isAutoLoadLoaded ? (
|
|
65
|
+
<Box
|
|
66
|
+
sx={{
|
|
67
|
+
display: "flex",
|
|
68
|
+
flexDirection: "column",
|
|
69
|
+
// alignItems: "center",
|
|
70
|
+
justifyContent: "flex-start",
|
|
71
|
+
flex: 1,
|
|
72
|
+
overflow: "hidden",
|
|
73
|
+
padding: 3,
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
<Routes>
|
|
77
|
+
{AppInfo.enableAdministrationModule
|
|
78
|
+
? SYSTEM_ROUTES.map((route: SystemRoute, index) => {
|
|
79
|
+
return (
|
|
80
|
+
<Route
|
|
81
|
+
key={"adm" + index}
|
|
82
|
+
path={route.path}
|
|
83
|
+
element={
|
|
84
|
+
<RouteWrapper authority={route.authority}>
|
|
85
|
+
<route.component />
|
|
86
|
+
</RouteWrapper>
|
|
87
|
+
}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
})
|
|
91
|
+
: null}
|
|
92
|
+
{businessRoutes.map((route: SystemRoute, index) => {
|
|
93
|
+
return (
|
|
94
|
+
<Route
|
|
95
|
+
key={"bs" + index}
|
|
96
|
+
path={route.path}
|
|
97
|
+
element={
|
|
98
|
+
<RouteWrapper authority={route.authority}>
|
|
99
|
+
<route.component />
|
|
100
|
+
</RouteWrapper>
|
|
101
|
+
}
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
})}
|
|
105
|
+
</Routes>
|
|
106
|
+
</Box>
|
|
107
|
+
) : (
|
|
105
108
|
<></>
|
|
106
|
-
)}
|
|
109
|
+
)}
|
|
107
110
|
</CacheProvider>
|
|
108
111
|
);
|
|
109
112
|
};
|
package/src/layout/TopBar.tsx
CHANGED
|
@@ -21,6 +21,7 @@ import i18n, { changeLanguage } from "../locales/i18n";
|
|
|
21
21
|
import { useSession, useWindow } from "../hooks";
|
|
22
22
|
import ChangeOrgForm from "../components/common/ChangeOrgForm";
|
|
23
23
|
import { toggleSideBarState } from "../redux/features/common/SideBarSlice";
|
|
24
|
+
import AttachmentImageViewer from "../components/templates/attachment/AttachmentImageViewer";
|
|
24
25
|
|
|
25
26
|
interface AppBarProps extends MuiAppBarProps {
|
|
26
27
|
open?: boolean;
|
|
@@ -191,7 +192,11 @@ const TopBar: React.FC = () => {
|
|
|
191
192
|
<></>
|
|
192
193
|
)}
|
|
193
194
|
|
|
194
|
-
<
|
|
195
|
+
<AttachmentImageViewer
|
|
196
|
+
showAsAvatar={true}
|
|
197
|
+
attachmentCode="PERSON_IMG"
|
|
198
|
+
refKey={UserSession.value?.id + ""}
|
|
199
|
+
/>
|
|
195
200
|
<div style={{ marginLeft: 5, marginRight: 5 }}>
|
|
196
201
|
{isMobile ? "" : UserSession.value?.username}
|
|
197
202
|
</div>
|
|
@@ -276,5 +276,17 @@
|
|
|
276
276
|
"WORKFLOW_DOCUMENT_STATUS_IS_ZERO_STATE": "Is zero state",
|
|
277
277
|
"WORKFLOW_DOCUMENT_STATUS_NEXT_ACTION_TAKERS_QUERY_ID": "Next action takers query id",
|
|
278
278
|
"WORKFLOW_DOCUMENT_STATUS_NEXT_ACTIONS_QUERY_ID": "Next actions query id",
|
|
279
|
-
"WORKFLOW_DOCUMENT_STATUS_WORKFLOW_DOCUMENT_ID": "Workflow document id"
|
|
279
|
+
"WORKFLOW_DOCUMENT_STATUS_WORKFLOW_DOCUMENT_ID": "Workflow document id",
|
|
280
|
+
"ATTACHMENT_ATTACHMENT_CONFIG_ID": "Attachment config id",
|
|
281
|
+
"ATTACHMENT_CONFIG_SINGULAR": "Attachment Configuration",
|
|
282
|
+
"ATTACHMENT_CONFIG_PLURAL": "Attachment Configuration",
|
|
283
|
+
"ATTACHMENT_CONFIG_ALLOWED_FILE_TYPES": "Allowed file types",
|
|
284
|
+
"ATTACHMENT_CONFIG_ATTACHMENT_CATEGORIES": "Attachment categories",
|
|
285
|
+
"ATTACHMENT_CONFIG_ATTACHMENT_CODE": "Attachment code",
|
|
286
|
+
"ATTACHMENT_CONFIG_DOWNLOAD_AUTHORITY_KEY": "Download authority key",
|
|
287
|
+
"ATTACHMENT_CONFIG_MAX_ALLOWED_NUMBER_OF_FILES": "Max allowed number of files",
|
|
288
|
+
"ATTACHMENT_CONFIG_RELATED_DATABASE_TABLE": "Related database table",
|
|
289
|
+
"ATTACHMENT_CONFIG_STORAGE_TYPE": "Storage type",
|
|
290
|
+
"ATTACHMENT_CONFIG_UPLOAD_AUTHORITY_KEY": "Upload authority key",
|
|
291
|
+
"ATTACHMENT_CONFIG_UPLOAD_DIRECTORY": "Upload directory"
|
|
280
292
|
}
|
|
@@ -277,5 +277,17 @@
|
|
|
277
277
|
"WORKFLOW_DOCUMENT_STATUS_IS_ZERO_STATE": "Is zero state",
|
|
278
278
|
"WORKFLOW_DOCUMENT_STATUS_NEXT_ACTION_TAKERS_QUERY_ID": "Next action takers query id",
|
|
279
279
|
"WORKFLOW_DOCUMENT_STATUS_NEXT_ACTIONS_QUERY_ID": "Next actions query id",
|
|
280
|
-
"WORKFLOW_DOCUMENT_STATUS_WORKFLOW_DOCUMENT_ID": "Workflow document id"
|
|
280
|
+
"WORKFLOW_DOCUMENT_STATUS_WORKFLOW_DOCUMENT_ID": "Workflow document id",
|
|
281
|
+
"ATTACHMENT_ATTACHMENT_CONFIG_ID": "Attachment config id",
|
|
282
|
+
"ATTACHMENT_CONFIG_SINGULAR": "Attachment Configuration",
|
|
283
|
+
"ATTACHMENT_CONFIG_PLURAL": "Attachment Configuration",
|
|
284
|
+
"ATTACHMENT_CONFIG_ALLOWED_FILE_TYPES": "Allowed file types",
|
|
285
|
+
"ATTACHMENT_CONFIG_ATTACHMENT_CATEGORIES": "Attachment categories",
|
|
286
|
+
"ATTACHMENT_CONFIG_ATTACHMENT_CODE": "Attachment code",
|
|
287
|
+
"ATTACHMENT_CONFIG_DOWNLOAD_AUTHORITY_KEY": "Download authority key",
|
|
288
|
+
"ATTACHMENT_CONFIG_MAX_ALLOWED_NUMBER_OF_FILES": "Max allowed number of files",
|
|
289
|
+
"ATTACHMENT_CONFIG_RELATED_DATABASE_TABLE": "Related database table",
|
|
290
|
+
"ATTACHMENT_CONFIG_STORAGE_TYPE": "Storage type",
|
|
291
|
+
"ATTACHMENT_CONFIG_UPLOAD_AUTHORITY_KEY": "Upload authority key",
|
|
292
|
+
"ATTACHMENT_CONFIG_UPLOAD_DIRECTORY": "Upload directory"
|
|
281
293
|
}
|