Skip to content
Snippets Groups Projects
EmployeeDetailsPopUp.java 1.87 KiB
package com.example.schedulerapp;

import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Popup;

public class EmployeeDetailsPopUp extends Popup {

    public EmployeeDetailsPopUp(Employee e){

        this.setHeight(300);
        this.setWidth(300);

        VBox details = new VBox();
        details.setStyle("-fx-background-color: papayawhip; -fx-border-color: black");
        details.setPadding(new Insets(20));
        details.setSpacing(20);

        Label name = new Label(e.getFullName());
        Label id = new Label("ID: " + e.getEmployeeID());

        String positions = "";
        if (e.isManager()) positions += "Manager, ";
        for (String s : e.getPositions()){
            positions += s + ", ";
        }
        if (positions.length() == 0) {
            positions = "none";
        }
        else{
            positions = positions.substring(0, positions.length()-2);
        }
        Label position = new Label(positions);

        Label wage = new Label("Wage: " + e.getWage());
        Label contact = new Label(e.getPhoneNumber() + "\t" + e.getEmail());


        HBox buttons = new HBox();
        Button schedule = new Button("Schedule");
        //schedule.setOnAction();
        Button availability = new Button("Availability");
        //availability.setOnAction();
        Button edit = new Button("Edit Details");
        //edit.setOnAction();

        buttons.getChildren().addAll(schedule, availability, edit);
        buttons.setSpacing(20);
        for (Node button : buttons.getChildren()){
            ((Button) button).setMaxWidth(200);
        }

        details.getChildren().addAll(name, id, position, wage, contact, buttons);

        this.getContent().add(details);
        this.setAutoHide(true);
    }
}