@asaleh37/ui-base 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +20 -13
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -3
- package/src/components/App.tsx +1 -1
- package/src/components/BaseApp.tsx +2 -19
- package/src/components/administration/admin/OrgMemberRoleForm.tsx +83 -0
- package/src/components/administration/admin/OrganizationApplicationModuleGrid.tsx +131 -0
- package/src/components/administration/admin/OrganizationGrid.tsx +165 -0
- package/src/components/administration/admin/OrganizationMemberGrid.tsx +176 -0
- package/src/components/administration/admin/OrganizationMemberRoleGrid.tsx +87 -0
- package/src/components/{admin → administration/admin}/OrganizationRankGrid.tsx +49 -19
- package/src/components/administration/admin/OrganizationUnitGrid.tsx +139 -0
- package/src/components/administration/admin/OrganizationUnitTypeGrid.tsx +121 -0
- package/src/components/administration/admin/PersonGrid.tsx +195 -0
- package/src/components/{admin → administration/admin}/RoleAuthoritiesForm.tsx +30 -11
- package/src/components/administration/admin/SystemApplicationAuthorityGrid.tsx +142 -0
- package/src/components/administration/admin/SystemApplicationGrid.tsx +161 -0
- package/src/components/administration/admin/SystemApplicationModuleGrid.tsx +109 -0
- package/src/components/administration/admin/SystemApplicationRoleAuthorityGrid.tsx +67 -0
- package/src/components/administration/admin/SystemApplicationRoleGrid.tsx +130 -0
- package/src/components/administration/dev/BluePrintGrid.tsx +129 -0
- package/src/components/administration/dev/DashboardGrid.tsx +173 -0
- package/src/components/administration/dev/DashboardWidgetGrid.tsx +164 -0
- package/src/components/administration/dev/DataQueryGrid.tsx +206 -0
- package/src/components/administration/dev/DataQueryParameterGrid.tsx +191 -0
- package/src/components/administration/dev/DataQueryParametersForm.tsx +84 -0
- package/src/components/administration/dev/DatasourceConnectionGrid.tsx +150 -0
- package/src/components/administration/dev/EntityParameterGrid.tsx +279 -0
- package/src/components/administration/dev/LookupGrid.tsx +131 -0
- package/src/components/administration/dev/MailAttachmentGrid.tsx +155 -0
- package/src/components/administration/dev/MailBodyGrid.tsx +215 -0
- package/src/components/{admin → administration/dev}/MailNotificationQueueGrid.tsx +114 -26
- package/src/components/administration/dev/MailRecipientGrid.tsx +169 -0
- package/src/components/administration/dev/MailSenderConfigGrid.tsx +478 -0
- package/src/components/administration/dev/MailTemplateGrid.tsx +388 -0
- package/src/components/administration/dev/ReportGrid.tsx +504 -0
- package/src/components/administration/dev/ReportParameterGrid.tsx +186 -0
- package/src/components/administration/dev/ReportParametersForm.tsx +84 -0
- package/src/components/administration/dev/WidgetGrid.tsx +431 -0
- package/src/components/administration/dev/WorkflowDocumentActionGrid.tsx +264 -0
- package/src/components/administration/dev/WorkflowDocumentActionHistoryGrid.tsx +172 -0
- package/src/components/administration/dev/WorkflowDocumentActionMailGrid.tsx +161 -0
- package/src/components/administration/dev/WorkflowDocumentGrid.tsx +377 -0
- package/src/components/{admin → administration/dev}/WorkflowDocumentMailLogGrid.tsx +87 -10
- package/src/components/administration/dev/WorkflowDocumentStatusGrid.tsx +243 -0
- package/src/components/common/ChangeOrgForm.tsx +81 -0
- package/src/components/common/Home.tsx +28 -22
- package/src/components/common/LoadingMask.tsx +9 -4
- package/src/components/common/Login.tsx +9 -13
- package/src/components/templates/DataEntryTemplates/DataEntryTypes.ts +30 -6
- package/src/components/templates/DataEntryTemplates/DataEntryUtil.ts +46 -5
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementField.tsx +64 -5
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementGroup.tsx +11 -3
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/CheckBox.tsx +2 -2
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/ComboBox.tsx +1 -2
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/HtmlEditor.tsx +144 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/SystemLookupCombobox.tsx +55 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/TemplateTextField.tsx +9 -1
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/TemplateForm.tsx +45 -5
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/DataGridColumnsUtil.tsx +8 -7
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid.tsx +38 -10
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridRecordAction.tsx +4 -1
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGridTopBar.tsx +3 -4
- package/src/components/templates/TransferList.tsx +16 -6
- package/src/components/templates/index.ts +0 -2
- package/src/components/templates/report/ExcelReportViewer.tsx +65 -0
- package/src/components/templates/report/ReportViewer.tsx +382 -0
- package/src/components/templates/visuals/DashboardRouteView.tsx +9 -0
- package/src/components/templates/visuals/DashboardViewer.tsx +148 -0
- package/src/components/templates/visuals/WidgetViewer.tsx +198 -0
- package/src/components/templates/visuals/charts/TemplateBarChart.tsx +9 -2
- package/src/components/templates/visuals/charts/TemplateDataCard.tsx +6 -31
- package/src/components/templates/visuals/charts/TemplateGauge.tsx +8 -3
- package/src/components/templates/visuals/charts/TemplateLineChart.tsx +8 -2
- package/src/components/templates/visuals/charts/TemplateLineProgress.tsx +5 -3
- package/src/components/templates/visuals/charts/TemplatePieChart.tsx +1 -2
- package/src/components/templates/workflow/WorkflowDocumentPanel.tsx +581 -0
- package/src/components/templates/workflow/WorkflowDocumentTimeLine.tsx +134 -0
- package/src/hooks/UseSession.tsx +3 -7
- package/src/hooks/UseWindow.tsx +2 -1
- package/src/hooks/useAxios.tsx +9 -27
- package/src/hooks/useLookupGridColumn.tsx +35 -0
- package/src/layout/Layout.tsx +2 -46
- package/src/layout/MainContent.tsx +60 -7
- package/src/layout/MobileDrawer.tsx +5 -5
- package/src/layout/NavigationTree.tsx +0 -1
- package/src/layout/RouteWrapper.tsx +36 -0
- package/src/layout/SideBar.tsx +15 -10
- package/src/layout/TopBar.tsx +139 -71
- package/src/locales/arabic/adminLocalsAr.json +81 -344
- package/src/locales/arabic/common.json +11 -1
- package/src/locales/arabic/devLocalsAr.json +280 -0
- package/src/locales/arabic/index.ts +2 -0
- package/src/locales/english/adminLocalsEn.json +86 -346
- package/src/locales/english/common.json +11 -1
- package/src/locales/english/devLocalsEn.json +281 -0
- package/src/locales/english/index.ts +3 -0
- package/src/main.tsx +5 -6
- package/src/navigationItems/Administration/adminNavigationItems.tsx +65 -99
- package/src/navigationItems/Administration/index.tsx +10 -65
- package/src/redux/features/administration/AdministrationStoresMetaData.ts +45 -12
- package/src/redux/features/common/AppLayoutSlice.ts +0 -8
- package/src/redux/features/common/CommonStoreSlice.ts +4 -0
- package/src/redux/features/common/SideBarSlice.ts +29 -0
- package/src/redux/features/common/UserSessionSlice.ts +15 -23
- package/src/redux/store.ts +1 -1
- package/src/routes/administration/adminRoutes.tsx +41 -222
- package/src/routes/administration/devRoutes.tsx +90 -0
- package/src/routes/administration/index.ts +5 -1
- package/src/routes/index.ts +1 -0
- package/src/styles/index.css +3 -3
- package/src/util/AppUtils.ts +5 -0
- package/vite.config.ts +14 -0
- package/src/components/admin/AttachmentGrid.tsx +0 -116
- package/src/components/admin/AuthorityGrid.tsx +0 -88
- package/src/components/admin/BluePrintGrid.tsx +0 -55
- package/src/components/admin/BluePrintPageGrid.tsx +0 -85
- package/src/components/admin/BluePrintPointGrid.tsx +0 -85
- package/src/components/admin/DashboardGrid.tsx +0 -95
- package/src/components/admin/DashboardWidgetGrid.tsx +0 -75
- package/src/components/admin/DataQueryGrid.tsx +0 -75
- package/src/components/admin/DataQueryParameterGrid.tsx +0 -98
- package/src/components/admin/DatasourceConnectionGrid.tsx +0 -98
- package/src/components/admin/EmployeeGrid.tsx +0 -105
- package/src/components/admin/EntityParameterGrid.tsx +0 -125
- package/src/components/admin/ExcelUploaderDetailGrid.tsx +0 -78
- package/src/components/admin/ExcelUploaderHeaderGrid.tsx +0 -78
- package/src/components/admin/LookupGrid.tsx +0 -95
- package/src/components/admin/MailAttachmentGrid.tsx +0 -65
- package/src/components/admin/MailBodyGrid.tsx +0 -105
- package/src/components/admin/MailRecipientGrid.tsx +0 -75
- package/src/components/admin/MailTemplateGrid.tsx +0 -145
- package/src/components/admin/NewTableGrid.tsx +0 -65
- package/src/components/admin/NotificationGrid.tsx +0 -115
- package/src/components/admin/NotificationQueueGrid.tsx +0 -125
- package/src/components/admin/OrganizationApplicationGrid.tsx +0 -81
- package/src/components/admin/OrganizationGrid.tsx +0 -65
- package/src/components/admin/OrganizationUnitGrid.tsx +0 -85
- package/src/components/admin/OrganizationUserGrid.tsx +0 -75
- package/src/components/admin/OrganizationUserRoleGrid.tsx +0 -98
- package/src/components/admin/ReportGrid.tsx +0 -155
- package/src/components/admin/ReportParameterGrid.tsx +0 -95
- package/src/components/admin/RoleAuthorityGrid.tsx +0 -65
- package/src/components/admin/RoleGrid.tsx +0 -132
- package/src/components/admin/UserAccountGrid.tsx +0 -65
- package/src/components/admin/UserRequestGrid.tsx +0 -145
- package/src/components/admin/WidgetGrid.tsx +0 -175
- package/src/components/admin/WorkflowDocumentActionGrid.tsx +0 -111
- package/src/components/admin/WorkflowDocumentActionHistoryGrid.tsx +0 -111
- package/src/components/admin/WorkflowDocumentActionMailGrid.tsx +0 -71
- package/src/components/admin/WorkflowDocumentGrid.tsx +0 -185
- package/src/components/admin/WorkflowDocumentStatusGrid.tsx +0 -121
- package/src/components/templates/visuals/TemplateDashboard.tsx +0 -126
- package/src/redux/features/CounterSlice.tsx +0 -13
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { Box, Grid2, IconButton } from "@mui/material";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { useAxios } from "../../../hooks";
|
|
4
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
5
|
+
import WidgetViewer, { Widget } from "./WidgetViewer";
|
|
6
|
+
import { useNavigate } from "react-router-dom";
|
|
7
|
+
|
|
8
|
+
type DashboardViewerProps = {
|
|
9
|
+
dashboardCode: string;
|
|
10
|
+
parameters?: { [key: string]: any };
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export interface WidgetProps {
|
|
14
|
+
widgetTitle?: string;
|
|
15
|
+
widgetType: "Line" | "Bar" | "Pie" | "Card" | "Gauge" | "Progress";
|
|
16
|
+
data: any;
|
|
17
|
+
valueLabel?: string;
|
|
18
|
+
valueField: string; //x-axis field in case of line/bar chart
|
|
19
|
+
labelField: string; //y-axis field in case of line/bar chart, it can also be a comma separated string for multiple series
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface SingleRecordWidgetProps {
|
|
23
|
+
widgetTitle?: string;
|
|
24
|
+
record: object;
|
|
25
|
+
valueField: string;
|
|
26
|
+
labelField: string;
|
|
27
|
+
total?: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type DashboardInfo = {
|
|
31
|
+
dashboardCode: string;
|
|
32
|
+
dashboardName: string;
|
|
33
|
+
dashboardTitle: string;
|
|
34
|
+
widgets: Array<Widget>;
|
|
35
|
+
dashboardParameters: Array<any>;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const DashboardViewer: React.FC<DashboardViewerProps> = (props) => {
|
|
39
|
+
const [dashboardInfo, setDashboardInfo] = useState<DashboardInfo>({
|
|
40
|
+
dashboardCode: "",
|
|
41
|
+
dashboardName: "",
|
|
42
|
+
dashboardTitle: "",
|
|
43
|
+
dashboardParameters: [],
|
|
44
|
+
widgets: [],
|
|
45
|
+
});
|
|
46
|
+
const [dashboardParameterValues, setDashboardParameterValues] = useState<{
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
}>(props?.parameters || {});
|
|
49
|
+
const navigate = useNavigate();
|
|
50
|
+
const { handleGetRequest, handlePostRequest } = useAxios();
|
|
51
|
+
const loadDashboardInfo = async () => {
|
|
52
|
+
await handleGetRequest({
|
|
53
|
+
endPointURI: "api/v1/dev/dashboard/metadata",
|
|
54
|
+
showMask: true,
|
|
55
|
+
parameters: {
|
|
56
|
+
dashboardCode: props.dashboardCode,
|
|
57
|
+
},
|
|
58
|
+
successCallBkFn: (response) => {
|
|
59
|
+
setDashboardInfo(response.data);
|
|
60
|
+
},
|
|
61
|
+
failureCallBkFn: () => {
|
|
62
|
+
setDashboardInfo(null);
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (props.dashboardCode) {
|
|
68
|
+
loadDashboardInfo();
|
|
69
|
+
}
|
|
70
|
+
}, [props.dashboardCode, props.parameters]);
|
|
71
|
+
return (
|
|
72
|
+
<>
|
|
73
|
+
{dashboardInfo ? (
|
|
74
|
+
<>
|
|
75
|
+
<Box
|
|
76
|
+
sx={{
|
|
77
|
+
fontSize: 20,
|
|
78
|
+
fontWeight: "bold",
|
|
79
|
+
display: "flex",
|
|
80
|
+
alignItems: "center",
|
|
81
|
+
justifyContent: "center",
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
<IconButton
|
|
85
|
+
onClick={() => {
|
|
86
|
+
navigate(-1, { replace: true });
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
<FontAwesomeIcon icon="arrow-left" />
|
|
90
|
+
</IconButton>
|
|
91
|
+
<Box sx={{ flex: 1 }}></Box>
|
|
92
|
+
<FontAwesomeIcon
|
|
93
|
+
style={{ marginLeft: 10, marginRight: 10 }}
|
|
94
|
+
icon={"square-poll-vertical"}
|
|
95
|
+
/>
|
|
96
|
+
<Box>{dashboardInfo?.dashboardTitle}</Box>
|
|
97
|
+
<Box sx={{ flex: 1 }}></Box>
|
|
98
|
+
</Box>
|
|
99
|
+
<Grid2
|
|
100
|
+
container
|
|
101
|
+
spacing={1}
|
|
102
|
+
sx={{
|
|
103
|
+
flexGrow: 1,
|
|
104
|
+
overflowY: "auto",
|
|
105
|
+
padding: 1,
|
|
106
|
+
}}
|
|
107
|
+
>
|
|
108
|
+
{dashboardInfo?.widgets.map((widget, index) => {
|
|
109
|
+
return (
|
|
110
|
+
<Grid2
|
|
111
|
+
key={index}
|
|
112
|
+
sx={{
|
|
113
|
+
alignItems: "center",
|
|
114
|
+
justifyContent: "center",
|
|
115
|
+
padding: 1,
|
|
116
|
+
display: "flex",
|
|
117
|
+
overflow: "auto",
|
|
118
|
+
flexDirection:
|
|
119
|
+
widget.widgetType != "Card" ? "column" : undefined,
|
|
120
|
+
height: widget?.height || 300,
|
|
121
|
+
}}
|
|
122
|
+
size={{ md: widget?.width, sm: 12 }}
|
|
123
|
+
>
|
|
124
|
+
<WidgetViewer {...widget} />
|
|
125
|
+
</Grid2>
|
|
126
|
+
);
|
|
127
|
+
})}
|
|
128
|
+
</Grid2>
|
|
129
|
+
</>
|
|
130
|
+
) : (
|
|
131
|
+
<Box
|
|
132
|
+
sx={{
|
|
133
|
+
flex: 1,
|
|
134
|
+
display: "flex",
|
|
135
|
+
alignItems: "center",
|
|
136
|
+
justifyContent: "center",
|
|
137
|
+
fontSize: 24,
|
|
138
|
+
fontWeight: "bold",
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
No Dashboard Found
|
|
142
|
+
</Box>
|
|
143
|
+
)}
|
|
144
|
+
</>
|
|
145
|
+
);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export default DashboardViewer;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
2
|
+
import { WidgetType } from "../../administration/dev/WidgetGrid";
|
|
3
|
+
import { Backdrop, Box, CircularProgress, Grid2 } from "@mui/material";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import LoadingMask from "../../common/LoadingMask";
|
|
6
|
+
import { useTranslation } from "react-i18next";
|
|
7
|
+
import { useSelector } from "react-redux";
|
|
8
|
+
import { useAxios } from "../../../hooks";
|
|
9
|
+
import TemplateLineChart from "./charts/TemplateLineChart";
|
|
10
|
+
import TemplateBarChart from "./charts/TemplateBarChart";
|
|
11
|
+
import TemplatePieChart from "./charts/TemplatePieChart";
|
|
12
|
+
import TemplateDataCard from "./charts/TemplateDataCard";
|
|
13
|
+
import TemplateGauge from "./charts/TemplateGauge";
|
|
14
|
+
import TemplateLineProgress from "./charts/TemplateLineProgress";
|
|
15
|
+
|
|
16
|
+
export type Widget = {
|
|
17
|
+
widgetName: string;
|
|
18
|
+
widgetDescription: string;
|
|
19
|
+
title: string;
|
|
20
|
+
icon: any;
|
|
21
|
+
dataQueryId: number;
|
|
22
|
+
widgetType: WidgetType;
|
|
23
|
+
width: any;
|
|
24
|
+
height: any;
|
|
25
|
+
horizontalAxisField: any;
|
|
26
|
+
horizontalAxisLabel: any;
|
|
27
|
+
verticalAxisField: string;
|
|
28
|
+
verticalAxisLabel: string;
|
|
29
|
+
seriesKeys: any;
|
|
30
|
+
parameterValues: {
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const WidgetViewer: React.FC<Widget> = (props) => {
|
|
36
|
+
const [isWidgetLoading, setWidgetLoading] = useState(true);
|
|
37
|
+
const [data, setData] = useState([]);
|
|
38
|
+
const { handleGetRequest } = useAxios();
|
|
39
|
+
const getWidgetData = async () => {
|
|
40
|
+
setWidgetLoading(true);
|
|
41
|
+
await handleGetRequest({
|
|
42
|
+
endPointURI: "api/v1/dev/query/result",
|
|
43
|
+
showMask: false,
|
|
44
|
+
parameters: {
|
|
45
|
+
queryId: props.dataQueryId,
|
|
46
|
+
...props.parameterValues,
|
|
47
|
+
},
|
|
48
|
+
successCallBkFn: (response) => {
|
|
49
|
+
setWidgetLoading(false);
|
|
50
|
+
setData(response.data);
|
|
51
|
+
},
|
|
52
|
+
failureCallBkFn: () => {
|
|
53
|
+
setWidgetLoading(false);
|
|
54
|
+
setData(null);
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
getWidgetData();
|
|
60
|
+
}, [props.parameterValues]);
|
|
61
|
+
|
|
62
|
+
let total = 0;
|
|
63
|
+
if (data.length == 1) {
|
|
64
|
+
total = 100;
|
|
65
|
+
}
|
|
66
|
+
if (
|
|
67
|
+
props.widgetType === "CircularProgress" ||
|
|
68
|
+
props.widgetType === "LinearProgress"
|
|
69
|
+
) {
|
|
70
|
+
for (const record of data) {
|
|
71
|
+
total += record[props.verticalAxisField];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
{props.widgetType === "LineChart" ||
|
|
77
|
+
props.widgetType === "PieChart" ||
|
|
78
|
+
props.widgetType === "ColumnChart" ? (
|
|
79
|
+
<Box>
|
|
80
|
+
<FontAwesomeIcon
|
|
81
|
+
style={{ marginRight: 10, marginLeft: 10 }}
|
|
82
|
+
icon={props?.icon || "chart-pie"}
|
|
83
|
+
/>
|
|
84
|
+
{props?.title}
|
|
85
|
+
</Box>
|
|
86
|
+
) : (
|
|
87
|
+
<></>
|
|
88
|
+
)}
|
|
89
|
+
|
|
90
|
+
<Box
|
|
91
|
+
sx={{
|
|
92
|
+
flex: 1,
|
|
93
|
+
display: "flex",
|
|
94
|
+
alignItems: "center",
|
|
95
|
+
justifyContent: "center",
|
|
96
|
+
width: "100%",
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
{isWidgetLoading ? (
|
|
100
|
+
<>
|
|
101
|
+
<FontAwesomeIcon
|
|
102
|
+
icon={{ prefix: "fas", iconName: "arrows-spin" }}
|
|
103
|
+
style={{ marginRight: 10, marginLeft: 10 }}
|
|
104
|
+
spin
|
|
105
|
+
size="2x"
|
|
106
|
+
/>
|
|
107
|
+
<div>Loading</div>
|
|
108
|
+
</>
|
|
109
|
+
) : props.widgetType === "ColumnChart" ? (
|
|
110
|
+
<TemplateBarChart
|
|
111
|
+
data={data}
|
|
112
|
+
widgetTitle={props.title}
|
|
113
|
+
labelField={props.verticalAxisField}
|
|
114
|
+
valueField={props.horizontalAxisField}
|
|
115
|
+
valueLabel={props.horizontalAxisLabel}
|
|
116
|
+
widgetType="Line"
|
|
117
|
+
/>
|
|
118
|
+
) : props.widgetType === "LineChart" ? (
|
|
119
|
+
<TemplateLineChart
|
|
120
|
+
data={data}
|
|
121
|
+
widgetTitle={props.title}
|
|
122
|
+
labelField={props.verticalAxisField}
|
|
123
|
+
valueField={props.horizontalAxisField}
|
|
124
|
+
valueLabel={props.horizontalAxisLabel}
|
|
125
|
+
widgetType="Line"
|
|
126
|
+
/>
|
|
127
|
+
) : props.widgetType === "PieChart" ? (
|
|
128
|
+
<TemplatePieChart
|
|
129
|
+
data={data}
|
|
130
|
+
widgetTitle={props.title}
|
|
131
|
+
labelField={props.horizontalAxisField}
|
|
132
|
+
valueField={props.verticalAxisField}
|
|
133
|
+
widgetType="Line"
|
|
134
|
+
/>
|
|
135
|
+
) : (
|
|
136
|
+
<Grid2
|
|
137
|
+
container
|
|
138
|
+
sx={{
|
|
139
|
+
width: "100%",
|
|
140
|
+
alignItems: "flex-start",
|
|
141
|
+
justifyContent: "flex-start",
|
|
142
|
+
}}
|
|
143
|
+
spacing={2}
|
|
144
|
+
size={{ xs: 12 }}
|
|
145
|
+
>
|
|
146
|
+
<Grid2 size={{ xs: 12 }} sx={{ textAlign: "center" }}>
|
|
147
|
+
{props.title}
|
|
148
|
+
</Grid2>
|
|
149
|
+
|
|
150
|
+
{data.map((record, index) => {
|
|
151
|
+
if (props.widgetType === "Card") {
|
|
152
|
+
return (
|
|
153
|
+
<Grid2 size={{ md: 3, xs: 12 }}>
|
|
154
|
+
<TemplateDataCard
|
|
155
|
+
key={index}
|
|
156
|
+
widgetTitle={""}
|
|
157
|
+
record={record}
|
|
158
|
+
labelField={props.verticalAxisField}
|
|
159
|
+
valueField={props.horizontalAxisField}
|
|
160
|
+
/>
|
|
161
|
+
</Grid2>
|
|
162
|
+
);
|
|
163
|
+
} else if (props.widgetType === "CircularProgress") {
|
|
164
|
+
return (
|
|
165
|
+
<Grid2 size={{ md: 3, xs: 12 }}>
|
|
166
|
+
<TemplateGauge
|
|
167
|
+
key={index}
|
|
168
|
+
widgetTitle={""}
|
|
169
|
+
record={record}
|
|
170
|
+
labelField={props.horizontalAxisField}
|
|
171
|
+
valueField={props.verticalAxisField}
|
|
172
|
+
total={total}
|
|
173
|
+
/>
|
|
174
|
+
</Grid2>
|
|
175
|
+
);
|
|
176
|
+
} else if (props.widgetType === "LinearProgress") {
|
|
177
|
+
return (
|
|
178
|
+
<Grid2 size={{ md: 3, xs: 12 }}>
|
|
179
|
+
<TemplateLineProgress
|
|
180
|
+
key={index}
|
|
181
|
+
widgetTitle={""}
|
|
182
|
+
record={record}
|
|
183
|
+
labelField={props.horizontalAxisField}
|
|
184
|
+
valueField={props.verticalAxisField}
|
|
185
|
+
total={total}
|
|
186
|
+
/>
|
|
187
|
+
</Grid2>
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
})}
|
|
191
|
+
</Grid2>
|
|
192
|
+
)}
|
|
193
|
+
</Box>
|
|
194
|
+
</>
|
|
195
|
+
);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export default WidgetViewer;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { BarChart } from "@mui/x-charts";
|
|
2
|
-
import { WidgetProps } from "../
|
|
2
|
+
import { WidgetProps } from "../DashboardViewer";
|
|
3
|
+
|
|
3
4
|
|
|
4
5
|
const TemplateBarChart: React.FC<WidgetProps> = (props) => {
|
|
5
6
|
return (
|
|
6
7
|
<BarChart
|
|
7
8
|
dataset={props.data}
|
|
8
|
-
xAxis={[
|
|
9
|
+
xAxis={[
|
|
10
|
+
{
|
|
11
|
+
dataKey: props.valueField,
|
|
12
|
+
scaleType: "band",
|
|
13
|
+
label: props.valueLabel,
|
|
14
|
+
},
|
|
15
|
+
]}
|
|
9
16
|
series={props.labelField?.split(",").map((labelField) => {
|
|
10
17
|
return { dataKey: labelField, label: labelField };
|
|
11
18
|
})}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Box, Paper, Typography } from "@mui/material";
|
|
2
|
-
import { SingleRecordWidgetProps } from "../
|
|
2
|
+
import { SingleRecordWidgetProps } from "../DashboardViewer";
|
|
3
|
+
|
|
3
4
|
|
|
4
5
|
const TemplateDataCard: React.FC<SingleRecordWidgetProps> = (props: any) => {
|
|
5
6
|
return (
|
|
@@ -22,37 +23,11 @@ const TemplateDataCard: React.FC<SingleRecordWidgetProps> = (props: any) => {
|
|
|
22
23
|
alignItems: "center",
|
|
23
24
|
}}
|
|
24
25
|
>
|
|
25
|
-
<
|
|
26
|
-
{props.widgetTitle}
|
|
27
|
-
</Typography>
|
|
28
|
-
</Box>
|
|
29
|
-
<Box
|
|
30
|
-
sx={{
|
|
31
|
-
flex: 1,
|
|
32
|
-
display: "flex",
|
|
33
|
-
width: "100%",
|
|
34
|
-
justifyContent: "space-evenly",
|
|
35
|
-
alignItems: "center",
|
|
36
|
-
}}
|
|
37
|
-
>
|
|
38
|
-
{/* <div>left</div> */}
|
|
39
|
-
<div>{`${props.record[props.labelField]} : ${
|
|
40
|
-
props.record[props.valueField]
|
|
41
|
-
}`}</div>
|
|
42
|
-
{/* <div>right</div> */}
|
|
43
|
-
</Box>
|
|
44
|
-
<Box
|
|
45
|
-
sx={{
|
|
46
|
-
display: "flex",
|
|
47
|
-
width: "100%",
|
|
48
|
-
justifyContent: "space-evenly",
|
|
49
|
-
alignItems: "center",
|
|
50
|
-
}}
|
|
51
|
-
>
|
|
52
|
-
{/* <div>left</div>
|
|
53
|
-
<div>center</div>
|
|
54
|
-
<div>right</div> */}
|
|
26
|
+
<div>{props.record[props.valueField]}</div>
|
|
55
27
|
</Box>
|
|
28
|
+
<Typography sx={{ fontSize: 16, fontWeight: "bold" }}>
|
|
29
|
+
{props.record[props.labelField]}
|
|
30
|
+
</Typography>
|
|
56
31
|
</Paper>
|
|
57
32
|
);
|
|
58
33
|
};
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { Gauge } from "@mui/x-charts";
|
|
2
|
-
import { SingleRecordWidgetProps } from "../
|
|
2
|
+
import { SingleRecordWidgetProps } from "../DashboardViewer";
|
|
3
3
|
import { Typography } from "@mui/material";
|
|
4
4
|
|
|
5
5
|
const TemplateGauge: React.FC<SingleRecordWidgetProps> = (props: any) => {
|
|
6
6
|
return (
|
|
7
7
|
<>
|
|
8
8
|
<Typography sx={{ fontSize: 16, fontWeight: "bold" }}>
|
|
9
|
-
{props.
|
|
9
|
+
{props.record[props.labelField]}
|
|
10
10
|
</Typography>
|
|
11
|
-
<Gauge
|
|
11
|
+
<Gauge
|
|
12
|
+
width={200}
|
|
13
|
+
height={200}
|
|
14
|
+
value={props.record[props.valueField]}
|
|
15
|
+
valueMax={props.total}
|
|
16
|
+
/>
|
|
12
17
|
</>
|
|
13
18
|
);
|
|
14
19
|
};
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { LineChart } from "@mui/x-charts";
|
|
2
|
-
import { WidgetProps } from "../
|
|
2
|
+
import { WidgetProps } from "../DashboardViewer";
|
|
3
3
|
|
|
4
4
|
const TemplateLineChart: React.FC<WidgetProps> = (props) => {
|
|
5
5
|
return (
|
|
6
6
|
<LineChart
|
|
7
7
|
dataset={props.data}
|
|
8
|
-
xAxis={[
|
|
8
|
+
xAxis={[
|
|
9
|
+
{
|
|
10
|
+
dataKey: props.valueField,
|
|
11
|
+
scaleType: "band",
|
|
12
|
+
label: props.valueLabel,
|
|
13
|
+
},
|
|
14
|
+
]}
|
|
9
15
|
series={props.labelField?.split(",").map((labelField) => {
|
|
10
16
|
return { dataKey: labelField, label: labelField };
|
|
11
17
|
})}
|
|
@@ -4,7 +4,7 @@ import LinearProgress, {
|
|
|
4
4
|
} from "@mui/material/LinearProgress";
|
|
5
5
|
import Typography from "@mui/material/Typography";
|
|
6
6
|
import Box from "@mui/material/Box";
|
|
7
|
-
import { SingleRecordWidgetProps } from "../
|
|
7
|
+
import { SingleRecordWidgetProps } from "../DashboardViewer";
|
|
8
8
|
|
|
9
9
|
function LinearProgressWithLabel(
|
|
10
10
|
props: LinearProgressProps & { value: number }
|
|
@@ -30,9 +30,11 @@ const TemplateLineProgress: React.FC<SingleRecordWidgetProps> = (
|
|
|
30
30
|
return (
|
|
31
31
|
<Box sx={{ width: "100%" }}>
|
|
32
32
|
<Typography sx={{ fontSize: 16, fontWeight: "bold" }}>
|
|
33
|
-
{props.
|
|
33
|
+
{props.record[props.labelField]}
|
|
34
34
|
</Typography>
|
|
35
|
-
<LinearProgressWithLabel
|
|
35
|
+
<LinearProgressWithLabel
|
|
36
|
+
value={100 * (props.record[props.valueField] / props.total)}
|
|
37
|
+
/>
|
|
36
38
|
</Box>
|
|
37
39
|
);
|
|
38
40
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PieChart } from "@mui/x-charts/PieChart";
|
|
2
|
-
import { WidgetProps } from "../
|
|
2
|
+
import { WidgetProps } from "../DashboardViewer";
|
|
3
3
|
|
|
4
4
|
const TemplatePieChart: React.FC<WidgetProps> = (props) => {
|
|
5
5
|
// construct data object
|
|
@@ -10,7 +10,6 @@ const TemplatePieChart: React.FC<WidgetProps> = (props) => {
|
|
|
10
10
|
label: record[props.labelField] + "",
|
|
11
11
|
};
|
|
12
12
|
});
|
|
13
|
-
console.log("chartData", chartData);
|
|
14
13
|
return (
|
|
15
14
|
<PieChart
|
|
16
15
|
series={[
|