Intervention revocation

* adds Revocation model to interventions/models.py
* adds revocations to interventions detail view
* fixes duplicated ids in html includes
* refactors controls for detail view into included template files (controls.html)
* reduces max length for payment transfer notes from 1000 to 200
* adds RevocationAdmin to intervention/admin.py
* adds new form for adding a Revocation to an intervention's legal_data
  * only one revocation per intervention possible
  * removes add button in case of an existing revocation
* adds revocation routes to intervention app
* renames document field in Document model into file for more clarity
* adds/updates translations
This commit is contained in:
mipel
2021-08-04 13:32:35 +02:00
parent d7c95c9e70
commit 6818ef290e
25 changed files with 495 additions and 197 deletions

View File

@@ -1,5 +1,5 @@
{% load i18n l10n fontawesome_5 %}
<div id="related-compensations" class="card">
<div id="compensations" class="card">
<div class="card-header rlp-r">
<div class="row">
<div class="col-sm-6">

View File

@@ -0,0 +1,43 @@
{% load i18n l10n fontawesome_5 %}
<div class="d-flex justify-content-end">
<a href="{% url 'home' %}" class="mr-2">
<button class="btn btn-default" title="{% trans 'Open in LANIS' %}">
LANIS
</button>
</a>
<a href="{% url 'home' %}" class="mr-2">
<button class="btn btn-default" title="{% trans 'Public report' %}">
{% fa5_icon 'file-alt' %}
</button>
</a>
{% if has_access %}
<button class="btn btn-default btn-modal mr-2" title="{% trans 'Share' %}" data-form-url="{% url 'intervention:share-create' intervention.id %}">
{% fa5_icon 'share-alt' %}
</button>
{% if is_zb_member %}
<a href="{% url 'home' %}" class="mr-2">
<button class="btn btn-default" title="{% trans 'Run check' %}">
{% fa5_icon 'star' %}
</button>
</a>
{% endif %}
{% 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' %}">
{% fa5_icon 'edit' %}
</button>
</a>
<button class="btn btn-default btn-modal" data-form-url="{% url 'intervention:remove' intervention.id %}" title="{% trans 'Delete' %}">
{% fa5_icon 'trash' %}
</button>
{% endif %}
{% endif %}
</div>

View File

@@ -1,5 +1,5 @@
{% load i18n l10n fontawesome_5 %}
<div id="related-documents" class="card">
<div id="documents" class="card">
<div class="card-header rlp-r">
<div class="row">
<div class="col-sm-6">

View File

@@ -1,5 +1,5 @@
{% load i18n l10n fontawesome_5 %}
<div id="related-eco-account-withdraws" class="card">
<div id="eco-account-withdraws" class="card">
<div class="card-header rlp-r">
<div class="row">
<div class="col-sm-6">

View File

@@ -1,5 +1,5 @@
{% load i18n l10n fontawesome_5 %}
<div id="related-payments" class="card">
<div id="payments" class="card">
<div class="card-header rlp-r">
<div class="row">
<div class="col-sm-6">

View File

@@ -0,0 +1,70 @@
{% load i18n l10n fontawesome_5 %}
<div id="revocation" class="card">
<div class="card-header rlp-r">
<div class="row">
<div class="col-sm-6">
<h5>
<span class="badge badge-light">{% if intervention.legal.revocation %}1{% else %}0{% endif %}</span>
{% trans 'Revocation' %}
</h5>
</div>
<div class="col-sm-6">
<div class="d-flex justify-content-end">
{% comment %}
Only show add-button if no revocation exists, yet.
{% endcomment %}
{% if is_default_member and has_access and not intervention.legal.revocation %}
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:revocation-new' intervention.id %}" title="{% trans 'Add revocation' %}">
{% fa5_icon 'plus' %}
{% fa5_icon 'ban' %}
</button>
{% endif %}
</div>
</div>
</div>
</div>
<div class="card-body scroll-300">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">
{% trans 'From' context 'Revocation' %}
</th>
<th scope="col">
{% trans 'Comment' %}
</th>
<th scope="col">
{% trans 'Document' %}
</th>
<th scope="col">
{% trans 'Action' %}
</th>
</tr>
</thead>
<tbody>
{% if intervention.legal.revocation %}
{% with intervention.legal.revocation as rev %}
<tr>
<td class="align-middle">
{{ rev.date }}
</td>
<td class="align-middle">{{ rev.comment }}</td>
<td class="align-middle">
<a href="{% url 'doc-open' rev.document.id %}">
{{ rev.document.file }}
</a>
</td>
<td>
{% if is_default_member and has_access %}
<button data-form-url="{% url 'intervention:revocation-remove' rev.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove revocation' %}">
{% fa5_icon 'trash' %}
</button>
{% endif %}
</td>
</tr>
{% endwith %}
{% endif %}
</tbody>
</table>
</div>
</div>

View File

@@ -12,47 +12,7 @@
<h3>{% trans 'Intervention' %} {{intervention.identifier}}</h3>
</div>
<div class="col-sm-12 col-md-12 col-lg-6">
<div class="d-flex justify-content-end">
<a href="{% url 'home' %}" class="mr-2">
<button class="btn btn-default" title="{% trans 'Open in LANIS' %}">
LANIS
</button>
</a>
<a href="{% url 'home' %}" class="mr-2">
<button class="btn btn-default" title="{% trans 'Public report' %}">
{% fa5_icon 'file-alt' %}
</button>
</a>
{% if has_access %}
<button class="btn btn-default btn-modal mr-2" title="{% trans 'Share' %}" data-form-url="{% url 'intervention:share-create' intervention.id %}">
{% fa5_icon 'share-alt' %}
</button>
{% if is_zb_member %}
<a href="{% url 'home' %}" class="mr-2">
<button class="btn btn-default" title="{% trans 'Run check' %}">
{% fa5_icon 'star' %}
</button>
</a>
{% endif %}
{% 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' %}">
{% fa5_icon 'edit' %}
</button>
</a>
<button class="btn btn-default btn-modal" data-form-url="{% url 'intervention:remove' intervention.id %}" title="{% trans 'Delete' %}">
{% fa5_icon 'trash' %}
</button>
{% endif %}
{% endif %}
</div>
{% include 'intervention/detail/includes/controls.html' %}
</div>
</div>
<hr>
@@ -128,6 +88,10 @@
<th scope="row">{% trans 'Binding on' %}</th>
<td class="align-middle">{{intervention.legal.binding_date|default_if_none:""}}</td>
</tr>
<tr {% if intervention.legal.revocation %}class="alert alert-danger"{% endif %}>
<th scope="row">{% trans 'Revocation' %}</th>
<td class="align-middle">{{intervention.legal.revocation.date|naturalday|default_if_none:""}}</td>
</tr>
<tr>
<th scope="row">{% trans 'Last modified' %}</th>
<td class="align-middle">
@@ -171,9 +135,16 @@
<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/revocation.html' %}
</div>
</div>
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-6">
{% include 'intervention/detail/includes/documents.html' %}
</div>
<div class="col-sm-12 col-md-12 col-lg-6">
</div>
</div>