|
@@ -82,7 +82,7 @@ |
82 |
82 |
|
tipControlList.id = "tip-control"; |
83 |
83 |
|
tipControl = new TipControl(tipControlList, tipologies, markers, place.name, response.locals, map); |
84 |
84 |
|
containerList.appendChild(tipControlList); |
85 |
|
- |
map.controls[google.maps.ControlPosition.TOP_RIGHT].push(containerList); |
|
85 |
+ |
map.controls[google.maps.ControlPosition.LEFT].push(containerList); |
86 |
86 |
|
} else { |
87 |
87 |
|
containerList = document.getElementById("container-list"); |
88 |
88 |
|
var child = document.getElementById("tip-control"); |
|
@@ -91,8 +91,9 @@ |
91 |
91 |
|
tipControlList.id = "tip-control"; |
92 |
92 |
|
tipControl = new TipControl(tipControlList, tipologies, markers, place.name, response.locals, map); |
93 |
93 |
|
containerList.replaceChild(tipControlList, child); |
|
94 |
+ |
|
94 |
95 |
|
} |
95 |
|
- |
for (i=0; i<response.locals.length; i++){ |
|
96 |
+ |
for (var i=0; i<response.locals.length; i++){ |
96 |
97 |
|
markers.push(new google.maps.Marker({ |
97 |
98 |
|
map: map, |
98 |
99 |
|
icon: iconSmart, |
|
@@ -101,6 +102,7 @@ |
101 |
102 |
|
})); |
102 |
103 |
|
var marker = markers[i+1]; |
103 |
104 |
|
|
|
105 |
+ |
var id = response.locals[i].id; |
104 |
106 |
|
var name = response.locals[i].nomelocale ? response.locals[i].nomelocale : ""; |
105 |
107 |
|
var rates = rating(response.locals[i].stelle); |
106 |
108 |
|
var charging = response.locals[i].n_punti_ricarica ? response.locals[i].n_punti_ricarica : 0; |
|
@@ -116,19 +118,23 @@ |
116 |
118 |
|
typName = tipologies[j].tipologia; |
117 |
119 |
|
} |
118 |
120 |
|
|
119 |
|
- |
var content = '<div id="content">'+ |
|
121 |
+ |
var content = '<div id="content" class="' + id + '">'+ |
120 |
122 |
|
'<div id="siteNotice">'+ |
121 |
123 |
|
'</div>'+ |
122 |
124 |
|
'<h1 id="firstHeading" class="firstHeading">' + name + '</h1>'+ |
123 |
125 |
|
'<h4 id="secondHeading" class="secondHeading">' + typName + '</h4>' + |
124 |
126 |
|
'<div id="bodyContent">'+ |
125 |
|
- |
'<div id="rating">' + rates + '</div>' + |
126 |
|
- |
'<p>' + description + '</p>'+ |
|
127 |
+ |
'<div id="rating" class="' + response.locals[i].stelle + '">' + rates + '</div>' + |
|
128 |
+ |
'<p style="margin-top: 1em;">' + description + '</p>'+ |
127 |
129 |
|
'<div id="charging"><p><b>Punti di ricarica: </b>' + charging + '</p></div>' + |
128 |
130 |
|
'<p><b>Indirizzo:</b> ' + address + '</p>' + |
129 |
131 |
|
'<p><b>E-mail: </b>' + email + '</p>' + |
130 |
132 |
|
'<p><b>Sito: </b><a href="http://' + site + '" target="_blank">'+ |
131 |
|
- |
site + '</a></p>'+ |
|
133 |
+ |
site + '</a></p>'+ |
|
134 |
+ |
// inserimento commenti (in sospeso) |
|
135 |
+ |
/*'<p class="btn comment-btn"><a id="create-comment" href="javascript:void(0)" onclick="openComment(this)">Inserisci Commento</a></p>' +*/ |
|
136 |
+ |
//visualizza commenti |
|
137 |
+ |
'<p class="btn comment-btn"><a id="list-comments" href="javascript:void(0)" onclick="openListComments(this)" >Visualizza Commenti</a></p>' + |
132 |
138 |
|
'</div>'+ |
133 |
139 |
|
'</div>'; |
134 |
140 |
|
contents.push(content); |
|
@@ -157,6 +163,62 @@ |
157 |
163 |
|
API.getLocali(-1, lat, lng, 10000, success, error); |
158 |
164 |
|
} |
159 |
165 |
|
|
|
166 |
+ |
// setta il contenuto per l'inserimento dei commenti (in sospeso) |
|
167 |
+ |
function openComment(elem){ |
|
168 |
+ |
var contentComment = template.getCommentContent(); |
|
169 |
+ |
$(contentComment).replaceAll(infoWinContent); |
|
170 |
+ |
} |
|
171 |
+ |
|
|
172 |
+ |
function openListComments(elem){ |
|
173 |
+ |
|
|
174 |
+ |
var idLocal = elem.closest("div").parentNode.getAttribute("class"); |
|
175 |
+ |
var content = '<div class="comments-container">'; |
|
176 |
+ |
var infoWinContent = elem.closest("div").parentNode; |
|
177 |
+ |
|
|
178 |
+ |
function success(response){ |
|
179 |
+ |
var countComments; |
|
180 |
+ |
if (response && response.comments.length > 0){ |
|
181 |
+ |
countComments = response.comments.length; |
|
182 |
+ |
for(var i=0; i<response.comments.length; i++){ |
|
183 |
+ |
content += template.getListComments(response.comments[i]); |
|
184 |
+ |
} |
|
185 |
+ |
content += '</div>'; |
|
186 |
+ |
} else { |
|
187 |
+ |
content += template.getNoComments(); |
|
188 |
+ |
countComments = 0; |
|
189 |
+ |
} |
|
190 |
+ |
popup.showCommentsPopup(content, countComments, idLocal, infoWinContent); |
|
191 |
+ |
|
|
192 |
+ |
$('.popup-header').find(".close-btn").click(function(){ |
|
193 |
+ |
popup.closePopup($(this).parent().parent()); |
|
194 |
+ |
}); |
|
195 |
+ |
|
|
196 |
+ |
$('.popup').find("button").unbind().click(function(){ |
|
197 |
+ |
function success(response){ |
|
198 |
+ |
if (response && response.comments.length > 0){ |
|
199 |
+ |
countComments += response.comments.length; |
|
200 |
+ |
for(var i=0; i<response.comments.length; i++){ |
|
201 |
+ |
$('.comments-container').append(template.getListComments(response.comments[i])); |
|
202 |
+ |
} |
|
203 |
+ |
} |
|
204 |
+ |
} |
|
205 |
+ |
|
|
206 |
+ |
function error(response){ |
|
207 |
+ |
|
|
208 |
+ |
} |
|
209 |
+ |
API.getComments(idLocal, success, error, countComments + 1); |
|
210 |
+ |
}); |
|
211 |
+ |
|
|
212 |
+ |
|
|
213 |
+ |
} |
|
214 |
+ |
|
|
215 |
+ |
function error(response){ |
|
216 |
+ |
|
|
217 |
+ |
} |
|
218 |
+ |
|
|
219 |
+ |
API.getComments(idLocal, success, error, 1); |
|
220 |
+ |
} |
|
221 |
+ |
|
160 |
222 |
|
|
161 |
223 |
|
function TipControl(controlList, tipologies, markers, searchedMarker, listLocals, map) { |
162 |
224 |
|
controlList.style.padding = '0'; |
|
@@ -320,7 +382,7 @@ |
320 |
382 |
|
})); |
321 |
383 |
|
|
322 |
384 |
|
//var i; |
323 |
|
- |
|
|
385 |
+ |
var contents = []; |
324 |
386 |
|
getMarkersBySearch(place, lat, lng, markers, tipologies, infowindow, map, iconSmart, contents, bounds); |
325 |
387 |
|
|
326 |
388 |
|
|