{% extends 'admin.html.twig' %}


{% block body %}
    <section class="clearfix">
        <div class="content-copy">
            <h1>Objekte</h1>

            <div class="table-responsive" id="no-more-tables">
                <table class="table">
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>Name</th>
                        <th>Typ</th>
                        <th>Objekt</th>
                    </tr>
                    </thead>
                    <tbody>

                    {% if lodgingGroups is not empty %}
                        {% for lodgingGroup in lodgingGroups %}
                            <tr>
                                <td>- ({{ lodgingGroup.id }}) -</td>
                                <td>{{ lodgingGroup.name }}</td>
                                <td>Gruppe</td>
                                <td>
                                    <a href="{{ '/admin/fewo/lodging/group/' ~ lodgingGroup.id }}"
                                       class="btn btn-primary"
                                       rel="nofollow"
                                    >
                                        Bearbeiten
                                    </a>
                                    <a href="{{ '/admin/fewo/lodging/group/' ~ lodgingGroup.id ~ '/delete' }}"
                                       class="btn btn-primary"
                                       rel="nofollow"
                                    >
                                        Löschen
                                    </a>
                                </td>
                            </tr>
                             {% if lodgingGroup.lodgings is not empty %}
                                {% for lodging in lodgingGroup.lodgings  %}
                                   <tr>
                                        <td>{{ lodging.id }}</td>
                                        <td>{{ lodging.name }}</td>
                                        <td>{{ lodging.type }}</td>
                                        <td>
                                            <a href="{{ '/admin/fewo/lodgings/' ~ lodging.id }}"
                                               class="btn btn-primary"
                                               rel="nofollow"
                                            >
                                                Bearbeiten
                                            </a>
                                            <a href="{{ '/admin/fewo/lodgings/' ~ lodging.id ~ '/delete' }}"
                                               class="btn btn-primary"
                                               rel="nofollow"
                                            >
                                                Löschen
                                            </a>
                                        </td>
                                    </tr>
                                {% endfor %}
                             {% endif %}


                        {% endfor %}
                    {% else %}
                        <h2>Keine Objekte verfügbar</h2>
                    {% endif %}

                    <tr>
                        <td>
                            <a href="/admin/fewo/lodgings/new"
                               class="btn btn-primary"
                               rel="nofollow"
                            >
                                Hinzufügen
                            </a>
                        </td>
                    </tr>

                     <tr>
                        <td>
                            <a href="/admin/fewo/lodgings/group/new"
                               class="btn btn-primary"
                               rel="nofollow"
                            >
                               Gruppe hinzufügen
                            </a>
                        </td>
                    </tr>

                    </tbody>
                </table>
            </div>
        </div>
    </section><!-- end section -->
{% endblock body %}