Skip to content

Commit 9a38ab9

Browse files
committed
fix: chiusura tour
1 parent f915457 commit 9a38ab9

9 files changed

Lines changed: 93 additions & 28 deletions

File tree

modules/anagrafiche/js/anagrafiche-tour.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ function initAnagraficheTour() {
1919
console.error('Shepherd.js non è disponibile dopo il ritardo. Il tour non può essere inizializzato.');
2020
return;
2121
} else {
22-
console.log('Shepherd.js è ora disponibile. Inizializzazione del tour...');
2322
// Chiama la funzione di inizializzazione
2423
initAnagraficheTourInternal();
2524
}
@@ -64,8 +63,7 @@ function initAnagraficheTourInternal() {
6463

6564
// Gestisci l'evento di cancellazione
6665
anagraficheTour.on('cancel', function() {
67-
// Non salvare nulla se l'utente cancella il tour
68-
console.log('Tour anagrafiche cancellato');
66+
localStorage.setItem('anagrafiche-tour-completed', 'true');
6967
});
7068
}
7169

@@ -129,7 +127,7 @@ function addTourSteps() {
129127
buttons: [
130128
{
131129
text: 'No',
132-
action: anagraficheTour.cancel,
130+
action: cancelTourAndClose,
133131
classes: 'shepherd-button-secondary'
134132
},
135133
{
@@ -404,6 +402,17 @@ function completeTourAndClose() {
404402
}
405403
}
406404

405+
/**
406+
* Cancella il tour e salva lo stato (usato per il pulsante "No")
407+
*/
408+
function cancelTourAndClose() {
409+
localStorage.setItem('anagrafiche-tour-completed', 'true');
410+
411+
if (anagraficheTour) {
412+
anagraficheTour.cancel();
413+
}
414+
}
415+
407416
/**
408417
* Verifica se il tour è già stato completato
409418
*/

modules/articoli/js/articoli-tour.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ function initArticoliTour() {
1313
console.error('Shepherd.js non è disponibile dopo il ritardo. Il tour non può essere inizializzato.');
1414
return;
1515
} else {
16-
console.log('Shepherd.js è ora disponibile. Inizializzazione del tour...');
1716
initArticoliTourInternal();
1817
}
1918
}, 500);
@@ -48,7 +47,7 @@ function initArticoliTourInternal() {
4847
});
4948

5049
articoliTour.on('cancel', function() {
51-
console.log('Tour articoli cancellato');
50+
localStorage.setItem('articoli-tour-completed', 'true');
5251
});
5352
}
5453

@@ -100,7 +99,7 @@ function addTourSteps() {
10099
buttons: [
101100
{
102101
text: 'No',
103-
action: articoliTour.cancel,
102+
action: cancelTourAndClose,
104103
classes: 'shepherd-button-secondary'
105104
},
106105
{
@@ -289,6 +288,14 @@ function completeTourAndClose() {
289288
}
290289
}
291290

291+
function cancelTourAndClose() {
292+
localStorage.setItem('articoli-tour-completed', 'true');
293+
294+
if (articoliTour) {
295+
articoliTour.cancel();
296+
}
297+
}
298+
292299
function isTourCompleted() {
293300
return localStorage.getItem('articoli-tour-completed') === 'true';
294301
}

modules/contratti/js/contratti-tour.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ function initContrattiTour() {
1313
console.error('Shepherd.js non è disponibile dopo il ritardo. Il tour non può essere inizializzato.');
1414
return;
1515
} else {
16-
console.log('Shepherd.js è ora disponibile. Inizializzazione del tour...');
1716
initContrattiTourInternal();
1817
}
1918
}, 500);
@@ -48,7 +47,7 @@ function initContrattiTourInternal() {
4847
});
4948

5049
contrattiTour.on('cancel', function() {
51-
console.log('Tour contratti cancellato');
50+
localStorage.setItem('contratti-tour-completed', 'true');
5251
});
5352
}
5453

