Commit 192d9c39 authored by Muhamad's avatar Muhamad

user setting

parent 3a79ac61
...@@ -63,6 +63,11 @@ urlpatterns = [ ...@@ -63,6 +63,11 @@ urlpatterns = [
path('edit-jalan-valid', views.editjalanvalid, name='edit-jalan-valid'), path('edit-jalan-valid', views.editjalanvalid, name='edit-jalan-valid'),
path('3d-maps', views.maps3d, name='3d-maps'), path('3d-maps', views.maps3d, name='3d-maps'),
path('deletejalan', views.deletejalan, name='hapus-jalan') path('deletejalan', views.deletejalan, name='hapus-jalan'),
path('filt_perbaikan_kecamatan', views.filt_perbaikan_kecamatan),
path('filt_perbaikan_desa', views.filt_perbaikan_desa),
path('user-data', views.user_data, name='user-data'),
] ]
\ No newline at end of file
...@@ -2770,3 +2770,213 @@ def createpoint(request): ...@@ -2770,3 +2770,213 @@ def createpoint(request):
respon={'data':data, 'info': info, 'status':status} respon={'data':data, 'info': info, 'status':status}
return Response(respon) return Response(respon)
@api_view(('GET',))
def filt_perbaikan_kecamatan(request):
id_kec = request.GET.get('id_kec')
with conn.cursor() as kel:
kel.execute("""SELECT ID,
desa
FROM
geo_data_kelurahan gd
WHERE
kecamatan = ( SELECT kecamatan FROM geo_data_kecamatan WHERE ID = %s )
"""% int(id_kec))
res_kel = kel.fetchall()
with conn.cursor() as data_per:
data_per.execute("""
SELECT
gl.NAME,
tp.id_object,
tp.NAME,
tp.TYPE,
tp.tgl_perbaikan,
tp.anggaran,
tp.tgl_selesai
FROM
( SELECT tbl_perbaikan.*, ROW_NUMBER ( ) OVER ( PARTITION BY id_object ORDER BY tgl_selesai DESC ) AS rn FROM tbl_perbaikan ) tp
JOIN geo_label gl ON gl.ID = tp.type_id
JOIN geo_data_kecamatan gdk on st_intersects(st_setsrid(gdk.geom, 4326), st_setsrid(tp.geom, 4326))
WHERE
rn = 1 and gdk.ID = %s
LIMIT 10
"""% int(id_kec))
res_perbaikan = data_per.fetchall()
res_all = []
for j in res_perbaikan:
data_all = {
'name_perbaikan':j[0],
'id_object':j[1],
'name':j[2],
'type':j[3],
'tgl_perbaikan':j[4],
'anggaran':j[5],
'tgl_selesai':j[6],
}
res_all.append(data_all)
respon = {'res_kel':res_kel,'res_perbaikan':res_all}
return Response(respon)
@api_view(('GET',))
def filt_perbaikan_desa(request):
id_desa = request.GET.get('id_desa')
with conn.cursor() as data_per:
data_per.execute("""
SELECT
gl.NAME,
tp.id_object,
tp.NAME,
tp.TYPE,
tp.tgl_perbaikan,
tp.anggaran,
tp.tgl_selesai
FROM
( SELECT tbl_perbaikan.*, ROW_NUMBER ( ) OVER ( PARTITION BY id_object ORDER BY tgl_selesai DESC ) AS rn FROM tbl_perbaikan ) tp
JOIN geo_label gl ON gl.ID = tp.type_id
JOIN geo_data_kelurahan gdk on st_intersects(st_setsrid(gdk.geom, 4326), st_setsrid(tp.geom, 4326))
WHERE
rn = 1 and gdk.ID = %s
"""% int(id_desa))
res_perbaikan = data_per.fetchall()
res_all = []
for j in res_perbaikan:
data_all = {
'name_perbaikan':j[0],
'id_object':j[1],
'name':j[2],
'type':j[3],
'tgl_perbaikan':j[4],
'anggaran':j[5],
'tgl_selesai':j[6],
}
res_all.append(data_all)
respon = {'res_perbaikan':res_all}
return Response(respon)
@api_view(('GET',))
def user_data(request):
with conn.cursor() as userlist_:
if request.user.is_superuser:
# 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:
if request.user.is_staff:
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 AND
ag.id IN("""+ars+")"
else:
print('not staff')
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)
current_user = request.user
thisUser = current_user.id
# 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.append(datas)
with conn.cursor() as po:
po.execute("select id, namobj, alamat, luas_bangunan, perangkat from geo_kantor_administrasi")
poi = po.fetchall()
point = []
for p in poi:
datap = {
"id":p[0],
"nama_tempat":p[1],
"alamat":p[2],
"luas":p[3],
"pj":p[4]
}
point.append(datap)
respon = {
'data' : user_res,
'thisUser' : user_data,
'point':point
}
return Response(respon)
\ No newline at end of file
...@@ -63,7 +63,16 @@ class Dashboard(generic.TemplateView): ...@@ -63,7 +63,16 @@ class Dashboard(generic.TemplateView):
b.kabupaten, b.kabupaten,
c.kecamatan, c.kecamatan,
d.desa, d.desa,
a.id a.id,
(
SELECT ARRAY_AGG
( '' || ID || ',' || tgl_perbaikan || ',' || jenis_perbaikan || '' ORDER BY tgl_perbaikan DESC )
FROM
tbl_perbaikan
WHERE
id_object = A.ID
AND type_id = 1
)
), ),
'geometry', 'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json ST_AsGeoJSON ( A.geom :: geometry ) :: json
...@@ -78,6 +87,8 @@ class Dashboard(generic.TemplateView): ...@@ -78,6 +87,8 @@ class Dashboard(generic.TemplateView):
kantor_administrasi_result = [] kantor_administrasi_result = []
for i in kantor_administrasi_res: for i in kantor_administrasi_res:
if i[0]['administrasi']['f16'] == None:
i[0]['administrasi']['f16'] = "None"
kantor_administrasi_result.append(i[0]) kantor_administrasi_result.append(i[0])
with conn.cursor() as layanan_kesehatan: with conn.cursor() as layanan_kesehatan:
...@@ -519,6 +530,73 @@ class Dashboard(generic.TemplateView): ...@@ -519,6 +530,73 @@ class Dashboard(generic.TemplateView):
user_data.append(datas) user_data.append(datas)
with conn.cursor() as userlist_:
if request.user.is_superuser:
# 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:
if request.user.is_staff:
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 AND
ORDER BY
au.username ASC"""
else:
print('not staff')
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)
context = { context = {
'title':'Dashboard', 'title':'Dashboard',
...@@ -537,7 +615,8 @@ class Dashboard(generic.TemplateView): ...@@ -537,7 +615,8 @@ class Dashboard(generic.TemplateView):
'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,
'user_res':user_res
} }
return render (request, self.template_name, context) return render (request, self.template_name, context)
......
...@@ -234,6 +234,29 @@ body>div.page-container>div>div.sidebar.sidebar-main>div>img { ...@@ -234,6 +234,29 @@ body>div.page-container>div>div.sidebar.sidebar-main>div>img {
font-family: 'gilroylight'; font-family: 'gilroylight';
} }
#map-edit>div.leaflet-control-container>div.leaflet-top.leaflet-left>div>div>div {
display: none;
}
#map-for-edit>div.leaflet-control-container>div.leaflet-top.leaflet-left>div>div>div {
display: none;
}
#map-for-delete>div.leaflet-control-container>div.leaflet-top.leaflet-left>div>div>div {
display: none;
}
/* #user_profile>div>div>div>div>div.col-md-3>div>div.text-left>div>.active {
border: 1pt solid #4C97DC;
color: #4C97DC;
} */
.tab-user.active {
border: 1pt solid #4C97DC;
color: #4C97DC;
}
@media (max-width: 1025px) { @media (max-width: 1025px) {
.dock { .dock {
position: absolute; position: absolute;
......
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="8" cy="8" r="8" fill="#D5A266"/>
<path d="M7.53125 10.8125C9.34343 10.8125 10.8125 9.34343 10.8125 7.53125C10.8125 5.71907 9.34343 4.25 7.53125 4.25C5.71907 4.25 4.25 5.71907 4.25 7.53125C4.25 9.34343 5.71907 10.8125 7.53125 10.8125Z" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M9.85107 9.85156L11.7495 11.75" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="8" cy="8" r="8" fill="url(#paint0_linear)"/>
<path d="M6.75 11.4375H4.875C4.79212 11.4375 4.71263 11.4045 4.65403 11.3459C4.59542 11.2873 4.5625 11.2078 4.5625 11.125V9.3794C4.5625 9.33836 4.57058 9.29772 4.58629 9.25981C4.60199 9.22189 4.62501 9.18744 4.65403 9.15842L9.34153 4.47092C9.40014 4.41232 9.47962 4.37939 9.5625 4.37939C9.64538 4.37939 9.72487 4.41232 9.78347 4.47092L11.529 6.21648C11.5876 6.27509 11.6206 6.35457 11.6206 6.43745C11.6206 6.52033 11.5876 6.59982 11.529 6.65842L6.75 11.4375Z" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M8.3125 5.5L10.5 7.6875" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11.4375 11.4375H6.75" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
<defs>
<linearGradient id="paint0_linear" x1="8" y1="-15" x2="28.9097" y2="18.3913" gradientUnits="userSpaceOnUse">
<stop stop-color="#4C97DC"/>
<stop offset="1" stop-color="#4969DA"/>
</linearGradient>
</defs>
</svg>
<svg width="29" height="29" viewBox="0 0 29 29" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="29" height="29" viewBox="0 0 29 29" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14.0755 25.1478C19.9057 25.1478 24.6319 20.4215 24.6319 14.5914C24.6319 8.7612 19.9057 4.03491 14.0755 4.03491C8.24533 4.03491 3.51904 8.7612 3.51904 14.5914C3.51904 20.4215 8.24533 25.1478 14.0755 25.1478Z" stroke="url(#paint0_linear)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> <path d="M14.0755 25.1478C19.9057 25.1478 24.6319 20.4215 24.6319 14.5914C24.6319 8.7612 19.9057 4.03491 14.0755 4.03491C8.24533 4.03491 3.51904 8.7612 3.51904 14.5914C3.51904 20.4215 8.24533 25.1478 14.0755 25.1478Z" stroke="#343539" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M14.0753 18.1103C16.5045 18.1103 18.4738 16.141 18.4738 13.7118C18.4738 11.2825 16.5045 9.31323 14.0753 9.31323C11.646 9.31323 9.67676 11.2825 9.67676 13.7118C9.67676 16.141 11.646 18.1103 14.0753 18.1103Z" stroke="url(#paint1_linear)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> <path d="M14.0753 18.1103C16.5045 18.1103 18.4738 16.141 18.4738 13.7118C18.4738 11.2825 16.5045 9.31323 14.0753 9.31323C11.646 9.31323 9.67676 11.2825 9.67676 13.7118C9.67676 16.141 11.646 18.1103 14.0753 18.1103Z" stroke="#343539" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M7.01562 22.4399C7.67827 21.1371 8.68852 20.043 9.93452 19.2789C11.1805 18.5147 12.6137 18.1102 14.0753 18.1102C15.537 18.1102 16.9702 18.5147 18.2162 19.2789C19.4622 20.043 20.4724 21.1371 21.1351 22.4399" stroke="url(#paint2_linear)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> <path d="M7.01562 22.4398C7.67827 21.137 8.68852 20.0429 9.93452 19.2787C11.1805 18.5146 12.6137 18.1101 14.0753 18.1101C15.537 18.1101 16.9702 18.5146 18.2162 19.2787C19.4622 20.0429 20.4724 21.1369 21.1351 22.4398" stroke="#343539" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<defs>
<linearGradient id="paint0_linear" x1="14.0755" y1="-15.7584" x2="41.667" y2="28.3032" gradientUnits="userSpaceOnUse">
<stop stop-color="#4C97DC"/>
<stop offset="1" stop-color="#4969DA"/>
</linearGradient>
<linearGradient id="paint1_linear" x1="14.0753" y1="1.066" x2="25.5717" y2="19.425" gradientUnits="userSpaceOnUse">
<stop stop-color="#4C97DC"/>
<stop offset="1" stop-color="#4969DA"/>
</linearGradient>
<linearGradient id="paint2_linear" x1="14.0753" y1="14.0511" x2="16.4049" y2="26.1829" gradientUnits="userSpaceOnUse">
<stop stop-color="#4C97DC"/>
<stop offset="1" stop-color="#4969DA"/>
</linearGradient>
</defs>
</svg> </svg>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<i class="icon-pie-chart5"></i> <i class="icon-pie-chart5"></i>
</a> </a>
</li> </li>
<li style="margin-top: 400px;position: absolute;"> <li style="margin-top: 60vh;position: absolute;">
<a href="#" id="btn-hide-all" class="side-bar-but" style="position: absolute;margin-top: 20px;"> <a href="#" id="btn-hide-all" class="side-bar-but" style="position: absolute;margin-top: 20px;">
<i class="icon-arrow-right13"></i> <i class="icon-arrow-right13"></i>
</a> </a>
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</div> </div>
</div> </div>
<div id="panel-sm" class="sidebar-2" style="display:none;background: #1B1F2D;position: absolute;z-index: 9;width: 23%;height:100vh;left: 0%;transition: all 0.5s ease;"> <div id="panel-sm" class="sidebar-2" style="display:none;background: #1B1F2D;position: absolute;z-index: 9;width:330px;height:100vh;left: 0%;transition: all 0.5s ease;">
<div style="margin-left: 50px;background: #1B1F2D;"> <div style="margin-left: 50px;background: #1B1F2D;">
<div class="header" style="margin-top: 25px;background: #2F3445;"> <div class="header" style="margin-top: 25px;background: #2F3445;">
...@@ -426,7 +426,7 @@ ...@@ -426,7 +426,7 @@
<div class="panel panel-flat " id="perbaikan-dashboard " style="background: #181B27;position: absolute;z-index: 9;width: 77%;height:100vh;left: 23%;transition: all 0.5s ease;color: white; border: none; "> <div class="panel panel-flat " id="perbaikan-dashboard " style="background: #181B27;position: absolute;z-index: 9;width: 77%;height:100vh;left: 23%;transition: all 0.5s ease;color: white; border: none; ">
<div class="panel-body " style="padding:14px 0px;"> <div class="panel-body " style="padding:14px 0px;">
<table class="table table-responsive datatable-show-all table-sm bg-slate-610" id="list_perbaikan" style="font-size : 8pt;padding:0px;border-top:0.5pt solid #343434;border-bottom:0.5pt solid #343434;margin-bottom: 10px;"> <table class="table table-responsive datatable-show-all table-sm bg-slate-610 list_perb" id="list_perbaikan" style="font-size : 8pt;padding:0px;border-top:0.5pt solid #343434;border-bottom:0.5pt solid #343434;margin-bottom: 10px;">
<div style="position: absolute;right: 30px;font-size: 10pt;"> <div style="position: absolute;right: 30px;font-size: 10pt;">
<a class="btn side-bar-but" id="download_perbaikan" onclick="download_all('xlsx')" style="color: white;z-index:9;"> <a class="btn side-bar-but" id="download_perbaikan" onclick="download_all('xlsx')" style="color: white;z-index:9;">
<div> <div>
...@@ -668,6 +668,7 @@ ...@@ -668,6 +668,7 @@
<script> <script>
$("#sel-kec ").change(function() { $("#sel-kec ").change(function() {
var id_kec = $(this).val() var id_kec = $(this).val()
$.ajax({ $.ajax({
...@@ -726,8 +727,7 @@ ...@@ -726,8 +727,7 @@
data_perbaikan.push(data_gab) data_perbaikan.push(data_gab)
}; };
$("#tbody_perbaikan ").html(data_perbaikan) $("#tbody_perbaikan").html(data_perbaikan)
} }
}); });
......
This diff is collapsed.
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