@campxdev/shared 1.11.22 → 1.11.24
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/ApplicationProfile/UserProfileRelation.tsx +4 -1
- package/src/components/ErrorModalWrapper/ErrorModalTemplate.tsx +16 -15
- package/src/components/Form/Form.tsx +4 -1
- package/src/components/ImageUpload.tsx +4 -1
- package/src/components/Layout/Header/applications.ts +30 -30
- package/src/components/Tables/BasicTable/Table.tsx +1 -1
- package/src/components/UploadFileDialog/UploadFileDialog.tsx +6 -4
- package/src/hooks/useAuth.ts +1 -0
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
updateCreateUserApplicationProfile,
|
|
16
16
|
userProfileSchema,
|
|
17
17
|
} from './services'
|
|
18
|
+
import { useErrorModal } from '../ErrorModalWrapper/ErrorModalWrapper'
|
|
18
19
|
interface UserProps {
|
|
19
20
|
options: {
|
|
20
21
|
label: any
|
|
@@ -26,6 +27,7 @@ const getDepartments = () => {
|
|
|
26
27
|
return axios.get('/hrms/departments').then((res) => res?.data?.data)
|
|
27
28
|
}
|
|
28
29
|
function UserProfileRelation({ close, application, profiles, data }) {
|
|
30
|
+
const errorModal = useErrorModal()
|
|
29
31
|
const [state, setState] = useImmer<UserProps>({
|
|
30
32
|
options: [],
|
|
31
33
|
inputValue: '',
|
|
@@ -58,7 +60,8 @@ function UserProfileRelation({ close, application, profiles, data }) {
|
|
|
58
60
|
onError: (err) => {
|
|
59
61
|
// eslint-disable-next-line no-console
|
|
60
62
|
console.log(err)
|
|
61
|
-
axiosErrorToast(err)
|
|
63
|
+
// axiosErrorToast(err)
|
|
64
|
+
errorModal({ error: err })
|
|
62
65
|
},
|
|
63
66
|
},
|
|
64
67
|
)
|
|
@@ -82,26 +82,27 @@ export const ErrorModalTemplate = ({ handleClose, modal, setModal }) => {
|
|
|
82
82
|
<StyledImage>
|
|
83
83
|
<img src={animatedImage} alt="Error Image" />
|
|
84
84
|
</StyledImage>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<MessageContainer>
|
|
89
|
-
{modal.type == 'String' ? (
|
|
85
|
+
|
|
86
|
+
{modal.type == 'String' ? (
|
|
87
|
+
<MessageContainer>
|
|
90
88
|
<Typography
|
|
91
89
|
variant="h6"
|
|
92
90
|
sx={{ textAlign: 'center', lineHeight: 1.7 }}
|
|
93
91
|
dangerouslySetInnerHTML={{ __html: modal?.errorMessage }}
|
|
94
92
|
/>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
93
|
+
</MessageContainer>
|
|
94
|
+
) : (
|
|
95
|
+
<>
|
|
96
|
+
<MessageContainer>
|
|
97
|
+
<Alert severity={'error'} sx={{ padding: '10px' }}>
|
|
98
|
+
Please resolve the below mentioned errors to proceed further
|
|
99
|
+
</Alert>
|
|
100
|
+
<StyledTableContainer
|
|
101
|
+
dangerouslySetInnerHTML={{ __html: modal?.errorMessage }}
|
|
102
|
+
/>
|
|
103
|
+
</MessageContainer>
|
|
104
|
+
</>
|
|
105
|
+
)}
|
|
105
106
|
|
|
106
107
|
{modal.content && modal.content({ close: handleClose })}
|
|
107
108
|
<Button
|
|
@@ -14,6 +14,7 @@ import { useMutation, useQueryClient } from 'react-query'
|
|
|
14
14
|
import { toast } from 'react-toastify'
|
|
15
15
|
import axios, { axiosErrorToast } from '../../config/axios'
|
|
16
16
|
import RenderForm, { RenderFormProps, generateYupSchema } from './RenderForm'
|
|
17
|
+
import { useErrorModal } from '../ErrorModalWrapper/ErrorModalWrapper'
|
|
17
18
|
|
|
18
19
|
const makePostRequest = async ({
|
|
19
20
|
endpoint,
|
|
@@ -59,6 +60,7 @@ export default function Form({
|
|
|
59
60
|
onCancel,
|
|
60
61
|
successToastMessage,
|
|
61
62
|
}: FormProps) {
|
|
63
|
+
const errorModal = useErrorModal()
|
|
62
64
|
const queryClient = useQueryClient()
|
|
63
65
|
const [error, setError] = useState<any>(null)
|
|
64
66
|
const { control, watch, handleSubmit } = useForm({
|
|
@@ -74,7 +76,8 @@ export default function Form({
|
|
|
74
76
|
},
|
|
75
77
|
onError(error: any) {
|
|
76
78
|
setError(error?.response?.data?.message)
|
|
77
|
-
axiosErrorToast(error)
|
|
79
|
+
// axiosErrorToast(error)
|
|
80
|
+
errorModal({ error: error })
|
|
78
81
|
},
|
|
79
82
|
})
|
|
80
83
|
|
|
@@ -2,6 +2,7 @@ import { InsertPhotoOutlined } from '@mui/icons-material'
|
|
|
2
2
|
import { styled, Typography } from '@mui/material'
|
|
3
3
|
import { ReactNode, useRef, useState } from 'react'
|
|
4
4
|
import axios, { axiosErrorToast } from '../config/axios'
|
|
5
|
+
import { useErrorModal } from './ErrorModalWrapper/ErrorModalWrapper'
|
|
5
6
|
|
|
6
7
|
interface ImageUploadProps {
|
|
7
8
|
onFileUploaded: (v) => void
|
|
@@ -17,6 +18,7 @@ export default function ImageUpload({
|
|
|
17
18
|
loadingState,
|
|
18
19
|
postBody = {},
|
|
19
20
|
}: ImageUploadProps) {
|
|
21
|
+
const errorModal = useErrorModal()
|
|
20
22
|
const [loading, setLoading] = useState(false)
|
|
21
23
|
const ref = useRef<HTMLInputElement>(null)
|
|
22
24
|
|
|
@@ -47,7 +49,8 @@ export default function ImageUpload({
|
|
|
47
49
|
.catch((err) => {
|
|
48
50
|
setLoading(false)
|
|
49
51
|
loadingState && setLoading(false)
|
|
50
|
-
axiosErrorToast(err)
|
|
52
|
+
// axiosErrorToast(err)
|
|
53
|
+
errorModal({ error: err })
|
|
51
54
|
})
|
|
52
55
|
}
|
|
53
56
|
}
|
|
@@ -15,14 +15,18 @@ const origins = {
|
|
|
15
15
|
dev: 'https://admin.campx.dev',
|
|
16
16
|
prod: 'https://admin.campx.in',
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
dev: 'https://
|
|
20
|
-
prod: 'https://
|
|
18
|
+
enroll: {
|
|
19
|
+
dev: 'https://enroll.campx.dev',
|
|
20
|
+
prod: 'https://enroll.campx.in',
|
|
21
21
|
},
|
|
22
22
|
payments: {
|
|
23
23
|
dev: 'https://payments.campx.dev',
|
|
24
24
|
prod: 'https://payments.campx.in',
|
|
25
25
|
},
|
|
26
|
+
ums: {
|
|
27
|
+
dev: 'https://ums.campx.dev',
|
|
28
|
+
prod: 'https://ums.campx.in',
|
|
29
|
+
},
|
|
26
30
|
exams: {
|
|
27
31
|
dev: 'https://exams.campx.dev',
|
|
28
32
|
prod: 'https://exams.campx.in',
|
|
@@ -39,10 +43,6 @@ const origins = {
|
|
|
39
43
|
dev: 'https://commute.campx.dev',
|
|
40
44
|
prod: 'https://commute.campx.in',
|
|
41
45
|
},
|
|
42
|
-
enroll: {
|
|
43
|
-
dev: 'https://enroll.campx.dev',
|
|
44
|
-
prod: 'https://enroll.campx.in',
|
|
45
|
-
},
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
export const applications = [
|
|
@@ -54,6 +54,23 @@ export const applications = [
|
|
|
54
54
|
domainName: 'admin',
|
|
55
55
|
description: 'Manage Complete Campus Root Configuration',
|
|
56
56
|
},
|
|
57
|
+
|
|
58
|
+
{
|
|
59
|
+
title: 'EnrollX',
|
|
60
|
+
key: 'enroll_x',
|
|
61
|
+
domainName: 'enroll',
|
|
62
|
+
path: isDevelopment ? origins.enroll.dev : origins.enroll.prod,
|
|
63
|
+
icon: enrollSmall,
|
|
64
|
+
description: 'Manage Admissions in the Campus',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
title: 'PayX',
|
|
68
|
+
key: 'payments',
|
|
69
|
+
domainName: 'payments',
|
|
70
|
+
path: isDevelopment ? origins.payments.dev : origins.payments.prod,
|
|
71
|
+
icon: paySmall,
|
|
72
|
+
description: 'Manage Payments in the Campus',
|
|
73
|
+
},
|
|
57
74
|
{
|
|
58
75
|
title: 'CollegeX',
|
|
59
76
|
path: isDevelopment ? origins.ums.dev : origins.ums.prod,
|
|
@@ -71,20 +88,12 @@ export const applications = [
|
|
|
71
88
|
description: 'Manage all Examinations in the Campus',
|
|
72
89
|
},
|
|
73
90
|
{
|
|
74
|
-
title: '
|
|
75
|
-
key: '
|
|
76
|
-
domainName: '
|
|
77
|
-
path: isDevelopment ? origins.
|
|
78
|
-
icon:
|
|
79
|
-
description: 'Manage
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
title: 'EnrollX',
|
|
83
|
-
key: 'enroll_x',
|
|
84
|
-
domainName: 'enroll',
|
|
85
|
-
path: isDevelopment ? origins.enroll.dev : origins.enroll.prod,
|
|
86
|
-
icon: enrollSmall,
|
|
87
|
-
description: 'Manage Admissions in the Campus',
|
|
91
|
+
title: 'PeopleX',
|
|
92
|
+
key: 'hrms',
|
|
93
|
+
domainName: 'people',
|
|
94
|
+
path: isDevelopment ? origins.people.dev : origins.people.prod,
|
|
95
|
+
icon: peopleSmall,
|
|
96
|
+
description: 'Manage People in the Campus',
|
|
88
97
|
},
|
|
89
98
|
{
|
|
90
99
|
title: 'HostelX',
|
|
@@ -102,13 +111,4 @@ export const applications = [
|
|
|
102
111
|
icon: commuteSmall,
|
|
103
112
|
description: 'Manage Commute in the Campus',
|
|
104
113
|
},
|
|
105
|
-
|
|
106
|
-
{
|
|
107
|
-
title: 'PeopleX',
|
|
108
|
-
key: 'hrms',
|
|
109
|
-
domainName: 'people',
|
|
110
|
-
path: isDevelopment ? origins.people.dev : origins.people.prod,
|
|
111
|
-
icon: peopleSmall,
|
|
112
|
-
description: 'Manage People in the Campus',
|
|
113
|
-
},
|
|
114
114
|
]
|
|
@@ -28,7 +28,7 @@ export interface TableColumn<T> {
|
|
|
28
28
|
dataIndex: string
|
|
29
29
|
key: string
|
|
30
30
|
title: any
|
|
31
|
-
render?: (cellData: any, row:
|
|
31
|
+
render?: (cellData: any, row: any, index: number) => any
|
|
32
32
|
textColor?: string
|
|
33
33
|
sort?: boolean
|
|
34
34
|
width?: string //pixels
|
|
@@ -17,6 +17,7 @@ import { toast } from 'react-toastify'
|
|
|
17
17
|
import axios, { axiosErrorToast } from '../../config/axios'
|
|
18
18
|
import { buffertoCSV } from '../../utils'
|
|
19
19
|
import { DeleteButton, EditButton } from '../IconButtons'
|
|
20
|
+
import { useErrorModal } from '../ErrorModalWrapper/ErrorModalWrapper'
|
|
20
21
|
const animatedImage = require('./AnimatedUploadFile.gif')
|
|
21
22
|
|
|
22
23
|
const StyledDialogHeader = styled(Box)(({ theme }) => ({
|
|
@@ -97,7 +98,7 @@ export default function UploadFileDialog({
|
|
|
97
98
|
}: UploadFileDialogProps) {
|
|
98
99
|
const inputRef: any = useRef(null)
|
|
99
100
|
const [loading, setLoading] = useState(false)
|
|
100
|
-
|
|
101
|
+
const errorModal = useErrorModal()
|
|
101
102
|
const [file, setFile] = useState(null)
|
|
102
103
|
const [open, setOpen] = useState(false)
|
|
103
104
|
const onClose = () => {
|
|
@@ -136,17 +137,18 @@ export default function UploadFileDialog({
|
|
|
136
137
|
.catch((err) => {
|
|
137
138
|
console.log(err)
|
|
138
139
|
setLoading(false)
|
|
139
|
-
axiosErrorToast(err)
|
|
140
|
+
// axiosErrorToast(err)
|
|
141
|
+
errorModal({ error: err })
|
|
140
142
|
})
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
const handleSampleFileDownload = async () => {
|
|
144
146
|
try {
|
|
145
147
|
const res = await axios.get(sampleFileDownloadUrl)
|
|
146
|
-
|
|
147
148
|
buffertoCSV({ data: res.data, filename: `${dialogTitle}` })
|
|
148
149
|
} catch (error) {
|
|
149
|
-
|
|
150
|
+
errorModal({ error: error })
|
|
151
|
+
// axiosErrorToast(error)
|
|
150
152
|
}
|
|
151
153
|
}
|
|
152
154
|
|