diff --git a/portal/portal.js b/portal/portal.js index 89236f8..0b50156 100644 --- a/portal/portal.js +++ b/portal/portal.js @@ -715,6 +715,7 @@ const Portal = { // Load business info for settings async loadBusinessInfo() { + alert('DEBUG 1: loadBusinessInfo called, bizId=' + this.config.businessId); try { const response = await fetch(`${this.config.apiBaseUrl}/businesses/get.cfm`, { method: 'POST', @@ -722,6 +723,7 @@ const Portal = { body: JSON.stringify({ BusinessID: this.config.businessId }) }); const data = await response.json(); + alert('DEBUG 2: API response OK=' + data.OK + ', hasBiz=' + !!data.BUSINESS + ', keys=' + (data.BUSINESS ? Object.keys(data.BUSINESS).join(',') : 'none')); if (data.OK && data.BUSINESS) { // Normalize all keys to uppercase for consistent access @@ -731,6 +733,8 @@ const Portal = { Object.keys(raw).forEach(k => { biz[k.toUpperCase()] = raw[k]; }); this.currentBusiness = biz; + alert('DEBUG 3: BRANDCOLOR=[' + biz.BRANDCOLOR + '] HEADERIMAGEURL=[' + biz.HEADERIMAGEURL + ']'); + // Populate form fields document.getElementById('settingBusinessName').value = biz.NAME || biz.BUSINESSNAME || ''; document.getElementById('settingPhone').value = biz.PHONE || biz.BUSINESSPHONE || ''; @@ -754,8 +758,12 @@ const Portal = { const headerUrl = biz.HEADERIMAGEURL || ''; if (headerPreview && headerUrl) { headerPreview.onload = function() { + alert('DEBUG 4: img loaded OK'); if (headerWrapper) headerWrapper.style.display = 'block'; }; + headerPreview.onerror = function() { + alert('DEBUG 4: img FAILED to load: ' + headerPreview.src); + }; headerPreview.src = `${headerUrl}?t=${Date.now()}`; } @@ -763,6 +771,7 @@ const Portal = { this.renderHoursEditor(biz.HOURSDETAIL || biz.BUSINESSHOURSDETAIL || []); } } catch (err) { + alert('DEBUG ERR: ' + err.message); console.error('[Portal] Error loading business info:', err); } },