1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00

display 'pay' button when booking only custom prices tickets

This commit is contained in:
Sylvain 2016-08-30 12:11:51 +02:00
parent feda4861f2
commit 7de896feb9
2 changed files with 7 additions and 6 deletions

View File

@ -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]

View File

@ -164,23 +164,20 @@
<button class="btn btn-warning-full rounded btn-block text-sm" ng-click="reserveEvent()" ng-show="event.nb_free_places > 0 && !reserve.toReserve">{{ 'book' | translate }}</button>
<coupon show="(reserve.nbReservePlaces > 0 || reserve.nbReserveReducedPlaces > 0) && ctrl.member" coupon="coupon.applied" user-id="{{ctrl.member.id}}"></coupon>
<coupon show="reserve.totalSeats > 0 && ctrl.member" coupon="coupon.applied" user-id="{{ctrl.member.id}}"></coupon>
</div>
</div>
<div class="panel-footer no-padder ng-scope" ng-if="event.amount">
<button class="btn btn-valid btn-info btn-block p-l btn-lg text-u-c r-b text-base" ng-click="payEvent()" ng-if="reserve.nbReservePlaces > 0 || reserve.nbReserveReducedPlaces > 0">{{ 'confirm_and_pay' | translate }} {{reserve.amountTotal | currency}}</button>
<button class="btn btn-valid btn-info btn-block p-l btn-lg text-u-c r-b text-base" ng-click="payEvent()" ng-if="reserve.totalSeats > 0">{{ 'confirm_and_pay' | translate }} {{reserve.amountTotal | currency}}</button>
</div>
<div class="panel-footer no-padder ng-scope" ng-if="event.amount == 0">
<button class="btn btn-valid btn-info btn-block p-l btn-lg text-u-c r-b text-base" ng-click="validReserveEvent()" ng-if="reserve.nbReservePlaces > 0 || reserve.nbReserveReducedPlaces > 0" ng-disabled="attempting">{{ 'confirm' | translate }}</button>
<button class="btn btn-valid btn-info btn-block p-l btn-lg text-u-c r-b text-base" ng-click="validReserveEvent()" ng-if="reserve.totalSeats > 0" ng-disabled="attempting">{{ 'confirm' | translate }}</button>
</div>
</section>
<div ng-if="event.reduced_amount" ng-bind-html="reducedAmountAlert" class="alert alert-warning text-sm m" role="alert">
</div>
</div>
</div>