Form: required submitter info section above the stage pathway

Captures the form-filler's name and email on every check-in. Both fields
are required; values write back to Check_in_data__organizing_.Survey_completed_by
and Survey_completed_by_email on the activity, giving us a per-submission
record of who filled out which check-in.

Implementation:
- config/form.ts: new submitterInfo section (rank -1) at the head of the
  sections array. rank -1 keeps it out of the past/current/future stage
  pathway computation.
- components/EngagementForm.tsx: filter the submitter section out of
  sectionsToRender and render it directly with FieldRenderer inside a
  bordered card above the stage list. The fields still flow through RHF
  registration, onInvalid scroll-to-error, and the onSubmit visibility
  filter the same as any other field.

The staff report auto-discovers these fields via CustomField.get since
they live in Check_in_data__organizing_, so the field history shows up
in the report with no extra wiring.
This commit is contained in:
Joel Brock
2026-06-10 09:03:19 -07:00
parent 2e1244aa47
commit bd859ce906
2 changed files with 86 additions and 3 deletions
+31 -1
View File
@@ -54,6 +54,36 @@ const G5 = "Stage_5";
// route through Contact.update on submit and Contact.get at form load.
const G_ORG = "Food_Co_op_Organizing";
// Submitter information — captured on every check-in. Rendered above the
// stage pathway (see EngagementForm) so it's not threaded into the past /
// current / future stage rail. Both fields are required on every submission.
// rank: -1 keeps the section out of the rank-based pathway computation;
// EngagementForm filters this section out of `sectionsToRender` and renders
// it directly via FieldRenderer above the stage list.
const submitterInfo: StageSectionConfig = {
rank: -1,
id: "submitter_info",
label: "Survey submitter",
intro:
"Who's filling this out? We log this with each submission so we can follow up if needed.",
fields: [
{
name: "Survey_completed_by",
label: "Survey completed by",
type: "text",
required: true,
civiField: `${G0}.Survey_completed_by`,
},
{
name: "Survey_completed_by_email",
label: "Survey completed by — email",
type: "email",
required: true,
civiField: `${G0}.Survey_completed_by_email`,
},
],
};
// Stage 0 — Survey (always visible)
const stage0: StageSectionConfig = {
rank: 0,
@@ -753,7 +783,7 @@ export const formConfig: FormConfig = {
subtitle:
"Thank you for updating your co-op information. The questions you'll see depend on where you are in the Framework.",
stageField: "current_stage",
sections: [stage0, stage1, stage2, stage3, stage4, stage5],
sections: [submitterInfo, stage0, stage1, stage2, stage3, stage4, stage5],
};
/** Convenience: flatten all field configs across all sections for lookup by name. */