@@ -100,7 +99,7 @@ function addTourSteps() {
10099
buttons: [
101100
{
102101
text: 'No',
103-
action: contrattiTour.cancel,
102+
action: cancelTourAndClose,
104103
classes: 'shepherd-button-secondary'
105104
},
106105
{
@@ -317,6 +316,14 @@ function completeTourAndClose() {
317316
}
318317
}
319318

319+
function cancelTourAndClose() {
320+
localStorage.setItem('contratti-tour-completed', 'true');
321+
322+
if (contrattiTour) {
323+
contrattiTour.cancel();
324+
}
325+
}
326+
320327
function isTourCompleted() {
321328
return localStorage.getItem('contratti-tour-completed') === 'true';
322329
}

modules/ddt/js/ddt-tour.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ function initDdtTour() {
1313
console.error('Shepherd.js non è disponibile dopo il ritardo. Il tour non può essere inizializzato.');
1414
return;
1515
} else {
16-
console.log('Shepherd.js è ora disponibile. Inizializzazione del tour...');
1716
initDdtTourInternal();
1817
}
1918
}, 500);
@@ -48,7 +47,7 @@ function initDdtTourInternal() {
4847
});
4948

5049
ddtTour.on('cancel', function() {
51-
console.log('Tour ddt cancellato');
50+
localStorage.setItem('ddt-tour-completed', 'true');
5251
});
5352
}
5453

@@ -100,7 +99,7 @@ function addTourSteps() {
10099
buttons: [
101100
{
102101
text: 'No',
103-
action: ddtTour.cancel,
102+
action: cancelTourAndClose,
104103
classes: 'shepherd-button-secondary'
105104
},
106105
{
@@ -321,6 +320,14 @@ function completeTourAndClose() {
321320
}
322321
}
323322

323+
function cancelTourAndClose() {
324+
localStorage.setItem('ddt-tour-completed', 'true');
325+
326+
if (ddtTour) {
327+
ddtTour.cancel();
328+
}
329+
}
330+
324331
function isTourCompleted() {
325332
return localStorage.getItem('ddt-tour-completed') === 'true';
326333
}

modules/fatture/js/fatture-tour.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ function initFattureTour() {
1313
console.error('Shepherd.js non è disponibile dopo il ritardo. Il tour non può essere inizializzato.');
1414
return;
1515
} else {
16-
console.log('Shepherd.js è ora disponibile. Inizializzazione del tour...');
1716
initFattureTourInternal();
1817
}
1918
}, 500);
@@ -48,7 +47,7 @@ function initFattureTourInternal() {
4847
});
4948

5049
fattureTour.on('cancel', function() {
51-
console.log('Tour fatture cancellato');
50+
localStorage.setItem('fatture-tour-completed', 'true');
5251
});
5352
}
5453

@@ -100,7 +99,7 @@ function addTourSteps() {
10099
buttons: [
101100
{
102101
text: 'No',
103-
action: fattureTour.cancel,
102+
action: cancelTourAndClose,
104103
classes: 'shepherd-button-secondary'
105104
},
106105
{
@@ -334,6 +333,14 @@ function completeTourAndClose() {
334333
}
335334
}
336335

336+
function cancelTourAndClose() {
337+
localStorage.setItem('fatture-tour-completed', 'true');
338+
339+
if (fattureTour) {
340+
fattureTour.cancel();
341+
}
342+
}
343+
337344
function isTourCompleted() {
338345
return localStorage.getItem('fatture-tour-completed') === 'true';
339346
}

modules/impianti/js/impianti-tour.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ function initImpiantiTour() {
1313
console.error('Shepherd.js non è disponibile dopo il ritardo. Il tour non può essere inizializzato.');
1414
return;
1515
} else {
16-
console.log('Shepherd.js è ora disponibile. Inizializzazione del tour...');
1716
initImpiantiTourInternal();
1817
}
1918
}, 500);
@@ -48,7 +47,7 @@ function initImpiantiTourInternal() {
4847
});
4948

5049
impiantiTour.on('cancel', function() {
51-
console.log('Tour impianti cancellato');
50+
localStorage.setItem('impianti-tour-completed', 'true');
5251
});
5352
}
5453

