// add_site_user.js — extracted from add_site_user.html
// Data injected via window.__DATA__

document.getElementById('templateSlug').addEventListener('change', function() {
        var preview = document.getElementById('templatePreview');
        var selected = this.options[this.selectedIndex];
        if (selected.value) {
            preview.querySelector('.desc').textContent = selected.dataset.desc || '';
            preview.querySelector('.fields').textContent = selected.dataset.fields || '';
            preview.classList.add('active');
        } else {
            preview.classList.remove('active');
        }
    });