changed pooling interval from 3s to 10s
This commit is contained in:
@ -22,14 +22,14 @@ const App = {
|
|||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
console.log('Initializing WebWizard...');
|
console.log('Initializing WebWizard...');
|
||||||
|
|
||||||
if (!this.state.userId) {
|
if (!this.state.userId) {
|
||||||
await this.initSession();
|
await this.initSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.loadCategories();
|
await this.loadCategories();
|
||||||
this.bindEvents();
|
this.bindEvents();
|
||||||
|
|
||||||
// If we don't have a project, try to load existing or create one
|
// If we don't have a project, try to load existing or create one
|
||||||
if (!this.state.project) {
|
if (!this.state.project) {
|
||||||
await this.loadLastProject();
|
await this.loadLastProject();
|
||||||
@ -70,14 +70,14 @@ const App = {
|
|||||||
syncSelectionWithProject() {
|
syncSelectionWithProject() {
|
||||||
if (this.state.project && this.state.project.wizard_data) {
|
if (this.state.project && this.state.project.wizard_data) {
|
||||||
const wd = this.state.project.wizard_data;
|
const wd = this.state.project.wizard_data;
|
||||||
|
|
||||||
// Step 1
|
// Step 1
|
||||||
if (wd.business_category) {
|
if (wd.business_category) {
|
||||||
const bc = wd.business_category;
|
const bc = wd.business_category;
|
||||||
this.state.selection.category = bc.group;
|
this.state.selection.category = bc.group;
|
||||||
this.state.selection.subcategory = bc.subcategory;
|
this.state.selection.subcategory = bc.subcategory;
|
||||||
this.state.selection.customDescription = bc.custom_description || '';
|
this.state.selection.customDescription = bc.custom_description || '';
|
||||||
|
|
||||||
if (this.state.selection.category) {
|
if (this.state.selection.category) {
|
||||||
this.selectCategory(this.state.selection.category);
|
this.selectCategory(this.state.selection.category);
|
||||||
this.state.selection.subcategory = bc.subcategory;
|
this.state.selection.subcategory = bc.subcategory;
|
||||||
@ -136,7 +136,7 @@ const App = {
|
|||||||
if (m.contact_form) {
|
if (m.contact_form) {
|
||||||
document.getElementById('form-enabled').checked = m.contact_form.enabled;
|
document.getElementById('form-enabled').checked = m.contact_form.enabled;
|
||||||
document.getElementById('form-config-container').classList.toggle('hidden', !m.contact_form.enabled);
|
document.getElementById('form-config-container').classList.toggle('hidden', !m.contact_form.enabled);
|
||||||
|
|
||||||
if (m.contact_form.mode) {
|
if (m.contact_form.mode) {
|
||||||
document.querySelector(`input[name="form-mode"][value="${m.contact_form.mode}"]`).checked = true;
|
document.querySelector(`input[name="form-mode"][value="${m.contact_form.mode}"]`).checked = true;
|
||||||
document.getElementById('config-local').classList.toggle('hidden', m.contact_form.mode !== 'local');
|
document.getElementById('config-local').classList.toggle('hidden', m.contact_form.mode !== 'local');
|
||||||
@ -224,7 +224,7 @@ const App = {
|
|||||||
bindEvents() {
|
bindEvents() {
|
||||||
document.getElementById('btn-next').addEventListener('click', () => this.nextStep());
|
document.getElementById('btn-next').addEventListener('click', () => this.nextStep());
|
||||||
document.getElementById('btn-prev').addEventListener('click', () => this.prevStep());
|
document.getElementById('btn-prev').addEventListener('click', () => this.prevStep());
|
||||||
|
|
||||||
document.getElementById('custom-description').addEventListener('input', (e) => {
|
document.getElementById('custom-description').addEventListener('input', (e) => {
|
||||||
this.state.selection.customDescription = e.target.value;
|
this.state.selection.customDescription = e.target.value;
|
||||||
});
|
});
|
||||||
@ -291,7 +291,7 @@ const App = {
|
|||||||
const card = document.createElement('div');
|
const card = document.createElement('div');
|
||||||
card.className = 'category-card';
|
card.className = 'category-card';
|
||||||
if (this.state.selection.category === cat.id) card.classList.add('selected');
|
if (this.state.selection.category === cat.id) card.classList.add('selected');
|
||||||
|
|
||||||
card.innerHTML = `
|
card.innerHTML = `
|
||||||
<div class="category-icon">${icons[cat.id] || '📁'}</div>
|
<div class="category-icon">${icons[cat.id] || '📁'}</div>
|
||||||
<div class="category-name">${cat.name}</div>
|
<div class="category-name">${cat.name}</div>
|
||||||
@ -305,13 +305,13 @@ const App = {
|
|||||||
selectCategory(categoryId) {
|
selectCategory(categoryId) {
|
||||||
this.state.selection.category = categoryId;
|
this.state.selection.category = categoryId;
|
||||||
this.state.selection.subcategory = null;
|
this.state.selection.subcategory = null;
|
||||||
|
|
||||||
this.renderCategories();
|
this.renderCategories();
|
||||||
this.renderSubcategories(categoryId);
|
this.renderSubcategories(categoryId);
|
||||||
this.renderSmartQuestions(categoryId);
|
this.renderSmartQuestions(categoryId);
|
||||||
|
|
||||||
document.getElementById('subcategory-container').classList.remove('hidden');
|
document.getElementById('subcategory-container').classList.remove('hidden');
|
||||||
|
|
||||||
if (categoryId === 'other') {
|
if (categoryId === 'other') {
|
||||||
document.getElementById('custom-category-group').classList.remove('hidden');
|
document.getElementById('custom-category-group').classList.remove('hidden');
|
||||||
} else {
|
} else {
|
||||||
@ -345,7 +345,7 @@ const App = {
|
|||||||
const container = document.getElementById('services-list');
|
const container = document.getElementById('services-list');
|
||||||
const itemDiv = document.createElement('div');
|
const itemDiv = document.createElement('div');
|
||||||
itemDiv.className = 'service-item';
|
itemDiv.className = 'service-item';
|
||||||
|
|
||||||
itemDiv.innerHTML = `
|
itemDiv.innerHTML = `
|
||||||
<div class="service-item-header">
|
<div class="service-item-header">
|
||||||
<span class="service-number">Služba</span>
|
<span class="service-number">Služba</span>
|
||||||
@ -487,7 +487,7 @@ const App = {
|
|||||||
<button class="btn-remove-asset" id="btn-remove-logo">×</button>`;
|
<button class="btn-remove-asset" id="btn-remove-logo">×</button>`;
|
||||||
preview.classList.remove('hidden');
|
preview.classList.remove('hidden');
|
||||||
document.querySelector('#logo-upload-box .upload-placeholder').classList.add('hidden');
|
document.querySelector('#logo-upload-box .upload-placeholder').classList.add('hidden');
|
||||||
|
|
||||||
document.getElementById('btn-remove-logo').addEventListener('click', (e) => {
|
document.getElementById('btn-remove-logo').addEventListener('click', (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.removeAsset('logo');
|
this.removeAsset('logo');
|
||||||
@ -502,12 +502,12 @@ const App = {
|
|||||||
item.className = 'gallery-item';
|
item.className = 'gallery-item';
|
||||||
item.innerHTML = `<img src="/${path}" alt="Gallery ${index+1}">
|
item.innerHTML = `<img src="/${path}" alt="Gallery ${index+1}">
|
||||||
<button class="btn-remove-asset" data-index="${index}">×</button>`;
|
<button class="btn-remove-asset" data-index="${index}">×</button>`;
|
||||||
|
|
||||||
item.querySelector('.btn-remove-asset').addEventListener('click', (e) => {
|
item.querySelector('.btn-remove-asset').addEventListener('click', (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.removeAsset('gallery', index);
|
this.removeAsset('gallery', index);
|
||||||
});
|
});
|
||||||
|
|
||||||
container.appendChild(item);
|
container.appendChild(item);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -679,7 +679,7 @@ const App = {
|
|||||||
|
|
||||||
const formEnabled = document.getElementById('form-enabled').checked;
|
const formEnabled = document.getElementById('form-enabled').checked;
|
||||||
const formMode = document.querySelector('input[name="form-mode"]:checked').value;
|
const formMode = document.querySelector('input[name="form-mode"]:checked').value;
|
||||||
|
|
||||||
const modulesData = {
|
const modulesData = {
|
||||||
pages: ['home'],
|
pages: ['home'],
|
||||||
sections: sections,
|
sections: sections,
|
||||||
@ -760,7 +760,7 @@ const App = {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Polling error:', error);
|
console.error('Polling error:', error);
|
||||||
}
|
}
|
||||||
}, 3000);
|
}, 10000);
|
||||||
},
|
},
|
||||||
|
|
||||||
updateGenerationStatus(status) {
|
updateGenerationStatus(status) {
|
||||||
@ -786,7 +786,7 @@ const App = {
|
|||||||
const btnNext = document.getElementById('btn-next');
|
const btnNext = document.getElementById('btn-next');
|
||||||
|
|
||||||
btnPrev.disabled = this.state.currentStep === 1;
|
btnPrev.disabled = this.state.currentStep === 1;
|
||||||
|
|
||||||
// Validation for Next button
|
// Validation for Next button
|
||||||
let nextDisabled = false;
|
let nextDisabled = false;
|
||||||
if (this.state.currentStep === 1) {
|
if (this.state.currentStep === 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user