Nothing Special   »   [go: up one dir, main page]

Discover events

EGR's portfolio of global events provide a comprehensive source of market insights and intelligence from across the globe
{ if (categoryElement.slug !== categorySlug) { categoryElement.isActive = false; } else { categoryElement.isActive = true; } }); if (this.categoriesFromBackEnd.length > 0) { if (categorySlug !== '') { this.updateUrlHistory(categorySlug); } else { this.resetUrl(); } } this.getItemsByCategory(categorySlug); }, resetUrl() { window.history.pushState('', '', window.location.pathname); }, updateUrlHistory(categorySlug) { const currentUrlParameters = window.location.search; if (currentUrlParameters.toLowerCase().includes(categorySlug)) { return; } window.history.pushState('', '', `?${this.filterName}=${categorySlug}`); }, getItemsByCategory(category) { page = 1; offset = 0; const requestData = { action: 'get_events_by_category', paged: page, offset: offset, term: category, limit_latest: 16 }; fetch('/wp-admin/admin-ajax.php', { method: 'POST', body: new URLSearchParams(requestData).toString(), headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', }, }) .then((response) => response.text()) .then((result) => { if (result.trim() === '') { this.noMorePosts = true; this.latestAjaxItems = '
No Latest Items
'; } else { this.noMorePosts = false; this.latestAjaxItems = result; } }) .catch((error) => { latestAjaxItems = '
No Latest Items
'; console.error('Error:', error); }); }, }" x-init=" selectedCategory = window.location.search.includes(`${filterName}`) ? window.location.search.split(`${filterName}=`)[1] : ''; categoryElements = categoriesFromBackEnd.map((category) => { return { slug: category.slug, text: category.name, type: category.type || 'sushi', url: category.url, isActive: category.slug === selectedCategory, } }); categoryElements.unshift({ slug: '', text: 'All', type: 'all', isActive: false, }); setCategory(selectedCategory); ">