diff --git a/apps/web/src/pages/FormEntryPage.tsx b/apps/web/src/pages/FormEntryPage.tsx index 320970b..f4c21dc 100644 --- a/apps/web/src/pages/FormEntryPage.tsx +++ b/apps/web/src/pages/FormEntryPage.tsx @@ -172,6 +172,18 @@ function EntryControl({ ); } +/** Read-only rendering of a stored value: decode code list values and map + * booleans to Yes/No, the same way the editable controls present them. */ +function readOnlyDisplayValue(def: ItemDef, codeList: CodeList | undefined, raw: string): string { + if (raw === "") return ""; + if (codeList) { + const item = codeList.items.find((i) => i.codedValue === raw); + return item ? (displayText(item.decode) ?? item.codedValue) : raw; + } + if (def.dataType === "boolean") return raw === "true" || raw === "1" ? "Yes" : "No"; + return raw; +} + /** Client-side dynamic form state (ADR-0014), recomputed on every edit. */ interface DynamicState { /** Field occurrences not collected under the current responses. */ @@ -282,7 +294,11 @@ function EntryGroup({