diff --git a/app/assets/javascripts/controllers/admin/pricing.coffee.erb b/app/assets/javascripts/controllers/admin/pricing.coffee.erb index 8144075bd..35b69d1c9 100644 --- a/app/assets/javascripts/controllers/admin/pricing.coffee.erb +++ b/app/assets/javascripts/controllers/admin/pricing.coffee.erb @@ -3,8 +3,8 @@ ## # Controller used in the prices edition page ## -Application.Controllers.controller "EditPricingController", ["$scope", "$state", '$uibModal', '$filter', 'TrainingsPricing', 'Credit', 'Pricing', 'Plan', 'Coupon', 'plans', 'groups', 'growl', 'machinesPricesPromise', 'Price', 'dialogs', 'trainingsPricingsPromise', 'trainingsPromise', 'machineCreditsPromise', 'machinesPromise', 'trainingCreditsPromise', 'couponsPromise', '_t' -, ($scope, $state, $uibModal, $filter, TrainingsPricing, Credit, Pricing, Plan, Coupon, plans, groups, growl, machinesPricesPromise, Price, dialogs, trainingsPricingsPromise, trainingsPromise, machineCreditsPromise, machinesPromise, trainingCreditsPromise, couponsPromise, _t) -> +Application.Controllers.controller "EditPricingController", ["$scope", "$state", '$uibModal', '$filter', 'TrainingsPricing', 'Credit', 'Pricing', 'Plan', 'Coupon', 'plans', 'groups', 'growl', 'machinesPricesPromise', 'Price', 'dialogs', 'trainingsPricingsPromise', 'trainingsPromise', 'machineCreditsPromise', 'machinesPromise', 'trainingCreditsPromise', 'couponsPromise', 'spacesPromise', 'spacesPricesPromise', '_t' +, ($scope, $state, $uibModal, $filter, TrainingsPricing, Credit, Pricing, Plan, Coupon, plans, groups, growl, machinesPricesPromise, Price, dialogs, trainingsPricingsPromise, trainingsPromise, machineCreditsPromise, machinesPromise, trainingCreditsPromise, couponsPromise, spacesPromise, spacesPricesPromise, _t) -> ### PUBLIC SCOPE ### ## List of machines prices (not considering any plan) @@ -37,6 +37,12 @@ Application.Controllers.controller "EditPricingController", ["$scope", "$state", ## List of coupons $scope.coupons = couponsPromise + ## List of spaces + $scope.spaces = spacesPromise + + ## List of spaces prices (not considering any plan) + $scope.spacesPrices = spacesPricesPromise + ## The plans list ordering. Default: by group $scope.orderPlans = 'group_id' diff --git a/app/assets/javascripts/router.coffee.erb b/app/assets/javascripts/router.coffee.erb index a7426eb8c..197a60fdc 100644 --- a/app/assets/javascripts/router.coffee.erb +++ b/app/assets/javascripts/router.coffee.erb @@ -824,6 +824,12 @@ angular.module('application.router', ['ui.router']). couponsPromise: ['Coupon', (Coupon) -> Coupon.query().$promise ] + spacesPromise: ['Space', (Space) -> + Space.query().$promise + ] + spacesPricesPromise: ['Price', (Price)-> + Price.query(priceable_type: 'Space', plan_id: 'null').$promise + ] # plans .state 'app.admin.plans', diff --git a/app/assets/templates/admin/pricing/index.html.erb b/app/assets/templates/admin/pricing/index.html.erb index bad193f0f..aa90fd967 100644 --- a/app/assets/templates/admin/pricing/index.html.erb +++ b/app/assets/templates/admin/pricing/index.html.erb @@ -33,6 +33,10 @@ + + + + diff --git a/app/assets/templates/admin/pricing/spaces.html.erb b/app/assets/templates/admin/pricing/spaces.html.erb new file mode 100644 index 000000000..a189ac4c4 --- /dev/null +++ b/app/assets/templates/admin/pricing/spaces.html.erb @@ -0,0 +1,26 @@ +
+ {{ 'pricing.these_prices_match_space_hours_rates_' | translate }} {{ 'pricing._without_subscriptions' }}. +
+ + + + + + + + + + + + + +
{{ 'pricing.spaces' }} + {{group.name}} +
+ {{ space.name }} + + + {{ findPriceBy(spacesPrices, space.id, group.id).amount | currency}} + +
\ No newline at end of file diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index 7f636cb89..91a611c2b 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -199,6 +199,8 @@ en: once: "Just once" forever: "Each use" valid_until: "Valid until (included)" + spaces: "Spaces" + these_prices_match_space_hours_rates_: "These prices match space hours rates" coupons_new: # ajouter un code promotionnel diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml index bd572cd0e..e745e53e0 100644 --- a/config/locales/app.admin.fr.yml +++ b/config/locales/app.admin.fr.yml @@ -199,6 +199,8 @@ fr: once: "Une seule fois" forever: "À chaque utilisation" valid_until: "Valable jusqu'au (inclus)" + spaces: "Espaces" + these_prices_match_space_hours_rates_: "Ces tarifs correspondent au prix d'une heure espace" coupons_new: # ajouter un code promotionnel