#25 Public reports

* adds fully functional EMA report
* adds/updates translations
pull/30/head
mpeltriaux 3 years ago
parent ce74d011f6
commit f5f08b979b

@ -62,7 +62,7 @@
<td class="align-middle">{{obj.responsible.conservation_file_number|default_if_none:""}}</td>
</tr>
<tr {% if not obj.responsible.handler %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
<th scope="row">{% trans 'Intervention handler' %}</th>
<th scope="row">{% trans 'Action handler' %}</th>
<td class="align-middle">{{obj.responsible.handler|default_if_none:""}}</td>
</tr>
<tr>

@ -47,7 +47,7 @@
<td class="align-middle">{{obj.responsible.conservation_file_number|default_if_none:""}}</td>
</tr>
<tr {% if not obj.responsible.handler %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
<th scope="row">{% trans 'Intervention handler' %}</th>
<th scope="row">{% trans 'Action handler' %}</th>
<td class="align-middle">{{obj.responsible.handler|default_if_none:""}}</td>
</tr>
<tr>

@ -0,0 +1,74 @@
{% extends 'public_base.html' %}
{% load i18n fontawesome_5 humanize %}
{% block body %}
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-6">
<h3>{% trans 'Report' %}</h3>
<h4>{{obj.identifier}}</h4>
<div class="table-container">
<table class="table table-hover">
<tr>
<th class="w-25" scope="row">{% trans 'Title' %}</th>
<td class="align-middle">{{obj.title|default_if_none:""}}</td>
</tr>
<tr>
<th scope="row">{% trans 'Conservation office' %}</th>
<td class="align-middle">{{obj.responsible.conservation_office.str_as_office|default_if_none:""}}</td>
</tr>
<tr>
<th scope="row">{% trans 'Conservation office file number' %}</th>
<td class="align-middle">{{obj.responsible.conservation_file_number|default_if_none:""}}</td>
</tr>
<tr>
<th scope="row">{% trans 'Action handler' %}</th>
<td class="align-middle">{{obj.responsible.handler|default_if_none:""}}</td>
</tr>
<tr>
<th scope="row">{% trans 'Funded by' %}</th>
<td class="align-middle">
{% with obj.fundings.all as fundings %}
{% for funding in fundings %}
<div class="badge pill-badge rlp-r-outline">{{funding.short_name}}</div>
<br>
{% empty %}
{% trans 'None' %}
{% endfor %}
{% endwith %}
</td>
</tr>
<tr>
<th scope="row">{% trans 'Last modified' %}</th>
<td class="align-middle">
{{obj.modified.timestamp|default_if_none:""|naturalday}}
</td>
</tr>
</table>
</div>
{% include 'compensation/detail/compensation/includes/states-before.html' %}
{% include 'compensation/detail/compensation/includes/states-after.html' %}
{% include 'compensation/detail/compensation/includes/actions.html' %}
</div>
<div class="col-sm-12 col-md-12 col-lg-6">
<div class="row">
{% include 'map/geom_form.html' %}
</div>
<div class="row">
{% include 'intervention/detail/includes/comment.html' %}
</div>
<div class="row">
<div class="col-sm-6 col-md-6 col-lg-6">
<h4>{% trans 'Open in browser' %}</h4>
{{ qrcode|safe }}
</div>
<div class="col-sm-6 col-md-6 col-lg-6">
<h4>{% trans 'View in LANIS' %}</h4>
{{ qrcode_lanis|safe }}
</div>
</div>
</div>
</div>
{% endblock %}

@ -412,7 +412,7 @@ def report_view(request:HttpRequest, id: str):
"""
# Reuse the compensation report template since EMAs are structurally identical
template = "compensation/report/report.html"
template = "ema/report/report.html"
ema = get_object_or_404(Ema, id=id)
# If intervention is not recorded (yet or currently) we need to render another template without any data
@ -420,6 +420,10 @@ def report_view(request:HttpRequest, id: str):
template = "report/unavailable.html"
return render(request, template, {})
# Prepare data for map viewer
geom_form = SimpleGeomForm(
instance=ema
)
qrcode_img = generate_qr_code(
request.build_absolute_uri(reverse("ema:report", args=(id,))),
10
@ -428,10 +432,20 @@ def report_view(request:HttpRequest, id: str):
ema.get_LANIS_link(),
7
)
# Order states by surface
before_states = ema.before_states.all().order_by("-surface").prefetch_related("biotope_type")
after_states = ema.after_states.all().order_by("-surface").prefetch_related("biotope_type")
actions = ema.actions.all().prefetch_related("action_type")
context = {
"obj": ema,
"qrcode": qrcode_img,
"qrcode_lanis": qrcode_img_lanis,
"has_access": False, # disables action buttons during rendering
"before_states": before_states,
"after_states": after_states,
"geom_form": geom_form,
"actions": actions,
}
context = BaseContext(request, context).context
return render(request, template, context)

Binary file not shown.

@ -19,7 +19,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-13 17:26+0200\n"
"POT-Creation-Date: 2021-10-14 08:46+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -52,7 +52,8 @@ msgstr "Automatisch generiert"
#: compensation/templates/compensation/detail/eco_account/view.html:31
#: compensation/templates/compensation/report/compensation/report.html:12
#: ema/tables.py:33 ema/templates/ema/detail/includes/documents.html:28
#: ema/templates/ema/detail/view.html:24 intervention/forms/forms.py:39
#: ema/templates/ema/detail/view.html:24
#: ema/templates/ema/report/report.html:12 intervention/forms/forms.py:39
#: intervention/tables.py:28
#: intervention/templates/intervention/detail/includes/compensations.html:33
#: intervention/templates/intervention/detail/includes/documents.html:28
@ -113,7 +114,8 @@ msgstr "Zusätzlicher Kommentar"
#: compensation/forms/forms.py:93
#: compensation/templates/compensation/detail/eco_account/view.html:58
#: ema/templates/ema/detail/view.html:42 intervention/forms/forms.py:101
#: ema/templates/ema/detail/view.html:42
#: ema/templates/ema/report/report.html:29 intervention/forms/forms.py:101
#: intervention/templates/intervention/detail/view.html:56
#: intervention/templates/intervention/report/report.html:37
msgid "Conservation office"
@ -125,7 +127,8 @@ msgstr "Verantwortliche Stelle"
#: compensation/forms/forms.py:109
#: compensation/templates/compensation/detail/eco_account/view.html:62
#: ema/templates/ema/detail/view.html:46 intervention/forms/forms.py:129
#: ema/templates/ema/detail/view.html:46
#: ema/templates/ema/report/report.html:33 intervention/forms/forms.py:129
#: intervention/templates/intervention/detail/view.html:60
#: intervention/templates/intervention/report/report.html:41
msgid "Conservation office file number"
@ -301,8 +304,8 @@ msgstr "Maßnahmentyp wählen"
#: compensation/forms/modalForms.py:334
#: compensation/templates/compensation/detail/compensation/includes/actions.html:38
#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:37
#: compensation/templates/compensation/detail/compensation/includes/documents.html:34
#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:38
#: compensation/templates/compensation/detail/compensation/includes/documents.html:35
#: compensation/templates/compensation/detail/compensation/includes/states-after.html:40
#: compensation/templates/compensation/detail/compensation/includes/states-before.html:40
#: compensation/templates/compensation/detail/eco_account/includes/actions.html:37
@ -316,11 +319,11 @@ msgstr "Maßnahmentyp wählen"
#: ema/templates/ema/detail/includes/documents.html:34
#: ema/templates/ema/detail/includes/states-after.html:39
#: ema/templates/ema/detail/includes/states-before.html:39
#: intervention/templates/intervention/detail/includes/compensations.html:36
#: intervention/templates/intervention/detail/includes/deductions.html:37
#: intervention/templates/intervention/detail/includes/documents.html:34
#: intervention/templates/intervention/detail/includes/payments.html:37
#: intervention/templates/intervention/detail/includes/revocation.html:41
#: intervention/templates/intervention/detail/includes/compensations.html:37
#: intervention/templates/intervention/detail/includes/deductions.html:38
#: intervention/templates/intervention/detail/includes/documents.html:35
#: intervention/templates/intervention/detail/includes/payments.html:38
#: intervention/templates/intervention/detail/includes/revocation.html:42
#: templates/log.html:10
msgid "Action"
msgstr "Aktionen"
@ -578,7 +581,7 @@ msgstr "Frist/Termin hinzufügen"
msgid "Type"
msgstr "Typ"
#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:51
#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:53
#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:51
#: ema/templates/ema/detail/includes/deadlines.html:51
msgid "Remove deadline"
@ -599,10 +602,10 @@ msgstr "Dokumente"
msgid "Add new document"
msgstr "Neues Dokument hinzufügen"
#: compensation/templates/compensation/detail/compensation/includes/documents.html:49
#: compensation/templates/compensation/detail/compensation/includes/documents.html:51
#: compensation/templates/compensation/detail/eco_account/includes/documents.html:49
#: ema/templates/ema/detail/includes/documents.html:49
#: intervention/templates/intervention/detail/includes/documents.html:49
#: intervention/templates/intervention/detail/includes/documents.html:51
msgid "Remove document"
msgstr "Dokument löschen"
@ -685,12 +688,15 @@ msgstr "Verzeichnet am"
#: compensation/templates/compensation/detail/eco_account/view.html:70
#: compensation/templates/compensation/report/compensation/report.html:24
#: ema/templates/ema/detail/view.html:54
#: ema/templates/ema/report/report.html:16
msgid "Funded by"
msgstr "Gefördert mit"
#: compensation/templates/compensation/detail/compensation/view.html:79
#: compensation/templates/compensation/detail/eco_account/view.html:78
#: compensation/templates/compensation/report/compensation/report.html:31
#: ema/templates/ema/detail/view.html:62
#: ema/templates/ema/report/report.html:23
#: intervention/templates/intervention/report/report.html:57
#: intervention/templates/intervention/report/report.html:78
msgid "None"
@ -698,8 +704,9 @@ msgstr ""
#: compensation/templates/compensation/detail/compensation/view.html:84
#: compensation/templates/compensation/detail/eco_account/view.html:83
#: compensation/templates/compensation/report/compensation/report.html:33
#: compensation/templates/compensation/report/compensation/report.html:37
#: ema/templates/ema/detail/view.html:67
#: ema/templates/ema/report/report.html:41
#: intervention/templates/intervention/detail/view.html:108
#: intervention/templates/intervention/report/report.html:91
msgid "Last modified"
@ -745,7 +752,7 @@ msgid "Created"
msgstr "Erstellt"
#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:63
#: intervention/templates/intervention/detail/includes/deductions.html:56
#: intervention/templates/intervention/detail/includes/deductions.html:58
msgid "Remove Deduction"
msgstr "Abbuchung entfernen"
@ -772,23 +779,23 @@ msgid "Missing"
msgstr "Fehlt"
#: compensation/templates/compensation/detail/eco_account/view.html:66
#: ema/templates/ema/detail/view.html:50 intervention/forms/forms.py:141
#: intervention/templates/intervention/detail/view.html:64
#: intervention/templates/intervention/report/report.html:45
msgid "Intervention handler"
msgstr "Eingriffsverursacher"
msgid "Action handler"
msgstr "Maßnahmenträger"
#: compensation/templates/compensation/report/compensation/report.html:7
#: ema/templates/ema/report/report.html:7
#: intervention/templates/intervention/report/report.html:7
msgid "Report"
msgstr "Bericht"
#: compensation/templates/compensation/report/compensation/report.html:54
#: compensation/templates/compensation/report/compensation/report.html:58
#: ema/templates/ema/report/report.html:62
#: intervention/templates/intervention/report/report.html:108
msgid "Open in browser"
msgstr "Im Browser öffnen"
#: compensation/templates/compensation/report/compensation/report.html:58
#: compensation/templates/compensation/report/compensation/report.html:62
#: ema/templates/ema/report/report.html:66
#: intervention/templates/intervention/report/report.html:112
msgid "View in LANIS"
msgstr "In LANIS öffnen"
@ -801,42 +808,42 @@ msgstr "Kompensation {} hinzugefügt"
msgid "Compensation {} edited"
msgstr "Kompensation {} bearbeitet"
#: compensation/views/compensation_views.py:211
#: compensation/views/compensation_views.py:213
#: compensation/views/eco_account_views.py:278 ema/views.py:175
#: intervention/views.py:428
msgid "Log"
msgstr "Log"
#: compensation/views/compensation_views.py:232
#: compensation/views/compensation_views.py:234
msgid "Compensation removed"
msgstr "Kompensation entfernt"
#: compensation/views/compensation_views.py:251
#: compensation/views/compensation_views.py:253
#: compensation/views/eco_account_views.py:377 ema/views.py:328
#: intervention/views.py:124
msgid "Document added"
msgstr "Dokument hinzugefügt"
#: compensation/views/compensation_views.py:307
#: compensation/views/compensation_views.py:309
#: compensation/views/eco_account_views.py:321 ema/views.py:272
msgid "State added"
msgstr "Zustand hinzugefügt"
#: compensation/views/compensation_views.py:326
#: compensation/views/compensation_views.py:328
#: compensation/views/eco_account_views.py:340 ema/views.py:291
msgid "Action added"
msgstr "Maßnahme hinzugefügt"
#: compensation/views/compensation_views.py:345
#: compensation/views/compensation_views.py:347
#: compensation/views/eco_account_views.py:359 ema/views.py:310
msgid "Deadline added"
msgstr "Frist/Termin hinzugefügt"
#: compensation/views/compensation_views.py:364
#: compensation/views/compensation_views.py:366
msgid "State removed"
msgstr "Zustand gelöscht"
#: compensation/views/compensation_views.py:383
#: compensation/views/compensation_views.py:385
msgid "Action removed"
msgstr "Maßnahme entfernt"
@ -906,6 +913,13 @@ msgstr ""
msgid "Payment funded compensation"
msgstr "Ersatzzahlungsmaßnahme"
#: ema/templates/ema/detail/view.html:50
#: ema/templates/ema/report/report.html:37 intervention/forms/forms.py:141
#: intervention/templates/intervention/detail/view.html:64
#: intervention/templates/intervention/report/report.html:45
msgid "Intervention handler"
msgstr "Eingriffsverursacher"
#: ema/views.py:78
msgid "EMA {} added"
msgstr "EMA {} hinzugefügt"
@ -1123,7 +1137,7 @@ msgstr "Rechtliche Daten fehlen"
#: intervention/tables.py:45
#: intervention/templates/intervention/detail/includes/revocation.html:8
#: intervention/templates/intervention/detail/includes/revocation.html:55
#: intervention/templates/intervention/detail/includes/revocation.html:57
#: intervention/templates/intervention/detail/view.html:104
msgid "Revocation"
msgstr "Widerspruch"
@ -1144,7 +1158,7 @@ msgstr "Widerspruch vom {}, am {} von {} hinzugefügt"
msgid "Add new compensation"
msgstr "Neue Kompensation hinzufügen"
#: intervention/templates/intervention/detail/includes/compensations.html:51
#: intervention/templates/intervention/detail/includes/compensations.html:53
msgid "Remove compensation"
msgstr "Kompensation entfernen"
@ -1152,11 +1166,11 @@ msgstr "Kompensation entfernen"
msgid "Account Identifier"
msgstr "Ökokonto Kennung"
#: intervention/templates/intervention/detail/includes/deductions.html:43
#: intervention/templates/intervention/detail/includes/deductions.html:45
msgid "Eco-account deleted! Deduction invalid!"
msgstr "Ökokonto gelöscht! Abbuchung ungültig!"
#: intervention/templates/intervention/detail/includes/deductions.html:43
#: intervention/templates/intervention/detail/includes/deductions.html:45
msgid "Eco-account not recorded! Deduction invalid!"
msgstr "Ökokonto nicht verzeichnet! Abbuchung ungültig!"
@ -1174,7 +1188,7 @@ msgctxt "money"
msgid "Amount"
msgstr "Betrag"
#: intervention/templates/intervention/detail/includes/payments.html:51
#: intervention/templates/intervention/detail/includes/payments.html:53
msgid "Remove payment"
msgstr "Zahlung entfernen"
@ -1183,7 +1197,7 @@ msgctxt "Revocation"
msgid "From"
msgstr "Vom"
#: intervention/templates/intervention/detail/includes/revocation.html:62
#: intervention/templates/intervention/detail/includes/revocation.html:64
msgid "Remove revocation"
msgstr "Widerspruch entfernen"

Loading…
Cancel
Save