Stage 0: org-contact custom fields (Food_Co_op_Organizing)

Adds four fields from the Organization Contact's Food_Co_op_Organizing
custom group to the Stage 0 (always-visible) section:

  Date Incorporated                (date, editable)
  Name on Incorporation Certificate (text, editable)
  Certificate of Incorporation     (readonly; see note)
  Equity share                     (currency, editable)

These live on the Organization Contact record, not on the Check-in
activity, so they read/write through a different code path:

  - FieldConfig gains civiContactField, mutually exclusive with civiField
  - /api/data extends the org Contact.get select to include them and
    merges values into the prefill payload keyed by form-side name
  - /api/submit splits incoming values: contact-bound fields go through
    Contact.update (run first), activity-bound fields stay in the
    Activity.create call (run second)
  - FieldRenderer readonly branch now detects file-shaped values
    ({id, file_name}) and displays the filename rather than [object Object]

Certificate_of_Incorporation is wired readonly only: the form's
file-upload pipeline is not actually wired end-to-end (FileList drops
at JSON.stringify in onSubmit; no /api/upload endpoint exists). A
follow-up will close that gap.

Also adds scripts/inspect-org-custom-fields.mjs, a one-off introspection
script for dumping CustomField metadata when wiring a new group.
This commit is contained in:
Joel Brock
2026-06-04 17:37:36 -07:00
parent b120075ca2
commit 8ecf64c79b
6 changed files with 205 additions and 12 deletions
+9 -1
View File
@@ -84,9 +84,17 @@ export interface FieldConfig {
/**
* The CiviCRM custom-field reference. APIv4 format: `<group_name>.<field_name>`.
* Leave undefined for fields that don't write back to Civi (e.g. transient
* UI helpers).
* UI helpers). Use this for fields that target the per-submission Activity
* record (Check_in_data__organizing_, Stage_1..5).
*/
civiField?: string;
/**
* Like `civiField`, but for fields that live on the **Organization Contact**
* (e.g. `Food_Co_op_Organizing.Date_Incorporated`). /api/data reads these
* from the org contact at form-load time; /api/submit writes them back via
* Contact.update on submit. Mutually exclusive with `civiField`.
*/
civiContactField?: string;
/**
* If this field's options come from a CiviCRM option group, set its ID here.
* `/api/data` will fetch the option-group values and embed them in