Browse Source

DIV-550: Monthly payor amount question in place

pull/160/head
Benard Ebinu 8 years ago
parent
commit
1758eda5be
4 changed files with 159 additions and 2 deletions
  1. +43
    -0
      edivorce/apps/core/static/js/main.js
  2. +105
    -0
      edivorce/apps/core/templates/question/06_children_payor_medical.html
  3. +1
    -1
      edivorce/apps/core/templatetags/input_field.py
  4. +10
    -1
      edivorce/fixtures/Question.json

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

@ -458,6 +458,49 @@ $(function () {
populateChildrenFactSheets();
});
var updateClaimantName = function() {
var payor = '';
var element = $('#__claimant_names');
$("input[name='child_support_payor']:checked").each(function() {
if ($(this).val() === 'Myself (Claimant 1)') {
payor = element.find('input[name="name_you"]').val() || 'Claimant 1';
} else if ($(this).val() === 'My Spouse (Claimant 2)') {
payor = element.find('input[name="name_spouse"]').val() || 'Claimant 2';
} else if ($(this).val() === 'Both myself and my spouse') {
payor = (element.find('input[name="name_you"]').val() || 'Claimant 1') + ' and ' +
(element.find('input[name="name_spouse"]').val() || 'Claimant 2');
}
});
$('.__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.
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
});
if (hasSoleCustody) {
$('#monthly_amount_question').show();
} else {
$('#monthly_amount_question').hide();
}
};
$('#__claimant_names').each(updateClaimantName);
$('input[name="child_support_payor"]').on('change', updateClaimantName);
$("#btn_add_reconciliation_periods").on('click', function () {
$('#reconciliation_period_fields').append($('#reconciliation_period_group').children().clone());
// add event lister for newly added from_date field, to_date field, delete button, and date picker


+ 105
- 0
edivorce/apps/core/templates/question/06_children_payor_medical.html View File

@ -9,6 +9,12 @@
{% block content %}
<h1><small>Step {% step_order step="children" %}:</small>Children - Payor & medical expenses</h1>
<div id="__claimant_names" hidden>
<input name="name_you" value="{{ name_you }}" title="name_you" hidden />
<input name="name_spouse" value="{{ name_spouse }}" title="name_spouse" hidden />
<input name="claimant_children" value="{{ claimant_children }}" title="claimant_children" hidden />
</div>
<div class="question-well">
<h3>Who is the
<span class="tooltip-link"
@ -57,6 +63,105 @@
</div>
</div>
<div class="question-well" id="monthly_amount_question" hidden>
<h3>What is the monthly child support amount (as per
<a href="http://laws-lois.justice.gc.ca/eng/regulations/SOR-97-175/page-5.html#h-9" target="_blank">Schedule 1</a>
of the guidelines) that is payable by <span class="__name-of-payor"></span></h3>
<div class="dollar-prefix">
{% money_input_field name="payor_monthly_child_support_amount" class="money form-block response-textbox children-input-block" %}
</div>
<div class="collapse-trigger collapsed" data-toggle="collapse" aria-expanded="false" data-target="#collapse_determine_payor_amount" aria-controls="collapse_determine_payor_amount">
<div>
How do I determine what amount needs to be paid?
</div>
</div>
<div class="collapse" id="collapse_determine_payor_amount">
<div>
<p>
Child support orders made in British Columbia are based on the
<a href="http://laws-lois.justice.gc.ca/eng/regulations/SOR-97-175/page-1.html" target="_blank">
Federal Child Support Guidelines.
</a>These guidelines contain clear rules that courts use to set child support as well as tables
that list the amount of child support the payor has to pay. These amounts are based on how much he
or she earns and how many children the payor must support. Each province has its own table; use the
one for the province where the payor lives.
</p>
<p>
To figure out how much child support the payor will be paying under the guidelines:
</p>
<ul>
<li>Use the
<a href="http://www.justice.gc.ca/eng/fl-df/child-enfant/2017/look-rech.asp" target="_blank">
Child Support Table Lookup tool
</a> (effective from November 22, 2017) to calculate the
correct amount of child support.
</li>
</ul>
<p>
or
</p>
<ul>
<li>Refer to the
<a href="http://www.justice.gc.ca/eng/fl-df/child-enfant/ft-tf.html" target="_blank">
Federal Child Support Tables
</a>. Make sure you view the table pertaining to the province where the payor lives.
</li>
</ul>
</div>
</div>
<div class="collapse-trigger collapsed" data-toggle="collapse" aria-expanded="false" data-target="#collapse_schedule_one" aria-controls="collapse_schedule_one">
<div>
What is Schedule 1?
</div>
</div>
<div class="collapse" id="collapse_schedule_one">
<div>
<p>
Schedule 1 refers to the federal child support tables which set out the amount of monthly child
support payments for each province on the basis of the annual income of the spouse ordered to pay
child support (the “support payer”) and the number of children for whom a table amount is payable.
</p>
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>If...</th>
<th>Then…</th>
</tr>
</thead>
<tbody>
<tr>
<td>you both live in the same province or territory</td>
<td>use the table for that province or territory.</td>
</tr>
<tr>
<td>you live in different provinces or territories and one of you has sole custody and the other
parent must pay support
</td>
<td>use the table for the province or territory where the paying parent lives.</td>
</tr>
<tr>
<td>you live in different provinces or territories and you share or split custody</td>
<td>use the tables for both provinces or territories where you reside to determine what you
would each pay to the other parent.
</td>
</tr>
<tr>
<td>one of you lives outside Canada</td>
<td>use the table for the province or territory where the parent in Canada lives. The laws of
the other country may apply in some cases. You may want to consult a lawyer. You may also
find information relating to <a target="_blank" href="http://www.justice.gc.ca/eng/fl-df/enforce-execution/enforce-execut.html">interjurisdictional
support</a> useful.
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}


+ 1
- 1
edivorce/apps/core/templatetags/input_field.py View File

@ -36,7 +36,7 @@ def money_input_field(context, input_type='number', name='', value_src=None, val
if kwargs.get('step', None):
step = kwargs.get('step')
tag = ['<input type="{}" value="{:.2f}" step="{}" '.format(input_type, float(value), step)]
tag = ['<input type="{}" value="{:.2f}" step="{}" min="0" '.format(input_type, float(value), step)]
if name != '':
tag.append('name="{}"'.format(name))


+ 10
- 1
edivorce/fixtures/Question.json View File

@ -1514,6 +1514,15 @@
},
"model": "core.question",
"pk": "child_support_payor"
},
{
"fields": {
"name": "Who is the payor?",
"description": "For Step 6, Your children - Payor & medical expenses",
"summary_order": 0,
"required": "Conditional"
},
"model": "core.question",
"pk": "payor_monthly_child_support_amount"
}
]

Loading…
Cancel
Save