package GUI;

import DB.MdbInterface;
import Information.Student;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class Main extends Application {

    private Scene scene;
    private HBox horizontalLayout;
    private SignInBox signInBox;
    private SignOutBox signOutBox;
    private static MdbInterface mdb;
    Student student;

    @Override
    public void start(Stage primaryStage) throws Exception {

        primaryStage.setTitle("Hunter CS Tutoring Center");
        primaryStage.setMinWidth(600);
        primaryStage.setMinHeight(400);

        signInBox = new SignInBox();
        signInBox.setPadding(new Insets(50));
        signInBox.setStyle("-fx-border-style: hidden solid hidden hidden");
        signInBox.getSignInButton().setOnAction(event -> handleEmpl());

        signOutBox = new SignOutBox();
        signOutBox.setPadding(new Insets(50));

        horizontalLayout = new HBox();
        horizontalLayout.setAlignment(Pos.CENTER);
        horizontalLayout.getChildren().addAll(signInBox, signOutBox);
        HBox.setMargin(signInBox, new Insets(20, 0, 20, 0));
        HBox.setMargin(signOutBox, new Insets(20, 0, 20, 0));

        scene = new Scene(horizontalLayout);
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        mdb = new MdbInterface();
        launch(args);
    }

    public static MdbInterface getMdb() {
        return mdb;
    }

    private int getEmpl() {
        return Integer.parseInt(signInBox.getTextField().getText());
    }

    private void handleEmpl() {
        int emplId = getEmpl();
        if (mdb.studentExists(emplId)) {
            student = mdb.getStudentByEmplId(emplId);
            signOutBox.addActiveStudent(student.getFirstName() + " " + student.getLastName());
        } else {
            try {
                new RegistrationWindow();
                student = mdb.getStudentByEmplId(emplId);
                signOutBox.addActiveStudent(student.getFirstName() + " " + student.getLastName());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}

@@ -1035,24 +1035,132 @@
 Insets(50));
+%0A        signOutBox.getSignOutButton().setOnAction(event -%3E handleSignOut(signOutBox.getSelectedStudent()));
 %0A%0A        ho
@@ -2036,60 +2036,70 @@
 ent(
-student.getFirstName() + %22 %22 + student.getLastName()
+mdb.getStudentByEmplId(emplId));%0A            mdb.signIn(emplId
 );%0A 
@@ -2280,60 +2280,74 @@
 ent(
-student.getFirstName() + %22 %22 + student.getLastName()
+mdb.getStudentByEmplId(emplId));%0A                mdb.signIn(emplId
 );%0A 
@@ -2447,11 +2447,154 @@
  %7D%0A    %7D
+%0A%0A    private void handleSignOut(Student student) %7B%0A        new SignOutReviewWindow(student);%0A        signOutBox.signOutStudent(student);%0A    %7D
 %0A%7D%0A

Add SignIn and SignOut Functionality