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

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

{% block content %}

    <div class="row">
        <div class="col-12">
            <h1 class="h3 mb-4">
                <i class="fas fa-chart-bar text-primary me-2"></i>Berichte & Auswertungen
            </h1>
        </div>
    </div>

    <div class="row">
        <!-- Jahresberichte -->
        <div class="col-lg-6 mb-4">
            <div class="card shadow h-100">
                <div class="card-header py-3">
                    <h6 class="m-0 font-weight-bold text-primary">
                        <i class="fas fa-calendar-alt me-2"></i>Jahresberichte
                    </h6>
                </div>
                <div class="card-body">
                    <p class="text-muted mb-4">
                        Generieren Sie detaillierte Jahresberichte mit allen wichtigen Informationen zu Personen, 
                        Förderungen und Ländereien.
                    </p>
                    
                    <form method="get" action="{% url 'stiftung:jahresbericht_generate_redirect' %}">
                        <div class="row g-3">
                            <div class="col-md-6">
                                <label for="jahr" class="form-label">Jahr auswählen</label>
                                <select name="jahr" id="jahr" class="form-select" required>
                                    <option value="">Jahr wählen...</option>
                                    {% for year in jahre %}
                                    <option value="{{ year }}">{{ year }}</option>
                                    {% endfor %}
                                </select>
                            </div>
                            <div class="col-md-6 d-flex align-items-end">
                                <button type="submit" class="btn btn-primary w-100">
                                    <i class="fas fa-file-alt me-2"></i>Bericht generieren
                                </button>
                            </div>
                        </div>
                    </form>
                    
                    <div class="mt-4">
                        <h6 class="text-primary">Verfügbare Berichte:</h6>
                        <div class="list-group list-group-flush">
                            {% for year in jahre %}
                            <div class="list-group-item d-flex justify-content-between align-items-center">
                                <span>Jahresbericht {{ year }}</span>
                                <div class="btn-group" role="group">
                                    <a href="{% url 'stiftung:jahresbericht_generate' year %}" class="btn btn-sm btn-outline-primary">
                                        <i class="fas fa-eye me-1"></i>Anzeigen
                                    </a>
                                    <a href="{% url 'stiftung:jahresbericht_pdf' year %}" class="btn btn-sm btn-outline-success">
                                        <i class="fas fa-download me-1"></i>PDF
                                    </a>
                                </div>
                            </div>
                            {% endfor %}
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Statistik-Übersicht -->
        <div class="col-lg-6 mb-4">
            <div class="card shadow h-100">
                <div class="card-header py-3">
                    <h6 class="m-0 font-weight-bold text-primary">
                        <i class="fas fa-chart-pie me-2"></i>Statistik-Übersicht
                    </h6>
                </div>
                <div class="card-body">
                    <div class="row g-3">
                        <div class="col-md-6">
                            <div class="card bg-primary text-white">
                                <div class="card-body text-center">
                                    <i class="fas fa-users fa-2x mb-2"></i>
                                    <h5 class="card-title">Personen</h5>
                                    <h3 class="card-text">{{ total_persons|default:"0" }}</h3>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="card bg-success text-white">
                                <div class="card-body text-center">
                                    <i class="fas fa-gift fa-2x mb-2"></i>
                                    <h5 class="card-title">Förderungen</h5>
                                    <h3 class="card-text">{{ total_foerderungen|default:"0" }}</h3>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="card bg-secondary text-white">
                                <div class="card-body text-center">
                                    <i class="fas fa-user-friends fa-2x mb-2"></i>
                                    <h5 class="card-title">Destinatäre</h5>
                                    <h3 class="card-text">{{ total_destinataere|default:"0" }}</h3>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="card bg-info text-white">
                                <div class="card-body text-center">
                                    <i class="fas fa-map fa-2x mb-2"></i>
                                    <h5 class="card-title">Ländereien</h5>
                                    <h3 class="card-text">{{ total_laendereien|default:"0" }}</h3>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="card bg-warning text-white">
                                <div class="card-body text-center">
                                    <i class="fas fa-handshake fa-2x mb-2"></i>
                                    <h5 class="card-title">Verpachtungen</h5>
                                    <h3 class="card-text">{{ total_verpachtungen|default:"0" }}</h3>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="mt-4">
                        <h6 class="text-primary">Schnellzugriff:</h6>
                        <div class="d-grid gap-2">
                            <a href="{% url 'stiftung:person_list' %}" class="btn btn-outline-primary">
                                <i class="fas fa-users me-2"></i>Alle Personen anzeigen
                            </a>
                            <a href="{% url 'stiftung:foerderung_list' %}" class="btn btn-outline-success">
                                <i class="fas fa-gift me-2"></i>Alle Förderungen anzeigen
                            </a>
                            <a href="{% url 'stiftung:land_list' %}" class="btn btn-outline-info">
                                <i class="fas fa-map me-2"></i>Alle Ländereien anzeigen
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Zusätzliche Berichte -->
    <div class="row">
        <div class="col-12">
            <div class="card shadow">
                <div class="card-header py-3">
                    <h6 class="m-0 font-weight-bold text-primary">
                        <i class="fas fa-cogs me-2"></i>Weitere Berichtstypen
                    </h6>
                </div>
                <div class="card-body">
                    <div class="row g-4">
                        <div class="col-md-4">
                            <div class="card border-0 shadow-sm h-100">
                                <div class="card-body text-center">
                                    <i class="fas fa-euro-sign fa-3x text-success mb-3"></i>
                                    <h5 class="card-title">Finanzberichte</h5>
                                    <p class="card-text">Detaillierte Auswertungen zu Förderungen und Ausgaben.</p>
                                    <button class="btn btn-outline-success" disabled>
                                        <i class="fas fa-clock me-2"></i>In Entwicklung
                                    </button>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="card border-0 shadow-sm h-100">
                                <div class="card-body text-center">
                                    <i class="fas fa-chart-line fa-3x text-info mb-3"></i>
                                    <h5 class="card-title">Trendanalysen</h5>
                                    <p class="card-text">Langzeitentwicklungen und Prognosen für die Zukunft.</p>
                                    <button class="btn btn-outline-info" disabled>
                                        <i class="fas fa-clock me-2"></i>In Entwicklung
                                    </button>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="card border-0 shadow-sm h-100">
                                <div class="card-body text-center">
                                    <i class="fas fa-file-export fa-3x text-warning mb-3"></i>
                                    <h5 class="card-title">Export-Funktionen</h5>
                                    <p class="card-text">Datenexport in verschiedene Formate (Excel, CSV, PDF).</p>
                                    <button class="btn btn-outline-warning" disabled>
                                        <i class="fas fa-clock me-2"></i>In Entwicklung
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

{% endblock %} 
