{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% load wger_extras %}

{% block title %}{% trans "Preferences" %}{% endblock %}


{% block content %}
<form action="{% url 'core:preferences' %}"
      method="post"
      class="ym-form">
      {% csrf_token %}
      {{ form.non_field_errors }}

    <div data-role="collapsible-set">
        <div data-role="collapsible" data-collapsed="false">
            <h3>{% trans "Email" %}</h3>
            <table>
                {% yaml_form_field email_form.email %}
            </table>
        </div>
        <div data-role="collapsible">
            <h3>{% trans "Workout reminders" %}</h3>
            <table>
                {% yaml_form_field form.workout_reminder_active %}
                {% yaml_form_field form.workout_duration %}
                {% yaml_form_field form.workout_reminder %}
            </table>
        </div>
        <div data-role="collapsible">
            <h3>{% trans "Gym mode" %}</h3>
            <table>
                {% yaml_form_field form.timer_active %}
                {% yaml_form_field form.timer_pause %}
            </table>
        </div>
        <div data-role="collapsible">
            <h3>{% trans "Other settings" %}</h3>
            <table>
                {% yaml_form_field form.notification_language %}
                {% yaml_form_field form.show_comments %}
                {% yaml_form_field form.show_english_ingredients %}
            </table>
        </div>
    </div>

    <a href="{% url 'core:index' %}"
               data-role="button"
               data-rel="back"
               data-mini="true">{% trans "Cancel" %}</a>
            <input type="submit" value="{% trans 'Save' %}">

</form>


{% endblock %}

{% block sidebar %}
<h3>{% trans "Options" %}</h3>
<p>
    <a href="{% url 'core:api-key' %}"
       data-role="button">
    <img src="{% static 'images/icons/internet.svg' %}"
         width="32"
         height="32"
         alt="{% trans 'API key' %}"
         title="{% trans 'API key' %}">
    {% trans "API key" %}</a>
</p>
<p>
    <a href="{% url 'core:change-password' %}"
       data-role="button">
    <img src="{% static 'images/icons/preferences.svg' %}"
         width="32"
         height="32"
         alt="{% trans 'Change password' %}"
         title="{% trans 'Change password' %}">
    {% trans "Change password" %}</a>
</p>
<p>
    <a href="{% url 'core:logout' %}"
       data-role="button"
       class="browserid-logout">
    <img src="{% static 'images/icons/logout.svg' %}"
         width="32"
         height="32"
         alt="{% trans 'Logout' %}"
         title="{% trans 'Logout' %}">
    {% trans "Logout" %}</a>
</p>
{% endblock %}
