EcoAccount detail

* adds detail view for eco account
* adds withdraw detail view to eco acount detail
* generalizes compensation/includes templates to be reusable for eco-accounts
* moves is_shared_with() check to class BaseObject
* adds/updates translations
This commit is contained in:
mipel 2021-08-09 14:39:36 +02:00
parent 3dc2af4b7c
commit d27a39f6d9
20 changed files with 364 additions and 127 deletions

View File

@ -17,7 +17,7 @@ from compensation.settings import COMPENSATION_IDENTIFIER_LENGTH, COMPENSATION_I
from intervention.models import Intervention, ResponsibilityData from intervention.models import Intervention, ResponsibilityData
from konova.models import BaseObject, BaseResource, Geometry, UuidModel from konova.models import BaseObject, BaseResource, Geometry, UuidModel
from konova.utils.generators import generate_random_string from konova.utils.generators import generate_random_string
from user.models import UserActionLogEntry, UserAction from user.models import UserActionLogEntry
class Payment(BaseResource): class Payment(BaseResource):

View File

@ -239,7 +239,7 @@ class EcoAccountTable(BaseTable):
""" """
withdraws = record.withdraws.all() withdraws = record.withdraws.all()
withdraw_surfaces = withdraws.aggregate(Sum("amount"))["amount__sum"] or 0 withdraw_surfaces = withdraws.aggregate(Sum("surface"))["surface__sum"] or 0
after_states_surfaces = record.after_states.all().aggregate(Sum("surface"))["surface__sum"] or withdraw_surfaces ## no division by zero after_states_surfaces = record.after_states.all().aggregate(Sum("surface"))["surface__sum"] or withdraw_surfaces ## no division by zero
value = int(((after_states_surfaces - withdraw_surfaces) / after_states_surfaces) * 100) value = int(((after_states_surfaces - withdraw_surfaces) / after_states_surfaces) * 100)
html = render_to_string("konova/custom_widgets/progressbar.html", {"value": value}) html = render_to_string("konova/custom_widgets/progressbar.html", {"value": value})

View File

@ -0,0 +1,61 @@
{% load i18n l10n fontawesome_5 humanize %}
<div id="eco-account-withdraws" class="card">
<div class="card-header rlp-r">
<div class="row">
<div class="col-sm-6">
<h5>
<span class="badge badge-light">{{obj.withdraws.count}}</span>
{% trans 'Eco Account Withdraws' %}
</h5>
</div>
<div class="col-sm-6">
<div class="d-flex justify-content-end">
{% if is_default_member and has_access %}
<a href="{% url 'compensation:new' %}" title="{% trans 'Add new withdraw' %}">
<button class="btn btn-outline-default">
{% fa5_icon 'plus' %}
{% fa5_icon 'tree' %}
</button>
</a>
{% endif %}
</div>
</div>
</div>
</div>
<div class="card-body scroll-300">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">
{% trans 'Intervention Identifier' %}
</th>
<th scope="col">
{% trans 'Amount' %}
</th>
<th scope="col">
{% trans 'Action' %}
</th>
</tr>
</thead>
<tbody>
{% for withdraw in obj.withdraws.all %}
<tr>
<td class="align-middle">
<a href="{% url 'intervention:open' withdraw.intervention.id %}">
{{ withdraw.intervention.identifier }}
</a>
</td>
<td class="align-middle">{{ withdraw.surface|floatformat:2|intcomma }} m²</td>
<td>
{% if is_default_member and has_access %}
<button data-form-url="{% url 'compensation:withdraw-remove' withdraw.account.id withdraw.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove Withdraw' %}">
{% fa5_icon 'trash' %}
</button>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>

View File

