EcoAccount detail view

* adds record control button
* adds html markup for invalid withdraws (unrecorded account)
* adds constraint to is_valid() method of NewWithdrawForm for checking whether the selected account for a withdraw is recorded or not
* adds/updates translations
This commit is contained in:
mipel 2021-08-10 14:15:42 +02:00
parent 09d7cad8c8
commit bd2413d63c
6 changed files with 139 additions and 111 deletions

View File

@ -12,6 +12,13 @@
</button>
</a>
{% if has_access %}
{% if is_ets_member %}
<a href="{% url 'home' %}" class="mr-2">
<button class="btn btn-default" title="{% trans 'Record' %}">
{% fa5_icon 'bookmark' %}
</button>
</a>
{% endif %}
{% if is_default_member %}
<a href="{% url 'home' %}" class="mr-2">
<button class="btn btn-default" title="{% trans 'Edit' %}">

View File

@ -40,9 +40,12 @@
</thead>
<tbody>
{% for withdraw in obj.withdraws.all %}
<tr>
<tr {% if withdraw.account.deleted %}class="align-middle alert-danger" title="{% trans 'Eco-account deleted! Withdraw invalid!' %}" {% elif not withdraw.account.recorded %}class="align-middle alert-danger" title="{% trans 'Eco-account not recorded! Withdraw invalid!' %}" {% endif %}>
<td class="align-middle">
<a href="{% url 'intervention:open' withdraw.intervention.id %}">
{% if withdraw.account.deleted or not withdraw.account.recorded %}
{% fa5_icon 'exclamation-triangle' %}
{% endif %}
{{ withdraw.intervention.identifier }}
</a>
</td>

View File

