Browse Source

DIV-1022: Add dummy API for court registry address

pull/172/head
ariannedee 5 years ago
parent
commit
00985bbc77
7 changed files with 54 additions and 25 deletions
  1. +1
    -1
      edivorce/apps/core/static/css/main.css
  2. +4
    -0
      edivorce/apps/core/static/css/main.scss
  3. +16
    -0
      edivorce/apps/core/static/js/signing-filing.js
  4. +6
    -22
      edivorce/apps/core/templates/dashboard/swear_forms.html
  5. +14
    -0
      edivorce/apps/core/templates/partials/filing_location.html
  6. +2
    -1
      edivorce/apps/core/urls.py
  7. +11
    -1
      edivorce/apps/core/views/api.py

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


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

@ -749,6 +749,10 @@ i.fa.fa-question-circle {
} }
} }
.error-text {
color: $color-red;
}
.table-error { .table-error {
border: 2px solid $color-red !important; border: 2px solid $color-red !important;
-webkit-transition: 0.1s ease-in-out all; -webkit-transition: 0.1s ease-in-out all;


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

@ -117,4 +117,20 @@ $(window).load(function () {
} }
}); });
if ($('#court-registry-location').length > 0) {
var city = $('#court-registry-city').text()
var url = $(location).attr('origin') + window.sm_base_url + 'api/court_location/' + city + '/';
$.ajax(url,
{
type: 'GET',
}).success((response) => {
var data = JSON.parse(response);
$('#court-registry-address').text(data.address);
$('#court-registry-postal-code').text(data.postal_code);
}).error((response) => {
$('#court-registry-address').html('<span class="error-text">Error retrieving address</span>');
$('#court-registry-postal-code').html('<a href="https://www.bccourts.ca/supreme_court/court_locations_and_contacts.aspx">Look up address</a>');
});
}
}); });

+ 6
- 22
edivorce/apps/core/templates/dashboard/swear_forms.html View File

@ -104,11 +104,7 @@
<p> <p>
You have indicated your closest court registry is: You have indicated your closest court registry is:
</p> </p>
<ul class="no-bullets">
<li>City</li>
<li>Address</li>
<li>Postal Code</li>
</ul>
{% include "partials/filing_location.html" %}
<p> <p>
If you are planning to {% include "partials/tooltips/swear_affirm.html" %} with a lawyer, notary or other commissioner please contact If you are planning to {% include "partials/tooltips/swear_affirm.html" %} with a lawyer, notary or other commissioner please contact
them directly. them directly.
@ -144,11 +140,7 @@
<p> <p>
You have indicated your closest court registry is: You have indicated your closest court registry is:
</p> </p>
<ul class="no-bullets">
<li>City</li>
<li>Address</li>
<li>Postal Code</li>
</ul>
{% include "partials/filing_location.html" %}
<p> <p>
If you are planning to {% include "partials/tooltips/swear_affirm.html" %} with a lawyer, notary or other commissioner please contact If you are planning to {% include "partials/tooltips/swear_affirm.html" %} with a lawyer, notary or other commissioner please contact
them directly. them directly.
@ -202,11 +194,7 @@
<p> <p>
You have indicated your closest court registry is: You have indicated your closest court registry is:
</p> </p>
<ul class="no-bullets">
<li>City</li>
<li>Address</li>
<li>Postal Code</li>
</ul>
{% include "partials/filing_location.html" %}
<p> <p>
If they are planning to {% include "partials/tooltips/swear_affirm.html" %} with a lawyer, notary or other commissioner please contact If they are planning to {% include "partials/tooltips/swear_affirm.html" %} with a lawyer, notary or other commissioner please contact
them directly. them directly.
@ -234,11 +222,7 @@
<p> <p>
You have indicated your closest court registry is: You have indicated your closest court registry is:
</p> </p>
<ul class="no-bullets">
<li>City</li>
<li>Address</li>
<li>Postal Code</li>
</ul>
{% include "partials/filing_location.html" %}
<p> <p>
If you are planning to {% include "partials/tooltips/swear_affirm.html" %} with a lawyer, notary or other commissioner please contact If you are planning to {% include "partials/tooltips/swear_affirm.html" %} with a lawyer, notary or other commissioner please contact
them directly. them directly.
@ -274,9 +258,9 @@
where you can learn more about how to submit the remaining documents to the court registry. where you can learn more about how to submit the remaining documents to the court registry.
</p> </p>
<div class="bg-danger"> <div class="bg-danger">
<p>
<span>
Please note: <b>sworn/affirmed affidavits must be filed within 30 days of swearing/affirming them.</b> Please note: <b>sworn/affirmed affidavits must be filed within 30 days of swearing/affirming them.</b>
</p>
</span>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}


