From 8d1035aabe515f756d9d02f3d5ca3c8fb9cdb076 Mon Sep 17 00:00:00 2001 From: Brad Bodine Date: Fri, 19 Jul 2024 14:16:46 -0500 Subject: [PATCH] refactor: Add unique IDs to input fields in consumer roles docs (#4006) * upgrade to bs4 base * revert temp changes for design review to trunk * registration process * more work on consumer flow * fix fonts, more ridp work started * 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 <78749008+kristinmerbach@users.noreply.github.com> * bs4 plan shopping family info & choose cov for HH pages (#3821) * 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 * 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 <78749008+kristinmerbach@users.noreply.github.com> * 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 <78749008+kristinmerbach@users.noreply.github.com> * 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 * 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 <78749008+kristinmerbach@users.noreply.github.com> * 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 <78749008+kristinmerbach@users.noreply.github.com> * 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 <78749008+kristinmerbach@users.noreply.github.com> * 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 <78749008+kristinmerbach@users.noreply.github.com> Signed-off-by: Sarah Austin Co-authored-by: Kristin Merbach Co-authored-by: Charlie Parker Co-authored-by: kvootla Co-authored-by: Alec Turnbull Co-authored-by: kristinmerbach <78749008+kristinmerbach@users.noreply.github.com> Co-authored-by: Alec Turnbull * bs4 income adjustments (#3954) * todos * add red required asterisk mc * remove date debug comments * remove newline * more section work mc * work through coverage mc * remove hack for frozen string and update displayable_field? mc * add income table * translation work, use existing gray colors for table borders mc * modal work * fix modal id * modal title fix * continue text for mec banner * coverage required fixes mc * move caretaker string to review section mc * translation cleanup * more localization work mc * fix hover color * fix asterisk * m mcodernize review_benefits partial (need to remove debug) * debug removal, translation esi work mc * move esi fields to partial * add bottom sections mc * fix formatted string * add subsection partial * pass in applicant for summary section mc * move hash helpers to new file mc * add translation helper for review and submit hashes mc * add private helpers for displayable field and add missing row map calls for foster care keys * move translator module into helper module, fix displayable helper callers for applicant * cleanup mc * use key for expected * fix caretaker key, view cleanup mc * use human boolean for parent outside * undo rebase issue * fix continue application content * add missing upcase * undo lock file change * update hover * remove todo * titleize relationship, add helpers for hash constructors * classify displayable helpers * remove class_name method * add include, fix wrong variable name for relationship builder * remove unneeded helper declaration * remove newline Signed-off-by: Charlie Parker * add bs4 outline to view, logic to controller mc * inital review work - update controller to support action, implement Personal Info and Tax rows mc mc * fix for review and submit layout mc * move selectric handling to js for other questions * initial page work mc * update form, update date formatting for date fields, disable selectric on drop downs * save cancel button work * remove debug * remove unneeded ids, fix error on translations but still need correct content mc * add nav, update form partial to default save button to disabled * fix save button and form disabling * fix add more link permeance after removal * fix created income UI showing legacy, fix edit button not working * remove unneeded bs4 set * move other actions to conditional mc * add date field for income, fix bug causing fake input fields to be enabled upon edit -> cancel flow * use date field for unemployment * fix add button permeance bug after remove for unemployment mc * cleanup mc * update disable for deductions * cleanup * cancel fix, other income form class fixes * fix cancel button reseting checkbox bug, update padding for elements in form partials to be consistent with non-form partials * update edit and remove buttons for deductions, remove repeated edit class for other income * swap id and class for add more button in both legacy and bs4 * add missing enable from rebase * add missing when from rebase * fix destroy/destroy all handling to ensure permeance of add new button when there are still other deductions for the kind, fix replace bug that caused the add new button to be hidden when adding a new deduction after deleting a deduction * update add new button hiding * button fixes - use outline for remove and use button class for edit to allow edit disabling * remove add more on destroy all * modal and translation work * add logic to reset deduction form when empty and uncheck * edit, cancel, add new fixes for other income * fix deduction remove not causing checkbox reset, break out deduction kind remove to function, refactor deduction kind remove to handle concurrency * disable all income edit buttons while editing for other/unemployment along with class update to btn to allow disable, start selector syntax fix for removeDeduction method, add removeIncome method, add other income checkbox uncheck handling for no created deductions case, button styling fix for modals * support add new disable for unemployment, remove unneeded selector from replace, margin fixes for unemployment cancel and unemployment add more * support add more disable for other income * margin fixes for buttons, apply other income add disable universally * add more fixes * add progress button disable functionality * fix new form permeating when removing all deduction kinds, fix add more permeating when unchecking kind with open form * fix other income add more permeating when unchecking kind with an income and form, fix doubling up of income when creating income after removing all kind with an income and form * cleanup cancel, fix unemployment add more to not appear for initial entry * remove cleanup * add legacy handling for deductions * hide add more on cancel when no other existing * auto uncheck unemployment on final delete, fix cancel handling * fix add more permeance for cancel new deduction, break out reset into function, update income edit disabling to account for unemployment * selector fixes, make frequency required * update modals and allow disabling of a tags * fix broken translation * translation cleanup for me, remove labels from subsection partial and replace with dl, add required class for dt * rename key string * remove unneeded style * remove unused strings * update margins of form buttons and checkboxes to match mockups * remove add new deduction bottom margin, add x margin for deduction/other driver radios, update deduction form edit/create to disable remove button of other forms * restructure other markup, update save input class to button to match disabled styling, disable remove button for income.js when editing * class fixes * update edit toggling selectors to not disable divs which directly own buttons * ss string fix * fix leave warning modal * cleanup * add support for ai an * set deductions actions from params * restore legacy add replace * consolidate add link * update disabled style to select all bottom level, non a & button elements so that a & buttons can be individually styled, update new form cloning to prevent multiple form label error * remove debug * comment fixes * update forms to validate date warnings using bs4 date format, add date warning UI for bs4, update date warning content to match mockups * fix date parsing for bs4 * income note field work * add end date translation * fix syntax error * remove unneeded keys from merge * fix legacy income note * translation cleanup * update leave edit to not enable submit buttons, remove redundant disable on fake inputs * more translation cleanup * disable help links * fix review description list * cleanup * fix unemployment edit delete * fix date parsing * update other questions date parsing * modal work * add date warning to other income, remove undefined check in js * move warning partials * flex work * rollback debug * remove extra semi colon * disable yes/no text * remove left margins on inputs * more margin updates * remove margin on unemployment add more * add leave ids --------- Signed-off-by: Charlie Parker * uplift job income page to bs4 (#3974) * personal information page redo * job income changes * missing translations * updates to translation * cleanup unneeded class changes * remove extra changed file * more cleanup * changes from PR comments * fixed * header sizing order issue * remove br * small nav bug for nonbs4 * improve spacing * fix income_kind * clean up nits * phone input masking * more changings --------- Co-authored-by: Kristin Merbach * refactor: Add unique IDs to input fields in consumer roles docs shared partials --------- Signed-off-by: kristinmerbach <78749008+kristinmerbach@users.noreply.github.com> Signed-off-by: Sarah Austin Signed-off-by: Charlie Parker Co-authored-by: Sarah Austin Co-authored-by: Kristin Merbach Co-authored-by: kristinmerbach <78749008+kristinmerbach@users.noreply.github.com> Co-authored-by: Charlie Parker Co-authored-by: kvootla Co-authored-by: Alec Turnbull Co-authored-by: Alec Turnbull --- app/javascript/css/colors.scss | 142 +- app/javascript/css/contrast_level_aa.scss | 48 +- app/javascript/css/dc.scss | 2 +- .../docs_shared/_card_number.html.erb | 3 +- .../docs_shared/_citizenship_number.html.erb | 3 +- .../_country_of_citizenship.html.erb | 12 +- .../docs_shared/_i_94_number.html.erb | 3 +- .../_naturalization_number.html.erb | 3 +- .../docs_shared/_passport_number.html.erb | 3 +- .../docs_shared/_servis_id.html.erb | 3 +- .../docs_shared/_visa_number.html.erb | 3 +- app/views/insured/families/personal.js.erb | 2 +- .../family_members/_dependent.html.erb | 2 +- .../family_members/_dependent_form.html.erb | 2 +- app/views/insured/family_members/show.js.erb | 2 +- .../_outstanding_ridp_documents.html.erb | 3 +- app/views/layouts/application.html.erb | 4 + app/views/shared/_age_off_excluded.html.erb | 2 +- app/views/shared/_sep_progress.html.erb | 2 +- .../financial_assistance/income.js | 1593 +++++++++++------ .../_faa_progress_options.html.erb | 26 + .../shared/_date_warning.html.erb | 2 +- 22 files changed, 1191 insertions(+), 674 deletions(-) create mode 100644 components/financial_assistance/app/views/financial_assistance/applications/_faa_progress_options.html.erb diff --git a/app/javascript/css/colors.scss b/app/javascript/css/colors.scss index 8a47695dc32..f4281a65f16 100644 --- a/app/javascript/css/colors.scss +++ b/app/javascript/css/colors.scss @@ -34,38 +34,37 @@ // May be unique colors, but used by all clients --bright-green: hsl(65, 100%, 42%); --orange: hsl(359, 80%, 54%); - } -[data-theme="me"] { +[data-theme='me'] { --default-font-color: #323130; --text-secondary: hsla(30, 2%, 37%, 1); //palette - --primary-color: #3D5D6F; - --primary-color-dark: #314A59; + --primary-color: #3d5d6f; + --primary-color-dark: #314a59; --primary-color-darker: #253843; --default-font-color: #323130; --placeholder-color: #676767; --placeholder-font-weight: 400; --floatlabel-color: #767676; - --floatlabel-onclick-color:#676767; + --floatlabel-onclick-color: #676767; --input-text-color: #454545; --form-element-text-color: #454545; --default-font-color: #323130; --placeholder-color: #676767; --floatlabel-color: #767676; - --floatlabel-onclick-color:#676767; + --floatlabel-onclick-color: #676767; --input-text-color: #454545; --form-element-text-color: #454545; - --secondary-color: #3B6B90; - --secondary-color-dark: #2E5470; - --secondary-color-darker: #213C50; + --secondary-color: #3b6b90; + --secondary-color-dark: #2e5470; + --secondary-color-darker: #213c50; - --tertiary-color: #5A7334; + --tertiary-color: #5a7334; --tertiary-color-dark: #465929; - --tertiary-color-darker: #32401D; + --tertiary-color-darker: #32401d; //fundamentals --primary-hover-color: var(--primary-color-dark); @@ -85,7 +84,7 @@ --placeholder-color: #676767; --placeholder-font-weight: 400; --floatlabel-color: #767676; - --floatlabel-onclick-color:#676767; + --floatlabel-onclick-color: #676767; --input-text-color: #454545; --form-element-text-color: #454545; @@ -93,126 +92,125 @@ --button-default-hover-color: var(--primary-hover-color); --button-default-active-color: var(--primary-color-darker); - --enrollment-status-red: #A21E1F; + --enrollment-status-red: #a21e1f; --enrollment-status-green: #027314; - --enrollment-status-yellow: #E5A900; + --enrollment-status-yellow: #e5a900; --enrollment-status-blue: #003260; - --enrollment-status-grey: #3B3A39; + --enrollment-status-grey: #3b3a39; - --button-primary-color: #3D5D6F; - --button-primary-hover-color: #314A59; + --button-primary-color: #3d5d6f; + --button-primary-hover-color: #314a59; --button-primary-active-color: #253843; - --button-secondary-color: #3B6B90; - --button-secondary-hover-color: #345F80; + --button-secondary-color: #3b6b90; + --button-secondary-hover-color: #345f80; --button-secondary-active-color: #274760; - --button-tertiary-color: #647F3A; - --button-tertiary-hover-color: #50662E; - --button-tertiary-active-color: #3C4C23; + --button-tertiary-color: #647f3a; + --button-tertiary-hover-color: #50662e; + --button-tertiary-active-color: #3c4c23; --button-error-color: var(--status-red); --button-error-hover-color: var(--status-red-hover); --button-error-active-color: var(--status-red-active); } -[data-theme="dc"] { +[data-theme='dc'] { --default-font-color: #323130; - --body-color: #FAFAFA; + --body-color: #fafafa; --placeholder-color: #676767; --floatlabel-color: #767676; - --floatlabel-onclick-color:#676767; + --floatlabel-onclick-color: #676767; --input-text-color: #454545; --form-element-text-color: #454545; - --button-default-color: #4A7EA6; - --button-default-hover-color: #345F80; + --button-default-color: #4a7ea6; + --button-default-hover-color: #345f80; --button-default-active-color: #274760; - --enrollment-status-red: #A21E1F; + --enrollment-status-red: #a21e1f; --enrollment-status-green: #027314; - --enrollment-status-yellow: #E5A900; + --enrollment-status-yellow: #e5a900; --enrollment-status-blue: #003260; - --enrollment-status-grey: #3B3A39; + --enrollment-status-grey: #3b3a39; //buttons - --button-primary-color: #007BC4; - --button-primary-hover-color: #00629D; - --button-primary-active-color: #004A76; + --button-primary-color: #007bc4; + --button-primary-hover-color: #00629d; + --button-primary-active-color: #004a76; --button-secondary-color: #003260; - --button-secondary-hover-color: #00284D; - --button-secondary-active-color: #001E3A; + --button-secondary-hover-color: #00284d; + --button-secondary-active-color: #001e3a; - --button-tertiary-color: #9D6E00; - --button-tertiary-hover-color: #7E5800; - --button-tertiary-active-color: #5E4200; + --button-tertiary-color: #9d6e00; + --button-tertiary-hover-color: #7e5800; + --button-tertiary-active-color: #5e4200; - --button-error-color: #A21E1F; - --button-error-hover-color: #85191A; + --button-error-color: #a21e1f; + --button-error-hover-color: #85191a; --button-error-active-color: #671314; } - -[data-contrast="true"] { - --secondary-font-color: #676C72; //secondary text gray +[data-contrast='true'] { + --secondary-font-color: #676c72; //secondary text gray --bold-font-color: #323130; //bold text - --theme-primary-blue: #3B6B90; //primary blue - --theme-secondary: #425C6E; //secondary dark blue - --primary-red: #D42537; //primary red - --background-light-red: #F9F1F1; //error notice background color - --primary-green: #5A7334; //green continue buttons - --secondary-green: #738C4A; //green for continue button hover - --success-green-background: #E3F9E6; //green for success pill - - --primary-yellow: #FFD600; - --soft-yellow: #FFFADF; + --theme-primary-blue: #3b6b90; //primary blue + --theme-secondary: #425c6e; //secondary dark blue + --primary-red: #d42537; //primary red + --background-light-red: #f9f1f1; //error notice background color + --primary-green: #5a7334; //green continue buttons + --secondary-green: #738c4a; //green for continue button hover + --success-green-background: #e3f9e6; //green for success pill + + --primary-yellow: #ffd600; + --soft-yellow: #fffadf; --primary-white: #ffffff; --primary-black: #000000; - --alert-notice-green: #62703E; //success notice green - --soft-blue: #D6EBFF; //home page right nav text color + --alert-notice-green: #62703e; //success notice green + --soft-blue: #d6ebff; //home page right nav text color - --status-red: #A21E1F; //status danger - --status-red-hover: #85191A; //status danger + --status-red: #a21e1f; //status danger + --status-red-hover: #85191a; //status danger --status-red-active: #671314; //status danger --status-blue: #003260; //status pending - --status-yellow: #E5A900; //status needs info + --status-yellow: #e5a900; //status needs info --status-green: #027314; //status complete - --light-gray: #A19F9D; + --light-gray: #a19f9d; --default-font-color: #323130; --placeholder-color: #676767; --floatlabel-color: #767676; - --floatlabel-onclick-color:#676767; + --floatlabel-onclick-color: #676767; --input-text-color: #454545; --form-element-text-color: #454545; - --button-default-color: #3D5D6F; - --button-default-hover-color: #314A59; + --button-default-color: #3d5d6f; + --button-default-hover-color: #314a59; --button-default-active-color: #253843; - --button-primary-color: #3D5D6F; - --button-primary-hover-color: #314A59; + --button-primary-color: #3d5d6f; + --button-primary-hover-color: #314a59; --button-primary-active-color: #253843; - --button-secondary-color: #3B6B90; - --button-secondary-hover-color: #345F80; + --button-secondary-color: #3b6b90; + --button-secondary-hover-color: #345f80; --button-secondary-active-color: #274760; - --button-tertiary-color: #647F3A; - --button-tertiary-hover-color: #50662E; - --button-tertiary-active-color: #3C4C23; + --button-tertiary-color: #647f3a; + --button-tertiary-hover-color: #50662e; + --button-tertiary-active-color: #3c4c23; --button-error-color: var(--status-red); --button-error-hover-color: var(--status-red-hover); --button-error-active-color: var(--status-red-active); - --enrollment-status-red: #A21E1F; + --enrollment-status-red: #a21e1f; --enrollment-status-green: #027314; - --enrollment-status-yellow: #E5A900; + --enrollment-status-yellow: #e5a900; --enrollment-status-blue: #003260; - --enrollment-status-grey: #3B3A39; + --enrollment-status-grey: #3b3a39; } diff --git a/app/javascript/css/contrast_level_aa.scss b/app/javascript/css/contrast_level_aa.scss index 01f4df1d9c0..90c8d7fa872 100644 --- a/app/javascript/css/contrast_level_aa.scss +++ b/app/javascript/css/contrast_level_aa.scss @@ -1,6 +1,6 @@ // all contents of this file must be nested within the data-contrast="true" selector to make sure they don't leak to other themes. // These will only be applied if the contrast level is set to true in the layout. -[data-contrast="true"] { +[data-contrast='true'] { --font: Barlow, sans-serif; --placeholder-font-weight: 400; @@ -9,59 +9,59 @@ border-radius: 18px; border: 1px; background-color: var(--status-yellow); - } + } - .success-notice { + .success-notice { padding: 8px 14px 8px 14px; border-radius: 18px; - border: 1px solid ; + border: 1px solid; background-color: var(--success-green-background); - } + } - .warning-status-hide { + .warning-status-hide { display: none !important; - } + } - .success-status-hide { + .success-status-hide { display: none !important; - } + } - .icon { + .icon { width: 1em; - } + } - // use these in case we want to improve the icons used for "info needed" statuses on the FAA application workflow - .warning-icon-small { + // use these in case we want to improve the icons used for "info needed" statuses on the FAA application workflow + .warning-icon-small { background-image: url('../../assets/images/warning-icon-small.svg'); background-repeat: no-repeat; background-position: center; color: transparent !important; padding: 1px; margin-right: 5px !important; - } - .warning-icon { + } + .warning-icon { background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.49845 2.29672C10.5292 0.234426 13.4708 0.234426 14.5016 2.29672L22.9501 19.2003C23.8802 21.0612 22.5273 23.25 20.4485 23.25H3.55146C1.47273 23.25 0.11977 21.0612 1.0499 19.2003L9.49845 2.29672Z' fill='%23FFD600' stroke='%233B3A39' stroke-width='1.5'/%3E%3Cpath d='M13.0089 15.8215H11.0074L10.589 7.80707H13.4273L13.0089 15.8215ZM10.5562 18.627C10.5562 18.1676 10.6793 17.8203 10.9254 17.5852C11.1714 17.35 11.5297 17.2325 12 17.2325C12.4539 17.2325 12.8039 17.3528 13.05 17.5934C13.3015 17.834 13.4273 18.1786 13.4273 18.627C13.4273 19.059 13.3015 19.4008 13.05 19.6524C12.7984 19.8985 12.4484 20.0215 12 20.0215C11.5406 20.0215 11.1851 19.9012 10.9336 19.6606C10.682 19.4145 10.5562 19.07 10.5562 18.627Z' fill='%233B3A39'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: center; color: transparent !important; font-size: 27px !important; - } + } - .ready-4-review .note.purple::before { + .ready-4-review .note.purple::before { display: none; - } + } - .note.purple { + .note.purple { display: none; - } + } - .complete-icon-text{ + .complete-icon-text { font-weight: normal !important; - } + } - #account-detail .popover { + #account-detail .popover { .arrow:after { border-right-color: transparent; } - } + } } diff --git a/app/javascript/css/dc.scss b/app/javascript/css/dc.scss index 79a9925e6e0..e2e2b97135f 100644 --- a/app/javascript/css/dc.scss +++ b/app/javascript/css/dc.scss @@ -1,5 +1,5 @@ // all contents of this file must be nested within the data-theme="dc" selector to make sure they don't leak to other clients. -[data-theme="dc"] { +[data-theme='dc'] { --font: 'Open Sans', sans-serif; --placeholder-font-weight: 400; } diff --git a/app/views/insured/consumer_roles/docs_shared/_card_number.html.erb b/app/views/insured/consumer_roles/docs_shared/_card_number.html.erb index c263984d76f..7b2880c04b2 100644 --- a/app/views/insured/consumer_roles/docs_shared/_card_number.html.erb +++ b/app/views/insured/consumer_roles/docs_shared/_card_number.html.erb @@ -5,7 +5,8 @@ <%= v.text_field :card_number, :placeholder => l10n("insured.consumer_roles.docs_shared.card_number"), :pattern => "[a-zA-Z0-9]{13}", :class => "#{FinancialAssistanceRegistry.feature_enabled?(:optional_document_fields) ? "" : "required" } doc_fields", - :title => description.gsub("-li-", "") %> + :title => description.gsub("-li-", ""), + :id => "card_number" %> <%= render :partial => "insured/consumer_roles/docs_shared/vlp_doc_requirements", locals: {req: description} %> <% else %> diff --git a/app/views/insured/consumer_roles/docs_shared/_citizenship_number.html.erb b/app/views/insured/consumer_roles/docs_shared/_citizenship_number.html.erb index a5cd54820e2..751b77495a9 100644 --- a/app/views/insured/consumer_roles/docs_shared/_citizenship_number.html.erb +++ b/app/views/insured/consumer_roles/docs_shared/_citizenship_number.html.erb @@ -4,7 +4,8 @@ <%= v.text_field :citizenship_number, :placeholder => l10n("insured.consumer_roles.docs_shared.citizenship_number"), :pattern => "[a-zA-Z0-9]{6,12}", :class => "doc_fields", - :title => l10n("insured.consumer_roles.docs_shared.citizenship_number_req").gsub("-li-", "") %> + :title => l10n("insured.consumer_roles.docs_shared.citizenship_number_req").gsub("-li-", ""), + :id => "citizenship_number" %> <%= render :partial => "insured/consumer_roles/docs_shared/vlp_doc_requirements", locals: {req: l10n("insured.consumer_roles.docs_shared.citizenship_number_req")} %> <% else %> diff --git a/app/views/insured/consumer_roles/docs_shared/_country_of_citizenship.html.erb b/app/views/insured/consumer_roles/docs_shared/_country_of_citizenship.html.erb index 34b0853ceee..83a0f58b2cb 100644 --- a/app/views/insured/consumer_roles/docs_shared/_country_of_citizenship.html.erb +++ b/app/views/insured/consumer_roles/docs_shared/_country_of_citizenship.html.erb @@ -1,8 +1,12 @@ <% if @bs4 %> -
- <%= label_tag :country_of_citizenship, l10n("insured.consumer_roles.docs_shared.country_of_citizenship"), class: "weight-n" %> - <%= v.select :country_of_citizenship, options_for_select(::VlpDocument::COUNTRIES_LIST, @country||=l10n("insured.consumer_roles.docs_shared.country_of_citizenship")), prompt: l10n("insured.consumer_roles.docs_shared.country_of_citizenship"), class: "select_tag" %> -
+
+ <%= label_tag :country_of_citizenship, l10n("insured.consumer_roles.docs_shared.country_of_citizenship"), class: "weight-n" %> + <%= v.select :country_of_citizenship, + options_for_select(::VlpDocument::COUNTRIES_LIST, @country ||= l10n("insured.consumer_roles.docs_shared.country_of_citizenship")), + { prompt: l10n("insured.consumer_roles.docs_shared.country_of_citizenship") }, + { class: "select_tag", id: "country_of_citizenship" } %> +
+ <% else %>
<%= v.select :country_of_citizenship, options_for_select(::VlpDocument::COUNTRIES_LIST, @country||=l10n("insured.consumer_roles.docs_shared.country_of_citizenship")), prompt: l10n("insured.consumer_roles.docs_shared.country_of_citizenship"), class: "select_tag" %>
diff --git a/app/views/insured/consumer_roles/docs_shared/_i_94_number.html.erb b/app/views/insured/consumer_roles/docs_shared/_i_94_number.html.erb index 6f85f0c8b90..7b2d3e33f6b 100644 --- a/app/views/insured/consumer_roles/docs_shared/_i_94_number.html.erb +++ b/app/views/insured/consumer_roles/docs_shared/_i_94_number.html.erb @@ -4,7 +4,8 @@ <%= v.text_field :i94_number, :placeholder => l10n("insured.consumer_roles.docs_shared.i94_number"), :pattern => "[A-Za-z0-9]{11}", :class => "doc_fields", - :title => l10n("insured.consumer_roles.docs_shared.i94_number_req").gsub("-li-", "") %> + :title => l10n("insured.consumer_roles.docs_shared.i94_number_req").gsub("-li-", ""), + :id => "i94_number" %> <%= render :partial => "insured/consumer_roles/docs_shared/vlp_doc_requirements", locals: {req: l10n("insured.consumer_roles.docs_shared.i94_number_req")} %>
<% else %> diff --git a/app/views/insured/consumer_roles/docs_shared/_naturalization_number.html.erb b/app/views/insured/consumer_roles/docs_shared/_naturalization_number.html.erb index f068d6ac208..abda8465fe1 100644 --- a/app/views/insured/consumer_roles/docs_shared/_naturalization_number.html.erb +++ b/app/views/insured/consumer_roles/docs_shared/_naturalization_number.html.erb @@ -4,7 +4,8 @@ <%= v.text_field :naturalization_number, :placeholder => l10n("insured.consumer_roles.docs_shared.naturalization_number"), :pattern => "[a-zA-Z0-9]{6,12}", :class => "doc_fields", - :title => l10n("insured.consumer_roles.docs_shared.naturalization_number_req").gsub("-li-", "") %> + :title => l10n("insured.consumer_roles.docs_shared.naturalization_number_req").gsub("-li-", ""), + :id => "naturalization_number" %> <%= render :partial => "insured/consumer_roles/docs_shared/vlp_doc_requirements", locals: {req: l10n("insured.consumer_roles.docs_shared.naturalization_number_req")} %> <% else %> diff --git a/app/views/insured/consumer_roles/docs_shared/_passport_number.html.erb b/app/views/insured/consumer_roles/docs_shared/_passport_number.html.erb index d9ab1f92d90..b54360bc2db 100644 --- a/app/views/insured/consumer_roles/docs_shared/_passport_number.html.erb +++ b/app/views/insured/consumer_roles/docs_shared/_passport_number.html.erb @@ -4,7 +4,8 @@ <%= v.text_field :passport_number, :placeholder => l10n("insured.passport_number"), :pattern => "[a-zA-Z0-9]{6,12}", :class => "doc_fields", - :title => l10n("insured.passport_number_req").gsub("-li-", "") %> + :title => l10n("insured.passport_number_req").gsub("-li-", ""), + :id => "passport_number" %> <%= render :partial => "insured/consumer_roles/docs_shared/vlp_doc_requirements", locals: {req: l10n("insured.passport_number_req")} %> <% else %> diff --git a/app/views/insured/consumer_roles/docs_shared/_servis_id.html.erb b/app/views/insured/consumer_roles/docs_shared/_servis_id.html.erb index 335d19290f1..6b59e55870a 100644 --- a/app/views/insured/consumer_roles/docs_shared/_servis_id.html.erb +++ b/app/views/insured/consumer_roles/docs_shared/_servis_id.html.erb @@ -4,7 +4,8 @@ <%= v.text_field :sevis_id, :placeholder => l10n("insured.consumer_roles.docs_shared.sevis_id"), :pattern => "\\d{10}", :class => "doc_fields", - :title => l10n("insured.consumer_roles.docs_shared.sevis_id_req").gsub("-li-", "") %> + :title => l10n("insured.consumer_roles.docs_shared.sevis_id_req").gsub("-li-", ""), + :id => "sevis_id" %> <%= render :partial => "insured/consumer_roles/docs_shared/vlp_doc_requirements", locals: {req: l10n("insured.consumer_roles.docs_shared.sevis_id_req")} %> <% else %> diff --git a/app/views/insured/consumer_roles/docs_shared/_visa_number.html.erb b/app/views/insured/consumer_roles/docs_shared/_visa_number.html.erb index 233a8130221..2c68ff7680f 100644 --- a/app/views/insured/consumer_roles/docs_shared/_visa_number.html.erb +++ b/app/views/insured/consumer_roles/docs_shared/_visa_number.html.erb @@ -4,7 +4,8 @@ <%= v.text_field :visa_number, :placeholder => l10n("insured.consumer_roles.docs_shared.visa_number"), :pattern => "[a-zA-Z0-9]{8,12}", :class => "doc_fields", - :title => l10n("insured.consumer_roles.docs_shared.visa_number_req").gsub("-li-", "") %> + :title => l10n("insured.consumer_roles.docs_shared.visa_number_req").gsub("-li-", ""), + :id => "visa_number" %> <%= render :partial => "insured/consumer_roles/docs_shared/vlp_doc_requirements", locals: {req: l10n("insured.consumer_roles.docs_shared.visa_number_req")} %> <% else %> diff --git a/app/views/insured/families/personal.js.erb b/app/views/insured/families/personal.js.erb index 0cebc66704d..4b69be62469 100644 --- a/app/views/insured/families/personal.js.erb +++ b/app/views/insured/families/personal.js.erb @@ -27,4 +27,4 @@ // Had to extensively call this function because this is being called only on Document load. // FAA specific case For Primary Demographic fields conditional edit. demographicValidations(); -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/insured/family_members/_dependent.html.erb b/app/views/insured/family_members/_dependent.html.erb index d360f711075..436537fe198 100644 --- a/app/views/insured/family_members/_dependent.html.erb +++ b/app/views/insured/family_members/_dependent.html.erb @@ -75,4 +75,4 @@ Freebies.floatlabels(); -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/insured/family_members/_dependent_form.html.erb b/app/views/insured/family_members/_dependent_form.html.erb index d2135e37e70..9e9c169d411 100644 --- a/app/views/insured/family_members/_dependent_form.html.erb +++ b/app/views/insured/family_members/_dependent_form.html.erb @@ -500,4 +500,4 @@ } -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/insured/family_members/show.js.erb b/app/views/insured/family_members/show.js.erb index f5d414da23c..500546e2d86 100644 --- a/app/views/insured/family_members/show.js.erb +++ b/app/views/insured/family_members/show.js.erb @@ -16,4 +16,4 @@ if (!$(".my-household-page")) { } else { //manage family/ my household page location.reload(); -} \ No newline at end of file +} diff --git a/app/views/insured/fdsh_ridp_verifications/_outstanding_ridp_documents.html.erb b/app/views/insured/fdsh_ridp_verifications/_outstanding_ridp_documents.html.erb index 49cf470c3b6..aac6c2c0420 100644 --- a/app/views/insured/fdsh_ridp_verifications/_outstanding_ridp_documents.html.erb +++ b/app/views/insured/fdsh_ridp_verifications/_outstanding_ridp_documents.html.erb @@ -77,7 +77,7 @@ <%= link_to(insured_ridp_document_path(ridp_doc, :person_id => @person.id), method: :delete, remote: true, class: "btn-error outline text-nowrap") do %> <%= l10n("insured.consumer_roles.upload_ridp_documents.remove") %> - <% end %> + <% end)%> <% end %> @@ -182,6 +182,7 @@ +
<%= h(link_to 'Documents FAQ', ::EnrollRegistry[:enroll_app].setting(:submit_docs_url).item, class: "btn btn-default btn-small pull-right", target: '_blank', rel: "noopener noreferrer") %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index f555f27b09c..5c98ff4820f 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -15,6 +15,10 @@ <%= csrf_meta_tags %> + <%= javascript_pack_tag 'application' %> + <%= javascript_include_tag "application" %> + <%= stylesheet_pack_tag 'application', media: "all" %> + <%= javascript_pack_tag ENV['CLIENT'] %> <%= stylesheet_pack_tag ENV['CLIENT'] %> diff --git a/app/views/shared/_age_off_excluded.html.erb b/app/views/shared/_age_off_excluded.html.erb index 084b959eecb..da95abb4ee2 100644 --- a/app/views/shared/_age_off_excluded.html.erb +++ b/app/views/shared/_age_off_excluded.html.erb @@ -12,4 +12,4 @@ Ageoff Exclusion
-<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/shared/_sep_progress.html.erb b/app/views/shared/_sep_progress.html.erb index 58fcdba1c72..3637333f6b9 100644 --- a/app/views/shared/_sep_progress.html.erb +++ b/app/views/shared/_sep_progress.html.erb @@ -80,4 +80,4 @@ show_previous_button: ![1, 7].include?(step), show_account_button: step > 2 && EnrollRegistry.feature_enabled?(:back_to_account_all_shop), show_help_button: step < 7, - is_complete: step == 7 } %> \ No newline at end of file + is_complete: step == 7 } %> diff --git a/components/financial_assistance/app/assets/javascripts/financial_assistance/income.js b/components/financial_assistance/app/assets/javascripts/financial_assistance/income.js index f19471b5eb5..793697b9909 100644 --- a/components/financial_assistance/app/assets/javascripts/financial_assistance/income.js +++ b/components/financial_assistance/app/assets/javascripts/financial_assistance/income.js @@ -1,30 +1,55 @@ function stopEditingIncome() { shouldShowEndDateWarningModal = false; // remove disabled style from drivers, instructions, and other income kinds - $('.driver-question, .driver-question a, .instruction-row, .income, .other-income-kind, .unemployment-income').removeClass('disabled'); + $( + '.driver-question, .driver-question a, .instruction-row, .income, .other-income-kind, .unemployment-income' + ).removeClass('disabled'); // enable inputs on drivers, instructions, and income kinds - except for submit (save) buttons as this would enable the submit button in the dummy forms, and fake-disabled-inputs as they should never be enabled - $('.driver-question input, .instruction-row input, .income input:not(":input[type=submit], .fake-disabled-input"), .other-income-kind input:not(":input[type=submit], .fake-disabled-input"), .unemployment-income input:not(":input[type=submit], .fake-disabled-input")').removeAttr('disabled'); + $( + '.driver-question input, .instruction-row input, .income input:not(":input[type=submit], .fake-disabled-input"), .other-income-kind input:not(":input[type=submit], .fake-disabled-input"), .unemployment-income input:not(":input[type=submit], .fake-disabled-input")' + ).removeAttr('disabled'); // enable "Add New" income buttons - $('#new-unemployment-income, #new-ai-an-income, .new-income, .add_new_other_income_kind').removeAttr('disabled'); - $("a.interaction-click-control-add-more").removeClass('hide'); - $("a[class*='income-edit'], a[class*='income-delete']").removeClass('disabled'); // legacy + $( + '#new-unemployment-income, #new-ai-an-income, .new-income, .add_new_other_income_kind' + ).removeAttr('disabled'); + $('a.interaction-click-control-add-more').removeClass('hide'); + $("a[class*='income-edit'], a[class*='income-delete']").removeClass( + 'disabled' + ); // legacy // enable nav $('#nav-buttons a').removeClass('disabled'); $('.col-md-3 > .interaction-click-control-continue').removeClass('disabled'); // legacy - -}; +} function startEditingIncome(income_kind) { shouldShowEndDateWarningModal = true; // apply disabled style to drivers, instructions, and other income kinds not being edited - $('.driver-question, .driver-question a, .instruction-row, .income:not(#' + income_kind + '), .other-income-kind:not(#' + income_kind + '), .unemployment-income:not(#' + income_kind + ')').addClass('disabled'); + $( + '.driver-question, .driver-question a, .instruction-row, .income:not(#' + + income_kind + + '), .other-income-kind:not(#' + + income_kind + + '), .unemployment-income:not(#' + + income_kind + + ')' + ).addClass('disabled'); // disable inputs on drivers, instructions, and other income kinds not being edited - except for submit (save) buttons as some form types require them to be enabled on edit/create - $('.driver-question input, .instruction-row input, .income:not(#' + income_kind + ') input:not(":input[type=submit]"), .other-income-kind:not(#' + income_kind + ') input:not(":input[type=submit]"), .unemployment-income:not(#' + income_kind + ') input:not(":input[type=submit]")').attr('disabled', true); + $( + '.driver-question input, .instruction-row input, .income:not(#' + + income_kind + + ') input:not(":input[type=submit]"), .other-income-kind:not(#' + + income_kind + + ') input:not(":input[type=submit]"), .unemployment-income:not(#' + + income_kind + + ') input:not(":input[type=submit]")' + ).attr('disabled', true); // disable "Add New" income buttons - $('#new-unemployment-income, #new-ai-an-income, .new-income, .add_new_other_income_kind').attr('disabled', true); - $("a.interaction-click-control-add-more").addClass('hide'); // legacy + $( + '#new-unemployment-income, #new-ai-an-income, .new-income, .add_new_other_income_kind' + ).attr('disabled', true); + $('a.interaction-click-control-add-more').addClass('hide'); // legacy // disable all income edit and edit buttons on created incomes $("a[class*='income-edit'], a[class*='income-delete']").addClass('disabled'); @@ -32,46 +57,57 @@ function startEditingIncome(income_kind) { // disable nav $('#nav-buttons a').addClass('disabled'); $('.col-md-3 > .interaction-click-control-continue').addClass('disabled'); // legacy -}; +} function checkDate(income_id) { - var startDate = $("#start_on_" + income_id).datepicker('getDate'); - var endDate = $("#end_on_" + income_id).datepicker('getDate'); + var startDate = $('#start_on_' + income_id).datepicker('getDate'); + var endDate = $('#end_on_' + income_id).datepicker('getDate'); - if ((endDate != "" && endDate != null) && (endDate < startDate)) { - alert('The end date must be after the start date.') - $("#end_on_" + income_id)[0].value = "" - window.event.preventDefault() + if (endDate != '' && endDate != null && endDate < startDate) { + alert('The end date must be after the start date.'); + $('#end_on_' + income_id)[0].value = ''; + window.event.preventDefault(); } -}; +} function currentlyEditing() { - return $('.interaction-click-control-continue').hasClass('disabled') || $('#nav-buttons a').hasClass('disabled'); -}; + return ( + $('.interaction-click-control-continue').hasClass('disabled') || + $('#nav-buttons a').hasClass('disabled') + ); +} function deleteIncomes(kind) { - const requests = $(kind).find('.other-incomes-list > .other-income').map(function(_, income) { - return $.ajax({ - type: 'DELETE', - url: $(income).attr('id').replace('other_income_', ''), - success: function() { - $(income).remove(); - } + const requests = $(kind) + .find('.other-incomes-list > .other-income') + .map(function (_, income) { + return $.ajax({ + type: 'DELETE', + url: $(income).attr('id').replace('other_income_', ''), + success: function () { + $(income).remove(); + }, + }); }); - }); - $.when.apply($, requests).done(function() { + $.when.apply($, requests).done(function () { const args = [].slice.apply(arguments); const responses = requests.length == 1 ? [args] : args; - if (responses.every(function(response) { return response[1] == 'success'; })) { + if ( + responses.every(function (response) { + return response[1] == 'success'; + }) + ) { $(kind).find('input[type="checkbox"]').prop('checked', false); - $(kind).find('[class^="interaction-click-control-add-more"]').addClass('hidden'); + $(kind) + .find('[class^="interaction-click-control-add-more"]') + .addClass('hidden'); $(kind).find('.new-other-income-form').addClass('hidden'); $(kind).find('.add-more-link').addClass('hidden'); } }); -}; +} /** * Clone, strip of dummy attributes, unhide, and append a new income form to the income list. @@ -85,53 +121,58 @@ function deleteIncomes(kind) { function generateNewForm(newIncomeFormEl, incomeListEl) { const clonedForm = newIncomeFormEl.clone(true, true); const attrs = ['id', 'class', 'for']; - attrs.forEach(function(attr) { + attrs.forEach(function (attr) { const els = clonedForm.find('[' + attr + '*="dummy"]'); - $(els).each(function() { + $(els).each(function () { const dummyAttr = $(this).attr(attr); $(this).attr(attr, dummyAttr.replace('dummy', '')); }); }); - clonedForm - .removeClass('hidden') - .appendTo(incomeListEl); + clonedForm.removeClass('hidden').appendTo(incomeListEl); return clonedForm; -}; +} -document.addEventListener("turbolinks:load", function () { +document.addEventListener('turbolinks:load', function () { var faWindow = $('.incomes'); - if ($('.incomes-list, .other-incomes-list, .unemployment-incomes .ai-an-incomes').length) { + if ( + $( + '.incomes-list, .other-incomes-list, .unemployment-incomes .ai-an-incomes' + ).length + ) { $(faWindow).bind('beforeunload', function (e) { - if (!currentlyEditing() || $('#unsavedIncomeChangesWarning:visible').length) + if ( + !currentlyEditing() || + $('#unsavedIncomeChangesWarning:visible').length + ) return undefined; - (e || faWindow.event).returnValue = 'You have an unsaved income, are you sure you want to proceed?'; //Gecko + IE + (e || faWindow.event).returnValue = + 'You have an unsaved income, are you sure you want to proceed?'; //Gecko + IE return 'You have an unsaved income, are you sure you want to proceed?'; }); $('a[href]:not(.disabled)').off('click'); - $('a[href]:not(.disabled)').on('click', function(e) { + $('a[href]:not(.disabled)').on('click', function (e) { if (currentlyEditing()) { e.preventDefault(); var self = this; $('#unsavedIncomeChangesWarning').modal('show'); - $('button#leave').click(function() { + $('button#leave').click(function () { window.location.href = $(self).attr('href'); }); return false; - } else - return true; + } else return true; }); var typingTimer; const doneTypingInterval = 500; - $(".end-on-field").on("change", function(){ + $('.end-on-field').on('change', function () { clearTimeout(typingTimer); - var endDateWarning = $("#end_date_warning_modal"); - typingTimer = setTimeout(function() { + var endDateWarning = $('#end_date_warning_modal'); + typingTimer = setTimeout(function () { if (shouldShowEndDateWarningModal) { endDateWarning.addClass('show'); endDateWarning.removeClass('hidden'); @@ -142,29 +183,33 @@ document.addEventListener("turbolinks:load", function () { }); /* Saving Responses to Job Income & Self Employment Driver Questions */ - $('#has_job_income_true, #has_job_income_false, #has_self_employment_income_true, #has_self_employment_income_false').on('change', function (e) { + $( + '#has_job_income_true, #has_job_income_false, #has_self_employment_income_true, #has_self_employment_income_false' + ).on('change', function (e) { var attributes = {}; attributes[$(this).attr('name')] = $(this).val(); $.ajax({ type: 'POST', url: window.location.pathname.replace('/incomes', ''), data: { financial_assistance_applicant: attributes }, - success: function (response) { - } - }) + success: function (response) {}, + }); }); /* Saving Responses to Other Income Driver Questions */ - $('#has_other_income_true, #has_other_income_false, #has_unemployment_income_true, #has_unemployment_income_false, #has_american_indian_alaskan_native_income_true, #has_american_indian_alaskan_native_income_false').on('change', function (e) { + $( + '#has_other_income_true, #has_other_income_false, #has_unemployment_income_true, #has_unemployment_income_false, #has_american_indian_alaskan_native_income_true, #has_american_indian_alaskan_native_income_false' + ).on('change', function (e) { var attributes = {}; attributes[$(this).attr('name')] = $(this).val(); $.ajax({ type: 'POST', - url: window.location.pathname.replace('/incomes', '').replace('/other', ''), + url: window.location.pathname + .replace('/incomes', '') + .replace('/other', ''), data: { financial_assistance_applicant: attributes }, - success: function (response) { - } - }) + success: function (response) {}, + }); }); /* DELETING all Job Incomes on selcting 'no' on Driver Question */ @@ -174,101 +219,146 @@ document.addEventListener("turbolinks:load", function () { if ($('.incomes-list:not(.self-employed-incomes-list) .income').length) { e.preventDefault(); // prompt to delete all these dedcutions - $("#destroyAllJobIncomes").modal(); + $('#destroyAllJobIncomes').modal(); $('#destroyAllJobIncomes .modal-cancel-button').off('click'); - $('#destroyAllJobIncomes .modal-cancel-button').on('click', function(e) { - $("#destroyAllJobIncomes").modal('hide'); - $('#has_job_income_true').prop('checked', true).trigger('change'); - }); + $('#destroyAllJobIncomes .modal-cancel-button').on( + 'click', + function (e) { + $('#destroyAllJobIncomes').modal('hide'); + $('#has_job_income_true').prop('checked', true).trigger('change'); + } + ); $('#destroyAllJobIncomes .modal-continue-button').off('click'); - $('#destroyAllJobIncomes .modal-continue-button').on('click', function(e) { - $("#destroyAllJobIncomes").modal('hide'); - //$(self).prop('checked', false); - $('#self-employed-income').addClass('hidden'); - $('#job_income').find('.incomes-list > .income').each(function (i, job_income) { - var url = $(job_income).attr('id').replace('income_', 'incomes/'); - $(job_income).remove(); - $.ajax({ - type: 'DELETE', - url: url - }); - }); - }); + $('#destroyAllJobIncomes .modal-continue-button').on( + 'click', + function (e) { + $('#destroyAllJobIncomes').modal('hide'); + //$(self).prop('checked', false); + $('#self-employed-income').addClass('hidden'); + $('#job_income') + .find('.incomes-list > .income') + .each(function (i, job_income) { + var url = $(job_income) + .attr('id') + .replace('income_', 'incomes/'); + $(job_income).remove(); + $.ajax({ + type: 'DELETE', + url: url, + }); + }); + } + ); } }); /* DELETING all American Indian/Alaskan Native Incomes on selcting 'no' on Driver Question */ - $('#has_american_indian_alaskan_native_income_false').on('change', function (e) { - var self = this; - //$('#DestroyExistingJobIncomesWarning').modal('show'); - if ($('.ai-an-incomes-list:not(.other-incomes-list) .ai-an-income').length) { - e.preventDefault(); - // prompt to delete all these dedcutions - $("#destroyAllAIANIncomes").modal(); - - $('#destroyAllAIANIncomes .modal-cancel-button').off('click'); - $('#destroyAllAIANIncomes .modal-cancel-button').on('click', function(e) { - $("#destroyAllAIAN").modal('hide'); - $('#has_american_indian_alaskan_native_income_true').prop('checked', true).trigger('change'); - }); - - $('#destroyAllAIANIncomes .modal-continue-button').off('click'); - $('#destroyAllAIANIncomes .modal-continue-button').on('click', function(e) { - $("#destroyAllAIANIncomes").modal('hide'); - //$(self).prop('checked', false); - - $('#ai_an_income').find('.ai-an-incomes-list > .ai-an-income').each(function (i, ai_an_income) { - var url = $(ai_an_income).attr('id').replace('financial_assistance_income_', ''); - $(ai_an_income).remove(); - $.ajax({ - type: 'DELETE', - url: url, - success: function() { - $(ai_an_income).remove(); - $("#add-more-link-ai").addClass('hidden'); - $("a.interaction-click-control-add-more").addClass('hide'); - } - }); - }); - }); + $('#has_american_indian_alaskan_native_income_false').on( + 'change', + function (e) { + var self = this; + //$('#DestroyExistingJobIncomesWarning').modal('show'); + if ( + $('.ai-an-incomes-list:not(.other-incomes-list) .ai-an-income').length + ) { + e.preventDefault(); + // prompt to delete all these dedcutions + $('#destroyAllAIANIncomes').modal(); + + $('#destroyAllAIANIncomes .modal-cancel-button').off('click'); + $('#destroyAllAIANIncomes .modal-cancel-button').on( + 'click', + function (e) { + $('#destroyAllAIAN').modal('hide'); + $('#has_american_indian_alaskan_native_income_true') + .prop('checked', true) + .trigger('change'); + } + ); + + $('#destroyAllAIANIncomes .modal-continue-button').off('click'); + $('#destroyAllAIANIncomes .modal-continue-button').on( + 'click', + function (e) { + $('#destroyAllAIANIncomes').modal('hide'); + //$(self).prop('checked', false); + + $('#ai_an_income') + .find('.ai-an-incomes-list > .ai-an-income') + .each(function (i, ai_an_income) { + var url = $(ai_an_income) + .attr('id') + .replace('financial_assistance_income_', ''); + $(ai_an_income).remove(); + $.ajax({ + type: 'DELETE', + url: url, + success: function () { + $(ai_an_income).remove(); + $('#add-more-link-ai').addClass('hidden'); + $('a.interaction-click-control-add-more').addClass( + 'hide' + ); + }, + }); + }); + } + ); + } } - }); + ); /* DELETING all Job Incomes on selcting 'no' on Driver Question */ $('#has_unemployment_income_false').on('change', function (e) { var self = this; stopEditingIncome(); //$('#DestroyExistingJobIncomesWarning').modal('show'); - if ($('.unemployment-incomes-list:not(.other-incomes-list) .unemployment-income').length) { + if ( + $( + '.unemployment-incomes-list:not(.other-incomes-list) .unemployment-income' + ).length + ) { e.preventDefault(); // prompt to delete all these dedcutions - $("#destroyAllUnemploymentIncomes").modal('show'); - - $("#destroyAllUnemploymentIncomes .modal-cancel-button").off('click'); - $('#destroyAllUnemploymentIncomes .modal-cancel-button').on('click', function(e) { - $("#destroyAllUnemploymentIncomes").modal('hide'); - $('#has_unemployment_income_true').prop('checked', true).trigger('change'); - }); - - $("#destroyAllUnemploymentIncomes .modal-continue-button").off('click'); - $('#destroyAllUnemploymentIncomes .modal-continue-button').on('click', function(e) { - $("#destroyAllUnemploymentIncomes").modal('hide'); - //$(self).prop('checked', false); - - $('#unemployment_income').find('.unemployment-incomes-list > .unemployment-income').each(function (i, unemployment_income) { - var url = $(unemployment_income).attr('id').replace('income_', ''); - $.ajax({ - type: 'DELETE', - url: url, - success: function() { - $(unemployment_income).remove(); - $("#add-more-link-unemployment").addClass('hidden'); - $("a.interaction-click-control-add-more").addClass('hide'); - } - }); - }); - }); + $('#destroyAllUnemploymentIncomes').modal('show'); + + $('#destroyAllUnemploymentIncomes .modal-cancel-button').off('click'); + $('#destroyAllUnemploymentIncomes .modal-cancel-button').on( + 'click', + function (e) { + $('#destroyAllUnemploymentIncomes').modal('hide'); + $('#has_unemployment_income_true') + .prop('checked', true) + .trigger('change'); + } + ); + + $('#destroyAllUnemploymentIncomes .modal-continue-button').off('click'); + $('#destroyAllUnemploymentIncomes .modal-continue-button').on( + 'click', + function (e) { + $('#destroyAllUnemploymentIncomes').modal('hide'); + //$(self).prop('checked', false); + + $('#unemployment_income') + .find('.unemployment-incomes-list > .unemployment-income') + .each(function (i, unemployment_income) { + var url = $(unemployment_income) + .attr('id') + .replace('income_', ''); + $.ajax({ + type: 'DELETE', + url: url, + success: function () { + $(unemployment_income).remove(); + $('#add-more-link-unemployment').addClass('hidden'); + $('a.interaction-click-control-add-more').addClass('hide'); + }, + }); + }); + } + ); } }); @@ -279,114 +369,171 @@ document.addEventListener("turbolinks:load", function () { if ($('.self-employed-incomes-list .income').length) { e.preventDefault(); // prompt to delete all these dedcutions - $("#destroyAllSelfEmploymentIncomes").modal(); - - $("#destroyAllSelfEmploymentIncomes .modal-cancel-button").off('click'); - $('#destroyAllSelfEmploymentIncomes .modal-cancel-button').on('click', function(e) { - $("#destroyAllSelfEmploymentIncomes").modal('hide'); - $('#has_self_employment_income_true').prop('checked', true).trigger('change'); - }); - - $("#destroyAllSelfEmploymentIncomes .modal-continue-button").off('click'); - $('#destroyAllSelfEmploymentIncomes .modal-continue-button').on('click', function(e) { - $("#destroyAllSelfEmploymentIncomes").modal('hide'); - //$(self).prop('checked', false); - - $('#self_employed_incomes').find('.self-employed-incomes-list > .income').each(function (i, job_income) { - var url = $(job_income).attr('id').replace('income_', 'incomes/'); - $(job_income).remove(); - $.ajax({ - type: 'DELETE', - url: url - }); - }); - }); + $('#destroyAllSelfEmploymentIncomes').modal(); + + $('#destroyAllSelfEmploymentIncomes .modal-cancel-button').off('click'); + $('#destroyAllSelfEmploymentIncomes .modal-cancel-button').on( + 'click', + function (e) { + $('#destroyAllSelfEmploymentIncomes').modal('hide'); + $('#has_self_employment_income_true') + .prop('checked', true) + .trigger('change'); + } + ); + + $('#destroyAllSelfEmploymentIncomes .modal-continue-button').off( + 'click' + ); + $('#destroyAllSelfEmploymentIncomes .modal-continue-button').on( + 'click', + function (e) { + $('#destroyAllSelfEmploymentIncomes').modal('hide'); + //$(self).prop('checked', false); + + $('#self_employed_incomes') + .find('.self-employed-incomes-list > .income') + .each(function (i, job_income) { + var url = $(job_income) + .attr('id') + .replace('income_', 'incomes/'); + $(job_income).remove(); + $.ajax({ + type: 'DELETE', + url: url, + }); + }); + } + ); } }); /* edit existing incomes */ - $('.incomes-list').on('click', 'a.income-edit:not(.disabled)', function (e) { - e.preventDefault(); - var incomeEl = $(this).parents('.income'); - incomeEl.find('.display-income').addClass('hidden'); - incomeEl.find('.income-edit-form').removeClass('hidden'); - if (!disableSelectric) { - $(incomeEl).find('select').selectric(); + $('.incomes-list').on( + 'click', + 'a.income-edit:not(.disabled)', + function (e) { + e.preventDefault(); + var incomeEl = $(this).parents('.income'); + incomeEl.find('.display-income').addClass('hidden'); + incomeEl.find('.income-edit-form').removeClass('hidden'); + if (!disableSelectric) { + $(incomeEl).find('select').selectric(); + } + $(incomeEl).find('.datepicker-js').datepicker({ + dateFormat: 'mm/dd/yy', + changeMonth: true, + changeYear: true, + yearRange: '-110:+110', + }); + startEditingIncome($(this).parents('.income').attr('id')); } - $(incomeEl).find(".datepicker-js").datepicker({ dateFormat: 'mm/dd/yy', changeMonth: true, changeYear: true, yearRange: "-110:+110" }); - startEditingIncome($(this).parents('.income').attr('id')); - }); - + ); /* destroy existing job incomes */ - $('.incomes-list').on('click', 'a.income-delete:not(.disabled)', function (e) { - var self = this; - e.preventDefault(); - $("#DestroyJobIncomeWarning").modal(); - - $("#DestroyJobIncomeWarning .modal-cancel-button").off('click'); - $('#DestroyJobIncomeWarning .modal-cancel-button').on('click', function(e) { - $("#DestroyJobIncomeWarning").modal('hide'); - }); - - $("#DestroyJobIncomeWarning .modal-continue-button").off('click'); - $('#DestroyJobIncomeWarning .modal-continue-button').on('click', function(e) { - $("#DestroyJobIncomeWarning").modal('hide'); - $(self).parents('.income').remove(); + $('.incomes-list').on( + 'click', + 'a.income-delete:not(.disabled)', + function (e) { + var self = this; + e.preventDefault(); + $('#DestroyJobIncomeWarning').modal(); - var url = $(self).parents('.income').attr('id').replace('income_', 'incomes/') - $.ajax({ - type: 'delete', - url: url - }) - }); - }); + $('#DestroyJobIncomeWarning .modal-cancel-button').off('click'); + $('#DestroyJobIncomeWarning .modal-cancel-button').on( + 'click', + function (e) { + $('#DestroyJobIncomeWarning').modal('hide'); + } + ); + + $('#DestroyJobIncomeWarning .modal-continue-button').off('click'); + $('#DestroyJobIncomeWarning .modal-continue-button').on( + 'click', + function (e) { + $('#DestroyJobIncomeWarning').modal('hide'); + $(self).parents('.income').remove(); + + var url = $(self) + .parents('.income') + .attr('id') + .replace('income_', 'incomes/'); + $.ajax({ + type: 'delete', + url: url, + }); + } + ); + } + ); /* destroy existing Self Employed Incomes */ - $('.self-employed-incomes-list').on('click', 'a.self-employed-income-delete:not(.disabled)', function (e) { - var self = this; - e.preventDefault(); - $("#DestroySelfEmplyedIncomeWarning").modal(); - - $("#DestroySelfEmplyedIncomeWarning .modal-cancel-button").off('click'); - $('#DestroySelfEmplyedIncomeWarning .modal-cancel-button').on('click', function(e) { - $("#DestroySelfEmplyedIncomeWarning").modal('hide'); - }); - - $("#DestroySelfEmplyedIncomeWarning .modal-continue-button").off('click'); - $('#DestroySelfEmplyedIncomeWarning .modal-continue-button').on('click', function(e) { - $("#DestroySelfEmplyedIncomeWarning").modal('hide'); - $(self).parents('.income').remove(); - - var url = $(self).parents('.income').attr('id').replace('income_', 'incomes/') - $.ajax({ - type: 'delete', - url: url - }) - }); - }); - + $('.self-employed-incomes-list').on( + 'click', + 'a.self-employed-income-delete:not(.disabled)', + function (e) { + var self = this; + e.preventDefault(); + $('#DestroySelfEmplyedIncomeWarning').modal(); + $('#DestroySelfEmplyedIncomeWarning .modal-cancel-button').off('click'); + $('#DestroySelfEmplyedIncomeWarning .modal-cancel-button').on( + 'click', + function (e) { + $('#DestroySelfEmplyedIncomeWarning').modal('hide'); + } + ); + + $('#DestroySelfEmplyedIncomeWarning .modal-continue-button').off( + 'click' + ); + $('#DestroySelfEmplyedIncomeWarning .modal-continue-button').on( + 'click', + function (e) { + $('#DestroySelfEmplyedIncomeWarning').modal('hide'); + $(self).parents('.income').remove(); + + var url = $(self) + .parents('.income') + .attr('id') + .replace('income_', 'incomes/'); + $.ajax({ + type: 'delete', + url: url, + }); + } + ); + } + ); /* cancel income edits */ $('.incomes-list').on('click', 'a.income-cancel', function (e) { e.preventDefault(); var incomeEl = $(this).parents('.income'); - $(this).parents('.new-income-form').addClass("hidden"); + $(this).parents('.new-income-form').addClass('hidden'); incomeEl.find('.income-edit-form').addClass('hidden'); incomeEl.find('.display-income').removeClass('hidden'); var incomeList = this.closest('.incomes-list'); var incomeType = incomeList ? incomeList.parentNode.id : null; if (incomeType == 'job_income') { - if (document.querySelectorAll('.incomes-list:not(.self-employed-incomes-list) .income').length == 0) { + if ( + document.querySelectorAll( + '.incomes-list:not(.self-employed-incomes-list) .income' + ).length == 0 + ) { $('.new-income').addClass('hidden'); $('#has_job_income_false').prop('checked', true).trigger('change'); } } else if (incomeType == 'self_employed_incomes') { - if (document.querySelectorAll('.self-employed-incomes-list .income').length == 0) { + if ( + document.querySelectorAll('.self-employed-incomes-list .income') + .length == 0 + ) { $('.new-income-self-employed').addClass('hidden'); - $('#has_self_employment_income_false').prop('checked', true).trigger('change'); + $('#has_self_employment_income_false') + .prop('checked', true) + .trigger('change'); } } @@ -400,14 +547,28 @@ document.addEventListener("turbolinks:load", function () { stopEditingIncome(); var otherIncomeEl = $(this).parents('.other-income'); - if (otherIncomeEl.length) { // canceling edit of existing income + if (otherIncomeEl.length) { + // canceling edit of existing income otherIncomeEl.find('.other-income-show').removeClass('hidden'); otherIncomeEl.find('.edit-other-income-form').addClass('hidden'); - } else { // canceling edit of new income - if (!$(this).parents('.other-incomes-list').find('.other-income').length) { // the kind for the canceled new income has no existing incomes - $(this).parents('.other-income-kind').find('input[type="checkbox"]').prop('checked', false); - $(this).parents('.other-income-kind').find('.add-more-link').addClass('hidden'); - $(this).parents('.other-income-kind').find("a.interaction-click-control-add-more").addClass('hide'); + } else { + // canceling edit of new income + if ( + !$(this).parents('.other-incomes-list').find('.other-income').length + ) { + // the kind for the canceled new income has no existing incomes + $(this) + .parents('.other-income-kind') + .find('input[type="checkbox"]') + .prop('checked', false); + $(this) + .parents('.other-income-kind') + .find('.add-more-link') + .addClass('hidden'); + $(this) + .parents('.other-income-kind') + .find('a.interaction-click-control-add-more') + .addClass('hide'); } $(this).parents('.new-other-income-form').remove(); } @@ -418,15 +579,26 @@ document.addEventListener("turbolinks:load", function () { stopEditingIncome(); var unemploymentIncomeEl = $(this).parents('.unemployment-income'); - if (unemploymentIncomeEl.length) { // canceling edit of existing income - unemploymentIncomeEl.find('.unemployment-income-show').removeClass('hidden'); - unemploymentIncomeEl.find('.edit-unemployment-income-form').addClass('hidden'); - } else { // canceling edit of new income - if (!$('.unemployment-incomes-list').find('.unemployment-income').length) { // no other existing incomes - $("#add-more-link-unemployment").addClass('hidden'); - $("a.interaction-click-control-add-more").addClass('hide'); - - $('#has_unemployment_income_false').prop('checked', true).trigger('change'); + if (unemploymentIncomeEl.length) { + // canceling edit of existing income + unemploymentIncomeEl + .find('.unemployment-income-show') + .removeClass('hidden'); + unemploymentIncomeEl + .find('.edit-unemployment-income-form') + .addClass('hidden'); + } else { + // canceling edit of new income + if ( + !$('.unemployment-incomes-list').find('.unemployment-income').length + ) { + // no other existing incomes + $('#add-more-link-unemployment').addClass('hidden'); + $('a.interaction-click-control-add-more').addClass('hide'); + + $('#has_unemployment_income_false') + .prop('checked', true) + .trigger('change'); } $(this).parents('.new-unmployment-income-form').remove(); @@ -438,14 +610,19 @@ document.addEventListener("turbolinks:load", function () { stopEditingIncome(); var aiAnIncomeEl = $(this).parents('ai-an-income'); - if (aiAnIncomeEl.length) { // canceling edit of existing income + if (aiAnIncomeEl.length) { + // canceling edit of existing income aiAnIncomeEl.find('.ai-an-income-show').removeClass('hidden'); aiAnIncomeEl.find('.edit-ai-an-income-form').addClass('hidden'); - } else { // canceling edit of new income - if (!$('.ai-an-incomes-list').find('.ai-an-income').length) { // no other existing incomes - $("#add-more-link-ai").addClass('hidden'); - $("a.interaction-click-control-add-more").addClass('hide'); - $('#has_american_indian_alaskan_native_income_false').prop('checked', true).trigger('change'); + } else { + // canceling edit of new income + if (!$('.ai-an-incomes-list').find('.ai-an-income').length) { + // no other existing incomes + $('#add-more-link-ai').addClass('hidden'); + $('a.interaction-click-control-add-more').addClass('hide'); + $('#has_american_indian_alaskan_native_income_false') + .prop('checked', true) + .trigger('change'); } $(this).parents('.new-ai-an-income-form').remove(); @@ -455,38 +632,53 @@ document.addEventListener("turbolinks:load", function () { // this index is to ensure duplicate hidden forms aren't saved on submit var incomeIndex = 0; /* new job incomes */ - $(".new-income").off('click'); - $('.new-income').on('click', function(e) { + $('.new-income').off('click'); + $('.new-income').on('click', function (e) { e.preventDefault(); startEditingIncome($(this).parents('.income').attr('id')); var form = $(this).parents(); if ($(this).parents('#job_income').children('.new-income-form').length) { - var newIncomeForm = $(this).parents('#job_income').children('.new-income-form') + var newIncomeForm = $(this) + .parents('#job_income') + .children('.new-income-form'); } else { - var newIncomeForm = $(this).parents('#self_employed_incomes').children('.new-income-form') + var newIncomeForm = $(this) + .parents('#self_employed_incomes') + .children('.new-income-form'); } if ($(this).parents('#job_income').find('.incomes-list').length) { var incomeListEl = $(this).parents('#job_income').find('.incomes-list'); } else { - var incomeListEl = $(this).parents('#self_employed_incomes').find('.incomes-list'); + var incomeListEl = $(this) + .parents('#self_employed_incomes') + .find('.incomes-list'); } - if (newIncomeForm.find('select').data('selectric')) newIncomeForm.find('select').selectric('destroy'); + if (newIncomeForm.find('select').data('selectric')) + newIncomeForm.find('select').selectric('destroy'); var clonedForm = generateNewForm(newIncomeForm, incomeListEl); - if (incomeListEl.children().length > 1 && incomeListEl.children().first().attr('id') === 'hidden-income-form') { + if ( + incomeListEl.children().length > 1 && + incomeListEl.children().first().attr('id') === 'hidden-income-form' + ) { incomeListEl.children().first().remove(); } if (incomeIndex != 0) { var previousForm = clonedForm.prev('.new-income-form'); previousForm.remove(); } - var length = incomeListEl.find(".income").length; + var length = incomeListEl.find('.income').length; if (!disableSelectric) { $(clonedForm).find('select').selectric(); } //$(newIncomeForm).find(".datepicker-js").datepicker({ dateFormat: 'mm/dd/yy', changeMonth: true, changeYear: true}); - $(clonedForm).find(".datepicker-js").datepicker({ dateFormat: 'mm/dd/yy', changeMonth: true, changeYear: true, yearRange: "-110:+110" }); - clonedForm.find('.interaction-click-control-save').addClass("disabled"); + $(clonedForm).find('.datepicker-js').datepicker({ + dateFormat: 'mm/dd/yy', + changeMonth: true, + changeYear: true, + yearRange: '-110:+110', + }); + clonedForm.find('.interaction-click-control-save').addClass('disabled'); incomeIndex++; }); @@ -494,221 +686,311 @@ document.addEventListener("turbolinks:load", function () { var unemploymentIndex = 0; /* new unemployment incomes */ $('#new-unemployment-income').off('click'); - $('#new-unemployment-income').on('click', function(e) { + $('#new-unemployment-income').on('click', function (e) { e.preventDefault(); startEditingIncome($(this).parents('.unemployment-income').attr('id')); var form = $(this).parents(); - var newIncomeForm = $(this).parents('#unemployment_income').children('.new-unemployment-income-form') - var incomeListEl = $(this).parents('#unemployment_income').find('.unemployment-incomes-list'); - - if (newIncomeForm.find('select').data('selectric')) newIncomeForm.find('select').selectric('destroy'); + var newIncomeForm = $(this) + .parents('#unemployment_income') + .children('.new-unemployment-income-form'); + var incomeListEl = $(this) + .parents('#unemployment_income') + .find('.unemployment-incomes-list'); + + if (newIncomeForm.find('select').data('selectric')) + newIncomeForm.find('select').selectric('destroy'); const clonedForm = generateNewForm(newIncomeForm, incomeListEl); - if (incomeListEl.children().length > 1 && incomeListEl.children().first().attr('id') === 'hidden-income-form') { + if ( + incomeListEl.children().length > 1 && + incomeListEl.children().first().attr('id') === 'hidden-income-form' + ) { incomeListEl.children().first().remove(); } if (unemploymentIndex != 0) { var previousForm = clonedForm.prev('.new-unemployment-income-form'); previousForm.remove(); } - var length = incomeListEl.find(".unemployment-income").length; + var length = incomeListEl.find('.unemployment-income').length; if (!disableSelectric) { $(clonedForm).find('select').selectric(); } - $(clonedForm).find(".datepicker-js").datepicker({ dateFormat: 'mm/dd/yy', changeMonth: true, changeYear: true, yearRange: "-110:+110" }); - clonedForm.find('.interaction-click-control-save').addClass("disabled"); + $(clonedForm).find('.datepicker-js').datepicker({ + dateFormat: 'mm/dd/yy', + changeMonth: true, + changeYear: true, + yearRange: '-110:+110', + }); + clonedForm.find('.interaction-click-control-save').addClass('disabled'); unemploymentIndex++; }); /* new AI/AN incomes */ $('#new-ai-an-income').off('click'); - $('#new-ai-an-income').on('click', function(e) { + $('#new-ai-an-income').on('click', function (e) { e.preventDefault(); startEditingIncome($(this).parents('.ai-an-income').attr('id')); var form = $(this).parents(); - var newIncomeForm = $(this).parents('#ai_an_income').children('.new-ai-an-income-form') - var incomeListEl = $(this).parents('#ai_an_income').find('.ai-an-incomes-list'); - - if (newIncomeForm.find('select').data('selectric')) newIncomeForm.find('select').selectric('destroy'); + var newIncomeForm = $(this) + .parents('#ai_an_income') + .children('.new-ai-an-income-form'); + var incomeListEl = $(this) + .parents('#ai_an_income') + .find('.ai-an-incomes-list'); + + if (newIncomeForm.find('select').data('selectric')) + newIncomeForm.find('select').selectric('destroy'); const clonedForm = generateNewForm(newIncomeForm, incomeListEl); - var length = incomeListEl.find(".ai-an-income").length; + var length = incomeListEl.find('.ai-an-income').length; if (!disableSelectric) { $(clonedForm).find('select').selectric(); } - $(clonedForm).find(".datepicker-js").datepicker({ dateFormat: 'mm/dd/yy', changeMonth: true, changeYear: true, yearRange: "-110:+110" }); - clonedForm.find('.interaction-click-control-save').addClass("disabled"); + $(clonedForm).find('.datepicker-js').datepicker({ + dateFormat: 'mm/dd/yy', + changeMonth: true, + changeYear: true, + yearRange: '-110:+110', + }); + clonedForm.find('.interaction-click-control-save').addClass('disabled'); }); $('#has_job_income_true').off('click'); - $('#has_job_income_true').on('click', function(e) { + $('#has_job_income_true').on('click', function (e) { $('.new-income-job').removeClass('hidden'); startEditingIncome($(this).parents('.income').attr('id')); if ($('#job_income').children('.new-income-form').length) { - var newIncomeForm = $('#job_income').children('.new-income-form') + var newIncomeForm = $('#job_income').children('.new-income-form'); } if ($('#job_income').find('.incomes-list').length) { var incomeListEl = $('#job_income').find('.incomes-list'); } - if (newIncomeForm.find('select').data('selectric')) newIncomeForm.find('select').selectric('destroy'); + if (newIncomeForm.find('select').data('selectric')) + newIncomeForm.find('select').selectric('destroy'); var clonedForm = generateNewForm(newIncomeForm, incomeListEl); - if (incomeListEl.children().length > 1 && incomeListEl.children().first().attr('id') === 'hidden-income-form') { + if ( + incomeListEl.children().length > 1 && + incomeListEl.children().first().attr('id') === 'hidden-income-form' + ) { incomeListEl.children().first().remove(); } - var length = incomeListEl.find(".income").length; + var length = incomeListEl.find('.income').length; if (!disableSelectric) { $(clonedForm).find('select').selectric(); } - $(clonedForm).find(".datepicker-js").datepicker({ dateFormat: 'mm/dd/yy', changeMonth: true, changeYear: true, yearRange: "-110:+110" }); + $(clonedForm).find('.datepicker-js').datepicker({ + dateFormat: 'mm/dd/yy', + changeMonth: true, + changeYear: true, + yearRange: '-110:+110', + }); }); $('#has_unemployment_income_true').off('click'); - $('#has_unemployment_income_true').on('click', function(e) { + $('#has_unemployment_income_true').on('click', function (e) { startEditingIncome($(this).parents('.income').attr('id')); - if ($('#unemployment_income').children('.new-unemployment-income-form').length) { - var newIncomeForm = $('#unemployment_income').children('.new-unemployment-income-form') + if ( + $('#unemployment_income').children('.new-unemployment-income-form') + .length + ) { + var newIncomeForm = $('#unemployment_income').children( + '.new-unemployment-income-form' + ); } if ($('#unemployment_income').find('.unemployment-incomes-list').length) { - var incomeListEl = $('#unemployment_income').find('.unemployment-incomes-list'); + var incomeListEl = $('#unemployment_income').find( + '.unemployment-incomes-list' + ); } - if (newIncomeForm.find('select').data('selectric')) newIncomeForm.find('select').selectric('destroy'); - if (!$('.unemployment-incomes-list').children('.new-unemployment-income-form').length) { + if (newIncomeForm.find('select').data('selectric')) + newIncomeForm.find('select').selectric('destroy'); + if ( + !$('.unemployment-incomes-list').children( + '.new-unemployment-income-form' + ).length + ) { var clonedForm = generateNewForm(newIncomeForm, incomeListEl); } - var length = incomeListEl.find(".unemployment-income").length; + var length = incomeListEl.find('.unemployment-income').length; if (!disableSelectric) { $(clonedForm).find('select').selectric(); } - $(clonedForm).find(".datepicker-js").datepicker({ dateFormat: 'mm/dd/yy', changeMonth: true, changeYear: true, yearRange: "-110:+110" }); + $(clonedForm).find('.datepicker-js').datepicker({ + dateFormat: 'mm/dd/yy', + changeMonth: true, + changeYear: true, + yearRange: '-110:+110', + }); }); - $("#has_american_indian_alaskan_native_income_true").off('click'); - $('#has_american_indian_alaskan_native_income_true').on('click', function(e) { - startEditingIncome($(this).parents('.income').attr('id')); - if ($('#ai_an_income').children('.new-ai-an-income-form').length) { - var newIncomeForm = $('#ai_an_income').children('.new-ai-an-income-form') - } + $('#has_american_indian_alaskan_native_income_true').off('click'); + $('#has_american_indian_alaskan_native_income_true').on( + 'click', + function (e) { + startEditingIncome($(this).parents('.income').attr('id')); + if ($('#ai_an_income').children('.new-ai-an-income-form').length) { + var newIncomeForm = $('#ai_an_income').children( + '.new-ai-an-income-form' + ); + } - if ($('#ai_an_income').find('.ai-an-incomes-list').length) { - var incomeListEl = $('#ai_an_income').find('.ai-an-incomes-list'); - } - if (newIncomeForm.find('select').data('selectric')) newIncomeForm.find('select').selectric('destroy'); - if (!$('.ai-an-incomes-list').children('.new-ai-an-income-form').length) { - var clonedForm = generateNewForm(newIncomeForm, incomeListEl); - } - var length = incomeListEl.find(".ai-an-income").length; - if (!disableSelectric) { - $(clonedForm).find('select').selectric(); - $(clonedForm).find(".datepicker-js").datepicker({ dateFormat: 'mm/dd/yy', changeMonth: true, changeYear: true, yearRange: "-110:+110" }); + if ($('#ai_an_income').find('.ai-an-incomes-list').length) { + var incomeListEl = $('#ai_an_income').find('.ai-an-incomes-list'); + } + if (newIncomeForm.find('select').data('selectric')) + newIncomeForm.find('select').selectric('destroy'); + if ( + !$('.ai-an-incomes-list').children('.new-ai-an-income-form').length + ) { + var clonedForm = generateNewForm(newIncomeForm, incomeListEl); + } + var length = incomeListEl.find('.ai-an-income').length; + if (!disableSelectric) { + $(clonedForm).find('select').selectric(); + $(clonedForm).find('.datepicker-js').datepicker({ + dateFormat: 'mm/dd/yy', + changeMonth: true, + changeYear: true, + yearRange: '-110:+110', + }); + } } - }); + ); - $("#has_self_employment_income_true").off('click'); - $('#has_self_employment_income_true').on('click', function(e) { + $('#has_self_employment_income_true').off('click'); + $('#has_self_employment_income_true').on('click', function (e) { $('.new-income-self-employed').removeClass('hidden'); startEditingIncome($(this).parents('.income').attr('id')); if ($('#self_employed_incomes').children('.new-income-form').length) { - var newIncomeForm = $('#self_employed_incomes').children('.new-income-form') + var newIncomeForm = $('#self_employed_incomes').children( + '.new-income-form' + ); } if ($('#self_employed_incomes').find('.incomes-list').length) { var incomeListEl = $('#self_employed_incomes').find('.incomes-list'); } - if (newIncomeForm.find('select').data('selectric')) newIncomeForm.find('select').selectric('destroy'); - var clonedForm = generateNewForm(newIncomeForm, incomeListEl); - if (incomeListEl.children().length > 1 && incomeListEl.children().first().attr('id') === 'hidden-self-income-form') { + if (newIncomeForm.find('select').data('selectric')) + newIncomeForm.find('select').selectric('destroy'); + var clonedForm = generateNewForm(newIncomeForm, incomeListEl); + if ( + incomeListEl.children().length > 1 && + incomeListEl.children().first().attr('id') === 'hidden-self-income-form' + ) { incomeListEl.children().first().remove(); } if (!disableSelectric) { $(clonedForm).find('select').selectric(); } - $(clonedForm).find(".datepicker-js").datepicker({ dateFormat: 'mm/dd/yy', changeMonth: true, changeYear: true, yearRange: "-110:+110" }); + $(clonedForm).find('.datepicker-js').datepicker({ + dateFormat: 'mm/dd/yy', + changeMonth: true, + changeYear: true, + yearRange: '-110:+110', + }); }); /* Condtional Display Job Income Question */ - if (!$("#has_job_income_true").is(':checked')) $("#job_income").addClass('hidden'); - if (!$("#has_self_employment_income_true").is(':checked')) $("#self_employed_incomes").addClass('hidden'); - if (!$("#has_other_income_true").is(':checked')) $(".other_income_kinds").addClass('hidden'); - if (!$("#has_unemployment_income_true").is(':checked')) $("#unemployment_income").addClass('hidden'); - if (!$("#has_american_indian_alaskan_native_income_true").is(':checked')) $("#ai_an_income").addClass('hidden'); - - $("body").on("change", "#has_job_income_true", function () { + if (!$('#has_job_income_true').is(':checked')) + $('#job_income').addClass('hidden'); + if (!$('#has_self_employment_income_true').is(':checked')) + $('#self_employed_incomes').addClass('hidden'); + if (!$('#has_other_income_true').is(':checked')) + $('.other_income_kinds').addClass('hidden'); + if (!$('#has_unemployment_income_true').is(':checked')) + $('#unemployment_income').addClass('hidden'); + if (!$('#has_american_indian_alaskan_native_income_true').is(':checked')) + $('#ai_an_income').addClass('hidden'); + + $('body').on('change', '#has_job_income_true', function () { if ($('#has_job_income_true').is(':checked')) { - $("#job_income").removeClass('hidden'); + $('#job_income').removeClass('hidden'); } else { - $("#job_income").addClass('hidden'); + $('#job_income').addClass('hidden'); } }); - $("body").on("change", "#has_job_income_false", function () { + $('body').on('change', '#has_job_income_false', function () { if ($('#has_job_income_false').is(':checked')) { - $("#job_income").addClass('hidden'); - $("#new_income_form").remove(); + $('#job_income').addClass('hidden'); + $('#new_income_form').remove(); } else { - $("#job_income").removeClass('hidden'); + $('#job_income').removeClass('hidden'); } }); - $("body").on("change", "#has_unemployment_income_true", function () { + $('body').on('change', '#has_unemployment_income_true', function () { if ($('#has_unemployment_income_true').is(':checked')) { - $("#unemployment_income").removeClass('hidden'); + $('#unemployment_income').removeClass('hidden'); } else { - $("#unemployment_income").addClass('hidden'); + $('#unemployment_income').addClass('hidden'); } }); - $("body").on("change", "#has_unemployment_income_false", function () { + $('body').on('change', '#has_unemployment_income_false', function () { if ($('#has_unemployment_income_false').is(':checked')) { - $("#unemployment_income").addClass('hidden'); + $('#unemployment_income').addClass('hidden'); } else { - $("#unemployment_income").removeClass('hidden'); + $('#unemployment_income').removeClass('hidden'); } }); - $("body").on("change", "#has_american_indian_alaskan_native_income_true", function () { - if ($('#has_american_indian_alaskan_native_income_true').is(':checked')) { - $("#ai_an_income").removeClass('hidden'); - } else { - $("#ai_an_income").addClass('hidden'); + $('body').on( + 'change', + '#has_american_indian_alaskan_native_income_true', + function () { + if ( + $('#has_american_indian_alaskan_native_income_true').is(':checked') + ) { + $('#ai_an_income').removeClass('hidden'); + } else { + $('#ai_an_income').addClass('hidden'); + } } - }); - - $("body").on("change", "#has_american_indian_alaskan_native_income_false", function () { - if ($('#has_american_indian_alaskan_native_income_false').is(':checked')) { - $("#ai_an_income").addClass('hidden'); - } else { - $("#ai_an_income").removeClass('hidden'); + ); + + $('body').on( + 'change', + '#has_american_indian_alaskan_native_income_false', + function () { + if ( + $('#has_american_indian_alaskan_native_income_false').is(':checked') + ) { + $('#ai_an_income').addClass('hidden'); + } else { + $('#ai_an_income').removeClass('hidden'); + } } - }); + ); - $("body").on("change", "#has_self_employment_income_true", function () { + $('body').on('change', '#has_self_employment_income_true', function () { if ($('#has_self_employment_income_true').is(':checked')) { - $("#self_employed_incomes").removeClass('hidden'); + $('#self_employed_incomes').removeClass('hidden'); } else { - $("#self_employed_incomes").addClass('hidden'); + $('#self_employed_incomes').addClass('hidden'); } }); - $("body").on("change", "#has_self_employment_income_false", function () { + $('body').on('change', '#has_self_employment_income_false', function () { if ($('#has_self_employment_income_false').is(':checked')) { - $("#self_employed_incomes").addClass('hidden'); + $('#self_employed_incomes').addClass('hidden'); } else { - $("#self_employed_incomes").removeClass('hidden'); + $('#self_employed_incomes').removeClass('hidden'); } }); /* Condtional Display Other Income Question */ - $("body").on("change", "#has_other_income_true", function () { + $('body').on('change', '#has_other_income_true', function () { if ($('#has_other_income_true').is(':checked')) { - $(".other_income_kinds").removeClass('hidden'); + $('.other_income_kinds').removeClass('hidden'); } else { - $(".other_income_kinds").addClass('hidden'); + $('.other_income_kinds').addClass('hidden'); } }); - $("body").on("change", "#has_other_income_false", function () { + $('body').on('change', '#has_other_income_false', function () { if ($('#has_other_income_false').is(':checked')) { - $(".other_income_kinds").addClass('hidden'); + $('.other_income_kinds').addClass('hidden'); } else { - $(".other_income_kinds").removeClass('hidden'); + $('.other_income_kinds').removeClass('hidden'); } }); } @@ -717,7 +999,7 @@ document.addEventListener("turbolinks:load", function () { // otherincome checkbox fuctionality $(document).on('turbolinks:load', function () { function disableSave(form) { - form.find('.interaction-click-control-save').addClass("disabled"); + form.find('.interaction-click-control-save').addClass('disabled'); form.find('.interaction-click-control-save').attr('disabled', 'disabled'); } @@ -728,9 +1010,9 @@ $(document).on('turbolinks:load', function () { $(':input[required=""],:input[required]').on('change', function () { var form = $(this).closest('form'); if (validateForm(form)) { - enableSave(form) + enableSave(form); } else { - disableSave(form) + disableSave(form); } }); @@ -751,38 +1033,68 @@ $(document).on('turbolinks:load', function () { // return 'You have an unsaved income, are you sure you want to proceed?'; // }); $('input[name="other_income_kind"]').off('click'); - $('input[name="other_income_kind"]').on('click', function(e) { + $('input[name="other_income_kind"]').on('click', function (e) { var value = e.target.checked; self = this; - if (value) { // checked deduction kind - var newOtherIncomeFormEl = $(this).parents('.other-income-kind').children('.new-other-income-form').first(); - otherIncomeListEl = $(this).parents('.other-income-kind').find('.other-incomes-list'); - if (newOtherIncomeFormEl.find('select').data('selectric')) newOtherIncomeFormEl.find('select').selectric('destroy'); - const clonedForm = generateNewForm(newOtherIncomeFormEl, otherIncomeListEl); + if (value) { + // checked deduction kind + var newOtherIncomeFormEl = $(this) + .parents('.other-income-kind') + .children('.new-other-income-form') + .first(); + otherIncomeListEl = $(this) + .parents('.other-income-kind') + .find('.other-incomes-list'); + if (newOtherIncomeFormEl.find('select').data('selectric')) + newOtherIncomeFormEl.find('select').selectric('destroy'); + const clonedForm = generateNewForm( + newOtherIncomeFormEl, + otherIncomeListEl + ); startEditingIncome($(this).parents('.other-income-kind').attr('id')); if (!disableSelectric) { - $(clonedForm).find(".datepicker-js").datepicker({ dateFormat: 'mm/dd/yy', changeMonth: true, changeYear: true, yearRange: "-110:+110" }); + $(clonedForm).find('.datepicker-js').datepicker({ + dateFormat: 'mm/dd/yy', + changeMonth: true, + changeYear: true, + yearRange: '-110:+110', + }); $(clonedForm).find('select').selectric(); } - } else if (!$(self).parents('.other-income-kind').find('.other-incomes-list > .other-income').length) { // unchecked deduction kind with no created deductions + } else if ( + !$(self) + .parents('.other-income-kind') + .find('.other-incomes-list > .other-income').length + ) { + // unchecked deduction kind with no created deductions $(self).parents('.other-income-kind').find('.other-incomes-list').empty(); - $(self).parents('.other-income-kind').find('.add-more-link').addClass('hidden'); + $(self) + .parents('.other-income-kind') + .find('.add-more-link') + .addClass('hidden'); stopEditingIncome(); - } else { // unchecked deduction kind with created deductions + } else { + // unchecked deduction kind with created deductions // prompt to delete all these deductions e.preventDefault(); - $("#destroyAllOtherIncomesOfKind").modal(); - $("#destroyAllOtherIncomesOfKind .modal-cancel-button").off('click'); - $('#destroyAllOtherIncomesOfKind .modal-cancel-button').on('click', function(e) { - $("#destroyAllOtherIncomesOfKind").modal('hide'); - }); - - $("#destroyAllOtherIncomesOfKind .modal-continue-button").off('click'); - $('#destroyAllOtherIncomesOfKind .modal-continue-button').on('click', function(e) { - $("#destroyAllOtherIncomesOfKind").modal('hide'); - stopEditingIncome(); - deleteIncomes($(self).parents('.other-income-kind')) - }); + $('#destroyAllOtherIncomesOfKind').modal(); + $('#destroyAllOtherIncomesOfKind .modal-cancel-button').off('click'); + $('#destroyAllOtherIncomesOfKind .modal-cancel-button').on( + 'click', + function (e) { + $('#destroyAllOtherIncomesOfKind').modal('hide'); + } + ); + + $('#destroyAllOtherIncomesOfKind .modal-continue-button').off('click'); + $('#destroyAllOtherIncomesOfKind .modal-continue-button').on( + 'click', + function (e) { + $('#destroyAllOtherIncomesOfKind').modal('hide'); + stopEditingIncome(); + deleteIncomes($(self).parents('.other-income-kind')); + } + ); } }); @@ -791,40 +1103,57 @@ $(document).on('turbolinks:load', function () { var self = this; let other_incomes_exists = false; - document.querySelectorAll(".other_income_kinds .other-income-kind").forEach(function (kind) { - if (kind.querySelector('input[type="checkbox"]').checked) { - other_incomes_exists = true; - } - }); + document + .querySelectorAll('.other_income_kinds .other-income-kind') + .forEach(function (kind) { + if (kind.querySelector('input[type="checkbox"]').checked) { + other_incomes_exists = true; + } + }); if (other_incomes_exists) { e.preventDefault(); - $("#destroyAllOtherIncomes").modal(); - $("#destroyAllOtherIncomes .modal-cancel-button").off('click'); - $('#destroyAllOtherIncomes .modal-cancel-button').on('click', function(e) { - $("#destroyAllOtherIncomes").modal('hide'); - $('#has_other_income_true').prop('checked', true).trigger('change') - }); + $('#destroyAllOtherIncomes').modal(); + $('#destroyAllOtherIncomes .modal-cancel-button').off('click'); + $('#destroyAllOtherIncomes .modal-cancel-button').on( + 'click', + function (e) { + $('#destroyAllOtherIncomes').modal('hide'); + $('#has_other_income_true').prop('checked', true).trigger('change'); + } + ); - $("#destroyAllOtherIncomes .modal-continue-button").off('click'); - $('#destroyAllOtherIncomes .modal-continue-button').on('click', function(e) { - $("#destroyAllOtherIncomes").modal('hide'); + $('#destroyAllOtherIncomes .modal-continue-button').off('click'); + $('#destroyAllOtherIncomes .modal-continue-button').on( + 'click', + function (e) { + $('#destroyAllOtherIncomes').modal('hide'); - $(".other_income_kinds .other-income-kind").each(function (_, kind) { - deleteIncomes($(kind)); - }); - }); + $('.other_income_kinds .other-income-kind').each(function (_, kind) { + deleteIncomes($(kind)); + }); + } + ); } }); // this index is to ensure duplicate hidden forms aren't saved on submit var otherIndex = 0; - $(document).on('click', ".add_new_other_income_kind", function (e) { - var newOtherIncomeFormEl = $(this).parents('.other-income-kind').children('.new-other-income-form'), - otherIncomeListEl = $(this).parents('.other-income-kind').find('.other-incomes-list'); - if (newOtherIncomeFormEl.find('select').data('selectric')) newOtherIncomeFormEl.find('select').selectric('destroy'); + $(document).on('click', '.add_new_other_income_kind', function (e) { + var newOtherIncomeFormEl = $(this) + .parents('.other-income-kind') + .children('.new-other-income-form'), + otherIncomeListEl = $(this) + .parents('.other-income-kind') + .find('.other-incomes-list'); + if (newOtherIncomeFormEl.find('select').data('selectric')) + newOtherIncomeFormEl.find('select').selectric('destroy'); const clonedForm = generateNewForm(newOtherIncomeFormEl, otherIncomeListEl); - if (otherIncomeListEl.children().length > 1 && otherIncomeListEl.children().first().attr('id') === 'hidden-other-income-form') { + if ( + otherIncomeListEl.children().length > 1 && + otherIncomeListEl.children().first().attr('id') === + 'hidden-other-income-form' + ) { incomeListEl.children().first().remove(); } if (otherIndex != 0) { @@ -835,54 +1164,87 @@ $(document).on('turbolinks:load', function () { if (!disableSelectric) { $(clonedForm).find('select').selectric(); } - $(clonedForm).find(".datepicker-js").datepicker({ dateFormat: 'mm/dd/yy', changeMonth: true, changeYear: true, yearRange: "-110:+110" }); + $(clonedForm).find('.datepicker-js').datepicker({ + dateFormat: 'mm/dd/yy', + changeMonth: true, + changeYear: true, + yearRange: '-110:+110', + }); e.stopImmediatePropagation(); otherIndex++; }); /* edit existing other income */ $('.other-incomes-list').off('click', 'a.other-income-edit:not(.disabled)'); - $('.other-incomes-list').on('click', 'a.other-income-edit:not(.disabled)', function (e) { - e.preventDefault(); - var otherIncomeEl = $(this).parents('.other-income'); - otherIncomeEl.find('.other-income-show').addClass('hidden'); - otherIncomeEl.find('.edit-other-income-form').removeClass('hidden'); - startEditingIncome($(this).parents('.other-income-kind').attr('id')); + $('.other-incomes-list').on( + 'click', + 'a.other-income-edit:not(.disabled)', + function (e) { + e.preventDefault(); + var otherIncomeEl = $(this).parents('.other-income'); + otherIncomeEl.find('.other-income-show').addClass('hidden'); + otherIncomeEl.find('.edit-other-income-form').removeClass('hidden'); + startEditingIncome($(this).parents('.other-income-kind').attr('id')); - $(otherIncomeEl).find(".datepicker-js").datepicker({ dateFormat: 'mm/dd/yy', changeMonth: true, changeYear: true, yearRange: "-110:+110" }); - }); + $(otherIncomeEl).find('.datepicker-js').datepicker({ + dateFormat: 'mm/dd/yy', + changeMonth: true, + changeYear: true, + yearRange: '-110:+110', + }); + } + ); /* destroy existing other income */ - $('.other-incomes-list').on('click', 'a.other-income-delete:not(.disabled)', function (e) { - var self = this; - e.preventDefault(); - $("#destroyOtherIncome").modal(); + $('.other-incomes-list').on( + 'click', + 'a.other-income-delete:not(.disabled)', + function (e) { + var self = this; + e.preventDefault(); + $('#destroyOtherIncome').modal(); - $("#destroyOtherIncome .modal-cancel-button").off('click'); - $('#destroyOtherIncome .modal-cancel-button').on('click', function(e) { - $("#destroyOtherIncome").modal('hide'); - }); + $('#destroyOtherIncome .modal-cancel-button').off('click'); + $('#destroyOtherIncome .modal-cancel-button').on('click', function (e) { + $('#destroyOtherIncome').modal('hide'); + }); - $("#destroyOtherIncome .modal-continue-button").off('click'); - $('#destroyOtherIncome .modal-continue-button').on('click', function(e) { - $("#destroyOtherIncome").modal('hide'); + $('#destroyOtherIncome .modal-continue-button').off('click'); + $('#destroyOtherIncome .modal-continue-button').on('click', function (e) { + $('#destroyOtherIncome').modal('hide'); - var url = $(self).parents('.other-income').attr('id').replace('financial_assistance_income_', ''); - $.ajax({ - type: 'DELETE', - url: url, - dataType: 'script', - success: function() { - if ($(self).parents('.other-incomes-list').find('.other-income').length == 1) { - $(self).parents('.other-income-kind').find('input[type="checkbox"]').prop('checked', false); - $(self).parents('.other-income-kind').find('.add-more-link').addClass('hidden'); - $(self).parents('.other-income-kind').find("a.interaction-click-control-add-more").addClass('hide'); - } - $(self).parents('.other-income').remove(); - } - }) - }); - }); + var url = $(self) + .parents('.other-income') + .attr('id') + .replace('financial_assistance_income_', ''); + $.ajax({ + type: 'DELETE', + url: url, + dataType: 'script', + success: function () { + if ( + $(self).parents('.other-incomes-list').find('.other-income') + .length == 1 + ) { + $(self) + .parents('.other-income-kind') + .find('input[type="checkbox"]') + .prop('checked', false); + $(self) + .parents('.other-income-kind') + .find('.add-more-link') + .addClass('hidden'); + $(self) + .parents('.other-income-kind') + .find('a.interaction-click-control-add-more') + .addClass('hide'); + } + $(self).parents('.other-income').remove(); + }, + }); + }); + } + ); /* cancel other income edits */ $('.other-incomes-list').off('click', 'a.other-income-cancel'); @@ -891,128 +1253,218 @@ $(document).on('turbolinks:load', function () { stopEditingIncome(); var otherIncomeEl = $(this).parents('.other-income'); - if (otherIncomeEl.length) { // canceling edit of existing income + if (otherIncomeEl.length) { + // canceling edit of existing income otherIncomeEl.find('.other-income-show').removeClass('hidden'); otherIncomeEl.find('.edit-other-income-form').addClass('hidden'); - } else { // canceling edit of new income - if (!$(this).parents('.other-incomes-list').find('.other-income').length) { // the kind for the canceled new income has no existing incomes - $(this).parents('.other-income-kind').find('input[type="checkbox"]').prop('checked', false); - $(this).parents('.other-income-kind').find('.add-more-link').addClass('hidden'); - $(this).parents('.other-income-kind').find("a.interaction-click-control-add-more").addClass('hide'); + } else { + // canceling edit of new income + if ( + !$(this).parents('.other-incomes-list').find('.other-income').length + ) { + // the kind for the canceled new income has no existing incomes + $(this) + .parents('.other-income-kind') + .find('input[type="checkbox"]') + .prop('checked', false); + $(this) + .parents('.other-income-kind') + .find('.add-more-link') + .addClass('hidden'); + $(this) + .parents('.other-income-kind') + .find('a.interaction-click-control-add-more') + .addClass('hide'); } $(this).parents('.new-other-income-form').remove(); } }); /* edit existing unemployment income */ - $('.unemployment-incomes-list').off('click', 'a.unemployment-income-edit:not(.disabled)'); - $('.unemployment-incomes-list').on('click', 'a.unemployment-income-edit:not(.disabled)', function(e) { - e.preventDefault(); + $('.unemployment-incomes-list').off( + 'click', + 'a.unemployment-income-edit:not(.disabled)' + ); + $('.unemployment-incomes-list').on( + 'click', + 'a.unemployment-income-edit:not(.disabled)', + function (e) { + e.preventDefault(); - var unemploymentIncomeEl = $(this).parents('.unemployment-income'); - unemploymentIncomeEl.find('.unemployment-income-show').addClass('hidden'); - unemploymentIncomeEl.find('.edit-unemployment-income-form').removeClass('hidden'); + var unemploymentIncomeEl = $(this).parents('.unemployment-income'); + unemploymentIncomeEl.find('.unemployment-income-show').addClass('hidden'); + unemploymentIncomeEl + .find('.edit-unemployment-income-form') + .removeClass('hidden'); - startEditingIncome($(this).parents('.unemployment-income').attr('id')); + startEditingIncome($(this).parents('.unemployment-income').attr('id')); - $(unemploymentIncomeEl).find(".datepicker-js").datepicker({ dateFormat: 'mm/dd/yy', changeMonth: true, changeYear: true, yearRange: "-110:+110" }); - }); + $(unemploymentIncomeEl).find('.datepicker-js').datepicker({ + dateFormat: 'mm/dd/yy', + changeMonth: true, + changeYear: true, + yearRange: '-110:+110', + }); + } + ); /* destroy existing unemployment income */ - $('.unemployment-incomes-list').off('click', 'a.unemployment-income-delete:not(.disabled)'); - $('.unemployment-incomes-list').on('click', 'a.unemployment-income-delete:not(.disabled)', function(e) { - var self = this; - e.preventDefault(); - $("#destroyUnemploymentIncome").modal(); - - $("#destroyUnemploymentIncome .modal-cancel-button").off('click'); - $('#destroyUnemploymentIncome .modal-cancel-button').on('click', function(e) { - $("#destroyUnemploymentIncome").modal('hide'); - }); - - $("#destroyUnemploymentIncome .modal-continue-button").off('click'); - $('#destroyUnemploymentIncome .modal-continue-button').on('click', function(e) { - $("#destroyUnemploymentIncome").modal('hide'); + $('.unemployment-incomes-list').off( + 'click', + 'a.unemployment-income-delete:not(.disabled)' + ); + $('.unemployment-incomes-list').on( + 'click', + 'a.unemployment-income-delete:not(.disabled)', + function (e) { + var self = this; + e.preventDefault(); + $('#destroyUnemploymentIncome').modal(); - var url = $(self).parents('.unemployment-income').attr('id').replace('financial_assistance_income_', ''); - $.ajax({ - type: 'DELETE', - url: url, - dataType: 'script', - success: function() { - $(self).parents('.unemployment-income').remove(); - if (!$('.unemployment-incomes-list').find('.unemployment-income').length) { // no other existing incomes - $("#add-more-link-unemployment").addClass('hidden'); - $("a.interaction-click-control-add-more").addClass('hide'); - $('#has_unemployment_income_false').prop('checked', true).trigger('change'); - } + $('#destroyUnemploymentIncome .modal-cancel-button').off('click'); + $('#destroyUnemploymentIncome .modal-cancel-button').on( + 'click', + function (e) { + $('#destroyUnemploymentIncome').modal('hide'); } - }); - }); - }); + ); + + $('#destroyUnemploymentIncome .modal-continue-button').off('click'); + $('#destroyUnemploymentIncome .modal-continue-button').on( + 'click', + function (e) { + $('#destroyUnemploymentIncome').modal('hide'); + + var url = $(self) + .parents('.unemployment-income') + .attr('id') + .replace('financial_assistance_income_', ''); + $.ajax({ + type: 'DELETE', + url: url, + dataType: 'script', + success: function () { + $(self).parents('.unemployment-income').remove(); + if ( + !$('.unemployment-incomes-list').find('.unemployment-income') + .length + ) { + // no other existing incomes + $('#add-more-link-unemployment').addClass('hidden'); + $('a.interaction-click-control-add-more').addClass('hide'); + $('#has_unemployment_income_false') + .prop('checked', true) + .trigger('change'); + } + }, + }); + } + ); + } + ); /* cancel unemployment income edits */ - $('.unemployment-incomes-list').on('click', 'a.unemployment-income-cancel', function (e) { - e.preventDefault(); - stopEditingIncome(); + $('.unemployment-incomes-list').on( + 'click', + 'a.unemployment-income-cancel', + function (e) { + e.preventDefault(); + stopEditingIncome(); - var unemploymentIncomeEl = $(this).parents('.unemployment-income'); - if (unemploymentIncomeEl.length) { - $(this).closest('.unemployment-income-kind').find('a#add_new_unemployment_income_kind').removeClass("hidden"); - unemploymentIncomeEl.find('.unemployment-income-show').removeClass('hidden'); - unemploymentIncomeEl.find('.edit-unemployment-income-form').addClass('hidden'); - } else { - if (!$(this).parents('.unemployment-incomes-list > div.unemployment-income').length) { - $(this).parents('.unemployment-income-kind').find('input[type="checkbox"]').prop('checked', false); - $(this).closest('.unemployment-income-kind').find('a#add_new_unemployment_income_kind').addClass("hidden"); + var unemploymentIncomeEl = $(this).parents('.unemployment-income'); + if (unemploymentIncomeEl.length) { + $(this) + .closest('.unemployment-income-kind') + .find('a#add_new_unemployment_income_kind') + .removeClass('hidden'); + unemploymentIncomeEl + .find('.unemployment-income-show') + .removeClass('hidden'); + unemploymentIncomeEl + .find('.edit-unemployment-income-form') + .addClass('hidden'); + } else { + if ( + !$(this).parents( + '.unemployment-incomes-list > div.unemployment-income' + ).length + ) { + $(this) + .parents('.unemployment-income-kind') + .find('input[type="checkbox"]') + .prop('checked', false); + $(this) + .closest('.unemployment-income-kind') + .find('a#add_new_unemployment_income_kind') + .addClass('hidden'); + } + $(this).parents('.new-unemployment-income-form').remove(); + $(this).parents('.edit-unemployment-income-form').remove(); } - $(this).parents('.new-unemployment-income-form').remove(); - $(this).parents('.edit-unemployment-income-form').remove(); } - }); + ); /* edit existing AI/AN income */ - $('.ai-an-incomes-list').on('click', 'a.ai-an-income-edit:not(.disabled)', function (e) { - e.preventDefault(); - var aianIncomeEl = $(this).parents('.ai-an-income'); - aianIncomeEl.find('.ai-an-income-show').addClass('hidden'); - aianIncomeEl.find('.edit-ai-an-income-form').removeClass('hidden'); - startEditingIncome($(this).parents('.ai-an-income-kind').attr('id')); - - $(aianIncomeEl).find(".datepicker-js").datepicker({ dateFormat: 'mm/dd/yy', changeMonth: true, changeYear: true, yearRange: "-110:+110" }); - }); + $('.ai-an-incomes-list').on( + 'click', + 'a.ai-an-income-edit:not(.disabled)', + function (e) { + e.preventDefault(); + var aianIncomeEl = $(this).parents('.ai-an-income'); + aianIncomeEl.find('.ai-an-income-show').addClass('hidden'); + aianIncomeEl.find('.edit-ai-an-income-form').removeClass('hidden'); + startEditingIncome($(this).parents('.ai-an-income-kind').attr('id')); + + $(aianIncomeEl).find('.datepicker-js').datepicker({ + dateFormat: 'mm/dd/yy', + changeMonth: true, + changeYear: true, + yearRange: '-110:+110', + }); + } + ); /* destroy existing AI/AN income */ - $('.ai-an-incomes-list').on('click', 'a.ai-an-income-delete:not(.disabled)', function (e) { - var self = this; - e.preventDefault(); - $("#destroyAIANIncome").modal(); + $('.ai-an-incomes-list').on( + 'click', + 'a.ai-an-income-delete:not(.disabled)', + function (e) { + var self = this; + e.preventDefault(); + $('#destroyAIANIncome').modal(); - $("#destroyAIANIncome .modal-cancel-button").off('click'); - $('#destroyAIANIncome .modal-cancel-button').on('click', function(e) { - $("#destroyAIANIncome").modal('hide'); - }); + $('#destroyAIANIncome .modal-cancel-button').off('click'); + $('#destroyAIANIncome .modal-cancel-button').on('click', function (e) { + $('#destroyAIANIncome').modal('hide'); + }); - $("#destroyAIANIncome .modal-continue-button").off('click'); - $('#destroyAIANIncome .modal-continue-button').on('click', function(e) { - $("#destroyAIANIncome").modal('hide'); + $('#destroyAIANIncome .modal-continue-button').off('click'); + $('#destroyAIANIncome .modal-continue-button').on('click', function (e) { + $('#destroyAIANIncome').modal('hide'); - var url = $(self).parents('.ai-an-income').attr('id').replace('financial_assistance_income_', ''); - $.ajax({ - type: 'DELETE', - url: url, - dataType: 'script', - success: function() { - $(self).parents('.ai-an-income').remove(); - if (!$('.ai-an-incomes-list').find('.ai-an-income').length) { // no other existing incomes - $("#add-more-link-ai").addClass('hidden'); - $("a.interaction-click-control-add-more").addClass('hide'); - $('#has_american_indian_alaskan_native_income_false').prop('checked', true).trigger('change'); - } - } - }) - }); - }); + var url = $(self) + .parents('.ai-an-income') + .attr('id') + .replace('financial_assistance_income_', ''); + $.ajax({ + type: 'DELETE', + url: url, + dataType: 'script', + success: function () { + $(self).parents('.ai-an-income').remove(); + if (!$('.ai-an-incomes-list').find('.ai-an-income').length) { + // no other existing incomes + $('#add-more-link-ai').addClass('hidden'); + $('a.interaction-click-control-add-more').addClass('hide'); + $('#has_american_indian_alaskan_native_income_false') + .prop('checked', true) + .trigger('change'); + } + }, + }); + }); + } + ); /* cancel AI/AN income edits */ $('.ai-an-incomes-list').on('click', 'a.ai-an-income-cancel', function (e) { @@ -1021,13 +1473,22 @@ $(document).on('turbolinks:load', function () { var aianIncomeEl = $(this).parents('.ai-an-income'); if (aianIncomeEl.length) { - $(this).closest('.ai-an-income-kind').find('a#add_new_ai_an_income_kind').removeClass("hidden"); + $(this) + .closest('.ai-an-income-kind') + .find('a#add_new_ai_an_income_kind') + .removeClass('hidden'); aianIncomeEl.find('.ai-an-income-show').removeClass('hidden'); aianIncomeEl.find('.edit-ai-an-income-form').addClass('hidden'); } else { if (!$(this).parents('.ai-an-incomes-list > div.ai-an-income').length) { - $(this).parents('.ai-an-income-kind').find('input[type="checkbox"]').prop('checked', false); - $(this).closest('.ai-an-income-kind').find('a#add_new_ai_an_income_kind').addClass("hidden"); + $(this) + .parents('.ai-an-income-kind') + .find('input[type="checkbox"]') + .prop('checked', false); + $(this) + .closest('.ai-an-income-kind') + .find('a#add_new_ai_an_income_kind') + .addClass('hidden'); } $(this).parents('.new-ai-an-income-form').remove(); $(this).parents('.edit-ai-an-income-form').remove(); @@ -1035,7 +1496,7 @@ $(document).on('turbolinks:load', function () { }); // disable save button logic function disableSave(form) { - form.find('.interaction-click-control-save').addClass("disabled"); + form.find('.interaction-click-control-save').addClass('disabled'); form.find('.interaction-click-control-save').attr('disabled', 'disabled'); } @@ -1047,45 +1508,61 @@ $(document).on('turbolinks:load', function () { $(':input[required]').on('keyup change', function () { var form = $(this).closest('form'); if (validateForm(form)) { - enableSave(form) + enableSave(form); } else { - disableSave(form) + disableSave(form); } }); function validateForm(form) { var isValid = true; form.find(':input[required]').each(function () { - if ($(this).val() == '' || $(this).val() == '0.00' || $(this).val() == 'Choose') { + if ( + $(this).val() == '' || + $(this).val() == '0.00' || + $(this).val() == 'Choose' + ) { isValid = false; } }); return isValid; } - $(document).on('focus', '.new-income-form .phone_number', function() { - $(this).mask('(000) 000-0000'); - }); - - $('body').on('keyup keydown keypress', '#income_employer_phone_full_phone_number', function (e) { - var key = e.which || e.keyCode || e.charCode; + $(document).on('focus', '.new-income-form .phone_number', function () { $(this).mask('(000) 000-0000'); - return (key == 8 || - key == 9 || - key == 46 || - (key >= 37 && key <= 40) || - (key >= 48 && key <= 57) || - (key >= 96 && key <= 105)); }); - $('body').on('keyup keydown keypress', '#income_employer_address_zip', function (e) { - var key = e.which || e.keyCode || e.charCode; - $(this).attr('maxlength', '5'); - return (key == 8 || - key == 9 || - key == 46 || - (key >= 37 && key <= 40) || - (key >= 48 && key <= 57) || - (key >= 96 && key <= 105)); - }); + $('body').on( + 'keyup keydown keypress', + '#income_employer_phone_full_phone_number', + function (e) { + var key = e.which || e.keyCode || e.charCode; + $(this).mask('(000) 000-0000'); + return ( + key == 8 || + key == 9 || + key == 46 || + (key >= 37 && key <= 40) || + (key >= 48 && key <= 57) || + (key >= 96 && key <= 105) + ); + } + ); + + $('body').on( + 'keyup keydown keypress', + '#income_employer_address_zip', + function (e) { + var key = e.which || e.keyCode || e.charCode; + $(this).attr('maxlength', '5'); + return ( + key == 8 || + key == 9 || + key == 46 || + (key >= 37 && key <= 40) || + (key >= 48 && key <= 57) || + (key >= 96 && key <= 105) + ); + } + ); }); diff --git a/components/financial_assistance/app/views/financial_assistance/applications/_faa_progress_options.html.erb b/components/financial_assistance/app/views/financial_assistance/applications/_faa_progress_options.html.erb new file mode 100644 index 00000000000..49d674ebe71 --- /dev/null +++ b/components/financial_assistance/app/views/financial_assistance/applications/_faa_progress_options.html.erb @@ -0,0 +1,26 @@ +<% step = (defined? step) ? step.to_i : 1 %> + +<% content_for(:step) { step } %> +<% content_for(:show_exit_button) { "true" } %> +<% content_for(:show_previous_button) { "false" } %> +<% content_for(:show_account_button) { EnrollRegistry.feature_enabled?(:back_to_account_all_shop)&.to_s } %> +<% content_for(:show_help_button) { "true" } %> +<% content_for(:back_to_account_flag) { "true" } %> + +<% if @applicant.present? %> + <% content_for(:title) { l10n("faa.left_nav.my_household") } %> + <% content_for(:title_link) { edit_application_path(@application) } %> +<% else %> + <% content_for(:title) { l10n('faa.my_applications') } %> + <% content_for(:title_link) { financial_assistance.applications_path } %> + <% content_for(:nav_options) do %> + <% no_applicant_faa_nav_options(@application).each do |nav_option| %> + + <% end %> + <% end %> +<% end %> + diff --git a/components/financial_assistance/app/views/financial_assistance/shared/_date_warning.html.erb b/components/financial_assistance/app/views/financial_assistance/shared/_date_warning.html.erb index 1cb80bd0708..93662c40014 100644 --- a/components/financial_assistance/app/views/financial_assistance/shared/_date_warning.html.erb +++ b/components/financial_assistance/app/views/financial_assistance/shared/_date_warning.html.erb @@ -35,4 +35,4 @@
-<% end %> \ No newline at end of file +<% end %>