Browse Source

Add required fields to What are you asking for

pull/160/head
ariannedee 5 years ago
parent
commit
51f1baf175
3 changed files with 118 additions and 53 deletions
  1. +37
    -21
      edivorce/apps/core/templates/question/06_children_what_for.html
  2. +66
    -0
      edivorce/apps/core/utils/conditional_logic.py
  3. +15
    -32
      edivorce/apps/core/utils/derived.py

+ 37
- 21
edivorce/apps/core/templates/question/06_children_what_for.html View File

@ -11,7 +11,7 @@
{% block content %} {% block content %}
<h1><small>Step {% step_order step="children" %}:</small>Children - What are you asking for</h1> <h1><small>Step {% step_order step="children" %}:</small>Children - What are you asking for</h1>
<div class="question-well">
<div class="question-well {% if child_support_in_order_error or child_support_in_order_reason_error %}error{% endif %}">
<h3>What is the monthly child support amount <h3>What is the monthly child support amount
<span class="tooltip-link" <span class="tooltip-link"
data-toggle="tooltip" data-placement="right" data-html="true" data-toggle="tooltip" data-placement="right" data-html="true"
@ -25,6 +25,7 @@
proposed in the order<i class="fa fa-question-circle" aria-hidden="true"></i> proposed in the order<i class="fa fa-question-circle" aria-hidden="true"></i>
</span> </span>
to be paid by {% payorize %}? to be paid by {% payorize %}?
{% if child_support_in_order_error %}{% include 'partials/required.html' %}{% endif %}
</h3> </h3>
<div class="radio"> <div class="radio">
<label class="radio-with-textbox"> <label class="radio-with-textbox">
@ -85,9 +86,11 @@
<div class="radio"> <div class="radio">
{% if 'Child support' in want_which_orders|load_json %} {% if 'Child support' in want_which_orders|load_json %}
<label>{% 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>
<label>{% 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>
{% else %} {% else %}
<label>{% 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" disabled="" checked="" %}We are not asking for child support to be included in the order</label>
<label>{% 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" disabled="" checked="" %}
We are not asking for child support to be included in the order</label>
<div class="information-message bg-danger"> <div class="information-message bg-danger">
<p>This option has been automatically selected for you because you indicated in Step 1 you didn't want an "Order pertaining to children"</p> <p>This option has been automatically selected for you because you indicated in Step 1 you didn't want an "Order pertaining to children"</p>
</div> </div>
@ -99,8 +102,10 @@
</div> </div>
</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="question-well support-amount-match hide-grouping {% if claimants_agree_to_child_support_amount_error %}error{% endif %}" id="amount_does_not_match" hidden>
<h3>Do you and the other parent agree (have consented) on the child support amount?
{% if claimants_agree_to_child_support_amount_error %}{% include 'partials/required.html' %}{% endif %}
</h3>
<div class="btn-radio-group" data-toggle="buttons"> <div class="btn-radio-group" data-toggle="buttons">
<label class="btn btn-radio"> <label class="btn btn-radio">
{% input_field type="radio" name="claimants_agree_to_child_support_amount" value="YES" data_target_id="what_special_provisions" data_reveal_target="false" %} Yes {% input_field type="radio" name="claimants_agree_to_child_support_amount" value="YES" data_target_id="what_special_provisions" data_reveal_target="false" %} Yes
@ -111,13 +116,15 @@
</div> </div>
</div> </div>
<div class="question-well hide-grouping support-amount-match" id="what_special_provisions" hidden>
<h3>What special provisions have been made?</h3>
<div class="question-well hide-grouping support-amount-match {% if child_support_payment_special_provisions_error %}error{% endif %}" id="what_special_provisions" hidden>
<h3>What special provisions have been made?{% if child_support_payment_special_provisions_error %}{% include 'partials/required.html' %}{% endif %}</h3>
{% input_field type="textarea" name="child_support_payment_special_provisions" class="response-textarea form-control" tabindex="-1" maxlength="1000" rows="3" %} {% input_field type="textarea" name="child_support_payment_special_provisions" class="response-textarea form-control" tabindex="-1" maxlength="1000" rows="3" %}
</div> </div>
<div class="question-well">
<h3>Do you have a separation agreement that sets out what you've agreed to around parenting and child support?</h3>
<div class="question-well {% if have_separation_agreement_error %}error{% endif %}">
<h3>Do you have a separation agreement that sets out what you've agreed to around parenting and child support?
{% if have_separation_agreement_error %}{% include 'partials/required.html' %}{% endif %}
</h3>
<div class="btn-radio-group" data-toggle="buttons"> <div class="btn-radio-group" data-toggle="buttons">
<label class="btn btn-radio"> <label class="btn btn-radio">
{% input_field type="radio" name="have_separation_agreement" autocomplete="off" value="YES" data_target_id="separation_agreement" data_reveal_target="true" %} Yes {% input_field type="radio" name="have_separation_agreement" autocomplete="off" value="YES" data_target_id="separation_agreement" data_reveal_target="true" %} Yes
@ -208,7 +215,7 @@
</div> </div>
<div class="question-well">
<div class="question-well {% if have_court_order_error %}error{% endif %}">
<h3>Do you already have a child support <h3>Do you already have a child support
<span class="tooltip-link" <span class="tooltip-link"
data-toggle="tooltip" data-placement="right" data-html="true" data-toggle="tooltip" data-placement="right" data-html="true"
@ -220,7 +227,9 @@
</p> </p>
"> ">
order <i class="fa fa-question-circle" aria-hidden="true"></i> order <i class="fa fa-question-circle" aria-hidden="true"></i>
</span>in Provincial or Supreme Court?</h3>
</span>in Provincial or Supreme Court?
{% if have_court_order_error %}{% include 'partials/required.html' %}{% endif %}
</h3>
<div class="btn-radio-group" data-toggle="buttons"> <div class="btn-radio-group" data-toggle="buttons">
<label class="btn btn-radio"> <label class="btn btn-radio">
{% input_field type="radio" name="have_court_order" autocomplete="off" value="YES" data_target_id="court_order_details" data_reveal_target="true" %} Yes {% input_field type="radio" name="have_court_order" autocomplete="off" value="YES" data_target_id="court_order_details" data_reveal_target="true" %} Yes
@ -259,8 +268,10 @@
</div> </div>
<div class="question-well">
<h3>The court needs to know what the current parenting arrangements are for the children of the marriage. Please describe below.</h3>
<div class="question-well {% if what_parenting_arrangements_error %}error{% endif %}">
<h3>The court needs to know what the current parenting arrangements are for the children of the marriage. Please describe below.
{% if what_parenting_arrangements_error %}{% include 'partials/required.html' %}{% endif %}
</h3>
<div class="collapse-trigger collapsed" data-toggle="collapse" aria-expanded="false" data-target="#collapse_parenting_arrangement" aria-controls="collapse_parenting_arrangement"> <div class="collapse-trigger collapsed" data-toggle="collapse" aria-expanded="false" data-target="#collapse_parenting_arrangement" aria-controls="collapse_parenting_arrangement">
<div> <div>
What should we consider when determining parenting arrangements? What should we consider when determining parenting arrangements?
@ -300,8 +311,7 @@
{% input_field type="textarea" name="what_parenting_arrangements" class="response-textarea form-control" maxlength="20000" rows="7"%} {% input_field type="textarea" name="what_parenting_arrangements" class="response-textarea form-control" maxlength="20000" rows="7"%}
</div> </div>
{% if 'Child support' in want_which_orders|load_json %}
<div class="question-well">
<div class="question-well {% if want_parenting_arrangements_error %}error{% endif %}">
<h3>Are you asking the court for an <h3>Are you asking the court for an
<span class="tooltip-link" <span class="tooltip-link"
data-toggle="tooltip" data-placement="right" data-html="true" data-toggle="tooltip" data-placement="right" data-html="true"
@ -317,6 +327,7 @@
"> ">
order about parenting arrangements or contact <i class="fa fa-question-circle" aria-hidden="true"></i> order about parenting arrangements or contact <i class="fa fa-question-circle" aria-hidden="true"></i>
</span> with a child? </span> with a child?
{% if want_parenting_arrangements_error %}{% include 'partials/required.html' %}{% endif %}
</h3> </h3>
<div class="btn-radio-group" data-toggle="buttons"> <div class="btn-radio-group" data-toggle="buttons">
<label class="btn btn-radio"> <label class="btn btn-radio">
@ -329,8 +340,10 @@
</div> </div>
</div> </div>
<div class="question-well" id="parenting_arrangement_detail" hidden>
<h3>Please indicate the parenting arrangements you are asking for below.</h3>
<div class="question-well {% if order_respecting_arrangement_error %}error{% endif %}" id="parenting_arrangement_detail" hidden>
<h3>Please indicate the parenting arrangements you are asking for below.
{% if order_respecting_arrangement_error %}{% include 'partials/required.html' %}{% endif %}
</h3>
<p> <p>
You need to include each of the orders you want pertaining to guardianship, parental responsibilities and You need to include each of the orders you want pertaining to guardianship, parental responsibilities and
parenting time, and contact with the child. You will need to write them as if a Judge is telling you to do it. parenting time, and contact with the child. You will need to write them as if a Judge is telling you to do it.
@ -353,8 +366,8 @@
</blockquote> </blockquote>
{% input_field type="textarea" name="order_respecting_arrangement" class="response-textarea form-control" maxlength="20000" rows="7"%} {% input_field type="textarea" name="order_respecting_arrangement" class="response-textarea form-control" maxlength="20000" rows="7"%}
</div> </div>
<div class="question-well" id="child_support_description">
{% if 'Child support' in want_which_orders|load_json %}
<div class="question-well {% if order_for_child_support_error %}error{% endif %}" id="child_support_description">
<h3>If you are asking for an <h3>If you are asking for an
<span class="tooltip-link" <span class="tooltip-link"
data-toggle="tooltip" data-placement="right" data-html="true" data-toggle="tooltip" data-placement="right" data-html="true"
@ -367,6 +380,7 @@
order for child support<i class="fa fa-question-circle" aria-hidden="true"></i> order for child support<i class="fa fa-question-circle" aria-hidden="true"></i>
</span> </span>
please describe what you are asking for. please describe what you are asking for.
{% if order_for_child_support_error %}{% include 'partials/required.html' %}{% endif %}
</h3> </h3>
<p> <p>
Child support is determined according to the federal government’s Child support is determined according to the federal government’s
@ -400,8 +414,10 @@
{% endif %} {% endif %}
{# DIV-963: Show/hide logic and text update will be handled by JavaScript function updateChildSupportActQuestion() #} {# DIV-963: Show/hide logic and text update will be handled by JavaScript function updateChildSupportActQuestion() #}
<div class="question-well" id="child_support_act" {% if 'Child support' in want_which_orders|load_json %}data-want_child_order="true"{% endif %}>
<h3 id="child_support_act_question">Please indicate which act(s) you are asking for child support under.</h3>
<div class="question-well {% if child_support_act_error %}error{% endif %}" id="child_support_act" {% if 'Child support' in want_which_orders|load_json %}data-want_child_order="true"{% endif %}>
<h3><span id="child_support_act_question">Please indicate which act(s) you are asking for child support under.</span>
{% if child_support_act_error %}{% include 'partials/required.html' %}{% endif %}
</h3>
<div class="checkbox-group"> <div class="checkbox-group">
<div class="checkbox"> <div class="checkbox">
<label> <label>


+ 66
- 0
edivorce/apps/core/utils/conditional_logic.py View File

@ -67,3 +67,69 @@ def determine_missing_undue_hardship_reasons(questions_dict):
return False return False
return True return True
def determine_child_support_payor(questions_dict):
payor = questions_dict.get('child_support_payor', '')
if payor == 'Myself (Claimant 1)':
return 'Claimant 1'
elif payor == 'My Spouse (Claimant 2)':
return 'Claimant 2'
elif payor == 'Both myself and my spouse':
return 'both Claimant 1 and Claimant 2'
return ''
def determine_show_fact_sheet_f_you(questions_dict):
"""
If claimant 1 (you) is a payor and makes over $150,000/year, show fact sheet F for claimant 1
"""
payor = determine_child_support_payor(questions_dict)
try:
annual = float(questions_dict.get('annual_gross_income', 0))
except ValueError:
annual = 0
return (payor == 'Claimant 1' or payor == 'both Claimant 1 and Claimant 2') and annual > 150000
def determine_show_fact_sheet_f_spouse(questions_dict):
"""
If claimant 2 (spouse) is a payor and makes over $150,000/year, show fact sheet F for claimant 2
"""
payor = determine_child_support_payor(questions_dict)
try:
annual = float(questions_dict.get('spouse_annual_gross_income', 0))
except ValueError:
annual = 0
return (payor == 'Claimant 2' or payor == 'both Claimant 1 and Claimant 2') and annual > 150000
def determine_child_support_act_requirement(questions_dict):
orders_wanted = json.loads(questions_dict.get('want_which_orders', '[]'))
return 'Child support' in orders_wanted
def determine_special_expenses_detail_error(questions_dict):
special_expenses_keys = ["child_care_expenses", "annual_child_care_expenses", "children_healthcare_premiums",
"annual_children_healthcare_premiums", "health_related_expenses", "annual_health_related_expenses",
"extraordinary_educational_expenses", "annual_extraordinary_educational_expenses",
"post_secondary_expenses", "annual_post_secondary_expenses", "extraordinary_extracurricular_expenses",
"annual_extraordinary_extracurricular_expenses"]
if questions_dict.get('special_extraordinary_expenses') == 'YES':
for special_expense in special_expenses_keys:
value = questions_dict.get(special_expense)
if value and value != '0.00':
return False
return True
else:
return False
def get_cleaned_response_value(response):
ignore_values = [None, '', '[]', '[["",""]]', '[["also known as",""]]']
if response not in ignore_values:
return response
return None

+ 15
- 32
edivorce/apps/core/utils/derived.py View File

@ -17,6 +17,13 @@ from edivorce.apps.core.utils import conditional_logic
# This array is order sensitive: later functions may depend on values from # This array is order sensitive: later functions may depend on values from
# earlier ones # earlier ones
from edivorce.apps.core.utils.conditional_logic import (
determine_child_support_payor,
determine_show_fact_sheet_f_spouse,
determine_show_fact_sheet_f_you,
determine_special_expenses_detail_error
)
DERIVED_DATA = [ DERIVED_DATA = [
'orders_wanted', 'orders_wanted',
'children', 'children',
@ -79,6 +86,7 @@ DERIVED_DATA = [
'pursuant_parenting_arrangement', 'pursuant_parenting_arrangement',
'pursuant_child_support', 'pursuant_child_support',
'sole_custody', 'sole_custody',
'special_expenses_detail_error',
] ]
@ -216,31 +224,11 @@ def fact_sheet_e_error(responses, derived):
def show_fact_sheet_f_you(responses, derived): def show_fact_sheet_f_you(responses, derived):
"""
If claimant 1 (you) is a payor and makes over $150,000/year, show fact sheet F for claimant 1
"""
payor = child_support_payor(responses, derived)
try:
annual = float(responses.get('annual_gross_income', 0))
except ValueError:
annual = 0
return (payor == 'Claimant 1' or payor == 'both Claimant 1 and Claimant 2') and annual > 150000
return determine_show_fact_sheet_f_you(responses)
def show_fact_sheet_f_spouse(responses, derived): def show_fact_sheet_f_spouse(responses, derived):
"""
If claimant 2 (spouse) is a payor and makes over $150,000/year, show fact sheet F for claimant 2
"""
payor = child_support_payor(responses, derived)
try:
annual = float(responses.get('spouse_annual_gross_income', 0))
except ValueError:
annual = 0
return (payor == 'Claimant 2' or payor == 'both Claimant 1 and Claimant 2') and annual > 150000
return determine_show_fact_sheet_f_spouse(responses)
def show_fact_sheet_f(responses, derived): def show_fact_sheet_f(responses, derived):
@ -397,16 +385,7 @@ def schedule_1_amount(responses, derived):
def child_support_payor(responses, derived): def child_support_payor(responses, derived):
""" Return the payor phrased for the affidavit """ """ Return the payor phrased for the affidavit """
payor = responses.get('child_support_payor', '')
if payor == 'Myself (Claimant 1)':
return 'Claimant 1'
elif payor == 'My Spouse (Claimant 2)':
return 'Claimant 2'
elif payor == 'Both myself and my spouse':
return 'both Claimant 1 and Claimant 2'
return ''
return determine_child_support_payor(responses)
def child_support_payor_by_name(responses, derived): def child_support_payor_by_name(responses, derived):
@ -760,6 +739,10 @@ def sole_custody(responses, derived):
return conditional_logic.determine_sole_custody(responses) return conditional_logic.determine_sole_custody(responses)
def special_expenses_detail_error(responses, derived):
return determine_special_expenses_detail_error(responses)
def _any_question_errors(responses, questions): def _any_question_errors(responses, questions):
for field in questions: for field in questions:
error_field_name = f'{field}_error' error_field_name = f'{field}_error'


Loading…
Cancel
Save