{% extends "base.html" %}

{% block content %}
<div class="row justify-content-center mt-4">
    <div class="col-md-8">
        {% if edit_mode %}<h2>Event bearbeiten</h2>{% else %}<h2>Neues Event erstellen</h2>{% endif %}
        {% if edit_mode %}<form method="post" action="/event/{{ event.id }}/edit">{% else %}<form method="post" action="/event/add">{% endif %}
            <div class="mb-3">
                <label for="eventName" class="form-label">Event Name</label>
                <input type="text" class="form-control" id="eventName" name="eventName" required {% if edit_mode %}value="{{ event.title }}"{% endif %}>
            </div>

            <div class="mb-3">
                <label for="eventTime" class="form-label">Datum und Uhrzeit</label>
                <input type="datetime-local" class="form-control" id="eventTime" name="eventTime" required {% if edit_mode %}value="{{ event.event_time }}"{% endif %}>
            </div>

            <div class="mb-3">
                <label for="registrationDeadline" class="form-label">Anmeldungs-Deadline</label>
                <input type="datetime-local" class="form-control" id="registrationDeadline" name="registrationDeadline" {% if edit_mode %}value="{{ event.registration_deadline }}"{% endif %}>
                <small class="form-text text-muted">Leer lassen für Sonntag Abend vor dem Event</small>
            </div>

            <div class="mb-3">
                <label for="organizerName" class="form-label">Organisator*in</label>
                <input type="text" class="form-control" id="organizerName" name="organizerName" {% if edit_mode %}value="{{ event.organizer_name }}"{% endif %}>
                <small class="form-text text-muted">Name der Person, die das Event organisiert.</small>
            </div>

            <div class="mb-3">
                <label for="recipeLink" class="form-label">Rezept-Link</label>
                <input type="text" class="form-control" id="recipeLink" name="recipeLink" {% if edit_mode %}value="{{ event.recipe_link }}"{% endif %}>
            </div>

            <div class="mb-3">
                <label for="eventDescription" class="form-label">Beschreibung</label>
                <textarea class="form-control" id="eventDescription" name="eventDescription" rows="3" {% if edit_mode %}value="{{ event.description }}"{% endif %}></textarea>
            </div>

            <div class="mb-3 form-check">
                <input type="checkbox" class="form-check-input" id="ignoreSubscriptions" name="ignoreSubscriptions" {% if (edit_mode and event.ignore_subscriptions) or not edit_mode %}checked{% endif %}>
                <label class="form-check-label" for="ignoreSubscriptions">Dauerhafte Anmeldung ignorieren</label>
                <small class="form-text text-muted">
                    Aktivieren, um dauerhafte Anmeldungen für dieses Event zu ignorieren. Das sollte für alle Events getan werden, die keine offiziellen AG Kochen Kochabende sind.
                </small>
            </div>

            <div class="mb-3 form-check">
                <input type="checkbox" class="form-check-input" id="excludeFromBilling" name="excludeFromBilling" {% if edit_mode and event.exclude_from_billing %}checked{% endif %}>
                <label class="form-check-label" for="excludeFromBilling">Keine Abrechnung</label>
                <small class="form-text text-muted">
                    Aktivieren, um dieses Event von der Abrechnung auszuschließen.
                </small>
            </div>
            <div class="mb-3">
            <h3>Helfer</h3>
            </div>
            <div class="row m-2">
                <div class="col-md-4">
                    <label for="teamCookingMin" class="form-label">Kochen</label>
                    <input type="number" class="form-control" id="teamCookingMin" min="0" name="teamCookingMin"
                        value="{% if
                        edit_mode %}{{ event.team_cooking_min }}{% else %}3{% endif %}">
                </div>
                <div class="col-md-4">
                    <label for="teamDishesMin" class="form-label">Spülen</label>
                    <input type="number" class="form-control" id="teamDishesMin" min="0" name="teamDishesMin" value="{% if
                        edit_mode %}{{ event.team_dishes_min }}{% else %}3{% endif %}">
                </div>
                <div class="col-md-4">
                    <label for="teamPrepMin" class="form-label">Tisch decken</label>
                    <input type="number" class="form-control" id="teamPrepMin" min="0" name="teamPrepMin" value="{% if
                        edit_mode %}{{ event.team_prep_min }}{% else %}1{% endif %}">
                </div>
            </div>
            <button type="submit" class="btn btn-primary">Event {% if edit_mode %}bearbeiten{% else %}erstellen{% endif %}</button>
        </form>
    </div>
</div>
{% endblock %}
