Skip to content

Commit

Permalink
adding admin router and dropdown fix
Browse files Browse the repository at this point in the history
  • Loading branch information
karkran committed Dec 11, 2018
1 parent 4d9f105 commit 007917b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 10 deletions.
3 changes: 2 additions & 1 deletion frontend/src/MainApp/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Component } from 'react';
import Login from '../components/Login/index'
import NotFound from '../components/NotFound/index'
import AdminView from '../components/AdminView/index'
import { Switch, Route, Redirect } from 'react-router-dom'
class MainApp extends Component {
constructor(props){
Expand All @@ -15,12 +16,12 @@ class MainApp extends Component {
submittedData:data
})
}

render() {
return (
<main>
<Switch>
<Route exact path='/' render={() => <Login onSubmit={this.onSubmit}/>}/>
<Route exact path='/AdminView' component={AdminView} />
<Route path='/NotFound' component={NotFound} />
<Redirect from='*' to='/NotFound' />
</Switch>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/common/SelectBox2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ class SelectBox2 extends React.Component {
}

render() {
const { options } = this.props
const { options, value } = this.props
return (
<select className='SelectBox2SelectBox' onChange={this.props.handleChange}>
<select className='SelectBox2SelectBox' onChange={this.props.handleChange} value={value}>
{options.map((option, index) => {
return <option key={index}>{option}</option>
return <option key={index} value={option}>{option}</option>
})}
</select>
)
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/common/SelectBoxWithLabel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import './index.css'
class SelectBoxWithLabel extends React.Component {

render() {
const { category } = this.props
const { category, value } = this.props
return (
<div className='SelectBox2'>
<div className='SelectBox2Label'>
{category}
</div>
<SelectBox2 options={this.props.options} handleChange={this.props.handleChange}></SelectBox2>
<SelectBox2 options={this.props.options} handleChange={this.props.handleChange} value={value}></SelectBox2>
</div>
)
}
Expand Down
11 changes: 11 additions & 0 deletions frontend/src/components/AdminView/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React, {Component} from 'react';
class AdminView extends Component {
constructor(props){
super(props)
}
render(){
return (<h1>Successfully submit</h1>)
}
}

export default AdminView;
13 changes: 9 additions & 4 deletions frontend/src/components/OnemdaForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import SelectBoxWithLabel from '../../common/SelectBoxWithLabel/index'
import Date from '../../common/Date/index'
import TextBox from '../../common/TextBox/index'
import TextWithCaption from '../../common/TextWithCaption/index'
import Emoji from '../../common/Emoji/index'
import { withRouter } from 'react-router-dom';

class OnemdaForm extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -161,7 +161,12 @@ class OnemdaForm extends React.Component {
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
})
}).then((response)=>{
this.props.history.push('/AdminView')
}
).catch(function(err) {
console.log('Fetch Error :-S', err);
});

console.log('submitting for realz')
}
Expand All @@ -181,7 +186,7 @@ class OnemdaForm extends React.Component {
<SelectBoxWithLabel category='Service Category' options={categories} handleChange={this.handleChangeSelectBoxServiceCategory}></SelectBoxWithLabel>
<Date handleChange={this.handleChangeDate}></Date>
<SelectableButtonGroupWithLabel handleChange={this.handleChangeSBGSessionTime} label='Session Time' options={options2}></SelectableButtonGroupWithLabel>
<SelectBoxWithLabel category='Activity Name' options={this.state.activityCategoryNames} handleChange={this.handleChangeSelectBoxActivityName}></SelectBoxWithLabel>
<SelectBoxWithLabel category='Activity Name' options={this.state.activityCategoryNames} handleChange={this.handleChangeSelectBoxActivityName} value={this.state.activityName}></SelectBoxWithLabel>
<TextWithCaption heading='LEARNING' text=' Onemda will suport me with everyday learning that promotes my independence and personal development over the next 12 months'></TextWithCaption>
<SelectableButtonGroup handleChange={() => {}} options={options1}></SelectableButtonGroup>
<TextBox handleChange={this.handleChangeLearningComment}></TextBox>
Expand All @@ -199,4 +204,4 @@ class OnemdaForm extends React.Component {
}
}

export default OnemdaForm
export default withRouter(OnemdaForm)

0 comments on commit 007917b

Please sign in to comment.