fix: inverted name and phone positions on the customers list
fix: use the correct variables for getting the customers status fix: customer name was showing as 'undefined undefined' when not present fix: use the phone number as a fallback for the customer name when it's not present fix: removed phone number compliance card fix: set a fixed size for the popup photos
This commit is contained in:
parent
f53a934092
commit
15618df4ef
10 changed files with 117 additions and 100 deletions
26
new-lamassu-admin/src/pages/Customers/helper.js
Normal file
26
new-lamassu-admin/src/pages/Customers/helper.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { parsePhoneNumberFromString } from 'libphonenumber-js'
|
||||
import * as R from 'ramda'
|
||||
|
||||
const CUSTOMER_BLOCKED = 'blocked'
|
||||
|
||||
const getAuthorizedStatus = it =>
|
||||
it.authorizedOverride === CUSTOMER_BLOCKED
|
||||
? { label: 'Blocked', type: 'error' }
|
||||
: it.daysSuspended > 0
|
||||
? { label: `${it.daysSuspended} day suspension`, type: 'warning' }
|
||||
: { label: 'Authorized', type: 'success' }
|
||||
|
||||
const getFormattedPhone = (phone, country) =>
|
||||
phone && country
|
||||
? parsePhoneNumberFromString(phone, country).formatInternational()
|
||||
: ''
|
||||
|
||||
const getName = it => {
|
||||
const idData = R.path(['idCardData'])(it)
|
||||
|
||||
return `${R.path(['firstName'])(idData) ?? ''} ${R.path(['lastName'])(
|
||||
idData
|
||||
) ?? ''}`.trim()
|
||||
}
|
||||
|
||||
export { getAuthorizedStatus, getFormattedPhone, getName }
|
||||
Loading…
Add table
Add a link
Reference in a new issue