diff options
-rw-r--r-- | servo/models/repair.py | 7 | ||||
-rwxr-xr-x | servo/templates/devices/view.html | 25 |
2 files changed, 27 insertions, 5 deletions
diff --git a/servo/models/repair.py b/servo/models/repair.py index df11afa..4dd363b 100644 --- a/servo/models/repair.py +++ b/servo/models/repair.py @@ -89,9 +89,9 @@ class Repair(models.Model): Proxies service order data between our internal service orders and GSX repairs """ - order = models.ForeignKey(Order, editable=False, on_delete=models.PROTECT) + order = models.ForeignKey(Order, editable=False, on_delete=models.PROTECT) device = models.ForeignKey(Device, editable=False, on_delete=models.PROTECT) - parts = models.ManyToManyField(ServiceOrderItem, through=ServicePart) + parts = models.ManyToManyField(ServiceOrderItem, through=ServicePart) created_at = models.DateTimeField(auto_now_add=True, editable=False) created_by = models.ForeignKey( @@ -507,6 +507,9 @@ class Repair(models.Model): self.save() self.order.notify("repair_status_changed", self.status, user) + def get_status(self): + return self.status if len(self.status) else _('No status') + def update_status(self, user): repair = self.get_gsx_repair() status = repair.status().repairStatus diff --git a/servo/templates/devices/view.html b/servo/templates/devices/view.html index 51a30c1..8234cd7 100755 --- a/servo/templates/devices/view.html +++ b/servo/templates/devices/view.html @@ -56,17 +56,36 @@ </ul> </div> <div class="pull-right"> - {% if perms.servo.change_device %} + {% if perms.servo.change_device %} <a href="edit/" class="btn">{% trans "Edit" %}</a> - {% endif %} + {% endif %} </div> </div> <div class="tab-pane" id="tab2"> {% include "orders/list.html" with orders=device.order_set.all %} + <hr/> + <h4>{% trans "Local GSX repairs" %}</h4> + <table class="table"> + <tbody> + {% for r in device.repair_set.all %} + <tr> + <td>{{ r.confirmation }}</td> + <td>{{ r.created_at|date }}</td> + <td>{{ r.created_by }}</td> + <td>{{ r.get_status }}</td> + <td><a href="{% url 'repairs-delete_repair' r.pk %}" class="btn btn-default" data-modal="modal" title="{% trans "Delete repair" %}"><i class="icon-trash"></i></a></td> + </tr> + {% empty %} + <tr> + <td colspan="4">{% trans "No local GSX repairs found" %}</td> + </tr> + {% endfor %} + </tbody> + </table> </div> {% if device.is_apple_device %} <div class="tab-pane" id="tab3"> - <div id="gsx-container" data-source="{% url 'search-search_gsx' what='repairs' param='serialNumber' query=device.sn %}"> + <div id="gsx-container" data-source="{% url 'devices-search_gsx_repairs' pk=device.pk %}"> <div class="progress active"> <div class="bar" style="width:100%;" data-progress="0"></div> </div> |