From 5e769e6cb4b6029f7418ef3db431d3a246edcdb6 Mon Sep 17 00:00:00 2001 From: Benard Ebinu Date: Fri, 23 Feb 2018 14:48:19 -0800 Subject: [PATCH] DIV-806: Display fact sheet f if the income of the payor is over threshold amount --- edivorce/apps/core/static/js/main.js | 37 +- .../templates/question/06_children_facts.html | 326 +++++++++--------- 2 files changed, 171 insertions(+), 192 deletions(-) diff --git a/edivorce/apps/core/static/js/main.js b/edivorce/apps/core/static/js/main.js index bd76e1b4..33ca5982 100755 --- a/edivorce/apps/core/static/js/main.js +++ b/edivorce/apps/core/static/js/main.js @@ -442,40 +442,19 @@ $(function () { populateChildrenFactSheets(); }); - var updateClaimantName = function() { - var payor = ''; - var element = $('#__claimant_names'); - $("input[name='child_support_payor']:checked").each(function() { - if ($(this).val() === 'Myself (Claimant 1)') { - payor = element.find('input[name="name_you"]').val() || 'Claimant 1'; - } else if ($(this).val() === 'My Spouse (Claimant 2)') { - payor = element.find('input[name="name_spouse"]').val() || 'Claimant 2'; - } else if ($(this).val() === 'Both myself and my spouse') { - payor = (element.find('input[name="name_you"]').val() || 'Claimant 1') + ' and ' + - (element.find('input[name="name_spouse"]').val() || 'Claimant 2'); - } - }); - - $('.__name-of-payor').text(payor); - - // check who has sole custody - var children = JSON.parse($('input[name="claimant_children"]').val()); - var youHaveSoleCustody = children.every(function(child){ - return child.child_live_with === 'Lives with you' - }); - var spouseHasSoleCustody = children.every(function(child){ - return child.child_live_with === 'Lives with spouse' - }); - if (youHaveSoleCustody || spouseHasSoleCustody) { - $('#monthly_amount_question').show(); + var showHideFactSheetF = function() { + var claimant = $(this).val(); + if ( claimant === 'Myself (Claimant 1)' && parseFloat($('input[name="annual_gross_income"]').val()) > 150000) { + $('#fact_sheet_f').show(); + } else if ( claimant === 'My Spouse (Claimant 2)' && parseFloat($('input[name="spouse_annual_gross_income"]').val()) > 150000) { + $('#fact_sheet_f').show(); } else { - $('#monthly_amount_question').hide(); + $('#fact_sheet_f').hide(); } }; - // $('#__claimant_names').each(updateClaimantName); - // $('input[name="child_support_payor"]').on('change', updateClaimantName); + $('input[name="child_support_payor"]').on('click', showHideFactSheetF).filter(':checked').each(showHideFactSheetF); $("#btn_add_reconciliation_periods").on('click', function () { diff --git a/edivorce/apps/core/templates/question/06_children_facts.html b/edivorce/apps/core/templates/question/06_children_facts.html index ef1a35e2..80849b70 100644 --- a/edivorce/apps/core/templates/question/06_children_facts.html +++ b/edivorce/apps/core/templates/question/06_children_facts.html @@ -355,6 +355,9 @@
+ {% money_input_field name="annual_gross_income" hidden="true" %} + {% money_input_field name="spouse_annual_gross_income" hidden="true" %} +

Who is the {% endif %} -{% if annual_gross_income|integer > 150000 %} -
-
-

Income over $150,000 (Fact Sheet F)

-

- Since you have previously indicated that the payor's income is over $150,000 you will need to provide - answers to the next set of questions. The child support guideline table you previously entered only goes - to $150,000. Income beyond that point requires a 2 stage calculation, the amount payable at $150,000 + - the amount payable on the income in excess of $150,000. This takes into account other factors such as - the financial ability of each parent, maintaining a certain quality of life, etc. It is no longer a - matter of there being money simply to look after the needs of the child, but rather the level of care - factoring in the family's lifestyle. -

+