mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Display stock level in quick search bar
This commit is contained in:
parent
03726911e1
commit
ce921a6774
@ -1,3 +1,4 @@
|
|||||||
|
{% load i18n %}
|
||||||
{% load inventree_extras %}
|
{% load inventree_extras %}
|
||||||
|
|
||||||
/* globals
|
/* globals
|
||||||
@ -144,7 +145,8 @@ function inventreeDocReady() {
|
|||||||
return {
|
return {
|
||||||
label: el.full_name,
|
label: el.full_name,
|
||||||
id: el.pk,
|
id: el.pk,
|
||||||
thumbnail: el.thumbnail
|
thumbnail: el.thumbnail,
|
||||||
|
data: el,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
response(transformed);
|
response(transformed);
|
||||||
@ -164,7 +166,15 @@ function inventreeDocReady() {
|
|||||||
html += `'> `;
|
html += `'> `;
|
||||||
html += item.label;
|
html += item.label;
|
||||||
|
|
||||||
html += '</span></a>';
|
html += '</span>';
|
||||||
|
|
||||||
|
if (item.data.in_stock > 0) {
|
||||||
|
html += `<span class='label label-right label-success'>{% trans "Stock" %}: ${item.data.in_stock}</span>`;
|
||||||
|
} else {
|
||||||
|
html += `<span class='label label-right label-danger'>{% trans "No Stock" %}</span>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
html += '</a>';
|
||||||
|
|
||||||
return $('<li>').append(html).appendTo(ul);
|
return $('<li>').append(html).appendTo(ul);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user