diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html
index 07b1a1d34b..3cc9b33619 100644
--- a/InvenTree/templates/base.html
+++ b/InvenTree/templates/base.html
@@ -124,14 +124,14 @@
-
-
+
+
diff --git a/InvenTree/templates/js/part.js b/InvenTree/templates/js/part.js
index f28bef059e..52f54dfa36 100644
--- a/InvenTree/templates/js/part.js
+++ b/InvenTree/templates/js/part.js
@@ -278,6 +278,58 @@ function loadParametricPartTable(table, options={}) {
}
+function partGridTile(part) {
+ // Generate a "grid tile" view for a particular part
+
+ // Rows for table view
+ var rows = '';
+
+ if (part.IPN) {
+ rows += `
{% trans "IPN" %} | ${part.IPN} |
`;
+ }
+
+ rows += `{% trans "Stock" %} | ${part.in_stock} |
`;
+
+ if (part.on_order) {
+ rows += `{$ trans "On Order" %} | ${part.on_order} |
`;
+ }
+
+ if (part.building) {
+ rows += `{% trans "Building" %} | ${part.building} |
`;
+ }
+
+ var html = `
+
+
+
+
+
+
+
+

+
+
+
+
+
+
+ `;
+
+ return html;
+}
+
+
function loadPartTable(table, url, options={}) {
/* Load part listing data into specified table.
*
@@ -289,6 +341,7 @@ function loadPartTable(table, url, options={}) {
* query: extra query params for API request
* buttons: If provided, link buttons to selection status of this table
* disableFilters: If true, disable custom filters
+ * gridView: If true, display as grid rather than standard table
*/
// Ensure category detail is included
@@ -452,6 +505,18 @@ function loadPartTable(table, url, options={}) {
formatNoMatches: function() { return '{% trans "No parts found" %}'; },
columns: columns,
showColumns: true,
+ showCustomView: true,
+ showCustomViewButton: true,
+ customView: function(data) {
+
+ var html = '';
+
+ data.forEach(function(row) {
+ html += partGridTile(row);
+ });
+
+ return `${html}
`;
+ }
});
if (options.buttons) {