partial: notifications, op info, services
This commit is contained in:
parent
a90833726e
commit
6d6edf578c
22 changed files with 290 additions and 795 deletions
|
|
@ -35,7 +35,7 @@ const cashboxStyles = {
|
||||||
border: '4px solid'
|
border: '4px solid'
|
||||||
},
|
},
|
||||||
emptyPart: {
|
emptyPart: {
|
||||||
backgroundColor: 'white',
|
backgroundColor: 'var(--ghost)',
|
||||||
height: ({ percent }) => `${100 - percent}%`,
|
height: ({ percent }) => `${100 - percent}%`,
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
'& > p': {
|
'& > p': {
|
||||||
|
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
export default {
|
|
||||||
cryptoBalanceAlerts: {
|
|
||||||
display: 'flex',
|
|
||||||
marginBottom: 36,
|
|
||||||
height: 135,
|
|
||||||
alignItems: 'center'
|
|
||||||
},
|
|
||||||
cryptoBalanceAlertsForm: {
|
|
||||||
width: 222,
|
|
||||||
marginRight: 32
|
|
||||||
},
|
|
||||||
cryptoBalanceAlertsSecondForm: {
|
|
||||||
marginLeft: 50
|
|
||||||
},
|
|
||||||
vertSeparator: {
|
|
||||||
width: 1,
|
|
||||||
height: '100%',
|
|
||||||
borderRight: [[1, 'solid', 'black']]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import { makeStyles } from '@mui/styles'
|
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { H4 } from 'src/components/typography'
|
import { H4 } from 'src/components/typography'
|
||||||
import DisabledEditIcon from 'src/styling/icons/action/edit/disabled.svg?react'
|
import DisabledEditIcon from 'src/styling/icons/action/edit/disabled.svg?react'
|
||||||
|
|
@ -6,27 +5,23 @@ import EditIcon from 'src/styling/icons/action/edit/enabled.svg?react'
|
||||||
|
|
||||||
import { Link, IconButton } from 'src/components/buttons'
|
import { Link, IconButton } from 'src/components/buttons'
|
||||||
|
|
||||||
import styles from './EditHeader.styles'
|
|
||||||
|
|
||||||
const useStyles = makeStyles(styles)
|
|
||||||
|
|
||||||
const Header = ({ title, editing, disabled, setEditing }) => {
|
const Header = ({ title, editing, disabled, setEditing }) => {
|
||||||
const classes = useStyles()
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.header}>
|
<div className="flex items-center m-0 mb-4 h-7">
|
||||||
<H4 className={classes.title}>{title}</H4>
|
<H4 noMargin className="overflow-hidden whitespace-nowrap text-ellipsis">
|
||||||
|
{title}
|
||||||
|
</H4>
|
||||||
{!editing && (
|
{!editing && (
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => setEditing(true)}
|
onClick={() => setEditing(true)}
|
||||||
className={classes.button}
|
className="border-0 bg-transparent shrink-0 cursor-pointer ml-2"
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
size="large">
|
size="large">
|
||||||
{disabled ? <DisabledEditIcon /> : <EditIcon />}
|
{disabled ? <DisabledEditIcon /> : <EditIcon />}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
)}
|
)}
|
||||||
{editing && (
|
{editing && (
|
||||||
<div className={classes.editingButtons}>
|
<div className="flex ml-4 justify-between shrink-0 w-27">
|
||||||
<Link color="primary" type="submit">
|
<Link color="primary" type="submit">
|
||||||
Save
|
Save
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -36,7 +31,7 @@ const Header = ({ title, editing, disabled, setEditing }) => {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Header
|
export default Header
|
||||||
|
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
export default {
|
|
||||||
header: {
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
marginBottom: 16,
|
|
||||||
height: 26,
|
|
||||||
margin: 0
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
flexShrink: 2,
|
|
||||||
margin: 0,
|
|
||||||
overflow: 'hidden',
|
|
||||||
whiteSpace: 'nowrap',
|
|
||||||
textOverflow: 'ellipsis'
|
|
||||||
},
|
|
||||||
button: {
|
|
||||||
border: 'none',
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
cursor: 'pointer',
|
|
||||||
marginLeft: 8
|
|
||||||
},
|
|
||||||
editingButtons: {
|
|
||||||
display: 'flex',
|
|
||||||
flexShrink: 0,
|
|
||||||
marginLeft: 16,
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
width: 110
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import { makeStyles } from '@mui/styles'
|
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import { useFormikContext, Field as FormikField } from 'formik'
|
import { useFormikContext, Field as FormikField } from 'formik'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
@ -6,10 +5,6 @@ import { Label1, Info1, TL2 } from 'src/components/typography'
|
||||||
|
|
||||||
import { NumberInput } from 'src/components/inputs/formik'
|
import { NumberInput } from 'src/components/inputs/formik'
|
||||||
|
|
||||||
import styles from './EditableNumber.styles'
|
|
||||||
|
|
||||||
const useStyles = makeStyles(styles)
|
|
||||||
|
|
||||||
const EditableNumber = ({
|
const EditableNumber = ({
|
||||||
label,
|
label,
|
||||||
name,
|
name,
|
||||||
|
|
@ -20,20 +15,21 @@ const EditableNumber = ({
|
||||||
decimalPlaces = 0,
|
decimalPlaces = 0,
|
||||||
width = 80
|
width = 80
|
||||||
}) => {
|
}) => {
|
||||||
const classes = useStyles({ width, editing })
|
|
||||||
const { values } = useFormikContext()
|
const { values } = useFormikContext()
|
||||||
|
|
||||||
const classNames = {
|
const classNames = {
|
||||||
[classes.fieldWrapper]: true,
|
'h-13': true,
|
||||||
className
|
className
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classnames(classNames)}>
|
<div className={classnames(classNames)}>
|
||||||
{label && <Label1 className={classes.label}>{label}</Label1>}
|
{label && <Label1 noMargin>{label}</Label1>}
|
||||||
<div className={classes.valueWrapper}>
|
<div className="flex items-baseline">
|
||||||
{!editing && (
|
{!editing && (
|
||||||
<Info1 className={classes.text}>{displayValue(values[name])}</Info1>
|
<Info1 noMargin className="my-2">
|
||||||
|
{displayValue(values[name])}
|
||||||
|
</Info1>
|
||||||
)}
|
)}
|
||||||
{editing && (
|
{editing && (
|
||||||
<FormikField
|
<FormikField
|
||||||
|
|
@ -47,7 +43,9 @@ const EditableNumber = ({
|
||||||
decimalPlaces={decimalPlaces}
|
decimalPlaces={decimalPlaces}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<TL2 className={classes.decoration}>{decoration}</TL2>
|
<TL2 noMargin className="ml-2">
|
||||||
|
{decoration}
|
||||||
|
</TL2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
export default {
|
|
||||||
text: {
|
|
||||||
margin: [[7, 0, 7, 1]]
|
|
||||||
},
|
|
||||||
fieldWrapper: {
|
|
||||||
height: 53
|
|
||||||
},
|
|
||||||
valueWrapper: {
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'baseline'
|
|
||||||
},
|
|
||||||
label: {
|
|
||||||
margin: 0
|
|
||||||
},
|
|
||||||
decoration: {
|
|
||||||
margin: [[0, 0, 0, 7]]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +1,24 @@
|
||||||
import { makeStyles } from '@mui/styles'
|
|
||||||
import React, { useContext } from 'react'
|
import React, { useContext } from 'react'
|
||||||
|
|
||||||
import NotificationsCtx from '../NotificationsContext'
|
import NotificationsCtx from '../NotificationsContext'
|
||||||
import SingleFieldEditableNumber from '../components/SingleFieldEditableNumber'
|
import SingleFieldEditableNumber from '../components/SingleFieldEditableNumber'
|
||||||
|
|
||||||
import styles from './CryptoBalanceAlerts.styles'
|
|
||||||
|
|
||||||
const LOW_BALANCE_KEY = 'cryptoLowBalance'
|
const LOW_BALANCE_KEY = 'cryptoLowBalance'
|
||||||
const HIGH_BALANCE_KEY = 'cryptoHighBalance'
|
const HIGH_BALANCE_KEY = 'cryptoHighBalance'
|
||||||
|
|
||||||
const useStyles = makeStyles(styles)
|
|
||||||
|
|
||||||
const CryptoBalanceAlerts = ({ section, fieldWidth }) => {
|
const CryptoBalanceAlerts = ({ section, fieldWidth }) => {
|
||||||
const classes = useStyles()
|
|
||||||
|
|
||||||
const { data, save, currency, setEditing, isEditing, isDisabled } =
|
const { data, save, currency, setEditing, isEditing, isDisabled } =
|
||||||
useContext(NotificationsCtx)
|
useContext(NotificationsCtx)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.cryptoBalanceAlerts}>
|
<div className="flex mb-9 h-34 items-center gap-12">
|
||||||
<SingleFieldEditableNumber
|
<SingleFieldEditableNumber
|
||||||
name={LOW_BALANCE_KEY}
|
name={LOW_BALANCE_KEY}
|
||||||
data={data}
|
data={data}
|
||||||
save={save}
|
save={save}
|
||||||
section={section}
|
section={section}
|
||||||
decoration={currency}
|
decoration={currency}
|
||||||
className={classes.cryptoBalanceAlertsForm}
|
className="w-50"
|
||||||
title="Default (Low balance)"
|
title="Default (Low balance)"
|
||||||
label="Alert me under"
|
label="Alert me under"
|
||||||
editing={isEditing(LOW_BALANCE_KEY)}
|
editing={isEditing(LOW_BALANCE_KEY)}
|
||||||
|
|
@ -34,7 +27,7 @@ const CryptoBalanceAlerts = ({ section, fieldWidth }) => {
|
||||||
width={fieldWidth}
|
width={fieldWidth}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className={classes.vertSeparator} />
|
<div className="w-[1px] h-full border-r border-r-comet" />
|
||||||
|
|
||||||
<SingleFieldEditableNumber
|
<SingleFieldEditableNumber
|
||||||
name={HIGH_BALANCE_KEY}
|
name={HIGH_BALANCE_KEY}
|
||||||
|
|
@ -42,7 +35,6 @@ const CryptoBalanceAlerts = ({ section, fieldWidth }) => {
|
||||||
section={section}
|
section={section}
|
||||||
save={save}
|
save={save}
|
||||||
decoration={currency}
|
decoration={currency}
|
||||||
className={classes.cryptoBalanceAlertsSecondForm}
|
|
||||||
title="Default (High balance)"
|
title="Default (High balance)"
|
||||||
label="Alert me over"
|
label="Alert me over"
|
||||||
editing={isEditing(HIGH_BALANCE_KEY)}
|
editing={isEditing(HIGH_BALANCE_KEY)}
|
||||||
|
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
export default {
|
|
||||||
cryptoBalanceAlerts: {
|
|
||||||
display: 'flex',
|
|
||||||
marginBottom: 36,
|
|
||||||
height: 135,
|
|
||||||
alignItems: 'center'
|
|
||||||
},
|
|
||||||
cryptoBalanceAlertsForm: {
|
|
||||||
width: 222,
|
|
||||||
marginRight: 32
|
|
||||||
},
|
|
||||||
cryptoBalanceAlertsSecondForm: {
|
|
||||||
marginLeft: 50
|
|
||||||
},
|
|
||||||
vertSeparator: {
|
|
||||||
width: 1,
|
|
||||||
height: '100%',
|
|
||||||
borderRight: [[1, 'solid', 'black']]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import { makeStyles } from '@mui/styles'
|
|
||||||
import { Form, Formik } from 'formik'
|
import { Form, Formik } from 'formik'
|
||||||
import * as R from 'ramda'
|
import * as R from 'ramda'
|
||||||
import React, { useContext } from 'react'
|
import React, { useContext } from 'react'
|
||||||
|
|
@ -13,10 +12,6 @@ import NotificationsCtx from '../NotificationsContext'
|
||||||
import Header from '../components/EditHeader'
|
import Header from '../components/EditHeader'
|
||||||
import EditableNumber from '../components/EditableNumber'
|
import EditableNumber from '../components/EditableNumber'
|
||||||
|
|
||||||
import styles from './FiatBalanceAlerts.styles'
|
|
||||||
|
|
||||||
const useStyles = makeStyles(styles)
|
|
||||||
|
|
||||||
const CASH_IN_KEY = 'fiatBalanceAlertsCashIn'
|
const CASH_IN_KEY = 'fiatBalanceAlertsCashIn'
|
||||||
const CASH_OUT_KEY = 'fiatBalanceAlertsCashOut'
|
const CASH_OUT_KEY = 'fiatBalanceAlertsCashOut'
|
||||||
const RECYCLER_STACKER_KEY = 'fiatBalanceAlertsRecyclerStacker'
|
const RECYCLER_STACKER_KEY = 'fiatBalanceAlertsRecyclerStacker'
|
||||||
|
|
@ -34,8 +29,6 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
|
||||||
save,
|
save,
|
||||||
machines = []
|
machines = []
|
||||||
} = useContext(NotificationsCtx)
|
} = useContext(NotificationsCtx)
|
||||||
const classes = useStyles()
|
|
||||||
|
|
||||||
const maxNumberOfCassettes = Math.max(
|
const maxNumberOfCassettes = Math.max(
|
||||||
...R.map(it => it.numberOfCassettes, machines),
|
...R.map(it => it.numberOfCassettes, machines),
|
||||||
DEFAULT_NUMBER_OF_CASSETTES
|
DEFAULT_NUMBER_OF_CASSETTES
|
||||||
|
|
@ -97,8 +90,8 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
|
||||||
setEditing(CASH_OUT_KEY, false)
|
setEditing(CASH_OUT_KEY, false)
|
||||||
}}>
|
}}>
|
||||||
{({ values }) => (
|
{({ values }) => (
|
||||||
<>
|
<div className="flex flex-col gap-9">
|
||||||
<Form className={classes.form}>
|
<Form>
|
||||||
<PromptWhenDirty />
|
<PromptWhenDirty />
|
||||||
<Header
|
<Header
|
||||||
title="Cash box"
|
title="Cash box"
|
||||||
|
|
@ -106,24 +99,16 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
|
||||||
disabled={isDisabled(CASH_IN_KEY)}
|
disabled={isDisabled(CASH_IN_KEY)}
|
||||||
setEditing={it => setEditing(CASH_IN_KEY, it)}
|
setEditing={it => setEditing(CASH_IN_KEY, it)}
|
||||||
/>
|
/>
|
||||||
<div className={classes.wrapper}>
|
<EditableNumber
|
||||||
<div className={classes.first}>
|
label="Alert me over"
|
||||||
<div className={classes.row}>
|
name="cashInAlertThreshold"
|
||||||
<div className={classes.col2}>
|
editing={isEditing(CASH_IN_KEY)}
|
||||||
<EditableNumber
|
displayValue={x => (x === '' ? '-' : x)}
|
||||||
label="Alert me over"
|
decoration="notes"
|
||||||
name="cashInAlertThreshold"
|
width={fieldWidth}
|
||||||
editing={isEditing(CASH_IN_KEY)}
|
/>
|
||||||
displayValue={x => (x === '' ? '-' : x)}
|
|
||||||
decoration="notes"
|
|
||||||
width={fieldWidth}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Form>
|
</Form>
|
||||||
<Form className={classes.form}>
|
<Form>
|
||||||
<PromptWhenDirty />
|
<PromptWhenDirty />
|
||||||
<Header
|
<Header
|
||||||
title="Cash out (Empty)"
|
title="Cash out (Empty)"
|
||||||
|
|
@ -131,14 +116,12 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
|
||||||
disabled={isDisabled(CASH_OUT_KEY)}
|
disabled={isDisabled(CASH_OUT_KEY)}
|
||||||
setEditing={it => setEditing(CASH_OUT_KEY, it)}
|
setEditing={it => setEditing(CASH_OUT_KEY, it)}
|
||||||
/>
|
/>
|
||||||
<div className={classes.wrapper}>
|
<div className="flex flex-wrap gap-8">
|
||||||
{R.map(
|
{R.map(
|
||||||
it => (
|
it => (
|
||||||
<>
|
<>
|
||||||
<div className={classes.row}>
|
<div className="flex w-50 gap-4">
|
||||||
<Cashbox
|
<Cashbox
|
||||||
labelClassName={classes.cashboxLabel}
|
|
||||||
emptyPartClassName={classes.cashboxEmptyPart}
|
|
||||||
percent={
|
percent={
|
||||||
values[`fillingPercentageCassette${it + 1}`] ??
|
values[`fillingPercentageCassette${it + 1}`] ??
|
||||||
data[`cassette${it + 1}`]
|
data[`cassette${it + 1}`]
|
||||||
|
|
@ -148,8 +131,8 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
|
||||||
omitInnerPercentage
|
omitInnerPercentage
|
||||||
cashOut
|
cashOut
|
||||||
/>
|
/>
|
||||||
<div className={classes.col2}>
|
<div className="w-30">
|
||||||
<TL2 className={classes.title}>Cassette {it + 1}</TL2>
|
<TL2 className="mt-0">Cassette {it + 1}</TL2>
|
||||||
<EditableNumber
|
<EditableNumber
|
||||||
label="Alert me under"
|
label="Alert me under"
|
||||||
name={`fillingPercentageCassette${it + 1}`}
|
name={`fillingPercentageCassette${it + 1}`}
|
||||||
|
|
@ -166,7 +149,7 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
<Form className={classes.form}>
|
<Form>
|
||||||
<PromptWhenDirty />
|
<PromptWhenDirty />
|
||||||
<Header
|
<Header
|
||||||
title="Cash recycling"
|
title="Cash recycling"
|
||||||
|
|
@ -174,14 +157,12 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
|
||||||
disabled={isDisabled(RECYCLER_STACKER_KEY)}
|
disabled={isDisabled(RECYCLER_STACKER_KEY)}
|
||||||
setEditing={it => setEditing(RECYCLER_STACKER_KEY, it)}
|
setEditing={it => setEditing(RECYCLER_STACKER_KEY, it)}
|
||||||
/>
|
/>
|
||||||
<div className={classes.wrapper}>
|
<div className="flex flex-wrap gap-8">
|
||||||
{R.chain(
|
{R.chain(
|
||||||
it => [
|
it => [
|
||||||
<>
|
<>
|
||||||
<div className={classes.row}>
|
<div className="flex w-50 gap-4">
|
||||||
<Cashbox
|
<Cashbox
|
||||||
labelClassName={classes.cashboxLabel}
|
|
||||||
emptyPartClassName={classes.cashboxEmptyPart}
|
|
||||||
percent={
|
percent={
|
||||||
values[
|
values[
|
||||||
`fillingPercentageRecycler${(it + 1) * 2 - 1}`
|
`fillingPercentageRecycler${(it + 1) * 2 - 1}`
|
||||||
|
|
@ -192,10 +173,8 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
|
||||||
omitInnerPercentage
|
omitInnerPercentage
|
||||||
cashOut
|
cashOut
|
||||||
/>
|
/>
|
||||||
<div className={classes.col2}>
|
<div className="w-30">
|
||||||
<TL2 className={classes.title}>
|
<TL2 className="mt-0">Recycler {(it + 1) * 2 - 1}</TL2>
|
||||||
Recycler {(it + 1) * 2 - 1}
|
|
||||||
</TL2>
|
|
||||||
<EditableNumber
|
<EditableNumber
|
||||||
label="Alert me under"
|
label="Alert me under"
|
||||||
name={`fillingPercentageRecycler${(it + 1) * 2 - 1}`}
|
name={`fillingPercentageRecycler${(it + 1) * 2 - 1}`}
|
||||||
|
|
@ -208,10 +187,8 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
|
||||||
</div>
|
</div>
|
||||||
</>,
|
</>,
|
||||||
<>
|
<>
|
||||||
<div className={classes.row}>
|
<div className="flex w-50 gap-4">
|
||||||
<Cashbox
|
<Cashbox
|
||||||
labelClassName={classes.cashboxLabel}
|
|
||||||
emptyPartClassName={classes.cashboxEmptyPart}
|
|
||||||
percent={
|
percent={
|
||||||
values[`fillingPercentageRecycler${(it + 1) * 2}`] ??
|
values[`fillingPercentageRecycler${(it + 1) * 2}`] ??
|
||||||
data[`recycler${(it + 1) * 2}`]
|
data[`recycler${(it + 1) * 2}`]
|
||||||
|
|
@ -221,10 +198,8 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
|
||||||
omitInnerPercentage
|
omitInnerPercentage
|
||||||
cashOut
|
cashOut
|
||||||
/>
|
/>
|
||||||
<div className={classes.col2}>
|
<div className="w-30">
|
||||||
<TL2 className={classes.title}>
|
<TL2 className="mt-0">Recycler {(it + 1) * 2}</TL2>
|
||||||
Recycler {(it + 1) * 2}
|
|
||||||
</TL2>
|
|
||||||
<EditableNumber
|
<EditableNumber
|
||||||
label="Alert me under"
|
label="Alert me under"
|
||||||
name={`fillingPercentageRecycler${(it + 1) * 2}`}
|
name={`fillingPercentageRecycler${(it + 1) * 2}`}
|
||||||
|
|
@ -241,7 +216,7 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
</>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Formik>
|
</Formik>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
import { backgroundColor } from 'src/styling/variables'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
wrapper: {
|
|
||||||
display: 'flex'
|
|
||||||
},
|
|
||||||
form: {
|
|
||||||
marginBottom: 36
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
marginTop: 0
|
|
||||||
},
|
|
||||||
row: {
|
|
||||||
width: 236,
|
|
||||||
display: 'grid',
|
|
||||||
gridTemplateColumns: 'repeat(2,1fr)',
|
|
||||||
gridTemplateRows: '1fr',
|
|
||||||
gridColumnGap: 18,
|
|
||||||
gridRowGap: 0
|
|
||||||
},
|
|
||||||
col2: {
|
|
||||||
width: 136
|
|
||||||
},
|
|
||||||
cashboxLabel: {
|
|
||||||
marginRight: 4,
|
|
||||||
fontSize: 20
|
|
||||||
},
|
|
||||||
cashboxEmptyPart: {
|
|
||||||
backgroundColor: `${backgroundColor}`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import { makeStyles } from '@mui/styles'
|
|
||||||
import Switch from '@mui/material/Switch'
|
import Switch from '@mui/material/Switch'
|
||||||
import * as R from 'ramda'
|
import * as R from 'ramda'
|
||||||
import React, { useContext } from 'react'
|
import React, { useContext } from 'react'
|
||||||
|
|
@ -74,12 +73,6 @@ const Row = ({
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles({
|
|
||||||
wizardTable: {
|
|
||||||
width: 930
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const Setup = ({ wizard, forceDisable }) => {
|
const Setup = ({ wizard, forceDisable }) => {
|
||||||
const {
|
const {
|
||||||
data: rawData,
|
data: rawData,
|
||||||
|
|
@ -120,9 +113,8 @@ const Setup = ({ wizard, forceDisable }) => {
|
||||||
]
|
]
|
||||||
|
|
||||||
const widthAdjust = wizard ? 20 : 0
|
const widthAdjust = wizard ? 20 : 0
|
||||||
const classes = useStyles()
|
|
||||||
return (
|
return (
|
||||||
<Table className={wizard ? classes.wizardTable : null}>
|
<Table className={wizard ? 'w-233' : null}>
|
||||||
<THead>
|
<THead>
|
||||||
<Th width={channelSize - widthAdjust}>Channel</Th>
|
<Th width={channelSize - widthAdjust}>Channel</Th>
|
||||||
{Object.keys(sizes).map(it => (
|
{Object.keys(sizes).map(it => (
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,11 @@
|
||||||
import { useQuery, useMutation, gql } from "@apollo/client";
|
import { useQuery, useMutation, gql } from '@apollo/client'
|
||||||
import { makeStyles } from '@mui/styles'
|
|
||||||
import Switch from '@mui/material/Switch'
|
|
||||||
import React, { memo } from 'react'
|
import React, { memo } from 'react'
|
||||||
import { HelpTooltip } from 'src/components/Tooltip'
|
|
||||||
import { H4, P, Label2 } from 'src/components/typography'
|
|
||||||
|
|
||||||
import { BooleanPropertiesTable } from 'src/components/booleanPropertiesTable'
|
import { BooleanPropertiesTable } from 'src/components/booleanPropertiesTable'
|
||||||
import { fromNamespace, toNamespace, namespaces } from 'src/utils/config'
|
import { fromNamespace, toNamespace, namespaces } from 'src/utils/config'
|
||||||
|
|
||||||
import { SupportLinkButton } from '../../components/buttons'
|
import SwitchRow from './components/SwitchRow.jsx'
|
||||||
|
import Header from './components/Header.jsx'
|
||||||
import { global } from './OperatorInfo.styles'
|
|
||||||
|
|
||||||
const useStyles = makeStyles(global)
|
|
||||||
|
|
||||||
const GET_CONFIG = gql`
|
const GET_CONFIG = gql`
|
||||||
query getData {
|
query getData {
|
||||||
|
|
@ -26,27 +19,7 @@ const SAVE_CONFIG = gql`
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const Row = memo(({ title, disabled = false, checked, save, label }) => {
|
|
||||||
const classes = useStyles()
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={classes.switchRow}>
|
|
||||||
<P>{title}</P>
|
|
||||||
<div className={classes.switch}>
|
|
||||||
<Switch
|
|
||||||
disabled={disabled}
|
|
||||||
checked={checked}
|
|
||||||
onChange={event => save && save(event.target.checked)}
|
|
||||||
/>
|
|
||||||
{label && <Label2>{label}</Label2>}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
const CoinATMRadar = memo(({ wizard }) => {
|
const CoinATMRadar = memo(({ wizard }) => {
|
||||||
const classes = useStyles()
|
|
||||||
|
|
||||||
const { data } = useQuery(GET_CONFIG)
|
const { data } = useQuery(GET_CONFIG)
|
||||||
|
|
||||||
const [saveConfig] = useMutation(SAVE_CONFIG, {
|
const [saveConfig] = useMutation(SAVE_CONFIG, {
|
||||||
|
|
@ -63,53 +36,34 @@ const CoinATMRadar = memo(({ wizard }) => {
|
||||||
if (!coinAtmRadarConfig) return null
|
if (!coinAtmRadarConfig) return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.content}>
|
<>
|
||||||
<div>
|
<Header
|
||||||
<div className={classes.header}>
|
title="Coin ATM Radar share settings"
|
||||||
<H4>Coin ATM Radar share settings</H4>
|
articleUrl="https://support.lamassu.is/hc/en-us/articles/360023720472-Coin-ATM-Radar"
|
||||||
<HelpTooltip width={320}>
|
tooltipText="For details on configuring this panel, please read the relevant knowledgebase article."
|
||||||
<P>
|
/>
|
||||||
For details on configuring this panel, please read the relevant
|
<SwitchRow
|
||||||
knowledgebase article{' '}
|
title={'Share information?'}
|
||||||
<a
|
checked={coinAtmRadarConfig.active}
|
||||||
target="_blank"
|
save={value => save({ active: value })}
|
||||||
rel="noopener noreferrer"
|
/>
|
||||||
href="https://support.lamassu.is/hc/en-us/articles/360023720472-Coin-ATM-Radar">
|
<BooleanPropertiesTable
|
||||||
here
|
editing={wizard}
|
||||||
</a>
|
title="Machine info"
|
||||||
.
|
data={coinAtmRadarConfig}
|
||||||
</P>
|
elements={[
|
||||||
<SupportLinkButton
|
{
|
||||||
link="https://support.lamassu.is/hc/en-us/articles/360023720472-Coin-ATM-Radar"
|
name: 'commissions',
|
||||||
label="Lamassu Support Article"
|
display: 'Commissions'
|
||||||
bottomSpace="1"
|
},
|
||||||
/>
|
{
|
||||||
</HelpTooltip>
|
name: 'limitsAndVerification',
|
||||||
</div>
|
display: 'Limits and verification'
|
||||||
<Row
|
}
|
||||||
title={'Share information?'}
|
]}
|
||||||
checked={coinAtmRadarConfig.active}
|
save={save}
|
||||||
save={value => save({ active: value })}
|
/>
|
||||||
label={coinAtmRadarConfig.active ? 'Yes' : 'No'}
|
</>
|
||||||
/>
|
|
||||||
<BooleanPropertiesTable
|
|
||||||
editing={wizard}
|
|
||||||
title="Machine info"
|
|
||||||
data={coinAtmRadarConfig}
|
|
||||||
elements={[
|
|
||||||
{
|
|
||||||
name: 'commissions',
|
|
||||||
display: 'Commissions'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'limitsAndVerification',
|
|
||||||
display: 'Limits and verification'
|
|
||||||
}
|
|
||||||
]}
|
|
||||||
save={save}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,70 +1,37 @@
|
||||||
import { useQuery, useMutation, gql } from "@apollo/client";
|
import { useQuery, useMutation, gql } from '@apollo/client'
|
||||||
import { makeStyles } from '@mui/styles'
|
|
||||||
import Switch from '@mui/material/Switch'
|
|
||||||
import classnames from 'classnames'
|
|
||||||
import { Form, Formik, Field as FormikField } from 'formik'
|
import { Form, Formik, Field as FormikField } from 'formik'
|
||||||
import * as R from 'ramda'
|
import * as R from 'ramda'
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import ErrorMessage from 'src/components/ErrorMessage'
|
import ErrorMessage from 'src/components/ErrorMessage'
|
||||||
import PromptWhenDirty from 'src/components/PromptWhenDirty'
|
import PromptWhenDirty from 'src/components/PromptWhenDirty'
|
||||||
import { HelpTooltip } from 'src/components/Tooltip'
|
import { H4, Info3, Label3 } from 'src/components/typography'
|
||||||
import { P, H4, Info3, Label1, Label2, Label3 } from 'src/components/typography'
|
|
||||||
import EditIcon from 'src/styling/icons/action/edit/enabled.svg?react'
|
import EditIcon from 'src/styling/icons/action/edit/enabled.svg?react'
|
||||||
import WarningIcon from 'src/styling/icons/warning-icon/comet.svg?react'
|
import WarningIcon from 'src/styling/icons/warning-icon/comet.svg?react'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
|
|
||||||
import { Link, IconButton, SupportLinkButton } from 'src/components/buttons'
|
import { Link, IconButton } from 'src/components/buttons'
|
||||||
import { TextInput } from 'src/components/inputs/formik'
|
import { TextInput } from 'src/components/inputs/formik'
|
||||||
import { fontSize5 } from 'src/styling/variables'
|
|
||||||
import { fromNamespace, toNamespace, namespaces } from 'src/utils/config'
|
import { fromNamespace, toNamespace, namespaces } from 'src/utils/config'
|
||||||
|
|
||||||
import { global } from './OperatorInfo.styles'
|
import SwitchRow from './components/SwitchRow.jsx'
|
||||||
|
import InfoMessage from './components/InfoMessage.jsx'
|
||||||
|
import Header from './components/Header.jsx'
|
||||||
|
|
||||||
const FIELD_WIDTH = 280
|
const FIELD_WIDTH = 280
|
||||||
|
|
||||||
const fieldStyles = {
|
|
||||||
field: {
|
|
||||||
position: 'relative',
|
|
||||||
width: 280,
|
|
||||||
height: 48,
|
|
||||||
padding: [[0, 4, 4, 0]]
|
|
||||||
},
|
|
||||||
notEditing: {
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: 'column',
|
|
||||||
'& > p:first-child': {
|
|
||||||
height: 16,
|
|
||||||
lineHeight: '16px',
|
|
||||||
fontSize: fontSize5,
|
|
||||||
transformOrigin: 'left',
|
|
||||||
paddingLeft: 0,
|
|
||||||
margin: [[3, 0, 3, 0]]
|
|
||||||
},
|
|
||||||
'& > p:last-child': {
|
|
||||||
overflow: 'hidden',
|
|
||||||
whiteSpace: 'nowrap',
|
|
||||||
textOverflow: 'ellipsis',
|
|
||||||
margin: 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const fieldUseStyles = makeStyles(fieldStyles)
|
|
||||||
|
|
||||||
const Field = ({ editing, field, displayValue, ...props }) => {
|
const Field = ({ editing, field, displayValue, ...props }) => {
|
||||||
const classes = fieldUseStyles()
|
|
||||||
|
|
||||||
const classNames = {
|
|
||||||
[classes.field]: true,
|
|
||||||
[classes.notEditing]: !editing
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classnames(classNames)}>
|
<div className="w-70 h-12 p-0 pl-1 pb-1">
|
||||||
{!editing && (
|
{!editing && (
|
||||||
<>
|
<>
|
||||||
<Label3>{field.label}</Label3>
|
<Label3 noMargin className="h-4 text-[13px] my-[3px]">
|
||||||
<Info3>{displayValue(field.value)}</Info3>
|
{field.label}
|
||||||
|
</Label3>
|
||||||
|
<Info3
|
||||||
|
noMargin
|
||||||
|
className="overflow-hidden whitespace-nowrap text-ellipsis">
|
||||||
|
{displayValue(field.value)}
|
||||||
|
</Info3>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{editing && (
|
{editing && (
|
||||||
|
|
@ -95,11 +62,7 @@ const SAVE_CONFIG = gql`
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const contactUseStyles = makeStyles(global)
|
|
||||||
|
|
||||||
const ContactInfo = ({ wizard }) => {
|
const ContactInfo = ({ wizard }) => {
|
||||||
const classes = contactUseStyles()
|
|
||||||
|
|
||||||
const [editing, setEditing] = useState(wizard || false)
|
const [editing, setEditing] = useState(wizard || false)
|
||||||
const [error, setError] = useState(null)
|
const [error, setError] = useState(null)
|
||||||
|
|
||||||
|
|
@ -187,42 +150,17 @@ const ContactInfo = ({ wizard }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={classes.header}>
|
<Header
|
||||||
<H4>Contact information</H4>
|
title="Contact information"
|
||||||
<HelpTooltip width={320}>
|
articleUrl="https://support.lamassu.is/hc/en-us/articles/360033051732-Enabling-Operator-Info"
|
||||||
<P>
|
tooltipText="For details on configuring this panel, please read the relevant knowledgebase article:"
|
||||||
For details on configuring this panel, please read the relevant
|
/>
|
||||||
knowledgebase article:
|
<SwitchRow checked={info.active} save={save} title="Info card enabled?" />
|
||||||
</P>
|
<div>
|
||||||
<SupportLinkButton
|
<div className="flex items-center gap-4">
|
||||||
link="https://support.lamassu.is/hc/en-us/articles/360033051732-Enabling-Operator-Info"
|
|
||||||
label="Lamassu Support Article"
|
|
||||||
bottomSpace="1"
|
|
||||||
/>
|
|
||||||
</HelpTooltip>
|
|
||||||
</div>
|
|
||||||
<div className={classes.switchRow}>
|
|
||||||
<P>Info card enabled?</P>
|
|
||||||
<div className={classes.switch}>
|
|
||||||
<Switch
|
|
||||||
checked={info.active}
|
|
||||||
onChange={event =>
|
|
||||||
save({
|
|
||||||
active: event.target.checked
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Label2>{info.active ? 'Yes' : 'No'}</Label2>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className={classes.section}>
|
|
||||||
<div className={classes.header}>
|
|
||||||
<H4>Info card</H4>
|
<H4>Info card</H4>
|
||||||
{!editing && (
|
{!editing && (
|
||||||
<IconButton
|
<IconButton onClick={() => setEditing(true)} size="large">
|
||||||
className={classes.transparentButton}
|
|
||||||
onClick={() => setEditing(true)}
|
|
||||||
size="large">
|
|
||||||
<EditIcon />
|
<EditIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
)}
|
)}
|
||||||
|
|
@ -239,9 +177,9 @@ const ContactInfo = ({ wizard }) => {
|
||||||
setError(null)
|
setError(null)
|
||||||
}}>
|
}}>
|
||||||
{({ errors }) => (
|
{({ errors }) => (
|
||||||
<Form>
|
<Form className="flex flex-col gap-7 w-147">
|
||||||
<PromptWhenDirty />
|
<PromptWhenDirty />
|
||||||
<div className={classes.row}>
|
<div className="flex gap-6 justify-between">
|
||||||
<Field
|
<Field
|
||||||
field={findField('name')}
|
field={findField('name')}
|
||||||
editing={editing}
|
editing={editing}
|
||||||
|
|
@ -255,7 +193,7 @@ const ContactInfo = ({ wizard }) => {
|
||||||
onFocus={() => setError(null)}
|
onFocus={() => setError(null)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className={classes.row}>
|
<div className="flex gap-6">
|
||||||
<Field
|
<Field
|
||||||
field={findField('email')}
|
field={findField('email')}
|
||||||
editing={editing}
|
editing={editing}
|
||||||
|
|
@ -269,7 +207,7 @@ const ContactInfo = ({ wizard }) => {
|
||||||
onFocus={() => setError(null)}
|
onFocus={() => setError(null)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className={classes.row}>
|
<div className="flex gap-6">
|
||||||
<Field
|
<Field
|
||||||
field={findField('companyNumber')}
|
field={findField('companyNumber')}
|
||||||
editing={editing}
|
editing={editing}
|
||||||
|
|
@ -278,41 +216,34 @@ const ContactInfo = ({ wizard }) => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{editing && !!getErrorMsg(errors) && (
|
{editing && !!getErrorMsg(errors) && (
|
||||||
<ErrorMessage className={classes.formErrorMsg}>
|
<ErrorMessage>{getErrorMsg(errors)}</ErrorMessage>
|
||||||
{getErrorMsg(errors)}
|
)}
|
||||||
</ErrorMessage>
|
{editing && (
|
||||||
|
<div className="flex gap-10">
|
||||||
|
<Link color="primary" type="submit">
|
||||||
|
Save
|
||||||
|
</Link>
|
||||||
|
<Link color="secondary" type="reset">
|
||||||
|
Cancel
|
||||||
|
</Link>
|
||||||
|
{error && <ErrorMessage>Failed to save changes</ErrorMessage>}
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className={classnames(classes.row, classes.submit)}>
|
|
||||||
{editing && (
|
|
||||||
<>
|
|
||||||
<Link color="primary" type="submit">
|
|
||||||
Save
|
|
||||||
</Link>
|
|
||||||
<Link color="secondary" type="reset">
|
|
||||||
Cancel
|
|
||||||
</Link>
|
|
||||||
{error && (
|
|
||||||
<ErrorMessage>Failed to save changes</ErrorMessage>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</Form>
|
</Form>
|
||||||
)}
|
)}
|
||||||
</Formik>
|
</Formik>
|
||||||
</div>
|
</div>
|
||||||
{!wizard && (
|
{!wizard && (
|
||||||
<div className={classnames(classes.section, classes.infoMessage)}>
|
<>
|
||||||
<WarningIcon />
|
<InfoMessage Icon={WarningIcon}>
|
||||||
<Label1>
|
|
||||||
Sharing your information with your customers through your machines
|
Sharing your information with your customers through your machines
|
||||||
allows them to contact you in case there's a problem with a machine
|
allows them to contact you in case there's a problem with a machine
|
||||||
in your network or a transaction.
|
in your network or a transaction.
|
||||||
</Label1>
|
</InfoMessage>
|
||||||
</div>
|
</>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ContactInfo
|
export default ContactInfo
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,11 @@
|
||||||
import { useQuery, useMutation, gql } from "@apollo/client";
|
import { useQuery, useMutation, gql } from '@apollo/client'
|
||||||
import { makeStyles } from '@mui/styles'
|
|
||||||
import Switch from '@mui/material/Switch'
|
|
||||||
import * as R from 'ramda'
|
import * as R from 'ramda'
|
||||||
import React, { memo } from 'react'
|
import React, { memo } from 'react'
|
||||||
import { H4, P, Label2 } from 'src/components/typography'
|
import { H4 } from 'src/components/typography'
|
||||||
|
|
||||||
import { fromNamespace, toNamespace, namespaces } from 'src/utils/config'
|
import { fromNamespace, toNamespace, namespaces } from 'src/utils/config'
|
||||||
|
|
||||||
import { global } from './OperatorInfo.styles'
|
import SwitchRow from './components/SwitchRow.jsx'
|
||||||
|
|
||||||
const useStyles = makeStyles(global)
|
|
||||||
|
|
||||||
const GET_CONFIG = gql`
|
const GET_CONFIG = gql`
|
||||||
query getData {
|
query getData {
|
||||||
|
|
@ -24,14 +20,26 @@ const SAVE_CONFIG = gql`
|
||||||
`
|
`
|
||||||
|
|
||||||
const MachineScreens = memo(({ wizard }) => {
|
const MachineScreens = memo(({ wizard }) => {
|
||||||
const classes = useStyles()
|
|
||||||
|
|
||||||
const { data } = useQuery(GET_CONFIG)
|
const { data } = useQuery(GET_CONFIG)
|
||||||
|
|
||||||
const [saveConfig] = useMutation(SAVE_CONFIG, {
|
const [saveConfig] = useMutation(SAVE_CONFIG, {
|
||||||
refetchQueries: () => ['getData']
|
refetchQueries: () => ['getData']
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const save = it => {
|
||||||
|
const formatConfig = R.compose(
|
||||||
|
toNamespace(namespaces.MACHINE_SCREENS),
|
||||||
|
toNamespace('rates'),
|
||||||
|
R.mergeRight(ratesScreenConfig)
|
||||||
|
)
|
||||||
|
|
||||||
|
return saveConfig({
|
||||||
|
variables: {
|
||||||
|
config: formatConfig({ active: it })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const machineScreensConfig =
|
const machineScreensConfig =
|
||||||
data?.config && fromNamespace(namespaces.MACHINE_SCREENS, data.config)
|
data?.config && fromNamespace(namespaces.MACHINE_SCREENS, data.config)
|
||||||
|
|
||||||
|
|
@ -46,32 +54,12 @@ const MachineScreens = memo(({ wizard }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={classes.header}>
|
<H4>Rates screen</H4>
|
||||||
<H4>Rates screen</H4>
|
<SwitchRow
|
||||||
</div>
|
save={save}
|
||||||
<div className={classes.switchRow}>
|
title="Enable rates screen"
|
||||||
<P>Enable rates screen</P>
|
checked={ratesScreenConfig.active}
|
||||||
<div className={classes.switch}>
|
/>
|
||||||
<Switch
|
|
||||||
checked={ratesScreenConfig.active}
|
|
||||||
onChange={event =>
|
|
||||||
saveConfig({
|
|
||||||
variables: {
|
|
||||||
config: R.compose(
|
|
||||||
toNamespace(namespaces.MACHINE_SCREENS),
|
|
||||||
toNamespace('rates')
|
|
||||||
)(
|
|
||||||
R.merge(ratesScreenConfig, {
|
|
||||||
active: event.target.checked
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Label2>{ratesScreenConfig.active ? 'Yes' : 'No'}</Label2>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,118 +0,0 @@
|
||||||
import { offColor } from 'src/styling/variables'
|
|
||||||
|
|
||||||
const global = {
|
|
||||||
content: {
|
|
||||||
display: 'flex'
|
|
||||||
},
|
|
||||||
header: {
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
position: 'relative',
|
|
||||||
flex: 'wrap'
|
|
||||||
},
|
|
||||||
section: {
|
|
||||||
marginBottom: 52
|
|
||||||
},
|
|
||||||
row: {
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
marginBottom: 28,
|
|
||||||
width: 600,
|
|
||||||
'&:last-child': {
|
|
||||||
marginBottom: 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
switchRow: {
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
position: 'relative',
|
|
||||||
flex: 'wrap',
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
width: 396
|
|
||||||
},
|
|
||||||
switch: {
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center'
|
|
||||||
},
|
|
||||||
submit: {
|
|
||||||
justifyContent: 'flex-start',
|
|
||||||
alignItems: 'center',
|
|
||||||
padding: [[0, 4, 4, 4]],
|
|
||||||
'& > button': {
|
|
||||||
marginRight: 40
|
|
||||||
}
|
|
||||||
},
|
|
||||||
transparentButton: {
|
|
||||||
'& > *': {
|
|
||||||
margin: 'auto 12px'
|
|
||||||
},
|
|
||||||
'& button': {
|
|
||||||
border: 'none',
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
cursor: 'pointer'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
infoMessage: {
|
|
||||||
display: 'flex',
|
|
||||||
marginBottom: 52,
|
|
||||||
'& > p': {
|
|
||||||
width: 330,
|
|
||||||
color: offColor,
|
|
||||||
marginTop: 4,
|
|
||||||
marginLeft: 16
|
|
||||||
}
|
|
||||||
},
|
|
||||||
formErrorMsg: {
|
|
||||||
margin: [[0, 0, 20, 0]]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const fieldStyles = {
|
|
||||||
field: {
|
|
||||||
position: 'relative',
|
|
||||||
width: 280,
|
|
||||||
padding: [[0, 4, 4, 0]]
|
|
||||||
},
|
|
||||||
notEditing: {
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: 'column'
|
|
||||||
},
|
|
||||||
notEditingSingleLine: {
|
|
||||||
'& > p:first-child': {
|
|
||||||
height: 16,
|
|
||||||
lineHeight: '16px',
|
|
||||||
transform: 'scale(0.75)',
|
|
||||||
transformOrigin: 'left',
|
|
||||||
paddingLeft: 0,
|
|
||||||
margin: [[1, 0, 6, 0]]
|
|
||||||
},
|
|
||||||
'& > p:last-child': {
|
|
||||||
overflow: 'hidden',
|
|
||||||
whiteSpace: 'nowrap',
|
|
||||||
textOverflow: 'ellipsis',
|
|
||||||
height: 25,
|
|
||||||
margin: 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
notEditingMultiline: {
|
|
||||||
'& > p:first-child': {
|
|
||||||
height: 16,
|
|
||||||
lineHeight: '16px',
|
|
||||||
transform: 'scale(0.75)',
|
|
||||||
transformOrigin: 'left',
|
|
||||||
paddingLeft: 0,
|
|
||||||
margin: [[1, 0, 5, 0]]
|
|
||||||
},
|
|
||||||
'& > p:last-child': {
|
|
||||||
width: 502,
|
|
||||||
height: 121,
|
|
||||||
overflowY: 'auto',
|
|
||||||
lineHeight: '19px',
|
|
||||||
wordWrap: 'anywhere',
|
|
||||||
margin: 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { global, fieldStyles }
|
|
||||||
|
|
@ -1,19 +1,12 @@
|
||||||
import { useQuery, useMutation, gql } from "@apollo/client";
|
import { useQuery, useMutation, gql } from '@apollo/client'
|
||||||
import { makeStyles } from '@mui/styles'
|
|
||||||
import Switch from '@mui/material/Switch'
|
|
||||||
import * as R from 'ramda'
|
import * as R from 'ramda'
|
||||||
import React, { memo } from 'react'
|
import React, { memo } from 'react'
|
||||||
import { HelpTooltip } from 'src/components/Tooltip'
|
|
||||||
import { H4, P, Label2 } from 'src/components/typography'
|
|
||||||
|
|
||||||
import { BooleanPropertiesTable } from 'src/components/booleanPropertiesTable'
|
import { BooleanPropertiesTable } from 'src/components/booleanPropertiesTable'
|
||||||
import { fromNamespace, toNamespace, namespaces } from 'src/utils/config'
|
import { fromNamespace, toNamespace, namespaces } from 'src/utils/config'
|
||||||
|
|
||||||
import { SupportLinkButton } from '../../components/buttons'
|
import Header from './components/Header.jsx'
|
||||||
|
import SwitchRow from './components/SwitchRow.jsx'
|
||||||
import { global } from './OperatorInfo.styles'
|
|
||||||
|
|
||||||
const useStyles = makeStyles(global)
|
|
||||||
|
|
||||||
const GET_CONFIG = gql`
|
const GET_CONFIG = gql`
|
||||||
query getData {
|
query getData {
|
||||||
|
|
@ -28,14 +21,23 @@ const SAVE_CONFIG = gql`
|
||||||
`
|
`
|
||||||
|
|
||||||
const ReceiptPrinting = memo(({ wizard }) => {
|
const ReceiptPrinting = memo(({ wizard }) => {
|
||||||
const classes = useStyles()
|
|
||||||
|
|
||||||
const { data } = useQuery(GET_CONFIG)
|
const { data } = useQuery(GET_CONFIG)
|
||||||
|
|
||||||
const [saveConfig] = useMutation(SAVE_CONFIG, {
|
const [saveConfig] = useMutation(SAVE_CONFIG, {
|
||||||
refetchQueries: () => ['getData']
|
refetchQueries: () => ['getData']
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const saveSwitch = object => {
|
||||||
|
return saveConfig({
|
||||||
|
variables: {
|
||||||
|
config: toNamespace(
|
||||||
|
namespaces.RECEIPT,
|
||||||
|
R.mergeRight(receiptPrintingConfig, object)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const save = it =>
|
const save = it =>
|
||||||
saveConfig({
|
saveConfig({
|
||||||
variables: { config: toNamespace(namespaces.RECEIPT, it) }
|
variables: { config: toNamespace(namespaces.RECEIPT, it) }
|
||||||
|
|
@ -47,84 +49,26 @@ const ReceiptPrinting = memo(({ wizard }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={classes.header}>
|
<Header
|
||||||
<H4>Receipt options</H4>
|
title="Receipt printing"
|
||||||
<HelpTooltip width={320}>
|
tooltipText="For details on configuring this panel, please read the relevant knowledgebase article."
|
||||||
<P>
|
articleUrl="https://support.lamassu.is/hc/en-us/articles/360058513951-Receipt-options-printers"
|
||||||
For details on configuring this panel, please read the relevant
|
/>
|
||||||
knowledgebase article:
|
<SwitchRow
|
||||||
</P>
|
title="Enable receipt printing"
|
||||||
<SupportLinkButton
|
checked={receiptPrintingConfig.active}
|
||||||
link="https://support.lamassu.is/hc/en-us/articles/360058513951-Receipt-options-printers"
|
save={it => saveSwitch({ active: it })}
|
||||||
label="Lamassu Support Article"
|
/>
|
||||||
bottomSpace="1"
|
<SwitchRow
|
||||||
/>
|
title="Automatic receipt printing"
|
||||||
</HelpTooltip>
|
checked={receiptPrintingConfig.automaticPrint}
|
||||||
</div>
|
save={it => saveSwitch({ automaticPrint: it })}
|
||||||
<div className={classes.switchRow}>
|
/>
|
||||||
<P>Enable receipt printing</P>
|
<SwitchRow
|
||||||
<div className={classes.switch}>
|
title="Offer SMS receipt"
|
||||||
<Switch
|
checked={receiptPrintingConfig.sms}
|
||||||
checked={receiptPrintingConfig.active}
|
save={it => saveSwitch({ sms: it })}
|
||||||
onChange={event =>
|
/>
|
||||||
saveConfig({
|
|
||||||
variables: {
|
|
||||||
config: toNamespace(
|
|
||||||
namespaces.RECEIPT,
|
|
||||||
R.merge(receiptPrintingConfig, {
|
|
||||||
active: event.target.checked
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Label2>{receiptPrintingConfig.active ? 'Yes' : 'No'}</Label2>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className={classes.switchRow}>
|
|
||||||
<P>Automatic receipt printing</P>
|
|
||||||
<div className={classes.switch}>
|
|
||||||
<Switch
|
|
||||||
disabled={!receiptPrintingConfig.active}
|
|
||||||
checked={receiptPrintingConfig.automaticPrint}
|
|
||||||
onChange={event =>
|
|
||||||
saveConfig({
|
|
||||||
variables: {
|
|
||||||
config: toNamespace(
|
|
||||||
namespaces.RECEIPT,
|
|
||||||
R.merge(receiptPrintingConfig, {
|
|
||||||
automaticPrint: event.target.checked
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Label2>{receiptPrintingConfig.automaticPrint ? 'Yes' : 'No'}</Label2>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className={classes.switchRow}>
|
|
||||||
<P>Offer SMS receipt</P>
|
|
||||||
<div className={classes.switch}>
|
|
||||||
<Switch
|
|
||||||
checked={receiptPrintingConfig.sms}
|
|
||||||
onChange={event =>
|
|
||||||
saveConfig({
|
|
||||||
variables: {
|
|
||||||
config: toNamespace(
|
|
||||||
namespaces.RECEIPT,
|
|
||||||
R.merge(receiptPrintingConfig, {
|
|
||||||
sms: event.target.checked
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Label2>{receiptPrintingConfig.sms ? 'Yes' : 'No'}</Label2>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<BooleanPropertiesTable
|
<BooleanPropertiesTable
|
||||||
editing={wizard}
|
editing={wizard}
|
||||||
title={'Visible on the receipt (options)'}
|
title={'Visible on the receipt (options)'}
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,20 @@
|
||||||
import { useQuery, useMutation, gql } from "@apollo/client";
|
import { useQuery, useMutation, gql } from '@apollo/client'
|
||||||
import { makeStyles } from '@mui/styles'
|
|
||||||
import Switch from '@mui/material/Switch'
|
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import { Form, Formik, Field as FormikField } from 'formik'
|
import { Form, Formik, Field as FormikField } from 'formik'
|
||||||
import * as R from 'ramda'
|
import * as R from 'ramda'
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import ErrorMessage from 'src/components/ErrorMessage'
|
import ErrorMessage from 'src/components/ErrorMessage'
|
||||||
import PromptWhenDirty from 'src/components/PromptWhenDirty'
|
import PromptWhenDirty from 'src/components/PromptWhenDirty'
|
||||||
import { HelpTooltip } from 'src/components/Tooltip'
|
import { Info2, Info3, Label3 } from 'src/components/typography'
|
||||||
import { H4, Info2, Info3, Label2, Label3, P } from 'src/components/typography'
|
|
||||||
import EditIcon from 'src/styling/icons/action/edit/enabled.svg?react'
|
import EditIcon from 'src/styling/icons/action/edit/enabled.svg?react'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
|
|
||||||
import { Link, IconButton, SupportLinkButton } from 'src/components/buttons'
|
import { Link, IconButton } from 'src/components/buttons'
|
||||||
import { TextInput } from 'src/components/inputs/formik'
|
import { TextInput } from 'src/components/inputs/formik'
|
||||||
import { fromNamespace, toNamespace, namespaces } from 'src/utils/config'
|
import { fromNamespace, toNamespace, namespaces } from 'src/utils/config'
|
||||||
|
|
||||||
import { global, fieldStyles } from './OperatorInfo.styles'
|
import Header from './components/Header.jsx'
|
||||||
|
import SwitchRow from './components/SwitchRow.jsx'
|
||||||
const useFieldStyles = makeStyles(fieldStyles)
|
|
||||||
|
|
||||||
const Field = ({
|
const Field = ({
|
||||||
editing,
|
editing,
|
||||||
|
|
@ -32,21 +28,21 @@ const Field = ({
|
||||||
onFocus,
|
onFocus,
|
||||||
...props
|
...props
|
||||||
}) => {
|
}) => {
|
||||||
const classes = useFieldStyles()
|
const info3ClassNames = {
|
||||||
|
'overflow-hidden whitespace-nowrap text-ellipsis h-6': !multiline,
|
||||||
const classNames = {
|
'wrap-anywhere overflow-y-auto h-32 mt-4 leading-[23px]': multiline
|
||||||
[classes.field]: true,
|
|
||||||
[classes.notEditing]: !editing,
|
|
||||||
[classes.notEditingSingleLine]: !editing && !multiline,
|
|
||||||
[classes.notEditingMultiline]: !editing && multiline
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classnames(classNames)}>
|
<div className={`w-125 p-0 pl-1 pb-1`}>
|
||||||
{!editing && (
|
{!editing && (
|
||||||
<>
|
<>
|
||||||
<Label3>{label}</Label3>
|
<Label3 noMargin className="h-4 text-[13px] my-[3px] mb-1">
|
||||||
<Info3>{value}</Info3>
|
{label}
|
||||||
|
</Label3>
|
||||||
|
<Info3 noMargin className={classnames(info3ClassNames)}>
|
||||||
|
{value}
|
||||||
|
</Info3>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{editing && (
|
{editing && (
|
||||||
|
|
@ -81,8 +77,6 @@ const SAVE_CONFIG = gql`
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const useTermsConditionsStyles = makeStyles(global)
|
|
||||||
|
|
||||||
const TermsConditions = () => {
|
const TermsConditions = () => {
|
||||||
const [error, setError] = useState(null)
|
const [error, setError] = useState(null)
|
||||||
const [editing, setEditing] = useState(false)
|
const [editing, setEditing] = useState(false)
|
||||||
|
|
@ -95,8 +89,6 @@ const TermsConditions = () => {
|
||||||
onError: e => setError(e)
|
onError: e => setError(e)
|
||||||
})
|
})
|
||||||
|
|
||||||
const classes = useTermsConditionsStyles()
|
|
||||||
|
|
||||||
const { data } = useQuery(GET_CONFIG)
|
const { data } = useQuery(GET_CONFIG)
|
||||||
|
|
||||||
const termsAndConditions =
|
const termsAndConditions =
|
||||||
|
|
@ -169,72 +161,30 @@ const TermsConditions = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={classes.header}>
|
<Header
|
||||||
<H4>Terms & Conditions</H4>
|
title="Terms & Conditions"
|
||||||
<HelpTooltip width={320}>
|
tooltipText="For details on configuring this panel, please read the relevant knowledgebase article:"
|
||||||
<P>
|
articleUrl="https://support.lamassu.is/hc/en-us/articles/360015982211-Terms-and-Conditions"
|
||||||
For details on configuring this panel, please read the relevant
|
/>
|
||||||
knowledgebase article:
|
<SwitchRow
|
||||||
</P>
|
title="Show on screen"
|
||||||
<SupportLinkButton
|
checked={showOnScreen}
|
||||||
link="https://support.lamassu.is/hc/en-us/articles/360015982211-Terms-and-Conditions"
|
save={it => save({ active: it })}
|
||||||
label="Lamassu Support Article"
|
/>
|
||||||
bottomSpace="1"
|
<SwitchRow
|
||||||
/>
|
title="Capture customer photo on acceptance of Terms & Conditions"
|
||||||
</HelpTooltip>
|
checked={tcPhoto}
|
||||||
</div>
|
save={it => save({ tcPhoto: it })}
|
||||||
<div className={classes.switchRow}>
|
/>
|
||||||
<P>Show on screen</P>
|
<SwitchRow
|
||||||
<div className={classes.switch}>
|
title="Add 7 seconds delay on screen"
|
||||||
<Switch
|
checked={addDelayOnScreen}
|
||||||
checked={showOnScreen}
|
save={it => save({ delay: it })}
|
||||||
onChange={event =>
|
/>
|
||||||
save({
|
<div className="flex gap-3">
|
||||||
active: event.target.checked
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Label2>{showOnScreen ? 'Yes' : 'No'}</Label2>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className={classes.switchRow}>
|
|
||||||
<P>
|
|
||||||
Capture customer photo on acceptance <br /> of Terms & Conditions
|
|
||||||
screen
|
|
||||||
</P>
|
|
||||||
<div className={classes.switch}>
|
|
||||||
<Switch
|
|
||||||
checked={tcPhoto}
|
|
||||||
onChange={event =>
|
|
||||||
save({
|
|
||||||
tcPhoto: event.target.checked
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Label2>{tcPhoto ? 'Yes' : 'No'}</Label2>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className={classes.switchRow}>
|
|
||||||
<P>Add 7 seconds delay on screen</P>
|
|
||||||
<div className={classes.switch}>
|
|
||||||
<Switch
|
|
||||||
checked={addDelayOnScreen}
|
|
||||||
onChange={event =>
|
|
||||||
save({
|
|
||||||
delay: event.target.checked
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Label2>{addDelayOnScreen ? 'Yes' : 'No'}</Label2>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className={classes.header}>
|
|
||||||
<Info2>Info card</Info2>
|
<Info2>Info card</Info2>
|
||||||
{!editing && (
|
{!editing && (
|
||||||
<IconButton
|
<IconButton onClick={() => setEditing(true)} size="large">
|
||||||
className={classes.transparentButton}
|
|
||||||
onClick={() => setEditing(true)}
|
|
||||||
size="large">
|
|
||||||
<EditIcon />
|
<EditIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
)}
|
)}
|
||||||
|
|
@ -251,10 +201,10 @@ const TermsConditions = () => {
|
||||||
setError(null)
|
setError(null)
|
||||||
}}>
|
}}>
|
||||||
{({ errors }) => (
|
{({ errors }) => (
|
||||||
<Form>
|
<Form className="flex flex-col gap-6">
|
||||||
<PromptWhenDirty />
|
<PromptWhenDirty />
|
||||||
{fields.map((f, idx) => (
|
{fields.map((f, idx) => (
|
||||||
<div className={classes.row} key={idx}>
|
<div className="flex gap-7" key={idx}>
|
||||||
<Field
|
<Field
|
||||||
editing={editing}
|
editing={editing}
|
||||||
name={f.name}
|
name={f.name}
|
||||||
|
|
@ -268,7 +218,7 @@ const TermsConditions = () => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
<div className={classnames(classes.row, classes.submit)}>
|
<div className="flex gap-10">
|
||||||
{editing && (
|
{editing && (
|
||||||
<>
|
<>
|
||||||
<Link color="primary" type="submit">
|
<Link color="primary" type="submit">
|
||||||
|
|
@ -288,7 +238,7 @@ const TermsConditions = () => {
|
||||||
)}
|
)}
|
||||||
</Formik>
|
</Formik>
|
||||||
</>
|
</>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default TermsConditions
|
export default TermsConditions
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
import React from 'react'
|
||||||
|
import { H4, P } from 'src/components/typography/index.jsx'
|
||||||
|
import { HelpTooltip } from 'src/components/Tooltip.jsx'
|
||||||
|
import { SupportLinkButton } from 'src/components/buttons/index.js'
|
||||||
|
|
||||||
|
const Header = ({ title, tooltipText, articleUrl }) => (
|
||||||
|
<div className="flex items-center">
|
||||||
|
<H4>{title}</H4>
|
||||||
|
<HelpTooltip width={320}>
|
||||||
|
<P>{tooltipText}</P>
|
||||||
|
<SupportLinkButton
|
||||||
|
link={articleUrl}
|
||||||
|
label="Lamassu Support Article"
|
||||||
|
bottomSpace="1"
|
||||||
|
/>
|
||||||
|
</HelpTooltip>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
export default Header
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
import { Label1 } from 'src/components/typography'
|
||||||
|
|
||||||
|
const InfoMessage = ({ Icon, children }) => (
|
||||||
|
<div className="flex my-13 gap-4">
|
||||||
|
<Icon />
|
||||||
|
<Label1 className="w-83 text-comet mt-1">{children}</Label1>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
export default InfoMessage
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
import React, { memo } from 'react'
|
||||||
|
import { Label2, P } from 'src/components/typography/index.jsx'
|
||||||
|
import Switch from '@mui/material/Switch'
|
||||||
|
|
||||||
|
const SwitchRow = memo(({ title, disabled = false, checked, save }) => {
|
||||||
|
return (
|
||||||
|
<div className="flex justify-between w-99">
|
||||||
|
<P>{title}</P>
|
||||||
|
<div className="flex items-center">
|
||||||
|
<Switch
|
||||||
|
disabled={disabled}
|
||||||
|
checked={checked}
|
||||||
|
onChange={event => save && save(event.target.checked)}
|
||||||
|
/>
|
||||||
|
<Label2>{checked ? 'Yes' : 'No'}</Label2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
export default SwitchRow
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import Grid from '@mui/material/Grid'
|
|
||||||
import { makeStyles } from '@mui/styles'
|
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import { Formik, Form, FastField } from 'formik'
|
import { Formik, Form, FastField } from 'formik'
|
||||||
import * as R from 'ramda'
|
import * as R from 'ramda'
|
||||||
|
|
@ -8,29 +6,7 @@ import ErrorMessage from 'src/components/ErrorMessage'
|
||||||
|
|
||||||
import { Button } from 'src/components/buttons'
|
import { Button } from 'src/components/buttons'
|
||||||
import { SecretInput } from 'src/components/inputs/formik'
|
import { SecretInput } from 'src/components/inputs/formik'
|
||||||
import { spacer } from 'src/styling/variables'
|
|
||||||
|
|
||||||
const styles = {
|
|
||||||
footer: {
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: 'row',
|
|
||||||
margin: [['auto', 0, spacer * 4, 0]]
|
|
||||||
},
|
|
||||||
button: {
|
|
||||||
margin: [['auto', 0, 0, 'auto']]
|
|
||||||
},
|
|
||||||
form: {
|
|
||||||
flex: 1,
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: 'column'
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
marginBottom: 24,
|
|
||||||
marginTop: 12
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const useStyles = makeStyles(styles)
|
|
||||||
const FormRenderer = ({
|
const FormRenderer = ({
|
||||||
validationSchema,
|
validationSchema,
|
||||||
elements,
|
elements,
|
||||||
|
|
@ -40,8 +16,6 @@ const FormRenderer = ({
|
||||||
buttonClass,
|
buttonClass,
|
||||||
xs = 12
|
xs = 12
|
||||||
}) => {
|
}) => {
|
||||||
const classes = useStyles()
|
|
||||||
|
|
||||||
const initialValues = R.compose(
|
const initialValues = R.compose(
|
||||||
R.mergeAll,
|
R.mergeAll,
|
||||||
R.map(({ code }) => ({ [code]: (value && value[code]) ?? '' }))
|
R.map(({ code }) => ({ [code]: (value && value[code]) ?? '' }))
|
||||||
|
|
@ -74,11 +48,11 @@ const FormRenderer = ({
|
||||||
validationSchema={validationSchema}
|
validationSchema={validationSchema}
|
||||||
onSubmit={saveNonEmptySecret}>
|
onSubmit={saveNonEmptySecret}>
|
||||||
{({ errors }) => (
|
{({ errors }) => (
|
||||||
<Form className={classes.form}>
|
<Form className="flex flex-col flex-1">
|
||||||
<Grid container spacing={3} className={classes.grid}>
|
<div className="flex flex-col gap-3 mb-6 mt-3">
|
||||||
{elements.map(
|
{elements.map(
|
||||||
({ component, code, display, settings, inputProps }) => (
|
({ component, code, display, settings, inputProps }) => (
|
||||||
<Grid item xs={xs} key={code}>
|
<div key={code}>
|
||||||
<FastField
|
<FastField
|
||||||
component={component}
|
component={component}
|
||||||
{...inputProps}
|
{...inputProps}
|
||||||
|
|
@ -87,18 +61,18 @@ const FormRenderer = ({
|
||||||
settings={settings}
|
settings={settings}
|
||||||
fullWidth={true}
|
fullWidth={true}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</div>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
</Grid>
|
</div>
|
||||||
<div className={classes.footer}>
|
<div className="flex flex-row mt-auto mb-8">
|
||||||
{!R.isEmpty(R.mergeRight(errors, saveError)) && (
|
{!R.isEmpty(R.mergeRight(errors, saveError)) && (
|
||||||
<ErrorMessage>
|
<ErrorMessage>
|
||||||
{R.head(R.values(R.mergeRight(errors, saveError)))}
|
{R.head(R.values(R.mergeRight(errors, saveError)))}
|
||||||
</ErrorMessage>
|
</ErrorMessage>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
className={classnames(classes.button, buttonClass)}
|
className={classnames('mt-auto ml-auto', buttonClass)}
|
||||||
type="submit">
|
type="submit">
|
||||||
{buttonLabel}
|
{buttonLabel}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import { useQuery, useMutation, gql } from "@apollo/client";
|
import { useQuery, useMutation, gql } from '@apollo/client'
|
||||||
import Grid from '@mui/material/Grid'
|
|
||||||
import { makeStyles } from '@mui/styles'
|
|
||||||
import * as R from 'ramda'
|
import * as R from 'ramda'
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import Modal from 'src/components/Modal'
|
import Modal from 'src/components/Modal'
|
||||||
|
|
@ -33,16 +31,6 @@ const SAVE_ACCOUNT = gql`
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const styles = {
|
|
||||||
wrapper: {
|
|
||||||
// widths + spacing is a little over 1200 on the design
|
|
||||||
// this adjusts the margin after a small reduction on card size
|
|
||||||
marginLeft: 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const useStyles = makeStyles(styles)
|
|
||||||
|
|
||||||
const Services = () => {
|
const Services = () => {
|
||||||
const [editingSchema, setEditingSchema] = useState(null)
|
const [editingSchema, setEditingSchema] = useState(null)
|
||||||
|
|
||||||
|
|
@ -57,8 +45,6 @@ const Services = () => {
|
||||||
|
|
||||||
const schemas = _schemas(markets)
|
const schemas = _schemas(markets)
|
||||||
|
|
||||||
const classes = useStyles()
|
|
||||||
|
|
||||||
const accounts = data?.accounts ?? {}
|
const accounts = data?.accounts ?? {}
|
||||||
|
|
||||||
const getItems = (code, elements) => {
|
const getItems = (code, elements) => {
|
||||||
|
|
@ -116,20 +102,19 @@ const Services = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
!loading && (
|
!loading && (
|
||||||
<div className={classes.wrapper}>
|
<div>
|
||||||
<TitleSection title="Third-Party services" />
|
<TitleSection title="Third-Party services" />
|
||||||
<Grid container spacing={4}>
|
<div className="grid grid-cols-3 gap-5">
|
||||||
{R.values(schemas).map(schema => (
|
{R.values(schemas).map(schema => (
|
||||||
<Grid item key={schema.code}>
|
<SingleRowTable
|
||||||
<SingleRowTable
|
key={schema.code}
|
||||||
editMessage={'Configure ' + schema.title}
|
editMessage={'Configure ' + schema.title}
|
||||||
title={schema.title}
|
title={schema.title}
|
||||||
onEdit={() => setEditingSchema(schema)}
|
onEdit={() => setEditingSchema(schema)}
|
||||||
items={getItems(schema.code, schema.elements)}
|
items={getItems(schema.code, schema.elements)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
|
||||||
))}
|
))}
|
||||||
</Grid>
|
</div>
|
||||||
{editingSchema && (
|
{editingSchema && (
|
||||||
<Modal
|
<Modal
|
||||||
title={`Edit ${editingSchema.name}`}
|
title={`Edit ${editingSchema.name}`}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue