Skip to content

Commit

Permalink
bs4 plan shopping family info & choose cov for HH pages (#3821)
Browse files Browse the repository at this point in the history
* create account page plus additional translations

* immigration doc partials

* translations for other clients

* don't touch FAA yet

* app scan warnings

* app scan warnings

* app scan issues

* starting to rubocop

* navigation helper rubocop

* fix brakeman, other text changes

* app scan flags

* sanitize links

* fix link

* devise translations

* fix devise translations

* devise translations

* devise translations

* devise translations

* devise translations

* devise translations

* reformat devide translations

* reformat devide translations

* reformat devide translations

* reformat devide translations

* redo devise translations

* id bad bullets

* id bad bullet

* id bad bullet

* id bad bullet text

* previous and continue buttons dryed out

* properly sanitize link

* fix for no ssn info text

* sign in text fix

* header contact number not clickable (#3812)

add missing href attribute to link

* fix personal info step 3 content (#3819)

* fix duplicate for, fix missing asterisk for home address fields with introduction of form builder helper that builds a text field which abstracts out setting required field and asterisk append

* update helper method to allow callers to not specify class param, fix contact_info_for in other translations

* remove unrelated changes

* update race legend subtitle to be inline (#3833)

move parenthetical to inline with legend title

* remove disagree placeholder text (#3831)

remove disagree_placeholder_text div

* fix auth and consent previous button layout (#3825)

* wrap progress button in vertically aligned flex box

* combines prev and continue link partial into one partial, updates consumers of the old partials to use the new one and keep functionality

* remove unneeded div

* remove unneeded argument

* ssn number mask format (#3824)

* add mask for ssn, add mask-ssn class on text field

* update class name to not be repetitive

* use preexisting input mask for ssn

* phone number mask format (#3823)

* add script tag for phone number mask, add phone_number class on text field, update placeholder to match expected format

* replace new mask with a call to inputMasks

* add missing underscore prefix to partial (#3840)

* right align header account links (#3832)

* add ml-auto class to link column

* remove unneeded span

* adds newline for each span

* remove ml-auto class from span and adds align-items-end to both columns

* unbold demo info questions (#3836)

* localize incarcerated and citizen strings, remove asterisk from tribe_member_2 to allow space and non-space cases, add new selector to allow for unbold form labels and legends

* remove asterisk from tribal_name translation

* use weight-n instead of new class for enforcing non-bold titles in form

* add class for immigrant doc labels

* replace header content (#3838)

add new devise entry for bs4 welcome message, update controller to drive the flash message using bs4 flag

* remove repeated header text (#3839)

add translations for user roles, remove fallback on role check in portal helper, use new translation keys in portal helper

* rubocop

* give continue buttons shared selectors

* resolve ticket 187618984 previous button underlined

* ridp agreement text bold

* disabled dob on more info

* session warning pop up

* privacy spacing

* add not sure for is applying coverage

* duplicated *s for aiant question

* load correct ridp partials

* show help shopping button

* progress nav buttons cleanup

* auto build feature branch on new changes

* fix failed validation page

* start fixing rspec failures

* continuing spec work

* continuing spec work

* more spec fixes

* ridp admin actions

* rubocop fixes

* fix warning

* make bs4 layout more conditional for dc

* bs4 flag for layouts already using bs4 layout

* wlecome controller

* rubocop

* fix address and contact row spacing (#3843)

* use margin bottom 2 for first address and contact rows, wrap address hidden fields in span to lose input + label styling

* remove span, update selector to disregard hidden inputs

* fix contact method alert (#3851)

* adds localized string for contact options, update checkbox setup to use unique ids for each option and localize the label, adds missing class on BS4 checkbox span

* adds check for non-person which crashed on null check and stopped further validations in the call

* remove checked call in combined get

* unbold personal info immigration fields (#3852)

add weight-n to other status questions legend and all missing immigration doc labels

* remove extra personal info contact text (#3850)

* fix fonts, more ridp work started

* remove unneeded please provide disclaimer label

* remove weird merge tag

---------

Co-authored-by: Kristin Merbach <[email protected]>

* hide id in pre login (#3849)

update translation to just be id, update account display to only show id substring when present

* fix label for verified state (#3865)

update new verification helper to return the string matching legacy for valid case

* remove personal info step in consumer signup (#3863)

cherry pick old changes

* use warning banner for no match (#3861)

* update content for bs4, use warning banner

* padding updates

* rename translation key

* add text for missing immigrant status labels (#3864)

* adds hardcoded text for missing localized keys

* add translations for content

* move not sure link below radios (#3870)

* use grid for is_applying_for_cov elements

* remove rows and reorganize classes

* add asterisk to address line 1 and zip in personal info (#3820)

* add builder to use for DRYing creation of required text fields with asterisks

* update address 1, address 2, city, and zip fields to use the new text_field builder, update zip field to have asterisk

* localize city

* makes placeholder a required keyword param

* rename to RequirableFormBuilder, update helper to maintain both the field/select element and its label, moves asterisk to label per specs

* fixe merge order so that params override options

* remove formbuilder and hardcode asterisks in markup

* fix trailing whitespace, remove county translation

* restore add 1 class

* use required class for required fields

* add required attr for city

* add disabled class to continue link (#3872)

* add disabled class to link, remove extraneous if in button

* restores disabled if for button case

* fix missing document faq button (#3877)

* 187579400 update flash (#3854)

* add BS4 view to flash partial

* updates flash partial for bs4, updates progress and bs4 layouts to render new flash

* fix underscore on close button

* close icon work

* white space fix

* map legacy alert type to bs4, update flash layout to work well with larger messages, accessibility updates

* add success case, more whitespace cleanup

* update alert-error to use correct border and add error icon

* move container out of layout, update padding on header to match footer

* update padding and margins on flash

* simplify flash in progress layout now that we have flash in its own container

* unrelated fix for failed validations, replace old alert style, add missing legacy style in BS4 flash style map, add new alert style, update flash margin,

* adds @bs4 arguments for render_flash calls and restores horizontal status in bs4 layout

* rename flash type helper method

* update info step 1 banner (#3860)

* adds warning option to DOB error, updates error_messages partial to handle error option and use new UI

* remove left padding for list in alert

* remove unneeded classes

* remove padding style

* updates classes for error banner to match mockups

* move flash into content column for progress layout, remove mt class from flash to allow layouts to drive top margin

* ridp default select agree (#3878)

add selected args for radio buttons

* resolve spacing issues (#3875)

* fix spacing, style the info to match other info boxes

* more spacing

* consolidate spacing classes

* session modal styling (#3874)

* session modal styling

* remove unnecessary span

* consolidate spacing classes

* ridp waiting

* update upload doc verify identity modal (#3886)

* split modal partial for bs4, finish header

* add radios and upload/close buttons

* padding update

* update radio text to be blocked and centered with radio

* more padding and margin fixes

* padding update for info label

* use for to render radios

* add id

* remove unneeded value attr

* remove unneeded classes on button row

* refactor radio value and id

* use element name for legend

* removes for from legend

* remove row

* move btn-file selector to forms

* start moving FAA to use bootstrap 4 (#3855)

* fix fonts, more ridp work started

* start faa

* fix resolve layout

* fix resolve layout

* fix rebase issues

* pr requests and translations

---------

Signed-off-by: kristinmerbach <[email protected]>

* improve ridp status badges (#3884)

* temp

* improve ridp status badges

* improve encapsulation

* rename of vars

* rename vars 2.0

* ridp fixes for previous and log out links (#3879)

* ridp link fixes

* button link hovers shouldn't have underline

* fix add mailing address functionality (#3876)

* fix mailing address js

* remove console log

* add button for existing mailing addresses

* help me sign up flow bs4 conversion started (#3887)

* help me sign up flow started

* translations and search input

* wave issues

* translations

---------

Signed-off-by: kristinmerbach <[email protected]>

* fix fonts, more ridp work started

* choose cov page wip

* plan shopping progress bars updated

* plan shopping nav refactoring

* remove debug line

* choose cov for hh progress, added pg nav buttons for first flow

* family information page progress

* family information conversion, fixed progress nav buttons

* translation fixes

* removed debugging code

* convert to html.erb

* rebase cleanup

* removed duped code  & unnecessary vars, erb convert for ps compare modal

* fix link_to CSS vunerabilities

* baseline post convrsion

* plan shopping progress refactor

* Bootstrap misc bugfixes (#3895)

fixes for 6 bug tickets

* pr feedback, small fixes

* upgrade to bs4 base

* revert temp changes for design review to trunk

* add feature flag and switch consumer role controler layout

* personal information page redo

* feature flags, faa layouts

* bs4 footer

* fix for dynamic footer

* header wip, stable

* header progress

* sticky footer fix

* header logo update, move styling to new file

* add bs4 upgrade icons, collapsed header tweaks

* started family information

* privacy page and personal information, button mixin

* registration process

* more work on consumer flow

* fix semicolon

* client specific files re-organized

* authorization & consent page

* footer updates

* footer phone # fix

* authority & consent ridp page

* progress nav accessibility

* fix fonts, more ridp work started

* added ME colors, revert app controller flag

* ridp flow

* add new progress layout

* create account page plus additional translations

* immigration doc partials

* translations for other clients

* don't touch FAA yet

* app scan warnings

* app scan warnings

* app scan issues

* starting to rubocop

* navigation helper rubocop

* fix brakeman, other text changes

* app scan flags

* sanitize links

* fix link

* devise translations

* fix devise translations

* devise translations

* devise translations

* devise translations

* devise translations

* devise translations

* reformat devide translations

* reformat devide translations

* reformat devide translations

* reformat devide translations

* redo devise translations

* id bad bullets

* id bad bullet

* id bad bullet

* id bad bullet text

* previous and continue buttons dryed out

* properly sanitize link

* fix for no ssn info text

* sign in text fix

* header contact number not clickable (#3812)

add missing href attribute to link

* fix personal info step 3 content (#3819)

* fix duplicate for, fix missing asterisk for home address fields with introduction of form builder helper that builds a text field which abstracts out setting required field and asterisk append

* update helper method to allow callers to not specify class param, fix contact_info_for in other translations

* remove unrelated changes

* update race legend subtitle to be inline (#3833)

move parenthetical to inline with legend title

* remove disagree placeholder text (#3831)

remove disagree_placeholder_text div

* fix auth and consent previous button layout (#3825)

* wrap progress button in vertically aligned flex box

* combines prev and continue link partial into one partial, updates consumers of the old partials to use the new one and keep functionality

* remove unneeded div

* remove unneeded argument

* ssn number mask format (#3824)

* add mask for ssn, add mask-ssn class on text field

* update class name to not be repetitive

* use preexisting input mask for ssn

* phone number mask format (#3823)

* add script tag for phone number mask, add phone_number class on text field, update placeholder to match expected format

* replace new mask with a call to inputMasks

* add missing underscore prefix to partial (#3840)

* right align header account links (#3832)

* add ml-auto class to link column

* remove unneeded span

* adds newline for each span

* remove ml-auto class from span and adds align-items-end to both columns

* unbold demo info questions (#3836)

* localize incarcerated and citizen strings, remove asterisk from tribe_member_2 to allow space and non-space cases, add new selector to allow for unbold form labels and legends

* remove asterisk from tribal_name translation

* use weight-n instead of new class for enforcing non-bold titles in form

* add class for immigrant doc labels

* replace header content (#3838)

add new devise entry for bs4 welcome message, update controller to drive the flash message using bs4 flag

* remove repeated header text (#3839)

add translations for user roles, remove fallback on role check in portal helper, use new translation keys in portal helper

* rubocop

* give continue buttons shared selectors

* resolve ticket 187618984 previous button underlined

* ridp agreement text bold

* disabled dob on more info

* session warning pop up

* privacy spacing

* add not sure for is applying coverage

* duplicated *s for aiant question

* load correct ridp partials

* show help shopping button

* progress nav buttons cleanup

* auto build feature branch on new changes

* fix failed validation page

* start fixing rspec failures

* continuing spec work

* continuing spec work

* more spec fixes

* ridp admin actions

* rubocop fixes

* fix warning

* make bs4 layout more conditional for dc

* bs4 flag for layouts already using bs4 layout

* wlecome controller

* rubocop

* fix address and contact row spacing (#3843)

* use margin bottom 2 for first address and contact rows, wrap address hidden fields in span to lose input + label styling

* remove span, update selector to disregard hidden inputs

* fix contact method alert (#3851)

* adds localized string for contact options, update checkbox setup to use unique ids for each option and localize the label, adds missing class on BS4 checkbox span

* adds check for non-person which crashed on null check and stopped further validations in the call

* remove checked call in combined get

* unbold personal info immigration fields (#3852)

add weight-n to other status questions legend and all missing immigration doc labels

* remove extra personal info contact text (#3850)

* fix fonts, more ridp work started

* remove unneeded please provide disclaimer label

* remove weird merge tag

---------

Co-authored-by: Kristin Merbach <[email protected]>

* hide id in pre login (#3849)

update translation to just be id, update account display to only show id substring when present

* fix label for verified state (#3865)

update new verification helper to return the string matching legacy for valid case

* remove personal info step in consumer signup (#3863)

cherry pick old changes

* use warning banner for no match (#3861)

* update content for bs4, use warning banner

* padding updates

* rename translation key

* add text for missing immigrant status labels (#3864)

* adds hardcoded text for missing localized keys

* add translations for content

* move not sure link below radios (#3870)

* use grid for is_applying_for_cov elements

* remove rows and reorganize classes

* add asterisk to address line 1 and zip in personal info (#3820)

* add builder to use for DRYing creation of required text fields with asterisks

* update address 1, address 2, city, and zip fields to use the new text_field builder, update zip field to have asterisk

* localize city

* makes placeholder a required keyword param

* rename to RequirableFormBuilder, update helper to maintain both the field/select element and its label, moves asterisk to label per specs

* fixe merge order so that params override options

* remove formbuilder and hardcode asterisks in markup

* fix trailing whitespace, remove county translation

* restore add 1 class

* use required class for required fields

* add required attr for city

* add disabled class to continue link (#3872)

* add disabled class to link, remove extraneous if in button

* restores disabled if for button case

* fix missing document faq button (#3877)

* 187579400 update flash (#3854)

* add BS4 view to flash partial

* updates flash partial for bs4, updates progress and bs4 layouts to render new flash

* fix underscore on close button

* close icon work

* white space fix

* map legacy alert type to bs4, update flash layout to work well with larger messages, accessibility updates

* add success case, more whitespace cleanup

* update alert-error to use correct border and add error icon

* move container out of layout, update padding on header to match footer

* update padding and margins on flash

* simplify flash in progress layout now that we have flash in its own container

* unrelated fix for failed validations, replace old alert style, add missing legacy style in BS4 flash style map, add new alert style, update flash margin,

* adds @bs4 arguments for render_flash calls and restores horizontal status in bs4 layout

* rename flash type helper method

* update info step 1 banner (#3860)

* adds warning option to DOB error, updates error_messages partial to handle error option and use new UI

* remove left padding for list in alert

* remove unneeded classes

* remove padding style

* updates classes for error banner to match mockups

* move flash into content column for progress layout, remove mt class from flash to allow layouts to drive top margin

* ridp default select agree (#3878)

add selected args for radio buttons

* resolve spacing issues (#3875)

* fix spacing, style the info to match other info boxes

* more spacing

* consolidate spacing classes

* session modal styling (#3874)

* session modal styling

* remove unnecessary span

* consolidate spacing classes

* ridp waiting

* update upload doc verify identity modal (#3886)

* split modal partial for bs4, finish header

* add radios and upload/close buttons

* padding update

* update radio text to be blocked and centered with radio

* more padding and margin fixes

* padding update for info label

* use for to render radios

* add id

* remove unneeded value attr

* remove unneeded classes on button row

* refactor radio value and id

* use element name for legend

* removes for from legend

* remove row

* move btn-file selector to forms

* start moving FAA to use bootstrap 4 (#3855)

* fix fonts, more ridp work started

* start faa

* fix resolve layout

* fix resolve layout

* fix rebase issues

* pr requests and translations

---------

Signed-off-by: kristinmerbach <[email protected]>

* improve ridp status badges (#3884)

* temp

* improve ridp status badges

* improve encapsulation

* rename of vars

* rename vars 2.0

* ridp fixes for previous and log out links (#3879)

* ridp link fixes

* button link hovers shouldn't have underline

* fix add mailing address functionality (#3876)

* fix mailing address js

* remove console log

* add button for existing mailing addresses

* help me sign up flow bs4 conversion started (#3887)

* help me sign up flow started

* translations and search input

* wave issues

* translations

---------

Signed-off-by: kristinmerbach <[email protected]>

* Bootstrap misc bugfixes (#3895)

fixes for 6 bug tickets

* update bs4 content for dob personal info banner (#3883)

* update corner radius for bs4 alerts, localize dob error, switch on message when validating dob for bs4 flag

* use existing continue strings as substring in dob error

* add document list to verify identity (#3890)

* cleanup, move old list to bs4

* more list work

* layout cleanup

* more list work

* adds trash style

* destroy icon update

* adds js handling for delete

* add new js destroy

* indentation fixes

* adds aria

* use h6 for type

* fix header span

* indentation fixes, update fdish page with list changes as well

* add missing change from merge

* remove class

* refactor row classes to support mobile

* alpha tweak

* remove float-end

* remove align

* fix unmatched span

* remove align

* remove d-flex

* puts label and badge in col

* button refactor

* remove unneeded icon

* add remove padding

* margin fixes

* more layout fixes

* restore fdsh modal

* use insured modal for insured

* cleanup

* FAA eligibility results to bs4 (#3894)

* eligibility results

* waiting for eligibility

* wait for results

---------

Signed-off-by: kristinmerbach <[email protected]>

* add member to family fix

* main.scss brace fix, cleanup

* webpacker depreciation warning cleanup

* fix build error with calc

* revert sass depreciation fix attempt

* small transation & inline style fixes

* XSS fixes

---------

Signed-off-by: kristinmerbach <[email protected]>
Signed-off-by: Sarah Austin <[email protected]>
Co-authored-by: Kristin Merbach <[email protected]>
Co-authored-by: Charlie Parker <[email protected]>
Co-authored-by: kvootla <[email protected]>
Co-authored-by: Alec Turnbull <[email protected]>
Co-authored-by: kristinmerbach <[email protected]>
Co-authored-by: Alec Turnbull <[email protected]>
  • Loading branch information
7 people committed Sep 16, 2024
1 parent 6cd23d5 commit 87eb91a
Show file tree
Hide file tree
Showing 35 changed files with 1,318 additions and 2,239 deletions.
7 changes: 3 additions & 4 deletions app/assets/javascripts/demographics_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,9 @@ var PersonValidations = (function (window, undefined) {
document.getElementById('naturalized_citizen_true');
return us_citizen.checked || naturalized_citizen.checked;
} else if (immigration_field) {
return (
document.getElementById('dependent_us_citizen_false').checked ||
document.getElementById('dependent_naturalized_citizen_true').checked
);
var us_citizen = document.getElementById('dependent_us_citizen_false') || document.getElementById('us_citizen_false');
var naturalized_citizen = document.getElementById('dependent_naturalized_citizen_true') || document.getElementById('naturalized_citizen_true');
return ( us_citizen.checked || naturalized_citizen.checked );
}
}

Expand Down
27 changes: 5 additions & 22 deletions app/controllers/insured/families_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ class Insured::FamiliesController < FamiliesController
include Config::SiteConcern
include Insured::FamiliesHelper

layout :resolve_layout
if EnrollRegistry.feature_enabled?(:bs4_consumer_flow)
before_action :enable_bs4_layout, only: [:home, :find_sep, :record_sep, :check_qle_date, :check_move_reason, :check_marriage_reason,
:check_insurance_reason, :verification, :personal, :inbox, :manage_family, :brokers, :enrollment_history]
end
before_action :updateable?, only: [:delete_consumer_broker, :record_sep, :purchase, :upload_notice]
before_action :init_qualifying_life_events, only: [:home, :manage_family, :find_sep]
before_action :check_for_address_info, only: [:find_sep, :home]
Expand Down Expand Up @@ -144,7 +139,7 @@ def find_sep
end

respond_to do |format|
format.html { render :layout => EnrollRegistry.feature_enabled?(:bs4_consumer_flow) ? "progress" : "application" }
format.html { render :layout => 'application' }
end
end

Expand All @@ -156,7 +151,7 @@ def record_sep
special_enrollment_period = @family.special_enrollment_periods.new(effective_on_kind: params[:effective_on_kind])
special_enrollment_period.selected_effective_on = Date.strptime(params[:effective_on_date], "%m/%d/%Y") if params[:effective_on_date].present?
special_enrollment_period.qualifying_life_event_kind = qle
special_enrollment_period.qle_on = get_date(:qle_date)
special_enrollment_period.qle_on = Date.strptime(params[:qle_date], "%m/%d/%Y")
special_enrollment_period.market_kind = qle.market_kind == "individual" ? "ivl" : qle.market_kind
special_enrollment_period.save
end
Expand All @@ -180,6 +175,7 @@ def personal
@person.resident_role.build_nested_models_for_person if @person.is_resident_role_active?
@resident = @person.is_resident_role_active?

@bs4 = true if params[:bs4] == "true"
respond_to do |format|
format.html
format.js
Expand Down Expand Up @@ -253,7 +249,7 @@ def check_qle_date
today = TimeKeeper.date_of_record
start_date = today - 30.days
end_date = today + 30.days
@qle_event_date = get_date(:date_val)
@qle_event_date = Date.strptime(params[:date_val], "%m/%d/%Y")

if params[:qle_id].present?
@qle = QualifyingLifeEventKind.find(params[:qle_id])
Expand Down Expand Up @@ -664,7 +660,7 @@ def notice_upload_secure_message(notice, subject)
end

def calculate_dates
@qle_event_date = get_date(:date_val)
@qle_event_date = Date.strptime(params[:date_val], "%m/%d/%Y")
@qle = QualifyingLifeEventKind.find(params[:qle_id])
@qle_date = @qle.qle_event_date_kind == :qle_on ? @qle_event_date : TimeKeeper.date_of_record
start_date = TimeKeeper.date_of_record - @qle.post_event_sep_in_days.try(:days)
Expand All @@ -681,17 +677,4 @@ def calculate_dates
end

end

def get_date(date_param)
date_format = @bs4 ? "%Y-%m-%d" : "%m/%d/%Y"
Date.strptime(params[date_param], date_format)
end

def conditionally_bs4_enabled_actions
%i[record_sep check_qle_date check_move_reason check_marriage_reason check_insurance_reason personal]
end

def enable_bs4_layout
@bs4 = conditionally_bs4_enabled_actions.include?(action_name) ? params[:bs4] == "true" : true
end
end
32 changes: 7 additions & 25 deletions app/controllers/insured/family_members_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Insured::FamilyMembersController < ApplicationController
include ::L10nHelper

layout 'progress', only: [:index] if EnrollRegistry.feature_enabled?(:bs4_consumer_flow)
before_action :enable_bs4_layout, only: [:index, :destroy] if EnrollRegistry.feature_enabled?(:bs4_consumer_flow)
before_action :enable_bs4_layout, only: [:index] if EnrollRegistry.feature_enabled?(:bs4_consumer_flow)

before_action :dependent_person_params, only: [:create, :update]
before_action :set_current_person
Expand Down Expand Up @@ -144,24 +144,6 @@ def show
end
end

# NOTE: ensure that current user is either
# 1.) hbx admin, or
# 2.) the current user is the primary for the family AND the subject is a member of that family
def show_ssn
@family = Family.find(params[:family_id]) if params[:family_id]
authorize @family, :can_show_ssn?
@person = Person.find(params[:id]) unless @person.id == params[:id]

if @family.person_is_family_member?(@person)
payload = number_to_ssn(@person.ssn)
render json: { payload: payload, status: 200 }
else
render json: { message: "Unauthorized" }, status: 401
end
rescue Pundit::NotAuthorizedError, Mongoid::Errors::DocumentNotFound
render json: { message: "Unauthorized" }, status: 401
end

def edit
authorize @family, :edit?

Expand All @@ -171,8 +153,8 @@ def edit

@bs4 = true if params[:bs4] == "true"
respond_to do |format|
format.html { render 'edit.js.erb' }
format.js { render 'edit.js.erb' }
format.html
format.js
end
end

Expand Down Expand Up @@ -223,8 +205,8 @@ def update
@vlp_doc_subject = get_vlp_doc_subject_by_consumer_role(consumer_role) if consumer_role.present?
init_address_for_dependent
respond_to do |format|
format.html { render 'edit.js.erb' }
format.js { render 'edit.js.erb' }
format.html { render 'edit' }
format.js { render 'edit' }
end
end
end
Expand Down Expand Up @@ -319,8 +301,8 @@ def set_type_role_and_family
end
@family = @person.primary_family
when 'consumer'
@consumer_role = @person&.consumer_role
@family = @consumer_role&.person&.primary_family
@consumer_role = @person.consumer_role
@family = @consumer_role.person.primary_family
end

@family = Family.find(params[:family_id]) if params[:family_id]
Expand Down
75 changes: 12 additions & 63 deletions app/controllers/insured/group_selection_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,15 @@ class Insured::GroupSelectionController < ApplicationController
include L10nHelper
include Insured::FamiliesHelper

CANCELATION_REASONS = [
"medicare_cancel",
"medicaid_cancel",
"employer_cancel",
"spouse_cancel",
"parents_cancel",
"other_coverage_cancel",
"move_cancel",
"cost_cancel",
"unwanted_cancel",
"other_cancel"
].freeze


layout 'progress', only: [:new, :edit_plan] if EnrollRegistry.feature_enabled?(:bs4_consumer_flow)
before_action :enable_bs4_layout, only: [:new, :edit_plan] if EnrollRegistry.feature_enabled?(:bs4_consumer_flow)

layout 'progress', only: [:new] if EnrollRegistry.feature_enabled?(:bs4_consumer_flow)
before_action :enable_bs4_layout, only: [:new] if EnrollRegistry.feature_enabled?(:bs4_consumer_flow)

before_action :initialize_common_vars, only: [:new, :create, :terminate_selection]
before_action :validate_rating_address, only: [:create]
before_action :set_cache_headers, only: [:new, :edit_plan]
before_action :is_user_authorized?

helper_method :cancelation_reasons
helper_method :show_cancellation_reason
helper_method :show_termination_calendar?

def new
set_bookmark_url
set_admin_bookmark_url
Expand Down Expand Up @@ -126,7 +109,7 @@ def create
end

hbx_enrollment = build_hbx_enrollment(family_member_ids)
update_tobacco_field(hbx_enrollment.hbx_enrollment_members) if show_tobacco_field
update_tobacco_field(hbx_enrollment.hbx_enrollment_members) if ::EnrollRegistry.feature_enabled?(:tobacco_cost)

if @market_kind == 'shop' || @market_kind == 'fehb'
raise @adapter.no_employer_benefits_error_message(hbx_enrollment) unless hbx_enrollment.sponsored_benefit_package.shoppable?
Expand Down Expand Up @@ -183,19 +166,11 @@ def create
hbx_enrollment.update_osse_childcare_subsidy
redirect_to thankyou_insured_plan_shopping_path(change_plan: @change_plan, market_kind: @market_kind, coverage_kind: @adapter.coverage_kind, id: hbx_enrollment.id, plan_id: @adapter.previous_hbx_enrollment.product_id)
elsif @change_plan.present?
if EnrollRegistry.feature_enabled?(:choose_shopping_method) && @adapter.coverage_kind == 'health'
redirect_to choose_shopping_method_insured_plan_shopping_path(:id => hbx_enrollment.id, change_plan: @change_plan, market_kind: @market_kind, coverage_kind: @adapter.coverage_kind, enrollment_kind: @adapter.enrollment_kind)
else
redirect_to insured_plan_shopping_path(:id => hbx_enrollment.id, change_plan: @change_plan, market_kind: @market_kind, coverage_kind: @adapter.coverage_kind, enrollment_kind: @adapter.enrollment_kind)
end
redirect_to insured_plan_shopping_path(:id => hbx_enrollment.id, change_plan: @change_plan, market_kind: @market_kind, coverage_kind: @adapter.coverage_kind, enrollment_kind: @adapter.enrollment_kind)
else
# FIXME: models should update relationships, not the controller
hbx_enrollment.benefit_group_assignment.update(hbx_enrollment_id: hbx_enrollment.id) if hbx_enrollment.benefit_group_assignment.present?
if EnrollRegistry.feature_enabled?(:choose_shopping_method) && @adapter.coverage_kind == 'health'
redirect_to choose_shopping_method_insured_plan_shopping_path(:id => hbx_enrollment.id, market_kind: @market_kind, coverage_kind: @adapter.coverage_kind, enrollment_kind: @adapter.enrollment_kind)
else
redirect_to insured_plan_shopping_path(:id => hbx_enrollment.id, market_kind: @market_kind, coverage_kind: @adapter.coverage_kind, enrollment_kind: @adapter.enrollment_kind)
end
redirect_to insured_plan_shopping_path(:id => hbx_enrollment.id, market_kind: @market_kind, coverage_kind: @adapter.coverage_kind, enrollment_kind: @adapter.enrollment_kind)
end
else
raise "You must select the primary applicant to enroll in the healthcare plan"
Expand Down Expand Up @@ -258,18 +233,11 @@ def term_or_cancel
# @todo Refactor GroupSelectionController to implement the ideal solution. This is a temporary fix.
# Redirects to root path unless RIDP is verified for the given market kind and family.
(redirect_to(root_path) and return) unless ridp_verified?(hbx_enrollment.kind, hbx_enrollment.family)
@self_term_or_cancel_form = ::Insured::Forms::SelfTermOrCancelForm.for_post(
enrollment_id: params.require(:hbx_enrollment_id),
term_date: params[:term_date],
term_or_cancel: params[:term_or_cancel],
cancellation_reason: params[:cancellation_reason]
)
@self_term_or_cancel_form = ::Insured::Forms::SelfTermOrCancelForm.for_post({enrollment_id: params.require(:hbx_enrollment_id), term_date: params[:term_date], term_or_cancel: params[:term_or_cancel]})

if @self_term_or_cancel_form.errors.present?
flash[:error] = @self_term_or_cancel_form.errors.values.flatten.inject(""){|memo, error| "#{memo}<li>#{error}</li>"}
redirect_to edit_plan_insured_group_selections_path(hbx_enrollment_id: params[:hbx_enrollment_id], family_id: params[:family_id])
elsif params[:bs4]
redirect_to edit_plan_insured_group_selections_path(hbx_enrollment_id: params[:hbx_enrollment_id], family_id: params[:family_id])
flash[:success] = l10n("plan_canceled")
else
redirect_to family_account_path
end
Expand All @@ -285,16 +253,14 @@ def edit_aptc
aptc_applied_total = revise_aptc_applied_total(params, enrollment_id)
applied_aptc_pct = calculate_elected_aptc_pct(aptc_applied_total.to_f, params[:max_aptc].to_f)
attrs = {enrollment_id: enrollment_id, elected_aptc_pct: applied_aptc_pct, aptc_applied_total: aptc_applied_total}

begin
message = ::Insured::Forms::SelfTermOrCancelForm.for_aptc_update_post(attrs)
if params[:bs4]
flash[:success] = l10n('aptc_updated')
else
flash[:notice] = message
end
flash[:notice] = message
rescue StandardError => e
flash[:error] = "Unable to update tax credits for enrollment"
end

redirect_to family_account_path
end

Expand Down Expand Up @@ -348,12 +314,7 @@ def revise_aptc_applied_total(params, enrollment_id)
end

def calculate_elected_aptc_pct(aptc_applied_amount, aggregate_aptc_amount)
return 0.00 if aggregate_aptc_amount.zero?
if params[:bs4]
(aptc_applied_amount / aggregate_aptc_amount).round(4)
else
(aptc_applied_amount / aggregate_aptc_amount).round(2)
end
(aptc_applied_amount / aggregate_aptc_amount).round(2)
end

def is_user_authorized?
Expand Down Expand Up @@ -553,18 +514,6 @@ def update_tobacco_field(members)
end
end

def cancelation_reasons
CANCELATION_REASONS.map { |reason| l10n(reason) }
end

def show_cancellation_reason
::EnrollRegistry.feature_enabled?(:cancellation_reason)
end

def show_termination_calendar?
@self_term_or_cancel_form.enrollment.should_term_or_cancel_ivl == 'terminate'
end

def enable_bs4_layout
@bs4 = true
end
Expand Down
81 changes: 79 additions & 2 deletions app/helpers/navigation_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,87 @@ def local_assigned_boolean(local, default)
local == "true"
end

def family_info_progress_hash
if @change_plan.present?
qle_nav_options
elsif @type == "employee"
sep_nav_options
else
individual_nav_options
end
end

def plan_shopping_progress_hash
if @change_plan.blank? && @market_kind == "individual"
if @enrollment_kind.blank? && is_under_open_enrollment?
individual_nav_options
else
sep_nav_options
end
elsif @change_plan == "change_by_qle"
qle_nav_options
elsif @change_plan == "change_plan"
if (@market_kind == "individual" && !is_under_open_enrollment?) || @enrollment_kind == 'sep'
sep_shop_for_plans_nav_options
else
shop_for_plans_nav_options
end
end
end

def sign_up_nav_options
[
{step: 1, label: l10n('tell_us_about_yourself')},
{step: 2, label: l10n('family_info')}
{step: 1, page_key: :personal_info, display_label: l10n('tell_us_about_yourself')},
{step: 2, page_key: :family_info, display_label: l10n('family_info')}
]
end

def individual_nav_options
[
{step: 1, page_key: :personal_info, display_label: l10n('personal_information')},
{step: 2, page_key: :verify_identity, display_label: l10n('insured.consumer_roles.upload_ridp_documents.header')},
{step: 3, page_key: :household_info, display_label: l10n('household_info')},
{step: 4, page_key: :choose_plan, display_label: l10n('choose_plan')},
{step: 5, page_key: :review, display_label: l10n('confirm_selection')},
{step: 6, page_key: :complete, display_label: l10n('complete')}
]
end

def sep_nav_options
[
{step: 1, page_key: :personal_info, display_label: l10n('personal_information')},
{step: 2, page_key: :verify_identity, display_label: l10n('verify_identity')},
{step: 3, page_key: :household_info, display_label: l10n('household_info')},
{step: 4, page_key: :sep, display_label: l10n('insured.families.special_enrollment_period')},
{step: 5, page_key: :choose_plan, display_label: l10n('choose_plan')},
{step: 6, page_key: :review, display_label: l10n('confirm_selection')},
{step: 7, page_key: :complete, display_label: l10n('complete')}
]
end

def qle_nav_options
[
{step: 1, page_key: :household_info, display_label: l10n('household_info')},
{step: 2, page_key: :choose_plan, display_label: l10n('plan_selection')},
{step: 3, page_key: :review, display_label: l10n('review')},
{step: 4, page_key: :complete, display_label: l10n('complete')}
]
end

def sep_shop_for_plans_nav_options
[
{step: 1, page_key: :sep, display_label: l10n('insured.families.special_enrollment_period')},
{step: 2, page_key: :choose_plan, display_label: l10n('plan_selection')},
{step: 3, page_key: :review, display_label: l10n('review')},
{step: 4, page_key: :complete, display_label: l10n('complete')}
]
end

def shop_for_plans_nav_options
[
{step: 1, page_key: :choose_plan, display_label: l10n('plan_selection')},
{step: 2, page_key: :review, display_label: l10n('review')},
{step: 3, page_key: :complete, display_label: l10n('complete')}
]
end
end
Loading

0 comments on commit 87eb91a

Please sign in to comment.