{% extends 'base.html' %}
{% block content %}
    {% from '_helpers.html' import render_simple_field, render_field %}

    <div class="edit-form">
        <div class="tabs collapsable">
            <ul>
                <li class="tab active" id=""><a href="{{ url_for('backups.create') }}">{{ _('Create') }}</a></li>
                <li class="tab"><a href="{{ url_for('backups.restore.restore') }}">{{ _('Restore') }}</a></li>
            </ul>
        </div>
        <div class="box-wrap inner">
            <div id="general">
                {% if backup_running %}
                    <p>
                        <span class="spinner"></span>&nbsp;<strong>{{ _('A backup is running!') }}</strong>
                    </p>
                {% endif %}

                <p>
                    {{ _('Here you can download and request a new backup, when a backup is completed you will see it listed below.') }}
                </p>
                <br>
                {% if available_backups %}
                    <ul>
                        {% for backup in available_backups %}
                            <li>
                                <a href="{{ url_for('backups.download_backup', filename=backup["filename"]) }}">{{ backup["filename"] }}</a> {{ backup["filesize"] }} {{ _('Mb') }}
                            </li>
                        {% endfor %}
                    </ul>
                {% else %}
                    <p>
                        <strong>{{ _('No backups found.') }}</strong>
                    </p>
                {% endif %}

                <a class="pure-button pure-button-primary"
                   href="{{ url_for('backups.request_backup') }}">{{ _('Create backup') }}</a>
                {% if available_backups %}
                    <a class="pure-button button-small button-error "
                       href="{{ url_for('backups.remove_backups') }}">{{ _('Remove backups') }}</a>
                {% endif %}

            </div>

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