{% extends 'account_layout.html' %}
{% load i18n %}
{% load static %}

{% block pagetitle %}{% trans 'Account Settings' %}{% endblock %}
{% block account_content_outer %}
<div class="flex-page-content account-settings">
    <div class="content-box">
        <h3>{% trans 'Change e-mail address' %}</h3>

        <p>{% trans "Current address" %}: {{user.email|default:"-"}}</p>

        <form action="/account/settings" method="post" class="pure-form pure-form-aligned">
            {% csrf_token %}
            <input type="hidden" name="action" value="email" />
            <fieldset>
                <div class="pure-control-group">
                    <label for="ins_curpassword">{% trans 'Current password' %}</label>
                    <input type="password" id="ins_curpassword" name="current_password" class="pure-input-1-2" />
                </div>

                <div class="pure-control-group">
                    <label for="ins_email">{% trans 'New E-Mail' %}</label>
                    <input type="email" id="ins_email" name="email" class="pure-input-1-2" />
                </div>
            
                <div class="pure-controls">
                    <input type="submit" class="pure-button pure-button-primary" value="{% trans 'Save' %}" />
                </div>
            </fieldset>
        </form>
    </div>
    <div class="content-box">
        <h3>{% trans 'Change password' %}</h3>

        <form action="/account/settings" method="post" class="pure-form pure-form-aligned">
            {% csrf_token %}
            <input type="hidden" name="action" value="password" />
            <fieldset>
                <div class="pure-control-group">
                    <label for="ins_curpassword">{% trans 'Current password' %}</label>
                    <input type="password" id="ins_curpassword" name="current_password" class="pure-input-1-2" />
                </div>

                <div class="pure-control-group">
                    <label for="ins_password">{% trans 'New password' %}</label>
                    <input type="password" id="ins_password" name="password" class="pure-input-1-2" />
                </div>

                <div class="pure-control-group">
                    <label for="ins_password2">{% trans 'New password' %} ({% trans 'repeat' %})</label>
                    <input type="password" id="ins_password2" name="password2" class="pure-input-1-2" />
                </div>

                <div class="pure-controls">
                    <input type="submit" class="pure-button pure-button-primary" value="{% trans 'Save' %}" />
                </div>
            </fieldset>
        </form>
    </div>
    <div class="content-box">
        <h3>{% trans 'Data export' %}</h3>
        
        <form action="/account/settings" method="post" class="pure-form pure-form-aligned">
            {% csrf_token %}
            <input type="hidden" name="action" value="export" />
            <fieldset>
                <div class="pure-control-group">
                    <label for="ins_curpassword">{% trans 'Current password' %}</label>
                    <input type="password" id="ins_curpassword" name="current_password" />
                </div>
                <p>
                    {% blocktrans trimmed %}
                    Produces an archive containing account details and the logs we legally have to keep for one year.
                    {% endblocktrans %}
                </p>
            
                <div class="pure-controls">
                    <input type="submit" class="pure-button pure-button-primary button-danger" value="{% trans 'Export my data' %}" />
                </div>
                    <p class="inputinfo">
                        {% blocktrans trimmed %}
                            It may take a few seconds.
                        {% endblocktrans %}
                    </p>
            </fieldset>
        </form>

    </div>
    <div class="content-box">
        <h3>{% trans 'Account deletion' %}</h3>

        <form action="/account/settings" method="post" class="pure-form pure-form-aligned">
            {% csrf_token %}
            <input type="hidden" name="action" value="delete" />
            <fieldset>
                {% if not can_delete %}
                    <p>
                        {% blocktrans trimmed %}
                        You need to cancel your active subscription before deleting your account.
                        {% endblocktrans %}
                    </p>
                {% else %}
                    <div class="pure-control-group">
                        <label for="ins_curpassword">{% trans 'Current password' %}</label>
                        <input type="password" id="ins_curpassword" name="current_password" />
                    </div>

                    <div class="pure-controls">
                        <input type="submit" class="pure-button pure-button-primary button-danger" value="{% trans 'Delete my account' %}" />
                    </div>
                {% endif %}
            </fieldset>
        </form>
    </div>
</div>



{% endblock %}
