Skip to content

Commit

Permalink
Add appointment details to view window of ViewCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic-Khoo committed Nov 7, 2024
1 parent 98890ac commit e465711
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/seedu/address/model/person/Appointment.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Check warning on line 118 in src/main/java/seedu/address/model/person/Appointment.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/model/person/Appointment.java#L117-L118

Added lines #L117 - L118 were not covered by tests
}
}
3 changes: 3 additions & 0 deletions src/main/java/seedu/address/ui/ViewWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public class ViewWindow extends UiPart<Stage> {
@FXML
private Label nric;
@FXML
private Label appointment;
@FXML
private FlowPane tags;
@FXML
private VBox logListContainer;
Expand All @@ -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());

Check warning on line 61 in src/main/java/seedu/address/ui/ViewWindow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/ViewWindow.java#L61

Added line #L61 was not covered by tests
person.getTags().stream()
.sorted(Comparator.comparing(tag -> tag.tagName))
.forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/view/ViewWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<Label fx:id="email" styleClass="label-bright" text="\$email" />
<Label fx:id="remark" styleClass="label-bright" text="\$remark" />
<Label fx:id="nric" styleClass="label-bright" text="\$nric" />
<Label fx:id="appointment" styleClass="label-bright" text="\$appointment" />
</VBox>
</VBox>
<VBox styleClass="pane-with-border">
Expand Down

0 comments on commit e465711

Please sign in to comment.