summaryrefslogtreecommitdiffstats
path: root/data/templates/products
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2018-06-29 00:58:19 +0200
committerSebastian Reichel <sre@ring0.de>2018-07-15 22:59:57 +0200
commit22df08c29f6e4566d418e2a80a8279303406a733 (patch)
treedecb3029284b966635855e1684bc07ef9d3c1a6f /data/templates/products
parent17560f8bf49a0be2e0b490159e29f4894fe12cba (diff)
downloadserial-barcode-scanner-22df08c29f6e4566d418e2a80a8279303406a733.tar.bz2
build: switch to meson buildsystem
We build the project with 'meson' now instead of using custom configure script + GNU Makefiles. To build the project, go to the project root directory and use the following commands: Building: meson build cd build ninja Update Language Files: ninja shopsystem-pot ninja shopsystem-update-po Install: DESTDIR=./tmp ninja install
Diffstat (limited to 'data/templates/products')
-rw-r--r--data/templates/products/bestbefore.html8
-rw-r--r--data/templates/products/entry.html64
-rw-r--r--data/templates/products/index.html24
-rw-r--r--data/templates/products/new.html22
-rw-r--r--data/templates/products/newprice.html18
-rw-r--r--data/templates/products/restock.html22
6 files changed, 158 insertions, 0 deletions
diff --git a/data/templates/products/bestbefore.html b/data/templates/products/bestbefore.html
new file mode 100644
index 0000000..dbc7f47
--- /dev/null
+++ b/data/templates/products/bestbefore.html
@@ -0,0 +1,8 @@
+<table class="sortable table table-bordered table-striped table-condensed">
+ <thead>
+ <tr><th>EAN</th></th><th>Name</th><th>Amount</th><th>Best Before Date</th></tr>
+ </thead>
+ <tbody>
+ {{{DATA}}}
+ </tbody>
+</table>
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>
diff --git a/data/templates/products/index.html b/data/templates/products/index.html
new file mode 100644
index 0000000..d80adbd
--- /dev/null
+++ b/data/templates/products/index.html
@@ -0,0 +1,24 @@
+<a href="/products/bestbefore">product list with best before dates</a>
+
+<table class="sortable table table-bordered table-striped table-condensed">
+ <thead>
+ <tr><th>EAN</th></th><th>Name</th><th>Category</th><th>Amount</th><th>Memberprice</th><th>Guestprice</th></tr>
+ </thead>
+ <tbody>
+ {{{DATA}}}
+ </tbody>
+</table>
+
+<div id="newproduct" style="display: {{{NEWPRODUCT}}};">
+ <form action="/products/new" class="form-horizontal">
+ <legend>New Product</legend>
+ <input class="input-medium" name="id" type="number" min="0" placeholder="EAN" />
+ <input class="input-medium" name="name" type="text" placeholder="Name" />
+ <select name="category" title="Category">
+ {{{CATEGORIES}}}
+ </select>
+ <input class="input-medium" name="memberprice" type="number" step="0.01" min="0.01" placeholder="Memberprice" />
+ <input class="input-medium" name="guestprice" type="number" step="0.01" min="0.01" placeholder="Guestprice" />
+ <button type="submit" class="btn btn-primary"><i class="icon-plus"></i></button>
+ </form>
+</div>
diff --git a/data/templates/products/new.html b/data/templates/products/new.html
new file mode 100644
index 0000000..e38bd7b
--- /dev/null
+++ b/data/templates/products/new.html
@@ -0,0 +1,22 @@
+<h2>Add new product: {{{NAME}}}</h2>
+
+<div id="new-successful" class="alert alert-success" style="display: {{{NEW.OK}}};">
+ <p>Successfully created new item:</p>
+
+ <table class="table">
+ <tr><th>Name</th><td>{{{NAME}}}</td></tr>
+ <tr><th>EAN</th><td>{{{EAN}}}</td></tr>
+ <tr><th>Memberprice</th><td>{{{MEMBERPRICE}}}</td></tr>
+ <tr><th>Guestprice</th><td>{{{GUESTPRICE}}}</td></tr>
+ </table>
+</div>
+
+<div id="new-failed" class="alert alert-error" style="display: {{{NEW.FAIL}}};">
+ <h4>Error</h4>
+ Creating new product failed. Please make sure you
+ have sufficient permissions and gave valid values
+ for name, EAN, memberprice and guestprice.
+</div>
+
+<a href="{{{EAN}}}" style="display: {{{NEW.OK}}}">Go to {{{NAME}}}</a><br style="display: {{{NEW.OK}}}">
+<a href=".">Back to product list</a>
diff --git a/data/templates/products/newprice.html b/data/templates/products/newprice.html
new file mode 100644
index 0000000..c46d439
--- /dev/null
+++ b/data/templates/products/newprice.html
@@ -0,0 +1,18 @@
+<h2>Restock: {{{NAME}}}</h2>
+
+<div id="newprice-successful" class="alert alert-success" style="display: {{{NEWPRICE.OK}}};">
+ Successfully added new prices to <b>{{{NAME}}}</b>. New prices valid from now on:
+ <ul>
+ <li>Member: {{{MEMBER}}}€</li>
+ <li>Guest: {{{GUEST}}}€</li>
+ </ul>
+</div>
+
+<div id="newprice-failed" class="alert alert-error" style="display: {{{NEWPRICE.FAIL}}};">
+ <h4>Error</h4>
+ Adding new price for <b>{{{NAME}}}</b> failed. Please make sure you
+ have sufficient permissions and gave valid prices for members and
+ guests.
+</div>
+
+<a href=".">Back to {{{NAME}}}</a>
diff --git a/data/templates/products/restock.html b/data/templates/products/restock.html
new file mode 100644
index 0000000..70926c5
--- /dev/null
+++ b/data/templates/products/restock.html
@@ -0,0 +1,22 @@
+<h2>Restock: {{{NAME}}}</h2>
+
+<div id="restock-successful" class="alert" style="display: {{{RESTOCK.OK}}};">
+ <p>Successfully restocked:</p>
+
+ <table class="table table-hover">
+ <tr><th>Name</th><td>{{{NAME}}}</td></tr>
+ <tr><th>Amount</th><td>{{{AMOUNT}}}</td></tr>
+ <tr><th>Price</th><td>{{{PRICE}}}</td></tr>
+ <tr><th>Supplier</th><td>{{{SUPPLIER}}}</td></tr>
+ <tr><th>Best Before Date</th><td>{{{BESTBEFORE}}}</td></tr>
+ </table>
+</div>
+
+<div id="restock-failed" class="alert alert-error" style="display: {{{RESTOCK.FAIL}}};">
+ <h4>Error</h4>
+ Restocking <b>{{{NAME}}}</b> failed. Please make sure you
+ have sufficient permissions and gave valid values
+ for amount and price.
+</div>
+
+<a href=".">Back to {{{NAME}}}</a>