Minor tweaks
* display date on event page * Filter existing subscriptions for new subscriptions dropdown * Add Typeahead for Team registration
This commit is contained in:
@@ -10,8 +10,7 @@ from fastapi.staticfiles import StaticFiles
|
|||||||
from fastapi.templating import Jinja2Templates
|
from fastapi.templating import Jinja2Templates
|
||||||
from sqlmodel import Session, SQLModel, create_engine, select
|
from sqlmodel import Session, SQLModel, create_engine, select
|
||||||
|
|
||||||
from models import (Event, Household, Registration, Subscription,
|
from models import Event, Household, Registration, Subscription, TeamRegistration
|
||||||
TeamRegistration)
|
|
||||||
|
|
||||||
sqlite_file_name = "database.db"
|
sqlite_file_name = "database.db"
|
||||||
sqlite_url = f"sqlite:///{sqlite_file_name}"
|
sqlite_url = f"sqlite:///{sqlite_file_name}"
|
||||||
@@ -85,15 +84,13 @@ async def subscribe(request: Request, session: SessionDep):
|
|||||||
statement = select(Household)
|
statement = select(Household)
|
||||||
households = session.exec(statement).all()
|
households = session.exec(statement).all()
|
||||||
|
|
||||||
# filter out households with existing registrations
|
|
||||||
# households = [
|
|
||||||
# h
|
|
||||||
# for h in households
|
|
||||||
# if h.id not in [reg.household_id for reg in event.registrations]
|
|
||||||
# ]
|
|
||||||
|
|
||||||
subscriptions = session.exec(select(Subscription)).all()
|
subscriptions = session.exec(select(Subscription)).all()
|
||||||
|
|
||||||
|
# filter out households with existing subscriptions
|
||||||
|
households = [
|
||||||
|
h for h in households if h.id not in [sub.household_id for sub in subscriptions]
|
||||||
|
]
|
||||||
|
|
||||||
return templates.TemplateResponse(
|
return templates.TemplateResponse(
|
||||||
request=request,
|
request=request,
|
||||||
name="subscribe.html",
|
name="subscribe.html",
|
||||||
|
|||||||
@@ -15,3 +15,5 @@ dev = [
|
|||||||
"black>=25.1.0",
|
"black>=25.1.0",
|
||||||
"isort>=6.0.1",
|
"isort>=6.0.1",
|
||||||
]
|
]
|
||||||
|
[tool.isort]
|
||||||
|
profile = "black"
|
||||||
@@ -32,7 +32,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="submit" class="btn btn-primary">Event erstellen</button>
|
<button type="submit" class="btn btn-primary">Event erstellen</button>
|
||||||
<a href="/new-registration-app/static" class="btn btn-secondary">Abbrechen</a>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -14,10 +14,11 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<p class="h1">{{ event.title }}</p>
|
<p class="h1">{{ event.title }}</p>
|
||||||
|
<p class="text-muted">{{ event.event_time.strftime('%A, %d.%m.%Y') }}</p>
|
||||||
<p>{{ event.description }}</p>
|
<p>{{ event.description }}</p>
|
||||||
<hr class="hr"/>
|
<hr class="hr"/>
|
||||||
<p class="h3">Anmeldungen</p>
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
<p class="h3">Anmeldungen</p>
|
||||||
<div class="row m-2">
|
<div class="row m-2">
|
||||||
<div class="col-md-4 d-flex justify-content-center align-items-center flex-column">
|
<div class="col-md-4 d-flex justify-content-center align-items-center flex-column">
|
||||||
<p class="text-muted w-100 mb-2">Anmeldung schließt {{ event.registration_deadline.strftime('%A, %d.%m.%Y, %H:%M Uhr') }}</p>
|
<p class="text-muted w-100 mb-2">Anmeldung schließt {{ event.registration_deadline.strftime('%A, %d.%m.%Y, %H:%M Uhr') }}</p>
|
||||||
@@ -214,8 +215,15 @@
|
|||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="personName" class="form-label">Name</label>
|
<label for="personName" class="form-label">Name</label>
|
||||||
<input name="personName" id="personName" type="text" class="form-control"
|
<input name="personName" id="personName" type="text" class="form-control"
|
||||||
aria-label="Name">
|
aria-label="Name" list="people">
|
||||||
</div>
|
</div>
|
||||||
|
<datalist id="people">
|
||||||
|
{% for household in households %}
|
||||||
|
{% for person in household.name.split(",") %}
|
||||||
|
<option value="{{ person.strip() }}">
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
</datalist>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="workType" class="form-label">Dienst-Art</label>
|
<label for="workType" class="form-label">Dienst-Art</label>
|
||||||
<select id="workType" name="workType" class="form-select" aria-label="Multiple select example">
|
<select id="workType" name="workType" class="form-select" aria-label="Multiple select example">
|
||||||
|
|||||||
@@ -81,7 +81,6 @@
|
|||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
<div class="card-footer d-flex justify-content-end gap-2">
|
<div class="card-footer d-flex justify-content-end gap-2">
|
||||||
<button type="submit" class="btn btn-primary">Dauerhaft anmelden</button>
|
<button type="submit" class="btn btn-primary">Dauerhaft anmelden</button>
|
||||||
<a href="/" class="btn btn-secondary">Abbrechen</a>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user