From 47dd4e06740bce6b8735ec770850dcf67dbc95b1 Mon Sep 17 00:00:00 2001 From: Benard Ebinu Date: Wed, 28 Feb 2018 23:37:43 -0800 Subject: [PATCH] DIV-801: show schedule 1 question only if either parent has sole custody --- edivorce/apps/core/static/js/main.js | 16 ++++++++++++++++ .../question/06_children_income_expenses.html | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/edivorce/apps/core/static/js/main.js b/edivorce/apps/core/static/js/main.js index e9b690e3..2e1c27f4 100755 --- a/edivorce/apps/core/static/js/main.js +++ b/edivorce/apps/core/static/js/main.js @@ -443,6 +443,22 @@ $(function () { populateChildrenFactSheets(); }); + // check who has sole custody + $('input[name="__claimant_children"]').each(function() { + var children = JSON.parse($(this).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(); + } else { + $('#monthly_amount_question').hide(); + } + }); var payorCallback = function() { var claimant = $(this).val(); 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 32300c4d..6413b482 100644 --- a/edivorce/apps/core/templates/question/06_children_income_expenses.html +++ b/edivorce/apps/core/templates/question/06_children_income_expenses.html @@ -248,7 +248,9 @@ -
+ + +