{% extends "helpdesk/base.html" %}

{% load i18n bootstrap4form %}

{% block helpdesk_title %}{% trans "Edit Ticket" %}{% endblock %}

{% block helpdesk_breadcrumb %}
    <li class="breadcrumb-item">
        <a href="{% url 'helpdesk:list' %}">{% trans "Tickets" %}</a>
    </li>
    <li class="breadcrumb-item">
        <a href="{% url 'helpdesk:list' %}{{ ticket.id }}/">{{ ticket.queue.slug }}-{{ ticket.id }}</a>
    </li>
    <li class="breadcrumb-item active">{% trans "Edit Ticket" %}</li>
{% endblock %}

{% block helpdesk_body %}
    <div class="col-xs-6">
        <div class="panel panel-default">
            <div class="panel-body"><h2>{% trans "Edit a Ticket" %}</h2>
                <p>
                    {% trans "Unless otherwise stated, all fields are required." %}
                    {% trans "Please provide as descriptive a title and description as possible." %}
                </p>
                <p>
                    <strong>{% trans "Note" %}:</strong>
                    {% blocktrans %}Editing a ticket does <em>not</em> send an e-mail to the ticket owner or submitter. No new details should be entered, this form should only be used to fix incorrect details or clean up the submission.{% endblocktrans %}
                </p>
                {% if errors %}<p class="text-danger">{% for error in errors %}{% trans "Error: " %}{{ error }}<br>{% endfor %}</p>{% endif %}
                <form method='post'>
                    {% csrf_token %}
                    <fieldset>
                        {{ form|bootstrap4form }}
                        <div class='buttons form-group'>
                            <input type='submit' class="btn btn-primary btn-sm" value='{% trans "Save Changes" %}'/>
                            <a href='{{ ticket.get_absolute_url }}'>
                                <button class="btn btn-danger">{% trans "Cancel Changes" %}</button>
                            </a>
                        </div>
                    </fieldset>
                </form>
            </div>
        </div>
    </div>
{% endblock %}

{% block helpdesk_js %}
    {{ form.media.js }}
{% endblock %}
