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

show custom price tickets booked in event show

This commit is contained in:
Sylvain 2016-08-29 16:28:26 +02:00
parent 06d65c785a
commit af883ea1ec
3 changed files with 14 additions and 6 deletions

View File

@ -408,13 +408,14 @@ Application.Controllers.controller "ShowEventController", ["$scope", "$state", "
## ##
# Return the textual description of the conditions applyable to the given price's category # Return the requested property of the given price's category (name or conditions)
# @param category_id {number} ID of the price's category # @param category_id {number} ID of the price's category
# @param [property] {string} name of the field to get, name if undefined
## ##
$scope.getPriceCategoryConditions = (category_id) -> $scope.getPriceCategory = (category_id, property = 'name') ->
for cat in $scope.priceCategories for cat in $scope.priceCategories
if cat.id == category_id if cat.id == category_id
return cat.conditions return cat[property]

View File

@ -89,7 +89,7 @@
<div class="text-sm" ng-if="event.amount"> <div class="text-sm" ng-if="event.amount">
<div>{{ 'full_price_' | translate }} <span>{{ event.amount | currency}}</span></div> <div>{{ 'full_price_' | translate }} <span>{{ event.amount | currency}}</span></div>
<div ng-repeat="price in event.prices" class="description-hover"> <div ng-repeat="price in event.prices" class="description-hover">
<span uib-popover="{{getPriceCategoryConditions(price.category.id)}}" popover-trigger="mouseenter"> <span uib-popover="{{getPriceCategory(price.category.id, 'conditions')}}" popover-trigger="mouseenter">
{{price.category.name}} : {{price.category.name}} :
</span> </span>
{{price.amount | currency}} {{price.amount | currency}}
@ -153,7 +153,9 @@
<div class="well well-warning m-t-sm" ng-if="reservations && !reserve.toReserve" ng-repeat="reservation in reservations"> <div class="well well-warning m-t-sm" ng-if="reservations && !reserve.toReserve" ng-repeat="reservation in reservations">
<div class="font-sbold text-u-c text-sm">{{ 'you_booked_(DATE)' | translate:{DATE:(reservation.created_at | amDateFormat:'L LT')} }}</div> <div class="font-sbold text-u-c text-sm">{{ 'you_booked_(DATE)' | translate:{DATE:(reservation.created_at | amDateFormat:'L LT')} }}</div>
<div class="font-sbold text-sm" ng-if="reservation.nb_reserve_places > 0">{{ 'full_price_' | translate }} {{reservation.nb_reserve_places}} {{ 'ticket' | translate:{NUMBER:reservation.nb_reserve_places}:"messageformat" }}</div> <div class="font-sbold text-sm" ng-if="reservation.nb_reserve_places > 0">{{ 'full_price_' | translate }} {{reservation.nb_reserve_places}} {{ 'ticket' | translate:{NUMBER:reservation.nb_reserve_places}:"messageformat" }}</div>
<div class="font-sbold text-sm" ng-if="reservation.nb_reserve_reduced_places > 0">{{ 'reduced_rate*' | translate }} {{reservation.nb_reserve_reduced_places}} {{ 'ticket' | translate:{NUMBER:reservation.nb_reserve_reduced_places}:"messageformat" }}</div> <div class="font-sbold text-sm" ng-repeat="ticket in reservation.tickets">
{{getPriceCategory(ticket.event_price_category.price_category_id)}} : {{ticket.booked}} {{ 'ticket' | translate:{NUMBER:ticket.booked}:"messageformat" }}
</div>
<div class="clear" ng-if="event.recurrence_events.length > 0 && reservationCanModify(reservation)"> <div class="clear" ng-if="event.recurrence_events.length > 0 && reservationCanModify(reservation)">
<a class="pull-right m-t-xs text-u-l" href="#" ng-click="modifyReservation(reservation, $event)" translate>{{ 'change' }}</a> <a class="pull-right m-t-xs text-u-l" href="#" ng-click="modifyReservation(reservation, $event)" translate>{{ 'change' }}</a>
</div> </div>

View File

@ -8,7 +8,12 @@ json.slots reservation.slots do |s|
json.end_at s.end_at.iso8601 json.end_at s.end_at.iso8601
end end
json.nb_reserve_places reservation.nb_reserve_places json.nb_reserve_places reservation.nb_reserve_places
json.nb_reserve_reduced_places reservation.nb_reserve_reduced_places json.tickets reservation.tickets do |t|
json.extract! t, :booked, :created_at
json.event_price_category do
json.extract! t.event_price_category, :id, :price_category_id
end
end
json.created_at reservation.created_at.iso8601 json.created_at reservation.created_at.iso8601
json.reservable_id reservation.reservable_id json.reservable_id reservation.reservable_id
json.reservable_type reservation.reservable_type json.reservable_type reservation.reservable_type