feat: sms data card info
This commit is contained in:
parent
c072803ac3
commit
894161a998
4 changed files with 28 additions and 5 deletions
|
|
@ -29,7 +29,8 @@ import { EditableCard } from './components'
|
||||||
import {
|
import {
|
||||||
customerDataElements,
|
customerDataElements,
|
||||||
customerDataSchemas,
|
customerDataSchemas,
|
||||||
formatDates
|
formatDates,
|
||||||
|
getFormattedPhone
|
||||||
} from './helper.js'
|
} from './helper.js'
|
||||||
|
|
||||||
const useStyles = makeStyles(styles)
|
const useStyles = makeStyles(styles)
|
||||||
|
|
@ -62,6 +63,7 @@ const Photo = ({ show, src }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const CustomerData = ({
|
const CustomerData = ({
|
||||||
|
locale,
|
||||||
customer,
|
customer,
|
||||||
updateCustomer,
|
updateCustomer,
|
||||||
replacePhoto,
|
replacePhoto,
|
||||||
|
|
@ -96,6 +98,9 @@ const CustomerData = ({
|
||||||
R.path(['customInfoRequests'])(customer) ?? []
|
R.path(['customInfoRequests'])(customer) ?? []
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const phone = R.path(['phone'])(customer)
|
||||||
|
const smsData = R.path(['subscriberInfo'])(customer)
|
||||||
|
|
||||||
const isEven = elem => elem % 2 === 0
|
const isEven = elem => elem % 2 === 0
|
||||||
|
|
||||||
const getVisibleCards = _.filter(elem => elem.isAvailable)
|
const getVisibleCards = _.filter(elem => elem.isAvailable)
|
||||||
|
|
@ -126,6 +131,9 @@ const CustomerData = ({
|
||||||
},
|
},
|
||||||
idCardPhoto: {
|
idCardPhoto: {
|
||||||
idCardPhoto: null
|
idCardPhoto: null
|
||||||
|
},
|
||||||
|
smsData: {
|
||||||
|
phoneNumber: getFormattedPhone(phone, locale.country)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,12 +156,16 @@ const CustomerData = ({
|
||||||
isAvailable: !_.isNil(idData)
|
isAvailable: !_.isNil(idData)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'SMS Confirmation',
|
fields: customerDataElements.smsData,
|
||||||
|
title: 'SMS data',
|
||||||
titleIcon: <PhoneIcon className={classes.cardIcon} />,
|
titleIcon: <PhoneIcon className={classes.cardIcon} />,
|
||||||
authorize: () => {},
|
authorize: () => {},
|
||||||
reject: () => {},
|
reject: () => {},
|
||||||
save: () => {},
|
save: () => {},
|
||||||
isAvailable: false
|
validationSchema: customerDataSchemas.smsData,
|
||||||
|
initialValues: initialValues.smsData,
|
||||||
|
isAvailable: !_.isNil(phone),
|
||||||
|
isDeletable: !_.isNil(smsData) || !_.isEmpty(smsData.result)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Name',
|
title: 'Name',
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ const GET_CUSTOMER = gql`
|
||||||
daysSuspended
|
daysSuspended
|
||||||
isSuspended
|
isSuspended
|
||||||
isTestCustomer
|
isTestCustomer
|
||||||
|
subscriberInfo
|
||||||
customFields {
|
customFields {
|
||||||
id
|
id
|
||||||
label
|
label
|
||||||
|
|
@ -628,6 +629,7 @@ const CustomerProfile = memo(() => {
|
||||||
{isCustomerData && (
|
{isCustomerData && (
|
||||||
<div>
|
<div>
|
||||||
<CustomerData
|
<CustomerData
|
||||||
|
locale={locale}
|
||||||
customer={customerData}
|
customer={customerData}
|
||||||
updateCustomer={updateCustomer}
|
updateCustomer={updateCustomer}
|
||||||
replacePhoto={replacePhoto}
|
replacePhoto={replacePhoto}
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,8 @@ const EditableCard = ({
|
||||||
children,
|
children,
|
||||||
validationSchema,
|
validationSchema,
|
||||||
initialValues,
|
initialValues,
|
||||||
deleteEditedData
|
deleteEditedData,
|
||||||
|
isDeletable
|
||||||
}) => {
|
}) => {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -397,7 +397,12 @@ const customerDataElements = {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
idCardPhoto: [{ name: 'idCardPhoto' }],
|
idCardPhoto: [{ name: 'idCardPhoto' }],
|
||||||
frontCamera: [{ name: 'frontCamera' }]
|
frontCamera: [{ name: 'frontCamera' }],
|
||||||
|
smsData: {
|
||||||
|
name: 'phoneNumber',
|
||||||
|
label: 'Phone number',
|
||||||
|
component: TextInput
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const customerDataSchemas = {
|
const customerDataSchemas = {
|
||||||
|
|
@ -426,6 +431,9 @@ const customerDataSchemas = {
|
||||||
}),
|
}),
|
||||||
frontCamera: Yup.object().shape({
|
frontCamera: Yup.object().shape({
|
||||||
frontCamera: Yup.mixed().required()
|
frontCamera: Yup.mixed().required()
|
||||||
|
}),
|
||||||
|
smsData: Yup.object().shape({
|
||||||
|
phoneNumber: Yup.mixed().required()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue