feature: Phase 2- splitting the treatment schema into TreatmentDetail and LabCase.
This commit is contained in:
@@ -2,21 +2,26 @@
|
||||
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { formatCaseSentLines } from '@/components/treatment/caseSendLabel';
|
||||
import type { LinkedOrganizationOption, PastTreatmentCase, TreatmentCaseDraft } from '@/types/treatment';
|
||||
import type { LabCaseSendInfo, LinkedOrganizationOption } from '@/types/treatment';
|
||||
|
||||
interface CaseSentLabelProps {
|
||||
treatmentCase: Pick<
|
||||
PastTreatmentCase | TreatmentCaseDraft,
|
||||
'sends' | 'sendToOrganizationIds' | 'sentAt'
|
||||
>;
|
||||
treatmentCase: {
|
||||
sends?: LabCaseSendInfo[];
|
||||
sendToOrganizationIds?: string[];
|
||||
destinationOrganizationId?: string | null;
|
||||
sentAt?: string | null;
|
||||
};
|
||||
orgs?: LinkedOrganizationOption[];
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function CaseSentLabel({ treatmentCase, orgs, className = 'text-xs text-text-muted' }: CaseSentLabelProps) {
|
||||
const t = useTranslations('treatment');
|
||||
const organizationIds =
|
||||
treatmentCase.sendToOrganizationIds ??
|
||||
(treatmentCase.destinationOrganizationId ? [treatmentCase.destinationOrganizationId] : []);
|
||||
const lines = formatCaseSentLines(treatmentCase.sends, {
|
||||
organizationIds: treatmentCase.sendToOrganizationIds ?? [],
|
||||
organizationIds,
|
||||
sentAt: treatmentCase.sentAt ?? null,
|
||||
orgs,
|
||||
}, t);
|
||||
|
||||
Reference in New Issue
Block a user