{% extends 'base.html' %}
{% load static %}
{% load help_tags %}

{% block title %}{{ title }} - Stiftungsverwaltung{% endblock %}

{% block content %}

    <div class="row">
        <div class="col-lg-8">
            <div class="card shadow">
                <div class="card-header">
                    <h4 class="mb-0">
                        <i class="fas fa-gift text-primary me-2"></i>{{ title }}
                    </h4>
                </div>
                <div class="card-body">
                    <form method="post">
                        {% csrf_token %}
                        
                        <div class="row">
                            <div class="col-md-6 mb-3">
                                <label for="{{ form.destinataer.id_for_label }}" class="form-label">
                                    {{ form.destinataer.label }} *
                                </label>
                                {{ form.destinataer }}
                                {% if form.destinataer.errors %}
                                <div class="invalid-feedback d-block">
                                    {{ form.destinataer.errors.0 }}
                                </div>
                                {% endif %}
                            </div>
                            
                            <div class="col-md-6 mb-3">
                                <label for="{{ form.jahr.id_for_label }}" class="form-label">
                                    {{ form.jahr.label }} *
                                </label>
                                {{ form.jahr }}
                                {% if form.jahr.errors %}
                                <div class="invalid-feedback d-block">
                                    {{ form.jahr.errors.0 }}
                                </div>
                                {% endif %}
                            </div>
                        </div>
                        
                        <div class="row">
                            <div class="col-md-6 mb-3">
                                <label for="{{ form.betrag.id_for_label }}" class="form-label">
                                    {{ form.betrag.label }} *
                                </label>
                                <div class="input-group">
                                    <span class="input-group-text">€</span>
                                    {{ form.betrag }}
                                </div>
                                {% if form.betrag.errors %}
                                <div class="invalid-feedback d-block">
                                    {{ form.betrag.errors.0 }}
                                </div>
                                {% endif %}
                            </div>
                            
                            <div class="col-md-6 mb-3">
                                <label for="{{ form.kategorie.id_for_label }}" class="form-label">
                                    {{ form.kategorie.label }} *
                                </label>
                                {{ form.kategorie }}
                                {% if form.kategorie.errors %}
                                <div class="invalid-feedback d-block">
                                    {{ form.kategorie.errors.0 }}
                                </div>
                                {% endif %}
                            </div>
                        </div>
                        
                        <div class="row">
                            <div class="col-md-6 mb-3">
                                <label for="{{ form.status.id_for_label }}" class="form-label">
                                    {{ form.status.label }} *
                                </label>
                                {{ form.status }}
                                {% if form.status.errors %}
                                <div class="invalid-feedback d-block">
                                    {{ form.status.errors.0 }}
                                </div>
                                {% endif %}
                            </div>
                            
                            <div class="col-md-6 mb-3">
                                <label for="{{ form.antragsdatum.id_for_label }}" class="form-label">
                                    {{ form.antragsdatum.label }} *
                                </label>
                                {{ form.antragsdatum }}
                                {% if form.antragsdatum.errors %}
                                <div class="invalid-feedback d-block">
                                    {{ form.antragsdatum.errors.0 }}
                                </div>
                                {% endif %}
                            </div>
                        </div>
                        
                        <div class="row">
                            <div class="col-md-6 mb-3">
                                <label for="{{ form.entscheidungsdatum.id_for_label }}" class="form-label">
                                    {{ form.entscheidungsdatum.label }}
                                </label>
                                {{ form.entscheidungsdatum }}
                                {% if form.entscheidungsdatum.errors %}
                                <div class="invalid-feedback d-block">
                                    {{ form.entscheidungsdatum.errors.0 }}
                                </div>
                                {% endif %}
                            </div>
                            
                            <div class="col-md-6 mb-3">
                                <label for="{{ form.verwendungsnachweis.id_for_label }}" class="form-label">
                                    {{ form.verwendungsnachweis.label }}
                                </label>
                                {{ form.verwendungsnachweis }}
                                {% if form.verwendungsnachweis.errors %}
                                <div class="invalid-feedback d-block">
                                    {{ form.verwendungsnachweis.errors.0 }}
                                </div>
                                {% endif %}
                                <div class="form-text">
                                    Optionale Verknüpfung zu einem Dokument aus dem Paperless-System
                                </div>
                            </div>
                        </div>
                        
                        <div class="mb-3">
                            <label for="{{ form.bemerkungen.id_for_label }}" class="form-label">
                                {{ form.bemerkungen.label }}
                            </label>
                            {{ form.bemerkungen }}
                            {% if form.bemerkungen.errors %}
                            <div class="invalid-feedback d-block">
                                {{ form.bemerkungen.errors.0 }}
                            </div>
                            {% endif %}
                        </div>
                        
                        <div class="d-flex justify-content-between">
                            <a href="{% url 'stiftung:foerderung_list' %}" class="btn btn-secondary">
                                <i class="fas fa-arrow-left me-2"></i>Zurück zur Liste
                            </a>
                            <button type="submit" class="btn btn-primary">
                                <i class="fas fa-save me-2"></i>Speichern
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        
        <!-- Sidebar mit Hilfe -->
        <div class="col-lg-4">
            {% help_box 'foerderung_new' user %}
        </div>
    </div>

{% endblock %}

{% block extra_css %}
<style>
    .form-control, .form-select {
        border-radius: 0.375rem;
    }
    .form-control:focus, .form-select:focus {
        border-color: #86b7fe;
        box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    }
</style>
{% endblock %} 
