From 107c2fe0ac9651f9240086fe3dced6e605df2a6c Mon Sep 17 00:00:00 2001 From: ariannedee Date: Tue, 25 Aug 2020 13:00:18 -0700 Subject: [PATCH] Fix bugs related to errors for Fact sheet F and special extraordinary expenses. Remove unused questions --- edivorce/apps/core/static/js/main.js | 36 +++ .../partials/fact_sheets/fact_sheet_f.html | 17 +- .../question/06_children_income_expenses.html | 6 +- .../apps/core/utils/question_step_mapping.py | 23 +- edivorce/fixtures/Question.json | 256 ++++-------------- 5 files changed, 103 insertions(+), 235 deletions(-) diff --git a/edivorce/apps/core/static/js/main.js b/edivorce/apps/core/static/js/main.js index dfd05def..7d92e96a 100755 --- a/edivorce/apps/core/static/js/main.js +++ b/edivorce/apps/core/static/js/main.js @@ -570,6 +570,42 @@ $(function () { }); var payorCallback = function() { + var claimant = $(this).val(); + + var toggleFactSheetTable = function(table_suffix, claimant_name_selector, hide) { + $('#fact_sheet_f').show(); + if (hide) { + $('#fact_sheet_f_table_' + table_suffix).hide(); + } else { + var fact_sheet_table_element = $('#fact_sheet_f_table_' + table_suffix); + fact_sheet_table_element.show(); + fact_sheet_table_element.find('input:radio, input:checkbox').each(reveal_input_elements); + } + + if (claimant_name_selector) { + $('#fact_sheet_f_payor_title_' + table_suffix).text($(claimant_name_selector).text()); + } + }; + + if (claimant === 'Myself (Claimant 1)' && parseFloat($('input[name="annual_gross_income"]').val()) > 150000) { + toggleFactSheetTable('1', '#__name_you'); + toggleFactSheetTable('2', null, true); + } else if (claimant === 'My Spouse (Claimant 2)' && parseFloat($('input[name="spouse_annual_gross_income"]').val()) > 150000) { + toggleFactSheetTable('2', '#__name_spouse'); + toggleFactSheetTable('1', null, true); + } else if (claimant === 'Both myself and my spouse') { + if (parseFloat($('input[name="annual_gross_income"]').val()) > 150000) { + toggleFactSheetTable('1', '#__name_you'); + } + if (parseFloat($('input[name="spouse_annual_gross_income"]').val()) > 150000) { + toggleFactSheetTable('2', '#__name_spouse'); + } + } else { + $('#fact_sheet_f').hide(); + $('#fact_sheet_f_table_1').hide(); + $('#fact_sheet_f_table_2').hide(); + } + // Update Factsheet B payor label var amount_b_you = $('#fact_b_your_child_support_paid').val(); var amount_b_spouse = $('#fact_b_your_spouse_child_support_paid').val(); diff --git a/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_f.html b/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_f.html index e254623f..66029009 100644 --- a/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_f.html +++ b/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_f.html @@ -61,14 +61,11 @@ - {% if derived.show_fact_sheet_f_you %} -
- {% include "partials/fact_sheets/fact_sheet_f_table.html" with table_id=1 claimant_id='you' %} -
- {% endif %} - {% if derived.show_fact_sheet_f_spouse %} -
- {% include "partials/fact_sheets/fact_sheet_f_table.html" with table_id=2 claimant_id='spouse' %} -
- {% endif %} + +
+ {% include "partials/fact_sheets/fact_sheet_f_table.html" with table_id=1 claimant_id='you' %} +
+
+ {% include "partials/fact_sheets/fact_sheet_f_table.html" with table_id=2 claimant_id='spouse' %} +
diff --git a/edivorce/apps/core/templates/question/06_children_income_expenses.html b/edivorce/apps/core/templates/question/06_children_income_expenses.html index d0597eb7..59258620 100644 --- a/edivorce/apps/core/templates/question/06_children_income_expenses.html +++ b/edivorce/apps/core/templates/question/06_children_income_expenses.html @@ -306,10 +306,10 @@