Commit 23cae4a3 authored by Manggar Mahardhika's avatar Manggar Mahardhika

Merge branch 'master' of http://git.khansia.co.id/Nahrowi/oku-gis

parents 12c741c6 e4f629e3
......@@ -98,6 +98,7 @@ urlpatterns = [
path('reloadpoint', views.reload_point, name='reloadpoint'),
path('download_perbaikan_data', views.download_perbaikan_data),
path('search_list_perbaikan', views.search_list_perbaikan)
path('search_list_perbaikan', views.search_list_perbaikan),
path('dataperbaikan', views.data_perbaikan),
]
\ No newline at end of file
......@@ -4323,3 +4323,41 @@ def reload_point(request):
}
return (context)
@api_view(('GET',))
def data_perbaikan(request):
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,
gdl.desa,
gdc.kecamatan
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 gdl on st_intersects(st_setsrid(gdl.geom, 4326), st_setsrid(tp.geom, 4326))
JOIN geo_data_kecamatan gdc ON st_intersects ( st_setsrid ( gdc.geom, 4326 ), st_setsrid ( tp.geom, 4326 ) )
""")
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],
'desa':j[7],
'kecamatan':j[8],
}
res_all.append(data_all)
return Response(res_all)
\ No newline at end of file
......@@ -467,40 +467,40 @@ class Dashboard(generic.TemplateView):
# for i in gardu_listrik_res:
# gardu_listrik_result.append(i[0])
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,
gdl.desa,
gdc.kecamatan
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 gdl on st_intersects(st_setsrid(gdl.geom, 4326), st_setsrid(tp.geom, 4326))
JOIN geo_data_kecamatan gdc ON st_intersects ( st_setsrid ( gdc.geom, 4326 ), st_setsrid ( tp.geom, 4326 ) )
""")
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],
'desa':j[7],
'kecamatan':j[8],
}
res_all.append(data_all)
# 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,
# gdl.desa,
# gdc.kecamatan
# 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 gdl on st_intersects(st_setsrid(gdl.geom, 4326), st_setsrid(tp.geom, 4326))
# JOIN geo_data_kecamatan gdc ON st_intersects ( st_setsrid ( gdc.geom, 4326 ), st_setsrid ( tp.geom, 4326 ) )
# """)
# 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],
# 'desa':j[7],
# 'kecamatan':j[8],
# }
# res_all.append(data_all)
perm_group = []
if request.user.is_authenticated:
......@@ -620,7 +620,7 @@ class Dashboard(generic.TemplateView):
# 'cagar_budaya':cagar_budaya_result,
# 'gardu_listrik':gardu_listrik_result,
'global':all[0],
'res_all':res_all,
# 'res_all':res_all,
'thisUser' : user_data,
'perm_group' : perm_group
# 'user_res':user_res
......
......@@ -470,10 +470,17 @@ def load_group_edit(request):
}
resgroup.append(datas)
print(datas)
group = Group.objects.get(name=datas['name'])
group_perm = []
for group_p in group.permissions.all():
g = str(group_p).split("| Can ")[1].replace(" ","_")
group_perm.append(g)
data = {
"info" : "success",
"code" : 0,
"data" : datas,
"perm_group":group_perm
}
return Response(data)
......
asgiref==3.4.0
autopep8==1.5.7
click==8.0.1
colorama==0.4.4
dj-database-url==0.5.0
Django==3.2.4
django-utils-six==2.0
django-widget-tweaks==1.4.8
djangorestframework==3.12.4
Flask==2.0.1
gunicorn==20.1.0
importlib-metadata==4.8.1
itsdangerous==2.0.1
Jinja2==3.0.1
MarkupSafe==2.0.1
Pillow==8.3.1
psycopg2==2.9.1
pycodestyle==2.7.0
python-decouple==3.4
pytz==2021.1
six==1.16.0
sqlparse==0.4.1
toml==0.10.2
typing==3.7.4.3
typing-extensions==3.10.0.0
Unipath==1.1
Werkzeug==2.0.1
whitenoise==5.2.0
zipp==3.5.0
......@@ -816,6 +816,7 @@ function loadgroupbyid(id) {
isObject.id = id;
$("#idgroup").val(id)
$("input[name='chekbox'][name='chekbox']").attr('checked', false)
$.ajax({
url: "/loadgroup/",
......@@ -831,10 +832,10 @@ function loadgroupbyid(id) {
let response = data;
if (response.code == 0) {
for (i in list_perm) {
console.log()
$("input[name='chekbox'][value=" + list_perm[i] + "]").prop('checked', 'checked')
for (i in data.perm_group) {
$("input[name='chekbox'][value=" + data.perm_group[i] + "]").prop('checked', 'checked')
}
var grup = response.data;
$("#ingroup").val(grup.name);
......@@ -1763,9 +1764,5 @@ $(".send_pesan").click(function() {
document.querySelector("#map-create-all > div.leaflet-control-container > div.leaflet-bottom.leaflet-right > div").html(`Powered by <a href="https://khansia.co.id" target="_blank">Khansia</a> with <a href="https://leafletjs.com" target="_blank">Leaflet</a>`)
document.querySelector("#map-create-all > div.leaflet-control-container > div.leaflet-bottom.leaflet-right > div").css("right", "50px")
\ No newline at end of file
......@@ -1094,14 +1094,6 @@
<div class="tab-pane" id="grouproleuser">
<table class="table table-responsive datatable-show-all table-sm list_group" id="list_group" style="font-size : 8pt;padding:0px;border-top:0.5pt solid #EFEFEF;border-bottom:0.5pt solid #EFEFEF;margin-bottom: 10px;">
<div style="position: absolute;right: 30px;font-size: 10pt;">
<a class="btn side-bar-but" id="download_perbaikan" onclick="download_user_list('xlsx')" style="z-index:9;">
<div>
<i class="icon-download4"></i><span>&nbsp;&nbsp;&nbsp;Download</span>
</div>
</a>
</div>
<div style="position: absolute;left: 292px;font-size: 10pt;background: #2196F3;border-radius: 10px;">
<a class="btn side-bar-but" id="add_group" style="z-index:9;color:white;">
<div>
......
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