Add matrix-group display for monthly/quarterly time-series fields in Stage 5

This commit is contained in:
Joel Brock
2026-05-09 21:29:21 -07:00
parent 082238d884
commit da3e48a874
4 changed files with 268 additions and 4 deletions

View File

@@ -511,12 +511,78 @@ const STAGE_5_FIELDS: FieldConfig[] = [
})),
];
// Helpers for building the field-name lists in the matrices below.
const months = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
const monthCols = months.map((m) => ({ key: `M${m}`, label: `M${m}` }));
const quarters = [1, 2, 3, 4];
const quarterCols = quarters.map((q) => ({ key: `Q${q}`, label: `Q${q}` }));
// Y1 Monthly Sales Target field names (irregular — built explicitly).
const Y1_TARGET_FIELDS = [
"Y1_Monthly_Sales_Targets", // M1
"Y1_Monthly_Sales_Targets_M2", // M2
"Y1_Monthly_Sales_Target_M2", // M3 (Civi field name says M2; label says M3)
"Y1_Monthly_Sales_Target_M4",
"Y1_Monthly_Sales_Target_M5",
"Y1_Monthly_Sales_Target_M6",
"Y1_Monthly_Sales_Target_M7",
"Y1_Monthly_Sales_Target_M8",
"Y1_Monthly_Sales_Target_M9",
"Y1_Monthly_Sales_Target_M10",
"Y1_Monthly_Sales_Target_M11",
"Y1_Monthly_Sales_Target_M12",
];
const stage5: StageSectionConfig = {
rank: 5,
id: "stage_5",
label: "Stage 5 — Fulfill and Stabilize",
visibleWhen: visibleAtOrAfter(S.Stabilize),
fields: STAGE_5_FIELDS,
matrixGroups: [
{
id: "y1_monthly_metrics",
label: "Year 1 — Monthly Tracking",
intro: "Targets and actuals by month. Leave blank for months you don't yet have data for.",
cols: monthCols,
rows: [
{ label: "Sales Target", type: "currency", fields: Y1_TARGET_FIELDS },
{
label: "Actual Sales",
type: "currency",
fields: months.map((m) => `Y1_M${m}_Actual_Sales`),
},
{
label: "Transactions",
type: "number",
fields: months.map((m) => `Y1_M${m}_Transactions`),
},
],
},
{
id: "y1_quarterly_metrics",
label: "Year 1 — Quarterly Tracking",
intro: "Quarterly operating ratios.",
cols: quarterCols,
rows: [
{
label: "Labor",
type: "percent",
fields: quarters.map((q) => `Y1_Q${q}_Labor`),
},
{
label: "Margin",
type: "percent",
fields: quarters.map((q) => `Y1_Q${q}_Margin`),
},
{
label: "Member Sales",
type: "percent",
fields: quarters.map((q) => `Y1_Q${q}_Member_Sales_`),
},
],
},
],
};
export const formConfig: FormConfig = {