Commit 696fadf2 authored by Manggar Mahardhika's avatar Manggar Mahardhika

push go

parent 96f254b9
...@@ -15,6 +15,7 @@ urlpatterns = [ ...@@ -15,6 +15,7 @@ urlpatterns = [
path('input-perbaikan', views.inpuperbaikan, name='input-perbaikan'), path('input-perbaikan', views.inpuperbaikan, name='input-perbaikan'),
path('input-perbaikan-bang', views.inputperbaikanbangunan, name='input-perbaikan-bang'), path('input-perbaikan-bang', views.inputperbaikanbangunan, name='input-perbaikan-bang'),
path('save-perbaikan', views.saveperbaikan, name='save-perbaikan'), path('save-perbaikan', views.saveperbaikan, name='save-perbaikan'),
path('save-perbaikan-bang', views.saveperbaikanbangunan, name='save-perbaikan-bang'),
path('load-jl-by-id-detail', views.loadbyiddetail, name='load-jl-by-id-detail'), path('load-jl-by-id-detail', views.loadbyiddetail, name='load-jl-by-id-detail'),
path('get-jalan-perbaikan', views.getjalanperbaikan, name='get-jalan-perbaikan'), path('get-jalan-perbaikan', views.getjalanperbaikan, name='get-jalan-perbaikan'),
......
...@@ -648,9 +648,12 @@ def inputperbaikanbangunan(request): ...@@ -648,9 +648,12 @@ def inputperbaikanbangunan(request):
data_per.execute(""" data_per.execute("""
SELECT SELECT
name, name,
type, type_id,
json_build_object ( 'type', 'Feature', 'geometry', ST_AsGeoJSON ( geom :: geometry ) :: json ), json_build_object ( 'type', 'Feature', 'geometry', ST_AsGeoJSON ( geom :: geometry ) :: json ),
ID ID,
remark,
address_1,
address_2
FROM FROM
geo_bangunan geo_bangunan
WHERE WHERE
...@@ -714,6 +717,7 @@ def saveperbaikan(request): ...@@ -714,6 +717,7 @@ def saveperbaikan(request):
ll = ll.replace("[[","(") ll = ll.replace("[[","(")
coordinat = f'MULTILINESTRING({ll})' coordinat = f'MULTILINESTRING({ll})'
print(ll)
if coord['features'][0]['geometry']['type'] == 'Polygon': if coord['features'][0]['geometry']['type'] == 'Polygon':
print('tidakoke') print('tidakoke')
...@@ -801,6 +805,143 @@ def saveperbaikan(request): ...@@ -801,6 +805,143 @@ def saveperbaikan(request):
respon = {"data":data,"info":info,"code":code} respon = {"data":data,"info":info,"code":code}
return Response(respon) return Response(respon)
# from django.core.files.storage import FileSystemStorage
# import random
# import re
# import json
@api_view(('POST',))
def saveperbaikanbangunan(request):
type_id = '1'
id_object = request.POST.get("object_idbang")
name = request.POST.get("namebang")
type = request.POST.get("typebang")
# tgl_pembuatan = request.POST.get("tgl_pembuatanbang")
tgl_perbaikan = request.POST.get("tgl_perbaikanbang")
tgl_disetujui = request.POST.get("tgl_disetujuibang")
anggaran = request.POST.get("anggaranbang")
pj = request.POST.get("pjbang")
pj_lapangan = request.POST.get("pj_lapanganbang")
kontraktor = request.POST.get("kontraktorbang")
jenis_perbaikan = request.POST.get("jenis_perbaikanbang")
coor = request.POST.get("coordbang")
# for co in coor['features']:
# ll = coor['geometry']['coordinates']
# ll += ll
# ll = ll.replace(", "," ")
# ll = ll.replace("]][[","),(")
# ll = ll.replace("] [",", ")
# ll = ll.replace("]]",")")
# ll = ll.replace("[[","(")
# corcoran = ll
# p_create = coor.replace('"','')
# po_create = p_create.replace(', ','],[')
# cood_edit = json.loads(coor)
# co_edit = cood_edit['geometry']['coordinates']
yak = str(coor)
suk = yak.replace("""{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":""","")
sik = suk.replace("""}}""","")
cor = sik.replace("""[[[""","((")
coran = cor.replace("""]]]""","))")
ll = coran.replace(","," ")
ii = ll.replace("] [",",")
corcoran = f'MULTIPOLYGON({ii})'
print("-------------------")
print(str(corcoran))
print("-------------------")
# print(yak)
tgl_selesai = request.POST.get("tgl_selesaibang")
proposal = request.FILES.get("proposal_bang")
bukti_selesai = request.FILES.get("bukti_selesai_bang")
fss_p = FileSystemStorage(location='media/proposal/')
fss_b = FileSystemStorage(location='media/bukti_penyelesaian/')
try:
format = (proposal.name).split(".")
num = random.randrange(1, 10000000000000)
nproposal = f"{name}_{num}.{format[-1:][0]}"
nproposal = nproposal.replace(" ","-")
filename_p = fss_p.save(nproposal, proposal)
url_p = fss_p.url(filename_p)
nbukti = f"{name}_{num}.{format[-1:][0]}"
nbukti = nbukti.replace(" ","-")
filename_b = fss_b.save(nbukti, bukti_selesai)
url_b = fss_b.url(filename_b)
with conn.cursor() as data_per:
data_per.execute("""
INSERT INTO tbl_perbaikan (
type_id,
id_object,
name,
type,
tgl_selesai,
tgl_perbaikan,
tgl_disetujui,
anggaran,
proposal,
bukti_selesai,
pj,
pj_lapangan,
kontraktor,
jenis_perbaikan,
geom
)
VALUES
(
%s,
%s,
'%s',
'%s',
'%s',
'%s',
'%s',
%s,
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
ST_GeomFromText('%s')
)
"""% (
int(type_id),
int(id_object),
name,
type,
tgl_selesai,
tgl_perbaikan,
tgl_disetujui,
int(anggaran),
nproposal,
nbukti,
pj,
pj_lapangan,
kontraktor,
jenis_perbaikan,
corcoran))
conn.commit()
data = "Sukses"
info = "Data Telah Berhasil di Perbaharui"
code = 0
except:
data = "Pastikan Semua Data Terisi Termasuk Proposal dan Bukti Selesai"
info = "Oops"
code = 1
respon = {"data":data,"info":info,"code":code}
return Response(respon)
@api_view(('GET',)) @api_view(('GET',))
def loadbyiddetail(request): def loadbyiddetail(request):
id = request.GET.get('id') id = request.GET.get('id')
......
...@@ -130,21 +130,21 @@ ...@@ -130,21 +130,21 @@
<ul class="nav nav-tabs nav-tabs-bottom nav-justified"> <ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<button type="button" class="close" onclick="destroyWraper()">&times;</button> <button type="button" class="close" onclick="destroyWraper()">&times;</button>
<li class="active"><a href="#left-tab-input-coordinat" data-toggle="tab">Koordinat</a></li> <li class="active"><a href="#left-tab-input-coordinat_bang" data-toggle="tab">Koordinat</a></li>
<li><a href="#right-tab-input-informasi" data-toggle="tab">Insert Informasi</a></li> <li><a href="#right-tab-input-informasi_bang" data-toggle="tab">Insert Informasi</a></li>
</ul> </ul>
</div> </div>
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane active" id="left-tab-input-coordinat"> <div class="tab-pane active" id="left-tab-input-coordinat_bang">
<div class="modal-body" style="max-height: 450px;overflow-y: auto;"> <div class="modal-body" style="max-height: 450px;overflow-y: auto;">
<input type="text" class="hidden" id="poly_create_input_bang"> <input type="text" class="hidden" id="poly_create_input_bang">
<input type="text" class="hidden" id="id_bang_perbaikan"> <input type="text" class="hidden" id="id_bang_perbaikan">
<input type="text" class="hidden" id="type_id_bang"> <input type="text" class="hidden" id="type_id_bang">
<div id="map-insert-bang" style="height: 375px;width: 100%"> <div id="map-insert-renov-bang" style="height: 375px;width: 100%">
</div> </div>
</div> </div>
</div> </div>
<div class="tab-pane" id="right-tab-input-informasi"> <div class="tab-pane" id="right-tab-input-informasi_bang">
<div class="modal-body" style="max-height: 415px;overflow-y: auto;"> <div class="modal-body" style="max-height: 415px;overflow-y: auto;">
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
...@@ -232,6 +232,7 @@ ...@@ -232,6 +232,7 @@
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
<input type="text" id="coorbangbaru" class="form-control" value="">
<button type="button" class="btn btn-info" id="save-perbaikan_bang" style="float: right; margin-right: 40px;">SAVE</button> <button type="button" class="btn btn-info" id="save-perbaikan_bang" style="float: right; margin-right: 40px;">SAVE</button>
<button type="button" class="btn btn-link" onclick="destroyWraper()" style="float: right;">Close</button> <button type="button" class="btn btn-link" onclick="destroyWraper()" style="float: right;">Close</button>
......
This diff is collapsed.
...@@ -358,7 +358,6 @@ ...@@ -358,7 +358,6 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div id="modal_bangunan_delete" class="modal fade"> <div id="modal_bangunan_delete" class="modal fade">
<div class="modal-dialog" style="width: max-content;height: max-content;"> <div class="modal-dialog" style="width: max-content;height: max-content;">
...@@ -392,6 +391,127 @@ ...@@ -392,6 +391,127 @@
</div> </div>
</div> </div>
<div id="input_perbaikan_bang" class="modal fade">
<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">Renovasi Bangunan</h6>
</div>
<div class="modal-body" style="max-height: 450px;overflow-y: auto;">
<div class="tab-pane has-padding" id="panel-tab2">
<div class="tab-pane" id="bottom-justified-data">
<div class="tabbable">
<ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<li onclick="changetabs(this)" class="active"><a href="#left-tab1-feas-upl" data-toggle="tab">Koordinat</a></li>
<li onclick="changetabs(this)"><a href="#right-tab2-feas-upl" data-toggle="tab">Informasi Umum</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="left-tab1-feas-upl">
<input type="text" class="hidden" id="poly_create_input_bang">
<input type="text" class="hidden" id="id_bang_perbaikan">
<input type="text" class="hidden" id="type_id_bang">
<div id="map-insert-renov-bang" style="height: 375px;width: 100%">
</div>
</div>
<div class="tab-pane" id="right-tab2-feas-upl">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>Nama :</label>
<input type="text" id="nama_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Type :</label>
<input type="text" id="type_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Kelurahan :</label>
<input type="text" id="kelurahan_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Kecamatan :</label>
<input type="text" id="kecamatan_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Tanggal Disetujui :</label>
<input type="date" id="tgldisetujui_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Tanggal Mulai Perbaikan :</label>
<input type="date" id="tglmulaiperbaikan_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Tanggal Selesai Perbaikan :</label>
<input type="date" id="tglselesaiperbaikan_bang" class="form-control" value="">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Anggaran :</label>
<input type="text" id="anggaran_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Pihak yang Mengesahkan :</label>
<input type="text" id="pihakpengesahan_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Penanggung Jawab Lapangan :</label>
<input type="text" id="pjlapangan_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Kontraktor :</label>
<input type="text" id="kontraktor_bang" 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_bang" class="form-control" value="">
</div>
<div class="form-group">
<label>Proposal (.pdf):</label>
<input type="file" id="proposal_bang">
</div>
<div class="form-group">
<label>Bukti Selesai Perbaikan (.png/.jpg/.jpeg/):</label>
<input type="file" id="buktiselesai_bang">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<input type="text" id="coorbangbaru" class="form-control" value="">
<button type="button" class="btn btn-info" id="save-perbaikan_bang" style="float: right; margin-right: 40px;">SAVE</button>
</div>
</div>
</div>
</div>
<!-- modal tuplah --> <!-- modal tuplah -->
<div id="modal-edit-tuplah" class="modal fade"> <div id="modal-edit-tuplah" class="modal fade">
<div class="modal-dialog" style="width: max-content;height: max-content;"> <div class="modal-dialog" style="width: max-content;height: max-content;">
......
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