@campxdev/shared 1.10.79 → 1.10.80

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.80",
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
  }
@@ -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',
@@ -623,6 +629,7 @@ export enum Permission {
623
629
  CAN_DETAINED_STUDENT_VIEW = 'can_detained_student_view',
624
630
  CAN_DISCONTINUED_STUDENT_VIEW = 'can_discontinued_student_view',
625
631
  CAN_CONCESSION_REPORT_VIEW = 'can_concession_report_view',
632
+ CAN_FEE_TYPE_SUMMARY_VIEW = 'can_fee_type_summary_report_view',
626
633
  CAN_EXAMINATION_REPORT_VIEW = 'can_examination_report_view',
627
634
  CAN_EXAMINATION_NOT_PAID_REPORT_VIEW = 'can_examination_not_paid_report_view',
628
635
  CAN_EXAMINATION_BLOCKED_STUDENTS_VIEW = 'can_examination_blocked_students_view',