{% load datatable_tags %}

{% for group in groups.values %}
    <div class="card django-card" id="list" data-title="">
        <div class="card-header">
            <div class="d-flex align-items-center">
                <h5 class="mr-auto">{{ group.title }}</h5>
                {{ group.menu.render }}
            </div>
        </div>
        <div class="card-body cards-list">
            {% if group.type == group_types.datatable %}
                {{ group.datatable.render|safe }}
            {% elif group.type == group_types.standard %}
                <div class="list-group">
                    {% for row in group.rows %}
                        {% if row.type == 'multiple' %}<div class="row">{% endif %}
                        {% for entry in row.entries %}
                            {% if row.type == 'multiple' %}<div class="{{ row.css_class }}">{% endif %}
                            {% if entry.link %}<a class="list-group-item cards-list-group-item" href="{{ entry.link }}">{% else %}<div class="list-group-item">{% endif %}
                                {% if entry.label %}
                                    <label>{{ entry.label }}</label>
                                    {% if entry.multiple_lines %}
                                        {% for x in entry.html %}
                                            <h4 class="list-group-item-heading {{ entry.css_class }}">{{ x|safe }}</h4>
                                        {% endfor %}
                                    {% else %}
                                        <h4 class="list-group-item-heading {{ entry.css_class }}">{{ entry.html|safe }}</h4>
                                    {% endif %}
                                {% else %}
                                    {{ entry.html|safe }}
                                {% endif %}
                            {% if entry.link %}</a>{% else %}</div>{% endif %}
                         {% if row.type == 'multiple' %}</div>{% endif %}
                        {% endfor %}
                        {% if row.type == 'multiple' %}</div>{% endif %}
                    {% endfor %}
                </div>
            {% elif group.type == group_types.html %}
                {{ group.html }}
            {% endif %}
        </div>
        {% if group.created_modified_dates %}
            <div class="card-footer">
                <small style="text-align: left">Date modified: {{ group.created_modified_dates.0 }}<br>Date
                    created: {{ group.created_modified_dates.1 }}
                </small>
            </div>
        {% endif %}
    </div>
{% endfor %}