@campxdev/shared 1.11.40 → 1.11.42
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@campxdev/shared",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.42",
|
|
4
4
|
"main": "./exports.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "react-scripts start",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"react-table": "^7.8.0",
|
|
57
57
|
"react-toastify": "^9.0.1",
|
|
58
58
|
"styled-components": "^5.3.5",
|
|
59
|
+
"@mongodb-js/charts-embed-dom": "3.2.1",
|
|
59
60
|
"swiper": "^8.1.5",
|
|
60
61
|
"typescript": "^5.2.2",
|
|
61
62
|
"use-immer": "^0.8.1",
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import ChartsEmbedSDK from '@mongodb-js/charts-embed-dom'
|
|
2
|
+
import { useEffect, useRef, useState } from 'react'
|
|
3
|
+
|
|
4
|
+
interface DashboardProps {
|
|
5
|
+
token: any
|
|
6
|
+
dashboardId: string
|
|
7
|
+
charts: any
|
|
8
|
+
chartFilters: any
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const MongoDashboard: React.FC<DashboardProps> = ({
|
|
12
|
+
token,
|
|
13
|
+
dashboardId,
|
|
14
|
+
charts,
|
|
15
|
+
chartFilters,
|
|
16
|
+
}) => {
|
|
17
|
+
const [rendered, setRendered] = useState<Boolean>(false)
|
|
18
|
+
const [dashboard, setDashboard] = useState<any>(null)
|
|
19
|
+
const chartDiv = useRef(null)
|
|
20
|
+
|
|
21
|
+
const sdk = new ChartsEmbedSDK({
|
|
22
|
+
baseUrl: 'https://charts.mongodb.com/charts-project-0-cnovv',
|
|
23
|
+
getUserToken: () => token,
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
const initDashboard = async () => {
|
|
28
|
+
const dashboard = sdk.createDashboard({
|
|
29
|
+
dashboardId: dashboardId,
|
|
30
|
+
showAttribution: false,
|
|
31
|
+
background: 'transparent',
|
|
32
|
+
widthMode: 'scale',
|
|
33
|
+
heightMode: 'scale',
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
setDashboard(dashboard)
|
|
37
|
+
try {
|
|
38
|
+
await dashboard.render(chartDiv.current)
|
|
39
|
+
|
|
40
|
+
setRendered(true)
|
|
41
|
+
} catch (err) {
|
|
42
|
+
console.log('Error during Charts rendering:', err)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
initDashboard()
|
|
47
|
+
}, [])
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (dashboard && rendered) {
|
|
51
|
+
const applyFiltersToChart = async () => {
|
|
52
|
+
charts.map((chartGroup, index) => {
|
|
53
|
+
chartGroup.map(async (chartId) => {
|
|
54
|
+
const chart = await dashboard.getChart(chartId)
|
|
55
|
+
console.log(chartFilters[index], chart)
|
|
56
|
+
try {
|
|
57
|
+
await chart.setFilter(chartFilters[index])
|
|
58
|
+
} catch (err) {
|
|
59
|
+
console.log(
|
|
60
|
+
'Error while applying filters to specific chart.',
|
|
61
|
+
err,
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
// charts.default.map(async (chartId) => {
|
|
68
|
+
// const chart = await dashboard.getChart(chartId)
|
|
69
|
+
|
|
70
|
+
// try {
|
|
71
|
+
// await chart.setFilter(filters)
|
|
72
|
+
// } catch (err) {
|
|
73
|
+
// console.log('Error while applying filters to specific chart.', err)
|
|
74
|
+
// }
|
|
75
|
+
// })
|
|
76
|
+
|
|
77
|
+
// charts.lessThanAcademicYear.map(async (chartId) => {
|
|
78
|
+
// const chart = await dashboard.getChart(chartId)
|
|
79
|
+
|
|
80
|
+
// try {
|
|
81
|
+
// await chart.setFilter({
|
|
82
|
+
// ...filters,
|
|
83
|
+
// academicYear: { $lt: filters.academicYear },
|
|
84
|
+
// })
|
|
85
|
+
// } catch (err) {
|
|
86
|
+
// console.log('Error while applying filters to specific chart.', err)
|
|
87
|
+
// }
|
|
88
|
+
// })
|
|
89
|
+
|
|
90
|
+
// charts.lessThanOrEqualAcademicYear.map(async (chartId) => {
|
|
91
|
+
// const chart = await dashboard.getChart(chartId)
|
|
92
|
+
|
|
93
|
+
// try {
|
|
94
|
+
// await chart.setFilter({
|
|
95
|
+
// ...filters,
|
|
96
|
+
// academicYear: { $lte: filters.academicYear },
|
|
97
|
+
// })
|
|
98
|
+
// } catch (err) {
|
|
99
|
+
// console.log('Error while applying filters to specific chart.', err)
|
|
100
|
+
// }
|
|
101
|
+
// })
|
|
102
|
+
|
|
103
|
+
// charts.dateRangeByAcademicYear.map(async (chartId) => {
|
|
104
|
+
// const chart = await dashboard.getChart(chartId)
|
|
105
|
+
|
|
106
|
+
// try {
|
|
107
|
+
// await chart.setFilter({
|
|
108
|
+
// 'admissionSubValue.tenantId':
|
|
109
|
+
// filters['admissionSubValue.tenantId'],
|
|
110
|
+
// 'admissionSubValue.institutionId':
|
|
111
|
+
// filters['admissionSubValue.institutionId'],
|
|
112
|
+
// 'feeTypeObject.feeType': filters['feeTypeObject.feeType'],
|
|
113
|
+
// createdAt: {
|
|
114
|
+
// $gte: startDate,
|
|
115
|
+
// $lte: endDate,
|
|
116
|
+
// },
|
|
117
|
+
// })
|
|
118
|
+
// } catch (err) {
|
|
119
|
+
// console.log('Error while applying filters to specific chart.', err)
|
|
120
|
+
// }
|
|
121
|
+
// })
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
applyFiltersToChart()
|
|
125
|
+
}
|
|
126
|
+
}, [dashboard, chartFilters, rendered])
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<div
|
|
130
|
+
className="chart"
|
|
131
|
+
ref={chartDiv}
|
|
132
|
+
style={{
|
|
133
|
+
height: '200vh',
|
|
134
|
+
margin: '25px 10px',
|
|
135
|
+
backgroundColor: '#EEEE',
|
|
136
|
+
padding: '15px 0px',
|
|
137
|
+
borderRadius: '10px',
|
|
138
|
+
}}
|
|
139
|
+
/>
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export default MongoDashboard
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './MongoDashboard'
|
package/src/components/index.ts
CHANGED
|
@@ -27,6 +27,7 @@ import { DialogButton, DrawerButton } from './ModalButtons'
|
|
|
27
27
|
import { CustomDialog } from './ModalButtons/DialogButton'
|
|
28
28
|
import { CustomDrawer } from './ModalButtons/DrawerButton'
|
|
29
29
|
import PopoverButton from './ModalButtons/PopoverButton'
|
|
30
|
+
import MongoDashboard from './MongoCharts'
|
|
30
31
|
import PageNotFound from './PageNotFound'
|
|
31
32
|
import ReactJoyRide from './ReactJoyRide'
|
|
32
33
|
import ResetPassword from './ResetPassword'
|
|
@@ -95,6 +96,7 @@ export {
|
|
|
95
96
|
LayoutWrapper,
|
|
96
97
|
ListItemButton,
|
|
97
98
|
LoginForm,
|
|
99
|
+
MongoDashboard,
|
|
98
100
|
NavigationTabs,
|
|
99
101
|
PageNotFound,
|
|
100
102
|
PopoverButton,
|
|
@@ -357,6 +357,13 @@ export enum EnrollPermissions {
|
|
|
357
357
|
CAN_ASSIGN_COUNSELLOR_LEADS = 'can_leads_assign_counsellor',
|
|
358
358
|
CAN_LEADS_CONVERT_TO_ADMISSION = 'can_leads_convert_to_admission',
|
|
359
359
|
|
|
360
|
+
// Clusters
|
|
361
|
+
CAN_CLUSTERS_VIEW = 'can_clusters_view',
|
|
362
|
+
CAN_CLUSTERS_EDIT = 'can_clusters_edit',
|
|
363
|
+
CAN_CLUSTERS_ADD = 'can_clusters_add',
|
|
364
|
+
CAN_CLUSTERS_DELETE = 'can_clusters_delete',
|
|
365
|
+
CAN_CLUSTERS_DASHBOARD_VIEW = 'can_clusters_dashboard_view',
|
|
366
|
+
|
|
360
367
|
// Counsellor
|
|
361
368
|
CAN_COUNSELLOR_VIEW = 'can_counsellor_view',
|
|
362
369
|
CAN_COUNSELLOR_ADD = 'can_counsellor_add',
|
|
@@ -647,6 +654,7 @@ export enum Permission {
|
|
|
647
654
|
CAN_DISCONTINUED_STUDENT_VIEW = 'can_discontinued_student_view',
|
|
648
655
|
CAN_CONCESSION_REPORT_VIEW = 'can_concession_report_view',
|
|
649
656
|
CAN_FEE_TYPE_SUMMARY_VIEW = 'can_fee_type_summary_report_view',
|
|
657
|
+
CAN_PROGRAM_WISE_FEE_TYPE_REPORT_VIEW = 'can_program_wise-fee_type_report_view',
|
|
650
658
|
CAN_EXAMINATION_REPORT_VIEW = 'can_examination_report_view',
|
|
651
659
|
CAN_EXAMINATION_NOT_PAID_REPORT_VIEW = 'can_examination_not_paid_report_view',
|
|
652
660
|
CAN_EXAMINATION_BLOCKED_STUDENTS_VIEW = 'can_examination_blocked_students_view',
|
|
@@ -1647,6 +1655,7 @@ export interface IPermissions {
|
|
|
1647
1655
|
can_discontinued_student_view: boolean
|
|
1648
1656
|
can_concession_report_view: boolean
|
|
1649
1657
|
can_fee_type_summary_report_view: boolean
|
|
1658
|
+
can_program_wise_fee_type_report_view: boolean
|
|
1650
1659
|
can_examination_report_view: boolean
|
|
1651
1660
|
can_examination_not_paid_report_view: boolean
|
|
1652
1661
|
can_examination_blocked_students_view: boolean
|
|
@@ -1719,6 +1728,11 @@ export interface IPermissions {
|
|
|
1719
1728
|
can_leads_assign_counsellor: boolean
|
|
1720
1729
|
can_leads_import: boolean
|
|
1721
1730
|
can_leads_convert_to_admission: boolean
|
|
1731
|
+
can_clusters_view: boolean
|
|
1732
|
+
can_clusters_add: boolean
|
|
1733
|
+
can_clusters_edit: boolean
|
|
1734
|
+
can_clusters_delete: boolean
|
|
1735
|
+
can_clusters_dashboard_view: boolean
|
|
1722
1736
|
can_notification_view: boolean
|
|
1723
1737
|
can_notification_add: boolean
|
|
1724
1738
|
can_notification_edit: boolean
|