Merge pull request #1160 from siiky/fix/lam-376/transactions-page
fix: crash on customers with no ID card data
This commit is contained in:
commit
6f4846b6c8
1 changed files with 13 additions and 7 deletions
|
|
@ -158,18 +158,24 @@ const Transactions = () => {
|
||||||
return history.push(`/compliance/customer/${customerId}`)
|
return history.push(`/compliance/customer/${customerId}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatCustomerName = customer => {
|
const formatCustomerName = ({ firstName, lastName }) =>
|
||||||
const { firstName, lastName } = customer
|
R.isNil(firstName) && R.isNil(lastName)
|
||||||
|
? null
|
||||||
return `${R.o(R.toUpper, R.head)(firstName)}. ${lastName}`
|
: R.isNil(firstName)
|
||||||
}
|
? lastName
|
||||||
|
: R.isNil(lastName)
|
||||||
|
? firstName
|
||||||
|
: `${R.o(R.toUpper, R.head)(firstName)}. ${lastName}`
|
||||||
|
|
||||||
const getCustomerDisplayName = tx => {
|
const getCustomerDisplayName = tx => {
|
||||||
if (tx.isAnonymous) return 'Anonymous'
|
if (tx.isAnonymous) return 'Anonymous'
|
||||||
if (tx.customerName) return tx.customerName
|
if (tx.customerName) return tx.customerName
|
||||||
if (tx.customerIdCardData) return formatCustomerName(tx.customerIdCardData)
|
const customerName = tx.customerIdCardData
|
||||||
return tx.customerPhone
|
? formatCustomerName(tx.customerIdCardData)
|
||||||
|
: null
|
||||||
|
return R.defaultTo(tx.customerPhone, customerName)
|
||||||
}
|
}
|
||||||
|
|
||||||
const elements = [
|
const elements = [
|
||||||
{
|
{
|
||||||
header: '',
|
header: '',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue