From 0a336f14e4082eb97fb84d9aee047b96bb0ec2ab Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 6 May 2020 16:55:26 +0200 Subject: [PATCH] updated messages about prices --- .../javascripts/controllers/admin/pricing.js.erb | 16 ++++++++++++++++ .../admin/pricing/machine_hours.html.erb | 4 +++- .../templates/admin/pricing/spaces.html.erb | 4 +++- config/locales/app.admin.en.yml | 9 +++++---- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/controllers/admin/pricing.js.erb b/app/assets/javascripts/controllers/admin/pricing.js.erb index 96239941e..7d501e4a0 100644 --- a/app/assets/javascripts/controllers/admin/pricing.js.erb +++ b/app/assets/javascripts/controllers/admin/pricing.js.erb @@ -617,6 +617,22 @@ Application.Controllers.controller('EditPricingController', ['$scope', '$state', }); } + /** + * Return the exemple price based on the configuration of the default slot duration. + * @param type {string} 'hourly_rate' | * + * @returns {number} price for Fablab.slotDuration minutes. + */ + $scope.examplePrice = function(type) { + const hourlyRate = 10; + + if (type === 'hourly_rate') { + return $filter('currency')(hourlyRate); + } + + const price = (hourlyRate / 60) * Fablab.slotDuration; + return $filter('currency')(price); + } + /** * Setup the feature-tour for the admin/pricing page. * This is intended as a contextual help (when pressing F1) diff --git a/app/assets/templates/admin/pricing/machine_hours.html.erb b/app/assets/templates/admin/pricing/machine_hours.html.erb index d8ef5780c..570e935bd 100644 --- a/app/assets/templates/admin/pricing/machine_hours.html.erb +++ b/app/assets/templates/admin/pricing/machine_hours.html.erb @@ -1,5 +1,7 @@
- {{ 'app.admin.pricing.these_prices_match_machine_hours_rates_' | translate:{DURATION:slotDuration} }} {{ 'app.admin.pricing._without_subscriptions' }}. +

+

+

{{ 'app.admin.pricing.you_can_override' }}

diff --git a/app/assets/templates/admin/pricing/spaces.html.erb b/app/assets/templates/admin/pricing/spaces.html.erb index 03675b2e3..41f6d0045 100644 --- a/app/assets/templates/admin/pricing/spaces.html.erb +++ b/app/assets/templates/admin/pricing/spaces.html.erb @@ -1,5 +1,7 @@
- {{ 'app.admin.pricing.these_prices_match_space_hours_rates_' | translate:{DURATION:slotDuration} }} {{ 'app.admin.pricing._without_subscriptions' }}. +

+

+

{{ 'app.admin.pricing.you_can_override' }}

diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index 5e6a265a8..60543d8a2 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -283,8 +283,9 @@ en: prominence: "Prominence" price: "Price" machine_hours: "Machine slots" - these_prices_match_machine_hours_rates_: "These prices match one slot of machine usage (default {DURATION} minutes), " - _without_subscriptions: "without subscriptions" + these_prices_match_machine_hours_rates_html: "The prices below match one hour of machine usage, without subscription." + prices_calculated_on_hourly_rate_html: "All the prices will be automatically calculated based on the hourly rate defined here.
For example, if you define an hourly rate at {RATE}: a slot of {DURATION} minutes (default), will be charged {PRICE}." + you_can_override: "You can override this duration for each availability you create in the agenda. The price will then be adjusted accordingly." machines: "Machines" credits: "Credits" subscription: "Subscription" @@ -337,7 +338,7 @@ en: forever: "Each use" valid_until: "Valid until (included)" spaces: "Spaces" - these_prices_match_space_hours_rates_: "These prices match one slot of space usage (default {DURATION} minutes), " + these_prices_match_space_hours_rates_html: "The prices below match one hour of space usage, without subscription." add_a_space_credit: "Add a Space credit" space: "Space" error_a_credit_linking_this_space_with_that_subscription_already_exists: "Error : a credit linking this space with that subscription already exists." @@ -366,7 +367,7 @@ en: copy_prices_from: "Copy prices from" machines: "Machines" machine: "Machine" - hourly_rate: "Price by slot" + hourly_rate: "Hourly rate" spaces: "Spaces" space: "Space" unable_to_save_subscription_changes_please_try_again: "Unable to save subscription changes. Please try again."