@ -0,0 +1,108 @@
{% extends 'base.html' %}
{% load i18n l10n static fontawesome_5 humanize %}
{% block head %}
{% endblock %}
{% block body %}
<div id="detail-header" class="row">
<div class="col-sm-12 col-md-12 col-lg-6">
<h3>{% trans 'Eco-account' %} {{obj.identifier}}</h3>
</div>
<div class="col-sm-12 col-md-12 col-lg-6">
{% include 'compensation/detail/includes/controls.html' %}
</div>
</div>
<hr>
<div id="data" class="row">
<div class="col-sm-12 col-md-12 col-lg-6">
<div class="table-container">
<table class="table table-hover">
<tr>
<th class="w-25" scope="row">{% trans 'Title' %}</th>
<td class="align-middle">{{obj.title}}</td>
</tr>
<tr>
<th scope="row">{% trans 'Available' %}</th>
<td class="align-middle">
{% with available as value %}
{% include 'konova/custom_widgets/progressbar.html' %}
{% endwith %}
</td>
</tr>
<tr>
<th scope="row">{% trans 'Recorded' %}</th>
<td class="align-middle">
{% if obj.recorded is None %}
<span title="{% trans 'Not recorded yet' %}">
{% fa5_icon 'bookmark' 'far' %}
</span>
{% else %}
<span class="registered-bookmark" title="{% trans 'Recorded on '%} {{obj.recorded.timestamp}} {% trans 'by' %} {{obj.recorded.user}}">
{% fa5_icon 'bookmark' %}
</span>
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans 'Last modified' %}</th>
<td class="align-middle">
{{obj.created.timestamp|default_if_none:""|naturalday}}
<br>
{{obj.created.user.username}}
</td>
</tr>
<tr>
<th scope="row">{% trans 'Shared with' %}</th>
<td class="align-middle">
{% for user in obj.users.all %}
{% include 'user/includes/contact_modal_button.html' %}
{% endfor %}
</td>
</tr>
</table>
</div>
</div>
<div class="col-sm-12 col-md-12 col-lg-6">
{% if geom_form.area == 0 %}
<div class="alert alert-info">{% trans 'No geometry added, yet.' %}</div>
{% endif %}
{{geom_form.media}}
{{geom_form.geom}}
</div>
</div>
<hr>
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-6">
{% include 'compensation/detail/includes/states-before.html' %}
</div>
<div class="col-sm-12 col-md-12 col-lg-6">
{% include 'compensation/detail/includes/states-after.html' %}
</div>
</div>
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-6">
{% include 'compensation/detail/includes/actions.html' %}
</div>
<div class="col-sm-12 col-md-12 col-lg-6">
{% include 'compensation/detail/includes/deadlines.html' %}
</div>
</div>
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-6">
{% include 'compensation/detail/includes/documents.html' %}
</div>
<div class="col-sm-12 col-md-12 col-lg-6">
{% include 'compensation/detail/eco_account/includes/withdraws.html' %}
</div>
</div>
{% with 'btn-modal' as btn_class %}
{% include 'modal/modal_form_script.html' %}
{% endwith %}
{% endblock %}

View File

@ -4,14 +4,14 @@
<div class="row"> <div class="row">
<div class="col-sm-6"> <div class="col-sm-6">
<h5> <h5>
<span class="badge badge-light">{{comp.actions.count}}</span> <span class="badge badge-light">{{obj.actions.count}}</span>
{% trans 'Actions' context 'Compensation' %} {% trans 'Actions' context 'Compensation' %}
</h5> </h5>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="d-flex justify-content-end"> <div class="d-flex justify-content-end">
{% if is_default_member and has_access %} {% if is_default_member and has_access %}
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-action' comp.id %}" title="{% trans 'Add new action' %}"> <button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-action' obj.id %}" title="{% trans 'Add new action' %}">
{% fa5_icon 'plus' %} {% fa5_icon 'plus' %}
{% fa5_icon 'seedling' %} {% fa5_icon 'seedling' %}
</button> </button>
@ -39,7 +39,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for action in comp.actions.all %} {% for action in obj.actions.all %}
<tr> <tr>
<td class="align-middle"> <td class="align-middle">
{{ action.action_type }} {{ action.action_type }}

View File

@ -18,10 +18,10 @@
{% fa5_icon 'edit' %} {% fa5_icon 'edit' %}
</button> </button>
</a> </a>
<button class="btn btn-default btn-modal mr-2" data-form-url="{% url 'compensation:log' comp.id %}" title="{% trans 'Show log' %}"> <button class="btn btn-default btn-modal mr-2" data-form-url="{% url 'compensation:log' obj.id %}" title="{% trans 'Show log' %}">
{% fa5_icon 'history' %} {% fa5_icon 'history' %}
</button> </button>
<button class="btn btn-default btn-modal" data-form-url="{% url 'compensation:remove' comp.id %}" title="{% trans 'Delete' %}"> <button class="btn btn-default btn-modal" data-form-url="{% url 'compensation:remove' obj.id %}" title="{% trans 'Delete' %}">
{% fa5_icon 'trash' %} {% fa5_icon 'trash' %}
</button> </button>
{% endif %} {% endif %}

View File

@ -4,14 +4,14 @@
<div class="row"> <div class="row">
<div class="col-sm-6"> <div class="col-sm-6">
<h5> <h5>
<span class="badge badge-light">{{comp.deadlines.count}}</span> <span class="badge badge-light">{{obj.deadlines.count}}</span>
{% trans 'Deadlines' %} {% trans 'Deadlines' %}
</h5> </h5>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="d-flex justify-content-end"> <div class="d-flex justify-content-end">
{% if is_default_member and has_access %} {% if is_default_member and has_access %}
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-deadline' comp.id %}" title="{% trans 'Add new deadline' %}"> <button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-deadline' obj.id %}" title="{% trans 'Add new deadline' %}">
{% fa5_icon 'plus' %} {% fa5_icon 'plus' %}
{% fa5_icon 'calendar-check' %} {% fa5_icon 'calendar-check' %}
</button> </button>
@ -39,7 +39,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for deadline in comp.deadlines.all %} {% for deadline in obj.deadlines.all %}
<tr> <tr>
<td class="align-middle"> <td class="align-middle">
{% trans deadline.type_humanized %} {% trans deadline.type_humanized %}

