Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,44 +1,62 @@
package com.gitrekt.resort.controller;

import com.gitrekt.resort.model.entities.GuestFeedback;
import com.gitrekt.resort.model.services.GuestFeedbackService;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.stage.Stage;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

/**
* FXML Controller class for the leave feedback screen.
*/
public class LeaveFeedbackScreenController implements Initializable {

@FXML
private Button submitButton;

@FXML
private TextArea feedbackTextArea;

@FXML
private TextField guestEmailTextField;

@FXML
private Button cancelButton;
private Button submitButton;

@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}

public void onCancelClicked() {
ScreenManager.getInstance().switchToScreen(
"/fxml/GuestHomeScreen.fxml"
"/fxml/GuestHomeScreen.fxml"
);
}

/**
* Action button for when submit button is clicked.
* @throws IOException
*
* @throws IOException
*/
public void onSubmitClicked() throws IOException {
Stage stage = (Stage) submitButton.getScene().getWindow();
//TODO Add feedback to database
if (!feedbackTextArea.getText().equals("") && !guestEmailTextField.getText().equals("")) {
GuestFeedbackService guestfeedbackservice = new GuestFeedbackService();
guestfeedbackservice.createNewGuestFeedback(new GuestFeedback(feedbackTextArea.getText(), guestEmailTextField.getText()));
Alert a = new Alert(AlertType.INFORMATION);
a.setTitle("THANK YOU!");
a.setHeaderText("Thanks for your feeback");
a.showAndWait();
if (a.getResult() == ButtonType.OK) {
onCancelClicked();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,7 @@ public class ResetEmployeePasswordDialogController implements Initializable {
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// Configure text change listeners for the two fields
newPasswordField.setOnKeyPressed(
e -> onNewPasswordFieldUpdated()
);
confirmPasswordField.setOnKeyPressed(e ->
onConfirmPasswordFieldUpdated()
);

}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/fxml/LeaveFeedbackScreen.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>

<VBox alignment="TOP_CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" stylesheets="@../fxcss/Master.css" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.gitrekt.resort.controller.LeaveFeedbackScreenController">
<VBox alignment="TOP_CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" stylesheets="@../fxcss/Master.css" xmlns="http://javafx.com/javafx/9" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.gitrekt.resort.controller.LeaveFeedbackScreenController">
<children>
<Label styleClass="screenHeader" text="Feedback">
<font>
Expand All @@ -27,7 +27,7 @@
</Separator>
<HBox alignment="CENTER">
<children>
<TextArea prefHeight="200.0" prefWidth="400.0" promptText="Please tell us about your experience. Not that we care." wrapText="true">
<TextArea fx:id="feedbackTextArea" prefHeight="500.0" prefWidth="500.0" promptText="Please tell us about your experience. Not that we care." wrapText="true">
<HBox.margin>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</HBox.margin></TextArea>
Expand All @@ -40,7 +40,7 @@
<Insets bottom="10.0" left="10.0" right="20.0" top="10.0" />
</padding>
</Label>
<TextField maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefWidth="300.0" promptText="Enter email address" />
<TextField fx:id="guestEmailTextField" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefWidth="300.0" promptText="Enter email address" />
</children>
<padding>
<Insets bottom="10.0" top="10.0" />
Expand Down