improvement: treatment plan turned into a wizard. shift+click control added to FDI tooth chart for cunnected prosthesises.

This commit is contained in:
2026-07-17 00:39:32 +03:30
parent cf07b4d8a8
commit 68fc9d5d6d
28 changed files with 1461 additions and 477 deletions

View File

@@ -20,6 +20,42 @@ export function normalizeTeeth(teeth: unknown): string[] {
return [...unique].sort();
}
export type ToothSelectionGroupNormalized = {
groupId: string;
kind: 'connected' | 'single';
teeth: string[];
};
export function normalizeToothSelectionGroups(
value: unknown,
fallbackTeeth: string[] = [],
): ToothSelectionGroupNormalized[] {
if (Array.isArray(value) && value.length > 0) {
const out: ToothSelectionGroupNormalized[] = [];
for (const row of value) {
if (!row || typeof row !== 'object') continue;
const rec = row as Record<string, unknown>;
const groupId = typeof rec.groupId === 'string' && rec.groupId.trim() ? rec.groupId.trim() : '';
if (!groupId) continue;
const kind = rec.kind === 'connected' ? 'connected' : 'single';
const teeth = normalizeTeeth(rec.teeth);
if (teeth.length === 0) continue;
out.push({
groupId,
kind: kind === 'connected' && teeth.length < 2 ? 'single' : kind,
teeth,
});
}
if (out.length > 0) return out;
}
return fallbackTeeth.map((tooth, index) => ({
groupId: `legacy-${tooth}-${index}`,
kind: 'single' as const,
teeth: [tooth],
}));
}
export function generateTreatmentTitle(
cases: { treatmentType: string; teeth: string[] }[],
): string {