Skip to content

Commit

Permalink
dont have secondary modal for dependent table (#4273)
Browse files Browse the repository at this point in the history
* don't open secondary modal when in comparison modal

* forgot to commit a file

* rubocop

* fix spec by undoing rubocop suggestions
  • Loading branch information
kristinmerbach authored and bbodine1 committed Aug 27, 2024
1 parent a055263 commit 15c3411
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 29 deletions.
6 changes: 6 additions & 0 deletions app/assets/javascripts/plan_shopping.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -407,3 +407,9 @@ function disableSelectricInModal() {
$('select#waiver_reason_selection_dropdown').selectric('destroy');
})
}

// show the dependent table when the primary's name is clicked
$(document).on("click", "#dependentList", function(event) {
event.preventDefault();
$("#dependentTable").toggleClass('hidden');
});
61 changes: 34 additions & 27 deletions app/helpers/insured/families_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ module Insured::FamiliesHelper

def display_change_tax_credits_button?(hbx_enrollment)
hbx_enrollment.has_at_least_one_aptc_eligible_member?(hbx_enrollment.effective_on.year) &&
hbx_enrollment.product.can_use_aptc? &&
!hbx_enrollment.is_coverall? &&
hbx_enrollment.coverage_kind != 'dental'
hbx_enrollment.product.can_use_aptc? &&
!hbx_enrollment.is_coverall? &&
hbx_enrollment.coverage_kind != 'dental'
end

def plan_shopping_dependent_text(hbx_enrollment)
Expand All @@ -32,21 +32,21 @@ def plan_shopping_dependent_text(hbx_enrollment)
end
end

def current_premium hbx_enrollment
begin
if hbx_enrollment.is_shop?
hbx_enrollment.total_employee_cost
else
cost = float_fix(hbx_enrollment.total_premium - [hbx_enrollment.total_ehb_premium, hbx_enrollment.applied_aptc_amount.to_f].min - hbx_enrollment.eligible_child_care_subsidy.to_f)
cost > 0 ? cost.round(2) : 0
end
rescue Exception => e
exception_message = "Current Premium calculation error for HBX Enrollment: #{hbx_enrollment.hbx_id.to_s}"
Rails.logger.error(exception_message) unless Rails.env.test?
puts(exception_message) unless Rails.env.test?
'Not Available.'
# rubocop:disable Lint/RescueException, Lint/UselessAssignment
def current_premium(hbx_enrollment)
if hbx_enrollment.is_shop?
hbx_enrollment.total_employee_cost
else
cost = float_fix(hbx_enrollment.total_premium - [hbx_enrollment.total_ehb_premium, hbx_enrollment.applied_aptc_amount.to_f].min - hbx_enrollment.eligible_child_care_subsidy.to_f)
cost > 0 ? cost.round(2) : 0
end
rescue Exception => e
exception_message = "Current Premium calculation error for HBX Enrollment: #{hbx_enrollment.hbx_id}"
Rails.logger.error(exception_message) unless Rails.env.test?
puts(exception_message) unless Rails.env.test?
'Not Available.'
end
# rubocop:enable Lint/RescueException, Lint/UselessAssignment

def hide_policy_selected_date?(hbx_enrollment)
return true if hbx_enrollment.created_at.blank?
Expand Down Expand Up @@ -88,9 +88,7 @@ def render_plan_type_details(plan)
plan_details << "<span class=\"#{plan_level.try(:downcase)}-icon\">#{metal_level}</span>"
end

if plan.try(:nationwide)
plan_details << "NATIONWIDE NETWORK"
end
plan_details << "NATIONWIDE NETWORK" if plan.try(:nationwide)

