Files
member-console/internal/embeds/static/operator-tabs.js
Christian Galo 751bae7768 Use plan ladder for org defaults
Add default_plan_ladder_id with a forward data migration and update
the runtime to resolve the ladder's rank-0 tier at use-time. Regenerate
sqlc, update auto-provisioning, ReapplyDefaultsForPool, operator UI and
tests; add GetTierByLadderRank and pool/provision query helpers. Add a
CSP-safe confirm-action modal and wire operator actions to it. Close
plan-sole-writer safety gaps and serialize IssueGrant with a FOR UPDATE
pool lock to prevent ladder races.
2026-04-27 01:57:17 -05:00

32 lines
1.3 KiB
JavaScript

document.addEventListener('DOMContentLoaded', function () {
var tabParam = new URLSearchParams(window.location.search).get('tab');
if (tabParam) {
var btn = document.querySelector('#operatorTabs button[data-bs-target="#' + tabParam + '-pane"]');
if (btn) {
bootstrap.Tab.getOrCreateInstance(btn).show();
}
}
document.addEventListener('shown.bs.tab', function (e) {
if (!e.target.closest('#operatorTabs')) return;
var target = e.target.getAttribute('data-bs-target');
if (!target) return;
var tabId = target.slice(1, -5);
history.replaceState(null, '', '?tab=' + tabId);
});
// Cross-tab actions: any element carrying data-switch-tab="<tabId>" will
// activate the matching operator tab on click. Used by the structural-
// validation view so "View Product" jumps to the Products tab and the
// accompanying hx-get can swap the editor into #productsContent.
document.addEventListener('click', function (e) {
var trigger = e.target.closest('[data-switch-tab]');
if (!trigger) return;
var tabId = trigger.getAttribute('data-switch-tab');
var btn = document.querySelector('#operatorTabs button[data-bs-target="#' + tabId + '-pane"]');
if (btn) {
bootstrap.Tab.getOrCreateInstance(btn).show();
}
});
});