{% extends 'admin.html.twig' %}
{% form_theme form 'default/form/theme.html.twig' %}

{% block body %}
    <section class="clearfix">
        <div class="content-copy">
            <h1>Gruppe {{ lodgingGroup.name }} bearbeiten</h1>

            <form class="st-booking-form" method="post">

                {{ form_errors(form) }}

                <div id="message"></div>

                <div class="form-box">

                    {{ form_row(form.name, {'label': 'Name'}) }}


                      <br><br>

                    <h3>Bilder vor</h3>
                    {% if lodgingGroup.images is not empty %}
                    <table class="table">
                        <thead>
                        <tr>
                            <th>Bild</th>
                            <th>Pos</th>
                            <th>Name</th>
                            <th>Beschreibung</th>
                            <th></th>
                        </tr>
                        </thead>
                        <tbody>
                            {% for image in lodgingGroup.images %}
                                {% if image.comp == 'pre' %}
                                <tr>
                                    <td><img src="{{ asset('uploads/images/' ~ image.file) }}" alt="{{ image.description }}" style="width:228px;height:75px;" ></td>
                                    <td>{{ image.pos }}</td>
                                    <td>{{ image.fileName }}</td>
                                    <td>{{ image.description }}</td>
                                    <td>
                                        <a href="{{ '/admin/fewo/lodgings/group/' ~ lodgingGroup.id ~ '/images/' ~ image.id }}"
                                           class="btn btn-primary"
                                        >
                                            Bearbeiten
                                        </a>
                                        <a href="{{ '/admin/fewo/lodgings/group/' ~ lodgingGroup.id ~ '/images/' ~ image.id ~ '/delete' }}"
                                           class="btn btn-primary"
                                        >
                                            Löschen
                                        </a>
                                    </td>
                                </tr>
                                {% endif %}
                            {% endfor %}
                        </tbody>
                    </table>
                    {% else %}
                        <h4>Keine Bilder vorhanden</h4>
                    {% endif %}

                    <a href="{{ '/admin/fewo/lodgings/group/pre/' ~ lodgingGroup.id ~ '/images/new' }}" class="btn btn-primary">
                        Hinzufügen
                    </a>
                    <a href="/admin/fewo/lodgings/group/pre/{{ lodgingGroup.id }}/images/multi-upload" class="btn btn-primary">
                        Mehrere Bilder hochladen
                    </a>

                    <br><br>

                     <h3>Bilder nach</h3>
                    {% if lodgingGroup.images is not empty %}
                    <table class="table">
                        <thead>
                        <tr>
                            <th>Bild</th>
                            <th>Pos</th>
                            <th>Name</th>
                            <th>Beschreibung</th>
                            <th></th>
                        </tr>
                        </thead>
                        <tbody>
                            {% for image in lodgingGroup.images %}
                                {% if image.comp == 'post' %}
                                <tr>
                                    <td><img src="{{ asset('uploads/images/' ~ image.file) }}" alt="{{ image.description }}" style="width:228px;height:75px;" ></td>
                                    <td>{{ image.pos }}</td>
                                    <td>{{ image.fileName }}</td>
                                    <td>{{ image.description }}</td>
                                    <td>
                                        <a href="{{ '/admin/fewo/lodgings/group/' ~ lodgingGroup.id ~ '/images/' ~ image.id }}"
                                           class="btn btn-primary"
                                        >
                                            Bearbeiten
                                        </a>
                                        <a href="{{ '/admin/fewo/lodgings/group/' ~ lodgingGroup.id ~ '/images/' ~ image.id ~ '/delete' }}"
                                           class="btn btn-primary"
                                        >
                                            Löschen
                                        </a>
                                    </td>
                                </tr>
                                {% endif %}
                            {% endfor %}
                        </tbody>
                    </table>
                    {% else %}
                        <h4>Keine Bilder vorhanden</h4>
                    {% endif %}

                    <a href="{{ '/admin/fewo/lodgings/group/post/' ~ lodgingGroup.id ~ '/images/new' }}" class="btn btn-primary">
                        Hinzufügen
                    </a>
                    <a href="/admin/fewo/lodgings/group/post/{{ lodgingGroup.id }}/images/multi-upload" class="btn btn-primary">
                        Mehrere Bilder hochladen
                    </a>

                    <br><br>

                    <div class="col-md-12 col-sm-12 col-xs-12">
                        <button type="submit" value="SEND" id="submit"
                                class="btn btn-primary btn-lg border-radius"
                        >
                            Speichern
                        </button>
                    </div>
                </div><!-- end form-box -->
                {{ form_rest(form) }}
            </form>
            <a href="/admin/fewo/lodgings"
               class="btn btn-primary"
               rel="nofollow"
            >
                Zurück
            </a>
        </div>
    </section><!-- end section -->
{% endblock body %}