emile 11 months ago
parent 73cad8e468
commit c11d964b51

Binary file not shown.

@ -20,7 +20,7 @@ urlpatterns = [
path('businesstype/<int:businesstype_id>/', views.edit_business_type, name='editbusinesstype'),
path('reference/<int:reference_id>/', views.edit_reference, name='editreference'),
path('tag/<int:tag_id>/', views.edit_tag, name='edittag'),
path('edit-ticket-status', views.edit_ticket_status_modal, name='edit-ticket-status-modal'),
path('ticket/<int:ticket_id>/status/', views.edit_ticket_status_modal, name='edit-ticket-status-modal'),

@ -4,6 +4,7 @@ from django.http import HttpResponseRedirect
from django.urls import reverse
from django.http import HttpResponse
from osinacore.decorators import *
from customercore.models import *
@staff_login_required
@ -422,12 +423,20 @@ def edit_tag(request, tag_id):
@staff_login_required
def edit_ticket_status_modal(request, *args, **kwargs):
def edit_ticket_status_modal(request, ticket_id):
ticket = get_object_or_404(Ticket, id=ticket_id)
if request.method == 'POST':
ticket_status = TicketStatus(
ticket = ticket,
status = request.POST.get('status'),
date_added = request.POST.get('date'),
added_by = request.user
)
ticket_status.save()
return redirect('ticketdetails', ticket_number=ticket.ticket_number)
context = {
'ticket': ticket,
}
return render(request, 'edit_templates/edit-ticket-status-modal.html', context)

@ -17,7 +17,7 @@
<div class="w-full s:w-fit flex flex-col s:flex-row justify-end items-center gap-2">
<button class="w-full s:w-fit px-3 py-2 bg-osiblue border border-osiblue text-white cursor-pointer duration-300 hover:bg-white hover:text-osiblue rounded-md updateTicketStatusButton" data-modal-url="{% url 'edit-ticket-status-modal' %}">
<button class="w-full s:w-fit px-3 py-2 bg-osiblue border border-osiblue text-white cursor-pointer duration-300 hover:bg-white hover:text-osiblue rounded-md updateTicketStatusButton" data-modal-url="{% url 'edit-ticket-status-modal' ticket.id %}">
Update Status
</button>
@ -32,20 +32,20 @@
{% if last_ticket_status.status == 'Open' %}
<div class="flex justify-start items-center gap-1">
<div class="w-[16px] h-[16px] rounded-full bg-green-200 shadow-md"></div>
<p class="text-secondosiblue font-light">Opened by {{last_ticket_status.added_by.first_name}} at
{{last_ticket_status.date_added}}</p>
<p class="text-secondosiblue font-light">Opened by {{last_ticket_status.added_by.first_name}} on
{{ last_ticket_status.date_added|date:"d F Y, h:i A" }}</p>
</div>
{% elif last_ticket_status.status == 'Working On' %}
<div class="flex justify-start items-center gap-1">
<div class="w-[16px] h-[16px] rounded-full bg-yellow-200 shadow-md"></div>
<p class="text-secondosiblue font-light">Updated to 'Working On' by
{{last_ticket_status.added_by.first_name}} at {{last_ticket_status.date_added}}</p>
{{last_ticket_status.added_by.first_name}} on {{ last_ticket_status.date_added|date:"d F Y, h:i A" }}</p>
</div>
{% elif last_ticket_status.status == 'Closed' %}
<div class="flex justify-start items-center gap-1">
<div class="w-[16px] h-[16px] rounded-full bg-red-200 shadow-md"></div>
<p class="text-secondosiblue font-light">Closed by {{last_ticket_status.added_by.first_name}} at
{{last_ticket_status.date_added}}</p>
<p class="text-secondosiblue font-light">Closed by {{last_ticket_status.added_by.first_name}} on
{{ last_ticket_status.date_added|date:"d F Y, h:i A" }}</p>
</div>
{% endif %}

@ -14,7 +14,7 @@
</head>
<body class="font-poppinsLight">
<form id="hiddenContent" method="POST" action="">
<form id="hiddenContent" method="POST" action="{% url 'edit-ticket-status-modal' ticket.id %}">
{% csrf_token %}
<h1 class="text-secondosiblue text-2xl font-semibold text-center">Update Ticket Status</h1>
@ -26,7 +26,7 @@
<div class="w-full">
<input required name="date" type="date" id="date" name="date"
<input required name="date" type="datetime-local" id="date" name="date"
class="w-full p-3 border border-gray-300 rounded-md bg-transparent outline-none mt-4">
</div>

Loading…
Cancel
Save