Update Postman collection
This commit is contained in:
@@ -22,7 +22,6 @@ public class AppointmentDTO {
|
||||
private SimpleStringProperty appointmentTime;
|
||||
private SimpleStringProperty appointmentStatus;
|
||||
|
||||
// Constructor
|
||||
public AppointmentDTO(int appointmentId,
|
||||
int customerId, String customerName,
|
||||
int petId, String petName,
|
||||
@@ -47,7 +46,6 @@ public class AppointmentDTO {
|
||||
this.appointmentStatus = new SimpleStringProperty(appointmentStatus);
|
||||
}
|
||||
|
||||
// Getters
|
||||
public int getAppointmentId() { return appointmentId.get(); }
|
||||
|
||||
public int getCustomerId() { return customerId.get(); }
|
||||
|
||||
@@ -68,7 +68,7 @@ public class AdoptionController {
|
||||
void initialize() {
|
||||
btnEdit.setDisable(true);
|
||||
btnDelete.setDisable(true);
|
||||
//Enable multiple selection
|
||||
|
||||
tvAdoptions.getSelectionModel().setSelectionMode(javafx.scene.control.SelectionMode.MULTIPLE);
|
||||
|
||||
colAdoptionId.setCellValueFactory(new PropertyValueFactory<>("adoptionId"));
|
||||
@@ -91,7 +91,6 @@ public class AdoptionController {
|
||||
displayFilteredAdoptions(newValue);
|
||||
});
|
||||
|
||||
//EventListener for DELETE key
|
||||
tvAdoptions.setOnKeyPressed(event -> {
|
||||
if (event.getCode() == javafx.scene.input.KeyCode.DELETE) {
|
||||
if (tvAdoptions.getSelectionModel().getSelectedItem() != null) {
|
||||
@@ -109,11 +108,10 @@ public class AdoptionController {
|
||||
|
||||
@FXML
|
||||
void btnDeleteClicked(ActionEvent event) {
|
||||
//get selected adoptions
|
||||
|
||||
var selectedAdoptions = tvAdoptions.getSelectionModel().getSelectedItems();
|
||||
if (selectedAdoptions.isEmpty()) return;
|
||||
|
||||
//ask user to confirm
|
||||
Alert question = new Alert(Alert.AlertType.CONFIRMATION);
|
||||
question.setHeaderText("Please confirm delete");
|
||||
String message = selectedAdoptions.size() == 1
|
||||
@@ -123,7 +121,6 @@ public class AdoptionController {
|
||||
question.getDialogPane().lookupButton(ButtonType.OK).requestFocus();
|
||||
Optional<ButtonType> result = question.showAndWait();
|
||||
|
||||
//if confirmed, start deletion
|
||||
if (result.isPresent() && result.get() == ButtonType.OK) {
|
||||
List<Long> ids = selectedAdoptions.stream()
|
||||
.map(a -> (long) a.getAdoptionId())
|
||||
@@ -146,7 +143,6 @@ public class AdoptionController {
|
||||
alert.showAndWait();
|
||||
}
|
||||
|
||||
//refresh display and reset inputs
|
||||
displayAdoptions();
|
||||
btnDelete.setDisable(true);
|
||||
btnEdit.setDisable(true);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class AppointmentController {
|
||||
|
||||
@FXML
|
||||
public void initialize(){
|
||||
//Enable multiple selection
|
||||
|
||||
tvAppointments.getSelectionModel().setSelectionMode(javafx.scene.control.SelectionMode.MULTIPLE);
|
||||
|
||||
colAppointmentId.setCellValueFactory(new PropertyValueFactory<>("appointmentId"));
|
||||
@@ -66,7 +66,6 @@ public class AppointmentController {
|
||||
txtSearch.textProperty().addListener((obs, o, n) -> applyFilter(n));
|
||||
}
|
||||
|
||||
//EventListener for DELETE key
|
||||
tvAppointments.setOnKeyPressed(event -> {
|
||||
if (event.getCode() == javafx.scene.input.KeyCode.DELETE) {
|
||||
if (tvAppointments.getSelectionModel().getSelectedItem() != null) {
|
||||
@@ -148,11 +147,10 @@ public class AppointmentController {
|
||||
|
||||
@FXML
|
||||
void btnDeleteClicked(ActionEvent event){
|
||||
//get selected appointments
|
||||
|
||||
var selectedAppointments = tvAppointments.getSelectionModel().getSelectedItems();
|
||||
if (selectedAppointments.isEmpty()) return;
|
||||
|
||||
//ask user to confirm
|
||||
Alert question = new Alert(Alert.AlertType.CONFIRMATION);
|
||||
question.setHeaderText("Please confirm delete");
|
||||
String message = selectedAppointments.size() == 1
|
||||
@@ -162,7 +160,6 @@ public class AppointmentController {
|
||||
question.getDialogPane().lookupButton(ButtonType.OK).requestFocus();
|
||||
java.util.Optional<ButtonType> result = question.showAndWait();
|
||||
|
||||
//if confirmed, start deletion
|
||||
if (result.isPresent() && result.get() == ButtonType.OK) {
|
||||
List<Long> ids = selectedAppointments.stream()
|
||||
.map(a -> (long) a.getAppointmentId())
|
||||
@@ -185,7 +182,6 @@ public class AppointmentController {
|
||||
alert.showAndWait();
|
||||
}
|
||||
|
||||
//refresh display
|
||||
loadAppointments();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import java.util.Objects;
|
||||
|
||||
public class AdoptionDialogController {
|
||||
|
||||
//FXML elements
|
||||
@FXML
|
||||
private Button btnCancel;
|
||||
|
||||
@@ -56,11 +55,9 @@ public class AdoptionDialogController {
|
||||
@FXML
|
||||
private Label lblMode;
|
||||
|
||||
//Stores if the dialog view is in add/edit mode
|
||||
private String mode = null;
|
||||
private Adoption selectedAdoption = null;
|
||||
|
||||
//Adoption statuses
|
||||
private ObservableList<String> statusList = FXCollections.observableArrayList(
|
||||
"Pending", "Completed", "Cancelled"
|
||||
);
|
||||
@@ -234,7 +231,6 @@ public class AdoptionDialogController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void closeStage(MouseEvent mouseEvent) {
|
||||
Node node = (Node) mouseEvent.getSource();
|
||||
Stage stage = (Stage) node.getScene().getWindow();
|
||||
|
||||
@@ -26,10 +26,6 @@ import java.util.Objects;
|
||||
|
||||
public class AppointmentDialogController {
|
||||
|
||||
// ============================
|
||||
// FXML
|
||||
// ============================
|
||||
|
||||
@FXML private Button btnCancel;
|
||||
@FXML private Button btnSave;
|
||||
|
||||
@@ -47,11 +43,7 @@ public class AppointmentDialogController {
|
||||
@FXML private Label lblAppointmentId;
|
||||
@FXML private Label lblMode;
|
||||
|
||||
// ============================
|
||||
// DATA
|
||||
// ============================
|
||||
|
||||
private String mode = null; // Add | Edit
|
||||
private String mode = null;
|
||||
private AppointmentDTO selectedAppointment = null;
|
||||
private Long pendingPetSelectionId = null;
|
||||
|
||||
@@ -60,20 +52,12 @@ public class AppointmentDialogController {
|
||||
"Booked", "Completed", "Cancelled", "Missed"
|
||||
);
|
||||
|
||||
//
|
||||
// MODE
|
||||
//
|
||||
|
||||
public void setMode(String mode) {
|
||||
this.mode = mode;
|
||||
lblMode.setText(mode + " Appointment");
|
||||
lblAppointmentId.setVisible(!mode.equals("Add"));
|
||||
}
|
||||
|
||||
//
|
||||
// INITIALIZE
|
||||
//
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
cbAppointmentStatus.setItems(statusList);
|
||||
@@ -85,14 +69,12 @@ public class AppointmentDialogController {
|
||||
dpAppointmentDate.setValue(LocalDate.now().plusDays(1));
|
||||
cbAppointmentStatus.setValue("Booked");
|
||||
|
||||
// Hours 9 AM - 5 PM
|
||||
for (int i = 9; i <= 17; i++) {
|
||||
cbHour.getItems().add(i);
|
||||
}
|
||||
|
||||
cbMinute.getItems().addAll(0, 15, 30, 45);
|
||||
|
||||
// Show dropdown labels
|
||||
cbService.setCellFactory(param -> new ListCell<>() {
|
||||
@Override
|
||||
protected void updateItem(DropdownOption option, boolean empty) {
|
||||
@@ -175,10 +157,6 @@ public class AppointmentDialogController {
|
||||
loadEmployees();
|
||||
}
|
||||
|
||||
//
|
||||
// DISPLAY FOR EDIT
|
||||
//
|
||||
|
||||
public void displayAppointmentDetails(AppointmentDTO appt) {
|
||||
|
||||
selectedAppointment = appt;
|
||||
@@ -214,10 +192,6 @@ public class AppointmentDialogController {
|
||||
applySelectedEmployee();
|
||||
}
|
||||
|
||||
//
|
||||
// SAVE
|
||||
//
|
||||
|
||||
private void buttonSaveClicked(MouseEvent e) {
|
||||
|
||||
if (cbService.getValue() == null ||
|
||||
@@ -276,10 +250,6 @@ public class AppointmentDialogController {
|
||||
}).start();
|
||||
}
|
||||
|
||||
//
|
||||
// UTIL
|
||||
//
|
||||
|
||||
private void closeStage(MouseEvent e) {
|
||||
Stage stage = (Stage) ((Node) e.getSource()).getScene().getWindow();
|
||||
stage.close();
|
||||
|
||||
Reference in New Issue
Block a user