Browse Source

Merge pull request #44 from bcgov/DIV-947

DIV-947, DIV-950
pull/160/head
Charles Shin 6 years ago
committed by GitHub
parent
commit
0d9e336bd9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 16 deletions
  1. +29
    -0
      edivorce/apps/core/static/js/functions.js
  2. +7
    -7
      edivorce/apps/core/static/js/main.js
  3. +10
    -9
      edivorce/apps/core/templates/question/06_children_facts.html

+ 29
- 0
edivorce/apps/core/static/js/functions.js View File

@ -7,6 +7,35 @@ if (!String.prototype.startsWith) {
};
}
// Internet Explorer 11 implementation does not have the replaceWith function
// so manually add polyfill version from MDN docs.
function ReplaceWithPolyfill() {
'use-strict'; // For safari, and IE > 10
var parent = this.parentNode, i = arguments.length, currentNode;
if (!parent) return;
if (!i) // if there are no arguments
parent.removeChild(this);
while (i--) { // i-- decrements i and returns the value of i before the decrement
currentNode = arguments[i];
if (typeof currentNode !== 'object'){
currentNode = this.ownerDocument.createTextNode(currentNode);
} else if (currentNode.parentNode){
currentNode.parentNode.removeChild(currentNode);
}
// the value of "i" below is after the decrement
if (!i) // if currentNode is the first argument (currentNode === arguments[0])
parent.replaceChild(currentNode, this);
else // if currentNode isn't the first
parent.insertBefore(this.previousSibling, currentNode);
}
}
if (!Element.prototype.replaceWith)
Element.prototype.replaceWith = ReplaceWithPolyfill;
if (!CharacterData.prototype.replaceWith)
CharacterData.prototype.replaceWith = ReplaceWithPolyfill;
if (!DocumentType.prototype.replaceWith)
DocumentType.prototype.replaceWith = ReplaceWithPolyfill;
// Show or Hide Information Section
// Using following data attributes:
// data-target_id: id of information section


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

@ -485,7 +485,7 @@ $(function () {
deleteAddedTableRow($element);
} else if (tempRowData.isNewRow === false && tempRowData.el !== null) {
// Restore original row data when edit is cancelled.
var $rows = $('#claimant_children').find('tbody:first').find(`tr[data-counter="${tempRowData.activeRow}"]`).find('.child-item-cell:not(.fact-sheet-button)');
var $rows = $('#claimant_children').find('tbody:first').find('tr[data-counter=' + tempRowData.activeRow + ']').find('.child-item-cell:not(.fact-sheet-button)');
$rows.each(function(i, $row) {
$row.replaceWith(tempRowData.el[i]);
});
@ -500,10 +500,10 @@ $(function () {
$('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'
return child.child_live_with === 'Lives with you';
});
var spouseHasSoleCustody = children.every(function(child){
return child.child_live_with === 'Lives with spouse'
return child.child_live_with === 'Lives with spouse';
});
if (youHaveSoleCustody || spouseHasSoleCustody) {
@ -533,10 +533,10 @@ $(function () {
if (claimant === 'Myself (Claimant 1)' && parseFloat($('input[name="annual_gross_income"]').val()) > 150000) {
toggleFactSheetTable('1', '#__name_you');
toggleFactSheetTable('2', null, true)
toggleFactSheetTable('2', null, true);
} else if (claimant === 'My Spouse (Claimant 2)' && parseFloat($('input[name="spouse_annual_gross_income"]').val()) > 150000) {
toggleFactSheetTable('2', '#__name_spouse');
toggleFactSheetTable('1', null, true)
toggleFactSheetTable('1', null, true);
} else if (claimant === 'Both myself and my spouse') {
if (parseFloat($('input[name="annual_gross_income"]').val()) > 150000) {
toggleFactSheetTable('1', '#__name_you');
@ -1005,7 +1005,7 @@ var deleteAddedTableRow = function(element) {
// In that case, check if the data-target-form-field attribute is set, that will contain
// the field names to be saved.
if (fieldKey === undefined) {
fieldKey = $(this).attr('data-target-form-field')
fieldKey = $(this).attr('data-target-form-field');
}
var fieldValue = $(this).val();
@ -1126,7 +1126,7 @@ var date_picker = function (selector, showOnFocus) {
$(this).closest(selector).find('input').removeAttr('readonly');
}).on('clearDate', function (e) {
var input = $(this).closest(selector).find('input');
ajaxCall(input.attr('name'), '')
ajaxCall(input.attr('name'), '');
});
};


+ 10
- 9
edivorce/apps/core/templates/question/06_children_facts.html View File

@ -18,9 +18,9 @@
<div id="fact_sheet_b" class="question-well fact-sheets" hidden>
<h1>Shared Living Arrangement (Fact Sheet B)</h1>
<p>
Since you have previously indicated that the child/children will live with both parents more or less equally
(between 40 to 60% of the time with each parent) we need you to answer the questions below in order for the
court to assess if the payor is paying the right amount (percentage) for child support.
Since you have previously indicated that the child/children will live with both parents more or less equally
(between 40 to 60% of the time with each parent) we need you to answer the questions below.
<b>This information is needed for the Judge. You will be able to indicate a different child support amount in a following step.</b>
</p>
<div class="question-well">
<h3>Number of children</h3>
@ -238,10 +238,10 @@
<div id="fact_sheet_c" class="question-well fact-sheets" hidden>
<h1>Split Living Arrangement (Fact Sheet C)</h1>
<p>
Since you have previously indicated that you and your spouse have more than one child and each of you has
sole custody of at least one of the children, we need you to answer the next set of questions in order for the
court to satisfy itself that "reasonable arrangements" have been made for the support of the children before it
can grant an order for divorce.
Since you have previously indicated that you and your spouse have more than one child and
at least one of the children lives primarily with just 1 parent (more than 60% of the time)
you must complete Fact Sheet C.
<b>This information is needed for the Judge. You will be able to indicate a different child support amount in a following step.</b>
</p>
<table class="table table-bordered">
<tbody>
@ -387,7 +387,7 @@
</h3>
{% if derived.show_fact_sheet_b %}
<p>
If the total in <b>Fact Sheet B</b> is <b>zero dollars ($0.00)</b>, select 'Both' are the payor below.
If the total in <b>Fact Sheet(s)</b> is <b>zero dollars ($0.00)</b>, select 'Both' are the payor below.
</p>
{% endif %}
<p>
@ -463,7 +463,8 @@
<div class="question-well">
<p>
What is the monthly amount that <span class="payor-placeholder">payor</span> will be paying for child support (as per Schedule 1 of the Federal Child Support Guidelines)?
What would the child support amount be using the Federal Child Support Guidelines?
<b>This information is needed for the Judge. You will be able to indicate a different child support amount in a following step.</b>
</p>
<div>
<div class="dollar-prefix">


Loading…
Cancel
Save