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):
# @method_decorator(login_required(login_url='/login/'))
def get(self, request):
# print(Group.objects.get(user=request.user))
with conn.cursor() as all_:
all_.execute("SELECT * from global_oku")
all = all_.fetchall()
# with conn.cursor() as all_:
# all_.execute("SELECT * from global_oku")
# all = all_.fetchall()
# 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")
......@@ -502,105 +502,105 @@ class Dashboard(generic.TemplateView):
# }
# res_all.append(data_all)
perm_group = []
if request.user.is_authenticated:
current_user = request.user
thisUser = current_user.id
# perm_group = []
# if request.user.is_authenticated:
# current_user = request.user
# thisUser = current_user.id
for xx in request.user.get_group_permissions():
perm_group.append(xx.split(".")[1])
# for xx in request.user.get_group_permissions():
# perm_group.append(xx.split(".")[1])
if thisUser == None:
user_data = {"filepath":'placeholder.jpg'}
else:
# print()
sql = "select * from auth_user where id = "+str(thisUser)
with conn.cursor() as userprop:
userprop.execute(sql)
us = userprop.fetchall()
# if thisUser == None:
# user_data = {"filepath":'placeholder.jpg'}
# else:
# # print()
# sql = "select * from auth_user where id = "+str(thisUser)
# with conn.cursor() as userprop:
# userprop.execute(sql)
# us = userprop.fetchall()
user_data = []
for row in us:
datas = {
"id": row[0],
"username": row[4],
"firstname": row[5],
"lastname": row[6],
"email" : row[7],
"filepath": row[11],
# "password": row[1]
}
# user_data = []
# for row in us:
# datas = {
# "id": row[0],
# "username": row[4],
# "firstname": row[5],
# "lastname": row[6],
# "email" : row[7],
# "filepath": row[11],
# # "password": row[1]
# }
user_data.append(datas)
# user_data.append(datas)
with conn.cursor() as userlist_:
if request.user.is_superuser or request.user.is_staff:
# print("is superuser")
sql = """
SELECT
au.id,
au.username,
au.first_name,
au.last_name,
au.is_active,
au.last_login,
au.email,
ag.name,
au.is_staff,
au.is_superuser,
au.file_path
FROM
auth_user au,
auth_user_groups aug,
auth_group ag
WHERE
au.id = aug.user_id AND
ag.id = aug.group_id
ORDER BY
au.username ASC"""
else:
sql = """
SELECT
au.id,
au.username,
au.first_name,
au.last_name,
au.is_active,
au.last_login,
au.email,
ag.name,
au.is_staff,
au.is_superuser,
au.file_path
FROM
auth_user au,
auth_user_groups aug,
auth_group ag
WHERE
au.id = aug.user_id AND
ag.id = aug.group_id
ORDER BY
au.username ASC"""
userlist_.execute(sql)
allUser = userlist_.fetchall()
# with conn.cursor() as userlist_:
# if request.user.is_superuser or request.user.is_staff:
# # print("is superuser")
# sql = """
# SELECT
# au.id,
# au.username,
# au.first_name,
# au.last_name,
# au.is_active,
# au.last_login,
# au.email,
# ag.name,
# au.is_staff,
# au.is_superuser,
# au.file_path
# FROM
# auth_user au,
# auth_user_groups aug,
# auth_group ag
# WHERE
# au.id = aug.user_id AND
# ag.id = aug.group_id
# ORDER BY
# au.username ASC"""
# else:
# sql = """
# SELECT
# au.id,
# au.username,
# au.first_name,
# au.last_name,
# au.is_active,
# au.last_login,
# au.email,
# ag.name,
# au.is_staff,
# au.is_superuser,
# au.file_path
# FROM
# auth_user au,
# auth_user_groups aug,
# auth_group ag
# WHERE
# au.id = aug.user_id AND
# ag.id = aug.group_id
# ORDER BY
# au.username ASC"""
# userlist_.execute(sql)
# allUser = userlist_.fetchall()
user_res = []
for rows in allUser:
datas = {
"id": rows[0],
"username": rows[1],
"name": rows[2] +" "+ rows[3],
"email": rows[6],
"isactive": rows[4],
"last": rows[5],
"group": rows[7],
"filepath": rows[10]
}
user_res.append(datas)
# user_res = []
# for rows in allUser:
# datas = {
# "id": rows[0],
# "username": rows[1],
# "name": rows[2] +" "+ rows[3],
# "email": rows[6],
# "isactive": rows[4],
# "last": rows[5],
# "group": rows[7],
# "filepath": rows[10]
# }
# user_res.append(datas)
else:
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"}]
# else:
# 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"}]
......@@ -619,10 +619,10 @@ class Dashboard(generic.TemplateView):
# 'terminal':terminal_result,
# 'cagar_budaya':cagar_budaya_result,
# 'gardu_listrik':gardu_listrik_result,
'global':all[0],
# 'global':all[0],
# 'res_all':res_all,
'thisUser' : user_data,
'perm_group' : perm_group
# 'thisUser' : user_data,
# 'perm_group' : perm_group
# 'user_res':user_res
}
return render (request, self.template_name, context)
......
......@@ -2,7 +2,7 @@ var map = L.map('map', { editable: true, zoomControl: false, drawControl: true }
var pool = [];
// var BaseMap = document.getElementById("BaseMap");
var BaseMap = document.getElementById("BaseMap");
var OpenStreetMap = document.getElementById("OpenStreetMap");
var WorldImagery = document.getElementById("WorldImagery");
var BingSatellite = document.getElementById("BingSatellite");
......@@ -834,4 +834,4 @@ $("#id_kec").change(function() {
$(document).on('click', 'li', function() {
$('#provinsi').val($(this).text());
$('#provinsiList').fadeOut();
});
\ No newline at end of file
});
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -859,6 +859,8 @@
var checkBox = document.getElementById("batas_desa");
if (checkBox.checked == 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)) {
geo_batas_kel.clearLayers()
geo_batas_kel.remove()
......@@ -884,6 +886,8 @@
});
geo_batas_kel.addTo(map)
} else {
$('#scrapex').remove();
$('#scrapex').remove();
geo_batas_kel.clearLayers()
geo_batas_kel.remove()
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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