Browse Source

DIV-881: Updated child support amount question and logic.

pull/160/head
Charles Shin 7 years ago
parent
commit
567671cd80
11 changed files with 77 additions and 50 deletions
  1. +2
    -2
      edivorce/apps/core/static/css/main.css
  2. +10
    -0
      edivorce/apps/core/static/css/main.scss
  3. +10
    -0
      edivorce/apps/core/static/js/ajax.js
  4. +6
    -0
      edivorce/apps/core/static/js/functions.js
  5. +2
    -2
      edivorce/apps/core/templates/pdf/form37.html
  6. +1
    -1
      edivorce/apps/core/templates/pdf/partials/fact_sheet_d.html
  7. +1
    -1
      edivorce/apps/core/templates/pdf/partials/fact_sheet_f_table.html
  8. +30
    -22
      edivorce/apps/core/templates/question/06_children_what_for.html
  9. +10
    -4
      edivorce/apps/core/templatetags/summary_format.py
  10. +0
    -1
      edivorce/apps/core/utils/question_step_mapping.py
  11. +5
    -17
      edivorce/fixtures/Question.json

+ 2
- 2
edivorce/apps/core/static/css/main.css
File diff suppressed because it is too large
View File


+ 10
- 0
edivorce/apps/core/static/css/main.scss View File

