mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 15:42:24 +00:00
fix(vaccinations): show a dose's linked documents and keep them on edit
A dose opened from the list carried no document links, since only the detail read has them. The edit sheet showed an empty picker, and saving any change sent that empty set, which the route reads as unlink everything. The sheet now reads the dose's own links before it shows them, and a save leaves the links alone unless they were changed. A link to one dose or visit (/vaccinations?dose=, /checkups?visit=) now scrolls to it and opens it for someone who may edit it.
This commit is contained in:
1 parent
31f0d7c9fb
commit
6e05f86e7b
10 files changed
+233
-12
No files matched your search
@@ -22,6 +22,7 @@ import { PageHeader } from "@/components/ui/page-header";
|
||||
import { QueryErrorCard } from "@/components/ui/query-error-card";
|
||||
import { SectionHeading } from "@/components/ui/section-heading";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { useDeepLinkedRecord } from "@/hooks/use-deep-linked-record";
|
||||
import { useRecordCapabilities } from "@/hooks/use-record-capabilities";
|
||||
import { useEncounters, type Encounter } from "@/hooks/use-encounters";
|
||||
import { useTranslations } from "@/lib/i18n/context";
|
||||
@@ -49,6 +50,15 @@ export function VisitsSection({ enabled = true }: { enabled?: boolean }) {
|
||||
|
||||
const upcoming = list.data?.upcoming ?? [];
|
||||
const past = list.data?.past ?? [];
|
||||
|
||||
// `?visit=<id>` — a document's link chip names the visit it is filed
|
||||
// against. Scroll to it, and open it for someone who may edit it.
|
||||
useDeepLinkedRecord({
|
||||
param: "visit",
|
||||
records: list.data ? [...upcoming, ...past] : undefined,
|
||||
anchorAttribute: "data-encounter-id",
|
||||
open: canManageVisits ? openSheet : undefined,
|
||||
});
|
||||
const empty = upcoming.length === 0 && past.length === 0;
|
||||
|
||||
const addButton = canAddVisit ? (
|
||||
|
||||
Reference in new issue
Block a user