Compare commits
No commits in common. "a073a9f90ba16954cc59a113fa768be43f099571" and "517aaa1ff4fcff4497cd8f4251e7085ee224f3ef" have entirely different histories.
a073a9f90b
...
517aaa1ff4
|
@ -19,13 +19,14 @@
|
|||
</section>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer_content %}
|
||||
{% block footer %}
|
||||
<div class="content">
|
||||
{% if DEBUG %}
|
||||
<br>
|
||||
(Debug-Modus)
|
||||
{% if helper %}
|
||||
<a href="{% url 'token_logout' %}">logout</a>
|
||||
<a href="{{ helper.logintoken_set.first.get_absolute_url }}">login url</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -14,10 +14,6 @@
|
|||
src: url("{% static 'MavenPro-VariableFont:wght.ttf' %}");
|
||||
}
|
||||
|
||||
a:hover > .box {
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Maven Pro", sans-serif !important;
|
||||
min-height: 100vh;
|
||||
|
@ -27,10 +23,6 @@
|
|||
flex-grow: 1;
|
||||
}
|
||||
|
||||
button, input, select, textarea {
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
:root {
|
||||
--background: #fff;
|
||||
}
|
||||
|
@ -72,10 +64,6 @@
|
|||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
a:hover > .box {
|
||||
background: #1a1a1a;
|
||||
}
|
||||
|
||||
:root {
|
||||
--background: #17181c;
|
||||
}
|
||||
|
@ -117,11 +105,9 @@
|
|||
{% endblock %}
|
||||
<footer class="footer">
|
||||
<div class="container is-flex is-flex-wrap-wrap is-justify-content-space-between">
|
||||
<div class="content">
|
||||
<a href="https://git.as42.net/kontakt/shiftregister">shiftregister</a> by flo, Luca & xAndy
|
||||
{% block footer_content %}
|
||||
{% block footer %}
|
||||
<div class="content"><a href="https://git.as42.net/kontakt/shiftregister">shiftregister</a> by flo, Luca & xAndy</div>
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div class="breadcrumb has-dot-separator is-flex-grow-1 is-right ml-5">
|
||||
<ul>
|
||||
{% for item in footer_nav_items %}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
{% if is_paginated %}
|
||||
{% if page.has_other_pages %}
|
||||
<nav class="pagination is-centered" role="navigation" aria-label="pagination">
|
||||
{% if page_obj.has_previous %}
|
||||
<a class="pagination-previous" href="?page={{ page_obj.previous_page_number }}"><</a>
|
||||
{% if page.has_previous %}
|
||||
<a class="pagination-previous" href="?page={{ page.previous_page_number }}"><</a>
|
||||
{% else %}
|
||||
<a class="pagination-previous is-disabled"><</a>
|
||||
{% endif %}
|
||||
{% if page_obj.has_next %}
|
||||
<a class="pagination-next" href="?page={{ page_obj.next_page_number }}">></a>
|
||||
{% if page.has_next %}
|
||||
<a class="pagination-next" href="?page={{ page.next_page_number }}">></a>
|
||||
{% else %}
|
||||
<a class="pagination-next is-disabled">></a>
|
||||
{% endif %}
|
||||
<ul class="pagination-list">
|
||||
{% for p in page_range %}
|
||||
<li>
|
||||
{% if p == paginator.ELLIPSIS %}
|
||||
<span class="pagination-ellipsis">{{ paginator.ELLIPSIS }}</span>
|
||||
{% elif p == page_obj.number %}
|
||||
<span class="pagination-link is-current">{{ p }}</span>
|
||||
{% if p == page.paginator.ELLIPSIS %}
|
||||
<span class="pagination-ellipsis">{{ page.paginator.ELLIPSIS }}</span>
|
||||
{% elif p == page.number %}
|
||||
<a class="pagination-link is-current">{{ p }}</a>
|
||||
{% else %}
|
||||
<a class="pagination-link" href="?page={{ p }}">{{ p }}</a>
|
||||
{% endif %}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
{% block content %}
|
||||
<h3 class="title">{{ title }}</h3>
|
||||
<table class="table is-fullwidth">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
|
@ -16,7 +16,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for reg in page_obj %}
|
||||
{% for reg in object_list %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url 'team:helper' reg.helper.pk %}">
|
||||
|
@ -27,26 +27,19 @@
|
|||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a{% if reg.shift.event.calendar.needs_fallback %} class="is-underlined"{% endif %} href="{% url 'team:shift_room' reg.shift.room.pk %}">{{ reg.shift.room }}</a>
|
||||
<span class="{{ reg.shift.event.calendar.needs_fallback|yesno:"is-underlined," }}">
|
||||
<a href="{% url 'team:shift_room' reg.shift.room.pk %}">{{ reg.shift.room }}</a>
|
||||
</span>
|
||||
</td>
|
||||
<td><a href="{% url 'team:shift' reg.shift.pk %}">{{ reg.shift.start_at }}</a></td>
|
||||
<td><a href="{% url 'team:shift' reg.shift.pk %}">{{ reg.shift.duration|duration }}</a></td>
|
||||
<td>
|
||||
<div class="buttons">
|
||||
<form action="{% url 'team:checkin' reg.pk %}" method="post">
|
||||
{% csrf_token %}
|
||||
<button class="button is-success is-small mr-2" type="submit">Als angekommen markieren</button>
|
||||
</form>
|
||||
<form action="{% url 'team:mark_as_failed' reg.pk %}" method="post">
|
||||
{% csrf_token %}
|
||||
<button class="button is-danger is-small mr-2" type="submit">Nicht angetreten</button>
|
||||
</form>
|
||||
<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>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% include "pagination.html" %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ action|default:"Aktion bestätigen" }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3 class="title">{{ action|default:"Aktion bestätigen" }}</h3>
|
||||
<form method="POST">
|
||||
{% csrf_token %}
|
||||
<button class="button is-{{ button_style|default:"danger" }} is-small" type="submit">{{ button_text|default:"Bestätigen" }}</button>
|
||||
</form>
|
||||
<a class="button mt-3" href="{% url 'team:shift' reg.shift.pk %}">Zurück</a>
|
||||
{% endblock %}
|
|
@ -13,7 +13,9 @@
|
|||
<h5 class="subtitle">Schichten</h5>
|
||||
<div class="columns is-multiline">
|
||||
{% for reg in helper.shiftregistration_set.all %}
|
||||
<a class="" href="{% url 'team:shift' reg.shift.id %}">
|
||||
{% include 'partials/shift_list_item.html' with shift=reg.shift %}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<h5 class="subtitle" id="history">Nachrichtenverlauf</h5>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
{% block content %}
|
||||
<h3 class="title">Eingehende Nachrichten</h3>
|
||||
{% for message in page_obj %}
|
||||
{% for message in page %}
|
||||
<a href="{% if message.from_helper %}{% url 'team:helper' message.from_helper.pk %}#history{% else %}{% url 'team:incoming_message' message.pk %}{% endif %}">
|
||||
<div class="message{% if not message.read %} is-info{% endif %} mb-5">
|
||||
<div class="message-header">
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Helfer*in wirklich sperren?{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3 class="title">Helfer*in wirklich sperren?</h3>
|
||||
<form method="POST">
|
||||
{% csrf_token %}
|
||||
<button class="button is-danger is-small" type="submit">Schicht als "nicht angetreten" markieren und Helfer*in sperren</button>
|
||||
</form>
|
||||
<a class="button mt-3" href="{% url 'team:shift' reg.shift.pk %}">Zurück</a>
|
||||
{% endblock %}
|
|
@ -1,5 +1,4 @@
|
|||
<a href="{% url 'team:shift' shift.pk %}">
|
||||
<div class="box">
|
||||
<div class="box">
|
||||
<div class="content">
|
||||
{% if shift.deleted %}
|
||||
<em>gelöscht</em><br>
|
||||
|
@ -13,5 +12,7 @@
|
|||
<strong>Checkin-Status:</strong> {% if shift.checkin_count >= shift.required_helpers|default:shift.room.required_helpers %}<span class="tag is-rounded is-success">vollständig</span>{% elif shift.checkin_count > 0 %}<span class="tag is-rounded is-warning">teilweise</span>{% else %}<span class="tag is-rounded is-danger">kein Checkin</span>{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="buttons is-right mt-3">
|
||||
<a class="button is-info is-small mr-0" href="{% url 'team:shift' shift.id %}">Details</a>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ room.name }}{% endblock %}
|
||||
|
||||
{% block everything %}
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<h3 class="title" style="background:var(--background);margin:0 -1rem;padding:1rem;position:sticky;top:0;">Helfer*innen für {{ room.name }}</h3>
|
||||
<h3 class="title" style="background:var(--background);margin:0 -1rem;padding:1rem;position:sticky;top:0;">Helfer:innen für {{ room.name }}</h3>
|
||||
<table class="table">
|
||||
<thead style="background:inherit;position:sticky;top:4rem;">
|
||||
<tr>
|
||||
<th>Startzeit</th>
|
||||
<th>Helfer*innen</th>
|
||||
<th>Helfer:innen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for shift in shifts %}
|
||||
{% for shift in room.valid_shifts.all|dictsort:"start_at" %}
|
||||
<tr>
|
||||
<td>{{ shift.start_at }}</td>
|
||||
<td>{% for reg in shift.valid_registrations.all %}{{ reg.helper.name }}{% if not forloop.last %}, {% endif %}{% endfor %}</td>
|
||||
|
|
|
@ -32,18 +32,9 @@
|
|||
</div>
|
||||
<div class="buttons">
|
||||
{% if reg.is_pending %}
|
||||
<form action="{% url 'team:checkin' reg.pk %}" method="post">
|
||||
{% csrf_token %}
|
||||
<button class="button is-success is-small mr-2" type="submit">Als angekommen markieren</button>
|
||||
</form>
|
||||
<form action="{% url 'team:unregister' reg.pk %}" method="post">
|
||||
{% csrf_token %}
|
||||
<button class="button is-warning is-small mr-2" type="submit">Helfer*in abmelden</button>
|
||||
</form>
|
||||
<form action="{% url 'team:mark_as_failed' reg.pk %}" method="post">
|
||||
{% csrf_token %}
|
||||
<button class="button is-danger is-small" type="submit">Nicht angetreten</button>
|
||||
</form>
|
||||
<a class="button is-success is-small" href="{% url 'team:checkin' reg.pk %}">Als angekommen markieren</a>
|
||||
<a class="button is-warning is-small" href="{% url 'team:unregister' reg.pk %}">Helfer*in abmelden</a>
|
||||
<a class="button is-danger is-small" href="{% url 'team:mark_as_failed' reg.pk %}">Nicht angetreten</a>
|
||||
{% elif reg.is_checked_in %}
|
||||
<button class="button is-success is-small" style="pointer-events:none;">✓</button>
|
||||
{% endif %}
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
<h3 class="title">{{ title }}</h3>
|
||||
<div class="columns is-multiline">
|
||||
{% for shift in object_list %}
|
||||
<a class="" href="{% url 'team:shift' shift.id %}">
|
||||
{% include "partials/shift_list_item.html" %}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
{% for shift in next_shifts_per_room %}
|
||||
<div class="column is-one-quarter">
|
||||
<h5 class="subtitle"><a href="{% url 'team:shift_room' shift.room.name %}">{{ shift.room.name }}</a></h5>
|
||||
<a href="{% url 'team:shift' shift.id %}">
|
||||
{% include "partials/shift_box.html" %}
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
|
|
@ -16,7 +16,7 @@ urlpatterns = [
|
|||
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"),
|
||||
path("incoming/", views.IncomingMessagesList.as_view(), name="incoming_messages"),
|
||||
path("incoming/", views.incoming_messages, name="incoming_messages"),
|
||||
path("incoming/<slug:pk>", views.incoming_message, name="incoming_message"),
|
||||
path("incoming/mark_as_read/<slug:pk>", views.mark_as_read, name="mark_as_read"),
|
||||
path("list/<slug:token>", views.room_view_token, name="room_view_token"),
|
||||
|
|
|
@ -284,43 +284,32 @@ class RoomShiftList(ShiftList):
|
|||
|
||||
|
||||
class CheckinList(LoginRequiredMixin, ListView):
|
||||
paginate_by = 30
|
||||
template_name = "checkin_list.html"
|
||||
title = "Ankommende Helfer*innen"
|
||||
model = Shift
|
||||
title = "Ankommende Helfer:innen"
|
||||
|
||||
def get_queryset(self):
|
||||
return (
|
||||
ShiftRegistration.objects.select_related("helper", "shift")
|
||||
.prefetch_related("shift__event__calendar")
|
||||
.filter(shift__deleted=False, state=ShiftRegistration.RegState.REGISTERED)
|
||||
.order_by("shift__start_at", "shift__room__name")
|
||||
)
|
||||
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["page_range"] = context["paginator"].get_elided_page_range(
|
||||
context["page_obj"].number
|
||||
)
|
||||
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)
|
||||
|
||||
if request.method == "POST":
|
||||
reg.state = reg.RegState.CHECKED_IN
|
||||
reg.save()
|
||||
|
||||
return redirect("team:shift", pk=reg.shift.pk)
|
||||
|
||||
return render(
|
||||
request,
|
||||
"csrf_protect.html",
|
||||
{"action": "Als angekommen markieren", "button_text": "Angekommen", "reg": reg},
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
def mark_as_failed(request, pk):
|
||||
|
@ -335,50 +324,33 @@ def mark_as_failed(request, pk):
|
|||
|
||||
return redirect("team:shift", pk=reg.shift.pk)
|
||||
|
||||
return render(
|
||||
request,
|
||||
"csrf_protect.html",
|
||||
{
|
||||
"action": 'Schicht als "nicht angetreten" markieren',
|
||||
"button_text": "Nicht angetreten",
|
||||
"reg": reg,
|
||||
},
|
||||
)
|
||||
return render(request, "molly_guard.html", {"reg": reg})
|
||||
|
||||
|
||||
@login_required
|
||||
def delete_shiftregistration(request, pk):
|
||||
reg = get_object_or_404(ShiftRegistration, pk=pk)
|
||||
|
||||
if request.method == "POST":
|
||||
spk = reg.shift.pk
|
||||
reg.delete()
|
||||
return redirect("team:shift", pk=spk)
|
||||
|
||||
return redirect("team:shift", pk=reg.shift.pk)
|
||||
|
||||
@login_required
|
||||
def incoming_messages(request):
|
||||
p = Paginator(IncomingMessage.objects.order_by("read", "-created_at"), 10)
|
||||
page = p.get_page(request.GET.get("page"))
|
||||
|
||||
return render(
|
||||
request,
|
||||
"csrf_protect.html",
|
||||
{"action": "Helfer*in abmelden", "button_text": "Abmelden", "reg": reg},
|
||||
"incoming_messages.html",
|
||||
{
|
||||
"num_unread": IncomingMessage.objects.filter(read=False).count(),
|
||||
"page": page,
|
||||
"page_range": p.get_elided_page_range(page.number),
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
class IncomingMessagesList(LoginRequiredMixin, ListView):
|
||||
model = IncomingMessage
|
||||
paginate_by = 10
|
||||
template_name = "incoming_messages.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["num_unread"] = IncomingMessage.objects.filter(read=False).count()
|
||||
context["page_range"] = context["paginator"].get_elided_page_range(
|
||||
context["page_obj"].number
|
||||
)
|
||||
return context
|
||||
|
||||
def get_ordering(self):
|
||||
return ("read", "-created_at")
|
||||
|
||||
|
||||
@login_required
|
||||
def incoming_message(request, pk):
|
||||
message = get_object_or_404(IncomingMessage, pk=pk)
|
||||
|
@ -401,11 +373,10 @@ def mark_as_read(request, pk):
|
|||
|
||||
|
||||
def room_view_token(request, token):
|
||||
token = get_object_or_404(RoomViewToken, pk=token)
|
||||
room = token.room
|
||||
|
||||
return render(
|
||||
request,
|
||||
"room_registrations.html",
|
||||
{"room": room, "shifts": room.valid_shifts().order_by("start_at")},
|
||||
{
|
||||
"room": get_object_or_404(RoomViewToken, pk=token).room,
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue