|
Lines 125-130
Link Here
|
| 125 |
</div> |
125 |
</div> |
| 126 |
[% END %] |
126 |
[% END %] |
| 127 |
|
127 |
|
|
|
128 |
<form method="post" class="refresh-form"> |
| 129 |
<p> |
| 130 |
<input type="hidden" name="tab" id="current-tab" value="[% tab | html %]" /> |
| 131 |
<button type="submit" class="btn btn-default"><i class="fa fa-refresh" aria-hidden="true"></i> Refresh</button> |
| 132 |
|
| 133 |
<label> |
| 134 |
[% IF auto_refresh %] |
| 135 |
<input type="checkbox" id="auto_refresh" name="auto_refresh" checked="checked" /> |
| 136 |
[% ELSE %] |
| 137 |
<input type="checkbox" id="auto_refresh" name="auto_refresh" /> |
| 138 |
[% END %] |
| 139 |
Refresh automatically every <input type="text" inputmode="numeric" pattern="[0-9]*" id="refresh_delay" name="refresh_delay" value="[% refresh_delay || 60 | html %]" size="3" /> seconds. |
| 140 |
</label> |
| 141 |
|
| 142 |
<span id="refresh_info"></span> |
| 143 |
</p> |
| 144 |
</form> |
| 145 |
|
| 128 |
[% SET to_be_staged = curbside_pickups.filter_by_to_be_staged %] |
146 |
[% SET to_be_staged = curbside_pickups.filter_by_to_be_staged %] |
| 129 |
[% SET staged_and_ready = curbside_pickups.filter_by_staged_and_ready %] |
147 |
[% SET staged_and_ready = curbside_pickups.filter_by_staged_and_ready %] |
| 130 |
[% SET patron_outside = curbside_pickups.filter_by_patron_outside %] |
148 |
[% SET patron_outside = curbside_pickups.filter_by_patron_outside %] |
|
Lines 174-185
Link Here
|
| 174 |
[% ELSE %] |
192 |
[% ELSE %] |
| 175 |
<div id="to-be-staged" role="tabpanel" class="tab-pane"> |
193 |
<div id="to-be-staged" role="tabpanel" class="tab-pane"> |
| 176 |
[% END %] |
194 |
[% END %] |
| 177 |
<form method="post" class="form"> |
|
|
| 178 |
<p> |
| 179 |
<button type="submit" class="btn btn-default"><i class="fa fa-refresh" aria-hidden="true"></i> Refresh</button> |
| 180 |
</p> |
| 181 |
</form> |
| 182 |
|
| 183 |
[% IF to_be_staged.count %] |
195 |
[% IF to_be_staged.count %] |
| 184 |
<table class="table table-striped"> |
196 |
<table class="table table-striped"> |
| 185 |
<thead> |
197 |
<thead> |
|
Lines 235-247
Link Here
|
| 235 |
[% ELSE %] |
247 |
[% ELSE %] |
| 236 |
<div id="staged-and-ready" role="tabpanel" class="tab-pane"> |
248 |
<div id="staged-and-ready" role="tabpanel" class="tab-pane"> |
| 237 |
[% END %] |
249 |
[% END %] |
| 238 |
<form method="post" class="form"> |
|
|
| 239 |
<input type="hidden" name="tab" value="staged-and-ready"/> |
| 240 |
<p> |
| 241 |
<button type="submit" class="btn btn-default"><i class="fa fa-refresh" aria-hidden="true"></i> Refresh</button> |
| 242 |
</p> |
| 243 |
</form> |
| 244 |
|
| 245 |
[% IF staged_and_ready.count %] |
250 |
[% IF staged_and_ready.count %] |
| 246 |
<table class="table table-striped"> |
251 |
<table class="table table-striped"> |
| 247 |
<thead> |
252 |
<thead> |
|
Lines 310-322
Link Here
|
| 310 |
[% ELSE %] |
315 |
[% ELSE %] |
| 311 |
<div id="patron-is-outside" role="tabpanel" class="tab-pane"> |
316 |
<div id="patron-is-outside" role="tabpanel" class="tab-pane"> |
| 312 |
[% END %] |
317 |
[% END %] |
| 313 |
<form method="post" class="form"> |
|
|
| 314 |
<input type="hidden" name="tab" value="patron-is-outside"/> |
| 315 |
<p> |
| 316 |
<button type="submit" class="btn btn-default"><i class="fa fa-refresh" aria-hidden="true"></i> Refresh</button> |
| 317 |
</p> |
| 318 |
</form> |
| 319 |
|
| 320 |
[% IF patron_outside.count %] |
318 |
[% IF patron_outside.count %] |
| 321 |
<table class="table table-striped"> |
319 |
<table class="table table-striped"> |
| 322 |
<thead> |
320 |
<thead> |
|
Lines 385-397
Link Here
|
| 385 |
[% ELSE %] |
383 |
[% ELSE %] |
| 386 |
<div id="delivered-today" role="tabpanel" class="tab-pane"> |
384 |
<div id="delivered-today" role="tabpanel" class="tab-pane"> |
| 387 |
[% END %] |
385 |
[% END %] |
| 388 |
<form method="post" class="form"> |
|
|
| 389 |
<input type="hidden" name="tab" value="delivered-today"/> |
| 390 |
<p> |
| 391 |
<button type="submit" class="btn btn-default"><i class="fa fa-refresh" aria-hidden="true"></i> Refresh</button> |
| 392 |
</p> |
| 393 |
</form> |
| 394 |
|
| 395 |
[% IF delivered_today.count %] |
386 |
[% IF delivered_today.count %] |
| 396 |
<table class="table table-striped"> |
387 |
<table class="table table-striped"> |
| 397 |
<thead> |
388 |
<thead> |
|
Lines 540-546
Link Here
|
| 540 |
slots_per_day[day].push(slot); |
531 |
slots_per_day[day].push(slot); |
| 541 |
}); |
532 |
}); |
| 542 |
|
533 |
|
| 543 |
|
|
|
| 544 |
$(document).ready(function() { |
534 |
$(document).ready(function() { |
| 545 |
|
535 |
|
| 546 |
$('#schedule-pickup-tab').on('click', function() { |
536 |
$('#schedule-pickup-tab').on('click', function() { |
|
Lines 668-674
Link Here
|
| 668 |
}); |
658 |
}); |
| 669 |
} |
659 |
} |
| 670 |
|
660 |
|
|
|
661 |
$("#pickup-tabs a[data-toggle='tab']").on("shown.bs.tab", function (e) { |
| 662 |
$("#current-tab").val($(this).attr('href').substring(1)); // Remove # |
| 663 |
}); |
| 664 |
$("#auto_refresh,#refresh_delay").on("change", function(){ |
| 665 |
set_interval_if_needed(); |
| 666 |
}); |
| 667 |
|
| 668 |
set_interval_if_needed(); |
| 669 |
|
| 671 |
}); |
670 |
}); |
|
|
671 |
|
| 672 |
let refresh_interval_id = 0; |
| 673 |
let countdown_interval_id = 0; |
| 674 |
function set_interval(refresh_delay_ms){ |
| 675 |
clear_intervals(); |
| 676 |
let next_refresh = new Date(); |
| 677 |
next_refresh.setSeconds(next_refresh.getSeconds() + refresh_delay_ms / 1000); |
| 678 |
|
| 679 |
countdown_interval_id = setInterval(function() { |
| 680 |
const now = new Date().getTime(); |
| 681 |
const seconds = Math.floor(( next_refresh - now + 1 ) / 1000); |
| 682 |
if ( seconds > 0 ) { |
| 683 |
$("#refresh_info").text(_("Refresh in %s seconds").format(seconds)); |
| 684 |
} else { |
| 685 |
$("#refresh_info").text(""); // In case something is going wrong |
| 686 |
} |
| 687 |
}, 1000); |
| 688 |
|
| 689 |
setInterval(function() { |
| 690 |
$(".refresh-form:visible").submit(); |
| 691 |
}, refresh_delay_ms); |
| 692 |
} |
| 693 |
function clear_intervals(){ |
| 694 |
if (refresh_interval_id) { |
| 695 |
clearInterval(refresh_interval_id); |
| 696 |
refresh_interval_id = 0; |
| 697 |
} |
| 698 |
if (countdown_interval_id) { |
| 699 |
clearInterval(countdown_interval_id); |
| 700 |
countdown_interval_id = 0; |
| 701 |
} |
| 702 |
} |
| 703 |
|
| 704 |
function set_interval_if_needed(){ |
| 705 |
const refresh_delay = $("#refresh_delay").val(); |
| 706 |
const auto_refresh = $("#auto_refresh").is(":checked"); |
| 707 |
|
| 708 |
if (auto_refresh && refresh_delay){ |
| 709 |
set_interval(refresh_delay * 1000); |
| 710 |
} else { |
| 711 |
clear_intervals(); |
| 712 |
} |
| 713 |
} |
| 672 |
</script> |
714 |
</script> |
| 673 |
[% END %] |
715 |
[% END %] |
| 674 |
|
716 |
|
| 675 |
- |
|
|