{% extends 'django_spire/item/item.html' %}

{% block item_title_col %}{% endblock %}

{% block item_row_content %}
    <a class="col-12 col-sm-4 mb-2 mb-sm-0" href="{% url 'django_spire:help_desk:page:detail' pk=ticket.pk %}">
        {% include 'django_spire/element/attribute_element.html' with attribute_value=ticket.description|truncatechars:50 %}
    </a>
    <div class="col-6 col-sm-2 mb-2 mb-sm-0 text-start">
        {% include 'django_spire/element/attribute_element.html' with attribute_value=ticket.created_by.get_full_name attribute_title='Created By' %}
    </div>
    <div class="col-6 col-sm-2 mb-2 mb-sm-0 text-start">
        {% include 'django_spire/element/attribute_element.html' with attribute_value=ticket.created_datetime|date:'M d, Y' attribute_title='Created At' %}
    </div>
    <div class="col">
        {% include 'django_spire/element/attribute_element.html' with attribute_title='Purpose' %}
        {% include 'django_spire/help_desk/element/ticket_purpose_badge.html' %}
    </div>
    <div class="col">
        {% include 'django_spire/element/attribute_element.html' with attribute_title='Priority' %}
        {% include 'django_spire/help_desk/element/ticket_priority_badge.html' %}
    </div>
    <div class="col">
        {% include 'django_spire/element/attribute_element.html' with attribute_title='Status' %}
        {% include 'django_spire/help_desk/element/ticket_status_badge.html' %}
    </div>
{% endblock %}

{% block item_button %}
    {% url 'django_spire:help_desk:page:detail' pk=ticket.pk as detail_url %}
    {% if AuthController.help_desk.can_change %}
        {% url 'django_spire:help_desk:form:update' pk=ticket.pk as update_url %}
    {% endif %}
    {% if AuthController.help_desk.can_delete %}
        {% url 'django_spire:help_desk:page:delete' pk=ticket.pk as delete_url %}
    {% endif %}
    {% include 'django_spire/dropdown/ellipsis_dropdown.html' with view_url=detail_url edit_url=update_url delete_url=delete_url %}
{% endblock %}
