`,
data() {
return {
containerClass: "",
categories: [{"id":1,"name":"Concerti","id_event_types":1,"sort":1,"icon":"fa-guitars","alias":"Musica a tutto volume"},{"id":2,"name":"Cabaret","id_event_types":1,"sort":2,"icon":"fa-mask","alias":"Tutto da ridere"},{"id":3,"name":"Teatro","id_event_types":1,"sort":3,"icon":"fa-theater-masks","alias":"Una serata a teatro"},{"id":6,"name":"Spettacoli","id_event_types":1,"sort":4,"icon":"fa-screen-users","alias":"Lo spettacolo continua"},{"id":8,"name":"Cinema","id_event_types":1,"sort":5,"icon":"fa-camera-movie","alias":"Emozioni al grande schermo"},{"id":4,"name":"Sport","id_event_types":1,"sort":6,"icon":"fa-hockey-sticks","alias":"Lo sport da non perdere"},{"id":10,"name":"Trip & More","id_event_types":1,"sort":7,"icon":"fa-ship","alias":"Trip & More"},{"id":9,"name":"Mostre","id_event_types":1,"sort":8,"icon":"fa-palette","alias":"Immersi nell'arte e la cultura"},{"id":11,"name":"Party","id_event_types":1,"sort":9,"icon":"fa-glass-cheers","alias":"\u00c8 qui la festa?"},{"id":12,"name":"Fiere","id_event_types":1,"sort":12,"icon":"fa-tent-double-peak","alias":"Tra esposizioni e convegni"},{"id":5,"name":"Altro","id_event_types":1,"sort":14,"icon":"fa-ticket-alt","alias":"Altri eventi in prevendita"},{"id":7,"name":"Buoni","id_event_types":2,"sort":15,"icon":"fa-gift-card","alias":null}],
isHome: false,
isAdmin: false,
isPromoter: false,
sidebarOpen: false,
search: {
type: null,
text: null
}
}
},
methods: {
toggleSidebar() {
this.sidebarOpen = !this.sidebarOpen;
console.log(this.sidebarOpen);
this.$emit('toggleSidebar');
},
handleCategorySelection(category) {
if (category === null) {
if (this.isHome === false) {
localStorage.setItem('search', JSON.stringify({type: null, text: null}));
window.location.href = '/';
return;
}
this.search.type = null;
this.search.text = null;
scroll(0, 0)
return;
}
if (this.isHome === false) {
localStorage.setItem('search', JSON.stringify({type: 'category', text: category.name}));
window.location.href = '/';
return;
}
this.search.type = 'category';
this.search.text = category.name;
scroll(0, 0)
},
handleSearch(text) {
if (this.isAdmin || this.isPromoter) {
if(text === null){
window.location.href = '/';
this.search.type = null;
this.search.text = null;
return;
}
else {
window.location.href = '/?q=' + text;
this.search.type = 'search';
this.search.text = text;
return;
}
}
if (this.isHome === false) {
localStorage.setItem('search', JSON.stringify({type: 'search', text: text}));
window.location.href = '/';
return;
}
if (text === null) {
this.search.type = null;
this.search.text = null;
scroll(0, 0)
return;
}
this.search.type = 'search';
this.search.text = text;
scroll(0, 0)
}
},
beforeMount() {
const urlParams = new URLSearchParams(window.location.search);
const q = urlParams.get('q');
if (q !== null) {
this.search.type = 'search';
this.search.text = q.toString();
}
}
}