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

Commit a89738b

Browse files
committed
Update applications page to handle applications
1 parent 6ec2fba commit a89738b

File tree

15 files changed

+173
-87
lines changed

15 files changed

+173
-87
lines changed
Loading
Loading
Loading
75.6 KB
Loading
Loading
89.2 KB
Loading

src/views/pages/ApplicationsView/ApplicationSteps.js

Lines changed: 120 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ import StepLabel from '@material-ui/core/StepLabel';
66
import StepContent from '@material-ui/core/StepContent';
77
import Paper from '@material-ui/core/Paper';
88

9-
import { Button, Typography } from '@material-ui/core';
10-
import { ValidatorForm, TextValidator } from 'react-material-ui-form-validator';
9+
import { Button, Typography, MenuItem } from '@material-ui/core';
10+
import {
11+
ValidatorForm,
12+
TextValidator,
13+
SelectValidator
14+
} from 'react-material-ui-form-validator';
1115

1216
// import axios from 'axios';
1317

@@ -26,12 +30,16 @@ const useStyles = makeStyles(theme => ({
2630
padding: theme.spacing(3)
2731
},
2832
textField: {
29-
marginBottom: '12px'
33+
marginBottom: '16px'
3034
}
3135
}));
3236

3337
function getSteps() {
34-
return ['Profile Information', 'Education Information', 'Application Challenge'];
38+
return [
39+
'Profile Information',
40+
'Education Information',
41+
'Application Challenge'
42+
];
3543
}
3644

