improvement: treatment plan turned into a wizard. shift+click control added to FDI tooth chart for cunnected prosthesises.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
name: dyolink-treatment-workspace
|
||||
|
||||
description: Treatment tab workspace — appointments strip, preview vs form, history, load flow, draft autosave, lab dispatch. Use when changing treatment UX, preview/history, or lab dispatch in TreatmentWorkspace.
|
||||
description: Treatment tab workspace — appointments strip, preview vs form, history, load flow, draft autosave, entry wizard, connected teeth, lab dispatch. Use when changing treatment UX, preview/history, or lab dispatch in TreatmentWorkspace.
|
||||
|
||||
---
|
||||
|
||||
@@ -28,7 +28,37 @@ Thin route: `app/[locale]/(dashboard)/treatment/page.tsx` (supports `?appointmen
|
||||
|
||||
3. **Treatment history** — `PastTreatmentsPanel.tsx` (past saved plans for patient; **client-side** filters in `treatmentHistoryFilters.ts`)
|
||||
|
||||
4. **Editor** — `TreatmentDetailsEditor.tsx`, `FdiToothChart.tsx`, `LabCasesDispatchPanel.tsx`
|
||||
4. **Editor** — detail chips + Add (`TreatmentDetailsEditor` chrome); entry wizard (`WizardStepper`); step panels: `FdiToothChart`, Content fields, `LabCasesDispatchPanel`
|
||||
|
||||
|
||||
|
||||
## Entry wizard (Teeth / Content / Lab)
|
||||
|
||||
|
||||
|
||||
Right-column entry uses `WizardStepper` (`components/ui/shared/WizardStepper.tsx`) — numbered nodes + connector rail. **Do not** reuse detail-chip tab styling for steps.
|
||||
|
||||
| Step | UI | Notes |
|
||||
|------|-----|--------|
|
||||
| **Teeth** | `FdiToothChart` | Shift+click range; connected dots |
|
||||
| **Content** | `TreatmentDetailsEditor` fields only (`showChrome={false}`) | Type / notes / attachments — **no delete button** |
|
||||
| **Lab** | `LabCasesDispatchPanel` | Shown in stepper **only** when active detail type is lab-dependent (`labDependentCodes`) |
|
||||
|
||||
- Detail type may differ from appointment purpose (purpose only defaults new details).
|
||||
- Next/Back navigate visible steps; leaving prosthesis while on Lab returns to Content.
|
||||
|
||||
|
||||
|
||||
## Tooth selection groups
|
||||
|
||||
|
||||
|
||||
Helpers: `frontend/src/components/treatment/toothSelectionGroups.ts`. Persisted as `toothSelectionGroups` on the detail; lab tasks group by `selectionGroupId`.
|
||||
|
||||
- **Plain click:** add/remove single; if tooth is in a **connected** group → drop the whole span and keep **only** that tooth as a single (no peel / no connected+single pair for the same span).
|
||||
- **Shift+click:** inclusive same-arch range between prior anchor and target; replaces overlapping groups. Prevent browser selection artifacts (`select-none`, Shift `preventDefault` on mousedown).
|
||||
- On group change, prune/remap `labCase.toothProsthesis` via `pruneToothProsthesisForGroups`.
|
||||
- Connected UI label: `ConnectedSelectionBadge` (shared `Badge` + primary tint) in dispatch + lab case lists.
|
||||
|
||||
|
||||
|
||||
@@ -161,17 +191,27 @@ Draft writes require provider match (`ensureAppointmentProvider`) unless org own
|
||||
|
||||
## Edit gating
|
||||
|
||||
|
||||
|
||||
```typescript
|
||||
|
||||
canEditTreatmentForDay = canEdit && selectedAppointment && !isViewingPastDay && workspaceMode === 'live'
|
||||
|
||||
```
|
||||
|
||||
Past day or `historical` workspace mode freezes the treatment form + most lab-dispatch fields.
|
||||
|
||||
### Per-detail sent lock
|
||||
|
||||
`isDetailLocked` = linked lab case has `sentAt`. Locked details: type, comment, teeth, attachments are read-only (UI + draft save skips updates/deletes; attachment upload returns `TREATMENT_DETAIL_SENT`).
|
||||
|
||||
### Add / remove details
|
||||
|
||||
- **Add detail** stays enabled whenever `canEditTreatmentForDay` — even if sibling details are already sent.
|
||||
- **Remove detail:** trash icon on each **detail chip** in chrome (`TreatmentDetailsEditor` `showChrome`). Same gates as before: only when `details.length > 1`; disabled when `!canEdit`, day/workspace `disabled`, detail sent (`isDetailLocked`), or `uploadBusy`. Confirm via `confirmRemoveDetail`. Drop linked unsent lab drafts with the detail. **Do not** put a delete control in the Content wizard step.
|
||||
|
||||
### Sent lab shipment fields (vs detail)
|
||||
|
||||
After send, destination / prosthesis / shipment attachments are frozen. **Due date** stays editable until all lab tasks complete (UI still respects day/mode `disabled`). **Comments** stay editable until tasks complete and intentionally ignore the day/mode gate.
|
||||
|
||||
Full map helpers: `treatmentDetailRules.ts`, `LabCasesDispatchPanel.tsx`.
|
||||
|
||||
## Optional fields
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user