{% extends "./layout.html" %}
{% block content %}
  <h1><div class="text-shadow">Zwift credentials</div></h1>
  {% if username != "zoffline" %}
    <h4 class="text-shadow">Logged in as {{ username }}</h4>
  {% endif %}
  <div class="row">
    <div class="col-md-12">
      <a href="{{ url_for('settings', username=username) }}" class="btn btn-sm btn-secondary">Back</a>
      {% if uname or passw %}
        <a href="/delete/zwift_credentials.bin" class="btn btn-sm btn-danger">Remove credentials</a>
      {% endif %}
    </div>
  </div>
  <div class="row">
    <div class="col-sm-6 col-md-5 top-buffer">
      <form id="profile" action="{{ url_for('profile', username=username) }}" method="post">
        <div class="row">
          <div class="col-md-12">
            <label class="col-form-label col-form-label-sm text-shadow">Zwift username</label>
            <input type="text" id="username" name="username" value="{{ uname }}" class="form-control form-control-sm">
          </div>
          <div class="col-md-12">
            <label class="col-form-label col-form-label-sm text-shadow">Zwift password</label>
            <input type="password" id="password" name="password" value="{{ passw }}" class="form-control form-control-sm">
          </div>
          <div class="col-md-12 top-buffer">
            <div class="form-check">
              <input class="form-check-input" type="checkbox" id="zwift_profile" name="zwift_profile">
              <label class="form-check-label text-shadow" for="zwift_profile">Download profile</label>
            </div>
            <div class="form-check">
              <input class="form-check-input" type="checkbox" id="achievements" name="achievements">
              <label class="form-check-label text-shadow" for="achievements">Download achievements</label>
            </div>
            <div class="form-check">
              <input class="form-check-input" type="checkbox" id="save_zwift" name="save_zwift">
              <label class="form-check-label text-shadow" for="save_zwift">Save credentials (upload activities)</label>
            </div>
          </div>
        </div>
        <div class="row">
          <div class="col-md-12 top-buffer">
            <input type="submit" value="Submit" class="btn btn-sm btn-light">
          </div>
        </div>
      </form>
      {% with messages = get_flashed_messages() %}
        {% if messages %}
          <ul class="list-group top-buffer">
          {% for message in messages %}
            <li class="list-group-item py-2">
              <div class="text-shadow">{{ message }}</div>
            </li>
          {% endfor %}
          </ul>
        {% endif %}
      {% endwith %}
    </div>
  </div>
{% endblock %}
