{% extends "base-authenticated.html" %}
{% block title %}
{% endblock %}
{% block content %}
<form action="edit-canvasser" method="post">
  {% if canvasser %}
  <input type="hidden" name="id" id="id" value="{{canvasser.id}}"/>
  {% endif %}
  <p class="widget">
    <label for="fullname">Full name</label>
    <input type="text" name="fullname" id="fullname" value="{{canvasser.fullname}}"/>
  </p>
  <p class="widget">
    (TODO: Not absolutely sure what I'm going to do for an elector id widget yet.)
  </p>
  <p class="widget">
    <label for="address">Address</label>
    {% if address.id %}
    <!-- if we already have an address, just show it with a link to edit it -->
      <span class="pseudo-widget" id="address">
        {{address.address}}
      </span>
    {% else %}
    (TODO: Some sort of address lookup widget goes here.)
    {% endif %}
  </p>
  <p class="widget">
    <label for="phone">Phone number</label>
    <input type="tel" name="phone" id="phone" value="{{canvasser.phone}}"/>
  </p>
  <p class="widget">
    <label for="email">Email address</label>
    <input type="email" name="email" id="email" value="{{canvasser.email}}"/>
  </p>
  <p class="widget">
    <label for="authority_id">Authorised by</label>
    <select name="authority_id" id="authority_id">
      {% for authority in authorities %}
      <option value="{{authority.id}}"
              {% ifequal authority.id canvasser.authority_id %}selected {% endifequal %}>
        {{authority.id}}
      </option>
    </select>
  </p>

  </p>
      id             serial,
    username       character varying(32) NOT NULL,
    fullname       character varying(64) NOT NULL,
    elector_id     integer,
    address_id     integer NOT NULL,
    phone          character varying(16),
    email          character varying(128),
    authority_id   character varying(32) NOT NULL,
    introduced_by  int references canvassers(id),
    authorised     boolean

</form>

{% endblock %}
