diff --git a/modular_chomp/code/_onclick/hud/alert.dm b/modular_chomp/code/_onclick/hud/alert.dm index 2e2acebfd0..09e06fa641 100644 --- a/modular_chomp/code/_onclick/hud/alert.dm +++ b/modular_chomp/code/_onclick/hud/alert.dm @@ -4,7 +4,6 @@ desc = "A Administrator would like to chat with you. \ Click here to begin." icon_state = "32x32" - var/clicked_once = FALSE /obj/screen/alert/open_ticket/Click() if(!usr || !usr.client) return @@ -13,6 +12,3 @@ var/datum/ticket_chat/TC = new() TC.T = usr.client.current_ticket TC.tgui_interact(usr.client.mob) - - desc = "A Administrator would like to chat with you. \ - Click here to continue the conversation." diff --git a/modular_chomp/code/modules/tgui/feedback.dm b/modular_chomp/code/modules/tgui/feedback.dm new file mode 100644 index 0000000000..9c65474364 --- /dev/null +++ b/modular_chomp/code/modules/tgui/feedback.dm @@ -0,0 +1,48 @@ +/datum/tgui_feedback + var/selected_window + +/datum/tgui_feedback/tgui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "TguiFeedback", "TGUI Feedback Submission") + ui.open() + +/datum/tgui_feedback/tgui_state(mob/user) + return GLOB.tgui_always_state + +/datum/tgui_feedback/tgui_static_data(mob/user) + var/list/data = list() + + data["open_windows"] = list() + for(var/datum/tgui/ui in user.tgui_open_uis) + data["open_windows"] += ui.title + + return data + +/datum/tgui_feedback/tgui_data(mob/user) + var/list/data = list() + + data["selected_window"] = selected_window + + return data + +/datum/tgui_feedback/tgui_act(action, params) + if(..()) + return + switch(action) + if("pick_window") + if(!params["win"]) + return + + selected_window = sanitize(params["win"]) + . = TRUE + if("submit") + message_admins("TGUI Feedback: Rating [params["rating"]] - Comment: [params["comment"]]") + . = TRUE + +/client/verb/tgui_feedback() + set name = "Submit TGUI Feedback" + set category = "OOC" + + var/datum/tgui_feedback/feedback = new() + feedback.tgui_interact(usr) diff --git a/modular_chomp/code/modules/tickets/tickets.dm b/modular_chomp/code/modules/tickets/tickets.dm index 861afe597d..15c83f4ee5 100644 --- a/modular_chomp/code/modules/tickets/tickets.dm +++ b/modular_chomp/code/modules/tickets/tickets.dm @@ -129,11 +129,13 @@ GLOBAL_DATUM_INIT(tickets, /datum/tickets, new) if(C.current_ticket) C.current_ticket.AddInteraction("Client reconnected.") C.current_ticket.initiator = C + C.current_ticket.initiator.mob.throw_alert("open ticket", /obj/screen/alert/open_ticket) //Dissasociate ticket /datum/tickets/proc/ClientLogout(client/C) if(C.current_ticket) C.current_ticket.AddInteraction("Client disconnected.") + C.current_ticket.initiator.mob.clear_alert("open ticket") C.current_ticket.initiator = null C.current_ticket = null @@ -430,7 +432,7 @@ GLOBAL_DATUM_INIT(tickets, /datum/tickets, new) message_admins(msg) log_admin(msg) feedback_inc("ticket_reopen") - TicketPanel() //can only be done from here, so refresh it + //TicketPanel() //can only be done from here, so refresh it SSwebhooks.send( WEBHOOK_AHELP_SENT, @@ -473,7 +475,7 @@ GLOBAL_DATUM_INIT(tickets, /datum/tickets, new) "color" = COLOR_WEBHOOK_BAD ) ) - initiator.mob.clear_alert("open ticket") + initiator?.mob?.clear_alert("open ticket") //Mark open ticket as resolved/legitimate, returns ahelp verb /datum/ticket/proc/Resolve(silent = FALSE) @@ -504,6 +506,7 @@ GLOBAL_DATUM_INIT(tickets, /datum/tickets, new) "color" = COLOR_WEBHOOK_GOOD ) ) + initiator?.mob?.clear_alert("open ticket") //Close and return ahelp verb, use if ticket is incoherent /datum/ticket/proc/Reject(key_name = key_name_admin(usr)) @@ -596,7 +599,7 @@ GLOBAL_DATUM_INIT(tickets, /datum/tickets, new) var/msg = "Ticket [TicketHref("#[id]")] titled [name] by [key_name_admin(usr)]" message_admins(msg) log_admin(msg) - TicketPanel() //we have to be here to do this + //TicketPanel() //we have to be here to do this //Kick ticket to next level /datum/ticket/proc/Escalate() diff --git a/modular_chomp/code/modules/tickets/tickets_player_ui.dm b/modular_chomp/code/modules/tickets/tickets_player_ui.dm index bda51706c6..d1597c17ab 100644 --- a/modular_chomp/code/modules/tickets/tickets_player_ui.dm +++ b/modular_chomp/code/modules/tickets/tickets_player_ui.dm @@ -37,7 +37,7 @@ return switch(action) if("send_msg") - if(params["msg"]) + if(!params["msg"]) return usr.client.cmd_admin_pm(usr.client, sanitize(params["msg"]), T) diff --git a/modular_chomp/code/modules/tickets/tickets_ui.dm b/modular_chomp/code/modules/tickets/tickets_ui.dm index 1775ff1a7f..b434d72a7a 100644 --- a/modular_chomp/code/modules/tickets/tickets_ui.dm +++ b/modular_chomp/code/modules/tickets/tickets_ui.dm @@ -104,11 +104,11 @@ TicketListLegacy(choice) . = TRUE if("new_ticket") - var/list/ckeys + var/list/ckeys = list() for(var/client/C in GLOB.clients) - ckeys += C.ckey + ckeys += C.key - var/ckey = tgui_input_list(usr, "Please select the ckey of the user.", "Select CKEY", ckeys) + var/ckey = lowertext(tgui_input_list(usr, "Please select the ckey of the user.", "Select CKEY", ckeys)) if(!ckey) return @@ -121,22 +121,21 @@ to_chat(usr, "Ckey ([ckey]) not online.") return - var/msg = tgui_input_text(usr, "What should the initial text be?", "New Ticket") - if(!msg) + var/ticket_text = tgui_input_text(usr, "What should the initial text be?", "New Ticket") + if(!ticket_text) to_chat(usr, "Ticket message cannot be empty.") return - var/level = tgui_input_text(usr, "What level is the ticket? 0 = ADMIN, 1 = MENTOR", "Ticket Level") - if(level != "0" && level != "1") - to_chat(usr, "Invalid ticket level: [level].") + var/level = tgui_alert(usr, "Is this ticket Admin-Level or Mentor-Level?", "Ticket Level", list("Admin", "Mentor")) + if(!level) return feedback_add_details("admin_verb","Admincreatedticket") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! if(player.current_ticket) if(tgui_alert(usr, "The player already has a ticket open. Is this for the same issue?","Duplicate?",list("Yes","No")) != "No") if(player.current_ticket) - player.current_ticket.MessageNoRecipient(msg) - to_chat(usr, "PM to-Admins: [msg]") + player.current_ticket.MessageNoRecipient(ticket_text) + to_chat(usr, "PM to-Admins: [ticket_text]") return else to_chat(usr, "Ticket not found, creating new one...") @@ -144,7 +143,14 @@ player.current_ticket.AddInteraction("[key_name_admin(usr)] opened a new ticket.") player.current_ticket.Close() - new /datum/ticket(msg, player, TRUE, level) + // Create a new ticket and handle it. You created it afterall! + var/datum/ticket/T = new /datum/ticket(ticket_text, player, TRUE, level) + if(level == "Admin") + T.level = 0 + else + T.level = 1 + T.HandleIssue() + usr.client.cmd_admin_pm(player, ticket_text, T) . = TRUE if("pick_ticket") var/datum/ticket/T = ID2Ticket(params["ticket_id"]) @@ -160,6 +166,12 @@ usr.client.selected_ticket.tgui_interact(usr) usr.client.selected_ticket = null . = TRUE + if("send_msg") + if(!params["msg"]) + return + + usr.client.cmd_admin_pm(usr.client.selected_ticket.initiator, sanitize(params["msg"]), usr.client.selected_ticket) + . = TRUE /datum/tickets/tgui_fallback(payload) if(..()) @@ -190,6 +202,7 @@ var/ref_src = "\ref[src]" data["title"] = name data["name"] = LinkedReplyName(ref_src) + data["ticket_ref"] = ref_src switch(state) if(AHELP_ACTIVE) @@ -229,6 +242,14 @@ if("legacy") TicketPanelLegacy() . = TRUE + if("send_msg") + if(!params["msg"] || !params["ticket_ref"]) + return + + var/datum/ticket/T = locate(params["ticket_ref"]) + + usr.client.cmd_admin_pm(T.initiator, sanitize(params["msg"]), T) + . = TRUE /datum/ticket/tgui_fallback(payload) if(..()) diff --git a/tgui/packages/tgui_ch/interfaces/TguiFeedback.tsx b/tgui/packages/tgui_ch/interfaces/TguiFeedback.tsx new file mode 100644 index 0000000000..a0145c5d25 --- /dev/null +++ b/tgui/packages/tgui_ch/interfaces/TguiFeedback.tsx @@ -0,0 +1,62 @@ +import { useBackend, useLocalState } from '../backend'; +import { Box, Button, Flex, Input, Section, Tabs, TextArea } from '../components'; +import { Window } from '../layouts'; + +type Data = { + open_windows: string[]; + selected_window: string; +}; + +export const TguiFeedback = (props, context) => { + const { act, data } = useBackend(context); + const { open_windows, selected_window } = data; + const [rating, setRating] = useLocalState(context, 'rating', ''); + const [comment, setComment] = useLocalState(context, 'comment', ''); + return ( + + + +
+ + {open_windows.map((window) => ( + act('pick_window', { win: window })}> + {window} + + ))} + +
+
+ + {selected_window && ( + <> +
+ Please enter your rating of this window from a range from 1 to 5 +
+ setRating(val)} value={rating} /> +
+
+ If you want, you can leave an optional comment as well! +
+