Files
dyolink/frontend/src/components/ui/treatment/DetailLabSendBadge.tsx

44 lines
1.1 KiB
TypeScript

'use client';
import { useTranslations } from 'next-intl';
import { CaseSentLabel } from '@/components/ui/treatment/CaseSentLabel';
import { labNotSentBadgeClass, labSentBadgeClass } from '@/components/ui/treatment/treatmentStatusStyles';
import type { LinkedOrganizationOption, PastTreatmentDetail } from '@/types/treatment';
interface DetailLabSendBadgeProps {
detail: Pick<
PastTreatmentDetail,
'treatmentType' | 'sentAt' | 'sends' | 'destinationOrganizationId'
>;
labDependentCodes: Set<string>;
orgs?: LinkedOrganizationOption[];
className?: string;
}
export function DetailLabSendBadge({
detail,
labDependentCodes,
orgs,
className = '',
}: DetailLabSendBadgeProps) {
const t = useTranslations('treatment');
if (!labDependentCodes.has(detail.treatmentType)) {
return null;
}
if (detail.sentAt) {
return (
<CaseSentLabel
treatmentCase={detail}
orgs={orgs}
className={`${labSentBadgeClass} ${className}`.trim()}
/>
);
}
return (
<span className={`${labNotSentBadgeClass} ${className}`.trim()}>{t('detailNotSentToLab')}</span>
);
}