package AbsentieLijst.userInterfaceLaag;_x000D_
_x000D_
import AbsentieLijst.*;_x000D_
import javafx.collections.FXCollections;_x000D_
import javafx.collections.ObservableList;_x000D_
import javafx.event.ActionEvent;_x000D_
import javafx.fxml.FXMLLoader;_x000D_
import javafx.scene.Parent;_x000D_
import javafx.scene.Scene;_x000D_
import javafx.scene.control.Button;_x000D_
import javafx.scene.control.ComboBox;_x000D_
import javafx.scene.control.DatePicker;_x000D_
import javafx.scene.control.Label;_x000D_
import javafx.scene.image.Image;_x000D_
import javafx.stage.Modality;_x000D_
import javafx.stage.Stage;_x000D_
_x000D_
import java.sql.Time;_x000D_
import java.time.LocalDate;_x000D_
import java.util.ArrayList;_x000D_
import java.util.HashMap;_x000D_
_x000D_
public class ToekomstigAfmeldenController {_x000D_
    public Button ButtonOpslaan;_x000D_
    public Button ButtonAnnuleren;_x000D_
    public DatePicker DatePickerDate;_x000D_
    public ComboBox ComboBoxReden;_x000D_
    public static ArrayList<Afspraak> afGmeld = new ArrayList<>();_x000D_
    public Button overzicht;_x000D_
    public Label label;_x000D_
    public ComboBox tijd;_x000D_
_x000D_
    School HU = School.getSchool();_x000D_
    ObservableList<String> options =_x000D_
            FXCollections.observableArrayList(_x000D_
                    "Bruiloft",_x000D_
                    "Tandarts afspraak",_x000D_
                    "Begravenis", "Wegens corona.", "Overig"_x000D_
            );_x000D_
_x000D_
_x000D_
    public void initialize() {_x000D_
        ComboBoxReden.setItems(options);_x000D_
_x000D_
    }_x000D_
_x000D_
_x000D_
    public void ActionOpslaan(ActionEvent actionEvent) {_x000D_
        if (DatePickerDate.getValue() != null && ComboBoxReden != null) {_x000D_
            LocalDate datum = DatePickerDate.getValue();_x000D_
            Object time = tijd.getValue();_x000D_
            try {_x000D_
                for (Klas klas : HU.getKlassen()) {_x000D_
                    for (Student student : klas.getStudenten()) {_x000D_
                        if (student.getisIngelogd()) {_x000D_
                            HashMap<String, Les> alleLessen = klas.getLessen();_x000D_
                            for (String lesNaam : alleLessen.keySet()) {_x000D_
                                if (alleLessen.get(lesNaam).getDatum().equals(datum)) {_x000D_
                                    alleLessen.get(lesNaam).setAbsent(student, " met reden:"+" "+(String) ComboBoxReden.getValue()); //afgemeld_lijst in de les_x000D_
                                    student.setAfgemeld("Vooraf afgemeld: " + alleLessen.get(lesNaam).getDatum() + " " + alleLessen.get(lesNaam).getLescode() + " met als reden: " + ComboBoxReden.getValue()); //afgemeld overzicht student._x000D_
                                    Button source = (Button) actionEvent.getSource();_x000D_
                                    Stage stage = (Stage) source.getScene().getWindow();_x000D_
                                    stage.close();_x000D_
                                }_x000D_
                            }_x000D_
                        }_x000D_
                    }_x000D_
                }_x000D_
            } catch (Exception e) {_x000D_
                label.setText("ddddd");_x000D_
            }_x000D_
        } else label.setText("Je moet Datum en reden kiezen");_x000D_
    }_x000D_
_x000D_
    public void ActionAnnuleren(ActionEvent actionEvent) {_x000D_
        Button source = (Button) actionEvent.getSource();_x000D_
        Stage stage = (Stage) source.getScene().getWindow();_x000D_
        stage.close();_x000D_
    }_x000D_
_x000D_
    public void DatapickerOnAction(ActionEvent actionEvent) {_x000D_
        ObservableList<String> lessen = FXCollections.observableArrayList();_x000D_
        for (Klas klas : HU.getKlassen()) {_x000D_
            for (Student student : klas.getStudenten()) {_x000D_
                if (student.getisIngelogd()) {_x000D_
                    ArrayList<String> les = new ArrayList<>();_x000D_
_x000D_
                    HashMap<String, Les> alleLessen = klas.getLessen();_x000D_
                    for (Les lesNaam : alleLessen.values())_x000D_
                        if (lesNaam.getDatum().equals(DatePickerDate.getValue())) {_x000D_
//                            for (String les1 : alleLessen.keySet()) {_x000D_
                            les.add(lesNaam.getNaam());_x000D_
                            lessen.addAll(les);_x000D_
                            tijd.setItems(lessen);_x000D_
                        }_x000D_
_x000D_
                }_x000D_
            }_x000D_
        }_x000D_
    }_x000D_
}_x000D_

