diff --git a/code/controllers/subsystem/tickets/tickets.dm b/code/controllers/subsystem/tickets/tickets.dm index 95f647e9012..24be623573e 100644 --- a/code/controllers/subsystem/tickets/tickets.dm +++ b/code/controllers/subsystem/tickets/tickets.dm @@ -357,7 +357,7 @@ UI STUFF if(!T.staffAssigned) dat += "No staff member assigned to this [ticket_name] - Take Ticket
" else - dat += "[T.staffAssigned] is assigned to this Ticket. - Take Ticket
" + dat += "[T.staffAssigned] is assigned to this Ticket. - Take Ticket - Unassign Ticket
" if(T.lastStaffResponse) dat += "Last Staff response Response: [T.lastStaffResponse] at [T.lastResponseTime]" @@ -460,6 +460,11 @@ UI STUFF takeTicket(indexNum) showDetailUI(usr, indexNum) + if(href_list["unassignstaff"]) + var/indexNum = text2num(href_list["unassignstaff"]) + unassignTicket(indexNum) + showDetailUI(usr, indexNum) + if(href_list["autorespond"]) var/indexNum = text2num(href_list["autorespond"]) autoRespond(indexNum) @@ -477,3 +482,13 @@ UI STUFF else message_staff("[usr.client] / ([usr]) has taken [ticket_name] number [index]", TRUE) to_chat_safe(returnClient(index), "Your [ticket_name] is being handled by [usr.client].") + +/datum/controller/subsystem/tickets/proc/unassignTicket(index) + var/datum/ticket/T = allTickets[index] + if(T.staffAssigned != null && (T.staffAssigned == usr.client || alert("Ticket is already assigned to [T.staffAssigned]. Do you want to unassign it?","Unassign ticket","No","Yes") == "Yes")) + T.staffAssigned = null + to_chat_safe(returnClient(index), "Your [ticket_name] has been unassigned. Another staff member will help you soon.") + if(span_class == "mentorhelp") + message_staff("[usr.client] / ([usr]) has unassigned [ticket_name] number [index]") + else + message_staff("[usr.client] / ([usr]) has unassigned [ticket_name] number [index]", TRUE)