summaryrefslogtreecommitdiffstats
path: root/data/templates/products/entry.html
diff options
context:
space:
mode:
Diffstat (limited to 'data/templates/products/entry.html')
-rw-r--r--data/templates/products/entry.html64
1 files changed, 64 insertions, 0 deletions
diff --git a/data/templates/products/entry.html b/data/templates/products/entry.html
new file mode 100644
index 0000000..05c1dce
--- /dev/null
+++ b/data/templates/products/entry.html
@@ -0,0 +1,64 @@
+<h2>Product Information</h2>
+<p>
+ <table class="table table-bordered table-nonfluid">
+ <tr><th>EAN</th><td>{{{EAN}}}</td></tr>
+ <tr><th>Name</th><td>{{{NAME}}}</td></tr>
+ <tr><th>Category</th><td>{{{CATEGORY}}}</td></tr>
+ <tr><th>Amount</th><td>{{{AMOUNT}}}</td></tr>
+ <tr><th>State</th><td><button id="statebutton" type="button" class="btn {{{BTNSTATE}}}" {{{ISADMIN2}}}>{{{STATE}}}</button></td></tr>
+ </table>
+</p></p>
+
+<h2>Price History</h2>
+<table class="table table-bordered table-nonfluid">
+ <tr><th>Valid Since</th><th>Memberprice</th><th>Guestprice</th></tr>
+ {{{PRICES}}}
+</table>
+
+<div id="new_price" style="display: {{{ISADMIN}}};">
+ <form action="/products/{{{EAN}}}/newprice" class="form-horizontal">
+ <input class="input-small" name="member" type="number" step="0.01" min="0.01" placeholder="Member" />
+ <input class="input-small" name="guest" type="number" step="0.10" min="0.10" placeholder="Guest" />
+ <button type="submit" class="btn btn-primary">Add new Prices</button>
+ </form>
+</div>
+
+<h2>Restock</h2>
+<table class="table table-bordered table-nonfluid">
+ <tr><th>Date</th><th>Amount</th><th>Unit Price</th><th>Supplier</th><th>Best before Date</th></tr>
+ {{{RESTOCKS}}}
+</table>
+
+<div id="restock" style="display: {{{ISADMIN}}};">
+ <form action="/products/{{{EAN}}}/restock" class="form-horizontal">
+ <input class="input-small" name="amount" type="number" min="1" placeholder="Amount" title="Amount" />
+ <input class="input-small" name="price" type="number" step="0.01" min="0.00" placeholder="Price" title="Price per Piece" />
+ <select name="supplier" title="Supplier">
+ {{{SUPPLIERS}}}
+ </select>
+ <input class="input-small" name="best_before_date" type="date" title="Best Before Date (YYYY-MM-DD)" />
+ <button type="submit" class="btn btn-primary"><i class="icon-plus"></i></button>
+ </form>
+</div>
+
+<script>
+$('#statebutton').on('click', function (e) {
+ var req = $.getJSON(
+ "/products/{{{EAN}}}/togglestate",
+ function( data ) {
+ if(data["state"] == "deprecated") {
+ $('#statebutton').html("Deprecated")
+ $('#statebutton').addClass("btn-danger")
+ $('#statebutton').removeClass("btn-success")
+ } else if(data["state"] == "active") {
+ $('#statebutton').html("Active")
+ $('#statebutton').addClass("btn-success")
+ $('#statebutton').removeClass("btn-danger")
+ } else {
+ console.error("unknown state")
+ console.info(data)
+ }
+ }
+ );
+});
+</script>