fix: cashout screen column widths

This commit is contained in:
Sérgio Salgado 2023-05-31 10:55:39 +01:00
parent ab4fa10fb3
commit a8c2a2c252
2 changed files with 13 additions and 16 deletions

View file

@ -122,9 +122,9 @@ const CashOut = ({ name: SCREEN_KEY }) => {
data={config} data={config}
stripeWhen={wasNeverEnabled} stripeWhen={wasNeverEnabled}
enableEdit enableEdit
editWidth={134} editWidth={95}
enableToggle enableToggle
toggleWidth={109} toggleWidth={100}
onToggle={onToggle} onToggle={onToggle}
save={save} save={save}
error={error?.message} error={error?.message}

View file

@ -8,13 +8,13 @@ import { getBillOptions } from 'src/utils/bill-options'
import { CURRENCY_MAX } from 'src/utils/constants' import { CURRENCY_MAX } from 'src/utils/constants'
import { transformNumber } from 'src/utils/number' import { transformNumber } from 'src/utils/number'
const widthsByNumberOfCassettes = { const widthsByNumberOfUnits = {
2: { machine: 320, cassette: 315 }, 2: { machine: 325, cassette: 340 },
3: { machine: 305, cassette: 215 }, 3: { machine: 300, cassette: 235 },
4: { machine: 195, cassette: 190 }, 4: { machine: 205, cassette: 200 },
5: { machine: 175, cassette: 155 }, 5: { machine: 180, cassette: 165 },
6: { machine: 170, cassette: 130 }, 6: { machine: 165, cassette: 140 },
7: { machine: 140, cassette: 125 } 7: { machine: 130, cassette: 125 }
} }
const DenominationsSchema = Yup.object().shape({ const DenominationsSchema = Yup.object().shape({
@ -89,10 +89,7 @@ const getElements = (machines, locale = {}, classes) => {
...R.map(it => it.numberOfStackers, machines), ...R.map(it => it.numberOfStackers, machines),
0 0
) )
const maxNumberOfCashUnits = Math.max( const numberOfCashUnits = maxNumberOfCassettes + maxNumberOfStackers
...R.map(it => it.numberOfCassettes + it.numberOfStackers, machines),
0
)
const options = getBillOptions(locale, denominations) const options = getBillOptions(locale, denominations)
const cassetteProps = const cassetteProps =
@ -109,7 +106,7 @@ const getElements = (machines, locale = {}, classes) => {
{ {
name: 'id', name: 'id',
header: 'Machine', header: 'Machine',
width: widthsByNumberOfCassettes[maxNumberOfCashUnits]?.machine, width: widthsByNumberOfUnits[numberOfCashUnits]?.machine,
view: it => machines.find(({ deviceId }) => deviceId === it).name, view: it => machines.find(({ deviceId }) => deviceId === it).name,
size: 'sm', size: 'sm',
editable: false editable: false
@ -125,7 +122,7 @@ const getElements = (machines, locale = {}, classes) => {
size: 'sm', size: 'sm',
stripe: true, stripe: true,
textAlign: 'right', textAlign: 'right',
width: widthsByNumberOfCassettes[maxNumberOfCashUnits]?.cassette, width: widthsByNumberOfUnits[numberOfCashUnits]?.cassette,
suffix: fiatCurrency, suffix: fiatCurrency,
bold: bold, bold: bold,
view: it => it, view: it => it,
@ -151,7 +148,7 @@ const getElements = (machines, locale = {}, classes) => {
size: 'sm', size: 'sm',
stripe: true, stripe: true,
textAlign: 'right', textAlign: 'right',
width: widthsByNumberOfCassettes[maxNumberOfCashUnits]?.cassette, width: widthsByNumberOfUnits[numberOfCashUnits]?.cassette,
prefix: it => (R.last(it) === 'f' ? 'F' : 'R'), prefix: it => (R.last(it) === 'f' ? 'F' : 'R'),
suffix: fiatCurrency, suffix: fiatCurrency,
bold: bold, bold: bold,