Skip to content

Commit

Permalink
#328 add admin ui/trim code to null
Browse files Browse the repository at this point in the history
  • Loading branch information
syjer committed Aug 18, 2017
1 parent c19934f commit c4b8b70
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main/java/alfio/manager/EventManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h5 class="text-muted">Here the categories that have been defined for this event
No categories matching the selected criteria have been found.
</div>
<div data-ng-switch-default="">
<div class="panel panel-default" data-ng-repeat="ticketCategory in event.ticketCategories | orderBy: ['formattedInception'] | showSelectedCategories : selection"
<div class="panel panel-default" data-ng-repeat="ticketCategory in event.ticketCategories | orderBy: ['formattedInception', 'id'] | showSelectedCategories : selection"
data-ng-class="{'panel-danger':ticketCategory.containingOrphans, 'panel-warning':ticketCategory.containingStuckTickets}"
data-ng-init="displayWarning = ticketCategory.containingStuckTickets || ticketCategory.containingOrphans"
id="ticket-category-{{ticketCategory.id}}">
Expand Down Expand Up @@ -89,28 +89,36 @@ <h5 class="text-muted">Here the categories that have been defined for this event
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-5">
<div class="col-xs-12 col-md-12">
<div class="row">
<div class="col-sm-4"><strong>Max tickets</strong></div>
<div class="col-sm-2"><strong>Max tickets</strong></div>
<div class="col-sm-8" data-ng-if="ticketCategory.bounded">{{::ticketCategory.maxTickets}}</div>
<div class="col-sm-8" data-ng-if="!ticketCategory.bounded">dynamic</div>
</div>
<div class="row">
<div class="col-sm-4"><strong>Initial sale date</strong></div>
<div class="col-sm-2"><strong>Initial sale date</strong></div>
<div class="col-sm-8">{{::ticketCategory.formattedInception | formatDate}} </div>
</div>
<div class="row">
<div class="col-sm-4"><strong>End sale date</strong></div>
<div class="col-sm-2"><strong>End sale date</strong></div>
<div class="col-sm-8">{{::ticketCategory.formattedExpiration | formatDate}} </div>
</div>
<div class="row" data-ng-if="!event.freeOfCharge">
<div class="col-sm-4"><strong>Price</strong></div>
<div class="col-sm-2"><strong>Price</strong></div>
<div class="col-sm-8">{{::ticketCategory.price | currency : (event.currency || "")}}</div>
</div>
<div class="row" data-ng-if="!event.freeOfCharge">
<div class="col-sm-4"><strong>Final price</strong></div>
<div class="col-sm-2"><strong>Final price</strong></div>
<div class="col-sm-8">{{::ticketCategory.actualPrice | currency : (event.currency || "")}}</div>
</div>
<div class="row" ng-if="ticketCategory.code && ticketCategory.code.length > 0">
<div class="col-sm-2"><strong>Category code</strong></div>
<div class="col-sm-8">{{::ticketCategory.code}}</div>
</div>
<div class="row" ng-if="ticketCategory.code && ticketCategory.code.length > 0">
<div class="col-sm-2"><strong>Category code url</strong></div>
<div class="col-sm-8">{{::baseUrl}}/event/{{::event.shortName}}/code/{{::ticketCategory.code}}</div>
</div>
</div>
<div class="col-md-7 hidden-xs"><p class="text-muted" data-ng-repeat="(lang, desc) in ticketCategory.description" title="{{lang}}"><display-commonmark-preview text="desc"></display-commonmark-preview> {{desc}}</p></div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,20 @@ <h4>Category visibility:</h4>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 col-md-4">
<div class="form-group" bs-form-error="ticketCategory.code">
<label for="{{buildPrefix($index, 'code')}}">Category code</label>
<input type="text" ng-model="ticketCategory.code" id="{{buildPrefix($index, 'code')}}" name="{{buildPrefix($index, 'code')}}" class="form-control" >
</div>
</div>
<div class="col-sm-12 col-md-8" ng-if="ticketCategory.code && ticketCategory.code.length > 0">
<label>Access url</label>
<p class="form-control-static">
{{baseUrl}}/event/{{event.shortName}}/code/{{ticketCategory.code}}
</p>
</div>
</div>
<div class="row">
<div data-ng-repeat="(lang, language) in allLanguagesMapping" class="col-sm-6 col-md-4">
<div data-ng-if="isLanguagePresent(event.locales, language.value)" class="form-group">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@
};
});
};
$scope.baseUrl = window.location.origin;
loadData().then(function() {
initScopeForEventEditing($scope, OrganizationService, PaymentProxyService, LocationService, EventService, $state, PAYMENT_PROXY_DESCRIPTIONS);
});
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit c4b8b70

Please sign in to comment.