Commit 96f254b9 authored by Manggar Mahardhika's avatar Manggar Mahardhika

push

parent 1dc705f3
...@@ -48,6 +48,7 @@ urlpatterns = [ ...@@ -48,6 +48,7 @@ urlpatterns = [
path('dkantor', views.deletekantoradmin, name='dkantor'), path('dkantor', views.deletekantoradmin, name='dkantor'),
path('change-tipe', views.changetipe, name='change-tipe'), path('change-tipe', views.changetipe, name='change-tipe'),
path('change-jenis', views.changejenis, name='change-jenis'),
path('c_bangunan', views.createbang, name='c_bangunan'), path('c_bangunan', views.createbang, name='c_bangunan'),
path('create-jalan', views.createjalan, name='create-jalan'), path('create-jalan', views.createjalan, name='create-jalan'),
......
...@@ -82,7 +82,7 @@ def building(request): ...@@ -82,7 +82,7 @@ def building(request):
# kulon lor, wetan lor, wetan kidul, kulon kidul, kulon lor # kulon lor, wetan lor, wetan kidul, kulon kidul, kulon lor
with conn.cursor() as buldings: with conn.cursor() as buldings:
buldings.execute("SELECT json_build_object('type', 'Feature', 'properties', (id, name, information), 'administrasi',(address_1, address_2, address_3, provinsi, alamat, luas_bangunan, luas_tanah, tinggi_bangunan, gambar, pemilik), 'geometry', ST_AsGeoJSON(geom :: geometry) :: json) FROM geo_bangunan WHERE st_intersects(geom,'SRID=0;POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))')"% (kulon, lor, wetan, lor, wetan, kidul, kulon, kidul, kulon, lor)) buldings.execute("SELECT json_build_object('type', 'Feature', 'properties', (id, name, information), 'administrasi',(address_1, address_2, address_3, provinsi, alamat, luas_bangunan, luas_tanah, tinggi_bangunan, gambar, pemilik, db_tipe, remark, point_id, point_name), 'geometry', ST_AsGeoJSON(geom :: geometry) :: json) FROM geo_bangunan WHERE st_intersects(geom,'SRID=0;POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))')"% (kulon, lor, wetan, lor, wetan, kidul, kulon, kidul, kulon, lor))
prov_res = buldings.fetchall() prov_res = buldings.fetchall()
polbang = [] polbang = []
...@@ -193,7 +193,7 @@ def editpoly(request): ...@@ -193,7 +193,7 @@ def editpoly(request):
if request.method == 'GET': if request.method == 'GET':
id_poly = request.GET.get("id_poly") id_poly = request.GET.get("id_poly")
with conn.cursor() as buldings: with conn.cursor() as buldings:
buldings.execute("SELECT json_build_object('type', 'Feature', 'properties', (id, name, information, 'osm'), 'administrasi',(address_1, address_2, address_3, provinsi, alamat, luas_bangunan, luas_tanah, tinggi_bangunan, gambar, pemilik), 'geometry', ST_AsGeoJSON(geom :: geometry) :: json) FROM geo_bangunan WHERE id = %s"% int(id_poly)) buldings.execute("SELECT json_build_object('type', 'Feature', 'properties', (id, name, information, 'osm'), 'administrasi',(address_1, address_2, address_3, provinsi, alamat, luas_bangunan, luas_tanah, tinggi_bangunan, gambar, pemilik, db_tipe, remark, point_id), 'geometry', ST_AsGeoJSON(geom :: geometry) :: json) FROM geo_bangunan WHERE id = %s"% int(id_poly))
build = buldings.fetchall() build = buldings.fetchall()
return Response(build[0][0]) return Response(build[0][0])
...@@ -1512,6 +1512,9 @@ def createbang(request): ...@@ -1512,6 +1512,9 @@ def createbang(request):
po_create = p_create.replace(', ','],[') po_create = p_create.replace(', ','],[')
name = request.GET.get('name') name = request.GET.get('name')
tipedb = request.GET.get('tipedb')
poin = request.GET.get('poin')
remark = request.GET.get('remark')
info = request.GET.get('info') info = request.GET.get('info')
atalam = request.GET.get('alamat') atalam = request.GET.get('alamat')
lb = request.GET.get('lb') lb = request.GET.get('lb')
...@@ -1545,7 +1548,20 @@ def createbang(request): ...@@ -1545,7 +1548,20 @@ def createbang(request):
else: else:
lt = lt lt = lt
if tipedb == "":
tdb = "bangunan"
else:
tdb = tipedb
if poin == "":
pointopeto = 0
else:
pointopeto = poin
if remark == "":
rem = "bangunan"
else:
rem = remark
if atalam == "": if atalam == "":
alamat = "None" alamat = "None"
...@@ -1573,7 +1589,6 @@ def createbang(request): ...@@ -1573,7 +1589,6 @@ def createbang(request):
ltb = ltbang ltb = ltbang
except: except:
ltb = 0 ltb = 0
print(ltb)
if kilimep == "": if kilimep == "":
pemilik = "unnamed" pemilik = "unnamed"
else: else:
...@@ -1581,7 +1596,6 @@ def createbang(request): ...@@ -1581,7 +1596,6 @@ def createbang(request):
print(pemilik) print(pemilik)
# try: # try:
with conn.cursor() as kel: 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) kel.execute("SELECT desa, kecamatan, kab_kota, provinsi FROM geo_data_kelurahan WHERE st_intersects(geom, 'SRID=4326;POINT(%s)'::geometry)"% latlng)
...@@ -1590,7 +1604,7 @@ def createbang(request): ...@@ -1590,7 +1604,7 @@ def createbang(request):
administrasi = adm[0] administrasi = adm[0]
with conn.cursor() as buldings: 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, 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 )) 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, point_id, type_id, remark, db_tipe) VALUES (ST_GeomFromEWKT('SRID=0;MULTIPOLYGON(((%s)))'), '%s', '%s', 'new', '%s', '%s', '%s', '%s', '%s', '0', '%s', '%s', '%s', '%s', '%s', '%s', %s, '1', '%s', '%s')"""% (p_create, name, info, alamat, administrasi[0], administrasi[1], administrasi[2], administrasi[3], lb, lt, tb, ltb, namafile, pemilik, pointopeto, rem, tdb ))
conn.commit() conn.commit()
data = {'status':'Success'} data = {'status':'Success'}
...@@ -1678,12 +1692,15 @@ def createjalan(request): ...@@ -1678,12 +1692,15 @@ def createjalan(request):
def changetipe(request): def changetipe(request):
tipe_point = request.GET.get('tipe') tipe_point = request.GET.get('tipe')
if tipe_point == 'administrasi': if tipe_point == 'bangunan':
tipepoint = [['Rumah'],['Ruko'],['Pabrik'],['Pasar/Swalayan']]
if tipe_point == 'kantor_administrasi':
with conn.cursor() as point: with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_kantor_administrasi""") point.execute("""SELECT DISTINCT remark FROM geo_kantor_administrasi""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
if tipe_point == 'layanankesehatan': if tipe_point == 'layanan_kesehatan':
with conn.cursor() as point: with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_layanan_kesehatan""") point.execute("""SELECT DISTINCT remark FROM geo_layanan_kesehatan""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
...@@ -1693,22 +1710,22 @@ def changetipe(request): ...@@ -1693,22 +1710,22 @@ def changetipe(request):
point.execute("""SELECT DISTINCT remark FROM geo_puskesmas""") point.execute("""SELECT DISTINCT remark FROM geo_puskesmas""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
if tipe_point == 'rumahsakit': if tipe_point == 'rumah_sakit':
with conn.cursor() as point: with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_rumah_sakit""") point.execute("""SELECT DISTINCT remark FROM geo_rumah_sakit""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
if tipe_point == 'saranaibadah': if tipe_point == 'sarana_ibadah':
with conn.cursor() as point: with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_sarana_ibadah""") point.execute("""SELECT DISTINCT remark FROM geo_sarana_ibadah""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
if tipe_point == 'saranapendidikan': if tipe_point == 'sarana_pendidikan':
with conn.cursor() as point: with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_sarana_pendidikan""") point.execute("""SELECT DISTINCT remark FROM geo_sarana_pendidikan""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
if tipe_point == 'cagarbudaya': if tipe_point == 'cagar_budaya':
with conn.cursor() as point: with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_cagar_budaya""") point.execute("""SELECT DISTINCT remark FROM geo_cagar_budaya""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
...@@ -1723,12 +1740,12 @@ def changetipe(request): ...@@ -1723,12 +1740,12 @@ def changetipe(request):
point.execute("""SELECT DISTINCT remark FROM geo_stasiun""") point.execute("""SELECT DISTINCT remark FROM geo_stasiun""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
if tipe_point == 'terminalbus': if tipe_point == 'terminal_bus':
with conn.cursor() as point: with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_terminal_bus""") point.execute("""SELECT DISTINCT remark FROM geo_terminal_bus""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
if tipe_point == 'gardulistrik': if tipe_point == 'gardu_listrik':
with conn.cursor() as point: with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_gardu_listrik""") point.execute("""SELECT DISTINCT remark FROM geo_gardu_listrik""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
...@@ -1736,6 +1753,19 @@ def changetipe(request): ...@@ -1736,6 +1753,19 @@ def changetipe(request):
respon = {'result':tipepoint} respon = {'result':tipepoint}
return Response(respon) return Response(respon)
@api_view(('GET',))
def changejenis(request):
tipe_point = request.GET.get('tipe')
jenis_point = request.GET.get('jenis')
if tipe_point == 'bangunan':
tipepoint1 = [['0','-']]
else:
with conn.cursor() as point:
point.execute("""SELECT id, namobj FROM geo_%s where remark = '%s'"""% (tipe_point, jenis_point))
tipepoint1 = point.fetchall()
respon = {'result':tipepoint1}
return Response(respon)
@api_view(('POST',)) @api_view(('POST',))
def createpoint(request): def createpoint(request):
gambar = request.FILES.get('gambar') gambar = request.FILES.get('gambar')
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<div class="tab-pane" id="left-tab1-feas-upl"> <div class="tab-pane" id="left-tab1-feas-upl">
<div class="row" style="margin-top: 15px;"> <div class="row" style="margin-top: 15px;">
<div class="form-group"> <div class="form-group">
<label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Bangunan</label> <label class="col-lg-3 control-label lbl-top" >Nama Bangunan</label>
<div class="col-lg-9"> <div class="col-lg-9">
<input id="name_create" type="text" class="form-control" value="" required> <input id="name_create" type="text" class="form-control" value="" required>
</div> </div>
...@@ -52,7 +52,52 @@ ...@@ -52,7 +52,52 @@
<div class="row" style="margin-top: 15px;"> <div class="row" style="margin-top: 15px;">
<div class="form-group"> <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" >Jenis Bangunan</label>
<div class="col-lg-9">
<select style="border-bottom: 1px solid rgb(83, 83, 83) !important;" id="tipe_point_b" data-placeholder="select point.." class="select-size-md">
<option value="null" selected disabled>-- Pilih Jenis Point --</option>
<option value="bangunan">Bangunan Biasa</option>
<option value="kantor_administrasi">Kantor Administrasi</option>
<option value="layanan_kesehatan">Layanan Kesehatan</option>
<option value="puskesmas">Puskesmas</option>
<option value="rumah_sakit">Rumah Sakit</option>
<option value="sarana_ibadah">Sarana Ibadah</option>
<option value="sarana_pendidikan">Sarana Pendidikan</option>
<option value="spbu">SPBU</option>
<option value="stasiun">Stasiun</option>
<option value="terminal_bus">Terminal Bus</option>
<option value="cagar_budaya">Cagar Budaya dan Tempat Wisata</option>
<option value="gardu_listrik">Gardu Listrik</option>
</select>
</div>
</div>
</div>
<div class="row" style="margin-top: 15px;">
<div class="form-group">
<label class="col-lg-3 control-label lbl-top" >Tipe Bangunan</label>
<div class="col-lg-9">
<select style="border-bottom: 1px solid rgb(83, 83, 83) !important;width: 220px;" id="tipe_point_2_b" data-placeholder="select point.." class="select-size-md">
<option value="null" selected disabled>-- Pilih Tipe Point --</option>
</select>
</div>
</div>
</div>
<div class="row" style="margin-top: 15px;">
<div class="form-group">
<label class="col-lg-3 control-label lbl-top" >Nama Point</label>
<div class="col-lg-9">
<select style="border-bottom: 1px solid rgb(83, 83, 83) !important;width: 220px;" id="tipe_point_3_b" data-placeholder="select point.." class="select-size-md">
<option value="null" selected disabled>-- Pilih Point --</option>
</select>
</div>
</div>
</div>
<div class="row" style="margin-top: 15px;">
<div class="form-group">
<label class="col-lg-3 control-label lbl-top" >Informasi Bangunan</label>
<div class="col-lg-9"> <div class="col-lg-9">
<input id="info_create" type="text" class="form-control" value="" placeholder="Rumah/Gedung/Ruko/Pabrik/dsb" required> <input id="info_create" type="text" class="form-control" value="" placeholder="Rumah/Gedung/Ruko/Pabrik/dsb" required>
</div> </div>
...@@ -61,7 +106,7 @@ ...@@ -61,7 +106,7 @@
<div class="row" style="margin-top: 15px;"> <div class="row" style="margin-top: 15px;">
<div class="form-group"> <div class="form-group">
<label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Alamat</label> <label class="col-lg-3 control-label lbl-top" >Alamat</label>
<div class="col-lg-9"> <div class="col-lg-9">
<input id="alamat_create" type="text" class="form-control" value="" placeholder="cth : Jl. Contoh Rt 005/01 No.01" required> <input id="alamat_create" type="text" class="form-control" value="" placeholder="cth : Jl. Contoh Rt 005/01 No.01" required>
</div> </div>
...@@ -70,12 +115,12 @@ ...@@ -70,12 +115,12 @@
<div class="row" style="margin-top: 15px;"> <div class="row" style="margin-top: 15px;">
<div class="form-group"> <div class="form-group">
<label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Luas Bangunan</label> <label class="col-lg-3 control-label lbl-top" >Luas Bangunan</label>
<div class="col-lg-6"> <div class="col-lg-6">
<input id="luas_bangunan_create" type="text" class="form-control" value="" required> <input id="luas_bangunan_create" type="text" class="form-control" value="" required>
</div> </div>
<div class="col-lg-3"> <div class="col-lg-3">
<select id="satuan_luas_bangunan" style="margin-top: 15px;"> <select id="satuan_luas_bangunan" >
<option>m2</option> <option>m2</option>
</select> </select>
</div> </div>
...@@ -84,12 +129,12 @@ ...@@ -84,12 +129,12 @@
<div class="row" style="margin-top: 15px;"> <div class="row" style="margin-top: 15px;">
<div class="form-group"> <div class="form-group">
<label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Luas Tanah</label> <label class="col-lg-3 control-label lbl-top">Luas Tanah</label>
<div class="col-lg-6"> <div class="col-lg-6">
<input id="luas_tanah_create" type="text" class="form-control" value="" required> <input id="luas_tanah_create" type="text" class="form-control" value="" required>
</div> </div>
<div class="col-lg-3"> <div class="col-lg-3">
<select id="satuan_luas_tanah" style="margin-top: 15px;"> <select id="satuan_luas_tanah">
<option>m2</option> <option>m2</option>
</select> </select>
</div> </div>
...@@ -98,17 +143,17 @@ ...@@ -98,17 +143,17 @@
<div class="row" style="margin-top: 15px;"> <div class="row" style="margin-top: 15px;">
<div class="form-group"> <div class="form-group">
<label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tinggi Bangunan</label> <label class="col-lg-3 control-label lbl-top">Tinggi Bangunan</label>
<div class="col-lg-6"> <div class="col-lg-6">
<input id="tinggi_bangunan_create" type="text" class="form-control" value="" required> <input id="tinggi_bangunan_create" type="text" class="form-control" value="" required>
</div> </div>
<div class="col-lg-3" style="margin-top: 15px;">m</div> <div class="col-lg-3">m</div>
</div> </div>
</div> </div>
<div class="row" style="margin-top: 15px;"> <div class="row" style="margin-top: 15px;">
<div class="form-group"> <div class="form-group">
<label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Jumlah Lantai</label> <label class="col-lg-3 control-label lbl-top">Jumlah Lantai</label>
<div class="col-lg-9"> <div class="col-lg-9">
<input id="lantai" type="text" class="form-control" value="" placeholder="Estimasi Per Lantai = 3m" required> <input id="lantai" type="text" class="form-control" value="" placeholder="Estimasi Per Lantai = 3m" required>
</div> </div>
...@@ -117,7 +162,7 @@ ...@@ -117,7 +162,7 @@
<div class="row" style="margin-top: 15px;"> <div class="row" style="margin-top: 15px;">
<div class="form-group"> <div class="form-group">
<label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Pemilik</label> <label class="col-lg-3 control-label lbl-top" >Pemilik</label>
<div class="col-lg-9"> <div class="col-lg-9">
<input id="pemilik_create" type="text" class="form-control" value="" placeholder="cth : Ali Budiman, S.Si." required> <input id="pemilik_create" type="text" class="form-control" value="" placeholder="cth : Ali Budiman, S.Si." required>
</div> </div>
...@@ -221,6 +266,60 @@ ...@@ -221,6 +266,60 @@
map.openPopup(popup); map.openPopup(popup);
$("#tipe_point_b").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_b').html(`<option value="null" selected disabled>-- Pilih Tipe Point --</option>` + data_all_kab);
}
});
});
$("#tipe_point_2_b").change(function() {
var jenis = $(this).val();
var tipx = $("#tipe_point_b").val();
$.ajax({
url: "{% url 'api:change-jenis' %}",
data: {
'tipe': tipx,
'jenis': jenis
},
dataType: 'json',
success: function(data) {
console.log(data)
var data_all_kab = []
for (var i = 0; i < data['result'].length; i++) {
var data_id = data['result'][i][0];
var data_po = data['result'][i][1];
console.log(data_id)
console.log(data_po)
var data_kab = `<option value="` +data_id + `">` + data_po + `</option>`;
data_all_kab.push(data_kab)
};
$('#tipe_point_3_b').html(`<option value="null" selected disabled>-- Pilih Point --</option>` + data_all_kab);
}
});
});
var map_create_bangunan = L.map('map-create', { var map_create_bangunan = L.map('map-create', {
editable: true, editable: true,
zoomControl: false, zoomControl: false,
...@@ -473,6 +572,9 @@ ...@@ -473,6 +572,9 @@
$(document).on("click", "#create_save_bangunan", function(e) { $(document).on("click", "#create_save_bangunan", function(e) {
var polygin = $('#poly_create_bangunan').val(); var polygin = $('#poly_create_bangunan').val();
var name_poly = $('#name_create').val(); var name_poly = $('#name_create').val();
var tdb = $('#tipe_point_b').val();
var remark = $('#tipe_point_2_b').val();
var poin_id = $('#tipe_point_3_b').val();
var info_poly = $('#info_create').val(); var info_poly = $('#info_create').val();
var alamat_poly = $('#alamat_create').val(); var alamat_poly = $('#alamat_create').val();
var lb_poly = $('#luas_bangunan_create').val(); var lb_poly = $('#luas_bangunan_create').val();
...@@ -486,6 +588,9 @@ ...@@ -486,6 +588,9 @@
data: { data: {
'polygon': polygin, 'polygon': polygin,
'name': name_poly, 'name': name_poly,
'tipedb': tdb,
'poin': poin_id,
'remark': remark,
'info': info_poly, 'info': info_poly,
'alamat': alamat_poly, 'alamat': alamat_poly,
'lb': lb_poly, 'lb': lb_poly,
......
...@@ -4815,6 +4815,22 @@ ...@@ -4815,6 +4815,22 @@
} else { } else {
var path_img = `"static/image/bangunan/` + feature.administrasi.f9 + `"` var path_img = `"static/image/bangunan/` + feature.administrasi.f9 + `"`
} }
console.log(feature.administrasi.f11)
// if (feature.administrasi.f11 != 'None'){
// var cbb = `<option value="null" disabled>-- Pilih Jenis Point --</option>
// <option value="bangunan" `if(feature.administrasi.f11 != 'bangunan'){`selected`};` >Bangunan Biasa</option>
// <option value="kantor_administrasi">Kantor Administrasi</option>
// <option value="layanan_kesehatan">Layanan Kesehatan</option>
// <option value="puskesmas">Puskesmas</option>
// <option value="rumah_sakit">Rumah Sakit</option>
// <option value="sarana_ibadah">Sarana Ibadah</option>
// <option value="sarana_pendidikan">Sarana Pendidikan</option>
// <option value="spbu">SPBU</option>
// <option value="stasiun">Stasiun</option>
// <option value="terminal_bus">Terminal Bus</option>
// <option value="cagar_budaya">Cagar Budaya dan Tempat Wisata</option>
// <option value="gardu_listrik">Gardu Listrik</option>`
// }
// var list_history = feature.properties.f7 // var list_history = feature.properties.f7
...@@ -4857,7 +4873,7 @@ ...@@ -4857,7 +4873,7 @@
<div class="col-md-4"> <div class="col-md-4">
<input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunan" value="`+feature.geometry+`"> <input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunan" value="`+feature.geometry+`">
<table> <table>
<tr> <tr style="margin-top: 10px">
<th> <th>
Image Image
</th> </th>
...@@ -4878,6 +4894,43 @@ ...@@ -4878,6 +4894,43 @@
<input type="text" name="namebangunan" id="namebangunan" class="form-control" value="`+feature.properties.f2+`"> <input type="text" name="namebangunan" id="namebangunan" class="form-control" value="`+feature.properties.f2+`">
</td> </td>
</tr> </tr>
<tr>
<th>Jenis Bangunan</th>
<td>
<input type="text" class="hidden" name="tipe1" id="tipe111" value="`+feature.administrasi.f11+`">
<input type="text" class="hidden" name="tipe1" id="tipe222" value="`+feature.administrasi.f12+`">
<input type="text" class="hidden" name="tipe1" id="tipe333" value="`+feature.administrasi.f13+`">
<input type="text" class="hidden" name="tipe1" id="tipe444" value="`+feature.administrasi.f14+`">
<select style="border-bottom: 1px solid rgb(83, 83, 83) !important;width: 220px;" id="tipe_point_b_e" data-placeholder="select point.." class="select-size-md">
<option value="null" selected disabled>-- Pilih Jenis Point --</option>
<option value="bangunan">Bangunan Biasa</option>
<option value="kantor_administrasi">Kantor Administrasi</option>
<option value="layanan_kesehatan">Layanan Kesehatan</option>
<option value="puskesmas">Puskesmas</option>
<option value="rumah_sakit">Rumah Sakit</option>
<option value="sarana_ibadah">Sarana Ibadah</option>
<option value="sarana_pendidikan">Sarana Pendidikan</option>
<option value="spbu">SPBU</option>
<option value="stasiun">Stasiun</option>
<option value="terminal_bus">Terminal Bus</option>
<option value="cagar_budaya">Cagar Budaya dan Tempat Wisata</option>
<option value="gardu_listrik">Gardu Listrik</option>
</td>
</tr>
<tr>
<th>Tipe Bangunan</th>
<td>
<select style="border-bottom: 1px solid rgb(83, 83, 83) !important;width: 220px;" id="tipe_point_2_b_e" data-placeholder="select point.." class="select-size-md">
<option value="null" selected disabled>-- Pilih Tipe Point --</option>
</td>
</tr>
<tr>
<th>Point Bangunan</th>
<td>
<select style="border-bottom: 1px solid rgb(83, 83, 83) !important;width: 220px;" id="tipe_point_3_b_e" data-placeholder="select point.." class="select-size-md">
<option value="null" selected disabled>-- Pilih Point --</option>
</td>
</tr>
<tr> <tr>
<th>Informasi Bangunan</th> <th>Informasi Bangunan</th>
<td> <td>
...@@ -5063,6 +5116,10 @@ ...@@ -5063,6 +5116,10 @@
$("#modal_bangunan_edit").html(content_edit); $("#modal_bangunan_edit").html(content_edit);
$("#modal_bangunan_delete").html(content_delete); $("#modal_bangunan_delete").html(content_delete);
}); });
// $("#tipe_point_b_e").val('feature.administrasi.f11').change();
// $('#tipe_point_b_e').val(feature.properties.f11).attr('selected','selected');
// $('#tipe_point_b_e option[value=bangunan]').attr('selected','selected');
// $('#idbangunan').val(feature.properties.f1); // $('#idbangunan').val(feature.properties.f1);
// $('#namebangunan').val(feature.properties.f2); // $('#namebangunan').val(feature.properties.f2);
// $('#infobangunan').val(feature.properties.f3); // $('#infobangunan').val(feature.properties.f3);
...@@ -5205,6 +5262,83 @@ ...@@ -5205,6 +5262,83 @@
var id_poly = $('#idbangunan').val(); var id_poly = $('#idbangunan').val();
loaderPage(true); loaderPage(true);
var tipe1 = $('#tipe111').val();
$('#tipe_point_b_e option[value='+tipe1+']').attr('selected','selected');
// $("#tipe_point_b_e option").val(tipe1).change();
$("#tipe_point_b_e").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];
// if (feature.administrasi.f12 == data_k){
// var data_kab = `<option value="` + data_k + `" selected>` + data_k + `</option>`;
// } else{
// var data_kab = `<option value="` + data_k + `">` + data_k + `</option>`;
// }
var data_kab = `<option value="` + data_k + `">` + data_k + `</option>`;
data_all_kab.push(data_kab)
};
$('#tipe_point_2_b_e').html(`<option value="null" selected disabled>-- Pilih Tipe Point --</option>` + data_all_kab);
}
});
});
var tipe2 = $('#tipe222').val();
// $('#tipe_point_2_b_e option[value='+tipe2+']').attr('selected','selected');
if (tipe2 == 'null') {
$('#tipe_point_2_b_e').html(`<option value="null" selected disabled>-- Pilih Tipe Point --</option>`);
} else{
$('#tipe_point_2_b_e').html(`<option value="`+tipe2+`" selected disabled>`+tipe2+`</option>`);
}
$("#tipe_point_2_b_e").change(function() {
var jenis = $(this).val();
var tipx = $("#tipe_point_b_e").val();
$.ajax({
url: "{% url 'api:change-jenis' %}",
data: {
'tipe': tipx,
'jenis': jenis
},
dataType: 'json',
success: function(data) {
console.log(data)
var data_all_kab = []
for (var i = 0; i < data['result'].length; i++) {
var data_id = data['result'][i][0];
var data_po = data['result'][i][1];
console.log(data_id)
console.log(data_po)
var data_kab = `<option value="` +data_id + `">` + data_po + `</option>`;
data_all_kab.push(data_kab)
};
$('#tipe_point_3_b_e').html(`<option value="null" selected disabled>-- Pilih Point --</option>` + data_all_kab);
}
});
});
var tipe3 = $('#tipe333').val();
var tipe4 = $('#tipe444').val();
// $('#tipe_point_3_b_e option[value='+tipe3+']').attr('selected','selected');
if (tipe3 == 'null') {
$('#tipe_point_3_b_e').html(`<option value="null" selected disabled>-- Pilih Point --</option>`);
} else{
$('#tipe_point_3_b_e').html(`<option value="`+tipe3+`" selected disabled>`+tipe4+`</option>`);
}
$.ajax({ $.ajax({
url: "{% url 'api:edit' %}", url: "{% url 'api:edit' %}",
data: { data: {
...@@ -5221,7 +5355,7 @@ ...@@ -5221,7 +5355,7 @@
map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19); map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
// $("#tipe_point_b_e").val(data['administrasi'][]).change();
let lop_poly_edit = data['geometry']['coordinates'][0][0]; let lop_poly_edit = data['geometry']['coordinates'][0][0];
let list_poly_edit = []; let list_poly_edit = [];
for (var i = 0; i < lop_poly_edit.length; i++) { for (var i = 0; i < lop_poly_edit.length; i++) {
...@@ -5238,8 +5372,11 @@ ...@@ -5238,8 +5372,11 @@
}) })
} }
}) })
}); });
$(document).on("click", "#btnsavebangunan", function() { $(document).on("click", "#btnsavebangunan", function() {
var data = new FormData(); var data = new FormData();
data.append("file", $("input[id^='imgbangunan']")[0].files[0]); data.append("file", $("input[id^='imgbangunan']")[0].files[0]);
...@@ -5397,12 +5534,12 @@ ...@@ -5397,12 +5534,12 @@
// [-4.1283969, 104.1674575] // [-4.1283969, 104.1674575]
// ]).addTo(map_bang) // ]).addTo(map_bang)
// $(document).on("click", "#btn_perbaikan_bangunan", function() { $(document).on("click", "#btn_perbaikan_bangunan", function() {
// if (map_bang.hasLayer(polyxxx)) { // if (map_bang.hasLayer(polyxxx)) {
// polyxxx.remove() // polyxxx.remove()
// } // }
// var id_polyx = $('#idbangunan').val(); // var id_polyx = $('#idbangunan').val();
// $("#input_perbaikan_bang").css("display", "block"); $("#input_perbaikan_bang").css("display", "block");
// $.ajax({ // $.ajax({
// url: "{% url 'apps:input-perbaikan-bang' %}", // url: "{% url 'apps:input-perbaikan-bang' %}",
...@@ -5433,7 +5570,7 @@ ...@@ -5433,7 +5570,7 @@
// } // }
// }) // })
// }) })
</script> </script>
{% include 'includes/insert.html' %} {% include 'includes/insert.html' %}
\ No newline at end of file
...@@ -476,17 +476,17 @@ ...@@ -476,17 +476,17 @@
<div class="col-lg-9"> <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"> <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> <option value="null" selected disabled>-- Pilih Jenis Point --</option>
<option value="administrasi">Kantor Administrasi</option> <option value="kantor_administrasi">Kantor Administrasi</option>
<option value="layanankesehatan">Layanan Kesehatan</option> <option value="layanan_kesehatan">Layanan Kesehatan</option>
<option value="puskesmas">Puskesmas</option> <option value="puskesmas">Puskesmas</option>
<option value="rumahsakit">Rumah Sakit</option> <option value="rumah_sakit">Rumah Sakit</option>
<option value="saranaibadah">Sarana Ibadah</option> <option value="sarana_ibadah">Sarana Ibadah</option>
<option value="saranapendidikan">Sarana Pendidikan</option> <option value="sarana_pendidikan">Sarana Pendidikan</option>
<option value="spbu">SPBU</option> <option value="spbu">SPBU</option>
<option value="stasiun">Stasiun</option> <option value="stasiun">Stasiun</option>
<option value="terminalbus">Terminal Bus</option> <option value="terminal_bus">Terminal Bus</option>
<option value="cagarbudaya">Cagar Budaya dan Tempat Wisata</option> <option value="cagar_budaya">Cagar Budaya dan Tempat Wisata</option>
<option value="gardulistrik">Gardu Listrik</option> <option value="gardu_listrik">Gardu Listrik</option>
</select> </select>
</div> </div>
......
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