Compare commits
No commits in common. "b57d52dc9f6ffe3d451296884a06e3d23ceb6ab3" and "7235110b7db666b5ecff7a8fa8862555ae91fbff" have entirely different histories.
b57d52dc9f
...
7235110b7d
@ -14,11 +14,11 @@ from django.utils.translation import gettext_lazy as _
|
||||
from compensation.filters.compensation import CompensationTableFilter
|
||||
from compensation.models import Compensation
|
||||
from konova.utils.message_templates import DATA_IS_UNCHECKED, DATA_CHECKED_ON_TEMPLATE, DATA_CHECKED_PREVIOUSLY_TEMPLATE
|
||||
from konova.utils.tables import BaseTable, TableRenderMixin, TableOrderMixin
|
||||
from konova.utils.tables import BaseTable, TableRenderMixin
|
||||
import django_tables2 as tables
|
||||
|
||||
|
||||
class CompensationTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
class CompensationTable(BaseTable, TableRenderMixin):
|
||||
id = tables.Column(
|
||||
verbose_name=_("Identifier"),
|
||||
orderable=True,
|
||||
@ -31,7 +31,7 @@ class CompensationTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
)
|
||||
d = tables.Column(
|
||||
verbose_name=_("Parcel gmrkng"),
|
||||
orderable=False,
|
||||
orderable=True,
|
||||
accessor="geometry",
|
||||
)
|
||||
c = tables.Column(
|
||||
@ -126,6 +126,28 @@ class CompensationTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
)
|
||||
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.get_underlying_parcels().values_list(
|
||||
"parcel_group__name",
|
||||
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
|
||||
|
||||
@ -148,3 +170,20 @@ class CompensationTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
)
|
||||
return format_html(html)
|
||||
|
||||
def render_e(self, value, record: Compensation):
|
||||
""" Renders the editable column for a compensation
|
||||
|
||||
Args:
|
||||
value (str): The identifier value
|
||||
record (Compensation): The compensation record
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
has_access = record.is_shared_with(self.user)
|
||||
|
||||
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",
|
||||
)
|
||||
return format_html(html)
|
||||
|
@ -13,12 +13,12 @@ from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from compensation.filters.eco_account import EcoAccountTableFilter
|
||||
from compensation.models import EcoAccount
|
||||
from konova.utils.tables import TableRenderMixin, BaseTable, TableOrderMixin
|
||||
from konova.utils.tables import TableRenderMixin, BaseTable
|
||||
|
||||
import django_tables2 as tables
|
||||
|
||||
|
||||
class EcoAccountTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
class EcoAccountTable(BaseTable, TableRenderMixin):
|
||||
id = tables.Column(
|
||||
verbose_name=_("Identifier"),
|
||||
orderable=True,
|
||||
@ -31,7 +31,7 @@ class EcoAccountTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
)
|
||||
d = tables.Column(
|
||||
verbose_name=_("Parcel gmrkng"),
|
||||
orderable=False,
|
||||
orderable=True,
|
||||
accessor="geometry",
|
||||
)
|
||||
av = tables.Column(
|
||||
@ -113,6 +113,28 @@ class EcoAccountTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
html = render_to_string("konova/widgets/progressbar.html", {"value": value_relative})
|
||||
return format_html(html)
|
||||
|
||||
def render_d(self, value, record):
|
||||
""" Renders the parcel district column for a compensation
|
||||
|
||||
Args:
|
||||
value (str): The geometry
|
||||
record (Compensation): The compensation record
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
parcels = value.get_underlying_parcels().values_list(
|
||||
"parcel_group__name",
|
||||
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
|
||||
|
||||
@ -134,3 +156,23 @@ class EcoAccountTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
icn_filled=checked,
|
||||
)
|
||||
return format_html(html)
|
||||
|
||||
def render_e(self, value, record: EcoAccount):
|
||||
""" Renders the editable column for an eco account
|
||||
|
||||
Args:
|
||||
value (str): The identifier value
|
||||
record (EcoAccount): The eco account record
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
html = ""
|
||||
# Do not use value in here, since value does use unprefetched 'users' manager, where record has already
|
||||
# prefetched users data
|
||||
has_access = record.is_shared_with(self.user)
|
||||
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",
|
||||
)
|
||||
return format_html(html)
|
||||
|
@ -6,18 +6,21 @@ 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 _
|
||||
from django.urls import reverse
|
||||
|
||||
import django_tables2 as tables
|
||||
|
||||
from konova.utils.tables import BaseTable, TableRenderMixin, TableOrderMixin
|
||||
from konova.sub_settings.django_settings import DEFAULT_DATE_TIME_FORMAT
|
||||
from konova.utils.tables import BaseTable, TableRenderMixin
|
||||
from ema.filters import EmaTableFilter
|
||||
from ema.models import Ema
|
||||
|
||||
|
||||
class EmaTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
class EmaTable(BaseTable, TableRenderMixin):
|
||||
"""
|
||||
Since EMA and compensation are basically the same, we can reuse CompensationTableFilter and extend the EMA filter
|
||||
in the future by inheriting.
|
||||
@ -34,7 +37,7 @@ class EmaTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
)
|
||||
d = tables.Column(
|
||||
verbose_name=_("Parcel gmrkng"),
|
||||
orderable=False,
|
||||
orderable=True,
|
||||
accessor="geometry",
|
||||
)
|
||||
r = tables.Column(
|
||||
@ -90,6 +93,28 @@ class EmaTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
)
|
||||
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.get_underlying_parcels().values_list(
|
||||
"parcel_group__name",
|
||||
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
|
||||
|
||||
@ -111,3 +136,22 @@ class EmaTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
icn_filled=recorded,
|
||||
)
|
||||
return format_html(html)
|
||||
|
||||
def render_e(self, value, record: Ema):
|
||||
""" Renders the editable column for a EMA
|
||||
|
||||
Args:
|
||||
value (str): The identifier value
|
||||
record (Ema): The EMA record
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
html = ""
|
||||
has_access = record.is_shared_with(self.user)
|
||||
|
||||
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",
|
||||
)
|
||||
return format_html(html)
|
||||
|
@ -39,8 +39,9 @@ def index_view(request: HttpRequest):
|
||||
template = "generic_index.html"
|
||||
emas = Ema.objects.filter(
|
||||
deleted=None,
|
||||
).order_by(
|
||||
"-modified"
|
||||
)
|
||||
|
||||
table = EmaTable(
|
||||
request,
|
||||
queryset=emas
|
||||
|
@ -14,11 +14,11 @@ from django.utils.translation import gettext_lazy as _
|
||||
from intervention.filters import InterventionTableFilter
|
||||
from intervention.models import Intervention
|
||||
from konova.utils.message_templates import DATA_CHECKED_ON_TEMPLATE, DATA_IS_UNCHECKED, DATA_CHECKED_PREVIOUSLY_TEMPLATE
|
||||
from konova.utils.tables import BaseTable, TableRenderMixin, TableOrderMixin
|
||||
from konova.utils.tables import BaseTable, TableRenderMixin
|
||||
import django_tables2 as tables
|
||||
|
||||
|
||||
class InterventionTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
class InterventionTable(BaseTable, TableRenderMixin):
|
||||
id = tables.Column(
|
||||
verbose_name=_("Identifier"),
|
||||
orderable=True,
|
||||
@ -31,7 +31,7 @@ class InterventionTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
)
|
||||
d = tables.Column(
|
||||
verbose_name=_("Parcel gmrkng"),
|
||||
orderable=False,
|
||||
orderable=True,
|
||||
accessor="geometry",
|
||||
)
|
||||
c = tables.Column(
|
||||
@ -124,6 +124,28 @@ class InterventionTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
)
|
||||
return format_html(html)
|
||||
|
||||
def render_d(self, value, record: Intervention):
|
||||
""" Renders the parcel district column for an intervention
|
||||
|
||||
Args:
|
||||
value (str): The intervention geometry
|
||||
record (Intervention): The intervention record
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
parcels = value.get_underlying_parcels().values_list(
|
||||
"parcel_group__name",
|
||||
flat=True
|
||||
).distinct()
|
||||
html = render_to_string(
|
||||
"table/gmrkng_col.html",
|
||||
{
|
||||
"entries": parcels
|
||||
}
|
||||
)
|
||||
return html
|
||||
|
||||
def render_r(self, value, record: Intervention):
|
||||
""" Renders the recorded column for an intervention
|
||||
|
||||
@ -146,3 +168,22 @@ class InterventionTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
)
|
||||
return format_html(html)
|
||||
|
||||
def render_e(self, value, record: Intervention):
|
||||
""" Renders the editable column for an intervention
|
||||
|
||||
Args:
|
||||
value (str): The identifier value
|
||||
record (Intervention): The intervention record
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
html = ""
|
||||
has_access = record.is_shared_with(self.user)
|
||||
|
||||
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",
|
||||
)
|
||||
return format_html(html)
|
||||
|
||||
|
@ -10,5 +10,5 @@ BASE_TITLE_SHORT = "KSP"
|
||||
BASE_TITLE = "KSP - Kompensationsverzeichnis Service Portal"
|
||||
BASE_FRONTEND_TITLE = "Kompensationsverzeichnis Service Portal"
|
||||
TAB_TITLE_IDENTIFIER = "tab_title"
|
||||
HELP_LINK = "https://dienste.naturschutz.rlp.de/doku/doku.php?id=ksp2:start"
|
||||
HELP_LINK = "https://dienste.naturschutz.rlp.de/doku/doku.php?id=ksp:start"
|
||||
IMPRESSUM_LINK = "https://naturschutz.rlp.de/index.php?q=impressum"
|
||||
|
@ -1,8 +1,7 @@
|
||||
{% load i18n l10n fontawesome_5 %}
|
||||
{% load i18n l10n %}
|
||||
<div class="table-container w-100 scroll-300">
|
||||
{% if parcels|length == 0 %}
|
||||
<article class="alert alert-info">
|
||||
{% fa5_icon 'search-location' %}
|
||||
{% trans 'Parcels can not be calculated, since no geometry is given.' %}
|
||||
</article>
|
||||
{% else %}
|
||||
|
@ -7,14 +7,11 @@ Created on: 25.11.20
|
||||
"""
|
||||
|
||||
from django.core.paginator import PageNotAnInteger, EmptyPage
|
||||
from django.db.models import F
|
||||
from django.http import HttpRequest
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.html import format_html
|
||||
import django_tables2 as tables
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from konova.models import BaseObject, GeoReferencedMixin, ShareableObjectMixin
|
||||
from konova.models import BaseObject
|
||||
from konova.settings import PAGE_SIZE_DEFAULT, PAGE_PARAM, RESULTS_PER_PAGE_PARAM, PAGE_SIZE_OPTIONS
|
||||
|
||||
|
||||
@ -177,55 +174,3 @@ class TableRenderMixin:
|
||||
if len(value) > max_length:
|
||||
value = f"{value[:max_length]}..."
|
||||
return value
|
||||
|
||||
def render_d(self, value, record: GeoReferencedMixin):
|
||||
""" Renders the parcel district column
|
||||
|
||||
Args:
|
||||
value (str): The intervention geometry
|
||||
record (GeoReferencedMixin): The record
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
parcels = value.get_underlying_parcels().values_list(
|
||||
"parcel_group__name",
|
||||
flat=True
|
||||
).distinct()
|
||||
html = render_to_string(
|
||||
"table/gmrkng_col.html",
|
||||
{
|
||||
"entries": parcels,
|
||||
"geometry": record.geometry
|
||||
}
|
||||
)
|
||||
return html
|
||||
|
||||
def render_e(self, value, record: ShareableObjectMixin):
|
||||
""" Renders the editable column
|
||||
|
||||
Args:
|
||||
value (str): The identifier value
|
||||
record (ShareableObjectMixin): The record
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
html = ""
|
||||
has_access = record.is_shared_with(self.user)
|
||||
|
||||
html += self.render_icn(
|
||||
tooltip=_("Full access granted") if has_access else _("Access not granted"),
|
||||
icn_class="fas fa-share-alt rlp-r-inv" if has_access else "",
|
||||
)
|
||||
return format_html(html)
|
||||
|
||||
|
||||
class TableOrderMixin:
|
||||
"""
|
||||
Holds different order_by methods for general purposes
|
||||
|
||||
"""
|
||||
def order_lm(self, queryset, is_asc):
|
||||
queryset = queryset.order_by(F('modified__timestamp').desc(nulls_last=True))
|
||||
return (queryset, is_asc)
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% load i18n fontawesome_5 %}
|
||||
{% load i18n %}
|
||||
|
||||
{% comment %}
|
||||
Encapsules the rendering and initializing of a geometry view component, e.g. used in the detail views.
|
||||
@ -6,10 +6,7 @@
|
||||
|
||||
{% if geom_form.empty %}
|
||||
<div class="w-100">
|
||||
<div class="alert alert-info">
|
||||
{% fa5_icon 'search-location' %}
|
||||
{% trans 'No geometry added, yet.' %}
|
||||
</div>
|
||||
<div class="alert alert-info">{% trans 'No geometry added, yet.' %}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
{% load i18n fontawesome_5 %}
|
||||
|
||||
{% if geometry.geom is not None %}
|
||||
{% for entry in entries %}
|
||||
<span class="badge pill-badge rlp-r">{{entry}}</span>
|
||||
{% empty %}
|
||||
@ -8,9 +7,3 @@
|
||||
{% fa5_icon 'hourglass-half' %}
|
||||
</span>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<span class="text-info" title="{% translate 'No geometry added, yet.' %}">
|
||||
{% fa5_icon 'search-location' %}
|
||||
{% fa5_icon 'question' %}
|
||||
</span>
|
||||
{% endif %}
|
@ -38,6 +38,14 @@
|
||||
</article>
|
||||
<hr>
|
||||
<div class="col-sm">
|
||||
<div class="row mb-2">
|
||||
<a href="{% url 'user:index' %}" title="{% trans 'Change default configuration for your KSP map' %}">
|
||||
<button class="btn btn-default">
|
||||
{% fa5_icon 'layer-group' %}
|
||||
<span>{% trans 'Map settings' %}</span>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<a href="{% url 'user:notifications' %}" title="{% trans 'Change notification configurations' %}">
|
||||
<button class="btn btn-default">
|
||||
|
Loading…
Reference in New Issue
Block a user