@@ -99,6 +99,7 @@ const DataTable = ({
data = [],
Details,
className,
+ tableClassName,
expandable,
initialExpanded,
onClick,
@@ -169,7 +170,7 @@ const DataTable = ({
return (
-
+
{elements.map(({ width, className, textAlign, header }, idx) => (
{
const classes = useStyles()
@@ -121,89 +53,14 @@ const CashCassettes = ({ machine, config, refetchData, bills }) => {
const cashout = config && fromNamespace('cashOut')(config)
const locale = config && fromNamespace('locale')(config)
- const fillingPercentageSettings =
- config && fromNamespace('notifications', config)
const fiatCurrency = locale?.fiatCurrency
- const numberOfCassettes = machine.numberOfCassettes
const getCashoutSettings = deviceId => fromNamespace(deviceId)(cashout)
- const isCashOutDisabled = ({ deviceId }) =>
- !getCashoutSettings(deviceId).active
- const elements = [
- {
- name: 'cashbox',
- header: 'Cash box',
- width: widthsByNumberOfCassettes[numberOfCassettes].cashbox,
- stripe: false,
- view: value => (
- it.fiat)(bills))}
- />
- ),
- input: NumberInput,
- inputProps: {
- decimalPlaces: 0
- }
- }
- ]
-
- R.until(
- R.gt(R.__, numberOfCassettes),
- it => {
- elements.push({
- name: `cassette${it}`,
- header: `Cash cassette ${it}`,
- width: widthsByNumberOfCassettes[numberOfCassettes].cassette,
- stripe: true,
- doubleHeader: 'Cash-out',
- view: value => {
- return (
-
- )
- },
- isHidden: ({ numberOfCassettes }) => it > numberOfCassettes,
- input: CashCassetteInput,
- inputProps: {
- decimalPlaces: 0,
- width: widthsByNumberOfCassettes[numberOfCassettes].cassetteGraph,
- inputClassName: classes.cashbox
- }
- })
- return R.add(1, it)
- },
- 1
+ const elements = R.filter(it => it.name !== 'name')(
+ helper.getElements(classes, config, bills, setWizard, widths)
)
- elements.push({
- name: 'edit',
- header: 'Edit',
- width: widthsByNumberOfCassettes[numberOfCassettes].editWidth,
- view: () => {
- return (
- {
- setWizard(true)
- }}>
-
-
- )
- }
- })
-
const [setCassetteBills, { error }] = useMutation(SET_CASSETTE_BILLS, {
refetchQueries: () => refetchData()
})
@@ -218,18 +75,26 @@ const CashCassettes = ({ machine, config, refetchData, bills }) => {
}
})
+ const InnerCashUnitDetails = ({ it }) => (
+
+ )
+
return machine.name ? (
<>
-
{wizard && (
*': {
+ marginRight: 30
+ },
+ '& > *:last-child': {
+ marginRight: 0
+ }
+ },
+ units: {
+ display: 'flex',
+ flexDirection: 'row',
+ '& > *': {
+ marginRight: 10
+ },
+ '& > *:last-child': {
+ marginRight: 0
+ }
+ },
+ verticalLine: {
+ height: '100%',
+ width: 1,
+ backgroundColor: offDarkColor
+ },
+ dataTable: {
+ minHeight: 290
}
}
diff --git a/new-lamassu-admin/src/pages/Maintenance/CashUnitDetails.js b/new-lamassu-admin/src/pages/Maintenance/CashUnitDetails.js
index 6bd69372..3aea6984 100644
--- a/new-lamassu-admin/src/pages/Maintenance/CashUnitDetails.js
+++ b/new-lamassu-admin/src/pages/Maintenance/CashUnitDetails.js
@@ -36,10 +36,10 @@ const styles = {
flexDirection: 'column',
minWidth: 210
},
- billList: {
+ billList: ({ hideMachineData }) => ({
display: 'flex',
flexDirection: 'column',
- minWidth: 160,
+ minWidth: hideMachineData ? 80 : 160,
'& > span': {
display: 'flex',
flexDirection: 'row',
@@ -48,7 +48,7 @@ const styles = {
minWidth: 30
}
}
- },
+ }),
unitList: {
display: 'flex',
flexDirection: 'row',
@@ -82,8 +82,14 @@ const styles = {
const useStyles = makeStyles(styles)
-const CashUnitDetails = ({ machine, bills, currency, config }) => {
- const classes = useStyles()
+const CashUnitDetails = ({
+ machine,
+ bills,
+ currency,
+ config,
+ hideMachineData = false
+}) => {
+ const classes = useStyles({ hideMachineData })
const billCount = R.countBy(it => it.fiat)(bills)
const fillingPercentageSettings = fromNamespace('notifications', config)
const cashout = fromNamespace('cashOut')(config)
@@ -91,10 +97,12 @@ const CashUnitDetails = ({ machine, bills, currency, config }) => {
return (
-
- Machine Model
- {modelPrettifier[machine.model]}
-
+ {!hideMachineData && (
+
+ Machine Model
+ {modelPrettifier[machine.model]}
+
+ )}
Cash box
{R.isEmpty(billCount) && Empty}
diff --git a/new-lamassu-admin/src/pages/Maintenance/CashUnits.js b/new-lamassu-admin/src/pages/Maintenance/CashUnits.js
index 212af940..2572476a 100644
--- a/new-lamassu-admin/src/pages/Maintenance/CashUnits.js
+++ b/new-lamassu-admin/src/pages/Maintenance/CashUnits.js
@@ -101,6 +101,13 @@ const GET_BATCHES_CSV = gql`
}
`
+const widths = {
+ name: 250,
+ cashbox: 200,
+ cassettes: 575,
+ edit: 90
+}
+
const CashCassettes = () => {
const classes = useStyles()
const [showHistory, setShowHistory] = useState(false)
@@ -176,12 +183,12 @@ const CashCassettes = () => {
}
const elements = helper.getElements(
- machines,
classes,
config,
bills,
- setMachineId,
- setWizard
+ setWizard,
+ widths,
+ setMachineId
)
const InnerCashUnitDetails = ({ it }) => (
diff --git a/new-lamassu-admin/src/pages/Maintenance/helper.js b/new-lamassu-admin/src/pages/Maintenance/helper.js
index c37769be..fa3c1e0e 100644
--- a/new-lamassu-admin/src/pages/Maintenance/helper.js
+++ b/new-lamassu-admin/src/pages/Maintenance/helper.js
@@ -7,12 +7,12 @@ import { fromNamespace } from 'src/utils/config'
import { cashUnitCapacity } from 'src/utils/machine'
const getElements = (
- machines,
classes,
config,
bills,
- setMachineId,
- setWizard
+ setWizard,
+ widths,
+ setMachineId
) => {
const fillingPercentageSettings = fromNamespace('notifications', config)
const locale = fromNamespace('locale')(config)
@@ -25,14 +25,14 @@ const getElements = (
{
name: 'name',
header: 'Machine',
- width: 250,
+ width: widths.name,
view: m => <>{m.name}>,
input: ({ field: { value: name } }) => <>{name}>
},
{
name: 'cashbox',
header: 'Cashbox',
- width: 200,
+ width: widths.cashbox,
view: m => (
{
return (
@@ -112,13 +112,13 @@ const getElements = (
{
name: 'edit',
header: 'Edit',
- width: 90,
+ width: widths.edit,
textAlign: 'center',
view: m => {
return (
{
- setMachineId(m.id)
+ !R.isNil(setMachineId) && setMachineId(m.id)
setWizard(true)
}}>
| |