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

View file

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

View file

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

View file

@ -110,19 +110,10 @@ const TermsConditions = () => {
const formData = termsAndConditions ?? {}
const showOnScreen = termsAndConditions?.active ?? false
const save = it => {
setError(null)
return saveConfig({
const save = it =>
saveConfig({
variables: { config: toNamespace(namespaces.TERMS_CONDITIONS, it) }
})
}
const handleEnable = () => {
const s = !showOnScreen
save({ active: s })
}
if (!formData) return null
const fields = [
{
@ -186,7 +177,14 @@ const TermsConditions = () => {
<div className={classes.section}>
<div className={classes.enable}>
<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>
</div>
<div className={classes.header}>
@ -200,6 +198,7 @@ const TermsConditions = () => {
)}
</div>
<Formik
enableReinitialize
initialValues={initialValues}
validationSchema={validationSchema}
onSubmit={values => save(values)}