diff --git a/app/create_database.py b/app/create_database.py index ba2814a..a4af0de 100644 --- a/app/create_database.py +++ b/app/create_database.py @@ -42,6 +42,7 @@ specials = ["Kippenbolletjes zoetzuur", "varkenbolletjes zoetzuur", "Nazi Babi P chinees = Location() chinees.configure("Oceans's Garden", "Top-4-straat Keknet-city", "http://oceangarden.byethost3.com/studentenmenus.html") +db.session.add(chinees) def chinees_create_entry(zetmeel, vlees="", saus=""): entry = Product() diff --git a/app/static/js/timer.js b/app/static/js/timer.js new file mode 100644 index 0000000..f0872ee --- /dev/null +++ b/app/static/js/timer.js @@ -0,0 +1,36 @@ +/** + * Created by feliciaan on 30/03/15. + */ +$.ready(function(){ + $('.time').each(function() { + var timeEl = $( this ); + var time = timeEl.text().split(' ').slice(-1)[0].split(':'); + + if (timeEl.text().indexOf('closed') < 0) { + window.setInterval(function () { + time = my_tick(time); + if (time !== "closed") { + timeS = "closes in " + ("0" + time[0]).slice(-2) + ":" + ("0" + time[1]).slice(-2) + ":" + ("0" + time[2]).slice(-2); + } else { + timeS = "closed" + } + timeEl.html(timeS); + }, 1000); + } + }); + + function my_tick(time) { + if (time[2] > 0) { + time[2] = time[2] - 1; + } else if(time[1] > 0) { + time[2] = 59; + time[1] = time[1] - 1; + } else if(time[0] > 0) { + time[1] = 59; + time[0] = time[0] - 1; + } else { + return "closed"; + } + return time; + } +}()); \ No newline at end of file diff --git a/app/templates/layout.html b/app/templates/layout.html index 050c0e8..7c0473e 100644 --- a/app/templates/layout.html +++ b/app/templates/layout.html @@ -23,6 +23,7 @@ {% block scripts %} {{ super() }} + {% endblock %} diff --git a/app/templates/order.html b/app/templates/order.html index 1141d98..b95c8fa 100644 --- a/app/templates/order.html +++ b/app/templates/order.html @@ -8,7 +8,7 @@
Status: {{ order.stoptime|countdown }}
+
Status: {{ order.stoptime|countdown }}
Orders: {{ order.items.count() }}