From c4b8b7014f48eeffca1c59709fae813ba9a3c5d0 Mon Sep 17 00:00:00 2001 From: Sylvain Jermini Date: Fri, 18 Aug 2017 16:29:38 +0200 Subject: [PATCH] #328 add admin ui/trim code to null --- src/main/java/alfio/manager/EventManager.java | 2 +- .../admin/partials/event/detail.html | 22 +++++++++++++------ .../event/fragment/edit-category.html | 14 ++++++++++++ .../js/admin/directive/admin-directive.js | 2 ++ .../js/admin/ng-app/admin-application.js | 2 ++ 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/main/java/alfio/manager/EventManager.java b/src/main/java/alfio/manager/EventManager.java index be82c5f0e0..4284bd1e85 100644 --- a/src/main/java/alfio/manager/EventManager.java +++ b/src/main/java/alfio/manager/EventManager.java @@ -551,7 +551,7 @@ private void updateCategory(TicketCategoryModification tc, boolean freeOfCharge, final int price = evaluatePrice(tc.getPriceInCents(), freeOfCharge); TicketCategory original = ticketCategoryRepository.getById(tc.getId(), eventId); ticketCategoryRepository.update(tc.getId(), tc.getName(), tc.getInception().toZonedDateTime(zoneId), - tc.getExpiration().toZonedDateTime(zoneId), tc.getMaxTickets(), tc.isTokenGenerationRequested(), price, tc.getCode()); + tc.getExpiration().toZonedDateTime(zoneId), tc.getMaxTickets(), tc.isTokenGenerationRequested(), price, StringUtils.trimToNull(tc.getCode())); TicketCategory updated = ticketCategoryRepository.getById(tc.getId(), eventId); int addedTickets = 0; if(original.isBounded() ^ tc.isBounded()) { diff --git a/src/main/webapp/resources/angular-templates/admin/partials/event/detail.html b/src/main/webapp/resources/angular-templates/admin/partials/event/detail.html index 084e14ae5e..8aaf80b0b0 100644 --- a/src/main/webapp/resources/angular-templates/admin/partials/event/detail.html +++ b/src/main/webapp/resources/angular-templates/admin/partials/event/detail.html @@ -36,7 +36,7 @@
Here the categories that have been defined for this event No categories matching the selected criteria have been found.
-
@@ -89,28 +89,36 @@
Here the categories that have been defined for this event
-
+
-
Max tickets
+
Max tickets
{{::ticketCategory.maxTickets}}
dynamic
-
Initial sale date
+
Initial sale date
{{::ticketCategory.formattedInception | formatDate}}
-
End sale date
+
End sale date
{{::ticketCategory.formattedExpiration | formatDate}}
-
Price
+
Price
{{::ticketCategory.price | currency : (event.currency || "")}}
-
Final price
+
Final price
{{::ticketCategory.actualPrice | currency : (event.currency || "")}}
+
+
Category code
+
{{::ticketCategory.code}}
+
+
+
Category code url
+
{{::baseUrl}}/event/{{::event.shortName}}/code/{{::ticketCategory.code}}
+
diff --git a/src/main/webapp/resources/angular-templates/admin/partials/event/fragment/edit-category.html b/src/main/webapp/resources/angular-templates/admin/partials/event/fragment/edit-category.html index f721787fe9..dfb62b4520 100644 --- a/src/main/webapp/resources/angular-templates/admin/partials/event/fragment/edit-category.html +++ b/src/main/webapp/resources/angular-templates/admin/partials/event/fragment/edit-category.html @@ -114,6 +114,20 @@

Category visibility:

+
+
+
+ + +
+
+
+ +

+ {{baseUrl}}/event/{{event.shortName}}/code/{{ticketCategory.code}} +

+
+
diff --git a/src/main/webapp/resources/js/admin/directive/admin-directive.js b/src/main/webapp/resources/js/admin/directive/admin-directive.js index 96d875b494..e75b65dafa 100644 --- a/src/main/webapp/resources/js/admin/directive/admin-directive.js +++ b/src/main/webapp/resources/js/admin/directive/admin-directive.js @@ -511,6 +511,8 @@ return angular.isDefined(index) ? index + "-" + name : name; } + $scope.baseUrl = window.location.origin; + $scope.isLanguagePresent = function(locales, value) { return (locales & value) === value; } diff --git a/src/main/webapp/resources/js/admin/ng-app/admin-application.js b/src/main/webapp/resources/js/admin/ng-app/admin-application.js index 476d0057a9..bae032ad47 100644 --- a/src/main/webapp/resources/js/admin/ng-app/admin-application.js +++ b/src/main/webapp/resources/js/admin/ng-app/admin-application.js @@ -627,6 +627,7 @@ }; }); }; + $scope.baseUrl = window.location.origin; loadData().then(function() { initScopeForEventEditing($scope, OrganizationService, PaymentProxyService, LocationService, EventService, $state, PAYMENT_PROXY_DESCRIPTIONS); }); @@ -899,6 +900,7 @@ description: category.description, maxTickets: category.maxTickets, bounded: category.bounded, + code: category.code, inception: { date: inception.format('YYYY-MM-DD'), time: inception.format('HH:mm')