{% extends "base.html" %}

{% block title %}Change state of {{ doc }}{% endblock %}

{% block morecss %}
form.change-state select {
  width: 22em;
}
form.change-state .actions {
  text-align: right;
  padding-top: 10px;
}
.next-states,
.prev-state {
  margin-bottom: 30px;
}
.next-states form,
.prev-state form {
  display: inline;
  margin-right: 10px;
}
{% endblock %}

{% block content %}
<h1>Change state of {{ doc }}</h1>

<p class="helptext">For help on the states, see the <a href="{% url help_states %}">state table</a>.</p>

<form class="change-state" action="" method="post">
  <table>
    {{ form.as_table }}
    <tr>
      <td colspan="2" class="actions">
        <a href="{{ doc.get_absolute_url }}">Back</a>
        <input type="submit" value="Save"/>
      </td>
    </tr>
  </table>
</form>

{% if next_states %}
<h3>Or jump directly to</h3>

<div class="next-states">
  {% for n in next_states %}
  <form action="" method="post">
    <input type="hidden" name="state" value="{{ n.pk }}" />
    <input type="submit" value="{{ n.name }}" />
  </form>
  {% endfor %}
</div>
{% endif %}

{% if to_iesg_eval %}
<h3>You could also jump directly to</h3>
<div class="warn-states">
  <form action="" method="post">
    <input type="hidden" name="state" value="{{ to_iesg_eval.pk }}" />
    <input type="submit" value="{{ to_iesg_eval.name }}" />
  </form>
  <p> 
     But the ballot for this document has not yet been issued. 
     <a href="{% url doc_ballot_writeupnotes name=doc.name %}">Edit Ballot Text</a>
  </p>
</div>
{% endif %}

{% if prev_state %}
<h3>Or revert to previous state</h3>

<div class="prev-state">
  <form action="" method="post">
    <input type="hidden" name="state" value="{{ prev_state.pk }}" />
    <input type="submit" value="Back to {{ prev_state.name }}" />
  </form>
</div>
{% endif %}
{% endblock %}
