diff --git a/README.md b/README.md index e7f99c3d..5dfd78ac 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![Discord](https://img.shields.io/discord/717102560909197493.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/jBHPxUz) -[![Chat on Telegram](https://img.shields.io/badge/Chat%20on-Telegram-brightgreen.svg)](https://t.me/codeforcause) +[![Chat on Telegram](https://img.shields.io/badge/Chat%20on-Telegram-brightgreen.svg)](https://t.me/codeforcause) [![Twitter URL](https://img.shields.io/twitter/follow/codeforcausein?style=social&logo=twitter)](https://twitter.com/codeforcausein) ![](./public/static/logo/logo.png) @@ -7,7 +7,8 @@ # Code for Cause home website ## Contributions and PR - [![GitHub issues by-label](https://img.shields.io/github/issues/codeforcauseorg/codeforcause.org/good%20first%20issue)](https://github.com/codeforcauseorg/codeforcause.org/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) + +[![GitHub issues by-label](https://img.shields.io/github/issues/codeforcauseorg/codeforcause.org/good%20first%20issue)](https://github.com/codeforcauseorg/codeforcause.org/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) - PRs should be generated against `development`. - Remember to run `npm run format` before creating pull request. diff --git a/src/Routes.js b/src/Routes.js index a84c5207..92792898 100755 --- a/src/Routes.js +++ b/src/Routes.js @@ -177,6 +177,15 @@ const renderRoutes = () => ( )} /> + ( + + + + )} + /> ({ })); function getSteps() { - return [ - 'Profile Information', - 'Education Information' - ]; + return ['Profile Information', 'Education Information']; } function getStepContent( @@ -120,7 +117,7 @@ export function ApplicationSteps({ applicationId, setCourseTitle }) { if (response.data.submitted) { setActiveStep(3); enqueueSnackbar( - 'You application in submitted. We will contact you back with result.' + 'You application in submitted. We will contact you back.' ); } else { setFormData(response.data); diff --git a/src/views/pages/Course/ApplyModal.js b/src/views/pages/Course/ApplyModal.js new file mode 100644 index 00000000..035f4209 --- /dev/null +++ b/src/views/pages/Course/ApplyModal.js @@ -0,0 +1,258 @@ +import React, { useState } from 'react'; +import { + Dialog, + DialogActions, + DialogContent, + DialogContentText, + DialogTitle, + Button, + Typography, + MenuItem, + Grid +} from '@material-ui/core'; +import { makeStyles } from '@material-ui/core/styles'; +import CircularProgress from '@material-ui/core/CircularProgress'; +import { + ValidatorForm, + TextValidator, + SelectValidator +} from 'react-material-ui-form-validator'; +import { useSnackbar } from 'notistack'; +import axios from 'axios'; + +const useStyles = makeStyles(theme => ({ + btn: { + backgroundColor: '#A60000', + color: '#ffffff', + textTransform: 'capitalize', + '&:hover': { + backgroundColor: 'rgba(166, 0, 0, 0.8)' + } + }, + textField: { + marginBottom: '16px' + }, + submissions: { + width: '80px', + height: '50px' + } +})); + +export default function ApplyModal() { + const classes = useStyles(); + const [open, setOpen] = useState(false); + const [formData, updateFormData] = useState({}); + const [submitting, setSubmitting] = useState(0); + + const { enqueueSnackbar } = useSnackbar(); + + const handleClickOpen = () => { + setOpen(true); + formData.countryCode = '+91'; + formData.phone = ''; + }; + + const handleClose = () => { + setOpen(false); + }; + + const handleChange = event => { + updateFormData({ + ...formData, + [event.target.name]: event.target.value + }); + }; + + const handleSubmit = e => { + formData.phone = `${formData.countryCode}-${formData.phone}`; + formData.source = window.location.href; + setSubmitting(1); + e.preventDefault(); + axios({ + method: 'post', + url: + 'https://us-central1-codeforcauseorg.cloudfunctions.net/widgets/courseenquiries', + data: formData + }) + .then(response => { + setSubmitting(0); + handleClose(); + enqueueSnackbar('Application Submitted Successfully'); + }) + .catch(error => { + enqueueSnackbar('Application Failed. Try again later'); + }); + }; + + const countryCodes = Array(100) + .fill(1) + .map((x, y) => x + y) + .reverse(); + + return ( +
+ + + + Enquire for Course Enrollment + + + + Please provide your details below. + + + + + + + + + + {countryCodes.map(code => { + return +{code}; + })} + + + + + + + + + + + + 1st + 2nd + 3rd + 4th + 5th + Graduated + + + + + {submitting === 0 ? ( + + ) : ( +
+ +
+ )} + + +
+
+ +
+
+ ); +} diff --git a/src/views/pages/Course/CoursePage/index.js b/src/views/pages/Course/CoursePage/index.js index 186951c9..a37b313b 100755 --- a/src/views/pages/Course/CoursePage/index.js +++ b/src/views/pages/Course/CoursePage/index.js @@ -10,7 +10,7 @@ import Schedule from '../Schedule'; import Major from '../Major'; import Features from '../Features'; import Process from '../Process'; -import CourseFeatures from '../partials/CourseFeatures'; +// import CourseFeatures from '../partials/CourseFeatures'; const useStyles = makeStyles(() => ({ root: { @@ -26,7 +26,7 @@ function CoursePage({ course }) { return ( - + {/* */} diff --git a/src/views/pages/Course/ProcessSteppers.js b/src/views/pages/Course/ProcessSteppers.js index a96000ef..6be42d91 100644 --- a/src/views/pages/Course/ProcessSteppers.js +++ b/src/views/pages/Course/ProcessSteppers.js @@ -113,8 +113,8 @@ function ColorlibStepIcon(props) { const icons = { 1: , - 2: , - 3: , + 2: , + 3: , 4: }; @@ -164,8 +164,8 @@ const useStyles = makeStyles(theme => ({ function getSteps() { return [ 'Fill Application', - 'Get Shortlisted', 'Online Meeting', + 'Get Shortlisted', 'Welcome Aboard' ]; } diff --git a/src/views/pages/Course/Schedule.js b/src/views/pages/Course/Schedule.js index bf99d1b8..b9e3d3e0 100755 --- a/src/views/pages/Course/Schedule.js +++ b/src/views/pages/Course/Schedule.js @@ -1,19 +1,10 @@ import React, { useState } from 'react'; -import { - Grid, - Typography, - Box, - Collapse, - IconButton, - Button, -} from '@material-ui/core'; +import { Grid, Typography, Box, Collapse, IconButton } from '@material-ui/core'; import ExpandLessIcon from '@material-ui/icons/ExpandLess'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import { makeStyles } from '@material-ui/core/styles'; -import { login } from 'src/actions/accountActions'; -import axios from 'src/utils/axios'; -import { useDispatch, useSelector } from 'react-redux'; +import ApplyModal from './ApplyModal'; const useStyles = makeStyles(theme => ({ icon: { @@ -28,7 +19,6 @@ const useStyles = makeStyles(theme => ({ padding: theme.spacing(10, 3, 10) } }, - boxCover: { margin: theme.spacing(3, 3), [theme.breakpoints.down('md')]: { @@ -50,7 +40,7 @@ const useStyles = makeStyles(theme => ({ export default function Schedule({ course }) { const classes = useStyles(); - const [expanded, setExpanded] = React.useState(0); + const [expanded, setExpanded] = useState(0); return ( @@ -108,24 +98,6 @@ export default function Schedule({ course }) { } function BatchDropBox({ course, batch, batchIndex, expanded, setExpanded }) { - const user = useSelector(state => state.account.user); - const [applyState, setApplyState] = useState('Apply'); - - const baseUrl = - 'https://us-central1-codeforcauseorg.cloudfunctions.net/widgets/applications'; - const dispatch = useDispatch(); - const handleApply = () => { - const url = `${baseUrl}/${batch.courseId}`; - if (!user) { - dispatch(login()); - } else { - setApplyState('Generating...'); - axios.post(url).then(result => { - window.location.href = `/applications?id=${result.data.id}`; - }); - } - }; - return ( - - +