Browse Source

DIV-1020: Display errors

pull/172/head
ariannedee 5 years ago
parent
commit
1b335c0baf
8 changed files with 104 additions and 25 deletions
  1. +14
    -0
      edivorce/apps/core/models.py
  2. +1
    -1
      edivorce/apps/core/static/css/main.css
  3. +22
    -10
      edivorce/apps/core/static/css/main.scss
  4. +23
    -0
      edivorce/apps/core/static/js/filing.js
  5. +9
    -1
      edivorce/apps/core/templates/dashboard/initial_filing.html
  6. +1
    -2
      edivorce/apps/core/templates/dashboard/partials/question_incomplete_warning.html
  7. +13
    -3
      edivorce/apps/core/utils/cso_filing.py
  8. +21
    -8
      edivorce/apps/core/views/main.py

+ 14
- 0
edivorce/apps/core/models.py View File

@ -152,6 +152,18 @@ class Document(models.Model):
date_uploaded = models.DateTimeField(auto_now_add=True) date_uploaded = models.DateTimeField(auto_now_add=True)
""" Date the record was last updated """ """ Date the record was last updated """
form_types = {
'AAI': "Agreement as to Annual Income (F9)",
'AFDO': "Affidavit - Desk Order Divorce Form (F38)",
'AFTL': "Affidavit of Translation Form",
'CSA': "Child Support Affidavit (F37)",
'EFSS': "Electronic Filing Statement (F96)",
'MC': "Proof of Marriage",
'NCV': "Identification of Applicant (VSA 512)",
'OFI': "Draft Final Order Form (F52)",
'RDP': "Registration of Joint Divorce Proceedings (JUS280)",
}
class Meta: class Meta:
unique_together = ("bceid_user", "doc_type", "party_code", "filename", "size") unique_together = ("bceid_user", "doc_type", "party_code", "filename", "size")
ordering = ('sort_order',) ordering = ('sort_order',)
@ -164,6 +176,8 @@ class Document(models.Model):
if not self.sort_order: if not self.sort_order:
num_docs = self.get_documents_in_form().count() num_docs = self.get_documents_in_form().count()
self.sort_order = num_docs + 1 self.sort_order = num_docs + 1
if self.doc_type not in self.form_types:
raise ValueError(f"Invalid doc_type '{self.doc_type}'")
super(Document, self).save(*args, **kwargs) super(Document, self).save(*args, **kwargs)


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


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