View File

@ -4,14 +4,14 @@
<div class="row"> <div class="row">
<div class="col-sm-6"> <div class="col-sm-6">
<h5> <h5>
<span class="badge badge-light">{{comp.documents.count}}</span> <span class="badge badge-light">{{obj.documents.count}}</span>
{% trans 'Documents' %} {% trans 'Documents' %}
</h5> </h5>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="d-flex justify-content-end"> <div class="d-flex justify-content-end">
{% if is_default_member and has_access %} {% if is_default_member and has_access %}
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-doc' comp.id %}" title="{% trans 'Add new document' %}"> <button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-doc' obj.id %}" title="{% trans 'Add new document' %}">
{% fa5_icon 'plus' %} {% fa5_icon 'plus' %}
{% fa5_icon 'file' %} {% fa5_icon 'file' %}
</button> </button>
@ -36,7 +36,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for doc in comp.documents.all %} {% for doc in obj.documents.all %}
<tr> <tr>
<td class="align-middle"> <td class="align-middle">
<a href="{% url 'doc-open' doc.id %}"> <a href="{% url 'doc-open' doc.id %}">

View File

@ -4,14 +4,14 @@
<div class="row"> <div class="row">
<div class="col-sm-6"> <div class="col-sm-6">
<h5> <h5>
<span class="badge badge-light">{{comp.after_states.count}}</span> <span class="badge badge-light">{{obj.after_states.count}}</span>
{% trans 'States after' %} {% trans 'States after' %}
</h5> </h5>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="d-flex justify-content-end"> <div class="d-flex justify-content-end">
{% if is_default_member and has_access %} {% if is_default_member and has_access %}
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-state' comp.id %}" title="{% trans 'Add new state after' %}"> <button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-state' obj.id %}" title="{% trans 'Add new state after' %}">
{% fa5_icon 'plus' %} {% fa5_icon 'plus' %}
{% fa5_icon 'layer-group' %} {% fa5_icon 'layer-group' %}
</button> </button>

View File

@ -4,14 +4,14 @@
<div class="row"> <div class="row">
<div class="col-sm-6"> <div class="col-sm-6">
<h5> <h5>
<span class="badge badge-light">{{comp.before_states.count}}</span> <span class="badge badge-light">{{obj.before_states.count}}</span>
{% trans 'States before' %} {% trans 'States before' %}
</h5> </h5>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="d-flex justify-content-end"> <div class="d-flex justify-content-end">
{% if is_default_member and has_access %} {% if is_default_member and has_access %}
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-state' comp.id %}?before=true" title="{% trans 'Add new state before' %}"> <button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-state' obj.id %}?before=true" title="{% trans 'Add new state before' %}">
{% fa5_icon 'plus' %} {% fa5_icon 'plus' %}
{% fa5_icon 'layer-group' %} {% fa5_icon 'layer-group' %}
</button> </button>

View File

