{% load i18n %}
<table width='100%'>
    <tr class='row_tablehead'><td colspan='2'>{{ ticket.id }}. {{ ticket.title }} [{{ ticket.get_status }}] <span class='ticket_toolbar'>
    {% if helpdesk_settings.HELPDESK_SHOW_EDIT_BUTTON_TICKET_TOP %}
        <a href='{% url helpdesk_edit ticket.id %}' class="ticket-edit"><img src='{{ STATIC_URL }}helpdesk/buttons/edit.png' alt='Edit' title='Edit' width='60' height='15' /></a>
    {% endif %}
    {% if helpdesk_settings.HELPDESK_SHOW_DELETE_BUTTON_TICKET_TOP %}
    <a href='{% url helpdesk_delete ticket.id %}' class="ticket-delete"><img src='{{ STATIC_URL }}helpdesk/buttons/delete.png' alt='Delete' title='Delete' width='60' height='15' /></a>
    {% endif %}
    {% if helpdesk_settings.HELPDESK_SHOW_HOLD_BUTTON_TICKET_TOP %}
    {% if ticket.on_hold %}<a href='unhold/' class="ticket-hold">{% trans "Unhold" %}</a>{% else %}<a href='hold/' class="ticket-hold">{% trans "Hold" %}</a>{% endif %}
    {% endif %}</span></td></tr>
<tr class='row_columnheads'><th colspan='2'>{% blocktrans with ticket.queue as queue %}Queue: {{ queue }}{% endblocktrans %}</th></tr>

<tr class='{% cycle 'row_odd' 'row_even' as rowcolors %}'>
    <th>{% trans "Submitted On" %}</th>
    <td>{{ ticket.created|date:"r" }} ({{ ticket.created|timesince }} ago)</td>
</tr>

<tr class='{% cycle rowcolors %}'>
    <th>{% trans "Assigned To" %}</th>
    <td>{{ ticket.get_assigned_to }}{% ifequal ticket.get_assigned_to _('Unassigned') %} <strong><a href='?take'><span class='button button_take'>{% trans "Take" %}</span></a></strong>{% endifequal %}</td>
</tr>

<tr class='{% cycle rowcolors %}'>
    <th>{% trans "Submitter E-Mail" %}</th>
    <td>{{ ticket.submitter_email }}{% if user.is_superuser %} <strong><a href='{% url helpdesk_email_ignore_add %}?email={{ ticket.submitter_email }}'>{% trans "Ignore" %}</a></strong>{% endif %}</td>
</tr>

<tr class='{% cycle rowcolors %}'>
    <th>{% trans "Priority" %}</th>
    <td>{{ ticket.get_priority_display }}</td>
</tr>

<tr class='{% cycle rowcolors %}'>
    <th>{% trans "Copies To" %}</th>
    <td>{% for ticketcc in ticket.ticketcc_set.all %}{{ ticketcc.display }}{% if not forloop.last %}, {% endif %}{% endfor %} <strong><a class='tooltip' href='{% url helpdesk_ticket_cc ticket.id %}'>{% trans "Manage" %}<span>{% trans "Click here to add / remove people who should receive an e-mail whenever this ticket is updated." %}</span></a></strong></td>
</tr>

{% if tags_enabled %}
<tr class='{% cycle rowcolors %}'>
    <th>{% trans "Tags" %}</th>
    <td>{{ ticket.tags }}</td>
</tr>
{% endif %}

<tr class='{% cycle rowcolors %}'>
    <th>{% trans "Dependencies" %}</th>
    <td>{% for dep in ticket.ticketdependency.all %}
        {% if forloop.first %}<p>{% trans "This ticket cannot be resolved until the following ticket(s) are resolved" %}</p><ul>{% endif %}
            <li><a href='{{ dep.depends_on.get_absolute_url }}'>{{ dep.depends_on.ticket }} {{ dep.depends_on.title }}</a> ({{ dep.depends_on.get_status_display }}) <a href='{% url helpdesk_ticket_dependency_del ticket.id dep.id %}'>{% trans "Remove Dependency" %}</a></li>
        {% if forloop.last %}</ul>{% endif %}
        {% empty %}
        <p>{% trans "This ticket has no dependencies." %}</p>
        {% endfor %}
        <p><a class='tooltip' href='{% url helpdesk_ticket_dependency_add ticket.id %}'>{% trans "Add Dependency" %}<span>{% trans "Click on 'Add Dependency', if you want to make this ticket dependent on another ticket. A ticket may not be closed until all tickets it depends on are closed." %}</span></a></p>
    </td>
</tr>

{% for customfield in ticket.ticketcustomfieldvalue_set.all %}
<tr class='{% cycle rowcolors %}'>
    <th>{{ customfield.field.label }}</th>
    <td>{% ifequal customfield.field.data_type "url" %}<a href='{{ customfield.value }}'>{{ customfield.value }}</a>{% else %}{{ customfield.value }}{% endifequal %}</td>
</tr>{% endfor %}

<tr class='{% cycle rowcolors %}'>
    <th colspan='2'>{% trans "Description" %}</th>
</tr>
<tr class='{% cycle rowcolors %}'>
    <td colspan='2'>{{ ticket.description|force_escape|urlizetrunc:50|linebreaksbr }}</td>
</tr>

{% if ticket.resolution %}<tr class='{% cycle rowcolors %}'>
    <th colspan='2'>{% trans "Resolution" %}{% ifequal ticket.get_status_display "Resolved" %} <a href='?close'><img src='{{ STATIC_URL }}helpdesk/buttons/accept.png' alt='{% trans "Accept" %}' title='{% trans "Accept and Close" %}' width='60' height='15' /></a>{% endifequal %}</th>
</tr>
<tr class='{% cycle rowcolors %}'>
    <td colspan='2'>{{ ticket.resolution|force_escape|urlizetrunc:50|linebreaksbr }}</td>
</tr>{% endif %}

</table>
