add checkin view

pull/1/head
parent fcff581d33
commit a7e6b89711

@ -13,6 +13,7 @@ def populate_team_nav(sender, **kwargs):
nav_items.append(
{"link": reverse("team:shift_overview"), "text": "Schichtübersicht"}
)
nav_items.append({"link": reverse("team:checkins"), "text": "Checkin"})
nav_items.append(
{"link": reverse("team:shift_free"), "text": "Freie Schichten"}
)

@ -0,0 +1,35 @@
{% extends "base.html" %}
{% block title %}{{ title }}{% endblock %}
{% block content %}
<section class="section">
<div class="container">
<h3 class="title">{{ title }}</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Schicht</th>
<th>Startzeit</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
{% for reg in object_list %}
<tr>
<td>{{ reg.helper.name }}({{ reg.helper.phone|stringformat:"s"|slice:"-3:" }})</td>
<td>{{ reg.shift.room }}</td>
<td>{{ reg.shift.start_at }}</td>
<td>
<a class="button is-success is-small" href="{% url 'team:checkin' reg.pk %}">Als angekommen markieren</a>
<a class="button is-danger is-small" href="{% url 'team:mark_as_failed' reg.pk %}">Nicht angetreten</a>
<a class="button is-link is-small" href="tel:{{ reg.helper.phone }}">📞</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</section>
{% endblock %}

@ -12,6 +12,7 @@ urlpatterns = [
path("shift/<int:pk>", views.shift_detail, name="shift"),
path("helper/<int:pk>", views.HelperDetail.as_view(), name="helper"),
path("message/", views.bulk_message, name="bulk_message"),
path("checkins/", views.CheckinList.as_view(), name="checkins"),
path("checkin/<int:pk>", views.checkin, name="checkin"),
path("mark_as_failed/<int:pk>", views.mark_as_failed, name="mark_as_failed"),
path("remove_helper/<int:pk>", views.delete_shiftregistration, name="unregister"),

@ -271,6 +271,26 @@ class RoomShiftList(ShiftList):
)
class CheckinList(LoginRequiredMixin, ListView):
template_name = "checkin_list.html"
model = Shift
title = "Ankommende Helfer:innen"
def get_queryset(self):
return ShiftRegistration.objects.filter(
shift__deleted=False,
state=ShiftRegistration.RegState.REGISTERED,
).order_by("shift__start_at")[:30]
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = self.title
return context
def get_ordering(self):
return ("start_at", "room__name")
@login_required
def checkin(request, pk):
reg = get_object_or_404(ShiftRegistration, pk=pk)

Loading…
Cancel
Save