@ -3,44 +3,49 @@
{% load i18n %}
{% load i18n %}
{% block extrastyle %}
{% block extrastyle %}
{{ block.super }}
{{ block.super }}
< link rel = "stylesheet" href = "https://code.jquery.com/ui/1.12.0/themes/smoothness/jquery-ui.css" / >
< link rel = "stylesheet" href = "https://code.jquery.com/ui/1.12.0/themes/smoothness/jquery-ui.css" / >
< link rel = "stylesheet" href = "https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" integrity = "sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" crossorigin = "" / >
< link rel = "stylesheet" href = "https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
< link rel = "stylesheet" href = "{% static 'home/css/openmap.css' %}" / >
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
< link rel = "stylesheet" href = "{% static " admin / css / changelists . css " % } " type = "text/css" / >
crossorigin="" />
< link rel = "stylesheet" href = "{% static 'home/css/openmap.css' %}" / >
< link rel = "stylesheet" href = "{% static " admin / css / changelists . css " % } " type = "text/css" / >
{% endblock %}
{% endblock %}
{% block extrahead %}
{% block extrahead %}
{{ block.super }}
{{ block.super }}
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" / >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" / >
< meta http-equiv = "Content-Type" content = "text/xhtml; charset=UTF-8" / >
< meta http-equiv = "Content-Type" content = "text/xhtml; charset=UTF-8" / >
< meta name = "robots" content = "NONE,NOARCHIVE" / >
< meta name = "robots" content = "NONE,NOARCHIVE" / >
< script type = "text/javascript" >
< script type = "text/javascript" >
//< ![CDATA[
//< ![CDATA[
window.__admin_media_prefix__ = "{% filter escapejs %}{% static "admin/" %}{% endfilter %}";
window.__admin_media_prefix__ = "{% filter escapejs %}{% static "admin / " %}{% endfilter %}";
//]]>
//]]>
< / script >
< / script >
< script src = "https://code.jquery.com/jquery-3.6.0.min.js" integrity = "sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin = "anonymous" > < / script >
< script src = "https://code.jquery.com/jquery-3.6.0.min.js"
<!-- script src="https://code.jquery.com/ui/1.13.1/jquery - ui.min.js" integrity="sha256 - eTyxS0rkjpLEo16uXTS0uVCS4815lc40K2iVpWDvdSY=" crossorigin="anonymous"></script -->
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous">< / script >
< script src = "https://unpkg.com/leaflet@1.7.1/dist/leaflet.js" integrity = "sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" crossorigin = "" > < / script >
<!-- script src="https://code.jquery.com/ui/1.13.1/jquery - ui.min.js" integrity="sha256 - eTyxS0rkjpLEo16uXTS0uVCS4815lc40K2iVpWDvdSY=" crossorigin="anonymous"></script -->
< script type = "text/javascript" src = "{% static " admin / js / core . js " % } " > < / script >
< script src = "https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin="">< / script >
< script type = "text/javascript" src = "{% static " admin / js / core . js " % } " > < / script >
{% endblock %}
{% endblock %}
{% block usertools %}
{% block usertools %}
< div id = "user-tools" >
< div id = "user-tools" >
< a href = "{% url 'admin:index' %}" > {% trans "Entrar" %}< / a >
< a href = "{% url 'admin:index' %}" > {% trans "Entrar" %}< / a >
< / div >
< / div >
{% endblock %}
{% endblock %}
{% block side_nav %}
{% block side_nav %}
{% if not nav_bar_minimized %}
{% if not nav_bar_minimized %}
< div id = "side-bar" class = "hide-on-med-and-down" >
< div id = "side-bar" class = "hide-on-med-and-down" >
{% include 'home/mapfilter.html' %}
{% include 'home/mapfilter.html' %}
< / div >
< / div >
{% endif %}
{% endif %}
< div id = "mobile-demo" class = "sidenav" >
< div id = "mobile-demo" class = "sidenav" >
{% include 'home/mapfilter.html' with mobile=True %}
{% include 'home/mapfilter.html' with mobile=True %}
< / div >
< / div >
{% endblock %}
{% endblock %}
{% block content %}
{% block content %}
@ -53,61 +58,16 @@
{% block footer %}
{% block footer %}
{{ block.super }}
{{ block.super }}
< script type = "text/javascript" src = "{% static 'js/search.js' %}" > < / script >
< script >
< script >
$(document).ready(function(){
var mymap;
var options = {color: 'blue', fillColor: 'red', fillOpacity: 0.4, radius: 500};
$(document).ready(function () {
var unfiltred_options = {color: 'red', fillColor: 'red', fillOpacity: 0, radius: 1000};
var options = { color: 'blue', fillColor: 'red', fillOpacity: 0.4, radius: 500 };
var unfiltred_options = { color: 'red', fillColor: 'red', fillOpacity: 0, radius: 1000 };
$(".search-text").on("input change", function() {
$resultbox = $(".search-result");
var $this = $(this);
var term = $this.val();
if (term.length < 3 ) {
$resultbox.html("");
$resultbox.addClass("hide");
return;
}
$.get("{% url "openmapsearch" %}", {"q": term}, function(data) {
$resultbox.html("");
for (i in data) {
var plain = JSON.stringify(data[i]);
var $item = $(`< a href = "#" class = "search-result-item" data-orgao = '${plain}' > < / a > `);
$item.html(data[i].label);
$item.prop("data_item", data[i]);
$resultbox.append($item);
}
$resultbox.removeClass("hide");
$(".search-result-item").on("click", function() {
var plain = $(this).attr("data-orgao");
var result = JSON.parse(plain);
console.log(result);
$this.val(result.label);
$resultbox.html("").addClass("hide");
mymap.flyTo([result.lat, result.lng], 8.5);
var encontrado = false;
mymap.eachLayer(function(layer) {
if (layer instanceof L.Circle) {
if (layer.orgao_id == result.id) {
layer.openPopup();
encontrado = true;
}
}
});
if (!encontrado) {
var mark = L.circle([result.lat, result.lng], unfiltred_options).bindTooltip(result.label).bindPopup("").addTo(mymap);
mark.orgao_id = result.id
mark.openPopup();
}
});
});
});
$("input[type=checkbox]").change(filtra);
$("input[type=checkbox]").change(filtra);
var mymap = L.map('map', {zoomSnap: 0.01}).setView([-14.235004, -51.92528], 4.5);
mymap = L.map('map', { zoomSnap: 0.01 }).setView([-14.235004, -51.92528], 4.5);
mymap.zoomControl.options.zoomInTitle = "{% trans 'Aproximar' %}";
mymap.zoomControl.options.zoomInTitle = "{% trans 'Aproximar' %}";
mymap.zoomControl.options.zoomOutTitle = "{% trans 'Afastar' %}";
mymap.zoomControl.options.zoomOutTitle = "{% trans 'Afastar' %}";
@ -116,20 +76,20 @@
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 18,
maxZoom: 18,
attribution: 'Map data © < a href = "https://www.openstreetmap.org/copyright" > OpenStreetMap< / a > contributors, ' +
attribution: 'Map data © < a href = "https://www.openstreetmap.org/copyright" > OpenStreetMap< / a > contributors, ' +
'Imagery © < a href = "https://www.mapbox.com/" > Mapbox< / a > ',
'Imagery © < a href = "https://www.mapbox.com/" > Mapbox< / a > ',
id: 'mapbox/streets-v11',
id: 'mapbox/streets-v11',
tileSize: 512,
tileSize: 512,
zoomOffset: -1
zoomOffset: -1
}).addTo(mymap);
}).addTo(mymap);
mymap.on("popupopen", function(e) {
mymap.on("popupopen", function (e) {
var popup = e.popup;
var popup = e.popup;
mark = popup._source;
mark = popup._source;
$.ajax({
$.ajax({
type: "GET",
type: "GET",
url: "{% url "openmapdetail" "orgao_id" %}".replace("orgao_id", mark.orgao_id),
url: "{% url "openmapdetail" "orgao_id" %}".replace("orgao_id", mark.orgao_id),
encode: true
encode: true
}).done(function(content) {
}).done(function (content) {
popup.setContent(content);
popup.setContent(content);
})
})
})
})
@ -138,8 +98,8 @@
function filtra() {
function filtra() {
var name = $(this).attr("name"),
var name = $(this).attr("name"),
value = $(this).attr("value"),
value = $(this).attr("value"),
checked = $(this).prop("checked");
checked = $(this).prop("checked");
if (name) {
if (name) {
$(`input[type=checkbox][name=${name}][value=${value}]`).prop("checked", checked);
$(`input[type=checkbox][name=${name}][value=${value}]`).prop("checked", checked);
@ -147,27 +107,27 @@
if (value == "ignore") {
if (value == "ignore") {
controls = $(this).attr("data-controls");
controls = $(this).attr("data-controls");
$("input[type=checkbox][name='"+controls+"']").prop("disabled", checked);
$("input[type=checkbox][name='" + controls + "']").prop("disabled", checked);
}
}
if (value=="none") {
if (value == "none") {
$("input[type=checkbox][name='" + name +"'][value!='none']").prop("checked", !checked);
$("input[type=checkbox][name='" + name + "'][value!='none']").prop("checked", !checked);
} else {
} else {
if (checked) {
if (checked) {
$("input[type=checkbox][name='" + name +"'][value='none']").prop("checked", false);
$("input[type=checkbox][name='" + name + "'][value='none']").prop("checked", false);
}
}
}
}
if (name=='regiao') {
if (name == 'regiao') {
$("input[type=checkbox][name='uf'][data-regiao='"+value+"']").prop('checked', checked);
$("input[type=checkbox][name='uf'][data-regiao='" + value + "']").prop('checked', checked);
}
}
if (name=='uf') {
if (name == 'uf') {
var sigla_regiao = $(this).attr('data-regiao'),
var sigla_regiao = $(this).attr('data-regiao'),
regiao = $("input[type=checkbox][value='"+sigla_regiao+"']");
regiao = $("input[type=checkbox][value='" + sigla_regiao + "']");
if ($("input[type=checkbox][name='uf'][data-regiao='"+sigla_regiao+"']:checked").length == 0) {
if ($("input[type=checkbox][name='uf'][data-regiao='" + sigla_regiao + "']:checked").length == 0) {
$(regiao).prop('checked', false).prop("indeterminate", false);
$(regiao).prop('checked', false).prop("indeterminate", false);
} else if ($("input[type=checkbox][name='uf'][data-regiao='"+sigla_regiao+"']:not(:checked)").length == 0) {
} else if ($("input[type=checkbox][name='uf'][data-regiao='" + sigla_regiao + "']:not(:checked)").length == 0) {
$(regiao).prop('checked', true).prop("indeterminate", false);
$(regiao).prop('checked', true).prop("indeterminate", false);
} else {
} else {
$(regiao).prop("indeterminate", true)
$(regiao).prop("indeterminate", true)
@ -176,7 +136,7 @@
var formData = $("#filterForm").serializeArray();
var formData = $("#filterForm").serializeArray();
mymap.eachLayer(function(layer) {
mymap.eachLayer(function (layer) {
if (layer instanceof L.Circle) {
if (layer instanceof L.Circle) {
mymap.removeLayer(layer);
mymap.removeLayer(layer);
}
}
@ -188,11 +148,11 @@
data: formData,
data: formData,
dataType: "json",
dataType: "json",
encode: true,
encode: true,
}).done(function(returnedData) {
}).done(function (returnedData) {
$("#totalOrgao").text(returnedData.length);
$("#totalOrgao").text(returnedData.length);
returnedData.forEach(function(casa) {
returnedData.forEach(function (casa) {
if (casa[2] === null || casa[3] === null) {
if (casa[2] === null || casa[3] === null) {
alert(casa[1]+" está sem coordenadas geográficas e não será plotada");
alert(casa[1] + " está sem coordenadas geográficas e não será plotada");
} else {
} else {
var mark = L.circle([casa[2], casa[3]], options).bindTooltip(casa[1]).bindPopup('< div class = "preloader-wrapper small active" > < div class = "spinner-layer spinner-green-only" > < div class = "circle-clipper left" > < div class = "circle" > < / div > < / div > < div class = "gap-patch" > < div class = "circle" > < / div > < / div > < div class = "circle-clipper right" > < div class = "circle" > < / div > < / div > < / div > < / div > ').addTo(mymap);
var mark = L.circle([casa[2], casa[3]], options).bindTooltip(casa[1]).bindPopup('< div class = "preloader-wrapper small active" > < div class = "spinner-layer spinner-green-only" > < div class = "circle-clipper left" > < div class = "circle" > < / div > < / div > < div class = "gap-patch" > < div class = "circle" > < / div > < / div > < div class = "circle-clipper right" > < div class = "circle" > < / div > < / div > < / div > < / div > ').addTo(mymap);
mark.orgao_id = casa[0]
mark.orgao_id = casa[0]
@ -200,175 +160,197 @@
})
})
})
})
}
}
})
});
function map_fly_to(obj) {
mymap.flyTo([obj.lat, obj.lng], 8.5);
var encontrado = false;
mymap.eachLayer(function (layer) {
if (layer instanceof L.Circle) {
if (layer.orgao_id == obj.id) {
layer.openPopup();
encontrado = true;
}
}
});
if (!encontrado) {
var mark = L.circle([result.lat, result.lng], unfiltred_options).bindTooltip(result.label).bindPopup("").addTo(mymap);
mark.orgao_id = result.id
mark.openPopup();
}
}
< / script >
< / script >
{% endblock %}
{% endblock %}
{% comment %}
{% comment %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" lang = "{{ LANGUAGE_CODE|default:" en-us " } } " { % if LANGUAGE_BIDI % } dir = "rtl" { % endif % } >
< html xmlns = "http://www.w3.org/1999/xhtml" lang = "{{ LANGUAGE_CODE|default:" en-us " } } " { % if LANGUAGE_BIDI % } dir = "rtl"
< head >
{% endif %}>
< head >
< title > {% trans 'SIGI' %}< / title >
< title > {% trans 'SIGI' %}< / title >
< / head >
< / head >
< body >
< div class = "mapbox" >
< body >
< div class = "sigi-logo" >
< div class = "mapbox" >
< div >
< div class = "sigi-logo" >
< img src = "{% static 'img/interlegis_60x60.png' %}" class = 'img-circle' / >
< div >
< img src = "{% static 'img/interlegis_60x60.png' %}" class = 'img-circle' / >
< / div >
< div >
< h3 > Interlegis< / h3 >
< a href = "{% url 'admin:index' %}" > Voltar ao SIGI< / a >
< / div >
< / div >
< / div >
< div >
< div id = "map" >
< h3 > Interlegis< / h3 >
<!-- open street map -->
< a href = "{% url 'admin:index' %}" > Voltar ao SIGI< / a >
< / div >
< / div >
< / div >
< div id = "map" >
<!-- open street map -->
< / div >
< / div >
< script >
$(document).ready(function(){
var options = {color: 'blue', fillColor: 'red', fillOpacity: 0.4, radius: 500};
var unfiltred_options = {color: 'red', fillColor: 'red', fillOpacity: 0, radius: 1000};
$("#search-text").autocomplete({
< / div >
minLength: 3,
< script >
source: function(request, response) {
$(document).ready(function () {
$.ajax({
var options = { color: 'blue', fillColor: 'red', fillOpacity: 0.4, radius: 500 };
url: "{% url "openmapsearch" %}",
var unfiltred_options = { color: 'red', fillColor: 'red', fillOpacity: 0, radius: 1000 };
data: {q: request.term },
dataType: "json",
$("#search-text").autocomplete({
appendTo: "#searchform",
minLength: 3,
success: function(data) {
source: function (request, response) {
console.log(data);
$.ajax({
response(data);
url: "{% url "openmapsearch" %}",
},
data: { q: request.term },
})
dataType: "json",
},
appendTo: "#searchform",
select: function( event, ui ) {
success: function (data) {
mymap.flyTo([ui.item.lat, ui.item.lng], 8.5);
console.log(data);
var encontrado = false;
response(data);
mymap.eachLayer(function(layer) {
},
if (layer instanceof L.Circle) {
})
if (layer.orgao_id == ui.item.id) {
},
layer.openPopup();
select: function (event, ui) {
encontrado = true;
mymap.flyTo([ui.item.lat, ui.item.lng], 8.5);
var encontrado = false;
mymap.eachLayer(function (layer) {
if (layer instanceof L.Circle) {
if (layer.orgao_id == ui.item.id) {
layer.openPopup();
encontrado = true;
}
}
}
}
})
})
if (!encontrado) {
if (!encontrado) {
var mark = L.circle([ui.item.lat, ui.item.lng], unfiltred_options).bindTooltip(ui.item.label).bindPopup("").addTo(mymap);
var mark = L.circle([ui.item.lat, ui.item.lng], unfiltred_options).bindTooltip(ui.item.label).bindPopup("").addTo(mymap);
mark.orgao_id = ui.item.id
mark.orgao_id = ui.item.id
mark.openPopup();
mark.openPopup();
}
}
console.log(ui);
console.log(ui);
}
}
});
});
$("#filterbox").on("shown.bs.collapse", function() {
$("#filterbox").on("shown.bs.collapse", function () {
$("#options-toggler span").removeClass("glyphicon-chevron-right").addClass("glyphicon-chevron-left")
$("#options-toggler span").removeClass("glyphicon-chevron-right").addClass("glyphicon-chevron-left")
})
})
$("#filterbox").on("hidden.bs.collapse", function() {
$("#filterbox").on("hidden.bs.collapse", function () {
$("#options-toggler span").removeClass("glyphicon-chevron-left").addClass("glyphicon-chevron-right")
$("#options-toggler span").removeClass("glyphicon-chevron-left").addClass("glyphicon-chevron-right")
})
})
$("input[type=checkbox]").change(filtra);
$("input[type=checkbox]").change(filtra);
var mymap = L.map('map', {zoomSnap: 0.01}).setView([-14.235004, -51.92528], 4.5);
var mymap = L.map('map', { zoomSnap: 0.01 }).setView([-14.235004, -51.92528], 4.5);
mymap.zoomControl.options.zoomInTitle = "{% trans 'Aproximar' %}";
mymap.zoomControl.options.zoomInTitle = "{% trans 'Aproximar' %}";
mymap.zoomControl.options.zoomOutTitle = "{% trans 'Afastar' %}";
mymap.zoomControl.options.zoomOutTitle = "{% trans 'Afastar' %}";
mymap.zoomControl.setPosition("bottomright");
mymap.zoomControl.setPosition("bottomright");
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 18,
maxZoom: 18,
attribution: 'Map data © < a href = "https://www.openstreetmap.org/copyright" > OpenStreetMap< / a > contributors, ' +
attribution: 'Map data © < a href = "https://www.openstreetmap.org/copyright" > OpenStreetMap< / a > contributors, ' +
'Imagery © < a href = "https://www.mapbox.com/" > Mapbox< / a > ',
'Imagery © < a href = "https://www.mapbox.com/" > Mapbox< / a > ',
id: 'mapbox/streets-v11',
id: 'mapbox/streets-v11',
tileSize: 512,
tileSize: 512,
zoomOffset: -1
zoomOffset: -1
}).addTo(mymap);
}).addTo(mymap);
mymap.on("popupopen", function(e) {
mymap.on("popupopen", function (e) {
var popup = e.popup;
var popup = e.popup;
mark = popup._source;
mark = popup._source;
$.ajax({
$.ajax({
type: "GET",
type: "GET",
url: "{% url "openmapdetail" 'orgao_id' %}".replace("orgao_id", mark.orgao_id),
url: "{% url "openmapdetail" 'orgao_id' %}".replace("orgao_id", mark.orgao_id),
encode: true
encode: true
}).done(function(content) {
}).done(function (content) {
popup.setContent(content);
popup.setContent(content);
})
})
})
})
filtra();
filtra();
function filtra() {
function filtra() {
var name = $(this).attr("name"),
var name = $(this).attr("name"),
value = $(this).attr("value"),
value = $(this).attr("value"),
checked = $(this).prop("checked");
checked = $(this).prop("checked");
if (value == "ignore") {
if (value == "ignore") {
controls = $(this).attr("data-controls");
controls = $(this).attr("data-controls");
$("input[type=checkbox][name='"+controls+"']").prop("disabled", checked);
$("input[type=checkbox][name='" + controls + "']").prop("disabled", checked);
}
if (value=="none") {
$("input[type=checkbox][name='" + name +"'][value!='none']").prop("checked", !checked);
} else {
if (checked) {
$("input[type=checkbox][name='" + name +"'][value='none']").prop("checked", false);
}
}
}
if (name='regiao') {
if (value == "none") {
$("input[type=checkbox][name='uf'][data-regiao='"+value+"']").prop('checked', checked);
$("input[type=checkbox][name='" + name + "'][value!='none']").prop("checked", !checked);
}
if (name='uf') {
var sigla_regiao = $(this).attr('data-regiao'),
regiao = $("input[type=checkbox][value='"+sigla_regiao+"']");
if ($("input[type=checkbox][name='uf'][data-regiao='"+sigla_regiao+"']:checked").length == 0) {
$(regiao).prop('checked', false).prop("indeterminate", false);
} else if ($("input[type=checkbox][name='uf'][data-regiao='"+sigla_regiao+"']:not(:checked)").length == 0) {
$(regiao).prop('checked', true).prop("indeterminate", false);
} else {
} else {
$(regiao).prop("indeterminate", true)
if (checked) {
$("input[type=checkbox][name='" + name + "'][value='none']").prop("checked", false);
}
}
}
}
var formData = $("#filterForm").serializeArray();
mymap.eachLayer(function(layer) {
if (name = 'regiao') {
if (layer instanceof L.Circle) {
$("input[type=checkbox][name='uf'][data-regiao='" + value + "']").prop('checked', checked);
mymap.removeLayer(layer);
}
}
})
$.ajax({
if (name = 'uf') {
type: "GET",
var sigla_regiao = $(this).attr('data-regiao'),
url: "{% url "openmapdata" %}",
regiao = $("input[type=checkbox][value='" + sigla_regiao + "']");
data: formData,
if ($("input[type=checkbox][name='uf'][data-regiao='" + sigla_regiao + "']:checked").length == 0) {
dataType: "json",
$(regiao).prop('checked', false).prop("indeterminate", false);
encode: true,
} else if ($("input[type=checkbox][name='uf'][data-regiao='" + sigla_regiao + "']:not(:checked)").length == 0) {
}).done(function(returnedData) {
$(regiao).prop('checked', true).prop("indeterminate", false);
$("#totalOrgao").text(returnedData.length);
returnedData.forEach(function(casa) {
if (casa[2] === null || casa[3] === null) {
alert(casa[1]+" está sem coordenadas geográficas e não será plotada");
} else {
} else {
var mark = L.circle([casa[2], casa[3]], options).bindTooltip(casa[1]).bindPopup("").addTo(mymap);
$(regiao).prop("indeterminate", true)
mark.orgao_id = casa[0]
}
}
var formData = $("#filterForm").serializeArray();
mymap.eachLayer(function (layer) {
if (layer instanceof L.Circle) {
mymap.removeLayer(layer);
}
}
})
})
})
}
})
< / script >
< / body >
< / html >
{% endcomment %}
$.ajax({
type: "GET",
url: "{% url "openmapdata" %}",
data: formData,
dataType: "json",
encode: true,
}).done(function (returnedData) {
$("#totalOrgao").text(returnedData.length);
returnedData.forEach(function (casa) {
if (casa[2] === null || casa[3] === null) {
alert(casa[1] + " está sem coordenadas geográficas e não será plotada");
} else {
var mark = L.circle([casa[2], casa[3]], options).bindTooltip(casa[1]).bindPopup("").addTo(mymap);
mark.orgao_id = casa[0]
}
})
})
}
})
< / script >
< / body >
< / html >
{% endcomment %}