1<@liferay_ui["panel-container"]
2 extended=true
3 id="${namespace + 'facetAssetCategoriesPanelContainer'}"
4 markupView="lexicon"
5 persistState=false
6 >
7 <#assign barrios = []/>
8 <#assign recintos = []/>
9 <#assign selected = ""/>
10 <#if entries?has_content>
11 <#list entries as entry>
12 <#if entry.isSelected()>
13 <#assign selected = entry.getFilterValue()/>
14 </#if>
15 <#assign category = restClient.get("/headless-admin-taxonomy/v1.0/taxonomy-categories/${entry.getFilterValue()}")/>
16 <#assign vocabulary = category.parentTaxonomyVocabulary.name/>
17 <#if vocabulary = "Barrio" || vocabulary = "Auzoa">
18 <#assign barrios += [category]/>
19 <#elseif vocabulary = "Lugar" || vocabulary = "Lekua">
20 <#assign recintos += [category]/>
21 </#if>
22 </#list>
23 </#if>
24 <#assign random = .now?long/>
25 <div class="dtik-input-group" id="${random}">
26 <select class="dtik-input-group__select custom-select" onChange="document.getElementById(this.options[this.selectedIndex].value).click();">
27 <option value="${random}all_0">${languageUtil.get(locale, "all")}</option>
28 <#if recintos?has_content>
29 <optgroup label="${languageUtil.get(locale, 'enclosure')}">
30 <#list recintos as recinto>
31 <option ${(recinto?is_first)?then("data-before='" + languageUtil.get(locale, "enclosures") + "'", '')} ${(selected = recinto.id)?then('selected', '')} value="${random}_${recinto.id}">
32 ${htmlUtil.escape(recinto.name)}
33 </option>
34 </#list>
35 </optgroup>
36 </#if>
37 <#if barrios?has_content>
38 <optgroup label="${languageUtil.get(locale, 'neighborhood')}">
39 <#list barrios as barrio>
40 <option ${(selected = barrio.id)?then('selected', '')} value="${random}_${barrio.id}">
41 ${htmlUtil.escape(barrio.name)}
42 </option>
43 </#list>
44 </optgroup>
45 </#if>
46 </select>
47 <svg class="dtik-input-group__icon" width="12" height="8" viewBox="0 0 12 8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1.5L6 6.5L11 1.5" stroke="#666C85" stroke-width="2"></path>
48 </svg>
49 <@clay.button
50 cssClass="facet-term ${(entry.isSelected())?then('facet-term-selected', 'facet-term-unselected')}"
51 data\-term\-id="all_0"
52 disabled="false"
53 displayType="link"
54 onClick="if(!document.querySelector('.searchEvents'))Liferay.Search.FacetUtil.clearSelections(event);"
55 style="display: none;"
56 id="${random}all_0"
57 >
58 ${htmlUtil.escape(entry.getBucketText())}
59 </@clay.button>
60 <#if entries?has_content>
61 <#list entries as category>
62 <@clay.button
63 cssClass="facet-term ${(category.isSelected())?then('facet-term-selected', 'facet-term-unselected')}"
64 data\-term\-id="${category.getFilterValue()}"
65 disabled="false"
66 displayType="link"
67 onClick="clearFilters(this);if(!document.querySelector('.searchEvents'))Liferay.Search.FacetUtil.changeSelection(event);"
68 style="display: none;"
69 id="${random}_${category.getFilterValue()}"
70 >
71 ${htmlUtil.escape(category.getBucketText())}
72 </@clay.button>
73 </#list>
74 </#if>
75 <script>
76 function clearFilters(button) {
77 var parent = button.parentNode;
78 var buttons = parent.querySelectorAll("button");
79 for(var i = 0; i < buttons.length; i++) {
80 buttons[i].classList.remove("facet-term-selected");
81 buttons[i].classList.add("facet-term-unselected");
82 }
83 }
84 </script>
85 </div>
86 </@>