1<#assign namespace = renderResponse.getNamespace()>
2<#assign journalService = serviceLocator.findService('com.liferay.journal.service.JournalArticleService')/>
3<#assign hits = searchResultsPortletDisplayContext.getDocuments()>
4
5<div class="search__results search--locresults" id="search__results-${namespace}">
6 <div class="explore__right">
7 <div class="explore__rightinner">
8 <h2 class="explore__heading">
9 <span>Global locations</span>
10 <span class="explore__filtericon"></span>
11 </h2>
12 <div class="explore__results">
13 <div class="accordion" id="accordion-${namespace}">
14 <#if entries?has_content>
15
16 <#assign locationDetails = [] />
17 <#assign renderingCountry = "--NULL--" />
18
19 <#list entries as entry>
20 <#if !entry.isTemporarilyUnavailable()>
21 <#assign
22 hit = hits[entry?index]
23 journalArticle = journalService.getArticle(getterUtil.getLong(hit.groupId), hit.articleId)
24 document = saxReaderUtil.read(journalArticle.getContentByLocale(locale.toString()))
25 rootElement = document.getRootElement()
26
27 xPathSelector = saxReaderUtil.createXPath("dynamic-element[@name='Country']")
28 country = xPathSelector.selectSingleNode(rootElement).getStringValue()?trim
29
30 xPathSelector = saxReaderUtil.createXPath("dynamic-element[@name='City']")
31 city = xPathSelector.selectSingleNode(rootElement).getStringValue()?trim
32
33 xPathSelector = saxReaderUtil.createXPath("dynamic-element[@name='Address']")
34 address = xPathSelector.selectSingleNode(rootElement).getStringValue()?trim?replace("\n", "<br/>")
35
36 xPathSelector = saxReaderUtil.createXPath("dynamic-element[@name='ContactDetails']")
37 contactDetails = xPathSelector.selectSingleNode(rootElement).getStringValue()?trim?replace("\n", "<br/>")
38
39 xPathSelector = saxReaderUtil.createXPath("dynamic-element[@name='MapLink_TitleFieldSet']//dynamic-element[@name='MapLink_External']")
40 mapLink = xPathSelector.selectSingleNode(rootElement).getStringValue()?trim
41
42 locationDetail = {'country': country, 'city': city, 'address': address, 'contactDetails': contactDetails, 'mapLink': mapLink}
43 />
44 <#if country == renderingCountry || renderingCountry == '--NULL--' >
45 <#assign
46 renderingCountry = country
47 locationDetails = locationDetails + [locationDetail]
48 />
49 <#else>
50 <@renderCountryLocations countryName=renderingCountry locationDetails=locationDetails />
51 <#assign
52 renderingCountry = country
53 locationDetails = [locationDetail]
54 />
55 </#if>
56 <#if entry?is_last>
57 <@renderCountryLocations countryName=country locationDetails=locationDetails />
58 </#if>
59 </#if>
60 </#list>
61 </#if>
62 </div>
63 </div>
64 </div>
65 </div>
66</div>
67
68<#macro renderCountryLocations countryName locationDetails>
69 <#assign sectionId = random.nextInt() />
70 <div class="jmaccrdn__section">
71 <div class="jmaccrdn__title" role="button" tabindex="0" data-toggle="collapse" data-target="#section${namespace}${sectionId}"
72 aria-expanded="true" aria-controls="section${namespace}${sectionId}">
73 <p>
74 ${countryName}
75 <span class="jmaccrdn__arrow"></span>
76 </p>
77 </div>
78 <div id="section${namespace}${sectionId}" class="jmaccrdn__body collapse" data-parent="#accordion-${namespace}">
79 <div class="jmaccrdn__answer-sec">
80 <#list locationDetails as locationDetail>
81 <div class="row country-locations">
82 <div class="col-md-4">
83 <div class="jmcountry-title">City</div>
84 <div>${locationDetail.city}</div>
85 </div>
86 <div class="col-md-4">
87 <div class="jmcountry-title">Address</div>
88 <div>${locationDetail.address}</div>
89 </div>
90 <div class="col-md-4">
91 <div class="jmcountry-title">Contact Details</div>
92 <div>${locationDetail.contactDetails}</div>
93 <div class="map-link-cont">
94 <a class="map-link" href="${locationDetail.mapLink}" target="_blank">Map Link</a>
95 </div>
96 </div>
97 </div>
98 </#list>
99 </div>
100 </div>
101 </div>
102</#macro>
103
104<script>
105$(function() {
106 $("#search__results-${namespace}").parent().find(".pagination-bar").hide();
107 $('button.dropdown-toggle.page-link[role="combobox"]').attr('aria-label', 'Select number of entries per page');
108});
109</script>
110
111<style>
112
113@media (min-width: 320px) and (max-width: 650px) {
114 .search__results .explore__right {
115 margin-top: -16%;
116 }
117 .search--locresults .jmaccrdn__title p {
118 font-size: 20px !important;
119 }
120 .explore__heading{
121 padding-left: 14.2px !important;
122 padding-right: 14px !important;
123 }
124 .search--locresults .jmaccrdn__title p {
125 padding: 25px 25px 25px 18px;
126 }
127}
128</style>