From f41992e30874637c551d2ac9a41eb540544d1f10 Mon Sep 17 00:00:00 2001 From: Charlie Parker Date: Wed, 14 Aug 2024 20:44:18 -0400 Subject: [PATCH] bs4 fix ssn exclusivity (#4316) * apply missing class used to ensure exclusivity on dep ssn fields * add classes and ids to other forms * allow submit to not be listened * only exclusive when creating not editing * restore time jump * restore edit * fix syntax --- .../insured/family_members/_dependent_form.html.erb | 5 +++-- .../applicants/_dependent_form.html.erb | 13 +++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/views/insured/family_members/_dependent_form.html.erb b/app/views/insured/family_members/_dependent_form.html.erb index b7072ebbdc6..f8368ccdc50 100644 --- a/app/views/insured/family_members/_dependent_form.html.erb +++ b/app/views/insured/family_members/_dependent_form.html.erb @@ -1,6 +1,7 @@ <% if @bs4 %>
-

<%= dependent.id.present? ? l10n("edit_member") : l10n("add_member") %>

+ <% is_editing = dependent.id.present? %> +

<%= is_editing ? l10n("edit_member") : l10n("add_member") %>

<%= form_for dependent, employee_dependent_submission_options_for(dependent) do |f| %> <%= hidden_field_tag :consumer_role_id, params[:consumer_role_id] %> @@ -65,7 +66,7 @@
-
+
<%= f.label :ssn, "Social Security" %> <% if EnrollRegistry.feature_enabled?(:ssn_ui_validation) %> diff --git a/components/financial_assistance/app/views/financial_assistance/applicants/_dependent_form.html.erb b/components/financial_assistance/app/views/financial_assistance/applicants/_dependent_form.html.erb index a34e65bec63..c0449d1f64b 100644 --- a/components/financial_assistance/app/views/financial_assistance/applicants/_dependent_form.html.erb +++ b/components/financial_assistance/app/views/financial_assistance/applicants/_dependent_form.html.erb @@ -1,7 +1,8 @@ <% if @bs4 %> <% dependent = @applicant %>
-

<%= dependent.id.present? ? l10n("edit_member") : l10n("add_member") %>

+ <% is_editing = dependent.id.present? %> +

<%= is_editing ? l10n("edit_member") : l10n("add_member") %>

<%= form_for @applicant, {url: application_applicants_path(@application), as: :applicant, remote: true} do |f| %> <%= hidden_field_tag :consumer_role_id, params[:consumer_role_id] %> @@ -65,21 +66,21 @@
-
-
+
+
<%= f.label :ssn, "Social Security" %> <% if EnrollRegistry.feature_enabled?(:ssn_ui_validation) %> - <%= f.text_field :ssn, placeholder: "000-00-0000", class: "required keep-label mask-ssn", + <%= f.text_field :ssn, placeholder: "000-00-0000", id: "dependent_ssn", class: "required keep-label mask-ssn", pattern: "(?!666|000|9\\d{2})\\d{3}[\\- ]{0,1}(?!00)\\d{2}[\\- ]{0,1}(?!0{4})\\d{4}", oninvalid: "this.setCustomValidity('Invalid Social Security number.')", oninput: "this.setCustomValidity('')", disabled: false, readonly: f.object.is_a?(Forms::EmployeeRole) %> <% else %> - <%= f.text_field :ssn, placeholder: "000-00-0000", class: "required", disabled: false, + <%= f.text_field :ssn, placeholder: "000-00-0000", id: "dependent_ssn", class: "required", disabled: false, readonly: f.object.is_a?(Forms::EmployeeRole) %> <% end %>
<%= f.label :no_ssn, class: "mt-1 d-inline-block" do %> - <%= f.check_box :no_ssn %><%= l10n("do_not_have_ssn") %> + <%= f.check_box :no_ssn, id: "dependent_no_ssn" %><%= l10n("do_not_have_ssn") %> <%= l10n("not_sure") %> <%= render partial: 'shared/modal_support_text_household', locals: {key: "no_ssn_info"} %> <% end %>