1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

show custom price reservations in admin/events/show reservations

This commit is contained in:
Sylvain 2016-08-29 17:51:11 +02:00
parent 60a8f60be8
commit 8aef50660a
5 changed files with 18 additions and 8 deletions

View File

@ -408,14 +408,13 @@ Application.Controllers.controller "ShowEventController", ["$scope", "$state", "
##
# Return the requested property of the given price's category (name or conditions)
# Return the textual description of the conditions applyable to the given 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.getPriceCategory = (category_id, property = 'name') ->
$scope.getPriceCategoryConditions = (category_id) ->
for cat in $scope.priceCategories
if cat.id == category_id
return cat[property]
return cat.conditions

View File

@ -32,7 +32,10 @@
<a ui-sref="app.logged.members_show({id: reservation.user_id})">{{ reservation.user_full_name }} </a>
</td>
<td>{{ reservation.created_at | amDateFormat:'LL LTS' }}</td>
<td><span ng-if="reservation.nb_reserve_places > 0">{{ 'full_price_' | translate }} {{reservation.nb_reserve_places}}<br/></span><span ng-if="reservation.nb_reserve_reduced_places > 0">{{ 'reduced_rate_' | translate }} {{reservation.nb_reserve_reduced_places}}</span></td>
<td>
<span ng-if="reservation.nb_reserve_places > 0">{{ 'full_price_' | translate }} {{reservation.nb_reserve_places}}<br/></span>
<span ng-repeat="ticket in reservation.tickets">{{ticket.event_price_category.price_category.name}} : {{ticket.booked}}</span>
</td>
<td>
<div class="buttons">
<button class="btn btn-default" ui-sref="app.public.events_show({id: event.id})">

View File

@ -89,7 +89,7 @@
<div class="text-sm" ng-if="event.amount">
<div>{{ 'full_price_' | translate }} <span>{{ event.amount | currency}}</span></div>
<div ng-repeat="price in event.prices" class="description-hover">
<span uib-popover="{{getPriceCategory(price.category.id, 'conditions')}}" popover-trigger="mouseenter">
<span uib-popover="{{getPriceCategoryConditions(price.category.id)}}" popover-trigger="mouseenter">
{{price.category.name}} :
</span>
{{price.amount | currency}}
@ -154,7 +154,7 @@
<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-repeat="ticket in reservation.tickets">
{{getPriceCategory(ticket.event_price_category.price_category_id)}} : {{ticket.booked}} {{ 'ticket' | translate:{NUMBER:ticket.booked}:"messageformat" }}
{{ticket.event_price_category.price_category.name}} : {{ticket.booked}} {{ 'ticket' | translate:{NUMBER:ticket.booked}:"messageformat" }}
</div>
<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>

View File

@ -12,6 +12,9 @@ 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
json.price_category do
json.extract! t.event_price_category.price_category, :id, :name
end
end
end
json.created_at reservation.created_at.iso8601

View File

@ -25,5 +25,10 @@ json.reservable do
json.name @reservation.reservable.name
end
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.price_category do
json.extract! t.event_price_category.price_category, :id, :name
end
end
json.created_at @reservation.created_at.iso8601