summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2013-03-06 21:58:16 +0100
committerSebastian Reichel <sre@ring0.de>2013-03-06 21:58:16 +0100
commitaffa473b3cce8f43113d46dbf88dd695abaa44f7 (patch)
treef2d75cd512cb241991c090cf71553fd19f3a36d7
parent1a2ebec81a74e478f4e2976882451434deb40f7a (diff)
downloadserial-barcode-scanner-affa473b3cce8f43113d46dbf88dd695abaa44f7.tar.bz2
show supplier & best before date in the web interface
-rw-r--r--src/web.vala12
-rw-r--r--templates/products/entry.html2
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>