mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-21 15:42:35 +00:00
Cargo Order Logging (#9797)
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
/datum/nano_module/program/civilian/cargocontrol
|
||||
name = "Cargo Control"
|
||||
var/page = "overview_main" //overview_main - Main Menu, overview_submitted - Submitted Order Overview, overview_approved - Approved Order Overview, settings - Settings, details - order details, bounties - centcom bounties
|
||||
var/last_user_name = "" //Name of the User that last used the computer
|
||||
var/status_message //A status message that can be displayed
|
||||
var/list/order_details = list() //Order Details for the order
|
||||
var/list/shipment_details = list() //Shipment Details for a selected shipment
|
||||
@@ -29,10 +28,7 @@
|
||||
//Send the status message
|
||||
data["status_message"] = status_message
|
||||
|
||||
//Pass the ID Data
|
||||
var/obj/item/card/id/user_id_card = user.GetIdCard()
|
||||
last_user_name = GetNameAndAssignmentFromId(user_id_card)
|
||||
data["username"] = last_user_name
|
||||
data["username"] = GetNameAndAssignmentFromId(user.GetIdCard())
|
||||
|
||||
var/list/submitted_orders = SScargo.get_orders_by_status("submitted",1)
|
||||
data["order_submitted_number"] = submitted_orders.len
|
||||
@@ -108,6 +104,11 @@
|
||||
ui.set_auto_update(TRUE)
|
||||
|
||||
/datum/nano_module/program/civilian/cargocontrol/Topic(href, href_list)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
var/obj/item/card/id/I = usr.GetIdCard()
|
||||
|
||||
var/datum/shuttle/autodock/ferry/supply/shuttle = SScargo.shuttle
|
||||
var/obj/item/modular_computer/console = program.computer
|
||||
if (!shuttle)
|
||||
@@ -150,7 +151,7 @@
|
||||
if(href_list["order_approve"])
|
||||
var/datum/cargo_order/co = SScargo.get_order_by_id(text2num(href_list["order_approve"]))
|
||||
if(co)
|
||||
var/message = co.set_approved(last_user_name)
|
||||
var/message = co.set_approved(GetNameAndAssignmentFromId(I), usr.character_id)
|
||||
if(message)
|
||||
status_message = message
|
||||
return TRUE
|
||||
@@ -166,7 +167,7 @@
|
||||
|
||||
//Send shuttle
|
||||
if(href_list["shuttle_send"])
|
||||
var/message = SScargo.shuttle_call(last_user_name)
|
||||
var/message = SScargo.shuttle_call(GetNameAndAssignmentFromId(I))
|
||||
if(message)
|
||||
status_message = message
|
||||
return TRUE
|
||||
@@ -260,4 +261,4 @@
|
||||
status_signal.transmission_method = 1
|
||||
status_signal.data["command"] = command
|
||||
|
||||
frequency.post_signal(src, status_signal)
|
||||
frequency.post_signal(src, status_signal)
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
/datum/nano_module/program/civilian/cargodelivery
|
||||
name = "Cargo Delivery"
|
||||
var/page = "overview_main" //overview_main - Main Menu, order_overview - Overview page for a specific order, order_payment - Payment page for a specific order
|
||||
var/last_user_name = "" //Name of the User that last used the computer
|
||||
var/status_message //A status message that can be displayed
|
||||
var/list/order_details = list() //Order Details for the order
|
||||
var/datum/cargo_order/co
|
||||
@@ -34,7 +33,6 @@
|
||||
data["id_account_number"] = id_card ? id_card.associated_account_number : null
|
||||
data["id_owner"] = id_card && id_card.registered_name ? id_card.registered_name : "-----"
|
||||
data["id_name"] = id_card ? id_card.name : "-----"
|
||||
last_user_name = data["id_owner"]
|
||||
|
||||
//Pass the shipped orders
|
||||
data["order_list"] = SScargo.get_orders_by_status("shipped",1) + SScargo.get_orders_by_status("approved",1)
|
||||
@@ -61,6 +59,7 @@
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
var/obj/item/card/id/I = usr.GetIdCard()
|
||||
|
||||
//Check if we want to deliver or pay
|
||||
//If we are at the status shipped, then only the confirm delivery and pay button should be shown (deliver)
|
||||
@@ -96,16 +95,16 @@
|
||||
|
||||
//Check if we have delivered it aswell or only paid
|
||||
if(order_details["status"] == "shipped")
|
||||
status_message = co.set_delivered(id_card.registered_name,1)
|
||||
status_message = co.set_delivered(GetNameAndAssignmentFromId(I), usr.character_id, 1)
|
||||
else
|
||||
status_message = co.set_paid(id_card.registered_name)
|
||||
status_message = co.set_paid(GetNameAndAssignmentFromId(I), usr.character_id)
|
||||
order_details = co.get_list()
|
||||
|
||||
else
|
||||
//TODO: Add a sound effect here
|
||||
//If a payment is not needed and we are at the status shipped, then confirm the delivery
|
||||
if(order_details["status"] == "shipped")
|
||||
status_message = co.set_delivered(id_card.registered_name,0)
|
||||
playsound(program.computer, 'sound/machines/chime.ogg', 50, TRUE)
|
||||
status_message = co.set_delivered(GetNameAndAssignmentFromId(I), usr.character_id, 0)
|
||||
order_details = co.get_list()
|
||||
else
|
||||
status_message = "Unable to process - Network Card or Cardreader Missing"
|
||||
@@ -113,12 +112,8 @@
|
||||
|
||||
|
||||
//But only cargo can switch between the pages
|
||||
var/mob/user = usr
|
||||
if(!istype(user))
|
||||
return
|
||||
var/obj/item/card/id/I = user.GetIdCard()
|
||||
if(!istype(I) || !I.registered_name || !(access_cargo in I.access) || issilicon(user))
|
||||
to_chat(user, SPAN_WARNING("Authentication error: Unable to locate ID with appropriate access to allow this operation."))
|
||||
if(!istype(I) || !I.registered_name || !(access_cargo in I.access) || issilicon(usr))
|
||||
to_chat(usr, SPAN_WARNING("Authentication error: Unable to locate ID with appropriate access to allow this operation."))
|
||||
return
|
||||
|
||||
if(href_list["page"])
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
var/selected_category = "" // Category that is currently selected
|
||||
var/selected_item = "" // Path of the currently selected item
|
||||
var/datum/cargo_order/co
|
||||
var/last_user_name = "" //Name of the user that used the program
|
||||
var/status_message //Status Message to be displayed to the user
|
||||
var/user_tracking_id = 0 //Tracking id of the user
|
||||
var/user_tracking_code = 0 //Tracking Code of the user
|
||||
@@ -28,14 +27,7 @@
|
||||
var/list/data = host.initial_data()
|
||||
|
||||
//Pass the ID Data
|
||||
var/obj/item/card/id/user_id_card = user.GetIdCard()
|
||||
if(!user_id_card)
|
||||
last_user_name = "Unknown"
|
||||
else
|
||||
last_user_name = user_id_card.registered_name
|
||||
|
||||
|
||||
data["username"] = last_user_name
|
||||
data["username"] = GetNameAndAssignmentFromId(user.GetIdCard())
|
||||
|
||||
//Pass the list of all ordered items and the order value
|
||||
data["order_items"] = co.get_item_list()
|
||||
@@ -92,12 +84,14 @@
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
var/obj/item/card/id/I = usr.GetIdCard()
|
||||
|
||||
//Send the order to cargo
|
||||
if(href_list["submit_order"])
|
||||
if(!co.items.len)
|
||||
return TRUE //Only submit the order if there are items in it
|
||||
|
||||
if(last_user_name == "Unknown")
|
||||
if(!I)
|
||||
status_message = "Unable to submit order. ID could not be located."
|
||||
return TRUE
|
||||
|
||||
@@ -106,9 +100,7 @@
|
||||
status_message = "Unable to submit order. No reason supplied."
|
||||
return TRUE
|
||||
|
||||
co.ordered_by = last_user_name
|
||||
co.reason = reason
|
||||
co.set_submitted()
|
||||
co.set_submitted(GetNameAndAssignmentFromId(I), usr.character_id, reason)
|
||||
status_message = "Order submitted successfully. Order ID: [co.order_id] Tracking code: [co.get_tracking_code()]"
|
||||
//TODO: Print a list with the order data
|
||||
co = null
|
||||
@@ -175,4 +167,4 @@
|
||||
|
||||
if(href_list["clear_message"])
|
||||
status_message = null
|
||||
return TRUE
|
||||
return TRUE
|
||||
|
||||
Reference in New Issue
Block a user