76 lines
2.6 KiB
JavaScript
76 lines
2.6 KiB
JavaScript
import React, {Component} from "react";
|
|
import {Tabs, Tab} from "react-bootstrap"
|
|
import Accueil from "./GestionSemestre/Accueil";
|
|
import Absences from "./GestionSemestre/Absences";
|
|
import Eleves from "./GestionSemestre/Eleves";
|
|
import ScoNavBar from "./ScoNavBar";
|
|
import Bulletin from "./GestionSemestre/Bulletin";
|
|
import Select from "react-select";
|
|
|
|
class GestionSemestre extends Component {
|
|
constructor(props){
|
|
super(props)
|
|
this.state = {
|
|
selectOptions: [],
|
|
id: "",
|
|
name: '',
|
|
}
|
|
}
|
|
|
|
componentWillMount() {
|
|
let dept = window.location.href.split('/')[6]
|
|
let sem = window.location.href.split('/')[8]
|
|
let BASE_URL = window.$api_url
|
|
fetch(BASE_URL + dept +
|
|
'/Scolarite/Notes/groups_view?with_codes=1&format=json&formsemestre_id=' + sem, {
|
|
method: 'GET',
|
|
verify: false,
|
|
credentials: 'include',
|
|
})
|
|
.then(response =>
|
|
response.json().then(data => ({
|
|
data: data,
|
|
})
|
|
).then(res => {
|
|
res.data.map((student, index) => {
|
|
let joined = this.state.selectOptions.concat({label: student.nom_disp + " " + student.prenom, value: student.etudid});
|
|
this.setState({selectOptions: joined})
|
|
})
|
|
})
|
|
);
|
|
}
|
|
|
|
handleSelectChange(e){
|
|
this.setState({id:e.value, name:e.label})
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<div>
|
|
<ScoNavBar/>
|
|
<div id="wrapDept">
|
|
Choix de l'étudiant
|
|
<Select className="mySelect" options={this.state.selectOptions} onChange={this.handleSelectChange.bind(this)}/>
|
|
</div>
|
|
<div>
|
|
<Tabs defaultActiveKey="Accueil" id="controlled-tab-example">
|
|
<Tab eventKey="Accueil" title="Acceuil" >
|
|
<Accueil />
|
|
</Tab>
|
|
<Tab eventKey="Absences" title="Absences">
|
|
<Absences id={this.state.id} name={this.state.name}/>
|
|
</Tab>
|
|
<Tab eventKey="Bulletin" title="Bulletins">
|
|
<Bulletin id={this.state.id} name={this.state.name}/>
|
|
</Tab>
|
|
<Tab eventKey="Eleves" title="Eleves">
|
|
<Eleves />
|
|
</Tab>
|
|
</Tabs>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
}
|
|
|
|
export default GestionSemestre |