|
@ -5,6 +5,7 @@ |
|
|
$(document).ready(function($) { |
|
|
$(document).ready(function($) { |
|
|
$("input[type='checkbox']").change( filter ); |
|
|
$("input[type='checkbox']").change( filter ); |
|
|
$("#changelist-search").submit( search ); |
|
|
$("#changelist-search").submit( search ); |
|
|
|
|
|
$("#closeiwlink").click( closeAllInfowindows ); |
|
|
var latlng = new google.maps.LatLng(-14.2350040, -51.925280); |
|
|
var latlng = new google.maps.LatLng(-14.2350040, -51.925280); |
|
|
var myOptions = { |
|
|
var myOptions = { |
|
|
zoom: 5, |
|
|
zoom: 5, |
|
@ -40,7 +41,8 @@ |
|
|
var mark = new google.maps.Marker(markData); |
|
|
var mark = new google.maps.Marker(markData); |
|
|
var infoWin = new google.maps.InfoWindow({content: '<strong>' + municipio.nome + '</strong><br/><br/>' + municipio.info }); |
|
|
var infoWin = new google.maps.InfoWindow({content: '<strong>' + municipio.nome + '</strong><br/><br/>' + municipio.info }); |
|
|
linkMarkMessage(mark, infoWin, map); |
|
|
linkMarkMessage(mark, infoWin, map); |
|
|
municipio['mapmark'] = mark |
|
|
municipio['mapmark'] = mark; |
|
|
|
|
|
municipio['infowindow'] = infoWin; |
|
|
municipiosArray[i] = municipio; |
|
|
municipiosArray[i] = municipio; |
|
|
} |
|
|
} |
|
|
filter(null); |
|
|
filter(null); |
|
@ -52,6 +54,12 @@ |
|
|
google.maps.event.addListener(mark, 'click', function() {infoWin.open(map, mark);}); |
|
|
google.maps.event.addListener(mark, 'click', function() {infoWin.open(map, mark);}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function closeAllInfowindows() { |
|
|
|
|
|
for (var i in municipiosArray) { |
|
|
|
|
|
municipiosArray[i]['infowindow'].close(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function filter(event) { |
|
|
function filter(event) { |
|
|
var data = $("#filter_form").serializeArray(); |
|
|
var data = $("#filter_form").serializeArray(); |
|
|
var estados = []; |
|
|
var estados = []; |
|
@ -70,6 +78,7 @@ |
|
|
|
|
|
|
|
|
for (var i in municipiosArray) { |
|
|
for (var i in municipiosArray) { |
|
|
var municipio = municipiosArray[i]; |
|
|
var municipio = municipiosArray[i]; |
|
|
|
|
|
municipio['infowindow'].close(); |
|
|
var aparece = false; |
|
|
var aparece = false; |
|
|
|
|
|
|
|
|
if (regioes.indexOf(municipio.regiao) == -1 && estados.indexOf(municipio.estado) == -1) { |
|
|
if (regioes.indexOf(municipio.regiao) == -1 && estados.indexOf(municipio.estado) == -1) { |
|
@ -99,7 +108,6 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function search(event) { |
|
|
function search(event) { |
|
|
var data = |
|
|
|
|
|
$.ajax({ |
|
|
$.ajax({ |
|
|
url: "/sigi/dashboard/mapsearch/", |
|
|
url: "/sigi/dashboard/mapsearch/", |
|
|
type: 'GET', |
|
|
type: 'GET', |
|
@ -119,6 +127,9 @@ |
|
|
for (var i in return_data.ids) { |
|
|
for (var i in return_data.ids) { |
|
|
var municipio = municipiosArray[return_data.ids[i]]; |
|
|
var municipio = municipiosArray[return_data.ids[i]]; |
|
|
if (typeof(municipio) != 'undefined') { |
|
|
if (typeof(municipio) != 'undefined') { |
|
|
|
|
|
if (municipio.mapmark.map == null) { |
|
|
|
|
|
municipio.mapmark.setMap(map); |
|
|
|
|
|
} |
|
|
google.maps.event.trigger(municipio.mapmark, 'click'); |
|
|
google.maps.event.trigger(municipio.mapmark, 'click'); |
|
|
total = total + 1; |
|
|
total = total + 1; |
|
|
} |
|
|
} |
|
@ -133,7 +144,6 @@ |
|
|
} else { |
|
|
} else { |
|
|
$("#search-panel").html(total + ' municípios encontrados.'); |
|
|
$("#search-panel").html(total + ' municípios encontrados.'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}}); |
|
|
}}); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|