{% extends "fellchensammlung/base.html" %}
{% load custom_tags %}
{% load i18n %}
{% load admin_urls %}

{% block title %}<title>{{ org.name }}</title>{% endblock %}
{% block og_title %}
    <meta property="og:title" content="{{ org.name }} - Notfellchen"/>
{% endblock %}
{% block description %}
    <meta name="description" content="{{ org.name }}: {% translate 'Kontaktdaten und Tiere zur Adoption' %}">
{% endblock %}
{% block og_description %}
    <meta property="og:description" content="{{ org.name }}: {% translate 'Kontaktdaten und Tiere zur Adoption' %}">
{% endblock %}
{% block canonical_url %}{% host %}{% url 'rescue-organization-detail' rescue_organization_id=org.id %}{% endblock %}

{% block content %}
    <div class="columns">
        <div class="column">
            <div class="block">
                {% include "fellchensammlung/partials/rescue_orgs/partial-basic-info-card.html" %}
            </div>
            <div class="block">
                {% include "fellchensammlung/partials/rescue_orgs/partial-rescue-organization-contact.html" %}
            </div>
            <div class="block">
                <a class="button is-warning is-fullwidth" href="{% url org_meta|admin_urlname:'change' org.pk %}">
                    <i class="fa-solid fa-tools fa-fw"></i> Admin interface
                </a>
            </div>
        </div>
        <div class="column">
            {% include "fellchensammlung/partials/partial-map.html" %}
        </div>
    </div>

    {% if org.child_organizations %}
        <div class="block">
            <h2 class="title is-2">{% translate 'Unterorganisationen' %}</h2>
            {% with rescue_organizations=org.child_organizations %}
                {% include "fellchensammlung/lists/list-animal-shelters.html" %}
            {% endwith %}
        </div>
    {% endif %}


    <h2 class="title is-2">{% translate 'Vermittlungen der Organisation' %}</h2>
    {% with ans_by_status=org.adoption_notices_in_hierarchy_divided_by_status %}
        {% with active_ans=ans_by_status.0 inactive_ans=ans_by_status.1 %}
            <div class="block">
                <h3 class="title is-3">{% translate 'Aktive Vermittlungen' %}</h3>
                <div class="container-cards">
                    {% if active_ans %}
                        {% for adoption_notice in active_ans %}
                            {% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %}
                        {% endfor %}
                    {% else %}
                        <p>{% translate "Keine Vermittlungen gefunden." %}</p>
                    {% endif %}
                </div>
            </div>
            <div class="block">
                <h3 class="title is-3">{% translate 'Inaktive Vermittlungen' %}</h3>
                <div class="container-cards">
                    {% if inactive_ans %}
                        {% for adoption_notice in inactive_ans %}
                            {% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %}
                        {% endfor %}
                    {% else %}
                        <p>{% translate "Keine Vermittlungen gefunden." %}</p>
                    {% endif %}
                </div>
            </div>
        {% endwith %}
    {% endwith %}
{% endblock %}
