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

Revert "more input error checks"

This reverts commit e16e6ba2
parent 28fc6783
No related branches found
No related tags found
1 merge request!8Revert "more input error checks"
......@@ -111,12 +111,6 @@ public class Controller {
TextField timeOffReason;
@FXML
Label timeOffResponse;
@FXML
TextField addEmployeeEmail;
@FXML
TextField addEmployeePhoneNumber;
@FXML
CheckBox addEmployeeManager;
boolean isDaily;
......@@ -579,32 +573,10 @@ public class Controller {
public void addEmployeeClicked(MouseEvent mouseEvent) {
String firstName = addFirstName.getText();
String lastName = addLastName.getText();
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();
}
model.addEmployee(firstName, lastName);
System.out.println("Employee " + firstName + " " + lastName + " added to Staff. Welcome "
+ firstName + "!");
model.notifySubscribers();
}
public void editEmployeeClicked(MouseEvent mouseEvent) {
......@@ -805,12 +777,10 @@ public class Controller {
VBox tempVBox = new VBox();
tempVBox.setSpacing(20);
tempVBox.setPadding(new Insets(30));
Label positionLabel = new Label("Enter Position: ");
TextField tempPositionText = new TextField();
Label wageLabel = new Label("Enter Wage: ");
TextField tempWageText = new TextField();
TextField tempPositionText = new TextField("Enter Position Here");
TextField tempWageText = new TextField("Enter Wage Here");
Button addPositionSubmit = new Button("Submit");
tempVBox.getChildren().addAll(positionLabel, tempPositionText, wageLabel, tempWageText, addPositionSubmit);
tempVBox.getChildren().addAll(tempPositionText, tempWageText, addPositionSubmit);
Scene tempScene = new Scene(tempVBox);
Stage tempStage = new Stage();
tempStage.setScene(tempScene);
......@@ -818,23 +788,8 @@ public class Controller {
addPositionSubmit.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
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.");
}
}
System.out.println(model.addPosition(tempPositionText.getText(), Float.parseFloat(tempWageText.getText())));
tempStage.close();
}
});
}
......
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