feat: added new ticket status categories
This commit is contained in:
@@ -4,8 +4,10 @@ from django.contrib.auth.models import User
|
|||||||
|
|
||||||
class Ticket(models.Model):
|
class Ticket(models.Model):
|
||||||
STATUS_CHOICES = [
|
STATUS_CHOICES = [
|
||||||
("open", "Offen"),
|
("new", "Neu"),
|
||||||
("in_progress", "In Bearbeitung"),
|
("in_progress", "In Bearbeitung"),
|
||||||
|
("resolved", "Gelöst"),
|
||||||
|
("pending_close", "Wartend - Schließen"),
|
||||||
("closed", "Geschlossen"),
|
("closed", "Geschlossen"),
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -17,7 +19,7 @@ class Ticket(models.Model):
|
|||||||
|
|
||||||
title = models.CharField(max_length=200)
|
title = models.CharField(max_length=200)
|
||||||
description = models.TextField()
|
description = models.TextField()
|
||||||
status = models.CharField(max_length=20, choices=STATUS_CHOICES, default="open")
|
status = models.CharField(max_length=20, choices=STATUS_CHOICES, default="new")
|
||||||
priority = models.CharField(
|
priority = models.CharField(
|
||||||
max_length=10, choices=PRIORITY_CHOICES, default="medium"
|
max_length=10, choices=PRIORITY_CHOICES, default="medium"
|
||||||
)
|
)
|
||||||
@@ -25,11 +27,7 @@ class Ticket(models.Model):
|
|||||||
User, related_name="tickets_created", on_delete=models.CASCADE
|
User, related_name="tickets_created", on_delete=models.CASCADE
|
||||||
)
|
)
|
||||||
assigned_to = models.ForeignKey(
|
assigned_to = models.ForeignKey(
|
||||||
User,
|
User, related_name="tickets_assigned", null=True, blank=True, on_delete=models.CASCADE,
|
||||||
related_name="tickets_assigned",
|
|
||||||
null=True,
|
|
||||||
blank=True,
|
|
||||||
on_delete=models.SET_NULL,
|
|
||||||
)
|
)
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
updated_at = models.DateTimeField(auto_now=True)
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|||||||
@@ -1,148 +1,140 @@
|
|||||||
{% extends "ticketsystem/base.html" %}
|
{% extends "ticketsystem/base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<!-- Messages -->
|
||||||
<!-- Messages -->
|
{% if messages %}
|
||||||
{% if messages %}
|
<div class="max-w-4xl mx-auto px-4 pt-4">
|
||||||
<div class="max-w-4xl mx-auto px-4 pt-4">
|
{% for message in messages %}
|
||||||
{% for message in messages %}
|
<div class="mb-4 p-3 rounded {% if message.tags == 'error' %}bg-red-100 text-red-700{% elif message.tags == 'success' %}bg-green-100 text-green-700{% else %}bg-yellow-100 text-yellow-700{% endif %}">
|
||||||
<div class="mb-4 p-3 rounded {% if message.tags == 'error' %}bg-red-100 text-red-700{% elif message.tags == 'success' %}bg-green-100 text-green-700{% else %}bg-yellow-100 text-yellow-700{% endif %}">
|
{{ message }}
|
||||||
{{ message }}
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<div class="max-w-4xl mx-auto px-4 py-6">
|
|
||||||
<!-- Ticket Bearbeitung -->
|
|
||||||
<div class="bg-white rounded-lg shadow p-6 mb-6">
|
|
||||||
<h1 class="text-3xl font-bold mb-4">🎫 Ticket #{{ ticket.id }} – {{ ticket.title }}</h1>
|
|
||||||
|
|
||||||
<div class="text-sm text-gray-500 mb-6">
|
|
||||||
🕒 Erstellt: {{ ticket.created_at|date:"d.m.Y H:i" }} |
|
|
||||||
🔄 Aktualisiert: {{ ticket.updated_at|date:"d.m.Y H:i" }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form method="post" class="space-y-4">
|
|
||||||
{% csrf_token %}
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label class="block text-sm font-medium mb-1">Titel:</label>
|
|
||||||
<input type="text" name="title" value="{{ ticket.title }}"
|
|
||||||
{% if not view.can_edit %}disabled{% endif %}
|
|
||||||
class="w-full p-2 border border-gray-300 rounded shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 {% if not view.can_edit %}bg-gray-100{% endif %}">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label class="block text-sm font-medium mb-1">Beschreibung:</label>
|
|
||||||
<textarea name="description" rows="4"
|
|
||||||
{% if not view.can_edit %}disabled{% endif %}
|
|
||||||
class="w-full p-2 border border-gray-300 rounded shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 {% if not view.can_edit %}bg-gray-100{% endif %}">{{ ticket.description }}</textarea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid grid-cols-2 gap-4">
|
|
||||||
<div>
|
|
||||||
<label class="block text-sm font-medium mb-1">Status:</label>
|
|
||||||
<select name="status" {% if not view.can_edit %}disabled{% endif %}
|
|
||||||
class="w-full p-2 border border-gray-300 rounded shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 {% if not view.can_edit %}bg-gray-100{% endif %}">
|
|
||||||
<option value="open" {% if ticket.status == 'open' %}selected{% endif %}>Offen</option>
|
|
||||||
<option value="in_progress" {% if ticket.status == 'in_progress' %}selected{% endif %}>In Bearbeitung</option>
|
|
||||||
<option value="closed" {% if ticket.status == 'closed' %}selected{% endif %}>Geschlossen</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<label class="block text-sm font-medium mb-1">Priorität:</label>
|
|
||||||
<select name="priority" {% if not view.can_edit %}disabled{% endif %}
|
|
||||||
class="w-full p-2 border border-gray-300 rounded shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 {% if not view.can_edit %}bg-gray-100{% endif %}">
|
|
||||||
<option value="low" {% if ticket.priority == 'low' %}selected{% endif %}>Niedrig</option>
|
|
||||||
<option value="medium" {% if ticket.priority == 'medium' %}selected{% endif %}>Normal</option>
|
|
||||||
<option value="high" {% if ticket.priority == 'high' %}selected{% endif %}>Hoch</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label class="block text-sm font-medium mb-1">Zugewiesen an:</label>
|
|
||||||
<select name="assigned_to" {% if not view.can_edit %}disabled{% endif %}
|
|
||||||
class="w-full p-2 border border-gray-300 rounded shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 {% if not view.can_edit %}bg-gray-100{% endif %}">
|
|
||||||
<option value="">Nicht zugewiesen</option>
|
|
||||||
{% for user in form.assigned_to.field.queryset %}
|
|
||||||
<option value="{{ user.pk }}" {% if ticket.assigned_to == user %}selected{% endif %}>
|
|
||||||
{{ user.username }}
|
|
||||||
</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if view.can_edit %}
|
|
||||||
<button type="submit" class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded">
|
|
||||||
💾 Speichern
|
|
||||||
</button>
|
|
||||||
{% else %}
|
|
||||||
<p class="text-gray-500 italic">Du kannst dieses Ticket nicht bearbeiten.</p>
|
|
||||||
{% endif %}
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Kommentare -->
|
|
||||||
<div class="bg-white rounded-lg shadow p-6 mb-6">
|
|
||||||
<h2 class="text-xl font-bold mb-4">💬 Kommentare ({{ ticket.comments.count }})</h2>
|
|
||||||
|
|
||||||
{% if ticket.comments.exists %}
|
|
||||||
{% for comment in ticket.comments.all %}
|
|
||||||
<div class="border-l-4 border-blue-400 bg-blue-50 p-4 mb-4">
|
|
||||||
<div class="text-sm text-gray-600 mb-2">
|
|
||||||
<strong>{{ comment.author.username }}</strong> - {{ comment.created_at|date:"d.m.Y H:i" }}
|
|
||||||
</div>
|
|
||||||
<div>{{ comment.text|linebreaks }}</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
</div>
|
||||||
<p class="text-gray-500 italic">Keine Kommentare vorhanden.</p>
|
{% endif %}
|
||||||
{% endif %}
|
<div class="max-w-4xl mx-auto px-4 py-6">
|
||||||
|
<!-- Ticket Bearbeitung -->
|
||||||
{% if user.is_authenticated %}
|
<div class="bg-white rounded-lg shadow p-6 mb-6">
|
||||||
<div class="bg-gray-50 p-4 rounded mt-4">
|
<h1 class="text-3xl font-bold mb-4">🎫 Ticket #{{ ticket.id }} – {{ ticket.title }}</h1>
|
||||||
<h3 class="font-medium mb-2">📝 Neuer Kommentar</h3>
|
<div class="text-sm text-gray-500 mb-6">
|
||||||
<form method="post">
|
🕒 Erstellt: {{ ticket.created_at|date:"d.m.Y H:i" }} |
|
||||||
|
🔄 Aktualisiert: {{ ticket.updated_at|date:"d.m.Y H:i" }}
|
||||||
|
</div>
|
||||||
|
<form method="post" class="space-y-4">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<textarea name="text" rows="3" placeholder="Kommentar schreiben..."
|
<div>
|
||||||
class="w-full p-2 border border-gray-300 rounded shadow-sm mb-2 focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500"></textarea>
|
<label class="block text-sm font-medium mb-1">Titel:</label>
|
||||||
<button type="submit" name="comment_submit"
|
<input type="text"
|
||||||
class="bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded">
|
name="title"
|
||||||
Absenden
|
value="{{ ticket.title }}"
|
||||||
</button>
|
{% if not view.can_edit %}disabled{% endif %}
|
||||||
|
class="w-full p-2 border border-gray-300 rounded shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 {% if not view.can_edit %}bg-gray-100{% endif %}">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-medium mb-1">Beschreibung:</label>
|
||||||
|
<textarea name="description"
|
||||||
|
rows="4"
|
||||||
|
{% if not view.can_edit %}disabled{% endif %}
|
||||||
|
class="w-full p-2 border border-gray-300 rounded shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 {% if not view.can_edit %}bg-gray-100{% endif %}">{{ ticket.description }}</textarea>
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-2 gap-4">
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-medium mb-1">Status:</label>
|
||||||
|
<select name="status"
|
||||||
|
{% if not view.can_edit %}disabled{% endif %}
|
||||||
|
class="w-full p-2 border border-gray-300 rounded shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 {% if not view.can_edit %}bg-gray-100{% endif %}">
|
||||||
|
{% for value, label in form.status.field.choices %}
|
||||||
|
<option value="{{ value }}"
|
||||||
|
{% if value == ticket.status %}selected{% endif %}>{{ label }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-medium mb-1">Priorität:</label>
|
||||||
|
<select name="priority"
|
||||||
|
{% if not view.can_edit %}disabled{% endif %}
|
||||||
|
class="w-full p-2 border border-gray-300 rounded shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 {% if not view.can_edit %}bg-gray-100{% endif %}">
|
||||||
|
<option value="low" {% if ticket.priority == 'low' %}selected{% endif %}>Niedrig</option>
|
||||||
|
<option value="medium"
|
||||||
|
{% if ticket.priority == 'medium' %}selected{% endif %}>Normal</option>
|
||||||
|
<option value="high" {% if ticket.priority == 'high' %}selected{% endif %}>Hoch</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-medium mb-1">Zugewiesen an:</label>
|
||||||
|
<select name="assigned_to"
|
||||||
|
{% if not view.can_edit %}disabled{% endif %}
|
||||||
|
class="w-full p-2 border border-gray-300 rounded shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 {% if not view.can_edit %}bg-gray-100{% endif %}">
|
||||||
|
<option value="">Nicht zugewiesen</option>
|
||||||
|
{% for user in form.assigned_to.field.queryset %}
|
||||||
|
<option value="{{ user.pk }}"
|
||||||
|
{% if ticket.assigned_to == user %}selected{% endif %}>{{ user.username }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
{% if view.can_edit %}
|
||||||
|
<button type="submit"
|
||||||
|
class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded">💾 Speichern</button>
|
||||||
|
{% else %}
|
||||||
|
<p class="text-gray-500 italic">Du kannst dieses Ticket nicht bearbeiten.</p>
|
||||||
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
<!-- Kommentare -->
|
||||||
</div>
|
<div class="bg-white rounded-lg shadow p-6 mb-6">
|
||||||
|
<h2 class="text-xl font-bold mb-4">💬 Kommentare ({{ ticket.comments.count }})</h2>
|
||||||
<!-- Historie -->
|
{% if ticket.comments.exists %}
|
||||||
<div class="bg-white rounded-lg shadow p-6">
|
{% for comment in ticket.comments.all %}
|
||||||
<h2 class="text-xl font-bold mb-4">🕓 Änderungen ({{ ticket.history.count }})</h2>
|
<div class="border-l-4 border-blue-400 bg-blue-50 p-4 mb-4">
|
||||||
|
<div class="text-sm text-gray-600 mb-2">
|
||||||
{% if ticket.history.exists %}
|
<strong>{{ comment.author.username }}</strong> - {{ comment.created_at|date:"d.m.Y H:i" }}
|
||||||
{% for entry in ticket.history.all %}
|
</div>
|
||||||
<div class="border-l-4 border-gray-300 bg-gray-50 p-4 mb-4">
|
<div>{{ comment.text|linebreaks }}</div>
|
||||||
<div class="text-sm">
|
</div>
|
||||||
<strong>{{ entry.changed_by.username }}</strong> hat
|
{% endfor %}
|
||||||
<code class="bg-gray-200 px-1 rounded">{{ entry.field }}</code> geändert
|
{% else %}
|
||||||
|
<p class="text-gray-500 italic">Keine Kommentare vorhanden.</p>
|
||||||
|
{% endif %}
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
<div class="bg-gray-50 p-4 rounded mt-4">
|
||||||
|
<h3 class="font-medium mb-2">📝 Neuer Kommentar</h3>
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<textarea name="text"
|
||||||
|
rows="3"
|
||||||
|
placeholder="Kommentar schreiben..."
|
||||||
|
class="w-full p-2 border border-gray-300 rounded shadow-sm mb-2 focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500"></textarea>
|
||||||
|
<button type="submit"
|
||||||
|
name="comment_submit"
|
||||||
|
class="bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded">Absenden</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-sm mt-1">
|
{% endif %}
|
||||||
<span class="text-red-600">{{ entry.old_value }}</span> →
|
</div>
|
||||||
<span class="text-green-600">{{ entry.new_value }}</span>
|
<!-- Historie -->
|
||||||
</div>
|
<div class="bg-white rounded-lg shadow p-6">
|
||||||
<div class="text-xs text-gray-500 mt-1">{{ entry.changed_at|date:"d.m.Y H:i" }}</div>
|
<h2 class="text-xl font-bold mb-4">🕓 Änderungen ({{ ticket.history.count }})</h2>
|
||||||
</div>
|
{% if ticket.history.exists %}
|
||||||
{% endfor %}
|
{% for entry in ticket.history.all %}
|
||||||
{% else %}
|
<div class="border-l-4 border-gray-300 bg-gray-50 p-4 mb-4">
|
||||||
<p class="text-gray-500 italic">Keine Änderungen bisher.</p>
|
<div class="text-sm">
|
||||||
{% endif %}
|
<strong>{{ entry.changed_by.username }}</strong> hat
|
||||||
|
<code class="bg-gray-200 px-1 rounded">{{ entry.field }}</code> geändert
|
||||||
|
</div>
|
||||||
|
<div class="text-sm mt-1">
|
||||||
|
<span class="text-red-600">{{ entry.old_value }}</span> →
|
||||||
|
<span class="text-green-600">{{ entry.new_value }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-xs text-gray-500 mt-1">{{ entry.changed_at|date:"d.m.Y H:i" }}</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
<p class="text-gray-500 italic">Keine Änderungen bisher.</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<!-- Navigation -->
|
||||||
|
<div class="mt-6">
|
||||||
|
<a href="{% url 'ticket-list' %}"
|
||||||
|
class="text-blue-500 hover:text-blue-600">← Zurück zur Übersicht</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Navigation -->
|
|
||||||
<div class="mt-6">
|
|
||||||
<a href="{% url 'ticket-list' %}" class="text-blue-500 hover:text-blue-600">← Zurück zur Übersicht</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -35,13 +35,10 @@
|
|||||||
onchange="this.form.submit()"
|
onchange="this.form.submit()"
|
||||||
class="w-full h-10 px-3 border border-gray-300 rounded shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
class="w-full h-10 px-3 border border-gray-300 rounded shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
||||||
<option value="">Alle Status</option>
|
<option value="">Alle Status</option>
|
||||||
<option value="open" {% if selected_status == "open" %}selected{% endif %}>🔴 Offen</option>
|
{% for value, label in status_choices %}
|
||||||
<option value="in_progress"
|
<option value="{{ value }}"
|
||||||
{% if selected_status == "in_progress" %}selected{% endif %}>
|
{% if selected_status == value %}selected{% endif %}>{{ label }}</option>
|
||||||
🟡 In Bearbeitung
|
{% endfor %}
|
||||||
</option>
|
|
||||||
<option value="closed"
|
|
||||||
{% if selected_status == "closed" %}selected{% endif %}>🟢 Erledigt</option>
|
|
||||||
</select>
|
</select>
|
||||||
<!-- Andere Filter beibehalten -->
|
<!-- Andere Filter beibehalten -->
|
||||||
{% if request.GET.assigned_to %}
|
{% if request.GET.assigned_to %}
|
||||||
@@ -98,7 +95,10 @@
|
|||||||
<span class="font-medium text-gray-700">Aktive Filter:</span>
|
<span class="font-medium text-gray-700">Aktive Filter:</span>
|
||||||
{% if selected_status %}
|
{% if selected_status %}
|
||||||
<span class="px-2 py-1 bg-blue-100 text-blue-800 text-sm rounded">
|
<span class="px-2 py-1 bg-blue-100 text-blue-800 text-sm rounded">
|
||||||
Status: {{ selected_status|title }}
|
Status:
|
||||||
|
{% for value, label in status_choices %}
|
||||||
|
{% if value == selected_status %}{{ label }}{% endif %}
|
||||||
|
{% endfor %}
|
||||||
<a href="?{% if search_query %}q={{ search_query }}{% endif %}{% if request.GET.assigned_to %}&assigned_to={{ request.GET.assigned_to }}{% endif %}"
|
<a href="?{% if search_query %}q={{ search_query }}{% endif %}{% if request.GET.assigned_to %}&assigned_to={{ request.GET.assigned_to }}{% endif %}"
|
||||||
class="ml-1 text-blue-600 hover:text-blue-800">×</a>
|
class="ml-1 text-blue-600 hover:text-blue-800">×</a>
|
||||||
</span>
|
</span>
|
||||||
@@ -148,14 +148,18 @@
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="px-4 py-3 text-center">
|
<td class="px-4 py-3 text-center">
|
||||||
{% if ticket.status == 'open' %}
|
{% if ticket.status == 'new' %}
|
||||||
<span class="px-2 py-1 rounded-full text-xs font-bold bg-red-500 text-white">{{ ticket.get_status_display }}</span>
|
<span class="px-2 py-1 rounded-full text-xs font-bold bg-blue-500 text-white">{{ ticket.get_status_display }}</span>
|
||||||
{% elif ticket.status == 'in_progress' %}
|
{% elif ticket.status == 'in_progress' %}
|
||||||
<span class="px-2 py-1 rounded-full text-xs font-bold bg-yellow-400 text-gray-900">
|
<span class="px-2 py-1 rounded-full text-xs font-bold bg-yellow-400 text-gray-900">
|
||||||
{{ ticket.get_status_display }}
|
{{ ticket.get_status_display }}
|
||||||
</span>
|
</span>
|
||||||
|
{% elif ticket.status == 'resolved' %}
|
||||||
|
<span class="px-2 py-1 rounded-full text-xs font-bold bg-green-400 text-white">{{ ticket.get_status_display }}</span>
|
||||||
|
{% elif ticket.status == 'pending_close' %}
|
||||||
|
<span class="px-2 py-1 rounded-full text-xs font-bold bg-orange-500 text-white">{{ ticket.get_status_display }}</span>
|
||||||
{% elif ticket.status == 'closed' %}
|
{% elif ticket.status == 'closed' %}
|
||||||
<span class="px-2 py-1 rounded-full text-xs font-bold bg-green-500 text-white">{{ ticket.get_status_display }}</span>
|
<span class="px-2 py-1 rounded-full text-xs font-bold bg-gray-600 text-white">{{ ticket.get_status_display }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-4 py-3 text-center">
|
<td class="px-4 py-3 text-center">
|
||||||
|
|||||||
@@ -62,9 +62,9 @@
|
|||||||
<select name="status"
|
<select name="status"
|
||||||
disabled
|
disabled
|
||||||
class="w-full p-2 border border-gray-300 bg-gray-300 rounded shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
class="w-full p-2 border border-gray-300 bg-gray-300 rounded shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
||||||
<option value="open" {% if form.status.value == 'open' or not form.status.value %}selected{% endif %}>Offen</option>
|
<option value="new" {% if form.status.value == 'new' or not form.status.value %}selected{% endif %}>Neu</option>
|
||||||
</select>
|
</select>
|
||||||
<input type="hidden" name="status" value="open">
|
<input type="hidden" name="status" value="new">
|
||||||
{% if form.status.errors %}
|
{% if form.status.errors %}
|
||||||
<div class="text-red-600 text-sm mt-1">{{ form.status.errors }}</div>
|
<div class="text-red-600 text-sm mt-1">{{ form.status.errors }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -57,9 +57,9 @@ class TicketListView(ListView):
|
|||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context["selected_status"] = self.request.GET.get("status", "")
|
context["selected_status"] = self.request.GET.get("status", "")
|
||||||
context["search_query"] = self.request.GET.get("q", "")
|
context["search_query"] = self.request.GET.get("q", "")
|
||||||
|
context["status_choices"] = Ticket.STATUS_CHOICES
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
class TicketDetailUpdateView(UpdateView):
|
class TicketDetailUpdateView(UpdateView):
|
||||||
model = Ticket
|
model = Ticket
|
||||||
fields = ["title", "description", "status", "priority", "assigned_to"]
|
fields = ["title", "description", "status", "priority", "assigned_to"]
|
||||||
@@ -173,7 +173,7 @@ class TicketCreateView(CreateView):
|
|||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
form.instance.created_by = self.request.user
|
form.instance.created_by = self.request.user
|
||||||
form.instance.status = "open"
|
form.instance.status = "new"
|
||||||
return super().form_valid(form)
|
return super().form_valid(form)
|
||||||
|
|
||||||
def get_success_url(self):
|
def get_success_url(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user