{% extends "pretixcontrol/event/base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% load order_overview %}
{% block title %}{% trans "Data shredder" %}{% endblock %}
{% block content %}
    <h1>
        {% trans "Data shredder" %}
    </h1>
    <form action="{% url "control:event.shredder.shred" event=request.event.slug organizer=request.organizer.slug %}"
          method="post" class="form-horizontal" data-asynctask data-asynctask-long>
        {% csrf_token %}
        <fieldset>
            {% if download_on_shred %}
                <legend>{% trans "Step 1: Download data" %}</legend>
            {% else %}
                <legend>{% trans "(Optional) Step 1: Download data" %}</legend>
            {% endif %}
            <p>
                {% blocktrans trimmed %}
                    You are about to permanently delete data from the server, even though you might be required to
                    keep
                    some of this data on file. You can therefore download the following file and store it in a safe
                    place:
                {% endblocktrans %}
            </p>
            <p>
                <a href="{% url "cachedfile.download" id=file.pk %}" class="btn btn-primary btn-lg">
                    {% trans "Download data" %}
                </a>
            </p>
        </fieldset>
        <fieldset>
            <legend>{% trans "Step 2: Confirm deletion" %}</legend>
            <p>
                {% blocktrans trimmed with event=request.event.name slug=request.event.slug %}
                Please re-check that you are fully certain that you want to delete the selected categories of data from the event <strong>{{ event }}</strong>.
                    To confirm you really want this, please type out the event's short name ("{{ slug }}") here:
                {% endblocktrans %}
            </p>
            <input type="text" class="form-control" name="slug" required placeholder="{% trans "Event short name" %}">
            <br>
        </fieldset>
        {% if download_on_shred %}
            <fieldset>
                <legend>{% trans "Step 3: Confirm download" %}</legend>
                <p>
                    {% blocktrans trimmed %}
                        In the downloaded file, there is a text file named "CONFIRM_CODE.txt" with a six-character code.
                        Please enter this code here to confirm that you successfully downloaded the file.
                    {% endblocktrans %}
                </p>
                <input type="text" class="form-control" name="confirm_code" required placeholder="{% trans "Confirmation code" %}">
                <br>
            </fieldset>
        {% endif %}
        <input type="hidden" name="file" value="{{ file.pk }}">
        <div class="alert alert-info">
            {% blocktrans trimmed %}
                Depending on the amount of data in your event, the following step may take a while to complete.
                We will inform you via email once it has been completed.
            {% endblocktrans %}
        </div>
        <div class="form-group submit-group">
            <button type="submit" class="btn btn-primary btn-save">
                {% trans "Continue" %}
            </button>
        </div>
    </form>
{% endblock %}