@ -439,7 +439,7 @@ class NewWithdrawForm(BaseModalForm):
label=_("Eco-account"),
label_suffix="",
help_text=_("Only recorded accounts can be selected for withdraws"),
queryset=EcoAccount.objects.filter(deleted=None, recorded__isnull=False),
queryset=EcoAccount.objects.filter(deleted=None),
widget=autocomplete.ModelSelect2(
url="accounts-autocomplete",
attrs={
@ -506,6 +506,14 @@ class NewWithdrawForm(BaseModalForm):
else:
acc = self.instance
if not acc.recorded:
self.add_error(
"account",
_("Eco-account {} is not recorded yet. You can only withdraw from recorded accounts.").format(acc.identifier)
)
return False
# Calculate valid surface
sum_surface = acc.get_surface()
sum_surface_withdraws = acc.get_surface_withdraws()
rest_surface = sum_surface - sum_surface_withdraws

View File

@ -40,10 +40,10 @@
</thead>
<tbody>
{% for withdraw in intervention.withdraws.all %}
<tr {% if withdraw.account.deleted %}class="align-middle alert-danger" title="{% trans 'Eco-account deleted! Withdraw invalid!' %}" {% endif %}>
<tr {% if withdraw.account.deleted %}class="align-middle alert-danger" title="{% trans 'Eco-account deleted! Withdraw invalid!' %}" {% elif not withdraw.account.recorded %}class="align-middle alert-danger" title="{% trans 'Eco-account not recorded! Withdraw invalid!' %}" {% endif %}>
<td class="align-middle">
<a href="{% url 'compensation:acc-open' withdraw.account.id %}">
{% if withdraw.account.deleted %}
{% if withdraw.account.deleted or not withdraw.account.recorded %}
{% fa5_icon 'exclamation-triangle' %}
{% endif %}
{{ withdraw.account.identifier }}

Binary file not shown.

View File

@ -4,7 +4,7 @@
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#: compensation/filters.py:71 compensation/forms.py:42 compensation/forms.py:47
#: compensation/forms.py:60 compensation/forms.py:203 compensation/forms.py:271
#: compensation/forms.py:60 compensation/forms.py:207 compensation/forms.py:275
#: intervention/filters.py:26 intervention/filters.py:40
#: intervention/filters.py:47 intervention/filters.py:48
#: intervention/forms.py:319 intervention/forms.py:331
@ -16,7 +16,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-10 12:35+0200\n"
"POT-Creation-Date: 2021-08-10 14:11+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,7 +30,7 @@ msgstr ""
msgid "Show only unrecorded"
msgstr "Nur unverzeichnete anzeigen"
#: compensation/forms.py:41 compensation/forms.py:260
#: compensation/forms.py:41 compensation/forms.py:264
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:31
#: intervention/templates/intervention/detail/includes/withdraws.html:31
msgid "Amount"
@ -106,26 +106,26 @@ msgstr "Zustand hinzugefügt"
msgid "Object removed"
msgstr "Objekt entfernt"
#: compensation/forms.py:175
#: compensation/forms.py:179
msgid "Deadline Type"
msgstr "Fristart"
#: compensation/forms.py:178
#: compensation/forms.py:182
msgid "Select the deadline type"
msgstr "Fristart wählen"
#: compensation/forms.py:187
#: compensation/forms.py:191
#: compensation/templates/compensation/detail/compensation/includes/deadlines.html:31
#: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:31
#: intervention/forms.py:318
msgid "Date"
msgstr "Datum"
#: compensation/forms.py:190
#: compensation/forms.py:194
msgid "Select date"
msgstr "Datum wählen"
#: compensation/forms.py:202 compensation/forms.py:270
#: compensation/forms.py:206 compensation/forms.py:274
#: 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
@ -139,76 +139,76 @@ msgstr "Datum wählen"
msgid "Comment"
msgstr "Kommentar"
#: compensation/forms.py:204 compensation/forms.py:272
#: compensation/forms.py:208 compensation/forms.py:276
#: intervention/forms.py:344 konova/forms.py:290
msgid "Additional comment, maximum {} letters"
msgstr "Zusätzlicher Kommentar, maximal {} Zeichen"
#: compensation/forms.py:215
#: compensation/forms.py:219
msgid "New deadline"
msgstr "Neue Frist"
#: compensation/forms.py:216
#: compensation/forms.py:220
msgid "Insert data for the new deadline"
msgstr "Geben Sie die Daten der neuen Frist ein"
#: compensation/forms.py:233
#: compensation/forms.py:237
msgid "Added deadline"
msgstr "Frist/Termin hinzugefügt"
#: compensation/forms.py:242
#: compensation/forms.py:246
msgid "Action Type"
msgstr "Maßnahmentyp"
#: compensation/forms.py:245
#: compensation/forms.py:249
msgid "Select the action type"
msgstr "Maßnahmentyp wählen"
#: compensation/forms.py:248
#: compensation/forms.py:252
msgid "Unit"
msgstr "Einheit"
#: compensation/forms.py:251
#: compensation/forms.py:255
msgid "Select the unit"
msgstr "Einheit wählen"
#: compensation/forms.py:263
#: compensation/forms.py:267
msgid "Insert the amount"
msgstr "Menge eingeben"
#: compensation/forms.py:283
#: compensation/forms.py:287
msgid "New action"
msgstr "Neue Maßnahme"
#: compensation/forms.py:284
#: compensation/forms.py:288
msgid "Insert data for the new action"
msgstr "Geben Sie die Daten der neuen Maßnahme ein"
#: compensation/forms.py:302
#: compensation/forms.py:306
msgid "Added action"
msgstr "Maßnahme hinzugefügt"
#: compensation/models.py:58
#: compensation/models.py:59
msgid "cm"
msgstr ""
#: compensation/models.py:59
#: compensation/models.py:60
msgid "m"
msgstr ""
#: compensation/models.py:60
#: compensation/models.py:61
msgid "km"
msgstr ""
#: compensation/models.py:61
#: compensation/models.py:62
msgid "m²"
msgstr ""
#: compensation/models.py:62
#: compensation/models.py:63
msgid "ha"
msgstr ""
#: compensation/models.py:63
#: compensation/models.py:64
msgid "Pieces"
msgstr "Stück"
@ -222,26 +222,26 @@ msgstr "Kennung"
#: compensation/templates/compensation/detail/compensation/includes/documents.html:28
#: compensation/templates/compensation/detail/compensation/view.html:24
#: compensation/templates/compensation/detail/eco_account/includes/documents.html:28
#: compensation/templates/compensation/detail/eco_account/view.html:24
#: compensation/templates/compensation/detail/eco_account/view.html:31
#: intervention/forms.py:36 intervention/tables.py:28
#: intervention/templates/intervention/detail/includes/compensations.html:33
#: intervention/templates/intervention/detail/includes/documents.html:28
#: intervention/templates/intervention/detail/view.html:24 konova/forms.py:259
#: intervention/templates/intervention/detail/view.html:31 konova/forms.py:259
msgid "Title"
msgstr "Bezeichnung"
#: compensation/tables.py:36
#: compensation/templates/compensation/detail/compensation/view.html:36
#: intervention/tables.py:33
#: intervention/templates/intervention/detail/view.html:56 user/models.py:48
#: intervention/templates/intervention/detail/view.html:63 user/models.py:48
msgid "Checked"
msgstr "Geprüft"
#: compensation/tables.py:42 compensation/tables.py:181
#: compensation/templates/compensation/detail/compensation/view.html:50
#: compensation/templates/compensation/detail/eco_account/view.html:36
#: compensation/templates/compensation/detail/eco_account/view.html:43
#: intervention/tables.py:39
#: intervention/templates/intervention/detail/view.html:70 user/models.py:49
#: intervention/templates/intervention/detail/view.html:77 user/models.py:49
msgid "Recorded"
msgstr "Verzeichnet"
@ -281,9 +281,9 @@ msgstr "Am {} von {} geprüft worden"
#: compensation/tables.py:130
#: compensation/templates/compensation/detail/compensation/view.html:53
#: compensation/templates/compensation/detail/eco_account/view.html:39
#: compensation/templates/compensation/detail/eco_account/view.html:46
#: intervention/tables.py:135
#: intervention/templates/intervention/detail/view.html:73
#: intervention/templates/intervention/detail/view.html:80
msgid "Not recorded yet"
msgstr "Noch nicht verzeichnet"
@ -303,7 +303,7 @@ msgid "Access not granted"
msgstr "Nicht freigegeben - Datensatz nur lesbar"
#: compensation/tables.py:176
#: compensation/templates/compensation/detail/eco_account/view.html:28
#: compensation/templates/compensation/detail/eco_account/view.html:35
#: konova/templates/konova/custom_widgets/progressbar.html:3
msgid "Available"
msgstr "Verfügbar"
@ -313,7 +313,7 @@ msgid "Eco Accounts"
msgstr "Ökokonten"
#: compensation/tables.py:224
#: compensation/templates/compensation/detail/eco_account/view.html:12
#: compensation/templates/compensation/detail/eco_account/view.html:19
#: intervention/forms.py:439 intervention/forms.py:446
#: konova/templates/konova/home.html:88 templates/navbar.html:34
msgid "Eco-account"
@ -491,43 +491,37 @@ msgid "compensates intervention"
msgstr "kompensiert Eingriff"
#: compensation/templates/compensation/detail/compensation/view.html:43
#: intervention/templates/intervention/detail/view.html:63
#: intervention/templates/intervention/detail/view.html:70
msgid "Checked on "
msgstr "Geprüft am "
#: compensation/templates/compensation/detail/compensation/view.html:43
#: compensation/templates/compensation/detail/compensation/view.html:57
#: compensation/templates/compensation/detail/eco_account/view.html:43
#: intervention/templates/intervention/detail/view.html:63
#: intervention/templates/intervention/detail/view.html:77
#: compensation/templates/compensation/detail/eco_account/view.html:50
#: intervention/templates/intervention/detail/view.html:70
#: intervention/templates/intervention/detail/view.html:84
msgid "by"
msgstr "von"
#: compensation/templates/compensation/detail/compensation/view.html:57
#: compensation/templates/compensation/detail/eco_account/view.html:43
#: intervention/templates/intervention/detail/view.html:77
#: compensation/templates/compensation/detail/eco_account/view.html:50
#: intervention/templates/intervention/detail/view.html:84
msgid "Recorded on "
msgstr "Verzeichnet am"
#: compensation/templates/compensation/detail/compensation/view.html:64
#: compensation/templates/compensation/detail/eco_account/view.html:50
#: intervention/templates/intervention/detail/view.html:96
#: compensation/templates/compensation/detail/eco_account/view.html:57
#: intervention/templates/intervention/detail/view.html:103
msgid "Last modified"
msgstr "Zuletzt bearbeitet"
#: compensation/templates/compensation/detail/compensation/view.html:72
#: compensation/templates/compensation/detail/eco_account/view.html:58
#: compensation/templates/compensation/detail/eco_account/view.html:65
#: intervention/forms.py:252
#: intervention/templates/intervention/detail/view.html:104
#: intervention/templates/intervention/detail/view.html:111
msgid "Shared with"
msgstr "Freigegeben für"
#: compensation/templates/compensation/detail/compensation/view.html:84
#: compensation/templates/compensation/detail/eco_account/view.html:70
#: intervention/templates/intervention/detail/view.html:116
msgid "No geometry added, yet."
msgstr "Keine Geometrie vorhanden"
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:8
#: intervention/templates/intervention/detail/includes/withdraws.html:8
msgid "Eco Account Withdraws"
@ -548,57 +542,67 @@ msgstr "Eingriffskennung"
msgid "Created"
msgstr "Erstellt"
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:53
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:43
#: intervention/templates/intervention/detail/includes/withdraws.html:43
msgid "Eco-account deleted! Withdraw invalid!"
msgstr "Ökokonto gelöscht! Abbuchung ungültig!"
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:43
#: intervention/templates/intervention/detail/includes/withdraws.html:43
msgid "Eco-account not recorded! Withdraw invalid!"
msgstr "Ökokonto nicht verzeichnet! Abbuchung ungültig!"
#: compensation/templates/compensation/detail/eco_account/includes/withdraws.html:56
#: intervention/templates/intervention/detail/includes/withdraws.html:56
msgid "Remove Withdraw"
msgstr "Abbuchung entfernen"
#: compensation/views/compensation_views.py:121
#: compensation/views/eco_account_views.py:184 intervention/views.py:391
#: compensation/views/compensation_views.py:122
#: compensation/views/eco_account_views.py:185 intervention/views.py:392
msgid "Log"
msgstr "Log"
#: compensation/views/compensation_views.py:142
#: compensation/views/compensation_views.py:143
msgid "Compensation removed"
msgstr "Kompensation entfernt"
#: compensation/views/compensation_views.py:161
#: compensation/views/eco_account_views.py:261 intervention/views.py:96
#: compensation/views/compensation_views.py:162
#: compensation/views/eco_account_views.py:262 intervention/views.py:96
msgid "Document added"
msgstr "Dokument hinzugefügt"
#: compensation/views/compensation_views.py:180
#: compensation/views/eco_account_views.py:205
#: compensation/views/compensation_views.py:181
#: compensation/views/eco_account_views.py:206
msgid "State added"
msgstr "Zustand hinzugefügt"
#: compensation/views/compensation_views.py:199
#: compensation/views/eco_account_views.py:224
#: compensation/views/compensation_views.py:200
#: compensation/views/eco_account_views.py:225
msgid "Action added"
msgstr "Maßnahme hinzugefügt"
#: compensation/views/compensation_views.py:218
#: compensation/views/eco_account_views.py:243
#: compensation/views/compensation_views.py:219
#: compensation/views/eco_account_views.py:244
msgid "Deadline added"
msgstr "Frist hinzugefügt"
#: compensation/views/compensation_views.py:237
#: compensation/views/compensation_views.py:238
msgid "State removed"
msgstr "Zustand gelöscht"
#: compensation/views/compensation_views.py:256
#: compensation/views/compensation_views.py:257
msgid "Action removed"
msgstr "Maßnahme entfernt"
#: compensation/views/eco_account_views.py:134
#: compensation/views/eco_account_views.py:135
msgid "Eco-account removed"
msgstr "Ökokonto entfernt"
#: compensation/views/eco_account_views.py:161
#: compensation/views/eco_account_views.py:162
msgid "Withdraw removed"
msgstr "Abbuchung entfernt"
#: compensation/views/eco_account_views.py:281 intervention/views.py:413
#: compensation/views/eco_account_views.py:282 intervention/views.py:414
msgid "Withdraw added"
msgstr "Abbuchung hinzugefügt"
@ -635,7 +639,7 @@ msgid "Which intervention type is this"
msgstr "Welcher Eingriffstyp"
#: intervention/forms.py:47
#: intervention/templates/intervention/detail/view.html:32
#: intervention/templates/intervention/detail/view.html:39
msgid "Law"
msgstr "Gesetz"
@ -644,7 +648,7 @@ msgid "Based on which law"
msgstr "Basiert auf welchem Recht"
#: intervention/forms.py:53
#: intervention/templates/intervention/detail/view.html:52
#: intervention/templates/intervention/detail/view.html:59
msgid "Intervention handler"
msgstr "Eingriffsverursacher"
@ -758,7 +762,7 @@ msgstr "Nur verzeichnete Ökokonten können für Abbuchungen verwendet werden."
#: intervention/forms.py:460 intervention/forms.py:467
#: intervention/tables.py:92 intervention/tables.py:172
#: intervention/templates/intervention/detail/view.html:12
#: intervention/templates/intervention/detail/view.html:19
#: konova/templates/konova/home.html:11 templates/navbar.html:22
msgid "Intervention"
msgstr "Eingriff"
@ -775,7 +779,13 @@ msgstr "Neue Abbuchung"
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:517
#: intervention/forms.py:512
msgid ""
"Eco-account {} is not recorded yet. You can only withdraw from recorded "
"accounts."
msgstr ""
#: intervention/forms.py:525
msgid ""
"The account {} has not enough surface for a withdraw of {} m². There are "
"only {} m² left"
@ -783,19 +793,19 @@ msgstr ""
"Das Ökokonto {} hat für eine Abbuchung von {} m² nicht ausreichend "
"Restfläche. Es stehen noch {} m² zur Verfügung."
#: intervention/models.py:203
#: intervention/templates/intervention/detail/view.html:23
#: intervention/templates/intervention/detail/view.html:27
#: intervention/templates/intervention/detail/view.html:31
#: intervention/templates/intervention/detail/view.html:39
#: intervention/templates/intervention/detail/view.html:51
#: intervention/templates/intervention/detail/view.html:83
#: intervention/templates/intervention/detail/view.html:87
#: intervention/templates/intervention/detail/view.html:91
#: intervention/models.py:204
#: intervention/templates/intervention/detail/view.html:30
#: intervention/templates/intervention/detail/view.html:34
#: intervention/templates/intervention/detail/view.html:38
#: intervention/templates/intervention/detail/view.html:46
#: intervention/templates/intervention/detail/view.html:58
#: intervention/templates/intervention/detail/view.html:90
#: intervention/templates/intervention/detail/view.html:94
#: intervention/templates/intervention/detail/view.html:98
msgid "Missing"
msgstr "Fehlt"
#: intervention/models.py:204
#: intervention/models.py:205
msgid "Exists"
msgstr "Existiert"
@ -845,7 +855,7 @@ msgid "Remove payment"
msgstr "Zahlung entfernen"
#: intervention/templates/intervention/detail/includes/revocation.html:8
#: intervention/templates/intervention/detail/view.html:92
#: intervention/templates/intervention/detail/view.html:99
msgid "Revocation"
msgstr "Widerspruch"
@ -862,35 +872,31 @@ msgstr "Widerspruch entfernen"
msgid "Account Identifier"
msgstr "Ökokonto Kennung"
#: intervention/templates/intervention/detail/includes/withdraws.html:43
msgid "Eco-account deleted! Withdraw invalid!"
msgstr "Ökokonto gelöscht! Abbuchung ungültig!"
#: intervention/templates/intervention/detail/view.html:28
#: intervention/templates/intervention/detail/view.html:35
msgid "Process type"
msgstr "Verfahrenstyp"
#: intervention/templates/intervention/detail/view.html:36
#: intervention/templates/intervention/detail/view.html:43
msgid "Registration office"
msgstr "Zulassungsbehörde"
#: intervention/templates/intervention/detail/view.html:40
#: intervention/templates/intervention/detail/view.html:47
msgid "Registration office file number"
msgstr "Aktenzeichen Zulassungsbehörde"
#: intervention/templates/intervention/detail/view.html:44
#: intervention/templates/intervention/detail/view.html:51
msgid "Conservation office"
msgstr "Naturschutzbehörde"
#: intervention/templates/intervention/detail/view.html:48
#: intervention/templates/intervention/detail/view.html:55
msgid "Conversation office file number"
msgstr "Aktenzeichen Naturschutzbehörde"
#: intervention/templates/intervention/detail/view.html:84
#: intervention/templates/intervention/detail/view.html:91
msgid "Registration date"
msgstr "Datum Zulassung bzw. Satzungsbeschluss"
#: intervention/templates/intervention/detail/view.html:88
#: intervention/templates/intervention/detail/view.html:95
msgid "Binding on"
msgstr "Datum Bestandskraft"
@ -898,7 +904,7 @@ msgstr "Datum Bestandskraft"
msgid "Intervention {} added"
msgstr "Eingriff {} hinzugefügt"
#: intervention/views.py:71 intervention/views.py:171
#: intervention/views.py:71 intervention/views.py:172
msgid "Invalid input"
msgstr "Eingabe fehlerhaft"
@ -906,7 +912,7 @@ msgstr "Eingabe fehlerhaft"
msgid "This intervention has a revocation from {}"
msgstr "Es existiert ein Widerspruch vom {}"
#: intervention/views.py:145
#: intervention/views.py:146
msgid ""
"Remember: This data has not been shared with you, yet. This means you can "
"only read but can not edit or perform any actions like running a check or "
@ -916,47 +922,47 @@ msgstr ""
"bedeutet, dass Sie nur lesenden Zugriff hierauf haben und weder bearbeiten, "
"noch Prüfungen durchführen oder verzeichnen können."
#: intervention/views.py:168
#: intervention/views.py:169
msgid "{} edited"
msgstr "{} bearbeitet"
#: intervention/views.py:197
#: intervention/views.py:198
msgid "{} removed"
msgstr "{} entfernt"
#: intervention/views.py:218
#: intervention/views.py:219
msgid "Revocation removed"
msgstr "Widerspruch entfernt"
#: intervention/views.py:244
#: intervention/views.py:245
msgid "{} has already been shared with you"
msgstr "{} wurde bereits für Sie freigegeben"
#: intervention/views.py:249
#: intervention/views.py:250
msgid "{} has been shared with you"
msgstr "{} ist nun für Sie freigegeben"
#: intervention/views.py:256
#: intervention/views.py:257
msgid "Share link invalid"
msgstr "Freigabelink ungültig"
#: intervention/views.py:280
#: intervention/views.py:281
msgid "Share settings updated"
msgstr "Freigabe Einstellungen aktualisiert"
#: intervention/views.py:311
#: intervention/views.py:312
msgid "Check performed"
msgstr "Prüfung durchgeführt"
#: intervention/views.py:316
#: intervention/views.py:317
msgid "There has been errors on this intervention:"
msgstr "Es liegen Fehler in diesem Eingriff vor:"
#: intervention/views.py:322
#: intervention/views.py:323
msgid "{}: {}"
msgstr ""
#: intervention/views.py:354
#: intervention/views.py:355
msgid "Revocation added"
msgstr "Widerspruch hinzugefügt"
@ -1194,6 +1200,10 @@ msgstr ""
msgid "User"
msgstr "Nutzer"
#: templates/map/geom_form.html:9
msgid "No geometry added, yet."
msgstr "Keine Geometrie vorhanden"
#: templates/modal/modal_form.html:25
msgid "Continue"
msgstr "Weiter"