diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e60da7c1..1e434e326 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ - Enabled Hot module replacement - Enlarged privacy policy display and edition zones - Removed fab-manager email address from the seeds +- Initialize new plans with default prices for machines & spaces +- Display a message when no plans are available - Fix a bug: in the settings area, boolean switches are always shown as false - Fix a bug: public cards presenting the plans in the public area, have bogus style - Updated stripe gem to 5.21.0 diff --git a/app/frontend/templates/plans/index.html b/app/frontend/templates/plans/index.html index 3575b5623..74c3abdf5 100644 --- a/app/frontend/templates/plans/index.html +++ b/app/frontend/templates/plans/index.html @@ -17,61 +17,65 @@
-
+
-
-

{{plansGroup.name}}

-
-
-
+
+
+

{{plansGroup.name}}

+
+
+
- -
+ +
-

{{ plan.base_name }}

+

{{ plan.base_name }}

-
-
-
-
{{plan.amount | currency}}
- {{ plan.interval | planIntervalFilter: plan.interval_count }} +
+
+
+
{{plan.amount | currency}}
+ {{ plan.interval | planIntervalFilter: plan.interval_count }} +
-
-
- +
+ - + -
+
-
- -
+
+ +
-
- {{ 'app.public.plans.more_information' }} +
+ {{ 'app.public.plans.more_information' }} +
+
+ + +
+ + {{ 'app.public.plans.your_subscription_expires_on_the_DATE' | translate:{DATE:(ctrl.member.subscription.expired_at | amDateFormat:'L' )} }} +
- - -
- - {{ 'app.public.plans.your_subscription_expires_on_the_DATE' | translate:{DATE:(ctrl.member.subscription.expired_at | amDateFormat:'L' )} }} - -
- +
+
+ {{ 'app.public.plans.no_plans' }}
diff --git a/app/models/plan.rb b/app/models/plan.rb index cc108cb81..1316c4452 100644 --- a/app/models/plan.rb +++ b/app/models/plan.rb @@ -59,13 +59,15 @@ class Plan < ApplicationRecord def create_machines_prices Machine.all.each do |machine| - Price.create(priceable: machine, plan: self, group_id: group_id, amount: 0) + default_price = Price.find_by(priceable: machine, plan: nil, group_id: group_id)&.amount || 0 + Price.create(priceable: machine, plan: self, group_id: group_id, amount: default_price) end end def create_spaces_prices Space.all.each do |space| - Price.create(priceable: space, plan: self, group_id: group_id, amount: 0) + default_price = Price.find_by(priceable: space, plan: nil, group_id: group_id)&.amount || 0 + Price.create(priceable: space, plan: self, group_id: group_id, amount: default_price) end end diff --git a/config/locales/app.public.en.yml b/config/locales/app.public.en.yml index efbc65756..2442f1ff9 100644 --- a/config/locales/app.public.en.yml +++ b/config/locales/app.public.en.yml @@ -240,6 +240,7 @@ en: i_already_subscribed: "I already subscribed" more_information: "More information" your_subscription_expires_on_the_DATE: "Your subscription expires on the {DATE}" + no_plans: "No plans are available for your group" my_group: "My group" his_group: "{GENDER, select, male{His} female{Her} other{Its}} group" he_wants_to_change_group: "{ROLE, select, member{I want} other{The user wants}} to change group" diff --git a/config/locales/app.public.fr.yml b/config/locales/app.public.fr.yml index e2b5000d0..54a7308fe 100644 --- a/config/locales/app.public.fr.yml +++ b/config/locales/app.public.fr.yml @@ -240,6 +240,7 @@ fr: i_already_subscribed: "Je suis déjà abonné" more_information: "Plus d'infos" your_subscription_expires_on_the_DATE: "Votre abonnement expire au {DATE}" + no_plans: "Aucun abonnement n'est disponible pour votre groupe" my_group: "Mon groupe" his_group: "Son groupe" he_wants_to_change_group: "{ROLE, select, member{Je veux} other{L'utilisateur veut}} changer de groupe"