Appointment page

This commit is contained in:
Nikitha
2026-02-23 16:08:55 -07:00
parent 8bb502c4cc
commit 4fcaa7f2eb
6 changed files with 560 additions and 240 deletions

View File

@@ -0,0 +1,59 @@
package org.example.petshopdesktop.DTOs;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
public class AppointmentDTO {
private SimpleIntegerProperty appointmentId;
private SimpleIntegerProperty customerId;
private SimpleStringProperty customerName;
private SimpleIntegerProperty petId;
private SimpleStringProperty petName;
private SimpleIntegerProperty serviceId;
private SimpleStringProperty serviceName;
private SimpleStringProperty appointmentDate;
private SimpleStringProperty appointmentTime;
private SimpleStringProperty appointmentStatus;
// Constructor
public AppointmentDTO(int appointmentId,
int customerId, String customerName,
int petId, String petName,
int serviceId, String serviceName,
String appointmentDate,
String appointmentTime,
String appointmentStatus) {
this.appointmentId = new SimpleIntegerProperty(appointmentId);
this.customerId = new SimpleIntegerProperty(customerId);
this.customerName = new SimpleStringProperty(customerName);
this.petId = new SimpleIntegerProperty(petId);
this.petName = new SimpleStringProperty(petName);
this.serviceId = new SimpleIntegerProperty(serviceId);
this.serviceName = new SimpleStringProperty(serviceName);
this.appointmentDate = new SimpleStringProperty(appointmentDate);
this.appointmentTime = new SimpleStringProperty(appointmentTime);
this.appointmentStatus = new SimpleStringProperty(appointmentStatus);
}
// Getters
public int getAppointmentId() { return appointmentId.get(); }
public int getCustomerId() { return customerId.get(); }
public String getCustomerName() { return customerName.get(); }
public int getPetId() { return petId.get(); }
public String getPetName() { return petName.get(); }
public int getServiceId() { return serviceId.get(); }
public String getServiceName() { return serviceName.get(); }
public String getAppointmentDate() { return appointmentDate.get(); }
public String getAppointmentTime() { return appointmentTime.get(); }
public String getAppointmentStatus() { return appointmentStatus.get(); }
}

View File

