From affa473b3cce8f43113d46dbf88dd695abaa44f7 Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Wed, 6 Mar 2013 21:58:16 +0100 Subject: show supplier & best before date in the web interface --- src/web.vala | 12 ++++++++++-- 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 += "%s%d%s€".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 += "%s%d%s€%s%s".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 @@

Restock

- + {{{RESTOCKS}}}
DateAmountUnit Price
DateAmountUnit PriceSupplierBest before Date
-- cgit v1.2.3