`The Final Countdown
This commit is contained in:
parent
a0b2e6dd3d
commit
7032f2ad77
5 changed files with 41 additions and 3 deletions
|
@ -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()
|
||||
|
|
36
app/static/js/timer.js
Normal file
36
app/static/js/timer.js
Normal file
|
@ -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;
|
||||
}
|
||||
}());
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
{% block scripts %}
|
||||
{{ super() }}
|
||||
<script src="{{ url_for('static', filename='js/timer.js') }}"></script>
|
||||
<script async defer id="github-bjs" src="https://buttons.github.io/buttons.js"></script>
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<div class="col-md-push-1 col-md-10 darker"><!-- Shitty html-->
|
||||
<h3>Order {{ order.id }}
|
||||
{% if order.can_close(current_user.id) -%}
|
||||
<a class="btn btn-danger" href="{{ url_for('.close_order', id=order.id) }}">Close</a><br/>
|
||||
<a class="btn btn-danger pull-right" href="{{ url_for('.close_order', id=order.id) }}">Close</a><br/>
|
||||
{%- endif %}</h3>
|
||||
courrier: {{ order.courrier.username }}
|
||||
{% if order.courrier == None and not current_user.is_anonymous() %}
|
||||
|
@ -16,7 +16,7 @@
|
|||
{% endif %}
|
||||
<br/>
|
||||
location: <a href="{{ order.location.website }}">{{ order.location.name }}</a><br/>
|
||||
<b>status:</b> {% if order.stoptime %}{{ order.stoptime|countdown }}{% else %}open{% endif %}<br/>
|
||||
<b>status:</b> {% if order.stoptime %}<span class="time">{{ order.stoptime|countdown }}</span>{% else %}open{% endif %}<br/>
|
||||
total price: {{ total_price|euro }}
|
||||
</div>
|
||||
{% if form -%}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="row darker">
|
||||
<div class="col-md-9">
|
||||
<h5>{{ order.location.name }}</h5>
|
||||
<p><b>Status:</b> {{ order.stoptime|countdown }}<br/>
|
||||
<p><b>Status:</b> <span class="time">{{ order.stoptime|countdown }}</span><br/>
|
||||
<b>Orders:</b> {{ order.items.count() }}</p>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
|
|
Loading…
Reference in a new issue