diff --git a/uber/templates/forms/attendee/personal_info.html b/uber/templates/forms/attendee/personal_info.html index c92cedfcb..c5a49af21 100644 --- a/uber/templates/forms/attendee/personal_info.html +++ b/uber/templates/forms/attendee/personal_info.html @@ -18,18 +18,20 @@ international: {{ personal_info.international.data | javascript_bool }}, dealer: {{ (is_prereg_dealer or attendee.is_dealer) | javascript_bool }}, noCellphone: {{ personal_info.no_cellphone.data | javascript_bool }}, + copyEmail: {{ (group and loaded_from_group and attendee.email == group.email_address) | javascript_bool }}, + get isEmailRequired() { return !this.copyEmail }, copyAddress: false, copyCellphone: false, - get isZipRequired(){ return !this.international && !this.copyAddress && !this.badge_placeholder }, //hmd todo broken and not sure why. + get isZipRequired(){ return !this.international && !this.copyAddress && !this.badge_placeholder }, get isCellphoneDisabled() { return this.noCellphone || this.copyCellphone}, - get isCellphoneRequired() { return (this.staffing || this.dealer) && !this.noCellphone && !this.copyCellphone && !this.badge_placeholder } //this is also similarly broken. + get isCellphoneRequired() { return (this.staffing || this.dealer) && !this.noCellphone && !this.copyCellphone && !this.badge_placeholder } }"> {% block name %} {% set attendee_last_name = attendee.last_name[0] ~ '.' if limited_read else attendee.last_name %}
-
{{ form_macros.form_input(personal_info.first_name) }}
-
{{ form_macros.form_input(personal_info.last_name, value=attendee_last_name) }}
+
{{ form_macros.alpine_form_input(personal_info.first_name) }}
+
{{ form_macros.alpine_form_input(personal_info.last_name, value=attendee_last_name) }}
{% if attendee.legal_name or attendee.is_new or attendee.placeholder or admin_area %} @@ -38,7 +40,7 @@ checked=attendee.first_name != '' and attendee.legal_name == '') }} -
{{ form_macros.form_input(personal_info.legal_name, help_text=macros.popup_link("../static_views/legal_name.html", 'What does "Legal Photo ID" mean?')) }} +
{{ form_macros.alpine_form_input(personal_info.legal_name, help_text=macros.popup_link("../static_views/legal_name.html", 'What does "Legal Photo ID" mean?')) }}
{% else %} @@ -58,13 +60,13 @@ {% block contact_info %} {% set attendee_email = attendee.masked_email if limited_read else attendee.email %} -{% if is_prereg_dealer %} - {% set email_extra_field = form_macros.toggle_checkbox(personal_info.copy_email, [personal_info.email], hide_on_checked=True, toggle_required=True, prop="disabled", checked=group and loaded_from_group and attendee.email == group.email_address) %} -{% endif %}
- {{ form_macros.form_input(personal_info.email, extra_field=email_extra_field, value=attendee_email) }} + {{ form_macros.alpine_form_input(personal_info.email, value=attendee_email, alpine_props={':required':'isEmailRequired', ':disabled':'copyEmail'}) }} + {% if is_prereg_dealer %} + {{ form_macros.alpine_form_input(personal_info.copy_email, alpine_props={'x-model.boolean':'copyEmail'}) }} + {% endif %}
{% if c.PREREG_CONFIRM_EMAIL_ENABLED and (attendee.needs_pii_consent or attendee.badge_status == c.PENDING_STATUS) %}
diff --git a/uber/templates/forms/macros.html b/uber/templates/forms/macros.html index 226d005ee..cba2a39fd 100644 --- a/uber/templates/forms/macros.html +++ b/uber/templates/forms/macros.html @@ -190,14 +190,16 @@ {%- endmacro %} -{% macro alpine_form_label(field, label_text='', required_if=None) %} +{% macro alpine_form_label(field, label_text='', required=None, required_if=None) %} {% endmacro %} @@ -247,7 +249,7 @@ {% else %} {{ field(class="form-check-input", checked=field.data, value=1, **custom_kwargs) }} {% endif %} - {{ alpine_form_label(field, label_text=label_text, required_if=required_if, class="form-check-label") }} + {{ alpine_form_label(field, label_text=label_text, required= field.flags.required, required_if=required_if, class="form-check-label") }} {{ form_input_extras(field, help_text, admin_text) }}
{% elif type == 'checkgroup' %} @@ -258,13 +260,13 @@ {% elif type == 'select' %}
{{ field(class="form-select", **custom_kwargs) }} - {{ alpine_form_label(field, label_text=label_text, required_if=required_if) }} + {{ alpine_form_label(field, label_text=label_text, required= field.flags.required, required_if=required_if) }} {{ form_input_extras(field, help_text, admin_text) }}
{% else %}
{{ field(class="form-control", **custom_kwargs) }} - {{ alpine_form_label(field, label_text=label_text, required_if=required_if) }} + {{ alpine_form_label(field, label_text=label_text, required= field.flags.required, required_if=required_if) }} {{ form_input_extras(field, help_text, admin_text) }}
{% endif %}