From c4666160ae2638f3c9a23661dedf65a2abf95bd1 Mon Sep 17 00:00:00 2001 From: csrapr <26280794+csrapr@users.noreply.github.com> Date: Fri, 19 Feb 2021 16:09:31 +0000 Subject: [PATCH] Fix: remove inline styles and comment out cashIn total calculations --- .../src/pages/Maintenance/CashCassettes.js | 16 ++-- .../pages/Maintenance/CashCassettesFooter.js | 88 ++++++++++--------- .../Maintenance/CashCassettesFooter.styles.js | 29 ++++-- 3 files changed, 80 insertions(+), 53 deletions(-) diff --git a/new-lamassu-admin/src/pages/Maintenance/CashCassettes.js b/new-lamassu-admin/src/pages/Maintenance/CashCassettes.js index 004bcd01..e411e5dc 100644 --- a/new-lamassu-admin/src/pages/Maintenance/CashCassettes.js +++ b/new-lamassu-admin/src/pages/Maintenance/CashCassettes.js @@ -49,15 +49,19 @@ const GET_MACHINES_AND_CONFIG = gql` cassette2 } config - bills { - fiat - deviceId - created - cashbox - } } ` +/* + // for cash in total calculation + bills { + fiat + deviceId + created + cashbox + } +*/ + const SET_CASSETTE_BILLS = gql` mutation MachineAction( $deviceId: ID! diff --git a/new-lamassu-admin/src/pages/Maintenance/CashCassettesFooter.js b/new-lamassu-admin/src/pages/Maintenance/CashCassettesFooter.js index 0784887d..27773a47 100644 --- a/new-lamassu-admin/src/pages/Maintenance/CashCassettesFooter.js +++ b/new-lamassu-admin/src/pages/Maintenance/CashCassettesFooter.js @@ -1,19 +1,27 @@ -/*eslint-disable*/ import { makeStyles } from '@material-ui/core' +// import BigNumber from 'bignumber.js' import * as R from 'ramda' import React from 'react' -import BigNumber from "bignumber.js" + import { Info1, Info2, Info3 } from 'src/components/typography/index' -import { ReactComponent as TxInIcon } from 'src/styling/icons/direction/cash-in.svg' +// 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 { fromNamespace } from 'src/utils/config' import styles from './CashCassettesFooter.styles.js' const useStyles = makeStyles(styles) -const sortDate = function(a, b) { return new Date(b.created).getTime() - new Date(a.created).getTime()} +/* const sortDate = function(a, b) { + return new Date(b.created).getTime() - new Date(a.created).getTime() +} */ -const CashCassettesFooter = ({ machines, config, currencyCode, bills, deviceIds }) => { +const CashCassettesFooter = ({ + machines, + config, + currencyCode, + bills, + deviceIds +}) => { const classes = useStyles() const cashout = config && fromNamespace('cashOut')(config) const getCashoutSettings = id => fromNamespace(id)(cashout) @@ -21,50 +29,46 @@ const CashCassettesFooter = ({ machines, config, currencyCode, bills, deviceIds (acc[0] += cassette1 * getCashoutSettings(id).top), (acc[1] += cassette2 * getCashoutSettings(id).bottom) ] - const totalInCassettes = R.sum(R.reduce(reducerFn, [0,0], machines)) - const totalInCashBox = R.sum(R.flatten(R.map(id => { - const sliceIdx = R.path([id, 0, 'cashbox'])(bills) ?? 0 - return R.map(R.prop('fiat'), R.slice(0, sliceIdx, R.sort(sortDate, bills[id] ?? []))) - }, deviceIds))) - const total = new BigNumber(totalInCassettes + totalInCashBox).toFormat(0) + const totalInCassettes = R.sum(R.reduce(reducerFn, [0, 0], machines)) + /* const totalInCashBox = R.sum( + R.flatten( + R.map(id => { + const sliceIdx = R.path([id, 0, 'cashbox'])(bills) ?? 0 + return R.map( + R.prop('fiat'), + R.slice(0, sliceIdx, R.sort(sortDate, bills[id] ?? [])) + ) + }, deviceIds) + ) + ) */ + + // const total = new BigNumber(totalInCassettes + totalInCashBox).toFormat(0) return (
Cash value in System -
- - - Cash-in: - - {totalInCashBox} {currencyCode} -
-
- - - Cash-out: - - {totalInCassettes} {currencyCode} -
-
- Total: - {total} {currencyCode} + {/*
+ + Cash-in: + + {totalInCashBox} {currencyCode} + +
*/} +
+ + Cash-out: + + {totalInCassettes} {currencyCode} +
+ {/*
+ Total: + + {total} {currencyCode} + +
*/}
) diff --git a/new-lamassu-admin/src/pages/Maintenance/CashCassettesFooter.styles.js b/new-lamassu-admin/src/pages/Maintenance/CashCassettesFooter.styles.js index 567f96c3..735f0d5e 100644 --- a/new-lamassu-admin/src/pages/Maintenance/CashCassettesFooter.styles.js +++ b/new-lamassu-admin/src/pages/Maintenance/CashCassettesFooter.styles.js @@ -7,19 +7,38 @@ export default { }, footerContent: { width: 1200, - height: 64, + maxHeight: 64, display: 'flex', - justifyContent: 'space-around' + justifyContent: 'space-around', + position: 'fixed' }, footerContainer: { position: 'fixed', - bottom: 0, - left: 0, - right: 0, height: 64, + left: 0, + bottom: 0, + width: '100vw', backgroundColor: 'white', display: 'flex', justifyContent: 'space-around', boxShadow: [[0, -1, 10, 0, 'rgba(50, 50, 50, 0.1)']] + }, + flex: { + display: 'flex', + // temp marginLeft until cashIn square is enabled + marginLeft: -640 + }, + icon: { + alignSelf: 'center', + height: 20, + width: 20, + marginRight: 8 + }, + iconLabel: { + alignSelf: 'center', + marginRight: 8 + }, + valueDisplay: { + alignSelf: 'center' } }