fix: allow text on company number

fix: data wasn't updated after saving

fix: fixed switches on all of the operator info pages
This commit is contained in:
Liordino Neto 2020-09-24 21:12:45 -03:00 committed by Josh Harvey
parent b3290602d7
commit b997e9ecf0
4 changed files with 21 additions and 20 deletions

View file

@ -51,6 +51,8 @@ const CoinATMRadar = memo(() => {
refetchQueries: ['getData'] refetchQueries: ['getData']
}) })
const classes = useStyles()
const save = it => const save = it =>
saveConfig({ saveConfig({
variables: { config: toNamespace(namespaces.COIN_ATM_RADAR, it) } variables: { config: toNamespace(namespaces.COIN_ATM_RADAR, it) }
@ -81,7 +83,7 @@ const CoinATMRadar = memo(() => {
</div> </div>
<Row <Row
title={'Share information?'} title={'Share information?'}
checked={coinAtmRadarConfig.active} checked={coinAtmRadarConfig.active || false}
save={value => save({ active: value })} save={value => save({ active: value })}
label={coinAtmRadarConfig.active ? 'Yes' : 'No'} label={coinAtmRadarConfig.active ? 'Yes' : 'No'}
/> />
@ -89,13 +91,13 @@ const CoinATMRadar = memo(() => {
<Row <Row
title={'Commissions'} title={'Commissions'}
disabled={!coinAtmRadarConfig.active} disabled={!coinAtmRadarConfig.active}
checked={coinAtmRadarConfig.commissions} checked={coinAtmRadarConfig.commissions || false}
save={value => save({ commissions: value })} save={value => save({ commissions: value })}
/> />
<Row <Row
title={'Limits and verification'} title={'Limits and verification'}
disabled={!coinAtmRadarConfig.active} disabled={!coinAtmRadarConfig.active}
checked={coinAtmRadarConfig.limitsAndVerification} checked={coinAtmRadarConfig.limitsAndVerification || false}
save={value => save({ limitsAndVerification: value })} save={value => save({ limitsAndVerification: value })}
/> />
</div> </div>

View file

@ -143,7 +143,7 @@ const ContactInfo = () => {
.email('Please enter a valid email address') .email('Please enter a valid email address')
.required(), .required(),
website: Yup.string(), website: Yup.string(),
companyNumber: Yup.number() companyNumber: Yup.string()
}) })
const fields = [ const fields = [
@ -181,7 +181,7 @@ const ContactInfo = () => {
name: 'companyNumber', name: 'companyNumber',
label: 'Company number', label: 'Company number',
value: info.companyNumber ?? '', value: info.companyNumber ?? '',
component: NumberInput component: TextInput
} }
] ]
@ -194,7 +194,7 @@ const ContactInfo = () => {
initialValues: { initialValues: {
active: info.active, active: info.active,
name: findValue('name'), name: findValue('name'),
phone: info.phone ?? '', phone: findValue('phone'),
email: findValue('email'), email: findValue('email'),
website: findValue('website'), website: findValue('website'),
companyNumber: findValue('companyNumber') companyNumber: findValue('companyNumber')
@ -210,7 +210,7 @@ const ContactInfo = () => {
<P>Info card enabled?</P> <P>Info card enabled?</P>
<div className={classes.switch}> <div className={classes.switch}>
<Switch <Switch
checked={info.active} checked={info.active || false}
onChange={event => onChange={event =>
save({ save({
active: event.target.checked active: event.target.checked

View file

@ -52,7 +52,7 @@ const ReceiptPrinting = memo(() => {
<P>Share information?</P> <P>Share information?</P>
<div className={classes.switchWrapper}> <div className={classes.switchWrapper}>
<Switch <Switch
checked={receiptPrintingConfig.active} checked={receiptPrintingConfig.active || false}
onChange={event => onChange={event =>
saveConfig({ saveConfig({
variables: { variables: {

View file

@ -110,19 +110,10 @@ const TermsConditions = () => {
const formData = termsAndConditions ?? {} const formData = termsAndConditions ?? {}
const showOnScreen = termsAndConditions?.active ?? false const showOnScreen = termsAndConditions?.active ?? false
const save = it => { const save = it =>
setError(null) saveConfig({
return saveConfig({
variables: { config: toNamespace(namespaces.TERMS_CONDITIONS, it) } variables: { config: toNamespace(namespaces.TERMS_CONDITIONS, it) }
}) })
}
const handleEnable = () => {
const s = !showOnScreen
save({ active: s })
}
if (!formData) return null
const fields = [ const fields = [
{ {
@ -186,7 +177,14 @@ const TermsConditions = () => {
<div className={classes.section}> <div className={classes.section}>
<div className={classes.enable}> <div className={classes.enable}>
<span>Show on screen</span> <span>Show on screen</span>
<Switch checked={showOnScreen} onChange={handleEnable} value="show" /> <Switch
checked={showOnScreen}
onChange={event =>
save({
active: event.target.checked
})
}
/>
<Label2>{showOnScreen ? 'Yes' : 'No'}</Label2> <Label2>{showOnScreen ? 'Yes' : 'No'}</Label2>
</div> </div>
<div className={classes.header}> <div className={classes.header}>
@ -200,6 +198,7 @@ const TermsConditions = () => {
)} )}
</div> </div>
<Formik <Formik
enableReinitialize
initialValues={initialValues} initialValues={initialValues}
validationSchema={validationSchema} validationSchema={validationSchema}
onSubmit={values => save(values)} onSubmit={values => save(values)}