fix: field headers
This commit is contained in:
parent
46516c16b8
commit
2297f98246
1 changed files with 15 additions and 15 deletions
|
|
@ -45,10 +45,11 @@ const FiatBalanceOverrides = ({ config, section }) => {
|
||||||
const innerSetEditing = it => setEditing(NAME, it)
|
const innerSetEditing = it => setEditing(NAME, it)
|
||||||
|
|
||||||
const overriddenMachines = R.map(override => override.machine, setupValues)
|
const overriddenMachines = R.map(override => override.machine, setupValues)
|
||||||
const suggestionFilter = R.filter(
|
const suggestions = R.differenceWith(
|
||||||
it => !R.includes(it.deviceId, overriddenMachines)
|
(it, m) => it.deviceId === m,
|
||||||
|
machines,
|
||||||
|
overriddenMachines
|
||||||
)
|
)
|
||||||
const suggestions = suggestionFilter(machines)
|
|
||||||
|
|
||||||
const findSuggestion = it => {
|
const findSuggestion = it => {
|
||||||
const coin = R.find(R.propEq('deviceId', it?.machine), machines)
|
const coin = R.find(R.propEq('deviceId', it?.machine), machines)
|
||||||
|
|
@ -78,7 +79,6 @@ const FiatBalanceOverrides = ({ config, section }) => {
|
||||||
.shape({
|
.shape({
|
||||||
[MACHINE_KEY]: Yup.string()
|
[MACHINE_KEY]: Yup.string()
|
||||||
.label('Machine')
|
.label('Machine')
|
||||||
.nullable()
|
|
||||||
.required(),
|
.required(),
|
||||||
[CASHBOX_KEY]: Yup.number()
|
[CASHBOX_KEY]: Yup.number()
|
||||||
.label('Cash box')
|
.label('Cash box')
|
||||||
|
|
@ -116,16 +116,15 @@ const FiatBalanceOverrides = ({ config, section }) => {
|
||||||
.max(percentMax)
|
.max(percentMax)
|
||||||
.nullable()
|
.nullable()
|
||||||
})
|
})
|
||||||
.test((values, context) => {
|
.test((values, context) =>
|
||||||
const picked = R.pick(CASSETTE_LIST, values)
|
R.any(key => !R.isNil(values[key]), R.prepend(CASHBOX_KEY, CASSETTE_LIST))
|
||||||
|
? undefined
|
||||||
if (CASSETTE_LIST.some(it => !R.isNil(picked[it]))) return
|
: context.createError({
|
||||||
|
path: CASHBOX_KEY,
|
||||||
return context.createError({
|
message:
|
||||||
path: CASSETTE_1_KEY,
|
'The cash box or at least one of the cassettes must have a value'
|
||||||
message: 'At least one of the cassettes must have a value'
|
})
|
||||||
})
|
)
|
||||||
})
|
|
||||||
|
|
||||||
const viewMachine = it =>
|
const viewMachine = it =>
|
||||||
R.compose(R.path(['name']), R.find(R.propEq('deviceId', it)))(machines)
|
R.compose(R.path(['name']), R.find(R.propEq('deviceId', it)))(machines)
|
||||||
|
|
@ -134,6 +133,7 @@ const FiatBalanceOverrides = ({ config, section }) => {
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
name: MACHINE_KEY,
|
name: MACHINE_KEY,
|
||||||
|
display: 'Machine',
|
||||||
width: widthsByNumberOfCassettes[maxNumberOfCassettes].machine,
|
width: widthsByNumberOfCassettes[maxNumberOfCassettes].machine,
|
||||||
size: 'sm',
|
size: 'sm',
|
||||||
view: viewMachine,
|
view: viewMachine,
|
||||||
|
|
@ -146,7 +146,7 @@ const FiatBalanceOverrides = ({ config, section }) => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: CASHBOX_KEY,
|
name: CASHBOX_KEY,
|
||||||
display: 'Cashbox',
|
display: 'Cash box',
|
||||||
width: 155,
|
width: 155,
|
||||||
textAlign: 'right',
|
textAlign: 'right',
|
||||||
bold: true,
|
bold: true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue