budget viewer program (#15528)

* budget viewer

* fix indentation

* Update budgetviewer.dm
This commit is contained in:
ynot01
2022-09-04 09:11:25 -04:00
committed by GitHub
parent a52a0fbfd4
commit 1ad31d17ff
3 changed files with 57 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
/datum/computer_file/program/budget_monitor
filename = "budgetmonitor"
filedesc = "Budget Monitor"
category = PROGRAM_CATEGORY_CMD
program_icon_state = "id"
extended_desc = "This program will allow you to view the financial status of your department(s)."
transfer_access = ACCESS_HEADS
usage_flags = PROGRAM_ALL
requires_ntnet = 1
size = 3
tgui_id = "NtosBudgetMonitor"
program_icon = "id-card"
/datum/computer_file/program/budget_monitor/ui_data()
var/list/data = get_header_data()
var/list/budgets = list()
for(var/A in SSeconomy.department_accounts)
var/datum/bank_account/acc = SSeconomy.get_dep_account(A)
var/name = acc.account_holder
var/money = acc.account_balance || "0"
budgets += list(list("name" = name, "money" = money))
data["budgets"] = budgets
return data

View File

@@ -0,0 +1,29 @@
import { useBackend } from '../backend';
import { LabeledList, Section } from '../components';
import { NtosWindow } from '../layouts';
export const NtosBudgetMonitor = (props, context) => {
const { act, data } = useBackend(context);
const {
budgets,
} = data;
return (
<NtosWindow
width={400}
height={480}
resizable>
<NtosWindow.Content>
<Section title="Budgets">
<LabeledList>
{budgets.map((budget, index) =>
(
<LabeledList.Item label={budget["name"]} key={index}>
{budget["money"] + "cr"}
</LabeledList.Item>
))}
</LabeledList>
</Section>
</NtosWindow.Content>
</NtosWindow>
);
};

View File

@@ -2674,6 +2674,7 @@
#include "code\modules\modular_computers\file_system\programs\antagonist\contract_uplink.dm"
#include "code\modules\modular_computers\file_system\programs\antagonist\dos.dm"
#include "code\modules\modular_computers\file_system\programs\antagonist\revelation.dm"
#include "code\modules\modular_computers\file_system\programs\command\budgetviewer.dm"
#include "code\modules\modular_computers\file_system\programs\command\card.dm"
#include "code\modules\modular_computers\file_system\programs\command\crewmanifest.dm"
#include "code\modules\modular_computers\file_system\programs\command\jobmanagement.dm"