#86 Parcel district column for all

* adds parcel district column for all major data objects
* adds warning about intervention-revocation on index view of compensations
* adds warning about intervention-revocation on detail view of related compensations
pull/111/head
mpeltriaux 3 years ago
parent 5e79f16e1e
commit 402bc2d6f3

@ -21,7 +21,7 @@ from konova.contexts import BaseContext
from konova.forms import BaseModalForm, NewDocumentForm, RemoveModalForm
from konova.models import DeadlineType
from konova.utils.message_templates import FORM_INVALID, ADDED_COMPENSATION_STATE, ADDED_DEADLINE, \
ADDED_COMPENSATION_ACTION, PAYMENT_ADDED
ADDED_COMPENSATION_ACTION
class NewPaymentForm(BaseModalForm):

@ -22,7 +22,7 @@ from konova.models import BaseObject, AbstractDocument, Deadline, generate_docum
from konova.settings import DEFAULT_SRID_RLP, LANIS_LINK_TEMPLATE
from konova.utils.message_templates import DATA_UNSHARED_EXPLANATION, COMPENSATION_REMOVED_TEMPLATE, \
DOCUMENT_REMOVED_TEMPLATE, COMPENSATION_EDITED_TEMPLATE, DEADLINE_REMOVED, ADDED_DEADLINE, \
COMPENSATION_ACTION_REMOVED, COMPENSATION_STATE_REMOVED
COMPENSATION_ACTION_REMOVED, COMPENSATION_STATE_REMOVED, INTERVENTION_HAS_REVOCATIONS_TEMPLATE
from user.models import UserActionLogEntry
@ -390,6 +390,26 @@ class Compensation(AbstractCompensation, CEFMixin, CoherenceMixin):
"""
return self.intervention.is_ready_for_publish()
def set_status_messages(self, request: HttpRequest):
""" Setter for different information that need to be rendered
Adds messages to the given HttpRequest
Args:
request (HttpRequest): The incoming request
Returns:
request (HttpRequest): The modified request
"""
if self.intervention.legal.revocations.exists():
messages.error(
request,
INTERVENTION_HAS_REVOCATIONS_TEMPLATE.format(self.intervention.legal.revocations.count()),
extra_tags="danger",
)
super().set_status_messages(request)
return request
class CompensationDocument(AbstractDocument):
"""

@ -31,6 +31,11 @@ class CompensationTable(BaseTable, TableRenderMixin):
orderable=True,
accessor="title",
)
d = tables.Column(
verbose_name=_("Parcel gmrkng"),
orderable=True,
accessor="geometry",
)
c = tables.Column(
verbose_name=_("Checked"),
orderable=True,
@ -80,14 +85,17 @@ class CompensationTable(BaseTable, TableRenderMixin):
Returns:
"""
html = ""
html += self.render_link(
tooltip=_("Open {}").format(_("Compensation")),
href=reverse("compensation:detail", args=(record.id,)),
txt=value,
new_tab=False,
context = {
"tooltip": _("Open {}").format(_("Intervention")),
"content": value,
"url": reverse("compensation:detail", args=(record.id,)),
"has_revocations": record.intervention.legal.revocations.exists()
}
html = render_to_string(
"table/revocation_warning_col.html",
context
)
return format_html(html)
return html
def render_c(self, value, record: Compensation):
""" Renders the checked column for a compensation
@ -115,6 +123,28 @@ class CompensationTable(BaseTable, TableRenderMixin):
)
return format_html(html)
def render_d(self, value, record: Compensation):
""" Renders the parcel district column for a compensation
Args:
value (str): The geometry
record (Compensation): The compensation record
Returns:
"""
parcels = value.parcels.values_list(
"gmrkng",
flat=True
).distinct()
html = render_to_string(
"table/gmrkng_col.html",
{
"entries": parcels
}
)
return html
def render_r(self, value, record: Compensation):
""" Renders the registered column for a compensation
@ -173,10 +203,20 @@ class EcoAccountTable(BaseTable, TableRenderMixin):
orderable=True,
accessor="title",
)
d = tables.Column(
verbose_name=_("Parcel gmrkng"),
orderable=True,
accessor="geometry",
)
av = tables.Column(
verbose_name=_("Available"),
orderable=True,
empty_values=[],
attrs={
"th": {
"class": "w-20",
}
}
)
r = tables.Column(
verbose_name=_("Recorded"),
@ -244,6 +284,28 @@ class EcoAccountTable(BaseTable, TableRenderMixin):
html = render_to_string("konova/widgets/progressbar.html", {"value": value_relative})
return format_html(html)
def render_d(self, value, record: Compensation):
""" Renders the parcel district column for a compensation
Args:
value (str): The geometry
record (Compensation): The compensation record
Returns:
"""
parcels = value.parcels.values_list(
"gmrkng",
flat=True
).distinct()
html = render_to_string(
"table/gmrkng_col.html",
{
"entries": parcels
}
)
return html
def render_r(self, value, record: EcoAccount):
""" Renders the recorded column for an eco account

