feat: cashbox on overrides
This commit is contained in:
parent
b3b7c6f61a
commit
e3dc1ef4fd
2 changed files with 27 additions and 2 deletions
|
|
@ -93,7 +93,7 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
|
||||||
<Form className={classes.form}>
|
<Form className={classes.form}>
|
||||||
<PromptWhenDirty />
|
<PromptWhenDirty />
|
||||||
<Header
|
<Header
|
||||||
title="Cash box (Full)"
|
title="Cash box"
|
||||||
editing={isEditing(CASH_IN_KEY)}
|
editing={isEditing(CASH_IN_KEY)}
|
||||||
disabled={isDisabled(CASH_IN_KEY)}
|
disabled={isDisabled(CASH_IN_KEY)}
|
||||||
setEditing={it => setEditing(CASH_IN_KEY, it)}
|
setEditing={it => setEditing(CASH_IN_KEY, it)}
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,14 @@ import { transformNumber } from 'src/utils/number'
|
||||||
|
|
||||||
import NotificationsCtx from '../NotificationsContext'
|
import NotificationsCtx from '../NotificationsContext'
|
||||||
|
|
||||||
|
const CASHBOX_KEY = 'cashbox'
|
||||||
const CASSETTE_1_KEY = 'fillingPercentageCassette1'
|
const CASSETTE_1_KEY = 'fillingPercentageCassette1'
|
||||||
const CASSETTE_2_KEY = 'fillingPercentageCassette2'
|
const CASSETTE_2_KEY = 'fillingPercentageCassette2'
|
||||||
const CASSETTE_3_KEY = 'fillingPercentageCassette3'
|
const CASSETTE_3_KEY = 'fillingPercentageCassette3'
|
||||||
const CASSETTE_4_KEY = 'fillingPercentageCassette4'
|
const CASSETTE_4_KEY = 'fillingPercentageCassette4'
|
||||||
const MACHINE_KEY = 'machine'
|
const MACHINE_KEY = 'machine'
|
||||||
const NAME = 'fiatBalanceOverrides'
|
const NAME = 'fiatBalanceOverrides'
|
||||||
|
const DEFAULT_NUMBER_OF_CASSETTES = 2
|
||||||
|
|
||||||
const CASSETTE_LIST = [
|
const CASSETTE_LIST = [
|
||||||
CASSETTE_1_KEY,
|
CASSETTE_1_KEY,
|
||||||
|
|
@ -60,15 +62,19 @@ const FiatBalanceOverrides = ({ config, section }) => {
|
||||||
|
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
[MACHINE_KEY]: null,
|
[MACHINE_KEY]: null,
|
||||||
|
[CASHBOX_KEY]: '',
|
||||||
[CASSETTE_1_KEY]: '',
|
[CASSETTE_1_KEY]: '',
|
||||||
[CASSETTE_2_KEY]: '',
|
[CASSETTE_2_KEY]: '',
|
||||||
[CASSETTE_3_KEY]: '',
|
[CASSETTE_3_KEY]: '',
|
||||||
[CASSETTE_4_KEY]: ''
|
[CASSETTE_4_KEY]: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const notesMin = 0
|
||||||
|
const notesMax = 9999999
|
||||||
|
|
||||||
const maxNumberOfCassettes = Math.max(
|
const maxNumberOfCassettes = Math.max(
|
||||||
...R.map(it => it.numberOfCassettes, machines),
|
...R.map(it => it.numberOfCassettes, machines),
|
||||||
2
|
DEFAULT_NUMBER_OF_CASSETTES
|
||||||
)
|
)
|
||||||
|
|
||||||
const percentMin = 0
|
const percentMin = 0
|
||||||
|
|
@ -79,6 +85,13 @@ const FiatBalanceOverrides = ({ config, section }) => {
|
||||||
.label('Machine')
|
.label('Machine')
|
||||||
.nullable()
|
.nullable()
|
||||||
.required(),
|
.required(),
|
||||||
|
[CASHBOX_KEY]: Yup.number()
|
||||||
|
.label('Cash box')
|
||||||
|
.transform(transformNumber)
|
||||||
|
.integer()
|
||||||
|
.min(notesMin)
|
||||||
|
.max(notesMax)
|
||||||
|
.nullable(),
|
||||||
[CASSETTE_1_KEY]: Yup.number()
|
[CASSETTE_1_KEY]: Yup.number()
|
||||||
.label('Cassette 1')
|
.label('Cassette 1')
|
||||||
.transform(transformNumber)
|
.transform(transformNumber)
|
||||||
|
|
@ -134,6 +147,18 @@ const FiatBalanceOverrides = ({ config, section }) => {
|
||||||
valueProp: 'deviceId',
|
valueProp: 'deviceId',
|
||||||
labelProp: 'name'
|
labelProp: 'name'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: CASHBOX_KEY,
|
||||||
|
display: 'Cashbox',
|
||||||
|
width: 155,
|
||||||
|
textAlign: 'right',
|
||||||
|
bold: true,
|
||||||
|
input: NumberInput,
|
||||||
|
suffix: 'notes',
|
||||||
|
inputProps: {
|
||||||
|
decimalPlaces: 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue