diff --git a/src/components/Credentials/CredentialInfo.js b/src/components/Credentials/CredentialInfo.js index 27c4b3c..062a4ed 100644 --- a/src/components/Credentials/CredentialInfo.js +++ b/src/components/Credentials/CredentialInfo.js @@ -2,8 +2,8 @@ import React, { useEffect, useState } from 'react'; import { BiSolidCategoryAlt, BiSolidUserCircle } from 'react-icons/bi'; import { AiFillCalendar } from 'react-icons/ai'; import { RiPassExpiredFill, RiPassValidFill } from 'react-icons/ri'; -import { MdTitle, MdGrade, MdOutlineNumbers, MdFlag, MdLocalPolice } from 'react-icons/md'; -import { TbRating18Plus } from "react-icons/tb"; +import { MdTitle, MdGrade, MdOutlineNumbers, MdFlag, MdLocalPolice, MdHome } from 'react-icons/md'; +import { TbRating12Plus, TbRating14Plus, TbRating16Plus, TbRating18Plus, TbRating21Plus, TbCirclePlus } from "react-icons/tb"; import { GiLevelEndFlag } from 'react-icons/gi'; import { formatDate } from '../../functions/DateFormat'; import { parseCredential } from '../../functions/parseCredential'; @@ -18,8 +18,18 @@ const getFieldIcon = (fieldName) => { return ; case 'dateOfBirth': return ; + case 'over12': + return ; + case 'over14': + return ; + case 'over16': + return ; case 'over18': return ; + case 'over21': + return ; + case 'over': + return ; case 'id': return ; case 'familyName': @@ -35,6 +45,8 @@ const getFieldIcon = (fieldName) => { return ; case 'issuingCountry': return ; + case 'address': + return ; default: return null; } @@ -61,7 +73,7 @@ const renderRow = (fieldName, label, fieldValue) => { } }; -const CredentialInfo = ({ credential, mainClassName = "text-xs sm:text-sm md:text-base pt-5 pr-2 w-full" }) => { +const CredentialInfo = ({ credential, mainClassName = "text-xs sm:text-sm md:text-base pt-5 pr-2 w-full", displayAgeFields = 'false', displayExtraFields = 'false'}) => { const [parsedCredential, setParsedCredential] = useState(null); @@ -87,17 +99,55 @@ const CredentialInfo = ({ credential, mainClassName = "text-xs sm:text-sm md:tex {renderRow('familyName', 'Family Name', parsedCredential?.familyName)} {renderRow('familyName', 'Family Name', parsedCredential?.family_name)} {renderRow('familyName', 'Given Name', parsedCredential?.given_name)} + {renderRow('familyName', 'Birth Family Name', parsedCredential?.birth_family_name)} + {renderRow('familyName', 'Birth Family Name', parsedCredential?.family_name_birth)} + {parsedCredential?.nationalities && renderRow('placeOfBirth', 'Nationality', parsedCredential?.nationalities[0])} + {renderRow('placeOfBirth', 'Nationality', parsedCredential?.nationality?.value)} + {renderRow('placeOfBirth', 'Nationality (Country)', parsedCredential?.nationality?.countryName)} {renderRow('placeOfBirth', 'Place of Birth', parsedCredential?.place_of_birth?.locality)} {renderRow('placeOfBirth', 'Place of Birth', parsedCredential?.birth_place)} {renderRow('issuingCountry', 'Issuing Country', parsedCredential?.issuing_country)} {renderRow('issuingCountry', 'Issuing Authority', parsedCredential?.issuing_authority)} + {renderRow('issuingCountry', 'Issuing Company', parsedCredential?.issuing_company)} {renderRow('firstName', 'First Name', parsedCredential?.firstName)} {renderRow('id', 'Personal ID', parsedCredential?.personalIdentifier)} {renderRow('dateOfBirth', 'Birthday', parsedCredential?.dateOfBirth)} {renderRow('dateOfBirth', 'Birthday', parsedCredential?.birthdate)} {renderRow('dateOfBirth', 'Birthday', parsedCredential?.birth_date)} - {renderRow('over18', 'Age Over 18', parsedCredential?.age_equal_or_over ? parsedCredential?.age_equal_or_over['18'] : null)} - {renderRow('over18', 'Age Over 18', parsedCredential?.age_over_18)} + + {displayAgeFields === 'true' && ( + <> + {renderRow('over12', 'Age Over 12', parsedCredential?.age_equal_or_over ? parsedCredential?.age_equal_or_over['12'] : null)} + {renderRow('over14', 'Age Over 14', parsedCredential?.age_equal_or_over ? parsedCredential?.age_equal_or_over['14'] : null)} + {renderRow('over16', 'Age Over 16', parsedCredential?.age_equal_or_over ? parsedCredential?.age_equal_or_over['16'] : null)} + {renderRow('over18', 'Age Over 18', parsedCredential?.age_equal_or_over ? parsedCredential?.age_equal_or_over['18'] : null)} + {renderRow('over21', 'Age Over 21', parsedCredential?.age_equal_or_over ? parsedCredential?.age_equal_or_over['21'] : null)} + + {renderRow('over12', 'Age Over 12', parsedCredential?.age_over_12)} + {renderRow('over14', 'Age Over 14', parsedCredential?.age_over_14)} + {renderRow('over16', 'Age Over 16', parsedCredential?.age_over_16)} + {renderRow('over18', 'Age Over 18', parsedCredential?.age_over_18)} + {renderRow('over21', 'Age Over 21', parsedCredential?.age_over_21)} + {renderRow('over', 'Age Over 65', parsedCredential?.age_over_65)} + + {renderRow('dateOfBirth', 'Birthday (Year)', parsedCredential?.age_birth_year)} + {renderRow('dateOfBirth', 'Age in years', parsedCredential?.age_in_years)} + + + )} + {displayExtraFields === 'true' && ( + <> + {renderRow('address', 'Resident Country', parsedCredential?.resident_country)} + {renderRow('address', 'Resident City', parsedCredential?.resident_city)} + {renderRow('address', 'Resident Postal Code', parsedCredential?.resident_postal_code)} + {renderRow('address', 'Resident Street', parsedCredential?.resident_street)} + + {renderRow('address', 'Address (City)', parsedCredential?.address?.locality)} + {renderRow('address', 'Address (Country)', parsedCredential?.address?.country)} + {renderRow('address', 'Address (Postal Code)', parsedCredential?.address?.postal_code)} + {renderRow('address', 'Address (Street)', parsedCredential?.address?.street_address)} + + )} )} diff --git a/src/components/Popups/SelectCredentials.js b/src/components/Popups/SelectCredentials.js index 4484ded..4b90212 100644 --- a/src/components/Popups/SelectCredentials.js +++ b/src/components/Popups/SelectCredentials.js @@ -248,9 +248,9 @@ function SelectCredentials({ showPopup, setShowPopup, setSelectionMap, conforman additionalClassName='text-xs w-full' />
- +
diff --git a/src/pages/History/History.js b/src/pages/History/History.js index 99a3d17..ba8fca5 100644 --- a/src/pages/History/History.js +++ b/src/pages/History/History.js @@ -175,7 +175,7 @@ const History = () => {
- +