From 1380de468d530d909b223d47c4f1bd61bfe4aa3b Mon Sep 17 00:00:00 2001 From: Victoria Earl Date: Mon, 3 Jun 2024 09:55:51 -0400 Subject: [PATCH] Add deadline for purchasing meal plans Requested via Slack! --- magstock/configspec.ini | 4 +++ .../forms/attendee/badge_extras.html | 28 +++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/magstock/configspec.ini b/magstock/configspec.ini index edfcc86..0a36d92 100644 --- a/magstock/configspec.ini +++ b/magstock/configspec.ini @@ -1,6 +1,10 @@ # The cost of a food wristband, which entitles attendees to meals provided by the event. food_price = integer(default=20) +[dates] +# Set to blank to sell meal plans throughout the event. +meal_plan_deadline = string(default="") + [enums] [[meal_plan]] no_food = string(default="No thanks") diff --git a/magstock/templates/forms/attendee/badge_extras.html b/magstock/templates/forms/attendee/badge_extras.html index 0b1ecc3..fc850c8 100644 --- a/magstock/templates/forms/attendee/badge_extras.html +++ b/magstock/templates/forms/attendee/badge_extras.html @@ -6,6 +6,7 @@ {{ super() }} {{ badge_extras.camping_type(id=id_upgrade_prepend ~ "camping_type") }} {{ badge_extras.meal_plan(id=id_upgrade_prepend ~ "meal_plan") }} +{% set show_meal_plans = not c.MEAL_PLAN_DEADLINE or c.BEFORE_MEAL_PLAN_DEADLINE %} {% if not receipt or upgrade_modal %}
@@ -21,9 +22,12 @@
{{ form_macros.form_input(badge_extras.cabin_type, required=True, id=id_upgrade_prepend ~ "cabin_type") }}
+ {% if show_meal_plans %}
{{ form_macros.card_select(badge_extras.meal_plan, - c.FORMATTED_MEAL_PLANS, disabled_opts=[], + c.FORMATTED_MEAL_PLANS, + help_text="" if not c.MEAL_PLAN_DEADLINE else "You can purchase a beverage or meal plan any time before " ~ c.MEAL_PLAN_DEADLINE|datetime_local, + disabled_opts=[], target_field_id=id_upgrade_prepend ~ "meal_plan") }}
{{ form_macros.toggle_fields_js(badge_extras.meal_plan, [badge_extras.meal_restrictions], on_values=[c.FULL_FOOD|string], @@ -34,6 +38,24 @@
{{ form_macros.form_input(badge_extras.meal_restrictions, id=id_upgrade_prepend ~ "meal_restrictions") }}
+ {% else %} +
+
+
{{ badge_extras.meal_plan.label }}
+ {% if attendee.meal_plan != c.NO_FOOD %} +
{{ attendee.meal_plan_label }}
+ {% endif %} + {% if attendee.meal_plan != c.FULL_FOOD %} +
+ + The deadline to purchase a beverage or meal plan was {{ c.MEAL_PLAN_DEADLINE|datetime_local }}. + Individual meal tickets can be purchased through Ramblewood's Dining Hall for $20 per meal. Cash and digital payments are accepted. + +
+ {% endif %} +
+
+ {% endif %} {% elif not is_prereg_attendee %} {{ form_macros.form_input(badge_extras.cabin_type, force_hidden=True, default=0) }}
@@ -51,7 +73,9 @@
{{ badge_extras.meal_plan.label.text }}
-
{{ attendee.meal_plan_label }}{% if attendee.meal_plan != c.FULL_FOOD %}{{ macros.upgrade_button('meal-plan') }}{% endif %}
+
+ {{ attendee.meal_plan_label }}{% if attendee.meal_plan != c.FULL_FOOD and show_meal_plans %}{{ macros.upgrade_button('meal-plan') }}{% endif %} +
{% if attendee.meal_plan == c.FULL_FOOD %}