From 660bb2e9ee04ff2ab02cecced9fec84d5825af4f Mon Sep 17 00:00:00 2001 From: Benard Ebinu Date: Mon, 12 Mar 2018 13:55:34 -0700 Subject: [PATCH] DIV-814: Adding question F5.0, F6.0, and F7.0 back to fact sheet F --- edivorce/apps/core/static/js/main.js | 10 +- .../partials/fact_sheet_f_table.html | 242 ++++++++++-------- .../templates/pdf/partials/fact_sheet_f.html | 20 -- .../pdf/partials/fact_sheet_f_table.html | 23 +- .../apps/core/templatetags/format_utils.py | 6 + edivorce/fixtures/Question.json | 46 +++- 6 files changed, 217 insertions(+), 130 deletions(-) diff --git a/edivorce/apps/core/static/js/main.js b/edivorce/apps/core/static/js/main.js index 4b89754f..6b934602 100755 --- a/edivorce/apps/core/static/js/main.js +++ b/edivorce/apps/core/static/js/main.js @@ -1,5 +1,5 @@ // Reveal sections as the form is loading -$('input:radio, input:checkbox').each(function () { +var reveal_input_elements = function () { if ($(this).is(':checked')) { if ($(this).is(':visible')) { reveal($(this)); @@ -9,7 +9,9 @@ $('input:radio, input:checkbox').each(function () { $(this).parent().addClass('active'); } } -}); +}; + +$('input:radio, input:checkbox').each(reveal_input_elements); $('input[type=number]').each(function() { if ($(this).is(':visible')) { @@ -470,7 +472,9 @@ $(function () { if (hide) { $('#fact_sheet_f_table_' + table_suffix).hide(); } else { - $('#fact_sheet_f_table_' + table_suffix).show(); + var fact_sheet_table_element = $('#fact_sheet_f_table_' + table_suffix); + fact_sheet_table_element.show(); + fact_sheet_table_element.find('input:radio, input:checkbox').each(reveal_input_elements); } if (claimant_name_selector) { diff --git a/edivorce/apps/core/templates/partials/fact_sheet_f_table.html b/edivorce/apps/core/templates/partials/fact_sheet_f_table.html index 529bd086..fd52e6a9 100644 --- a/edivorce/apps/core/templates/partials/fact_sheet_f_table.html +++ b/edivorce/apps/core/templates/partials/fact_sheet_f_table.html @@ -1,107 +1,147 @@ {% load input_field %} +{% load format_utils %} - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - + + + + + + + + - - - - - - - -
Payor Amount
- How many child(ren) are you asking for support? - - {% input_field type="number" name="number_children_seeking_support_"|add:claimant_id class="fact-sheet-input" %} -
-

