Commit 4307a24b authored by Manggar Mahardhika's avatar Manggar Mahardhika

push apex + cesium on trigger

parent 23cae4a3
...@@ -16,9 +16,9 @@ class Dashboard(generic.TemplateView): ...@@ -16,9 +16,9 @@ class Dashboard(generic.TemplateView):
# @method_decorator(login_required(login_url='/login/')) # @method_decorator(login_required(login_url='/login/'))
def get(self, request): def get(self, request):
# print(Group.objects.get(user=request.user)) # print(Group.objects.get(user=request.user))
with conn.cursor() as all_: # with conn.cursor() as all_:
all_.execute("SELECT * from global_oku") # all_.execute("SELECT * from global_oku")
all = all_.fetchall() # all = all_.fetchall()
# with conn.cursor() as kel: # with conn.cursor() as kel:
# kel.execute("SELECT json_build_object('type', 'Feature', 'administrasi', (kode_desa, desa, kecamatan, kab_kota, provinsi, jumlah_pen, jumlah_kk, luas_desa, gambar),'penduduk', (pria, wanita, belum_kawin, kawin, cerai_hidup, cerai_mati, wajib_ktp, islam, kristen, khatolik, hindu, budha, konghucu, kepercayaan_lain, u0, u5, u10, u15, u20, u25, u30, u35, u40, u45, u50, u55, u60, u65, u70, u75),'pekerjaan_pendidikan', (tidak_sekolah, belum_tamat, tamat_sd, sltp, slta, diploma_i, diploma_ii, diploma_iv, strata_ii, strata_iii, tidak_bekerja, aparatur_pemerintah, tenaga_pendidik, wiraswasta, pertanian, tenaga_kesehatan, pensiunan, pegawai, tentara, kepolisian, pedagang, petani, peternak, nelayan, karyawan, buruh, pembantu, tukang, pendeta, pastor, ustadz, dosen, guru, pilot, pengacara, notaris, arsitek, akuntan, konsultan, dokter, bidan, perawat, psikiater, sopir, lainnya), 'poi',(jml_puskesma, jml_sekolah, jml_sarib),'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_data_kelurahan") # kel.execute("SELECT json_build_object('type', 'Feature', 'administrasi', (kode_desa, desa, kecamatan, kab_kota, provinsi, jumlah_pen, jumlah_kk, luas_desa, gambar),'penduduk', (pria, wanita, belum_kawin, kawin, cerai_hidup, cerai_mati, wajib_ktp, islam, kristen, khatolik, hindu, budha, konghucu, kepercayaan_lain, u0, u5, u10, u15, u20, u25, u30, u35, u40, u45, u50, u55, u60, u65, u70, u75),'pekerjaan_pendidikan', (tidak_sekolah, belum_tamat, tamat_sd, sltp, slta, diploma_i, diploma_ii, diploma_iv, strata_ii, strata_iii, tidak_bekerja, aparatur_pemerintah, tenaga_pendidik, wiraswasta, pertanian, tenaga_kesehatan, pensiunan, pegawai, tentara, kepolisian, pedagang, petani, peternak, nelayan, karyawan, buruh, pembantu, tukang, pendeta, pastor, ustadz, dosen, guru, pilot, pengacara, notaris, arsitek, akuntan, konsultan, dokter, bidan, perawat, psikiater, sopir, lainnya), 'poi',(jml_puskesma, jml_sekolah, jml_sarib),'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_data_kelurahan")
...@@ -502,105 +502,105 @@ class Dashboard(generic.TemplateView): ...@@ -502,105 +502,105 @@ class Dashboard(generic.TemplateView):
# } # }
# res_all.append(data_all) # res_all.append(data_all)
perm_group = [] # perm_group = []
if request.user.is_authenticated: # if request.user.is_authenticated:
current_user = request.user # current_user = request.user
thisUser = current_user.id # thisUser = current_user.id
for xx in request.user.get_group_permissions(): # for xx in request.user.get_group_permissions():
perm_group.append(xx.split(".")[1]) # perm_group.append(xx.split(".")[1])
if thisUser == None: # if thisUser == None:
user_data = {"filepath":'placeholder.jpg'} # user_data = {"filepath":'placeholder.jpg'}
else: # else:
# print() # # print()
sql = "select * from auth_user where id = "+str(thisUser) # sql = "select * from auth_user where id = "+str(thisUser)
with conn.cursor() as userprop: # with conn.cursor() as userprop:
userprop.execute(sql) # userprop.execute(sql)
us = userprop.fetchall() # us = userprop.fetchall()
user_data = [] # user_data = []
for row in us: # for row in us:
datas = { # datas = {
"id": row[0], # "id": row[0],
"username": row[4], # "username": row[4],
"firstname": row[5], # "firstname": row[5],
"lastname": row[6], # "lastname": row[6],
"email" : row[7], # "email" : row[7],
"filepath": row[11], # "filepath": row[11],
# "password": row[1] # # "password": row[1]
} # }
user_data.append(datas) # user_data.append(datas)
with conn.cursor() as userlist_: # with conn.cursor() as userlist_:
if request.user.is_superuser or request.user.is_staff: # if request.user.is_superuser or request.user.is_staff:
# print("is superuser") # # print("is superuser")
sql = """ # sql = """
SELECT # SELECT
au.id, # au.id,
au.username, # au.username,
au.first_name, # au.first_name,
au.last_name, # au.last_name,
au.is_active, # au.is_active,
au.last_login, # au.last_login,
au.email, # au.email,
ag.name, # ag.name,
au.is_staff, # au.is_staff,
au.is_superuser, # au.is_superuser,
au.file_path # au.file_path
FROM # FROM
auth_user au, # auth_user au,
auth_user_groups aug, # auth_user_groups aug,
auth_group ag # auth_group ag
WHERE # WHERE
au.id = aug.user_id AND # au.id = aug.user_id AND
ag.id = aug.group_id # ag.id = aug.group_id
ORDER BY # ORDER BY
au.username ASC""" # au.username ASC"""
else: # else:
sql = """ # sql = """
SELECT # SELECT
au.id, # au.id,
au.username, # au.username,
au.first_name, # au.first_name,
au.last_name, # au.last_name,
au.is_active, # au.is_active,
au.last_login, # au.last_login,
au.email, # au.email,
ag.name, # ag.name,
au.is_staff, # au.is_staff,
au.is_superuser, # au.is_superuser,
au.file_path # au.file_path
FROM # FROM
auth_user au, # auth_user au,
auth_user_groups aug, # auth_user_groups aug,
auth_group ag # auth_group ag
WHERE # WHERE
au.id = aug.user_id AND # au.id = aug.user_id AND
ag.id = aug.group_id # ag.id = aug.group_id
ORDER BY # ORDER BY
au.username ASC""" # au.username ASC"""
userlist_.execute(sql) # userlist_.execute(sql)
allUser = userlist_.fetchall() # allUser = userlist_.fetchall()
user_res = [] # user_res = []
for rows in allUser: # for rows in allUser:
datas = { # datas = {
"id": rows[0], # "id": rows[0],
"username": rows[1], # "username": rows[1],
"name": rows[2] +" "+ rows[3], # "name": rows[2] +" "+ rows[3],
"email": rows[6], # "email": rows[6],
"isactive": rows[4], # "isactive": rows[4],
"last": rows[5], # "last": rows[5],
"group": rows[7], # "group": rows[7],
"filepath": rows[10] # "filepath": rows[10]
} # }
user_res.append(datas) # user_res.append(datas)
else: # else:
user_data = [{"id":"Not Login", "username":"Not Login", "firstname":"Not Login", "lastname":"Not Login","email":"Not Login","filepath":"Not Login"}] # user_data = [{"id":"Not Login", "username":"Not Login", "firstname":"Not Login", "lastname":"Not Login","email":"Not Login","filepath":"Not Login"}]
user_res = [{"id":"Not Login", "username":"Not Login", "name":"Not Login", "isactive":"Not Login","email":"Not Login","last":"Not Login", "group":"Not Login", "filepath":"Not Login"}] # user_res = [{"id":"Not Login", "username":"Not Login", "name":"Not Login", "isactive":"Not Login","email":"Not Login","last":"Not Login", "group":"Not Login", "filepath":"Not Login"}]
...@@ -619,10 +619,10 @@ class Dashboard(generic.TemplateView): ...@@ -619,10 +619,10 @@ class Dashboard(generic.TemplateView):
# 'terminal':terminal_result, # 'terminal':terminal_result,
# 'cagar_budaya':cagar_budaya_result, # 'cagar_budaya':cagar_budaya_result,
# 'gardu_listrik':gardu_listrik_result, # 'gardu_listrik':gardu_listrik_result,
'global':all[0], # 'global':all[0],
# 'res_all':res_all, # 'res_all':res_all,
'thisUser' : user_data, # 'thisUser' : user_data,
'perm_group' : perm_group # 'perm_group' : perm_group
# 'user_res':user_res # 'user_res':user_res
} }
return render (request, self.template_name, context) return render (request, self.template_name, context)
......
...@@ -2,7 +2,7 @@ var map = L.map('map', { editable: true, zoomControl: false, drawControl: true } ...@@ -2,7 +2,7 @@ var map = L.map('map', { editable: true, zoomControl: false, drawControl: true }
var pool = []; var pool = [];
// var BaseMap = document.getElementById("BaseMap"); var BaseMap = document.getElementById("BaseMap");
var OpenStreetMap = document.getElementById("OpenStreetMap"); var OpenStreetMap = document.getElementById("OpenStreetMap");
var WorldImagery = document.getElementById("WorldImagery"); var WorldImagery = document.getElementById("WorldImagery");
var BingSatellite = document.getElementById("BingSatellite"); var BingSatellite = document.getElementById("BingSatellite");
......
...@@ -5803,12 +5803,24 @@ ...@@ -5803,12 +5803,24 @@
// var map_cesium = new Cesium.Viewer('map-cesium'); // var map_cesium = new Cesium.Viewer('map-cesium');
function mapsganti() { //function mapsganti() {
// $.getScript('/static/Cesium-185/Build/Cesium/Cesium.js', function() { // $("#modalsearch3d").modal()
//}
// }); function mapsganti() {
// $.getScript('/static/Cesium-185/Build/Cesium/Cesium.js');
var checkBox_3d = document.getElementById("mapschange"); var checkBox_3d = document.getElementById("mapschange");
$('#scrcesium').append('<script id="scrheadcesium" src="/static/Cesium-185/Build/Cesium/Cesium.js"><\/script>');
var map_cesium = new Cesium.Viewer('map-cesium', {
imageryProvider: new Cesium.BingMapsImageryProvider({
url: '//dev.virtualearth.net',
key: 'Anj9XBZaRShAMdbXJlZ16iqEVpjikY1eY_dzqGl451WYkSKV3l_FJaFgMbhwdbLz',
mapStyle: Cesium.BingMapsStyle.AERIAL
//url : '//services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer',
//url : Cesium.buildModuleUrl('/static/Cesium-185/Build/Cesium/Assets/Textures/NaturalEarthII')
}),
baseLayerPicker: false,
geocoder: false
});
if (checkBox_3d.checked == true) { if (checkBox_3d.checked == true) {
$("#modalsearch3d").modal() $("#modalsearch3d").modal()
$.ajax({ $.ajax({
...@@ -5832,47 +5844,9 @@ ...@@ -5832,47 +5844,9 @@
} }
$("#search_desa").html(data_de); $("#search_desa").html(data_de);
checkBox_3d.checked = false; checkBox_3d.checked = false;
}
})
} else {
//location.reload();
$("#labelchange").html(`<img src="static/img/icon-1/Vector3d.svg" alt="" style="height: 50px;
width: 50px;">`)
map_cesium.entities.removeAll();
//map_cesium.destroy();
setTimeout(function() {
map.invalidateSize();
}, 1000);
$("#map").css('display', 'block');
$(".no3d").css('display', 'block');
$(".rar").css('display', 'block');
$("#map-cesium").css('display', 'none');
$(".tooltip-3d").html(`3D`)
//$(".filter3d").removeClass("d3filter");
}
}
//function mapsganti() {
// $("#modalsearch3d").modal()
//}
$("#search3D").click(function() { $("#search3D").click(function() {
// $.getScript('/static/Cesium-185/Build/Cesium/Cesium.js'); map_cesium.entities.removeAll();
var map_cesium = new Cesium.Viewer('map-cesium', { // $('head').append('<script src="/static/Cesium-185/Build/Cesium/Cesium.js"><\/script>');
imageryProvider: new Cesium.BingMapsImageryProvider({
url: '//dev.virtualearth.net',
key: 'Anj9XBZaRShAMdbXJlZ16iqEVpjikY1eY_dzqGl451WYkSKV3l_FJaFgMbhwdbLz',
mapStyle: Cesium.BingMapsStyle.AERIAL
//url : '//services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer',
//url : Cesium.buildModuleUrl('/static/Cesium-185/Build/Cesium/Assets/Textures/NaturalEarthII')
}),
baseLayerPicker: false,
geocoder: false
});
$("#map").css('display', 'none'); $("#map").css('display', 'none');
$("#map-cesium").css('display', 'block'); $("#map-cesium").css('display', 'block');
$(".no3d").css('display', 'none'); $(".no3d").css('display', 'none');
...@@ -5891,7 +5865,7 @@ ...@@ -5891,7 +5865,7 @@
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
document.getElementById("mapschange").checked = true; document.getElementById("mapschange").checked = true;
$("#modalsearch3d").modal("toggle") // $("#modalsearch3d").modal("toggle")
// console.log(data['polygon_o']) // console.log(data['polygon_o'])
// console.log(data['line_o']) // console.log(data['line_o'])
// console.log(data['kantor_administrasi']) // console.log(data['kantor_administrasi'])
...@@ -8289,6 +8263,27 @@ ...@@ -8289,6 +8263,27 @@
}); });
}
})
} else {
//location.reload();
$("#labelchange").html(`<img src="static/img/icon-1/Vector3d.svg" alt="" style="height: 50px;
width: 50px;">`)
map_cesium.entities.removeAll();
map_cesium.destroy();
// setTimeout(function() {
// map.invalidateSize();
// }, 1000);
$('#scrcesium').remove();
$("#map").css('display', 'block');
$(".no3d").css('display', 'block');
$(".rar").css('display', 'block');
$("#map-cesium").css('display', 'none');
$(".tooltip-3d").html(`3D`)
//$(".filter3d").removeClass("d3filter");
}
}
function load3dbang() { function load3dbang() {
$(".label-bangunan").css("display", "none"); $(".label-bangunan").css("display", "none");
} }
......
...@@ -859,6 +859,8 @@ ...@@ -859,6 +859,8 @@
var checkBox = document.getElementById("batas_desa"); var checkBox = document.getElementById("batas_desa");
if (checkBox.checked == true) { if (checkBox.checked == true) {
// loaderPage(true); // loaderPage(true);
$('#scrapex').append(`<script id="idscrapexmin" type="text/javascript " src="{% static 'js/apexcharts.min.js' %}"><\/script>`);
$('#scrapex').append(`<script id="idscrapex" type="text/javascript " src="{% static 'js/apexcharts.js' %}"><\/script>`);
if (map.hasLayer(geo_batas_kel)) { if (map.hasLayer(geo_batas_kel)) {
geo_batas_kel.clearLayers() geo_batas_kel.clearLayers()
geo_batas_kel.remove() geo_batas_kel.remove()
...@@ -884,6 +886,8 @@ ...@@ -884,6 +886,8 @@
}); });
geo_batas_kel.addTo(map) geo_batas_kel.addTo(map)
} else { } else {
$('#scrapex').remove();
$('#scrapex').remove();
geo_batas_kel.clearLayers() geo_batas_kel.clearLayers()
geo_batas_kel.remove() geo_batas_kel.remove()
} }
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script> <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<!-- <script src="https://cesium.com/downloads/cesiumjs/releases/1.78/Build/Cesium/Cesium.js"></script> --> <!-- <script src="https://cesium.com/downloads/cesiumjs/releases/1.78/Build/Cesium/Cesium.js"></script> -->
<script src="/static/Cesium-185/Build/Cesium/Cesium.js"></script> <!-- <script src="/static/Cesium-185/Build/Cesium/Cesium.js"></script> -->
<link href="{% static 'css/widgets.css' %}" rel="stylesheet"> <link href="{% static 'css/widgets.css' %}" rel="stylesheet">
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.css"> <link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.css">
...@@ -851,14 +851,16 @@ ...@@ -851,14 +851,16 @@
<script type="text/javascript" src="{% static 'js/plugins/pickers/daterangepicker.js' %}"></script> <script type="text/javascript" src="{% static 'js/plugins/pickers/daterangepicker.js' %}"></script>
<!-- <script type="text/javascript" src="{% static 'js/plugins/forms/styling/switch.min.js' %}"></script> --> <!-- <script type="text/javascript" src="{% static 'js/plugins/forms/styling/switch.min.js' %}"></script> -->
<!-- <script type="text/javascript" src="{% static 'js/pages/form_checkboxes_radios.js' %}"></script> --> <!-- <script type="text/javascript" src="{% static 'js/pages/form_checkboxes_radios.js' %}"></script> -->
<script type="text/javascript " src="{% static 'js/apexcharts.min.js' %}"></script> <!-- <script type="text/javascript " src="{% static 'js/apexcharts.min.js' %}"></script>
<script type="text/javascript " src="{% static 'js/apexcharts.js' %}"></script> <script type="text/javascript " src="{% static 'js/apexcharts.js' %}"></script> -->
<!-- <script type="text/javascript" src="{% static 'js/plugins/media/cropper.min.js' %}"></script> <!-- <script type="text/javascript" src="{% static 'js/plugins/media/cropper.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/pages/extension_image_cropper.js' %}"></script> --> <script type="text/javascript" src="{% static 'js/pages/extension_image_cropper.js' %}"></script> -->
<!-- /theme JS files --> <!-- /theme JS files -->
<div id ='scrapex'></div>
<div id ='scrcesium'></div>
<script src="{% static 'js/leaflet-bing-layer.js' %}"></script> <script src="{% static 'js/leaflet-bing-layer.js' %}"></script>
...@@ -866,13 +868,9 @@ ...@@ -866,13 +868,9 @@
<script src="{% static 'js/scripts.js' %}"></script> <script src="{% static 'js/scripts.js' %}"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script> <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
{% include 'includes/permission.html' %} {% include 'includes/js-o.html' %} {% include 'includes/js-m.html' %}
</body> <script type="text/javascript" src="{% static 'js/action.js' %}"></script>
<script>
</html>
{% include 'includes/permission.html' %} {% include 'includes/js-o.html' %} {% include 'includes/js-m.html' %}
<script type="text/javascript" src="{% static 'js/action.js' %}"></script>
<script>
// start disabled inspect // start disabled inspect
// document.addEventListener('contextmenu', function(e) { // document.addEventListener('contextmenu', function(e) {
...@@ -3023,7 +3021,15 @@ ...@@ -3023,7 +3021,15 @@
$('.leaflet-bottom.leaflet-right>.leaflet-control-attribution.leaflet-control').html(`Powered by <a href="https://khansia.co.id" target="_blank">Khansia</a> with <a href="https://leafletjs.com" target="_blank">Leaflet</a>`) $('.leaflet-bottom.leaflet-right>.leaflet-control-attribution.leaflet-control').html(`Powered by <a href="https://khansia.co.id" target="_blank">Khansia</a> with <a href="https://leafletjs.com" target="_blank">Leaflet</a>`)
$('.leaflet-bottom.leaflet-right>.leaflet-control-attribution.leaflet-control').css("right", "50px") $('.leaflet-bottom.leaflet-right>.leaflet-control-attribution.leaflet-control').css("right", "50px")
</script> </script>
{% if user.is_authenticated %} {% else %}
<script>
$(".tombol-edit").html('ilang')
</script>
{% endif %}
</body>
</html>
<!-- <script> <!-- <script>
$(function() { $(function() {
...@@ -3134,8 +3140,3 @@ ...@@ -3134,8 +3140,3 @@
} }
} }
</style> </style>
\ No newline at end of file
{% if user.is_authenticated %} {% else %}
<script>
$(".tombol-edit").html('ilang')
</script>
{% endif %}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment