diff --git a/compensation/forms/modalForms.py b/compensation/forms/modalForms.py
index 6436a7c8..804ebad4 100644
--- a/compensation/forms/modalForms.py
+++ b/compensation/forms/modalForms.py
@@ -21,7 +21,7 @@ from konova.contexts import BaseContext
from konova.forms import BaseModalForm, NewDocumentModalForm, RemoveModalForm
from konova.models import DeadlineType
from konova.utils.message_templates import FORM_INVALID, ADDED_COMPENSATION_STATE, ADDED_DEADLINE, \
- ADDED_COMPENSATION_ACTION, PAYMENT_EDITED, COMPENSATION_STATE_EDITED, COMPENSATION_ACTION_EDITED
+ ADDED_COMPENSATION_ACTION, PAYMENT_EDITED, COMPENSATION_STATE_EDITED, COMPENSATION_ACTION_EDITED, DEADLINE_EDITED
class NewPaymentForm(BaseModalForm):
@@ -373,6 +373,29 @@ class NewDeadlineModalForm(BaseModalForm):
return deadline
+class EditDeadlineModalForm(NewDeadlineModalForm):
+ deadline = None
+
+ def __init__(self, *args, **kwargs):
+ self.deadline = kwargs.pop("deadline", None)
+ super().__init__(*args, **kwargs)
+ form_data = {
+ "type": self.deadline.type,
+ "date": str(self.deadline.date),
+ "comment": self.deadline.comment,
+ }
+ self.load_initial_data(form_data)
+
+ def save(self):
+ deadline = self.deadline
+ deadline.type = self.cleaned_data.get("type", None)
+ deadline.date = self.cleaned_data.get("date", None)
+ deadline.comment = self.cleaned_data.get("comment", None)
+ deadline.save()
+ self.instance.mark_as_edited(self.user, self.request, edit_comment=DEADLINE_EDITED)
+ return deadline
+
+
class NewActionModalForm(BaseModalForm):
""" Form handling action related input
diff --git a/ema/templates/ema/detail/includes/deadlines.html b/ema/templates/ema/detail/includes/deadlines.html
index 02efaf8b..6c7214e4 100644
--- a/ema/templates/ema/detail/includes/deadlines.html
+++ b/ema/templates/ema/detail/includes/deadlines.html
@@ -52,9 +52,12 @@
{{ deadline.comment }}
-
+ |
{% if is_default_member and has_access %}
- |