diff --git a/compensation/account_urls.py b/compensation/account_urls.py index 158e148a..d29c827b 100644 --- a/compensation/account_urls.py +++ b/compensation/account_urls.py @@ -12,9 +12,10 @@ urlpatterns = [ path("", index_view, name="acc-index"), path('new/', new_view, name='acc-new'), path('new/id', new_id_view, name='acc-new-id'), - path('', open_view, name='acc-open'), + path('', detail_view, name='acc-detail'), path('/log', log_view, name='acc-log'), path('/record', record_view, name='acc-record'), + path('/report', report_view, name='acc-report'), path('/edit', edit_view, name='acc-edit'), path('/remove', remove_view, name='acc-remove'), path('/state/new', state_new_view, name='acc-new-state'), diff --git a/compensation/comp_urls.py b/compensation/comp_urls.py index 5ec578b3..a63a6903 100644 --- a/compensation/comp_urls.py +++ b/compensation/comp_urls.py @@ -14,13 +14,14 @@ urlpatterns = [ path('new/id', new_id_view, name='new-id'), path('new/', new_view, name='new'), path('new', new_view, name='new'), - path('', open_view, name='open'), + path('', detail_view, name='detail'), path('/log', log_view, name='log'), path('/edit', edit_view, name='edit'), path('/remove', remove_view, name='remove'), path('/state/new', state_new_view, name='new-state'), path('/action/new', action_new_view, name='new-action'), path('/deadline/new', deadline_new_view, name="new-deadline"), + path('/report', report_view, name='report'), # Documents path('/document/new/', new_document_view, name='new-doc'), diff --git a/compensation/forms/forms.py b/compensation/forms/forms.py index 000cea2b..fd747ef5 100644 --- a/compensation/forms/forms.py +++ b/compensation/forms/forms.py @@ -179,7 +179,7 @@ class NewCompensationForm(AbstractCompensationForm): self.initialize_form_field("intervention", intervention_id) self.disable_form_field("intervention") self.action_url = reverse("compensation:new", args=(intervention_id,)) - self.cancel_redirect = reverse("intervention:open", args=(intervention_id,)) + self.cancel_redirect = reverse("intervention:detail", args=(intervention_id,)) else: self.action_url = reverse("compensation:new") self.cancel_redirect = reverse("compensation:index") @@ -230,7 +230,7 @@ class EditCompensationForm(NewCompensationForm): super().__init__(*args, **kwargs) self.form_title = _("Edit compensation") self.action_url = reverse("compensation:edit", args=(self.instance.id,)) - self.cancel_redirect = reverse("compensation:open", args=(self.instance.id,)) + self.cancel_redirect = reverse("compensation:detail", args=(self.instance.id,)) # Initialize form data form_data = { @@ -384,7 +384,7 @@ class EditEcoAccountForm(NewEcoAccountForm): self.form_title = _("Edit Eco-Account") self.action_url = reverse("compensation:acc-edit", args=(self.instance.id,)) - self.cancel_redirect = reverse("compensation:acc-open", args=(self.instance.id,)) + self.cancel_redirect = reverse("compensation:acc-detail", args=(self.instance.id,)) # Initialize form data form_data = { diff --git a/compensation/managers.py b/compensation/managers.py new file mode 100644 index 00000000..c97cd518 --- /dev/null +++ b/compensation/managers.py @@ -0,0 +1,73 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: michel.peltriaux@sgdnord.rlp.de +Created on: 14.10.21 + +""" +from django.db import models + + +class CompensationActionManager(models.Manager): + """ Holds default db fetch setting for this model type + + """ + def get_queryset(self): + return super().get_queryset().select_related( + "action_type", + "action_type__parent" + ) + + +class CompensationStateManager(models.Manager): + """ Holds default db fetch setting for this model type + + """ + def get_queryset(self): + return super().get_queryset().select_related( + "biotope_type", + "biotope_type__parent" + ) + + +class CompensationManager(models.Manager): + """ Holds default db fetch setting for this model type + + """ + def get_queryset(self): + return super().get_queryset().select_related( + "modified", + "intervention", + "intervention__recorded", + "intervention__recorded__user", + "intervention__modified", + "intervention__checked", + "intervention__checked__user", + ) + + +class EcoAccountManager(models.Manager): + """ Holds default db fetch setting for this model type + + """ + def get_queryset(self): + return super().get_queryset().select_related( + "recorded", + "recorded__user", + "modified", + "modified__user", + ).prefetch_related( + "users", + ) + + +class EcoAccountDeductionManager(models.Manager): + """ Holds default db fetch setting for this model type + + """ + def get_queryset(self): + return super().get_queryset().select_related( + "intervention", + "intervention__recorded", + "created", + ) \ No newline at end of file diff --git a/compensation/models.py b/compensation/models.py index 850ff7e5..4f9cc919 100644 --- a/compensation/models.py +++ b/compensation/models.py @@ -17,6 +17,8 @@ from django.utils.translation import gettext_lazy as _ from codelist.models import KonovaCode from codelist.settings import CODELIST_COMPENSATION_ACTION_ID, CODELIST_BIOTOPES_ID, \ CODELIST_COMPENSATION_FUNDING_ID +from compensation.managers import CompensationStateManager, EcoAccountDeductionManager, CompensationActionManager, \ + EcoAccountManager, CompensationManager from intervention.models import Intervention, ResponsibilityData from konova.models import BaseObject, BaseResource, Geometry, UuidModel, AbstractDocument, \ generate_document_file_upload_path @@ -67,6 +69,8 @@ class CompensationState(UuidModel): ) surface = models.FloatField() + objects = CompensationStateManager() + def __str__(self): return "{} | {} m²".format(self.biotope_type, self.surface) @@ -102,6 +106,8 @@ class CompensationAction(BaseResource): unit = models.CharField(max_length=100, null=True, blank=True, choices=UnitChoices.choices) comment = models.TextField(blank=True, null=True, help_text="Additional comment") + objects = CompensationActionManager() + def __str__(self): return "{} | {} {}".format(self.action_type, self.amount, self.unit) @@ -178,6 +184,8 @@ class Compensation(AbstractCompensation): related_name='compensations' ) + objects = CompensationManager() + def __str__(self): return "{}".format(self.identifier) @@ -301,6 +309,8 @@ class EcoAccount(AbstractCompensation): default=0, ) + objects = EcoAccountManager() + def __str__(self): return "{}".format(self.identifier) @@ -500,5 +510,7 @@ class EcoAccountDeduction(BaseResource): related_name="deductions", ) + objects = EcoAccountDeductionManager() + def __str__(self): return "{} of {}".format(self.surface, self.account) diff --git a/compensation/tables.py b/compensation/tables.py index 5f9f6e7c..df7ec3eb 100644 --- a/compensation/tables.py +++ b/compensation/tables.py @@ -82,7 +82,7 @@ class CompensationTable(BaseTable): html = "" html += self.render_link( tooltip=_("Open {}").format(_("Compensation")), - href=reverse("compensation:open", args=(record.id,)), + href=reverse("compensation:detail", args=(record.id,)), txt=value, new_tab=False, ) @@ -148,14 +148,13 @@ class CompensationTable(BaseTable): Returns: """ - html = "" if value is None: value = User.objects.none() has_access = value.filter( - username=self.user.username + id=self.user.id ).exists() - html += self.render_icn( + html = self.render_icn( tooltip=_("Full access granted") if has_access else _("Access not granted"), icn_class="fas fa-edit rlp-r-inv" if has_access else "far fa-edit", ) @@ -223,7 +222,7 @@ class EcoAccountTable(BaseTable): html = "" html += self.render_link( tooltip=_("Open {}").format(_("Eco-account")), - href=reverse("compensation:acc-open", args=(record.id,)), + href=reverse("compensation:acc-detail", args=(record.id,)), txt=value, new_tab=False, ) @@ -244,7 +243,7 @@ class EcoAccountTable(BaseTable): return format_html(html) def render_r(self, value, record: EcoAccount): - """ Renders the registered column for an eco account + """ Renders the recorded column for an eco account Args: value (str): The identifier value @@ -268,7 +267,7 @@ class EcoAccountTable(BaseTable): return format_html(html) def render_e(self, value, record: EcoAccount): - """ Renders the registered column for an eco account + """ Renders the editable column for an eco account Args: value (str): The identifier value @@ -278,10 +277,9 @@ class EcoAccountTable(BaseTable): """ html = "" - has_access = value.filter( - username=self.user.username - ).exists() - + # Do not use value in here, since value does use unprefetched 'users' manager, where record has already + # prefetched users data + has_access = self.user in record.users.all() html += self.render_icn( tooltip=_("Full access granted") if has_access else _("Access not granted"), icn_class="fas fa-edit rlp-r-inv" if has_access else "far fa-edit", diff --git a/compensation/templates/compensation/detail/compensation/includes/actions.html b/compensation/templates/compensation/detail/compensation/includes/actions.html index c4b7fb40..08930a9c 100644 --- a/compensation/templates/compensation/detail/compensation/includes/actions.html +++ b/compensation/templates/compensation/detail/compensation/includes/actions.html @@ -4,7 +4,7 @@
- {{obj.actions.count}} + {{actions.count}} {% trans 'Actions' context 'Compensation' %}
@@ -33,13 +33,15 @@ {% trans 'Comment' %} + {% if is_default_member and has_access %} {% trans 'Action' %} + {% endif %} - {% for action in obj.actions.all %} + {% for action in actions %} {{ action.action_type }} diff --git a/compensation/templates/compensation/detail/compensation/includes/controls.html b/compensation/templates/compensation/detail/compensation/includes/controls.html index 5d6f61be..5be0b3e8 100644 --- a/compensation/templates/compensation/detail/compensation/includes/controls.html +++ b/compensation/templates/compensation/detail/compensation/includes/controls.html @@ -6,7 +6,7 @@ LANIS - + diff --git a/compensation/templates/compensation/detail/compensation/includes/deadlines.html b/compensation/templates/compensation/detail/compensation/includes/deadlines.html index 206bd7d3..4ca109f7 100644 --- a/compensation/templates/compensation/detail/compensation/includes/deadlines.html +++ b/compensation/templates/compensation/detail/compensation/includes/deadlines.html @@ -33,9 +33,11 @@ {% trans 'Comment' %} - - {% trans 'Action' %} - + {% if is_default_member and has_access %} + + {% trans 'Action' %} + + {% endif %} diff --git a/compensation/templates/compensation/detail/compensation/includes/documents.html b/compensation/templates/compensation/detail/compensation/includes/documents.html index 3548e940..7e958f6d 100644 --- a/compensation/templates/compensation/detail/compensation/includes/documents.html +++ b/compensation/templates/compensation/detail/compensation/includes/documents.html @@ -30,9 +30,11 @@ {% trans 'Comment' %} - - {% trans 'Action' %} - + {% if is_default_member and has_access %} + + {% trans 'Action' %} + + {% endif %} diff --git a/compensation/templates/compensation/detail/compensation/includes/states-after.html b/compensation/templates/compensation/detail/compensation/includes/states-after.html index 585d5390..6b372974 100644 --- a/compensation/templates/compensation/detail/compensation/includes/states-after.html +++ b/compensation/templates/compensation/detail/compensation/includes/states-after.html @@ -35,9 +35,11 @@ {% trans 'Surface' %} + {% if is_default_member and has_access %} {% trans 'Action' %} + {% endif %} diff --git a/compensation/templates/compensation/detail/compensation/includes/states-before.html b/compensation/templates/compensation/detail/compensation/includes/states-before.html index fe6e4347..a0c541ae 100644 --- a/compensation/templates/compensation/detail/compensation/includes/states-before.html +++ b/compensation/templates/compensation/detail/compensation/includes/states-before.html @@ -4,7 +4,7 @@
- {% include 'compensation/detail/compensation/includes/comment.html' %} + {% include 'konova/comment_card.html' %}
diff --git a/compensation/templates/compensation/detail/eco_account/includes/actions.html b/compensation/templates/compensation/detail/eco_account/includes/actions.html index 23b3f069..868242a5 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/actions.html +++ b/compensation/templates/compensation/detail/eco_account/includes/actions.html @@ -4,7 +4,7 @@
- {{obj.actions.count}} + {{actions.count}} {% trans 'Actions' context 'Compensation' %}
@@ -33,13 +33,15 @@ {% trans 'Comment' %} - - {% trans 'Action' %} - + {% if default_member and has_access %} + + {% trans 'Action' %} + + {% endif %} - {% for action in obj.actions.all %} + {% for action in actions %} {{ action.action_type }} diff --git a/compensation/templates/compensation/detail/eco_account/includes/comment.html b/compensation/templates/compensation/detail/eco_account/includes/comment.html deleted file mode 100644 index aff3dec8..00000000 --- a/compensation/templates/compensation/detail/eco_account/includes/comment.html +++ /dev/null @@ -1,23 +0,0 @@ -{% load i18n fontawesome_5 %} - -{% if obj.comment %} -
-
-
-
-
-
- {% fa5_icon 'info-circle' %} - {% trans 'Comment' %} -
-
-
-
-
-
- {{obj.comment}} -
-
-
-
-{% endif %} \ No newline at end of file diff --git a/compensation/templates/compensation/detail/eco_account/includes/controls.html b/compensation/templates/compensation/detail/eco_account/includes/controls.html index 76e3b2b9..5aa9620e 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/controls.html +++ b/compensation/templates/compensation/detail/eco_account/includes/controls.html @@ -6,7 +6,7 @@ LANIS - + diff --git a/compensation/templates/compensation/detail/eco_account/includes/deductions.html b/compensation/templates/compensation/detail/eco_account/includes/deductions.html index 53061939..b35cef1e 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/deductions.html +++ b/compensation/templates/compensation/detail/eco_account/includes/deductions.html @@ -45,15 +45,15 @@ {% for deduction in deductions %} - + {{ deduction.intervention.identifier }} {% if deduction.intervention.recorded %} - + {% else %} - + {% endif %} {{ deduction.surface|floatformat:2|intcomma }} m² diff --git a/compensation/templates/compensation/detail/eco_account/includes/states-after.html b/compensation/templates/compensation/detail/eco_account/includes/states-after.html index da88db0e..bd71e25a 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/states-after.html +++ b/compensation/templates/compensation/detail/eco_account/includes/states-after.html @@ -4,7 +4,7 @@
- {{obj.after_states.count}} + {{after_states.count}} {% trans 'States after' %}
@@ -35,9 +35,11 @@ {% trans 'Surface' %} + {% if is_default_member and has_access %} {% trans 'Action' %} + {% endif %} diff --git a/compensation/templates/compensation/detail/eco_account/includes/states-before.html b/compensation/templates/compensation/detail/eco_account/includes/states-before.html index 33591509..8acb4865 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/states-before.html +++ b/compensation/templates/compensation/detail/eco_account/includes/states-before.html @@ -4,7 +4,7 @@
- {{obj.before_states.count}} + {{before_states.count}} {% trans 'States before' %}
@@ -35,9 +35,11 @@ {% trans 'Surface' %} + {% if is_default_member and has_access %} {% trans 'Action' %} + {% endif %} diff --git a/compensation/templates/compensation/detail/eco_account/view.html b/compensation/templates/compensation/detail/eco_account/view.html index efe44bb1..e839e6e9 100644 --- a/compensation/templates/compensation/detail/eco_account/view.html +++ b/compensation/templates/compensation/detail/eco_account/view.html @@ -62,7 +62,7 @@ {{obj.responsible.conservation_file_number|default_if_none:""}} - {% trans 'Intervention handler' %} + {% trans 'Action handler' %} {{obj.responsible.handler|default_if_none:""}} @@ -102,7 +102,7 @@ {% include 'map/geom_form.html' %}
- {% include 'compensation/detail/compensation/includes/comment.html' %} + {% include 'konova/comment_card.html' %}
diff --git a/compensation/templates/compensation/report/compensation/report.html b/compensation/templates/compensation/report/compensation/report.html new file mode 100644 index 00000000..956c0094 --- /dev/null +++ b/compensation/templates/compensation/report/compensation/report.html @@ -0,0 +1,67 @@ +{% extends 'public_base.html' %} +{% load i18n fontawesome_5 humanize %} + +{% block body %} +
+
+

{% trans 'Report' %}

+

{{obj.identifier}}

+
+ + + + + + + + + + + + + + + + + +
{% trans 'Title' %}{{obj.title|default_if_none:""}}
{% trans 'compensates intervention' %} + + {{obj.intervention.identifier}} + +
{% trans 'Funded by' %} + {% with obj.fundings.all as fundings %} + {% for funding in fundings %} +
{{funding.short_name}}
+
+ {% empty %} + {% trans 'None' %} + {% endfor %} + {% endwith %} +
{% trans 'Last modified' %} + {{obj.modified.timestamp|default_if_none:""|naturalday}} +
+
+ + {% include 'compensation/detail/compensation/includes/states-before.html' %} + {% include 'compensation/detail/compensation/includes/states-after.html' %} + {% include 'compensation/detail/compensation/includes/actions.html' %} +
+
+
+ {% include 'map/geom_form.html' %} +
+
+
+

{% trans 'Open in browser' %}

+ {{ qrcode|safe }} +
+
+

{% trans 'View in LANIS' %}

+ {{ qrcode_lanis|safe }} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/compensation/templates/compensation/report/eco_account/report.html b/compensation/templates/compensation/report/eco_account/report.html new file mode 100644 index 00000000..bd633322 --- /dev/null +++ b/compensation/templates/compensation/report/eco_account/report.html @@ -0,0 +1,84 @@ +{% extends 'public_base.html' %} +{% load i18n fontawesome_5 humanize %} + +{% block body %} +
+
+

{% trans 'Report' %}

+

{{obj.identifier}}

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{% trans 'Title' %}{{obj.title|default_if_none:""}}
{% trans 'Conservation office' %}{{obj.responsible.conservation_office.str_as_office|default_if_none:""}}
{% trans 'Conservation office file number' %}{{obj.responsible.conservation_file_number|default_if_none:""}}
{% trans 'Action handler' %}{{obj.responsible.handler|default_if_none:""}}
{% trans 'Funded by' %} + {% with obj.fundings.all as fundings %} + {% for funding in fundings %} +
{{funding.short_name}}
+
+ {% empty %} + {% trans 'None' %} + {% endfor %} + {% endwith %} +
{% trans 'Deductions for' %} + {% for deduction in deductions %} + + {{deduction.intervention__identifier}} + +
+ {% empty %} + {% trans 'None' %} + {% endfor %} +
{% trans 'Last modified' %} + {{obj.modified.timestamp|default_if_none:""|naturalday}} +
+
+ + {% include 'compensation/detail/compensation/includes/states-before.html' %} + {% include 'compensation/detail/compensation/includes/states-after.html' %} + {% include 'compensation/detail/compensation/includes/actions.html' %} +
+
+
+ {% include 'map/geom_form.html' %} +
+
+
+

{% trans 'Open in browser' %}

+ {{ qrcode|safe }} +
+
+

{% trans 'View in LANIS' %}

+ {{ qrcode_lanis|safe }} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/compensation/views/compensation_views.py b/compensation/views/compensation_views.py index 0d56d817..994e9647 100644 --- a/compensation/views/compensation_views.py +++ b/compensation/views/compensation_views.py @@ -13,6 +13,7 @@ from konova.contexts import BaseContext from konova.decorators import * from konova.forms import RemoveModalForm, SimpleGeomForm, NewDocumentForm from konova.utils.documents import get_document, remove_document +from konova.utils.generators import generate_qr_code from konova.utils.message_templates import FORM_INVALID, IDENTIFIER_REPLACED from konova.utils.user_checks import in_group @@ -74,7 +75,7 @@ def new_view(request: HttpRequest, intervention_id: str = None): ) ) messages.success(request, _("Compensation {} added").format(comp.identifier)) - return redirect("compensation:open", id=comp.id) + return redirect("compensation:detail", id=comp.id) else: messages.error(request, FORM_INVALID) else: @@ -129,7 +130,7 @@ def edit_view(request: HttpRequest, id: str): # The data form takes the geom form for processing, as well as the performing user comp = data_form.save(request.user, geom_form) messages.success(request, _("Compensation {} edited").format(comp.identifier)) - return redirect("compensation:open", id=comp.id) + return redirect("compensation:detail", id=comp.id) else: messages.error(request, FORM_INVALID) else: @@ -145,7 +146,7 @@ def edit_view(request: HttpRequest, id: str): @login_required @any_group_check -def open_view(request: HttpRequest, id: str): +def detail_view(request: HttpRequest, id: str): """ Renders a detail view for a compensation Args: @@ -162,8 +163,9 @@ def open_view(request: HttpRequest, id: str): is_data_shared = comp.intervention.is_shared_with(_user) # Order states according to surface - before_states = comp.before_states.all().order_by("-surface") - after_states = comp.after_states.all().order_by("-surface") + before_states = comp.before_states.all().prefetch_related("biotope_type").order_by("-surface") + after_states = comp.after_states.all().prefetch_related("biotope_type").order_by("-surface") + actions = comp.actions.all().prefetch_related("action_type") # Precalculate logical errors between before- and after-states # Sum() returns None in case of no states, so we catch that and replace it with 0 for easier handling @@ -175,6 +177,7 @@ def open_view(request: HttpRequest, id: str): "obj": comp, "geom_form": geom_form, "has_access": is_data_shared, + "actions": actions, "before_states": before_states, "after_states": after_states, "sum_before_states": sum_before_states, @@ -381,3 +384,53 @@ def action_remove_view(request: HttpRequest, id: str): request, msg_success=_("Action removed") ) + + +def report_view(request:HttpRequest, id: str): + """ Renders the public report view + + Args: + request (HttpRequest): The incoming request + id (str): The id of the intervention + + Returns: + + """ + # Reuse the compensation report template since compensations are structurally identical + template = "compensation/report/compensation/report.html" + comp = get_object_or_404(Compensation, id=id) + + # If intervention is not recorded (yet or currently) we need to render another template without any data + if not comp.intervention.recorded: + template = "report/unavailable.html" + return render(request, template, {}) + + # Prepare data for map viewer + geom_form = SimpleGeomForm( + instance=comp + ) + qrcode_img = generate_qr_code( + request.build_absolute_uri(reverse("compensation:report", args=(id,))), + 10 + ) + qrcode_img_lanis = generate_qr_code( + comp.get_LANIS_link(), + 7 + ) + # Order states by surface + before_states = comp.before_states.all().order_by("-surface").prefetch_related("biotope_type") + after_states = comp.after_states.all().order_by("-surface").prefetch_related("biotope_type") + actions = comp.actions.all().prefetch_related("action_type") + + context = { + "obj": comp, + "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) diff --git a/compensation/views/eco_account_views.py b/compensation/views/eco_account_views.py index 476bd977..dadac7e6 100644 --- a/compensation/views/eco_account_views.py +++ b/compensation/views/eco_account_views.py @@ -24,6 +24,7 @@ from konova.decorators import any_group_check, default_group_required, conservat from konova.forms import RemoveModalForm, SimpleGeomForm, NewDocumentForm, RecordModalForm from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP from konova.utils.documents import get_document, remove_document +from konova.utils.generators import generate_qr_code from konova.utils.message_templates import IDENTIFIER_REPLACED, FORM_INVALID from konova.utils.user_checks import in_group @@ -41,7 +42,6 @@ def index_view(request: HttpRequest): A rendered view """ template = "generic_index.html" - user = request.user eco_accounts = EcoAccount.objects.filter( deleted=None, ) @@ -84,7 +84,7 @@ def new_view(request: HttpRequest): ) ) messages.success(request, _("Eco-Account {} added").format(acc.identifier)) - return redirect("compensation:acc-open", id=acc.id) + return redirect("compensation:acc-detail", id=acc.id) else: messages.error(request, FORM_INVALID) else: @@ -139,7 +139,7 @@ def edit_view(request: HttpRequest, id: str): # The data form takes the geom form for processing, as well as the performing user acc = data_form.save(request.user, geom_form) messages.success(request, _("Eco-Account {} edited").format(acc.identifier)) - return redirect("compensation:acc-open", id=acc.id) + return redirect("compensation:acc-detail", id=acc.id) else: messages.error(request, FORM_INVALID) else: @@ -155,7 +155,7 @@ def edit_view(request: HttpRequest, id: str): @login_required @any_group_check -def open_view(request: HttpRequest, id: str): +def detail_view(request: HttpRequest, id: str): """ Renders a detail view for a compensation Args: @@ -166,27 +166,36 @@ def open_view(request: HttpRequest, id: str): """ template = "compensation/detail/eco_account/view.html" - acc = get_object_or_404(EcoAccount, id=id) + acc = get_object_or_404( + EcoAccount.objects.prefetch_related( + "deadlines", + ).select_related( + 'geometry', + 'responsible', + ), + id=id + ) geom_form = SimpleGeomForm(instance=acc) _user = request.user is_data_shared = acc.is_shared_with(_user) # Order states according to surface - before_states = acc.before_states.all().order_by("-surface") - after_states = acc.after_states.all().order_by("-surface") + before_states = acc.before_states.order_by("-surface") + after_states = acc.after_states.order_by("-surface") # Precalculate logical errors between before- and after-states # Sum() returns None in case of no states, so we catch that and replace it with 0 for easier handling sum_before_states = before_states.aggregate(Sum("surface"))["surface__sum"] or 0 sum_after_states = after_states.aggregate(Sum("surface"))["surface__sum"] or 0 diff_states = abs(sum_before_states - sum_after_states) - # Calculate rest of available surface for deductions available_total, available_relative = acc.get_available_rest() + # Prefetch related data to decrease the amount of db connections deductions = acc.deductions.filter( intervention__deleted=None, ) + actions = acc.actions.all() context = { "obj": acc, @@ -204,6 +213,7 @@ def open_view(request: HttpRequest, id: str): "is_ets_member": in_group(_user, ETS_GROUP), "LANIS_LINK": acc.get_LANIS_link(), "deductions": deductions, + "actions": actions, } context = BaseContext(request, context).context return render(request, template, context) @@ -432,3 +442,60 @@ def new_deduction_view(request: HttpRequest, id: str): request, msg_success=_("Deduction added") ) + + +def report_view(request:HttpRequest, id: str): + """ Renders the public report view + + Args: + request (HttpRequest): The incoming request + id (str): The id of the intervention + + Returns: + + """ + # Reuse the compensation report template since EcoAccounts are structurally identical + template = "compensation/report/eco_account/report.html" + acc = get_object_or_404(EcoAccount, id=id) + + # If intervention is not recorded (yet or currently) we need to render another template without any data + if not acc.recorded: + template = "report/unavailable.html" + return render(request, template, {}) + + # Prepare data for map viewer + geom_form = SimpleGeomForm( + instance=acc + ) + qrcode_img = generate_qr_code( + request.build_absolute_uri(reverse("ema:report", args=(id,))), + 10 + ) + qrcode_img_lanis = generate_qr_code( + acc.get_LANIS_link(), + 7 + ) + # Order states by surface + before_states = acc.before_states.all().order_by("-surface").select_related("biotope_type__parent") + after_states = acc.after_states.all().order_by("-surface").select_related("biotope_type__parent") + actions = acc.actions.all().select_related("action_type__parent") + + # Reduce amount of db fetched data to the bare minimum we need in the template (deduction's intervention id and identifier) + deductions = acc.deductions.all()\ + .distinct("intervention")\ + .select_related("intervention")\ + .values_list("intervention__id", "intervention__identifier", named=True) + + context = { + "obj": acc, + "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, + "deductions": deductions, + } + context = BaseContext(request, context).context + return render(request, template, context) diff --git a/ema/forms.py b/ema/forms.py index d516259a..7fd42a51 100644 --- a/ema/forms.py +++ b/ema/forms.py @@ -99,7 +99,7 @@ class EditEmaForm(NewEmaForm): self.form_title = _("Edit EMA") self.action_url = reverse("ema:edit", args=(self.instance.id,)) - self.cancel_redirect = reverse("ema:open", args=(self.instance.id,)) + self.cancel_redirect = reverse("ema:detail", args=(self.instance.id,)) self.fields["identifier"].widget.attrs["url"] = reverse_lazy("ema:new-id") self.fields["title"].widget.attrs["placeholder"] = _("Compensation XY; Location ABC") diff --git a/ema/managers.py b/ema/managers.py new file mode 100644 index 00000000..aaac3a39 --- /dev/null +++ b/ema/managers.py @@ -0,0 +1,21 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: michel.peltriaux@sgdnord.rlp.de +Created on: 14.10.21 + +""" +from django.db import models + + +class EmaManager(models.Manager): + """ Holds default db fetch setting for this model type + + """ + def get_queryset(self): + return super().get_queryset().select_related( + "modified", + "modified__user", + "recorded", + "recorded__user", + ) \ No newline at end of file diff --git a/ema/models.py b/ema/models.py index d7e214fe..e8d31c4f 100644 --- a/ema/models.py +++ b/ema/models.py @@ -5,6 +5,7 @@ from django.db import models from django.db.models import QuerySet from compensation.models import AbstractCompensation +from ema.managers import EmaManager from konova.models import AbstractDocument, generate_document_file_upload_path from konova.settings import DEFAULT_SRID_RLP, LANIS_LINK_TEMPLATE, EMA_DOC_PATH from user.models import UserActionLogEntry @@ -43,6 +44,8 @@ class Ema(AbstractCompensation): related_name="+" ) + objects = EmaManager() + def __str__(self): return "{}".format(self.identifier) diff --git a/ema/tables.py b/ema/tables.py index 5771307b..9055059d 100644 --- a/ema/tables.py +++ b/ema/tables.py @@ -49,7 +49,7 @@ class EmaTable(BaseTable): lm = tables.Column( verbose_name=_("Last edit"), orderable=True, - accessor="created__timestamp", + accessor="modified__timestamp", ) class Meta(BaseTable.Meta): @@ -80,7 +80,7 @@ class EmaTable(BaseTable): html = "" html += self.render_link( tooltip=_("Open {}").format(_("EMA")), - href=reverse("ema:open", args=(record.id,)), + href=reverse("ema:detail", args=(record.id,)), txt=value, new_tab=False, ) @@ -122,7 +122,7 @@ class EmaTable(BaseTable): """ html = "" has_access = value.filter( - username=self.user.username + id=self.user.id ).exists() html += self.render_icn( diff --git a/ema/templates/ema/detail/includes/controls.html b/ema/templates/ema/detail/includes/controls.html index 8b24f66e..1d5e5467 100644 --- a/ema/templates/ema/detail/includes/controls.html +++ b/ema/templates/ema/detail/includes/controls.html @@ -6,7 +6,7 @@ LANIS - + diff --git a/ema/templates/ema/detail/view.html b/ema/templates/ema/detail/view.html index 941e47c1..757ee64d 100644 --- a/ema/templates/ema/detail/view.html +++ b/ema/templates/ema/detail/view.html @@ -47,7 +47,7 @@ {{obj.responsible.conservation_file_number|default_if_none:""}} - {% trans 'Intervention handler' %} + {% trans 'Action handler' %} {{obj.responsible.handler|default_if_none:""}} diff --git a/ema/templates/ema/report/report.html b/ema/templates/ema/report/report.html new file mode 100644 index 00000000..2395e7ce --- /dev/null +++ b/ema/templates/ema/report/report.html @@ -0,0 +1,71 @@ +{% extends 'public_base.html' %} +{% load i18n fontawesome_5 humanize %} + +{% block body %} +
+
+

