[Intervention] Revocations files optional #4 #11

Merged
mpeltriaux merged 1 commits from 4_Revocations_files_optional into master 3 years ago

@ -332,6 +332,7 @@ class NewRevocationForm(BaseModalForm):
file = forms.FileField(
label=_("Document"),
label_suffix=_(""),
required=False,
help_text=_("Must be smaller than 15 Mb"),
widget=forms.FileInput(
attrs={
@ -371,12 +372,15 @@ class NewRevocationForm(BaseModalForm):
user=self.user,
action=UserAction.EDITED
)
if self.cleaned_data["file"]:
document = Document.objects.create(
title="revocation_of_{}".format(self.instance.identifier),
date_of_creation=self.cleaned_data["date"],
comment=self.cleaned_data["comment"],
file=self.cleaned_data["file"],
)
else:
document = None
revocation = Revocation.objects.create(
date=self.cleaned_data["date"],
comment=self.cleaned_data["comment"],

@ -13,7 +13,7 @@ from django.utils.translation import gettext_lazy as _
from intervention.filters import InterventionTableFilter
from intervention.models import Intervention
from konova.sub_settings.django_settings import DEFAULT_DATE_TIME_FORMAT
from konova.sub_settings.django_settings import DEFAULT_DATE_TIME_FORMAT, DEFAULT_DATE_FORMAT
from konova.utils.tables import BaseTable
import django_tables2 as tables
@ -41,6 +41,12 @@ class InterventionTable(BaseTable):
empty_values=[],
accessor="recorded",
)
rev = tables.Column(
verbose_name=_("Revocation"),
orderable=True,
empty_values=[],
accessor="legal__revocation",
)
e = tables.Column(
verbose_name=_("Editable"),
orderable=True,
@ -52,16 +58,6 @@ class InterventionTable(BaseTable):
orderable=True,
accessor="modified__timestamp",
)
"""
# ToDo: Decide to keep actions column or to dismiss them
ac = tables.Column(
verbose_name=_("Actions"),
orderable=False,
empty_values=[],
attrs={"td": {"class": "action-col"}}
)
"""
class Meta(BaseTable.Meta):
template_name = "django_tables2/bootstrap4.html"
@ -164,3 +160,29 @@ class InterventionTable(BaseTable):
icn_class="fas fa-edit rlp-r-inv" if has_access else "far fa-edit",
)
return format_html(html)
def render_rev(self, value, record: Intervention):
""" Renders the revocation column for an intervention
Args:
value (str): The revocation value
record (Intervention): The intervention record
Returns:
"""
html = ""
exists = value is not None
tooltip = _("No revocation")
if exists:
_date = value.date
added_ts = localtime(value.created.timestamp)
added_ts = added_ts.strftime(DEFAULT_DATE_TIME_FORMAT)
on = _date.strftime(DEFAULT_DATE_FORMAT)
tooltip = _("Revocation from {}, added on {} by {}").format(on, added_ts, value.created.user)
html += self.render_stop(
tooltip=tooltip,
icn_filled=exists,
)
return format_html(html)

@ -50,9 +50,11 @@
</td>
<td class="align-middle">{{ rev.comment }}</td>
<td class="align-middle">
{% if rev.document %}
<a href="{% url 'doc-open' rev.document.id %}">
{{ rev.document.file }}
</a>
{% endif %}
</td>
<td>
{% if is_default_member and has_access %}

@ -22,6 +22,10 @@ Declare some basic colours
color:white;
}
.rlp-gd-inv{
color: var(--rlp-gray-dark);
}
.rlp-gd-outline{
border:1px solid var(--rlp-gray-dark);
color:var(--rlp-gray-dark);

@ -127,6 +127,17 @@ class BaseTable(tables.tables.Table):
icon
)
def render_stop(self, tooltip: str = None, icn_filled: bool = False):
"""
Returns a stop icon
"""
icon = "fas fa-ban rlp-r-inv" if icn_filled else "fas fa-ban rlp-gd-inv"
return format_html(
"<em title='{}' class='{}'></em>",
tooltip,
icon
)
def render_icn(self, tooltip: str = None, icn_class: str = None):
"""
Returns a rendered fontawesome icon

Binary file not shown.

@ -3,12 +3,12 @@
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#: compensation/filters.py:71 compensation/forms.py:48 compensation/forms.py:53
#: compensation/forms.py:67 compensation/forms.py:236 compensation/forms.py:331
#: compensation/filters.py:71 compensation/forms.py:47 compensation/forms.py:52
#: compensation/forms.py:67 compensation/forms.py:264 compensation/forms.py:345
#: intervention/filters.py:26 intervention/filters.py:40
#: intervention/filters.py:47 intervention/filters.py:48
#: intervention/forms.py:322 intervention/forms.py:334
#: intervention/forms.py:346 konova/forms.py:108 konova/forms.py:252
#: intervention/forms.py:347 konova/forms.py:108 konova/forms.py:252
#: konova/forms.py:287 konova/forms.py:292 konova/forms.py:304
#: konova/forms.py:316 konova/forms.py:329 user/forms.py:38
#, fuzzy
@ -16,7 +16,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-26 13:45+0200\n"
"POT-Creation-Date: 2021-08-26 14:59+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"
@ -30,87 +30,106 @@ msgstr ""
msgid "Show only unrecorded"
msgstr "Nur unverzeichnete anzeigen"
#: compensation/forms.py:49
#: compensation/forms.py:48
msgid "in Euro"
msgstr "in Euro"
#: compensation/forms.py:52
#: compensation/forms.py:51
#: intervention/templates/intervention/detail/includes/payments.html:31
msgid "Due on"
msgstr "Fällig am"
#: compensation/forms.py:55
#: compensation/forms.py:54
msgid "Due on which date"
msgstr "Zahlung wird an diesem Datum erwartet"
#: compensation/forms.py:68
msgid "Transfer note"
msgstr "Verwendungszweck"
#: compensation/forms.py:66 compensation/forms.py:263 compensation/forms.py:344
#: compensation/templates/compensation/detail/compensation/includes/actions.html:34
#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:34
#: compensation/templates/compensation/detail/compensation/includes/documents.html:31
#: compensation/templates/compensation/detail/eco_account/includes/actions.html:34
#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:34
#: compensation/templates/compensation/detail/eco_account/includes/documents.html:31
#: ema/templates/ema/detail/includes/actions.html:34
#: ema/templates/ema/detail/includes/deadlines.html:34
#: ema/templates/ema/detail/includes/documents.html:31
#: intervention/forms.py:346
#: intervention/templates/intervention/detail/includes/documents.html:31
#: intervention/templates/intervention/detail/includes/payments.html:34
#: intervention/templates/intervention/detail/includes/revocation.html:35
#: konova/forms.py:315
msgid "Comment"
msgstr "Kommentar"
#: compensation/forms.py:69
msgid "Note for money transfer"
msgstr "Verwendungszweck für Überweisung"
#: compensation/forms.py:68 compensation/forms.py:265 compensation/forms.py:346
#: intervention/forms.py:348 konova/forms.py:317
msgid "Additional comment, maximum {} letters"
msgstr "Zusätzlicher Kommentar, maximal {} Zeichen"
#: compensation/forms.py:75
#: compensation/forms.py:80
msgid "Payment"
msgstr "Zahlung"
#: compensation/forms.py:76
#: compensation/forms.py:81
msgid "Add a payment for intervention '{}'"
msgstr "Neue Ersatzzahlung zu Eingriff '{}' hinzufügen"
#: compensation/forms.py:88
#: compensation/forms.py:102
msgid "If there is no date you can enter, please explain why."
msgstr "Falls Sie kein Datum angeben können, erklären Sie bitte weshalb."
#: compensation/forms.py:116
msgid "Added payment"
msgstr "Zahlung hinzufügen"
#: compensation/forms.py:105 compensation/forms.py:117
#: compensation/forms.py:133 compensation/forms.py:145
msgid "Biotope Type"
msgstr "Biotoptyp"
#: compensation/forms.py:108
#: compensation/forms.py:136
msgid "Select the biotope type"
msgstr "Biotoptyp wählen"
#: compensation/forms.py:124
#: compensation/forms.py:152
#: compensation/templates/compensation/detail/compensation/includes/states-after.html:36
#: compensation/templates/compensation/detail/compensation/includes/states-before.html:36
#: compensation/templates/compensation/detail/eco_account/includes/states-after.html:36
#: compensation/templates/compensation/detail/eco_account/includes/states-before.html:36
#: ema/templates/ema/detail/includes/states-after.html:36
#: ema/templates/ema/detail/includes/states-before.html:36
#: intervention/forms.py:474
#: intervention/forms.py:478
msgid "Surface"
msgstr "Fläche"
#: compensation/forms.py:127 intervention/forms.py:476
#: compensation/forms.py:155 intervention/forms.py:480
msgid "in m²"
msgstr ""
#: compensation/forms.py:132
#: compensation/forms.py:160
msgid "New state"
msgstr "Neuer Zustand"
#: compensation/forms.py:133
#: compensation/forms.py:161
msgid "Insert data for the new state"
msgstr "Geben Sie die Daten des neuen Zustandes ein"
#: compensation/forms.py:141
#: compensation/forms.py:169
msgid "Added state"
msgstr "Zustand hinzugefügt"
#: compensation/forms.py:157 konova/forms.py:168
#: compensation/forms.py:185 konova/forms.py:168
msgid "Object removed"
msgstr "Objekt entfernt"
#: compensation/forms.py:208
#: compensation/forms.py:236
msgid "Deadline Type"
msgstr "Fristart"
#: compensation/forms.py:211
#: compensation/forms.py:239
msgid "Select the deadline type"
msgstr "Fristart wählen"
#: compensation/forms.py:220
#: compensation/forms.py:248
#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:31
#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:31
#: ema/templates/ema/detail/includes/deadlines.html:31
@ -118,57 +137,31 @@ msgstr "Fristart wählen"
msgid "Date"
msgstr "Datum"
#: compensation/forms.py:223
#: compensation/forms.py:251
msgid "Select date"
msgstr "Datum wählen"
#: compensation/forms.py:235 compensation/forms.py:330
#: compensation/templates/compensation/detail/compensation/includes/actions.html:34
#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:34
#: compensation/templates/compensation/detail/compensation/includes/documents.html:31
#: compensation/templates/compensation/detail/eco_account/includes/actions.html:34
#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:34
#: compensation/templates/compensation/detail/eco_account/includes/documents.html:31
#: ema/templates/ema/detail/includes/actions.html:34
#: ema/templates/ema/detail/includes/deadlines.html:34
#: ema/templates/ema/detail/includes/documents.html:31
#: intervention/forms.py:345
#: intervention/templates/intervention/detail/includes/documents.html:31
#: intervention/templates/intervention/detail/includes/revocation.html:35
#: konova/forms.py:315
msgid "Comment"
msgstr "Kommentar"
#: compensation/forms.py:237 compensation/forms.py:332
#: intervention/forms.py:347 konova/forms.py:317
msgid "Additional comment, maximum {} letters"
msgstr "Zusätzlicher Kommentar, maximal {} Zeichen"
#: compensation/forms.py:248
#: compensation/forms.py:276
msgid "New deadline"
msgstr "Neue Frist"
#: compensation/forms.py:249
#: compensation/forms.py:277
msgid "Insert data for the new deadline"
msgstr "Geben Sie die Daten der neuen Frist ein"
#: compensation/forms.py:259
msgid "If there is no date you can enter, please explain why."
msgstr "Falls Sie kein Datum angeben können, erklären Sie bitte weshalb."
#: compensation/forms.py:280
#: compensation/forms.py:294
msgid "Added deadline"
msgstr "Frist/Termin hinzugefügt"
#: compensation/forms.py:291
#: compensation/forms.py:305
msgid "Action Type"
msgstr "Maßnahmentyp"
#: compensation/forms.py:294
#: compensation/forms.py:308
msgid "Select the action type"
msgstr "Maßnahmentyp wählen"
#: compensation/forms.py:303
#: compensation/forms.py:317
#: compensation/templates/compensation/detail/compensation/includes/actions.html:37
#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:37
#: compensation/templates/compensation/detail/compensation/includes/documents.html:34
@ -194,33 +187,33 @@ msgstr "Maßnahmentyp wählen"
msgid "Action"
msgstr "Aktionen"
#: compensation/forms.py:308
#: compensation/forms.py:322
msgid "Unit"
msgstr "Einheit"
#: compensation/forms.py:311
#: compensation/forms.py:325
msgid "Select the unit"
msgstr "Einheit wählen"
#: compensation/forms.py:320
#: compensation/forms.py:334
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:31
#: intervention/templates/intervention/detail/includes/withdraws.html:31
msgid "Amount"
msgstr "Menge"
#: compensation/forms.py:323
#: compensation/forms.py:337
msgid "Insert the amount"
msgstr "Menge eingeben"
#: compensation/forms.py:343
#: compensation/forms.py:357
msgid "New action"
msgstr "Neue Maßnahme"
#: compensation/forms.py:344
#: compensation/forms.py:358
msgid "Insert data for the new action"
msgstr "Geben Sie die Daten der neuen Maßnahme ein"
#: compensation/forms.py:363
#: compensation/forms.py:377
msgid "Added action"
msgstr "Maßnahme hinzugefügt"
@ -249,7 +242,7 @@ msgid "Pieces"
msgstr "Stück"
#: compensation/tables.py:24 compensation/tables.py:164 ema/tables.py:28
#: intervention/forms.py:30 intervention/tables.py:23
#: intervention/forms.py:30 intervention/tables.py:24
#: intervention/templates/intervention/detail/includes/compensations.html:30
msgid "Identifier"
msgstr "Kennung"
@ -261,7 +254,7 @@ msgstr "Kennung"
#: compensation/templates/compensation/detail/eco_account/view.html:31
#: ema/tables.py:33 ema/templates/ema/detail/includes/documents.html:28
#: ema/templates/ema/detail/view.html:24 intervention/forms.py:37
#: intervention/tables.py:28
#: intervention/tables.py:29
#: intervention/templates/intervention/detail/includes/compensations.html:33
#: intervention/templates/intervention/detail/includes/documents.html:28
#: intervention/templates/intervention/detail/view.html:31 konova/forms.py:286
@ -270,7 +263,7 @@ msgstr "Bezeichnung"
#: compensation/tables.py:34
#: compensation/templates/compensation/detail/compensation/view.html:43
#: intervention/tables.py:33
#: intervention/tables.py:34
#: intervention/templates/intervention/detail/view.html:63 user/models.py:48
msgid "Checked"
msgstr "Geprüft"
@ -279,18 +272,18 @@ msgstr "Geprüft"
#: compensation/templates/compensation/detail/compensation/view.html:57
#: compensation/templates/compensation/detail/eco_account/view.html:43
#: ema/tables.py:38 ema/templates/ema/detail/view.html:28
#: intervention/tables.py:39
#: intervention/tables.py:40
#: intervention/templates/intervention/detail/view.html:77 user/models.py:49
msgid "Recorded"
msgstr "Verzeichnet"
#: compensation/tables.py:46 compensation/tables.py:185 ema/tables.py:44
#: intervention/tables.py:45
#: intervention/tables.py:52
msgid "Editable"
msgstr "Freigegeben"
#: compensation/tables.py:52 compensation/tables.py:191 ema/tables.py:50
#: intervention/tables.py:51
#: intervention/tables.py:58
msgid "Last edit"
msgstr "Zuletzt bearbeitet"
@ -300,7 +293,7 @@ msgid "Compensations"
msgstr "Kompensationen"
#: compensation/tables.py:83 compensation/tables.py:222 ema/tables.py:82
#: intervention/tables.py:92
#: intervention/tables.py:89
msgid "Open {}"
msgstr "Öffne {}"
@ -310,11 +303,11 @@ msgstr "Öffne {}"
msgid "Compensation"
msgstr "Kompensation"
#: compensation/tables.py:104 intervention/tables.py:111
#: compensation/tables.py:104 intervention/tables.py:108
msgid "Not checked yet"
msgstr "Noch nicht geprüft"
#: compensation/tables.py:109 intervention/tables.py:116
#: compensation/tables.py:109 intervention/tables.py:113
msgid "Checked on {} by {}"
msgstr "Am {} von {} geprüft worden"
@ -322,23 +315,23 @@ msgstr "Am {} von {} geprüft worden"
#: compensation/templates/compensation/detail/compensation/view.html:60
#: compensation/templates/compensation/detail/eco_account/view.html:46
#: ema/tables.py:101 ema/templates/ema/detail/view.html:31
#: intervention/tables.py:135
#: intervention/tables.py:132
#: intervention/templates/intervention/detail/view.html:80
msgid "Not recorded yet"
msgstr "Noch nicht verzeichnet"
#: compensation/tables.py:133 compensation/tables.py:260 ema/tables.py:106
#: intervention/tables.py:140
#: intervention/tables.py:137
msgid "Recorded on {} by {}"
msgstr "Am {} von {} verzeichnet worden"
#: compensation/tables.py:156 compensation/tables.py:283 ema/tables.py:129
#: intervention/tables.py:163
#: intervention/tables.py:160
msgid "Full access granted"
msgstr "Für Sie freigegeben - Datensatz kann bearbeitet werden"
#: compensation/tables.py:156 compensation/tables.py:283 ema/tables.py:129
#: intervention/tables.py:163
#: intervention/tables.py:160
msgid "Access not granted"
msgstr "Nicht freigegeben - Datensatz nur lesbar"
@ -354,7 +347,7 @@ msgstr "Ökokonten"
#: compensation/tables.py:222
#: compensation/templates/compensation/detail/eco_account/view.html:19
#: intervention/forms.py:458 intervention/forms.py:465
#: intervention/forms.py:462 intervention/forms.py:469
#: konova/templates/konova/home.html:88 templates/navbar.html:34
msgid "Eco-account"
msgstr "Ökokonto"
@ -850,29 +843,29 @@ msgstr "Datum des Widerspruchs"
msgid "Document"
msgstr "Dokument"
#: intervention/forms.py:335 konova/forms.py:305
#: intervention/forms.py:336 konova/forms.py:305
msgid "Must be smaller than 15 Mb"
msgstr "Muss kleiner als 15 Mb sein"
#: intervention/forms.py:358
#: intervention/forms.py:359
#: intervention/templates/intervention/detail/includes/revocation.html:18
msgid "Add revocation"
msgstr "Widerspruch hinzufügen"
#: intervention/forms.py:396
#: intervention/forms.py:400
msgid "Checked intervention data"
msgstr "Eingriffsdaten geprüft"
#: intervention/forms.py:402
#: intervention/forms.py:406
msgid "Checked compensations data and payments"
msgstr "Kompensationen und Zahlungen geprüft"
#: intervention/forms.py:410
#: intervention/forms.py:414
#: intervention/templates/intervention/detail/includes/controls.html:19
msgid "Run check"
msgstr "Prüfung vornehmen"
#: intervention/forms.py:411 konova/forms.py:376
#: intervention/forms.py:415 konova/forms.py:376
msgid ""
"I, {} {}, confirm that all necessary control steps have been performed by "
"myself."
@ -880,30 +873,30 @@ msgstr ""
"Ich, {} {}, bestätige, dass die notwendigen Kontrollschritte durchgeführt "
"wurden:"
#: intervention/forms.py:460
#: intervention/forms.py:464
msgid "Only recorded accounts can be selected for withdraws"
msgstr "Nur verzeichnete Ökokonten können für Abbuchungen verwendet werden."
#: intervention/forms.py:479 intervention/forms.py:486
#: intervention/tables.py:92
#: intervention/forms.py:483 intervention/forms.py:490
#: intervention/tables.py:89
#: intervention/templates/intervention/detail/view.html:19
#: konova/templates/konova/home.html:11 templates/navbar.html:22
msgid "Intervention"
msgstr "Eingriff"
#: intervention/forms.py:481
#: intervention/forms.py:485
msgid "Only shared interventions can be selected"
msgstr "Nur freigegebene Eingriffe können gewählt werden"
#: intervention/forms.py:494
#: intervention/forms.py:498
msgid "New Withdraw"
msgstr "Neue Abbuchung"
#: intervention/forms.py:495
#: intervention/forms.py:499
msgid "Enter the information for a new withdraw from a chosen eco-account"
msgstr "Geben Sie die Informationen für eine neue Abbuchung ein."
#: intervention/forms.py:531
#: intervention/forms.py:535
msgid ""
"Eco-account {} is not recorded yet. You can only withdraw from recorded "
"accounts."
@ -911,7 +904,7 @@ msgstr ""
"Ökokonto {} ist noch nicht verzeichnet. Abbuchungen können nur von "
"verzeichneten Ökokonten erfolgen."
#: intervention/forms.py:544
#: intervention/forms.py:548
msgid ""
"The account {} has not enough surface for a withdraw of {} m². There are "
"only {} m² left"
@ -947,10 +940,24 @@ msgstr "Datum Bestandskraft fehlt"
msgid "Legal data missing"
msgstr "Rechtliche Daten fehlen"
#: intervention/tables.py:70
#: intervention/tables.py:46
#: intervention/templates/intervention/detail/includes/revocation.html:8
#: intervention/templates/intervention/detail/view.html:99
msgid "Revocation"
msgstr "Widerspruch"
#: intervention/tables.py:67
msgid "Interventions"
msgstr "Eingriffe"
#: intervention/tables.py:177
msgid "No revocation"
msgstr "Kein Widerspruch"
#: intervention/tables.py:183
msgid "Revocation from {}, added on {} by {}"
msgstr "Widerspruch vom {}, am {} von {} hinzugefügt"
#: intervention/templates/intervention/detail/includes/compensations.html:14
msgid "Add new compensation"
msgstr "Neue Kompensation hinzufügen"
@ -972,25 +979,16 @@ msgctxt "money"
msgid "Amount"
msgstr "Betrag"
#: intervention/templates/intervention/detail/includes/payments.html:34
msgid "Transfer comment"
msgstr "Verwendungszweck"
#: intervention/templates/intervention/detail/includes/payments.html:51
msgid "Remove payment"
msgstr "Zahlung entfernen"
#: intervention/templates/intervention/detail/includes/revocation.html:8
#: intervention/templates/intervention/detail/view.html:99
msgid "Revocation"
msgstr "Widerspruch"
#: intervention/templates/intervention/detail/includes/revocation.html:32
msgctxt "Revocation"
msgid "From"
msgstr "Vom"
#: intervention/templates/intervention/detail/includes/revocation.html:60
#: intervention/templates/intervention/detail/includes/revocation.html:62
msgid "Remove revocation"
msgstr "Widerspruch entfernen"
@ -2671,6 +2669,15 @@ msgstr ""
msgid "A fontawesome icon field"
msgstr ""
#~ msgid "Transfer note"
#~ msgstr "Verwendungszweck"
#~ msgid "Note for money transfer"
#~ msgstr "Verwendungszweck für Überweisung"
#~ msgid "Transfer comment"
#~ msgstr "Verwendungszweck"
#~ msgid "EMA recorded"
#~ msgstr "EMA verzeichnet"

Loading…
Cancel
Save