Files
backend-mm/public/web/shella/scripts/cs/navigation.js
2025-09-25 03:03:31 +05:00

1 line
975 B
JavaScript

createApp({data:function(){return{routes:window.Lara.routes,locale:window.Lara.locale,all_categories:window.Lara.navigation.categories,categories_dropdown_hidden:!0,categories_to_show:new Object,activeLinks:[]}},methods:{hideCategoryDropdown:function(){this.categories_dropdown_hidden=!0},showCategoriesDropdown:function(){this.categories_dropdown_hidden=!1},showCategoriesFor:function(o){var t=this;this.categories_to_show=this.all_categories.find((function(t){return t.id==o})),this.all_categories.forEach((function(o){return t.activeLinks[o.slug]=!1})),this.activeLinks[this.categories_to_show.slug]=!0},categoryShowRouteFor:function(o){return this.routes.categories.products.replace("slug",o)}},mounted:function(){var o=this;this.all_categories.forEach((function(t,e){0==e?(o.categories_to_show=t,o.activeLinks[t.slug]=!0):o.activeLinks[t.slug]=!1})),Event.listen("showCategoriesDropdownEvent",(function(){o.showCategoriesDropdown()}))}}).mount("#categories-navigation");