Skip to content
This repository was archived by the owner on Mar 7, 2024. It is now read-only.

Commit b15e0bb

Browse files
Merge pull request #167 from Abhishek-kumar09/r
Modify Enquire button function and add required validators to forms
2 parents 0261942 + cbcd665 commit b15e0bb

File tree

5 files changed

+81
-35
lines changed

5 files changed

+81
-35
lines changed

src/views/pages/CLView/ApplyNowModal.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ export default function ApplyNowModal() {
116116
</DialogContentText>
117117
<ValidatorForm onSubmit={handleSubmit}>
118118
<TextValidator
119+
required
119120
key="name"
120121
className={classes.textField}
121122
label="Full Name"
@@ -129,6 +130,7 @@ export default function ApplyNowModal() {
129130
/>
130131

131132
<TextValidator
133+
required
132134
key="email"
133135
className={classes.textField}
134136
label="Email"
@@ -165,6 +167,7 @@ export default function ApplyNowModal() {
165167

166168
<Grid item xs={10}>
167169
<TextValidator
170+
required
168171
key="contact"
169172
className={classes.textField}
170173
label="WhatsApp / Contact Number "
@@ -186,6 +189,7 @@ export default function ApplyNowModal() {
186189
</Grid>
187190

188191
<TextValidator
192+
required
189193
key="linkedIn"
190194
className={classes.textField}
191195
label="LinkedIn URL"
@@ -205,6 +209,7 @@ export default function ApplyNowModal() {
205209
/>
206210

207211
<TextValidator
212+
required
208213
key="course"
209214
className={classes.textField}
210215
label="Course & Branch"
@@ -218,6 +223,7 @@ export default function ApplyNowModal() {
218223
/>
219224

220225
<SelectValidator
226+
required
221227
key="year"
222228
className={classes.textField}
223229
value={formData.year}
@@ -238,6 +244,7 @@ export default function ApplyNowModal() {
238244
</SelectValidator>
239245

240246
<TextValidator
247+
required
241248
key="college"
242249
className={classes.textField}
243250
label="College Name"

src/views/pages/Course/ApplyModal.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const useStyles = makeStyles(theme => ({
3838
}
3939
}));
4040

41-
export default function ApplyModal() {
41+
export default function ApplyModal({ fullWidth = false, ...rest }) {
4242
const classes = useStyles();
4343
const [open, setOpen] = useState(false);
4444
const [formData, updateFormData] = useState({});
@@ -96,6 +96,8 @@ export default function ApplyModal() {
9696
size="large"
9797
variant="contained"
9898
onClick={handleClickOpen}
99+
{...rest}
100+
fullWidth={fullWidth}
99101
>
100102
Enquire Now
101103
</Button>
@@ -114,6 +116,7 @@ export default function ApplyModal() {
114116
</DialogContentText>
115117
<ValidatorForm onSubmit={handleSubmit}>
116118
<TextValidator
119+
required
117120
key="name"
118121
className={classes.textField}
119122
label="Full Name"
@@ -127,6 +130,7 @@ export default function ApplyModal() {
127130
/>
128131

129132
<TextValidator
133+
required
130134
key="email"
131135
className={classes.textField}
132136
label="Email"
@@ -163,6 +167,7 @@ export default function ApplyModal() {
163167

164168
<Grid item xs={10}>
165169
<TextValidator
170+
required
166171
key="contact"
167172
className={classes.textField}
168173
label="WhatsApp / Contact Number "
@@ -184,6 +189,7 @@ export default function ApplyModal() {
184189
</Grid>
185190

186191
<TextValidator
192+
required
187193
key="course"
188194
className={classes.textField}
189195
label="Course & Branch"
@@ -197,6 +203,7 @@ export default function ApplyModal() {
197203
/>
198204

199205
<SelectValidator
206+
required
200207
key="year"
201208
className={classes.textField}
202209
value={formData.year}
@@ -217,6 +224,7 @@ export default function ApplyModal() {
217224
</SelectValidator>
218225

219226
<TextValidator
227+
required
220228
key="college"
221229
className={classes.textField}
222230
label="College Name"
@@ -231,7 +239,7 @@ export default function ApplyModal() {
231239

232240
{submitting === 0 ? (
233241
<Button type="submit" variant="contained" color="secondary">
234-
Apply
242+
Submit
235243
</Button>
236244
) : (
237245
<div className={classes.submissions}>

src/views/pages/Course/FinalAction.js

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import React from 'react';
1+
import { Box, Card, Grid, Typography } from '@material-ui/core';
22
import { makeStyles } from '@material-ui/core/styles';
3-
import { Box, Grid, Typography, Card, Button } from '@material-ui/core';
4-
import DetailsBottom from './partials/DetailsBottom';
5-
3+
import React from 'react';
64
import ApplyModal from './ApplyModal';
5+
import DetailsBottom from './partials/DetailsBottom';
76

87
const useStyles = makeStyles(theme => ({
98
icon: {
@@ -87,6 +86,23 @@ const useStyles = makeStyles(theme => ({
8786

8887
export default function FinalAction({ course, batch }) {
8988
const classes = useStyles();
89+
// const [applyState, setApplyState] = useState('Enquire');
90+
91+
// const user = useSelector(state => state.account.user);
92+
// const baseUrl =
93+
// 'https://us-central1-codeforcauseorg.cloudfunctions.net/widgets/applications';
94+
// const dispatch = useDispatch();
95+
// const handleApply = () => {
96+
// const url = `${baseUrl}/${batch.courseId}`;
97+
// if (!user) {
98+
// dispatch(login());
99+
// } else {
100+
// setApplyState('Generating...');
101+
// axios.post(url).then(result => {
102+
// window.location.href = `/applications?id=${result.data.id}`;
103+
// });
104+
// }
105+
// };
90106

91107
return (
92108
<Grid container className={classes.root}>
@@ -211,9 +227,16 @@ export default function FinalAction({ course, batch }) {
211227
</Box>
212228
</Box>
213229
</Card>
214-
215-
<ApplyModal />
216-
230+
<Box style={{ width: '100%' }}>
231+
<ApplyModal
232+
fullWidth={true}
233+
style={{
234+
marginTop: '24px',
235+
textTransform: 'capitalize',
236+
padding: '6px 12px'
237+
}}
238+
/>
239+
</Box>
217240
</Box>
218241
</Grid>
219242
</Grid>

src/views/pages/EventsView/Events.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const useStyles = makeStyles(theme => ({
9090
borderRadius: '0px 5px 5px 0px',
9191
color: 'white',
9292
backgroundColor: '#000000'
93-
},
93+
},
9494
loading: {
9595
position: 'relative',
9696
padding: '160px 49vw',
@@ -120,10 +120,14 @@ function Events({ className, ...rest }) {
120120
}, [getEvents]);
121121

122122
if (!events) {
123-
return <Container className={classes.loading}>
124-
<CircularProgress style={{left: '50%', display: 'absolute'}}></CircularProgress>
125-
</Container>
126-
}
123+
return (
124+
<Container className={classes.loading}>
125+
<CircularProgress
126+
style={{ left: '50%', display: 'absolute' }}
127+
></CircularProgress>
128+
</Container>
129+
);
130+
}
127131

128132
return (
129133
<div className={clsx(classes.root, className)} {...rest}>

src/views/pages/HomeView/Events.js

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,18 @@ function Events({ className, ...rest }) {
152152
<SwiperSlide key={`slide-${index}`} tag="li">
153153
<EventCard event={event} index={index} style={{ height: 'auto' }} />
154154
</SwiperSlide>
155-
)
156-
})
155+
);
156+
});
157157
}
158158

159159
if (!events) {
160-
return <Container className={classes.loading}>
161-
<CircularProgress style={{left: '50%', display: 'absolute'}}></CircularProgress>
162-
</Container>
160+
return (
161+
<Container className={classes.loading}>
162+
<CircularProgress
163+
style={{ left: '50%', display: 'absolute' }}
164+
></CircularProgress>
165+
</Container>
166+
);
163167
}
164168

165169
return (
@@ -170,24 +174,24 @@ function Events({ className, ...rest }) {
170174
</Typography>
171175
<Grid container spacing={4} className={classes.extraMargin}>
172176
<Hidden xsDown>
173-
<Swiper
174-
id="main"
175-
navigation={true}
176-
pagination={{ clickable: true }}
177-
spaceBetween={70}
178-
slidesPerView={
179-
large ? 3 : medium ? 2 : small ? 1 : 1
180-
}
181-
slidesPerGroup={large ? 2 : medium ? 2 : small ? 1 : 1}
182-
className={classes.swiper}
183-
>
184-
{eventSlides}
185-
</Swiper>
177+
<Swiper
178+
id="main"
179+
navigation={true}
180+
pagination={{ clickable: true }}
181+
spaceBetween={70}
182+
slidesPerView={large ? 3 : medium ? 2 : small ? 1 : 1}
183+
slidesPerGroup={large ? 2 : medium ? 2 : small ? 1 : 1}
184+
className={classes.swiper}
185+
>
186+
{eventSlides}
187+
</Swiper>
186188
</Hidden>
187189
<Hidden smUp>
188-
{events.slice(Math.max(events.length - 3, 0)).map((event, index) => (
189-
<EventCard event={event} index={index} />
190-
))}
190+
{events
191+
.slice(Math.max(events.length - 3, 0))
192+
.map((event, index) => (
193+
<EventCard event={event} index={index} />
194+
))}
191195
</Hidden>
192196
<Grid item xs={12} sm={12} md={12}>
193197
<div className={classes.box2}>

0 commit comments

Comments
 (0)