Commit 1356d6e8 authored by Manggar Mahardhika's avatar Manggar Mahardhika

fix perbaikan bangunan dan jalan

parent 4a9869d6
...@@ -823,7 +823,8 @@ import re ...@@ -823,7 +823,8 @@ import re
import json import json
@api_view(('POST',)) @api_view(('POST',))
def saveperbaikan(request): def saveperbaikan(request):
type_id = request.POST.get("type_id") # type_id = request.POST.get("type_id")
type_id = 2
id_object = request.POST.get("object_id") id_object = request.POST.get("object_id")
name = request.POST.get("name") name = request.POST.get("name")
type = request.POST.get("type") type = request.POST.get("type")
...@@ -852,29 +853,40 @@ def saveperbaikan(request): ...@@ -852,29 +853,40 @@ def saveperbaikan(request):
fss_p = FileSystemStorage(location='/var/www/django/oku.khansia.co.id/media/proposal/') fss_p = FileSystemStorage(location='/var/www/django/oku.khansia.co.id/media/proposal/')
fss_b = FileSystemStorage(location='/var/www/django/oku.khansia.co.id/media/bukti_penyelesaian/') fss_b = FileSystemStorage(location='/var/www/django/oku.khansia.co.id/media/bukti_penyelesaian/')
coord = json.loads(str(coor)) # coord = json.loads(str(coor))
pjg_perbaikan = re.sub('[^0-9.]+', '', str(pjg_perbaikan)) pjg_perbaikan = re.sub('[^0-9.]+', '', str(pjg_perbaikan))
lbr_perbaikan = re.sub('[^0-9.]+', '', str(lbr_perbaikan)) lbr_perbaikan = re.sub('[^0-9.]+', '', str(lbr_perbaikan))
luas = re.sub('[^0-9.]+', '', str(luas)) luas = re.sub('[^0-9.]+', '', str(luas))
if coord['features'][0]['geometry']['type'] == 'LineString': # if coord['features'][0]['geometry']['type'] == 'LineString':
print("oke") # print("oke")
for co in coord['features']: # for co in coord['features']:
ll = str(co["geometry"]['coordinates']) # ll = str(co["geometry"]['coordinates'])
ll += ll # ll += ll
ll = ll.replace(", "," ") # ll = ll.replace(", "," ")
ll = ll.replace("]][[","),(") # ll = ll.replace("]][[","),(")
ll = ll.replace("] [",", ") # ll = ll.replace("] [",", ")
ll = ll.replace("]]",")") # ll = ll.replace("]]",")")
ll = ll.replace("[[","(") # ll = ll.replace("[[","(")
coordinat = f'MULTILINESTRING({ll})' # coordinat = f'MULTILINESTRING({ll})'
print(ll) # print(ll)
if coord['features'][0]['geometry']['type'] == 'Polygon': # if coord['features'][0]['geometry']['type'] == 'Polygon':
print('tidakoke') # print('tidakoke')
yak = str(coor)
suk = yak.replace("""{"type":"Feature","properties":{},"geometry":{"type":"LineString","coordinates":""","")
sik = suk.replace("""}}""","")
cor = sik.replace("""[[[""","(")
coran = cor.replace("""]]]""",")")
ll = coran.replace(","," ")
ii = ll.replace("] [",",")
mm = ii.replace('{"type":"FeatureCollection" "features":', '')
nn = mm.replace('}', '')
corcoran = f'MULTILINESTRING({nn})'
try:
format = (proposal.name).split(".") format = (proposal.name).split(".")
num = random.randrange(1, 10000000000000) num = random.randrange(1, 10000000000000)
nproposal = f"{name}_{num}.{format[-1:][0]}" nproposal = f"{name}_{num}.{format[-1:][0]}"
...@@ -888,6 +900,13 @@ def saveperbaikan(request): ...@@ -888,6 +900,13 @@ def saveperbaikan(request):
filename_b = fss_b.save(nbukti, bukti_selesai) filename_b = fss_b.save(nbukti, bukti_selesai)
url_b = fss_b.url(filename_b) url_b = fss_b.url(filename_b)
print("-------------------")
print(str(corcoran))
print("-------------------")
print(str(type_id),("-"),str(id_object),("-"),str(name),("-"),str(type),("-"),str(tgl_selesai),("-"),str(tgl_perbaikan),("-"),str(tgl_disetujui),("-"),str(anggaran),("-"),str(pj),("-"),str(pj_lapangan),("-"),str(kontraktor),("-"),str(pjg_perbaikan),("-"),str(lbr_perbaikan),("-"),str(jenis_perbaikan),("-"),str(nproposal),("-"),str(nbukti))
print("-------------------")
try:
with conn.cursor() as data_per: with conn.cursor() as data_per:
data_per.execute(""" data_per.execute("""
INSERT INTO tbl_perbaikan ( INSERT INTO tbl_perbaikan (
...@@ -946,7 +965,7 @@ def saveperbaikan(request): ...@@ -946,7 +965,7 @@ def saveperbaikan(request):
float(pjg_perbaikan), float(pjg_perbaikan),
float(lbr_perbaikan), float(lbr_perbaikan),
jenis_perbaikan, jenis_perbaikan,
coordinat)) corcoran))
conn.commit() conn.commit()
data = "Sukses" data = "Sukses"
info = "Data Telah Berhasil di Perbaharui" info = "Data Telah Berhasil di Perbaharui"
......
...@@ -4883,7 +4883,6 @@ ...@@ -4883,7 +4883,6 @@
} else { } else {
var alamak = feature.administrasi.f3; var alamak = feature.administrasi.f3;
} }
if (feature.administrasi.f10 == 'bpk') { if (feature.administrasi.f10 == 'bpk') {
var raja = ""; var raja = "";
...@@ -8001,11 +8000,18 @@ ...@@ -8001,11 +8000,18 @@
$("#modal_detail_non_kelurahan").modal('show'); $("#modal_detail_non_kelurahan").modal('show');
var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) { var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
if (result.address.Address != '') { // tay = result.address.Address;
var alamat = result.address.Address + `, ` // if (feature.administrasi.f3 == 'None') {
} else { // if (tay != '') {
var alamat = '' // var alamak = tay;
};
// } else {
// alamak = ""
// }
// } else {
// var alamak = feature.administrasi.f3;
// }
if (feature.administrasi.f9 == 'None') { if (feature.administrasi.f9 == 'None') {
var path_img = "static/img/image_null.jpg" var path_img = "static/img/image_null.jpg"
...@@ -8387,9 +8393,7 @@ ...@@ -8387,9 +8393,7 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
...@@ -8443,7 +8447,7 @@ ...@@ -8443,7 +8447,7 @@
</p> </p>
<p> <p>
<span> <span>
` + alamat + feature.administrasi.f1 + `, ` + feature.administrasi.f2 + `, ` + feature.administrasi.f3 + `, ` + feature.administrasi.f4 + ` ` + feature.administrasi.f1 + `, ` + feature.administrasi.f2 + `, ` + feature.administrasi.f3 + `, ` + feature.administrasi.f4 + `
</span> </span>
</p> </p>
</th> </th>
...@@ -8496,7 +8500,7 @@ ...@@ -8496,7 +8500,7 @@
</div> </div>
<div> <div>
<span> <span>
` + alamat + feature.administrasi.f1 + `, ` + feature.administrasi.f2 + `, ` + feature.administrasi.f3 + `, ` + feature.administrasi.f4 + ` ` + feature.administrasi.f1 + `, ` + feature.administrasi.f2 + `, ` + feature.administrasi.f3 + `, ` + feature.administrasi.f4 + `
</span> </span>
</div> </div>
...@@ -9014,10 +9018,16 @@ ...@@ -9014,10 +9018,16 @@
}; };
polylyly = L.polygon(list_poly_edit).addTo(map_bang) polylyly = L.polygon(list_poly_edit).addTo(map_bang)
polylyly.enableEdit(); // polylyly.enableEdit();
var hasil = (JSON.stringify(polylyly.toGeoJSON())) var hasil = (JSON.stringify(polylyly.toGeoJSON()))
// console.log(polylyly)
// console.log(hasil)
// $("#coorbangbaru").val(hasil);
$('#save-perbaikan_bang').click(function() { $('#save-perbaikan_bang').click(function() {
$("#coorbangbaru").val(hasil); $("#coorbangbaru").val(hasil);
console.log(hasil);
// console.log("tes");
}) })
} }
}) })
...@@ -9083,6 +9093,9 @@ ...@@ -9083,6 +9093,9 @@
data.append(keyss[0], data_umum[i][keyss[0]]) data.append(keyss[0], data_umum[i][keyss[0]])
} }
// console.log(data)
// console.log(data_umum)
$.ajax({ $.ajax({
url: "{% url 'apps:save-perbaikan-bang' %}", url: "{% url 'apps:save-perbaikan-bang' %}",
data: data, data: data,
......
This diff is collapsed.
...@@ -1648,129 +1648,8 @@ ...@@ -1648,129 +1648,8 @@
</div> </div>
</div> </div>
<div class="content-wrapper modal" id="input_perbaikan" style="display: none;padding: 60px;margin-left: 10%;border-radius:10px;top: -40px;"> <div id="input_perbaikan" class="modal fade">
<div class="content modal-md" style="padding: 15px;max-height: 550px;"> <!-- <div class="content-wrapper modal" id="input_perbaikan" style="display: none;padding: 60px;margin-left: 10%;border-radius:10px;top: -40px;"> -->
<!-- Main charts -->
<div class="panel panel-flat" style="display: none;width: 1000px;">
<div class="panel-header" style="height: 50px;background: #1E2233;border-top-left-radius: 10px;border-top-right-radius: 10px;">
<button type="button" class="close" onclick="destroyWraper()" style=" width: 30px;
color: white;
height: 30px;">&times;</button>
<h5 class="modal-title title-create" style="color: white;margin-left: 25px;padding-top: 10px;">Input Perbaikan</h5>
</div>
<div class="panel-body" style="padding-top: 10px;">
<div class="tabbable">
<ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<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">
<input type="text" class="hidden" id="id_jalan_perbaikan">
<input type="text" class="hidden" id="type_id">
<div id="map-insert" 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 Jalan :</label>
<input type="text" id="namajalan" class="form-control" value="">
</div>
<div class="form-group">
<label>Type Jalan :</label>
<input type="text" id="typejalan" class="form-control" value="">
</div>
<div class="form-group">
<label>Kelurahan :</label>
<input type="text" id="kelurahan" class="form-control" value="">
</div>
<div class="form-group">
<label>Kecamatan :</label>
<input type="text" id="kecamatan" class="form-control" value="">
</div>
<div class="form-group">
<label>Anggaran :</label>
<input type="text" id="anggaran" class="form-control" value="">
</div>
<div class="form-group">
<label>Pihak yang Mengesahkan :</label>
<input type="text" id="pihakpengesahan" class="form-control" value="">
</div>
<div class="form-group">
<label>Tanggal Disetujui :</label>
<input type="date" id="tgldisetujui" class="form-control" value="">
</div>
<div class="form-group">
<label>Tanggal Mulai Perbaikan :</label>
<input type="date" id="tglmulaiperbaikan" class="form-control" value="">
</div>
<div class="form-group">
<label>Tanggal Selesai Perbaikan :</label>
<input type="date" id="tglselesaiperbaikan" 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" class="form-control" value="">
</div>
<div class="form-group">
<label>Kontraktor :</label>
<input type="text" id="kontraktor" 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" class="form-control" value="">
</div>
<div class="form-group">
<label>Proposal (.pdf):</label>
<input type="file" id="proposal">
</div>
<div class="form-group">
<label>Bukti Selesai Perbaikan (.png/.jpg/.jpeg/):</label>
<input type="file" id="buktiselesai">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel-footer">
<button type="button" class="btn btn-info" id="save-perbaikan" 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> </div>
......
This diff is collapsed.
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