improvement: treatment preview and treatment history components overhauled. draft & completed status for treatment plan completely removed from the flow.
This commit is contained in:
43
frontend/src/components/ui/treatment/DetailLabSendBadge.tsx
Normal file
43
frontend/src/components/ui/treatment/DetailLabSendBadge.tsx
Normal file
@@ -0,0 +1,43 @@
|
||||
'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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user