@@ -100,7 +99,7 @@ function addTourSteps() {
10099
buttons: [
101100
{
102101
text: 'No',
103-
action: impiantiTour.cancel,
102+
action: cancelTourAndClose,
104103
classes: 'shepherd-button-secondary'
105104
},
106105
{
@@ -220,6 +219,14 @@ function completeTourAndClose() {
220219
}
221220
}
222221

222+
function cancelTourAndClose() {
223+
localStorage.setItem('impianti-tour-completed', 'true');
224+
225+
if (impiantiTour) {
226+
impiantiTour.cancel();
227+
}
228+
}
229+
223230
function isTourCompleted() {
224231
return localStorage.getItem('impianti-tour-completed') === 'true';
225232
}

modules/interventi/js/interventi-tour.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ function initInterventiTour() {
1717
console.error('Shepherd.js non è disponibile dopo il ritardo. Il tour non può essere inizializzato.');
1818
return;
1919
} else {
20-
console.log('Shepherd.js è ora disponibile. Inizializzazione del tour...');
2120
initInterventiTourInternal();
2221
}
2322
}, 500);
@@ -55,7 +54,7 @@ function initInterventiTourInternal() {
5554
});
5655

5756
interventiTour.on('cancel', function() {
58-
console.log('Tour interventi cancellato');
57+
localStorage.setItem('interventi-tour-completed', 'true');
5958
});
6059
}
6160

@@ -113,7 +112,7 @@ function addTourSteps() {
113112
buttons: [
114113
{
115114
text: 'No',
116-
action: interventiTour.cancel,
115+
action: cancelTourAndClose,
117116
classes: 'shepherd-button-secondary'
118117
},
119118
{
@@ -372,6 +371,14 @@ function completeTourAndClose() {
372371
}
373372
}
374373

374+
function cancelTourAndClose() {
375+
localStorage.setItem('interventi-tour-completed', 'true');
376+
377+
if (interventiTour) {
378+
interventiTour.cancel();
379+
}
380+
}
381+
375382
/**
376383
* Verifica se il tour è già stato completato
377384
*/

modules/ordini/js/ordini-tour.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ function initOrdiniTour() {
1313
console.error('Shepherd.js non è disponibile dopo il ritardo. Il tour non può essere inizializzato.');
1414
return;
1515
} else {
16-
console.log('Shepherd.js è ora disponibile. Inizializzazione del tour...');
1716
initOrdiniTourInternal();
1817
}
1918
}, 500);
@@ -48,7 +47,7 @@ function initOrdiniTourInternal() {
4847
});
4948

5049
ordiniTour.on('cancel', function() {
51-
console.log('Tour ordini cancellato');
50+
localStorage.setItem('ordini-tour-completed', 'true');
5251
});
5352
}
5453

@@ -100,7 +99,7 @@ function addTourSteps() {
10099
buttons: [
101100
{
102101
text: 'No',
103-
action: ordiniTour.cancel,
102+
action: cancelTourAndClose,
104103
classes: 'shepherd-button-secondary'
105104
},
106105
{
@@ -283,6 +282,14 @@ function completeTourAndClose() {
283282
}
284283
}
285284

285+
function cancelTourAndClose() {
286+
localStorage.setItem('ordini-tour-completed', 'true');
287+
288+
if (ordiniTour) {
289+
ordiniTour.cancel();
290+
}
291+
}
292+
286293
function isTourCompleted() {
287294
return localStorage.getItem('ordini-tour-completed') === 'true';
288295
}

modules/preventivi/js/preventivi-tour.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ function initPreventiviTour() {
1313
console.error('Shepherd.js non è disponibile dopo il ritardo. Il tour non può essere inizializzato.');
1414
return;
1515
} else {
16-
console.log('Shepherd.js è ora disponibile. Inizializzazione del tour...');
1716
initPreventiviTourInternal();
1817
}
1918
}, 500);
@@ -48,7 +47,7 @@ function initPreventiviTourInternal() {
4847
});
4948

5049
preventiviTour.on('cancel', function() {
51-
console.log('Tour preventivi cancellato');
50+
localStorage.setItem('preventivi-tour-completed', 'true');
5251
});
5352
}
5453

@@ -100,7 +99,7 @@ function addTourSteps() {
10099
buttons: [
101100
{
102101
text: 'No',
103-
action: preventiviTour.cancel,
102+
action: cancelTourAndClose,
104103
classes: 'shepherd-button-secondary'
105104
},
106105
{
@@ -246,6 +245,14 @@ function completeTourAndClose() {
246245
}
247246
}
248247

248+
function cancelTourAndClose() {
249+
localStorage.setItem('preventivi-tour-completed', 'true');
250+
251+
if (preventiviTour) {
252+
preventiviTour.cancel();
253+
}
254+
}
255+
249256
function isTourCompleted() {
250257
return localStorage.getItem('preventivi-tour-completed') === 'true';
251258
}

0 commit comments

Comments
 (0)