Browse Source

DIV-627: All fields in Fact Sheet B properly persist

pull/160/head
Benard Ebinu 8 years ago
parent
commit
160c4f7e5a
3 changed files with 130 additions and 10 deletions
  1. +24
    -0
      edivorce/apps/core/static/js/main.js
  2. +10
    -10
      edivorce/apps/core/templates/question/06_children_your_children.html
  3. +96
    -0
      edivorce/fixtures/Question.json

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

@ -59,6 +59,16 @@ $(function () {
// be persisted to the server.
$('[data-save_row="true"]').on('change', saveListControlRow);
// All elements tagged with the following delta related data attributes
// will have the delta between the two amounts calculated and the result written to
// the html elements at the delta target selector. Will store the absolute value of the difference
// of the terms.
// data-calc_delta=[true|false] - indicates input field should be included as term in the delta
// data-delta_term_selector=[selector] - all elements with the same delta class identifier will be
// addends of the delta.
// data-delta_target_selector=[selector] - all of the html elements where result of difference will be written
$('[data-calc_delta="true"]').on('change', deltaFieldOnChange);
$('[data-calc_delta="true"]').each(deltaFieldOnChange);
var fraction = function(part1, part2) {
part1 = parseFloat(part1);
@ -774,6 +784,20 @@ var sumFields = function(addend_selector, sum_selector) {
}
};
var deltaFieldOnChange = function() {
var deltaTermSelector = $(this).attr('data-delta_term_selector');
var deltaTargetSelector = $(this).attr('data-delta_target_selector');
var delta = 0;
$(deltaTermSelector).each(function(){
delta = Math.abs($(this).val() - delta);
});
$(deltaTargetSelector).each(function() {
$(this).val(delta);
});
};
// Configuration for datepicker
var date_picker = function (selector, showOnFocus) {
var startDate, endDate;


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

@ -285,10 +285,10 @@
What is the approximate amount of time the children spend with each parent?
</td>
<td class="fact-sheet-answer">
{% input_field type="number" name="time_spent_with_you" value="0" class="fact-sheet-input" %}
{% input_field type="number" name="time_spent_with_you" class="fact-sheet-input" %}
</td>
<td class="fact-sheet-answer">
{% input_field type="number" name="time_spent_with_spouse" value="0" class="fact-sheet-input" %}
{% input_field type="number" name="time_spent_with_spouse" class="fact-sheet-input" %}
</td>
</tr>
<tr>
@ -329,12 +329,12 @@
</td>
<td class="fact-sheet-answer">
<div class="dollar-prefix">
{% money_input_field name="your_child_support_paid" value="0" class="fact-sheet-input" %}
{% money_input_field name="your_child_support_paid" class="fact-sheet-input claimants-child-support-amounts" data_calc_delta="true" data_delta_term_selector=".claimants-child-support-amounts" data_delta_target_selector="input[name=difference_between_claimants]" %}
</div>
</td>
<td class="fact-sheet-answer">
<div class="dollar-prefix">
{% money_input_field name="your_spouse_child_support_paid" value="0" class="fact-sheet-input" %}
{% money_input_field name="your_spouse_child_support_paid" class="fact-sheet-input claimants-child-support-amounts" data_calc_delta="true" data_delta_term_selector=".claimants-child-support-amounts" data_delta_target_selector="input[name=difference_between_claimants]" %}
</div>
</td>
</tr>
@ -402,7 +402,7 @@
Difference between the Guidelines table amount of the claimant and the Guidelines table amount of the respondent
</td>
<td class="fact-sheet-answer" colspan="2" readonly>
{% input_field type="number" name="difference_between_claimants" value="0" class="fact-sheet-input" readonly="" %}
{% input_field type="number" name="difference_between_claimants" value="" class="fact-sheet-input" readonly="" %}
</td>
</tr>
<tr>
@ -420,25 +420,25 @@
) to be paid annually
</td>
<td class="fact-sheet-answer">
{% input_field type="number" name="extra_ordinary_expenses_you" value="0" class="fact-sheet-input" %}
{% input_field type="number" name="extra_ordinary_expenses_you" class="fact-sheet-input" %}
</td>
<td class="fact-sheet-answer">
{% input_field type="number" name="extra_ordinary_expenses_spouse" value="0" class="fact-sheet-input" %}
{% input_field type="number" name="extra_ordinary_expenses_spouse" class="fact-sheet-input" %}
</td>
</tr>
<tr>
<td colspan="3">
Any other relevant information regarding the conditions, means, needs and other circumstances of
each spouse or of any child for whom support is sought?
{% input_field type="textarea" name="additional_relevant_spouse_children_info" value="" maxlength="500" rows="3" class="fact-sheet-input" %}
{% input_field type="textarea" name="additional_relevant_spouse_children_info" maxlength="500" rows="3" class="fact-sheet-input form-control response-textarea" %}
</td>
</tr>
<tr>
<td class="fact-sheet-question">
Amount of child support to be paid per month by < Claimant 1 or Claimant 2>
</td>
<td colspan="2">
{{ difference_between_claimants }}
<td class="fact-sheet-answer" colspan="2" readonly>
{% input_field type="number" name="difference_between_claimants" value="" class="fact-sheet-input" readonly="" %}
</td>
</tr>
</tbody>


+ 96
- 0
edivorce/fixtures/Question.json View File

@ -1314,5 +1314,101 @@
},
"model": "core.question",
"pk": "spouse_proportionate_share_amount"
},
{
"fields": {
"name": "Number of children",
"description": "For Step 6, Your children - Your children - Fact Sheet B Shared Custody",
"summary_order": 0,
"required": "Conditional",
"conditional_target": "claimant_children",
"reveal_response": ""
},
"model": "core.question",
"pk": "number_of_children"
},
{
"fields": {
"name": "What is the approximate amount of time the children spend with each parent?",
"description": "For Step 6, Your children - Your children - Fact Sheet B Shared Custody",
"summary_order": 0,
"required": "Conditional",
"conditional_target": "claimant_children",
"reveal_response": ""
},
"model": "core.question",
"pk": "time_spent_with_you"
},
{
"fields": {
"name": "What is the approximate amount of time the children spend with each parent?",
"description": "For Step 6, Your children - Your children - Fact Sheet B Shared Custody",
"summary_order": 0,
"required": "Conditional",
"conditional_target": "claimant_children",
"reveal_response": ""
},
"model": "core.question",
"pk": "time_spent_with_spouse"
},
{
"fields": {
"name": "What is the monthly amount for child support (as per Federal Child Support Guidelines)?",
"description": "For Step 6, Your children - Your children - Fact Sheet B Shared Custody",
"summary_order": 0,
"required": "Conditional",
"conditional_target": "claimant_children",
"reveal_response": ""
},
"model": "core.question",
"pk": "your_child_support_paid"
},
{
"fields": {
"name": "What is the monthly amount for child support (as per Federal Child Support Guidelines)?",
"description": "For Step 6, Your children - Your children - Fact Sheet B Shared Custody",
"summary_order": 0,
"required": "Conditional",
"conditional_target": "claimant_children",
"reveal_response": ""
},
"model": "core.question",
"pk": "your_spouse_child_support_paid"
},
{
"fields": {
"name": "Special or extraordinary expenses (as per Section 7 of the Federal Child Support Guidelines) to be paid annually",
"description": "For Step 6, Your children - Your children - Fact Sheet B Shared Custody",
"summary_order": 0,
"required": "Conditional",
"conditional_target": "claimant_children",
"reveal_response": ""
},
"model": "core.question",
"pk": "extra_ordinary_expenses_you"
},
{
"fields": {
"name": "Special or extraordinary expenses (as per Section 7 of the Federal Child Support Guidelines) to be paid annually",
"description": "For Step 6, Your children - Your children - Fact Sheet B Shared Custody",
"summary_order": 0,
"required": "Conditional",
"conditional_target": "claimant_children",
"reveal_response": ""
},
"model": "core.question",
"pk": "extra_ordinary_expenses_spouse"
},
{
"fields": {
"name": "Any other relevant information regarding the conditions, means, needs and other circumstances of each spouse or of any child for whom support is sought?",
"description": "For Step 6, Your children - Your children - Fact Sheet B Shared Custody",
"summary_order": 0,
"required": "Conditional",
"conditional_target": "claimant_children",
"reveal_response": ""
},
"model": "core.question",
"pk": "additional_relevant_spouse_children_info"
}
]

Loading…
Cancel
Save