diff --git a/InvenTree/static/script/inventree/bom.js b/InvenTree/static/script/inventree/bom.js
index d81bff569a..b6e0c63a70 100644
--- a/InvenTree/static/script/inventree/bom.js
+++ b/InvenTree/static/script/inventree/bom.js
@@ -137,14 +137,14 @@ function loadBomTable(table, options) {
if (!options.editable) {
cols.push(
{
- field: 'sub_part_detail.available_stock',
+ field: 'sub_part_detail.total_stock',
title: 'Available',
searchable: false,
sortable: true,
formatter: function(value, row, index, field) {
var text = "";
- if (row.quantity < row.sub_part_detail.available_stock)
+ if (row.quantity < row.sub_part_detail.total_stock)
{
text = "" + value + "";
}
diff --git a/InvenTree/templates/InvenTree/search.html b/InvenTree/templates/InvenTree/search.html
index 77730f5ea5..f8631dfbd4 100644
--- a/InvenTree/templates/InvenTree/search.html
+++ b/InvenTree/templates/InvenTree/search.html
@@ -15,9 +15,11 @@ InvenTree | Search Results
-
Parts
-
+
+
+{% include "InvenTree/search_parts.html" with collapse_id='parts' %}
+
+{% include "InvenTree/search_supplier_parts.html" with collapse_id='supplier_parts' %}
{% endblock %}
@@ -29,10 +31,28 @@ InvenTree | Search Results
{% block js_ready %}
{{ block.super }}
- $("#part-results-table").on('load-success.bs.table', function() {
- var n = $("#part-results-table").bootstrapTable('getData').length;
- $("#part-result-count").html("(found " + n + " results)");
- });
+ function onSearchResults(table, output) {
+ $(table).on('load-success.bs.table', function() {
+ var n = $(table).bootstrapTable('getData').length;
+
+ var text = '';
+ if (n == 0) {
+ text = 'No results'
+ } else {
+ text = n + ' result';
+
+ if (n > 1) {
+ text += 's';
+ }
+ }
+
+ $(output).html(text);
+ });
+ }
+
+ onSearchResults('#part-results-table', '#part-result-count');
+
+ onSearchResults('#supplier-part-results-table', '#supplier-part-result-count');
loadPartTable("#part-results-table",
"{% url 'api-part-list' %}",
@@ -43,5 +63,39 @@ InvenTree | Search Results
allowInactive: true,
}
);
+
+ $("#supplier-part-results-table").bootstrapTable({
+ url: "{% url 'api-part-supplier-list' %}",
+ queryParams: {
+ search: "{{ query }}",
+ },
+ pagination: true,
+ pageSize: 25,
+ search: true,
+ columns: [
+ {
+ field: 'supplier_name',
+ title: 'Supplier',
+ formatter: function(value, row, index, field) {
+ return imageHoverIcon(row.supplier_logo) + renderLink(value, '/company/' + row.supplier + '/');
+ }
+ },
+ {
+ field: 'SKU',
+ title: 'SKU',
+ formatter: function(value, row, index, field) {
+ return renderLink(value, row.url);
+ }
+ },
+ {
+ field: 'manufacturer',
+ title: 'Manufacturer',
+ },
+ {
+ field: 'MPN',
+ title: 'MPN',
+ }
+ ]
+ });
{% endblock %}
\ No newline at end of file
diff --git a/InvenTree/templates/InvenTree/search_parts.html b/InvenTree/templates/InvenTree/search_parts.html
new file mode 100644
index 0000000000..69c5c29051
--- /dev/null
+++ b/InvenTree/templates/InvenTree/search_parts.html
@@ -0,0 +1,14 @@
+{% extends "collapse.html" %}
+
+{% block collapse_title %}
+Parts
+{% endblock %}
+
+{% block collapse_heading %}
+{% include "InvenTree/searching.html" %}
+{% endblock %}
+
+{% block collapse_content %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/InvenTree/templates/InvenTree/search_supplier_parts.html b/InvenTree/templates/InvenTree/search_supplier_parts.html
new file mode 100644
index 0000000000..04ee32cc5b
--- /dev/null
+++ b/InvenTree/templates/InvenTree/search_supplier_parts.html
@@ -0,0 +1,14 @@
+{% extends "collapse.html" %}
+
+{% block collapse_title %}
+Supplier Parts
+{% endblock %}
+
+{% block collapse_heading %}
+{% include "InvenTree/searching.html" %}
+{% endblock %}
+
+{% block collapse_content %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/InvenTree/templates/InvenTree/searching.html b/InvenTree/templates/InvenTree/searching.html
new file mode 100644
index 0000000000..9d111fe257
--- /dev/null
+++ b/InvenTree/templates/InvenTree/searching.html
@@ -0,0 +1 @@
+ Searching...
\ No newline at end of file