Commit 7514bdf4 authored by Manggar Mahardhika's avatar Manggar Mahardhika

bug fix + history bangunan

parent 1fcdd69e
......@@ -7,7 +7,6 @@ from django.core.files.storage import FileSystemStorage
from django.core.files.base import ContentFile, File
import base64
import json
from PIL import Image
from django.contrib.auth.decorators import login_required, user_passes_test
from django.utils.decorators import method_decorator
......@@ -82,7 +81,46 @@ def building(request):
# kulon lor, wetan lor, wetan kidul, kulon kidul, kulon lor
with conn.cursor() as buldings:
buldings.execute("SELECT json_build_object('type', 'Feature', 'properties', (id, name, information), 'administrasi',(address_1, address_2, address_3, provinsi, alamat, luas_bangunan, luas_tanah, tinggi_bangunan, gambar, pemilik, db_tipe, remark, point_id, point_name), 'geometry', ST_AsGeoJSON(geom :: geometry) :: json) FROM geo_bangunan WHERE st_intersects(geom,'SRID=0;POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))')"% (kulon, lor, wetan, lor, wetan, kidul, kulon, kidul, kulon, lor))
buldings.execute("""SELECT
json_build_object (
'type',
'Feature',
'properties',
( gb.ID, gb.NAME, gb.information,
(
SELECT ARRAY_AGG
( '' || ID || ',' || tgl_perbaikan || ',' || jenis_perbaikan || '' ORDER BY tgl_perbaikan DESC )
FROM
tbl_perbaikan
WHERE
id_object = gb.ID
AND type_id = 1
)
),
'administrasi',
(
gb.address_1,
gb.address_2,
gb.address_3,
gb.provinsi,
gb.alamat,
gb.luas_bangunan,
gb.luas_tanah,
gb.tinggi_bangunan,
gb.gambar,
gb.pemilik,
gb.db_tipe,
gb.remark,
gb.point_id,
gb.point_name
),
'geometry',
ST_AsGeoJSON ( gb.geom :: geometry ) :: json
)
FROM
geo_bangunan gb
WHERE
st_intersects ( gb.geom, 'SRID=0;POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' )"""% (kulon, lor, wetan, lor, wetan, kidul, kulon, kidul, kulon, lor))
prov_res = buldings.fetchall()
polbang = []
......
......@@ -20,5 +20,6 @@ urlpatterns = [
path('get-jalan-perbaikan', views.getjalanperbaikan, name='get-jalan-perbaikan'),
path('get-detail-perbaikan', views.getdetailperbaikan, name='get-detail-perbaikan'),
path('get-detail-perbaikan-bang', views.getdetailperbaikanbangunan, name='get-detail-perbaikan-bang'),
]
\ No newline at end of file
......@@ -1042,6 +1042,60 @@ def getdetailperbaikan(request):
respon =res_all
return Response(respon)
@api_view(('GET',))
def getdetailperbaikanbangunan(request):
id_object = request.GET.get('id')
with conn.cursor() as data_per:
data_per.execute("""
SELECT
gl.NAME,
tp.name,
gj.remark,
tp.tgl_pembuatan,
tp.tgl_perbaikan,
tp.tgl_selesai,
tp.anggaran,
tp.pj,
tp.pj_lapangan,
tp.kontraktor,
ST_AsGeoJSON ( tp.geom :: geometry ) :: json,
tp.id_object,
tp.id,
tp.proposal,
tp.bukti_selesai,
tp.jenis_perbaikan
FROM
tbl_perbaikan tp
JOIN geo_label gl ON gl.ID = tp.type_id
JOIN geo_bangunan gj ON gj.ID = tp.id_object
where tp.id_object = %s
order by tp.tgl_perbaikan desc"""% id_object)
res_perbaikan = data_per.fetchall()
res_all = []
for j in res_perbaikan:
data_all = {
'name':j[1],
'type':j[2],
'tgl_pembuatan':j[3],
'tgl_perbaikan':j[4],
'tgl_selesai':j[5],
'anggaran':j[6],
'pj':j[7],
'pj_lapangan':j[8],
'kontraktor':j[9],
'geometry':j[10],
'id_object':j[11],
'id':j[12],
'proposal':j[13],
'bukti_selesai':j[14],
'jenis_perbaikan':j[15]
}
res_all.append(data_all)
respon = res_all
return Response(respon)
@api_view(('GET',))
def editkelurahan(request):
kode_dagri = request.GET.get('kode_dagri')
......
......@@ -223,6 +223,14 @@
display: none;
}
#btn_detail_per_bang {
display: none;
}
#btn_perbaikan_bangunan {
display: none;
}
.leaflet-popup{
display: none;
}
......
This diff is collapsed.
......@@ -47,6 +47,14 @@
.leaflet-popup {
display: block;
}
#btn_detail_per_bang {
display: block;
}
#btn_perbaikan_bangunan {
display: block;
}
</style>
{% elif group.name == 'Dinas Kependudukan dan Pencatatan Sipil' %}
<style>
......
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