Change checkin page layout
This commit is contained in:
parent
dd8f33a472
commit
ab3878ea9f
1 changed files with 76 additions and 66 deletions
|
@ -1,85 +1,95 @@
|
|||
{% extends "regidesk/base.html" %}
|
||||
{% load static %}
|
||||
{% block header_title %}
|
||||
<h1>Boarding pass lookup</h1>
|
||||
<p>Please scan or enter boarding pass code and click "Look Up"</p>
|
||||
<h1>Boarding pass lookup</h1>
|
||||
<p>Please scan or enter boarding pass code and click "Look Up"</p>
|
||||
{% endblock %}
|
||||
{% block extra_head %}
|
||||
<script type="text/javascript" src="{% static 'js/instascan.min.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="my-5 col-12">
|
||||
<h2>Check-in</h2>
|
||||
<p>Please scan QR Code or enter it below</p>
|
||||
<p><strong id="note"></strong></p>
|
||||
<video id="preview"" autoplay style="width: 500px; height: 500px; border: 1px solid green;"></video>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h2>Check-in</h2>
|
||||
<p>Please scan QR Code or enter it below</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="my-5 col-12">
|
||||
<div id="code_div" class="form-group has-feedback has-error">
|
||||
<label class="control-label" for="bpcode">Boarding Pass Code</label>
|
||||
<input id="bptext" type="text" class="form-control" id="bpcode" placeholder="Code">
|
||||
<span id="input_icon" class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>
|
||||
<span id="help_ok" class="help-block" style="display: none;">Format appears OK</span>
|
||||
<span id="help_ur" class="help-block" style="display: block;">Format doesn't match</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-6">
|
||||
<p><strong id="note"></strong></p>
|
||||
<video id="preview"" autoplay style=" height: 400px;"></video>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<div id="code_div" class="form-group has-feedback has-error">
|
||||
<label class="control-label" for="bpcode">Boarding Pass Code</label>
|
||||
<input id="bptext" type="text" class="form-control" id="bpcode" placeholder="Code">
|
||||
<span id="input_icon" class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>
|
||||
<span id="help_ok" class="help-block" style="display: none;">Format appears OK</span>
|
||||
<span id="help_ur" class="help-block" style="display: block;">Format doesn't match</span>
|
||||
</div>
|
||||
<div>
|
||||
<button id="bpredir" class="btn btn-primary">Submit</button>
|
||||
<button id="clear" class="btn btn-danger">Clear</button>
|
||||
<a type=button" class="btn btn-info pull-right" href="{% url 'regidesk:boarding_overview' %}">Overview</a>
|
||||
</div>
|
||||
<div class="py-5">
|
||||
<a href="{% url 'regidesk:boarding_overview' %}">Overview (Search page)</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
let scanner = new Instascan.Scanner({ video: document.getElementById('preview') });
|
||||
scanner.addListener('scan', function (content) {
|
||||
// This should ensure we start with the lca base domain. However, I don't have the time for this
|
||||
// considering we have quite a few domains right now.
|
||||
// We simply validate that the domain ends in an OK format, which isn't ideal but should give us
|
||||
// enough reassurance for the time being. 2020 Can fix this :P
|
||||
var checkin_re = new RegExp('[A-Z0-9]{6}');
|
||||
if (checkin_re.test(content)) {
|
||||
document.getElementById('note').textContent = "Code " + content + " found. Redirecting ...";
|
||||
window.location.href = window.location.href + content;
|
||||
} else {
|
||||
<script type="text/javascript">
|
||||
let scanner = new Instascan.Scanner({ video: document.getElementById('preview') });
|
||||
scanner.addListener('scan', function (content) {
|
||||
// This should ensure we start with the lca base domain. However, I don't have the time for this
|
||||
// considering we have quite a few domains right now.
|
||||
// We simply validate that the domain ends in an OK format, which isn't ideal but should give us
|
||||
// enough reassurance for the time being. 2020 Can fix this :P
|
||||
var checkin_re = new RegExp('[A-Z0-9]{6}');
|
||||
if (checkin_re.test(content)) {
|
||||
document.getElementById('note').textContent = "Code " + content + " found. Redirecting ...";
|
||||
window.location.href = window.location.href + content;
|
||||
} else {
|
||||
document.getElementById('note').textContent = "INVALID code " + content + " found";
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function startCamera(cameras) { scanner.start(cameras[0]); }
|
||||
function errorCamera(error) { console.error(e); }
|
||||
function startCamera(cameras) { scanner.start(cameras[0]); }
|
||||
function errorCamera(error) { console.error(e); }
|
||||
|
||||
Instascan.Camera.getCameras().then(startCamera).catch(errorCamera);
|
||||
</script>
|
||||
Instascan.Camera.getCameras().then(startCamera).catch(errorCamera);
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var code_div = document.getElementById("code_div");
|
||||
var icon = document.getElementById("input_icon");
|
||||
var tb = document.getElementById("bptext");
|
||||
var ok = document.getElementById("help_ok");
|
||||
var unk = document.getElementById("help_ur");
|
||||
var re = new RegExp('^[A-Z0-9]{6}$');
|
||||
document.getElementById("bpredir").onclick = function() {
|
||||
location.href = tb.value;
|
||||
};
|
||||
document.getElementById("clear").onclick = function() {
|
||||
tb.value = "";
|
||||
};
|
||||
tb.oninput = function() {
|
||||
is_good = re.test(tb.value);
|
||||
if (is_good) {
|
||||
code_div.className = "form-group has-feedback has-success";
|
||||
icon.className = "glyphicon glyphicon-ok form-control-feedback";
|
||||
ok.style.display = "block";
|
||||
unk.style.display = "none";
|
||||
} else {
|
||||
code_div.className = "form-group has-feedback has-error";
|
||||
icon.className = "glyphicon glyphicon-remove form-control-feedback";
|
||||
ok.style.display = "none";
|
||||
unk.style.display = "block";
|
||||
}
|
||||
console.log(is_good);
|
||||
};
|
||||
</script>
|
||||
{% endblock %}
|
||||
<script type="text/javascript">
|
||||
var code_div = document.getElementById("code_div");
|
||||
var icon = document.getElementById("input_icon");
|
||||
var tb = document.getElementById("bptext");
|
||||
var ok = document.getElementById("help_ok");
|
||||
var unk = document.getElementById("help_ur");
|
||||
var re = new RegExp('^[A-Z0-9]{6}$');
|
||||
document.getElementById("bpredir").onclick = function () {
|
||||
location.href = tb.value;
|
||||
};
|
||||
document.getElementById("clear").onclick = function () {
|
||||
tb.value = "";
|
||||
};
|
||||
tb.oninput = function () {
|
||||
is_good = re.test(tb.value);
|
||||
if (is_good) {
|
||||
code_div.className = "form-group has-feedback has-success";
|
||||
icon.className = "glyphicon glyphicon-ok form-control-feedback";
|
||||
ok.style.display = "block";
|
||||
unk.style.display = "none";
|
||||
} else {
|
||||
code_div.className = "form-group has-feedback has-error";
|
||||
icon.className = "glyphicon glyphicon-remove form-control-feedback";
|
||||
ok.style.display = "none";
|
||||
unk.style.display = "block";
|
||||
}
|
||||
console.log(is_good);
|
||||
};
|
||||
</script>
|
||||
{% endblock %}
|
Loading…
Reference in a new issue