+ 14
- 0
edivorce/apps/core/templates/partials/filing_location.html View File

@ -0,0 +1,14 @@
{% if court_registry_for_filing %}
<ul class="no-bullets" id="court-registry-location">
<li id="court-registry-city">{{ court_registry_for_filing }}</li>
<li id="court-registry-address"></li>
<li id="court-registry-postal-code"></li>
</ul>
{% else %}
<div class="review-warning">
<span class="no-margin-bottom">
You haven't selected a court registry location.
Go to the <a href="{% url 'question_steps' 'location' %}">Filing Location question</a> page.
</span>
</div>
{% endif %}

+ 2
- 1
edivorce/apps/core/urls.py View File

@ -6,8 +6,9 @@ from .views import main, system, pdf, api, localdev
urlpatterns = [ urlpatterns = [
# url(r'^guide$', styleguide.guide), # url(r'^guide$', styleguide.guide),
url(r'^api/response$', api.UserResponseHandler.as_view()), url(r'^api/response$', api.UserResponseHandler.as_view()),
url(r'^api/documents/$', api.DocumentCreateView.as_view(), name='documents'),
path('api/documents/', api.DocumentCreateView.as_view(), name='documents'),
path('api/documents/<file_key>/<int:rotation>/', api.get_document_file_by_key, name='file_by_key'), path('api/documents/<file_key>/<int:rotation>/', api.get_document_file_by_key, name='file_by_key'),
path('api/court_location/<city>/', api.court_location, name='court-location'),
# we add an extra 'x' to the file extension so the siteminder proxy doesn't treat it as an image # we add an extra 'x' to the file extension so the siteminder proxy doesn't treat it as an image
path('api/documents/<doc_type>/<int:party_code>/<filename>x/<int:size>/', api.DocumentView.as_view(), name='document'), path('api/documents/<doc_type>/<int:party_code>/<filename>x/<int:size>/', api.DocumentView.as_view(), name='document'),


+ 11
- 1
edivorce/apps/core/views/api.py View File

@ -1,8 +1,9 @@
import json
import re import re
from django.http import Http404, HttpResponse, HttpResponseGone, HttpResponseNotFound from django.http import Http404, HttpResponse, HttpResponseGone, HttpResponseNotFound
from rest_framework import permissions, status from rest_framework import permissions, status
from rest_framework.generics import CreateAPIView, ListAPIView, RetrieveUpdateDestroyAPIView
from rest_framework.generics import CreateAPIView, RetrieveUpdateDestroyAPIView
from rest_framework.views import APIView from rest_framework.views import APIView
from rest_framework.response import Response from rest_framework.response import Response
from PIL import Image from PIL import Image
@ -54,6 +55,15 @@ class UserResponseHandler(APIView):
return Response(status=status.HTTP_200_OK) return Response(status=status.HTTP_200_OK)
def court_location(request, city):
data = {
'city': city,
'address': f'123 {city} St',
'postal_code': 'V0A 0A0',
}
return HttpResponse(content=json.dumps(data), status=status.HTTP_200_OK)
class DocumentCreateView(CreateAPIView): class DocumentCreateView(CreateAPIView):
serializer_class = CreateDocumentSerializer serializer_class = CreateDocumentSerializer
permission_classes = [permissions.IsAuthenticated] permission_classes = [permissions.IsAuthenticated]


Loading…
Cancel
Save