mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-06 01:08:21 +01:00
ability to edit event with custom prices
This commit is contained in:
parent
7dc359e4ee
commit
5d91756ace
@ -126,6 +126,17 @@ class EventsController
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
# Initialize a new price item in the additional prices list
|
||||||
|
##
|
||||||
|
$scope.addPrice = ->
|
||||||
|
$scope.event.prices.push({
|
||||||
|
category: null,
|
||||||
|
amount: null,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Controller used in the events listing page (admin view)
|
# Controller used in the events listing page (admin view)
|
||||||
##
|
##
|
||||||
@ -393,9 +404,6 @@ Application.Controllers.controller "NewEventController", ["$scope", "$state", "$
|
|||||||
## List of availables price's categories
|
## List of availables price's categories
|
||||||
$scope.priceCategories = priceCategoriesPromise
|
$scope.priceCategories = priceCategoriesPromise
|
||||||
|
|
||||||
## List of additional prices for the event
|
|
||||||
$scope.prices = []
|
|
||||||
|
|
||||||
## Default event parameters
|
## Default event parameters
|
||||||
$scope.event =
|
$scope.event =
|
||||||
event_files_attributes: []
|
event_files_attributes: []
|
||||||
@ -406,6 +414,7 @@ Application.Controllers.controller "NewEventController", ["$scope", "$state", "$
|
|||||||
all_day: 'false'
|
all_day: 'false'
|
||||||
recurrence: 'none'
|
recurrence: 'none'
|
||||||
category_id: null
|
category_id: null
|
||||||
|
prices: []
|
||||||
|
|
||||||
## Possible types of recurrences for an event
|
## Possible types of recurrences for an event
|
||||||
$scope.recurrenceTypes = [
|
$scope.recurrenceTypes = [
|
||||||
@ -420,17 +429,6 @@ Application.Controllers.controller "NewEventController", ["$scope", "$state", "$
|
|||||||
$scope.currencySymbol = $locale.NUMBER_FORMATS.CURRENCY_SYM;
|
$scope.currencySymbol = $locale.NUMBER_FORMATS.CURRENCY_SYM;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##
|
|
||||||
# Initialize a new price item in the additional prices list
|
|
||||||
##
|
|
||||||
$scope.addPrice = ->
|
|
||||||
$scope.prices.push({
|
|
||||||
category: null,
|
|
||||||
amount: null,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
## Using the EventsController
|
## Using the EventsController
|
||||||
new EventsController($scope, $state)
|
new EventsController($scope, $state)
|
||||||
]
|
]
|
||||||
@ -440,8 +438,8 @@ Application.Controllers.controller "NewEventController", ["$scope", "$state", "$
|
|||||||
##
|
##
|
||||||
# Controller used in the events edition page
|
# Controller used in the events edition page
|
||||||
##
|
##
|
||||||
Application.Controllers.controller "EditEventController", ["$scope", "$state", "$stateParams", "$locale", 'CSRF', 'eventPromise', 'categoriesPromise', 'themesPromise', 'ageRangesPromise'
|
Application.Controllers.controller "EditEventController", ["$scope", "$state", "$stateParams", "$locale", 'CSRF', 'eventPromise', 'categoriesPromise', 'themesPromise', 'ageRangesPromise', 'priceCategoriesPromise'
|
||||||
, ($scope, $state, $stateParams, $locale, CSRF, eventPromise, categoriesPromise, themesPromise, ageRangesPromise) ->
|
, ($scope, $state, $stateParams, $locale, CSRF, eventPromise, categoriesPromise, themesPromise, ageRangesPromise, priceCategoriesPromise) ->
|
||||||
|
|
||||||
### PUBLIC SCOPE ###
|
### PUBLIC SCOPE ###
|
||||||
|
|
||||||
@ -462,6 +460,9 @@ Application.Controllers.controller "EditEventController", ["$scope", "$state", "
|
|||||||
## List of categories for the events
|
## List of categories for the events
|
||||||
$scope.categories = categoriesPromise
|
$scope.categories = categoriesPromise
|
||||||
|
|
||||||
|
## List of availables price's categories
|
||||||
|
$scope.priceCategories = priceCategoriesPromise
|
||||||
|
|
||||||
## List of events themes
|
## List of events themes
|
||||||
$scope.themes = themesPromise
|
$scope.themes = themesPromise
|
||||||
|
|
||||||
|
@ -700,6 +700,9 @@ angular.module('application.router', ['ui.router']).
|
|||||||
ageRangesPromise: ['AgeRange', (AgeRange) ->
|
ageRangesPromise: ['AgeRange', (AgeRange) ->
|
||||||
AgeRange.query().$promise
|
AgeRange.query().$promise
|
||||||
]
|
]
|
||||||
|
priceCategoriesPromise: ['PriceCategory', (PriceCategory) ->
|
||||||
|
PriceCategory.query().$promise
|
||||||
|
]
|
||||||
translations: [ 'Translations', (Translations) ->
|
translations: [ 'Translations', (Translations) ->
|
||||||
Translations.query(['app.admin.events_edit', 'app.shared.event']).$promise
|
Translations.query(['app.admin.events_edit', 'app.shared.event']).$promise
|
||||||
]
|
]
|
||||||
|
@ -237,7 +237,7 @@
|
|||||||
<span class="help-block" translate>{{ '0_=_free' }}</span>
|
<span class="help-block" translate>{{ '0_=_free' }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" ng-repeat="price in prices">
|
<div class="form-group" ng-repeat="price in event.prices">
|
||||||
<div class="col-sm-5">
|
<div class="col-sm-5">
|
||||||
<select class="form-control"
|
<select class="form-control"
|
||||||
ng-model="price.category"
|
ng-model="price.category"
|
||||||
@ -256,7 +256,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="link-icon m-b" ng-hide="prices.length == priceCategories.length">
|
<div class="link-icon m-b" ng-hide="event.prices.length == priceCategories.length">
|
||||||
<div class="col-sm-offset-5">
|
<div class="col-sm-offset-5">
|
||||||
<i class="fa fa-plus"></i> <span ng-click="addPrice()">Ajouter un tarif</span>
|
<i class="fa fa-plus"></i> <span ng-click="addPrice()">Ajouter un tarif</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -122,7 +122,6 @@
|
|||||||
<span ng-if="!event.nb_total_places" translate>{{ 'free_entry' }}</span>
|
<span ng-if="!event.nb_total_places" translate>{{ 'free_entry' }}</span>
|
||||||
<span ng-if="event.nb_total_places && event.amount == 0" translate>{{ 'free_admission' }}</span>
|
<span ng-if="event.nb_total_places && event.amount == 0" translate>{{ 'free_admission' }}</span>
|
||||||
<span ng-if="event.amount > 0">{{event.amount | currency}} {{ 'full_price' | translate }}</span>
|
<span ng-if="event.amount > 0">{{event.amount | currency}} {{ 'full_price' | translate }}</span>
|
||||||
<span ng-if="event.reduced_amount > 0"><br/>{{event.reduced_amount | currency}} {{ 'reduced_rate' | translate }}</span>
|
|
||||||
<div ng-if="event.nb_free_places == 0"><span class="badge font-sbold bg-red" translate>{{ 'event_full' }}</span></div>
|
<div ng-if="event.nb_free_places == 0"><span class="badge font-sbold bg-red" translate>{{ 'event_full' }}</span></div>
|
||||||
</h6>
|
</h6>
|
||||||
|
|
||||||
|
@ -33,7 +33,13 @@ json.availability do
|
|||||||
end
|
end
|
||||||
json.availability_id event.availability_id
|
json.availability_id event.availability_id
|
||||||
json.amount (event.amount / 100.0) if event.amount
|
json.amount (event.amount / 100.0) if event.amount
|
||||||
json.reduced_amount (event.reduced_amount / 100.0) if event.reduced_amount
|
json.prices event.event_price_categories do |p_cat|
|
||||||
|
json.id p_cat.id
|
||||||
|
json.amount (p_cat.amount / 100.0)
|
||||||
|
json.category do
|
||||||
|
json.extract! p_cat.price_category, :id, :name
|
||||||
|
end
|
||||||
|
end
|
||||||
json.nb_total_places event.nb_total_places
|
json.nb_total_places event.nb_total_places
|
||||||
json.nb_free_places event.nb_free_places || event.nb_total_places
|
json.nb_free_places event.nb_free_places || event.nb_total_places
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user