2021-05-03 12:09:31 +02:00
|
|
|
import React, {Component} from "react";
|
2021-05-10 17:27:18 +02:00
|
|
|
import {Tabs, Tab} from "react-bootstrap"
|
|
|
|
import Accueil from "./GestionSemestre/Accueil";
|
2021-04-30 13:56:53 +02:00
|
|
|
import Absences from "./GestionSemestre/Absences";
|
2021-05-25 12:55:30 +02:00
|
|
|
import Etudiants from "./GestionSemestre/Etudiants";
|
2021-04-30 13:56:53 +02:00
|
|
|
import ScoNavBar from "./ScoNavBar";
|
2021-05-07 13:53:36 +02:00
|
|
|
import Bulletin from "./GestionSemestre/Bulletin";
|
2021-05-11 17:46:17 +02:00
|
|
|
import Select from "react-select";
|
2021-05-25 12:55:30 +02:00
|
|
|
import {getJson} from "./Request";
|
2021-04-30 13:56:53 +02:00
|
|
|
|
2021-05-25 12:55:30 +02:00
|
|
|
/** Page de gestion du semestre */
|
2021-04-30 13:56:53 +02:00
|
|
|
class GestionSemestre extends Component {
|
2021-05-11 17:46:17 +02:00
|
|
|
constructor(props){
|
|
|
|
super(props)
|
|
|
|
this.state = {
|
|
|
|
selectOptions: [],
|
|
|
|
id: "",
|
|
|
|
name: '',
|
2021-05-31 14:19:43 +02:00
|
|
|
defaulttab: "Accueil",
|
|
|
|
defaultsel: ""
|
2021-05-11 17:46:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
componentWillMount() {
|
2021-05-25 12:55:30 +02:00
|
|
|
this.getData()
|
2021-05-31 14:19:43 +02:00
|
|
|
|
|
|
|
if (this.props.location.tab) {
|
|
|
|
this.setState({defaulttab: this.props.location.tab, defaultsel: this.props.location.etudid,
|
|
|
|
id: this.props.location.etudid, name: this.state.selectOptions.find(option => option.value === this.state.id)
|
|
|
|
})
|
|
|
|
}
|
2021-05-25 12:55:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Recupère la liste des étudiants inscrits au semestre pour le Select depuis l'API
|
|
|
|
*/
|
|
|
|
getData() {
|
|
|
|
let dept = window.location.href.split('/')[7]
|
|
|
|
let sem = window.location.href.split('/')[9]
|
2021-05-11 17:46:17 +02:00
|
|
|
let BASE_URL = window.$api_url
|
2021-05-25 12:55:30 +02:00
|
|
|
getJson(BASE_URL + dept + '/Scolarite/Notes/groups_view?with_codes=1&format=json&formsemestre_id=' + sem)
|
|
|
|
.then(res => {
|
2021-05-31 14:19:43 +02:00
|
|
|
this.setState({students: res.data})
|
2021-05-25 12:55:30 +02:00
|
|
|
// Création d'une liste pour le select
|
|
|
|
res.data.map((student) => {
|
|
|
|
let joined = this.state.selectOptions.concat({label: student.nom_disp + " " + student.prenom, value: student.etudid});
|
|
|
|
this.setState({selectOptions: joined})
|
2021-05-11 17:46:17 +02:00
|
|
|
})
|
2021-05-25 12:55:30 +02:00
|
|
|
})
|
2021-05-11 17:46:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
handleSelectChange(e){
|
|
|
|
this.setState({id:e.value, name:e.label})
|
|
|
|
}
|
|
|
|
|
2021-04-30 13:56:53 +02:00
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<ScoNavBar/>
|
2021-05-18 17:21:19 +02:00
|
|
|
<div className="container">
|
|
|
|
<div className="row justify-content-center">
|
|
|
|
{/* Selection de l'étudiant pour les sous-composants */}
|
|
|
|
<div className="col-sm" id="wrapDept">
|
|
|
|
Choix de l'étudiant
|
2021-05-31 14:19:43 +02:00
|
|
|
<Select className="mySelect" options={this.state.selectOptions} onChange={this.handleSelectChange.bind(this)}
|
|
|
|
value={this.state.selectOptions.find(option => option.value === this.state.defaultsel)} />
|
2021-05-18 17:21:19 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-05-11 17:46:17 +02:00
|
|
|
</div>
|
2021-05-03 12:09:31 +02:00
|
|
|
<div>
|
2021-05-31 14:19:43 +02:00
|
|
|
<Tabs defaultActiveKey={this.state.defaulttab} id="controlled-tab-example">
|
2021-05-18 17:21:19 +02:00
|
|
|
<Tab eventKey="Accueil" title="Accueil" >
|
2021-05-10 17:27:18 +02:00
|
|
|
<Accueil />
|
2021-04-30 13:56:53 +02:00
|
|
|
</Tab>
|
|
|
|
<Tab eventKey="Absences" title="Absences">
|
2021-05-11 17:46:17 +02:00
|
|
|
<Absences id={this.state.id} name={this.state.name}/>
|
2021-04-30 13:56:53 +02:00
|
|
|
</Tab>
|
2021-05-31 14:19:43 +02:00
|
|
|
<Tab eventKey="Bulletin" title="Bulletin">
|
2021-05-11 17:46:17 +02:00
|
|
|
<Bulletin id={this.state.id} name={this.state.name}/>
|
2021-05-07 13:53:36 +02:00
|
|
|
</Tab>
|
2021-05-25 12:55:30 +02:00
|
|
|
<Tab eventKey="Etud" title="Etudiants">
|
2021-05-31 14:19:43 +02:00
|
|
|
<Etudiants students={this.state.students}/>
|
2021-04-30 13:56:53 +02:00
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default GestionSemestre
|