{% extends "forms.html" %}
{% load forms %}
{% load applications %}

{% block extrahead %}
<script type="text/javascript">
function showForm() {
  $("#show-email").hide("fast");
  $("#form-body").show("slow");
}
</script> 
{% endblock %}


{% block title %}Decline Application{% endblock %}


{% block breadcrumbs %}
<div class="breadcrumbs">
    <a href='{% url "index" %}'>Home</a>&nbsp;›
    <a href="{% url 'kg_application_list' %}">Applications</a>&nbsp;›
    <a href='{% url 'kg_application_detail' application.pk %}'>{{ application }}</a>&nbsp;›
    Decline
</div>
{% endblock %}


{% block content %}
<div class="module">
    <h2>Decline Application</h2>
    <p>Are you sure you want to decline {{ application.applicant }}'s application {{ application.info }}? </p>
    <p>An email will be sent to {{ application.applicant }}. <a id="show-email" href="#" onclick="showForm()">Customise email</a></p>

    <form method="post" action=".">{% csrf_token %}
        <div id="form-body" style="display: none">
            {% if form.errors or form.non_field_errors %}
                    <p class="errornote">Please correct the error{{ form.errors|pluralize }} below.</p>
            {% endif %}
            <fieldset class="aligned ()">
            <h3>Send email</h3>
            {{ form.non_field_errors }}
            {% form_as_div form %}
            </fieldset>
        </div>

        {# Default actions are likely to be confusing, need to replace them. #}
        <div class="submit-row">
            <input type="submit" name="back" value="Go back" class="button" />
            <input type="submit" name="cancel" value="Decline/Cancel" class="button default" />
        </div>

    </form>
</div>
{% endblock %}
