{% extends 'django_spire/card/card.html' %}

{% block card_padding %}py-3 px-1{% endblock %}

{% block card_content %}
    <div class="row m-0 align-items-center">
        <div class="col-3 p-0">
            <div class="container">
                <div class="row m-0">
                    <div class="col-auto ps-0">
                        <i style="cursor: grab" x-sort:handle class="align-self-center bi bi-grip-vertical p-0"></i>
                        <i
                            x-show="collection.has_child_collections() || collection.has_entries()"
                            class="align-self-center p-0 cursor-pointer"
                            :class="collection.show_details ? 'bi bi-chevron-down' : 'bi bi-chevron-right'"
                            @click="collection.toggle_show_details({value: !collection.show_details})"
                        ></i>
                    </div>
                    <div
                        x-data="{
                            collection_detail_url: '{% url "django_spire:knowledge:collection:page:detail" pk=0 %}'.replace(0, collection.id)
                        }"
                        class="col p-0"
                    >
                        {% include 'django_spire/element/attribute_element.html' with x_attribute_value='collection.name' x_attribute_href='collection_detail_url' %}
                    </div>
                </div>
            </div>
        </div>
        <div class="col align-self-center">
            <span x-text="collection.description"></span>
        </div>
        <div
            x-data="{
                {% if AuthController.knowledge.can_view %}
                detail_url: '{% url "django_spire:knowledge:collection:page:detail" pk=0 %}'.replace(0, collection.id),
                {% endif %}
                {% if AuthController.knowledge.can_change %}
                edit_url: '{% url "django_spire:knowledge:collection:form:update" pk=0 %}'.replace(0, collection.id),
                {% endif %}
                {% if AuthController.knowledge.can_delete %}
                delete_url: '{% url "django_spire:knowledge:collection:page:delete" pk=0 %}'.replace(0, collection.id)
                {% endif %}
            }"
            class="col-auto"
        >
            {% include 'django_spire/dropdown/ellipsis_dropdown.html' with x_view_url='detail_url' x_edit_url='edit_url' x_delete_url='delete_url' %}
        </div>
    </div>
{% endblock %}
