orga plan view started

This commit is contained in:
Tom Irgang 2023-06-18 17:38:38 +02:00
parent a7501ec565
commit 602f12ac8e
5 changed files with 138 additions and 17 deletions

View file

@ -4,24 +4,25 @@
"dictionaryDefinitions": [], "dictionaryDefinitions": [],
"dictionaries": [], "dictionaries": [],
"words": [ "words": [
"Ammeldelink",
"anmeldung",
"hilpoltstein",
"Keycloak",
"KeycloakOIDCAB",
"oidc",
"onetimelogin",
"orga",
"organisator",
"organisators",
"repa",
"repaircafe",
"repapp",
"reparateur",
"Reparateur", "Reparateur",
"Reparateure", "Reparateure",
"reparateur", "reparateurs",
"organisator",
"Reparateurs", "Reparateurs",
"repapp", "tabindex"
"oidc",
"anmeldung",
"repaircafe",
"hilpoltstein",
"KeycloakOIDCAB",
"Keycloak",
"tabindex",
"onetimelogin",
"Ammeldelink",
"orga",
"repa",
"organisators"
], ],
"ignoreWords": [], "ignoreWords": [],
"import": [] "import": []

View file

@ -17,7 +17,8 @@
<h1 class="mt-2">Repair-Cafés</h1> <h1 class="mt-2">Repair-Cafés</h1>
<p> <p>
<a href="{% url 'create_cafe' %}" class="btn btn-primary">Neues Repair-Café anlegen</a> <a href="{% url 'create_cafe' %}" class="btn btn-primary">Neues Repair-Café anlegen</a>
<a href="{% url 'edit_cafe' next_cafe.pk %}" class="btn btn-primary">Nächstes Repair-Café</a> <a href="{% url 'orga_plan_cafe' next_cafe.pk %}"
class="btn btn-primary">Nächstes Repair-Café</a>
</p> </p>
<hr class="mt-0 mb-4"> <hr class="mt-0 mb-4">
<h1 class="mt-2">Geräte</h1> <h1 class="mt-2">Geräte</h1>

View file

@ -0,0 +1,86 @@
{% extends "repapp/base.html" %}
{% block title %}
- Repair-Café planen
{% endblock title %}
{% block page_title %}
Repair-Café planen
{% endblock page_title %}
{% block content %}
<p>
<a href="{% url 'orga' %}" class="btn btn-primary">Zurück</a>
</p>
<h1 class="mt-2">Repair-Café am {{ cafe.event_date|date:"l" }}, {{ cafe.event_date|date }}</h1>
<hr class="mt-0 mb-4">
<h1 class="mt-2">Reparateure</h1>
<table class="table">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">eMail</th>
<th scope="col">Teilnahmen zugesagt?</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
{% for reparateur in reparateurs %}
<tr>
<td>{{ reparateur.name }}</td>
<td>{{ reparateur.mail }}</td>
<td>
{% if reparateur.accepted %}
Ja
{% else %}
Nein
{% endif %}
</td>
<td>
{% if not reparateur.accepted %}
<a href="" class="btn btn-primary">einplanen</a>
{% else %}
<a href="" class="btn btn-primary">ausplanen</a>
{% endif %}
</td>
</tr>
{% empty %}
<tr>
<td colspan="4">Es gibt keine Reparateure.</td>
</tr>
{% endfor %}
</tbody>
</table>
<hr class="mt-0 mb-4">
<h1 class="mt-2">Geräte</h1>
<table class="table">
<thead>
<tr>
<th scope="col">Art des Geräts</th>
<th scope="col">Hersteller & Modell/Typ</th>
<th scope="col">Interessenten</th>
<th scope="col">Reparateur</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
{% for device in devices %}
<tr>
<td>{{ device.device }}</td>
<td>{{ device.manufacturer }}</td>
<td>
{% for reparateur in device.reparateur.all %}
{{ reparateur.name }}
<br>
{% endfor %}
</td>
<td>//TODO: dropdown</td>
<td>
<a href="" class="btn btn-primary">aktualisieren</a>
</td>
</tr>
{% empty %}
<tr>
<td colspan="4">Es gibt kein Geräte.</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock content %}

View file

@ -35,6 +35,7 @@ urlpatterns = [
views.review_device_accept, name="review_device_accept"), views.review_device_accept, name="review_device_accept"),
path("orga/review/<int:device>/reject/", path("orga/review/<int:device>/reject/",
views.RejectDeviceFormView.as_view(), name="review_device_reject"), views.RejectDeviceFormView.as_view(), name="review_device_reject"),
path("orga/<int:cafe>/", views.orga_plan_cafe, name="orga_plan_cafe"),
path("member/device/<int:device>/question/", path("member/device/<int:device>/question/",
views.QuestionDeviceFormView.as_view(), name="device_question"), views.QuestionDeviceFormView.as_view(), name="device_question"),
path("member/device/<int:pk>/question/edit", path("member/device/<int:pk>/question/edit",

View file

@ -1076,3 +1076,35 @@ def repa_device_unassign(request, device):
return HttpResponseRedirect(reverse_lazy('repa_view_device', kwargs={ return HttpResponseRedirect(reverse_lazy('repa_view_device', kwargs={
'device': device.id 'device': device.id
})) }))
@login_required(login_url=reverse_lazy('member'))
def orga_plan_cafe(request, cafe):
"""
View device details.
"""
# TODO: test
if not is_organisator(request.user):
raise PermissionDenied('Not organisator!')
cafe = get_object_or_404(Cafe, pk=cafe)
reparateurs = []
for reparateur in Reparateur.objects.all():
if cafe.reparateur.filter(pk=reparateur.pk).count() > 0:
reparateur.accepted = True
else:
reparateur.accepted = False
reparateurs.append(reparateur)
devices = Device.objects.filter(
status__gte=Device.STATUS_WAITING_LIST).all()
return render(
request,
"repapp/orga/plan_cafe.html",
{
'cafe': cafe,
'devices': devices,
'reparateurs': reparateurs,
}
)