@campxdev/shared 1.11.48 → 1.11.50
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 +1 -1
- package/src/components/ActivityLog/ActivityLog.tsx +48 -35
- package/src/components/ActivityLog/Styles.tsx +0 -2
- package/src/components/ActivityLog/index.ts +1 -0
- package/src/components/UploadFileDialog/UploadFileDialog.tsx +1 -1
- package/src/components/index.ts +2 -0
- package/src/shared-state/PermissionsStore.ts +32 -0
- package/src/utils/getUrlParams.ts +3 -1
package/package.json
CHANGED
|
@@ -5,9 +5,10 @@ import {
|
|
|
5
5
|
TimelineSeparator,
|
|
6
6
|
} from '@mui/lab'
|
|
7
7
|
import { Box, SxProps, Typography } from '@mui/material'
|
|
8
|
-
import
|
|
8
|
+
import moment from 'moment'
|
|
9
9
|
import { useCallback, useRef } from 'react'
|
|
10
10
|
import { useInfiniteQuery } from 'react-query'
|
|
11
|
+
import axios from '../../config/axios'
|
|
11
12
|
import { useErrorModal } from '../ErrorModalWrapper/ErrorModalWrapper'
|
|
12
13
|
import Spinner from '../Spinner'
|
|
13
14
|
import Table from '../Tables/BasicTable/Table'
|
|
@@ -30,11 +31,11 @@ export default function ActivityLog({ endPoint, tableView, sx }: Props) {
|
|
|
30
31
|
try {
|
|
31
32
|
const response = await axios.get(endPoint, {
|
|
32
33
|
params: {
|
|
33
|
-
limit:
|
|
34
|
-
|
|
34
|
+
limit: 30,
|
|
35
|
+
// nextToken: pageParam,
|
|
35
36
|
},
|
|
36
37
|
})
|
|
37
|
-
return response.data
|
|
38
|
+
return response.data
|
|
38
39
|
} catch (error) {
|
|
39
40
|
// eslint-disable-next-line no-console
|
|
40
41
|
console.log(error)
|
|
@@ -55,12 +56,14 @@ export default function ActivityLog({ endPoint, tableView, sx }: Props) {
|
|
|
55
56
|
|
|
56
57
|
return (
|
|
57
58
|
<Box>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
{!tableView && (
|
|
60
|
+
<Typography
|
|
61
|
+
variant="h1"
|
|
62
|
+
sx={{ fontSize: '18px', fontWeight: 700, margin: '20px' }}
|
|
63
|
+
>
|
|
64
|
+
Activity Log
|
|
65
|
+
</Typography>
|
|
66
|
+
)}
|
|
64
67
|
|
|
65
68
|
{!tableView ? (
|
|
66
69
|
<Box
|
|
@@ -94,10 +97,28 @@ export default function ActivityLog({ endPoint, tableView, sx }: Props) {
|
|
|
94
97
|
}
|
|
95
98
|
|
|
96
99
|
const columns = [
|
|
97
|
-
{
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
{
|
|
101
|
+
title: 'Date',
|
|
102
|
+
dataIndex: 'timestamp',
|
|
103
|
+
key: 'timestamp',
|
|
104
|
+
render: (timestamp) =>
|
|
105
|
+
moment.utc(timestamp).local().format('DD MMM YYYY - hh:mm A'),
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
title: 'Action',
|
|
109
|
+
dataIndex: 'action',
|
|
110
|
+
key: 'action',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
title: 'User Name',
|
|
114
|
+
dataIndex: 'userName',
|
|
115
|
+
key: 'userName',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
title: 'Message',
|
|
119
|
+
dataIndex: 'message',
|
|
120
|
+
key: 'message',
|
|
121
|
+
},
|
|
101
122
|
]
|
|
102
123
|
|
|
103
124
|
export const TimeLineComponent = ({
|
|
@@ -107,7 +128,7 @@ export const TimeLineComponent = ({
|
|
|
107
128
|
fetchNextPage,
|
|
108
129
|
sx,
|
|
109
130
|
}) => {
|
|
110
|
-
const lastItemRef = useIntersectionObserver<
|
|
131
|
+
const lastItemRef = useIntersectionObserver<HTMLDivElement>(() => {
|
|
111
132
|
if (!isFetchingNextPage && hasNextPage) fetchNextPage()
|
|
112
133
|
})
|
|
113
134
|
|
|
@@ -134,7 +155,7 @@ export const TimeLineComponent = ({
|
|
|
134
155
|
<Box
|
|
135
156
|
sx={{
|
|
136
157
|
width: '1px',
|
|
137
|
-
height: '
|
|
158
|
+
height: '115%',
|
|
138
159
|
bgcolor: '#12121233',
|
|
139
160
|
position: 'absolute',
|
|
140
161
|
top: '25px',
|
|
@@ -142,21 +163,16 @@ export const TimeLineComponent = ({
|
|
|
142
163
|
/>
|
|
143
164
|
)}
|
|
144
165
|
</TimelineSeparator>
|
|
145
|
-
<TimelineContent sx={{ padding: '6px
|
|
166
|
+
<TimelineContent sx={{ padding: '6px 8px' }}>
|
|
146
167
|
<Box>
|
|
147
168
|
<Typography variant="subtitle2" sx={{ fontSize: '14px' }}>
|
|
148
|
-
{
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
{`${Math.floor(Math.random() * 12) + 1}:${
|
|
153
|
-
Math.floor(Math.random() * 60) + 1
|
|
154
|
-
} ${Math.random() > 0.5 ? 'AM' : 'PM'}`}
|
|
155
|
-
{/* {item.date} - {item.time} */}
|
|
169
|
+
{moment
|
|
170
|
+
.utc(item.timestamp)
|
|
171
|
+
.local()
|
|
172
|
+
.format('DD MMM YYYY - hh:mm A')}
|
|
156
173
|
</Typography>
|
|
157
174
|
<Typography sx={{ fontSize: '16px' }} variant="body1">
|
|
158
|
-
{item.
|
|
159
|
-
{/* {item.message} */}
|
|
175
|
+
{item.message}
|
|
160
176
|
</Typography>
|
|
161
177
|
<Typography
|
|
162
178
|
style={{
|
|
@@ -166,15 +182,10 @@ export const TimeLineComponent = ({
|
|
|
166
182
|
}}
|
|
167
183
|
>
|
|
168
184
|
<StyledAvatar>
|
|
169
|
-
{
|
|
170
|
-
.split(' ')
|
|
171
|
-
.map((n) => n[0])
|
|
172
|
-
.join('')
|
|
173
|
-
.toUpperCase()}
|
|
185
|
+
{item.userName.charAt(0).toUpperCase()}
|
|
174
186
|
</StyledAvatar>
|
|
175
187
|
<Typography sx={{ fontSize: '13px', fontWeight: 900 }}>
|
|
176
|
-
{
|
|
177
|
-
{/* {item.userName} */}
|
|
188
|
+
{item.userName}
|
|
178
189
|
</Typography>
|
|
179
190
|
</Typography>
|
|
180
191
|
</Box>
|
|
@@ -191,7 +202,9 @@ export const TimeLineComponent = ({
|
|
|
191
202
|
)
|
|
192
203
|
}
|
|
193
204
|
|
|
194
|
-
function useIntersectionObserver<T extends
|
|
205
|
+
function useIntersectionObserver<T extends HTMLDivElement>(
|
|
206
|
+
callback: () => void,
|
|
207
|
+
) {
|
|
195
208
|
const observer = useRef<IntersectionObserver | null>(null)
|
|
196
209
|
|
|
197
210
|
const handleObserver = useCallback(
|
|
@@ -25,7 +25,6 @@ export const StyledAvatar = styled(Avatar)(({ theme }) => ({
|
|
|
25
25
|
width: 30,
|
|
26
26
|
height: 30,
|
|
27
27
|
marginRight: '8px',
|
|
28
|
-
backgroundColor: theme.palette.primary.main,
|
|
29
28
|
fontSize: '14px',
|
|
30
29
|
}))
|
|
31
30
|
|
|
@@ -33,5 +32,4 @@ export const StyledSpinnerBox = styled(Box)({
|
|
|
33
32
|
display: 'flex',
|
|
34
33
|
justifyContent: 'center',
|
|
35
34
|
alignItems: 'center',
|
|
36
|
-
padding: '20px',
|
|
37
35
|
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ActivityLog'
|
package/src/components/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import ActivityLog from './ActivityLog'
|
|
1
2
|
import ApplicationProfile from './ApplicationProfile'
|
|
2
3
|
import ChangePassword from './ChangePassword'
|
|
3
4
|
import Chips from './Chips'
|
|
@@ -72,6 +73,7 @@ export { default as ReactTable } from './Tables/ReactTable'
|
|
|
72
73
|
export { default as Tabs } from './Tabs/Tabs'
|
|
73
74
|
export { default as ToastContainer } from './ToastContainer'
|
|
74
75
|
export {
|
|
76
|
+
ActivityLog,
|
|
75
77
|
AppHeader,
|
|
76
78
|
ApplicationProfile,
|
|
77
79
|
AsyncSearchSelect,
|
|
@@ -502,6 +502,20 @@ export enum ExamsPermissions {
|
|
|
502
502
|
CAN_RESULTS_PROCESSING_PUBLISH_RESULTS = 'can_results_processing_publish_results',
|
|
503
503
|
CAN_RESULTS_PROCESSING_UPDATE_INTERNAL_MARKS = 'can_results_processing_update_internal_marks',
|
|
504
504
|
|
|
505
|
+
//Blocked Students
|
|
506
|
+
CAN_BLOCKED_STUDENTS_VIEW = 'can_blocked_students_view',
|
|
507
|
+
CAN_BLOCKED_STUDENTS_ADD = 'can_blocked_students_add',
|
|
508
|
+
CAN_BLOCKED_STUDENTS_IMPORT = 'can_blocked_students_import',
|
|
509
|
+
CAN_BLOCKED_STUDENTS_DELETE = 'can_blocked_students_delete',
|
|
510
|
+
|
|
511
|
+
//student grades
|
|
512
|
+
CAN_STUDENTS_GRADES_VIEW = 'can_students_grades_view',
|
|
513
|
+
CAN_STUDENTS_GRADES_IMPORT = 'can_students_grades_import',
|
|
514
|
+
|
|
515
|
+
//student memos
|
|
516
|
+
CAN_STUDENTS_MEMOS_VIEW = 'can_students_memos_view',
|
|
517
|
+
CAN_STUDENTS_MEMOS_GENERATE = 'can_students_memos_generate',
|
|
518
|
+
|
|
505
519
|
// Revaluation Fee Configuration
|
|
506
520
|
CAN_REVALUATION_FEE_CONFIGURATION_VIEW = 'can_revaluation_fee_configuration_view',
|
|
507
521
|
CAN_REVAULATION_FEE_CONFIGURATION_ADD = 'can_revaluation_fee_configuration_add',
|
|
@@ -541,6 +555,12 @@ export enum ExamsPermissions {
|
|
|
541
555
|
CAN_EVALUATORS_EDIT = 'can_evaluators_edit',
|
|
542
556
|
CAN_EVALUATORS_DELETE = 'can_evaluators_delete',
|
|
543
557
|
|
|
558
|
+
//Grade Templates
|
|
559
|
+
CAN_GRADE_TEMPLATES_VIEW = 'can_grade_templates_view',
|
|
560
|
+
CAN_GRADE_TEMPLATES_ADD = 'can_grade_templates_add',
|
|
561
|
+
CAN_GRADE_TEMPLATES_EDIT = 'can_grade_templates_edit',
|
|
562
|
+
CAN_GRADE_TEMPLATES_DELETE = 'can_grade_templates_delete',
|
|
563
|
+
|
|
544
564
|
// Grades
|
|
545
565
|
CAN_GRADES_ADD = 'can_grades_add',
|
|
546
566
|
CAN_GRADES_EDIT = 'can_grades_edit',
|
|
@@ -1836,6 +1856,14 @@ export interface IPermissions {
|
|
|
1836
1856
|
can_results_processing_moderation_and_grafting: boolean
|
|
1837
1857
|
can_results_processing_generate_memos: boolean
|
|
1838
1858
|
can_results_processing_publish_results: boolean
|
|
1859
|
+
can_blocked_students_view: boolean
|
|
1860
|
+
can_blocked_students_add: boolean
|
|
1861
|
+
can_blocked_students_import: boolean
|
|
1862
|
+
can_blocked_students_delete: boolean
|
|
1863
|
+
can_students_grades_view: boolean
|
|
1864
|
+
can_students_grades_import: boolean
|
|
1865
|
+
can_students_memos_view: boolean
|
|
1866
|
+
can_students_memos_generate: boolean
|
|
1839
1867
|
can_revaluation_fee_configuration_view: boolean
|
|
1840
1868
|
can_revaluation_fee_configuration_add: boolean
|
|
1841
1869
|
can_revaluation_view: boolean
|
|
@@ -1860,6 +1888,10 @@ export interface IPermissions {
|
|
|
1860
1888
|
can_evaluators_add: boolean
|
|
1861
1889
|
can_evaluators_edit: boolean
|
|
1862
1890
|
can_evaluators_delete: boolean
|
|
1891
|
+
can_grade_templates_view: boolean
|
|
1892
|
+
can_grade_templates_add: boolean
|
|
1893
|
+
can_grade_templates_edit: boolean
|
|
1894
|
+
can_grade_templates_delete: boolean
|
|
1863
1895
|
can_grades_view: boolean
|
|
1864
1896
|
can_grades_add: boolean
|
|
1865
1897
|
can_grades_edit: boolean
|
|
@@ -7,7 +7,9 @@ export default function getUrlParams() {
|
|
|
7
7
|
return params
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const createSearchParams = (query: {
|
|
10
|
+
export const createSearchParams = (query: {
|
|
11
|
+
[key: string]: string | number
|
|
12
|
+
}) => {
|
|
11
13
|
const searchParams = new URLSearchParams()
|
|
12
14
|
|
|
13
15
|
for (const key in query) {
|