{% load i18n %}
{% load djblets_utils %}

{% if review_request.status == 'S' %}
<div class="banner" id="submitted-banner">
 <h1>{% trans "This change has been marked as submitted." %}</h1>
{% if request.user.pk == review_request.submitter_id or perms.reviews.can_change_status %}
 <input type="submit" id="btn-review-request-reopen"
  value="{% trans "Reopen for Review" %}" />
 <p><label for="changedescription">{% trans "Describe the submission (optional):" %}</label></p>
 <pre id="changedescription" class="editable">{{close_description}}</pre>
{% elif close_description %}
 <pre id="changedescription">{{close_description}}</pre>
{% endif %}
</div>
{% elif review_request.status == 'D' %}
<div class="banner" id="discard-banner">
 <h1>{% trans "This change has been discarded." %}</h1>
{% if request.user.pk == review_request.submitter_id %}
 <input type="submit" id="btn-review-request-reopen"
  value="{% trans "Reopen for Review" %}" />
{% endif %}
{% if request.user.pk == review_request.submitter_id or perms.reviews.can_change_status %}
 <p><label for="changedescription">{% trans "Describe the reason it's discarded (optional):" %}</label></p>
 <pre id="changedescription" class="editable">{{close_description}}</pre>
{% elif close_description %}
 <pre id="changedescription">{{close_description}}</pre>
{% endif %}
</div>
{% else %}{# pending review #}
{%  if request.user.pk == review_request.submitter_id or perms.reviews.can_edit_reviewrequest %}
<div class="banner" id="draft-banner" style="display:none;">
{%   if review_request.public %}
 <h1>{% trans "This review request is a draft." %}</h1>
 {% trans "Be sure to publish when finished." %}
 <input type="button" id="btn-draft-publish"
  value="{% trans "Publish Changes" %}" />
 <input type="button" id="btn-draft-discard"
  value="{% trans "Discard Draft" %}" />
 <p><label for="changedescription">{% trans "Describe your changes (optional):" %}</label></p>
 <pre id="changedescription" class="editable">{% if draft.changedesc %}{{draft.changedesc.text}}{% endif %}</pre>
{%   else %}
 <h1>{% trans "This review request is not yet public." %}</h1>
 {% trans "Be sure to publish when finished." %}
 <input type="button" id="btn-draft-publish"
  value="{% trans "Publish" %}" />
 <input type="button" id="btn-review-request-discard"
  value="{% trans "Discard Review Request" %}" />
{%   endif %}
{%  endif %}
</div>
{% endif %}

{% if request.user.pk == review_request.submitter_id or perms.reviews.can_edit_reviewrequest and review_request.status == 'P'%}
{%  if draft or not review_request.public %}
<script type="text/javascript">
  $("#draft-banner").show();
</script>
{%  endif %}
{% endif %}
