Skip to content

Commit

Permalink
fixes the claim button
Browse files Browse the repository at this point in the history
fix mark lock
  • Loading branch information
realforest2001 committed Sep 4, 2023
1 parent 9f23d87 commit 3594385
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
25 changes: 24 additions & 1 deletion code/game/machinery/ARES/AdminAres.dm
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
for(var/datum/ares_ticket/access/access_ticket as anything in tickets_access)
var/lock_status = TICKET_OPEN
switch(access_ticket.ticket_status)
if(TICKET_REJECTED, TICKET_CANCELLED, TICKET_COMPLETED)
if(TICKET_REJECTED, TICKET_CANCELLED, TICKET_REVOKED)
lock_status = TICKET_CLOSED

var/list/current_ticket = list()
Expand Down Expand Up @@ -347,6 +347,29 @@
admin_interface.last_menu = admin_interface.current_menu
admin_interface.current_menu = "read_deleted"

if("claim_ticket")
var/datum/ares_ticket/ticket = locate(params["ticket"])
if(!istype(ticket))
return FALSE
var/claim = TRUE
var/assigned = ticket.ticket_assignee
if(assigned)
if(assigned == MAIN_AI_SYSTEM)
var/prompt = tgui_alert(usr, "You already claimed this ticket! Do you wish to drop your claim?", "Unclaim ticket", list("Yes", "No"))
if(prompt != "Yes")
return FALSE
/// set ticket back to pending
ticket.ticket_assignee = null
ticket.ticket_status = TICKET_PENDING
return claim
var/choice = tgui_alert(usr, "This ticket has already been claimed by [assigned]! Do you wish to override their claim?", "Claim Override", list("Yes", "No"))
if(choice != "Yes")
claim = FALSE
if(claim)
ticket.ticket_assignee = MAIN_AI_SYSTEM
ticket.ticket_status = TICKET_ASSIGNED
return claim

if("auth_access")
var/datum/ares_ticket/access/access_ticket = locate(params["ticket"])
if(!access_ticket)
Expand Down
6 changes: 2 additions & 4 deletions tgui/packages/tgui/interfaces/AresAdmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1691,13 +1691,11 @@ const AccessManagement = (props, context) => {
)}
{access_tickets.map((ticket, i) => {
let can_claim = 'Yes';
if (ticket.assignee === logged_in) {
can_claim = 'No';
} else if (ticket.lock_status === 'CLOSED') {
if (ticket.lock_status === 'CLOSED') {
can_claim = 'No';
}
let can_update = 'Yes';
if (ticket.assignee !== logged_in) {
if (ticket.assignee !== 'ARES v3.2') {
can_update = 'No';
} else if (ticket.lock_status === 'CLOSED') {
can_update = 'No';
Expand Down

0 comments on commit 3594385

Please sign in to comment.