1<style>
2 .header-top-right .aegov-form-control .form-control-input:has(:disabled) { 3 opacity: 1;
4 }
5 .mobile-items { 6 max-height: 220px;
7 overflow: hidden;
8 overflow-y: auto;
9 }
10</style>
11<div class="!p-4 advanced-search-list">
12 <div class="grid sm:grid-cols-3 mobile-items">
13 <#if entries?has_content>
14 <#list entries as curEntry>
15 <#assign docXml = saxReaderUtil.read(curEntry.getAssetRenderer().getArticle().getContent()) />
16 <#assign StructureKey = docXml.valueOf("//dynamic-element[@name='Key']/dynamic-content[@language-id='${locale}']/text()") /> 17 <#assign StructureValue = docXml.valueOf("//dynamic-element[@name='Value']/dynamic-content[@language-id='${locale}']/text()") /> 18
19 <#if StructureKey?? && StructureValue??>
20 <div class="aegov-check-group advanced-search-item !pt-4 !pb-2">
21 <input id="checkbox_${StructureValue}" name="${StructureKey}" data-key="${StructureKey}" type="checkbox" value="${StructureValue}"> 22 <div>
23 <label for="checkbox_${StructureValue}">${curEntry.getTitle(locale)}</label> 24 </div>
25 </div>
26 </#if>
27 </#list>
28 </#if>
29 </div>
30
31 <div class="aegov-form-control control-error " id="msg-advanced-search-validation">
32 <p class="error-message mb-0 !mt-4"><strong>${languageUtil.get(locale,'mohap-error')}: </strong>${languageUtil.get(locale,'mohap-error-advanced-search-value')}</p> 33 </div>
34
35
36
37 <script type="text/javascript">
38 let selectedFiltersM = {}; 39 document.addEventListener("DOMContentLoaded", function () { 40 const searchInputM = document.getElementById('searchelemMobile'); 41 const applyFiltersBtnM = document.getElementById('searchLink'); 42 const dropdownTriggerM = document.getElementById('dropdown-advancedSearch-mobile'); 43 const validationMsgM = document.getElementById('msg-advanced-search-validation'); 44 const dropdownM = document.getElementById("dropdownAdvancedSearchMobile"); 45 const checkboxesM = document.querySelectorAll('.desktop-items .advanced-search-item input[type="checkbox"]'); 46 var isAnyCheckedM = false;
47 checkboxesM.forEach(checkbox => { 48 checkbox.addEventListener('change', () => { 49 isAnyChecked = Array.from(checkboxesM).some(cb => cb.checked);
50 });
51 });
52 let isDropdownOpenedM = false;
53 const dropdownInstanceM = new Dropdown(dropdownM, dropdownTriggerM, { 54 triggerType: 'none'
55 });
56
57 // Check if there is any filter or query, then enable/disable apply button
58 function updateUIStateM() { 59 const hasQuery = searchInputM && searchInputM.value.trim() !== "";
60 const hasFilters = Object.keys(selectedFiltersM).length > 0;
61
62 if (hasQuery) { 63 applyFiltersBtn.removeAttribute("disabled"); 64 validationMsg.classList.add("hide"); 65 } else { 66 applyFiltersBtn.setAttribute("disabled", true); 67 validationMsg.classList.remove("hide"); 68 }
69 }
70
71 //Update Button onchange search value
72 if (searchInputM) { 73 searchInputM.addEventListener("input", updateUIStateM); 74 }
75
76 //Keep Dropdown opened
77 if (searchInputM && dropdownM) { 78 searchInputM.addEventListener("click", () => { 79 if (dropdownM && typeof window.Dropdown === 'function') { 80 isDropdownOpenedM && dropdownInstanceM.show();
81 }
82 });
83 }
84
85 dropdownTriggerM.addEventListener("click", () => { 86 isDropdownOpenedM = !isDropdownOpenedM;
87 dropdownInstanceM.toggle();
88 });
89 });
90 </script>
91</div>
المشاركة على وسائل التواصل الاجتماعي
إذا أعجبك المحتوى يمكنك مشاركته عبر