@@ -1,138 +1,135 @@
package org.example.petshopdesktop.controllers; package org.example.petshopdesktop.controllers;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.stage.Modality;
import javafx.stage.Stage; import javafx.stage.Stage;
import java.io.IOException; import org.example.petshopdesktop.DTOs.AppointmentDTO;
import org.example.petshopdesktop.controllers.dialogcontrollers.AppointmentDialogController;
import org.example.petshopdesktop.database.AppointmentDB; import org.example.petshopdesktop.database.AppointmentDB;
import org.example.petshopdesktop.models.Appointment;
public class AppointmentController { public class AppointmentController {
@FXML private TableView<AppointmentDTO> tvAppointments;
private ObservableList<Appointment> appointments = @FXML private TableColumn<AppointmentDTO,Integer> colAppointmentId;
FXCollections.observableArrayList(); @FXML private TableColumn<AppointmentDTO,String> colPetName;
@FXML private TableColumn<AppointmentDTO,String> colServiceName;
@FXML private TableColumn<AppointmentDTO,String> colAppointmentDate;
@FXML private TableColumn<AppointmentDTO,String> colAppointmentTime;
@FXML private TableColumn<AppointmentDTO,String> colCustomerName;
@FXML private TableColumn<AppointmentDTO,String> colAppointmentStatus;
@FXML private Button btnAdd;
@FXML private Button btnEdit;
@FXML private Button btnDelete;
@FXML private TextField txtSearch;
private ObservableList<AppointmentDTO> data = FXCollections.observableArrayList();
@FXML @FXML
public void initialize(){
colAppointmentId.setCellValueFactory(new PropertyValueFactory<>("appointmentId"));
colPetName.setCellValueFactory(new PropertyValueFactory<>("petName"));
colServiceName.setCellValueFactory(new PropertyValueFactory<>("serviceName"));
colAppointmentDate.setCellValueFactory(new PropertyValueFactory<>("appointmentDate"));
colAppointmentTime.setCellValueFactory(new PropertyValueFactory<>("appointmentTime"));
colCustomerName.setCellValueFactory(new PropertyValueFactory<>("customerName"));
colAppointmentStatus.setCellValueFactory(new PropertyValueFactory<>("appointmentStatus"));
public void initialize() {
loadAppointments(); loadAppointments();
} }
private void loadAppointments(){
try{
private void loadAppointments() { data = AppointmentDB.getAppointmentDTOs();
appointments.setAll(AppointmentDB.getAllAppointments()); tvAppointments.setItems(data);
tvAppointments.setItems(appointments); }catch(Exception e){
e.printStackTrace();
}
} }
@FXML @FXML
private Button btnAdd; void btnAddClicked(ActionEvent event){
openDialog(null, "Add");
}
@FXML @FXML
private Button btnDelete; void btnEditClicked(ActionEvent event){
AppointmentDTO selected =
tvAppointments.getSelectionModel().getSelectedItem();
if(selected == null){
showAlert("Select Appointment", "Please select appointment to edit.");
return;
}
openDialog(selected, "Edit");
}
@FXML @FXML
private Button btnEdit; void btnDeleteClicked(ActionEvent event){
@FXML AppointmentDTO selected =
private TableColumn<?, ?> colAppointmentDate; tvAppointments.getSelectionModel().getSelectedItem();
@FXML if(selected == null) return;
private TableColumn<?, ?> colAppointmentId;
@FXML try{
private TableColumn<?, ?> colAppointmentStatus; AppointmentDB.deleteAppointment(selected.getAppointmentId());
loadAppointments();
}catch(Exception e){
e.printStackTrace();
}
}
@FXML private void openDialog(AppointmentDTO appt, String mode){
private TableColumn<?, ?> colAppointmentTime;
@FXML try{
private TableColumn<?, ?> colCustomerName;
@FXML
private TableColumn<?, ?> colPetName;
@FXML
private TableColumn<?, ?> colServiceName;
@FXML
private TableView<Appointment> tvAppointments;
@FXML
private TextField txtSearch;
@FXML
void btnAddClicked(ActionEvent event) {
try {
FXMLLoader loader = new FXMLLoader( FXMLLoader loader = new FXMLLoader(
getClass().getResource("/appointment-dialog-view.fxml") getClass().getResource(
"/org/example/petshopdesktop/dialogviews/appointment-dialog-view.fxml"
)
); );
Scene scene = new Scene(loader.load());
AppointmentDialogController controller =
loader.getController();
controller.setMode(mode);
if(mode.equals("Edit")){
controller.displayAppointmentDetails(appt);
}
Stage stage = new Stage(); Stage stage = new Stage();
stage.setScene(new Scene(loader.load())); stage.initModality(Modality.APPLICATION_MODAL);
stage.setScene(scene);
stage.showAndWait(); stage.showAndWait();
loadAppointments(); loadAppointments();
} catch (Exception e) { }catch(Exception e){
e.printStackTrace(); e.printStackTrace();
} }
} }
@FXML private void showAlert(String title, String msg){
void btnDeleteClicked(ActionEvent event) { Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle(title);
Appointment selected = tvAppointments.getSelectionModel().getSelectedItem(); alert.setHeaderText(null);
alert.setContentText(msg);
if (selected == null) return; alert.showAndWait();
try {
AppointmentDB.deleteAppointment(
selected.getAppointmentId()
);
loadAppointments();
} catch (Exception e) {
e.printStackTrace();
}
} }
@FXML
void btnEditClicked(ActionEvent event) {
Appointment selected = tvAppointments.getSelectionModel().getSelectedItem();
if (selected == null) return;
try {
FXMLLoader loader = new FXMLLoader(
getClass().getResource("/appointment-dialog-view.fxml")
);
Stage stage = new Stage();
stage.setScene(new Scene(loader.load()));
stage.showAndWait();
loadAppointments();
} catch (Exception e) {
e.printStackTrace();
}
}
} }

View File

