import type { Location, Organization } from "fhir/r4"; import { formatSingleAddress } from "../../../utils/fhirAddress"; import { formatFhirContactPoint } from "../../../utils/fhirContactPoint"; import { PRACTICE_TYPE_SYSTEM } from "../../../utils/staffRoleCatalog"; type IdentityFactsProps = { organization: Organization | null | undefined; primaryLocation?: Location; }; // The Identity sheet for organization: view (admin#s-organization, "without permission to manage it"): // every fact the editor holds, as text, and the one line that says who can change them. const IdentityFacts = ({ organization, primaryLocation }: IdentityFactsProps) => { const types = (organization?.type ?? []) .flatMap((t) => t.coding ?? []) .filter((c) => c.system === PRACTICE_TYPE_SYSTEM) .map((c) => c.display || c.code) .filter(Boolean) .join(", "); const facts: [string, string][] = [ ["Practice name", organization?.name || "—"], ["Practice types", types || "—"], ["Primary practice phone", formatFhirContactPoint(organization?.telecom, "phone", ", ", "—")], ["Primary practice email", formatFhirContactPoint(organization?.telecom, "email", ", ", "—")], ["Primary location", primaryLocation ? [primaryLocation.name, primaryLocation.address && formatSingleAddress(primaryLocation.address)].filter(Boolean).join(" · ") : "—"], ]; return (
Changing any of this needs organization: manage. Ask an administrator at this practice.