From 9e75741ac8af5cc86a48533ccb8cbd329b374b16 Mon Sep 17 00:00:00 2001
From: variableundefined <40092670+variableundefined@users.noreply.github.com>
Date: Sat, 31 Oct 2020 14:20:27 -0400
Subject: [PATCH 06/11] Finish transaction log and transfer screen. Compile
TGUI. Remove Nano template.
---
nano/templates/atm.tmpl | 149 -------
tgui/packages/tgui/interfaces/ATM.js | 390 +++++++++++++-----
.../tgui/interfaces/AccountsUplinkTerminal.js | 4 +-
tgui/packages/tgui/public/tgui.bundle.js | 6 +-
4 files changed, 286 insertions(+), 263 deletions(-)
delete mode 100644 nano/templates/atm.tmpl
diff --git a/nano/templates/atm.tmpl b/nano/templates/atm.tmpl
deleted file mode 100644
index 586512d76bd..00000000000
--- a/nano/templates/atm.tmpl
+++ /dev/null
@@ -1,149 +0,0 @@
-
-
-
-
-
-
-Nanotrasen Automatic Teller Machine
-For all your monetary needs!
-
-This terminal is {{:data.machine_id}}. Report this code when contacting Nanotrasen IT Support
-
-
-
-
Card:
-
{{:helper.link(data.held_card_name, 'eject', {'choice' : 'insert_card'})}}
-
-
-{{if data.ticks_left_locked_down > 0}}
- Maximum number of pin attempts exceeded! Access to this ATM has been temporarily disabled.
-{{else data.authenticated_account}}
- {{if data.view_screen == 1}}
- Select a new security level for this account:
-
-
Level:
-
{{:helper.link('Zero', 'unlock', {'choice' : 'change_security_level', 'new_security_level' : 0}, data.security_level == 0 ? 'selected' : null)}}
-
-
-
Description:
-
Either the account number or card is required to access this account. EFTPOS transactions will require a card and ask for a pin, but not verify the pin is correct.
-
-
-
-
Level:
-
{{:helper.link('One', 'unlock-alt', {'choice' : 'change_security_level', 'new_security_level' : 1}, data.security_level == 1 ? 'selected' : null)}}
-
-
-
Description:
-
An account number and pin must be manually entered to access this account and process transactions.
-
-
-
-
Level:
-
{{:helper.link('Two', 'lock', {'choice' : 'change_security_level', 'new_security_level' : 2}, data.security_level == 2 ? 'selected' : null)}}
-
-
-
Description:
-
In addition to account number and pin, a card is required to access this account and process transactions.
-
-
- {{:helper.link('Back', 'arrow-left', {'choice' : 'view_screen', 'view_screen' : 0})}}
- {{else data.view_screen == 2}}
- Account balance: ${{:helper.smoothRound(data.money)}}
-
-
- {{:helper.link('Back', 'arrow-left', {'choice' : 'view_screen', 'view_screen' : 0})}}
- {{else data.view_screen == 3}}
- Transaction logs
- {{:helper.link('Back', 'arrow-left', {'choice' : 'view_screen', 'view_screen' : 0})}}
-
-
- {{if data.transaction_log}}
-
-
-
- Timestamp
- Target
- Reason
- Value
- Terminal
-
-
-
- {{for data.transaction_log}}
-
- {{:value.date}} {{:value.time}}
- {{:value.target_name}}
- {{:value.purpose}}
- ${{:value.amount}}
- {{:value.source_terminal}}
-
- {{/for}}
-
-
- {{else}}
-
Your account has no financial transactions on record for today.
- {{/if}}
-
- {{else}}
- Welcome, {{:data.owner_name}} .
- Account balance: ${{:helper.smoothRound(data.money)}}
-
-
-
- Menu
- {{:helper.link('Change account security level', 'lock', {'choice' : 'view_screen', 'view_screen' : 1})}}
- {{:helper.link('Make transfer', 'exchange', {'choice' : 'view_screen', 'view_screen' : 2})}}
- {{:helper.link('View transaction log', 'list', {'choice' : 'view_screen', 'view_screen' : 3})}}
- {{:helper.link('Print balance statement', 'print', {'choice' : 'balance_statement'})}}
- {{:helper.link('Logout', 'sign-out', {'choice' : 'logout'})}}
- {{/if}}
-{{else data.linked_db}}
-
-{{else}}
- Unable to connect to accounts database, please retry and if the issue persists contact Nanotrasen IT support.
-{{/if}}
diff --git a/tgui/packages/tgui/interfaces/ATM.js b/tgui/packages/tgui/interfaces/ATM.js
index 0e15549f9fd..e6c5b95a27b 100644
--- a/tgui/packages/tgui/interfaces/ATM.js
+++ b/tgui/packages/tgui/interfaces/ATM.js
@@ -1,7 +1,6 @@
import { Fragment } from 'inferno';
import { useBackend, useLocalState } from '../backend';
-import { Button, Flex, Icon, Input, Divider, Box, LabeledList, Section } from '../components';
-import { FlexItem } from '../components/Flex';
+import { Button, Table, Icon, Input, Divider, Box, LabeledList, Section } from '../components';
import { Window } from '../layouts';
/*
@@ -20,40 +19,44 @@ export const ATM = (props, context) => {
linked_db,
} = data;
let body;
- if (ticks_left_locked_down > 0){
- body =
-
- Maximum number of pin attempts exceeded! Access to this ATM has been temporarily disabled.
-
- } else if (!linked_db){
- body =
-
- Unable to connect to accounts database, please retry and if the issue persists contact Nanotrasen IT support.
-
- } else if (authenticated_account){
- switch(view_screen){
+ if (ticks_left_locked_down > 0) {
+ body = (
+
+
+ Maximum number of pin attempts exceeded! Access to this ATM has been temporarily disabled.
+
+ );
+ } else if (!linked_db) {
+ body = (
+
+
+ Unable to connect to accounts database, please retry and if the issue persists contact Nanotrasen IT support.
+
+ );
+ } else if (authenticated_account) {
+ switch (view_screen) {
case 1: // CHANGE_SECURITY_LEVEL
- body =
+ body = ;
break;
case 2: // TRANSFER_FUNDS
- body =
+ body = ;
break;
case 3: // VIEW_TRANSACTION_LOGS
- body =
+ body = ;
break;
default:
- body =
+ body = ;
}
}
else {
body = ;
- }
+ }
return (
-
+
@@ -61,36 +64,141 @@ export const ATM = (props, context) => {
};
const IntroductionAndCard = (props, context) => {
- const {act, data } = useBackend(context);
+ const { act, data } = useBackend(context);
const {
machine_id,
held_card_name,
} = data;
- return (
- For all your monetary need!
-
-
-
- This terminal is {machine_id} , report this code when contacting Nanotrasen IT Support.
-
-
-
-
- act('insert_card')}
- />
-
-
-
+ return (
+
+ For all your monetary need!
+
+
+
+ This terminal is {machine_id} , report this code when contacting Nanotrasen IT Support.
+
+
+
+
+ act('insert_card')
+ }
+ />
+
+
+
+ );
+};
+
+const ChangeSecurityLevel = (props, context) => {
+ const { act, data } = useBackend(context);
+ const {
+ security_level,
+ } = data;
+ return (
+
+
+
+
+ act('change_security_level', { new_security_level: 0 })
+ }
+ />
+
+
+ Either the account number or card is required to access this account.
+ EFTPOS transactions will require a card and ask for a pin, but not verify the pin is correct.
+
+
+
+ act('change_security_level', { new_security_level: 1 })
+ }
+ />
+
+
+ An account number and pin must be manually entered to access this account and process transactions.
+
+
+
+ act('change_security_level', { new_security_level: 2 })
+ }
+ />
+
+
+ In addition to account number and pin, a card is required to access this account and process transactions.
+
+
+
+
+
+ );
+};
+
+const TransferFunds = (props, context) => {
+ const { act, data } = useBackend(context);
+ const [targetAccNumber, setTargetAccNumber] = useLocalState(context, "targetAccNumber", 0);
+ const [fundsAmount, setFundsAmount] = useLocalState(context, "fundsAmount", 0);
+ const [purpose, setPurpose] = useLocalState(context, "purpose", 0);
+ const {
+ money,
+ } = data;
+ return (
+
);
};
const DefaultScreen = (props, context) => {
- const {act, data } = useBackend(context);
- const [fundsAmount, setFundsAmount] = useLocalState(context, "fundsAmount", 0)
+ const { act, data } = useBackend(context);
+ const [fundsAmount, setFundsAmount] = useLocalState(context, "fundsAmount", 0);
const {
owner_name,
money,
@@ -99,12 +207,14 @@ const DefaultScreen = (props, context) => {
-
+
act('view_screen', {view_screen: 1})}
- />
+ content="Change account security level"
+ icon="lock"
+ onClick={
+ () => act('view_screen', { view_screen: 1 })
+ }
+ />
act('view_screen', {view_screen: 2})}
- />
+ content="Make transfer"
+ icon="exchange-alt"
+ onClick={
+ () => act('view_screen', { view_screen: 2 })
+ }
+ />
act('view_screen', {view_screen: 3})}
- />
+ content="View transaction log"
+ icon="list"
+ onClick={
+ () => act('view_screen', { view_screen: 3 })
+ }
+ />
act('balance_statement')}
- />
+ content="Print balance statement"
+ icon="print"
+ onClick={
+ () => act('balance_statement')
+ }
+ />
@@ -164,44 +278,102 @@ const DefaultScreen = (props, context) => {
};
const LoginScreen = (props, context) => {
- const {act, data } = useBackend(context);
- const [accountID, setAccountID] = useLocalState(context, "accountID", null)
- const [accountPin, setAccountPin] = useLocalState(context, "accountPin", null)
+ const { act, data } = useBackend(context);
+ const [accountID, setAccountID] = useLocalState(context, "accountID", null);
+ const [accountPin, setAccountPin] = useLocalState(context, "accountPin", null);
const {
machine_id,
held_card_name,
} = data;
return (
-
-
-
- Insert card or enter ID and pin to login
-
-
- setAccountID(value)}
- />
-
-
- setAccountPin(value)}
- />
-
-
- act('attempt_auth', {account_num: accountID, account_pin: accountPin})}
+
+
+