diff --git a/uber/templates/forms/attendee/admin_staffing_info.html b/uber/templates/forms/attendee/admin_staffing_info.html index 855f66675..ad6264e68 100644 --- a/uber/templates/forms/attendee/admin_staffing_info.html +++ b/uber/templates/forms/attendee/admin_staffing_info.html @@ -21,18 +21,18 @@
Walk-On Volunteer
- {{ form_macros.form_input(staffing_info.walk_on_volunteer) }} + {{ form_macros.alpine_form_input(staffing_info.walk_on_volunteer) }}
{% if c.PUBLIC_DEPARTMENT_OPTS_WITH_DESC|length > 1 %}
-
{{ form_macros.form_input(staffing_info.requested_depts_ids) }}
+
{{ form_macros.alpine_form_input(staffing_info.requested_depts_ids) }}
{% endif %}
-
{{ form_macros.form_input(staffing_info.assigned_depts_ids) }}
+
{{ form_macros.alpine_form_input(staffing_info.assigned_depts_ids) }}
{% endblock %} @@ -45,7 +45,7 @@
Received Staff Merch
-
{{ form_macros.form_input(staffing_info.got_staff_merch) }}
+
{{ form_macros.alpine_form_input(staffing_info.got_staff_merch) }}
{% endif %} @@ -55,20 +55,20 @@
{% if c.VOLUNTEER_AGREEMENT_ENABLED %}
- {{ form_macros.form_input(staffing_info.agreed_to_volunteer_agreement, + {{ form_macros.alpine_form_input(staffing_info.agreed_to_volunteer_agreement, hidden_field_text=staffing_info.agreed_to_volunteer_agreement.data|yesno("Yes,No")) }}
{% endif %} {% if c.EMERGENCY_PROCEDURES_ENABLED %}
- {{ form_macros.form_input(staffing_info.reviewed_emergency_procedures, + {{ form_macros.alpine_form_input(staffing_info.reviewed_emergency_procedures, hidden_field_text=staffing_info.reviewed_emergency_procedures.data|yesno("Yes,No")) }}
{% endif %}
Staff Crash Space
- {{ form_macros.form_input(staffing_info.hotel_eligible, readonly=not c.HAS_DEVTOOLS_ACCESS) }} + {{ form_macros.alpine_form_input(staffing_info.hotel_eligible, readonly=not c.HAS_DEVTOOLS_ACCESS) }}
diff --git a/uber/templates/forms/macros.html b/uber/templates/forms/macros.html index 12d5dfd27..226d005ee 100644 --- a/uber/templates/forms/macros.html +++ b/uber/templates/forms/macros.html @@ -201,7 +201,7 @@ {% endmacro %} -{% macro alpine_form_input(field, label_text='', help_text='', admin_text='', no_margin=False, alpine_props=dict() ) %} +{% macro alpine_form_input(field, label_text='', help_text='', admin_text='', no_margin=False, hidden_field_text='', force_hidden=False, alpine_props=dict() ) %} {# Renders the bootstrap scaffolding needed for a WTForms field based on its widget. field (Field): WTForms form field. @@ -218,7 +218,28 @@ {% set type = field.meta.get_field_type(field) %} {% set label_text = label_text or field.label.text %} {% set is_readonly = ('readonly' in kwargs and kwargs['readonly'] == True) or 'readonly' in field.render_kw %} - {% if type in ['checkbox','switch'] %} + {% if type == 'hidden' or force_hidden %} + {% set field_data = field.data|yesno("True,False") if force_hidden and type in ['checkbox','switch'] else field.data %} + {% if hidden_field_text %} +
{{ label_text }}
+ + {% if force_hidden %} + + {% else %} + {{ field(**custom_kwargs) }} + {% endif %} + {{ hidden_field_text }} + + {% else %} + {% if force_hidden %} + + {% else %} + {{ field(**custom_kwargs) }} + {% endif %} + {% endif %} + {% elif type in ['checkbox','switch'] %}
{% if is_readonly %} diff --git a/uber/templates/registration/attendee_data.html b/uber/templates/registration/attendee_data.html index 45b4e2f62..7db1bf766 100644 --- a/uber/templates/registration/attendee_data.html +++ b/uber/templates/registration/attendee_data.html @@ -145,12 +145,10 @@ x-init="$watch('badge_ribbons', (ribbons) => { - console.log(Alpine.raw(ribbons)) - if (Alpine.raw(ribbons).includes({{ c.VOLUNTEER_RIBBON }})) { staffing=true } + if (Alpine.raw(ribbons).includes({{ c.VOLUNTEER_RIBBON }})) { staffing = true } }); $watch('badge_type', (btype) => { - console.log(btype); if( btype == {{ c.STAFF_BADGE }} || btype == {{ c.CONTRACTOR_BADGE }}){ staffing = true } })" >