Catch unhandled javascript errors

This commit is contained in:
Oliver Walters 2020-08-08 09:31:57 +10:00
parent ff71fe6e93
commit a2c3c1086c
2 changed files with 9 additions and 5 deletions

View File

@ -161,7 +161,7 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
<tr>
<td><span class='fas fa-user-tie'></span></td>
<td>{% trans "Customer" %}</td>
<td><a href="{% url 'company-detail' item.customer.id %}">{{ item.customer.name }}</a></td>
<td><a href="{% url 'company-detail-assigned-stock' item.customer.id %}">{{ item.customer.name }}</a></td>
</tr>
{% endif %}
{% if item.belongs_to %}

View File

@ -18,14 +18,18 @@ function {{ label }}StatusDisplay(key) {
key = String(key);
var value = {{ label }}Codes[key].value;
var value = null;
var label = null;
if (key in {{ label }}Codes) {
value = {{ label }}Codes[key].value;
label = {{ label }}Codes[key].label;
}
if (value == null || value.length == 0) {
value = key;
label = '';
}
// Select the label color
var label = {{ label }}Codes[key].label ?? '';
return `<span class='label ${label}'>${value}</span>`;
}