@@ -2,110 +2,208 @@ package org.example.petshopdesktop.controllers.dialogcontrollers;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.event.EventHandler;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.Node; import javafx.scene.Node;
import javafx.scene.control.Button; import javafx.scene.control.*;
import javafx.scene.control.ComboBox;
import javafx.scene.control.DatePicker;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import javafx.stage.Stage; import javafx.stage.Stage;
import javafx.scene.control.ListCell;
import org.example.petshopdesktop.database.AppointmentDB; import org.example.petshopdesktop.DTOs.AppointmentDTO;
import org.example.petshopdesktop.models.Appointment; import org.example.petshopdesktop.database.*;
import org.example.petshopdesktop.models.*;
import java.sql.Time; import java.sql.Time;
public class AppointmentDialogController { public class AppointmentDialogController {
@FXML // ============================
private Button btnCancel; // FXML
// ============================
@FXML @FXML private Button btnCancel;
private Button btnSave; @FXML private Button btnSave;
@FXML @FXML private ComboBox<Service> cbService;
private ComboBox<String> cbAppointmentStatus; @FXML private ComboBox<Customer> cbCustomer;
@FXML private ComboBox<Pet> cbPet;
@FXML @FXML private ComboBox<Integer> cbHour;
private ComboBox<Time> cbAppointmentTime; @FXML private ComboBox<Integer> cbMinute;
@FXML @FXML private ComboBox<String> cbAppointmentStatus;
private ComboBox<?> cbCustomer; @FXML private DatePicker dpAppointmentDate;
@FXML private Label lblAppointmentId;
@FXML private Label lblMode;
@FXML // ============================
private ComboBox<?> cbService; // DATA
// ============================
@FXML private String mode = null; // Add | Edit
private DatePicker dpAppointmentDate; private AppointmentDTO selectedAppointment = null;
@FXML private ObservableList<String> statusList =
private Label lblAppointmentId; FXCollections.observableArrayList(
"Booked", "Completed", "Cancelled"
@FXML
private Label lblMode;
private String mode = null; //Used to determine add or edit mode
//Used to populate status combo box
private ObservableList<String> statusList = FXCollections.observableArrayList(
"Booked", "Completed", "Cancelled"
);
@FXML
void initialize() {
cbAppointmentStatus.setItems(statusList); //populate status combo box
//Set up mouse handlers for buttons
btnSave.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
buttonSaveClicked(mouseEvent);
}
});
btnCancel.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
closeStage(mouseEvent);
}
});
}
private void buttonSaveClicked(MouseEvent mouseEvent) {
try {
int serviceId = 1; // temporary
int customerId = 1; // temporary
int petId = 1; // temporary
Appointment appointment = new Appointment(
serviceId,
customerId,
petId,
dpAppointmentDate.getValue(),
cbAppointmentTime.getValue(),
cbAppointmentStatus.getValue()
); );
AppointmentDB.addAppointment(appointment); //
// MODE
//
closeStage(mouseEvent); public void setMode(String mode) {
this.mode = mode;
lblMode.setText(mode + " Appointment");
lblAppointmentId.setVisible(!mode.equals("Add"));
}
//
// INITIALIZE
//
@FXML
public void initialize() {
try {
cbService.setItems(ServiceDB.getServices());
cbCustomer.setItems(CustomerDB.getCustomers());
cbPet.setItems(PetDB.getPets());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
cbAppointmentStatus.setItems(statusList);
// Hours 9 AM - 5 PM
for (int i = 9; i <= 17; i++) {
cbHour.getItems().add(i);
}
cbMinute.getItems().addAll(0, 15, 30, 45);
// Show pet name
cbPet.setCellFactory(param -> new ListCell<>() {
@Override
protected void updateItem(Pet pet, boolean empty) {
super.updateItem(pet, empty);
setText(empty || pet == null ? null : pet.getPetName());
}
});
cbPet.setButtonCell(new ListCell<>() {
@Override
protected void updateItem(Pet pet, boolean empty) {
super.updateItem(pet, empty);
setText(empty || pet == null ? null : pet.getPetName());
}
});
btnSave.setOnMouseClicked(this::buttonSaveClicked);
btnCancel.setOnMouseClicked(this::closeStage);
} }
private void closeStage(MouseEvent mouseEvent) { //
Node node = (Node) mouseEvent.getSource(); // DISPLAY FOR EDIT
Stage stage = (Stage) node.getScene().getWindow(); //
public void displayAppointmentDetails(AppointmentDTO appt) {
selectedAppointment = appt;
lblAppointmentId.setText("ID: " + appt.getAppointmentId());
dpAppointmentDate.setValue(
java.time.LocalDate.parse(appt.getAppointmentDate())
);
cbAppointmentStatus.setValue(appt.getAppointmentStatus());
Time time = Time.valueOf(appt.getAppointmentTime());
cbHour.setValue(time.toLocalTime().getHour());
cbMinute.setValue(time.toLocalTime().getMinute());
cbService.getItems().forEach(s -> {
if (s.getServiceId() == appt.getServiceId()) cbService.setValue(s);
});
cbCustomer.getItems().forEach(c -> {
if (c.getCustomerId() == appt.getCustomerId()) cbCustomer.setValue(c);
});
cbPet.getItems().forEach(p -> {
if (p.getPetId() == appt.getPetId()) cbPet.setValue(p);
});
}
//
// SAVE
//
private void buttonSaveClicked(MouseEvent e) {
if (cbService.getValue() == null ||
cbCustomer.getValue() == null ||
cbPet.getValue() == null ||
dpAppointmentDate.getValue() == null ||
cbHour.getValue() == null ||
cbMinute.getValue() == null ||
cbAppointmentStatus.getValue() == null) {
showError("All fields are required");
return;
}
Time appointmentTime =
Time.valueOf(String.format(
"%02d:%02d:00",
cbHour.getValue(),
cbMinute.getValue()
));
Appointment appt = new Appointment(
selectedAppointment == null ? 0 : selectedAppointment.getAppointmentId(),
cbService.getValue().getServiceId(),
cbCustomer.getValue().getCustomerId(),
dpAppointmentDate.getValue().toString(),
appointmentTime.toString(),
cbAppointmentStatus.getValue()
);
try {
if (mode.equals("Add")) {
int newId = AppointmentDB.insertAppointment(appt);
AppointmentDB.insertAppointmentPet(newId, cbPet.getValue().getPetId());
} else {
AppointmentDB.updateAppointment(
selectedAppointment.getAppointmentId(),
appt,
cbPet.getValue().getPetId()
);
}
closeStage(e);
} catch (Exception ex) {
ex.printStackTrace();
showError("Error saving appointment");
}
}
//
// UTIL
//
private void closeStage(MouseEvent e) {
Stage stage = (Stage) ((Node) e.getSource()).getScene().getWindow();
stage.close(); stage.close();
} }
private void showError(String msg) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setHeaderText("Input Error");
alert.setContentText(msg);
alert.showAndWait();
}
} }

