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 %} -
Since you have indicated that there are special or extraordinary expenses, we need you to answer the next set of questions.
- {% if special_extraordinary_expenses_details_error %}+ {% if derived.special_expenses_detail_error %}
* At least one of these values must be greater than 0
{% endif %}