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