View File

@@ -2,72 +2,192 @@ package org.example.petshopdesktop.database;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import org.example.petshopdesktop.DTOs.AppointmentDTO;
import org.example.petshopdesktop.models.Appointment; import org.example.petshopdesktop.models.Appointment;
import java.sql.*; import java.sql.*;
public class AppointmentDB { public class AppointmentDB {
public static ObservableList<Appointment> getAllAppointments() { // ============================
// GET ALL APPOINTMENTS
// ============================
public static ObservableList<AppointmentDTO> getAppointmentDTOs()
throws SQLException {
ObservableList<Appointment> list = FXCollections.observableArrayList(); ObservableList<AppointmentDTO> list =
String sql = "SELECT * FROM appointment"; FXCollections.observableArrayList();
try (Connection conn = ConnectionDB.getConnection(); Connection conn = ConnectionDB.getConnection();
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql)) {
while (rs.next()) { String sql = """
SELECT a.appointmentId,
c.customerId,
CONCAT(c.firstName,' ',c.lastName) AS customerName,
p.petId,
p.petName,
s.serviceId,
s.serviceName,
a.appointmentDate,
a.appointmentTime,
a.appointmentStatus
FROM appointment a
JOIN customer c ON a.customerId = c.customerId
JOIN appointmentPet ap ON a.appointmentId = ap.appointmentId
JOIN pet p ON ap.petId = p.petId
JOIN service s ON a.serviceId = s.serviceId
""";
Appointment a = new Appointment( Statement stmt = conn.createStatement();
rs.getInt("appointmentId"), ResultSet rs = stmt.executeQuery(sql);
rs.getInt("serviceId"),
rs.getInt("customerId"),
rs.getDate("appointmentDate").toLocalDate(),
rs.getTime("appointmentTime"),
rs.getString("appointmentStatus")
);
list.add(a); while (rs.next()) {
}
} catch (Exception e) { AppointmentDTO dto = new AppointmentDTO(
e.printStackTrace(); rs.getInt("appointmentId"),
rs.getInt("customerId"),
rs.getString("customerName"),
rs.getInt("petId"),
rs.getString("petName"),
rs.getInt("serviceId"),
rs.getString("serviceName"),
rs.getString("appointmentDate"),
rs.getString("appointmentTime"),
rs.getString("appointmentStatus")
);
list.add(dto);
} }
conn.close();
return list; return list;
} }
public static void addAppointment(Appointment a) throws SQLException { // ============================
// INSERT APPOINTMENT
// ============================
public static int insertAppointment(Appointment appt)
throws SQLException {
Connection conn = ConnectionDB.getConnection();
String sql = """
INSERT INTO appointment
(serviceId, customerId, appointmentDate,
appointmentTime, appointmentStatus)
VALUES (?,?,?,?,?)
""";
PreparedStatement ps =
conn.prepareStatement(sql,
Statement.RETURN_GENERATED_KEYS);
ps.setInt(1, appt.getServiceId());
ps.setInt(2, appt.getCustomerId());
ps.setString(3, appt.getAppointmentDate());
ps.setString(4, appt.getAppointmentTime());
ps.setString(5, appt.getAppointmentStatus());
ps.executeUpdate();
ResultSet keys = ps.getGeneratedKeys();
int newId = 0;
if (keys.next()) {
newId = keys.getInt(1);
}
conn.close();
return newId;
}
//
// LINK PET TO APPOINTMENT
//
public static void insertAppointmentPet(int appointmentId,
int petId)
throws SQLException {
Connection conn = ConnectionDB.getConnection();
String sql = String sql =
"INSERT INTO appointment " + "INSERT INTO appointmentPet (appointmentId, petId) VALUES (?,?)";
"(petId, serviceId, customerId, appointmentDate, appointmentTime, appointmentStatus) " +
"VALUES (?, ?, ?, ?, ?, ?)";
try (Connection conn = ConnectionDB.getConnection(); PreparedStatement ps = conn.prepareStatement(sql);
PreparedStatement stmt = conn.prepareStatement(sql)) { ps.setInt(1, appointmentId);
ps.setInt(2, petId);
ps.executeUpdate();
stmt.setInt(1, a.getPetId()); conn.close();
stmt.setInt(2, a.getServiceId());
stmt.setInt(3, a.getCustomerId());
stmt.setDate(4, Date.valueOf(a.getAppointmentDate()));
stmt.setTime(5, a.getAppointmentTime());
stmt.setString(6, a.getAppointmentStatus());
stmt.executeUpdate();
}
} }
public static void deleteAppointment(int id) throws SQLException { //
// UPDATE APPOINTMENT
//
public static int updateAppointment(int id,
Appointment appt,
int petId)
throws SQLException {
String sql = "DELETE FROM appointment WHERE appointmentId=?"; Connection conn = ConnectionDB.getConnection();
try (Connection conn = ConnectionDB.getConnection(); String sql =
PreparedStatement stmt = conn.prepareStatement(sql)) { "UPDATE appointment SET serviceId=?, customerId=?, " +
"appointmentDate=?, appointmentTime=?, appointmentStatus=? " +
"WHERE appointmentId=?";
stmt.setInt(1, id); PreparedStatement ps = conn.prepareStatement(sql);
stmt.executeUpdate();
} ps.setInt(1, appt.getServiceId());
ps.setInt(2, appt.getCustomerId());
ps.setString(3, appt.getAppointmentDate());
ps.setString(4, appt.getAppointmentTime());
ps.setString(5, appt.getAppointmentStatus());
ps.setInt(6, id);
ps.executeUpdate();
String sql2 =
"UPDATE appointmentPet SET petId=? WHERE appointmentId=?";
PreparedStatement ps2 = conn.prepareStatement(sql2);
ps2.setInt(1, petId);
ps2.setInt(2, id);
ps2.executeUpdate();
conn.close();
return 1;
}
//
// DELETE APPOINTMENT
//
public static int deleteAppointment(int id)
throws SQLException {
Connection conn = ConnectionDB.getConnection();
PreparedStatement ps1 =
conn.prepareStatement(
"DELETE FROM appointmentPet WHERE appointmentId=?"
);
ps1.setInt(1, id);
ps1.executeUpdate();
PreparedStatement ps2 =
conn.prepareStatement(
"DELETE FROM appointment WHERE appointmentId=?"
);
ps2.setInt(1, id);
int rows = ps2.executeUpdate();
conn.close();
return rows;
} }
} }

View File

@@ -1,40 +1,46 @@
package org.example.petshopdesktop.models; package org.example.petshopdesktop.models;
import javafx.beans.property.*; import javafx.beans.property.SimpleIntegerProperty;
import java.sql.Time; import javafx.beans.property.SimpleStringProperty;
import java.time.LocalDate;
public class Appointment { public class Appointment {
private final SimpleIntegerProperty appointmentId; private SimpleIntegerProperty appointmentId;
private final SimpleIntegerProperty serviceId; private SimpleIntegerProperty serviceId;
private final SimpleIntegerProperty customerId; private SimpleIntegerProperty customerId;
private SimpleIntegerProperty petId = null; private SimpleStringProperty appointmentDate;
private final ObjectProperty<LocalDate> appointmentDate; private SimpleStringProperty appointmentTime;
private final ObjectProperty<Time> appointmentTime; private SimpleStringProperty appointmentStatus;
private final SimpleStringProperty appointmentStatus;
// Constructor
public Appointment(int appointmentId, public Appointment(int appointmentId,
int serviceId, int serviceId,
int customerId, int customerId,
LocalDate date, String appointmentDate,
Time time, String appointmentTime,
String status) { String appointmentStatus) {
this.appointmentId = new SimpleIntegerProperty(appointmentId); this.appointmentId = new SimpleIntegerProperty(appointmentId);
this.serviceId = new SimpleIntegerProperty(serviceId); this.serviceId = new SimpleIntegerProperty(serviceId);
this.customerId = new SimpleIntegerProperty(customerId); this.customerId = new SimpleIntegerProperty(customerId);
this.petId = new SimpleIntegerProperty(); this.appointmentDate = new SimpleStringProperty(appointmentDate);
this.appointmentDate = new SimpleObjectProperty<>(date); this.appointmentTime = new SimpleStringProperty(appointmentTime);
this.appointmentTime = new SimpleObjectProperty<>(time); this.appointmentStatus = new SimpleStringProperty(appointmentStatus);
this.appointmentStatus = new SimpleStringProperty(status);
} }
// Getters
public int getAppointmentId() { return appointmentId.get(); } public int getAppointmentId() { return appointmentId.get(); }
public int getServiceId() { return serviceId.get(); } public int getServiceId() { return serviceId.get(); }
public int getCustomerId() { return customerId.get(); } public int getCustomerId() { return customerId.get(); }
public int getPetId() { return petId.get(); } public String getAppointmentDate() { return appointmentDate.get(); }
public LocalDate getAppointmentDate() { return appointmentDate.get(); } public String getAppointmentTime() { return appointmentTime.get(); }
public Time getAppointmentTime() { return appointmentTime.get(); }
public String getAppointmentStatus() { return appointmentStatus.get(); } public String getAppointmentStatus() { return appointmentStatus.get(); }
// Properties
public SimpleIntegerProperty appointmentIdProperty() { return appointmentId; }
public SimpleIntegerProperty serviceIdProperty() { return serviceId; }
public SimpleIntegerProperty customerIdProperty() { return customerId; }
public SimpleStringProperty appointmentDateProperty() { return appointmentDate; }
public SimpleStringProperty appointmentTimeProperty() { return appointmentTime; }
public SimpleStringProperty appointmentStatusProperty() { return appointmentStatus; }
} }

