diff --git a/package-lock.json b/package-lock.json index c648433..c351407 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13305,6 +13305,14 @@ } } }, + "react-device-detect": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/react-device-detect/-/react-device-detect-1.17.0.tgz", + "integrity": "sha512-bBblIStwpHmoS281JFIVqeimcN3LhpoP5YKDWzxQdBIUP8S2xPvHDgizLDhUq2ScguLfVPmwfF5y268EEQR60w==", + "requires": { + "ua-parser-js": "^0.7.24" + } + }, "react-dom": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz", @@ -15844,6 +15852,11 @@ "is-typedarray": "^1.0.0" } }, + "ua-parser-js": { + "version": "0.7.28", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.28.tgz", + "integrity": "sha512-6Gurc1n//gjp9eQNXjD9O3M/sMwVtN5S8Lv9bvOYBfKfDNiIIhqiyi01vMBO45u4zkDE420w/e0se7Vs+sIg+g==" + }, "unbox-primitive": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", diff --git a/package.json b/package.json index 49b3f20..56b3b61 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "js-cookies": "^1.0.4", "react": "^17.0.2", "react-bootstrap": "^1.5.2", + "react-device-detect": "^1.17.0", "react-dom": "^17.0.2", "react-router-dom": "^5.2.0", "react-scripts": "4.0.3", diff --git a/src/ScoDoc/ChoixDept.js b/src/ScoDoc/ChoixDept.js index 1769f07..2c6ef30 100644 --- a/src/ScoDoc/ChoixDept.js +++ b/src/ScoDoc/ChoixDept.js @@ -1,7 +1,6 @@ -import {Link} from "react-router-dom"; import React, {Component} from "react"; +import {Link} from "react-router-dom"; import './Style.css' -import SearchStudent from "./SearchStudent"; class ChoixDept extends Component { constructor(props) { @@ -31,7 +30,7 @@ class ChoixDept extends Component { render() { return (
-

Choix du département

+

Choix du département

{this.state.depts.map((dept, index) => { return (
diff --git a/src/ScoDoc/Etudiant.js b/src/ScoDoc/Etudiant.js index d34aeba..c1a2527 100644 --- a/src/ScoDoc/Etudiant.js +++ b/src/ScoDoc/Etudiant.js @@ -77,10 +77,10 @@ class Etudiant extends Component { this.state.etud.email !== "" || this.state.etud.emailperso !== "" ?

Contact

- {this.state.etud.telephone !== "" && "Téléphone: " + this.state.etud.telephone}
- {this.state.etud.telephonemobile !== "" && "Mobile: " + this.state.etud.telephonemobile}
- {this.state.etud.email !== "" && "Mail étudiant: " + this.state.etud.email}
- {this.state.etud.emailperso !== "" && "Mail perso: " + this.state.etud.emailperso}
+ {this.state.etud.telephone !== "" && Téléphone: {this.state.etud.telephone}}
+ {this.state.etud.telephonemobile !== "" && Mobile: {this.state.etud.telephonemobile}}
+ {this.state.etud.email !== "" && Mail étudiant: {this.state.etud.email}}
+ {this.state.etud.emailperso !== "" && Mail personnel: {this.state.etud.emailperso}}
:
Aucun contact disponible
diff --git a/src/ScoDoc/GestionSemestre.js b/src/ScoDoc/GestionSemestre.js index a4348f3..6dcf3b2 100644 --- a/src/ScoDoc/GestionSemestre.js +++ b/src/ScoDoc/GestionSemestre.js @@ -5,22 +5,63 @@ 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 (
+
+ Choix de l'étudiant + + {this.props.name !== "" &&
- {this.state.name !== "" &&

Absences de {this.state.name}

} - {(this.state.abs.length === 0 && this.state.name !== "") && -
Aucune absence de l'élève
+

Absences de {this.props.name}

+ {(this.state.abs.length === 0 && this.props.name !== "") && +
Aucune absence de l'élève
} {this.state.abs.map((abs, index) => { return (
{abs.datedmy} | {abs.matin}
{abs.motif !== "" && - Motif: {abs.motif } + Motif: {abs.motif} } {abs.exams !== "" && - Exam a rattraper: {abs.exams} - } + Exam a rattraper: {abs.exams} + }
) })}
+ }
) } diff --git a/src/ScoDoc/GestionSemestre/Bulletin.js b/src/ScoDoc/GestionSemestre/Bulletin.js index 8eee8c7..a5622be 100644 --- a/src/ScoDoc/GestionSemestre/Bulletin.js +++ b/src/ScoDoc/GestionSemestre/Bulletin.js @@ -1,15 +1,12 @@ import React, {Component} from "react"; import Select from "react-select"; -import {Table} from "react-bootstrap" +import {Table, Button, Dropdown} from "react-bootstrap" import '../Style.css' class Bulletin extends Component { constructor(props) { super(props); this.state = { - selectOptions: [], - id: "", - name: '', bltn: {}, datue: {}, loaded: false @@ -18,29 +15,6 @@ class Bulletin extends Component { 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 = {} @@ -60,7 +34,7 @@ class Bulletin extends Component { 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', { + sem +'&etudid=' + this.props.id +'&format=json', { method: 'GET', verify: false, credentials: 'include', @@ -85,40 +59,62 @@ class Bulletin extends Component { ); } - handleSelectChange(e){ - this.setState({id:e.value, name:e.label}, () => {this.getData()}) + getPdf() { + let BASE_URL = window.$api_url + let dept = window.location.href.split('/')[6] + let sem = window.location.href.split('/')[8] + fetch( BASE_URL + dept + "/Scolarite/Notes/formsemestre_bulletinetud?" + + "formsemestre_id=" + sem + "&etudid=" + this.props.id + "&format=pdf&version=selectedevals", { + method: 'GET', + verify: false, + credentials: 'include', + }) + .then( res => res.blob() ) + .then( blob => { + let file = window.URL.createObjectURL(blob); + window.location.assign(file); + }); + } + + componentDidUpdate(prevProps) { + if (prevProps.id !== this.props.id) { + this.getData(); + } + } + + componentDidMount() { + if (this.props.id !== "") {this.getData()} } render() { return (
-

Bulletins de notes

-