Browse Source

DIV-678: show fact sheet c when claimants have appropriate children arrangements

pull/160/head
Benard Ebinu 8 years ago
parent
commit
f35826bbcf
1 changed files with 13 additions and 16 deletions
  1. +13
    -16
      edivorce/apps/core/static/js/main.js

+ 13
- 16
edivorce/apps/core/static/js/main.js View File

@ -367,24 +367,18 @@ $(function () {
};
var evaluateFactSheetShowCriteria = function(childrenData) {
var childWithBoth = false;
var childWithBoth = 0;
var childWithYou = 0;
var childWithSpouse = 0;
var childWithOther = 0;
childrenData.forEach(function(child) {
if (child.child_live_with === 'Lives with both') {
childWithBoth |= true;
if (child.child_live_with === 'Lives with you' ) {
childWithYou += 1;
}
if (childrenData.length > 1 ) {
if (child.child_live_with === 'Lives with you' ) {
childWithYou += 1;
}
if (child.child_live_with === 'Lives with spouse') {
childWithSpouse +=1 ;
}
if (child.child_live_with === 'Other') {
childWithOther +=1 ;
}
if (child.child_live_with === 'Lives with spouse') {
childWithSpouse +=1;
}
if (child.child_live_with === 'Lives with both') {
childWithBoth += 1;
}
});
@ -396,9 +390,12 @@ $(function () {
}
// show fact sheet c
if (childWithYou === 1 && (childWithSpouse > 0 || childWithOther > 0 || childWithBoth)) {
// When the claimants have indicated that they have more than one child, then show fact sheet c if each
// claimant has sole custody of at least one of the children or if one claimant has sole custody of at least one
// child and the both claimants have shared custody of the remaining children.
if (childWithYou && (childWithSpouse || childWithBoth)) {
$('#fact_sheet_c').show();
} else if (childWithSpouse === 1 && (childWithYou > 0 || childWithOther > 0 || childWithBoth)) {
} else if (childWithSpouse && (childWithYou || childWithBoth)) {
$('#fact_sheet_c').show();
} else {
$('#fact_sheet_c').hide();


Loading…
Cancel
Save