diff options
-rw-r--r-- | src/web.vala | 12 | ||||
-rw-r--r-- | templates/products/entry.html | 2 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/web.vala b/src/web.vala index 81b8e67..7140c22 100644 --- a/src/web.vala +++ b/src/web.vala @@ -495,8 +495,16 @@ public class WebServer { string restocks = ""; foreach(var e in db.get_restocks(id)) { var time = new DateTime.from_unix_local(e.timestamp); - restocks += "<tr><td>%s</td><td>%d</td><td>%s€</td></tr>".printf( - time.format("%Y-%m-%d %H:%M"), e.amount, e.price + var supplier = db.get_supplier(e.supplier).name; + if(supplier == "Unknown") + supplier = ""; + string bbd; + if(e.best_before_date > 0) + bbd = (new DateTime.from_unix_local(e.best_before_date)).format("%Y-%m-%d"); + else + bbd = ""; + restocks += "<tr><td>%s</td><td>%d</td><td>%s€</td><td>%s</td><td>%s</td></tr>".printf( + time.format("%Y-%m-%d %H:%M"), e.amount, e.price, supplier, bbd ); } t.replace("RESTOCKS", restocks); diff --git a/templates/products/entry.html b/templates/products/entry.html index 0cdd4a6..0b5cee7 100644 --- a/templates/products/entry.html +++ b/templates/products/entry.html @@ -23,7 +23,7 @@ <h2>Restock</h2> <table class="table table-bordered table-nonfluid"> - <tr><th>Date</th><th>Amount</th><th>Unit Price</th></tr> + <tr><th>Date</th><th>Amount</th><th>Unit Price</th><th>Supplier</th><th>Best before Date</th></tr> {{{RESTOCKS}}} </table> |