// 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"), })