@ -9,7 +9,7 @@
<div id="detail-header" class="row"> <div id="detail-header" class="row">
<div class="col-sm-12 col-md-12 col-lg-6"> <div class="col-sm-12 col-md-12 col-lg-6">
<h3>{% trans 'Compensation' %} {{comp.identifier}}</h3> <h3>{% trans 'Compensation' %} {{obj.identifier}}</h3>
</div> </div>
<div class="col-sm-12 col-md-12 col-lg-6"> <div class="col-sm-12 col-md-12 col-lg-6">
{% include 'compensation/detail/includes/controls.html' %} {% include 'compensation/detail/includes/controls.html' %}
@ -22,25 +22,25 @@
<table class="table table-hover"> <table class="table table-hover">
<tr> <tr>
<th class="w-25" scope="row">{% trans 'Title' %}</th> <th class="w-25" scope="row">{% trans 'Title' %}</th>
<td class="align-middle">{{comp.title}}</td> <td class="align-middle">{{obj.title}}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">{% trans 'compensates intervention' %}</th> <th scope="row">{% trans 'compensates intervention' %}</th>
<td class="align-middle"> <td class="align-middle">
<a href="{% url 'intervention:open' comp.intervention.id %}"> <a href="{% url 'intervention:open' obj.intervention.id %}">
{{comp.intervention.identifier}} {{obj.intervention.identifier}}
</a> </a>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">{% trans 'Checked' %}</th> <th scope="row">{% trans 'Checked' %}</th>
<td class="align-middle"> <td class="align-middle">
{% if comp.intervention.checked is None %} {% if obj.intervention.checked is None %}
<span> <span>
{% fa5_icon 'star' 'far' %} {% fa5_icon 'star' 'far' %}
</span> </span>
{% else %} {% else %}
<span class="check-star" title="{% trans 'Checked on '%} {{comp.intervention.checked.timestamp}} {% trans 'by' %} {{comp.intervention.checked.user}}"> <span class="check-star" title="{% trans 'Checked on '%} {{obj.intervention.checked.timestamp}} {% trans 'by' %} {{obj.intervention.checked.user}}">
{% fa5_icon 'star' %} {% fa5_icon 'star' %}
</span> </span>
{% endif %} {% endif %}
@ -49,12 +49,12 @@
<tr> <tr>
<th scope="row">{% trans 'Recorded' %}</th> <th scope="row">{% trans 'Recorded' %}</th>
<td class="align-middle"> <td class="align-middle">
{% if comp.intervention.recorded is None %} {% if obj.intervention.recorded is None %}
<span title="{% trans 'Not recorded yet' %}"> <span title="{% trans 'Not recorded yet' %}">
{% fa5_icon 'bookmark' 'far' %} {% fa5_icon 'bookmark' 'far' %}
</span> </span>
{% else %} {% else %}
<span class="registered-bookmark" title="{% trans 'Recorded on '%} {{comp.intervention.recorded.timestamp}} {% trans 'by' %} {{comp.intervention.recorded.user}}"> <span class="registered-bookmark" title="{% trans 'Recorded on '%} {{obj.intervention.recorded.timestamp}} {% trans 'by' %} {{obj.intervention.recorded.user}}">
{% fa5_icon 'bookmark' %} {% fa5_icon 'bookmark' %}
</span> </span>
{% endif %} {% endif %}
@ -63,15 +63,15 @@
<tr> <tr>
<th scope="row">{% trans 'Last modified' %}</th> <th scope="row">{% trans 'Last modified' %}</th>
<td class="align-middle"> <td class="align-middle">
{{comp.created.timestamp|default_if_none:""|naturalday}} {{obj.created.timestamp|default_if_none:""|naturalday}}
<br> <br>
{{comp.created.user.username}} {{obj.created.user.username}}
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">{% trans 'Shared with' %}</th> <th scope="row">{% trans 'Shared with' %}</th>
<td class="align-middle"> <td class="align-middle">
{% for user in comp.intervention.users.all %} {% for user in obj.intervention.users.all %}
{% include 'user/includes/contact_modal_button.html' %} {% include 'user/includes/contact_modal_button.html' %}
{% endfor %} {% endfor %}
</td> </td>

View File

@ -84,7 +84,7 @@ def open_view(request: HttpRequest, id: str):
diff_states = abs(sum_before_states - sum_after_states) diff_states = abs(sum_before_states - sum_after_states)
context = { context = {
"comp": comp, "obj": comp,
"geom_form": geom_form, "geom_form": geom_form,
"has_access": is_data_shared, "has_access": is_data_shared,
"before_states": before_states, "before_states": before_states,
@ -142,6 +142,8 @@ def remove_view(request: HttpRequest, id: str):
msg_success=_("Compensation removed"), msg_success=_("Compensation removed"),
redirect_url="", redirect_url="",
) )
@login_required @login_required
def new_document_view(request: HttpRequest, id: str): def new_document_view(request: HttpRequest, id: str):
""" Renders a form for uploading new documents """ Renders a form for uploading new documents

View File

