feat: add support for more than two cassettes

This commit is contained in:
Sérgio Salgado 2021-09-01 00:54:51 +01:00
parent 478af0fad0
commit 5788b6216d
13 changed files with 279 additions and 50 deletions

View file

@ -11,7 +11,7 @@ import WizardSplash from './WizardSplash'
import WizardStep from './WizardStep'
import { DenominationsSchema } from './helper'
const LAST_STEP = 4
const LAST_STEP = 6
const MODAL_WIDTH = 554
const MODAL_HEIGHT = 520
@ -52,8 +52,8 @@ const Wizard = ({ machine, locale, onClose, save, error }) => {
const steps = [
{
type: 'top',
display: 'Cassette 1 (Top)',
type: 'cassette1',
display: 'Cassette 1',
component: Autocomplete,
inputProps: {
options: R.map(it => ({ code: it, display: it }))(options),
@ -62,7 +62,7 @@ const Wizard = ({ machine, locale, onClose, save, error }) => {
}
},
{
type: 'bottom',
type: 'cassette2',
display: 'Cassette 2',
component: Autocomplete,
inputProps: {
@ -71,6 +71,26 @@ const Wizard = ({ machine, locale, onClose, save, error }) => {
valueProp: 'code'
}
},
{
type: 'cassette3',
display: 'Cassette 3',
component: Autocomplete,
inputProps: {
options: R.map(it => ({ code: it, display: it }))(options),
labelProp: 'display',
valueProp: 'code'
}
},
{
type: 'cassette4',
display: 'Cassette 4',
component: Autocomplete,
inputProps: {
options: R.map(it => ({ code: it, display: it }))(options),
labelProp: 'display',
valueProp: 'code'
}
},
{
type: 'zeroConfLimit',
display: '0-conf Limit',
@ -82,8 +102,10 @@ const Wizard = ({ machine, locale, onClose, save, error }) => {
const schema = () =>
Yup.object().shape({
top: Yup.number().required(),
bottom: step >= 2 ? Yup.number().required() : Yup.number()
cassette1: Yup.number().required(),
cassette2: step >= 2 ? Yup.number().required() : Yup.number(),
cassette3: step >= 3 ? Yup.number().required() : Yup.number(),
cassette4: step >= 4 ? Yup.number().required() : Yup.number()
})
return (