sanitize_html(
plan_details.inject([]) do |data, element|
Expand Down Expand Up @@ -138,15 +136,15 @@ def qle_link_generator(qle, index)
link_to qle_title_html || qle.title, @bs4 ? "#" : "javascript:void(0)", options
end

def qle_link_generator_for_an_existing_qle(qle, link_title=nil)
def qle_link_generator_for_an_existing_qle(qle, link_title = nil)
options = {class: 'existing-sep-item'}
data = {
title: qle.title, id: qle.id.to_s, label: qle.event_kind_label,
is_self_attested: qle.is_self_attested,
current_date: TimeKeeper.date_of_record.strftime("%m/%d/%Y")
}
options.merge!(data: data)
link_to link_title.present? ? link_title: "Shop for Plans", "javascript:void(0)", options
link_to link_title.present? ? link_title : "Shop for Plans", "javascript:void(0)", options
end

def generate_options_for_effective_on_kinds(qle, qle_date)
Expand All @@ -171,18 +169,26 @@ def all_active_enrollment_with_aptc(family)
end

def hbx_member_names(hbx_enrollment_members)
member_names = Array.new
member_names = []
hbx_enrollment_members.each do |hem|
member_names.push(Person.find(hem.family_member.person_id.to_s).full_name)
end
return member_names.join(", ")
member_names.join(", ")
end

def has_writing_agent?(employee_role_or_person)
if employee_role_or_person.is_a?(EmployeeRole)
employee_role_or_person.employer_profile.active_broker_agency_account.writing_agent rescue false
begin
employee_role_or_person.employer_profile.active_broker_agency_account.writing_agent
rescue StandardError
false
end
elsif employee_role_or_person.is_a?(Person)
employee_role_or_person.primary_family.current_broker_agency.writing_agent.present? rescue false
begin
employee_role_or_person.primary_family.current_broker_agency.writing_agent.present?
rescue StandardError
false
end
end
end

Expand Down Expand Up @@ -313,7 +319,7 @@ def build_link_for_sep_type(sep, link_title = nil, family_id = nil, link_class =
return if qle.blank?
if qle.date_options_available && sep.optional_effective_on.present?
# Take to the QLE like flow of choosing Option dates if available
qle_link_generator_for_an_existing_qle(qle, link_title)
qle_link_generator_for_an_existing_qle(qle, link_title)
else
# Take straight to the Plan Shopping - Add Members Flow. No date choices.
# Use turbolinks: false, to avoid calling controller action twice.
Expand Down Expand Up @@ -353,14 +359,15 @@ def show_download_tax_documents_button?
true
end
end

def is_applying_coverage_value_personal(person)
first_checked = true
second_checked = false
if person.consumer_role.present?
first_checked = person.consumer_role.is_applying_coverage
second_checked = !person.consumer_role.is_applying_coverage
end
return first_checked, second_checked
[first_checked, second_checked]
end

def current_market_kind(person)
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_comparison.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="modal-body">
<div id="printArea">
<p><%= l10n("plans.comparison_table.description") %></p>
<%= render "shared/plan_shoppings/more_plan_details" %>
<%= render partial: "shared/plan_shoppings/more_plan_details", locals: {dependent_modal: "false"} %>

<div class="table-responsive">
<table class="table compare-table">
Expand Down
31 changes: 31 additions & 0 deletions app/views/shared/_dependents_list_table.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<div class="table-responsive hidden" id="dependentTable">
<table class="table">
<thead class="thead-default">
<tr>
<th>
<%= l10n("plans.comparison_table.name") %>
</th>
<th>
<%= l10n("plans.dependents_modal.relationship") %>
</th>
</tr>
</thead>
<tbody>
<% dependentslist = subscriber + dependents %>
<% dependentslist.each do |d| %>
<tr>
<td>
<%= d.person.full_name %>
</td>
<td>
<% if subscriber.blank? %>
<%= @hbx_enrollment.consumer_role.person.find_relationship_with(d.person) %>
<% else %>
<%= subscriber.first.person.find_relationship_with(d.person) %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
7 changes: 6 additions & 1 deletion app/views/shared/plan_shoppings/_more_plan_details.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<% dependent_modal = local_assigns[:dependent_modal] ? dependent_modal : true %>
<% if @bs4 %>
<dl class="parent mt-2">
<dt><%= l10n("plans.dependents_modal.title")%>:</dt>
<dd><%= plan_shopping_dependent_text(@hbx_enrollment) %></dd>
<% if dependent_modal == true %>
<dd><%= plan_shopping_dependent_text(@hbx_enrollment) %></dd>
<% else %>
<dd><%= plan_shopping_dependent_text_without_modal(@hbx_enrollment) %></dd>
<% end %>
<dt><%= l10n("plans.more_plan_details.available")%>:</dt>
<% products = (['shop','employer_sponsored','fehb'].include?(@market_kind)) ? @member_groups : @plans %>
<dd id='plans-count'><%= products_count(products)%></dd>
Expand Down

0 comments on commit 15c3411

Please sign in to comment.