Files
svc-essensplanung/templates/mahlzeiten/form.html.twig
T

49 lines
1.9 KiB
Twig

{% extends 'layout/base.html.twig' %}
{% set titel = mahlzeit ? 'Mahlzeit bearbeiten' : 'Neue Mahlzeit' %}
{% block title %}{{ titel }} · svc-essensplanung{% endblock %}
{% block body %}
<div class="card">
<h1 style="margin-top: 0;">{{ titel }}</h1>
{% if fehler %}
<div class="flash flash-error">{{ fehler }}</div>
{% endif %}
<form method="post"
action="{{ mahlzeit ? path('mahlzeiten_aktualisieren', { id: mahlzeit.id }) : path('mahlzeiten_speichern') }}">
<div class="field">
<label for="name">Name <span class="req" title="Pflichtfeld">*</span></label>
<input type="text" id="name" name="name" value="{{ werte.name }}" required>
</div>
<div class="field">
<label for="notiz">Notiz</label>
<textarea id="notiz" name="notiz" rows="3" placeholder="z. B. mit Basilikum, scharf …">{{ werte.notiz }}</textarea>
</div>
<div class="field">
<label>Wochentage</label>
{% set gewaehlte = werte.wochentage|map(t => t.value) %}
<div class="checkboxes">
{% for tag in wochentage_choices %}
<label class="checkbox">
<input type="checkbox" name="wochentage[]" value="{{ tag.value }}"
{{ tag.value in gewaehlte ? 'checked' : '' }}>
{{ tag.name }}
</label>
{% endfor %}
</div>
</div>
<div class="actions">
<button type="submit" class="btn">{{ mahlzeit ? 'Speichern' : 'Anlegen' }}</button>
<a class="btn btn-link" href="{{ path('mahlzeiten_index') }}">Abbrechen</a>
</div>
</form>
</div>
{% endblock %}