Base flow for checkin scanning
It's ugly... But it should do the job. Ref #40
This commit is contained in:
parent
ac8df2da28
commit
8ee0dda5ac
8 changed files with 211 additions and 1 deletions
25
vendor/regidesk/regidesk/migrations/0002_auto_20180120_1726.py
vendored
Normal file
25
vendor/regidesk/regidesk/migrations/0002_auto_20180120_1726.py
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.9 on 2018-01-20 06:26
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('regidesk', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='checkin',
|
||||
name='badge_printed',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='checkin',
|
||||
name='schwag_given',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
15
vendor/regidesk/regidesk/models.py
vendored
15
vendor/regidesk/regidesk/models.py
vendored
|
@ -70,6 +70,8 @@ class CheckIn(models.Model):
|
|||
db_index=True,
|
||||
)
|
||||
_checkin_code_png=models.TextField(max_length=512,null=True,blank=True)
|
||||
badge_printed = models.BooleanField(default=False)
|
||||
schwag_given = models.BooleanField(default=False)
|
||||
|
||||
class Meta:
|
||||
permissions = (
|
||||
|
@ -83,6 +85,19 @@ class CheckIn(models.Model):
|
|||
self.checkin_code = checkin_code
|
||||
return super(CheckIn, self).save(*a, **k)
|
||||
|
||||
def mark_badge_printed(self):
|
||||
self.badge_printed = True
|
||||
self.save()
|
||||
|
||||
def mark_schwag_given(self):
|
||||
self.schwag_given = True
|
||||
self.save()
|
||||
|
||||
def bulk_mark_given(self):
|
||||
self.badge_printed = True
|
||||
self.schwag_given = True
|
||||
self.save()
|
||||
|
||||
@property
|
||||
def code(self):
|
||||
return self.checkin_code
|
||||
|
|
|
@ -22,6 +22,12 @@
|
|||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block header_title %}
|
||||
<div>
|
||||
<a type=button" class="btn btn-primary btn-lg" href="{% url 'regidesk:check_in_scanner' %}">Go to scanning page</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
<h1>Boarding Pass Overview</h1>
|
||||
|
|
11
vendor/regidesk/regidesk/templates/regidesk/ci_code_404.html
vendored
Normal file
11
vendor/regidesk/regidesk/templates/regidesk/ci_code_404.html
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
{% extends "regidesk/base.html" %}
|
||||
|
||||
|
||||
{% block header_title %}
|
||||
<h3>404 code not found</h3>
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<a type=button" class="btn btn-primary btn-lg" href="{% url 'regidesk:check_in_scanner' %}">Return to scanning page</a>
|
||||
<a type=button" class="btn btn-primary btn-lg pull-right" href="{% url 'regidesk:boarding_overview' %}">Go to overview</a>
|
||||
{% endblock %}
|
26
vendor/regidesk/regidesk/templates/regidesk/ci_landing.html
vendored
Normal file
26
vendor/regidesk/regidesk/templates/regidesk/ci_landing.html
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
{% extends "regidesk/base.html" %}
|
||||
|
||||
{% block header_title %}
|
||||
<h1>Boarding pass lookup</h1>
|
||||
<p>Please scan or enter boarding pass code and click "Look Up"</p>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block body %}
|
||||
<div>
|
||||
<div class="form-group">
|
||||
<label for="bpcode">Boarding Pass Code</label>
|
||||
<input id="bptext" type="text" class="form-control" id="bpcode" placeholder="Code">
|
||||
</div>
|
||||
<button id="bpredir" class="btn btn-default">Submit</button>
|
||||
<button id="clear" class="btn btn-default">Clear</button>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("bpredir").onclick = function() {
|
||||
location.href = document.getElementById("bptext").value;
|
||||
};
|
||||
document.getElementById("clear").onclick = function() {
|
||||
document.getElementById("bptext").value = "";
|
||||
};
|
||||
</script>
|
||||
{% endblock %}
|
78
vendor/regidesk/regidesk/templates/regidesk/ci_overview.html
vendored
Normal file
78
vendor/regidesk/regidesk/templates/regidesk/ci_overview.html
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
{% extends "regidesk/base.html" %}
|
||||
|
||||
|
||||
{% block header_title %}
|
||||
<h3>Pre-print check</h3>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block body %}
|
||||
{% load registrasion_tags %}
|
||||
{% load lca2018_tags %}
|
||||
{% items_purchased as purchased %}
|
||||
{% items_pending as pending %}
|
||||
{% items_purchased 1 as ticket %}
|
||||
{% total_items_purchased 3 as penguin_dinner_count %}
|
||||
{% total_items_purchased 4 as speakers_dinner_count %}
|
||||
{% total_items_purchased 5 as pdns_count %}
|
||||
{% ticket_type as ticket_type %}
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Content Check</div>
|
||||
<div class="panel-body">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Ticket type</dt><dd>{{ ticket_type }}</dd>
|
||||
<dt>Name</dt><dd>{{ user.attendee.attendeeprofilebase.attendeeprofile.name }}</dd>
|
||||
<dt>Company</dt><dd>{% if ticket_type == "Student" or ticket_type == "Hobbyist" or "Only" in ticket_type %}{% else %}{{ user.attendee.attendeeprofilebase.attendeeprofile.company }}{% endif %}</dd>
|
||||
<dt>Free Text 1</dt><dd>{{ user.attendee.attendeeprofilebase.attendeeprofile.free_text_1 }}</dd>
|
||||
<dt>Free Text 2</dt><dd>{{ user.attendee.attendeeprofilebase.attendeeprofile.free_text_2 }}</dd>
|
||||
<dt>Penguin Dinner Tickets</dt><dd>{{ penguin_dinner_count }}</dd>
|
||||
<dt>Spearker Dinner Tickets</dt><dd>{{ speakers_dinner_count }}</dd>
|
||||
<dt>PDNS Tickets</dt><dd>{{ pdns_count }}</dd>
|
||||
<dt>Over 18 years</dt><dd>{% if user.attendee.attendeeprofilebase.attendeeprofile.of_legal_age %}yes{% else %}<strong class="red">NO</strong>{% endif %}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel {% if check_in.badge_printed %}panel-danger{% else %}panel-success{% endif %}">
|
||||
<div class="panel-heading">Badge</div>
|
||||
<div class="panel-body">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Status</dt><dd>{% if check_in.badge_printed %}Marked{% else %}Not marked{% endif %} as printed</dd>
|
||||
</dl>
|
||||
<form method="post">
|
||||
<input type="checkbox" name="badge" value="badge" checked hidden>
|
||||
<a type="button" class="btn btn-primary" href="badge">Show Badge</a>
|
||||
<input class="btn {% if check_in.badge_printed %}btn-danger{% else %}btn-success{% endif %} pull-right" type="submit" value="Submit">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel {% if check_in.schwag_given %}panel-danger{% else %}panel-success{% endif %}">
|
||||
<div class="panel-heading">Schwag</div>
|
||||
<div class="panel-body">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Status</dt><dd>{% if check_in.schwag_given %}Marked{% else %}Not marked{% endif %} as given</dd>
|
||||
</dl>
|
||||
<form method="post">
|
||||
<input type="checkbox" name="schwag" value="schwag" checked hidden>
|
||||
<input class="btn {% if check_in.schwag_given %}btn-danger{% else %}btn-success{% endif %} pull-right" type="submit" value="Submit">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel {% if check_in.badge_printed or check_in.schwag_given %}panel-danger{% else %}panel-success{% endif %}">
|
||||
<div class="panel-heading">Bulk actions</div>
|
||||
<div class="panel-body">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Status</dt><dd>{% if check_in.badge_printed or check_in.schwag_given %}One of the items in bulk action is marked as given already{% else %}Both items are marked as unrecived{% endif %}</dd>
|
||||
</dl>
|
||||
<form method="post">
|
||||
<input type="checkbox" name="bulk" value="bulk" checked hidden>
|
||||
<input class="btn {% if check_in.badge_printed or check_in.schwag_given %}btn-danger{% else %}btn-success{% endif %} pull-right" type="submit" value="Submit">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<a type=button" class="btn btn-primary btn-lg" href="{% url 'regidesk:check_in_scanner' %}">Return to scanning page</a>
|
||||
|
||||
{% endblock %}
|
5
vendor/regidesk/regidesk/urls.py
vendored
5
vendor/regidesk/regidesk/urls.py
vendored
|
@ -9,5 +9,8 @@ urlpatterns = [
|
|||
url(r"^([A-Z0-9]{6}).png$", views.checkin_png, name="checkin_png"),
|
||||
url(r"^overview/([a-z]+)?$", views.boarding_overview, name="boarding_overview"),
|
||||
url(r"^prepare_passes/", views.boarding_prepare, name="boarding_prepare"),
|
||||
url(r"^send_passes/", views.boarding_send, name="boarding_send")
|
||||
url(r"^send_passes/", views.boarding_send, name="boarding_send"),
|
||||
url(r"^checkin/$", views.CheckInLanding.as_view(), name="check_in_scanner"),
|
||||
url(r"^checkin/(?P<access_code>[A-Z0-9]{6})/$", views.check_in_overview, name="check_in_user_view"),
|
||||
url(r"^checkin/([A-Z0-9]{6})/badge$", views.checken_in_badge, name="check_in_badge"),
|
||||
]
|
||||
|
|
46
vendor/regidesk/regidesk/views.py
vendored
46
vendor/regidesk/regidesk/views.py
vendored
|
@ -8,6 +8,7 @@ from django.core.mail import EmailMultiAlternatives
|
|||
from django.conf import settings
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.decorators import permission_required, user_passes_test, login_required
|
||||
from django.contrib.auth.mixins import PermissionRequiredMixin
|
||||
from django.contrib.auth.models import User, Group
|
||||
from django.db import transaction
|
||||
from django.db.models import F, Q
|
||||
|
@ -17,8 +18,11 @@ from django.http import HttpResponse, HttpResponseBadRequest
|
|||
from django.shortcuts import redirect, render
|
||||
from django.template import Template, Context
|
||||
from django.urls import reverse
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from registrasion import util
|
||||
from registrasion.views import render_badge
|
||||
from registrasion.models import commerce, people
|
||||
from registrasion.templatetags.registrasion_tags import items_purchased, items_pending
|
||||
from registrasion.templatetags.registrasion_tags import invoices, missing_categories
|
||||
|
@ -280,3 +284,45 @@ def boarding_send(request):
|
|||
request.session['boarding_attendees'].remove(attendee.pk)
|
||||
|
||||
return redirect("regidesk:boarding_overview")
|
||||
|
||||
|
||||
class CheckInLanding(PermissionRequiredMixin, TemplateView):
|
||||
template_name = 'regidesk/ci_landing.html'
|
||||
permission_required = 'regidesk.view_boarding_pass'
|
||||
|
||||
|
||||
@csrf_exempt
|
||||
@permission_required("regidesk.view_boarding_pass")
|
||||
def check_in_overview(request, access_code):
|
||||
check_in = CheckIn.objects.filter(
|
||||
checkin_code=access_code,
|
||||
)
|
||||
if not check_in:
|
||||
# yea it's a 200...
|
||||
return render(request, "regidesk/ci_code_404.html", {})
|
||||
check_in = check_in[0]
|
||||
if request.method == 'POST':
|
||||
if 'badge' in request.POST:
|
||||
check_in.mark_badge_printed()
|
||||
elif 'schwag' in request.POST:
|
||||
check_in.mark_schwag_given()
|
||||
elif 'bulk' in request.POST:
|
||||
check_in.bulk_mark_given()
|
||||
return redirect(request.path)
|
||||
ctx = {
|
||||
'check_in': check_in,
|
||||
'user': check_in.user,
|
||||
}
|
||||
return render(request, "regidesk/ci_overview.html", ctx)
|
||||
|
||||
|
||||
@permission_required("regidesk.view_boarding_pass")
|
||||
def checken_in_badge(request, access_code):
|
||||
check_in = CheckIn.objects.filter(
|
||||
checkin_code=access_code,
|
||||
)
|
||||
if not check_in:
|
||||
# yea it's a 200...
|
||||
return render(request, "regidesk/ci_code_404.html", {})
|
||||
badge = render_badge(check_in[0].user, format="svg", overlay=True)
|
||||
return badge
|
||||
|
|
Loading…
Reference in a new issue