{% extends "nopaque.html.j2" %}

{% block page_content %}
<div class="col s12 m4">
  <h3>General settings</h3>
</div>
<div class="col s12 m8">
  <br class="hide-on-small-only">
  <div class="card">
    <div class="card-content">
      <form method="POST">
        {{ edit_general_settings_form.hidden_tag() }}
        <div class="row">
          <div class="col s9">
            <p><i class="material-icons left">brightness_3</i>{{ edit_general_settings_form.dark_mode.label.text }}</p>
            <p class="light">Activate dark mode to ease your eyes.</p>
          </div>
          <div class="col s3 right-align">
            <div class="switch">
              <label>
                {{ edit_general_settings_form.dark_mode() }}
                <span class="lever"></span>
              </label>
            </div>
          </div>
          <!--
          Seperate each setting with the following two elements
          <div class="col s12 divider"></div>
          <div class="col s12"><p>&nbsp;</p></div>
          -->
        </div>
      </div>
      <div class="card-action right-align">
        {{ macros.submit_button(edit_general_settings_form.save_settings) }}
      </div>
    </form>
  </div>
</div>


<div class="col s12"></div>


<div class="col s12 m4">
  <h3>Change password</h3>
</div>
<div class="col s12 m8">
  <br class="hide-on-small-only">
  <div class="card">
    <form method="POST">
      <div class="card-content">
        {{ edit_password_form.hidden_tag() }}
        <div class="input-field ">
          <i class="material-icons prefix">vpn_key</i>
          {{ edit_password_form.current_password() }}
          {{ edit_password_form.current_password.label }}
          {% for error in edit_password_form.current_password.errors %}
            <span class="helper-text red-text">{{ error }}</span>
          {% endfor %}
        </div>
        <div class="input-field">
          <i class="material-icons prefix">vpn_key</i>
          {{ edit_password_form.password() }}
          {{ edit_password_form.password.label }}
          {% for error in edit_password_form.password.errors %}
            <span class="helper-text red-text">{{ error }}</span>
          {% endfor %}
        </div>
        <div class="input-field">
          <i class="material-icons prefix">vpn_key</i>
          {{ edit_password_form.password_confirmation() }}
          {{ edit_password_form.password_confirmation.label }}
          {% for error in edit_password_form.password_confirmation.errors %}
            <span class="helper-text red-text">{{ error }}</span>
          {% endfor %}
        </div>
      </div>
      <div class="card-action right-align">
        {{ macros.submit_button(edit_password_form.save_password) }}
      </div>
    </form>
  </div>
</div>


<div class="col s12"></div>


<div class="col s12 m4">
  <h3>Change email</h3>
</div>
<div class="col s12 m8">
  <br class="hide-on-small-only">
  <div class="card">
    <form method="POST">
      <div class="card-content">
        {{ edit_email_form.hidden_tag() }}
        <div class="input-field">
          <i class="material-icons prefix">mail</i>
          {{ edit_email_form.email() }}
          {{ edit_email_form.email.label }}
          {% for error in edit_email_form.email.errors %}
            <span class="helper-text red-text">{{ error }}</span>
          {% endfor %}
        </div>
      </div>
      <div class="card-action right-align">
        {{ macros.submit_button(edit_email_form.save_email) }}
      </div>
    </form>
  </div>
</div>


<div class="col s12"></div>


<div class="col s12 m4">
  <h3>Delete account</h3>
</div>
<div class="col s12 m8">
  <br class="hide-on-small-only">
  <div class="card">
    <div class="card-content">
      <p>Deleting an account has the following effects:</p>
      <ul>
        <li>All data associated with your corpora and jobs will be permanently deleted.</li>
        <li>All settings will be permanently deleted.</li>
      </ul>
    </div>
    <div class="card-action right-align">
      <a href="#delete-account-modal" class="btn modal-trigger red waves-effect waves-light"><i class="material-icons left">delete</i>Delete</a>
    </div>
  </div>
</div>


<!-- Modals -->
<div class="modal" id="delete-account-modal">
  <div class="modal-content">
    <h4>Confirm deletion</h4>
    <p>Do you really want to delete your account and all associated data? All associated corpora, jobs and files will be permanently deleted!</p>
  </div>
  <div class="modal-footer">
    <a href="#!" class="btn modal-close waves-effect waves-light">Cancel</a>
    <a href="{{ url_for('profile.delete') }}" class="btn red waves-effect waves-light"><i class="material-icons left">delete</i>Delete</a>
  </div>
</div>
{% endblock %}