@ -6,6 +6,7 @@ Created on: 19.08.21
"""
from django.http import HttpRequest
from django.template.loader import render_to_string
from django.utils.html import format_html
from django.utils.timezone import localtime
from django.utils.translation import gettext_lazy as _
@ -34,6 +35,11 @@ class EmaTable(BaseTable, TableRenderMixin):
orderable=True,
accessor="title",
)
d = tables.Column(
verbose_name=_("Parcel gmrkng"),
orderable=True,
accessor="geometry",
)
r = tables.Column(
verbose_name=_("Recorded"),
orderable=True,
@ -87,6 +93,29 @@ class EmaTable(BaseTable, TableRenderMixin):
)
return format_html(html)
def render_d(self, value, record: Ema):
""" Renders the parcel district column for a ema
Args:
value (str): The geometry
record (Ema): The ema record
Returns:
"""
parcels = value.parcels.values_list(
"gmrkng",
flat=True
).distinct()
html = render_to_string(
"table/gmrkng_col.html",
{
"entries": parcels
}
)
return html
def render_r(self, value, record: Ema):
""" Renders the registered column for a EMA

@ -26,7 +26,7 @@ from konova.models import generate_document_file_upload_path, AbstractDocument,
RecordableObjectMixin, CheckableObjectMixin, GeoReferencedMixin
from konova.settings import LANIS_LINK_TEMPLATE, LANIS_ZOOM_LUT, DEFAULT_SRID_RLP
from konova.utils.message_templates import DATA_UNSHARED_EXPLANATION, DOCUMENT_REMOVED_TEMPLATE, \
PAYMENT_REMOVED, PAYMENT_ADDED, REVOCATION_REMOVED
PAYMENT_REMOVED, PAYMENT_ADDED, REVOCATION_REMOVED, INTERVENTION_HAS_REVOCATIONS_TEMPLATE
from user.models import UserActionLogEntry
@ -276,6 +276,13 @@ class Intervention(BaseObject, ShareableObjectMixin, RecordableObjectMixin, Chec
Returns:
request (HttpRequest): The modified request
"""
# Inform user about revocation
if self.legal.revocations.exists():
messages.error(
request,
INTERVENTION_HAS_REVOCATIONS_TEMPLATE.format(self.legal.revocations.count()),
extra_tags="danger",
)
if not self.is_shared_with(request.user):
messages.info(request, DATA_UNSHARED_EXPLANATION)
request = self.set_geometry_conflict_message(request)

@ -245,14 +245,6 @@ def detail_view(request: HttpRequest, id: str):
parcels = intervention.get_underlying_parcels()
# Inform user about revocation
if intervention.legal.revocations.exists():
messages.error(
request,
_("This intervention has {} revocations").format(intervention.legal.revocations.count()),
extra_tags="danger",
)
context = {
"obj": intervention,
"compensations": compensations,

@ -219,6 +219,13 @@ Overwrites bootstrap .btn:focus box shadow color
overflow: auto;
}
.w-20{
width: 20%;
}
.w-10{
width: 20%;
}
/*
Extends css for django autocomplete light (dal)
No other approach worked to get the autocomplete fields to full width of parent containers

@ -62,3 +62,6 @@ ADDED_DEADLINE = _("Added deadline")
# Geometry conflicts
GEOMETRY_CONFLICT_WITH_TEMPLATE = _("Geometry conflict detected with {}")
# INTERVENTION
INTERVENTION_HAS_REVOCATIONS_TEMPLATE = _("This intervention has {} revocations")

Binary file not shown.

@ -26,7 +26,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-08 14:48+0100\n"
"POT-Creation-Date: 2022-02-08 15:16+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -136,7 +136,7 @@ msgstr "Zuständigkeitsbereich"
#: analysis/templates/analysis/reports/includes/intervention/amount.html:17
#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:8
#: analysis/templates/analysis/reports/includes/intervention/laws.html:17
#: compensation/tables.py:35
#: compensation/tables.py:40
#: compensation/templates/compensation/detail/compensation/view.html:63
#: intervention/tables.py:39
#: intervention/templates/intervention/detail/view.html:68
@ -152,11 +152,11 @@ msgstr "Geprüft"
#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:9
#: analysis/templates/analysis/reports/includes/intervention/laws.html:20
#: analysis/templates/analysis/reports/includes/old_data/amount.html:18
#: compensation/tables.py:41 compensation/tables.py:182
#: compensation/tables.py:46 compensation/tables.py:219
#: compensation/templates/compensation/detail/compensation/view.html:77
#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:31
#: compensation/templates/compensation/detail/eco_account/view.html:44
#: ema/tables.py:38 ema/templates/ema/detail/view.html:35
#: ema/tables.py:44 ema/templates/ema/detail/view.html:35
#: intervention/tables.py:45
#: intervention/templates/intervention/detail/view.html:82
#: user/models/user_action.py:21
@ -196,7 +196,7 @@ msgid "Other registration office"
msgstr "Andere Zulassungsbehörden"
#: analysis/templates/analysis/reports/includes/compensation/card_compensation.html:11
#: compensation/tables.py:62
#: compensation/tables.py:67
#: intervention/templates/intervention/detail/includes/compensations.html:8
#: intervention/templates/intervention/report/report.html:49
msgid "Compensations"
@ -239,7 +239,7 @@ msgstr "Kompensationsart"
#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:15
#: analysis/templates/analysis/reports/includes/old_data/amount.html:29
#: compensation/tables.py:85
#: compensation/tables.py:90
#: compensation/templates/compensation/detail/compensation/view.html:19
#: konova/templates/konova/includes/quickstart/compensations.html:4
#: templates/navbars/navbar.html:28
@ -285,7 +285,7 @@ msgstr "Typ"
#: analysis/templates/analysis/reports/includes/old_data/amount.html:24
#: intervention/forms/modalForms.py:322 intervention/forms/modalForms.py:329
#: intervention/tables.py:89
#: intervention/tables.py:88
#: intervention/templates/intervention/detail/view.html:19
#: konova/templates/konova/includes/quickstart/interventions.html:4
#: templates/navbars/navbar.html:22
@ -293,7 +293,7 @@ msgid "Intervention"
msgstr "Eingriff"
#: analysis/templates/analysis/reports/includes/old_data/amount.html:34
#: compensation/tables.py:226
#: compensation/tables.py:263
#: compensation/templates/compensation/detail/eco_account/view.html:19
#: intervention/forms/modalForms.py:295 intervention/forms/modalForms.py:302
#: konova/templates/konova/includes/quickstart/ecoaccounts.html:4
@ -314,7 +314,7 @@ msgid "Show only unrecorded"
msgstr "Nur unverzeichnete anzeigen"
#: compensation/forms/forms.py:32 compensation/tables.py:25
#: compensation/tables.py:167 ema/tables.py:28 intervention/forms/forms.py:28
#: compensation/tables.py:194 ema/tables.py:29 intervention/forms/forms.py:28
#: intervention/tables.py:24
#: intervention/templates/intervention/detail/includes/compensations.html:30
msgid "Identifier"
@ -326,14 +326,14 @@ msgid "Generated automatically"
msgstr "Automatisch generiert"
#: compensation/forms/forms.py:44 compensation/tables.py:30
#: compensation/tables.py:172
#: compensation/tables.py:199
#: compensation/templates/compensation/detail/compensation/includes/documents.html:28
#: 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/tables.py:34 ema/templates/ema/detail/includes/documents.html:28
#: ema/templates/ema/detail/view.html:31
#: ema/templates/ema/report/report.html:12 intervention/forms/forms.py:40
#: intervention/tables.py:29
@ -657,65 +657,70 @@ msgstr ""
"Es wurde bereits mehr Fläche abgebucht, als Sie nun als abbuchbar einstellen "
"wollen. Kontaktieren Sie die für die Abbuchungen verantwortlichen Nutzer!"
#: compensation/tables.py:47 compensation/tables.py:188 ema/tables.py:44
#: compensation/tables.py:35 compensation/tables.py:204 ema/tables.py:39
#: intervention/tables.py:34 konova/filters/mixins.py:98
msgid "Parcel gmrkng"
msgstr "Gemarkung"
#: compensation/tables.py:52 compensation/tables.py:225 ema/tables.py:50
#: intervention/tables.py:51
msgid "Editable"
msgstr "Freigegeben"
#: compensation/tables.py:53 compensation/tables.py:194 ema/tables.py:50
#: compensation/tables.py:58 compensation/tables.py:231 ema/tables.py:56
#: intervention/tables.py:57
msgid "Last edit"
msgstr "Zuletzt bearbeitet"
#: compensation/tables.py:85 compensation/tables.py:226 ema/tables.py:83
#: intervention/tables.py:89
#: compensation/tables.py:90 compensation/tables.py:263 ema/tables.py:89
#: intervention/tables.py:88
msgid "Open {}"
msgstr "Öffne {}"
#: compensation/tables.py:106 intervention/tables.py:108
#: compensation/tables.py:111 intervention/tables.py:111
msgid "Not checked yet"
msgstr "Noch nicht geprüft"
#: compensation/tables.py:111 intervention/tables.py:113
#: compensation/tables.py:116 intervention/tables.py:116
msgid "Checked on {} by {}"
msgstr "Am {} von {} geprüft worden"
#: compensation/tables.py:130
#: compensation/tables.py:157
#: compensation/templates/compensation/detail/compensation/view.html:80
#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:58
#: compensation/templates/compensation/detail/eco_account/view.html:47
#: ema/tables.py:102 ema/templates/ema/detail/view.html:38
#: intervention/tables.py:146
#: ema/tables.py:131 ema/templates/ema/detail/view.html:38
#: intervention/tables.py:157
#: intervention/templates/intervention/detail/view.html:85
msgid "Not recorded yet"
msgstr "Noch nicht verzeichnet"
#: compensation/tables.py:135 compensation/tables.py:264 ema/tables.py:107
#: intervention/tables.py:151
#: compensation/tables.py:162 compensation/tables.py:323 ema/tables.py:136
#: intervention/tables.py:162
msgid "Recorded on {} by {}"
msgstr "Am {} von {} verzeichnet worden"
#: compensation/tables.py:159 compensation/tables.py:286 ema/tables.py:130
#: intervention/tables.py:174
#: compensation/tables.py:186 compensation/tables.py:345 ema/tables.py:159
#: intervention/tables.py:185
msgid "Full access granted"
msgstr "Für Sie freigegeben - Datensatz kann bearbeitet werden"
#: compensation/tables.py:159 compensation/tables.py:286 ema/tables.py:130
#: intervention/tables.py:174
#: compensation/tables.py:186 compensation/tables.py:345 ema/tables.py:159
#: intervention/tables.py:185
msgid "Access not granted"
msgstr "Nicht freigegeben - Datensatz nur lesbar"
#: compensation/tables.py:177
#: compensation/tables.py:209
#: compensation/templates/compensation/detail/eco_account/view.html:35
#: konova/templates/konova/widgets/progressbar.html:3
msgid "Available"
msgstr "Verfügbar"
#: compensation/tables.py:203
#: compensation/tables.py:240
msgid "Eco Accounts"
msgstr "Ökokonten"
#: compensation/tables.py:259
#: compensation/tables.py:318
msgid "Not recorded yet. Can not be used for deductions, yet."
msgstr ""
"Noch nicht verzeichnet. Kann noch nicht für Abbuchungen genutzt werden."
@ -1149,11 +1154,11 @@ msgstr "Neue EMA hinzufügen"
msgid "Edit EMA"
msgstr "Bearbeite EMA"
#: ema/tables.py:59 templates/navbars/navbar.html:43
#: ema/tables.py:65 templates/navbars/navbar.html:43
msgid "Payment funded compensations"
msgstr "Ersatzzahlungsmaßnahmen (EMA)"
#: ema/tables.py:60
#: ema/tables.py:66
msgid "EMA explanation"
msgstr ""
"EMA sind Kompensationen, die durch Ersatzzahlungen finanziert wurden. "
@ -1161,7 +1166,7 @@ msgstr ""
"Maßnahmen aus Ersatzzahlungen, die nach 2015 rechtskräftig wurden, werden "
"durch die Stiftung Natur und Umwelt verwaltet."
#: ema/tables.py:83 templates/navbars/navbar.html:43
#: ema/tables.py:89 templates/navbars/navbar.html:43
msgid "EMA"
msgstr ""
@ -1349,10 +1354,6 @@ msgstr ""
"Das Ökokonto {} hat für eine Abbuchung von {} m² nicht ausreichend "
"Restfläche. Es stehen noch {} m² zur Verfügung."
#: intervention/tables.py:34 konova/filters/mixins.py:98
msgid "Parcel gmrkng"
msgstr "Gemarkung"
#: intervention/templates/intervention/detail/includes/compensations.html:14
msgid "Add new compensation"
msgstr "Neue Kompensation hinzufügen"
@ -1421,18 +1422,8 @@ msgstr "Abbuchungen von Ökokonten"
msgid "Exist"
msgstr "Vorhanden"
#: intervention/templates/intervention/table/gmrkng_col.html:6
msgid ""
"\n"
"If the geometry is not empty, the parcels are currently recalculated. Please "
"refresh this page in a few moments."
msgstr ""
"\n"
"Falls die Geometrie nicht leer ist, werden die Flurstücke aktuell berechnet. "
"Bitte laden Sie diese Seite in ein paar Augenblicken erneut... \n"
" "
#: intervention/utils/quality.py:70
#: templates/table/revocation_warning_col.html:5
msgid "Revocations exists"
msgstr "Widersprüche liegen vor"
@ -2265,6 +2256,14 @@ msgstr ""
"wieder vorbei. \n"
" "
#: templates/table/gmrkng_col.html:6
msgid ""
"If the geometry is not empty, the parcels are currently recalculated. Please "
"refresh this page in a few moments."
msgstr ""
"Falls die Geometrie nicht leer ist, werden die Flurstücke aktuell berechnet. "
"Bitte laden Sie diese Seite in ein paar Augenblicken erneut..."
#: user/forms.py:27
msgid "Notifications"
msgstr "Benachrichtigungen"

Loading…
Cancel
Save