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

fix perbaikan bangunan dan jalan

parent 4a9869d6
......@@ -823,7 +823,8 @@ import re
import json
@api_view(('POST',))
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")
name = request.POST.get("name")
type = request.POST.get("type")
......@@ -852,29 +853,40 @@ def saveperbaikan(request):
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/')
coord = json.loads(str(coor))
# coord = json.loads(str(coor))
pjg_perbaikan = re.sub('[^0-9.]+', '', str(pjg_perbaikan))
lbr_perbaikan = re.sub('[^0-9.]+', '', str(lbr_perbaikan))
luas = re.sub('[^0-9.]+', '', str(luas))
if coord['features'][0]['geometry']['type'] == 'LineString':
print("oke")
for co in coord['features']:
ll = str(co["geometry"]['coordinates'])
ll += ll
ll = ll.replace(", "," ")
ll = ll.replace("]][[","),(")
ll = ll.replace("] [",", ")
ll = ll.replace("]]",")")
ll = ll.replace("[[","(")
coordinat = f'MULTILINESTRING({ll})'
print(ll)
if coord['features'][0]['geometry']['type'] == 'Polygon':
print('tidakoke')
# if coord['features'][0]['geometry']['type'] == 'LineString':
# print("oke")
# for co in coord['features']:
# ll = str(co["geometry"]['coordinates'])
# ll += ll
# ll = ll.replace(", "," ")
# ll = ll.replace("]][[","),(")
# ll = ll.replace("] [",", ")
# ll = ll.replace("]]",")")
# ll = ll.replace("[[","(")
# coordinat = f'MULTILINESTRING({ll})'
# print(ll)
# if coord['features'][0]['geometry']['type'] == 'Polygon':
# 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(".")
num = random.randrange(1, 10000000000000)
nproposal = f"{name}_{num}.{format[-1:][0]}"
......@@ -888,6 +900,13 @@ def saveperbaikan(request):
filename_b = fss_b.save(nbukti, bukti_selesai)
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:
data_per.execute("""
INSERT INTO tbl_perbaikan (
......@@ -946,7 +965,7 @@ def saveperbaikan(request):
float(pjg_perbaikan),
float(lbr_perbaikan),
jenis_perbaikan,
coordinat))
corcoran))
conn.commit()
data = "Sukses"
info = "Data Telah Berhasil di Perbaharui"
......
......@@ -4883,7 +4883,6 @@
} else {
var alamak = feature.administrasi.f3;
}
if (feature.administrasi.f10 == 'bpk') {
var raja = "";
......@@ -8001,11 +8000,18 @@
$("#modal_detail_non_kelurahan").modal('show');
var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
if (result.address.Address != '') {
var alamat = result.address.Address + `, `
} else {
var alamat = ''
};
// tay = result.address.Address;
// if (feature.administrasi.f3 == 'None') {
// if (tay != '') {
// var alamak = tay;
// } else {
// alamak = ""
// }
// } else {
// var alamak = feature.administrasi.f3;
// }
if (feature.administrasi.f9 == 'None') {
var path_img = "static/img/image_null.jpg"
......@@ -8387,9 +8393,7 @@
</div>
</div>
</div>
</div>
</div>
</div>
</div>
......@@ -8443,7 +8447,7 @@
</p>
<p>
<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>
</p>
</th>
......@@ -8496,7 +8500,7 @@
</div>
<div>
<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>
</div>
......@@ -9014,10 +9018,16 @@
};
polylyly = L.polygon(list_poly_edit).addTo(map_bang)
polylyly.enableEdit();
// polylyly.enableEdit();
var hasil = (JSON.stringify(polylyly.toGeoJSON()))
// console.log(polylyly)
// console.log(hasil)
// $("#coorbangbaru").val(hasil);
$('#save-perbaikan_bang').click(function() {
$("#coorbangbaru").val(hasil);
console.log(hasil);
// console.log("tes");
})
}
})
......@@ -9083,6 +9093,9 @@
data.append(keyss[0], data_umum[i][keyss[0]])
}
// console.log(data)
// console.log(data_umum)
$.ajax({
url: "{% url 'apps:save-perbaikan-bang' %}",
data: data,
......
This diff is collapsed.
......@@ -1648,129 +1648,8 @@
</div>
</div>
<div class="content-wrapper modal" id="input_perbaikan" style="display: none;padding: 60px;margin-left: 10%;border-radius:10px;top: -40px;">
<div class="content modal-md" style="padding: 15px;max-height: 550px;">
<!-- 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 id="input_perbaikan" class="modal fade">
<!-- <div class="content-wrapper modal" id="input_perbaikan" style="display: none;padding: 60px;margin-left: 10%;border-radius:10px;top: -40px;"> -->
</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