Commit d5ab8921 authored by Manggar Mahardhika's avatar Manggar Mahardhika

push data perbaikan full renov

parent 2c448ef9
......@@ -101,8 +101,11 @@ urlpatterns = [
path('download_perbaikan_data', views.download_perbaikan_data),
path('search_list_perbaikan', views.search_list_perbaikan),
path('dataperbaikan', views.data_perbaikan),
path('deletedataperb', views.deletedataperb),
path('pointBangunan', views.pointBangunan),
path('pointBangunan_', views.pointBangunan_),
path('editperb', views.editperb),
]
\ No newline at end of file
......@@ -4479,12 +4479,16 @@ def data_perbaikan(request):
tp.tgl_selesai,
gdl.desa,
gdc.kecamatan,
tp.id
tp.id,
tp.tgl_disetujui,
tp.proposal,
tp.bukti_selesai
FROM
( SELECT tbl_perbaikan.*, ROW_NUMBER ( ) OVER ( PARTITION BY id_object ORDER BY tgl_selesai DESC ) AS rn FROM tbl_perbaikan ) tp
JOIN geo_label gl ON gl.ID = tp.type_id
JOIN geo_data_kelurahan gdl on st_intersects(st_setsrid(gdl.geom, 4326), st_setsrid(tp.geom, 4326))
JOIN geo_data_kecamatan gdc ON st_intersects ( st_setsrid ( gdc.geom, 4326 ), st_setsrid ( tp.geom, 4326 ) )
where tp.is_deleted = 0
ORDER BY tp.id desc
""")
res_perbaikan = data_per.fetchall()
......@@ -4502,11 +4506,36 @@ def data_perbaikan(request):
'desa':j[7],
'kecamatan':j[8],
'id':j[9],
'tgl_disetujui':j[10],
'proposal':j[11],
'bukti_selesai':j[12],
}
res_all.append(data_all)
return Response(res_all)
@api_view(('POST',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def deletedataperb(request):
id_perb = request.POST.get('id_perb')
id_object = request.POST.get('id_perb_object')
try:
with conn.cursor() as desa:
desa.execute("""UPDATE tbl_perbaikan set is_deleted = 1 where id=%s and id_object=%s"""%( int(id_perb), int(id_object)))
conn.commit()
data = 'SUCCESS'
info = 'data telah diperbaharui'
status = 0
except:
data = 'NOT SUCCESS'
info = 'Hubungi Orang Server'
status = 1
respon={'data':data, 'info':info, 'code':status}
return Response(respon)
def pointBangunan(request):
# with conn.cursor() as points:
# points.execute("SELECT st_astext(ST_centroid(geom)) FROM geo_bangunan")
......@@ -4537,4 +4566,72 @@ def pointBangunan_(request):
for i in point:
result.append(i[0])
return JsonResponse({'result':result})
\ No newline at end of file
return JsonResponse({'result':result})
@api_view(('POST',))
def editperb(request):
id_perb = request.POST.get('id_perb')
id_obj = request.POST.get('id_obj')
namobj = request.POST.get('namobj')
anggaran = request.POST.get('anggaran')
sumber_dana = request.POST.get('sumber_dana')
pihak_sah = request.POST.get('pihak_sah')
pj_lap = request.POST.get('pj_lap')
kontraktor = request.POST.get('kontraktor')
tgl_disetujui = request.POST.get('tgl_disetujui')
tgl_perbaikan = request.POST.get('tgl_perbaikan')
tgl_selesai = request.POST.get('tgl_selesai')
save = saver()
proposal = request.POST.get('proposal')
file1 = request.FILES.get('file_proposal')
fss = FileSystemStorage(location=str(str(save)+'proposal/'))
try:
format = (file1.name).split(".")
num = random.randrange(1, 10000000000000)
namafile = f"{namobj}_{num}.{format[-1:][0]}"
filename = fss.save(namafile, file1)
# print(file.name)
url = fss.url(filename)
except:
namafile = proposal
bukti_selesai = request.POST.get('bukti_selesai')
file2 = request.FILES.get('file_bukti')
fss2 = FileSystemStorage(location=str(str(save)+'bukti_penyelesaian/'))
try:
format = (file2.name).split(".")
num2 = random.randrange(1, 10000000000000)
namafile2 = f"{namobj}_{num2}.{format[-1:][0]}"
filename2 = fss2.save(namafile2, file2)
# print(file.name)
url2 = fss2.url(filename2)
except:
namafile2 = bukti_selesai
with conn.cursor() as editka:
editka.execute("""update tbl_perbaikan
set
anggaran = %s,
sumber_dana = '%s',
pj = '%s',
pj_lapangan = '%s',
kontraktor = '%s',
tgl_disetujui = '%s',
tgl_perbaikan = '%s',
tgl_selesai = '%s',
proposal = '%s',
bukti_selesai = '%s'
where id = %s and id_object = %s"""
%(anggaran, sumber_dana, pihak_sah, pj_lap, kontraktor, tgl_disetujui, tgl_perbaikan, tgl_selesai, namafile, namafile2, id_perb, id_obj))
conn.commit()
data = 'SUCCESS'
info = 'data telah diperbaharui'
status = 0
respon={'data':data, 'info': info, 'status':status}
return Response(respon)
This diff is collapsed.
......@@ -42,6 +42,7 @@ $("#upload_image").change(function() {
})
});
// perbaikan jalan
function getdetailper(id) {
$(".map_detail_p_p").html(``)
// console.log(id)
......@@ -73,6 +74,7 @@ function getdetailper(id) {
if (data.length === 0) {
$(".nama_detail_dash").text("Null");
$(".type_detail_dash").html("Null");
$(".tanggal_perbaikan_detail_dash").html("Null")
......@@ -82,6 +84,7 @@ function getdetailper(id) {
$(".kontraktor_detail_dash").html("Null")
$(".panjang_jalan_detail_dash").html("Null")
$(".lebar_jalan_detail_dash").html("Null")
$(".proposal_detail_dash").html(`
<a href="media/proposal/null" id="downloadproposal ">
<img src="{% static 'img/icon-1/proposal.svg' %} " alt=" " style="height: 65px;width: 65px; ">
......@@ -105,17 +108,17 @@ function getdetailper(id) {
// $(".kontraktor_detail_dash").html(data[0]['kontraktor'])
$(".panjang_jalan_detail_dash").html(data[0]['panjang'])
$(".lebar_jalan_detail_dash").html(data[0]['lbr_jln_reno'])
// $(".proposal_detail_dash").html(`
// <a href="static/media/proposal/` + data[0]['proposal'] + `" target="_blank" "id="downloadproposal">
// <img src="static/img/icon-1/proposal.svg" alt=" " style="height: 65px;width: 65px; ">
// </a>`);
$(".proposal_detail_dash").html(`
<a href="static/media/proposal/` + data[0]['proposal'] + `" target="_blank" "id="downloadproposal">
<img src="static/img/icon-1/proposal.svg" alt=" " style="height: 65px;width: 65px; ">
</a>`);
// $(".bukti_detail_perbaikan_dash").html(`
// <a href="static/media/bukti_penyelesaian/` + data[0].bukti_selesai + `" target="_blank" id="view-bukti">
// <img src="static/img/icon-1/bukti.svg" alt=" " style="height: 70px;
// width: 50px;">
// </a>`);
$(".bukti_detail_perbaikan_dash").html(`
<a href="static/media/bukti_penyelesaian/` + data[0].bukti_selesai + `" target="_blank" id="view-bukti">
<img src="static/img/icon-1/bukti.svg" alt=" " style="height: 70px;
width: 50px;">
</a>`);
//hide ngaco
// $("#bkt_ang").html(``)
......
This diff is collapsed.
This diff is collapsed.
......@@ -1655,7 +1655,7 @@
</div>
<div style="margin-top: 20px; ">
<!-- <div class="row">
<div class="row">
<div class="col-md-6 " id="bkt_prop">
<div>
<span>Proposal</span>
......@@ -1676,7 +1676,7 @@
</div>
</div>
</div> -->
</div>
<div>
<span>Ruas yang diperbaiki</span>
<!-- <div class="row">
......
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