finish event checkins
This commit is contained in:
parent
302fe4289a
commit
228ff85e6a
4 changed files with 65 additions and 2 deletions
|
@ -8,7 +8,7 @@ from io import BytesIO
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
from acmsite.models import Link, Officer, User, Event
|
from acmsite.models import EventCheckin, Link, Officer, User, Event
|
||||||
from acmsite import models
|
from acmsite import models
|
||||||
|
|
||||||
from .forms import EventForm, LinkForm, OfficerForm
|
from .forms import EventForm, LinkForm, OfficerForm
|
||||||
|
@ -155,6 +155,28 @@ def update_create_event(id):
|
||||||
|
|
||||||
return redirect(url_for("admin.events"))
|
return redirect(url_for("admin.events"))
|
||||||
|
|
||||||
|
@bp.route("/event/<string:id>/checkins")
|
||||||
|
@login_required
|
||||||
|
def event_checkins(id):
|
||||||
|
if not current_user.is_admin:
|
||||||
|
flash("Unauthorized")
|
||||||
|
return redirect(url_for("dashboard.home"))
|
||||||
|
|
||||||
|
event = db.session.execute(db.select(Event).where(Event.id == id)).scalar_one_or_none()
|
||||||
|
if event is None:
|
||||||
|
flash("Invalid event")
|
||||||
|
return redirect(url_for("admin.events"))
|
||||||
|
checkins = db.session.execute(db.select(EventCheckin).where(EventCheckin.event ==
|
||||||
|
id).join(User)).scalars()
|
||||||
|
|
||||||
|
processed_checkins = []
|
||||||
|
for c in checkins:
|
||||||
|
user = db.session.execute(db.select(User).where(User.id == c.user)).scalar_one_or_none()
|
||||||
|
processed_checkins.append({"name": f"{user.first_name} {user.last_name}", "email": user.email})
|
||||||
|
|
||||||
|
|
||||||
|
return render_template("admin/checkins.html", checkins=processed_checkins,e=event)
|
||||||
|
|
||||||
@bp.route("/links")
|
@bp.route("/links")
|
||||||
@login_required
|
@login_required
|
||||||
def links():
|
def links():
|
||||||
|
|
35
acmsite/templates/admin/checkins.html
Normal file
35
acmsite/templates/admin/checkins.html
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{% extends "admin/admin-layout.html" %}
|
||||||
|
{% import "bootstrap5/form.html" as wtf %}
|
||||||
|
|
||||||
|
{% block app_content %}
|
||||||
|
<h1>Checkins for `{{ e.name }}`</h1>
|
||||||
|
|
||||||
|
|
||||||
|
{% for c in checkins %}
|
||||||
|
{{ c.__dict__ }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Email</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for c in checkins %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ c.name }}</td>
|
||||||
|
<td>{{ c.email }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<h3>Copy-pastable list for CampusGroups</h3>
|
||||||
|
{% for c in checkins %}
|
||||||
|
{{ c.email }},
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
|
{% endblock %}
|
|
@ -40,6 +40,11 @@
|
||||||
<li class="dropdown-item">
|
<li class="dropdown-item">
|
||||||
<a href="#deleteModal"
|
<a href="#deleteModal"
|
||||||
data-bs-toggle="modal" data-id="{{ e.id }}">Delete Event</a>
|
data-bs-toggle="modal" data-id="{{ e.id }}">Delete Event</a>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-item">
|
||||||
|
<a href="{{ url_for('admin.event_checkins',
|
||||||
|
id=e.id) }}">Event Checkins</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
|
|
||||||
<p>The following events are available for check-in:</p>
|
<p>The following events are available for check-in:</p>
|
||||||
{% for e in events %}
|
{% for e in events %}
|
||||||
<a href="{{ url_for('dashboard.checkin', event_id=e.id) }}">{{ e.name }}</a>
|
<h5>{{ e.name }} <a class="btn btn-primary" href="{{ url_for('dashboard.checkin', event_id=e.id)
|
||||||
|
}}">Check in</a></h5>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>There are no events available for check-in.</p>
|
<p>There are no events available for check-in.</p>
|
||||||
|
|
Loading…
Add table
Reference in a new issue