Skip to content

Commit

Permalink
Update ui to include itinerary budget
Browse files Browse the repository at this point in the history
  • Loading branch information
CFSY committed Oct 25, 2022
1 parent 73c421f commit 7e5b7ed
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/main/java/seedu/waddle/model/itinerary/Budget.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public String toString() {
return String.valueOf(this.initialBudget);
}

public float getBudget() {
public float getValue() {
return this.initialBudget;
}

Expand All @@ -71,7 +71,7 @@ public void setSpending(float amt) {
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof Budget // instanceof handles nulls
&& this.initialBudget == (((Budget) other).getBudget())); // state check
&& this.initialBudget == (((Budget) other).getValue())); // state check
}

@Override
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/seedu/waddle/ui/ItineraryCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import seedu.waddle.model.itinerary.Budget;
import seedu.waddle.model.itinerary.Itinerary;

/**
Expand Down Expand Up @@ -37,6 +38,8 @@ public class ItineraryCard extends UiPart<Region> {
private Label time;
@FXML
private Label people;
@FXML
private Label budget;


/**
Expand All @@ -51,6 +54,13 @@ public ItineraryCard(Itinerary itinerary, int displayedIndex) {
time.setText("Dates: " + itinerary.getTimeString());
duration.setText("Duration: " + itinerary.getDuration().toString() + " Days");
people.setText("Waddlers: " + itinerary.getPeople().numOfPeople);
Budget itineraryBudget = itinerary.getBudget();
if (itineraryBudget.getSpending() == 0) {
budget.setText("Budget: $" + itineraryBudget.getValue());
} else {
budget.setText("Budget: $" + itineraryBudget.getValue() + ", $"
+ itineraryBudget.calculateLeftOverBudget() + " remaining");
}
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/waddle/ui/UiSizes.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
* Standard sizes for UI elements.
*/
public class UiSizes {
public static final double ITEM_CARD_HEIGHT = 130;
public static final double ITEM_CARD_HEIGHT = 140;
public static final double ITEM_LIST_MIN_HEIGHT = 20;
}
1 change: 1 addition & 0 deletions src/main/resources/view/ItineraryListCard.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<Label fx:id="duration" styleClass="cell_small_label" text="\$duration" />
<Label fx:id="time" styleClass="cell_small_label" text="\$time" />
<Label fx:id="people" styleClass="cell_small_label" text="\$people" />
<Label fx:id="budget" styleClass="cell_small_label" text="\$budget" />
</VBox>
</GridPane>
</HBox>

0 comments on commit 7e5b7ed

Please sign in to comment.