134 lines
6.0 KiB
JavaScript
134 lines
6.0 KiB
JavaScript
import React, {Component} from "react";
|
|
import './Style.css'
|
|
import ScoNavBar from "./ScoNavBar";
|
|
import {Link} from "react-router-dom";
|
|
import {Button} from "react-bootstrap";
|
|
|
|
class Etudiant extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
etud: {},
|
|
semestres: [],
|
|
formation: [],
|
|
loaded: false
|
|
};
|
|
}
|
|
|
|
componentWillMount() {
|
|
let dept = window.location.href.split('/')[3]
|
|
let etudid = window.location.href.split('/')[6]
|
|
let BASE_URL = window.$api_url
|
|
fetch(BASE_URL + dept + '/Scolarite/Notes/etud_info?format=json&etudid=' + etudid, {
|
|
method: 'GET',
|
|
verify: false,
|
|
credentials: 'include',
|
|
})
|
|
.then(response =>
|
|
response.json().then(data => ({
|
|
data: data,
|
|
status: response.status
|
|
})
|
|
).then(res => {
|
|
// Utilisation de '???' en cas de données vides pour le moment}
|
|
for (let propName in res.data) {
|
|
if (res.data[propName] === null || res.data[propName] === undefined || res.data[propName] === "") {
|
|
res.data[propName] = "???";
|
|
}
|
|
}
|
|
this.setState({ etud: res.data })
|
|
this.setState({ formation: res.data.insemestre })
|
|
|
|
res.data.insemestre.map((sem, index) => {
|
|
fetch(BASE_URL + dept + '/Scolarite/Notes/formsemestre_list?format=json&formsemestre_id=' + sem.formsemestre_id, {
|
|
method: 'GET',
|
|
verify: false,
|
|
credentials: 'include',
|
|
})
|
|
.then(response =>
|
|
response.json().then(data => ({
|
|
data: data,
|
|
status: response.status
|
|
}))
|
|
).then(res => {
|
|
var joined = this.state.semestres.concat(res.data[0]);
|
|
this.setState({ semestres: joined, loaded: true })
|
|
})
|
|
})
|
|
})
|
|
);
|
|
}
|
|
|
|
render() {
|
|
return(
|
|
<div>
|
|
<ScoNavBar/>
|
|
<div className="wrapper">
|
|
<div id="wrapDept">
|
|
<h1>{this.state.etud.nomprenom}</h1>
|
|
<img
|
|
alt={`${this.state.etud.nomprenom}`}
|
|
src={`https://scodoc.dev.net/ScoDoc/RT/Scolarite/Notes/${this.state.etud.photo_url}`}
|
|
width="102"
|
|
height="128"
|
|
className="d-inline-block align-top"
|
|
/>{' '}
|
|
<div id="wrapDept" className="col-sm">
|
|
<h3>Informations personnelles</h3>
|
|
<div className="col-sm">
|
|
<h4>Contact</h4>
|
|
Téléphone: {this.state.etud.telephone}<br/>
|
|
Mobile: {this.state.etud.telephonemobile}<br/>
|
|
Mail étudiant: {this.state.etud.email}<br/>
|
|
Mail perso: {this.state.etud.emailperso}<br/>
|
|
</div>
|
|
<div className="col-sm">
|
|
<h4>Lieu de résidence</h4>
|
|
Domicile: {this.state.etud.domicile} -
|
|
{" " + this.state.etud.codepostaldomicile} {this.state.etud.villedomicile}<br/>
|
|
</div>
|
|
</div>
|
|
<div id="wrapDept" className="col-sm">
|
|
<div className="col-sm">
|
|
<h4>Parcours</h4>
|
|
Bac {this.state.etud.bac} (Spécialité {this.state.etud.specialite}) -
|
|
{" " + this.state.etud.nomlycee} ({this.state.etud.codepostallycee} {this.state.etud.villelycee})<br/>
|
|
</div>
|
|
{this.state.loaded === true &&
|
|
<div className="col-sm">
|
|
<h4>Formation actuelle</h4>
|
|
{this.state.semestres.map((sem, index) => {
|
|
return (
|
|
<div>
|
|
<b>{sem.titreannee}</b><br/>
|
|
{sem.date_debut} - {sem.date_fin}
|
|
</div>
|
|
)
|
|
})}
|
|
</div>
|
|
}
|
|
</div>
|
|
{/* TODO: Lien vers la gestion des absences
|
|
<div id="wrapDept" className="col-sm">
|
|
<Link to="">
|
|
<div className="col-sm">
|
|
Gestion des absences
|
|
</div>
|
|
</Link>
|
|
</div>
|
|
*/}
|
|
</div>
|
|
</div>
|
|
<footer className="fixed-bottom">
|
|
<div style={{background: "#cccccc", padding: "5px"}}>
|
|
<Link to={`/${window.location.href.split('/')[3]}/Scolarite`}>
|
|
<Button type="button" className="btn waves-effect waves-light btn-primary">Retour au choix de semestre</Button>
|
|
</Link>
|
|
</div>
|
|
</footer>
|
|
</div>
|
|
)
|
|
}
|
|
}
|
|
|
|
export default Etudiant |