{% trans 'Report' %}

+

{{obj.identifier}}

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
{% trans 'Title' %}{{obj.title|default_if_none:""}}
{% trans 'Conservation office' %}{{obj.responsible.conservation_office.str_as_office|default_if_none:""}}
{% trans 'Conservation office file number' %}{{obj.responsible.conservation_file_number|default_if_none:""}}
{% trans 'Action handler' %}{{obj.responsible.handler|default_if_none:""}}
{% trans 'Funded by' %} + {% with obj.fundings.all as fundings %} + {% for funding in fundings %} +
{{funding.short_name}}
+
+ {% empty %} + {% trans 'None' %} + {% endfor %} + {% endwith %} +
{% trans 'Last modified' %} + {{obj.modified.timestamp|default_if_none:""|naturalday}} +
+
+ + {% include 'compensation/detail/compensation/includes/states-before.html' %} + {% include 'compensation/detail/compensation/includes/states-after.html' %} + {% include 'compensation/detail/compensation/includes/actions.html' %} +
+
+
+ {% include 'map/geom_form.html' %} +
+
+
+

{% trans 'Open in browser' %}

+ {{ qrcode|safe }} +
+
+

{% trans 'View in LANIS' %}

+ {{ qrcode_lanis|safe }} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/ema/urls.py b/ema/urls.py index 404cdf53..ad926d05 100644 --- a/ema/urls.py +++ b/ema/urls.py @@ -13,11 +13,12 @@ urlpatterns = [ path("", index_view, name="index"), path("new/", new_view, name="new"), path("new/id", new_id_view, name="new-id"), - path("", open_view, name="open"), + path("", detail_view, name="detail"), path('/log', log_view, name='log'), path('/edit', edit_view, name='edit'), path('/remove', remove_view, name='remove'), path('/record', record_view, name='record'), + path('/report', report_view, name='report'), path('/state/new', state_new_view, name='new-state'), path('/action/new', action_new_view, name='new-action'), path('/deadline/new', deadline_new_view, name="new-deadline"), diff --git a/ema/views.py b/ema/views.py index e479c17b..ead1a899 100644 --- a/ema/views.py +++ b/ema/views.py @@ -16,6 +16,7 @@ from ema.models import Ema, EmaDocument from konova.forms import RemoveModalForm, NewDocumentForm, SimpleGeomForm, RecordModalForm from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP from konova.utils.documents import get_document, remove_document +from konova.utils.generators import generate_qr_code from konova.utils.message_templates import IDENTIFIER_REPLACED, FORM_INVALID from konova.utils.user_checks import in_group @@ -75,7 +76,7 @@ def new_view(request: HttpRequest): ) ) messages.success(request, _("EMA {} added").format(ema.identifier)) - return redirect("ema:open", id=ema.id) + return redirect("ema:detail", id=ema.id) else: messages.error(request, FORM_INVALID) else: @@ -108,7 +109,7 @@ def new_id_view(request: HttpRequest): @login_required -def open_view(request: HttpRequest, id: str): +def detail_view(request: HttpRequest, id: str): """ Renders the detail view of an EMA Args: @@ -199,7 +200,7 @@ def edit_view(request: HttpRequest, id: str): # The data form takes the geom form for processing, as well as the performing user ema = data_form.save(request.user, geom_form) messages.success(request, _("EMA {} edited").format(ema.identifier)) - return redirect("ema:open", id=ema.id) + return redirect("ema:detail", id=ema.id) else: messages.error(request, FORM_INVALID) else: @@ -399,3 +400,52 @@ def action_remove_view(request: HttpRequest, id: str): id ) + +def report_view(request:HttpRequest, id: str): + """ Renders the public report view + + Args: + request (HttpRequest): The incoming request + id (str): The id of the intervention + + Returns: + + """ + # Reuse the compensation report template since EMAs are structurally identical + 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 + if not ema.recorded: + 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 + ) + qrcode_img_lanis = generate_qr_code( + 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) \ No newline at end of file diff --git a/intervention/forms/forms.py b/intervention/forms/forms.py index 27e2acf5..22364589 100644 --- a/intervention/forms/forms.py +++ b/intervention/forms/forms.py @@ -269,7 +269,7 @@ class EditInterventionForm(NewInterventionForm): super().__init__(*args, **kwargs) if self.instance is not None: self.action_url = reverse("intervention:edit", args=(self.instance.id,)) - self.cancel_redirect = reverse("intervention:open", args=(self.instance.id,)) + self.cancel_redirect = reverse("intervention:detail", args=(self.instance.id,)) self.form_title = _("Edit intervention") self.form_caption = "" diff --git a/intervention/managers.py b/intervention/managers.py new file mode 100644 index 00000000..213e8659 --- /dev/null +++ b/intervention/managers.py @@ -0,0 +1,48 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: michel.peltriaux@sgdnord.rlp.de +Created on: 14.10.21 + +""" +from django.db import models + + +class InterventionManager(models.Manager): + """ Holds default db fetch setting for this model type + + """ + def get_queryset(self): + return super().get_queryset().select_related( + "recorded", + "recorded__user", + "modified", + "modified__user", + "checked", + "checked__user", + ).prefetch_related( + "users", + ) + + +class LegalDataManager(models.Manager): + """ Holds default db fetch setting for this model type + + """ + def get_queryset(self): + return super().get_querset().select_related( + "process_type", + ).prefetch_related( + "laws" + ) + + +class ResponsibilityDataManager(models.Manager): + """ Holds default db fetch setting for this model type + + """ + def get_queryset(self): + return super().get_querset().select_related( + "registration_office", + "conservation_office", + ) diff --git a/intervention/models.py b/intervention/models.py index 6b1fda72..2bdf1eff 100644 --- a/intervention/models.py +++ b/intervention/models.py @@ -10,16 +10,15 @@ import shutil from django.contrib.auth.models import User from django.contrib.gis.db import models from django.db.models import QuerySet -from django.utils.timezone import localtime from django.utils.translation import gettext_lazy as _ from codelist.models import KonovaCode from codelist.settings import CODELIST_REGISTRATION_OFFICE_ID, CODELIST_CONSERVATION_OFFICE_ID, CODELIST_LAW_ID, \ CODELIST_PROCESS_TYPE_ID +from intervention.managers import InterventionManager, LegalDataManager, ResponsibilityDataManager from konova.models import BaseObject, Geometry, UuidModel, BaseResource, AbstractDocument, \ generate_document_file_upload_path -from konova.settings import DEFAULT_SRID_RLP, LANIS_LINK_TEMPLATE -from konova.sub_settings.django_settings import DEFAULT_DATE_TIME_FORMAT +from konova.settings import DEFAULT_SRID_RLP, LANIS_LINK_TEMPLATE, LANIS_ZOOM_LUT from konova.utils import generators from user.models import UserActionLogEntry @@ -57,6 +56,8 @@ class ResponsibilityData(UuidModel): conservation_file_number = models.CharField(max_length=1000, blank=True, null=True) handler = models.CharField(max_length=500, null=True, blank=True, help_text="Refers to 'Eingriffsverursacher' or 'Maßnahmenträger'") + objects = ResponsibilityDataManager() + def __str__(self): return "ZB: {} | ETS: {} | Handler: {}".format( self.registration_office, @@ -171,6 +172,8 @@ class LegalData(UuidModel): revocation = models.OneToOneField(Revocation, null=True, blank=True, help_text="Refers to 'Widerspruch am'", on_delete=models.SET_NULL) + objects = LegalDataManager() + class Intervention(BaseObject): """ @@ -221,6 +224,8 @@ class Intervention(BaseObject): help_text="Used for sharing access", ) + objects = InterventionManager() + def __str__(self): return "{} ({})".format(self.identifier, self.title) @@ -361,7 +366,13 @@ class Intervention(BaseObject): geom = self.geometry.geom.transform(DEFAULT_SRID_RLP, clone=True) x = geom.centroid.x y = geom.centroid.y - zoom_lvl = 16 + area = int(geom.envelope.area) + z_l = 16 + for k_area, v_zoom in LANIS_ZOOM_LUT.items(): + if k_area < area: + z_l = v_zoom + break + zoom_lvl = z_l except AttributeError: # If no geometry has been added, yet. x = 1 @@ -373,16 +384,6 @@ class Intervention(BaseObject): y, ) - @property - def recorded_tooltip(self): - tooltip = _("Not recorded yet") - if self.recorded: - value = self.recorded.timestamp - value = localtime(value) - on = value.strftime(DEFAULT_DATE_TIME_FORMAT) - tooltip = _("Recorded on {} by {}").format(on, self.recorded.user) - return tooltip - def get_documents(self) -> (QuerySet, QuerySet): """ Getter for all documents of an intervention diff --git a/intervention/tables.py b/intervention/tables.py index 1b9bc855..103d419a 100644 --- a/intervention/tables.py +++ b/intervention/tables.py @@ -86,7 +86,7 @@ class InterventionTable(BaseTable): html = "" html += self.render_link( tooltip=_("Open {}").format(_("Intervention")), - href=reverse("intervention:open", args=(record.id,)), + href=reverse("intervention:detail", args=(record.id,)), txt=value, new_tab=False, ) @@ -117,7 +117,7 @@ class InterventionTable(BaseTable): return format_html(html) def render_r(self, value, record: Intervention): - """ Renders the registered column for an intervention + """ Renders the recorded column for an intervention Args: value (str): The identifier value @@ -141,7 +141,7 @@ class InterventionTable(BaseTable): return format_html(html) def render_e(self, value, record: Intervention): - """ Renders the registered column for an intervention + """ Renders the editable column for an intervention Args: value (str): The identifier value @@ -152,7 +152,7 @@ class InterventionTable(BaseTable): """ html = "" has_access = value.filter( - username=self.user.username + id=self.user.id ).exists() html += self.render_icn( diff --git a/intervention/templates/intervention/detail/includes/comment.html b/intervention/templates/intervention/detail/includes/comment.html deleted file mode 100644 index 2f253568..00000000 --- a/intervention/templates/intervention/detail/includes/comment.html +++ /dev/null @@ -1,23 +0,0 @@ -{% load i18n fontawesome_5 %} - -{% if intervention.comment %} -
-
-
-
-
-
- {% fa5_icon 'info-circle' %} - {% trans 'Comment' %} -
-
-
-
-
-
- {{intervention.comment}} -
-
-
-
-{% endif %} \ No newline at end of file diff --git a/intervention/templates/intervention/detail/includes/compensations.html b/intervention/templates/intervention/detail/includes/compensations.html index 894c96af..79fcaa09 100644 --- a/intervention/templates/intervention/detail/includes/compensations.html +++ b/intervention/templates/intervention/detail/includes/compensations.html @@ -11,7 +11,7 @@
{% if is_default_member and has_access %} - + - + {% if has_access %} - {% if is_zb_member %} - {% endif %} {% if is_ets_member %} - {% if intervention.recorded %} - {% else %} - {% endif %} {% endif %} {% if is_default_member %} - + - - {% endif %} diff --git a/intervention/templates/intervention/detail/includes/deductions.html b/intervention/templates/intervention/detail/includes/deductions.html index bfbfa367..cb2f8179 100644 --- a/intervention/templates/intervention/detail/includes/deductions.html +++ b/intervention/templates/intervention/detail/includes/deductions.html @@ -4,14 +4,14 @@
- {{intervention.deductions.count}} + {{obj.deductions.count}} {% trans 'Eco Account Deductions' %}
{% if is_default_member and has_access %} - @@ -33,16 +33,18 @@ {% trans 'Created' %} - - {% trans 'Action' %} - + {% if is_default_member and has_access %} + + {% trans 'Action' %} + + {% endif %} - {% for deduction in intervention.deductions.all %} + {% for deduction in obj.deductions.all %} - + {% if deduction.account.deleted or not deduction.account.recorded %} {% fa5_icon 'exclamation-triangle' %} {% endif %} diff --git a/intervention/templates/intervention/detail/includes/documents.html b/intervention/templates/intervention/detail/includes/documents.html index 54972bf5..cc0c9a17 100644 --- a/intervention/templates/intervention/detail/includes/documents.html +++ b/intervention/templates/intervention/detail/includes/documents.html @@ -4,14 +4,14 @@
- {{intervention.documents.count}} + {{obj.documents.count}} {% trans 'Documents' %}
{% if is_default_member and has_access %} - @@ -30,13 +30,15 @@ {% trans 'Comment' %} - - {% trans 'Action' %} - + {% if is_default_member and has_access %} + + {% trans 'Action' %} + + {% endif %} - {% for doc in intervention.documents.all %} + {% for doc in obj.documents.all %} diff --git a/intervention/templates/intervention/detail/includes/payments.html b/intervention/templates/intervention/detail/includes/payments.html index 8177371a..c3ab7568 100644 --- a/intervention/templates/intervention/detail/includes/payments.html +++ b/intervention/templates/intervention/detail/includes/payments.html @@ -4,14 +4,14 @@
- {{intervention.payments.count}} + {{obj.payments.count}} {% trans 'Payments' %}
{% if is_default_member and has_access %} - @@ -33,13 +33,15 @@ {% trans 'Comment' %} - - {% trans 'Action' %} - + {% if is_default_member and has_access %} + + {% trans 'Action' %} + + {% endif %} - {% for pay in intervention.payments.all %} + {% for pay in obj.payments.all %} {{ pay.amount|floatformat:2 }} € diff --git a/intervention/templates/intervention/detail/includes/revocation.html b/intervention/templates/intervention/detail/includes/revocation.html index 10a4c44e..c9d821ff 100644 --- a/intervention/templates/intervention/detail/includes/revocation.html +++ b/intervention/templates/intervention/detail/includes/revocation.html @@ -4,7 +4,7 @@
- {% if intervention.legal.revocation %}1{% else %}0{% endif %} + {% if obj.legal.revocation %}1{% else %}0{% endif %} {% trans 'Revocation' %}
@@ -13,8 +13,8 @@ {% comment %} Only show add-button if no revocation exists, yet. {% endcomment %} - {% if is_default_member and has_access and not intervention.legal.revocation %} - @@ -36,14 +36,16 @@ {% trans 'Comment' %} - - {% trans 'Action' %} - + {% if is_default_member and has_access %} + + {% trans 'Action' %} + + {% endif %} - {% if intervention.legal.revocation %} - {% with intervention.legal.revocation as rev %} + {% if obj.legal.revocation %} + {% with obj.legal.revocation as rev %} {{ rev.date }} diff --git a/intervention/templates/intervention/detail/view.html b/intervention/templates/intervention/detail/view.html index 525182d5..e3d919f3 100644 --- a/intervention/templates/intervention/detail/view.html +++ b/intervention/templates/intervention/detail/view.html @@ -15,7 +15,7 @@
-

{% trans 'Intervention' %}
{{intervention.identifier}}

+

{% trans 'Intervention' %}
{{obj.identifier}}

{% include 'intervention/detail/includes/controls.html' %} @@ -26,52 +26,52 @@
- + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -127,7 +127,7 @@ {% include 'map/geom_form.html' %}
- {% include 'intervention/detail/includes/comment.html' %} + {% include 'konova/comment_card.html' %}
diff --git a/intervention/templates/intervention/report/report.html b/intervention/templates/intervention/report/report.html new file mode 100644 index 00000000..cf422042 --- /dev/null +++ b/intervention/templates/intervention/report/report.html @@ -0,0 +1,117 @@ +{% extends 'public_base.html' %} +{% load i18n fontawesome_5 humanize %} + +{% block body %} +
+
+

{% trans 'Report' %}

+

{{obj.identifier}}

+
+
{% trans 'Title' %}{{intervention.title|default_if_none:""}}{{obj.title|default_if_none:""}}
{% trans 'Process type' %}{{intervention.legal.process_type|default_if_none:""}}{{obj.legal.process_type|default_if_none:""}}
{% trans 'Law' %} - {% for law in intervention.legal.laws.all %} + {% for law in obj.legal.laws.all %}
{{law.short_name}} - {{law.long_name}}

{% endfor %}
{% trans 'Registration office' %}{{intervention.responsible.registration_office.str_as_office|default_if_none:""}}{{obj.responsible.registration_office.str_as_office|default_if_none:""}}
{% trans 'Registration office file number' %}{{intervention.responsible.registration_file_number|default_if_none:""}}{{obj.responsible.registration_file_number|default_if_none:""}}
{% trans 'Conservation office' %}{{intervention.responsible.conservation_office.str_as_office|default_if_none:""}}{{obj.responsible.conservation_office.str_as_office|default_if_none:""}}
{% trans 'Conservation office file number' %}{{intervention.responsible.conservation_file_number|default_if_none:""}}{{obj.responsible.conservation_file_number|default_if_none:""}}
{% trans 'Intervention handler' %}{{intervention.responsible.handler|default_if_none:""}}{{obj.responsible.handler|default_if_none:""}}
{% trans 'Checked' %} - {% if intervention.checked is None %} + {% if obj.checked is None %} {% fa5_icon 'star' 'far' %} {% else %} - + {% fa5_icon 'star' %} {% endif %} @@ -80,41 +80,41 @@
{% trans 'Recorded' %} - {% if intervention.recorded is None %} + {% if obj.recorded is None %} {% fa5_icon 'bookmark' 'far' %} {% else %} - + {% fa5_icon 'bookmark' %} {% endif %}
{% trans 'Registration date' %}{{intervention.legal.registration_date|default_if_none:""}}{{obj.legal.registration_date|default_if_none:""}}
{% trans 'Binding on' %}{{intervention.legal.binding_date|default_if_none:""}}{{obj.legal.binding_date|default_if_none:""}}
{% trans 'Revocation' %}{{intervention.legal.revocation.date|naturalday|default_if_none:""}}{{obj.legal.revocation.date|naturalday|default_if_none:""}}
{% trans 'Last modified' %} - {{intervention.created.timestamp|default_if_none:""|naturalday}} + {{obj.created.timestamp|default_if_none:""|naturalday}}
- {{intervention.created.user.username}} + {{obj.created.user.username}}
{% trans 'Shared with' %} - {% for user in intervention.users.all %} + {% for user in obj.users.all %} {% include 'user/includes/contact_modal_button.html' %} {% endfor %}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{% trans 'Title' %}{{obj.title|default_if_none:""}}
{% trans 'Process type' %}{{obj.legal.process_type|default_if_none:""}}
{% trans 'Law' %} + {% for law in obj.legal.laws.all %} +
{{law.short_name}} - {{law.long_name}}
+
+ {% endfor %} +
{% trans 'Registration office' %}{{obj.responsible.registration_office.str_as_office|default_if_none:""}}
{% trans 'Registration office file number' %}{{obj.responsible.registration_file_number|default_if_none:""}}
{% trans 'Conservation office' %}{{obj.responsible.conservation_office.str_as_office|default_if_none:""}}
{% trans 'Conservation office file number' %}{{obj.responsible.conservation_file_number|default_if_none:""}}
{% trans 'Intervention handler' %}{{obj.responsible.handler|default_if_none:""}}
{% trans 'Compensations' %} + {% for comp in obj.compensations.all %} + + {{comp.identifier}} + +
+ {% empty %} + {% trans 'None' %} + {% endfor %} +
{% trans 'Deductions of eco-accounts' %} + {% for deduction in deductions %} + + {{deduction.account.identifier}} + +
+ {% endfor %} +
{% trans 'Payments' %} + {% if obj.payments.all %} + {% trans 'Exist' %} + {% else %} + {% trans 'None' %} + {% endif %} +
{% trans 'Registration date' %}{{obj.legal.registration_date|default_if_none:""}}
{% trans 'Binding on' %}{{obj.legal.binding_date|default_if_none:""}}
{% trans 'Last modified' %} + {{obj.created.timestamp|default_if_none:""|naturalday}} +
+
+
+
+
+ {% include 'map/geom_form.html' %} +
+
+
+

{% trans 'Open in browser' %}

+ {{ qrcode|safe }} +
+
+

{% trans 'View in LANIS' %}

+ {{ qrcode_lanis|safe }} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/intervention/urls.py b/intervention/urls.py index ac96d628..022c3c9f 100644 --- a/intervention/urls.py +++ b/intervention/urls.py @@ -7,16 +7,16 @@ Created on: 30.11.20 """ from django.urls import path -from intervention.views import index_view, new_view, open_view, edit_view, remove_view, new_document_view, share_view, \ +from intervention.views import index_view, new_view, detail_view, edit_view, remove_view, new_document_view, share_view, \ create_share_view, remove_revocation_view, new_revocation_view, run_check_view, log_view, new_deduction_view, \ - record_view, remove_document_view, get_document_view, get_revocation_view, new_id_view + record_view, remove_document_view, get_document_view, get_revocation_view, new_id_view, report_view app_name = "intervention" urlpatterns = [ path("", index_view, name="index"), path('new/', new_view, name='new'), path('new/id', new_id_view, name='new-id'), - path('', open_view, name='open'), + path('', detail_view, name='detail'), path('/log', log_view, name='log'), path('/edit', edit_view, name='edit'), path('/remove', remove_view, name='remove'), @@ -24,6 +24,7 @@ urlpatterns = [ path('/share', create_share_view, name='share-create'), path('/check', run_check_view, name='run-check'), path('/record', record_view, name='record'), + path('/report', report_view, name='report'), # Documents path('/document/new/', new_document_view, name='new-doc'), diff --git a/intervention/views.py b/intervention/views.py index 8c9679f1..6853197f 100644 --- a/intervention/views.py +++ b/intervention/views.py @@ -1,7 +1,7 @@ from django.contrib.auth.decorators import login_required from django.utils.translation import gettext_lazy as _ from django.http import HttpRequest, JsonResponse -from django.shortcuts import render, get_object_or_404 +from django.shortcuts import render from intervention.forms.forms import NewInterventionForm, EditInterventionForm from intervention.forms.modalForms import ShareInterventionModalForm, NewRevocationModalForm, \ @@ -13,6 +13,7 @@ from konova.decorators import * from konova.forms import SimpleGeomForm, NewDocumentForm, RemoveModalForm, RecordModalForm from konova.sub_settings.django_settings import DEFAULT_DATE_FORMAT from konova.utils.documents import remove_document, get_document +from konova.utils.generators import generate_qr_code from konova.utils.message_templates import INTERVENTION_INVALID, FORM_INVALID, IDENTIFIER_REPLACED from konova.utils.user_checks import in_group @@ -34,6 +35,8 @@ def index_view(request: HttpRequest): # Filtering by user access is performed in table filter inside of InterventionTableFilter class interventions = Intervention.objects.filter( deleted=None, # not deleted + ).select_related( + "legal" ) table = InterventionTable( request=request, @@ -74,7 +77,7 @@ def new_view(request: HttpRequest): ) ) messages.success(request, _("Intervention {} added").format(intervention.identifier)) - return redirect("intervention:open", id=intervention.id) + return redirect("intervention:detail", id=intervention.id) else: messages.error(request, FORM_INVALID) else: @@ -180,7 +183,7 @@ def remove_document_view(request: HttpRequest, doc_id: str): @login_required @any_group_check -def open_view(request: HttpRequest, id: str): +def detail_view(request: HttpRequest, id: str): """ Renders a detail view for viewing an intervention's data Args: @@ -193,7 +196,14 @@ def open_view(request: HttpRequest, id: str): template = "intervention/detail/view.html" # Fetch data, filter out deleted related data - intervention = get_object_or_404(Intervention, id=id) + intervention = get_object_or_404( + Intervention.objects.select_related( + "geometry", + "legal", + "responsible", + ), + id=id + ) compensations = intervention.compensations.filter( deleted=None, ) @@ -213,7 +223,7 @@ def open_view(request: HttpRequest, id: str): ) context = { - "intervention": intervention, + "obj": intervention, "compensations": compensations, "has_access": is_data_shared, "geom_form": geom_form, @@ -252,7 +262,7 @@ def edit_view(request: HttpRequest, id: str): # The data form takes the geom form for processing, as well as the performing user intervention = data_form.save(request.user, geom_form) messages.success(request, _("Intervention {} edited").format(intervention.identifier)) - return redirect("intervention:open", id=intervention.id) + return redirect("intervention:detail", id=intervention.id) else: messages.error(request, FORM_INVALID) else: @@ -338,7 +348,7 @@ def share_view(request: HttpRequest, id: str, token: str): _("{} has been shared with you").format(intervention.identifier) ) intervention.users.add(user) - return redirect("intervention:open", id=id) + return redirect("intervention:detail", id=id) else: messages.error( request, @@ -470,4 +480,49 @@ def record_view(request: HttpRequest, id: str): request, msg_succ, msg_error=_("There are errors on this intervention:") - ) \ No newline at end of file + ) + + +def report_view(request:HttpRequest, id: str): + """ Renders the public report view + + Args: + request (HttpRequest): The incoming request + id (str): The id of the intervention + + Returns: + + """ + template = "intervention/report/report.html" + intervention = get_object_or_404(Intervention, id=id) + + # If intervention is not recorded (yet or currently) we need to render another template without any data + if not intervention.recorded: + template = "report/unavailable.html" + return render(request, template, {}) + + # Prepare data for map viewer + geom_form = SimpleGeomForm( + instance=intervention + ) + + distinct_deductions = intervention.deductions.all().distinct( + "account" + ) + qrcode_img = generate_qr_code( + request.build_absolute_uri(reverse("intervention:report", args=(id,))), + 10 + ) + qrcode_img_lanis = generate_qr_code( + intervention.get_LANIS_link(), + 7 + ) + context = { + "obj": intervention, + "deductions": distinct_deductions, + "qrcode": qrcode_img, + "qrcode_lanis": qrcode_img_lanis, + "geom_form": geom_form, + } + context = BaseContext(request, context).context + return render(request, template, context) diff --git a/konova/contexts.py b/konova/contexts.py index b8ca6d68..b415889b 100644 --- a/konova/contexts.py +++ b/konova/contexts.py @@ -8,6 +8,7 @@ Created on: 16.11.20 from django.http import HttpRequest from konova.sub_settings.context_settings import BASE_TITLE, HELP_LINK, BASE_FRONTEND_TITLE +from konova.sub_settings.django_settings import LANGUAGE_CODE class BaseContext: @@ -17,7 +18,7 @@ class BaseContext: context = { "base_title": BASE_TITLE, "base_frontend_title": BASE_FRONTEND_TITLE, - "language": "en", + "language": LANGUAGE_CODE, "user": None, "current_role": None, "help_link": HELP_LINK, diff --git a/konova/models.py b/konova/models.py index ab4ad7ae..f9f87584 100644 --- a/konova/models.py +++ b/konova/models.py @@ -149,7 +149,7 @@ class BaseObject(BaseResource): """ if hasattr(self, "users"): - return self.users.filter(username=user.username).exists() + return self.users.filter(id=user.id) else: return User.objects.none() diff --git a/konova/settings.py b/konova/settings.py index 3ed751a7..51e5bade 100644 --- a/konova/settings.py +++ b/konova/settings.py @@ -69,3 +69,14 @@ ETS_GROUP = "Conservation office" # Needed to redirect to LANIS ## Values to be inserted are [zoom_level, x_coord, y_coord] LANIS_LINK_TEMPLATE = "https://geodaten.naturschutz.rlp.de/kartendienste_naturschutz/index.php?lang=de&zl={}&x={}&y={}&bl=tk_rlp_tms_grau&bo=1&lo=0.8,0.8,0.8,0.6,0.8,0.8,0.8,0.8,0.8&layers=eiv_f,eiv_l,eiv_p,kom_f,kom_l,kom_p,oek_f,ema_f,mae&service=kartendienste_naturschutz" +## This look up table (LUT) defines different zoom levels on the size of the calculate area of a geometry. +LANIS_ZOOM_LUT = { + 1000000000: 6, + 100000000: 10, + 10000000: 17, + 1000000: 20, + 100000: 25, + 10000: 28, + 1000: 30, + 500: 31, +} diff --git a/konova/sub_settings/django_settings.py b/konova/sub_settings/django_settings.py index 568492f5..29540d4b 100644 --- a/konova/sub_settings/django_settings.py +++ b/konova/sub_settings/django_settings.py @@ -10,7 +10,7 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.1/ref/settings/ """ import os -from pathlib import Path +from django.utils.translation import gettext_lazy as _ # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = os.path.dirname( @@ -78,12 +78,12 @@ if DEBUG: MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', + "django.middleware.locale.LocaleMiddleware", 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', - "django.middleware.locale.LocaleMiddleware", ] if DEBUG: MIDDLEWARE += [ @@ -149,6 +149,10 @@ AUTH_PASSWORD_VALIDATORS = [ # https://docs.djangoproject.com/en/3.1/topics/i18n/ LANGUAGE_CODE = 'de' +LANGUAGES = [ + ('de', _('German')), + ('en', _('English')), +] USE_THOUSAND_SEPARATOR = True diff --git a/compensation/templates/compensation/detail/compensation/includes/comment.html b/konova/templates/konova/comment_card.html similarity index 81% rename from compensation/templates/compensation/detail/compensation/includes/comment.html rename to konova/templates/konova/comment_card.html index aff3dec8..0cc91bf0 100644 --- a/compensation/templates/compensation/detail/compensation/includes/comment.html +++ b/konova/templates/konova/comment_card.html @@ -1,5 +1,10 @@ {% load i18n fontawesome_5 %} +{% comment %} + Used in e.g. reports and detail views for every model which supports comment field (BaseObject derived) +{% endcomment %} + + {% if obj.comment %}
diff --git a/konova/utils/generators.py b/konova/utils/generators.py index dfae78f7..e8cc9d2d 100644 --- a/konova/utils/generators.py +++ b/konova/utils/generators.py @@ -7,6 +7,10 @@ Created on: 09.11.20 """ import random import string +import qrcode +import qrcode.image.svg + +from io import BytesIO def generate_random_string(length: int, use_numbers: bool = False, use_letters_lc: bool = False, use_letters_uc: bool = False) -> str: @@ -24,3 +28,24 @@ def generate_random_string(length: int, use_numbers: bool = False, use_letters_l elements = "".join(elements) ret_val = "".join(random.choice(elements) for i in range(length)) return ret_val + + +def generate_qr_code(content: str, size: int = 20) -> str: + """ Generates a qr code from given content + + Args: + content (str): The content for the qr code + size (int): The image size + + Returns: + qrcode_svg (str): The qr code as svg + """ + qrcode_factory = qrcode.image.svg.SvgImage + qrcode_img = qrcode.make( + content, + image_factory=qrcode_factory, + box_size=size + ) + stream = BytesIO() + qrcode_img.save(stream) + return stream.getvalue().decode() diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index 4e29c29e..b9d3ebde 100644 Binary files a/locale/de/LC_MESSAGES/django.mo and b/locale/de/LC_MESSAGES/django.mo differ diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index d50cd07e..aebd7445 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -19,7 +19,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-13 08:46+0200\n" +"POT-Creation-Date: 2021-10-14 09:12+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -50,12 +50,17 @@ msgstr "Automatisch generiert" #: compensation/templates/compensation/detail/compensation/view.html:31 #: compensation/templates/compensation/detail/eco_account/includes/documents.html:28 #: compensation/templates/compensation/detail/eco_account/view.html:31 +#: compensation/templates/compensation/report/compensation/report.html:12 +#: compensation/templates/compensation/report/eco_account/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 -#: intervention/templates/intervention/detail/view.html:31 konova/forms.py:336 +#: intervention/templates/intervention/detail/view.html:31 +#: intervention/templates/intervention/report/report.html:12 +#: konova/forms.py:336 msgid "Title" msgstr "Bezeichnung" @@ -85,22 +90,19 @@ msgstr "Auswählen..." #: compensation/forms/forms.py:73 compensation/forms/modalForms.py:61 #: compensation/forms/modalForms.py:272 compensation/forms/modalForms.py:367 #: compensation/templates/compensation/detail/compensation/includes/actions.html:34 -#: compensation/templates/compensation/detail/compensation/includes/comment.html:11 #: compensation/templates/compensation/detail/compensation/includes/deadlines.html:34 #: compensation/templates/compensation/detail/compensation/includes/documents.html:31 #: compensation/templates/compensation/detail/eco_account/includes/actions.html:34 -#: compensation/templates/compensation/detail/eco_account/includes/comment.html:11 #: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:34 #: compensation/templates/compensation/detail/eco_account/includes/documents.html:31 #: ema/templates/ema/detail/includes/actions.html:34 #: ema/templates/ema/detail/includes/deadlines.html:34 #: ema/templates/ema/detail/includes/documents.html:31 #: intervention/forms/forms.py:179 intervention/forms/modalForms.py:132 -#: intervention/templates/intervention/detail/includes/comment.html:11 #: intervention/templates/intervention/detail/includes/documents.html:31 #: intervention/templates/intervention/detail/includes/payments.html:34 #: intervention/templates/intervention/detail/includes/revocation.html:38 -#: konova/forms.py:371 +#: konova/forms.py:371 konova/templates/konova/comment_card.html:16 msgid "Comment" msgstr "Kommentar" @@ -110,8 +112,11 @@ 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 +#: compensation/templates/compensation/report/eco_account/report.html:16 +#: ema/templates/ema/detail/view.html:42 +#: ema/templates/ema/report/report.html:16 intervention/forms/forms.py:101 #: intervention/templates/intervention/detail/view.html:56 +#: intervention/templates/intervention/report/report.html:37 msgid "Conservation office" msgstr "Eintragungsstelle" @@ -121,8 +126,11 @@ 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 +#: compensation/templates/compensation/report/eco_account/report.html:20 +#: ema/templates/ema/detail/view.html:46 +#: ema/templates/ema/report/report.html:20 intervention/forms/forms.py:129 #: intervention/templates/intervention/detail/view.html:60 +#: intervention/templates/intervention/report/report.html:41 msgid "Conservation office file number" msgstr "Aktenzeichen Eintragungsstelle" @@ -144,6 +152,7 @@ msgstr "Firma Mustermann" #: compensation/forms/forms.py:146 #: compensation/templates/compensation/detail/compensation/view.html:35 +#: compensation/templates/compensation/report/compensation/report.html:16 msgid "compensates intervention" msgstr "kompensiert Eingriff" @@ -294,11 +303,11 @@ msgid "Select the action type" msgstr "Maßnahmentyp wählen" #: compensation/forms/modalForms.py:334 -#: compensation/templates/compensation/detail/compensation/includes/actions.html:37 -#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:37 -#: compensation/templates/compensation/detail/compensation/includes/documents.html:34 -#: compensation/templates/compensation/detail/compensation/includes/states-after.html:39 -#: compensation/templates/compensation/detail/compensation/includes/states-before.html:39 +#: compensation/templates/compensation/detail/compensation/includes/actions.html:38 +#: 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 #: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:37 #: compensation/templates/compensation/detail/eco_account/includes/deductions.html:40 @@ -310,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" @@ -373,14 +382,14 @@ msgstr "" msgid "Pieces" msgstr "Stück" -#: compensation/models.py:312 +#: compensation/models.py:311 msgid "" "Deductable surface can not be larger than existing surfaces in after states" msgstr "" "Die abbuchbare Fläche darf die Gesamtfläche der Zielzustände nicht " "überschreiten" -#: compensation/models.py:319 +#: compensation/models.py:318 msgid "" "Deductable surface can not be smaller than the sum of already existing " "deductions. Please contact the responsible users for the deductions!" @@ -417,6 +426,7 @@ msgstr "Zuletzt bearbeitet" #: compensation/tables.py:62 #: intervention/templates/intervention/detail/includes/compensations.html:8 +#: intervention/templates/intervention/report/report.html:49 msgid "Compensations" msgstr "Kompensationen" @@ -427,7 +437,7 @@ msgstr "Öffne {}" #: compensation/tables.py:84 #: compensation/templates/compensation/detail/compensation/view.html:19 -#: konova/templates/konova/home.html:49 templates/navbar.html:28 +#: konova/templates/konova/home.html:49 templates/navbars/navbar.html:28 msgid "Compensation" msgstr "Kompensation" @@ -443,13 +453,13 @@ msgstr "Am {} von {} geprüft worden" #: compensation/templates/compensation/detail/compensation/view.html:60 #: compensation/templates/compensation/detail/eco_account/view.html:47 #: ema/tables.py:101 ema/templates/ema/detail/view.html:31 -#: intervention/models.py:379 intervention/tables.py:131 +#: intervention/models.py:384 intervention/tables.py:131 #: intervention/templates/intervention/detail/view.html:85 msgid "Not recorded yet" msgstr "Noch nicht verzeichnet" #: compensation/tables.py:134 compensation/tables.py:263 ema/tables.py:106 -#: intervention/models.py:384 intervention/tables.py:136 +#: intervention/models.py:389 intervention/tables.py:136 msgid "Recorded on {} by {}" msgstr "Am {} von {} verzeichnet worden" @@ -476,7 +486,7 @@ msgstr "Ökokonten" #: compensation/tables.py:225 #: compensation/templates/compensation/detail/eco_account/view.html:19 #: intervention/forms/modalForms.py:258 intervention/forms/modalForms.py:265 -#: konova/templates/konova/home.html:88 templates/navbar.html:34 +#: konova/templates/konova/home.html:88 templates/navbars/navbar.html:34 msgid "Eco-account" msgstr "Ökokonto" @@ -511,7 +521,7 @@ msgctxt "Compensation" msgid "Amount" msgstr "Menge" -#: compensation/templates/compensation/detail/compensation/includes/actions.html:51 +#: compensation/templates/compensation/detail/compensation/includes/actions.html:53 #: compensation/templates/compensation/detail/eco_account/includes/actions.html:51 #: ema/templates/ema/detail/includes/actions.html:51 msgid "Remove action" @@ -571,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" @@ -592,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" @@ -626,8 +636,8 @@ msgstr "Fehlende Flächenmengen laut Ausgangszustand: " msgid "Biotope type" msgstr "Biotoptyp" -#: compensation/templates/compensation/detail/compensation/includes/states-after.html:52 -#: compensation/templates/compensation/detail/compensation/includes/states-before.html:52 +#: compensation/templates/compensation/detail/compensation/includes/states-after.html:54 +#: compensation/templates/compensation/detail/compensation/includes/states-before.html:54 #: compensation/templates/compensation/detail/eco_account/includes/states-after.html:52 #: compensation/templates/compensation/detail/eco_account/includes/states-before.html:52 #: ema/templates/ema/detail/includes/states-after.html:52 @@ -676,20 +686,33 @@ msgstr "Verzeichnet am" #: compensation/templates/compensation/detail/compensation/view.html:71 #: compensation/templates/compensation/detail/eco_account/view.html:70 +#: compensation/templates/compensation/report/compensation/report.html:24 +#: compensation/templates/compensation/report/eco_account/report.html:28 #: ema/templates/ema/detail/view.html:54 +#: ema/templates/ema/report/report.html:28 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 +#: compensation/templates/compensation/report/eco_account/report.html:35 +#: compensation/templates/compensation/report/eco_account/report.html:49 #: ema/templates/ema/detail/view.html:62 +#: ema/templates/ema/report/report.html:35 +#: intervention/templates/intervention/report/report.html:57 +#: intervention/templates/intervention/report/report.html:78 msgid "None" 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:37 +#: compensation/templates/compensation/report/eco_account/report.html:54 #: 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" msgstr "Zuletzt bearbeitet" @@ -733,7 +756,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" @@ -760,85 +783,111 @@ 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 -msgid "Intervention handler" -msgstr "Eingriffsverursacher" +#: compensation/templates/compensation/report/eco_account/report.html:24 +#: ema/templates/ema/detail/view.html:50 +#: ema/templates/ema/report/report.html:24 +msgid "Action handler" +msgstr "Maßnahmenträger" -#: compensation/views/compensation_views.py:76 +#: compensation/templates/compensation/report/compensation/report.html:7 +#: compensation/templates/compensation/report/eco_account/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:58 +#: compensation/templates/compensation/report/eco_account/report.html:75 +#: 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:62 +#: compensation/templates/compensation/report/eco_account/report.html:79 +#: ema/templates/ema/report/report.html:66 +#: intervention/templates/intervention/report/report.html:112 +msgid "View in LANIS" +msgstr "In LANIS öffnen" + +#: compensation/templates/compensation/report/eco_account/report.html:41 +msgid "Deductions for" +msgstr "Abbuchungen für" + +#: compensation/views/compensation_views.py:77 msgid "Compensation {} added" msgstr "Kompensation {} hinzugefügt" -#: compensation/views/compensation_views.py:131 +#: compensation/views/compensation_views.py:132 msgid "Compensation {} edited" msgstr "Kompensation {} bearbeitet" -#: compensation/views/compensation_views.py:210 -#: compensation/views/eco_account_views.py:277 ema/views.py:174 -#: intervention/views.py:427 +#: 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:231 +#: compensation/views/compensation_views.py:234 msgid "Compensation removed" msgstr "Kompensation entfernt" -#: compensation/views/compensation_views.py:250 -#: compensation/views/eco_account_views.py:376 ema/views.py:327 -#: intervention/views.py:123 +#: 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:306 -#: compensation/views/eco_account_views.py:320 ema/views.py:271 +#: 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:325 -#: compensation/views/eco_account_views.py:339 ema/views.py:290 +#: 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:344 -#: compensation/views/eco_account_views.py:358 ema/views.py:309 +#: 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:363 +#: compensation/views/compensation_views.py:366 msgid "State removed" msgstr "Zustand gelöscht" -#: compensation/views/compensation_views.py:382 +#: compensation/views/compensation_views.py:385 msgid "Action removed" msgstr "Maßnahme entfernt" -#: compensation/views/eco_account_views.py:86 +#: compensation/views/eco_account_views.py:87 msgid "Eco-Account {} added" msgstr "Ökokonto {} hinzugefügt" -#: compensation/views/eco_account_views.py:141 +#: compensation/views/eco_account_views.py:142 msgid "Eco-Account {} edited" msgstr "Ökokonto {} bearbeitet" -#: compensation/views/eco_account_views.py:227 +#: compensation/views/eco_account_views.py:228 msgid "Eco-account removed" msgstr "Ökokonto entfernt" -#: compensation/views/eco_account_views.py:254 +#: compensation/views/eco_account_views.py:255 msgid "Deduction removed" msgstr "Abbuchung entfernt" -#: compensation/views/eco_account_views.py:297 ema/views.py:248 -#: intervention/views.py:467 +#: compensation/views/eco_account_views.py:298 ema/views.py:249 +#: intervention/views.py:468 msgid "{} unrecorded" msgstr "{} entzeichnet" -#: compensation/views/eco_account_views.py:297 ema/views.py:248 -#: intervention/views.py:467 +#: compensation/views/eco_account_views.py:298 ema/views.py:249 +#: intervention/views.py:468 msgid "{} recorded" msgstr "{} verzeichnet" -#: compensation/views/eco_account_views.py:433 intervention/views.py:449 +#: compensation/views/eco_account_views.py:434 intervention/views.py:450 msgid "Deduction added" msgstr "Abbuchung hinzugefügt" @@ -858,7 +907,7 @@ msgstr "Neue EMA hinzufügen" msgid "Edit EMA" msgstr "Bearbeite EMA" -#: ema/tables.py:59 templates/navbar.html:43 +#: ema/tables.py:59 templates/navbars/navbar.html:43 msgid "Payment funded compensations" msgstr "Ersatzzahlungsmaßnahmen (EMA)" @@ -870,7 +919,7 @@ msgstr "" "Maßnahmen aus Ersatzzahlungen, die nach 2015 rechtskräftig wurden, werden " "durch die Stiftung Natur und Umwelt verwaltet." -#: ema/tables.py:82 templates/navbar.html:43 +#: ema/tables.py:82 templates/navbars/navbar.html:43 msgid "EMA" msgstr "" @@ -878,15 +927,15 @@ msgstr "" msgid "Payment funded compensation" msgstr "Ersatzzahlungsmaßnahme" -#: ema/views.py:77 +#: ema/views.py:78 msgid "EMA {} added" msgstr "EMA {} hinzugefügt" -#: ema/views.py:201 +#: ema/views.py:202 msgid "EMA {} edited" msgstr "EMA {} bearbeitet" -#: ema/views.py:231 +#: ema/views.py:232 msgid "EMA removed" msgstr "EMA entfernt" @@ -912,11 +961,13 @@ msgstr "Bauvorhaben XY; Flur ABC" #: intervention/forms/forms.py:51 #: intervention/templates/intervention/detail/view.html:35 +#: intervention/templates/intervention/report/report.html:16 msgid "Process type" msgstr "Verfahrenstyp" #: intervention/forms/forms.py:68 #: intervention/templates/intervention/detail/view.html:39 +#: intervention/templates/intervention/report/report.html:20 msgid "Law" msgstr "Gesetz" @@ -926,11 +977,13 @@ msgstr "Mehrfachauswahl möglich" #: intervention/forms/forms.py:85 #: intervention/templates/intervention/detail/view.html:48 +#: intervention/templates/intervention/report/report.html:29 msgid "Registration office" msgstr "Zulassungsbehörde" #: intervention/forms/forms.py:117 #: intervention/templates/intervention/detail/view.html:52 +#: intervention/templates/intervention/report/report.html:33 msgid "Registration office file number" msgstr "Aktenzeichen Zulassungsbehörde" @@ -938,17 +991,25 @@ msgstr "Aktenzeichen Zulassungsbehörde" msgid "ZB-123/ABC.456" msgstr "" +#: intervention/forms/forms.py:141 +#: intervention/templates/intervention/detail/view.html:64 +#: intervention/templates/intervention/report/report.html:45 +msgid "Intervention handler" +msgstr "Eingriffsverursacher" + #: intervention/forms/forms.py:145 msgid "Who performs the intervention" msgstr "Wer führt den Eingriff durch" #: intervention/forms/forms.py:154 #: intervention/templates/intervention/detail/view.html:96 +#: intervention/templates/intervention/report/report.html:83 msgid "Registration date" msgstr "Datum Zulassung bzw. Satzungsbeschluss" #: intervention/forms/forms.py:166 #: intervention/templates/intervention/detail/view.html:100 +#: intervention/templates/intervention/report/report.html:87 msgid "Binding on" msgstr "Datum Bestandskraft" @@ -1027,7 +1088,7 @@ msgstr "Nur verzeichnete Ökokonten können für Abbuchungen verwendet werden." #: intervention/forms/modalForms.py:285 intervention/forms/modalForms.py:292 #: intervention/tables.py:88 #: intervention/templates/intervention/detail/view.html:19 -#: konova/templates/konova/home.html:11 templates/navbar.html:22 +#: konova/templates/konova/home.html:11 templates/navbars/navbar.html:22 msgid "Intervention" msgstr "Eingriff" @@ -1059,37 +1120,37 @@ msgstr "" "Das Ökokonto {} hat für eine Abbuchung von {} m² nicht ausreichend " "Restfläche. Es stehen noch {} m² zur Verfügung." -#: intervention/models.py:325 +#: intervention/models.py:324 msgid "Registration office file number missing" msgstr "Aktenzeichen Zulassungsbehörde fehlt" -#: intervention/models.py:328 +#: intervention/models.py:327 msgid "Conservation office file number missing" msgstr "Aktenzeichen Naturschutzbehörde fehlt" -#: intervention/models.py:331 +#: intervention/models.py:330 msgid "Responsible data missing" msgstr "Daten zu Verantwortlichen fehlen" -#: intervention/models.py:345 +#: intervention/models.py:344 msgid "Revocation exists" msgstr "Widerspruch liegt vor" -#: intervention/models.py:348 +#: intervention/models.py:347 msgid "Registration date missing" msgstr "Datum Zulassung bzw. Satzungsbeschluss fehlt" -#: intervention/models.py:351 +#: intervention/models.py:350 msgid "Binding on missing" msgstr "Datum Bestandskraft fehlt" -#: intervention/models.py:353 +#: intervention/models.py:352 msgid "Legal data missing" 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" @@ -1110,7 +1171,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" @@ -1118,15 +1179,16 @@ 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!" #: intervention/templates/intervention/detail/includes/payments.html:8 +#: intervention/templates/intervention/report/report.html:73 msgid "Payments" msgstr "Ersatzzahlungen" @@ -1139,7 +1201,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" @@ -1148,7 +1210,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" @@ -1156,15 +1218,23 @@ msgstr "Widerspruch entfernen" msgid "Exists" msgstr "vorhanden" -#: intervention/views.py:76 +#: intervention/templates/intervention/report/report.html:62 +msgid "Deductions of eco-accounts" +msgstr "Abbuchungen von Ökokonten" + +#: intervention/templates/intervention/report/report.html:76 +msgid "Exist" +msgstr "Vorhanden" + +#: intervention/views.py:77 msgid "Intervention {} added" msgstr "Eingriff {} hinzugefügt" -#: intervention/views.py:211 +#: intervention/views.py:212 msgid "This intervention has a revocation from {}" msgstr "Es existiert ein Widerspruch vom {}" -#: intervention/views.py:227 +#: intervention/views.py:228 msgid "" "Remember: This data has not been shared with you, yet. This means you can " "only read but can not edit or perform any actions like running a check or " @@ -1174,43 +1244,43 @@ msgstr "" "bedeutet, dass Sie nur lesenden Zugriff hierauf haben und weder bearbeiten, " "noch Prüfungen durchführen oder verzeichnen können." -#: intervention/views.py:254 +#: intervention/views.py:255 msgid "Intervention {} edited" msgstr "Eingriff {} bearbeitet" -#: intervention/views.py:286 +#: intervention/views.py:287 msgid "{} removed" msgstr "{} entfernt" -#: intervention/views.py:307 +#: intervention/views.py:308 msgid "Revocation removed" msgstr "Widerspruch entfernt" -#: intervention/views.py:333 +#: intervention/views.py:334 msgid "{} has already been shared with you" msgstr "{} wurde bereits für Sie freigegeben" -#: intervention/views.py:338 +#: intervention/views.py:339 msgid "{} has been shared with you" msgstr "{} ist nun für Sie freigegeben" -#: intervention/views.py:345 +#: intervention/views.py:346 msgid "Share link invalid" msgstr "Freigabelink ungültig" -#: intervention/views.py:366 +#: intervention/views.py:367 msgid "Share settings updated" msgstr "Freigabe Einstellungen aktualisiert" -#: intervention/views.py:385 +#: intervention/views.py:386 msgid "Check performed" msgstr "Prüfung durchgeführt" -#: intervention/views.py:405 +#: intervention/views.py:406 msgid "Revocation added" msgstr "Widerspruch hinzugefügt" -#: intervention/views.py:472 +#: intervention/views.py:473 msgid "There are errors on this intervention:" msgstr "Es liegen Fehler in diesem Eingriff vor:" @@ -1293,27 +1363,27 @@ msgid "I, {} {}, confirm that this data must be unrecorded." msgstr "" "Ich, {} {}, bestätige, dass diese Daten wieder entzeichnet werden müssen." -#: konova/management/commands/setup_data.py:41 +#: konova/management/commands/setup_data.py:26 msgid "On new related data" msgstr "Wenn neue Daten für mich angelegt werden" -#: konova/management/commands/setup_data.py:42 +#: konova/management/commands/setup_data.py:27 msgid "On disabled share link" msgstr "Wenn ein Freigabelink deaktiviert wird" -#: konova/management/commands/setup_data.py:43 +#: konova/management/commands/setup_data.py:28 msgid "On shared access removed" msgstr "Wenn mir eine Freigabe zu Daten entzogen wird" -#: konova/management/commands/setup_data.py:44 +#: konova/management/commands/setup_data.py:29 msgid "On shared data recorded" msgstr "Wenn meine freigegebenen Daten verzeichnet wurden" -#: konova/management/commands/setup_data.py:45 +#: konova/management/commands/setup_data.py:30 msgid "On shared data deleted" msgstr "Wenn meine freigegebenen Daten gelöscht wurden" -#: konova/management/commands/setup_data.py:46 +#: konova/management/commands/setup_data.py:31 msgid "On registered data edited" msgstr "Wenn meine freigegebenen Daten bearbeitet wurden" @@ -1540,42 +1610,59 @@ msgstr "Keine Geometrie vorhanden" msgid "Continue" msgstr "Weiter" -#: templates/navbar.html:4 +#: templates/navbars/navbar.html:4 msgid "Kompensationsverzeichnis Service Portal" msgstr "" -#: templates/navbar.html:5 +#: templates/navbars/navbar.html:5 msgid "KSP" msgstr "" -#: templates/navbar.html:16 +#: templates/navbars/navbar.html:16 msgid "Home" msgstr "Home" -#: templates/navbar.html:40 +#: templates/navbars/navbar.html:40 msgid "More" msgstr "Mehr" -#: templates/navbar.html:44 +#: templates/navbars/navbar.html:44 msgid "Import..." msgstr "" -#: templates/navbar.html:45 +#: templates/navbars/navbar.html:45 msgid "Export..." msgstr "" -#: templates/navbar.html:46 +#: templates/navbars/navbar.html:46 msgid "Reports" msgstr "Berichte" -#: templates/navbar.html:58 user/templates/user/index.html:31 +#: templates/navbars/navbar.html:58 user/templates/user/index.html:31 msgid "Settings" msgstr "Einstellungen" -#: templates/navbar.html:59 +#: templates/navbars/navbar.html:59 msgid "Logout" msgstr "Abmelden" +#: templates/report/unavailable.html:6 +msgid "Unrecorded data" +msgstr "Daten nicht veröffentlicht" + +#: templates/report/unavailable.html:9 +msgid "" +"\n" +" The data you want to see is not recorded and might still be work " +"in progress. Please come back another time.\n" +" " +msgstr "" +"\n" +" Die Daten, die Sie einsehen möchten, sind in Bearbeitung und " +"daher aktuell nicht öffentlich einsehbar. Schauen Sie zu einem späteren " +"Zeitpunkt wieder vorbei. \n" +" " + #: user/forms.py:23 msgid "Notifications" msgstr "Benachrichtigungen" @@ -2342,71 +2429,71 @@ msgstr "" #: venv/lib/python3.7/site-packages/django/utils/dates.py:6 msgid "Monday" -msgstr "" +msgstr "Montag" #: venv/lib/python3.7/site-packages/django/utils/dates.py:6 msgid "Tuesday" -msgstr "" +msgstr "Dienstag" #: venv/lib/python3.7/site-packages/django/utils/dates.py:6 msgid "Wednesday" -msgstr "" +msgstr "Mittwoch" #: venv/lib/python3.7/site-packages/django/utils/dates.py:6 msgid "Thursday" -msgstr "" +msgstr "Donnerstag" #: venv/lib/python3.7/site-packages/django/utils/dates.py:6 msgid "Friday" -msgstr "" +msgstr "Freitag" #: venv/lib/python3.7/site-packages/django/utils/dates.py:7 msgid "Saturday" -msgstr "" +msgstr "Samstag" #: venv/lib/python3.7/site-packages/django/utils/dates.py:7 msgid "Sunday" -msgstr "" +msgstr "Sonntag" #: venv/lib/python3.7/site-packages/django/utils/dates.py:10 msgid "Mon" -msgstr "" +msgstr "Mo" #: venv/lib/python3.7/site-packages/django/utils/dates.py:10 msgid "Tue" -msgstr "" +msgstr "Di" #: venv/lib/python3.7/site-packages/django/utils/dates.py:10 msgid "Wed" -msgstr "" +msgstr "Mi" #: venv/lib/python3.7/site-packages/django/utils/dates.py:10 msgid "Thu" -msgstr "" +msgstr "Do" #: venv/lib/python3.7/site-packages/django/utils/dates.py:10 msgid "Fri" -msgstr "" +msgstr "Fr" #: venv/lib/python3.7/site-packages/django/utils/dates.py:11 msgid "Sat" -msgstr "" +msgstr "Sa" #: venv/lib/python3.7/site-packages/django/utils/dates.py:11 msgid "Sun" -msgstr "" +msgstr "So" #: venv/lib/python3.7/site-packages/django/utils/dates.py:14 msgid "January" -msgstr "" +msgstr "Januar" #: venv/lib/python3.7/site-packages/django/utils/dates.py:14 msgid "February" -msgstr "" +msgstr "Februar" #: venv/lib/python3.7/site-packages/django/utils/dates.py:14 msgid "March" -msgstr "" +msgstr "März" #: venv/lib/python3.7/site-packages/django/utils/dates.py:14 msgid "April" @@ -2414,15 +2501,15 @@ msgstr "" #: venv/lib/python3.7/site-packages/django/utils/dates.py:14 msgid "May" -msgstr "" +msgstr "Mai" #: venv/lib/python3.7/site-packages/django/utils/dates.py:14 msgid "June" -msgstr "" +msgstr "Juni" #: venv/lib/python3.7/site-packages/django/utils/dates.py:15 msgid "July" -msgstr "" +msgstr "Juli" #: venv/lib/python3.7/site-packages/django/utils/dates.py:15 msgid "August" @@ -2434,7 +2521,7 @@ msgstr "" #: venv/lib/python3.7/site-packages/django/utils/dates.py:15 msgid "October" -msgstr "" +msgstr "Oktober" #: venv/lib/python3.7/site-packages/django/utils/dates.py:15 msgid "November" @@ -2442,7 +2529,7 @@ msgstr "" #: venv/lib/python3.7/site-packages/django/utils/dates.py:16 msgid "December" -msgstr "" +msgstr "Dezember" #: venv/lib/python3.7/site-packages/django/utils/dates.py:19 msgid "jan" @@ -2454,7 +2541,7 @@ msgstr "" #: venv/lib/python3.7/site-packages/django/utils/dates.py:19 msgid "mar" -msgstr "" +msgstr "mär" #: venv/lib/python3.7/site-packages/django/utils/dates.py:19 msgid "apr" @@ -2462,7 +2549,7 @@ msgstr "" #: venv/lib/python3.7/site-packages/django/utils/dates.py:19 msgid "may" -msgstr "" +msgstr "mai" #: venv/lib/python3.7/site-packages/django/utils/dates.py:19 msgid "jun" @@ -2482,7 +2569,7 @@ msgstr "" #: venv/lib/python3.7/site-packages/django/utils/dates.py:20 msgid "oct" -msgstr "" +msgstr "okt" #: venv/lib/python3.7/site-packages/django/utils/dates.py:20 msgid "nov" @@ -2490,7 +2577,7 @@ msgstr "" #: venv/lib/python3.7/site-packages/django/utils/dates.py:20 msgid "dec" -msgstr "" +msgstr "dez" #: venv/lib/python3.7/site-packages/django/utils/dates.py:23 msgctxt "abbrev. month" @@ -2505,7 +2592,7 @@ msgstr "" #: venv/lib/python3.7/site-packages/django/utils/dates.py:25 msgctxt "abbrev. month" msgid "March" -msgstr "" +msgstr "Mär" #: venv/lib/python3.7/site-packages/django/utils/dates.py:26 msgctxt "abbrev. month" @@ -2515,17 +2602,17 @@ msgstr "" #: venv/lib/python3.7/site-packages/django/utils/dates.py:27 msgctxt "abbrev. month" msgid "May" -msgstr "" +msgstr "Mai" #: venv/lib/python3.7/site-packages/django/utils/dates.py:28 msgctxt "abbrev. month" msgid "June" -msgstr "" +msgstr "Juni" #: venv/lib/python3.7/site-packages/django/utils/dates.py:29 msgctxt "abbrev. month" msgid "July" -msgstr "" +msgstr "Juli" #: venv/lib/python3.7/site-packages/django/utils/dates.py:30 msgctxt "abbrev. month" @@ -2540,7 +2627,7 @@ msgstr "" #: venv/lib/python3.7/site-packages/django/utils/dates.py:32 msgctxt "abbrev. month" msgid "Oct." -msgstr "" +msgstr "Okt." #: venv/lib/python3.7/site-packages/django/utils/dates.py:33 msgctxt "abbrev. month" @@ -2550,22 +2637,22 @@ msgstr "" #: venv/lib/python3.7/site-packages/django/utils/dates.py:34 msgctxt "abbrev. month" msgid "Dec." -msgstr "" +msgstr "Dez." #: venv/lib/python3.7/site-packages/django/utils/dates.py:37 msgctxt "alt. month" msgid "January" -msgstr "" +msgstr "Januar" #: venv/lib/python3.7/site-packages/django/utils/dates.py:38 msgctxt "alt. month" msgid "February" -msgstr "" +msgstr "Februar" #: venv/lib/python3.7/site-packages/django/utils/dates.py:39 msgctxt "alt. month" msgid "March" -msgstr "" +msgstr "März" #: venv/lib/python3.7/site-packages/django/utils/dates.py:40 msgctxt "alt. month" @@ -2575,17 +2662,17 @@ msgstr "" #: venv/lib/python3.7/site-packages/django/utils/dates.py:41 msgctxt "alt. month" msgid "May" -msgstr "" +msgstr "Mai" #: venv/lib/python3.7/site-packages/django/utils/dates.py:42 msgctxt "alt. month" msgid "June" -msgstr "" +msgstr "Juni" #: venv/lib/python3.7/site-packages/django/utils/dates.py:43 msgctxt "alt. month" msgid "July" -msgstr "" +msgstr "Juli" #: venv/lib/python3.7/site-packages/django/utils/dates.py:44 msgctxt "alt. month" @@ -2600,7 +2687,7 @@ msgstr "" #: venv/lib/python3.7/site-packages/django/utils/dates.py:46 msgctxt "alt. month" msgid "October" -msgstr "" +msgstr "Oktober" #: venv/lib/python3.7/site-packages/django/utils/dates.py:47 msgctxt "alt. month" @@ -2610,7 +2697,7 @@ msgstr "" #: venv/lib/python3.7/site-packages/django/utils/dates.py:48 msgctxt "alt. month" msgid "December" -msgstr "" +msgstr "Dezember" #: venv/lib/python3.7/site-packages/django/utils/ipv6.py:8 msgid "This is not a valid IPv6 address." @@ -2624,7 +2711,7 @@ msgstr "" #: venv/lib/python3.7/site-packages/django/utils/text.py:236 msgid "or" -msgstr "" +msgstr "oder" #. Translators: This string is used as a separator between list elements #: venv/lib/python3.7/site-packages/django/utils/text.py:255 @@ -2953,9 +3040,6 @@ msgstr "" #~ msgid "Show eco-accounts" #~ msgstr "Zeige Ökokonten" -#~ msgid "Deduct from eco-account" -#~ msgstr "Von Konto abbuchen" - #~ msgid "You are currently working as " #~ msgstr "Sie arbeiten gerade als " diff --git a/templates/base.html b/templates/base.html index 1816e05a..e728405a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -20,7 +20,7 @@
{% block header %} - {% include 'navbar.html' %} + {% include 'navbars/navbar.html' %} {% endblock %}
diff --git a/templates/navbar.html b/templates/navbars/navbar.html similarity index 100% rename from templates/navbar.html rename to templates/navbars/navbar.html diff --git a/templates/navbars/public_navbar.html b/templates/navbars/public_navbar.html new file mode 100644 index 00000000..ec6db7c6 --- /dev/null +++ b/templates/navbars/public_navbar.html @@ -0,0 +1,8 @@ + + \ No newline at end of file diff --git a/templates/public_base.html b/templates/public_base.html new file mode 100644 index 00000000..d09d74b8 --- /dev/null +++ b/templates/public_base.html @@ -0,0 +1,44 @@ + +{% load static i18n l10n fontawesome_5 bootstrap4 %} + + + + + {{ base_frontend_title }} + + {% bootstrap_css %} + {% bootstrap_javascript jquery='full' %} + {% fontawesome_5_static %} + + + {% block head %} + {% endblock %} + + + +
+ {% block header %} + {% include 'navbars/public_navbar.html' %} + {% endblock %} +
+
+
+ {% for message in messages %} +
+ {{ message }} +
+ {% endfor %} +
+ + {% block body %} + + {% endblock %} +
+ + {% block footer %} + + {% endblock %} + + + + \ No newline at end of file diff --git a/templates/report/unavailable.html b/templates/report/unavailable.html new file mode 100644 index 00000000..87b1ecb9 --- /dev/null +++ b/templates/report/unavailable.html @@ -0,0 +1,14 @@ +{% extends 'public_base.html' %} +{% load i18n %} + +{% block body %} +
+

{% trans 'Unrecorded data' %}

+
+

+ {% blocktrans %} + The data you want to see is not recorded and might still be work in progress. Please come back another time. + {% endblocktrans %} +

+
+{% endblock %} \ No newline at end of file