This repository was archived by the owner on Feb 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Frontdav1 #29
Open
thekidchad
wants to merge
3
commits into
master
Choose a base branch
from
frontdav1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Frontdav1 #29
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,169 @@ | ||
| import React, {PureComponent} from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| import { withStyles } from 'material-ui/styles'; | ||
| import List, { ListItem, ListItemText } from 'material-ui/List'; | ||
| import Avatar from 'material-ui/Avatar'; | ||
| import { Dialog, AppBar, Toolbar, IconButton, Typography, Divider } from 'material-ui'; | ||
| import SchoolIcon from 'material-ui-icons/School'; | ||
| import AssignmentIcon from 'material-ui-icons/Assignment'; | ||
| import CloseIcon from 'material-ui-icons/Close'; | ||
| import UpdateIcon from 'material-ui-icons/Update'; | ||
| import PeopleIcon from 'material-ui-icons/People'; | ||
| import lightBlue from 'material-ui/colors/lightBlue'; | ||
| import moment from 'moment'; | ||
| import { apiRoute, testTokenProf } from '../config/routes'; | ||
|
|
||
|
|
||
| const styles = theme => ({ | ||
| root: { | ||
| width: '100%', | ||
| backgroundColor: theme.palette.background.paper, | ||
| }, | ||
| avatar: { | ||
| margin: 10, | ||
| }, | ||
| blueAvatar: { | ||
| margin: 10, | ||
| cursor: 'pointer', | ||
| color: '#fff', | ||
| backgroundColor: lightBlue[500], | ||
| }, | ||
| redAvatar: { | ||
| margin: 10, | ||
| cursor: 'pointer', | ||
| color: '#fff', | ||
| backgroundColor: '#F44336', | ||
| }, | ||
| row: { | ||
| display: 'flex', | ||
| justifyContent: 'center', | ||
| }, | ||
| }); | ||
|
|
||
| class DetailCourses extends PureComponent { | ||
|
|
||
| static propTypes = { | ||
| className: PropTypes.string | ||
| }; | ||
|
|
||
| static defaultProps = { | ||
| className: '' | ||
| }; | ||
|
|
||
| state = { | ||
| open: false, | ||
| memberDetail: {} | ||
| } | ||
| handleClickOpen = (param, e) => { | ||
| this.setState({ | ||
| open: true, | ||
| memberDetail: param | ||
| }); | ||
| }; | ||
|
|
||
| handleClose = () => { | ||
| this.setState({ open: false }); | ||
| }; | ||
|
|
||
| render() { | ||
| const {classes} = this.props; | ||
| return ( | ||
| <div | ||
| style={{ | ||
| marginTop: '10px' | ||
| }} | ||
| className={classes.root}> | ||
| <List> | ||
| <ListItem> | ||
| <Avatar> | ||
| <AssignmentIcon /> | ||
| </Avatar> | ||
| <ListItemText primary="Nom du cours" secondary={this.props.cours.title} /> | ||
| </ListItem> | ||
| <ListItem> | ||
| <Avatar> | ||
| <SchoolIcon /> | ||
| </Avatar> | ||
| <ListItemText primary="Professeur responsable" secondary={this.props.cours.teacher} /> | ||
| </ListItem> | ||
| <ListItem> | ||
| <Avatar> | ||
| <UpdateIcon /> | ||
| </Avatar> | ||
| <ListItemText primary="Dates" | ||
| secondary={`le ${moment(this.props.cours.start_time).format('DD/MM')} | ||
| de ${moment(this.props.cours.start_time).format('HH:mm')} à | ||
| ${moment(this.props.cours.end_time).format('HH:mm')} `} /> | ||
| </ListItem> | ||
| <ListItem> | ||
| <Avatar> | ||
| <PeopleIcon /> | ||
| </Avatar> | ||
| <ListItemText primary="Elèves" secondary="Liste des élèves associé à ce cours" /> | ||
| </ListItem> | ||
|
|
||
| </List> | ||
| <div className={classes.row}> | ||
| { this.props.cours.attendees ? | ||
| this.props.cours.attendees.map(e => | ||
| // fetch(`${apiRoute.linkapp}/pictures/file/${e.username}`, { | ||
| // method: 'GET', | ||
| // headers : { | ||
| // 'Authorization': testTokenProf.access_token | ||
| // } | ||
| // }) | ||
| // .then((response) => console.log(response) || response.json() ) | ||
| // .then(data => { | ||
| // console.log(data); | ||
| // }) | ||
| <Avatar | ||
| key={e._id} | ||
| className={e.ishere ? classes.blueAvatar : classes.redAvatar } | ||
| onClick={this.handleClickOpen.bind(this, e)}> | ||
| { e.username ? e.username.substring(0,1).toUpperCase() : '' } | ||
| </Avatar> | ||
| ) | ||
| : '' } | ||
| </div> | ||
| <Dialog | ||
| open={this.state.open} | ||
| onClose={this.handleClose} | ||
| > | ||
| <AppBar className={classes.appBar}> | ||
| <Toolbar> | ||
| <IconButton color="inherit" onClick={this.handleClose} aria-label="Close"> | ||
| <CloseIcon /> | ||
| </IconButton> | ||
| <Typography variant="title" color="inherit" className={classes.flex}> | ||
| { this.state.memberDetail.firstname && this.state.memberDetail.lastname ? | ||
| `${this.state.memberDetail.firstname} ${this.state.memberDetail.lastname}` : | ||
| '' } | ||
| </Typography> | ||
| </Toolbar> | ||
| </AppBar> | ||
| <h3 style={{ textAlign: 'center'}}> | ||
| { this.state.memberDetail.firstname && this.state.memberDetail.lastname ? | ||
| `${this.state.memberDetail.firstname} ${this.state.memberDetail.lastname}` : | ||
| '' } | ||
| </h3> | ||
| <List> | ||
| <ListItem button> | ||
| <ListItemText primary="Commentaire" secondary={ this.state.memberDetail.comments ? this.state.memberDetail.comments : 'Pas de commentaire' } /> | ||
| </ListItem> | ||
| <Divider /> | ||
| <p style={{ | ||
| textAlign: 'center', | ||
| color: this.state.memberDetail.ishere ? lightBlue[500]: '#F44336' | ||
| }} > | ||
| { this.state.memberDetail.ishere ? | ||
| 'Présent à ce cours' : 'Absent à ce cours' | ||
| } | ||
| </p> | ||
| </List> | ||
| </Dialog> | ||
| </div> | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| export default withStyles(styles)(DetailCourses); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import React, {Component} from 'react'; | ||
| import {withStyles} from 'material-ui'; | ||
|
|
||
|
|
||
| const styles = theme => ({ | ||
| root: { | ||
| width: "150px", | ||
| height: "150px", | ||
| border: "4px solid black", | ||
| borderRadius: "10px" | ||
| } | ||
|
|
||
|
|
||
| }); | ||
|
|
||
| class Course extends Component { | ||
|
|
||
|
|
||
| render() { | ||
| const {classes} = this.props; | ||
|
|
||
|
|
||
| return ( | ||
| <div style={classes.root}/> | ||
| ); | ||
| } | ||
|
|
||
|
|
||
| } | ||
|
|
||
| export default withStyles(styles)(Course); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| import React, {PureComponent} from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| import Select from 'material-ui/Select' | ||
| import { MenuItem } from 'material-ui/Menu'; | ||
| import { InputLabel, Typography } from 'material-ui'; | ||
| import DetailCourse from './DetailCourse'; | ||
| import { apiRoute, testTokenProf } from '../config/routes'; | ||
|
|
||
|
|
||
| class promotionsContent extends PureComponent { | ||
|
|
||
| static propTypes = { | ||
| className: PropTypes.string | ||
| }; | ||
|
|
||
| static defaultProps = { | ||
| className: '' | ||
| }; | ||
|
|
||
| handlepromotionselect = event => { | ||
| console.log(event.target.value); | ||
| fetch(`${apiRoute.sagg}/promos/${event.target.value}/courses`, { | ||
| method: 'GET', | ||
| headers : { | ||
| 'Authorization': testTokenProf.access_token | ||
| } | ||
| }) | ||
| .then((response) => console.log(response) || response.json() ) | ||
| .then(data => { | ||
| this.setState({ selectedCourse: data.courses, | ||
| selectedPromo: this.state.promotions.find(e => e._id === event.target.value) }) | ||
| }) | ||
| }; | ||
|
|
||
| componentDidMount() { | ||
| fetch(`${apiRoute.linkapp}/promos/listpromoofresponsable`, { | ||
| method: 'GET', | ||
| headers : { | ||
| 'Authorization': testTokenProf.access_token | ||
| } | ||
| }) | ||
| .then((response) => console.log(response) || response.json() ) | ||
| .then(data => { | ||
| this.setState({ promotions: data.promotions }) | ||
| }) | ||
| } | ||
| constructor(props) { | ||
| super(props); | ||
| this.state = { | ||
| showButton: true, | ||
| showCourseForm: false, | ||
| showAttendanceSheet: false, | ||
| value: 1, | ||
| selectedCourse: false, | ||
| open: false, | ||
| promotions: [] | ||
| }; | ||
| } | ||
|
|
||
| render() { | ||
| return ( | ||
| <div align="center"> | ||
| <InputLabel htmlFor="promotions-simple"> | ||
| <h3>{this.state.selectedPromo ? this.state.selectedPromo.nomPromo | ||
| : 'Veuillez sélectionner une promo'} | ||
| </h3> | ||
| </InputLabel> | ||
| <Select | ||
| onChange={this.handlepromotionselect} | ||
| value={this.state.selectedCourse._id || ''} | ||
| inputProps={{ | ||
| name: 'selectedCourse', | ||
| id: 'promotions-simple', | ||
| }} | ||
| style={{ | ||
| width: '75%', | ||
| textAlign: 'center' | ||
| }} | ||
| > | ||
| { this.state.promotions ? | ||
| this.state.promotions.map(option => | ||
| <MenuItem key={option._id} | ||
| value={option._id}> | ||
| {option.nomPromo} | ||
| </MenuItem>) : '' } | ||
| </Select> | ||
| {this.state.selectedCourse ? | ||
| this.state.selectedCourse.map(e => | ||
| <DetailCourse | ||
| cours={e} | ||
| key={e._id} | ||
| /> | ||
| ) | ||
| : '' } | ||
| </div> | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| export default promotionsContent; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c'est bien .sagg et pas local