
{% include "PublisherAdmin/_include.html" %}


<div id="images-page">

    {% call forms.upload('PublisherAdmin:upload_image', class='form-inline') %}
        <div class="row">

            <div class="col-md-12 col-xs-12">
                <div class="input-group">
                    <span class="input-group-addon">Add New Image</span>
                    <div class="form-control" style="padding-bottom: 50px;">
                        {{ forms.input(type="file", name="file") }}
                        {{ forms.button('Upload', type='submit', class='btn-info') }}
                    </div>
                </div>
                <br>
            </div>
        </div>
    {% endcall %}

    <hr>

{% call widget.panel("Images") %}
    <div class="row">
        {% for img in images %}
        <div class="col-md-3 col-sm-6 col-xs-12">
            <div class="image-container">
                <div class="image">
                    <a href="javascript:"
                            data-toggle="modal"
                            data-target="#modal-edit-image"
                            data-id="{{ img.id }}"
                            data-name="{{ img.name }}"
                            data-object_url="{{ img.object_url }}"
                            data-description="{{ img.description | default('', true)}}"
                            >
                            <img src="{{ img.object_url }}">
                        </a>
                </div>
                <div class="info">
                        {{ img.description | default('', true)}}
                </div>
            </div>
        </div>
        {% endfor %}
    </div>


    <div class="row">
        <div class="col-md-12">
            {{ widget.pagination(images) }}
        </div>
    </div>

{% endcall %}



{% call widget.modal('Image', id="modal-edit-image") %}

    <footer>
        <button type="submit" class="btn btn-success pull-left"><i class="fa fa-check"></i> SAVE</button>
        <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-danger delete-btn" data-dismiss="modal"><i class="fa fa-trash"></i> Delete</button>
    </footer>

    {% call forms.post('PublisherAdmin:images') %}
        {{ forms.hidden(name="id", value="") }}
        {{ forms.hidden(name="action", value="") }}

        <div class="modal-image-preview">
          <img id="modal-image-preview">
        </div>

        {{ forms.input(label="Name", name="description", data={"validation": "required"}) }}
        {{ forms.input(label="Url", name="object_url") }}
    {% endcall %}

{% endcall %}

</div>