@ -5,6 +5,7 @@ Contact: michel.peltriaux@sgdnord.rlp.de
Created on: 09.08.21 Created on: 09.08.21
""" """
from django.db.models import Sum
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
@ -15,7 +16,9 @@ from compensation.models import EcoAccount
from compensation.tables import EcoAccountTable from compensation.tables import EcoAccountTable
from konova.contexts import BaseContext from konova.contexts import BaseContext
from konova.decorators import any_group_check, default_group_required from konova.decorators import any_group_check, default_group_required
from konova.forms import RemoveModalForm from konova.forms import RemoveModalForm, SimpleGeomForm
from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP
from konova.utils.user_checks import in_group
@login_required @login_required
@ -63,8 +66,52 @@ def account_edit_view(request: HttpRequest, id: str):
@login_required @login_required
@any_group_check @any_group_check
def account_open_view(request: HttpRequest, id: str): def account_open_view(request: HttpRequest, id: str):
# ToDo """ Renders a detail view for a compensation
pass
Args:
request (HttpRequest): The incoming request
id (str): The compensation's id
Returns:
"""
template = "compensation/detail/eco_account/view.html"
acc = get_object_or_404(EcoAccount, 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")
# 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 withdraws
withdraws = acc.withdraws.all()
withdraw_surfaces = withdraws.aggregate(Sum("surface"))["surface__sum"] or 0
available = int(((sum_after_states - withdraw_surfaces) / sum_after_states) * 100)
context = {
"obj": acc,
"geom_form": geom_form,
"has_access": is_data_shared,
"before_states": before_states,
"after_states": after_states,
"sum_before_states": sum_before_states,
"sum_after_states": sum_after_states,
"available": available,
"diff_states": diff_states,
"is_default_member": in_group(_user, DEFAULT_GROUP),
"is_zb_member": in_group(_user, ZB_GROUP),
"is_ets_member": in_group(_user, ETS_GROUP),
}
context = BaseContext(request, context).context
return render(request, template, context)
@login_required @login_required

View File

@ -193,19 +193,6 @@ class Intervention(BaseObject):
self.identifier = new_id self.identifier = new_id
super().save(*args, **kwargs) super().save(*args, **kwargs)
def is_shared_with(self, user: User):
""" Access check
Checks whether a given user has access to this intervention
Args:
user ():
Returns:
"""
return self.users.filter(username=user.username).exists()
def check_validity(self) -> (bool, dict): def check_validity(self) -> (bool, dict):
""" Validity check """ Validity check

View File

@ -1,4 +1,4 @@
{% load i18n l10n fontawesome_5 %} {% load i18n l10n fontawesome_5 humanize %}
<div id="eco-account-withdraws" class="card"> <div id="eco-account-withdraws" class="card">
<div class="card-header rlp-r"> <div class="card-header rlp-r">
<div class="row"> <div class="row">
@ -45,7 +45,7 @@
{{ withdraw.account.identifier }} {{ withdraw.account.identifier }}
</a> </a>
</td> </td>
<td class="align-middle">{{ withdraw.amount|floatformat:2 }} %</td> <td class="align-middle">{{ withdraw.surface|floatformat:2|intcomma }} m²</td>
<td> <td>
{% if is_default_member and has_access %} {% if is_default_member and has_access %}
<button data-form-url="{% url 'compensation:withdraw-remove' withdraw.account.id withdraw.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove Withdraw' %}"> <button data-form-url="{% url 'compensation:withdraw-remove' withdraw.account.id withdraw.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove Withdraw' %}">

View File

@ -131,7 +131,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-12 col-md-12 col-lg-6"> <div class="col-sm-12 col-md-12 col-lg-6">
{% include 'intervention/detail/includes/eco-account-withdraws.html' %} {% include 'intervention/detail/includes/withdraws.html' %}
</div> </div>
<div class="col-sm-12 col-md-12 col-lg-6"> <div class="col-sm-12 col-md-12 col-lg-6">
{% include 'intervention/detail/includes/revocation.html' %} {% include 'intervention/detail/includes/revocation.html' %}

View File

@ -102,6 +102,22 @@ class BaseObject(BaseResource):
) )
self.log.add(user_action) self.log.add(user_action)
def is_shared_with(self, user: User):
""" Access check
Checks whether a given user has access to this object
Args:
user ():
Returns:
"""
if hasattr(self, "users"):
return self.users.filter(username=user.username).exists()
else:
return User.objects.none()
class DeadlineType(models.TextChoices): class DeadlineType(models.TextChoices):
""" """

View File

@ -1,6 +1,6 @@
{% load i18n %} {% load i18n %}
<div class="progress" title="{% trans 'Available: ' %}{{ value }}%"> <div class="progress" title="{% trans 'Available' %}: {{ value }}%">
<div class="progress-bar rlp-r" role="progressbar" style="width: {{ value }}%" aria-valuenow="{{ value }}" aria-valuemin="0" aria-valuemax="100"> <div class="progress-bar rlp-r" role="progressbar" style="width: {{ value }}%" aria-valuenow="{{ value }}" aria-valuemin="0" aria-valuemax="100">
{{ value }} % {{ value }} %
</div> </div>

Binary file not shown.

View File

@ -16,7 +16,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-09 14:12+0200\n" "POT-Creation-Date: 2021-08-09 14:35+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -27,7 +27,8 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: compensation/forms.py:41 compensation/forms.py:260 #: compensation/forms.py:41 compensation/forms.py:260
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:33 #: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:33
#: intervention/templates/intervention/detail/includes/withdraws.html:33
msgid "Amount" msgid "Amount"
msgstr "Menge" msgstr "Menge"
@ -207,6 +208,7 @@ msgid "Identifier"
msgstr "Kennung" msgstr "Kennung"
#: compensation/tables.py:31 compensation/tables.py:171 #: compensation/tables.py:31 compensation/tables.py:171
#: compensation/templates/compensation/detail/eco_account/view.html:24
#: compensation/templates/compensation/detail/includes/documents.html:28 #: compensation/templates/compensation/detail/includes/documents.html:28
#: compensation/templates/compensation/detail/view.html:24 #: compensation/templates/compensation/detail/view.html:24
#: intervention/forms.py:35 intervention/tables.py:28 #: intervention/forms.py:35 intervention/tables.py:28
@ -224,6 +226,7 @@ msgid "Checked"
msgstr "Geprüft" msgstr "Geprüft"
#: compensation/tables.py:42 compensation/tables.py:181 #: compensation/tables.py:42 compensation/tables.py:181
#: compensation/templates/compensation/detail/eco_account/view.html:36
#: compensation/templates/compensation/detail/view.html:50 #: compensation/templates/compensation/detail/view.html:50
#: intervention/tables.py:39 #: intervention/tables.py:39
#: intervention/templates/intervention/detail/view.html:70 user/models.py:49 #: intervention/templates/intervention/detail/view.html:70 user/models.py:49
@ -265,6 +268,7 @@ msgid "Checked on {} by {}"
msgstr "Am {} von {} geprüft worden" msgstr "Am {} von {} geprüft worden"
#: compensation/tables.py:130 #: compensation/tables.py:130
#: compensation/templates/compensation/detail/eco_account/view.html:39
#: compensation/templates/compensation/detail/view.html:53 #: compensation/templates/compensation/detail/view.html:53
#: intervention/tables.py:135 #: intervention/tables.py:135
#: intervention/templates/intervention/detail/view.html:73 #: intervention/templates/intervention/detail/view.html:73
@ -287,6 +291,7 @@ msgid "Access not granted"
msgstr "Nicht freigegeben - Datensatz nur lesbar" msgstr "Nicht freigegeben - Datensatz nur lesbar"
#: compensation/tables.py:176 #: compensation/tables.py:176
#: compensation/templates/compensation/detail/eco_account/view.html:28
msgid "Available" msgid "Available"
msgstr "Verfügbar" msgstr "Verfügbar"
@ -294,8 +299,9 @@ msgstr "Verfügbar"
msgid "Eco Accounts" msgid "Eco Accounts"
msgstr "Ökokonten" msgstr "Ökokonten"
#: compensation/tables.py:224 konova/templates/konova/home.html:88 #: compensation/tables.py:224
#: templates/navbar.html:34 #: compensation/templates/compensation/detail/eco_account/view.html:12
#: konova/templates/konova/home.html:88 templates/navbar.html:34
msgid "Eco-account" msgid "Eco-account"
msgstr "Ökokonto" msgstr "Ökokonto"
@ -304,6 +310,73 @@ msgid "Not recorded yet. Can not be used for withdraws, yet."
msgstr "" msgstr ""
"Noch nicht verzeichnet. Kann noch nicht für Abbuchungen genutzt werden." "Noch nicht verzeichnet. Kann noch nicht für Abbuchungen genutzt werden."
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:8
#: intervention/templates/intervention/detail/includes/withdraws.html:8
msgid "Eco Account Withdraws"
msgstr "Ökokonto Abbuchungen"
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:14
#: intervention/templates/intervention/detail/includes/withdraws.html:14
msgid "Add new withdraw"
msgstr "Neue Abbuchung hinzufügen"
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:30
msgid "Intervention Identifier"
msgstr "Eingriffskennung"
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:36
#: compensation/templates/compensation/detail/includes/actions.html:37
#: compensation/templates/compensation/detail/includes/deadlines.html:37
#: compensation/templates/compensation/detail/includes/documents.html:34
#: compensation/templates/compensation/detail/includes/states-after.html:39
#: compensation/templates/compensation/detail/includes/states-before.html:39
#: intervention/templates/intervention/detail/includes/compensations.html:36
#: 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/withdraws.html:36
#: templates/log.html:10
msgid "Action"
msgstr "Aktionen"
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:51
#: intervention/templates/intervention/detail/includes/withdraws.html:51
msgid "Remove Withdraw"
msgstr "Abbuchung entfernen"
#: compensation/templates/compensation/detail/eco_account/view.html:43
#: compensation/templates/compensation/detail/view.html:57
#: intervention/templates/intervention/detail/view.html:77
msgid "Recorded on "
msgstr "Verzeichnet am"
#: compensation/templates/compensation/detail/eco_account/view.html:43
#: compensation/templates/compensation/detail/view.html:43
#: compensation/templates/compensation/detail/view.html:57
#: intervention/templates/intervention/detail/view.html:63
#: intervention/templates/intervention/detail/view.html:77
msgid "by"
msgstr "von"
#: compensation/templates/compensation/detail/eco_account/view.html:50
#: compensation/templates/compensation/detail/view.html:64
#: intervention/templates/intervention/detail/view.html:96
msgid "Last modified"
msgstr "Zuletzt bearbeitet"
#: compensation/templates/compensation/detail/eco_account/view.html:58
#: compensation/templates/compensation/detail/view.html:72
#: intervention/forms.py:251
#: intervention/templates/intervention/detail/view.html:104
msgid "Shared with"
msgstr "Freigegeben für"
#: compensation/templates/compensation/detail/eco_account/view.html:70
#: compensation/templates/compensation/detail/view.html:84
#: intervention/templates/intervention/detail/view.html:116
msgid "No geometry added, yet."
msgstr "Keine Geometrie vorhanden"
#: compensation/templates/compensation/detail/includes/actions.html:8 #: compensation/templates/compensation/detail/includes/actions.html:8
msgctxt "Compensation" msgctxt "Compensation"
msgid "Actions" msgid "Actions"
@ -322,20 +395,6 @@ msgctxt "Compensation"
msgid "Amount" msgid "Amount"
msgstr "Menge" msgstr "Menge"
#: compensation/templates/compensation/detail/includes/actions.html:37
#: compensation/templates/compensation/detail/includes/deadlines.html:37
#: compensation/templates/compensation/detail/includes/documents.html:34
#: compensation/templates/compensation/detail/includes/states-after.html:39
#: compensation/templates/compensation/detail/includes/states-before.html:39
#: intervention/templates/intervention/detail/includes/compensations.html:36
#: intervention/templates/intervention/detail/includes/documents.html:34
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:36
#: intervention/templates/intervention/detail/includes/payments.html:37
#: intervention/templates/intervention/detail/includes/revocation.html:41
#: templates/log.html:10
msgid "Action"
msgstr "Aktionen"
#: compensation/templates/compensation/detail/includes/actions.html:51 #: compensation/templates/compensation/detail/includes/actions.html:51
msgid "Remove action" msgid "Remove action"
msgstr "Maßnahme entfernen" msgstr "Maßnahme entfernen"
@ -442,34 +501,6 @@ msgstr "kompensiert Eingriff"
msgid "Checked on " msgid "Checked on "
msgstr "Geprüft am " msgstr "Geprüft am "
#: compensation/templates/compensation/detail/view.html:43
#: compensation/templates/compensation/detail/view.html:57
#: intervention/templates/intervention/detail/view.html:63
#: intervention/templates/intervention/detail/view.html:77
msgid "by"
msgstr "von"
#: compensation/templates/compensation/detail/view.html:57
#: intervention/templates/intervention/detail/view.html:77
msgid "Recorded on "
msgstr "Verzeichnet am"
#: compensation/templates/compensation/detail/view.html:64
#: intervention/templates/intervention/detail/view.html:96
msgid "Last modified"
msgstr "Zuletzt bearbeitet"
#: compensation/templates/compensation/detail/view.html:72
#: intervention/forms.py:251
#: intervention/templates/intervention/detail/view.html:104
msgid "Shared with"
msgstr "Freigegeben für"
#: compensation/templates/compensation/detail/view.html:84
#: intervention/templates/intervention/detail/view.html:116
msgid "No geometry added, yet."
msgstr "Keine Geometrie vorhanden"
#: compensation/views/compensation_views.py:121 intervention/views.py:391 #: compensation/views/compensation_views.py:121 intervention/views.py:391
msgid "Log" msgid "Log"
msgstr "Log" msgstr "Log"
@ -478,31 +509,31 @@ msgstr "Log"
msgid "Compensation removed" msgid "Compensation removed"
msgstr "Kompensation entfernt" msgstr "Kompensation entfernt"
#: compensation/views/compensation_views.py:159 intervention/views.py:96 #: compensation/views/compensation_views.py:161 intervention/views.py:96
msgid "Document added" msgid "Document added"
msgstr "Dokument hinzugefügt" msgstr "Dokument hinzugefügt"
#: compensation/views/compensation_views.py:178 #: compensation/views/compensation_views.py:180
msgid "State added" msgid "State added"
msgstr "Zustand hinzugefügt" msgstr "Zustand hinzugefügt"
#: compensation/views/compensation_views.py:197 #: compensation/views/compensation_views.py:199
msgid "Action added" msgid "Action added"
msgstr "Maßnahme hinzugefügt" msgstr "Maßnahme hinzugefügt"
#: compensation/views/compensation_views.py:216 #: compensation/views/compensation_views.py:218
msgid "Deadline added" msgid "Deadline added"
msgstr "Frist hinzugefügt" msgstr "Frist hinzugefügt"
#: compensation/views/compensation_views.py:235 #: compensation/views/compensation_views.py:237
msgid "State removed" msgid "State removed"
msgstr "Zustand gelöscht" msgstr "Zustand gelöscht"
#: compensation/views/compensation_views.py:254 #: compensation/views/compensation_views.py:256
msgid "Action removed" msgid "Action removed"
msgstr "Maßnahme entfernt" msgstr "Maßnahme entfernt"
#: compensation/views/eco_account_views.py:100 #: compensation/views/eco_account_views.py:147
msgid "Withdraw removed" msgid "Withdraw removed"
msgstr "Abbuchung entfernt" msgstr "Abbuchung entfernt"
@ -656,7 +687,7 @@ msgstr ""
"Ich, {} {}, bestätige, dass die notwendigen Kontrollschritte durchgeführt " "Ich, {} {}, bestätige, dass die notwendigen Kontrollschritte durchgeführt "
"wurden:" "wurden:"
#: intervention/models.py:216 #: intervention/models.py:203
#: intervention/templates/intervention/detail/view.html:23 #: intervention/templates/intervention/detail/view.html:23
#: intervention/templates/intervention/detail/view.html:27 #: intervention/templates/intervention/detail/view.html:27
#: intervention/templates/intervention/detail/view.html:31 #: intervention/templates/intervention/detail/view.html:31
@ -668,7 +699,7 @@ msgstr ""
msgid "Missing" msgid "Missing"
msgstr "Fehlt" msgstr "Fehlt"
#: intervention/models.py:217 #: intervention/models.py:204
msgid "Exists" msgid "Exists"
msgstr "Existiert" msgstr "Existiert"
@ -702,22 +733,6 @@ msgstr "Kompensation entfernen"
msgid "Record" msgid "Record"
msgstr "Verzeichnen" msgstr "Verzeichnen"
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:8
msgid "Eco Account Withdraws"
msgstr "Ökokonto Abbuchungen"
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:14
msgid "Add new withdraw"
msgstr "Neue Abbuchung hinzufügen"
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:30
msgid "Account Identifier"
msgstr "Ökokonto Kennung"
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:51
msgid "Remove Withdraw"
msgstr "Abbuchung entfernen"
#: intervention/templates/intervention/detail/includes/payments.html:8 #: intervention/templates/intervention/detail/includes/payments.html:8
msgid "Payments" msgid "Payments"
msgstr "Ersatzzahlungen" msgstr "Ersatzzahlungen"
@ -753,6 +768,10 @@ msgstr "Vom"
msgid "Remove revocation" msgid "Remove revocation"
msgstr "Widerspruch entfernen" msgstr "Widerspruch entfernen"
#: intervention/templates/intervention/detail/includes/withdraws.html:30
msgid "Account Identifier"
msgstr "Ökokonto Kennung"
#: intervention/templates/intervention/detail/view.html:28 #: intervention/templates/intervention/detail/view.html:28
msgid "Process type" msgid "Process type"
msgstr "Verfahrenstyp" msgstr "Verfahrenstyp"
@ -929,19 +948,19 @@ msgstr "Wenn meine freigegebenen Daten gelöscht wurden"
msgid "On registered data edited" msgid "On registered data edited"
msgstr "Wenn meine freigegebenen Daten bearbeitet wurden" msgstr "Wenn meine freigegebenen Daten bearbeitet wurden"
#: konova/models.py:110 #: konova/models.py:126
msgid "Finished" msgid "Finished"
msgstr "Umgesetzt bis" msgstr "Umgesetzt bis"
#: konova/models.py:111 #: konova/models.py:127
msgid "Maintain" msgid "Maintain"
msgstr "Unterhaltung bis" msgstr "Unterhaltung bis"
#: konova/models.py:112 #: konova/models.py:128
msgid "Control" msgid "Control"
msgstr "Kontrolle am" msgstr "Kontrolle am"
#: konova/models.py:113 #: konova/models.py:129
msgid "Other" msgid "Other"
msgstr "Sonstige" msgstr "Sonstige"
@ -2550,9 +2569,6 @@ msgstr ""
#~ msgid "official" #~ msgid "official"
#~ msgstr "bestandskräftig" #~ msgstr "bestandskräftig"
#~ msgid "Intervention identifier"
#~ msgstr "Eingriffskennung"
#~ msgid "" #~ msgid ""
#~ "A process is based on an intervention. Please fill in the missing data " #~ "A process is based on an intervention. Please fill in the missing data "
#~ "for this intervention" #~ "for this intervention"