diff --git a/new-lamassu-admin/src/pages/Accounting/Accounting.js b/new-lamassu-admin/src/pages/Accounting/Accounting.js new file mode 100644 index 00000000..86d5a539 --- /dev/null +++ b/new-lamassu-admin/src/pages/Accounting/Accounting.js @@ -0,0 +1,167 @@ +import { makeStyles } from '@material-ui/core/styles' +import moment from 'moment' +import React from 'react' + +import { Tooltip } from 'src/components/Tooltip' +import TitleSection from 'src/components/layout/TitleSection' +import DataTable from 'src/components/tables/DataTable' +import { H4, Info2, P } from 'src/components/typography' + +import styles from './Accounting.styles' + +const mockData = [ + { + operation: 'Hedging summary', + direction: 'in', + extraInfo: 'This is mocked information', + amount: 486, + currency: 'USD', + balanceAfterTx: 10438, + date: '2021-02-22T20:16:12.020Z' + }, + { + operation: 'Funding transaction', + direction: 'in', + amount: 2000, + currency: 'USD', + balanceAfterTx: 9952, + date: '2021-02-22T12:40:32.020Z' + }, + { + operation: 'ZEC hot wallet top up', + direction: 'out', + amount: 1000, + currency: 'USD', + balanceAfterTx: 7952, + date: '2021-02-21T16:30:44.020Z' + }, + { + operation: 'Funding transaction', + direction: 'in', + amount: 8000, + currency: 'USD', + balanceAfterTx: 8952, + date: '2021-02-21T08:16:20.020Z' + } +] + +const useStyles = makeStyles(styles) + +const Assets = ({ balance, hedgingReserve, currency }) => { + const classes = useStyles() + + return ( +
+
+

Pazuz fiat balance

+
+ + {balance.toLocaleString('en-US', { maximumFractionDigits: 2 })} + + + {currency} + +
+
+ - +
+

Hedging reserve

+
+ + {hedgingReserve.toLocaleString('en-US', { + maximumFractionDigits: 2 + })} + + + {currency} + +
+
+ = +
+

Available balance

+
+ + {(balance - hedgingReserve).toLocaleString('en-US', { + maximumFractionDigits: 2 + })} + + + {currency} + +
+
+
+ ) +} + +const Accounting = () => { + const classes = useStyles() + + const elements = [ + { + header: 'Operation', + width: 500, + size: 'sm', + textAlign: 'left', + view: it => { + return ( + + {it.operation} + {!!it.extraInfo && ( + +

{it.extraInfo}

+
+ )} +
+ ) + } + }, + { + header: 'Amount', + width: 147, + size: 'sm', + textAlign: 'right', + view: it => + `${it.direction === 'in' ? it.amount : -it.amount} ${it.currency}` + }, + { + header: 'Balance after operation', + width: 250, + size: 'sm', + textAlign: 'right', + view: it => `${it.balanceAfterTx} ${it.currency}` + }, + { + header: 'Date', + width: 150, + size: 'sm', + textAlign: 'right', + view: it => moment.utc(it.created).format('YYYY-MM-DD') + }, + { + header: 'Time', + width: 150, + size: 'sm', + textAlign: 'right', + view: it => moment.utc(it.created).format('HH:mm:ss') + } + ] + + return ( + <> + + +

Fiat balance history

+ + + ) +} + +export default Accounting diff --git a/new-lamassu-admin/src/pages/Accounting/Accounting.styles.js b/new-lamassu-admin/src/pages/Accounting/Accounting.styles.js new file mode 100644 index 00000000..e62a1c85 --- /dev/null +++ b/new-lamassu-admin/src/pages/Accounting/Accounting.styles.js @@ -0,0 +1,39 @@ +import { offColor } from 'src/styling/variables' + +const styles = () => ({ + totalAssetWrapper: { + display: 'flex', + flexDirection: 'row' + }, + totalAssetFieldWrapper: { + display: 'flex', + flexDirection: 'column' + }, + fieldHeader: { + color: offColor, + marginBottom: 5 + }, + fieldValue: { + fontSize: 36 + }, + fieldCurrency: { + fontSize: 20, + alignSelf: 'flex-end', + margin: [[0, 0, 5, 5]] + }, + separator: { + fontSize: 32, + alignSelf: 'center', + margin: [[25, 20, 0, 20]] + }, + tableTitle: { + marginTop: 35 + }, + operation: { + display: 'flex', + flexDirection: 'row', + alignItems: 'center' + } +}) + +export default styles diff --git a/new-lamassu-admin/src/routing/pazuz.routes.js b/new-lamassu-admin/src/routing/pazuz.routes.js index 28b575e6..506b745d 100644 --- a/new-lamassu-admin/src/routing/pazuz.routes.js +++ b/new-lamassu-admin/src/routing/pazuz.routes.js @@ -2,6 +2,7 @@ import React from 'react' import { Redirect } from 'react-router-dom' import ATMWallet from 'src/pages/ATMWallet/ATMWallet' +import Accounting from 'src/pages/Accounting/Accounting' import Blacklist from 'src/pages/Blacklist' import Cashout from 'src/pages/Cashout' import Commissions from 'src/pages/Commissions' @@ -228,6 +229,13 @@ const getPazuzRoutes = () => [ return () => }, children: [ + { + key: 'accountingpage', + label: 'Accounting', + route: '/accounting/accounting', + allowedRoles: [ROLES.USER, ROLES.SUPERUSER], + component: Accounting + }, { key: 'atmwallets', label: 'ATM Wallets',