Browse Source

DIV-771: monthly child support amount shown irrespective of payor

pull/160/head
Benard Ebinu 8 years ago
parent
commit
5aa80392ed
1 changed files with 7 additions and 14 deletions
  1. +7
    -14
      edivorce/apps/core/static/js/main.js

+ 7
- 14
edivorce/apps/core/static/js/main.js View File

@ -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();


Loading…
Cancel
Save