From 14ebb4795bbb6951d8170209bc925fc001f9833e Mon Sep 17 00:00:00 2001 From: eugene teu Date: Mon, 4 Nov 2019 22:51:24 +0800 Subject: [PATCH 1/2] add to sample order util, add showing of Customer Tags --- .../address/model/util/SampleDataUtil.java | 35 ++++++++++++++++++- .../address/ui/cards/ArchivedOrderCard.java | 7 ++++ .../seedu/address/ui/cards/OrderCard.java | 8 +++++ .../resources/view/ArchivedOrderListCard.fxml | 4 +++ src/main/resources/view/OrderListCard.fxml | 4 +++ src/main/resources/view/SMLTheme.css | 10 ++++++ 6 files changed, 67 insertions(+), 1 deletion(-) diff --git a/src/main/java/seedu/address/model/util/SampleDataUtil.java b/src/main/java/seedu/address/model/util/SampleDataUtil.java index 6e349426c88..45a5ececc1f 100644 --- a/src/main/java/seedu/address/model/util/SampleDataUtil.java +++ b/src/main/java/seedu/address/model/util/SampleDataUtil.java @@ -203,7 +203,27 @@ Capacity.SIZE_256GB, new Colour("Black"), new Cost("$95"), getTagSet("New")), new Price("$1200"), Status.CANCELLED, - Optional.of(sampleSchedule3()), getTagSet("New")) + Optional.of(sampleSchedule3()), getTagSet("New")), + new Order(UUID.randomUUID(), + new Customer(new CustomerName("Tao Nan"), new ContactNumber("12345678"), + new Email("TaoNan@example.com"), getTagSet("bigCustomer")), + new Phone(new IdentityNumber("352039475644270"), + new SerialNumber("2ncs89ma"), new PhoneName("Galaxy apollo 20"), new Brand("NotApple"), + Capacity.SIZE_256GB, new Colour("Black"), new Cost("$900.02"), + getTagSet("New")), + new Price("$1911.32"), + Status.COMPLETED, + Optional.of(sampleSchedule4(01,23)), getTagSet("New")), + new Order(UUID.randomUUID(), + new Customer(new CustomerName("Tao tan"), new ContactNumber("01234323"), + new Email("Taotan@example.com"), getTagSet("smallCustomer")), + new Phone(new IdentityNumber("182043475644270"), + new SerialNumber("2ncs90ma"), new PhoneName("Galaxy apollo 19"), new Brand("NotApple"), + Capacity.SIZE_256GB, new Colour("Black"), new Cost("$800.10"), + getTagSet("New")), + new Price("$2900.32"), + Status.COMPLETED, + Optional.of(sampleSchedule4(04,15)), getTagSet("New")), }; } @@ -240,6 +260,19 @@ private static Schedule sampleSchedule3() { getTagSet("New")); } + /** + *Return sample Schedule object + */ + private static Schedule sampleSchedule4(int month, int day) { + return new Schedule( + UUID.randomUUID(), + new Calendar.Builder().setDate(2019, month, day).build(), + new Venue("test venue"), + getTagSet("New")); + } + + + public static ReadOnlyDataBook getSampleOrderBook() { diff --git a/src/main/java/seedu/address/ui/cards/ArchivedOrderCard.java b/src/main/java/seedu/address/ui/cards/ArchivedOrderCard.java index f718881de2d..64770dd0bb8 100644 --- a/src/main/java/seedu/address/ui/cards/ArchivedOrderCard.java +++ b/src/main/java/seedu/address/ui/cards/ArchivedOrderCard.java @@ -60,6 +60,8 @@ public class ArchivedOrderCard extends UiPart { private FlowPane tags; @FXML private FlowPane scheduleTags; + @FXML + private FlowPane customerTags; public ArchivedOrderCard(Order order, int displayedIndex) { super(FXML); @@ -98,6 +100,11 @@ public ArchivedOrderCard(Order order, int displayedIndex) { order.getSchedule().get().getTags().stream().sorted(Comparator.comparing(tag -> tag.tagName)) .forEach(tag -> scheduleTags.getChildren().add(new Label(tag.tagName))); } + if (order.getCustomer() != null) { + order.getCustomer().getTags().stream() + .sorted(Comparator.comparing(tag -> tag.tagName)) + .forEach(tag -> customerTags.getChildren().add(new Label(tag.tagName))); + } order.getTags().stream() .sorted(Comparator.comparing(tag -> tag.tagName)) diff --git a/src/main/java/seedu/address/ui/cards/OrderCard.java b/src/main/java/seedu/address/ui/cards/OrderCard.java index 8e2e32ef8db..5068648d15d 100644 --- a/src/main/java/seedu/address/ui/cards/OrderCard.java +++ b/src/main/java/seedu/address/ui/cards/OrderCard.java @@ -60,6 +60,8 @@ public class OrderCard extends UiPart { private FlowPane tags; @FXML private FlowPane scheduleTags; + @FXML + private FlowPane customerTags; public OrderCard(Order order, int displayedIndex) { super(FXML); @@ -92,6 +94,12 @@ public OrderCard(Order order, int displayedIndex) { order.getSchedule().get().getTags().stream().sorted(Comparator.comparing(tag -> tag.tagName)) .forEach(tag -> scheduleTags.getChildren().add(new Label(tag.tagName))); } + + if (order.getCustomer() != null) { + order.getCustomer().getTags().stream() + .sorted(Comparator.comparing(tag -> tag.tagName)) + .forEach(tag -> customerTags.getChildren().add(new Label(tag.tagName))); + } order.getTags().stream() .sorted(Comparator.comparing(tag -> tag.tagName)) .forEach(tag -> tags.getChildren().add(new Label(tag.tagName))); diff --git a/src/main/resources/view/ArchivedOrderListCard.fxml b/src/main/resources/view/ArchivedOrderListCard.fxml index ed7764a185c..1e1e260a68c 100644 --- a/src/main/resources/view/ArchivedOrderListCard.fxml +++ b/src/main/resources/view/ArchivedOrderListCard.fxml @@ -91,6 +91,10 @@