From 74a85d38fe375fbcc97a0bc3934c7789fe8d0524 Mon Sep 17 00:00:00 2001 From: Joel Brock Date: Wed, 13 May 2026 12:04:22 -0700 Subject: [PATCH] Drop in-form Framework Stage field; align section labels with Civi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current_stage readonly field is removed from Stage 0 — the activity- derived stage value already displays in the SubmissionContextHeader, so showing it again in-card was redundant. current_stage remains in form state (RHF defaults from /api/data) because every Stage 1-5 visibleWhen rule and the journey rail still key off it; it just isn't rendered. Section labels for Stages 1-5 updated to match the CiviCRM Stage option group labels exactly (ampersand instead of 'and'; Stage 2 corrected from 'Feasibility' to 'Grow & Plan'). Stage 0 keeps its 'Check-in (organizing)' label since it represents the always-visible core fields, not the Inquiry stage rank. Also folded in: in-progress visibleWhen additions on several Stage 0 fields and commented-out field stubs from your working tree. --- config/form.ts | 159 +++++++++++++++++++++++++++---------------------- 1 file changed, 89 insertions(+), 70 deletions(-) diff --git a/config/form.ts b/config/form.ts index 0f18628..791e757 100644 --- a/config/form.ts +++ b/config/form.ts @@ -50,16 +50,10 @@ const stage0: StageSectionConfig = { intro: "Core check-in fields. These are visible at every stage and capture the data we follow over time across the lifecycle of the co-op.", fields: [ - // current_stage is a UI-only readonly field. Its value is sourced by - // /api/data from the most recent Check-in (organizing) activity whose - // Stage custom field is non-empty (staff create these manually when an - // org transitions). The form never writes Stage back to the activity — - // org-owner submissions create activities with Stage left null. - { - name: "current_stage", - label: "Framework Stage", - type: "readonly", - }, + // `current_stage` is still tracked in form state (it gates every Stage + // 1–5 visibleWhen rule and feeds the journey rail), but it is no longer + // rendered as an in-card field — the SubmissionContextHeader displays + // the activity-derived Stage value as readonly above the cards. { name: "Peer_Group_Participation", label: "Peer Group Participation", @@ -67,6 +61,7 @@ const stage0: StageSectionConfig = { civiField: `${G0}.Peer_Group_Participation`, optionGroupId: 140, help: "Is this co-op currently participating in Peer Learning Groups?", + visibleWhen: [] }, { name: "Internal_Startup_Assessment", @@ -74,6 +69,7 @@ const stage0: StageSectionConfig = { type: "select", civiField: `${G0}.Internal_Startup_Assessment`, optionGroupId: 132, + visibleWhen: [] }, { name: "Internal_Startup_Assessment_Date", @@ -81,6 +77,7 @@ const stage0: StageSectionConfig = { type: "date", civiField: `${G0}.Internal_Startup_Assessment_Date`, help: "Date of the latest Internal Startup Assessment rating.", + visibleWhen: [] }, { name: "Member_Goal_for_current_Stage", @@ -101,31 +98,31 @@ const stage0: StageSectionConfig = { label: "Total members at opening", type: "number", civiField: `${G0}.Total_members_at_opening`, - visibleWhen: visibleAtOrAfter(S.Stabilize), - }, - { - name: "Volunteers_Helping_In_Store", - label: "Volunteers Helping In Store", - type: "select", - civiField: `${G0}.Volunteers_Helping_In_Store`, - optionGroupId: 141, - help: "Does this co-op use volunteers for day-to-day operations? (Not occasional events.)", - }, - { - name: "Work_from_Members", - label: "Work from Members", - type: "select", - civiField: `${G0}.Work_from_Members`, - optionGroupId: 142, - help: "Does this co-op require work from members (e.g. annual hours)?", + visibleWhen: visibleAtOrAfter(S.Stabilize), }, + // { + // name: "Volunteers_Helping_In_Store", + // label: "Volunteers Helping In Store", + // type: "select", + // civiField: `${G0}.Volunteers_Helping_In_Store`, + // optionGroupId: 141, + // help: "Does this co-op use volunteers for day-to-day operations? (Not occasional events.)", + // }, + // { + // name: "Work_from_Members", + // label: "Work from Members", + // type: "select", + // civiField: `${G0}.Work_from_Members`, + // optionGroupId: 142, + // help: "Does this co-op require work from members (e.g. annual hours)?", + // }, { name: "Total_square_ft", label: "Total square ft", type: "number", civiField: `${G0}.Total_square_ft`, step: 1, - visibleWhen: visibleAtOrAfter(S.BusinessFeasibility, S.StoreImplementation, S.Stabilize), + visibleWhen: visibleAtOrAfter(S.BusinessFeasibility, S.StoreImplementation, S.Stabilize), }, { name: "Retail_sq_ft", @@ -133,34 +130,34 @@ const stage0: StageSectionConfig = { type: "number", civiField: `${G0}.Retail_sq_ft`, step: 1, - visibleWhen: visibleAtOrAfter(S.BusinessFeasibility, S.StoreImplementation, S.Stabilize), - }, - { - name: "Latest_Sources_and_Uses_doc", - label: "Latest Sources and Uses doc", - type: "file", - civiField: `${G0}.Latest_Sources_and_Uses_doc`, - }, - { - name: "Latest_Pro_Forma_doc", - label: "Latest Pro Forma doc", - type: "file", - civiField: `${G0}.Latest_Pro_Forma_doc`, - }, - { name: "Projected_Year_1_Sales", label: "Projected Year 1 Sales", type: "currency", civiField: `${G0}.Projected_Year_1_Sales` }, - { name: "Projected_Year_2_Sales", label: "Projected Year 2 Sales", type: "currency", civiField: `${G0}.Projected_Year_2_Sales` }, - { name: "Projected_Year_3_Sales", label: "Projected Year 3 Sales", type: "currency", civiField: `${G0}.Projected_Year_3_Sales` }, - { - name: "Projected_sales_at_maturity", - label: "Projected sales once established", - type: "currency", - civiField: `${G0}.Projected_sales_at_maturity`, + visibleWhen: visibleAtOrAfter(S.BusinessFeasibility, S.StoreImplementation, S.Stabilize), }, + // { + // name: "Latest_Sources_and_Uses_doc", + // label: "Latest Sources and Uses doc", + // type: "file", + // civiField: `${G0}.Latest_Sources_and_Uses_doc`, + // }, + // { + // name: "Latest_Pro_Forma_doc", + // label: "Latest Pro Forma doc", + // type: "file", + // civiField: `${G0}.Latest_Pro_Forma_doc`, + // }, + // { name: "Projected_Year_1_Sales", label: "Projected Year 1 Sales", type: "currency", civiField: `${G0}.Projected_Year_1_Sales` }, + // { name: "Projected_Year_2_Sales", label: "Projected Year 2 Sales", type: "currency", civiField: `${G0}.Projected_Year_2_Sales` }, + // { name: "Projected_Year_3_Sales", label: "Projected Year 3 Sales", type: "currency", civiField: `${G0}.Projected_Year_3_Sales` }, + // { + // name: "Projected_sales_at_maturity", + // label: "Projected sales once established", + // type: "currency", + // civiField: `${G0}.Projected_sales_at_maturity`, + // }, { name: "FTEs", label: "Projected FTEs", type: "number", - visibleWhen: visibleAtOrAfter(S.BusinessFeasibility, S.StoreImplementation, S.Stabilize), + visibleWhen: visibleAtOrAfter(S.BusinessFeasibility, S.StoreImplementation, S.Stabilize), civiField: `${G0}.FTEs`, step: 0.1, help: "Number of full-time equivalent (FTE) employees planned to work at the store.", @@ -171,30 +168,52 @@ const stage0: StageSectionConfig = { type: "number", civiField: `${G0}.Actual_FTE`, step: 0.1, - visibleWhen: visibleAtOrAfter(S.Stabilize), + visibleWhen: visibleAtOrAfter(S.Stabilize), }, { name: "Total_cost_of_project", label: "Total cost of project", type: "currency", - visibleWhen: visibleAtOrAfter(S.Stabilize), + visibleWhen: visibleAtOrAfter(S.Stabilize), civiField: `${G0}.Total_cost_of_project`, }, - { name: "Member_equity_total", label: "Member equity total needed", type: "currency", civiField: `${G0}.Member_equity_total` }, - { name: "Member_equity_raised", label: "Member equity raised", type: "currency", visibleWhen: visibleAtOrAfter(S.Stabilize), civiField: `${G0}.Member_equity_raised` }, - { name: "Member_loans_total", label: "Member loans total needed", type: "currency", civiField: `${G0}.Member_loans_total` }, - { name: "Member_loans_raised", label: "Member loans raised", type: "currency", visibleWhen: visibleAtOrAfter(S.Stabilize), civiField: `${G0}.Member_loans_raised` }, - { - name: "Member_preferred_shares_total", - label: "Member preferred shares total needed", - type: "currency", - civiField: `${G0}.Member_preferred_shares_total`, - }, + { + name: "Member_equity_total", + label: "Member equity total needed", + type: "currency", + civiField: `${G0}.Member_equity_total` + }, + { + name: "Member_equity_raised", + label: "Member equity raised", + type: "currency", + visibleWhen: visibleAtOrAfter(S.Stabilize), + civiField: `${G0}.Member_equity_raised` + }, + { + name: "Member_loans_total", + label: "Member loans total needed", + type: "currency", + civiField: `${G0}.Member_loans_total` + }, + { + name: "Member_loans_raised", + label: "Member loans raised", + type: "currency", + visibleWhen: visibleAtOrAfter(S.Stabilize), + civiField: `${G0}.Member_loans_raised` + }, + // { + // name: "Member_preferred_shares_total", + // label: "Member preferred shares total needed", + // type: "currency", + // civiField: `${G0}.Member_preferred_shares_total`, + // }, { name: "Member_preferred_shares_raised", label: "Member preferred shares raised", type: "currency", - visibleWhen: visibleAtOrAfter(S.Stabilize), + visibleWhen: visibleAtOrAfter(S.Stabilize), civiField: `${G0}.Member_preferred_shares_raised`, }, { name: "Bank_debt_total", label: "Bank debt total needed", type: "currency", civiField: `${G0}.Bank_debt_total` }, @@ -211,7 +230,7 @@ const stage0: StageSectionConfig = { const stage1: StageSectionConfig = { rank: 1, id: "stage_1", - label: "Stage 1 — Convene and Prepare", + label: "Stage 1 — Convene & Prepare", visibleWhen: visibleAtOrAfter(S.Organizing, S.Feasibility, S.BusinessFeasibility, S.StoreImplementation, S.Stabilize), fields: [ { @@ -269,7 +288,7 @@ const stage1: StageSectionConfig = { const stage2: StageSectionConfig = { rank: 2, id: "stage_2", - label: "Stage 2 — Feasibility", + label: "Stage 2 — Grow & Plan", visibleWhen: visibleAtOrAfter(S.Feasibility, S.BusinessFeasibility, S.StoreImplementation, S.Stabilize), fields: [ { name: "Market_Study_Date", label: "Market Study Date", type: "date", civiField: `${G2}.Market_Study_Date` }, @@ -319,7 +338,7 @@ const stage2: StageSectionConfig = { const stage3: StageSectionConfig = { rank: 3, id: "stage_3", - label: "Stage 3 — Connect and Gather", + label: "Stage 3 — Connect & Gather", visibleWhen: visibleAtOrAfter(S.BusinessFeasibility, S.StoreImplementation, S.Stabilize), fields: [ { @@ -393,7 +412,7 @@ const stage3: StageSectionConfig = { const stage4: StageSectionConfig = { rank: 4, id: "stage_4", - label: "Stage 4 — Excite and Build", + label: "Stage 4 — Excite & Build", visibleWhen: visibleAtOrAfter(S.StoreImplementation, S.Stabilize), fields: [ { name: "Projected_Opening_Date", label: "Projected Opening Date", type: "date", civiField: `${G4}.Projected_Opening_Date` }, @@ -537,12 +556,12 @@ const Y1_TARGET_FIELDS = [ const stage5: StageSectionConfig = { rank: 5, id: "stage_5", - label: "Stage 5 — Fulfill and Stabilize", + label: "Stage 5 — Fulfill & Stabilize", visibleWhen: visibleAtOrAfter(S.Stabilize), fields: [ { name: "Date_Opened", label: "Date Opened", type: "date", civiField: `${G5}.Date_Opened` }, { name: "Y1_Actual_Sales", label: "Y1 Actual Sales", type: "currency", civiField: `${G5}.Y1_Actual_Sales` } - ], + ] as FieldConfig[], // STAGE_5_FIELDS, // matrixGroups: [ // {