import { getEl, disableElementsWhenTrue, onSwap } from "./utils.js"; // Switch between a single bundle price and one price per game. The per-game // inputs are the selection-fields element; this only sets the policy: the // hidden pricing_mode the view reads, the element's "active" flag, and whether // the bundle Price field is shown. function applyPricingMode(separate) { const pricingMode = getEl("#id_pricing_mode"); if (pricingMode) pricingMode.value = separate ? "per_game" : "combined"; const selectionFields = document.querySelector("selection-fields"); if (selectionFields) selectionFields.setAttribute("active", separate ? "true" : "false"); const priceInput = getEl("#id_price"); if (priceInput) { const wrapper = priceInput.closest("div"); if (wrapper) wrapper.classList.toggle("hidden", separate); } } // The games field is now a SearchSelect widget (a
, not a