From 5aa80392edb41f4826c073045cddf4e9f013847c Mon Sep 17 00:00:00 2001 From: Benard Ebinu Date: Thu, 11 Jan 2018 17:48:47 -0800 Subject: [PATCH] DIV-771: monthly child support amount shown irrespective of payor --- edivorce/apps/core/static/js/main.js | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/edivorce/apps/core/static/js/main.js b/edivorce/apps/core/static/js/main.js index d6d22583..27f906c2 100755 --- a/edivorce/apps/core/static/js/main.js +++ b/edivorce/apps/core/static/js/main.js @@ -474,23 +474,16 @@ $(function () { $('.__name-of-payor').text(payor); - // Check custody conditions and only show additional question of amount payor will pay - // if all of the children are in sole custody of payor. + // check who has sole custody var children = JSON.parse($('input[name="claimant_children"]').val()); - - var payorElement = $("input[name='child_support_payor']:checked").val(); - var soleCustodyCondition = null; - if (payorElement === 'Myself (Claimant 1)') { - soleCustodyCondition = 'Lives with you' - } else if (payorElement === 'My Spouse (Claimant 2)') { - soleCustodyCondition = 'Lives with spouse'; - } - - var hasSoleCustody = children.every(function(child){ - return soleCustodyCondition && child.child_live_with === soleCustodyCondition + 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 (hasSoleCustody) { + if (youHaveSoleCustody || spouseHasSoleCustody) { $('#monthly_amount_question').show(); } else { $('#monthly_amount_question').hide();