Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project ARES: Print ASRS Log #6333

Merged
merged 7 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions code/game/machinery/ARES/ARES_interface.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
/// The datacore storing all the information.
var/datum/ares_datacore/datacore

COOLDOWN_DECLARE(printer_cooldown)

/obj/structure/machinery/computer/ares_console/proc/link_systems(datum/ares_link/new_link = GLOB.ares_link, override)
if(link && !override)
return FALSE
Expand Down Expand Up @@ -94,6 +96,8 @@
data["nuketimelock"] = NUCLEAR_TIME_LOCK
data["nuke_available"] = datacore.nuke_available

data["printer_cooldown"] = !COOLDOWN_FINISHED(src, printer_cooldown)

var/list/logged_announcements = list()
for(var/datum/ares_record/announcement/broadcast as anything in datacore.records_announcement)
var/list/current_broadcast = list()
Expand Down Expand Up @@ -337,6 +341,72 @@
last_menu = current_menu
current_menu = "core_security"

// -- Print ASRS Audit Log -- //
if("print_req")
playsound = FALSE
if(!COOLDOWN_FINISHED(src, printer_cooldown))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE
if(!length(datacore.records_asrs))
to_chat(user, SPAN_WARNING("There are no records to print!"))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE
COOLDOWN_START(src, printer_cooldown, 20 SECONDS)
playsound(src, 'sound/machines/fax.ogg', 15, 1)
sleep(3.4 SECONDS)
var/contents = {"
<style>
#container { width: 500px; min-height: 500px; margin: 25px auto; \
font-family: monospace; padding: 0; font-size: 130% } \
#title { font-size: 250%; letter-spacing: 8px; \
font-weight: bolder; margin: 20px auto } \
.header { font-size: 130%; text-align: center; } \
.important { font-variant: small-caps; font-size = 130%; \
font-weight: bolder; } \
.tablelabel { width: 150px; } \
.field { font-style: italic; } \
table { table-layout: fixed } \
</style><div id='container'> \
<div class='header'> \
<p id='title' class='important'>A.S.R.S.</p> \
<p class='important'>Automatic Storage Retrieval System</p> \
<p class='field'>Audit Log</p> \
</div><hr>
<u>Printed By:</u> [last_login]<br>
<u>Print Time:</u> [worldtime2text()]<br>
<hr>
<center>
<table border=1 cellspacing=0 cellpadding=3 style='border: 1px solid black;'>
<thead>
<tr>
<th scope="col">Time</th>
<th scope="col">User</th>
<th scope="col">Source</th>
<th scope="col">Order</th>
</tr>
</thead>
<tbody>
"}

for(var/datum/ares_record/requisition_log/req_order as anything in datacore.records_asrs)

contents += {"
<tr>
<th scope="row">[req_order.time]</th>
<td>[req_order.user]</td>
<td>[req_order.title]</td>
<td>[req_order.details]</td>
</tr>
"}

contents += "</center></tbody></table>"

var/obj/item/paper/log = new(loc)
log.name = "ASRS Audit Log"
log.info += contents
log.icon_state = "paper_uscm_words"
visible_message(SPAN_NOTICE("\The [src] prints out a paper."))
harryob marked this conversation as resolved.
Show resolved Hide resolved

// -- Delete Button -- //
if("delete_record")
var/datum/ares_record/record = locate(params["record"])
Expand Down
14 changes: 14 additions & 0 deletions tgui/packages/tgui/interfaces/AresInterface.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,7 @@ const Requisitions = (props) => {
last_page,
current_menu,
records_requisition,
printer_cooldown,
} = data;

return (
Expand Down Expand Up @@ -1235,6 +1236,19 @@ const Requisitions = (props) => {

<Section>
<h1 align="center">ASRS Audit Log</h1>
<h4 align="center">
<Button
icon="print"
px="2rem"
textAlign="center"
tooltip="Print Audit Log"
onClick={() => act('print_req')}
disabled={printer_cooldown}
>
Print Audit Log
</Button>
</h4>

{!!records_requisition.length && (
<Flex
className="candystripe"
Expand Down
Loading