Commit 1dc705f3 authored by Manggar Mahardhika's avatar Manggar Mahardhika

push

parent 88ae78e8
......@@ -47,6 +47,7 @@ urlpatterns = [
path('hapus', views.hapus, name='hapus'),
path('dkantor', views.deletekantoradmin, name='dkantor'),
path('change-tipe', views.changetipe, name='change-tipe'),
path('c_bangunan', views.createbang, name='c_bangunan'),
path('create-jalan', views.createjalan, name='create-jalan'),
......
......@@ -104,7 +104,7 @@ def jalan(request):
print(kulon, lor, wetan, lor, wetan, kidul, kulon, kidul, kulon, lor, kulon, lor, wetan, lor, wetan, kidul, kulon, kidul, kulon, lor)
with conn.cursor() as jalan:
jalan.execute("SELECT json_build_object ('type', 'Feature', 'properties', ( gj.ID, gj.namrjl, st_length ( gj.geom :: geography ), gj.lebar_jalan, gj.remark, gj.gambar,(SELECT ARRAY_AGG ( '' || id || ',' || tgl_perbaikan || '' order by tgl_perbaikan DESC ) FROM tbl_perbaikan WHERE id_object = gj.ID and type_id = 2) ), 'geometry', ST_AsGeoJSON ( st_intersection(gj.geom, 'SRID=4326;POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))') :: geometry ) :: json ) FROM geo_jalan gj WHERE st_intersects(gj.geom,'SRID=4326;POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))') GROUP BY gj.id"% (kulon, lor, wetan, lor, wetan, kidul, kulon, kidul, kulon, lor, kulon, lor, wetan, lor, wetan, kidul, kulon, kidul, kulon, lor))
jalan.execute("SELECT json_build_object ('type', 'Feature', 'properties', ( gj.ID, namrjl, st_length ( gj.geom :: geography ), gj.lebar_jalan, gj.remark, gj.gambar,(SELECT ARRAY_AGG ( '' || id || ',' || tgl_perbaikan || '' order by tgl_perbaikan DESC ) FROM tbl_perbaikan WHERE id_object = gj.ID and type_id = 2) ), 'geometry', ST_AsGeoJSON ( st_intersection(gj.geom, 'SRID=4326;POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))') :: geometry ) :: json ) FROM geo_jalan gj WHERE st_intersects(gj.geom,'SRID=4326;POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))') GROUP BY gj.id"% (kulon, lor, wetan, lor, wetan, kidul, kulon, kidul, kulon, lor, kulon, lor, wetan, lor, wetan, kidul, kulon, kidul, kulon, lor))
prov_res = jalan.fetchall()
data = {'gen':prov_res}
......@@ -660,6 +660,11 @@ def validatedit(request):
pro_b = request.POST.get("pro_b")
gmb_b = request.POST.get("gambar")
luast_b = request.POST.get("luastanah_b")
luasb_b = request.POST.get("luasbangunan_b")
tinggi_b = request.POST.get("tinggibangunan_b")
pemilik_b = request.POST.get("pemilik_b")
id_poly = request.POST.get("id_poly")
polygon = request.POST.get("polygon")
print(polygon)
......@@ -683,7 +688,7 @@ def validatedit(request):
print(co_edit,name_b, info_b, desa_b, kec_b, kab_b, pro_b, namafile, int(id_poly))
with conn.cursor() as buldings:
buldings.execute("""UPDATE geo_bangunan set geom = st_geomfromgeojson('{"type":"MultiPolygon", "coordinates":[%s]}'),name='%s',information='%s',address_1='%s', address_2 = '%s', address_3 = '%s', provinsi='%s', gambar = '%s', is_deleted = 0 WHERE id = %s"""% (co_edit,name_b, info_b, desa_b, kec_b, kab_b, pro_b, namafile, int(id_poly)))
buldings.execute("""UPDATE geo_bangunan set geom = st_geomfromgeojson('{"type":"MultiPolygon", "coordinates":[%s]}'),name='%s',information='%s',address_1='%s', address_2 = '%s', address_3 = '%s', provinsi='%s', gambar = '%s', is_deleted = 0, luas_bangunan=%s, luas_tanah=%s, tinggi_bangunan=%s, pemilik='%s' WHERE id = %s"""% (co_edit,name_b, info_b, desa_b, kec_b, kab_b, pro_b, namafile, luasb_b, luast_b, tinggi_b, pemilik_b, int(id_poly)))
conn.commit()
data = 'SUCCESS'
......@@ -1508,16 +1513,76 @@ def createbang(request):
name = request.GET.get('name')
info = request.GET.get('info')
alamat = request.GET.get('alamat')
atalam = request.GET.get('alamat')
lb = request.GET.get('lb')
lt = request.GET.get('lt')
tb = request.GET.get('tb')
pemilik = request.GET.get('pemilik')
tibang = request.GET.get('tb')
ltbang = request.GET.get('ltb')
kilimep = request.GET.get('pemilik')
namafile = "None"
latlng = po_create.split("],[")[0]
print(p_create)
print(latlng)
if name == "":
name = "None"
else:
name = name
if info == "":
info = "None"
else:
info = info
if lb == "":
lb = 0
else:
lb = lb
if lt == "":
lt = 0
else:
lt = lt
if atalam == "":
alamat = "None"
else:
alamat = atalam
print(alamat)
try:
if tibang == "" and ltbang != "":
tb = ltbang*3
elif tibang == "" and ltbang == "":
tb = 0
ltb = 0
else:
tb = tibang
except:
tb = 0
print(tb)
try:
if ltbang == "" and tibang != "":
ltb = int(int(tibang)/3)
elif tibang == "" and ltbang == "":
tb = 0
ltb = 0
else:
ltb = ltbang
except:
ltb = 0
print(ltb)
if kilimep == "":
pemilik = "unnamed"
else:
pemilik = kilimep
print(pemilik)
# try:
with conn.cursor() as kel:
kel.execute("SELECT desa, kecamatan, kab_kota, provinsi FROM geo_data_kelurahan WHERE st_intersects(geom, 'SRID=4326;POINT(%s)'::geometry)"% latlng)
adm = kel.fetchall()
......@@ -1525,21 +1590,22 @@ def createbang(request):
administrasi = adm[0]
with conn.cursor() as buldings:
buldings.execute("""INSERT INTO geo_bangunan(geom, name, information, sumber, alamat, address_1, address_2, address_3, provinsi, no, luas_bangunan, luas_tanah, tinggi_bangunan, gambar, pemilik) VALUES (ST_GeomFromEWKT('SRID=0;MULTIPOLYGON(((%s)))'), '%s', '%s', 'new', '%s', '%s', '%s', '%s', '%s', '0', '%s', '%s', '%s', '%s', '%s')"""% (p_create, name, info, alamat, administrasi[0], administrasi[1], administrasi[2], administrasi[3], lb, lt, tb, namafile, pemilik ))
buldings.execute("""INSERT INTO geo_bangunan(geom, name, information, sumber, alamat, address_1, address_2, address_3, provinsi, no, luas_bangunan, luas_tanah, tinggi_bangunan, lantai, gambar, pemilik) VALUES (ST_GeomFromEWKT('SRID=0;MULTIPOLYGON(((%s)))'), '%s', '%s', 'new', '%s', '%s', '%s', '%s', '%s', '0', '%s', '%s', '%s', '%s', '%s', '%s')"""% (p_create, name, info, alamat, administrasi[0], administrasi[1], administrasi[2], administrasi[3], lb, lt, tb, ltb, namafile, pemilik ))
conn.commit()
data = {'status':'Success'}
data = 'SUCCESS'
info = 'data telah diperbaharui'
status = 0
except:
data = 'Sorry'
info = 'Dalam Perbaikan'
status = 1
# except:
# data = 'Sorry'
# info = 'Dalam Perbaikan'
# status = 1
respon={'data':data, 'info': info, 'status':status}
return Response(respon)
import re
@api_view(('POST',))
def createjalan(request):
polyline = request.POST.get('polyline')
......@@ -1549,6 +1615,10 @@ def createjalan(request):
tipe_jalan = request.POST.get('tipe_jalan')
img_jalan = request.FILES.get('gambar')
panjang_jalan = re.sub('[^0-9.]+', '', str(panjang_jalan))
if lebar_jalan == '':
lebar_jalan = 0
print(panjang_jalan)
coord = json.loads(str(polyline))
print(coord)
......@@ -1590,7 +1660,7 @@ def createjalan(request):
try:
with conn.cursor() as jalan:
jalan.execute("""INSERT INTO geo_jalan(geom, namrjl, panjang_jalan, lebar_jalan, remark, gambar) VALUES (ST_GeomFromEWKT('SRID=4326;%s'), '%s',%s,%s,'%s','%s')"""% (coordinat, name_jalan, panjang_jalan, lebar_jalan, tipe_jalan, ngambar))
jalan.execute("""INSERT INTO geo_jalan(geom, namrjl, panjang_jalan, lebar_jalan, remark, gambar) VALUES (ST_GeomFromEWKT('SRID=4326;%s'), '%s', %s, %s,'%s','%s')"""% (coordinat, name_jalan, panjang_jalan, lebar_jalan, tipe_jalan, ngambar))
conn.commit()
data = 'SUCCESS'
......@@ -1604,6 +1674,67 @@ def createjalan(request):
respon={'data':data, 'info': info, 'status':status}
return Response(respon)
@api_view(('GET',))
def changetipe(request):
tipe_point = request.GET.get('tipe')
if tipe_point == 'administrasi':
with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_kantor_administrasi""")
tipepoint = point.fetchall()
if tipe_point == 'layanankesehatan':
with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_layanan_kesehatan""")
tipepoint = point.fetchall()
if tipe_point == 'puskesmas':
with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_puskesmas""")
tipepoint = point.fetchall()
if tipe_point == 'rumahsakit':
with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_rumah_sakit""")
tipepoint = point.fetchall()
if tipe_point == 'saranaibadah':
with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_sarana_ibadah""")
tipepoint = point.fetchall()
if tipe_point == 'saranapendidikan':
with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_sarana_pendidikan""")
tipepoint = point.fetchall()
if tipe_point == 'cagarbudaya':
with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_cagar_budaya""")
tipepoint = point.fetchall()
if tipe_point == 'spbu':
with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_spbu""")
tipepoint = point.fetchall()
if tipe_point == 'stasiun':
with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_stasiun""")
tipepoint = point.fetchall()
if tipe_point == 'terminalbus':
with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_terminal_bus""")
tipepoint = point.fetchall()
if tipe_point == 'gardulistrik':
with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_gardu_listrik""")
tipepoint = point.fetchall()
print(tipepoint)
respon = {'result':tipepoint}
return Response(respon)
@api_view(('POST',))
def createpoint(request):
......@@ -1639,39 +1770,58 @@ def createpoint(request):
try:
if tipe_point == 'administrasi':
with conn.cursor() as point:
point.execute("""INSERT INTO geo_kantor_administrasi(geom, namobj, remark, luas_bangunan, luas_tanah, tinggi_bangunan, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, %s, %s, '%s', '%s', 5,'%s')"""% (coordinat, name_create_point, info_create_point, luas_bangunan_point, luas_tanah_point, tinggi_bangunan_point, alamat_create_point, pemilik_point, ngambar))
point.execute("""INSERT INTO geo_kantor_administrasi(geom, namobj, remark, luas_tanah, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, '%s', '%s', 5,'%s')"""% (coordinat, name_create_point, info_create_point, luas_tanah_point, alamat_create_point, pemilik_point, ngambar))
conn.commit()
if tipe_point == 'layanankesehatan':
with conn.cursor() as point:
point.execute("""INSERT INTO geo_layanan_kesehatan(geom, namobj, remark, luas_bangunan, luas_tanah, tinggi_bangunan, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, %s, %s, '%s', '%s', 6,'%s')"""% (coordinat, name_create_point, info_create_point, luas_bangunan_point, luas_tanah_point, tinggi_bangunan_point, alamat_create_point, pemilik_point, ngambar))
point.execute("""INSERT INTO geo_layanan_kesehatan(geom, namobj, remark, luas_tanah, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, '%s', '%s', 6,'%s')"""% (coordinat, name_create_point, info_create_point, luas_tanah_point, alamat_create_point, pemilik_point, ngambar))
conn.commit()
if tipe_point == 'puskesmas':
with conn.cursor() as point:
point.execute("""INSERT INTO geo_puskesmas(geom, namobj, remark, luas_bangunan, luas_tanah, tinggi_bangunan, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, %s, %s, '%s', '%s', 7,'%s')"""% (coordinat, name_create_point, info_create_point, luas_bangunan_point, luas_tanah_point, tinggi_bangunan_point, alamat_create_point, pemilik_point, ngambar))
point.execute("""INSERT INTO geo_puskesmas(geom, namobj, remark, luas_tanah, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, '%s', '%s', 7,'%s')"""% (coordinat, name_create_point, info_create_point, luas_tanah_point, alamat_create_point, pemilik_point, ngambar))
conn.commit()
if tipe_point == 'rumahsakit':
with conn.cursor() as point:
point.execute("""INSERT INTO geo_rumah_sakit(geom, namobj, remark, luas_bangunan, luas_tanah, tinggi_bangunan, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, %s, %s, '%s', '%s', 8,'%s')"""% (coordinat, name_create_point, info_create_point, luas_bangunan_point, luas_tanah_point, tinggi_bangunan_point, alamat_create_point, pemilik_point, ngambar))
point.execute("""INSERT INTO geo_rumah_sakit(geom, namobj, remark, luas_tanah, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, '%s', '%s', 8,'%s')"""% (coordinat, name_create_point, info_create_point, luas_tanah_point, alamat_create_point, pemilik_point, ngambar))
conn.commit()
if tipe_point == 'saranaibadah':
with conn.cursor() as point:
point.execute("""INSERT INTO geo_sarana_ibadah(geom, namobj, remark, luas_bangunan, luas_tanah, tinggi_bangunan, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, %s, %s, '%s', '%s', 9,'%s')"""% (coordinat, name_create_point, info_create_point, luas_bangunan_point, luas_tanah_point, tinggi_bangunan_point, alamat_create_point, pemilik_point, ngambar))
point.execute("""INSERT INTO geo_sarana_ibadah(geom, namobj, remark, luas_tanah, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, '%s', '%s', 9,'%s')"""% (coordinat, name_create_point, info_create_point, luas_tanah_point, alamat_create_point, pemilik_point, ngambar))
conn.commit()
if tipe_point == 'saranapendidikan':
with conn.cursor() as point:
point.execute("""INSERT INTO geo_sarana_pendidikan(geom, namobj, remark, luas_bangunan, luas_tanah, tinggi_bangunan, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, %s, %s, '%s', '%s', 10,'%s')"""% (coordinat, name_create_point, info_create_point, luas_bangunan_point, luas_tanah_point, tinggi_bangunan_point, alamat_create_point, pemilik_point, ngambar))
point.execute("""INSERT INTO geo_sarana_pendidikan(geom, namobj, remark, luas_tanah, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, '%s', '%s', 10,'%s')"""% (coordinat, name_create_point, info_create_point, luas_tanah_point, alamat_create_point, pemilik_point, ngambar))
conn.commit()
if tipe_point == 'cagarbudaya':
with conn.cursor() as point:
point.execute("""INSERT INTO geo_cagar_budaya(geom, namobj, remark, luas_bangunan, luas_tanah, tinggi_bangunan, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, %s, %s, '%s', '%s', 3,'%s')"""% (coordinat, name_create_point, info_create_point, luas_bangunan_point, luas_tanah_point, tinggi_bangunan_point, alamat_create_point, pemilik_point, ngambar))
point.execute("""INSERT INTO geo_cagar_budaya(geom, namobj, remark, luas_tanah, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, '%s', '%s', 3,'%s')"""% (coordinat, name_create_point, info_create_point, luas_tanah_point, alamat_create_point, pemilik_point, ngambar))
conn.commit()
if tipe_point == 'spbu':
with conn.cursor() as point:
point.execute("""INSERT INTO geo_spbu(geom, namobj, remark, luas_tanah, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, '%s', '%s', 3,'%s')"""% (coordinat, name_create_point, info_create_point, luas_tanah_point, alamat_create_point, pemilik_point, ngambar))
conn.commit()
if tipe_point == 'stasiun':
with conn.cursor() as point:
point.execute("""INSERT INTO geo_stasiun(geom, namobj, remark, luas_tanah, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, '%s', '%s', 3,'%s')"""% (coordinat, name_create_point, info_create_point, luas_tanah_point, alamat_create_point, pemilik_point, ngambar))
conn.commit()
if tipe_point == 'terminalbus':
with conn.cursor() as point:
point.execute("""INSERT INTO geo_terminal_bus(geom, namobj, remark, luas_tanah, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, '%s', '%s', 3,'%s')"""% (coordinat, name_create_point, info_create_point, luas_tanah_point, alamat_create_point, pemilik_point, ngambar))
conn.commit()
if tipe_point == 'gardulistrik':
with conn.cursor() as point:
point.execute("""INSERT INTO geo_gardu_listrik(geom, namobj, remark, luas_tanah, alamat, perangkat, type_id, gambar) VALUES (st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), '%s','%s', %s, '%s', '%s', 3,'%s')"""% (coordinat, name_create_point, info_create_point, luas_tanah_point, alamat_create_point, pemilik_point, ngambar))
conn.commit()
data = 'SUCCESS'
info = 'data telah diperbaharui'
......
......@@ -13,6 +13,7 @@ urlpatterns = [
path('perbaikan', views.perbaikanrenovasi, name='perbaikan'),
path('loadDetail', views.loadDetail, name='loadDetail'),
path('input-perbaikan', views.inpuperbaikan, name='input-perbaikan'),
path('input-perbaikan-bang', views.inputperbaikanbangunan, name='input-perbaikan-bang'),
path('save-perbaikan', views.saveperbaikan, name='save-perbaikan'),
path('load-jl-by-id-detail', views.loadbyiddetail, name='load-jl-by-id-detail'),
......
......@@ -75,7 +75,8 @@ class Dashboard(generic.TemplateView):
geo_kantor_administrasi A
JOIN geo_prov_kab b ON st_intersects ( A.geom, b.geom )
JOIN geo_data_kecamatan c ON st_intersects(A.geom, c.geom)
join geo_data_kelurahan d on st_intersects(A.geom, d.geom)""")
join geo_data_kelurahan d on st_intersects(A.geom, d.geom)
WHERE a.is_deleted = 0""")
kantor_administrasi_res = kantor_administrasi.fetchall()
kantor_administrasi_result = []
......@@ -466,7 +467,6 @@ class Dashboard(generic.TemplateView):
context = {
'title':'Dashboard',
'kelurahan':kel_res,
......@@ -641,6 +641,26 @@ def inpuperbaikan(request):
respon = res_data[0]
return Response(respon)
@api_view(('GET',))
def inputperbaikanbangunan(request):
id = request.GET.get('id_bangunan')
with conn.cursor() as data_per:
data_per.execute("""
SELECT
name,
type,
json_build_object ( 'type', 'Feature', 'geometry', ST_AsGeoJSON ( geom :: geometry ) :: json ),
ID
FROM
geo_bangunan
WHERE
ID = %s
"""% id)
res_data = data_per.fetchall()
respon = res_data[0]
return Response(respon)
from django.core.files.storage import FileSystemStorage
import random
import re
......@@ -770,7 +790,7 @@ def saveperbaikan(request):
jenis_perbaikan,
coordinat))
conn.commit()
data = "Alhamdulilah"
data = "Sukses"
info = "Data Telah Berhasil di Perbaharui"
code = 0
......
......@@ -87,8 +87,8 @@ DATABASES = {
'PASSWORD' : 'khansia215758',
'HOST': '30.10.20.102',
'PORT': '5432',
# 'HOST': '103.126.28.66',
# 'PORT': '8082',
#'HOST': '103.126.28.66',
#'PORT': '8082',
}
}
......
......@@ -121,6 +121,128 @@
</div>
<div class="content-wrapper mymodal" id="input_perbaikan_bang" style="display: none;padding: 60px;">
<div class="content" style="padding: 15px;max-height: 550px;">
<!-- Main charts -->
<div class="panel panel-flat" style="display: none;">
<div class="panel-body" style="padding-top: 10px;">
<div class="tabbable">
<ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<button type="button" class="close" onclick="destroyWraper()">&times;</button>
<li class="active"><a href="#left-tab-input-coordinat" data-toggle="tab">Koordinat</a></li>
<li><a href="#right-tab-input-informasi" data-toggle="tab">Insert Informasi</a></li>
</ul>
</div>
<div class="tab-content">
<div class="tab-pane active" id="left-tab-input-coordinat">
<div class="modal-body" style="max-height: 450px;overflow-y: auto;">
<input type="text" class="hidden" id="poly_create_input_bang">
<input type="text" class="hidden" id="id_bang_perbaikan">
<input type="text" class="hidden" id="type_id_bang">
<div id="map-insert-bang" style="height: 375px;width: 100%">
</div>
</div>
</div>
<div class="tab-pane" id="right-tab-input-informasi">
<div class="modal-body" style="max-height: 415px;overflow-y: auto;">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>Nama :</label>
<input type="text" id="nama_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Type :</label>
<input type="text" id="type_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Kelurahan :</label>
<input type="text" id="kelurahan_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Kecamatan :</label>
<input type="text" id="kecamatan_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Anggaran :</label>
<input type="text" id="anggaran_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Pihak yang Mengesahkan :</label>
<input type="text" id="pihakpengesahan_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Tanggal Disetujui :</label>
<input type="date" id="tgldisetujui_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Tanggal Mulai Perbaikan :</label>
<input type="date" id="tglmulaiperbaikan_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Tanggal Selesai Perbaikan :</label>
<input type="date" id="tglselesaiperbaikan_bang" class="form-control" value="">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Penanggung Jawab Lapangan :</label>
<input type="text" id="pjlapangan_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Kontraktor :</label>
<input type="text" id="kontraktor_bang" class="form-control" value="">
</div>
<!-- <div class="form-group">
<label>Panjang Jalan Keseluruhan :</label>
<input type="text" id="panjangjalanall" class="form-control" value="">
</div>
<div class="form-group">
<label>Panjang Jalan Perbaikan :</label>
<input type="text" id="panjangjalanperbaikan" class="form-control" value="">
</div>
<div class="form-group">
<label>Lebar Jalan Perbaikan :</label>
<input type="text" id="lebarjalanperbaikan" class="form-control" value="">
</div> -->
<div class="form-group">
<label>Jenis Perbaikan :</label>
<input type="text" id="jenisperbaikan_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Proposal (.pdf):</label>
<input type="file" id="proposal_bang">
</div>
<div class="form-group">
<label>Bukti Selesai Perbaikan (.png/.jpg/.jpeg/):</label>
<input type="file" id="buktiselesai_bang">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel-footer">
<button type="button" class="btn btn-info" id="save-perbaikan_bang" style="float: right; margin-right: 40px;">SAVE</button>
<button type="button" class="btn btn-link" onclick="destroyWraper()" style="float: right;">Close</button>
</div>
</div>
</div>
<!-- /main charts -->
</div>
<!-- editing kelurahan -->
<div class="content-wrapper mymodal" id="edit_kelurahan" style="display: none;padding: 60px;">
<div class="content" style="padding: 15px;max-height: 550px;">
......
......@@ -143,6 +143,9 @@
#btn_edit_bangunan {
display: none;
}
#btn_delete_bangunan {
display: none;
}
#btn_edit_kelurahan {
display: block;
......@@ -188,6 +191,9 @@
#btn_edit_adm {
display: none;
}
#btn_delete_adm {
display: none;
}
#btn_edit_rs {
display: none;
......
......@@ -244,7 +244,7 @@
map_create_bangunan.on(L.Draw.Event.CREATED, function(e) {
var layer = e.layer;
$("#poly_create").empty();
$("#poly_create_bangunan").empty();
var type = e.layerType;
var layer = e.layer;
......@@ -262,7 +262,7 @@
}
}
window.thisBaseDrawPolygonLayer = layer;
$("#poly_create").val(JSON.stringify(kordinat));
$("#poly_create_bangunan").val(JSON.stringify(kordinat));
});
polygon_options = {
......@@ -427,6 +427,7 @@
});
$(document).on("click", "#create_save_jalan", function(e) {
data = new FormData()
data.append("gambar", $("input[id^='img_jalan']")[0].files[0]);
......@@ -470,7 +471,7 @@
$(document).on("click", "#create_save_bangunan", function(e) {
var polygin = $('#poly_create').val();
var polygin = $('#poly_create_bangunan').val();
var name_poly = $('#name_create').val();
var info_poly = $('#info_create').val();
var alamat_poly = $('#alamat_create').val();
......
{% for group in user.groups.all %} {% if group.name == 'Superadmin' %}
<style>
.leaflet-popup {
.leaflet-popup{
display: block;
}
#btn_edit_kelurahan {
display: block;
}
......@@ -47,7 +46,6 @@
#btn_edit_adm {
display: block;
}
#btn_delete_adm {
display: block;
}
......@@ -72,7 +70,7 @@
display: block;
}
.leaflet-popup {
.leaflet-popup{
display: block;
}
</style>
......@@ -81,7 +79,7 @@
<script>
var kantor_administrasi = "{{ kantor_administrasi }}".replace(/&#x27;/g, '"');
var result_kan_adm = JSON.parse("" + kantor_administrasi + "")
// console.log(result_kan_adm[1]['administrasi']['f2'])
console.log(result_kan_adm)
geo_po_adm = L.geoJson(null, {
pointToLayer: function(feature, latlng) {
......@@ -278,6 +276,26 @@
});
return marker
}
else if (feature.administrasi.f2 == 'none') {
var smallIcon = new L.Icon({
iconSize: [20, 20],
iconAnchor: [13, 27],
popupAnchor: [1, -24],
iconUrl: 'static/img/icon/lurah.svg',
shadowUrl: 'static/img/icon/shadow.svg',
shadowSize: [38, 38],
shadowAnchor: [23, 32]
});
var marker = L.marker(latlng, {
icon: smallIcon
});
marker.bindTooltip(feature.administrasi.f1, {
permanent: false,
className: "my-label",
offset: [0, 0]
});
return marker
}
},
onEachFeature: function(feature, layer) {
layer.on({
......@@ -287,6 +305,7 @@
var geocoderNominatim = new L.Control.Geocoder.Nominatim();
var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
tay = result.address.Address;
console.log(feature.administrasi.f8)
// aladije(result.address.Address)
if (feature.administrasi.f3 == 'alamat') {
if (tay != '') {
......@@ -306,12 +325,18 @@
var raja = feature.administrasi.f10;
}
if (feature.administrasi.f8 == 'None') {
var gmb = "lurah.svg";
} else {
var gmb = feature.administrasi.f8;
}
content = `
<table class="table table-hover tasks-list">
<thead style="text-align: center;">
<tr>
<th style="padding: 0 0 0 0px;">
<img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 100%;max-height: 237px;height:237; margin-top: 40px;">
<img src="static/img/image/` + gmb + `" alt="Image" style="width: 100%;max-height: 237px;height:237; margin-top: 40px;">
</th>
</tr>
</thead>
......@@ -383,7 +408,7 @@
</div>
</tbody>
</table>`;
content_delete = `
content_delete_adm = `
<div class="modal-dialog md">
<div class="modal-content">
<div class="modal-header bg-info" style="background-color: #40777c !important;">
......@@ -422,7 +447,7 @@
</div>
</div>
</div>`;
content_edit = `
content_edit_adm = `
<div class="modal-dialog md">
<div class="modal-content">
<div class="modal-header bg-info" style="background-color: #40777c !important;">
......@@ -435,13 +460,13 @@
<div class="tabbable">
<ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<li onclick="changetabs(this)" class="active"><a href="#left-tab1-feas-upl" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)" ><a href="#right-tab2-feas-upl" data-toggle="tab">Informasi Umum</a></li>
<li onclick="changetabs(this)" class="active"><a href="#left-tab1-feas-upli" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)" ><a href="#right-tab2-feas-upli" data-toggle="tab">Informasi Umum</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="left-tab1-feas-upl">
<div class="tab-pane active" id="left-tab1-feas-upli">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<div class="form-group">
<label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
......@@ -452,7 +477,7 @@
</div>
</div>
<div class="tab-pane" id="right-tab2-feas-upl">
<div class="tab-pane" id="right-tab2-feas-upli">
<div class="modal-body" style="min-height: 450px;overflow-y: auto;">
......@@ -534,8 +559,8 @@
</div>
</div>`;
$("#isi_panel").html(content)
$("#modald_adm").html(content_delete)
$("#modal_adm").html(content_edit)
$("#modald_adm").html(content_delete_adm)
$("#modal_adm").html(content_edit_adm)
})
hidelegend();
......@@ -630,7 +655,7 @@
data.append('alamat', $('#alamat_adm_edit').val())
data.append('perangkat', $('#perangkat_adm_edit').val())
data.append('point', poi),
data.append('gambar', $('#gambar').val())
data.append('gambar', $('#gambar_adm_edit').val())
$.ajax({
url: "{% url 'api:kantor' %}",
......@@ -793,12 +818,18 @@
} else {
var raja = feature.administrasi.f10;
}
if (feature.administrasi.f8 == 'None') {
var gmb = "rs.svg";
} else {
var gmb = feature.administrasi.f8;
}
content_lk = `
<table class="table table-hover tasks-list">
<thead style="text-align: center;">
<tr>
<th style="padding: 0 0 0 0px;">
<img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 100%;max-height: 237px;height:237">
<img src="static/img/image/` + gmb + `" alt="Image" style="width: 100%;max-height: 237px;height:237">
</th>
</tr>
</thead>
......@@ -882,14 +913,14 @@
<div class="tabbable">
<ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upl" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)"><a href="#left-tab1-feas-upl" data-toggle="tab">Informasi Umum</a></li>
<li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane" id="left-tab1-feas-upl">
<div class="tab-pane" id="left-tab1-feas-upli">
<div class="modal-body" style="min-height: 450px;overflow-y: auto;">
......@@ -958,7 +989,7 @@
</div>
</div>
<div class="tab-pane active" id="right-tab2-feas-upl">
<div class="tab-pane active" id="right-tab2-feas-upli">
<div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<div class="form-group">
......@@ -1165,12 +1196,19 @@
} else {
var raja = feature.administrasi.f10;
}
if (feature.administrasi.f8 == 'None') {
var gmb = "rs.svg";
} else {
var gmb = feature.administrasi.f8;
}
content_puskes = `
<table class="table table-hover tasks-list">
<thead style="text-align: center;">
<tr>
<th style="padding: 0 0 0 0px;">
<img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 100%;max-height: 237px;height:237">
<img src="static/img/image/` + gmb + `" alt="Image" style="width: 100%;max-height: 237px;height:237">
</th>
</tr>
</thead>
......@@ -1254,13 +1292,13 @@
<div class="tabbable">
<ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upl" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)"><a href="#left-tab1-feas-upl" data-toggle="tab">Informasi Umum</a></li>
<li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane" id="left-tab1-feas-upl">
<div class="tab-pane" id="left-tab1-feas-upli">
<div class="modal-body" style="min-height: 450px;overflow-y: auto;">
......@@ -1329,7 +1367,7 @@
</div>
</div>
<div class="tab-pane active" id="right-tab2-feas-upl">
<div class="tab-pane active" id="right-tab2-feas-upli">
<div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<div class="form-group">
......@@ -1536,12 +1574,19 @@
} else {
var raja = feature.administrasi.f10;
}
if (feature.administrasi.f8 == 'None') {
var gmb = "rs.svg";
} else {
var gmb = feature.administrasi.f8;
}
content_rs = `
<table class="table table-hover tasks-list">
<thead style="text-align: center;">
<tr>
<th style="padding: 0 0 0 0px;">
<img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 100%;max-height: 237px;height:237">
<img src="static/img/image/` + gmb + `" alt="Image" style="width: 100%;max-height: 237px;height:237">
</th>
</tr>
</thead>
......@@ -1612,7 +1657,7 @@
</div>
</tbody>
</table>`;
content_edit_rs = `
content_edit_rs=`
<div class="modal-dialog md">
<div class="modal-content">
<div class="modal-header bg-info" style="background-color: #40777c !important;">
......@@ -1625,13 +1670,13 @@
<div class="tabbable">
<ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upl" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)"><a href="#left-tab1-feas-upl" data-toggle="tab">Informasi Umum</a></li>
<li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane" id="left-tab1-feas-upl">
<div class="tab-pane" id="left-tab1-feas-upli">
<div class="modal-body" style="min-height: 450px;overflow-y: auto;">
......@@ -1700,7 +1745,7 @@
</div>
</div>
<div class="tab-pane active" id="right-tab2-feas-upl">
<div class="tab-pane active" id="right-tab2-feas-upli">
<div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<div class="form-group">
......@@ -1963,13 +2008,13 @@
<div class="tabbable">
<ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upl" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)"><a href="#left-tab1-feas-upl" data-toggle="tab">Informasi Umum</a></li>
<li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane" id="left-tab1-feas-upl">
<div class="tab-pane" id="left-tab1-feas-upli">
<div class="modal-body" style="min-height: 450px;overflow-y: auto;">
......@@ -2038,7 +2083,7 @@
</div>
</div>
<div class="tab-pane active" id="right-tab2-feas-upl">
<div class="tab-pane active" id="right-tab2-feas-upli">
<div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<div class="form-group">
......@@ -2361,13 +2406,13 @@
<div class="tabbable">
<ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upl" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)"><a href="#left-tab1-feas-upl" data-toggle="tab">Informasi Umum</a></li>
<li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane" id="left-tab1-feas-upl">
<div class="tab-pane" id="left-tab1-feas-upli">
<div class="modal-body" style="min-height: 450px;overflow-y: auto;">
......@@ -2436,7 +2481,7 @@
</div>
</div>
<div class="tab-pane active" id="right-tab2-feas-upl">
<div class="tab-pane active" id="right-tab2-feas-upli">
<div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<div class="form-group">
......@@ -2733,13 +2778,13 @@
<div class="tabbable">
<ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<li onclick="changetabs(this)" class="active"><a href="#left-tab1-feas-upl" data-toggle="tab">Informasi Umum</a></li>
<li onclick="changetabs(this)"><a href="#right-tab2-feas-upl" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)" class="active"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
<li onclick="changetabs(this)"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="left-tab1-feas-upl">
<div class="tab-pane active" id="left-tab1-feas-upli">
<div class="modal-body" style="min-height: 450px;overflow-y: auto;">
......@@ -2835,7 +2880,7 @@
</div>
</div>
<div class="tab-pane" id="right-tab2-feas-upl">
<div class="tab-pane" id="right-tab2-feas-upli">
<div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<div class="form-group">
......@@ -3097,13 +3142,13 @@
<div class="tabbable">
<ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<li onclick="changetabs(this)" class="active"><a href="#left-tab1-feas-upl" data-toggle="tab">Informasi Umum</a></li>
<li onclick="changetabs(this)"><a href="#right-tab2-feas-upl" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)" class="active"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
<li onclick="changetabs(this)"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="left-tab1-feas-upl">
<div class="tab-pane active" id="left-tab1-feas-upli">
<div class="modal-body" style="min-height: 450px;overflow-y: auto;">
......@@ -3199,7 +3244,7 @@
</div>
</div>
<div class="tab-pane" id="right-tab2-feas-upl">
<div class="tab-pane" id="right-tab2-feas-upli">
<div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<div class="form-group">
......@@ -3460,13 +3505,13 @@
<div class="tabbable">
<ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<li onclick="changetabs(this)" class="active"><a href="#left-tab1-feas-upl" data-toggle="tab">Informasi Umum</a></li>
<li onclick="changetabs(this)"><a href="#right-tab2-feas-upl" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)" class="active"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
<li onclick="changetabs(this)"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="left-tab1-feas-upl">
<div class="tab-pane active" id="left-tab1-feas-upli">
<div class="modal-body" style="min-height: 450px;overflow-y: auto;">
......@@ -3525,7 +3570,7 @@
</div>
</div>
<div class="tab-pane" id="right-tab2-feas-upl">
<div class="tab-pane" id="right-tab2-feas-upli">
<div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<div class="form-group">
......@@ -3766,13 +3811,13 @@
<div class="tabbable">
<ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<li onclick="changetabs(this)" class="active"><a href="#left-tab1-feas-upl" data-toggle="tab">Informasi Umum</a></li>
<li onclick="changetabs(this)"><a href="#right-tab2-feas-upl" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)" class="active"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
<li onclick="changetabs(this)"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="left-tab1-feas-upl">
<div class="tab-pane active" id="left-tab1-feas-upli">
<div class="modal-body" style="min-height: 450px;overflow-y: auto;">
......@@ -3831,7 +3876,7 @@
</div>
</div>
<div class="tab-pane" id="right-tab2-feas-upl">
<div class="tab-pane" id="right-tab2-feas-upli">
<div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<div class="form-group">
......@@ -4084,13 +4129,13 @@
<div class="tabbable">
<ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<li onclick="changetabs(this)" class="active"><a href="#left-tab1-feas-upl" data-toggle="tab">Informasi Umum</a></li>
<li onclick="changetabs(this)"><a href="#right-tab2-feas-upl" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)" class="active"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
<li onclick="changetabs(this)"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="left-tab1-feas-upl">
<div class="tab-pane active" id="left-tab1-feas-upli">
<div class="modal-body" style="min-height: 450px;overflow-y: auto;">
......@@ -4186,7 +4231,7 @@
</div>
</div>
<div class="tab-pane" id="right-tab2-feas-upl">
<div class="tab-pane" id="right-tab2-feas-upli">
<div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<div class="form-group">
......@@ -4523,13 +4568,13 @@
var hrf = $(params).find("a").attr("href");
if (hrf == '#right-tab2-feas-upl') {
$("#left-tab1-feas-upl").removeClass("show")
// $("#right-tab2-feas-upl").attr("display", "block")
if (hrf == '#right-tab2-feas-upli') {
$("#left-tab1-feas-upli").removeClass("show")
// $("#right-tab2-feas-upli").attr("display", "block")
} else {
$("#right-tab2-feas-upl").removeClass("show")
// $("#left-tab1-feas-upl").attr("display", "block")
$("#right-tab2-feas-upli").removeClass("show")
// $("#left-tab1-feas-upli").attr("display", "block")
}
}
......@@ -4559,7 +4604,7 @@
}
}
//3d begin
//3d begin
function map3d() {
var checkBox_3d = document.getElementById("3d-maps");
if (checkBox_3d.checked == true) {
......@@ -4568,7 +4613,8 @@
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJhOTc0NDkxMi02N2NkLTQwYjMtOTE1Yi1iMGNkZDU0Zjg3MGMiLCJpZCI6NDQ1ODgsImlhdCI6MTYxNDE0NjM5NH0.sRHzNNa7uV_huqGxERySWlL8J5UVx1VwU-pRwNd0GJk';
var worldTerrain = new Cesium.ArcGISTiledElevationTerrainProvider({
url: "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer",
url:
"https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer",
});
var map_cesium = new Cesium.Viewer('map-cesium');
// var map_cesium = new Cesium.Viewer('map-cesium', {
......@@ -4726,6 +4772,668 @@
$("#map-cesium").css('display', 'none');
}
}
//3d end
//3d end
var geocodeService = L.esri.Geocoding.geocodeService();
var geocoderNominatim = new L.Control.Geocoder.Nominatim();
var geo_bangunan = L.geoJson(null, {
style: function(feature) {
return {
color: "#ff0008",
weight: 1,
opacity: 2,
zIndex: 1000
};
},
onEachFeature: function(feature, layer) {
if (feature.properties) {
var lattitud, longitud;
if (feature.geometry.type == 'MultiPolygon') {
lattitud = feature.geometry.coordinates[0][0][0][1];
longitud = feature.geometry.coordinates[0][0][0][0];
} else {
lattitud = feature.geometry.coordinates[0][0][1];
longitud = feature.geometry.coordinates[0][0][0];
};
layer.on({
click: function(e) {
var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
if (result.address.Address != '') {
var alamat = result.address.Address + `, `
} else {
var alamat = ''
};
if (feature.administrasi.f9 == 'None') {
var path_img = "static/img/image_null.jpg"
} else {
var path_img = `"static/image/bangunan/` + feature.administrasi.f9 + `"`
}
// var list_history = feature.properties.f7
// var list_history_panel = ``
// for (var i = 0; i < list_history.length; i++) {
// var dt_history = list_history[i].split(",");
// var data_history = `<div class="form-group" style="margin-bottom:0px;">
// <div class="row">
// <label class="col-md-6">` + dt_history[1] + `</label>
// <a class="col-md-3" onclick="getjalanper(` + dt_history[0] + `)"><i>View Ruas</i></a>
// <a class="col-md-3" onclick="getdetailper(` + dt_history[0] + `)" data-toggle="modal" data-target="#modal_detail"><i>View Detail</i></a>
// </div>
// </div>`;
// list_history_panel += data_history
// };
// history = `<p class="text-center">
// History Perbaikan
// </p>
// <br>
// ` + list_history_panel + `
// <p class="text-center" style="margin-top: 10px;">
// <a href="#" id='btn_perbaikan_jalan' class="btn btn-default"><i>Tambah History Perbaikan</i></a>
// </p>`;
content_edit = `
<div class="modal-dialog" style="width: max-content;height: max-content;">
<div class="modal-content">
<div class="modal-header bg-info" style="background-color:#40777c;">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h6 class="modal-title">Edit Polygon Bangunan dan Informasinya</h6>
</div>
<div class="modal-body" style="max-height: 450px;overflow-y: auto;">
<div class="row">
<div class="col-md-5">
<div id="map-edit" style="width:400px;height: 350px;">
</div>
</div>
<div class="col-md-4">
<input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunan" value="`+feature.geometry+`">
<table>
<tr>
<th>
Image
</th>
<td>
<input type="file" id="imgbangunan" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
<input style="display:none;" id="gambar" type="text" class="form-control" value="`+feature.administrasi.f9+`"required>
</td>
</tr>
<tr>
<td>
<input type="text" name="idbangunan" id="idbangunan" class="form-control hidden" value="`+feature.properties.f1+`" disable>
<input style="display:none;" id="coordinateZoneeditbang" type="text" class="form-control" value=""required>
</td>
</tr>
<tr>
<th>Nama Bangunan</th>
<td>
<input type="text" name="namebangunan" id="namebangunan" class="form-control" value="`+feature.properties.f2+`">
</td>
</tr>
<tr>
<th>Informasi Bangunan</th>
<td>
<input type="text" name="infobangunan" id="infobangunan" class="form-control" value="`+feature.properties.f3+`">
</td>
</tr>
<tr>
<th>Kelurahan</th>
<td>
<input type=" text " name="nmkelurahan " id="nmkelurahan" class="form-control " value="`+feature.administrasi.f1+`">
</td>
</tr>
<tr>
<th>Kecamatan</th>
<td>
<input type="text " name="nmkecamatan " id="nmkecamatan" class="form-control " value="`+feature.administrasi.f2+`">
</td>
</tr>
<tr>
<th>Kab/Kota</th>
<td>
<input type="text " name="nmkabkota " id="nmkabkota" class="form-control " value="`+feature.administrasi.f3+`">
</td>
</tr>
<tr>
<th>Provinsi</th>
<td>
<input type="text " name="nmprovinsi " id="nmprovinsi" class="form-control " value="`+feature.administrasi.f4+`">
</td>
</tr>
</table>
</div>
<div class="col-md-3 ">
<table>
<tr>
<th>Luas Bangunan</th>
<td>
<input type="text " name="luasbangunan " id="luasbangunan" class="form-control " value="`+feature.administrasi.f6+`">
</td>
</tr>
<tr>
<th>Luas Tanah</th>
<td>
<input type="text " name="luastanah " id="luastanah" class="form-control " value="`+feature.administrasi.f7+`">
</td>
</tr>
<tr>
<th>Tinggi Bangunan</th>
<td>
<input type="text " name="tinggibangunan " id="tinggibangunan" class="form-control " value="`+feature.administrasi.f8+`">
</td>
</tr>
<tr>
<th>Pemilik</th>
<td>
<input type="text " name="pemilik " id="pemilik" class="form-control " value="`+feature.administrasi.f10+`">
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="modal-footer ">
<button type="button " class="btn btn-link " data-dismiss="modal ">Close</button>
<button type="button " id="btnsavebangunan" class="btn btn-info ">Save changes</button>
</div>
</div>
</div>`;
content_delete=`
<div class="modal-dialog" style="width: max-content;height: max-content;">
<div class="modal-content">
<div class="modal-header bg-info" style="background-color:#40777c;">
<table>
<tr>
<th><h6 class="modal-title">Delete Bangunan dan Informasinya</h6></th>
<td><button type="button" class="close" data-dismiss="modal">&times;</button></td>
</tr>
</table>
</div>
<div class="form-group" style="margin-bottom:10px;">
<div id="map-delete" style="width: 300px;height: 250px;position: relative;margin-left: 10px;margin-right: 10px;margin-top: 10px;"></div>
<div class="form-group">
<div class="col-lg-12" style="margin-top:10px;margin-bottom:10px;">
<input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunanhps" value="">
<input type="text" name="idbangunan" id="idbangunanhps" class="form-control hidden" value="`+feature.properties.f1+`" disable>
<input type="text" name="namebangunan" id="namebangunanhps" class="form-control" value="`+feature.properties.f2+`">
<input type="text" name="infobangunan" id="infobangunanhps" class="form-control" value="`+feature.properties.f3+`">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" id="btnsavedeletebangunan" class="btn btn-info">Hapus</button>
</div>
</div>
</div>`;
content = `
<table class="table tasks-list">
<thead style="text-align: center;">
<tr>
<th style="padding: 0 0 0 0px;">
<img src=` + path_img + ` alt="Image" style="width: 100%;max-height: 368px;height:368">
</th>
</tr>
</thead>
<tbody>
<div class= "container">
<tr style="height: 100px;">
<th>
<div>
<h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
letter-spacing: 0;
font-weight: 400;">
<span style="font-size: x-large;">
` + feature.properties.f2 + `
</span>
</h1>
</div>
</th>
</tr>
</div>
<div class= "container">
<tr style="height: 30px;">
<th>
<span>
` + feature.properties.f3 + `
</span>
</th>
</tr>
</div>
<div class= "container">
<tr style="height: 40px;">
<th>
<span>
` + alamat + feature.administrasi.f1 + `, ` + feature.administrasi.f2 + `, ` + feature.administrasi.f3 + `, ` + feature.administrasi.f4 + `
</span>
</th>
</tr>
</div>
<div class= "container">
<tr style="height: 40px;">
<th>
<p>
<span>Luas Bangunan : ` + feature.administrasi.f6 + `</span>
</p>
<p>
<span>Luas Tanah : ` + feature.administrasi.f7 + `</span>
</p>
<p>
<span>Tinggi Bangunan : ` + feature.administrasi.f8 + `</span>
</p>
<p>
<span>Pemilik : ` + feature.administrasi.f10 + `</span>
</p>
<p class="text-center" style="margin-top: 25px;">
<a href="#" class="btn btn-default" data-toggle="modal" data-target="#modal_bangunan_edit" id="btn_edit_bangunan" data-backdrop="static" data-keyboard="false"><i>Edit Informasi Bangunan</i></a>
<a href="#" id='btn_delete_bangunan' class='btn
btn-default btn_edit_bangunan' data-toggle="modal" data-target="#modal_bangunan_delete" data-backdrop="static" data-keyboard="false"><i>Delete Bangunan</i></a>
</p>
</th>
</tr>
</div>
<div class="container">
<tr style="height: 40px;">
<th id="history_panel">
<p class="text-center">
History Perbaikan
</p>
<br>
<p class="text-center" style="margin-top: 10px;">
<a href="#" id='btn_perbaikan_bangunan' class="btn btn-default"><i>Tambah History Perbaikan</i></a>
</p>
</th>
</tr>
</div>
</tbody>
</table>`;
$("#isi_panel").html(content);
$("#modal_bangunan_edit").html(content_edit);
$("#modal_bangunan_delete").html(content_delete);
});
// $('#idbangunan').val(feature.properties.f1);
// $('#namebangunan').val(feature.properties.f2);
// $('#infobangunan').val(feature.properties.f3);
// $('#nmkelurahan').val(feature.administrasi.f1);
// $('#nmkecamatan').val(feature.administrasi.f2);
// $('#nmkabkota').val(feature.administrasi.f3);
// $('#nmprovinsi').val(feature.administrasi.f4);
// $('#luasbangunan').val(feature.administrasi.f6);
// $('#luastanah').val(feature.administrasi.f7);
// $('#tinggibangunan').val(feature.administrasi.f8);
// $('#pemilik').val(feature.administrasi.f10);
// $('#gambar').val(feature.administrasi.f9);
// $("#coordinatebangunan").val(feature.geometry);
$("#panel-samping").css("display", "block");
$("#button_hide_panel").css("display", "block");
// $('#idbangunanhps').val(feature.properties.f1);
// $('#namebangunanhps').val(feature.properties.f2);
// $('#infobangunanhps').val(feature.properties.f3);
panel_samp()
}
});
pool.push({
name: feature.properties.f2,
id: L.stamp(layer),
lat: lattitud,
lng: longitud
});
}
layer.on({
mouseover: function(e) {
var layer = e.target;
layer.setStyle({
weight: 1,
Color: "#067800",
fillColor: "#067800",
});
if (!L.Browser.ie && !L.Browser.opera) {
layer.bringToFront();
}
},
mouseout: function(e) {
geo_bangunan.resetStyle(e.target);
}
});
}
});
function geo_json_bangunan(data) {
geo_bangunan.addData(data)
}
var checkBox_building = document.getElementById("geo_building");
var checkBox_2d = document.getElementById("2d-maps");
map.on("movestart", function() {
geo_bangunan.clearLayers();
});
map.on("moveend", function() {
var wetan = map.getBounds().getEast();
var kulon = map.getBounds().getWest();
var lor = map.getBounds().getNorth()
var kidul = map.getBounds().getSouth();
var center = map.getBounds().getCenter();
var zoom = map.getZoom();
if (checkBox_building.checked == true || checkBox_2d.checked == true) {
if (zoom > 17) {
if (map.hasLayer(geo_bangunan)) {
geo_bangunan.clearLayers()
geo_bangunan.remove()
}
$.ajax({
url: "{% url 'api:building' %}",
data: {
'wetan': wetan,
'kulon': kulon,
'lor': lor,
'kidul': kidul
},
dataType: 'json',
success: function(data) {
let list_poly = [];
for (var i = 0; i < data['gen'].length; i++) {
geoj = data['gen'][i][0];
list_poly.push(geoj);
};
geo_json_bangunan(list_poly);
}
});
}
geo_bangunan.addTo(map)
} else {
geo_bangunan.clearLayers();
geo_bangunan.remove()
}
});
var map_edit = new L.map('map-edit', {
editable: true,
zoomControl: false,
drawControl: true
}).setView([-2, 118], 5);
mapss = L.tileLayer('https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
maxZoom: 22,
minZoom: 4,
}).addTo(map_edit);
var polylyly = L.polygon([
[-4.1283969, 104.1674575],
[-4.128396, 104.1674947],
[-4.1284664, 104.1674964],
[-4.1284674, 104.1674593],
[-4.1283969, 104.1674575]
]).addTo(map_edit)
$(document).on("click", "#btn_edit_bangunan", function() {
var map_edit = new L.map('map-edit', {
editable: true,
zoomControl: false,
drawControl: true
}).setView([-2, 118], 5);
mapss = L.tileLayer('https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
maxZoom: 22,
minZoom: 4,
}).addTo(map_edit);
var id_poly = $('#idbangunan').val();
loaderPage(true);
$.ajax({
url: "{% url 'api:edit' %}",
data: {
'id_poly': id_poly
},
dataType: 'json',
success: function(data) {
setTimeout(function() {
map_edit.invalidateSize();
}, 1000);
loaderPage(false);
map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
let lop_poly_edit = data['geometry']['coordinates'][0][0];
let list_poly_edit = [];
for (var i = 0; i < lop_poly_edit.length; i++) {
geoj = lop_poly_edit[i][0];
polygigi = [lop_poly_edit[i][1], lop_poly_edit[i][0]]
list_poly_edit.push(polygigi);
};
var polyly = L.polygon(list_poly_edit).addTo(map_edit)
polyly.enableEdit();
var hasil = (JSON.stringify(polyly.toGeoJSON()))
$('#btnsavebangunan').click(function() {
$("#coordinatebangunan").val(hasil);
})
}
})
});
$(document).on("click", "#btnsavebangunan", function() {
var data = new FormData();
data.append("file", $("input[id^='imgbangunan']")[0].files[0]);
data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
data.append('name_b', $('#namebangunan').val())
data.append('polygon', $('#coordinatebangunan').val())
data.append('info_b', $('#infobangunan').val())
data.append('desa_b', $('#nmkelurahan').val())
data.append('kec_b', $('#nmkecamatan').val())
data.append('kab_b', $('#nmkabkota').val())
data.append('pro_b', $('#nmprovinsi').val())
data.append('id_poly', $('#idbangunan').val())
data.append('gambar', $('#gambar').val())
data.append('luasbangunan_b', $('#luasbangunan').val())
data.append('luastanah_b', $('#luastanah').val())
data.append('tinggibangunan_b', $('#tinggibangunan').val())
data.append('pemilik_b', $('#pemilik').val())
$.ajax({
url: "{% url 'api:validatedit' %}",
data: data,
dataType: 'json',
type: 'POST',
processData: false,
contentType: false,
success: function(data) {
let response = data
if (response.code == 0) {
swal({
title: response.info,
text: response.data,
type: "success",
icon: "success",
confirmButtonColor: "#00BCD4"
}, function() {
$("#modal_bangunan_edit").css('display', 'none');
})
} else {
swal({
title: response.info,
text: response.data,
type: "warning",
icon: "error",
confirmButtonColor: "#00BCD4"
})
}
}
})
});
$(document).on("click", "#btn_delete_bangunan", function() {
var map_delete = new L.map('map-delete', {
editable: true,
zoomControl: false,
drawControl: true
}).setView([-2, 118], 5);
mapss = L.tileLayer('https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
maxZoom: 22,
minZoom: 4,
}).addTo(map_delete);
var id_polyhps = $('#idbangunanhps').val();
// console.log(id_polyhps)
loaderPage(true);
$.ajax({
url: "{% url 'api:edit' %}",
data: {
'id_poly': id_polyhps
},
dataType: 'json',
success: function(data) {
setTimeout(function() {
map_delete.invalidateSize();
}, 1000);
loaderPage(false);
map_delete.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
let lop_poly_edit = data['geometry']['coordinates'][0][0];
let list_poly_edit = [];
for (var i = 0; i < lop_poly_edit.length; i++) {
geoj = lop_poly_edit[i][0];
polygigi = [lop_poly_edit[i][1], lop_poly_edit[i][0]]
list_poly_edit.push(polygigi);
};
var polyly = L.polygon(list_poly_edit).addTo(map_delete)
$('#btnsavedeletebangunan').click(function() {
var hasil = (JSON.stringify(polyly.toGeoJSON()))
$("#coordinatebangunan").val(hasil);
})
}
})
});
$(document).on("click", "#btnsavedeletebangunan", function() {
var data = new FormData();
data.append('id_poly', $('#idbangunan').val())
$.ajax({
url: "{% url 'api:hapus' %}",
data: data,
dataType: 'json',
type: 'POST',
processData: false,
contentType: false,
success: function(data) {
let response = data
if (response.code == 0) {
swal({
title: response.info,
text: response.data,
type: "success",
icon: "success",
confirmButtonColor: "#00BCD4"
}, function() {
$("#modal_bangunan_delete").css('display', 'none');
})
} else {
swal({
title: 'Error',
text: 'Hubungi Mereka',
type: "warning",
icon: "error",
confirmButtonColor: "#00BCD4"
})
}
}
})
});
// var map_bang = new L.map('map-insert-bang', {
// editable: true,
// zoomControl: false,
// drawControl: true
// }).setView([-2, 118], 5);
// mapss = L.tileLayer('https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
// maxZoom: 22,
// minZoom: 4,
// }).addTo(map_bang);
// var polyxxx = L.polygon([
// [-4.1283969, 104.1674575],
// [-4.128396, 104.1674947],
// [-4.1284664, 104.1674964],
// [-4.1284674, 104.1674593],
// [-4.1283969, 104.1674575]
// ]).addTo(map_bang)
// $(document).on("click", "#btn_perbaikan_bangunan", function() {
// if (map_bang.hasLayer(polyxxx)) {
// polyxxx.remove()
// }
// var id_polyx = $('#idbangunan').val();
// $("#input_perbaikan_bang").css("display", "block");
// $.ajax({
// url: "{% url 'apps:input-perbaikan-bang' %}",
// data: {
// 'id_bangunan': id_polyx
// },
// dataType: 'json',
// success: function(data) {
// $("#nama_bang").val(data[0]);
// $("#type_bang").val(data[1]);
// $("#id_bang_perbaikan").val(data[3]);
// $("#type_id_bang").val("1")
// var latlngs = data[2];
// map_bang.setView([latlngs['geometry']['coordinates'][0][0][1], latlngs['geometry']['coordinates'][0][0][0]], 19)
// let lop_poly_edit = data['geometry']['coordinates'][0][0];
// let list_poly_edit = [];
// for (var i = 0; i < lop_poly_edit.length; i++) {
// geoj = lop_poly_edit[i][0];
// polygigi = [lop_poly_edit[i][1], lop_poly_edit[i][0]]
// list_poly_edit.push(polygigi);
// };
// polylyly = L.polygon(list_poly_edit).addTo(map_bang)
// polylyly.enableEdit();
// var hasil = (JSON.stringify(polylyly.toGeoJSON()))
// }
// })
// })
</script>
{% include 'includes/insert.html' %}
\ No newline at end of file
......@@ -1426,597 +1426,597 @@
});
var geocodeService = L.esri.Geocoding.geocodeService();
var geocoderNominatim = new L.Control.Geocoder.Nominatim();
var geo_bangunan = L.geoJson(null, {
style: function(feature) {
return {
color: "#ff0008",
weight: 1,
opacity: 2,
zIndex: 1000
};
},
onEachFeature: function(feature, layer) {
if (feature.properties) {
var lattitud, longitud;
if (feature.geometry.type == 'MultiPolygon') {
lattitud = feature.geometry.coordinates[0][0][0][1];
longitud = feature.geometry.coordinates[0][0][0][0];
} else {
lattitud = feature.geometry.coordinates[0][0][1];
longitud = feature.geometry.coordinates[0][0][0];
};
layer.on({
click: function(e) {
var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
if (result.address.Address != '') {
var alamat = result.address.Address + `, `
} else {
var alamat = ''
};
if (feature.administrasi.f9 == 'None') {
var path_img = "static/img/image_null.jpg"
} else {
var path_img = `"static/image/bangunan/` + feature.administrasi.f9 + `"`
}
var list_history = feature.properties.f7
var list_history_panel = ``
for (var i = 0; i < list_history.length; i++) {
var dt_history = list_history[i].split(",");
// var geocodeService = L.esri.Geocoding.geocodeService();
// var geocoderNominatim = new L.Control.Geocoder.Nominatim();
// var geo_bangunan = L.geoJson(null, {
// style: function(feature) {
// return {
// color: "#ff0008",
// weight: 1,
// opacity: 2,
// zIndex: 1000
// };
// },
var data_history = `<div class="form-group" style="margin-bottom:0px;">
<div class="row">
<label class="col-md-6">` + dt_history[1] + `</label>
<a class="col-md-3" onclick="getjalanper(` + dt_history[0] + `)"><i>View Ruas</i></a>
<a class="col-md-3" onclick="getdetailper(` + dt_history[0] + `)" data-toggle="modal" data-target="#modal_detail"><i>View Detail</i></a>
</div>
</div>`;
list_history_panel += data_history
};
// onEachFeature: function(feature, layer) {
// if (feature.properties) {
history = `<p class="text-center">
History Perbaikan
</p>
<br>
` + list_history_panel + `
<p class="text-center" style="margin-top: 10px;">
<a href="#" id='btn_perbaikan_jalan' class="btn btn-default"><i>Tambah History Perbaikan</i></a>
</p>`;
// var lattitud, longitud;
// if (feature.geometry.type == 'MultiPolygon') {
// lattitud = feature.geometry.coordinates[0][0][0][1];
// longitud = feature.geometry.coordinates[0][0][0][0];
content_edit = `
<div class="modal-dialog" style="width: max-content;height: max-content;">
<div class="modal-content">
<div class="modal-header bg-info" style="background-color:#40777c;">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h6 class="modal-title">Edit Polygon Bangunan dan Informasinya</h6>
</div>
<div class="modal-body" style="max-height: 450px;overflow-y: auto;">
<div class="row">
<div class="col-md-5">
<div id="map-edit" style="width:400px;height: 350px;">
</div>
</div>
<div class="col-md-4">
<input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunan" value="`+feature.geometry+`">
<table>
<tr>
<th>
Image
</th>
<td>
<input type="file" id="imgbangunan" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
<input style="display:none;" id="gambar" type="text" class="form-control" value="`+feature.administrasi.f9+`"required>
</td>
</tr>
<tr>
<td>
<input type="text" name="idbangunan" id="idbangunan" class="form-control hidden" value="`+feature.properties.f1+`" disable>
<input style="display:none;" id="coordinateZoneeditbang" type="text" class="form-control" value=""required>
</td>
</tr>
<tr>
<th>Nama Bangunan</th>
<td>
<input type="text" name="namebangunan" id="namebangunan" class="form-control" value="`+feature.properties.f2+`">
</td>
</tr>
<tr>
<th>Informasi Bangunan</th>
<td>
<input type="text" name="infobangunan" id="infobangunan" class="form-control" value="`+feature.properties.f3+`">
</td>
</tr>
<tr>
<th>Kelurahan</th>
<td>
<input type=" text " name="nmkelurahan " id="nmkelurahan" class="form-control " value="`+feature.administrasi.f1+`">
</td>
</tr>
<tr>
<th>Kecamatan</th>
<td>
<input type="text " name="nmkecamatan " id="nmkecamatan" class="form-control " value="`+feature.administrasi.f2+`">
</td>
</tr>
<tr>
<th>Kab/Kota</th>
<td>
<input type="text " name="nmkabkota " id="nmkabkota" class="form-control " value="`+feature.administrasi.f3+`">
</td>
</tr>
<tr>
<th>Provinsi</th>
<td>
<input type="text " name="nmprovinsi " id="nmprovinsi" class="form-control " value="`+feature.administrasi.f4+`">
</td>
</tr>
// } else {
// lattitud = feature.geometry.coordinates[0][0][1];
// longitud = feature.geometry.coordinates[0][0][0];
// };
</table>
</div>
// layer.on({
// click: function(e) {
// var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
<div class="col-md-3 ">
// if (result.address.Address != '') {
// var alamat = result.address.Address + `, `
// } else {
// var alamat = ''
// };
<table>
<tr>
<th>Luas Bangunan</th>
<td>
<input type="text " name="luasbangunan " id="luasbangunan" class="form-control " value="`+feature.administrasi.f6+`">
</td>
</tr>
<tr>
<th>Luas Tanah</th>
<td>
<input type="text " name="luastanah " id="luastanah" class="form-control " value="`+feature.administrasi.f7+`">
</td>
</tr>
<tr>
<th>Tinggi Bangunan</th>
<td>
<input type="text " name="tinggibangunan " id="tinggibangunan" class="form-control " value="`+feature.administrasi.f8+`">
</td>
</tr>
<tr>
<th>Pemilik</th>
<td>
<input type="text " name="pemilik " id="pemilik" class="form-control " value="`+feature.administrasi.f10+`">
</td>
</tr>
</table>
</div>
</div>
</div>
// if (feature.administrasi.f9 == 'None') {
// var path_img = "static/img/image_null.jpg"
// } else {
// var path_img = `"static/image/bangunan/` + feature.administrasi.f9 + `"`
// }
<div class="modal-footer ">
<button type="button " class="btn btn-link " data-dismiss="modal ">Close</button>
<button type="button " id="btnsavebangunan" class="btn btn-info ">Save changes</button>
</div>
</div>
</div>`;
content_delete=`
<div class="modal-dialog" style="width: max-content;height: max-content;">
<div class="modal-content">
<div class="modal-header bg-info" style="background-color:#40777c;">
<table>
<tr>
<th><h6 class="modal-title">Delete Bangunan dan Informasinya</h6></th>
<td><button type="button" class="close" data-dismiss="modal">&times;</button></td>
</tr>
</table>
</div>
<div class="form-group" style="margin-bottom:10px;">
<div id="map-delete" style="width: 300px;height: 250px;position: relative;margin-left: 10px;margin-right: 10px;margin-top: 10px;"></div>
<div class="form-group">
<div class="col-lg-12" style="margin-top:10px;margin-bottom:10px;">
<input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunanhps" value="">
<input type="text" name="idbangunan" id="idbangunanhps" class="form-control hidden" value="`+feature.properties.f1+`" disable>
<input type="text" name="namebangunan" id="namebangunanhps" class="form-control" value="`+feature.properties.f2+`">
<input type="text" name="infobangunan" id="infobangunanhps" class="form-control" value="`+feature.properties.f3+`">
</div>
</div>
</div>
// // var list_history = feature.properties.f7
// // var list_history_panel = ``
// // for (var i = 0; i < list_history.length; i++) {
// // var dt_history = list_history[i].split(",");
// // var data_history = `<div class="form-group" style="margin-bottom:0px;">
// // <div class="row">
// // <label class="col-md-6">` + dt_history[1] + `</label>
// // <a class="col-md-3" onclick="getjalanper(` + dt_history[0] + `)"><i>View Ruas</i></a>
// // <a class="col-md-3" onclick="getdetailper(` + dt_history[0] + `)" data-toggle="modal" data-target="#modal_detail"><i>View Detail</i></a>
// // </div>
// // </div>`;
// // list_history_panel += data_history
// // };
// // history = `<p class="text-center">
// // History Perbaikan
// // </p>
// // <br>
// // ` + list_history_panel + `
// // <p class="text-center" style="margin-top: 10px;">
// // <a href="#" id='btn_perbaikan_jalan' class="btn btn-default"><i>Tambah History Perbaikan</i></a>
// // </p>`;
// content_edit = `
// <div class="modal-dialog" style="width: max-content;height: max-content;">
// <div class="modal-content">
// <div class="modal-header bg-info" style="background-color:#40777c;">
// <button type="button" class="close" data-dismiss="modal">&times;</button>
// <h6 class="modal-title">Edit Polygon Bangunan dan Informasinya</h6>
// </div>
// <div class="modal-body" style="max-height: 450px;overflow-y: auto;">
// <div class="row">
// <div class="col-md-5">
// <div id="map-edit" style="width:400px;height: 350px;">
// </div>
// </div>
// <div class="col-md-4">
// <input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunan" value="`+feature.geometry+`">
// <table>
// <tr>
// <th>
// Image
// </th>
// <td>
// <input type="file" id="imgbangunan" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
// <input style="display:none;" id="gambar" type="text" class="form-control" value="`+feature.administrasi.f9+`"required>
// </td>
// </tr>
// <tr>
// <td>
// <input type="text" name="idbangunan" id="idbangunan" class="form-control hidden" value="`+feature.properties.f1+`" disable>
// <input style="display:none;" id="coordinateZoneeditbang" type="text" class="form-control" value=""required>
// </td>
// </tr>
// <tr>
// <th>Nama Bangunan</th>
// <td>
// <input type="text" name="namebangunan" id="namebangunan" class="form-control" value="`+feature.properties.f2+`">
// </td>
// </tr>
// <tr>
// <th>Informasi Bangunan</th>
// <td>
// <input type="text" name="infobangunan" id="infobangunan" class="form-control" value="`+feature.properties.f3+`">
// </td>
// </tr>
// <tr>
// <th>Kelurahan</th>
// <td>
// <input type=" text " name="nmkelurahan " id="nmkelurahan" class="form-control " value="`+feature.administrasi.f1+`">
// </td>
// </tr>
// <tr>
// <th>Kecamatan</th>
// <td>
// <input type="text " name="nmkecamatan " id="nmkecamatan" class="form-control " value="`+feature.administrasi.f2+`">
// </td>
// </tr>
// <tr>
// <th>Kab/Kota</th>
// <td>
// <input type="text " name="nmkabkota " id="nmkabkota" class="form-control " value="`+feature.administrasi.f3+`">
// </td>
// </tr>
// <tr>
// <th>Provinsi</th>
// <td>
// <input type="text " name="nmprovinsi " id="nmprovinsi" class="form-control " value="`+feature.administrasi.f4+`">
// </td>
// </tr>
<div class="modal-footer">
<button type="button" id="btnsavedeletebangunan" class="btn btn-info">Hapus</button>
</div>
</div>
</div>`;
content = `
<table class="table tasks-list">
<thead style="text-align: center;">
<tr>
<th style="padding: 0 0 0 0px;">
<img src=` + path_img + ` alt="Image" style="width: 100%;max-height: 368px;height:368">
</th>
</tr>
</thead>
<tbody>
<div class= "container">
<tr style="height: 100px;">
<th>
<div>
<h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
letter-spacing: 0;
font-weight: 400;">
<span style="font-size: x-large;">
` + feature.properties.f2 + `
</span>
</h1>
</div>
</th>
</tr>
</div>
<div class= "container">
<tr style="height: 30px;">
<th>
<span>
` + feature.properties.f3 + `
</span>
</th>
</tr>
</div>
<div class= "container">
<tr style="height: 40px;">
<th>
<span>
` + alamat + feature.administrasi.f1 + `, ` + feature.administrasi.f2 + `, ` + feature.administrasi.f3 + `, ` + feature.administrasi.f4 + `
</span>
</th>
</tr>
</div>
<div class= "container">
<tr style="height: 40px;">
<th>
<p>
<span>Luas Bangunan : ` + feature.administrasi.f6 + `</span>
</p>
<p>
<span>Luas Tanah : ` + feature.administrasi.f7 + `</span>
</p>
<p>
<span>Tinggi Bangunan : ` + feature.administrasi.f8 + `</span>
</p>
<p>
<span>Pemilik : ` + feature.administrasi.f10 + `</span>
</p>
<p class="text-center" style="margin-top: 25px;">
<a href="#" class="btn btn-default" data-toggle="modal" data-target="#modal_bangunan_edit" id="btn_edit_bangunan" data-backdrop="static" data-keyboard="false"><i>Edit Informasi Bangunan</i></a>
<a href="#" id='btn_delete_bangunan' class='btn
btn-default btn_edit_bangunan' data-toggle="modal" data-target="#modal_bangunan_delete" data-backdrop="static" data-keyboard="false"><i>Delete Bangunan</i></a>
</p>
</th>
</tr>
</div>
<div class="container">
<tr style="height: 40px;">
<th id="history_panel">
` + history + `
</th>
</tr>
</div>
</tbody>
</table>`;
$("#isi_panel").html(content);
$("#modal_bangunan_edit").html(content_edit);
$("#modal_bangunan_delete").html(content_delete);
});
// $('#idbangunan').val(feature.properties.f1);
// $('#namebangunan').val(feature.properties.f2);
// $('#infobangunan').val(feature.properties.f3);
// $('#nmkelurahan').val(feature.administrasi.f1);
// $('#nmkecamatan').val(feature.administrasi.f2);
// $('#nmkabkota').val(feature.administrasi.f3);
// $('#nmprovinsi').val(feature.administrasi.f4);
// $('#luasbangunan').val(feature.administrasi.f6);
// $('#luastanah').val(feature.administrasi.f7);
// $('#tinggibangunan').val(feature.administrasi.f8);
// $('#pemilik').val(feature.administrasi.f10);
// $('#gambar').val(feature.administrasi.f9);
// $("#coordinatebangunan").val(feature.geometry);
$("#panel-samping").css("display", "block");
$("#button_hide_panel").css("display", "block");
// </table>
// </div>
// $('#idbangunanhps').val(feature.properties.f1);
// $('#namebangunanhps').val(feature.properties.f2);
// $('#infobangunanhps').val(feature.properties.f3);
// <div class="col-md-3 ">
panel_samp()
}
});
// <table>
// <tr>
// <th>Luas Bangunan</th>
// <td>
// <input type="text " name="luasbangunan " id="luasbangunan" class="form-control " value="`+feature.administrasi.f6+`">
// </td>
// </tr>
// <tr>
// <th>Luas Tanah</th>
// <td>
// <input type="text " name="luastanah " id="luastanah" class="form-control " value="`+feature.administrasi.f7+`">
// </td>
// </tr>
// <tr>
// <th>Tinggi Bangunan</th>
// <td>
// <input type="text " name="tinggibangunan " id="tinggibangunan" class="form-control " value="`+feature.administrasi.f8+`">
// </td>
// </tr>
// <tr>
// <th>Pemilik</th>
// <td>
// <input type="text " name="pemilik " id="pemilik" class="form-control " value="`+feature.administrasi.f10+`">
// </td>
// </tr>
// </table>
// </div>
// </div>
// </div>
pool.push({
name: feature.properties.f2,
id: L.stamp(layer),
lat: lattitud,
lng: longitud
});
}
layer.on({
mouseover: function(e) {
var layer = e.target;
layer.setStyle({
weight: 1,
Color: "#067800",
fillColor: "#067800",
// <div class="modal-footer ">
// <button type="button " class="btn btn-link " data-dismiss="modal ">Close</button>
// <button type="button " id="btnsavebangunan" class="btn btn-info ">Save changes</button>
// </div>
// </div>
// </div>`;
// content_delete=`
// <div class="modal-dialog" style="width: max-content;height: max-content;">
// <div class="modal-content">
// <div class="modal-header bg-info" style="background-color:#40777c;">
// <table>
// <tr>
// <th><h6 class="modal-title">Delete Bangunan dan Informasinya</h6></th>
// <td><button type="button" class="close" data-dismiss="modal">&times;</button></td>
// </tr>
// </table>
// </div>
// <div class="form-group" style="margin-bottom:10px;">
// <div id="map-delete" style="width: 300px;height: 250px;position: relative;margin-left: 10px;margin-right: 10px;margin-top: 10px;"></div>
// <div class="form-group">
// <div class="col-lg-12" style="margin-top:10px;margin-bottom:10px;">
// <input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunanhps" value="">
// <input type="text" name="idbangunan" id="idbangunanhps" class="form-control hidden" value="`+feature.properties.f1+`" disable>
// <input type="text" name="namebangunan" id="namebangunanhps" class="form-control" value="`+feature.properties.f2+`">
// <input type="text" name="infobangunan" id="infobangunanhps" class="form-control" value="`+feature.properties.f3+`">
// </div>
// </div>
// </div>
});
if (!L.Browser.ie && !L.Browser.opera) {
layer.bringToFront();
}
},
mouseout: function(e) {
geo_bangunan.resetStyle(e.target);
}
});
}
});
// <div class="modal-footer">
// <button type="button" id="btnsavedeletebangunan" class="btn btn-info">Hapus</button>
// </div>
// </div>
// </div>`;
// content = `
// <table class="table tasks-list">
// <thead style="text-align: center;">
// <tr>
// <th style="padding: 0 0 0 0px;">
// <img src=` + path_img + ` alt="Image" style="width: 100%;max-height: 368px;height:368">
// </th>
// </tr>
// </thead>
// <tbody>
// <div class= "container">
// <tr style="height: 100px;">
// <th>
// <div>
// <h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
// letter-spacing: 0;
// font-weight: 400;">
// <span style="font-size: x-large;">
// ` + feature.properties.f2 + `
// </span>
// </h1>
// </div>
// </th>
// </tr>
// </div>
// <div class= "container">
// <tr style="height: 30px;">
// <th>
// <span>
// ` + feature.properties.f3 + `
// </span>
// </th>
// </tr>
// </div>
// <div class= "container">
// <tr style="height: 40px;">
// <th>
// <span>
// ` + alamat + feature.administrasi.f1 + `, ` + feature.administrasi.f2 + `, ` + feature.administrasi.f3 + `, ` + feature.administrasi.f4 + `
// </span>
// </th>
// </tr>
// </div>
// <div class= "container">
// <tr style="height: 40px;">
// <th>
// <p>
// <span>Luas Bangunan : ` + feature.administrasi.f6 + `</span>
// </p>
// <p>
// <span>Luas Tanah : ` + feature.administrasi.f7 + `</span>
// </p>
// <p>
// <span>Tinggi Bangunan : ` + feature.administrasi.f8 + `</span>
// </p>
// <p>
// <span>Pemilik : ` + feature.administrasi.f10 + `</span>
// </p>
// <p class="text-center" style="margin-top: 25px;">
// <a href="#" class="btn btn-default" data-toggle="modal" data-target="#modal_bangunan_edit" id="btn_edit_bangunan" data-backdrop="static" data-keyboard="false"><i>Edit Informasi Bangunan</i></a>
// <a href="#" id='btn_delete_bangunan' class='btn
// btn-default btn_edit_bangunan' data-toggle="modal" data-target="#modal_bangunan_delete" data-backdrop="static" data-keyboard="false"><i>Delete Bangunan</i></a>
// </p>
// </th>
// </tr>
// </div>
// <div class="container">
// <tr style="height: 40px;">
// <th id="history_panel">
// ` + history + `
// </th>
// </tr>
// </div>
// </tbody>
// </table>`;
// $("#isi_panel").html(content);
// $("#modal_bangunan_edit").html(content_edit);
// $("#modal_bangunan_delete").html(content_delete);
// });
// // $('#idbangunan').val(feature.properties.f1);
// // $('#namebangunan').val(feature.properties.f2);
// // $('#infobangunan').val(feature.properties.f3);
// // $('#nmkelurahan').val(feature.administrasi.f1);
// // $('#nmkecamatan').val(feature.administrasi.f2);
// // $('#nmkabkota').val(feature.administrasi.f3);
// // $('#nmprovinsi').val(feature.administrasi.f4);
// // $('#luasbangunan').val(feature.administrasi.f6);
// // $('#luastanah').val(feature.administrasi.f7);
// // $('#tinggibangunan').val(feature.administrasi.f8);
// // $('#pemilik').val(feature.administrasi.f10);
// // $('#gambar').val(feature.administrasi.f9);
// // $("#coordinatebangunan").val(feature.geometry);
// $("#panel-samping").css("display", "block");
// $("#button_hide_panel").css("display", "block");
function geo_json_bangunan(data) {
geo_bangunan.addData(data)
}
// // $('#idbangunanhps').val(feature.properties.f1);
// // $('#namebangunanhps').val(feature.properties.f2);
// // $('#infobangunanhps').val(feature.properties.f3);
// panel_samp()
// }
// });
var checkBox_building = document.getElementById("geo_building");
var checkBox_2d = document.getElementById("2d-maps");
// pool.push({
// name: feature.properties.f2,
// id: L.stamp(layer),
// lat: lattitud,
// lng: longitud
// });
// }
// layer.on({
// mouseover: function(e) {
// var layer = e.target;
// layer.setStyle({
// weight: 1,
// Color: "#067800",
// fillColor: "#067800",
map.on("movestart", function() {
geo_bangunan.clearLayers();
});
// });
// if (!L.Browser.ie && !L.Browser.opera) {
// layer.bringToFront();
// }
// },
// mouseout: function(e) {
// geo_bangunan.resetStyle(e.target);
// }
// });
// }
// });
map.on("moveend", function() {
var wetan = map.getBounds().getEast();
var kulon = map.getBounds().getWest();
var lor = map.getBounds().getNorth()
var kidul = map.getBounds().getSouth();
var center = map.getBounds().getCenter();
var zoom = map.getZoom();
// function geo_json_bangunan(data) {
// geo_bangunan.addData(data)
// }
if (checkBox_building.checked == true || checkBox_2d.checked == true) {
if (zoom > 17) {
if (map.hasLayer(geo_bangunan)) {
geo_bangunan.clearLayers()
geo_bangunan.remove()
}
$.ajax({
url: "{% url 'api:building' %}",
data: {
'wetan': wetan,
'kulon': kulon,
'lor': lor,
'kidul': kidul
},
dataType: 'json',
success: function(data) {
// var checkBox_building = document.getElementById("geo_building");
// var checkBox_2d = document.getElementById("2d-maps");
let list_poly = [];
for (var i = 0; i < data['gen'].length; i++) {
geoj = data['gen'][i][0];
list_poly.push(geoj);
};
geo_json_bangunan(list_poly);
}
});
}
// map.on("movestart", function() {
// geo_bangunan.clearLayers();
// });
geo_bangunan.addTo(map)
} else {
geo_bangunan.clearLayers();
geo_bangunan.remove()
}
});
// map.on("moveend", function() {
// var wetan = map.getBounds().getEast();
// var kulon = map.getBounds().getWest();
// var lor = map.getBounds().getNorth()
// var kidul = map.getBounds().getSouth();
// var center = map.getBounds().getCenter();
// var zoom = map.getZoom();
var map_edit = new L.map('map-edit', {
editable: true,
zoomControl: false,
drawControl: true
}).setView([-2, 118], 5);
// if (checkBox_building.checked == true || checkBox_2d.checked == true) {
mapss = L.tileLayer('https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
maxZoom: 22,
minZoom: 4,
}).addTo(map_edit);
// if (zoom > 17) {
// if (map.hasLayer(geo_bangunan)) {
// geo_bangunan.clearLayers()
// geo_bangunan.remove()
// }
// $.ajax({
// url: "{% url 'api:building' %}",
// data: {
// 'wetan': wetan,
// 'kulon': kulon,
// 'lor': lor,
// 'kidul': kidul
// },
// dataType: 'json',
// success: function(data) {
var polylyly = L.polygon([
[-4.1283969, 104.1674575],
[-4.128396, 104.1674947],
[-4.1284664, 104.1674964],
[-4.1284674, 104.1674593],
[-4.1283969, 104.1674575]
]).addTo(map_edit)
// let list_poly = [];
// for (var i = 0; i < data['gen'].length; i++) {
// geoj = data['gen'][i][0];
// list_poly.push(geoj);
// };
// geo_json_bangunan(list_poly);
// }
// });
// }
$(document).on("click", "#btn_edit_bangunan", function() {
if (map_edit.hasLayer(polylyly)) {
polylyly.remove()
}
var id_poly = $('#idbangunan').val();
loaderPage(true);
// geo_bangunan.addTo(map)
// } else {
// geo_bangunan.clearLayers();
// geo_bangunan.remove()
// }
// });
$.ajax({
url: "{% url 'api:edit' %}",
data: {
'id_poly': id_poly
},
dataType: 'json',
success: function(data) {
// var map_edit = new L.map('map-edit', {
// editable: true,
// zoomControl: false,
// drawControl: true
// }).setView([-2, 118], 5);
// mapss = L.tileLayer('https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
// maxZoom: 22,
// minZoom: 4,
// }).addTo(map_edit);
// var polylyly = L.polygon([
// [-4.1283969, 104.1674575],
// [-4.128396, 104.1674947],
// [-4.1284664, 104.1674964],
// [-4.1284674, 104.1674593],
// [-4.1283969, 104.1674575]
// ]).addTo(map_edit)
// $(document).on("click", "#btn_edit_bangunan", function() {
// if (map_edit.hasLayer(polylyly)) {
// polylyly.remove()
// }
// var id_poly = $('#idbangunan').val();
// loaderPage(true);
setTimeout(function() {
map_edit.invalidateSize();
}, 1000);
loaderPage(false);
// $.ajax({
// url: "{% url 'api:edit' %}",
// data: {
// 'id_poly': id_poly
// },
// dataType: 'json',
// success: function(data) {
map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
// setTimeout(function() {
// map_edit.invalidateSize();
// }, 1000);
// loaderPage(false);
// map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
let lop_poly_edit = data['geometry']['coordinates'][0][0];
let list_poly_edit = [];
for (var i = 0; i < lop_poly_edit.length; i++) {
geoj = lop_poly_edit[i][0];
polygigi = [lop_poly_edit[i][1], lop_poly_edit[i][0]]
list_poly_edit.push(polygigi);
};
polylyly = L.polygon(list_poly_edit).addTo(map_edit)
polylyly.enableEdit();
var hasil = (JSON.stringify(polyly.toGeoJSON()))
$('#btnsavebangunan').click(function() {
var hasil = (JSON.stringify(polylyly.toGeoJSON()))
$("#coordinatebangunan").val(hasil);
})
}
})
});
// let lop_poly_edit = data['geometry']['coordinates'][0][0];
// let list_poly_edit = [];
// for (var i = 0; i < lop_poly_edit.length; i++) {
// geoj = lop_poly_edit[i][0];
// polygigi = [lop_poly_edit[i][1], lop_poly_edit[i][0]]
// list_poly_edit.push(polygigi);
// };
$(document).on("click", "#btnsavebangunan", function() {
var data = new FormData();
data.append("file", $("input[id^='imgbangunan']")[0].files[0]);
data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
data.append('name_b', $('#namebangunan').val())
data.append('polygon', $('#coordinatebangunan').val())
data.append('info_b', $('#infobangunan').val())
data.append('desa_b', $('#nmkelurahan').val())
data.append('kec_b', $('#nmkecamatan').val())
data.append('kab_b', $('#nmkabkota').val())
data.append('pro_b', $('#nmprovinsi').val())
data.append('id_poly', $('#idbangunan').val())
data.append('gambar', $('#gambar').val())
data.append('luasbangunan', $('#luasbangunan').val())
data.append('luastanah', $('#luastanah').val())
data.append('tinggibangunan', $('#tinggibangunan').val())
data.append('pemilik', $('#pemilik').val())
// polylyly = L.polygon(list_poly_edit).addTo(map_edit)
// polylyly.enableEdit();
// var hasil = (JSON.stringify(polyly.toGeoJSON()))
// $('#btnsavebangunan').click(function() {
// var hasil = (JSON.stringify(polylyly.toGeoJSON()))
// $("#coordinatebangunan").val(hasil);
// })
// }
// })
// });
$.ajax({
url: "{% url 'api:validatedit' %}",
data: data,
dataType: 'json',
type: 'POST',
processData: false,
contentType: false,
success: function(data) {
let response = data
if (response.code == 0) {
swal({
title: response.info,
text: response.data,
type: "success",
icon: "success",
confirmButtonColor: "#00BCD4"
}, function() {
$("#modal_bangunan_edit").css('display', 'none');
})
} else {
swal({
title: response.info,
text: response.data,
type: "warning",
icon: "error",
confirmButtonColor: "#00BCD4"
})
// $(document).on("click", "#btnsavebangunan", function() {
// var data = new FormData();
// data.append("file", $("input[id^='imgbangunan']")[0].files[0]);
// data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
// data.append('name_b', $('#namebangunan').val())
// data.append('polygon', $('#coordinatebangunan').val())
// data.append('info_b', $('#infobangunan').val())
// data.append('desa_b', $('#nmkelurahan').val())
// data.append('kec_b', $('#nmkecamatan').val())
// data.append('kab_b', $('#nmkabkota').val())
// data.append('pro_b', $('#nmprovinsi').val())
// data.append('id_poly', $('#idbangunan').val())
// data.append('gambar', $('#gambar').val())
// data.append('luasbangunan', $('#luasbangunan').val())
// data.append('luastanah', $('#luastanah').val())
// data.append('tinggibangunan', $('#tinggibangunan').val())
// data.append('pemilik', $('#pemilik').val())
}
}
})
// $.ajax({
// url: "{% url 'api:validatedit' %}",
// data: data,
// dataType: 'json',
// type: 'POST',
// processData: false,
// contentType: false,
// success: function(data) {
// let response = data
// if (response.code == 0) {
// swal({
// title: response.info,
// text: response.data,
// type: "success",
// icon: "success",
// confirmButtonColor: "#00BCD4"
// }, function() {
// $("#modal_bangunan_edit").css('display', 'none');
// })
// } else {
// swal({
// title: response.info,
// text: response.data,
// type: "warning",
// icon: "error",
// confirmButtonColor: "#00BCD4"
// })
});
// }
// }
// })
$(document).on("click", "#btn_delete_bangunan", function() {
var map_delete = new L.map('map-delete', {
editable: true,
zoomControl: false,
drawControl: true
}).setView([-2, 118], 5);
// });
mapss = L.tileLayer('https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
maxZoom: 22,
minZoom: 4,
}).addTo(map_delete);
var id_polyhps = $('#idbangunanhps').val();
// console.log(id_polyhps)
loaderPage(true);
// $(document).on("click", "#btn_delete_bangunan", function() {
// var map_delete = new L.map('map-delete', {
// editable: true,
// zoomControl: false,
// drawControl: true
// }).setView([-2, 118], 5);
// mapss = L.tileLayer('https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
// maxZoom: 22,
// minZoom: 4,
// }).addTo(map_delete);
// var id_polyhps = $('#idbangunanhps').val();
// // console.log(id_polyhps)
// loaderPage(true);
$.ajax({
url: "{% url 'api:edit' %}",
data: {
'id_poly': id_polyhps
},
dataType: 'json',
success: function(data) {
// $.ajax({
// url: "{% url 'api:edit' %}",
// data: {
// 'id_poly': id_polyhps
// },
// dataType: 'json',
// success: function(data) {
setTimeout(function() {
map_delete.invalidateSize();
}, 1000);
loaderPage(false);
// setTimeout(function() {
// map_delete.invalidateSize();
// }, 1000);
// loaderPage(false);
map_delete.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
// map_delete.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
let lop_poly_edit = data['geometry']['coordinates'][0][0];
let list_poly_edit = [];
for (var i = 0; i < lop_poly_edit.length; i++) {
geoj = lop_poly_edit[i][0];
polygigi = [lop_poly_edit[i][1], lop_poly_edit[i][0]]
list_poly_edit.push(polygigi);
};
// let lop_poly_edit = data['geometry']['coordinates'][0][0];
// let list_poly_edit = [];
// for (var i = 0; i < lop_poly_edit.length; i++) {
// geoj = lop_poly_edit[i][0];
// polygigi = [lop_poly_edit[i][1], lop_poly_edit[i][0]]
// list_poly_edit.push(polygigi);
// };
var polyly = L.polygon(list_poly_edit).addTo(map_delete)
$('#btnsavedeletebangunan').click(function() {
var hasil = (JSON.stringify(polyly.toGeoJSON()))
$("#coordinatebangunan").val(hasil);
})
}
})
});
// var polyly = L.polygon(list_poly_edit).addTo(map_delete)
// $('#btnsavedeletebangunan').click(function() {
// var hasil = (JSON.stringify(polyly.toGeoJSON()))
// $("#coordinatebangunan").val(hasil);
// })
// }
// })
// });
$(document).on("click", "#btnsavedeletebangunan", function() {
// $(document).on("click", "#btnsavedeletebangunan", function() {
var data = new FormData();
data.append('id_poly', $('#idbangunan').val())
// var data = new FormData();
// data.append('id_poly', $('#idbangunan').val())
$.ajax({
url: "{% url 'api:hapus' %}",
data: data,
dataType: 'json',
type: 'POST',
processData: false,
contentType: false,
success: function(data) {
let response = data
if (response.code == 0) {
swal({
title: response.info,
text: response.data,
type: "success",
icon: "success",
confirmButtonColor: "#00BCD4"
}, function() {
$("#modal_bangunan_delete").css('display', 'none');
})
} else {
swal({
title: 'Error',
text: 'Hubungi Mereka',
type: "warning",
icon: "error",
confirmButtonColor: "#00BCD4"
})
}
}
})
// $.ajax({
// url: "{% url 'api:hapus' %}",
// data: data,
// dataType: 'json',
// type: 'POST',
// processData: false,
// contentType: false,
// success: function(data) {
// let response = data
// if (response.code == 0) {
// swal({
// title: response.info,
// text: response.data,
// type: "success",
// icon: "success",
// confirmButtonColor: "#00BCD4"
// }, function() {
// $("#modal_bangunan_delete").css('display', 'none');
// })
// } else {
// swal({
// title: 'Error',
// text: 'Hubungi Mereka',
// type: "warning",
// icon: "error",
// confirmButtonColor: "#00BCD4"
// })
// }
// }
// })
});
// });
var geo_jalan = L.geoJson(null, {
style: function(feature) {
......@@ -2074,7 +2074,7 @@
layer.on({
click: function(e) {
var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
if (feature.properties.f6 == 'NONE') {
if (feature.properties.f6 == 'None') {
var path_img = "static/img/image_null.jpg"
} else {
var path_img = `"static/image/jalan/` + feature.properties.f6 + `"`
......
......@@ -126,6 +126,7 @@
<div class="modal-body" style="max-height: 450px;overflow-y: auto;">
<div class="tab-pane has-padding" id="panel-tab2">
<div class="tab-pane" id="bottom-justified-data">
<input type="text" name="idjalan" id="idjalan" class="form-control hidden" value="">
<div class="tabbable">
<ul class="nav nav-tabs nav-tabs-bottom nav-justified">
......@@ -140,7 +141,7 @@
<div class="form-group">
<label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
<div class="col-lg-9" style="margin-top:10px">
<input type="file" id="imgbangunan" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
<input type="file" id="imgjalan" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
</div>
</div>
</div>
......@@ -149,8 +150,8 @@
<div class="row" style="height: 337px;">
<input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunan" value="">
<input type="text" name="idbangunan" id="idbangunan" class="form-control hidden" value="" disable>
<input type="text" class="hidden" name="coordinatejalan" id="coordinatejalan" value="">
<input type="text" name="idjalan" id="idjalan" class="form-control hidden" value="" disable>
<table style="margin-left: 50px;
width: 100vh;">
<tr>
......@@ -199,7 +200,7 @@
<div class="modal-footer ">
<button type="button" class="btn btn-link" onclick="destroyfade()" data-dismiss="modal">Close</button>
<button type="button" id="btnsavebangunan" class="btn btn-info">Save changes</button>
<button type="button" id="btnsavejalan" class="btn btn-info">Save changes</button>
</div>
</div>
</div>
......@@ -471,7 +472,7 @@
<div class="row" style="margin-top: 15px;">
<div class="form-group">
<label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
<label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Jenis Point</label>
<div class="col-lg-9">
<select style="border-bottom: 1px solid rgb(83, 83, 83) !important;" id="tipe_point" data-placeholder="select point.." class="select-size-md">
<option value="null" selected disabled>-- Pilih Jenis Point --</option>
......@@ -494,9 +495,11 @@
<div class="row" style="margin-top: 15px;">
<div class="form-group">
<label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Informasi Bangunan</label>
<label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
<div class="col-lg-9">
<input id="info_create_point" type="text" class="form-control" value="" placeholder="Rumah/Gedung/Ruko/Pabrik/dsb" required>
<select style="border-bottom: 1px solid rgb(83, 83, 83) !important;width: 220px;" id="tipe_point_2" data-placeholder="select point.." class="select-size-md">
<option value="null" selected disabled>-- Pilih Tipe Point --</option>
</select>
</div>
</div>
</div>
......@@ -578,3 +581,32 @@
</div>
</div>
</div>
<script>
$("#tipe_point").change(function() {
var tipe = $(this).val();
$.ajax({
url: "{% url 'api:change-tipe' %}",
data: {
'tipe': tipe
},
dataType: 'json',
success: function(data) {
console.log(data)
var data_all_kab = []
for (var i = 0; i < data['result'].length; i++) {
var data_k = data['result'][i][0];
console.log(data_k)
var data_kab = `<option value="` +
data_k +
`">` +
data_k +
`</option>`;
data_all_kab.push(data_kab)
};
$('#tipe_point_2').html(`<option value="null" selected disabled>-- Pilih Tipe Point --</option>` + data_all_kab);
}
});
});
</script>
\ No newline at end of file
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