Eco Accounts
* adds related eco account withdraw detail view to intervention detail view * adds new route for removing withdraws using RemoveModalForm * adds EcoAccountWithdraw model * adds admin interfaces for EcoAccount and EcoAccountWithdraw * adds message_templates.py to konova/utils for reusable messages * splits related-documents.html and related-objects.html into separate templates for each related object type: compensations.html, documents.html, eco-account-withdraws.html and payments.html * adds translations
This commit is contained in:
parent
221f7dfb79
commit
98de05089e
@ -1,6 +1,7 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from compensation.models import Compensation, CompensationAction, CompensationState, CompensationControl, Payment
|
||||
from compensation.models import Compensation, CompensationAction, CompensationState, CompensationControl, Payment, \
|
||||
EcoAccountWithdraw, EcoAccount
|
||||
|
||||
|
||||
class CompensationControlAdmin(admin.ModelAdmin):
|
||||
@ -34,9 +35,23 @@ class CompensationActionAdmin(admin.ModelAdmin):
|
||||
class CompensationAdmin(admin.ModelAdmin):
|
||||
list_display = [
|
||||
"id",
|
||||
"identifier",
|
||||
"title",
|
||||
"created_on",
|
||||
"created_by",
|
||||
]
|
||||
|
||||
|
||||
class EcoAccountAdmin(admin.ModelAdmin):
|
||||
list_display = [
|
||||
"id",
|
||||
"identifier",
|
||||
"title",
|
||||
"created_on",
|
||||
"created_by",
|
||||
]
|
||||
|
||||
|
||||
class PaymentAdmin(admin.ModelAdmin):
|
||||
list_display = [
|
||||
"id",
|
||||
@ -47,8 +62,21 @@ class PaymentAdmin(admin.ModelAdmin):
|
||||
]
|
||||
|
||||
|
||||
class EcoAccountWithdrawAdmin(admin.ModelAdmin):
|
||||
list_display = [
|
||||
"id",
|
||||
"account",
|
||||
"intervention",
|
||||
"amount",
|
||||
"created_by",
|
||||
"created_on",
|
||||
]
|
||||
|
||||
|
||||
admin.site.register(Compensation, CompensationAdmin)
|
||||
admin.site.register(Payment, PaymentAdmin)
|
||||
admin.site.register(CompensationAction, CompensationActionAdmin)
|
||||
admin.site.register(CompensationState, CompensationStateAdmin)
|
||||
admin.site.register(CompensationControl, CompensationControlAdmin)
|
||||
admin.site.register(EcoAccount, EcoAccountAdmin)
|
||||
admin.site.register(EcoAccountWithdraw, EcoAccountWithdrawAdmin)
|
||||
|
@ -7,7 +7,7 @@ Created on: 17.11.20
|
||||
"""
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.gis.db import models
|
||||
from django.core.validators import MinValueValidator
|
||||
from django.core.validators import MinValueValidator, MaxValueValidator
|
||||
from django.utils import timezone
|
||||
from django.utils.timezone import now
|
||||
|
||||
@ -152,3 +152,40 @@ class EcoAccount(Compensation):
|
||||
"""
|
||||
# Users having access on this object
|
||||
users = models.ManyToManyField(User)
|
||||
|
||||
def __str__(self):
|
||||
return "{}".format(self.identifier)
|
||||
|
||||
|
||||
class EcoAccountWithdraw(BaseResource):
|
||||
"""
|
||||
A withdraw object for eco accounts
|
||||
"""
|
||||
account = models.ForeignKey(
|
||||
EcoAccount,
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text="Withdrawn from",
|
||||
related_name="eco_withdraws",
|
||||
)
|
||||
amount = models.FloatField(
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text="Amount withdrawn (percentage)",
|
||||
validators=[
|
||||
MinValueValidator(limit_value=0.00),
|
||||
MaxValueValidator(limit_value=100),
|
||||
]
|
||||
)
|
||||
intervention = models.ForeignKey(
|
||||
Intervention,
|
||||
on_delete=models.CASCADE,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text="Withdrawn for",
|
||||
related_name="eco_withdraws",
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return "{} of {}".format(self.amount, self.account)
|
||||
|
@ -30,4 +30,8 @@ urlpatterns = [
|
||||
path('acc/<id>', account_open_view, name='acc-open'),
|
||||
path('acc/<id>/edit', account_edit_view, name='acc-edit'),
|
||||
path('acc/<id>/remove', account_remove_view, name='acc-remove'),
|
||||
|
||||
# Eco-account withdraws
|
||||
path('acc/<id>/remove/<withdraw_id>', withdraw_remove_view, name='withdraw-remove'),
|
||||
|
||||
]
|
@ -1,5 +1,6 @@
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.http import HttpRequest
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.http import HttpRequest, Http404
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
@ -10,6 +11,7 @@ from intervention.models import Intervention
|
||||
from konova.contexts import BaseContext
|
||||
from konova.decorators import *
|
||||
from konova.forms import RemoveModalForm
|
||||
from konova.utils.message_templates import FORM_INVALID
|
||||
|
||||
|
||||
@login_required
|
||||
@ -139,7 +141,7 @@ def new_payment_view(request: HttpRequest, intervention_id: str):
|
||||
else:
|
||||
messages.info(
|
||||
request,
|
||||
_("There was an error on this form.")
|
||||
FORM_INVALID
|
||||
)
|
||||
return redirect(request.META.get("HTTP_REFERER", "home"))
|
||||
elif request.method == "GET":
|
||||
@ -154,7 +156,7 @@ def new_payment_view(request: HttpRequest, intervention_id: str):
|
||||
|
||||
@login_required
|
||||
def payment_remove_view(request: HttpRequest, id: str):
|
||||
""" Renders a modal view for adding new payments
|
||||
""" Renders a modal view for removing payments
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
@ -177,7 +179,51 @@ def payment_remove_view(request: HttpRequest, id: str):
|
||||
else:
|
||||
messages.info(
|
||||
request,
|
||||
_("There was an error on this form.")
|
||||
FORM_INVALID
|
||||
)
|
||||
return redirect(request.META.get("HTTP_REFERER", "home"))
|
||||
elif request.method == "GET":
|
||||
context = {
|
||||
"form": form,
|
||||
}
|
||||
context = BaseContext(request, context).context
|
||||
return render(request, template, context)
|
||||
else:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
@login_required
|
||||
def withdraw_remove_view(request: HttpRequest, id: str, withdraw_id: str):
|
||||
""" Renders a modal view for removing withdraws
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
id (str): The eco account's id
|
||||
withdraw_id (str): The withdraw's id
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
acc = get_object_or_404(EcoAccount, id=id)
|
||||
try:
|
||||
eco_withdraw = acc.eco_withdraws.get(id=withdraw_id)
|
||||
except ObjectDoesNotExist:
|
||||
raise Http404("Unknown withdraw")
|
||||
|
||||
form = RemoveModalForm(request.POST or None, instance=eco_withdraw, user=request.user)
|
||||
template = form.template
|
||||
if request.method == "POST":
|
||||
if form.is_valid():
|
||||
form.save()
|
||||
messages.success(
|
||||
request,
|
||||
_("Withdraw removed")
|
||||
)
|
||||
return redirect(request.META.get("HTTP_REFERER", "home"))
|
||||
else:
|
||||
messages.info(
|
||||
request,
|
||||
FORM_INVALID
|
||||
)
|
||||
return redirect(request.META.get("HTTP_REFERER", "home"))
|
||||
elif request.method == "GET":
|
||||
|
@ -0,0 +1,49 @@
|
||||
{% load i18n l10n fontawesome_5 %}
|
||||
<div id="related-compensations" class="card">
|
||||
<div class="card-header rlp-r">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<h5>
|
||||
<span class="badge badge-light">{{intervention.compensations.count}}</span>
|
||||
{% trans 'Compensations' %}
|
||||
</h5>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
<a href="{% url 'compensation:new' %}" title="{% trans 'Add new compensation' %}">
|
||||
<button class="btn btn-outline-default">
|
||||
{% fa5_icon 'plus' %}
|
||||
{% fa5_icon 'leaf' %}
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body scroll-300">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
{% trans 'Identifier' %}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{% trans 'Title' %}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for comp in intervention.compensations.all %}
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
<a href="{% url 'compensation:open' comp.id %}">
|
||||
{{ comp.identifier }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="align-middle">{{ comp.title }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,55 @@
|
||||
{% load i18n l10n fontawesome_5 %}
|
||||
<div id="related-documents" class="card">
|
||||
<div class="card-header rlp-r">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<h5>
|
||||
<span class="badge badge-light">{{intervention.documents.count}}</span>
|
||||
{% trans 'Documents' %}
|
||||
</h5>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:new-doc' intervention.id %}" title="{% trans 'Add new document' %}">
|
||||
{% fa5_icon 'plus' %}
|
||||
{% fa5_icon 'file' %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body scroll-300">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
{% trans 'Title' %}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{% trans 'Comment' %}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{% trans 'Action' %}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for doc in intervention.documents.all %}
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
<a href="{% url 'doc-open' doc.id %}">
|
||||
{{ doc.title }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="align-middle">{{ doc.comment }}</td>
|
||||
<td>
|
||||
<button data-form-url="{% url 'doc-remove' doc.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove document' %}">
|
||||
{% fa5_icon 'trash' %}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,57 @@
|
||||
{% load i18n l10n fontawesome_5 %}
|
||||
<div id="related-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">{{intervention.eco_withdraws.count}}</span>
|
||||
{% trans 'Eco Account Withdraws' %}
|
||||
</h5>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
<a href="{% url 'compensation:new' %}" title="{% trans 'Add new withdraw' %}">
|
||||
<button class="btn btn-outline-default">
|
||||
{% fa5_icon 'plus' %}
|
||||
{% fa5_icon 'tree' %}
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body scroll-300">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
{% trans 'Account Identifier' %}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{% trans 'Amount' %}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{% trans 'Action' %}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for withdraw in intervention.eco_withdraws.all %}
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
<a href="{% url 'compensation:acc-open' withdraw.account.id %}">
|
||||
{{ withdraw.account.identifier }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="align-middle">{{ withdraw.amount }} %</td>
|
||||
<td>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,59 @@
|
||||
{% load i18n l10n fontawesome_5 %}
|
||||
<div id="related-payments" class="card">
|
||||
<div class="card-header rlp-r">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<h5>
|
||||
<span class="badge badge-light">{{intervention.payments.count}}</span>
|
||||
{% trans 'Payments' %}
|
||||
</h5>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:pay-new' intervention.id %}" title="{% trans 'Add new payment' %}">
|
||||
{% fa5_icon 'plus' %}
|
||||
{% fa5_icon 'money-bill-wave' %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body scroll-300">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
{% trans 'Amount' context 'money' %}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{% trans 'Due on' %}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{% trans 'Transfer comment' %}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{% trans 'Action' %}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for pay in intervention.payments.all %}
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
<a href="{% url 'compensation:pay-open' pay.id %}">
|
||||
{{ pay.amount|floatformat:2 }} €
|
||||
</a>
|
||||
</td>
|
||||
<td class="align-middle">{{ pay.due_on }}</td>
|
||||
<td class="align-middle">{{ pay.comment }}</td>
|
||||
<td>
|
||||
<button data-form-url="{% url 'compensation:pay-remove' pay.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove payment' %}">
|
||||
{% fa5_icon 'trash' %}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
@ -1,59 +0,0 @@
|
||||
{% load i18n l10n fontawesome_5 %}
|
||||
<div id="related-documents" class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="card">
|
||||
<div class="card-header rlp-r">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<h5>
|
||||
<span class="badge badge-light">{{intervention.documents.count}}</span>
|
||||
{% trans 'Documents' %}
|
||||
</h5>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:new-doc' intervention.id %}" title="{% trans 'Add new document' %}">
|
||||
{% fa5_icon 'plus' %}
|
||||
{% fa5_icon 'file' %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body scroll-300">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
{% trans 'Title' %}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{% trans 'Comment' %}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{% trans 'Action' %}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for doc in intervention.documents.all %}
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
<a href="{% url 'doc-open' doc.id %}">
|
||||
{{ doc.title }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="align-middle">{{ doc.comment }}</td>
|
||||
<td>
|
||||
<button data-form-url="{% url 'doc-remove' doc.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove document' %}">
|
||||
{% fa5_icon 'trash' %}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,113 +0,0 @@
|
||||
{% load i18n l10n fontawesome_5 %}
|
||||
<div id="related-objects" class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div id="related-compensations" class="card">
|
||||
<div class="card-header rlp-r">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<h5>
|
||||
<span class="badge badge-light">{{intervention.compensations.count}}</span>
|
||||
{% trans 'Compensations' %}
|
||||
</h5>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
<a href="{% url 'compensation:new' %}" title="{% trans 'Add new compensation' %}">
|
||||
<button class="btn btn-outline-default">
|
||||
{% fa5_icon 'plus' %}
|
||||
{% fa5_icon 'leaf' %}
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body scroll-300">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
{% trans 'Identifier' %}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{% trans 'Title' %}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for comp in intervention.compensations.all %}
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
<a href="{% url 'compensation:open' comp.id %}">
|
||||
{{ comp.identifier }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="align-middle">{{ comp.title }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div id="related-payments" class="card">
|
||||
<div class="card-header rlp-r">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<h5>
|
||||
<span class="badge badge-light">{{intervention.payments.count}}</span>
|
||||
{% trans 'Payments' %}
|
||||
</h5>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:pay-new' intervention.id %}" title="{% trans 'Add new payment' %}">
|
||||
{% fa5_icon 'plus' %}
|
||||
{% fa5_icon 'money-bill-wave' %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body scroll-300">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
{% trans 'Amount' %}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{% trans 'Due on' %}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{% trans 'Transfer comment' %}
|
||||
</th>
|
||||
<th scope="col">
|
||||
{% trans 'Action' %}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for pay in intervention.payments.all %}
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
<a href="{% url 'compensation:pay-open' pay.id %}">
|
||||
{{ pay.amount|floatformat:2 }} €
|
||||
</a>
|
||||
</td>
|
||||
<td class="align-middle">{{ pay.due_on }}</td>
|
||||
<td class="align-middle">{{ pay.comment }}</td>
|
||||
<td>
|
||||
<button data-form-url="{% url 'compensation:pay-remove' pay.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove payment' %}">
|
||||
{% fa5_icon 'trash' %}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -146,8 +146,22 @@
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
{% include 'intervention/detail/related-objects.html' %}
|
||||
{% include 'intervention/detail/related-documents.html' %}
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
{% include 'intervention/detail/includes/compensations.html' %}
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
{% include 'intervention/detail/includes/payments.html' %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
{% include 'intervention/detail/includes/eco-account-withdraws.html' %}
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
{% include 'intervention/detail/includes/documents.html' %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% with 'btn-modal' as btn_class %}
|
||||
|
@ -10,6 +10,7 @@ from intervention.tables import InterventionTable
|
||||
from konova.contexts import BaseContext
|
||||
from konova.decorators import *
|
||||
from konova.forms import RemoveForm, SimpleGeomForm, NewDocumentForm
|
||||
from konova.utils.message_templates import FORM_INVALID
|
||||
|
||||
|
||||
@login_required
|
||||
@ -98,7 +99,7 @@ def new_document_view(request: HttpRequest, id: str):
|
||||
else:
|
||||
messages.info(
|
||||
request,
|
||||
_("There was an error on this form.")
|
||||
FORM_INVALID
|
||||
)
|
||||
return redirect(request.META.get("HTTP_REFERER", "home"))
|
||||
elif request.method == "GET":
|
||||
|
11
konova/utils/message_templates.py
Normal file
11
konova/utils/message_templates.py
Normal file
@ -0,0 +1,11 @@
|
||||
"""
|
||||
Author: Michel Peltriaux
|
||||
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
||||
Contact: michel.peltriaux@sgdnord.rlp.de
|
||||
Created on: 02.08.21
|
||||
|
||||
"""
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
FORM_INVALID = _("There was an error on this form.")
|
@ -18,6 +18,7 @@ from intervention.models import Intervention
|
||||
from konova.contexts import BaseContext
|
||||
from konova.forms import RemoveModalForm
|
||||
from konova.models import Document
|
||||
from konova.utils.message_templates import FORM_INVALID
|
||||
from news.models import ServerMessage
|
||||
from konova.settings import SSO_SERVER_BASE
|
||||
|
||||
@ -150,7 +151,7 @@ def remove_document_view(request: HttpRequest, id: str):
|
||||
else:
|
||||
messages.info(
|
||||
request,
|
||||
_("There was an error on this form.")
|
||||
FORM_INVALID
|
||||
)
|
||||
return redirect(request.META.get("HTTP_REFERER", "home"))
|
||||
elif request.method == "GET":
|
||||
|
Binary file not shown.
@ -13,7 +13,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-07-30 15:00+0200\n"
|
||||
"POT-Creation-Date: 2021-08-02 09:52+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -24,16 +24,16 @@ msgstr ""
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: compensation/forms.py:26
|
||||
#: intervention/templates/intervention/detail/related-objects.html:78
|
||||
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:31
|
||||
msgid "Amount"
|
||||
msgstr "Betrag"
|
||||
msgstr "Menge"
|
||||
|
||||
#: compensation/forms.py:28
|
||||
msgid "Amount in Euro"
|
||||
msgstr "Betrag in Euro"
|
||||
|
||||
#: compensation/forms.py:31
|
||||
#: intervention/templates/intervention/detail/related-objects.html:81
|
||||
#: intervention/templates/intervention/detail/includes/payments.html:29
|
||||
msgid "Due on"
|
||||
msgstr "Fällig am"
|
||||
|
||||
@ -59,14 +59,14 @@ msgstr "Neue Ersatzzahlung zu Eingriff '{}' hinzufügen"
|
||||
|
||||
#: compensation/tables.py:24 compensation/tables.py:164
|
||||
#: intervention/forms.py:26 intervention/tables.py:23
|
||||
#: intervention/templates/intervention/detail/related-objects.html:30
|
||||
#: intervention/templates/intervention/detail/includes/compensations.html:28
|
||||
msgid "Identifier"
|
||||
msgstr "Kennung"
|
||||
|
||||
#: compensation/tables.py:29 compensation/tables.py:169
|
||||
#: intervention/forms.py:33 intervention/tables.py:28
|
||||
#: intervention/templates/intervention/detail/related-documents.html:28
|
||||
#: intervention/templates/intervention/detail/related-objects.html:33
|
||||
#: intervention/templates/intervention/detail/includes/compensations.html:31
|
||||
#: intervention/templates/intervention/detail/includes/documents.html:26
|
||||
#: intervention/templates/intervention/detail/view.html:60 konova/forms.py:181
|
||||
msgid "Title"
|
||||
msgstr "Bezeichnung"
|
||||
@ -90,7 +90,7 @@ msgid "Last edit"
|
||||
msgstr "Zuletzt bearbeitet"
|
||||
|
||||
#: compensation/tables.py:61
|
||||
#: intervention/templates/intervention/detail/related-objects.html:10
|
||||
#: intervention/templates/intervention/detail/includes/compensations.html:8
|
||||
msgid "Compensations"
|
||||
msgstr "Kompensationen"
|
||||
|
||||
@ -253,8 +253,7 @@ msgstr "Freigabelink"
|
||||
|
||||
#: intervention/forms.py:241
|
||||
msgid "Send this link to users who you want to have writing access on the data"
|
||||
msgstr ""
|
||||
"Andere Nutzer erhalten über diesen Link Zugriff auf die Daten"
|
||||
msgstr "Andere Nutzer erhalten über diesen Link Zugriff auf die Daten"
|
||||
|
||||
#: intervention/forms.py:250
|
||||
msgid "Shared with"
|
||||
@ -283,46 +282,60 @@ msgstr "Eingriffe"
|
||||
msgid "Intervention"
|
||||
msgstr "Eingriff"
|
||||
|
||||
#: intervention/templates/intervention/detail/related-documents.html:10
|
||||
#: intervention/templates/intervention/detail/includes/compensations.html:13
|
||||
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:13
|
||||
msgid "Add new compensation"
|
||||
msgstr "Neue Kompensation hinzufügen"
|
||||
|
||||
#: intervention/templates/intervention/detail/includes/documents.html:8
|
||||
msgid "Documents"
|
||||
msgstr "Dokumente"
|
||||
|
||||
#: intervention/templates/intervention/detail/related-documents.html:15
|
||||
#: intervention/templates/intervention/detail/includes/documents.html:13
|
||||
#: konova/forms.py:222
|
||||
msgid "Add new document"
|
||||
msgstr "Neues Dokument hinzufügen"
|
||||
|
||||
#: intervention/templates/intervention/detail/related-documents.html:31
|
||||
#: intervention/templates/intervention/detail/includes/documents.html:29
|
||||
#: konova/forms.py:209
|
||||
msgid "Comment"
|
||||
msgstr "Kommentar"
|
||||
|
||||
#: intervention/templates/intervention/detail/related-documents.html:34
|
||||
#: intervention/templates/intervention/detail/related-objects.html:87
|
||||
#: intervention/templates/intervention/detail/includes/documents.html:32
|
||||
#: intervention/templates/intervention/detail/includes/payments.html:35
|
||||
msgid "Action"
|
||||
msgstr "Aktionen"
|
||||
|
||||
#: intervention/templates/intervention/detail/related-documents.html:48
|
||||
#: intervention/templates/intervention/detail/includes/documents.html:46
|
||||
msgid "Remove document"
|
||||
msgstr "Dokument löschen"
|
||||
|
||||
#: intervention/templates/intervention/detail/related-objects.html:15
|
||||
msgid "Add new compensation"
|
||||
msgstr "Neue Kompensation hinzufügen"
|
||||
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:8
|
||||
msgid "Eco Account Withdraws"
|
||||
msgstr "Ökokonto Abbuchungen"
|
||||
|
||||
#: intervention/templates/intervention/detail/related-objects.html:60
|
||||
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:28
|
||||
msgid "Account Identifier"
|
||||
msgstr "Ökokonto Kennung"
|
||||
|
||||
#: intervention/templates/intervention/detail/includes/payments.html:8
|
||||
msgid "Payments"
|
||||
msgstr "Ersatzzahlungen"
|
||||
|
||||
#: intervention/templates/intervention/detail/related-objects.html:65
|
||||
#: intervention/templates/intervention/detail/includes/payments.html:13
|
||||
msgid "Add new payment"
|
||||
msgstr "Neue Zahlung hinzufügen"
|
||||
|
||||
#: intervention/templates/intervention/detail/related-objects.html:84
|
||||
#: intervention/templates/intervention/detail/includes/payments.html:26
|
||||
msgctxt "money"
|
||||
msgid "Amount"
|
||||
msgstr "Betrag"
|
||||
|
||||
#: intervention/templates/intervention/detail/includes/payments.html:32
|
||||
msgid "Transfer comment"
|
||||
msgstr "Verwendungszweck"
|
||||
|
||||
#: intervention/templates/intervention/detail/related-objects.html:102
|
||||
#: intervention/templates/intervention/detail/includes/payments.html:50
|
||||
msgid "Remove payment"
|
||||
msgstr "Zahlung entfernen"
|
||||
|
||||
@ -473,20 +486,20 @@ msgstr "Sie sind dabei {} {} zu löschen"
|
||||
|
||||
#: konova/forms.py:164
|
||||
msgid "Are you sure?"
|
||||
msgstr ""
|
||||
msgstr "Sind Sie sicher?"
|
||||
|
||||
#: konova/forms.py:188
|
||||
msgid "When has this file been created? Important for photos."
|
||||
msgstr ""
|
||||
msgstr "Wann wurde diese Datei erstellt oder das Foto aufgenommen?"
|
||||
|
||||
#: konova/forms.py:198
|
||||
#: venv/lib/python3.7/site-packages/django/db/models/fields/files.py:231
|
||||
msgid "File"
|
||||
msgstr ""
|
||||
msgstr "Datei"
|
||||
|
||||
#: konova/forms.py:200
|
||||
msgid "Must be smaller than 15 Mb"
|
||||
msgstr ""
|
||||
msgstr "Muss kleiner als 15 Mb sein"
|
||||
|
||||
#: konova/forms.py:211
|
||||
msgid "Additional comment on this file"
|
||||
|
Loading…
Reference in New Issue
Block a user