aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2021-05-19 20:28:09 +0300
committerFilipp Lepalaan <filipp@mac.com>2021-05-19 20:28:09 +0300
commit32906d5bbc8afdbb1017fd7339315fafe2394007 (patch)
treecd32f805590405bce9d5e97e5167c04d1e884e1e
parentce8012b7e4651eb3fa09849c3cef6fd027da87b6 (diff)
downloadServo-32906d5bbc8afdbb1017fd7339315fafe2394007.tar.gz
Servo-32906d5bbc8afdbb1017fd7339315fafe2394007.tar.bz2
Servo-32906d5bbc8afdbb1017fd7339315fafe2394007.zip
Make note type field editable
-rw-r--r--servo/forms/notes.py2
-rw-r--r--servo/models/order.py8
-rwxr-xr-xservo/templates/notes/form.html13
-rwxr-xr-xservo/templates/orders/notes.html8
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 @@
<ul class="nav nav-tabs">
<li class="active"><a href="#tab1" data-toggle="tab">{% trans "Note" %}</a></li>
<li><a href="#tab2" data-toggle="tab">{% trans "Attachments" %}</a></li>
- <li><a href="#tab3" data-toggle="tab">{% trans "Labels" %}</a></li>
+ <li><a href="#tab5" data-toggle="tab">{% trans "Message" %}</a></li>
<li><a href="#tab4" data-toggle="tab">{% trans "Escalation" %}</a></li>
+ <li><a href="#tab3" data-toggle="tab">{% trans "Labels" %}</a></li>
</ul>
{{ formset.management_form }}
{{ form.order }}
@@ -46,9 +47,7 @@
{% endif %}
<div class="tab-content">
<div class="tab-pane active" id="tab1">
- {% 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 %}
<table>
@@ -58,7 +57,11 @@
</tr>
</table>
{% endif %}
- {{ form.type }}
+ </div>
+ <div class="tab-pane" id="tab5">
+ {% 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 %}
</div>
<div class="tab-pane" id="tab2">
{% 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 @@
</a>
<div class="btn-group pull-right">
<a href="{% url 'notes-reply' node.pk %}" class="btn btn-small" title="{% trans "Reply" %}"><i class="icon-share-alt"></i></a>
- {% if perms.servo.change_note and order.is_editable %}
+ {% if perms.servo.change_note and order.is_editable %}
<a href="{{ node.get_edit_url }}" class="btn btn-small"><i class="icon-pencil"></i></a>
- {% else %}
+ {% else %}
<a href="#" class="btn btn-small disabled"><i class="icon-pencil"></i></a>
- {% endif %}
+ {% endif %}
<a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#">
<i class="icon-cog"></i> <span class="caret"></span>
</a>
@@ -51,7 +51,7 @@
</ul>
</div>
<div class="media-body">
- <h5 class="media-heading">{{ node.get_sender_name }} <span class="muted">{{ node.created_at|relative_date }}</span>
+ <h5 class="media-heading">{{ node.get_heading }} <span class="muted">{{ node.created_at|relative_date }}</span>
{% if node.escalation.is_submitted %}
<small class="muted"><i class="icon-globe"></i> {{ node.escalation.escalation_id }}</small>
{% endif %}