-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
300 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
{% load static %} | ||
{% load i18n %} | ||
{% load entry_filter %} | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Title</title> | ||
<link rel="stylesheet" href="{% static 'plotsearch/fonts/fonts.css' %}"> | ||
<link rel="stylesheet" href="{% static 'plotsearch/target_status_pdf_style.css' %}"> | ||
</head> | ||
|
||
<body> | ||
<div class="content"> | ||
<div> | ||
<h1>{{ object.identifier }}</h1> | ||
</div> | ||
<div> | ||
<h2>{% trans "Area search information" %}</h2> | ||
<table> | ||
<tr> | ||
<th>{% trans "Lessor" %}</th> | ||
<td>{{ object.lessor.value }}</td> | ||
</tr> | ||
<tr> | ||
<th>{% trans "Description area" %}</th> | ||
<td>{{ object.description_area }}</td> | ||
</tr> | ||
<tr> | ||
<th>{% trans "Address" %}</th> | ||
<td>{{ object.address }}</td> | ||
</tr> | ||
<tr> | ||
<th>{% trans "District" %}</th> | ||
<td>{{ object.district }}</td> | ||
</tr> | ||
<tr> | ||
<th>{% trans "Intended use" %}</th> | ||
<td>{{ object.intended_use }}</td> | ||
</tr> | ||
<tr> | ||
<th>{% trans "Description intended use" %}</th> | ||
<td>{{ object.description_intended_use }}</td> | ||
</tr> | ||
<tr> | ||
<th>{% trans "Start date" %}</th> | ||
<td>{{ object.start_date|date:"G:i j.n.Y" }}</td> | ||
</tr> | ||
<tr> | ||
<th>{% trans "End date" %}</th> | ||
<td>{{ object.end_date|date:"G:i j.n.Y" }}</td> | ||
</tr> | ||
<tr> | ||
<th>{% trans "Received date" %}</th> | ||
<td>{{ object.received_date|date:"G:i j.n.Y" }}</td> | ||
</tr> | ||
</table> | ||
</div> | ||
<div class="divider"> </div> | ||
{% for section in object.form.sections.all|filter_only_parent %} | ||
{% if section.applicant_type|slugify == applicant_type|slugify or section.applicant_type|slugify == "Both"|slugify %} | ||
{% include "mixins/section.html" with section=section answer=object.answer %} | ||
{% endif %} | ||
{% endfor %} | ||
{% if show_information_check %} | ||
<div> | ||
<h2>{% trans "Area search information" %}</h2> | ||
<table> | ||
<tr> | ||
<th>{% trans "Lessor" %}</th> | ||
<td>{{ object.area_search_status.decline_reason.value }}</td> | ||
</tr> | ||
<tr> | ||
<th>{% trans "Description area" %}</th> | ||
<td>{{ object.area_search_status.preparer_note }}</td> | ||
</tr> | ||
{% for note in object.area_search_status.status_notes.all %} | ||
<tr> | ||
<th>{% trans "Note" %}</th> | ||
<td>{{ note.note }}</td> | ||
</tr> | ||
<tr> | ||
<th>{% trans "Preparer" %}</th> | ||
<td>{{ note.preparer }}</td> | ||
</tr> | ||
<tr> | ||
<th>{% trans "Time stamp" %}</th> | ||
<td>{{ note.time_stamp|date:"G:i j.n.Y" }}</td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
<div class="divider"> </div> | ||
</div> | ||
{% endif %} | ||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,45 @@ | ||
{% for subsection in section.subsections.all %} | ||
{% include "mixins/section.html" with section=subsection %} | ||
{% endfor %} | ||
{% load entry_filter %} | ||
{% load form_visible %} | ||
|
||
{% if section.fields.all and section.visible == True %} | ||
<div> | ||
<h2>{{ section }}</h2> | ||
<table> | ||
{% for field in section.fields.all %} | ||
{% if field.enabled == True %} | ||
<tr> | ||
<th> | ||
{{ field }} | ||
</th> | ||
{% for entry in field.entry_set.all|filter_answer:answer %} | ||
<td> | ||
{% if field.type.identifier == "checkbox" or field.type.identifier == "radiobutton" or field.type.identifier == "radiobuttoninline" %} | ||
{% fetch_choice_value entry.value entry.field.id %} | ||
{% if not entry.value %} | ||
<span> - </span> | ||
{% endif %} | ||
|
||
{% else %} | ||
{{ entry.value }} | ||
{% if not entry.value %} | ||
<span> - </span> | ||
{% endif %} | ||
{% endif %} | ||
{% empty %} | ||
<span> - </span> | ||
</td> | ||
{% endfor %} | ||
</tr> | ||
{% endif %} | ||
|
||
{% if section.fields.all %} | ||
<div> | ||
<h2>{{ section }}</h2> | ||
<table> | ||
{% for field in section.fields.all %} | ||
<tr> | ||
<th> | ||
{{field}} | ||
</th> | ||
<td> | ||
{% for entry in field.entry_set.all %} | ||
{{ entry.value }} | ||
{% if not entry.value%} | ||
<span> - </span> | ||
{% endif %} | ||
{% empty %} | ||
<span> - </span> | ||
{% endfor %} | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
{% endfor %} | ||
</table> | ||
</div> | ||
<div class="divider"> </div> | ||
</div> | ||
{% endif %} | ||
|
||
{% for subsection in section.subsections.all %} | ||
{% if subsection.applicant_type|slugify == applicant_type|slugify or subsection.applicant_type|slugify == "Both"|slugify %} | ||
{% include "mixins/section.html" with section=subsection %} | ||
{% endif %} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from django import template | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.filter | ||
def filter_answer(qs, answer): | ||
return qs.filter(entry_section__answer=answer) | ||
|
||
|
||
@register.filter | ||
def filter_only_parent(qs): | ||
return qs.filter(parent__isnull=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import ast | ||
|
||
from django import template | ||
|
||
from forms.models import Choice | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.filter | ||
def visible_section(section, value): | ||
return section.filter(visible=value) | ||
|
||
|
||
@register.filter | ||
def visible_field(field, value): | ||
return field.filter(enabled=value) | ||
|
||
|
||
@register.simple_tag | ||
def fetch_choice_value(value, field_id): | ||
if value == "" or value == "[]": | ||
return "-" | ||
choice_value = ast.literal_eval(value) | ||
choices = Choice.objects.filter(field=field_id) | ||
if isinstance(choice_value, list): | ||
choices = choices.filter(value__in=choice_value) | ||
else: | ||
choices = choices.filter(value=choice_value) | ||
if not choices.exists(): | ||
return "-" | ||
return " ".join([choice.text for choice in choices]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.