Add debug alerts to diagnose mobile settings load issue
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
2562c51c27
commit
6ba3f3dffd
1 changed files with 9 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Reference in a new issue