Files
project-managment/templates/pages/tickets/ticket_list.html
T
sankalp 057031ed1b feat(templates/pages): add admin delete actions and UI refinements
- New Features
  - Add delete buttons with confirmation modals for users, expenses, invoices, and tickets
  - Introduce a priority column with styled badges in the ticket list
  - Refactor form fields to a shared partial for cleaner markup
- Enhancements
  - Rename “Creator” to “Assignee” and improve status/priority badge rendering
  - Fix empty‑state colspan and correct broken delete‑modal label closing tag
  - Initialize Quill editor on the ticket detail page
- Bug Fixes
  - Resolve typo in button class name and mismatched table header count
2026-05-28 00:26:59 +05:45

73 lines
4.5 KiB
HTML

{% extends "base_authenticated.html" %}
{% block title %}Tickets{% endblock %}
{% block content_inner %}
<div class="flex items-center justify-between mb-6">
<div>
<h1 class="text-2xl font-bold text-gray-900">Tickets</h1>
<p class="text-gray-500 mt-1">Client support and feature requests.</p>
</div>
<a href="{% url 'ticket_create' %}" class="btn bg-blue-600 text-white hover:bg-blue-700 border-0">
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg>
New Ticket
</a>
</div>
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
<div class="overflow-x-auto">
<table class="table w-full">
<thead>
<tr class="bg-gray-50">
<th class="text-xs font-semibold text-gray-500 uppercase tracking-wider">Title</th>
<th class="text-xs font-semibold text-gray-500 uppercase tracking-wider">Type</th>
<th class="text-xs font-semibold text-gray-500 uppercase tracking-wider">Status</th>
<th class="text-xs font-semibold text-gray-500 uppercase tracking-wider">Priority</th>
<th class="text-xs font-semibold text-gray-500 uppercase tracking-wider">Project</th>
<th class="text-xs font-semibold text-gray-500 uppercase tracking-wider">Assignee</th>
<th class="text-xs font-semibold text-gray-500 uppercase tracking-wider">Created</th>
{% if user.is_admin %}<th class="text-xs font-semibold text-gray-500 uppercase tracking-wider">Actions</th>{% endif %}
</tr>
</thead>
<tbody>
{% for ticket in tickets %}
<tr class="hover:bg-gray-50 transition-colors">
<td><a href="{% url 'ticket_detail' ticket.pk %}" class="font-medium text-gray-900 hover:text-blue-600">{{ ticket.title }}</a></td>
<td>
<span class="text-xs px-2.5 py-1 rounded-full font-medium {% if ticket.ticket_type == 'bug' %}bg-red-100 text-red-700{% elif ticket.ticket_type == 'feature_request' %}bg-blue-100 text-blue-700{% else %}bg-sky-100 text-sky-700{% endif %}">
{{ ticket.get_ticket_type_display }}
</span>
</td>
<td>
<span class="text-xs px-2.5 py-1 rounded-full font-medium {% if ticket.status == 'new' %}bg-gray-100 text-gray-700{% elif ticket.status == 'acknowledged' %}bg-blue-100 text-blue-700{% elif ticket.status == 'in_progress' %}bg-amber-100 text-amber-700{% elif ticket.status == 'done' %}bg-green-100 text-green-700{% else %}bg-red-100 text-red-700{% endif %}">
{{ ticket.get_status_display }}
</span>
</td>
<td>
<span class="text-xs px-2.5 py-1 rounded-full font-medium {% if ticket.priority == 'high' %}bg-red-100 text-red-700{% elif ticket.priority == 'medium' %}bg-amber-100 text-amber-700{% else %}bg-blue-100 text-blue-700{% endif %}">
{{ ticket.get_priority_display }}
</span>
</td>
<td class="text-sm text-gray-600">{{ ticket.project.name|default:"-" }}</td>
<td class="text-sm text-gray-600">{{ ticket.assignee.username|default:"-" }}</td>
<td class="text-sm text-gray-500">{{ ticket.created_at|date:"M d" }}</td>
{% if user.is_admin %}
<td>
<label for="delete-ticket-{{ ticket.pk }}" class="btn btn-ghost btn-xs text-red-600">Delete</label>
</td>
{% endif %}
</tr>
{% empty %}
<tr><td colspan="8" class="text-center py-12 text-gray-500">No tickets found.</td></tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% if user.is_admin %}
{% for ticket in tickets %}
{% with ticket_id=ticket.pk|stringformat:"s" %}
{% url 'ticket_delete' ticket.pk as delete_url %}
{% include "components/delete_modal.html" with modal_id="delete-ticket-"|add:ticket_id title="Delete Ticket" message="Are you sure you want to delete this ticket? This action cannot be undone." delete_url=delete_url %}
{% endwith %}
{% endfor %}
{% endif %}
{% endblock %}