Commit c8c11979 authored by Manggar Mahardhika's avatar Manggar Mahardhika

pbb edit bangunan

parent 8ed17adf
......@@ -729,7 +729,11 @@ def building(request):
gb.db_tipe,
gb.remark,
gb.point_id,
gb.point_name
gb.point_name,
gb.njop,
gb.njoptkp,
gb.njkp,
gb.pbb
),
'geometry',
ST_AsGeoJSON ( gb.geom :: geometry ) :: json
......@@ -1394,6 +1398,11 @@ def validatedit(request):
remark = request.POST.get('remarkbe')
namapoin = request.POST.get('napo')
njoptkp = request.POST.get('njoptkp')
njop = request.POST.get('njoppbb')
njkp = request.POST.get('njkp')
pbb = request.POST.get('pbb')
co_edit = cood_edit['geometry']['coordinates']
# print(co_edit)
......@@ -1429,7 +1438,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, 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)))
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', njoptkp=%s, njop=%s, njkp=%s, pbb=%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(njoptkp), int(njop), int(njkp), int(pbb), int(id_poly)))
conn.commit()
data = 'SUCCESS'
......
......@@ -10476,6 +10476,32 @@ var geo_bangunan = L.geoJson(null, {
history = ``
}
if (feature.administrasi.f15 == 'None') {
var njop = 0
} else {
var njop = feature.administrasi.f15.toLocaleString()
}
if (feature.administrasi.f16 == 'None') {
var njoptkp = 10000000
} else {
var njoptkp = feature.administrasi.f16.toLocaleString()
}
if (feature.administrasi.f17 == 'None') {
var njkp = 0
} else {
var njkp = feature.administrasi.f17.toLocaleString()
}
if (feature.administrasi.f18 == 'None') {
var pbb = 0
var pbb_depan = "Belum Dihitung"
} else {
var pbb = feature.administrasi.f18.toLocaleString()
var pbb_depan = feature.administrasi.f18.toLocaleString()
}
// if (feature.properties.f4 != null) {
// var list_history = feature.properties.f4
// console.log(list_history[0].split(",")[0])
......@@ -10630,6 +10656,30 @@ var geo_bangunan = L.geoJson(null, {
<input type="text " name="pemilik " id="pemilik" class="form-control " value="` + feature.administrasi.f10 + `">
</td>
</tr>
<tr>
<th>NJOP</th>
<td>
<input type="text " name="njop_bang_edit" id="njop_bang_edit" class="form-control " value="` + njop + `">
</td>
</tr>
<tr>
<th>NJOPTKP</th>
<td>
<input type="text " name="njoptkp_bang_edit" id="njoptkp_bang_edit" class="form-control " value="` + njoptkp + `">
</td>
</tr>
<tr>
<th>NJKP</th>
<td>
<input type="text " name="njkp_bang_edit" id="njkp_bang_edit" class="form-control " value="` + njkp + `">
</td>
</tr>
<tr>
<th>PBB</th>
<td>
<input type="text " name="pbb_bang_edit" id="pbb_bang_edit" class="form-control " value="` + pbb + `">
</td>
</tr>
</table>
</div>
</div>
......@@ -10918,6 +10968,15 @@ var geo_bangunan = L.geoJson(null, {
<span style="font-family: 'gilroysemibold';">` + feature.administrasi.f10 + ` m</span>
</div>
</div>
<div>
<div style="margin-top:5px;">
<span style="font-family: 'gilroylight';">Estimasi PBB</span>
</div>
<div>
<span style="font-family: 'gilroysemibold';"> ` + pbb_depan + ` </span>
</div>
</div>
</div>
` + history + `
`);
......@@ -11158,6 +11217,99 @@ $(document).on("click", "#btn_edit_bangunan", function() {
$('#tipe_point_3_b_e').html(`<option value="` + tipe3 + `" selected>` + tipe4 + `</option>`);
}
// var njoptkp = null
// var njoppbb = null
function isi_all() {
// var luas_rumah = $("#luas_polygon_rumah").val()
// var luas_tanah = $("#luas_polygon_tanah").val()
// var njop_bumi = $("#nilai_njop_bumi").val()
// var njop_bang = $("#nilai_njop_bangunan").val()
var njop_tkp_s = $("#njoptkp_bang_edit").val()
var njop_d_pbb_s = $("#njop_bang_edit").val()
// var njop_tkp = njop_tkp_s.replace(",","")
// var njop_d_pbb = njop_d_pbb_s.replace(",","")
var njop_tkp = parseInt(njop_tkp_s.indexOf(',') >= 4 ? njop_tkp_s.split(',')[0] : njop_tkp_s.replace(/[^0-9\.]/g, ''));
var njop_d_pbb = parseInt(njop_d_pbb_s.indexOf(',') >= 4 ? njop_d_pbb_s.split(',')[0] : njop_d_pbb_s.replace(/[^0-9\.]/g, ''));
// var njop_tkp = a
// var njop_d_pbb = b
console.log(njop_d_pbb, njop_tkp)
// njop_bumi.toLocaleString()
// njop_bang.toLocaleString()
// if (luas_rumah == null) {
// luas_rumah = 0
// }
// if (luas_tanah == null) {
// luas_tanah = 0
// }
// if (njop_bumi == null) {
// njop_bumi = 0
// }
// if (njop_bang == null) {
// njop_bang = 0
// }
// if (njop_tkp == null) {
// njop_tkp = 0
// }
// t_njop_bumi = njop_bumi * luas_tanah
// t_njop_bang = njop_bang * luas_rumah
// njop_d_pbb = t_njop_bang + t_njop_bumi
njkp_blm = njop_d_pbb - njop_tkp
njkp = 40/100 * njkp_blm
pbb = 0.5/100 *njkp
// pbb.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
// var separ_pbb = pbb.toString().split(".");
// separ_pbb.join(".")
pbx = pbb.toFixed(2)
// $("#nilai_njop_pbb").val(njop_d_pbb.toLocaleString())
if (njkp > 0){
$("#njkp_bang_edit").val(njkp.toLocaleString())
$("#pbb_bang_edit").val(pbb.toLocaleString())
}
else if (njkp < 0){
$("#njkp_bang_edit").val("0")
$("#pbb_bang_edit").val("0")
}
}
$('#njoptkp_bang_edit').on('input', function() {
$('#njoptkp_bang_edit').on('change click keyup input paste',(function (event) {
$(this).val(function (index, value) {
return value.replace(/(?!\.)\D/g, "").replace(/(?<=\..*)\./g, "").replace(/(?<=\.\d\d).*/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
});
// let njoptkp = njop_tkp_s.replace(",","")
// let njoppbb = njop_d_pbb_s.replace(",","")
// isi_all(njoptkp, njoppbb)
}));
// console.log(njoptkp, njoppbb)
isi_all()
});
$('#njop_bang_edit').on('input', function() {
$('#njop_bang_edit').on('change click keyup input paste',(function (event) {
$(this).val(function (index, value) {
return value.replace(/(?!\.)\D/g, "").replace(/(?<=\..*)\./g, "").replace(/(?<=\.\d\d).*/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
});
// let njoptkp = njop_tkp_s.replace(",","")
// let njoppbb = njop_d_pbb_s.replace(",","")
// isi_all(njoptkp, njoppbb)
}));
isi_all()
});
var map_edit = new L.map('map-edit', {
editable: true,
zoomControl: false,
......@@ -11215,6 +11367,12 @@ $(document).on("click", "#btn_edit_bangunan", function() {
polylyly = L.polygon(list_poly_edit).addTo(map_edit)
polylyly.enableEdit();
var hasil = (JSON.stringify(polylyly.toGeoJSON()))
var seeArea = L.GeometryUtil.geodesicArea(polylyly.getLatLngs()[0]);
var fixarea = seeArea.toFixed(3)
$("#luasbangunan").val(fixarea);
$('#btnsavebangunan').click(function() {
var hasil = (JSON.stringify(polylyly.toGeoJSON()))
$("#coordinatebangunan").val(hasil);
......@@ -11225,6 +11383,35 @@ $(document).on("click", "#btn_edit_bangunan", function() {
});
$(document).on("click", "#btnsavebangunan", function() {
var njop_tkp = $("#njoptkp_bang_edit").val()
var njop_pbb = $("#njop_bang_edit").val()
var njkp = $("#njkp_bang_edit").val()
var pbb = $("#pbb_bang_edit").val()
var njop_tkp_j = parseInt(njop_tkp.indexOf(',') >= 4 ? njop_tkp.split(',')[0] : njop_tkp.replace(/[^0-9\.]/g, ''));
var njop_pbb_j = parseInt(njop_pbb.indexOf(',') >= 4 ? njop_pbb.split(',')[0] : njop_pbb.replace(/[^0-9\.]/g, ''));
var njkp_j = parseInt(njkp.indexOf(',') >= 4 ? njkp.split(',')[0] : njkp.replace(/[^0-9\.]/g, ''));
var pbb_j = parseInt(pbb.indexOf(',') >= 4 ? pbb.split(',')[0] : pbb.replace(/[^0-9\.]/g, ''));
if (njop_tkp_j == ""){
njop_tkp_j = 0
}
if (njop_pbb_j == ""){
njop_pbb_j = 0
}
if (njkp_j == ""){
njkp_j = 0
}
if (pbb_j == ""){
pbb_j = 0
}
console.log(njop_tkp_j, njop_pbb_j, njkp_j, pbb_j)
var data = new FormData();
data.append("file", $("input[id^='imgbangunan']")[0].files[0]);
data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
......@@ -11254,7 +11441,12 @@ $(document).on("click", "#btnsavebangunan", function() {
data.append('tinggibangunan_b', $('#tinggibangunan').val())
data.append('pemilik_b', $('#pemilik').val())
console.log(data)
data.append('njoptkp', njop_tkp_j)
data.append('njoppbb', njop_pbb_j)
data.append('njkp', njkp_j)
data.append('pbb', pbb_j)
console.log($('#idbangunan').val())
$.ajax({
url: "api/validatedit",
......
......@@ -1498,50 +1498,50 @@ function x() {
}
function georumah() {
loaderPage(true)
// loaderPage(true)
var checkBox = document.getElementById("geo_building");
if (checkBox.checked == true) {
console.log(markerList.length)
if (markerList.length == 0) {
$.ajax({
url: "api/pointBangunan",
dataType: 'json',
success: function(response) {
$("#bangpoints").html(`<script src="static/bangunan.js"></script>`)
for (var i = 0; i < bangunanPoints.length; i++) {
var a = bangunanPoints[i];
var marker = L.marker(L.latLng(a[0], a[1]), {
icon: L.divIcon({
className: 'invisible-marker'
})
});
markerList.push(marker);
}
//console.log('start clustering: ' + window.performance.now());
markers.addLayers(markerList);
map.addLayer(markers);
if (map.hasLayer(markers)) {
loaderPage(false);
}
}
});
} else {
markers.addLayers(markerList);
map.addLayer(markers);
if (map.hasLayer(markers)) {
loaderPage(false);
}
}
// if (markerList.length == 0) {
// $.ajax({
// url: "api/pointBangunan",
// dataType: 'json',
// success: function(response) {
// $("#bangpoints").html(`<script src="static/bangunan.js"></script>`)
// for (var i = 0; i < bangunanPoints.length; i++) {
// var a = bangunanPoints[i];
// var marker = L.marker(L.latLng(a[0], a[1]), {
// icon: L.divIcon({
// className: 'invisible-marker'
// })
// });
// markerList.push(marker);
// }
// //console.log('start clustering: ' + window.performance.now());
// markers.addLayers(markerList);
// map.addLayer(markers);
// if (map.hasLayer(markers)) {
// loaderPage(false);
// }
// }
// });
// } else {
// markers.addLayers(markerList);
// map.addLayer(markers);
// if (map.hasLayer(markers)) {
// loaderPage(false);
// }
// }
$(".help_bangunan").html('Polygon Bangunan dan Line Jalan terlihat pada zoom > 16')
} else {
......
......@@ -376,12 +376,12 @@
<ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<button type="button" class="close" onclick="destroyWraper()">&times;</button>
<button class="close modalMinimize" style="right: 50px;"> <i class='fa fa-minus'></i> </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>
<li class="active"><a href="#left-tab-input-coordinat-jalan" data-toggle="tab">Koordinat</a></li>
<li><a href="#right-tab-input-informasi-jalan" 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="tab-pane active" id="left-tab-input-coordinat-jalan">
<div class="modal-body" style="max-height: 450px;overflow-y: auto;">
<input type="text" class="hidden" id="poly_create">
<input type="text" class="hidden" id="id_jalan_perbaikan">
......@@ -391,7 +391,7 @@
</div>
</div>
<div class="tab-pane" id="right-tab-input-informasi">
<div class="tab-pane" id="right-tab-input-informasi-jalan">
<div class="modal-body" style="max-height: 450px;overflow-y: auto;">
<div class="row">
<div class="col-md-6">
......
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