// static/admin/js/vendor-themes.js /** * Admin vendor themes selection page */ console.log('[ADMIN VENDOR THEMES] Loading...'); function adminVendorThemes() { console.log('[ADMIN VENDOR THEMES] adminVendorThemes() called'); return { // Inherit base layout state ...data(), // Set page identifier currentPage: 'vendor-theme', // State loading: false, error: '', vendors: [], selectedVendorCode: '', async init() { // Guard against multiple initialization if (window._adminVendorThemesInitialized) { return; } window._adminVendorThemesInitialized = true; // Call parent init first const parentInit = data().init; if (parentInit) { await parentInit.call(this); } await this.loadVendors(); }, async loadVendors() { this.loading = true; this.error = ''; try { const response = await apiClient.get('/admin/vendors?limit=1000'); this.vendors = response.vendors || []; console.log('[ADMIN VENDOR THEMES] Loaded vendors:', this.vendors.length); } catch (error) { console.error('[ADMIN VENDOR THEMES] Failed to load vendors:', error); this.error = error.message || 'Failed to load vendors'; } finally { this.loading = false; } }, navigateToTheme() { if (!this.selectedVendorCode) { return; } window.location.href = `/admin/vendors/${this.selectedVendorCode}/theme`; } }; } console.log('[ADMIN VENDOR THEMES] Module loaded');