Add last minute fixes to flow

Exception text storage and check in needs to be sepearte to badge.
This commit is contained in:
Sachi King 2018-01-21 10:35:37 +11:00
parent 05a45b77ed
commit 7370fc6012
4 changed files with 74 additions and 1 deletions

View file

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-01-20 23:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('regidesk', '0002_auto_20180120_1726'),
]
operations = [
migrations.AddField(
model_name='checkin',
name='checked_in_bool',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='checkin',
name='exception_set',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='checkin',
name='exception_text',
field=models.TextField(blank=True),
),
]

View file

@ -5,6 +5,7 @@ from decimal import Decimal
from io import BytesIO
from django.core.exceptions import ValidationError
from django.utils import timezone
from django.db import models
from django.db.models import Q, F
@ -72,6 +73,9 @@ class CheckIn(models.Model):
_checkin_code_png=models.TextField(max_length=512,null=True,blank=True)
badge_printed = models.BooleanField(default=False)
schwag_given = models.BooleanField(default=False)
checked_in_bool = models.BooleanField(default=False)
exception_set = models.BooleanField(default=False)
exception_text = models.TextField(blank=True)
class Meta:
permissions = (
@ -85,6 +89,11 @@ class CheckIn(models.Model):
self.checkin_code = checkin_code
return super(CheckIn, self).save(*a, **k)
def mark_checked_in(self):
self.checked_in_bool = True
self.checked_in = timezone.now()
self.save()
def mark_badge_printed(self):
self.badge_printed = True
self.save()
@ -98,6 +107,11 @@ class CheckIn(models.Model):
self.schwag_given = True
self.save()
def set_exception(self, text):
self.exception_set = True
self.exception_text = text
self.save()
@property
def code(self):
return self.checkin_code

View file

@ -34,6 +34,20 @@
</div>
</div>
<div class="panel {% if check_in.checked_in_bool %}panel-danger{% else %}panel-success{% endif %}">
<div class="panel-heading">Check In</div>
<div class="panel-body">
<dl class="dl-horizontal">
<dt>Status</dt><dd>{% if check_in.checked_in_bool %}Checked in{% else %}Not checked in{% endif %}</dd>
</dl>
<form method="post">
<input type="checkbox" name="checkin" value="checkin" checked hidden>
<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.badge_printed %}panel-danger{% else %}panel-success{% endif %}">
<div class="panel-heading">Badge</div>
<div class="panel-body">
@ -61,6 +75,17 @@
</div>
</div>
<div class="panel panel-warning">
<div class="panel-heading">Log Exception</div>
<div class="panel-body">
<form method="post">
<textarea class="form-control" rows="3" name="exception">{{ check_in.exception_text }}</textarea>
<p class="help-block">Reminder: Please tell attendee to email boarding@lca2018.org with the details as well</p>
<input class="btn btn-warning 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">

View file

@ -302,12 +302,16 @@ def check_in_overview(request, access_code):
return render(request, "regidesk/ci_code_404.html", {})
check_in = check_in[0]
if request.method == 'POST':
if 'badge' in request.POST:
if 'checkin' in request.POST:
check_in.mark_checked_in()
elif '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()
elif 'exception' in request.POST:
check_in.set_exception(request.POST['exception'])
return redirect(request.path)
ctx = {
'check_in': check_in,