From 32906d5bbc8afdbb1017fd7339315fafe2394007 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Wed, 19 May 2021 20:28:09 +0300 Subject: Make note type field editable --- servo/forms/notes.py | 2 +- servo/models/order.py | 8 ++++++-- servo/templates/notes/form.html | 13 ++++++++----- servo/templates/orders/notes.html | 8 ++++---- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/servo/forms/notes.py b/servo/forms/notes.py index b6ce1af..c433b7a 100644 --- a/servo/forms/notes.py +++ b/servo/forms/notes.py @@ -22,10 +22,10 @@ class NoteForm(BaseModelForm): widgets = { 'recipient': TextInput, 'subject': TextInput, + 'type': forms.Select(attrs={'class': 'span12'}), 'order': forms.HiddenInput, 'parent': forms.HiddenInput, 'customer': forms.HiddenInput, - 'type': forms.HiddenInput, 'labels': forms.CheckboxSelectMultiple, } diff --git a/servo/models/order.py b/servo/models/order.py index 344100d..574637d 100644 --- a/servo/models/order.py +++ b/servo/models/order.py @@ -284,11 +284,15 @@ class Order(models.Model): """ Return context dict for printing this order """ - r = {} - r['order'] = self + r = {'order': self} r['conf'] = Configuration.conf() r['title'] = _(u"Service Order #%s") % self.code r['notes'] = self.note_set.filter(is_reported=True) + # TODO: replace with constants + r['issues'] = r['notes'].filter(type=2) + r['diagnoses'] = r['notes'].filter(type=3) + r['verified_issues'] = r['notes'].filter(type=4) + r['customer_notes'] = r['notes'].filter(type=5) if kind == 'receipt': try: diff --git a/servo/templates/notes/form.html b/servo/templates/notes/form.html index d471385..a5e05c6 100755 --- a/servo/templates/notes/form.html +++ b/servo/templates/notes/form.html @@ -36,8 +36,9 @@ {{ formset.management_form }} {{ form.order }} @@ -46,9 +47,7 @@ {% endif %}
- {% include "form_field_snippet.html" with field=form.recipient %} - {% include "form_field_snippet.html" with field=form.subject %} - {% include "form_field_snippet.html" with field=form.sender %} + {% include "form_field_snippet.html" with field=form.type %} {% include "form_field_snippet.html" with field=form.body %} {% if note.order %} @@ -58,7 +57,11 @@
{% endif %} - {{ form.type }} +
+
+ {% include "form_field_snippet.html" with field=form.recipient %} + {% include "form_field_snippet.html" with field=form.subject %} + {% include "form_field_snippet.html" with field=form.sender %}
{% for f in formset %} diff --git a/servo/templates/orders/notes.html b/servo/templates/orders/notes.html index e7975e6..59de5c8 100755 --- a/servo/templates/orders/notes.html +++ b/servo/templates/orders/notes.html @@ -19,11 +19,11 @@
- {% if perms.servo.change_note and order.is_editable %} + {% if perms.servo.change_note and order.is_editable %} - {% else %} + {% else %} - {% endif %} + {% endif %} @@ -51,7 +51,7 @@
-
{{ node.get_sender_name }} {{ node.created_at|relative_date }} +
{{ node.get_heading }} {{ node.created_at|relative_date }} {% if node.escalation.is_submitted %} {{ node.escalation.escalation_id }} {% endif %} -- cgit v1.2.3