@campxdev/shared 1.11.47 → 1.11.49

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.47",
3
+ "version": "1.11.49",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -5,9 +5,10 @@ import {
5
5
  TimelineSeparator,
6
6
  } from '@mui/lab'
7
7
  import { Box, SxProps, Typography } from '@mui/material'
8
- import axios from 'axios'
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: 4,
34
- skip: pageParam,
34
+ limit: 30,
35
+ // nextToken: pageParam,
35
36
  },
36
37
  })
37
- return response.data.posts
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
- <Typography
59
- variant="h1"
60
- sx={{ fontSize: '18px', fontWeight: 700, margin: '20px' }}
61
- >
62
- Activity Log
63
- </Typography>
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
- { title: 'Date', dataIndex: 'date', key: 'date' },
98
- { title: 'Time', dataIndex: 'time', key: 'time' },
99
- { title: 'Message', dataIndex: 'message', key: 'message' },
100
- { title: 'User', dataIndex: 'userName', key: 'userName' },
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<HTMLElement>(() => {
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: '110px',
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 10px' }}>
166
+ <TimelineContent sx={{ padding: '6px 8px' }}>
146
167
  <Box>
147
168
  <Typography variant="subtitle2" sx={{ fontSize: '14px' }}>
148
- {`${Math.floor(Math.random() * 30) + 1} ${
149
- Math.random() > 0.5 ? 'June' : 'July'
150
- }, 2023`}{' '}
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.title}
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
- {'John Doe'
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
- {`John Doe ${item.id}`}
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 HTMLElement>(callback: () => void) {
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
  })
@@ -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',
@@ -1094,6 +1114,12 @@ export enum Permission {
1094
1114
 
1095
1115
  // Exams
1096
1116
 
1117
+ // signatures permissions
1118
+ SIGNATURE_ADD = 'can_signatures_add',
1119
+ SIGNATURE_EDIT = 'can_signatures_edit',
1120
+ SIGNATURE_DELETE = 'can_signatures_delete',
1121
+ SIGNATURE_VIEW = 'can_signatures_view',
1122
+
1097
1123
  // manage exams profile_permissions
1098
1124
  CAN_MANAGE_EXAMS_PROFILE_PERMISSIONS_VIEW = 'can_manage_exams_profile_permissions_view',
1099
1125
  CAN_MANAGE_EXAMS_PROFILE_PERMISSIONS_ADD = 'can_manage_exams_profile_permissions_add',
@@ -1435,6 +1461,10 @@ export enum Permission {
1435
1461
  }
1436
1462
 
1437
1463
  export interface IPermissions {
1464
+ can_signature_view: boolean
1465
+ can_signature_add: boolean
1466
+ can_signature_edit: boolean
1467
+ can_signature_delete: boolean
1438
1468
  can_manage_roles_and_profiles: boolean
1439
1469
  can_view_audit_logs: boolean
1440
1470
  can_manage_settings: boolean
@@ -1826,6 +1856,14 @@ export interface IPermissions {
1826
1856
  can_results_processing_moderation_and_grafting: boolean
1827
1857
  can_results_processing_generate_memos: boolean
1828
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
1829
1867
  can_revaluation_fee_configuration_view: boolean
1830
1868
  can_revaluation_fee_configuration_add: boolean
1831
1869
  can_revaluation_view: boolean
@@ -1850,6 +1888,10 @@ export interface IPermissions {
1850
1888
  can_evaluators_add: boolean
1851
1889
  can_evaluators_edit: boolean
1852
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
1853
1895
  can_grades_view: boolean
1854
1896
  can_grades_add: boolean
1855
1897
  can_grades_edit: boolean