From 7de896feb927da478c85c47a89160580a616fa29 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 30 Aug 2016 12:11:51 +0200 Subject: [PATCH] display 'pay' button when booking only custom prices tickets --- app/assets/javascripts/controllers/events.coffee.erb | 4 ++++ app/assets/templates/events/show.html.erb | 9 +++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/controllers/events.coffee.erb b/app/assets/javascripts/controllers/events.coffee.erb index 63311860d..399cb8983 100644 --- a/app/assets/javascripts/controllers/events.coffee.erb +++ b/app/assets/javascripts/controllers/events.coffee.erb @@ -154,6 +154,7 @@ Application.Controllers.controller "ShowEventController", ["$scope", "$state", " tickets: {} toReserve: false amountTotal : 0 + totalSeats: 0 ## Discount coupon to apply to the basket, if any $scope.coupon = @@ -185,6 +186,8 @@ Application.Controllers.controller "ShowEventController", ["$scope", "$state", " remain = $scope.event.nb_free_places - $scope.reserve.nbReservePlaces for ticket of $scope.reserve.tickets remain -= $scope.reserve.tickets[ticket] + # we store the total number of seats booked, this is used to know if the 'pay' button must be shown + $scope.reserve.totalSeats = $scope.event.nb_free_places - remain # update the availables seats for full price tickets fullPriceRemains = $scope.reserve.nbReservePlaces + remain @@ -512,6 +515,7 @@ Application.Controllers.controller "ShowEventController", ["$scope", "$state", " tickets: {} toReserve: false amountTotal : 0 + totalSeats: 0 for evt_px_cat in $scope.event.prices $scope.reserve.nbPlaces[evt_px_cat.id] = [0..$scope.event.nb_free_places] diff --git a/app/assets/templates/events/show.html.erb b/app/assets/templates/events/show.html.erb index 790e2f962..9c3c81c8e 100644 --- a/app/assets/templates/events/show.html.erb +++ b/app/assets/templates/events/show.html.erb @@ -164,23 +164,20 @@ - + - -