Commit d81d1276 authored by Manggar Mahardhika's avatar Manggar Mahardhika

push +fungsi kecamatan blomberes

parent 19bec183
......@@ -75,7 +75,7 @@ urlpatterns = [
path('create-point', views.createpoint, name='create-point'),
path('c_lahan', views.createlahan, name='c_lahan'),
path('edit-tuplah', login_required(views.edittuplah), name='edit-tuplah'),
path('edit-tuplah', views.edittuplah, name='edit-tuplah'),
path('edit-tuplah-valid', views.edittuplahvalid, name='edit-tuplah-valid'),
path('edit-jalan', views.editjalan, name='edit-jalan'),
......
......@@ -34,7 +34,7 @@ def group_required(group, login_url=None, raise_exception=False):
return True
if raise_exception:
print('raise')
# print('raise')
raise PermissionDenied("dilarang")
return False
......@@ -532,7 +532,27 @@ def tuplah(request):
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def kecamatan(request):
with conn.cursor() as kecamatan:
kecamatan.execute(f"""SELECT kecamatan, json_build_object('type', 'Feature', 'administrasi', (id, kecamatan),'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_data_kecamatan""")
kecamatan.execute(f"""SELECT
json_build_object (
'type',
'Feature',
'administrasi',
(
A.ID,
A.kecamatan,
SUM ( b.jumlah_pen ),
SUM ( b.jumlah_kk ),
st_area ( A.geom :: geography )
),
'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json
)
FROM
geo_data_kecamatan
A JOIN geo_data_kelurahan b ON A.kecamatan = b.kecamatan
GROUP BY
A.ID,
A.kecamatan""")
kec_res_ = kecamatan.fetchall()
# ltup = []
# for i in all:
......@@ -540,7 +560,7 @@ def kecamatan(request):
# ltup.append(i[0])
kec_res = []
for i in kec_res_:
kec_res.append(i[1])
kec_res.append(i[0])
data = {'kecamatan':kec_res}
return Response(data)
......@@ -548,7 +568,7 @@ def kecamatan(request):
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def desangab(request):
with conn.cursor() as desa:
desa.execute(f"""SELECT json_build_object('type', 'Feature', 'administrasi', (kode_desa, desa, kecamatan, kab_kota, provinsi, jumlah_pen, jumlah_kk, luas_desa, gambar),'penduduk', (pria, wanita, belum_kawin, kawin, cerai_hidup, cerai_mati, wajib_ktp, islam, kristen, khatolik, hindu, budha, konghucu, kepercayaan_lain, u0, u5, u10, u15, u20, u25, u30, u35, u40, u45, u50, u55, u60, u65, u70, u75),'pekerjaan_pendidikan', (tidak_sekolah, belum_tamat, tamat_sd, sltp, slta, diploma_i, diploma_ii, diploma_iv, strata_ii, strata_iii, tidak_bekerja, aparatur_pemerintah, tenaga_pendidik, wiraswasta, pertanian, tenaga_kesehatan, pensiunan, pegawai, tentara, kepolisian, pedagang, petani, peternak, nelayan, karyawan, buruh, pembantu, tukang, pendeta, pastor, ustadz, dosen, guru, pilot, pengacara, notaris, arsitek, akuntan, konsultan, dokter, bidan, perawat, psikiater, sopir, lainnya), 'poi',(jml_puskesma, jml_sekolah, jml_sarib),'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_data_kelurahan""")
desa.execute(f"""SELECT json_build_object('type', 'Feature', 'administrasi', (kode_desa, desa, kecamatan, kab_kota, provinsi, jumlah_pen, jumlah_kk, luas_desa, gambar, st_area ( geom :: geography )),'penduduk', (pria, wanita, belum_kawin, kawin, cerai_hidup, cerai_mati, wajib_ktp, islam, kristen, khatolik, hindu, budha, konghucu, kepercayaan_lain, u0, u5, u10, u15, u20, u25, u30, u35, u40, u45, u50, u55, u60, u65, u70, u75),'pekerjaan_pendidikan', (tidak_sekolah, belum_tamat, tamat_sd, sltp, slta, diploma_i, diploma_ii, diploma_iv, strata_ii, strata_iii, tidak_bekerja, aparatur_pemerintah, tenaga_pendidik, wiraswasta, pertanian, tenaga_kesehatan, pensiunan, pegawai, tentara, kepolisian, pedagang, petani, peternak, nelayan, karyawan, buruh, pembantu, tukang, pendeta, pastor, ustadz, dosen, guru, pilot, pengacara, notaris, arsitek, akuntan, konsultan, dokter, bidan, perawat, psikiater, sopir, lainnya), 'poi',(jml_puskesma, jml_sekolah, jml_sarib),'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_data_kelurahan""")
desa_res_ = desa.fetchall()
# ltup = []
# for i in all:
......@@ -631,7 +651,7 @@ def jalan(request):
kulon = request.GET.get("kulon")
lor = request.GET.get("lor")
kidul = request.GET.get("kidul")
print(kulon, lor, wetan, lor, wetan, kidul, kulon, kidul, kulon, lor, kulon, lor, wetan, lor, wetan, kidul, kulon, kidul, kulon, lor)
# 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, 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))
......@@ -684,7 +704,7 @@ def editjalanvalid(request):
file = request.FILES.get('file')
idjalan = request.POST.get('idjalan')
namajalan = request.POST.get('namajalan')
print(namajalan)
# print(namajalan)
panjangjalan = request.POST.get('panjangjalan')
tipejalan = request.POST.get('tipejalan')
lebarjalan = request.POST.get('lebarjalan')
......@@ -760,7 +780,7 @@ def editpointsearch(request):
else:
l = "a.luas_tanah"
print(id_point, db_point, l)
# print(id_point, db_point, l)
with conn.cursor() as buldings:
buldings.execute("""SELECT
json_build_object (
......@@ -1270,7 +1290,7 @@ def validatedit(request):
namapoin = request.POST.get('napo')
co_edit = cood_edit['geometry']['coordinates']
print(co_edit)
# print(co_edit)
file = request.FILES.get('file')
......@@ -1301,7 +1321,7 @@ def validatedit(request):
url = fss.url(filename)
except:
namafile = gmb_b
print(co_edit,name_b, info_b, desa_b, kec_b, kab_b, pro_b, namafile, int(id_poly))
# 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, luas_bangunan=%s, luas_tanah=%s, tinggi_bangunan=%s, pemilik='%s', type_id = 1, point_id=%s, remark='%s', db_tipe='%s', point_name='%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, pointopeto, rem, tdb, namapoin, int(id_poly)))
......@@ -1321,7 +1341,7 @@ def validatedit(request):
'info':info,
'code':status,
}
print(respon)
# print(respon)
return Response(respon)
......@@ -1350,7 +1370,7 @@ def hapus(request):
'info':info,
'code':status,
}
print(respon)
# print(respon)
return Response(respon)
......@@ -1358,9 +1378,8 @@ def hapus(request):
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def hasilsearch(request):
if request.method == 'GET':
nama_desa = request.GET.get("id_desa_search")
nama_desa = nama_desa.split(",")[0]
nama_desa1 = request.GET.get("id_desa_search")
nama_desa = nama_desa1.split(",")[0]
with conn.cursor() as bts:
bts.execute("""
SELECT
......@@ -1438,6 +1457,7 @@ def hasilsearch(request):
o_poly = []
for x in i[0]['geometry']['coordinates'][0][0]:
o_pol1 += (f'{x[0]},{x[1]}""')
# print(o_pol1)
o_pol2 = o_pol1.replace('""1',',1')
......@@ -1494,7 +1514,7 @@ def hasilsearch(request):
long_po.append(i[0]['geometry']['coordinates'][0])
info_po.append(i[0]['administrasi']['f15'])
rema_po.append(i[0]['administrasi']['f2'])
print(rema_po)
# print(rema_po)
kantor_administrasi_result = []
for i in kantor_administrasi_res:
......@@ -2214,7 +2234,7 @@ def editsearchpoint(request):
url = fss.url(filename)
except:
namafile = gambar
print(dbsave, co_edit, namobj, alamat, remark, l, luas, perangkat, namafile, idsave)
# print(dbsave, co_edit, namobj, alamat, remark, l, luas, perangkat, namafile, idsave)
with conn.cursor() as editspo:
editspo.execute("""update %s set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', alamat = '%s', remark = '%s', %s = '%s', perangkat = '%s', gambar = '%s' where id = %s"""% (dbsave, co_edit, namobj, alamat, remark, l, luas, perangkat, namafile, idsave))
conn.commit()
......@@ -2865,7 +2885,7 @@ def editgardu(request):
return Response(respon)
@api_view(('GET',))
@group_required(('Dinas Pekerjaan Umum dan Penataan Ruang', 'Dinas Perumahan dan Kawasan Permukiman', 'Dinas Lingkungan Hidup'), login_url='/')
# @group_required(('Dinas Pekerjaan Umum dan Penataan Ruang', 'Dinas Perumahan dan Kawasan Permukiman', 'Dinas Lingkungan Hidup','Superadmin'), login_url='/')
def edittuplah(request):
idtuplah = request.GET.get('idtuplah')
......@@ -2892,7 +2912,7 @@ def edittuplah(request):
return Response(respon)
@api_view(('POST',))
@group_required(('Dinas Pekerjaan Umum dan Penataan Ruang', 'Dinas Perumahan dan Kawasan Permukiman', 'Dinas Lingkungan Hidup'),login_url='/')
@group_required(('Dinas Pekerjaan Umum dan Penataan Ruang', 'Dinas Perumahan dan Kawasan Permukiman', 'Dinas Lingkungan Hidup','Superadmin'),login_url='/')
def edittuplahvalid(request):
file = request.FILES.get('file')
idtuplah = request.POST.get('idtuplah')
......@@ -2922,8 +2942,6 @@ def edittuplahvalid(request):
data = 'Sorry'
info = 'Hubungi Developer'
status = 1
respon={'data':data, 'info':info, 'code':status}
return Response(respon)
......@@ -2933,7 +2951,7 @@ def maps3d(request):
lattt = request.GET.get('latt')
longg = request.GET.get('loog')
print(lattt, type(longg))
# print(lattt, type(longg))
with conn.cursor() as gp3:
gp3.execute("""select json_build_object('type', 'Feature', 'properties', (id, name, information), 'administrasi',(address_1, address_2, address_3, provinsi, alamat, luas_bangunan, luas_tanah, tinggi_bangunan, gambar, pemilik, tampak_atas, tampak_depan), 'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_bangunan WHERE ST_DistanceSphere(geom, ST_MakePoint(%s,%s)) <= 400 LIMIT 1000"""%(float(longg), float(lattt)))
polygon_buildings = gp3.fetchall()
......@@ -2967,9 +2985,9 @@ def createbang(request):
name = request.GET.get('name')
tipedb = request.GET.get('tipedb')
poin = request.GET.get('poin_id')
print(poin)
# print(poin)
nama_poin = request.GET.get('nama_po')
print(nama_poin)
# print(nama_poin)
remark = request.GET.get('remark')
info = request.GET.get('info')
......@@ -2982,8 +3000,8 @@ def createbang(request):
namafile = "None"
latlng = po_create.split("],[")[0]
print(p_create)
print(latlng)
# print(p_create)
# print(latlng)
if name == "":
name = "None"
......@@ -3040,7 +3058,7 @@ def createbang(request):
tb = tibang
except:
tb = 3
print(tb)
# print(tb)
try:
if ltbang == "" and tibang != "":
......@@ -3052,13 +3070,13 @@ def createbang(request):
ltb = ltbang
except:
ltb = 1
print(ltb)
# print(ltb)
if kilimep == "":
pemilik = "unnamed"
else:
pemilik = kilimep
print(pemilik)
# print(pemilik)
# try:
......@@ -3136,7 +3154,7 @@ def upload_tampak(request):
'info':info,
'code':status,
}
print(respon)
# print(respon)
return Response(respon)
......@@ -3156,8 +3174,8 @@ def createlahan(request):
gambar = "NONE"
latlng = po_create.split("],[")[0]
print(p_create)
print(latlng)
# print(p_create)
# print(latlng)
if name == "":
name = "Sumatera Selatan"
......@@ -3193,9 +3211,9 @@ def createjalan(request):
panjang_jalan = re.sub('[^0-9.]+', '', str(panjang_jalan))
if lebar_jalan == '':
lebar_jalan = 0
print(panjang_jalan)
# print(panjang_jalan)
coord = json.loads(str(polyline))
print(coord)
# print(coord)
try:
if coord['features'][0]['geometry']['type'] == 'LineString':
......@@ -3340,8 +3358,8 @@ def createpoint(request):
luas_tanah_point = request.POST.get('luas_tanah_point')
pemilik_point = request.POST.get('pemilik_point')
print(tipe_point)
print(info_create_point)
# print(tipe_point)
# print(info_create_point)
coord = json.loads(str(co_point))
......@@ -3580,7 +3598,7 @@ def filt_perbaikan_desa(request):
respon = {'res_perbaikan':res_all}
return Response(respon)
@api_view(('GET',))
from django.http import JsonResponse
def user_data(request):
with conn.cursor() as userlist_:
......@@ -3635,7 +3653,9 @@ def user_data(request):
ORDER BY
au.username ASC"""
else:
print('not staff')
userlist_.execute(sql)
allUser = userlist_.fetchall()
......@@ -3769,7 +3789,7 @@ def user_data(request):
'point':point,
'group':group,
}
return Response(respon)
return JsonResponse(respon)
......
......@@ -97,7 +97,7 @@ var request = new XMLHttpRequest();
request.open("GET", "../static/batas.json", false);
request.send(null)
var batas = JSON.parse(request.responseText);
console.log(batas);
// console.log(batas);
var geo_batas = L.geoJson(batas, {
style: function(feature) {
......@@ -569,6 +569,12 @@ $("#id_kab").change(function() {
// });
$.ajaxSetup({
headers: {
'Csrf-Token': $('meta[name="csrf-token"]').attr('content')
}
});
jQuery(document).ajaxSend(function(event, xhr, settings) {
function getCookie(name) {
var cookieValue = null;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -111,7 +111,7 @@ function batas_desa_desa() {
$(".kode_kelurahan").html(feature.administrasi.f1)
$(".jumlah_penduduk_kelurahan").html(feature.administrasi.f6)
$(".luas_wilayah_kelurahan").html(feature.administrasi.f10)
$(".luas_wilayah_kelurahan").html(feature.administrasi.f10.toFixed(3)+' m2')
$(".jumlah_kk_kelurahan").html(feature.administrasi.f7)
$(".tombol-edit").html(`<a href="/editkelurahan?kode_dagri=` + encodeURIComponent(feature.administrasi.f1) + `" class='btn'>Edit</a>`)
......@@ -784,11 +784,24 @@ var geo_batas_kec = L.geoJson(null, {
geo_batas_kec.resetStyle(e.target);
},
click: function(e) {
$("modal_kecamatan").modal('show');
// var geocodeService = L.esri.Geocoding.geocodeService();
// var geocoderNominatim = new L.Control.Geocoder.Nominatim();
// var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
console.log(feature.administrasi.f1)
// console.log(feature.administrasi)
$('#modal_detail_kelurahan').modal('show');
$(".nama_kelurahan").html(feature.administrasi.f2)
$(".kode_kelurahan").html('-')
$(".jumlah_penduduk_kelurahan").html(feature.administrasi.f3)
$(".luas_wilayah_kelurahan").html(feature.administrasi.f5.toFixed(3)+' m2')
$(".jumlah_kk_kelurahan").html(feature.administrasi.f4)
$(".tombol-edit").html(`<a href="#" class='btn' data-toggle="modal" data-target="#modal_kecamatan" id="btn_edit_kec" data-backdrop="static" data-keyboard="false"><i>Edit</i></a>`)
// $(".tombol-edit").html(`<a href="/editkelurahan?kode_dagri=` + encodeURIComponent(feature.administrasi.f1) + `" class='btn'>Edit</a>`)
// $("modal_kecamatan").modal('show');
// // var geocodeService = L.esri.Geocoding.geocodeService();
// // var geocoderNominatim = new L.Control.Geocoder.Nominatim();
// // var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
// console.log(feature.administrasi.f1)
content_edit_kec = `
<div class="modal-dialog modal-md">
<div class="modal-content">
......@@ -1017,9 +1030,6 @@ $("#search_desa").keyup(function() {
});
//3d begin
function setsearch(element) {
var value = $(element).text();
......@@ -1267,6 +1277,7 @@ $(document).on("click", "#btn_edit_tuplah", function() {
var id_poly = $('#idtuplah').val();
var lwastup = $("#lwastuplah").val();
$("#modal_detail_non_kelurahan").modal("hide")
$.ajax({
url: "api/edit-tuplah",
......@@ -1276,7 +1287,9 @@ $(document).on("click", "#btn_edit_tuplah", function() {
dataType: 'json',
success: function(data) {
$("#modal-edit-tuplah").modal("show")
$("#modal_detail_non_kelurahan").modal("toggle")
$(".modal_detail_non_kelurahan").modal("hide")
console.log(data)
loaderPage(false);
$("#luas_tuplah_edit").val(lwastup);
let response = data
......@@ -1313,7 +1326,7 @@ $(document).on("click", "#btn_edit_tuplah", function() {
var seeArea = L.GeometryUtil.geodesicArea(polygon_edit_tuplah.getLatLngs()[0]);
var fixarea = seeArea.toFixed(3)
var separ = fixarea.toString().split(".");
var areacom = separ.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
// var areacom = separ.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
separ.join(".");
$("#luas_tuplah_edit").val(fixarea);
})
......@@ -1336,10 +1349,6 @@ $(document).on("click", "#btn_edit_tuplah", function() {
})
});
// $(document).on("click", "#btnsavetuplah", function() {
// });
$(document).on("click", "#btnsavetuplah", function() {
var id_poly = $('#idtuplah').val();
var cord = $("#coordinatetuplah").val();
......@@ -1389,598 +1398,6 @@ $(document).on("click", "#btnsavetuplah", function() {
});
// 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">
// ` + 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");
// // $('#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: "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() {
// if (map_edit.hasLayer(polylyly)) {
// polylyly.remove()
// }
// var id_poly = $('#idbangunan').val();
// loaderPage(true);
// $.ajax({
// 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);
// };
// 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);
// })
// }
// })
// });
// $(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: "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: "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: "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) {
var zoom = map.getZoom()
......
......@@ -390,7 +390,7 @@
<div class="col-md-6">
<div>
<div>
<span>Kode Desa</span>
<span>Kode</span>
</div>
<div>
<span class="kode_kelurahan">1234</span>
......
......@@ -70,7 +70,7 @@
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<!-- <script src="https://cesium.com/downloads/cesiumjs/releases/1.78/Build/Cesium/Cesium.js"></script> -->
<!-- <script src="/static/Cesium-185/Build/Cesium/Cesium.js"></script> -->
<script src="/static/Cesium-185/Build/Cesium/Cesium.js"></script>
<link href="{% static 'css/widgets.css' %}" rel="stylesheet">
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.css">
......
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