{% extends "base.html" %}
{% block title %}Subir Circuito{% endblock %}

{% block head %}
    {{ super() }}
{% endblock %}

{% block content %}
<center><h1>Usuarios de <code>dpto2</code></h1></center>

{% with messages = get_flashed_messages() %}
  {% if messages %}
    <ul class=flashes>
    {% for message in messages %}
      <li>{{ message }}</li>
    {% endfor %}
    </ul>
  {% endif %}
{% endwith %}

<div class="container" style="width: 601px;">
    <div class="row"><h3>Crear usuario nuevo:</h3></div>

    <div class="row">
        <form class="form-horizontal" method="POST">
          <div class="form-group">
            <label for="username" class="col-sm-2 control-label">Usuario</label>
            <div class="col-sm-10">
              <input type="text" class="form-control" id="username" name="username" placeholder="username">
            </div>
          </div>
          <div class="form-group">
            <label for="password1" class="col-sm-2 control-label">Contraseña</label>
            <div class="col-sm-10">
              <input type="password" class="form-control" id="password1" name="password1" placeholder="password">
            </div>
          </div>
          <div class="form-group">
            <label for="password2" class="col-sm-2 control-label">Contraseña</label>
            <div class="col-sm-10">
              <input type="password" class="form-control" id="password2" name="password2" placeholder="repeat password">
            </div>
          </div>
    {% if create_error %}
    <center>
        <p>Error: {{ errormsg }}</p>
    </center>
    {% endif %}
          <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
              <button type="submit" class="btn btn-default">Crear usuario</button>
            </div>
          </div>
        </form>
    </div>

    <div class="row"><h3>Borrar un usuario:</h3></div>

    <div class="row">
        <form class="form-horizontal" method="POST">
          <div class="form-group">
            <label for="username" class="col-sm-2 control-label">Usuario</label>
            <div class="col-sm-10">
              <input type="text" class="form-control" id="oldpass" name="deluser" placeholder="nombre de usuario">
            </div>
          </div>
        {% if delete_error %}
        <center>
            <p>Error: {{ errormsg }}</p>
        </center>
        {% endif %}
          <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
              <button type="submit" class="btn btn-danger">Borrar usuario</button>
            </div>
          </div>
        </form>
    </div>
    <div class="row"><a href="{{ url_for('logout') }}">Cerrar sesión</a></div>
</div>

{% endblock %}