Files
member-console/internal/server/member_plan_forms.go
T
cgalo5758 88db730fcc Add dual licensing and SPDX headers
Introduce a commercial license option alongside AGPL-3.0-only, require a
CLA for contributors, and document the terms in COMMERCIAL.md and
NOTICE. Add a script to stamp SPDX headers on Go files and apply it
across the tree.
2026-09-06 02:29:42 -05:00

37 lines
1.4 KiB
Go

// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
// SPDX-FileCopyrightText: 2025-2026 Christian Galo
package server
import "git.coopcloud.tech/wiki-cafe/member-console/internal/forms"
// The plan-switch preview form (spec member-product-discovery; spec
// form-library; design D9, D10, D12). A paid-to-paid switch commits through
// a preview: the target ladder and price ride two hidden fields, the
// proration estimate is prose above them (Binding.Message), and the commit
// is "Confirm switch" beside a "Keep current plan" way out that simply
// re-fetches the plans list, matching the hand-written banner this
// replaces field for field.
//
// This file is the form's home; the registry is only the index (design
// D1). It sits beside member_products.go, which parses through the
// declaration and never through r.FormValue.
const planMoveFormName = "member.plan.move"
var planMoveForm = forms.Register(forms.FormSpec{
Name: planMoveFormName,
Kind: forms.KindPreview,
Family: forms.Stacked,
Method: "POST",
Path: "/partials/member/plans/switch",
Target: "#member-plans",
Swap: "innerHTML",
Fields: []forms.Field{
{Name: "ladder_id", Label: "Ladder", Control: forms.Hidden},
{Name: "price_id", Label: "Target price", Control: forms.Hidden},
},
Commit: "Confirm switch",
WayOut: forms.ScopedLinkOut("Keep current plan", "/partials/member/plans", "#member-plans"),
})