fix: fiat balance notification recycler label

This commit is contained in:
Rafael Taranto 2025-06-30 07:17:41 +01:00
parent 4b9d101233
commit 15e4cba0dc
2 changed files with 86 additions and 79 deletions

View file

@ -149,73 +149,78 @@ const FiatBalance = ({ section, fieldWidth = 80 }) => {
)} )}
</div> </div>
</Form> </Form>
<Form> {maxNumberOfRecyclers > 0 && (
<PromptWhenDirty /> <Form>
<Header <PromptWhenDirty />
title="Cash recycling" <Header
editing={isEditing(RECYCLER_STACKER_KEY)} title="Cash recycling"
disabled={isDisabled(RECYCLER_STACKER_KEY)} editing={isEditing(RECYCLER_STACKER_KEY)}
setEditing={it => setEditing(RECYCLER_STACKER_KEY, it)} disabled={isDisabled(RECYCLER_STACKER_KEY)}
/> setEditing={it => setEditing(RECYCLER_STACKER_KEY, it)}
<div className="flex flex-wrap gap-8"> />
{R.chain( <div className="flex flex-wrap gap-8">
it => [ {R.chain(
<> it => [
<div className="flex w-50 gap-4"> <>
<Cashbox <div className="flex w-50 gap-4">
percent={ <Cashbox
values[ percent={
`fillingPercentageRecycler${(it + 1) * 2 - 1}` values[
] ?? data[`recycler${(it + 1) * 2 - 1}`] `fillingPercentageRecycler${(it + 1) * 2 - 1}`
} ] ?? data[`recycler${(it + 1) * 2 - 1}`]
isLow={false} }
className="border-4 inline-block" isLow={false}
omitInnerPercentage className="border-4 inline-block"
cashOut omitInnerPercentage
/> cashOut
<div className="w-30">
<TL2 className="mt-0">Recycler {(it + 1) * 2 - 1}</TL2>
<EditableNumber
label="Alert me under"
name={`fillingPercentageRecycler${(it + 1) * 2 - 1}`}
editing={isEditing(RECYCLER_STACKER_KEY)}
displayValue={x => (x === '' ? '-' : x)}
decoration="%"
width={fieldWidth}
/> />
<div className="w-30">
<TL2 className="mt-0">
Recycler {(it + 1) * 2 - 1}
</TL2>
<EditableNumber
label="Alert me under"
name={`fillingPercentageRecycler${(it + 1) * 2 - 1}`}
editing={isEditing(RECYCLER_STACKER_KEY)}
displayValue={x => (x === '' ? '-' : x)}
decoration="%"
width={fieldWidth}
/>
</div>
</div> </div>
</div> </>,
</>, <>
<> <div className="flex w-50 gap-4">
<div className="flex w-50 gap-4"> <Cashbox
<Cashbox percent={
percent={ values[
values[`fillingPercentageRecycler${(it + 1) * 2}`] ?? `fillingPercentageRecycler${(it + 1) * 2}`
data[`recycler${(it + 1) * 2}`] ] ?? data[`recycler${(it + 1) * 2}`]
} }
isLow={false} isLow={false}
className="border-4 inline-block" className="border-4 inline-block"
omitInnerPercentage omitInnerPercentage
cashOut cashOut
/>
<div className="w-30">
<TL2 className="mt-0">Recycler {(it + 1) * 2}</TL2>
<EditableNumber
label="Alert me under"
name={`fillingPercentageRecycler${(it + 1) * 2}`}
editing={isEditing(RECYCLER_STACKER_KEY)}
displayValue={x => (x === '' ? '-' : x)}
decoration="%"
width={fieldWidth}
/> />
<div className="w-30">
<TL2 className="mt-0">Recycler {(it + 1) * 2}</TL2>
<EditableNumber
label="Alert me under"
name={`fillingPercentageRecycler${(it + 1) * 2}`}
editing={isEditing(RECYCLER_STACKER_KEY)}
displayValue={x => (x === '' ? '-' : x)}
decoration="%"
width={fieldWidth}
/>
</div>
</div> </div>
</div> </>,
</>, ],
], R.times(R.identity, maxNumberOfRecyclers / 2),
R.times(R.identity, maxNumberOfRecyclers / 2), )}
)} </div>
</div> </Form>
</Form> )}
</div> </div>
)} )}
</Formik> </Formik>

View file

@ -185,22 +185,24 @@ const FiatBalanceOverrides = ({ config, section }) => {
) )
return ( return (
<EditableTable <div className="mt-4">
name={NAME} <EditableTable
title="Overrides" name={NAME}
error={error?.message} title="Overrides"
enableDelete error={error?.message}
enableEdit enableDelete
enableCreate enableEdit
save={it => save(section, validationSchema.cast(it))} enableCreate
initialValues={initialValues} save={it => save(section, validationSchema.cast(it))}
validationSchema={validationSchema} initialValues={initialValues}
forceDisable={isDisabled(NAME) || !machines} validationSchema={validationSchema}
data={setupValues} forceDisable={isDisabled(NAME) || !machines}
elements={elements} data={setupValues}
disableAdd={!suggestions?.length} elements={elements}
setEditing={innerSetEditing} disableAdd={!suggestions?.length}
/> setEditing={innerSetEditing}
/>
</div>
) )
} }