From c86219062e481244ec9abbb3409a7f184d716c3a Mon Sep 17 00:00:00 2001 From: Celestino Bellone Date: Thu, 6 Aug 2015 17:05:55 +0200 Subject: [PATCH] #66 - sort categories by status --- .../alfio/controller/EventController.java | 4 +- .../WEB-INF/templates/event/show-event.ms | 78 ++----------------- .../templates/event/ticket-category.ms | 72 +++++++++++++++++ 3 files changed, 80 insertions(+), 74 deletions(-) create mode 100644 src/main/webapp/WEB-INF/templates/event/ticket-category.ms diff --git a/src/main/java/alfio/controller/EventController.java b/src/main/java/alfio/controller/EventController.java index c882dcab6b..35c070518c 100644 --- a/src/main/java/alfio/controller/EventController.java +++ b/src/main/java/alfio/controller/EventController.java @@ -27,6 +27,7 @@ import alfio.model.Event; import alfio.model.PromoCodeDiscount; import alfio.model.SpecialPrice; +import alfio.model.TicketCategory; import alfio.model.modification.TicketReservationWithOptionalCodeModification; import alfio.model.modification.support.LocationDescriptor; import alfio.model.system.Configuration; @@ -197,7 +198,8 @@ public String showEvent(@PathVariable("eventName") String eventName, final EventDescriptor eventDescriptor = new EventDescriptor(event); model.addAttribute("event", eventDescriptor)// .addAttribute("organizer", organizationRepository.getById(event.getOrganizationId())) - .addAttribute("ticketCategories", ticketCategories)// + .addAttribute("ticketCategories", ticketCategories.stream().filter(tc -> !tc.getExpired()).collect(Collectors.toList()))// + .addAttribute("expiredCategories", ticketCategories.stream().filter(SaleableTicketCategory::getExpired).collect(Collectors.toList()))// .addAttribute("hasAccessPromotions", hasAccessPromotions) .addAttribute("promoCode", specialCode.map(SpecialPrice::getCode).orElse(null)) .addAttribute("locationDescriptor", ld) diff --git a/src/main/webapp/WEB-INF/templates/event/show-event.ms b/src/main/webapp/WEB-INF/templates/event/show-event.ms index 04a5bd0f62..89bbae331b 100644 --- a/src/main/webapp/WEB-INF/templates/event/show-event.ms +++ b/src/main/webapp/WEB-INF/templates/event/show-event.ms @@ -48,7 +48,7 @@
-
+
{{event.description}}
@@ -114,79 +114,11 @@
    {{#ticketCategories}} -
  • -
    -
    - - {{^expired}} -
    - {{#saleInFuture}} - {{#i18n}}show-event.sales-not-started{{/i18n}} - {{/saleInFuture}} - {{^saleInFuture}} - {{#i18n}}show-event.sales-end [{{#format-date}}{{zonedExpiration}} dd.MM.yyyy HH:mm locale:{{#i18n}}locale{{/i18n}}{{/format-date}}]{{/i18n}} - {{/saleInFuture}} -
    - {{/expired}} - {{#expired}} -
    - {{#i18n}}show-event.sales-ended [{{#format-date}}{{zonedExpiration}} dd.MM.yyyy HH:mm locale:{{#i18n}}locale{{/i18n}}{{/format-date}}]{{/i18n}} -
    - {{/expired}} -
    - {{description}} -
    -
    -
    - -
    -
    - {{#saleable}} - - - {{/saleable}} - {{^saleable}} - - {{/saleable}} -
    -
    -
  • + {{> /event/ticket-category.ms }} {{/ticketCategories}} + {{#expiredCategories}} + {{> /event/ticket-category.ms }} + {{/expiredCategories}}
{{#hasPromoCodeDiscount}} diff --git a/src/main/webapp/WEB-INF/templates/event/ticket-category.ms b/src/main/webapp/WEB-INF/templates/event/ticket-category.ms new file mode 100644 index 0000000000..2d7f5faaf6 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/event/ticket-category.ms @@ -0,0 +1,72 @@ +
  • +
    +
    + + {{^expired}} +
    + {{#saleInFuture}} + {{#i18n}}show-event.sales-not-started{{/i18n}} + {{/saleInFuture}} + {{^saleInFuture}} + {{#i18n}}show-event.sales-end [{{#format-date}}{{zonedExpiration}} dd.MM.yyyy HH:mm locale:{{#i18n}}locale{{/i18n}}{{/format-date}}]{{/i18n}} + {{/saleInFuture}} +
    + {{/expired}} + {{#expired}} +
    + {{#i18n}}show-event.sales-ended [{{#format-date}}{{zonedExpiration}} dd.MM.yyyy HH:mm locale:{{#i18n}}locale{{/i18n}}{{/format-date}}]{{/i18n}} +
    + {{/expired}} +
    + {{description}} +
    +
    +
    + +
    +
    + {{#saleable}} + + + {{/saleable}} + {{^saleable}} + + {{/saleable}} +
    +
    +
  • \ No newline at end of file