import { makeStyles } from '@material-ui/core' import classnames from 'classnames' import { Formik, Form, Field } from 'formik' import * as R from 'ramda' import React from 'react' import Stepper from 'src/components/Stepper' import { Tooltip } from 'src/components/Tooltip' import { Button } from 'src/components/buttons' import { Cashbox } from 'src/components/inputs/cashbox/Cashbox' import { NumberInput, RadioGroup } from 'src/components/inputs/formik' import { Info2, H4, P, Info1 } from 'src/components/typography' import cashbox from 'src/styling/icons/cassettes/acceptor-left.svg' import cassetteOne from 'src/styling/icons/cassettes/dispenser-1.svg' import cassetteTwo from 'src/styling/icons/cassettes/dispenser-2.svg' import { ReactComponent as TxOutIcon } from 'src/styling/icons/direction/cash-out.svg' import { comet, errorColor } from 'src/styling/variables' const styles = { content: { display: 'flex', flexDirection: 'column', justifyContent: 'space-between', flex: 1, paddingBottom: 32 }, titleDiv: { marginBottom: 32 }, title: { margin: [[0, 0, 12, 0]], color: comet }, stepImage: { width: 148, height: 196 }, form: { paddingBottom: 95 }, verticalAlign: { display: 'flex', flexDirection: 'column' }, horizontalAlign: { display: 'flex', flexDirection: 'row' }, centerAlignment: { alignItems: 'center' }, lineAlignment: { alignItems: 'baseline' }, fullWidth: { margin: [[0, 'auto']], flexBasis: 'auto' }, formWrapper: { flexBasis: '100%', display: 'flex', justifyContent: 'center' }, submit: { float: 'right' }, cashboxBills: { marginRight: 5 }, cassetteCashbox: { width: 40, height: 35 }, cassetteFormTitle: { marginTop: 18 }, cassetteFormTitleContent: { marginLeft: 10, marginRight: 25 }, smBottomMargin: { marginBottom: 25 }, fiatTotal: { color: comet }, errorMessage: { color: errorColor } } const useStyles = makeStyles(styles) const WizardStep = ({ step, name, machine, cashoutSettings, cassetteCapacity, error, lastStep, steps, fiatCurrency, onContinue }) => { const classes = useStyles() const label = lastStep ? 'Finish' : 'Confirm' const cassetesArtworks = { 1: cashbox, 2: cassetteOne, 3: cassetteTwo } const stepOneRadioOptions = [ { display: 'Yes', code: 'YES' }, { display: 'No', code: 'NO' } ] const cassetteInfo = { amount: step === 2 ? machine?.cassette1 : machine?.cassette2, denomination: step === 2 ? cashoutSettings.top : cashoutSettings.bottom } const getPercentage = values => { const cassetteCount = step === 2 ? values.cassette1Count : values.cassette2Count const value = cassetteCount ?? cassetteInfo.amount return R.clamp(0, 100, 100 * (value / cassetteCapacity)) } return (
{name}
{step === 1 && ( {({ values, errors }) => (
cassette

Did you empty the cash-in box?

{errors.wasCashboxEmptied && (
{errors.wasCashboxEmptied}
)}

Since previous update

Number of bills inside the cashbox, since the last cashbox changes.

{machine?.cashbox}

accepted bills

)}
)} {(step === 2 || step === 3) && ( {({ values, errors }) => (
cassette

Cash-out {step - 1} (dispenser)

Refill bill count

{cassetteInfo.denomination} {fiatCurrency} bills loaded

={' '} {step === 2 ? (values.cassette1Count ?? 0) * cassetteInfo.denomination : (values.cassette2Count ?? 0) * cassetteInfo.denomination}{' '} {fiatCurrency}

{step === 2 ? errors.cassette1Count : errors.cassette2Count}

)}
)}
) } export default WizardStep