- What is the monthly - {% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://www.justice.gc.ca/eng/rp-pr/fl-lf/child-enfant/guide/start-com.html#h11" link_text="Child Support Guidelines" %} - amount for $150,000? -

- {% include "partials/inline_question_determine_amount_to_pay.html" with collapse_target_id="collapse_guideline_amount" %} -
-
- {% money_input_field name="child_support_amount_under_high_income_"|add:claimant_id class="fact-sheet-input money guideline-amount-"|add:claimant_id data_sum="true" data_sum_class="guideline-amount-"|add:claimant_id data_sum_target_id="total_amount_"|add:claimant_id %} -
-
- What is the % of income over $150,000 from the +
Payor Amount
+ How many child(ren) are you asking for support? + + {% input_field type="number" name="number_children_seeking_support_"|add:claimant_id class="fact-sheet-input" %} +
+

+ What is the monthly {% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://www.justice.gc.ca/eng/rp-pr/fl-lf/child-enfant/guide/start-com.html#h11" link_text="Child Support Guidelines" %} - ? -

-
- {% input_field type="number" name="percent_income_over_high_income_limit_"|add:claimant_id class="fact-sheet-input" %} - -
-
-

- What is the monthly child support amount to be paid on the portion of income over - $150,000? -

- -
-
-

- The child support tables only show an amount for the first $150,000 of income. - You have - two choices for determining how much child support should be paid on the portion - of - income over $150,000: -

-
    -
  • - you can multiply the amount of income over $150,000 by the percentage shown - in the - table for the province or territory where the paying parent lives; or -
  • -
  • - you can agree on an additional amount of support based on the condition, - means, - needs and other circumstances of your children and your financial ability to - contribute. -
  • -
-

- Source: - {% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://www.justice.gc.ca/eng/rp-pr/fl-lf/child-enfant/guide/start-com.html#h11" link_text="Federal Child Support Guidelines" %} - , Department of Justice -

-
+ amount for $150,000? +

+ {% include "partials/inline_question_determine_amount_to_pay.html" with collapse_target_id="collapse_guideline_amount" %} +
+
+ {% money_input_field name="child_support_amount_under_high_income_"|add:claimant_id class="fact-sheet-input money guideline-amount-"|add:claimant_id data_sum="true" data_sum_class="guideline-amount-"|add:claimant_id data_sum_target_id="total_amount_"|add:claimant_id %} +
+
+ What is the % of income over $150,000 from the + {% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://www.justice.gc.ca/eng/rp-pr/fl-lf/child-enfant/guide/start-com.html#h11" link_text="Child Support Guidelines" %} + ? + +
+ {% input_field type="number" name="percent_income_over_high_income_limit_"|add:claimant_id class="fact-sheet-input" %} + +
+
+

+ What is the monthly child support amount to be paid on the portion of income over + $150,000? +

+
-
- {% money_input_field name="amount_income_over_high_income_limit_"|add:claimant_id class="fact-sheet-input money guideline-amount-"|add:claimant_id data_sum="true" data_sum_class="guideline-amount-"|add:claimant_id data_sum_target_id="total_amount_"|add:claimant_id %} +
+
+
+

+ The child support tables only show an amount for the first $150,000 of income. + You have + two choices for determining how much child support should be paid on the portion + of + income over $150,000: +

+
    +
  • + you can multiply the amount of income over $150,000 by the percentage shown + in the + table for the province or territory where the paying parent lives; or +
  • +
  • + you can agree on an additional amount of support based on the condition, + means, + needs and other circumstances of your children and your financial ability to + contribute. +
  • +
+

+ Source: + {% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://www.justice.gc.ca/eng/rp-pr/fl-lf/child-enfant/guide/start-com.html#h11" link_text="Federal Child Support Guidelines" %} + , Department of Justice +

-
- Guidelines table amount - -
- {% money_input_field name="total_guideline_amount_"|add:claimant_id id="total_amount_"|add:claimant_id class="fact-sheet-input money" readonly="" data_mirror="true" data_mirror_target="#agreed_total_amount" data_mirror_broadcast_change="true" %} -
-
\ No newline at end of file + + + +
+ {% money_input_field name="amount_income_over_high_income_limit_"|add:claimant_id class="fact-sheet-input money guideline-amount-"|add:claimant_id data_sum="true" data_sum_class="guideline-amount-"|add:claimant_id data_sum_target_id="total_amount_"|add:claimant_id data_mirror="true" data_mirror_target="#agreed_child_support_amount_"|add:claimant_id data_mirror_broadcast_change="true"%} +
+ + + + + Guidelines table amount + + +
+ {% money_input_field name="total_guideline_amount_"|add:claimant_id id="total_amount_"|add:claimant_id class="fact-sheet-input money" readonly="" data_mirror="true" data_mirror_target="#agreed_total_amount" data_mirror_broadcast_change="true" %} +
+ + + + + +
+

+ Do you and your spouse agree that ${% agreed_child_support_amount claimant_id %} is the child support amount? +

+
+ + + +
+ +
diff --git a/edivorce/apps/core/templates/pdf/partials/fact_sheet_f.html b/edivorce/apps/core/templates/pdf/partials/fact_sheet_f.html index 765b5926..f23c1832 100644 --- a/edivorce/apps/core/templates/pdf/partials/fact_sheet_f.html +++ b/edivorce/apps/core/templates/pdf/partials/fact_sheet_f.html @@ -10,25 +10,5 @@ {% include 'pdf/partials/fact_sheet_f_table.html' with claimant_id='spouse'%} {% endif %} - {% if responses.does_payour_amount_match_guidelines == 'YES' %} -

- We have agreed on the Guidelines table amount set out at Line D above as - the amount of child support. -

- {% else %} -

- We have agreed on an amount of child support that differs from the Guidelines table amount and the amount of child support agreed on is: -

    -
  1. {{ responses.order_monthly_child_support_amount|money }}, and
  2. -
  3. -

    differs from the Guidelines table amount because:

    -

    {{ responses.reason_child_support_amount|linebreaksbr }}

    -
  4. -
-

-

-

- {% endif %} - {% endif %} diff --git a/edivorce/apps/core/templates/pdf/partials/fact_sheet_f_table.html b/edivorce/apps/core/templates/pdf/partials/fact_sheet_f_table.html index 8ee3323f..d43d4527 100644 --- a/edivorce/apps/core/templates/pdf/partials/fact_sheet_f_table.html +++ b/edivorce/apps/core/templates/pdf/partials/fact_sheet_f_table.html @@ -45,4 +45,25 @@ Income Over $150,000 - \ No newline at end of file + + + + {% if responses.does_payour_amount_match_guidelines == 'YES' %} +

+ We have agreed on the Guidelines table amount set out at Line D above as + the amount of child support. +

+ {% else %} +

+ We have agreed on an amount of child support that differs from the Guidelines table amount and the amount of child support agreed on is: +

    +
  1. {% lookup responses 'agreed_child_support_amount_'|add:claimant_id %}, and
  2. +
  3. +

    differs from the Guidelines table amount because:

    +

    {% lookup responses 'reason_child_support_amount_'|add:claimant_id %}

    +
  4. +
+

+

+

+ {% endif %} \ No newline at end of file diff --git a/edivorce/apps/core/templatetags/format_utils.py b/edivorce/apps/core/templatetags/format_utils.py index 939ce272..bf18d4be 100644 --- a/edivorce/apps/core/templatetags/format_utils.py +++ b/edivorce/apps/core/templatetags/format_utils.py @@ -174,3 +174,9 @@ def integer(value): def lookup(obj, property): """ Return the value of a dynamic property within an object""" return obj.get(property, '') + + +@register.simple_tag(takes_context=True) +def agreed_child_support_amount(context, claimant_id): + """Return the agree amount for the specific claimant fact sheet table.""" + return linebreaksli(context.get('amount_income_over_high_income_limit_{}'.format(claimant_id), '')) diff --git a/edivorce/fixtures/Question.json b/edivorce/fixtures/Question.json index 42ac19b6..c2d388ab 100644 --- a/edivorce/fixtures/Question.json +++ b/edivorce/fixtures/Question.json @@ -1009,7 +1009,7 @@ }, { "fields": { - "name": "What is the amount that you and your spouse have agreed to?", + "name": "Do you and your spouse agree that amount is he child support amount?", "description": "For Step 6, Your children - Income & expenses - Your Fact Sheet F", "summary_order": 0, "required": "Conditional", @@ -1017,11 +1017,47 @@ "reveal_response": ">150000" }, "model": "core.question", - "pk": "agree_to_child_support_amount" + "pk": "agree_to_child_support_amount_you" }, { "fields": { - "name": "What is the amount that you and your spouse have agreed to?", + "name": "Do you and your spouse agree that amount is he child support amount?", + "description": "For Step 6, Your children - Income & expenses - Your Fact Sheet F", + "summary_order": 0, + "required": "Conditional", + "conditional_target": "annual_gross_income", + "reveal_response": ">150000" + }, + "model": "core.question", + "pk": "agree_to_child_support_amount_spouse" +}, +{ + "fields": { + "name": "What is the amount that you and your spouse have agreed to (that differs from the Child Support Guidelines table amount)?", + "description": "For Step 6, Your children - Income & expenses - Your Fact Sheet F", + "summary_order": 0, + "required": "Conditional", + "conditional_target": "claimants_agree_to_child_support_amount", + "reveal_response": "NO" + }, + "model": "core.question", + "pk": "agreed_child_support_amount_you" +}, +{ + "fields": { + "name": "What is the amount that you and your spouse have agreed to (that differs from the Child Support Guidelines table amount)?", + "description": "For Step 6, Your children - Income & expenses - Your Fact Sheet F", + "summary_order": 0, + "required": "Conditional", + "conditional_target": "claimants_agree_to_child_support_amount", + "reveal_response": "NO" + }, + "model": "core.question", + "pk": "agreed_child_support_amount_spouse" +}, +{ + "fields": { + "name": "Why do you think the court should approve your proposed amount?", "description": "For Step 6, Your children - Income & expenses - Your Fact Sheet F", "summary_order": 0, "required": "Conditional", @@ -1029,7 +1065,7 @@ "reveal_response": "NO" }, "model": "core.question", - "pk": "agreed_child_support_amount" + "pk": "reason_child_support_amount_you" }, { "fields": { @@ -1041,7 +1077,7 @@ "reveal_response": "NO" }, "model": "core.question", - "pk": "reason_child_support_amount" + "pk": "reason_child_support_amount_spouse" }, { "fields": {