Commit c3823ea7 authored by Muhamad's avatar Muhamad

manajemen perbaikan

parent 7d2550e5
......@@ -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
......@@ -4322,4 +4322,42 @@ def reload_point(request):
'kantor_administrasi':kantor_administrasi_result,
}
return (context)
\ No newline at end of file
@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()
# 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)
# 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
......
......@@ -1764,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
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