improvement: new prosthesis type data structure implemented and finally working!

This commit is contained in:
2026-09-01 21:03:04 +03:30
parent dc71c73ced
commit a3c14a18c1
51 changed files with 3306 additions and 1117 deletions

View File

@@ -40,10 +40,6 @@ interface TreatmentDetailsEditorProps {
showFields?: boolean;
/** FDI chart (or other) rendered beside notes on wide screens. */
chart?: ReactNode;
/** Shown below chrome (e.g. prosthesis wizard). */
stepper?: ReactNode;
/** Shown below type + chart + notes (e.g. Continue to lab). */
footer?: ReactNode;
/**
* Voice entry. Omit when unavailable — the Add button then renders unsplit, exactly as
* before this feature existed. Presence *is* the availability flag, so the two cannot
@@ -53,6 +49,10 @@ interface TreatmentDetailsEditorProps {
/** Dim the chart until a treatment type is chosen. */
chartLocked?: boolean;
chartLockMessage?: string;
/** Owned by TreatmentWorkspace so lab drafts can be wiped when leaving prosthesis. */
onTreatmentTypeChange?: (nextType: string) => void;
/** Arch-level jobs count as work for the missing-teeth lab banner. */
hasArchJobs?: boolean;
}
export function TreatmentDetailsEditor({
@@ -75,10 +75,10 @@ export function TreatmentDetailsEditor({
showFields = true,
voice,
chart,
stepper,
footer,
chartLocked = false,
chartLockMessage,
onTreatmentTypeChange,
hasArchJobs = false,
}: TreatmentDetailsEditorProps) {
const t = useTranslations('treatment');
const tCommon = useTranslations('common');
@@ -89,10 +89,10 @@ export function TreatmentDetailsEditor({
const readOnly = !activeDetail || disabled || locked;
const showMissingTeethLabBlock = Boolean(
activeDetail &&
isLabDependentDetailMissingTeeth(activeDetail, labDependentCodes),
isLabDependentDetailMissingTeeth(activeDetail, labDependentCodes, hasArchJobs),
);
if (!showChrome && !showFields && !stepper) return null;
if (!showChrome && !showFields) return null;
const treatmentTypeTextColor =
activeDetail && isDetailTypeSelected(activeDetail)
@@ -223,8 +223,6 @@ export function TreatmentDetailsEditor({
</>
) : null}
{stepper && activeDetail ? <div className="pt-1">{stepper}</div> : null}
{activeDetail && showMissingTeethLabBlock ? (
<p className={labBlockedBannerClass}>{t('labShipmentBlockedBody')}</p>
) : null}
@@ -235,7 +233,9 @@ export function TreatmentDetailsEditor({
<Dropdown
label={t('treatmentType')}
value={activeDetail.treatmentType}
onChange={(e) => setActiveType(e.target.value)}
onChange={(e) =>
(onTreatmentTypeChange ?? setActiveType)(e.target.value)
}
disabled={readOnly}
style={{ color: treatmentTypeTextColor }}
>
@@ -287,8 +287,6 @@ export function TreatmentDetailsEditor({
{saveStatus === 'error' && t('saveStatusError')}
</p>
)}
{footer ? <div className="pt-1">{footer}</div> : null}
</div>
) : showFields && !activeDetail ? (
<p className="text-sm text-text-muted">{t('noDetails')}</p>