From 0305d2f865934b33ad40aff9c6b4857165fe65ab Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 22 Jul 2019 10:30:53 +1000 Subject: [PATCH] Improve rendering of stock tracking table - Date only (no time) - Display URL if set - Edit/Delete buttons for manually created entries --- .../static/script/inventree/stock.js | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/InvenTree/InvenTree/static/script/inventree/stock.js b/InvenTree/InvenTree/static/script/inventree/stock.js index df63f21fdd..9e00860e0d 100644 --- a/InvenTree/InvenTree/static/script/inventree/stock.js +++ b/InvenTree/InvenTree/static/script/inventree/stock.js @@ -275,7 +275,7 @@ function loadStockTrackingTable(table, options) { formatter: function(value, row, index, field) { var m = moment(value); if (m.isValid()) { - var html = m.format('dddd MMMM Do YYYY'); // + '
' + m.format('h:mm a'); + var html = m.format('dddd MMMM Do YYYY') + '
' + m.format('h:mm a'); return html; } @@ -308,10 +308,6 @@ function loadStockTrackingTable(table, options) { html += "
" + row.notes + ""; } - if (row.URL) { - html += "
" + row.URL + ""; - } - return html; } }); @@ -338,6 +334,21 @@ function loadStockTrackingTable(table, options) { } }); + cols.push({ + sortable: false, + formatter: function(value, row, index, field) { + // Manually created entries can be edited or deleted + if (!row.system) { + var bEdit = ""; + var bDel = ""; + + return "
" + bEdit + bDel + "
"; + } else { + return ""; + } + } + }); + table.bootstrapTable({ sortable: true, search: true,