@asaleh37/ui-base 25.12.16 → 25.12.122
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/__ODockerfile +14 -14
- package/dist/index.d.ts +0 -2
- package/dist/index.js +107 -107
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +112 -112
- package/dist/index.mjs.map +1 -1
- package/package-lock.json/342/200/216 +9039 -9039
- package/package.json +122 -122
- package/src/components/administration/admin/OrganizationMemberGrid.tsx +49 -63
- package/src/components/administration/admin/PersonGrid.tsx +344 -10
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementField.tsx +238 -238
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/TemplateForm.tsx +427 -427
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/DataGridColumnsUtil.tsx +198 -198
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid.tsx +1047 -1047
- package/src/components/templates/report/ExcelReportViewer.tsx +72 -72
- package/src/components/templates/report/ReportViewer.tsx +272 -272
- package/src/hooks/UseWindow.tsx +111 -111
- package/src/hooks/index.ts +22 -22
- package/src/hooks/useCommonStore.tsx +29 -29
- package/src/hooks/useParameterPanel.tsx +159 -159
- package/src/layout/NavigationTree.tsx +1 -8
- package/src/layout/TopBar.tsx +55 -72
- package/src/main.tsx +1 -2
- package/src/navigationItems/Administration/adminNavigationItems.tsx +1 -1
- package/src/redux/features/common/AppInfoSlice.ts +0 -4
- package/src/components/administration/admin/CustomPersonGrid.tsx +0 -361
- package/src/components/administration/admin/OrgProvidedPersonGrid.tsx +0 -347
|
@@ -1,272 +1,272 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { useAxios } from "../../../hooks";
|
|
3
|
-
|
|
4
|
-
import { Box, IconButton } from "@mui/material";
|
|
5
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
6
|
-
import ExcelReportViewer from "./ExcelReportViewer";
|
|
7
|
-
import { useParameterPanel } from "../../../hooks/useParameterPanel";
|
|
8
|
-
|
|
9
|
-
type ReportViewerState =
|
|
10
|
-
| "ERROR"
|
|
11
|
-
| "WAITING_REPORT_CODE"
|
|
12
|
-
| "LOADING_METADATA"
|
|
13
|
-
| "WAITING_PARAMETER_INPUT"
|
|
14
|
-
| "WAITING_RESULT"
|
|
15
|
-
| "SHOWING_RESULT";
|
|
16
|
-
|
|
17
|
-
type ReportViewerProps = {
|
|
18
|
-
reportCode: string;
|
|
19
|
-
resultMode: "Request" | "App";
|
|
20
|
-
reportParametersValues?: { [key: string]: any };
|
|
21
|
-
byPassParameterEntry?: boolean;
|
|
22
|
-
jasperOutPutFileType?: "pdf" | "word" | "excel";
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const ReportViewer: React.FC<ReportViewerProps> = (props) => {
|
|
26
|
-
const [blobUrl, setBlobUrl] = useState(null);
|
|
27
|
-
const [errorMessage, setErrorMessage] = useState(null);
|
|
28
|
-
const [excelReportData, setExcelReportData] = useState<Array<any>>([]);
|
|
29
|
-
const [reportViewerState, setReportViewerState] = useState<ReportViewerState>(
|
|
30
|
-
"WAITING_REPORT_CODE"
|
|
31
|
-
);
|
|
32
|
-
const { handleGetRequest, handlePostRequest, HandleDownloadHTTPPostPDF } =
|
|
33
|
-
useAxios();
|
|
34
|
-
const [reportInfo, setReportInfo] = useState<any>(null);
|
|
35
|
-
const {
|
|
36
|
-
ParameterPanel,
|
|
37
|
-
parametersValues,
|
|
38
|
-
panelElements,
|
|
39
|
-
setParametersValues,
|
|
40
|
-
} = useParameterPanel({
|
|
41
|
-
parameters: reportInfo?.reportParameters || [],
|
|
42
|
-
initialParameterValues: { ...props?.reportParametersValues },
|
|
43
|
-
});
|
|
44
|
-
const loadReportData = async () => {
|
|
45
|
-
setReportViewerState("LOADING_METADATA");
|
|
46
|
-
await handleGetRequest({
|
|
47
|
-
endPointURI: "api/v1/public/report/metadata",
|
|
48
|
-
showMask: true,
|
|
49
|
-
parameters: { reportCode: props.reportCode },
|
|
50
|
-
successCallBkFn: (response: any) => {
|
|
51
|
-
setReportInfo(response.data);
|
|
52
|
-
},
|
|
53
|
-
failureCallBkFn: (response) => {
|
|
54
|
-
setErrorMessage(
|
|
55
|
-
"Failed loading report metadata ... contact your administrator"
|
|
56
|
-
);
|
|
57
|
-
setReportViewerState("ERROR");
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
useEffect(() => {
|
|
63
|
-
if (reportInfo) {
|
|
64
|
-
if (
|
|
65
|
-
props?.byPassParameterEntry === true ||
|
|
66
|
-
reportInfo.reportParameters.length == 0
|
|
67
|
-
) {
|
|
68
|
-
runReport(parametersValues);
|
|
69
|
-
setReportViewerState("WAITING_RESULT");
|
|
70
|
-
} else {
|
|
71
|
-
setReportViewerState("WAITING_PARAMETER_INPUT");
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}, [reportInfo]);
|
|
75
|
-
|
|
76
|
-
const runReport = async (params) => {
|
|
77
|
-
setReportViewerState("WAITING_RESULT");
|
|
78
|
-
if (reportInfo?.reportType === "Excel") {
|
|
79
|
-
await handlePostRequest({
|
|
80
|
-
endPointURI: "api/v1/public/report/run",
|
|
81
|
-
showMask: true,
|
|
82
|
-
data: {
|
|
83
|
-
reportCode: props.reportCode,
|
|
84
|
-
parameters: params,
|
|
85
|
-
resultMode: props.resultMode,
|
|
86
|
-
jasperOutPutFileType: props.jasperOutPutFileType,
|
|
87
|
-
},
|
|
88
|
-
successCallBkFn: (response: any) => {
|
|
89
|
-
setReportViewerState("SHOWING_RESULT");
|
|
90
|
-
setExcelReportData(response.data);
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
} else if (reportInfo?.reportType) {
|
|
94
|
-
await HandleDownloadHTTPPostPDF({
|
|
95
|
-
endPointURI: "api/v1/public/report/run",
|
|
96
|
-
showMask: true,
|
|
97
|
-
data: {
|
|
98
|
-
reportCode: props.reportCode,
|
|
99
|
-
parameters: params,
|
|
100
|
-
resultMode: props.resultMode,
|
|
101
|
-
jasperOutPutFileType: props.jasperOutPutFileType,
|
|
102
|
-
},
|
|
103
|
-
successCallBkFn: (response: any) => {
|
|
104
|
-
setReportViewerState("SHOWING_RESULT");
|
|
105
|
-
const contentDisposition = response.headers["content-disposition"];
|
|
106
|
-
let filename = "downloaded_file";
|
|
107
|
-
if (
|
|
108
|
-
contentDisposition &&
|
|
109
|
-
contentDisposition.indexOf("filename=") !== -1
|
|
110
|
-
) {
|
|
111
|
-
const match = contentDisposition.match(/filename="?([^"]+)"?/);
|
|
112
|
-
if (match && match[1]) filename = match[1];
|
|
113
|
-
}
|
|
114
|
-
if (filename.includes("pdf")) {
|
|
115
|
-
const file = new Blob([response.data], { type: "application/pdf" });
|
|
116
|
-
const url = URL.createObjectURL(file);
|
|
117
|
-
setBlobUrl(url);
|
|
118
|
-
} else {
|
|
119
|
-
const blob = new Blob([response.data], {
|
|
120
|
-
type: response.headers["content-type"],
|
|
121
|
-
});
|
|
122
|
-
// Create a temporary anchor element
|
|
123
|
-
const url = window.URL.createObjectURL(blob);
|
|
124
|
-
const link = document.createElement("a");
|
|
125
|
-
link.href = url;
|
|
126
|
-
// Optional: Try to get filename from response headers
|
|
127
|
-
|
|
128
|
-
link.download = filename;
|
|
129
|
-
document.body.appendChild(link);
|
|
130
|
-
link.click();
|
|
131
|
-
|
|
132
|
-
// Clean up
|
|
133
|
-
document.body.removeChild(link);
|
|
134
|
-
window.URL.revokeObjectURL(url);
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
failureCallBkFn: (response) => {
|
|
138
|
-
setErrorMessage(
|
|
139
|
-
"Failed To run report ... contact your administrator"
|
|
140
|
-
);
|
|
141
|
-
setReportViewerState("ERROR");
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
useEffect(() => {
|
|
148
|
-
if (props?.reportCode) {
|
|
149
|
-
loadReportData();
|
|
150
|
-
}
|
|
151
|
-
}, [
|
|
152
|
-
props.reportCode,
|
|
153
|
-
props.byPassParameterEntry,
|
|
154
|
-
props.reportParametersValues,
|
|
155
|
-
props.jasperOutPutFileType,
|
|
156
|
-
props.resultMode,
|
|
157
|
-
]);
|
|
158
|
-
|
|
159
|
-
return (
|
|
160
|
-
<>
|
|
161
|
-
<Box
|
|
162
|
-
sx={{
|
|
163
|
-
display: "flex",
|
|
164
|
-
alignItems: "center",
|
|
165
|
-
justifyContent: "center",
|
|
166
|
-
width: "100%",
|
|
167
|
-
}}
|
|
168
|
-
>
|
|
169
|
-
<Box sx={{ flex: 1, textAlign: "center", marginBottom: 1 }}>
|
|
170
|
-
<FontAwesomeIcon
|
|
171
|
-
icon={
|
|
172
|
-
reportInfo?.reportType === "Excel" ? "file-excel" : "file-pdf"
|
|
173
|
-
}
|
|
174
|
-
color={reportInfo?.reportType === "Excel" ? "darkgreen" : "darkred"}
|
|
175
|
-
style={{ marginRight: 10, marginLeft: 10 }}
|
|
176
|
-
/>
|
|
177
|
-
{reportInfo?.reportName}
|
|
178
|
-
</Box>
|
|
179
|
-
{reportInfo?.reportType != "Excel" ? (
|
|
180
|
-
reportViewerState === "SHOWING_RESULT" ? (
|
|
181
|
-
<>
|
|
182
|
-
{props?.byPassParameterEntry === true ? (
|
|
183
|
-
<></>
|
|
184
|
-
) : reportInfo?.reportParameters.length > 0 ? (
|
|
185
|
-
<IconButton
|
|
186
|
-
onClick={() => {
|
|
187
|
-
setReportViewerState("WAITING_PARAMETER_INPUT");
|
|
188
|
-
}}
|
|
189
|
-
>
|
|
190
|
-
<FontAwesomeIcon icon="filter" />
|
|
191
|
-
</IconButton>
|
|
192
|
-
) : (
|
|
193
|
-
<></>
|
|
194
|
-
)}
|
|
195
|
-
<IconButton>
|
|
196
|
-
<FontAwesomeIcon
|
|
197
|
-
icon="refresh"
|
|
198
|
-
onClick={() => {
|
|
199
|
-
runReport(parametersValues);
|
|
200
|
-
}}
|
|
201
|
-
/>
|
|
202
|
-
</IconButton>
|
|
203
|
-
</>
|
|
204
|
-
) : (
|
|
205
|
-
<></>
|
|
206
|
-
)
|
|
207
|
-
) : (
|
|
208
|
-
<></>
|
|
209
|
-
)}
|
|
210
|
-
</Box>
|
|
211
|
-
<Box
|
|
212
|
-
sx={{
|
|
213
|
-
flexGrow: 1,
|
|
214
|
-
width: "100%",
|
|
215
|
-
display: "flex",
|
|
216
|
-
flexDirection: "column",
|
|
217
|
-
alignItems: "center",
|
|
218
|
-
justifyContent: "flex-start",
|
|
219
|
-
}}
|
|
220
|
-
>
|
|
221
|
-
{reportViewerState === "WAITING_PARAMETER_INPUT" &&
|
|
222
|
-
reportInfo?.reportType != "Excel" ? (
|
|
223
|
-
<ParameterPanel searchBtnClickCallBk={runReport} />
|
|
224
|
-
) : reportViewerState === "SHOWING_RESULT" ||
|
|
225
|
-
((reportViewerState === "WAITING_PARAMETER_INPUT" ||
|
|
226
|
-
reportViewerState === "WAITING_RESULT") &&
|
|
227
|
-
reportInfo?.reportType === "Excel") ? (
|
|
228
|
-
reportInfo?.reportType === "Excel" ? (
|
|
229
|
-
<ExcelReportViewer
|
|
230
|
-
reportData={excelReportData}
|
|
231
|
-
setReportData={setExcelReportData}
|
|
232
|
-
reloadReport={async () => {
|
|
233
|
-
runReport(parametersValues);
|
|
234
|
-
}}
|
|
235
|
-
gridLoadParameters={panelElements}
|
|
236
|
-
gridLoadParametersValues={parametersValues}
|
|
237
|
-
setGridLoadParametersValues={setParametersValues}
|
|
238
|
-
/>
|
|
239
|
-
) : (
|
|
240
|
-
<iframe
|
|
241
|
-
src={blobUrl}
|
|
242
|
-
width="100%"
|
|
243
|
-
height="100%"
|
|
244
|
-
title="PDF Preview"
|
|
245
|
-
style={{ border: "1px solid #ccc", marginTop: "20px" }}
|
|
246
|
-
></iframe>
|
|
247
|
-
)
|
|
248
|
-
) : reportViewerState === "ERROR" ? (
|
|
249
|
-
<Box
|
|
250
|
-
sx={{
|
|
251
|
-
display: "flex",
|
|
252
|
-
flex: 1,
|
|
253
|
-
alignItems: "center",
|
|
254
|
-
justifyContent: "center",
|
|
255
|
-
}}
|
|
256
|
-
>
|
|
257
|
-
<FontAwesomeIcon
|
|
258
|
-
icon="circle-exclamation"
|
|
259
|
-
color="darkred"
|
|
260
|
-
style={{ marginRight: 10, marginLeft: 10 }}
|
|
261
|
-
/>
|
|
262
|
-
{errorMessage}
|
|
263
|
-
</Box>
|
|
264
|
-
) : (
|
|
265
|
-
<></>
|
|
266
|
-
)}
|
|
267
|
-
</Box>
|
|
268
|
-
</>
|
|
269
|
-
);
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
export default ReportViewer;
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { useAxios } from "../../../hooks";
|
|
3
|
+
|
|
4
|
+
import { Box, IconButton } from "@mui/material";
|
|
5
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
6
|
+
import ExcelReportViewer from "./ExcelReportViewer";
|
|
7
|
+
import { useParameterPanel } from "../../../hooks/useParameterPanel";
|
|
8
|
+
|
|
9
|
+
type ReportViewerState =
|
|
10
|
+
| "ERROR"
|
|
11
|
+
| "WAITING_REPORT_CODE"
|
|
12
|
+
| "LOADING_METADATA"
|
|
13
|
+
| "WAITING_PARAMETER_INPUT"
|
|
14
|
+
| "WAITING_RESULT"
|
|
15
|
+
| "SHOWING_RESULT";
|
|
16
|
+
|
|
17
|
+
type ReportViewerProps = {
|
|
18
|
+
reportCode: string;
|
|
19
|
+
resultMode: "Request" | "App";
|
|
20
|
+
reportParametersValues?: { [key: string]: any };
|
|
21
|
+
byPassParameterEntry?: boolean;
|
|
22
|
+
jasperOutPutFileType?: "pdf" | "word" | "excel";
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const ReportViewer: React.FC<ReportViewerProps> = (props) => {
|
|
26
|
+
const [blobUrl, setBlobUrl] = useState(null);
|
|
27
|
+
const [errorMessage, setErrorMessage] = useState(null);
|
|
28
|
+
const [excelReportData, setExcelReportData] = useState<Array<any>>([]);
|
|
29
|
+
const [reportViewerState, setReportViewerState] = useState<ReportViewerState>(
|
|
30
|
+
"WAITING_REPORT_CODE"
|
|
31
|
+
);
|
|
32
|
+
const { handleGetRequest, handlePostRequest, HandleDownloadHTTPPostPDF } =
|
|
33
|
+
useAxios();
|
|
34
|
+
const [reportInfo, setReportInfo] = useState<any>(null);
|
|
35
|
+
const {
|
|
36
|
+
ParameterPanel,
|
|
37
|
+
parametersValues,
|
|
38
|
+
panelElements,
|
|
39
|
+
setParametersValues,
|
|
40
|
+
} = useParameterPanel({
|
|
41
|
+
parameters: reportInfo?.reportParameters || [],
|
|
42
|
+
initialParameterValues: { ...props?.reportParametersValues },
|
|
43
|
+
});
|
|
44
|
+
const loadReportData = async () => {
|
|
45
|
+
setReportViewerState("LOADING_METADATA");
|
|
46
|
+
await handleGetRequest({
|
|
47
|
+
endPointURI: "api/v1/public/report/metadata",
|
|
48
|
+
showMask: true,
|
|
49
|
+
parameters: { reportCode: props.reportCode },
|
|
50
|
+
successCallBkFn: (response: any) => {
|
|
51
|
+
setReportInfo(response.data);
|
|
52
|
+
},
|
|
53
|
+
failureCallBkFn: (response) => {
|
|
54
|
+
setErrorMessage(
|
|
55
|
+
"Failed loading report metadata ... contact your administrator"
|
|
56
|
+
);
|
|
57
|
+
setReportViewerState("ERROR");
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (reportInfo) {
|
|
64
|
+
if (
|
|
65
|
+
props?.byPassParameterEntry === true ||
|
|
66
|
+
reportInfo.reportParameters.length == 0
|
|
67
|
+
) {
|
|
68
|
+
runReport(parametersValues);
|
|
69
|
+
setReportViewerState("WAITING_RESULT");
|
|
70
|
+
} else {
|
|
71
|
+
setReportViewerState("WAITING_PARAMETER_INPUT");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}, [reportInfo]);
|
|
75
|
+
|
|
76
|
+
const runReport = async (params) => {
|
|
77
|
+
setReportViewerState("WAITING_RESULT");
|
|
78
|
+
if (reportInfo?.reportType === "Excel") {
|
|
79
|
+
await handlePostRequest({
|
|
80
|
+
endPointURI: "api/v1/public/report/run",
|
|
81
|
+
showMask: true,
|
|
82
|
+
data: {
|
|
83
|
+
reportCode: props.reportCode,
|
|
84
|
+
parameters: params,
|
|
85
|
+
resultMode: props.resultMode,
|
|
86
|
+
jasperOutPutFileType: props.jasperOutPutFileType,
|
|
87
|
+
},
|
|
88
|
+
successCallBkFn: (response: any) => {
|
|
89
|
+
setReportViewerState("SHOWING_RESULT");
|
|
90
|
+
setExcelReportData(response.data);
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
} else if (reportInfo?.reportType) {
|
|
94
|
+
await HandleDownloadHTTPPostPDF({
|
|
95
|
+
endPointURI: "api/v1/public/report/run",
|
|
96
|
+
showMask: true,
|
|
97
|
+
data: {
|
|
98
|
+
reportCode: props.reportCode,
|
|
99
|
+
parameters: params,
|
|
100
|
+
resultMode: props.resultMode,
|
|
101
|
+
jasperOutPutFileType: props.jasperOutPutFileType,
|
|
102
|
+
},
|
|
103
|
+
successCallBkFn: (response: any) => {
|
|
104
|
+
setReportViewerState("SHOWING_RESULT");
|
|
105
|
+
const contentDisposition = response.headers["content-disposition"];
|
|
106
|
+
let filename = "downloaded_file";
|
|
107
|
+
if (
|
|
108
|
+
contentDisposition &&
|
|
109
|
+
contentDisposition.indexOf("filename=") !== -1
|
|
110
|
+
) {
|
|
111
|
+
const match = contentDisposition.match(/filename="?([^"]+)"?/);
|
|
112
|
+
if (match && match[1]) filename = match[1];
|
|
113
|
+
}
|
|
114
|
+
if (filename.includes("pdf")) {
|
|
115
|
+
const file = new Blob([response.data], { type: "application/pdf" });
|
|
116
|
+
const url = URL.createObjectURL(file);
|
|
117
|
+
setBlobUrl(url);
|
|
118
|
+
} else {
|
|
119
|
+
const blob = new Blob([response.data], {
|
|
120
|
+
type: response.headers["content-type"],
|
|
121
|
+
});
|
|
122
|
+
// Create a temporary anchor element
|
|
123
|
+
const url = window.URL.createObjectURL(blob);
|
|
124
|
+
const link = document.createElement("a");
|
|
125
|
+
link.href = url;
|
|
126
|
+
// Optional: Try to get filename from response headers
|
|
127
|
+
|
|
128
|
+
link.download = filename;
|
|
129
|
+
document.body.appendChild(link);
|
|
130
|
+
link.click();
|
|
131
|
+
|
|
132
|
+
// Clean up
|
|
133
|
+
document.body.removeChild(link);
|
|
134
|
+
window.URL.revokeObjectURL(url);
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
failureCallBkFn: (response) => {
|
|
138
|
+
setErrorMessage(
|
|
139
|
+
"Failed To run report ... contact your administrator"
|
|
140
|
+
);
|
|
141
|
+
setReportViewerState("ERROR");
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
if (props?.reportCode) {
|
|
149
|
+
loadReportData();
|
|
150
|
+
}
|
|
151
|
+
}, [
|
|
152
|
+
props.reportCode,
|
|
153
|
+
props.byPassParameterEntry,
|
|
154
|
+
props.reportParametersValues,
|
|
155
|
+
props.jasperOutPutFileType,
|
|
156
|
+
props.resultMode,
|
|
157
|
+
]);
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<>
|
|
161
|
+
<Box
|
|
162
|
+
sx={{
|
|
163
|
+
display: "flex",
|
|
164
|
+
alignItems: "center",
|
|
165
|
+
justifyContent: "center",
|
|
166
|
+
width: "100%",
|
|
167
|
+
}}
|
|
168
|
+
>
|
|
169
|
+
<Box sx={{ flex: 1, textAlign: "center", marginBottom: 1 }}>
|
|
170
|
+
<FontAwesomeIcon
|
|
171
|
+
icon={
|
|
172
|
+
reportInfo?.reportType === "Excel" ? "file-excel" : "file-pdf"
|
|
173
|
+
}
|
|
174
|
+
color={reportInfo?.reportType === "Excel" ? "darkgreen" : "darkred"}
|
|
175
|
+
style={{ marginRight: 10, marginLeft: 10 }}
|
|
176
|
+
/>
|
|
177
|
+
{reportInfo?.reportName}
|
|
178
|
+
</Box>
|
|
179
|
+
{reportInfo?.reportType != "Excel" ? (
|
|
180
|
+
reportViewerState === "SHOWING_RESULT" ? (
|
|
181
|
+
<>
|
|
182
|
+
{props?.byPassParameterEntry === true ? (
|
|
183
|
+
<></>
|
|
184
|
+
) : reportInfo?.reportParameters.length > 0 ? (
|
|
185
|
+
<IconButton
|
|
186
|
+
onClick={() => {
|
|
187
|
+
setReportViewerState("WAITING_PARAMETER_INPUT");
|
|
188
|
+
}}
|
|
189
|
+
>
|
|
190
|
+
<FontAwesomeIcon icon="filter" />
|
|
191
|
+
</IconButton>
|
|
192
|
+
) : (
|
|
193
|
+
<></>
|
|
194
|
+
)}
|
|
195
|
+
<IconButton>
|
|
196
|
+
<FontAwesomeIcon
|
|
197
|
+
icon="refresh"
|
|
198
|
+
onClick={() => {
|
|
199
|
+
runReport(parametersValues);
|
|
200
|
+
}}
|
|
201
|
+
/>
|
|
202
|
+
</IconButton>
|
|
203
|
+
</>
|
|
204
|
+
) : (
|
|
205
|
+
<></>
|
|
206
|
+
)
|
|
207
|
+
) : (
|
|
208
|
+
<></>
|
|
209
|
+
)}
|
|
210
|
+
</Box>
|
|
211
|
+
<Box
|
|
212
|
+
sx={{
|
|
213
|
+
flexGrow: 1,
|
|
214
|
+
width: "100%",
|
|
215
|
+
display: "flex",
|
|
216
|
+
flexDirection: "column",
|
|
217
|
+
alignItems: "center",
|
|
218
|
+
justifyContent: "flex-start",
|
|
219
|
+
}}
|
|
220
|
+
>
|
|
221
|
+
{reportViewerState === "WAITING_PARAMETER_INPUT" &&
|
|
222
|
+
reportInfo?.reportType != "Excel" ? (
|
|
223
|
+
<ParameterPanel searchBtnClickCallBk={runReport} />
|
|
224
|
+
) : reportViewerState === "SHOWING_RESULT" ||
|
|
225
|
+
((reportViewerState === "WAITING_PARAMETER_INPUT" ||
|
|
226
|
+
reportViewerState === "WAITING_RESULT") &&
|
|
227
|
+
reportInfo?.reportType === "Excel") ? (
|
|
228
|
+
reportInfo?.reportType === "Excel" ? (
|
|
229
|
+
<ExcelReportViewer
|
|
230
|
+
reportData={excelReportData}
|
|
231
|
+
setReportData={setExcelReportData}
|
|
232
|
+
reloadReport={async () => {
|
|
233
|
+
runReport(parametersValues);
|
|
234
|
+
}}
|
|
235
|
+
gridLoadParameters={panelElements}
|
|
236
|
+
gridLoadParametersValues={parametersValues}
|
|
237
|
+
setGridLoadParametersValues={setParametersValues}
|
|
238
|
+
/>
|
|
239
|
+
) : (
|
|
240
|
+
<iframe
|
|
241
|
+
src={blobUrl}
|
|
242
|
+
width="100%"
|
|
243
|
+
height="100%"
|
|
244
|
+
title="PDF Preview"
|
|
245
|
+
style={{ border: "1px solid #ccc", marginTop: "20px" }}
|
|
246
|
+
></iframe>
|
|
247
|
+
)
|
|
248
|
+
) : reportViewerState === "ERROR" ? (
|
|
249
|
+
<Box
|
|
250
|
+
sx={{
|
|
251
|
+
display: "flex",
|
|
252
|
+
flex: 1,
|
|
253
|
+
alignItems: "center",
|
|
254
|
+
justifyContent: "center",
|
|
255
|
+
}}
|
|
256
|
+
>
|
|
257
|
+
<FontAwesomeIcon
|
|
258
|
+
icon="circle-exclamation"
|
|
259
|
+
color="darkred"
|
|
260
|
+
style={{ marginRight: 10, marginLeft: 10 }}
|
|
261
|
+
/>
|
|
262
|
+
{errorMessage}
|
|
263
|
+
</Box>
|
|
264
|
+
) : (
|
|
265
|
+
<></>
|
|
266
|
+
)}
|
|
267
|
+
</Box>
|
|
268
|
+
</>
|
|
269
|
+
);
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
export default ReportViewer;
|