@campxdev/shared 1.10.26 → 1.10.27

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.26",
3
+ "version": "1.10.27",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -14,7 +14,22 @@ import { createUpdateEducation } from '../service'
14
14
  const schema = yup.object().shape({
15
15
  name: yup.string().required('Name is required'),
16
16
  institution: yup.string().required('Institution is required'),
17
- startDate: yup.string().required('From Date is required'),
17
+ startDate: yup.string().nullable().required('From Date is required'),
18
+ endDate: yup
19
+ .string()
20
+
21
+ .required('End Date is required')
22
+ .test(
23
+ 'endDate',
24
+ 'To date must be greater than From date',
25
+ function (value) {
26
+ const { startDate } = this.parent
27
+ if (!startDate) return true
28
+ const startDateObj = new Date(startDate)
29
+ const endDateObj = new Date(value)
30
+ return startDateObj < endDateObj
31
+ },
32
+ ),
18
33
  description: yup.string().required('Description is required'),
19
34
  })
20
35
 
@@ -73,7 +88,12 @@ export const EducationForm = ({ data, hideDialog }) => {
73
88
  label="From Date"
74
89
  required
75
90
  />
76
- <FormDatePicker control={control} name="endDate" label="To Date" />
91
+ <FormDatePicker
92
+ control={control}
93
+ name="endDate"
94
+ label="To Date"
95
+ required
96
+ />
77
97
  <FormTextField
78
98
  control={control}
79
99
  multiline
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable no-console */
2
+ import { yupResolver } from '@hookform/resolvers/yup'
2
3
  import { Stack } from '@mui/material'
3
4
  import moment from 'moment'
4
5
  import { useForm } from 'react-hook-form'
@@ -9,12 +10,26 @@ import axios, { axiosErrorToast } from '../../../config/axios'
9
10
  import ActionButton from '../../ActionButton'
10
11
  import { FormDatePicker, FormSingleSelect, FormTextField } from '../../HookForm'
11
12
  import { createUpdateExperience } from '../service'
12
- import { yupResolver } from '@hookform/resolvers/yup'
13
13
 
14
14
  const schema = yup.object().shape({
15
15
  experienceType: yup.string().required('Experience Type is required'),
16
16
  title: yup.string().required('Title is required'),
17
17
  organizationName: yup.string().required('Organization Name is required'),
18
+ fromDate: yup.string().required('FromDate is Required'),
19
+ toDate: yup
20
+ .string()
21
+ .required('To Date is Required')
22
+ .test(
23
+ 'endDate',
24
+ 'To date must be greater than From date',
25
+ function (value) {
26
+ const { fromDate } = this.parent
27
+ if (!fromDate) return true
28
+ const startDateObj = new Date(fromDate)
29
+ const endDateObj = new Date(value)
30
+ return startDateObj < endDateObj
31
+ },
32
+ ),
18
33
  })
19
34
 
20
35
  export const ExperienceForm = ({ data, hideDialog }) => {
@@ -82,8 +97,18 @@ export const ExperienceForm = ({ data, hideDialog }) => {
82
97
  label="Organisation Name"
83
98
  required
84
99
  />
85
- <FormDatePicker control={control} name="fromDate" label="From" />
86
- <FormDatePicker control={control} name="toDate" label="To" />
100
+ <FormDatePicker
101
+ control={control}
102
+ name="fromDate"
103
+ label="From"
104
+ required
105
+ />
106
+ <FormDatePicker
107
+ control={control}
108
+ name="toDate"
109
+ label="To"
110
+ required
111
+ />
87
112
  <FormTextField
88
113
  control={control}
89
114
  name="description"
@@ -2,6 +2,7 @@
2
2
  import { Box, Chip, Container, Typography } from '@mui/material'
3
3
  import { useQuery } from 'react-query'
4
4
  import axios from '../../config/axios'
5
+ import { InsititutionsStore } from '../../shared-state/InstitutionsStore'
5
6
  import PageHeader from '../PageHeader'
6
7
  import Spinner from '../Spinner'
7
8
  import Education from './Education/Education'
@@ -18,6 +19,8 @@ import {
18
19
  import Workshop from './Workshop/Workshop'
19
20
 
20
21
  const MyProfile = ({ close }) => {
22
+ const { institutions, current } = InsititutionsStore.useState((s) => s)
23
+
21
24
  const { data, isLoading } = useQuery('dashboard', () =>
22
25
  axios.get('/square/users/dashboard').then((res) => res?.data),
23
26
  )
@@ -113,7 +116,10 @@ const MyProfile = ({ close }) => {
113
116
  <Typography variant="h1">{userProfile?.fullName}</Typography>
114
117
  <Typography variant="h4">
115
118
  {userProfile?.designation?.name} | Dept. of{' '}
116
- {userProfile?.department?.name}
119
+ {userProfile?.departments
120
+ ?.filter((item) => item?.institutionId == current?.id)
121
+ .map((item) => item.name)
122
+ .join(',')}
117
123
  </Typography>
118
124
  </Box>
119
125
  </Box>
@@ -54,6 +54,7 @@ export const PublicationsForm = ({ data, hideDialog, userProfile = null }) => {
54
54
  selectedAuthor: 'singleAuthor',
55
55
  publicationSubtypes: [],
56
56
  })
57
+
57
58
  const { resource, selectedAuthor, publicationSubtypes } = state
58
59
 
59
60
  const { data: paperPublicationTypes } = useQuery(
@@ -18,10 +18,15 @@ export const StyledArrowIcon = styled(KeyboardArrowLeft)({
18
18
  color: 'white',
19
19
  })
20
20
  export const StyledMainContainer = styled(Box)(({ theme }) => ({
21
- minHeight: '55vh',
21
+ maxHeight: '50vh',
22
22
  height: 'auto',
23
23
  marginTop: '25px',
24
24
  overflowY: 'auto',
25
+ '&::-webkit-scrollbar': {
26
+ width: '0.5em',
27
+ height: '0.5em',
28
+ },
29
+
25
30
  border: theme.borders.grayLight,
26
31
  borderRadius: '10px',
27
32
  '& .MuiTabs-root': {
@@ -34,7 +34,20 @@ const schema = yup.object().shape({
34
34
  stream: yup.string().required('Stream is required'),
35
35
  program: yup.string().required('Program is required'),
36
36
  fromDate: yup.string().required('From Date is required'),
37
- toDate: yup.string().required('To Date is required'),
37
+ toDate: yup
38
+ .string()
39
+ .required('To Date is required')
40
+ .test(
41
+ 'endDate',
42
+ 'To date must be greater than From date',
43
+ function (value) {
44
+ const { fromDate } = this.parent
45
+ if (!fromDate) return true
46
+ const startDateObj = new Date(fromDate)
47
+ const endDateObj = new Date(value)
48
+ return startDateObj < endDateObj
49
+ },
50
+ ),
38
51
  })
39
52
 
40
53
  export const WorkshopForm = ({ data, hideDialog }) => {