diff --git a/intervention/forms/modalForms.py b/intervention/forms/modalForms.py index a240d8f6..f8a419d2 100644 --- a/intervention/forms/modalForms.py +++ b/intervention/forms/modalForms.py @@ -7,7 +7,7 @@ Created on: 27.09.21 """ from dal import autocomplete -from konova.utils.message_templates import DEDUCTION_ADDED +from konova.utils.message_templates import DEDUCTION_ADDED, REVOCATION_ADDED from user.models import User, UserActionLogEntry from django.db import transaction from django import forms @@ -168,7 +168,7 @@ class NewRevocationModalForm(BaseModalForm): def save(self): revocation = self.instance.add_revocation(self) - self.instance.mark_as_edited(self.user, self.request) + self.instance.mark_as_edited(self.user, self.request, edit_comment=REVOCATION_ADDED) return revocation diff --git a/intervention/models/revocation.py b/intervention/models/revocation.py index e996f564..66318735 100644 --- a/intervention/models/revocation.py +++ b/intervention/models/revocation.py @@ -10,6 +10,7 @@ import shutil from django.contrib.gis.db import models from konova.models import BaseResource, AbstractDocument, generate_document_file_upload_path +from konova.utils.message_templates import REVOCATION_REMOVED class Revocation(BaseResource): @@ -20,10 +21,14 @@ class Revocation(BaseResource): legal = models.ForeignKey("Legal", null=False, blank=False, on_delete=models.CASCADE, help_text="Refers to 'Widerspruch am'", related_name="revocations") comment = models.TextField(null=True, blank=True) - def delete(self, *args, **kwargs): + def delete(self, user = None, *args, **kwargs): # Make sure related objects are being removed as well if self.document: self.document.delete(*args, **kwargs) + + if user is not None: + self.legal.intervention.mark_as_edited(user, edit_comment=REVOCATION_REMOVED) + super().delete() @property diff --git a/intervention/views.py b/intervention/views.py index ea169b3b..75131f67 100644 --- a/intervention/views.py +++ b/intervention/views.py @@ -16,7 +16,7 @@ from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER from konova.utils.documents import remove_document, get_document from konova.utils.generators import generate_qr_code from konova.utils.message_templates import INTERVENTION_INVALID, FORM_INVALID, IDENTIFIER_REPLACED, \ - CHECKED_RECORDED_RESET, DEDUCTION_REMOVED, DEDUCTION_ADDED + CHECKED_RECORDED_RESET, DEDUCTION_REMOVED, DEDUCTION_ADDED, REVOCATION_ADDED, REVOCATION_REMOVED from konova.utils.user_checks import in_group @@ -354,7 +354,7 @@ def remove_revocation_view(request: HttpRequest, id: str): form = RemoveModalForm(request.POST or None, instance=obj, request=request) return form.process_request( request, - _("Revocation removed"), + REVOCATION_REMOVED, redirect_url=reverse("intervention:detail", args=(obj.intervention.id,)) + "#related_data" ) @@ -459,7 +459,7 @@ def new_revocation_view(request: HttpRequest, id: str): form = NewRevocationModalForm(request.POST or None, request.FILES or None, instance=intervention, request=request) return form.process_request( request, - msg_success=_("Revocation added"), + msg_success=REVOCATION_ADDED, redirect_url=reverse("intervention:detail", args=(id,)) + "#related_data" ) diff --git a/konova/static/css/konova.css b/konova/static/css/konova.css index d0373ac4..fd29d3ab 100644 --- a/konova/static/css/konova.css +++ b/konova/static/css/konova.css @@ -226,6 +226,12 @@ No other approach worked to get the autocomplete fields to full width of parent .select2{ width: 100% !important; } +/* +Similar to bootstraps 'shadow-lg' + */ +.select2-results{ + box-shadow: 0 1rem 3rem rgba(0,0,0,.2) !important; +} .select2-results__option--highlighted{ background-color: var(--rlp-red) !important; } diff --git a/konova/utils/message_templates.py b/konova/utils/message_templates.py index 501a5a03..04a756e7 100644 --- a/konova/utils/message_templates.py +++ b/konova/utils/message_templates.py @@ -29,6 +29,10 @@ DEDUCTION_REMOVED = _("Deduction removed") PAYMENT_ADDED = _("Payment added") PAYMENT_REMOVED = _("Payment removed") +# REVOCATIONS +REVOCATION_ADDED = _("Revocation added") +REVOCATION_REMOVED = _("Revocation removed") + # Edited EDITED_GENERAL_DATA = _("Edited general data") ADDED_COMPENSATION_STATE = _("Added compensation state")