From 26aaf0c366450d3e2f8990c267473f42f38fe3b7 Mon Sep 17 00:00:00 2001 From: csrapr <26280794+csrapr@users.noreply.github.com> Date: Thu, 18 Feb 2021 16:27:11 +0000 Subject: [PATCH] Feat: cash cassettes footer skeleton --- .../src/components/editableTable/Table.js | 88 ++++++++++--------- .../src/pages/Maintenance/CashCassettes.js | 36 ++++---- .../pages/Maintenance/CashCassettes.styles.js | 9 +- .../pages/Maintenance/CashCassettesFooter.js | 55 ++++++++++++ .../Maintenance/CashCassettesFooter.styles.js | 24 +++++ 5 files changed, 152 insertions(+), 60 deletions(-) create mode 100644 new-lamassu-admin/src/pages/Maintenance/CashCassettesFooter.js create mode 100644 new-lamassu-admin/src/pages/Maintenance/CashCassettesFooter.styles.js diff --git a/new-lamassu-admin/src/components/editableTable/Table.js b/new-lamassu-admin/src/components/editableTable/Table.js index 8d7ee976..0e0d4af6 100644 --- a/new-lamassu-admin/src/components/editableTable/Table.js +++ b/new-lamassu-admin/src/components/editableTable/Table.js @@ -54,7 +54,8 @@ const ETable = ({ groupBy, sortBy, createText = 'Add override', - forceAdd = false + forceAdd = false, + tbodyWrapperClass }) => { const [editingId, setEditingId] = useState(null) const [adding, setAdding] = useState(false) @@ -180,57 +181,60 @@ const ETable = ({ )}
-
- {adding && ( - -
- - - -
- )} - {innerData.map((it, idx) => { - const nextElement = innerData[idx + 1] - - const canGroup = !!groupBy && nextElement - const isFunction = R.type(groupBy) === 'Function' - const groupFunction = isFunction ? groupBy : R.prop(groupBy) - - const isLastOfGroup = - canGroup && groupFunction(it) !== groupFunction(nextElement) - - return ( +
+
+ {adding && (
- +
- ) - })} - + )} + {innerData.map((it, idx) => { + const nextElement = innerData[idx + 1] + + const canGroup = !!groupBy && nextElement + const isFunction = R.type(groupBy) === 'Function' + const groupFunction = isFunction ? groupBy : R.prop(groupBy) + + const isLastOfGroup = + canGroup && + groupFunction(it) !== groupFunction(nextElement) + + return ( + +
+ + + +
+ ) + })} + +
)} diff --git a/new-lamassu-admin/src/pages/Maintenance/CashCassettes.js b/new-lamassu-admin/src/pages/Maintenance/CashCassettes.js index 532373ec..5059cc86 100644 --- a/new-lamassu-admin/src/pages/Maintenance/CashCassettes.js +++ b/new-lamassu-admin/src/pages/Maintenance/CashCassettes.js @@ -13,6 +13,7 @@ import { EmptyTable } from 'src/components/table' import { fromNamespace } from 'src/utils/config' import styles from './CashCassettes.styles.js' +import CashCassettesFooter from './CashCassettesFooter' const useStyles = makeStyles(styles) @@ -78,7 +79,6 @@ const CashCassettes = () => { const classes = useStyles() const { data } = useQuery(GET_MACHINES_AND_CONFIG) - const [setCassetteBills, { error }] = useMutation(SET_CASSETTE_BILLS, { refetchQueries: () => ['getData'] }) @@ -164,23 +164,27 @@ const CashCassettes = () => { ] return ( -
+ <> - +
+ - {data && R.isEmpty(machines) && ( - - )} -
+ {data && R.isEmpty(machines) && ( + + )} +
+ + ) } diff --git a/new-lamassu-admin/src/pages/Maintenance/CashCassettes.styles.js b/new-lamassu-admin/src/pages/Maintenance/CashCassettes.styles.js index c6ebdda7..71f4a901 100644 --- a/new-lamassu-admin/src/pages/Maintenance/CashCassettes.styles.js +++ b/new-lamassu-admin/src/pages/Maintenance/CashCassettes.styles.js @@ -3,7 +3,12 @@ export default { width: 80, height: 36 }, - pageBottomMargin: { - marginBottom: 180 + tableContainer: { + flex: 1, + marginBottom: 100 + }, + tBody: { + maxHeight: '65vh', + overflow: 'auto' } } diff --git a/new-lamassu-admin/src/pages/Maintenance/CashCassettesFooter.js b/new-lamassu-admin/src/pages/Maintenance/CashCassettesFooter.js new file mode 100644 index 00000000..0f17006e --- /dev/null +++ b/new-lamassu-admin/src/pages/Maintenance/CashCassettesFooter.js @@ -0,0 +1,55 @@ +import { makeStyles } from '@material-ui/core' +import React from 'react' + +import { Info1, Info2, Info3 } from 'src/components/typography/index' +import { ReactComponent as TxInIcon } from 'src/styling/icons/direction/cash-in.svg' +import { ReactComponent as TxOutIcon } from 'src/styling/icons/direction/cash-out.svg' + +import styles from './CashCassettesFooter.styles.js' +const useStyles = makeStyles(styles) + +const CashCassettesFooter = () => { + const classes = useStyles() + + return ( +
+
+ Cash value in System +
+ + + Cash-in: + + 123123123€ +
+
+ + + Cash-out: + + 123123123€ +
+
+ Total: + 123123123€ +
+
+
+ ) +} + +export default CashCassettesFooter diff --git a/new-lamassu-admin/src/pages/Maintenance/CashCassettesFooter.styles.js b/new-lamassu-admin/src/pages/Maintenance/CashCassettesFooter.styles.js new file mode 100644 index 00000000..2f8ec360 --- /dev/null +++ b/new-lamassu-admin/src/pages/Maintenance/CashCassettesFooter.styles.js @@ -0,0 +1,24 @@ +import { comet } from 'src/styling/variables' + +export default { + footerLabel: { + color: comet, + alignSelf: 'center' + }, + footerContent: { + width: 1200, + height: 64, + display: 'flex', + justifyContent: 'space-around' + }, + footerContainer: { + position: 'fixed', + bottom: 0, + left: 0, + right: 0, + height: 64, + backgroundColor: 'white', + display: 'flex', + justifyContent: 'space-around' + } +}