"use client"; import * as React from "react"; import { Input } from "../../ui/input"; import { Label } from "../../ui/label"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "../../ui/select"; import { useMessages } from "../../context"; import { StatementAuditSelect, type StatementAuditOption, } from "../StatementAuditSelect"; import { StatementField } from "../StatementField"; import type { StatementFormController } from "../formController"; import { DATE_INPUT, FIELD_GRID, FULL_ROW } from "./layout"; /** Which audit the statement declares, and the choice the page offers. */ export interface StatementAuditChoice { /** A job id, or `LATEST_AUDIT`. */ value: string; onChange: (value: string) => void; options: StatementAuditOption[]; /** * The picker moved and the preview still shows the audit saved before: said * under the picker until the next save. */ unsaved: boolean; } /** What the statement claims: the level, the day it was drawn up, and the * audit its outcome is read from. */ export function ConformanceSection({ controller, audit, }: { controller: StatementFormController; audit: StatementAuditChoice; }) { const messages = useMessages(); const statementDict = messages.statement; const formDict = statementDict.form; const fields = formDict.fields; const { form, patch, fieldError, readOnly, today } = controller; return (
{/* No asterisk: it always holds a value, so there is nothing to ask for. */} ) => patch("statementDate", e.target.value) } className={DATE_INPUT} disabled={readOnly} /> {/* Which run the declared outcome rests on (ACC-388). Since ACC-387 an extension spot-check can set the outcome of a legal declaration, and the customer chooses: the options name the date, the service and the pages, the three things that make two audits of a site not interchangeable. The label is the picker's own name, word for word, so what is read out is what is written. */}
{/* Announced: it appears and disappears in response to the picker, and a screen-reader user changing the audit otherwise gets no indication that the preview beside them is now out of date. */}

{audit.unsaved ? formDict.auditPicker.unsaved : null}

); }