This commit is contained in:
pro.boooooo
2022-12-07 20:47:08 +01:00
parent 276fc19076
commit 51407d32cc
11 changed files with 167 additions and 10 deletions

View File

@@ -32,6 +32,7 @@ public class Controller implements ActionListener, ListSelectionListener {
private ArrayList<Etudiant> e;
private ArrayList<Groupe> g;
private ArrayList<Requete> r;
private JTable currentJTableUse;
private JComboBox<String> list;
@@ -51,9 +52,10 @@ public class Controller implements ActionListener, ListSelectionListener {
this.db = db;
this.e = this.db.getEtuList();
this.g = this.db.getGroupeList();
this.r = this.db.getRequestList();
this.sv = new StudentView(this.e, this.g, this);
this.pv = new ProfView(this.e, this.g, this);
this.av = new AdminView(this.e, this.g, this);
this.av = new AdminView(this);
this.parent = new MainMenu(this);
}
@@ -61,9 +63,10 @@ public class Controller implements ActionListener, ListSelectionListener {
this.db = db;
this.e = this.db.getEtuList();
this.g = this.db.getGroupeList();
this.r = this.db.getRequestList();
this.sv = new StudentView(this.e, this.g, this);
this.pv = new ProfView(this.e, this.g, this);
this.av = new AdminView(this.e, this.g, this);
this.av = new AdminView(this);
this.parent = new MainMenu(this, selectedView);
}
@@ -618,6 +621,32 @@ public class Controller implements ActionListener, ListSelectionListener {
DisplayWithListner(this.createJTable(data, titre));
}
else if(Objects.equals(command, "av::ShowRequestFromStudent")) {
Object[][] data = new Object[this.r.size()][5];
String[] titre = {
"Etudiant",
"Groupe demande",
"Message",
"Type",
"Action"
};
for(int i = 0; i <= this.r.size()-1; i++) {
Object[] info = {
this.getEtuNameById(this.r.get(i).getEtuId()),
this.getGroupeById(this.r.get(i).getWitchGroupe()),
this.r.get(i).getMessage(),
this.r.get(i).getType(),
"[DECISION]"
};
data[i] = info;
}
DisplayWithListner(this.createJTable(data, titre));
}
}
@Override
@@ -652,6 +681,13 @@ public class Controller implements ActionListener, ListSelectionListener {
}
}
public String getEtuNameById(int id) {
String nom = this.db.fetchAll("SELECT nom FROM fi_eleves WHERE id = " + id).get(0);
String prenom = this.db.fetchAll("SELECT prenom FROM fi_eleves WHERE id = " + id).get(0);
return nom + " " + prenom;
}
private void deleteGrup(TableModel tm, int[] cell) {
int choice = JOptionPane.showConfirmDialog(this.parent, "Etes-vous sur ?");
@@ -805,7 +841,7 @@ public class Controller implements ActionListener, ListSelectionListener {
this.g = this.db.getGroupeList();
this.parent.updateTable(this.initTable());
}
public JTable initTable() {
Object[][] data = new Object[this.e.size()][3];
String[] title = {