{#
/**
 * 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 %}

{% block formTitle %}
    {% trans "Delete Media" %}
{% endblock %}

{% block formButtons %}
    {% trans "Cancel" %}, XiboDialogClose()
    {% trans "Yes" %}, $("#libraryDeleteForm").submit()
{% endblock %}

{% block formHtml %}
    <div class="row">
        <div class="col-md-12">
            <form id="libraryDeleteForm" class="XiboForm form-horizontal" method="delete" action="{{ url_for("library.delete", {"id": media.mediaId}) }}">
                {% set message %}{% trans "Are you sure you want to delete this file?" %}{% endset %}
                {{ forms.message(message) }}

                {% set message %}{% trans "Deleting a file cannot be reversed." %}{% endset %}
                {{ forms.message(message) }}

                {% if media.isUsed() %}

                    {% set title %}{% trans "Force delete from any existing layouts, assignments, etc" %}{% endset %}
                    {% set helpText %}{% trans "This library item has been used somewhere in the system. You will only be allowed to delete it if you check this." %}{% endset %}
                    {{ forms.checkbox("forceDelete", title, 0, helpText) }}

                    {% set message %}{% trans "Please note that removing a media item from the Library will also delete it from the Published version of this Layout and you won't be able to undo that action by discarding your changes. Displays will also be immediately effected." %}{% endset %}
                    {{ forms.message(message, "alert alert-info") }}

                {% endif %}

                {% set title %}{% trans "Add to Purge list?" %}{% endset %}
                {% set helpText %}{% trans "When set, each Display that has this Media in its local storage, will be notified to remove it." %}{% endset %}
                {{ forms.checkbox("purge", title, 0, helpText) }}

            </form>
        </div>
    </div>
{% endblock %}