/** @module @category UI */ import React from 'react'; import { FormLabel, Tag } from '@carbon/react'; import { useConfig, usePrimaryIdentifierCode } from '@openmrs/esm-react-utils'; import { type StyleguideConfigObject } from '../../config-schema'; import styles from './patient-banner-patient-info.module.scss'; interface IdentifiersProps { showIdentifierLabel: boolean; type: fhir.CodeableConcept | undefined; value: string | undefined; } interface PatientBannerPatientIdentifiersProps { identifiers: fhir.Identifier[] | undefined; showIdentifierLabel: boolean; } function PrimaryIdentifier({ showIdentifierLabel, type, value }: IdentifiersProps) { return ( {showIdentifierLabel && type?.text && {type.text}: } {value} ); } function SecondaryIdentifier({ showIdentifierLabel, type, value }: IdentifiersProps) { return ( {showIdentifierLabel && {type?.text}: } {value} ); } export function PatientBannerPatientIdentifiers({ identifiers, showIdentifierLabel, }: PatientBannerPatientIdentifiersProps) { const { excludePatientIdentifierCodeTypes } = useConfig(); const { primaryIdentifierCode } = usePrimaryIdentifierCode(); const filteredIdentifiers = identifiers?.filter((identifier) => { const code = identifier.type?.coding?.[0]?.code; return code && !excludePatientIdentifierCodeTypes?.uuids.includes(code); }) ?? []; return ( <> {filteredIdentifiers?.length ? filteredIdentifiers.map(({ value, type }, index) => ( {type?.coding?.[0]?.code === primaryIdentifierCode ? ( ) : ( )} {index < filteredIdentifiers.length - 1 && ·} )) : ''} ); } export default PatientBannerPatientIdentifiers;