<!--
SPDX-FileCopyrightText: 2021-present Tobias Kunze
SPDX-License-Identifier: AGPL-3.0-only WITH LicenseRef-Pretalx-AGPL-3.0-Terms
-->

{% extends "orga/base.html" %}

{% load i18n %}

{% block extra_title %}{% translate "Export review data" %} :: {% endblock extra_title %}

{% block content %}
    <h2>{% translate "Export review data" %}</h2>

    {% include "orga/includes/tablist.html" %}

    <section role="tabpanel" id="tabpanel-custom" aria-labelledby="tab-custom" tabindex="0" aria-hidden="false">
        <p>
            {% blocktranslate trimmed %}
                Build your own custom export here, by selecting all the data you need,
                and the export format. CSV exports can be opened with Excel and similar
                applications, while JSON exports are often used for integration with
                other tools.
            {% endblocktranslate %}
        </p>
        <form method="post">
            {% csrf_token %}
            <fieldset>
                <legend id="dataset">{% translate "Dataset" %}</legend>
                {{ form.target.as_field_group }}
            </fieldset>
            <fieldset>
                <legend id="fields">{% translate "Data fields" %}</legend>
                <div class="d-flex">
                    <div class="ml-auto form-check">
                        <input type="checkbox" id="select-all" name="select-all">
                        <label for="select-all">{% translate "Select all" %}</label>
                    </div>
                </div>
                {% for field in form.export_fields %}
                    {{ field.as_field_group }}
                {% endfor %}
            </fieldset>
            <fieldset>
                <legend id="settings">{% translate "Export settings" %}</legend>
                {{ form.export_format.as_field_group }}
            </fieldset>

            {% include "orga/includes/submit_row.html" %}

        </form>

    </section>
    <section role="tabpanel" id="tabpanel-api" aria-labelledby="tab-api" tabindex="0" aria-hidden="true">
        <p>
            {% translate "You can also use the API to export or use data." %}
        </p>

        <p>
            {% blocktranslate trimmed %}
                Some of the general exports are only accessible for organisers, or include
                more information when accessed with your organiser account. If you want to
                access the organiser version in automatic integrations, you’ll have to
                provide your authentication token just like in the API, like this:
            {% endblocktranslate %}
        </p>

            <pre> curl -H "Authorization: Token INSERTAUTHTOKENHERE" {{ request.event.api_urls.reviews.full }} </pre>

        {% include "orga/includes/submit_row.html" with submit_buttons=api_buttons %}
    </section>
{% endblock content %}
