Files
allmende-essen/new-registration-app/templates/event.html

123 lines
5.4 KiB
HTML

{% extends "base.html" %}
{% block content %}
<p class="h1">{{ event.title }}</p>
<p>{{ event.description }}</p>
<hr class="hr"/>
<p class="h3">Anmeldungen</p>
<div class="container">
<div class="row">
<div class="col-md-4 d-flex justify-content-center align-items-center flex-column">
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary mb-2" data-bs-toggle="modal" data-bs-target="#staticBackdrop">
Anmeldung hinzufügen
</button>
{% if event.recipe_link %}
<div class="mb-3">
<a href="{{ event.recipe_link }}" class="btn btn-outline-primary" target="_blank">
<i class="bi bi-book"></i> Original Rezept ansehen
</a>
</div>
{% endif %}
</div>
<div class="col-md-8">
<div class="card">
<div class="card-body">
<h5 class="card-title">Zusammenfassung</h5>
<table class="table table-sm">
<tr>
<td>Erwachsene:</td>
<td>{{ event.registrations | sum(attribute="num_adult_meals") }}</td>
</tr>
<tr>
<td>Kinder:</td>
<td>{{ event.registrations | sum(attribute="num_children_meals") }}</td>
</tr>
<tr>
<td>Kleinkinder:</td>
<td>{{ event.registrations | sum(attribute="num_small_children_meals") }}</td>
</tr>
<tr>
<th>Gesamt:</th>
<th>{{ event.registrations | sum(attribute="num_adult_meals") + event.registrations | sum(attribute="num_children_meals") +event.registrations | sum(attribute="num_small_children_meals")}} </th>
</tr>
</table>
</div>
</div>
</div>
</div>
<table class="table">
<thead>
<tr>
<th scope="col">Haushalt</th>
<th scope="col">Erwachsene</th>
<th scope="col">Kinder</th>
<th scope="col">Kleinkinder</th>
<th scope="col">Löschen</th>
</tr>
</thead>
<tbody>
{% for reg in event.registrations %}
<tr>
<td>{{ reg.household.name }}</td>
<td>{{ reg.num_adult_meals }}</td>
<td>{{ reg.num_children_meals }}</td>
<td>{{ reg.num_small_children_meals }}</td>
<td><a href="/event/{{event.id}}/registration/{{reg.household_id}}/delete"><i class="bi bi-trash"></i></a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- Modal -->
<div class="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1"
aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="staticBackdropLabel">Anmeldung hinzufügen</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form action="/event/{{event.id}}/register" method="POST">
<div class="modal-body">
<p>Wenn dein Haushalt nicht auswählbar ist, existiert schon eine Anmeldung. Wenn du die Anmeldung ändern willst, lösche die bestehende Anmeldung und lege eine neue an.</p>
<div class="mb-3">
<select name="household" class="form-select" aria-label="Multiple select example">
<option selected>Wer?</option>
{% for household in households %}
<option value="{{household.id}}">{{household.name}}</option>
{% endfor %}
</select>
</div>
<div class="row">
<div class="col">
<label for="InputAdults" class="form-label">Anzahl Erwachsene</label>
<input name="numAdults" id="InputAdults" type="text" class="form-control"
aria-label="Anzahl Erwachsene">
</div>
<div class="col">
<label for="InputKids" class="form-label">Anzahl Kinder >7 </label>
<input name="numKids" id="InputKids" type="text" class="form-control"
aria-label="Anzahl Kinder >7">
</div>
<div class="col">
<label for="InputSmallKids" class="form-label">Anzahl Kinder <7 </label>
<input name="numSmallKids" id="InputSmallKids" type="text" class="form-control"
aria-label="Anzahl Kinder <7">
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Anmelden</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Abbrechen</button>
</div>
</form>
</div>
</div>
</div>
{% endblock %}