3745
function getStepContent(step, setActiveStep, formData, setFormData) {
@@ -67,16 +75,16 @@ function getStepContent(step, setActiveStep, formData, setFormData) {
6775

6876
export function ApplicationSteps() {
6977
const classes = useStyles();
70-
const [activeStep, setActiveStep] = React.useState(0);
78+
const [activeStep, setActiveStep] = React.useState(2);
7179
const [formData, setFormData] = React.useState({
72-
personal : {},
73-
education : {},
80+
personal: {},
81+
education: {},
7482
challenge: {}
7583
});
7684
const steps = getSteps();
7785

7886
const handleSubmitApplication = () => {
79-
console.log(formData)
87+
console.log(formData);
8088
};
8189

8290
return (
@@ -126,16 +134,29 @@ function FormPersonalInfo({ setActiveStep, data, setData }) {
126134
return (
127135
<ValidatorForm onSubmit={handleSubmit}>
128136
<TextValidator
129-
key="name"
137+
key="fullName"
130138
className={classes.textField}
131-
label="Full Name"
139+
label="Name"
132140
variant="outlined"
133-
value={formData.name}
141+
value={formData.fullName}
134142
fullWidth
135-
name="name"
143+
name="fullName"
136144
onChange={handleChange}
137145
validators={['required']}
138-
errorMessages={['This is a required field']}
146+
errorMessages={['Name is a required field']}
147+
/>
148+
149+
<TextValidator
150+
key="phone"
151+
className={classes.textField}
152+
label="Phone"
153+
variant="outlined"
154+
value={formData.phone}
155+
fullWidth
156+
name="phone"
157+
onChange={handleChange}
158+
validators={['required']}
159+
errorMessages={['Phone number is a required field']}
139160
/>
140161

141162
<TextValidator
@@ -147,10 +168,30 @@ function FormPersonalInfo({ setActiveStep, data, setData }) {
147168
fullWidth
148169
name="email"
149170
onChange={handleChange}
150-
validators={['required']}
151-
errorMessages={['This is a required field']}
171+
validators={['required', 'isEmail']}
172+
errorMessages={[
173+
'Email is a required field',
174+
'Must be a valid Email address'
175+
]}
152176
/>
153177

178+
<SelectValidator
179+
key="gender"
180+
className={classes.textField}
181+
value={formData.gender}
182+
onChange={handleChange}
183+
name="gender"
184+
variant="outlined"
185+
validators={['required']}
186+
errorMessages={['Please select a gender']}
187+
label="Gender"
188+
fullWidth
189+
>
190+
<MenuItem value="male">Male</MenuItem>
191+
<MenuItem value="female">Female</MenuItem>
192+
<MenuItem value="other">Other</MenuItem>
193+
</SelectValidator>
194+
154195
<Button variant="outlined" disabled color="secondary">
155196
Cancel
156197
</Button>
@@ -163,7 +204,7 @@ function FormPersonalInfo({ setActiveStep, data, setData }) {
163204
marginLeft: '16px'
164205
}}
165206
>
166-
Next
207+
Save
167208
</Button>
168209
</ValidatorForm>
169210
);
@@ -193,32 +234,66 @@ function FormEducationInfo({ setActiveStep, data, setData }) {
193234
setActiveStep(2);
194235
};
195236

237+
const years = Array(25)
238+
.fill(2000)
239+
.map((x, y) => x + y);
240+
196241
return (
197242
<ValidatorForm onSubmit={handleSubmit}>
243+
<SelectValidator
244+
key="year"
245+
className={classes.textField}
246+
value={formData.year}
247+
onChange={handleChange}
248+
name="year"
249+
variant="outlined"
250+
validators={['required']}
251+
errorMessages={['Please select your Graduation Year']}
252+
label="Graduation Year"
253+
fullWidth
254+
>
255+
{years.map((year, index) => {
256+
return <MenuItem value={year}>{year}</MenuItem>;
257+
})}
258+
</SelectValidator>
259+
198260
<TextValidator
199-
key="name"
261+
key="college"
200262
className={classes.textField}
201-
label="Full Name"
263+
label="College"
202264
variant="outlined"
203-
value={formData.name}
265+
value={formData.college}
204266
fullWidth
205-
name="name"
267+
name="college"
206268
onChange={handleChange}
207269
validators={['required']}
208-
errorMessages={['This is a required field']}
270+
errorMessages={['College is a required field']}
209271
/>
210272

211273
<TextValidator
212-
key="email"
274+
key="state"
213275
className={classes.textField}
214-
label="Email"
276+
label="State"
215277
variant="outlined"
216-
value={formData.email}
278+
value={formData.state}
217279
fullWidth
218-
name="email"
280+
name="state"
219281
onChange={handleChange}
220282
validators={['required']}
221-
errorMessages={['This is a required field']}
283+
errorMessages={['State is a required field']}
284+
/>
285+
286+
<TextValidator
287+
key="country"
288+
className={classes.textField}
289+
label="Country"
290+
variant="outlined"
291+
value={formData.country}
292+
fullWidth
293+
name="country"
294+
onChange={handleChange}
295+
validators={['required']}
296+
errorMessages={['Country is a required field']}
222297
/>
223298

224299
<Button variant="outlined" onClick={handlePrev} color="secondary">
@@ -232,7 +307,7 @@ function FormEducationInfo({ setActiveStep, data, setData }) {
232307
marginLeft: '16px'
233308
}}
234309
>
235-
Next
310+
Save
236311
</Button>
237312
</ValidatorForm>
238313
);
@@ -265,29 +340,33 @@ function FormChallenge({ setActiveStep, data, setData }) {
265340
return (
266341
<ValidatorForm onSubmit={handleSubmit}>
267342
<TextValidator
268-
key="name"
269343
className={classes.textField}
270-
label="Full Name"
271-
variant="outlined"
272-
value={formData.name}
344+
multiline
273345
fullWidth
274-
name="name"
346+
label="Why ?"
347+
variant="outlined"
275348
onChange={handleChange}
276-
validators={['required']}
277-
errorMessages={['This is a required field']}
349+
rows={4}
278350
/>
279351

280352
<TextValidator
281-
key="email"
282353
className={classes.textField}
283-
label="Email"
354+
multiline
355+
fullWidth
356+
label="What is your expectation from this course?"
284357
variant="outlined"
285-
value={formData.email}
358+
onChange={handleChange}
359+
rows={4}
360+
/>
361+
362+
<TextValidator
363+
className={classes.textField}
364+
multiline
286365
fullWidth
287-
name="email"
366+
label="What is your viewpoint toward Coding in Community Contribution?"
367+
variant="outlined"
288368
onChange={handleChange}
289-
validators={['required']}
290-
errorMessages={['This is a required field']}
369+
rows={4}
291370
/>
292371

293372
<Button variant="outlined" onClick={handlePrev} color="secondary">
@@ -301,7 +380,7 @@ function FormChallenge({ setActiveStep, data, setData }) {
301380
marginLeft: '16px'
302381
}}
303382
>
304-
Next
383+
Save
305384
</Button>
306385
</ValidatorForm>
307386
);

src/views/pages/ApplicationsView/EditApplication.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ export function EditApplication() {
2121

2222
return (
2323
<Grid container className={classes.root}>
24-
<Grid item lg={6} md={6} sm={12} xs={12}>
25-
<Typography variant="h2">
24+
<Grid item lg={12} md={12} sm={12} xs={12}>
25+
<Typography variant="h2" align="center">
2626
Fill the Application to be Considered for the Course
2727
</Typography>
2828
</Grid>
2929

30-
<Grid item lg={6} md={6} sm={12} xs={12}></Grid>
3130

3231
<Grid item lg={6} md={6} sm={12} xs={12}>
3332
<ApplicationSteps />

src/views/pages/ApplicationsView/index.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
import React from 'react';
22

3-
import { Switch, Route } from 'react-router-dom';
4-
import { ListApplications } from './ListApplications';
5-
import { PreviewApplication } from './PreviewApplication';
63
import { EditApplication } from './EditApplication';
74

85
function ApplicationsView({ match }) {
96
console.log('Matched in routing', match);
107

118
return (
12-
<Switch>
13-
<Route path={`${match.path}/:id/edit`} component={EditApplication} />
14-
<Route
15-
path={`${match.path}/:id/preview`}
16-
component={PreviewApplication}
17-
/>
18-
<Route path={`${match.path}/`} component={ListApplications} />
19-
</Switch>
9+
<EditApplication />
2010
);
2111
}
2212

src/views/pages/CLView/ApplyNowModal.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
import { makeStyles } from '@material-ui/core/styles';
1212
import CircularProgress from '@material-ui/core/CircularProgress';
1313
import { ValidatorForm, TextValidator } from 'react-material-ui-form-validator';
14-
14+
import { useSnackbar } from 'notistack';
1515
import axios from 'axios';
1616

1717
const useStyles = makeStyles(theme => ({
@@ -41,6 +41,8 @@ export default function ApplyNowModal() {
4141
const [formData, updateFormData] = useState({});
4242
const [submitting, setSubmitting] = useState(0);
4343

44+
const { enqueueSnackbar } = useSnackbar();
45+
4446
const handleClickOpen = () => {
4547
setOpen(true);
4648
};
@@ -68,8 +70,11 @@ export default function ApplyNowModal() {
6870
.then(response => {
6971
setSubmitting(0);
7072
handleClose();
73+
enqueueSnackbar('Application Submitted Successfully');
7174
})
72-
.catch(error => {});
75+
.catch(error => {
76+
enqueueSnackbar('Application Failed. Try again later');
77+
});
7378
};
7479

7580
return (

src/views/pages/Courses/Features.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const Features = () => {
6868
<Typography variant="h2" align="center" style={{
6969
marginBottom: "32px"
7070
}}>
71-
Courses Designed So You Munch Every Bit
71+
Courses Designed so You can Munch Every Bit
7272
</Typography>
7373

7474
<Grid container display="flex" flexDirection="row" justify="center" alignItems="center" style={{
@@ -78,7 +78,8 @@ const Features = () => {
7878
return (
7979
<Grid item lg={3} md={3} sm={6} xs={6} justify="center" alignItems="center">
8080
<Box display="flex" flexDirection="column" justifyContent="center" alignItems="center" style={{
81-
padding: "40px"
81+
padding: "40px",
82+
minWidth: "200px",
8283
}}>
8384
<img src={feature.image} alt={feature.line2} style={{
8485
width: "80px",

src/views/pages/Courses/FinalAction.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,13 @@ export default function FinalAction({ course, batch }) {
214214
variant="contained"
215215
color="secondary"
216216
fullWidth
217+
217218
style={{
218-
marginTop: '24px'
219+
marginTop: '24px',
220+
textTransform: 'capitalize'
219221
}}
220222
>
221-
Apply
223+
Apply Now
222224
</Button>
223225
</Box>
224226
</Grid>

0 commit comments

Comments
 (0)