View File

@@ -12,6 +12,8 @@
<?import javafx.scene.layout.RowConstraints?> <?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.layout.HBox?>
<VBox minHeight="-Infinity" minWidth="-Infinity" prefHeight="523.0" prefWidth="790.0" <VBox minHeight="-Infinity" minWidth="-Infinity" prefHeight="523.0" prefWidth="790.0"
spacing="20.0" style="-fx-font-size: 14px;" spacing="20.0" style="-fx-font-size: 14px;"
@@ -46,7 +48,8 @@
</HBox.margin> </HBox.margin>
</VBox> </VBox>
<Region prefHeight="93.0" prefWidth="151.0" HBox.hgrow="ALWAYS" /> <Region prefHeight="93.0" prefWidth="151.0" HBox.hgrow="ALWAYS" />
<Button fx:id="btnCancel" layoutX="391.0" layoutY="38.0" mnemonicParsing="false" style="-fx-background-color: #E74c3c; -fx-cursor: hand; -fx-background-radius: 8;" text="Cancel" textFill="WHITE"> <Button fx:id="btnCancel" layoutX="391.0" layoutY="38.0"
mnemonicParsing="false" style="-fx-background-color: #E74c3c; -fx-cursor: hand; -fx-background-radius: 8;" text="Cancel" textFill="WHITE">
<font> <font>
<Font name="System Bold" size="14.0" /> <Font name="System Bold" size="14.0" />
</font> </font>
@@ -54,7 +57,8 @@
<Insets bottom="12.0" left="24.0" right="24.0" top="12.0" /> <Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
</padding> </padding>
</Button> </Button>
<Button fx:id="btnSave" layoutX="520.0" layoutY="38.0" mnemonicParsing="false" style="-fx-background-color: #3fe06a; -fx-cursor: hand; -fx-background-radius: 8;" text="Save" textFill="WHITE"> <Button fx:id="btnSave" layoutX="520.0" layoutY="38.0" mnemonicParsing="false"
style="-fx-background-color: #3fe06a; -fx-cursor: hand; -fx-background-radius: 8;" text="Save" textFill="WHITE">
<font> <font>
<Font name="System Bold" size="14.0" /> <Font name="System Bold" size="14.0" />
</font> </font>
@@ -67,7 +71,8 @@
<Insets left="15.0" right="15.0" /> <Insets left="15.0" right="15.0" />
</padding> </padding>
</HBox> </HBox>
<VBox prefHeight="370.0" prefWidth="750.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-color: #5580b5; -fx-border-radius: 14;"> <VBox prefHeight="370.0" prefWidth="750.0"
style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-color: #5580b5; -fx-border-radius: 14;">
<children> <children>
<GridPane hgap="25.0" VBox.vgrow="ALWAYS"> <GridPane hgap="25.0" VBox.vgrow="ALWAYS">
<columnConstraints> <columnConstraints>
@@ -136,19 +141,54 @@
</ComboBox> </ComboBox>
</children> </children>
</VBox> </VBox>
<VBox prefHeight="200.0" prefWidth="100.0" spacing="8.0" GridPane.columnIndex="1" GridPane.rowIndex="1"> <VBox prefHeight="200.0"
prefWidth="100.0"
spacing="8.0"
GridPane.columnIndex="1"
GridPane.rowIndex="1">
<children> <children>
<Label text="Appointment Time:" textFill="#2c3e50"> <Label text="Appointment Time:" textFill="#2c3e50">
<font> <font>
<Font name="System Bold" size="16.0" /> <Font name="System Bold" size="16.0" />
</font> </font>
</Label> </Label>
<ComboBox fx:id="cbAppointmentTime" prefHeight="29.0" prefWidth="336.0" promptText="Select Time" style="-fx-border-color: #E8EBED; -fx-border-width: 2; -fx-border-radius: 10; -fx-background-radius: 10; -fx-background-color: white;">
<padding> <HBox spacing="10">
<Insets bottom="3.0" left="10.0" right="10.0" top="3.0" />
</padding> <!-- Hour -->
</ComboBox> <ComboBox fx:id="cbHour"
promptText="Hour"
prefWidth="160"
style="-fx-border-color: #E8EBED;
-fx-border-width: 2;
-fx-border-radius: 10;
-fx-background-radius: 10;
-fx-background-color: white;">
<padding>
<Insets bottom="3.0" left="10.0" right="10.0" top="3.0" />
</padding>
</ComboBox>
<!-- Minute -->
<ComboBox fx:id="cbMinute"
promptText="Minute"
prefWidth="160"
style="-fx-border-color: #E8EBED;
-fx-border-width: 2;
-fx-border-radius: 10;
-fx-background-radius: 10;
-fx-background-color: white;">
<padding>
<Insets bottom="3.0" left="10.0" right="10.0" top="3.0" />
</padding>
</ComboBox>
</HBox>
</children> </children>
</VBox> </VBox>
<VBox prefHeight="200.0" prefWidth="100.0" spacing="8.0" GridPane.rowIndex="2"> <VBox prefHeight="200.0" prefWidth="100.0" spacing="8.0" GridPane.rowIndex="2">
<children> <children>