import React, {Component} from "react"; import Select from "react-select"; import {Table} from "react-bootstrap" import '../Style.css' class Bulletin extends Component { constructor(props) { super(props); this.state = { selectOptions: [], id: "", name: '', bltn: {}, datue: {}, loaded: false }; this.getData = this.getData.bind(this); this.getJsonData = this.getJsonData.bind(this); } 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}) }) }) ); } getJsonData () { this.setState({bltn: require('..\\..\\json\\bltn.json')}, () => { let ls = {} for (let elm in this.state.bltn.decision_ue) { elm = this.state.bltn.decision_ue[elm] ls[elm.acronyme] = elm.titre } this.setState({datue: ls}, () => { this.setState({loaded: true}) }) }) } getData() { 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/formsemestre_bulletinetud?formsemestre_id=' + sem +'&etudid=' + this.state.id +'&format=json', { method: 'GET', verify: false, credentials: 'include', }) .then(response => response.json().then(data => ({ data: data, status: response.status }) ).then(res => { this.setState({ bltn: res.data }, () => { let ls = {} for (let elm in this.state.bltn.decision_ue) { elm = this.state.bltn.decision_ue[elm] ls[elm.acronyme] = elm.titre } this.setState({datue: ls}, () => { this.setState({loaded: true}) }) }) }) ); } handleSelectChange(e){ this.setState({id:e.value, name:e.label}, () => {this.getData()}) } render() { return (

Bulletins de notes