{#
/**
 * Copyright (C) 2020 Xibo Signage Ltd
 *
 * Xibo - Digital Signage - http://www.xibo.org.uk
 *
 * This file is part of Xibo.
 *
 * Xibo is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * Xibo is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Xibo.  If not, see <http://www.gnu.org/licenses/>.
 */
#}

{% extends "form-base.twig" %}
{% import "forms.twig" as forms %}
{% import "inline.twig" as inline %}

{% block formTitle %}
    {% trans "Associate an item from the Library" %}
{% endblock %}

{% block formButtons %}
    {% trans "Cancel" %}, XiboDialogClose()
    {% trans "Save" %}, forms.mediaAssignSubmit()
{% endblock %}

{% block callBack %}forms.mediaDisplayGroupFormCallBack{% endblock %}

{% block formHtml %}
    <div class="row">
        <div class="col-md-12">
            <div id="FileAssociationsAssign" class="card p-3 mb-3 bg-light" data-url="{{ url_for("displayGroup.assign.media", {id: displayGroup.displayGroupId}) }}">
                <div>
                    <ul id="FileAssociationsSortable">
                        {% for item in media %}
                        <li data-media-id="{{ item.id }}" class="btn btn-sm btn-white">{{ item.name }}<span class="fa fa-minus"></span></li>
                        {% endfor %}
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <div class="XiboGrid" id="{{ random() }}">
                <div class="XiboFilter card mb-3 bg-light">
                    <div class="FilterDiv card-body" id="Filter">
                        <form class="form-inline" id="displayForm">
                            {% set title %}{% trans "Name" %}{% endset %}
                            {{ inline.input("media", title) }}
                            {{ inline.dropdown("type", "single", "Type", "", [{type: null, module: ""}]|merge(modules), "type", "name") }}
                        </form>
                    </div>
                </div>
                <div class="XiboData card pt-3">
                    <table id="mediaAssignments" data-url="{{ url_for("library.search") }}" class="table table-striped">
                        <thead>
                        <tr>
                            <th>{% trans "Name" %}</th>
                            <th>{% trans "Type" %}</th>
                            <th></th>
                        </tr>
                        </thead>
                        <tbody>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
{% endblock %}