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