diff --git a/src/main/java/seedu/address/model/person/Appointment.java b/src/main/java/seedu/address/model/person/Appointment.java index 6e640cc4862..753d0106256 100644 --- a/src/main/java/seedu/address/model/person/Appointment.java +++ b/src/main/java/seedu/address/model/person/Appointment.java @@ -107,4 +107,14 @@ public boolean isSameDate(LocalDate currentDate) { } return value.toLocalDate().equals(currentDate); } + + /** + * Converts the LocalDateTime value of the appointment to a string in the format DD-MM-YYYY HH:MM + * + * @return the formatted date-time string + */ + public String formatDateTime() { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm"); + return this.value.format(formatter); + } } diff --git a/src/main/java/seedu/address/ui/ViewWindow.java b/src/main/java/seedu/address/ui/ViewWindow.java index d9c4032f7c7..7b0f782f490 100644 --- a/src/main/java/seedu/address/ui/ViewWindow.java +++ b/src/main/java/seedu/address/ui/ViewWindow.java @@ -40,6 +40,8 @@ public class ViewWindow extends UiPart { @FXML private Label nric; @FXML + private Label appointment; + @FXML private FlowPane tags; @FXML private VBox logListContainer; @@ -56,6 +58,7 @@ private ViewWindow(Stage root, String feedbackDisplayText, Person person) { email.setText(person.getEmail().value); remark.setText(person.getRemark().value); nric.setText(person.getNric().value); + appointment.setText("Appointment on " + person.getAppointment().formatDateTime()); person.getTags().stream() .sorted(Comparator.comparing(tag -> tag.tagName)) .forEach(tag -> tags.getChildren().add(new Label(tag.tagName))); diff --git a/src/main/resources/view/ViewWindow.fxml b/src/main/resources/view/ViewWindow.fxml index e86463034ce..8265eaacce5 100644 --- a/src/main/resources/view/ViewWindow.fxml +++ b/src/main/resources/view/ViewWindow.fxml @@ -41,6 +41,7 @@