<!-- frontend_admin/templates/frontend_admin/admin.html -->
{% load django_bootstrap5 %}
{% load django_fast_frontend %}

<div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 g-3 mt-1 mb-1">

    {% for object in table.objects %}
        <div class="col d-flex justify-content-center mt-1 mb-1">
            <div class="card h-100" style="width: 20rem;">
                <div class="card-header"></div>
                <div class="card-body d-flex flex-column">
                    {#                <div class="d-flex justify-content-center align-items-center" style="height: 150px;">#}
                    {#                    <i class="bi bi-bootstrap" style="font-size: 3rem;"></i>#}
                    {#                </div>#}
                    {% for key, value in object.items %}
                        {% if not key == 'id' %}
                            <p class="card-text">{{ key }}: {{ value }}</p>
                        {% endif %}
                    {% endfor %}
                    <div class="d-flex">
                        {% if option.table.inline_button %}
                            {% for inline_button in table.inline_button %}
                                <div class="p-1">
                                    <form method="post" class="needs-validation" novalidate action="{% url 'frontend' app_name=segments.1 model_name=segments.2 action=inline_button id=object.id %}">
                                        {% csrf_token %}
                                        {% with inline_button|label as inline_button_label %}
                                            {% bootstrap_button button_type="submit" content=inline_button_label %}
                                        {% endwith %}
                                    </form>
                                </div>
                            {% endfor %}
                        {% endif %}
                    </div>
                    <div class="d-flex">
                        {% if option.table.change %}
                            <div class="p-1">
                                <a href="{% url 'frontend' app_name=segments.1 model_name=segments.2 action="table_change" id=object.id %}">{% bootstrap_button button_type="button" content="<i class='bi bi-pencil'></i> Edit" %}</a>
                            </div>
                        {% endif %}
                    </div>
                </div>
            </div>
        </div>
    {% endfor %}
</div>
