@campxdev/shared 1.10.79 → 1.10.81

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.10.79",
3
+ "version": "1.10.81",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -13,7 +13,7 @@ import { BpCheckedIcon, BpIcon } from './SingleCheckbox'
13
13
  import TextField from './TextField'
14
14
  import { IOption } from './types'
15
15
 
16
- const StyledAutocomplete = styled(Autocomplete)(({ theme }) => ({
16
+ export const StyledAutocomplete = styled(Autocomplete)(({ theme }) => ({
17
17
  '& .MuiAutocomplete-tag': {
18
18
  border: '1px solid #D1D1D1',
19
19
  background: '#F8F8F8',
@@ -31,7 +31,7 @@ const StyledAutocomplete = styled(Autocomplete)(({ theme }) => ({
31
31
  },
32
32
  }))
33
33
 
34
- const StyledPopper = styled(Popper)(({ theme }) => ({
34
+ export const StyledPopper = styled(Popper)(({ theme }) => ({
35
35
  '& .MuiPaper-root': {
36
36
  borderRadius: '10px',
37
37
  borderTopRightRadius: 0,
@@ -1,33 +1,57 @@
1
- import { useState } from 'react'
2
- import { FormSingleSelect } from '../HookForm'
3
- import { SingleSelect } from '../Input'
4
- import { InsititutionsStore } from '../../shared-state/InstitutionsStore'
1
+ import { KeyboardArrowDown } from '@mui/icons-material'
2
+ import { Box } from '@mui/material'
5
3
  import { urlTenantKey } from '../../contexts/Providers'
4
+ import { InsititutionsStore } from '../../shared-state/InstitutionsStore'
5
+ import { TextField } from '../Input'
6
+ import { StyledAutocomplete, StyledPopper } from '../Input/MultiSelect'
6
7
 
7
8
  export default function SchoolSwitch() {
8
9
  const { current, institutions } = InsititutionsStore.useState((s) => s)
9
10
 
10
- const handleChange = (e) => {
11
- localStorage.setItem('institution_key', e.target.value)
12
- window.location.replace(
13
- `${window.location.origin}/${urlTenantKey}/${e.target.value}`,
14
- )
11
+ const handleChange = (value) => {
12
+ if (value) {
13
+ localStorage.setItem('institution_key', value?.value)
14
+ window.location.replace(
15
+ `${window.location.origin}/${urlTenantKey}/${value?.value}`,
16
+ )
17
+ }
15
18
  }
19
+ const options =
20
+ institutions?.map((item) => ({
21
+ label: item.name,
22
+ value: item.code,
23
+ })) || []
16
24
 
17
25
  return (
18
- <SingleSelect
19
- containerProps={{
20
- sx: {
21
- minWidth: '200px',
22
- },
23
- }}
24
- size="small"
25
- options={institutions?.map((item) => ({
26
- label: item.name,
27
- value: item.code,
28
- }))}
29
- value={current?.code}
30
- onChange={handleChange}
31
- />
26
+ <Box sx={{ legend: { display: 'none' } }}>
27
+ <StyledAutocomplete
28
+ multiple={false}
29
+ sx={{
30
+ minWidth: '220px',
31
+ }}
32
+ getOptionLabel={(option: any) => option?.label || ''}
33
+ options={options || []}
34
+ value={{ label: current.name, value: current.code }}
35
+ onChange={(e, value) => {
36
+ handleChange(value)
37
+ }}
38
+ isOptionEqualToValue={(option: any, value: any) =>
39
+ option?.value === value?.value
40
+ }
41
+ disableCloseOnSelect
42
+ PopperComponent={StyledPopper}
43
+ popupIcon={<KeyboardArrowDown />}
44
+ renderInput={(params) => (
45
+ <TextField
46
+ label={null}
47
+ InputProps={{
48
+ ...params.InputProps,
49
+ endAdornment: <>{params.InputProps.endAdornment}</>,
50
+ }}
51
+ {...params}
52
+ />
53
+ )}
54
+ />
55
+ </Box>
32
56
  )
33
57
  }
@@ -195,6 +195,7 @@ function useAuth({ permissionsEndpoint, loginUrl }: AuthParams): AuthResponse {
195
195
  const isAdmin = checkIsAdmin(res.data.user)
196
196
  const isSetup =
197
197
  window.location.hostname.split('.').includes('setup') && isAdmin
198
+ const isMasterSlave = res.data?.institutionType === 'MASTER_CHILD'
198
199
 
199
200
  // eslint-disable-next-line no-console
200
201
  console.log('Is Admin -> ', isAdmin)
@@ -231,6 +232,9 @@ function useAuth({ permissionsEndpoint, loginUrl }: AuthParams): AuthResponse {
231
232
  can_individual_pages_view: 1,
232
233
  can_analatics_view: isAdmin,
233
234
  can_admin_view: isAdmin,
235
+ can_challan_registrations_view:
236
+ isMasterSlave &&
237
+ res.data?.permissions.can_challan_registrations_view,
234
238
  } as any
235
239
  s.applications = res.data?.applications ?? []
236
240
  })
@@ -190,6 +190,12 @@ export enum SquarePermissions {
190
190
  COURSE_REGISTRATION_EDIT = 'can_course_registration_edit',
191
191
  COURSE_REGISTRATION_DELETE = 'can_course_registration_delete',
192
192
 
193
+ // Mentors
194
+ CAN_MENTORS_VIEW = 'can_mentors_view',
195
+ CAN_ALL_MENTORS_VIEW = 'can_all_mentors_view',
196
+ CAN_MY_MENTEES_VIEW = 'can_my_mentees_view',
197
+ CAN_SESSION_CREATE = 'can_session_create',
198
+
193
199
  // Extra Cirricular activities
194
200
  EXTRA_CURRICULAR_ACTIVITIES_NEWS_FEED = 'can_extra_curricular_activities_news_feed',
195
201
  EXTRA_CURRICULAR_ACTIVITIES_CLUBS = 'can_extra_curricular_activities_clubs',
@@ -313,13 +319,6 @@ export enum SquarePermissions {
313
319
  CAN_SURVEYS_EDIT = 'can_surveys_edit',
314
320
  CAN_SURVEYS_ADD = 'can_surveys_add',
315
321
  CAN_SURVEYS_DELETE = 'can_surveys_delete',
316
-
317
-
318
-
319
-
320
-
321
-
322
-
323
322
  }
324
323
 
325
324
  export enum EnrollPermissions {
@@ -623,6 +622,7 @@ export enum Permission {
623
622
  CAN_DETAINED_STUDENT_VIEW = 'can_detained_student_view',
624
623
  CAN_DISCONTINUED_STUDENT_VIEW = 'can_discontinued_student_view',
625
624
  CAN_CONCESSION_REPORT_VIEW = 'can_concession_report_view',
625
+ CAN_FEE_TYPE_SUMMARY_VIEW = 'can_fee_type_summary_report_view',
626
626
  CAN_EXAMINATION_REPORT_VIEW = 'can_examination_report_view',
627
627
  CAN_EXAMINATION_NOT_PAID_REPORT_VIEW = 'can_examination_not_paid_report_view',
628
628
  CAN_EXAMINATION_BLOCKED_STUDENTS_VIEW = 'can_examination_blocked_students_view',
@@ -956,7 +956,7 @@ export enum Permission {
956
956
  CAN_SURVEYS_ADD = 'can_surveys_add',
957
957
  CAN_SURVEYS_DELETE = 'can_surveys_delete',
958
958
 
959
- //Configuration
959
+ //Configuration
960
960
 
961
961
  CAN_CONFIGURATION_VIEW = 'can_configuration_view',
962
962
 
@@ -966,14 +966,12 @@ export enum Permission {
966
966
  CAN_NOTICE_BOARD_ADD = 'can_notice_board_add',
967
967
  CAN_NOTICE_BOARD_DELETE = 'can_notice_board_delete',
968
968
 
969
-
970
969
  //Research Projects
971
970
  CAN_RESEARCH_PROJECT_VIEW = 'can_research_project_view',
972
971
  CAN_RESEARCH_PROJECT_EDIT = 'can_research_project_edit',
973
972
  CAN_RESEARCH_PROJECT_ADD = 'can_research_project_add',
974
973
  CAN_RESEARCH_PROJECT_DELETE = 'can_research_project_delete',
975
974
 
976
-
977
975
  // Enroll X
978
976
 
979
977
  // manage exams profile_permissions
@@ -1064,19 +1062,28 @@ export enum Permission {
1064
1062
  CAN_MANAGE_EXAMS_PROFILE_PERMISSIONS_EDIT = 'can_manage_exams_profile_permissions_edit',
1065
1063
  CAN_MANAGE_EXAMS_PROFILE_PERMISSIONS_DELETE = 'can_manage_exams_profile_permissions_delete',
1066
1064
 
1067
-
1068
1065
  // End Semester Examination
1069
1066
  CAN_END_SEMESTER_EXAMINATIONS_VIEW = 'can_end_semester_examinations_view',
1070
1067
  CAN_END_SEMESTER_EXAMINATIONS_ADD = 'can_end_semester_examinations_add',
1071
1068
  CAN_END_SEMESTER_EXAMINATIONS_EDIT = 'can_end_semester_examinations_edit',
1069
+ CAN_END_SEMESTER_EXAMINATIONS_ARCHIVE_EXAM = 'can_end_semester_examinations_archive_exam',
1072
1070
  CAN_END_SEMESTER_EXAMINATIONS_DELETE = 'can_end_semester_examinations_delete',
1073
- CAN_END_SEMESTER_EXAMINATIONS_NOTIFICATION_DETAILS_VIEW = "can_end_semester_examinations_notification_details_view",
1071
+ CAN_END_SEMESTER_EXAMINATIONS_NOTIFICATION_DETAILS_VIEW = 'can_end_semester_examinations_notification_details_view',
1074
1072
 
1075
1073
  // Registrations
1076
1074
  CAN_EXAM_REGISTARTIONS_VIEW = 'can_exam_registrations_view',
1077
1075
  CAN_EXAM_REGISTARTIONS_ADD = 'can_exam_registrations_add',
1078
- CAN_EXAM_REGISTARTIONS_CHALLAN_UPLOAD = "can_exam_registrations_challan_upload",
1079
- CAN_EXAM_REGISTARTIONS_SUBMIT = "can_exam_registrations_submit",
1076
+ CAN_EXAM_REGISTARTIONS_CHALLAN_UPLOAD = 'can_exam_registrations_challan_upload',
1077
+ CAN_EXAM_REGISTARTIONS_SUBMIT = 'can_exam_registrations_submit',
1078
+
1079
+ //Challan Upload
1080
+ CAN_CHALLAN_UPLOAD_VIEW = 'can_challan_upload_view',
1081
+ CAN_CHALLAN_REGISTRATION_VIEW = 'can_challan_registrations_view',
1082
+ CAN_CHALLAN_REGISTRATION_ADD = 'can_challan_registrations_add',
1083
+ CAN_CHALLAN_UPLOAD_ADD = 'can_challan_upload_add',
1084
+
1085
+ //settings
1086
+ CAN_EXAMS_SETTINGS_VIEW = 'can_exams_settings_view',
1080
1087
 
1081
1088
  // Fee configuration
1082
1089
  EXAM_FEE_CONFIGURATION_VIEW = 'can_exam_fee_configuration_view',
@@ -1090,25 +1097,25 @@ export enum Permission {
1090
1097
 
1091
1098
  // Hall tickets
1092
1099
  CAN_HALL_TICKETS_VIEW = 'can_hall_tickets_view',
1093
- CAN_HALL_TICKETS_DOWNLOAD = "can_hall_tickets_download",
1100
+ CAN_HALL_TICKETS_DOWNLOAD = 'can_hall_tickets_download',
1094
1101
 
1095
1102
  // OMRS
1096
1103
  CAN_OMRS_VIEW = 'can_omrs_view',
1097
1104
  CAN_OMRS_UPDATE = 'can_omrs_update',
1098
1105
  CAN_OMRS_GENERATE = 'can_omrs_generate',
1099
- CAN_OMRS_DOWNLOAD = "can_omrs_download",
1106
+ CAN_OMRS_DOWNLOAD = 'can_omrs_download',
1100
1107
 
1101
1108
  // Paper Configuration
1102
1109
  CAN_PAPER_CONFIGURATION_VIEW = 'can_paper_configuration_view',
1103
1110
  CAN_PAPER_CONFIGURATION_ADD = 'can_paper_configuration_add',
1104
1111
  CAN_PAPER_CONFIGURATION_EDIT = 'can_paper_configuration_edit',
1105
1112
  CAN_PAPER_CONFIGURATION_DELETE = 'can_paper_configuration_delete',
1106
- CAN_PAPER_CONFIGURATION_DOWNLOAD = "can_paper_configuration_download",
1113
+ CAN_PAPER_CONFIGURATION_DOWNLOAD = 'can_paper_configuration_download',
1107
1114
 
1108
1115
  // D Form
1109
1116
  CAN_D_FORM_VIEW = 'can_d_forms_view',
1110
1117
  CAN_D_FORM_ADD = 'can_d_forms_add',
1111
- CAN_D_FORM_DOWNLOAD = "can_d_forms_download",
1118
+ CAN_D_FORM_DOWNLOAD = 'can_d_forms_download',
1112
1119
 
1113
1120
  // Bundling
1114
1121
  CAN_VIEW_ANSWER_SHEET_REPORT = 'can_view_answer_sheet_report',