Files
member-console/internal/embeds/static/grant-toggle.js
Christian Galo 47a75e0873 Add products, entitlement sets, and workspace support
- Add SQL queries and generated methods for Create/List/Update products
- Add CountWorkspacesByOrgID and ListResourceKeys querier methods
- Register workspace partials and operator routes for products and sets
- Add workspace UI section and operator tabs; tweak grant/site forms
- Replace isValidDNSLabel with validateDNSLabel for site validation
2026-03-27 10:55:03 -05:00

34 lines
1.1 KiB
JavaScript

// Grant path toggle: show/hide Product vs Entitlement Set fields
(function () {
function applyGrantPathToggle() {
var productRadio = document.getElementById("grantPathProduct");
var entSetRadio = document.getElementById("grantPathEntitlementSet");
var productFields = document.getElementById("productPathFields");
var entSetFields = document.getElementById("entitlementSetPathFields");
if (!productRadio || !productFields || !entSetFields) return;
function update() {
var isProduct = productRadio.checked;
productFields.style.display = isProduct ? "" : "none";
entSetFields.style.display = isProduct ? "none" : "";
}
productRadio.addEventListener("change", update);
entSetRadio.addEventListener("change", update);
update();
}
// Run on initial load
applyGrantPathToggle();
// Re-run after HTMX swaps (grants tab content is loaded via HTMX)
document.addEventListener("htmx:afterSettle", function (evt) {
if (
evt.detail.target &&
evt.detail.target.id === "grantsContent"
) {
applyGrantPathToggle();
}
});
})();