Skip to content

Commit

Permalink
bs4 fix ssn exclusivity (#4316)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
charlienparker authored and bbodine1 committed Aug 27, 2024
1 parent 783a45a commit f41992e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions app/views/insured/family_members/_dependent_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<% if @bs4 %>
<div id="<%= employee_dependent_form_id(dependent) %>" class="dependent_list">
<h2><%= dependent.id.present? ? l10n("edit_member") : l10n("add_member") %></h2>
<% is_editing = dependent.id.present? %>
<h2><%= is_editing ? l10n("edit_member") : l10n("add_member") %></h2>
<div id="add_info_<%= dependent.id %>" class="<%= pundit_class Family, :updateable? %>">
<%= form_for dependent, employee_dependent_submission_options_for(dependent) do |f| %>
<%= hidden_field_tag :consumer_role_id, params[:consumer_role_id] %>
Expand Down Expand Up @@ -65,7 +66,7 @@
</div>
</div>

<div class="d-flex mb-md-4">
<div class="d-flex mb-md-4 <%= 'new_dependent' unless is_editing %>">
<div class="col-md-6 col-lg-3 p-0">
<%= f.label :ssn, "Social Security" %>
<% if EnrollRegistry.feature_enabled?(:ssn_ui_validation) %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<% if @bs4 %>
<% dependent = @applicant %>
<div id="<%= employee_dependent_form_id(dependent) %>" class="dependent_list">
<h2><%= dependent.id.present? ? l10n("edit_member") : l10n("add_member") %></h2>
<% is_editing = dependent.id.present? %>
<h2><%= is_editing ? l10n("edit_member") : l10n("add_member") %></h2>
<div id="add_info_<%= dependent.id %>" class="<%= pundit_class Family, :updateable? %>">
<%= form_for @applicant, {url: application_applicants_path(@application), as: :applicant, remote: true} do |f| %>
<%= hidden_field_tag :consumer_role_id, params[:consumer_role_id] %>
Expand Down Expand Up @@ -65,21 +66,21 @@
</div>
</div>

<div class="d-flex mb-md-4">
<div class="col-md-6 col-lg-3 p-0">
<div class="d-flex mb-md-4 <%= 'new_dependent' unless is_editing %>">
<div class="col-md-6 col-lg-3 p-0 ">
<%= 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 %>
</div>
<div class="col-md-6 col-lg-3 p-0 pt-md-4 no-ssn-container mr-auto">
<%= f.label :no_ssn, class: "mt-1 d-inline-block" do %>
<%= f.check_box :no_ssn %><span class='no_ssn'><%= l10n("do_not_have_ssn") %></span>
<%= f.check_box :no_ssn, id: "dependent_no_ssn" %><span class='no_ssn'><%= l10n("do_not_have_ssn") %></span>
<a href="#no_ssn_info" data-toggle="modal" data-target="#no_ssn_info" class="d-block"><%= l10n("not_sure") %></a>
<%= render partial: 'shared/modal_support_text_household', locals: {key: "no_ssn_info"} %>
<% end %>
Expand Down

0 comments on commit f41992e

Please sign in to comment.