fix: move gender mapping to machine
This commit is contained in:
parent
43827736c0
commit
ab738bdcfa
1 changed files with 1 additions and 18 deletions
|
|
@ -14,21 +14,6 @@ import { getName } from '../helper'
|
||||||
|
|
||||||
import Field from './Field'
|
import Field from './Field'
|
||||||
|
|
||||||
const formatGender = field => {
|
|
||||||
// In US cards, gender comes as a number. In BC and ZA cards, gender comes as a letter
|
|
||||||
const genderMap = {
|
|
||||||
1: 'M',
|
|
||||||
2: 'F'
|
|
||||||
}
|
|
||||||
|
|
||||||
const isNumber = s => {
|
|
||||||
if (typeof s !== 'string') return false
|
|
||||||
return !isNaN(s) && !isNaN(parseInt(s))
|
|
||||||
}
|
|
||||||
|
|
||||||
return !isNumber(field) ? field : genderMap[field]
|
|
||||||
}
|
|
||||||
|
|
||||||
const IdDataCard = memo(({ customerData, updateCustomer }) => {
|
const IdDataCard = memo(({ customerData, updateCustomer }) => {
|
||||||
const idData = R.path(['idCardData'])(customerData)
|
const idData = R.path(['idCardData'])(customerData)
|
||||||
const rawExpirationDate = R.path(['expirationDate'])(idData)
|
const rawExpirationDate = R.path(['expirationDate'])(idData)
|
||||||
|
|
@ -61,9 +46,7 @@ const IdDataCard = memo(({ customerData, updateCustomer }) => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: 'Gender',
|
header: 'Gender',
|
||||||
display: formatGender(
|
display: R.path(['gender'])(idData) ?? R.path(['sex'])(idData),
|
||||||
R.path(['gender'])(idData) ?? R.path(['sex'])(idData)
|
|
||||||
),
|
|
||||||
size: 80
|
size: 80
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue