improvements: treatment's mobile UI fixed.
This commit is contained in:
@@ -15,7 +15,7 @@ alwaysApply: false
|
||||
- **Lab dispatch UI:** due date end-aligned beside title (`sm:flex-row` + `justify-between`; stacks on mobile). Job list is `LabCaseToothJobsList` → `ProsthesisJobLineLabel` (`13 · Pontic - 14 · PFZ Crown`; inherit `text-xs`; no category). Same-type teeth in one detail share a row; Connected badge only for a real bridge. Content clinical field = **Notes** (not case comments). Sent cases: dest/jobs share a row with the Cases QR thumb; tracker + comments are **full width below** the QR.
|
||||
- **Lab comments:** shared `LabCaseCommentsPanel` (newest-first; sent=`justify-start`, received=`justify-end`; `viewerSide`) across Treatment / Cases / Tasks / share. Use logical `text-start`/`text-end`, not left/right.
|
||||
- **Detail chrome:** chips (type + teeth) + Add at top; **Remove** = trash on chip (unsent, including last line; disabled when day-locked / no edit / uploading). Last-line confirm: plan will be empty until Add. Empty `[]` shows `noDetails` (not the type-first overlay). New treatment seeds one blank detail. No delete in type/notes fields.
|
||||
- **Patient search:** `PatientSearchCombobox` in the **page header** (workspace-wide). Opens today’s strip visit if any, else latest history. No visit/history → inline editor empty state pointing to **New treatment** in the rail (never a dialog, never auto-create). **New treatment** stays at the top of the left rail; selected-patient card sits under it. Picker: Walk-in first, then a matching full-width card for the current named patient (name + mobile/email, else hint), then search. Never auto-create from the appointment card.
|
||||
- **Patient search:** `PatientSearchCombobox` in the **page header** (workspace-wide). Opens today’s strip visit if any, else latest history. No visit/history → inline editor empty state pointing to **New treatment** (never a dialog, never auto-create). **New treatment** stays at the top of the left rail; selected-patient card sits under it. Below `xl`, that card stays on the editor screen; history is the pane behind **History**. Picker: Walk-in first, then a matching full-width card for the current named patient (name + mobile/email, else hint), then search. Never auto-create from the appointment card.
|
||||
- **Lab dispatch attention:** `LabDispatchAttentionPanel` — unsent lab-dependent details; quick jump to dispatch.
|
||||
- **History API:** patient-scoped; filtered by provider on treatment or appointment — owners are not exempt.
|
||||
- **History filters (client-side):** `PastTreatmentsPanel` — “Not shipped to lab” + single date; helpers in `treatmentHistoryFilters.ts`.
|
||||
|
||||
@@ -22,7 +22,7 @@ Thin route: `app/[locale]/(dashboard)/treatment/page.tsx` (supports `?appointmen
|
||||
|
||||
|
||||
|
||||
1. **Day strip** — `AppointmentsStrip.tsx` renders `DayStripItem[]` (`appointment` | `unscheduled`) via `DayStripCard`. Header uses **`ScheduleDayPicker` `compact`**: date is centered in a 3-col grid; no “Schedule date” label; **Today** sits on the navigator (`CalendarDaySelect` when the label row is hidden). Timed appointments keep treatment-type pastel banners. Unscheduled cards use the same banner from the **first detail’s type only** (`unscheduledStripColorCode`; live draft for the open card; `draftHydratingRef` must be set **before** strip/appointment pick so overlay does not paint the previous card’s type). Empty first line → chip theming even if later lines are typed. Trash inherits banner ink on typed cards. Strip trash only when `areUnscheduledDetailsStripDeletable` (no type/teeth/notes/attachments, including `[]`). Workspace fetches `GET /appointments` **and** `GET /treatments/day`. Patient search (`PatientSearchCombobox`) sits in the **page header** (workspace-wide). **New treatment** is one shared `Button` at the **top of the left rail**, with the selected-patient card under it: it opens `NewTreatmentPatientPicker` (Walk-in always first, then a matching full-width card for the current named patient with name + mobile/email or hint, then search). Creating happens only after an explicit patient choice — never from the selected appointment card. New treatment seeds one blank detail so the type field is ready; a persisted empty plan hydrates as `[]` until Add (`noDetails` copy — not the type-first overlay). Last-line chip delete confirms the plan will be empty until Add.
|
||||
1. **Day strip** — `AppointmentsStrip.tsx` renders `DayStripItem[]` (`appointment` | `unscheduled`) via `DayStripCard`. Header uses **`ScheduleDayPicker` `compact`**: date is centered in a 3-col grid; no “Schedule date” label; **Today** sits on the navigator (`CalendarDaySelect` when the label row is hidden). Timed appointments keep treatment-type pastel banners. Unscheduled cards use the same banner from the **first detail’s type only** (`unscheduledStripColorCode`; live draft for the open card; `draftHydratingRef` must be set **before** strip/appointment pick so overlay does not paint the previous card’s type). Empty first line → chip theming even if later lines are typed. Trash inherits banner ink on typed cards. Strip trash only when `areUnscheduledDetailsStripDeletable` (no type/teeth/notes/attachments, including `[]`). Workspace fetches `GET /appointments` **and** `GET /treatments/day`. Patient search (`PatientSearchCombobox`) sits in the **page header** (workspace-wide). **New treatment** is one shared `Button` at the **top of the left rail**, with the selected-patient card under it: it opens `NewTreatmentPatientPicker` (Walk-in always first, then a matching full-width card for the current named patient with name + mobile/email or hint, then search). Creating happens only after an explicit patient choice — never from the selected appointment card. Below `xl`, that card stays on the editor screen; history is the pane behind **History**. New treatment seeds one blank detail so the type field is ready; a persisted empty plan hydrates as `[]` until Add (`noDetails` copy — not the type-first overlay). Last-line chip delete confirms the plan will be empty until Add.
|
||||
|
||||
2. **Treatment preview** — `TreatmentPreviewCard.tsx` (history browse only; omitted for the live draft)
|
||||
|
||||
@@ -205,7 +205,7 @@ Use shared `Checkbox` (not native `<input type="checkbox">`) to avoid focus-driv
|
||||
|
||||
|
||||
|
||||
Walk-in uses one sentinel `Patient` per clinic (`isWalkIn`, hidden from Patients/search/booking). Display via i18n, never the stored name. Named patients are this-org only (`createdByOrganizationId`); another clinic’s identification is `PATIENT_IDENTIFICATION_UNAVAILABLE`, not a shared row. Patient search: same workspace patient with a live visit → no-op; else open today’s strip visit if any; else load latest history into the editor; **no history and no strip visit → do not auto-create**. Detach the previous visit, keep the searched patient, and show an inline editor empty state (`noTreatmentFoundTitle` / `noTreatmentFoundBody`) that points to **New treatment** in the rail (Walk-in, current named patient card, or search).
|
||||
Walk-in uses one sentinel `Patient` per clinic (`isWalkIn`, hidden from Patients/search/booking). Display via i18n, never the stored name. Named patients are this-org only (`createdByOrganizationId`); another clinic’s identification is `PATIENT_IDENTIFICATION_UNAVAILABLE`, not a shared row. Patient search: same workspace patient with a live visit → no-op; else open today’s strip visit if any; else load latest history into the editor; **no history and no strip visit → do not auto-create**. Detach the previous visit, keep the searched patient, and show an inline editor empty state (`noTreatmentFoundTitle` / `noTreatmentFoundBody`) that points to **New treatment** on the same screen (Walk-in, current named patient card, or search).
|
||||
|
||||
Draft writes for appointments require provider match (`ensureAppointmentProvider`). Standalone requires `treatment.providerUserId === actor`.
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ frontend/src/
|
||||
**Treatment tab:** Preview and editable form are **separate** until the user clicks **Load into workspace** on a history item. See `.cursor/skills/treatment-workspace/SKILL.md` before changing that flow.
|
||||
|
||||
**Treatment edit / details (quick ref):**
|
||||
- Day/mode gate: editable only for live draft on today/future (`canEditTreatmentForDay`). Past day / historical load → read-only form. Patient search sits in the **page header** (workspace-wide). If the patient has a visit on the day strip, that visit opens; else the latest history plan loads. Day arrows that land on a day with no visit reset the workspace to one blank detail and no patient, the same as opening Treatment with nothing selected. A day that has a visit still opens it. If neither exists, the editor shows an inline empty state (no dialog) pointing to **New treatment** in the rail — do not auto-create. **New treatment** is at the top of the left rail (selected-patient card below it) and opens a picker: Walk-in first, then a matching card for the current named patient (name + mobile/email), then search. It does not auto-copy the appointment card’s patient. New treatment seeds one blank detail; a persisted empty plan loads as `[]` until Add.
|
||||
- Day/mode gate: editable only for live draft on today/future (`canEditTreatmentForDay`). Past day / historical load → read-only form. Patient search sits in the **page header** (workspace-wide). If the patient has a visit on the day strip, that visit opens; else the latest history plan loads. Day arrows that land on a day with no visit reset the workspace to one blank detail and no patient, the same as opening Treatment with nothing selected. A day that has a visit still opens it. If neither exists, the editor shows an inline empty state (no dialog) pointing to **New treatment** — do not auto-create. **New treatment** is at the top of the left rail (selected-patient card below it). Below `xl`, that card stays on the editor screen; history is the pane behind **History**. and opens a picker: Walk-in first, then a matching card for the current named patient (name + mobile/email), then search. It does not auto-copy the appointment card’s patient. New treatment seeds one blank detail; a persisted empty plan loads as `[]` until Add.
|
||||
- **Unscheduled strip cards** use the same treatment-type banner as appointments from the **first detail’s type only** (`unscheduledStripColorCode`; live draft for the open card). Empty first line → chip theming even if later lines are typed. Strip trash only when every line is blank (no type/teeth/notes/attachments, including `[]`); typed cards need chip-delete first. Backend `DELETE /treatments/:id` is empty-only (`TREATMENT_HAS_DETAILS`).
|
||||
- A sent line stays editable until any lab task is completed, including a step finished by a further lab. Then the line locks (`TREATMENT_DETAIL_SENT`). **Add detail** still OK same day; **Remove detail** = trash on chip (unsent, including last line; day/edit gates apply). A sent line cannot be removed. Empty details persist as `[]`.
|
||||
- **Entry:** Type dropdown + compact attachments strip (`TreatmentDetailAttachmentsStrip`) on one row (plus **Lab dispatch** / **Chart** toggle when the type is lab-dependent; dispatch is primary, Chart is outline; **Add detail** uses the same width), then bordered FDI chart (Cases chrome/scale) **or** the lab dispatch panel in that same slot, then full-width auto-growing **Notes**. Prosthesis types are assigned on the chart (teeth, or Upper/Lower arch labels for jaw products — dashed outline + plus). Arch Upper/Lower/Both remaps existing `UA`/`LA` jobs (Both→Upper clears lower). Picker: `4fr` wrapping category grid / `1fr` add-ons with a vertical divider; tiles use `ProsthesisCatalogIcon` (`md` + two-line labels on category/addon; `sm` + centered icon/label on child cards); expanded children use a parent-colored **L** rail sized to the first child card; parent-bar back arrow is black; empty crown slot is plus + dashed “Crown can be added”; filled crown slot stays visible so it can be changed. Screen type names use `prosthesisTypeLabelStyleFromCatalog`. Implant/post & core show a **crown** suggestion slot; a veneer/inlay/onlay/overlay hides it. The empty **Pontic** suggestion appears only beside an immediate crown/indirect neighbor; a filled Pontic stays visible and the category remains available for pontic-first entry. Post & core is disabled after crown or implant; Implant is disabled after post & core; screw-retained does not suggest another crown. Removable on a tooth shows the full-arch notice (partial is tooth-selected; complete/overdenture use arch controls). Prosthesis teeth always have jobs (hydrate/save prune). Lab-rail / Go to dispatch **opens the dispatch view** (`pendingScrollToLabRef`). Detail chips show type + teeth; lab-dependent chips use colored sent/unsent text. Sent follows the linked lab case `sentAt` (or the detail’s own `sentAt`); editing stays open until a lab step is completed. The sent date stays on dispatch. Lab dispatch keeps comments.
|
||||
|
||||
@@ -796,7 +796,7 @@
|
||||
"loadingAppointments": "Loading appointments…",
|
||||
"selectDayWithAppointment": "Search for a patient or select a visit from the day strip.",
|
||||
"noTreatmentFoundTitle": "No treatment found",
|
||||
"noTreatmentFoundBody": "There is no treatment or visit for {name} yet. You can add one with the {action} button in the rail.",
|
||||
"noTreatmentFoundBody": "There is no treatment or visit for {name} yet. You can add one with the {action} button.",
|
||||
"confirmDiscard": "You have unsaved changes. Discard them and continue?",
|
||||
"errorChooseOrg": "Choose at least one active organization to send this case.",
|
||||
"successCaseSent": "Case sent to selected organizations.",
|
||||
@@ -819,7 +819,7 @@
|
||||
"noAppointment": "No appointment",
|
||||
"walkIn": "Walk-in",
|
||||
"newTreatment": "New treatment",
|
||||
"mobileOpenRail": "Patient / history",
|
||||
"mobileOpenRail": "History",
|
||||
"newTreatmentPatientPrompt": "Who is this visit for?",
|
||||
"newTreatmentUseCurrent": "Use {name}",
|
||||
"newTreatmentUseCurrentHint": "Start a new visit for the patient already open on this page.",
|
||||
|
||||
@@ -797,7 +797,7 @@
|
||||
"loadingAppointments": "در حال بارگذاری نوبتها...",
|
||||
"selectDayWithAppointment": "برای بیمار جستجو کنید یا یک ویزیت را از نوار روز انتخاب کنید.",
|
||||
"noTreatmentFoundTitle": "درمانی یافت نشد",
|
||||
"noTreatmentFoundBody": "هنوز درمان یا ویزیتی برای {name} ثبت نشده است. میتوانید با دکمه {action} در نوار کناری یکی اضافه کنید.",
|
||||
"noTreatmentFoundBody": "هنوز درمان یا ویزیتی برای {name} ثبت نشده است. میتوانید با دکمه {action} یکی اضافه کنید.",
|
||||
"confirmDiscard": "تغییرات ذخیرهنشده دارید. آنها را کنار بگذارید و ادامه دهید؟",
|
||||
"errorChooseOrg": "حداقل یک سازمان فعال را برای ارسال این پرونده انتخاب کنید.",
|
||||
"successCaseSent": "پرونده به سازمانهای انتخاب شده ارسال شد.",
|
||||
@@ -820,7 +820,7 @@
|
||||
"noAppointment": "بدون نوبت",
|
||||
"walkIn": "بدون نوبت (مراجع)",
|
||||
"newTreatment": "درمان جدید",
|
||||
"mobileOpenRail": "بیمار / سابقه",
|
||||
"mobileOpenRail": "سابقه",
|
||||
"newTreatmentPatientPrompt": "این ویزیت برای چه کسی است؟",
|
||||
"newTreatmentUseCurrent": "استفاده از {name}",
|
||||
"newTreatmentUseCurrentHint": "ویزیت جدیدی برای بیماری که همین حالا در این صفحه باز است شروع کنید.",
|
||||
|
||||
@@ -796,7 +796,7 @@
|
||||
"loadingAppointments": "Afspraken laden...",
|
||||
"selectDayWithAppointment": "Zoek een patiënt of kies een bezoek uit de dagstrook.",
|
||||
"noTreatmentFoundTitle": "Geen behandeling gevonden",
|
||||
"noTreatmentFoundBody": "Er is nog geen behandeling of bezoek voor {name}. U kunt er een toevoegen met de knop {action} in de zijbalk.",
|
||||
"noTreatmentFoundBody": "Er is nog geen behandeling of bezoek voor {name}. U kunt er een toevoegen met de knop {action}.",
|
||||
"confirmDiscard": "U heeft niet-opgeslagen wijzigingen. Wilt u deze negeren en doorgaan?",
|
||||
"errorChooseOrg": "Kies ten minste één actieve organisatie om deze case te verzenden.",
|
||||
"successCaseSent": "Case verzonden naar geselecteerde organisaties.",
|
||||
@@ -819,7 +819,7 @@
|
||||
"noAppointment": "Geen afspraak",
|
||||
"walkIn": "Inloop",
|
||||
"newTreatment": "Nieuwe behandeling",
|
||||
"mobileOpenRail": "Patiënt / geschiedenis",
|
||||
"mobileOpenRail": "Geschiedenis",
|
||||
"newTreatmentPatientPrompt": "Voor wie is dit bezoek?",
|
||||
"newTreatmentUseCurrent": "{name} gebruiken",
|
||||
"newTreatmentUseCurrentHint": "Start een nieuw bezoek voor de patiënt die al op deze pagina openstaat.",
|
||||
|
||||
@@ -501,7 +501,7 @@ export function TreatmentWorkspace({
|
||||
const [patientSearchBusy, setPatientSearchBusy] = useState(false);
|
||||
const [newTreatmentPickerOpen, setNewTreatmentPickerOpen] = useState(false);
|
||||
const [creatingStandalone, setCreatingStandalone] = useState(false);
|
||||
/** Below xl: show left rail instead of editor (Cases-style pane swap). */
|
||||
/** Below xl: history pane instead of the editor and patient card. */
|
||||
const [mobileRailOpen, setMobileRailOpen] = useState(false);
|
||||
|
||||
const {
|
||||
@@ -724,12 +724,6 @@ export function TreatmentWorkspace({
|
||||
!historyLoading &&
|
||||
history.length === 0;
|
||||
|
||||
useEffect(() => {
|
||||
if (showNoTreatmentFound) {
|
||||
setMobileRailOpen(true);
|
||||
}
|
||||
}, [showNoTreatmentFound]);
|
||||
|
||||
const unreadUpdatesCount = unreadLabCases.length;
|
||||
const otherPatientsUnreadCount = useMemo(
|
||||
() => unreadLabCases.filter((item) => item.patientId !== activePatientId).length,
|
||||
@@ -2909,11 +2903,10 @@ export function TreatmentWorkspace({
|
||||
|
||||
<div className="treatment-layout-grid grid grid-cols-1 xl:grid-cols-[minmax(300px,380px)_minmax(0,1fr)] gap-4 items-start">
|
||||
<div
|
||||
className={`space-y-3 min-w-0 xl:max-w-[380px] ${
|
||||
mobileRailOpen ? 'block' : 'hidden'
|
||||
className={`min-w-0 xl:col-start-1 xl:row-start-1 xl:max-w-[380px] ${
|
||||
mobileRailOpen ? 'hidden' : 'block'
|
||||
} xl:block`}
|
||||
>
|
||||
<MobileDetailBackButton hideFrom="xl" onClick={() => setMobileRailOpen(false)} />
|
||||
<div className="surface-card p-3 space-y-3">
|
||||
{canEdit && !isViewingPastDay ? (
|
||||
<div className="space-y-2">
|
||||
@@ -2974,6 +2967,14 @@ export function TreatmentWorkspace({
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={`space-y-3 min-w-0 xl:col-start-1 xl:row-start-2 xl:max-w-[380px] ${
|
||||
mobileRailOpen ? 'block' : 'hidden'
|
||||
} xl:block`}
|
||||
>
|
||||
<MobileDetailBackButton hideFrom="xl" onClick={() => setMobileRailOpen(false)} />
|
||||
|
||||
{isBrowsing && previewTreatment ? (
|
||||
<>
|
||||
@@ -3072,7 +3073,7 @@ export function TreatmentWorkspace({
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={`space-y-3 min-w-0 w-full ${
|
||||
className={`space-y-3 min-w-0 w-full xl:col-start-2 xl:row-start-1 xl:row-span-2 ${
|
||||
mobileRailOpen ? 'hidden' : 'block'
|
||||
} xl:block`}
|
||||
>
|
||||
@@ -3080,7 +3081,7 @@ export function TreatmentWorkspace({
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
fullWidth
|
||||
onClick={() => setMobileRailOpen(true)}
|
||||
>
|
||||
{t('mobileOpenRail')}
|
||||
|
||||
Reference in New Issue
Block a user