@ -21,6 +21,7 @@ $color-gold-light: #e6ca85;
$color-red: #D8292F; $color-red: #D8292F;
$color-red-light: #F7D4D5; $color-red-light: #F7D4D5;
$color-red-dark: #AC2025; $color-red-dark: #AC2025;
$color-yellow-light: #fcf8e3;
$font-custom: Myriad-Pro, Calibri, Arial, Sans Serif; $font-custom: Myriad-Pro, Calibri, Arial, Sans Serif;
$font-custom-bold: Myriad-Pro-Bold, Calibri, Arial, Sans Serif; $font-custom-bold: Myriad-Pro-Bold, Calibri, Arial, Sans Serif;
@ -370,9 +371,9 @@ div.percent-suffix {
.bg-danger { .bg-danger {
position: relative; position: relative;
padding: 30px 30px 30px 75px; padding: 30px 30px 30px 75px;
border-radius: 10px;
border-radius: 8px;
margin-bottom: 20px; margin-bottom: 20px;
background-color: #fcf8e3;
background-color: $color-yellow-light;
&:after { &:after {
content: "\f071"; content: "\f071";
@ -733,16 +734,26 @@ i.fa.fa-question-circle {
.review-warning { .review-warning {
background-color: $color-red-light; background-color: $color-red-light;
padding: 20px;
margin: 30px 0;
border-radius: 8px; border-radius: 8px;
display: flex;
.exclamation i {
font-size: 25px;
color: $color-red-dark;
position: relative;
padding: 30px 30px 30px 75px;
margin-bottom: 20px;
ul {
padding-left: 15px;
} }
div {
margin: 10px;
&:after {
content: "\f06a";
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
position: absolute;
font-size: 24px;
color: $color-red-dark;
top: 30px;
left: 27px;
} }
.warning, .progress-status i { .warning, .progress-status i {
color: $color-red-dark; color: $color-red-dark;
@ -1495,6 +1506,7 @@ textarea {
} }
.no-bullets { .no-bullets {
padding-left: 0;
li { li {
list-style: none; list-style: none;
} }


+ 23
- 0
edivorce/apps/core/static/js/filing.js View File

@ -0,0 +1,23 @@
$(window).ready(function () {
$('#submitDocuments').on('click', function (e) {
var missingForms = []
$('div#app').children().each(function (i, child) {
if ($(child).find("div.placeholder").length > 0) {
missingForms.push($(child).find("h5 a").text());
}
})
var errorBox = $('#error-message-box');
if (missingForms.length > 0) {
e.preventDefault();
var messageList = $('#error-messages');
messageList.empty();
missingForms.forEach(function (formName) {
messageList.append(`<li>Missing documents for ${formName}</li>`);
});
errorBox.show();
window.scrollTo(0, 0);
} else {
errorBox.hide();
}
});
});

+ 9
- 1
edivorce/apps/core/templates/dashboard/initial_filing.html View File

@ -36,6 +36,13 @@
and include your {% include "partials/tooltips/online_package_number.html" %}. and include your {% include "partials/tooltips/online_package_number.html" %}.
</p> </p>
{% elif how_to_file == 'Online' %} {% elif how_to_file == 'Online' %}
<div class="review-warning" id="error-message-box" {% if not messages %}hidden{% endif %}>
<ul id="error-messages" class="{% if messages|length == 1 %}no-bullets {% endif %}no-margin-bottom">
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
</div>
{% if derived.any_errors %} {% if derived.any_errors %}
{% include "dashboard/partials/question_incomplete_warning.html" %} {% include "dashboard/partials/question_incomplete_warning.html" %}
{% endif %} {% endif %}
@ -122,7 +129,7 @@
<a class="btn btn-success pull-right" href="{% url 'dashboard_nav' 'wait_for_number' %}">Next&nbsp;&nbsp;&nbsp;<i <a class="btn btn-success pull-right" href="{% url 'dashboard_nav' 'wait_for_number' %}">Next&nbsp;&nbsp;&nbsp;<i
class="fa fa-arrow-circle-o-right"></i></a> class="fa fa-arrow-circle-o-right"></i></a>
{% else %} {% else %}
<a class="btn btn-success pull-right save-spinner" href="{% url 'submit_initial_files' %}">
<a class="btn btn-success pull-right" href="{% url 'submit_initial_files' %}" id="submitDocuments">
<i class="fa fa-paper-plane"></i>&nbsp;&nbsp;&nbsp; <i class="fa fa-paper-plane"></i>&nbsp;&nbsp;&nbsp;
Submit Documents</a> Submit Documents</a>
{% endif %} {% endif %}
@ -161,4 +168,5 @@
<script type="text/javascript" src="{% static 'dist/vue/js/chunk-vendors.js' %}"></script> <script type="text/javascript" src="{% static 'dist/vue/js/chunk-vendors.js' %}"></script>
<script type="text/javascript" src="{% static 'dist/vue/js/chunk-common.js' %}"></script> <script type="text/javascript" src="{% static 'dist/vue/js/chunk-common.js' %}"></script>
<script type="text/javascript" src="{% static 'dist/vue/js/initialFiling.js' %}"></script> <script type="text/javascript" src="{% static 'dist/vue/js/initialFiling.js' %}"></script>
<script type="text/javascript" src="{% static 'js/filing.js' %}"></script>
{% endblock %} {% endblock %}

+ 1
- 2
edivorce/apps/core/templates/dashboard/partials/question_incomplete_warning.html View File

@ -1,5 +1,4 @@
<div class="review-warning">
<div><span class="exclamation"><i class="fa fa-fw fa-exclamation-circle"></i></span></div>
<div class="information-message bg-danger">
<div> <div>
At least one question in the <a href="{% url 'question_steps' 'review' %}">Questionnaire</a> portion of At least one question in the <a href="{% url 'question_steps' 'review' %}">Questionnaire</a> portion of
this application is incomplete. this application is incomplete.


+ 13
- 3
edivorce/apps/core/utils/cso_filing.py View File

@ -2,12 +2,22 @@ import random
from django.conf import settings from django.conf import settings
from edivorce.apps.core.models import UserResponse
from edivorce.apps.core.models import Document, UserResponse
from edivorce.apps.core.utils.derived import get_derived_data from edivorce.apps.core.utils.derived import get_derived_data
def file_documents(user, initial=False):
""" Save dummy data for now. Eventually replace with data from CSO. """
def file_documents(user, responses, initial=False):
forms = forms_to_file(responses, initial)
missing_forms = []
for form in forms:
docs = Document.objects.filter(bceid_user=user, doc_type=form['doc_type'], party_code=form.get('party_code', 0))
if docs.count() == 0:
missing_forms.append(Document.form_types[form['doc_type']])
if missing_forms:
return missing_forms
# Save dummy data for now. Eventually replace with data from CSO
prefix = 'initial' if initial else 'final' prefix = 'initial' if initial else 'final'
_save_response(user, f'{prefix}_filing_submitted', True) _save_response(user, f'{prefix}_filing_submitted', True)


+ 21
- 8
edivorce/apps/core/views/main.py View File

@ -1,6 +1,7 @@
import datetime import datetime
from django.conf import settings from django.conf import settings
from django.contrib import messages
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
@ -212,7 +213,15 @@ def dashboard_nav(request, nav_step):
if nav_step == 'initial_filing': if nav_step == 'initial_filing':
forms = forms_to_file(responses_dict, initial=True) forms = forms_to_file(responses_dict, initial=True)
responses_dict['form_types'] = forms responses_dict['form_types'] = forms
if request.GET.get('cancelled'):
messages.add_message(request, messages.ERROR,
'You have cancelled the filing of your documents. '
'You can complete the filing process at your convenience.')
elif request.GET.get('no_connection'):
messages.add_message(request, messages.ERROR,
'The connection to the BC Government’s eFiling Hub is currently not working. '
'This is a temporary problem. '
'Please try again now and if this issue persists try again later.')
return render(request, template_name=template_name, context=responses_dict) return render(request, template_name=template_name, context=responses_dict)
@ -231,14 +240,18 @@ def submit_final_files(request):
def _submit_files(request, initial=False): def _submit_files(request, initial=False):
responses_dict = get_data_for_user(request.user) responses_dict = get_data_for_user(request.user)
if initial: if initial:
nav_step = 'wait_for_number'
file_documents(request.user, initial=True)
original_step = 'initial_filing'
next_page = 'wait_for_number'
else: else:
nav_step = 'next_steps'
file_documents(request.user, initial=False)
responses_dict['active_page'] = nav_step
return redirect(reverse('dashboard_nav', kwargs={'nav_step': nav_step}), context=responses_dict)
original_step = 'final_filing'
next_page = 'next_steps'
missing_forms = file_documents(request.user, responses_dict, initial=initial)
if missing_forms:
next_page = original_step
for form_name in missing_forms:
messages.add_message(request, messages.ERROR, f'Missing documents for {form_name}')
responses_dict['active_page'] = next_page
return redirect(reverse('dashboard_nav', kwargs={'nav_step': next_page}), context=responses_dict)
@bceid_required @bceid_required


Loading…
Cancel
Save