import React, {Component} from "react"; import '../Style.css' import Select from 'react-select' class Absences extends Component { constructor(props){ super(props) this.state = { selectOptions: [], id: "", name: '', abs: [] } } 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}, () => {this.getData()}) } getData() { let dept = window.location.href.split('/')[6] let BASE_URL = window.$api_url if (this.state.id !== "") { fetch(BASE_URL + dept + "/Scolarite/Absences/ListeAbsEtud?format=json&etudid=" + this.state.id, { method: 'GET', verify: false, credentials: 'include', }) .then(response => response.json().then(data => ({ data: data, }) ).then(res => { this.setState({abs: res.data}) }) ); } } render() { return (

Gestion des absences