Skip to content
Snippets Groups Projects
Commit f0a74971 authored by Michael Kish (mik586)'s avatar Michael Kish (mik586)
Browse files

Revert "Merge branch 'revert-e16e6ba2' into 'main'"

This reverts merge request !8
parent 07a2d0e1
No related branches found
No related tags found
1 merge request!9Revert "Merge branch 'revert-e16e6ba2' into 'main'"
......@@ -111,6 +111,12 @@ public class Controller {
TextField timeOffReason;
@FXML
Label timeOffResponse;
@FXML
TextField addEmployeeEmail;
@FXML
TextField addEmployeePhoneNumber;
@FXML
CheckBox addEmployeeManager;
boolean isDaily;
......@@ -573,10 +579,32 @@ public class Controller {
public void addEmployeeClicked(MouseEvent mouseEvent) {
String firstName = addFirstName.getText();
String lastName = addLastName.getText();
model.addEmployee(firstName, lastName);
System.out.println("Employee " + firstName + " " + lastName + " added to Staff. Welcome "
+ firstName + "!");
model.notifySubscribers();
String addEmail = addEmployeeEmail.getText();
String addPhoneNumber = addEmployeePhoneNumber.getText();
boolean addManager = addEmployeeManager.isSelected();
if(firstName.isBlank() || firstName.isEmpty()){
showErrorMessage("First name is blank. Please try again.");
}
else if(lastName.isEmpty() || lastName.isBlank()){
showErrorMessage("Last name is blank. Please try again.");
}
else if(addEmail.isBlank() || addEmail.isBlank()){
showErrorMessage("Email is blank. Please try again.");
}
else if(addPhoneNumber.isBlank() || addPhoneNumber.isEmpty()){
showErrorMessage("Phone number is blank. Please try again");
}
else if(addPhoneNumber.contains(".") || addPhoneNumber.contains("-") || addPhoneNumber.contains(",") || addPhoneNumber.contains("/")){
showErrorMessage("Phone number has illegal character. Please try again");
}
else{
model.addEmployee(firstName, lastName);
//int id = model.addEmployee(firstName, lastName);
//model.editEmployee(id,firstName,lastName,addManager,addEmail,addPhoneNumber,0.0f);
model.notifySubscribers();
}
}
public void editEmployeeClicked(MouseEvent mouseEvent) {
......@@ -777,10 +805,12 @@ public class Controller {
VBox tempVBox = new VBox();
tempVBox.setSpacing(20);
tempVBox.setPadding(new Insets(30));
TextField tempPositionText = new TextField("Enter Position Here");
TextField tempWageText = new TextField("Enter Wage Here");
Label positionLabel = new Label("Enter Position: ");
TextField tempPositionText = new TextField();
Label wageLabel = new Label("Enter Wage: ");
TextField tempWageText = new TextField();
Button addPositionSubmit = new Button("Submit");
tempVBox.getChildren().addAll(tempPositionText, tempWageText, addPositionSubmit);
tempVBox.getChildren().addAll(positionLabel, tempPositionText, wageLabel, tempWageText, addPositionSubmit);
Scene tempScene = new Scene(tempVBox);
Stage tempStage = new Stage();
tempStage.setScene(tempScene);
......@@ -788,8 +818,23 @@ public class Controller {
addPositionSubmit.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
System.out.println(model.addPosition(tempPositionText.getText(), Float.parseFloat(tempWageText.getText())));
tempStage.close();
String position = tempPositionText.getText();
String wage = tempWageText.getText();
if(position.isEmpty() || position.isBlank()){
showErrorMessage("Position is blank. Please try again.");
}
else if(wage.isBlank() || wage.isEmpty()){
showErrorMessage("Wage is blank. Please try again.");
}
else{
try{
Float.parseFloat(wage);
System.out.println(model.addPosition(position, Float.parseFloat(wage)));
tempStage.close();
}catch(NumberFormatException e){
showErrorMessage("Wage is not a valid. Please try again.");
}
}
}
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment