{% extends "forms.html" %}


{% block title %}Edit Person{% endblock %}


{% block breadcrumbs %}
<div class="breadcrumbs">
    <a href='{% url "index" %}'>Home</a>&nbsp;›
    <a href="{% url 'kg_person_list' %}">People</a>&nbsp;›
    {% if person %}
        <a href="{% url 'kg_person_detail' person.username %}">{{ person }}</a>&nbsp;›
        Edit
    {% else %}
        Create Person
    {% endif %}
</div>
{% endblock %}


{% block content %}
<form method="post" action=".">{% csrf_token %}
    <div>
        {% load forms %}
        {% if form.errors or form.non_field_errors %}
            <p class="errornote">Please correct the error{{ form.errors|pluralize }} below.</p>
        {% endif %}

        <fieldset class="module aligned ()">
            <h2>Personal Details</h2>
            {% formfield form.title %}
            {% formfield form.short_name %}
            {% formfield form.full_name %}
            {% inlineformfield form.institute form.department %}
            {% formfield form.position %}
            {% formfield form.supervisor %}
            {% formfield form.email %}
            {% inlineformfield form.telephone form.mobile %}
            {% formfield form.fax %}
            {% formfield form.address %}
            {% formfield form.country %}
            {% formfield form.comment %}
            {% formfield form.expires %}
            {% formfield form.is_admin %}
            {% formfield form.is_systemuser %}
        </fieldset>

        {% if not person %}
        <fieldset class="module aligned ()">
            <h2>Login Details</h2>
            {% formfield form.username %}
            {% formfield form.password1 %}
            {% formfield form.password2 %}
        </fieldset>

        <fieldset class="module aligned ()">
            <h2>User Account Details</h2>
            {% formfield form.needs_account %}
            {% formfield form.project %}
        </fieldset>
        {% endif %}

        {{ form.non_field_errors }}
    </div>

    <div class="submit-row">
        <input type="submit" value="Save" class="default" />
    </div>
</form>
{% endblock %}