//afgemeld_lijst in de les_x000D_
package AbsentieLijst.userInterfaceLaag;_x000D_
_x000D_
import AbsentieLijst.*;_x000D_
import javafx.collections.FXCollections;_x000D_
import javafx.collections.ObservableList;_x000D_
import javafx.event.ActionEvent;_x000D_
import javafx.fxml.FXMLLoader;_x000D_
import javafx.scene.Parent;_x000D_
import javafx.scene.Scene;_x000D_
import javafx.scene.control.Button;_x000D_
import javafx.scene.control.ComboBox;_x000D_
import javafx.scene.control.DatePicker;_x000D_
import javafx.scene.control.Label;_x000D_
import javafx.scene.image.Image;_x000D_
import javafx.stage.Modality;_x000D_
import javafx.stage.Stage;_x000D_
_x000D_
import java.sql.Time;_x000D_
import java.time.LocalDate;_x000D_
import java.util.ArrayList;_x000D_
import java.util.HashMap;_x000D_
_x000D_
public class ToekomstigAfmeldenController {_x000D_
    public Button ButtonOpslaan;_x000D_
    public Button ButtonAnnuleren;_x000D_
    public DatePicker DatePickerDate;_x000D_
    public ComboBox ComboBoxReden;_x000D_
    public static ArrayList<Afspraak> afGmeld = new ArrayList<>();_x000D_
    public Button overzicht;_x000D_
    public Label label;_x000D_
    public ComboBox tijd;_x000D_
_x000D_
    School HU = School.getSchool();_x000D_
    ObservableList<String> options =_x000D_
            FXCollections.observableArrayList(_x000D_
                    "Bruiloft",_x000D_
                    "Tandarts afspraak",_x000D_
                    "Begravenis", "Wegens corona.", "Overig"_x000D_
            );_x000D_
_x000D_
_x000D_
    public void initialize() {_x000D_
        ComboBoxReden.setItems(options);_x000D_
_x000D_
    }_x000D_
_x000D_
_x000D_
    public void ActionOpslaan(ActionEvent actionEvent) {_x000D_
        if (DatePickerDate.getValue() != null && ComboBoxReden != null) {_x000D_
            LocalDate datum = DatePickerDate.getValue();_x000D_
            Object time = tijd.getValue();_x000D_
            try {_x000D_
                for (Klas klas : HU.getKlassen()) {_x000D_
                    for (Student student : klas.getStudenten()) {_x000D_
                        if (student.getisIngelogd()) {_x000D_
                            HashMap<String, Les> alleLessen = klas.getLessen();_x000D_
                            for (String lesNaam : alleLessen.keySet()) {_x000D_
                                if (alleLessen.get(lesNaam).getDatum().equals(datum)) {_x000D_
                                    alleLessen.get(lesNaam).setAbsent(student, " met reden:"+" "+(String) ComboBoxReden.getValue()); //afgemeld_lijst in<SUF>
                                    student.setAfgemeld("Vooraf afgemeld: " + alleLessen.get(lesNaam).getDatum() + " " + alleLessen.get(lesNaam).getLescode() + " met als reden: " + ComboBoxReden.getValue()); //afgemeld overzicht student._x000D_
                                    Button source = (Button) actionEvent.getSource();_x000D_
                                    Stage stage = (Stage) source.getScene().getWindow();_x000D_
                                    stage.close();_x000D_
                                }_x000D_
                            }_x000D_
                        }_x000D_
                    }_x000D_
                }_x000D_
            } catch (Exception e) {_x000D_
                label.setText("ddddd");_x000D_
            }_x000D_
        } else label.setText("Je moet Datum en reden kiezen");_x000D_
    }_x000D_
_x000D_
    public void ActionAnnuleren(ActionEvent actionEvent) {_x000D_
        Button source = (Button) actionEvent.getSource();_x000D_
        Stage stage = (Stage) source.getScene().getWindow();_x000D_
        stage.close();_x000D_
    }_x000D_
_x000D_
    public void DatapickerOnAction(ActionEvent actionEvent) {_x000D_
        ObservableList<String> lessen = FXCollections.observableArrayList();_x000D_
        for (Klas klas : HU.getKlassen()) {_x000D_
            for (Student student : klas.getStudenten()) {_x000D_
                if (student.getisIngelogd()) {_x000D_
                    ArrayList<String> les = new ArrayList<>();_x000D_
_x000D_
                    HashMap<String, Les> alleLessen = klas.getLessen();_x000D_
                    for (Les lesNaam : alleLessen.values())_x000D_
                        if (lesNaam.getDatum().equals(DatePickerDate.getValue())) {_x000D_
//                            for (String les1 : alleLessen.keySet()) {_x000D_
                            les.add(lesNaam.getNaam());_x000D_
                            lessen.addAll(les);_x000D_
                            tijd.setItems(lessen);_x000D_
                        }_x000D_
_x000D_
                }_x000D_
            }_x000D_
        }_x000D_
    }_x000D_
}_x000D_
