@campxdev/shared 1.10.57 → 1.10.59
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/HookForm/MultiSelect.tsx +4 -1
- package/src/components/HookForm/SingleSelect.tsx +2 -0
- package/src/components/Input/MultiSelect.tsx +4 -1
- package/src/components/Input/SingleSelect.tsx +2 -0
- package/src/components/ReportPageHeader.tsx +36 -0
- package/src/components/Selectors/ProgramSelector.tsx +49 -0
- package/src/components/Selectors/index.tsx +2 -0
- package/src/components/index.ts +2 -0
- package/src/shared-state/PermissionsStore.ts +15 -0
- package/src/components/Layout/Header/assets/commuteX.png +0 -0
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { AutocompleteInputChangeReason } from '@mui/material'
|
|
1
2
|
import { ReactNode } from 'react'
|
|
2
3
|
import { Controller } from 'react-hook-form'
|
|
3
4
|
import { MultiSelect } from '../Input'
|
|
4
5
|
import { IOption } from '../Input/types'
|
|
5
|
-
import { AutocompleteInputChangeReason } from '@mui/material'
|
|
6
6
|
|
|
7
7
|
interface MultiSelectProps {
|
|
8
8
|
control: any
|
|
@@ -20,6 +20,7 @@ interface MultiSelectProps {
|
|
|
20
20
|
value?: IOption[] | IOption
|
|
21
21
|
onChange?: (value: IOption[] | IOption) => void
|
|
22
22
|
multiple?: boolean
|
|
23
|
+
noOptionsText?: string
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export default function FormMultiSelect({
|
|
@@ -30,6 +31,7 @@ export default function FormMultiSelect({
|
|
|
30
31
|
loading,
|
|
31
32
|
required,
|
|
32
33
|
multiple = true,
|
|
34
|
+
noOptionsText,
|
|
33
35
|
onInputChange,
|
|
34
36
|
...props
|
|
35
37
|
}: MultiSelectProps) {
|
|
@@ -50,6 +52,7 @@ export default function FormMultiSelect({
|
|
|
50
52
|
loading={loading}
|
|
51
53
|
options={options || []}
|
|
52
54
|
error={!!error}
|
|
55
|
+
noOptionsText={noOptionsText}
|
|
53
56
|
required={required}
|
|
54
57
|
helperText={error ? error.message : null}
|
|
55
58
|
{...props}
|
|
@@ -8,6 +8,7 @@ type Props = {
|
|
|
8
8
|
control: any
|
|
9
9
|
options: Array<{ label: ReactNode; value: any }>
|
|
10
10
|
firstItemEmpty?: boolean
|
|
11
|
+
onOpen?: (e: any) => void
|
|
11
12
|
} & SelectProps
|
|
12
13
|
|
|
13
14
|
export default function FormSingleSelect(props: Props) {
|
|
@@ -37,6 +38,7 @@ export default function FormSingleSelect(props: Props) {
|
|
|
37
38
|
value={value ?? field?.value}
|
|
38
39
|
options={inputOptions}
|
|
39
40
|
error={!!error}
|
|
41
|
+
onOpen={props?.onOpen}
|
|
40
42
|
helperText={error?.message}
|
|
41
43
|
{...props}
|
|
42
44
|
/>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Close, KeyboardArrowDown } from '@mui/icons-material'
|
|
2
2
|
import {
|
|
3
|
-
alpha,
|
|
4
3
|
Autocomplete,
|
|
5
4
|
AutocompleteInputChangeReason,
|
|
6
5
|
Checkbox,
|
|
7
6
|
CircularProgress,
|
|
8
7
|
Popper,
|
|
8
|
+
alpha,
|
|
9
9
|
styled,
|
|
10
10
|
} from '@mui/material'
|
|
11
11
|
import { ReactNode } from 'react'
|
|
@@ -87,6 +87,7 @@ interface MultiSelectProps {
|
|
|
87
87
|
helperText?: string
|
|
88
88
|
multiple?: boolean
|
|
89
89
|
limitTags?: number
|
|
90
|
+
noOptionsText?: string
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
export default function MultiSelect({
|
|
@@ -99,6 +100,7 @@ export default function MultiSelect({
|
|
|
99
100
|
onInputChange,
|
|
100
101
|
required,
|
|
101
102
|
error,
|
|
103
|
+
noOptionsText,
|
|
102
104
|
helperText,
|
|
103
105
|
multiple = true,
|
|
104
106
|
limitTags = -1,
|
|
@@ -106,6 +108,7 @@ export default function MultiSelect({
|
|
|
106
108
|
}: MultiSelectProps) {
|
|
107
109
|
return (
|
|
108
110
|
<StyledAutocomplete
|
|
111
|
+
noOptionsText={noOptionsText}
|
|
109
112
|
multiple={multiple}
|
|
110
113
|
value={value}
|
|
111
114
|
loading={loading}
|
|
@@ -54,6 +54,7 @@ type Props = {
|
|
|
54
54
|
firstItemEmpty?: boolean
|
|
55
55
|
helperText?: string
|
|
56
56
|
containerProps?: BoxProps
|
|
57
|
+
onOpen?: (e: any) => void
|
|
57
58
|
} & SelectProps
|
|
58
59
|
|
|
59
60
|
export default function SingleSelect({
|
|
@@ -87,6 +88,7 @@ export default function SingleSelect({
|
|
|
87
88
|
MenuProps={{
|
|
88
89
|
PaperProps: PaperProps,
|
|
89
90
|
}}
|
|
91
|
+
onOpen={props?.onOpen}
|
|
90
92
|
IconComponent={KeyboardArrowDown}
|
|
91
93
|
onChange={onChange}
|
|
92
94
|
{...props}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import styled from '@emotion/styled'
|
|
2
|
+
import { Box, Divider, Typography } from '@mui/material'
|
|
3
|
+
import { ReactNode } from 'react'
|
|
4
|
+
interface PageHeaderProps {
|
|
5
|
+
urlTenantKey: string | ReactNode
|
|
6
|
+
title?: string | ReactNode
|
|
7
|
+
actions?: ReactNode
|
|
8
|
+
}
|
|
9
|
+
export const StyledHeaderBox = styled(Box)(({ theme }) => ({
|
|
10
|
+
width: '100%',
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flexDirection: 'column',
|
|
13
|
+
justifyContent: 'center',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
}))
|
|
16
|
+
export default function ReportPageHeader({
|
|
17
|
+
urlTenantKey,
|
|
18
|
+
title,
|
|
19
|
+
actions,
|
|
20
|
+
}: PageHeaderProps) {
|
|
21
|
+
return (
|
|
22
|
+
<StyledHeaderBox>
|
|
23
|
+
<Typography variant="h6" sx={{ textTransform: 'uppercase' }}>
|
|
24
|
+
{urlTenantKey}
|
|
25
|
+
</Typography>
|
|
26
|
+
<Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>
|
|
27
|
+
<Divider orientation="horizontal" sx={{ width: '100px' }} />
|
|
28
|
+
<Typography variant="h6" sx={{ fontSize: '24px' }}>
|
|
29
|
+
{title}
|
|
30
|
+
</Typography>
|
|
31
|
+
<Divider orientation="horizontal" sx={{ width: '100px' }} />
|
|
32
|
+
</Box>
|
|
33
|
+
<Box className="actions">{actions}</Box>
|
|
34
|
+
</StyledHeaderBox>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { FormSingleSelect } from '../HookForm'
|
|
3
|
+
import axios from '../../config/axios'
|
|
4
|
+
import { SelectProps } from '@mui/material'
|
|
5
|
+
|
|
6
|
+
type ProgramSelectorProps = {
|
|
7
|
+
control: any
|
|
8
|
+
name: string
|
|
9
|
+
label: string
|
|
10
|
+
required?: boolean
|
|
11
|
+
multiple?: boolean
|
|
12
|
+
} & SelectProps
|
|
13
|
+
export default function ProgramSelector(props: ProgramSelectorProps) {
|
|
14
|
+
const { name, required = false, control, label, multiple = false } = props
|
|
15
|
+
const [options, setOptions] = useState([])
|
|
16
|
+
const handleOpen = (e) => {
|
|
17
|
+
if (options.length === 0) {
|
|
18
|
+
axios
|
|
19
|
+
.get('/square/branches')
|
|
20
|
+
.then((response) => {
|
|
21
|
+
setOptions(response.data)
|
|
22
|
+
})
|
|
23
|
+
.catch((error) => {
|
|
24
|
+
console.error('Error fetching data from the API:', error)
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const handleOptions =
|
|
29
|
+
options.length > 0
|
|
30
|
+
? [
|
|
31
|
+
{ value: 'all', label: 'All' },
|
|
32
|
+
...options.map((item) => ({
|
|
33
|
+
label: `${item.branchName} (${item.course.courseName})`,
|
|
34
|
+
value: `${item.id}`,
|
|
35
|
+
})),
|
|
36
|
+
]
|
|
37
|
+
: [{ value: 'all', label: 'All' }]
|
|
38
|
+
return (
|
|
39
|
+
<FormSingleSelect
|
|
40
|
+
control={control}
|
|
41
|
+
name={name}
|
|
42
|
+
label={label}
|
|
43
|
+
required={required}
|
|
44
|
+
options={handleOptions}
|
|
45
|
+
onOpen={handleOpen}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
}
|
package/src/components/index.ts
CHANGED
|
@@ -42,6 +42,7 @@ import UploadFileDialog from './UploadFileDialog'
|
|
|
42
42
|
export { default as ActionButton } from './ActionButton'
|
|
43
43
|
export { default as AutocompleteSearch } from './AutocompleteSearch'
|
|
44
44
|
export { default as Breadcrumbs } from './Breadcrumbs'
|
|
45
|
+
export { default as ReportPageHeader } from './ReportPageHeader'
|
|
45
46
|
export { default as Card } from './Card'
|
|
46
47
|
export { default as CardsGrid } from './CardsGrid'
|
|
47
48
|
export { default as DividerHeading } from './DividerHeading'
|
|
@@ -111,3 +112,4 @@ export * from './HookForm'
|
|
|
111
112
|
export * from './IconButtons'
|
|
112
113
|
export * from './Input'
|
|
113
114
|
export * from './UploadButton/types'
|
|
115
|
+
export * from './Selectors'
|
|
@@ -599,6 +599,21 @@ export enum Permission {
|
|
|
599
599
|
CAN_RESTORE_FEE_TRANSACTIONS = 'can_restore_fee_transactions',
|
|
600
600
|
// Settings
|
|
601
601
|
CAN_MANAGE_PAYMENTS_SETTINGS = 'can_payments_manage_settings',
|
|
602
|
+
//Reports
|
|
603
|
+
CAN_PAYMENT_REPORTS_VIEW = 'can_payment_reports_view',
|
|
604
|
+
CAN_FEE_REPORT_VIEW = 'can_fee_report_view',
|
|
605
|
+
CAN_FEE_DUE_LIST_VIEW = 'can_fee_due_list_view',
|
|
606
|
+
CAN_ADVANCE_DUE_REPORT_VIEW = 'can_advance_due_report_view',
|
|
607
|
+
CAN_FEE_BY_CLASS_VIEW = 'can_fee_by_class_view',
|
|
608
|
+
CAN_BRANCH_WISE_REPORT_VIEW = 'can_branch_wise_report_view',
|
|
609
|
+
CAN_DETAINED_STUDENT_VIEW = 'can_detained_student_view',
|
|
610
|
+
CAN_DISCONTINUED_STUDENT_VIEW = 'can_discontinued_student_view',
|
|
611
|
+
CAN_CONCESSION_REPORT_VIEW = 'can_concession_report_view',
|
|
612
|
+
CAN_EXAMINATION_REPORT_VIEW = 'can_examination_report_view',
|
|
613
|
+
CAN_EXAMINATION_NOT_PAID_REPORT_VIEW = 'can_examination_not_paid_report_view',
|
|
614
|
+
CAN_EXAMINATION_BLOCKED_STUDENTS_VIEW = 'can_examination_blocked_students_view',
|
|
615
|
+
//Activity logs
|
|
616
|
+
CAN_PAYMENT_X_AUDIT_LOGS = 'can_payment_x_view_audit_logs',
|
|
602
617
|
|
|
603
618
|
// Commute X
|
|
604
619
|
// manage hostels profile_permissions
|
|
Binary file
|