diff --git a/README.md b/README.md
index 0bf0b24..1be57c6 100644
--- a/README.md
+++ b/README.md
@@ -42,4 +42,7 @@ Pour éviter des erreurs 404 liées à l'arborescence React:
Pages de login et choix du département
### /Scolarité
-Choix de la formation et barre de recherche d'élèves
\ No newline at end of file
+Choix de la formation et barre de recherche d'élèves
+
+### /Scolarité/GestionSem
+Page principale de la gestion d'un semestre
\ No newline at end of file
diff --git a/src/ScoDoc/ChoixDept.js b/src/ScoDoc/ChoixDept.js
index 834acda..dee55f5 100644
--- a/src/ScoDoc/ChoixDept.js
+++ b/src/ScoDoc/ChoixDept.js
@@ -1,6 +1,7 @@
import {Link} from "react-router-dom";
import React, {Component} from "react";
import './Style.css'
+import SearchStudent from "./SearchStudent";
class ChoixDept extends Component {
render() {
@@ -17,6 +18,10 @@ class ChoixDept extends Component {
Département Génie Civil
+
+
Recherche d'élèves
+
+
);
}
diff --git a/src/ScoDoc/GestionSemestre.js b/src/ScoDoc/GestionSemestre.js
new file mode 100644
index 0000000..c5aabe4
--- /dev/null
+++ b/src/ScoDoc/GestionSemestre.js
@@ -0,0 +1,31 @@
+import {Component} from "react";
+import {Tabs, Tab} from "react-bootstrap"
+import Acceuil from "./GestionSemestre/Acceuil";
+import Absences from "./GestionSemestre/Absences";
+import Eleves from "./GestionSemestre/Eleves";
+import ScoNavBar from "./ScoNavBar";
+
+class GestionSemestre extends Component {
+ render() {
+ return (
+
+ )
+ }
+}
+
+export default GestionSemestre
\ No newline at end of file
diff --git a/src/ScoDoc/GestionSemestre/Absences.js b/src/ScoDoc/GestionSemestre/Absences.js
new file mode 100644
index 0000000..4652abd
--- /dev/null
+++ b/src/ScoDoc/GestionSemestre/Absences.js
@@ -0,0 +1,9 @@
+import {Component} from "react";
+
+class Absences extends Component {
+ render() {
+ return (Absences
)
+ }
+}
+
+export default Absences
\ No newline at end of file
diff --git a/src/ScoDoc/GestionSemestre/Acceuil.js b/src/ScoDoc/GestionSemestre/Acceuil.js
new file mode 100644
index 0000000..a3648cb
--- /dev/null
+++ b/src/ScoDoc/GestionSemestre/Acceuil.js
@@ -0,0 +1,39 @@
+import React, {Component} from "react";
+
+class Acceuil extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ semestre: {},
+ students: [],
+ };
+ }
+
+ componentWillMount() {
+ fetch('https://scodoc.dev.net/ScoDoc/RT/Scolarite/Notes/formsemestre_list?format=json&formsemestre_id=SEM144', {
+ method: 'GET',
+ verify: false,
+ credentials: 'include',
+ })
+ .then(response =>
+ response.json().then(data => ({
+ data: data,
+ status: response.status
+ })
+ ).then(res => {
+ this.setState({ semestre: res.data[0]});
+ console.log(res.data)
+ console.log(this.state.semestre)
+ }));
+ }
+
+ render() {
+ return (
+
+
{this.state.semestre.titre}
+
+ )
+ }
+}
+
+export default Acceuil
\ No newline at end of file
diff --git a/src/ScoDoc/GestionSemestre/Eleves.js b/src/ScoDoc/GestionSemestre/Eleves.js
new file mode 100644
index 0000000..8b12a55
--- /dev/null
+++ b/src/ScoDoc/GestionSemestre/Eleves.js
@@ -0,0 +1,9 @@
+import {Component} from "react";
+
+class Eleves extends Component {
+ render() {
+ return (Eleves
)
+ }
+}
+
+export default Eleves
\ No newline at end of file
diff --git a/src/ScoDoc/Login.js b/src/ScoDoc/Login.js
index 4dbaa77..b37896e 100644
--- a/src/ScoDoc/Login.js
+++ b/src/ScoDoc/Login.js
@@ -1,5 +1,4 @@
import React, {Component} from "react";
-import {Link} from "react-router-dom";
import './Style.css'
import ChoixDept from "./ChoixDept";
diff --git a/src/ScoDoc/Scolarite.js b/src/ScoDoc/Scolarite.js
index 0ad8b43..2a5ea6b 100644
--- a/src/ScoDoc/Scolarite.js
+++ b/src/ScoDoc/Scolarite.js
@@ -1,23 +1,18 @@
import React, {Component} from "react";
-import {Link, Redirect} from "react-router-dom";
+import {Link} from "react-router-dom";
import './Style.css'
import ScoNavBar from "./ScoNavBar";
-import {Accordion, Card, Button, Toast} from 'react-bootstrap'
+import SearchStudent from './SearchStudent'
+import {Accordion, Card, Button} from 'react-bootstrap'
class Scolarite extends Component {
constructor(props) {
super(props);
this.state = {
- search: "",
- // Status possibles:
- // 0: Vide - 1: Pas de resultat - 2: Plusieurs resultats
- search_status: 0,
semestres: [],
students: [],
toast: false
};
- this.handleChangeSearch = this.handleChangeSearch.bind(this);
- this.searchStudent = this.searchStudent.bind(this);
this.dismissToast = this.dismissToast.bind(this);
this.getData = this.getData.bind(this);
}
@@ -50,41 +45,6 @@ class Scolarite extends Component {
this.setState({toast: false})
}
- handleChangeSearch(e) {
- this.setState({ search: e.target.value });
- }
-
- searchStudent(e) {
- fetch('https://scodoc.dev.net/ScoDoc/RT/Scolarite/Notes/search_etud_by_name?format=json', {
- method: "POST",
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({term: this.state.search})
- })
- .then(response =>
- response.json().then(data => ({
- data: data,
- status: response.status
- })
- ).then(res => {
- this.setState({ students: res.data });
- console.log(this.state.students)
- }));
- let result = 0
- console.log(this.state.students)
- if (result === 0) {
- this.setState({search_status: 1, toast: true});
- } else if (result === 1) {
- // Redirection sur la page de l'étudiant
- return
- } else {
- this.setState({search_status: 2});
- // Liste des élèves trouvés avec liens
- }
- }
-
render() {
return (
@@ -102,14 +62,18 @@ class Scolarite extends Component {
- {this.state.semestres.map((sem, index) => (
-
-
+ {this.state.semestres.map((sem, index) => {
+ return (
+
+ {sem.etat !== 0 ?
+
{sem.titre} [{sem.modalite}]
Semestre {sem.semestre_id} - Année {sem.anneescolaire} [{sem.date_debut} - {sem.date_fin}]
-
-
- ))}
+
+ : null}
+
+ )
+ })}
@@ -121,19 +85,7 @@ class Scolarite extends Component {
-
- {this.state.toast === true &&
-
- Aucun élève trouvé
-
- }
+
@@ -147,7 +99,7 @@ class Scolarite extends Component {
- )
+ );
}
}
diff --git a/src/ScoDoc/SearchStudent.js b/src/ScoDoc/SearchStudent.js
index e69de29..b212931 100644
--- a/src/ScoDoc/SearchStudent.js
+++ b/src/ScoDoc/SearchStudent.js
@@ -0,0 +1,84 @@
+import React, {Component} from "react";
+import {Redirect} from "react-router-dom";
+import {Row, Col} from "react-bootstrap"
+
+class SearchStudent extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ students: [],
+ // Status possibles:
+ // 0: Vide - 1: Pas de resultat - 2: Plusieurs resultats
+ search_status: 0,
+ };
+ this.handleChangeSearch = this.handleChangeSearch.bind(this)
+ this.searchStudent = this.searchStudent.bind(this);
+ }
+
+ handleChangeSearch(e) {
+ this.setState({ search: e.target.value });
+ }
+
+ searchStudent() {
+ fetch('https://scodoc.dev.net/ScoDoc/RT/Scolarite/Notes/search_etud_by_name?term=' + this.state.search +'&format=json', {
+ method: "GET",
+ credentials: "include",
+ })
+ .then(response =>
+ response.json().then(data => ({data: data,})
+ ).then(res => {
+ this.setState({ students: res.data });
+ console.log(this.state.students)
+ }))
+ .then(res => {
+ if (this.state.students.length === 0) {
+ this.setState({search_status: 1, toast: true});
+ } else if (this.state.students.length === 1) {
+ return
+ } else {
+ this.setState({search_status: 2, toast: false});
+ }
+ })
+ this.setState({searched: true})
+ }
+
+ result() {
+ console.log(this.state.students)
+
+ if (this.state.toast === true) {
+ return (
+
+ Aucun élève trouvé
+
+ )
+ } else if (this.state.search_status === 2) {
+ return (
+
+
+ {this.state.students.map((student, index) => {
+ return ({student.label}
);
+ })}
+
+
+ )
+ }
+ }
+
+ render() {
+ return (
+
+ )
+ }
+}
+
+export default SearchStudent
\ No newline at end of file
diff --git a/src/main.js b/src/main.js
index 90ae9df..3513e74 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,8 +1,8 @@
import React from 'react';
import {Switch, Route} from 'react-router-dom';
import Scolarite from './ScoDoc/Scolarite.js'
-import ChoixDept from './ScoDoc/ChoixDept.js'
import Login from './ScoDoc/Login'
+import GestionSemestre from "./ScoDoc/GestionSemestre";
const Main = () => {
@@ -10,6 +10,7 @@ const Main = () => {
+
);
}