Skip to content
Snippets Groups Projects
Commit 345e5528 authored by eyan_'s avatar eyan_
Browse files

edit employee, still needs autofill and error checks

parent 933ffa54
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,22 @@ public class Controller {
Label currentDateText;
@FXML
TextField loginField;
@FXML
TextField editEmployeeFirstName;
@FXML
TextField editEmployeeLastName;
@FXML
TextField editEmployeeEmail;
@FXML
TextField editEmployeeWage;
@FXML
TextField editEmployeePhoneNumber;
@FXML
TextField editEmployeeAddress;
@FXML
ComboBox editEmployeeBox;
@FXML
CheckBox editEmployeeManager;
......@@ -472,7 +488,15 @@ public class Controller {
// Edit employee
public void editEmployeeClicked(MouseEvent mouseEvent) {
//edit employee
int id = model.getIDbyIndex(editEmployeeBox.getSelectionModel().getSelectedIndex());
String newFirstName = editEmployeeFirstName.getText();
String newLastName = editEmployeeLastName.getText();
String newEmail = editEmployeeEmail.getText();
Float newWage = Float.parseFloat(editEmployeeWage.getText());
String newPhoneNumber = editEmployeePhoneNumber.getText();
boolean newIsManager = editEmployeeManager.isSelected();
model.editEmployee(id,newFirstName,newLastName,newIsManager,newEmail,newPhoneNumber,newWage);
System.out.println("edit employee submit clicked");
}
// Remove Employee
......
......@@ -2,70 +2,122 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="540.0" prefWidth="700.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" >
<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" spacing="20.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label alignment="CENTER" minHeight="-Infinity" minWidth="-Infinity" prefHeight="120.0" prefWidth="700.0" text="Edit Employee" textAlignment="CENTER">
<font>
<Font name="System Bold" size="28.0" />
</font>
<VBox.margin>
<Insets />
</VBox.margin>
<padding>
<Insets top="50.0" />
</padding>
</Label>
<HBox alignment="CENTER" minHeight="-Infinity" minWidth="-Infinity" prefHeight="100.0" prefWidth="600.0">
<VBox>
<children>
<Label text="Employee #: ">
<Label alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" text="Edit Employee" textAlignment="CENTER">
<font>
<Font size="20.0" />
<Font name="System Bold" size="28.0" />
</font>
</Label>
<TextField minHeight="-Infinity" minWidth="-Infinity" prefWidth="300.0">
<font>
<Font size="18.0" />
</font>
</TextField>
</children>
</HBox>
<HBox alignment="CENTER" minHeight="-Infinity" minWidth="-Infinity" prefHeight="100.0" prefWidth="600.0">
<children>
<Label text="First Name: ">
<font>
<Font size="20.0" />
</font>
</Label>
<TextField fx:id="addFirstName" prefWidth="300.0">
<font>
<Font size="18.0" />
</font>
</TextField>
<HBox alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0">
<children>
<Label maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" text="Employee: ">
<font>
<Font size="20.0" />
</font>
</Label>
<ComboBox fx:id="editEmployeeBox" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" onMouseClicked="#populateEmployeeBox" />
</children>
</HBox>
</children>
</HBox>
<HBox alignment="CENTER" minHeight="-Infinity" minWidth="-Infinity" prefHeight="100.0" prefWidth="600.0">
</VBox>
<HBox alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" spacing="30.0" VBox.vgrow="ALWAYS">
<children>
<Label text="Last Name: ">
<font>
<Font size="20.0" />
</font>
</Label>
<TextField fx:id="addLastName" prefWidth="300.0">
<font>
<Font size="18.0" />
</font>
</TextField>
<HBox>
<children>
<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0">
<children>
<Label maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" text="First Name: " VBox.vgrow="ALWAYS">
<font>
<Font size="20.0" />
</font>
</Label>
<Label maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" text="Manager:" VBox.vgrow="ALWAYS">
<font>
<Font size="20.0" />
</font>
</Label>
<Label maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" text="Phone Number:" VBox.vgrow="ALWAYS">
<font>
<Font size="20.0" />
</font>
</Label>
</children>
</VBox>
<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" spacing="50.0">
<children>
<TextField fx:id="editEmployeeFirstName" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" VBox.vgrow="ALWAYS">
<font>
<Font size="18.0" />
</font>
</TextField>
<CheckBox fx:id="editEmployeeManager" mnemonicParsing="false" />
<TextField fx:id="editEmployeePhoneNumber" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" VBox.vgrow="ALWAYS">
<font>
<Font size="18.0" />
</font>
</TextField>
</children>
</VBox>
</children>
</HBox>
<HBox>
<children>
<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0">
<children>
<Label maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" text="Last Name:" VBox.vgrow="ALWAYS">
<font>
<Font size="20.0" />
</font>
</Label>
<Label maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" text="Email: " VBox.vgrow="ALWAYS">
<font>
<Font size="20.0" />
</font>
</Label>
<Label maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" text="Wage:" VBox.vgrow="ALWAYS">
<font>
<Font size="20.0" />
</font>
</Label>
</children>
</VBox>
<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" spacing="50.0">
<children>
<TextField fx:id="editEmployeeLastName" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" VBox.vgrow="ALWAYS">
<font>
<Font size="18.0" />
</font>
</TextField>
<TextField fx:id="editEmployeeEmail" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" VBox.vgrow="ALWAYS">
<font>
<Font size="18.0" />
</font>
</TextField>
<TextField fx:id="editEmployeeWage" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" VBox.vgrow="ALWAYS">
<font>
<Font size="18.0" />
</font>
</TextField>
</children>
</VBox>
</children>
</HBox>
</children>
</HBox>
<HBox alignment="TOP_CENTER" prefHeight="120.0" prefWidth="600.0">
<HBox alignment="TOP_CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0">
<children>
<Button alignment="CENTER" mnemonicParsing="false" onMouseClicked="#editEmployeeClicked" text="Confirm Changes">
<Button alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" mnemonicParsing="false" onMouseClicked="#editEmployeeClicked" text="Confirm Changes">
<font>
<Font size="16.0" />
</font>
......
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