import React from 'react'; import classNames from 'classnames'; import { Tag } from '@carbon/react'; import { useTranslation } from 'react-i18next'; import { type WardPatient } from '../../types'; import CodedObsTagsRow from '../../ward-patient-card/card-rows/coded-obs-tags-row.component'; import MaternalWardPatientCardHeader from './maternal-ward-patient-card-header.component'; import maternalWardPatientCardStyles from './maternal-ward-patient-card.scss'; import MotherChildRow from '../../ward-patient-card/card-rows/mother-child-row.component'; import PendingItemsRow from '../../ward-patient-card/card-rows/pending-items-row.component'; import WardPatientCard from '../../ward-patient-card/ward-patient-card.component'; import WardPatientObs from '../../ward-patient-card/row-elements/ward-patient-obs.component'; import WardPatientTimeOnWard from '../../ward-patient-card/row-elements/ward-patient-time-on-ward.component'; import styles from '../../ward-patient-card/ward-patient-card.scss'; import IncorrectAdmissionWarningRow from '../../ward-patient-card/card-rows/incorrect-admission-warning-row.component'; export interface MaternalWardPatientCardProps { /** * the patient to render. Note that this patient can be a mother or a child */ wardPatient: WardPatient; /** * Children of the wardPatient occupying the same bed. A non-empty array implies that the wardPatient * is a mother. */ childrenOfWardPatientInSameBed: WardPatient[]; } /** * One major different between MaternalWardPatientCard vs DefaultWardPatientCard, besides the * different elements being rendered, is that it renders just not the patient card for the patient, * but also those of the the patient's children in same bed. This is done to ensure that the children's * patient cards are always rendered right below the mother's. * * @param props * @returns */ const MaternalWardPatientCard: React.FC = (props) => { const { wardPatient, childrenOfWardPatientInSameBed } = props; const { patient, visit, bed, inpatientAdmission } = wardPatient; const { encounterAssigningToCurrentInpatientLocation } = inpatientAdmission ?? {}; const card = ( <>
{childrenOfWardPatientInSameBed?.map((childWardPatient) => { // for eahch child, includes the mother and the child's siblings const relatedTransferPatients = [ wardPatient, ...childrenOfWardPatientInSameBed.filter((wp) => wp.patient.uuid !== childWardPatient.patient.uuid), ]; return ( ); })} ); if (bed) { return card; } else { return (
{card}
); } }; const MotherChildBedShareDivider = () => { const { t } = useTranslation(); return (
{t('motherChildBedShare', 'Mother / Child')}
); }; export default MaternalWardPatientCard;