@ -800,6 +800,16 @@ input {
margin-bottom: 8px;
margin-left: 21px;
}
.radio .radio-with-textbox {
display: flex;
align-items: baseline;
margin-bottom: 16px;
input.form-block {
margin-bottom: 0;
margin-right: 8px;
}
}
textarea {
width: 100%;


+ 10
- 0
edivorce/apps/core/static/js/ajax.js View File

@ -10,6 +10,16 @@ var ajaxOnChange = function () {
return;
}
// Only make Ajax call if radio button for the element is selected.
// data-ajax_only_radio_selected=[true]
var ajaxOnlyRadioSelect = el.attr('data-ajax_only_radio_selected');
if (ajaxOnlyRadioSelect !== undefined && ajaxOnlyRadioSelect === "true") {
var radioButton = el.closest('div.radio').find('input:radio');
if (!radioButton.prop('checked')) {
return;
}
}
var question = el.prop('name');
var value = getValue(el, question);
var isValid = true;


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

@ -184,6 +184,12 @@ var checkboxRadioControl = function(el) {
var radioWithTextboxControl = function(el){
// If radio button has other as an option and 'Other' is not selected, update other textbox to empty
if (el.is(".radio-with-other") && el.val() !== 'Other'){
// Special case for child_support_in_order question which has option to use value from Factsheet C.
// Change on radio button selection will save child support amount value as well.
if (el.prop('name') === 'child_support_in_order') {
var moneyTextBox = el.parent().find('.child-support-amount');
ajaxCall(moneyTextBox.prop('name'), moneyTextBox.val());
}
var otherTextBox = el.closest('div.radio').parent().find(".other-textbox");
otherTextBox.val('');
ajaxCall(otherTextBox.prop('name'), '');


+ 2
- 2
edivorce/apps/core/templates/pdf/form37.html View File

@ -239,13 +239,13 @@
arrangements have been made for the support of the child:
<div class="new-paragraph user-entered"
>{{ responses.child_support_in_order_reason }}</div>
{% elif responses.does_payour_amount_match_guidelines == 'YES' %} <!-- 6a -->
{% elif responses.child_support_in_order == 'MATCH' %} <!-- 6a -->
The proposed order sets out that
{{ responses.order_monthly_child_support_amount|money }}
is the amount of child support payable by
{{ derived.child_support_payor }},
which amount accords with the Guidelines.
{% elif responses.claimants_agree_to_child_support_amount == 'YES' %} <!-- 6b -->
{% elif responses.child_support_in_order == 'DIFF' and responses.claimants_agree_to_child_support_amount == 'YES' %} <!-- 6b -->
The proposed order by consent, pursuant to section 15.1(7) of the
Divorce Act (Canada) or section 150(2) of the Family Law Act,
sets out that


+ 1
- 1
edivorce/apps/core/templates/pdf/partials/fact_sheet_d.html View File

@ -20,7 +20,7 @@
</li>
</ol>
{% if responses.does_payour_amount_match_guidelines == 'YES' %}
{% if responses.child_support_in_order == 'MATCH' %}
<p>
The person swearing this affidavit says that the Guidelines table amount
is appropriate.


+ 1
- 1
edivorce/apps/core/templates/pdf/partials/fact_sheet_f_table.html View File

@ -48,7 +48,7 @@ Income Over $150,000
</table>
{% if responses.does_payour_amount_match_guidelines == 'YES' %}
{% if responses.child_support_in_order == 'MATCH' %}
<p>
We have agreed on the Guidelines table amount set out at Line D above as
the amount of child support.


+ 30
- 22
edivorce/apps/core/templates/question/06_children_what_for.html View File

@ -27,25 +27,49 @@
to be paid by {% payorize %}?
</h3>
<div class="radio">
<label>
<label class="radio-with-textbox">
{% if how_will_calculate_income != 'entered agreement' %}
{% input_field type="radio" class="radio-centered radio-with-other radio_with_textbox" name="child_support_in_order" value="YES" data_target_class="support-amount-match" data_reveal_class="true" %}
{% input_field type="radio" class="radio-centered radio-with-other radio_with_textbox" name="child_support_in_order" value="MATCH" data_target_id="child_support_in_order_detail" data_reveal_target="false" data_target_class="support-amount-match" data_reveal_class="false" %}
{% if derived.show_fact_sheet_c %}
<div class="dollar-prefix">
{% money_input_field name="order_monthly_child_support_amount" value_src="difference_payment_amounts" class="money positive-float form-block response-textbox children-input-block child-support-amount" readonly="" %}
</div>Matches Child Support Guideline amount
{% else %}
<div class="dollar-prefix">
{% money_input_field name="order_monthly_child_support_amount" class="money positive-float form-block response-textbox children-input-block child-support-amount" data_ajax_only_radio_selected="true" %}
</div>Matches Child Support Guideline amount
{% endif %}
{% else %}
{% input_field type="radio" class="radio-centered radio-with-other radio_with_textbox" name="child_support_in_order" value="YES" %}
{% input_field type="radio" class="radio-centered radio-with-other radio_with_textbox" name="child_support_in_order" value="MATCH" data_target_id="child_support_in_order_detail" data_reveal_target="false" %}
<div class="dollar-prefix">
{% money_input_field name="order_monthly_child_support_amount" class="money positive-float form-block response-textbox children-input-block" %}
</div>
{% endif %}
</label>
</div>
{% if how_will_calculate_income != 'entered agreement' %}
<div class="radio">
<label class="radio-with-textbox">
{% input_field type="radio" class="radio-centered radio-with-other radio_with_textbox" name="child_support_in_order" value="DIFF" data_target_class="support-amount-match" data_reveal_class="true" data_target_id="child_support_in_order_detail" data_reveal_target="false" %}
<div class="dollar-prefix">
{% money_input_field name="order_monthly_child_support_amount" class="money positive-float form-block response-textbox children-input-block" data_mirror="true" data_mirror_target="#child_support_amount_label" %}
{% money_input_field name="order_monthly_child_support_amount" class="money positive-float form-block response-textbox children-input-block child-support-amount" data_ajax_only_radio_selected="true" %}
</div>
Different amount (does not match Child Support Guidelines)
</label>
</div>
{% endif %}
{% if how_will_calculate_income != 'entered agreement' %}
<div class="radio">
<label>
{% input_field type="radio" class="radio-with-other radio_with_textbox" name="child_support_in_order" value="NO" data_target_class="support-amount-match" data_reveal_class="false" %}We are not asking for child support to be included in the order
{% input_field type="radio" class="radio-with-other radio_with_textbox" name="child_support_in_order" value="NO" data_target_id="child_support_in_order_detail" data_reveal_target="true" data_target_class="support-amount-match" data_reveal_class="false" %}We are not asking for child support to be included in the order
</label>
<p>
<p id="child_support_in_order_detail">
Please describe what arrangements have been made for the support of the child (ren)?
{% input_field type="textarea" name="child_support_in_order_reason" class="other-textbox response-textarea form-control" tabindex="-1" maxlength="500" rows="3" %}
</p>
@ -53,22 +77,6 @@
{% endif %}
</div>
<div class="question-well support-amount-match" id="does_amount_match" hidden>
<h3>Does this amount match with what is specified in the current
<a href="http://laws-lois.justice.gc.ca/eng/regulations/SOR-97-175/page-1.html" target="_blank">
Federal Child Support Guidelines
</a>amount based on the income of the payor(s)?
</h3>
<div class="btn-radio-group" data-toggle="buttons">
<label class="btn btn-radio">
{% input_field type="radio" name="does_payour_amount_match_guidelines" value="YES" data_target_id="amount_does_not_match" data_reveal_target="false" data_reveal_force_hide_group=".hide-grouping" %} Yes
</label>
<label class="btn btn-radio">
{% input_field type="radio" name="does_payour_amount_match_guidelines" value="NO" data_target_id="amount_does_not_match" data_reveal_target="true" %} No
</label>
</div>
</div>
<div class="question-well support-amount-match hide-grouping" id="amount_does_not_match" hidden>
<h3>Do you and the other parent agree (have consented) on the child support amount?</h3>
<div class="btn-radio-group" data-toggle="buttons">


+ 10
- 4
edivorce/apps/core/templatetags/summary_format.py View File

@ -119,10 +119,9 @@ def format_children(context, source):
'child_support_arrears_amount'
]
question_to_heading['What are you asking for?'] = [
# 'child_support_in_order',
'order_monthly_child_support_amount',
'child_support_in_order',
# 'order_monthly_child_support_amount',
'child_support_in_order_reason',
'does_payour_amount_match_guidelines',
'claimants_agree_to_child_support_amount',
'child_support_payment_special_provisions',
'agree_to_child_support_amount',
@ -215,9 +214,16 @@ def format_children(context, source):
value = json.loads(item['value'])
except:
pass
question_name = item['question__name']
if question == 'order_monthly_child_support_amount':
if question == 'child_support_in_order':
question_name = '{} {}'.format(question_name, context['derived']['child_support_payor_by_name'])
if value == 'MATCH':
value = '{:.2f}'.format(float(context['derived']['guideline_amounts_difference']))
elif value == 'DIFF':
amount = list(filter(lambda x: x['question_id'] == 'order_monthly_child_support_amount', working_source))
amount = amount.pop()
value = '{:.2f}'.format(float(amount['value']))
if question == 'describe_order_special_extra_expenses':
value = reformat_list(value)


+ 0
- 1
edivorce/apps/core/utils/question_step_mapping.py View File

@ -84,7 +84,6 @@ question_step_mapping = {
'child_support_in_order',
'order_monthly_child_support_amount',
'child_support_in_order_reason',
'does_payour_amount_match_guidelines',
'child_support_payment_special_provisions',
'number_children_seeking_support',
'child_support_amount_under_high_income',


+ 5
- 17
edivorce/fixtures/Question.json View File

@ -1800,7 +1800,7 @@
"summary_order": 0,
"required": "Conditional",
"conditional_target": "child_support_in_order",
"reveal_response": "YES"
"reveal_response": "DIFF"
},
"model": "core.question",
"pk": "order_monthly_child_support_amount"
@ -1815,26 +1815,14 @@
"model": "core.question",
"pk": "child_support_in_order_reason"
},
{
"fields": {
"name": "Does this amount match with what is specified in the current Federal Child Support Guidelines amount based on the income of the payor(s)?",
"description": "For Step 6, Your children - Payor & medical expenses",
"summary_order": 0,
"required": "Conditional",
"conditional_target": "child_support_in_order",
"reveal_response": "YES"
},
"model": "core.question",
"pk": "does_payour_amount_match_guidelines"
},
{
"fields": {
"name": "Do you and the other parent agree (have consented) on the child support amount?",
"description": "For Step 6, Your children - Payor & medical expenses",
"summary_order": 0,
"required": "Conditional",
"conditional_target": "[does_payour_amount_match_guidelines,child_support_in_order]",
"reveal_response": "[NO,YES]"
"conditional_target": "child_support_in_order",
"reveal_response": "[DIFF]"
},
"model": "core.question",
"pk": "claimants_agree_to_child_support_amount"
@ -1845,8 +1833,8 @@
"description": "For Step 6, Your children - Payor & medical expenses",
"summary_order": 0,
"required": "Conditional",
"conditional_target": "[claimants_agree_to_child_support_amount,does_payour_amount_match_guidelines,child_support_in_order]",
"reveal_response": "[NO,NO,YES]"
"conditional_target": "[claimants_agree_to_child_support_amount,child_support_in_order]",
"reveal_response": "[NO,DIFF]"
},
"model": "core.question",
"pk": "child_support_payment_special_provisions"


Loading…
Cancel
Save