summaryrefslogtreecommitdiffstats
path: root/data/templates/products
diff options
context:
space:
mode:
authorHolger Cremer <HolgerCremer@gmail.com>2018-08-27 19:38:11 +0200
committerHolger Cremer <HolgerCremer@gmail.com>2018-08-27 19:38:11 +0200
commit8f2ba2050ee78d0e4a47f1277c6bc4422d06170c (patch)
treec008d2878905e03df7a8bf8bd3330762cc2d8f43 /data/templates/products
parentbb55e121576a5b5d225bfc68c5062f386cc32db9 (diff)
parent3fc3ea6c6df237dbdf48d14703118b747bf5d647 (diff)
downloadserial-barcode-scanner-8f2ba2050ee78d0e4a47f1277c6bc4422d06170c.tar.bz2
Merge branch 'master' into better_inventory
Conflicts: README data/templates/products/entry.html docker/Dockerfile docker/init.sh src/database/database.vala src/database/db-interface.vala src/pdf-stock/Makefile src/pdf-stock/pdf-stock-interface.vala src/pdf-stock/pdf-stock.vala src/web/Makefile src/web/main.vala templates/menu.html templates/products/index.html
Diffstat (limited to 'data/templates/products')
-rw-r--r--data/templates/products/bestbefore.html14
-rw-r--r--data/templates/products/entry.html89
-rw-r--r--data/templates/products/index.html37
-rw-r--r--data/templates/products/inventory.html49
-rw-r--r--data/templates/products/new.html22
-rw-r--r--data/templates/products/newprice.html18
-rw-r--r--data/templates/products/restock.html22
7 files changed, 251 insertions, 0 deletions
diff --git a/data/templates/products/bestbefore.html b/data/templates/products/bestbefore.html
new file mode 100644
index 0000000..b5451a4
--- /dev/null
+++ b/data/templates/products/bestbefore.html
@@ -0,0 +1,14 @@
+<table id="producttable" class="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>
+
+<script type="text/javascript">
+$(document).ready(function() {
+ $('#producttable').DataTable({"lengthMenu": [ [25, 50, 100, -1], [25, 50, 100, "All"] ] });
+} );
+</script>
diff --git a/data/templates/products/entry.html b/data/templates/products/entry.html
new file mode 100644
index 0000000..64b2aa4
--- /dev/null
+++ b/data/templates/products/entry.html
@@ -0,0 +1,89 @@
+<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-inline">
+ <input class="form-control" name="member" type="number" step="0.01" min="0.01" placeholder="Member" />
+ <input class="form-control" 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">
+ <div class="control-group">
+ <label class="control-label">Amount</label>
+ <div class="controls">
+ <input name="amount" type="number" min="1" placeholder="Amount" />
+ </div>
+ </div>
+ <div class="control-group">
+ <label class="control-label">Price per Piece</label>
+ <div class="controls">
+ <input name="price" type="number" step="0.01" min="0.00" placeholder="Price" />
+ </div>
+ </div>
+ <div class="control-group">
+ <label class="control-label">Suppplier</label>
+ <div class="controls">
+ <select name="supplier">
+ {{{SUPPLIERS}}}
+ </select>
+ </div>
+ </div>
+ <div class="control-group">
+ <label class="control-label">Best Before Date</label>
+ <div class="controls">
+ <input name="best_before_date" type="date" />
+ </div>
+ </div>
+ <div class="control-group">
+ <div class="controls">
+ <button type="submit" class="btn btn-primary"><i class="icon-plus"></i> Restock</button>
+ </div>
+ </div>
+ </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..ba7e08c
--- /dev/null
+++ b/data/templates/products/index.html
@@ -0,0 +1,37 @@
+<table id="producttable" class="table table-bordered table-striped table-condensed">
+ <thead>
+ <tr>
+ <th>EAN</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}}};">
+ <legend>New Product</legend>
+ <form action="/products/new" class="form-inline">
+ <div class="form-group">
+ <input class="form-control" name="id" type="number" min="0" placeholder="EAN" />
+ <input class="form-control" name="name" type="text" placeholder="Name" />
+ <select class="form-control" name="category" title="Category">
+ {{{CATEGORIES}}}
+ </select>
+ <input class="form-control" name="memberprice" type="number" step="0.01" min="0.01" placeholder="Memberprice" />
+ <input class="form-control" name="guestprice" type="number" step="0.01" min="0.01" placeholder="Guestprice" />
+ <button type="submit" class="form-control btn btn-primary"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
+ </div>
+ </form>
+</div>
+
+<script type="text/javascript">
+$(document).ready(function() {
+ $('#producttable').DataTable({"lengthMenu": [ [25, 50, 100, -1], [25, 50, 100, "All"] ] });
+} );
+</script>
diff --git a/data/templates/products/inventory.html b/data/templates/products/inventory.html
new file mode 100644
index 0000000..eb02081
--- /dev/null
+++ b/data/templates/products/inventory.html
@@ -0,0 +1,49 @@
+<h1>Inventory <small>Thanks that you do it! </small></h1>
+
+<div class="{{{SUCESS_HIDDEN}}} alert alert-success">
+ <strong>Success!</strong> Every change was added. Thank you!
+</div>
+
+<div class="alert alert-info">
+ <strong>Tip!</strong> You can download an inventory PDF to collect the data offline.
+ <a href="/products/inventory-pdf" target="_blank" class="btn btn-primary">Only products with amount > 0</a>
+ <a href="/products/inventory-pdf?all=1" target="_blank" class="btn btn-primary">All products</a>
+</div>
+
+<form action="/products/inventory" method="POST" class="form-horizontal">
+ <div class="{{{RESTOCK_HIDDEN}}} form-group">
+ <label class="control-label col-sm-3">Select the supplier for the restock action.</label>
+ <div class="col-sm-3">
+ <select name="supplierId" class="form-control">
+ {{{SUPPLIERS}}}
+ </select>
+ </div>
+ </div>
+ <div class="{{{RESTOCK_HIDDEN}}} form-group">
+ <label class="control-label col-sm-3">Select the Shop User for loss transaction.</label>
+ <div class="col-sm-3">
+ <select name="userId" class="form-control">
+ {{{USERS}}}
+ </select>
+ </div>
+ </div>
+ <table class="sortable table table-bordered table-striped table-condensed">
+ <thead>
+ <tr>
+ <th>EAN</th>
+ <th>Name</th>
+ <th>Category</th>
+ <th>Expected Amount</th>
+ <th>Real Amount</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{{DATA}}}
+ </tbody>
+ </table>
+
+ <div class="pull-right">
+ {{{ACTION}}}
+ </div>
+
+</form> \ No newline at end of file
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>