Commit d5ab8921 authored by Manggar Mahardhika's avatar Manggar Mahardhika

push data perbaikan full renov

parent 2c448ef9
...@@ -101,8 +101,11 @@ urlpatterns = [ ...@@ -101,8 +101,11 @@ urlpatterns = [
path('download_perbaikan_data', views.download_perbaikan_data), path('download_perbaikan_data', views.download_perbaikan_data),
path('search_list_perbaikan', views.search_list_perbaikan), path('search_list_perbaikan', views.search_list_perbaikan),
path('dataperbaikan', views.data_perbaikan), path('dataperbaikan', views.data_perbaikan),
path('deletedataperb', views.deletedataperb),
path('pointBangunan', views.pointBangunan), path('pointBangunan', views.pointBangunan),
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): ...@@ -4479,12 +4479,16 @@ def data_perbaikan(request):
tp.tgl_selesai, tp.tgl_selesai,
gdl.desa, gdl.desa,
gdc.kecamatan, gdc.kecamatan,
tp.id tp.id,
tp.tgl_disetujui,
tp.proposal,
tp.bukti_selesai
FROM FROM
( SELECT tbl_perbaikan.*, ROW_NUMBER ( ) OVER ( PARTITION BY id_object ORDER BY tgl_selesai DESC ) AS rn FROM tbl_perbaikan ) tp ( 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_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_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 ) ) 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 ORDER BY tp.id desc
""") """)
res_perbaikan = data_per.fetchall() res_perbaikan = data_per.fetchall()
...@@ -4502,11 +4506,36 @@ def data_perbaikan(request): ...@@ -4502,11 +4506,36 @@ def data_perbaikan(request):
'desa':j[7], 'desa':j[7],
'kecamatan':j[8], 'kecamatan':j[8],
'id':j[9], 'id':j[9],
'tgl_disetujui':j[10],
'proposal':j[11],
'bukti_selesai':j[12],
} }
res_all.append(data_all) res_all.append(data_all)
return Response(res_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): def pointBangunan(request):
# with conn.cursor() as points: # with conn.cursor() as points:
# points.execute("SELECT st_astext(ST_centroid(geom)) FROM geo_bangunan") # points.execute("SELECT st_astext(ST_centroid(geom)) FROM geo_bangunan")
...@@ -4538,3 +4567,71 @@ def pointBangunan_(request): ...@@ -4538,3 +4567,71 @@ def pointBangunan_(request):
result.append(i[0]) result.append(i[0])
return JsonResponse({'result':result}) 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)
...@@ -734,10 +734,16 @@ def loadDetail(request): ...@@ -734,10 +734,16 @@ def loadDetail(request):
tp.id, tp.id,
tp.proposal, tp.proposal,
tp.bukti_selesai, tp.bukti_selesai,
tp.jenis_perbaikan tp.jenis_perbaikan,
gdl.desa,
gdc.kecamatan,
tp.sumber_dana,
tp.tgl_disetujui
FROM FROM
tbl_perbaikan tp tbl_perbaikan tp
JOIN geo_label gl ON gl.ID = tp.type_id 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.id_object = %s and tp.id = %s"""% (id_object,id)) where tp.id_object = %s and tp.id = %s"""% (id_object,id))
res_perbaikan = data_per.fetchall() res_perbaikan = data_per.fetchall()
...@@ -762,7 +768,11 @@ def loadDetail(request): ...@@ -762,7 +768,11 @@ def loadDetail(request):
'id':j[15], 'id':j[15],
'proposal':j[16], 'proposal':j[16],
'bukti_selesai':j[17], 'bukti_selesai':j[17],
'jenis_perbaikan':j[18] 'jenis_perbaikan':j[18],
'desa':j[19],
'kecamatan':j[20],
'sumber_dana':j[21],
'tgl_disetujui':j[22]
} }
res_all.append(data_all) res_all.append(data_all)
...@@ -826,11 +836,30 @@ def saveperbaikan(request): ...@@ -826,11 +836,30 @@ def saveperbaikan(request):
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")
tgl_pembuatan = request.POST.get("tgl_pembuatan") tgl_pembuatan = request.POST.get("tgl_pembuatan")
tgl_perbaikan = request.POST.get("tgl_perbaikan")
tgl_disetujui = request.POST.get("tgl_disetujui")
anggaran = request.POST.get("anggaran")
tgl_perbaikan1 = request.POST.get("tgl_perbaikan")
if tgl_perbaikan1 == '':
tgl_perbaikan = '0001-01-01'
else :
tgl_perbaikan = tgl_perbaikan1
tgl_disetujui1 = request.POST.get("tgl_disetujui")
if tgl_disetujui1 == '':
tgl_disetujui = '0001-01-01'
else :
tgl_disetujui = tgl_disetujui1
tgl_selesai1 = request.POST.get("tgl_selesai")
if tgl_selesai1 == '':
tgl_selesai = '0001-01-01'
else :
tgl_selesai = tgl_selesai1
anggaran1 = request.POST.get("anggaran")
if anggaran1 == '':
anggaran = 0
else :
anggaran = anggaran1
pj = request.POST.get("pj") pj = request.POST.get("pj")
pj_lapangan = request.POST.get("pj_lapangan") pj_lapangan = request.POST.get("pj_lapangan")
...@@ -841,15 +870,7 @@ def saveperbaikan(request): ...@@ -841,15 +870,7 @@ def saveperbaikan(request):
jenis_perbaikan = request.POST.get("jenis_perbaikan") jenis_perbaikan = request.POST.get("jenis_perbaikan")
# luas = request.POST.get("luas") # luas = request.POST.get("luas")
coor = request.POST.get("coord") coor = request.POST.get("coord")
tgl_selesai = request.POST.get("tgl_selesai")
proposal = request.FILES.get("proposal")
bukti_selesai = request.FILES.get("bukti_selesai")
print(coor, proposal)
save = saver()
fss_p = FileSystemStorage(location=str(str(save)+'proposal/'))
fss_b = FileSystemStorage(location=str(str(save)+'bukti_penyelesaian/'))
# coord = json.loads(str(coor)) # coord = json.loads(str(coor))
...@@ -892,28 +913,43 @@ def saveperbaikan(request): ...@@ -892,28 +913,43 @@ def saveperbaikan(request):
sek = siap.replace("]]]",")") sek = siap.replace("]]]",")")
corcoran = f'MULTILINESTRING({sek})' corcoran = f'MULTILINESTRING({sek})'
print(corcoran) # print(corcoran)
format = (proposal.name).split(".") proposal = request.FILES.get("proposal")
bukti_selesai = request.FILES.get("bukti_selesai")
print(proposal, bukti_selesai)
save = saver()
xproposal = 'None'
xbukti = 'None'
if proposal is not None:
fss_p = FileSystemStorage(location=str(str(save)+'proposal/'))
num = random.randrange(1, 10000000000000) num = random.randrange(1, 10000000000000)
format = (proposal.name).split(".")
nproposal = f"{name}_{num}.{format[-1:][0]}" nproposal = f"{name}_{num}.{format[-1:][0]}"
nproposal = nproposal.replace(" ","-") nproposal = nproposal.replace(" ","-")
xproposal = nproposal
filename_p = fss_p.save(nproposal, proposal) filename_p = fss_p.save(nproposal, proposal)
url_p = fss_p.url(filename_p) url_p = fss_p.url(filename_p)
if bukti_selesai is not None:
fss_b = FileSystemStorage(location=str(str(save)+'bukti_penyelesaian/'))
num = random.randrange(1, 10000000000000)
format_ = (bukti_selesai.name).split(".") format_ = (bukti_selesai.name).split(".")
nbukti = f"{name}_{num}.{format_[-1:][0]}" nbukti = f"{name}_{num}.{format_[-1:][0]}"
nbukti = nbukti.replace(" ","-") nbukti = nbukti.replace(" ","-")
xbukti = nbukti
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("-------------------")
print(str(corcoran)) # print(str(corcoran))
print("-------------------") # 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(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("-------------------") # print("-------------------")
try: # 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 (
...@@ -921,6 +957,9 @@ def saveperbaikan(request): ...@@ -921,6 +957,9 @@ def saveperbaikan(request):
id_object, id_object,
name, name,
type, type,
pjg_perbaikan,
lbr_perbaikan,
jenis_perbaikan,
tgl_selesai, tgl_selesai,
tgl_perbaikan, tgl_perbaikan,
tgl_disetujui, tgl_disetujui,
...@@ -930,9 +969,6 @@ def saveperbaikan(request): ...@@ -930,9 +969,6 @@ def saveperbaikan(request):
pj, pj,
pj_lapangan, pj_lapangan,
kontraktor, kontraktor,
pjg_perbaikan,
lbr_perbaikan,
jenis_perbaikan,
sumber_dana, sumber_dana,
geom geom
) )
...@@ -942,17 +978,17 @@ def saveperbaikan(request): ...@@ -942,17 +978,17 @@ def saveperbaikan(request):
%s, %s,
'%s', '%s',
'%s', '%s',
%s,
%s,
'%s', '%s',
'%s', '%s',
'%s', '%s',
%s,
'%s', '%s',
%s,
'%s', '%s',
'%s', '%s',
'%s', '%s',
'%s', '%s',
%s,
%s,
'%s', '%s',
'%s', '%s',
ST_GeomFromText('%s') ST_GeomFromText('%s')
...@@ -962,29 +998,29 @@ def saveperbaikan(request): ...@@ -962,29 +998,29 @@ def saveperbaikan(request):
int(id_object), int(id_object),
name, name,
type, type,
float(pjg_perbaikan),
float(lbr_perbaikan),
jenis_perbaikan,
tgl_selesai, tgl_selesai,
tgl_perbaikan, tgl_perbaikan,
tgl_disetujui, tgl_disetujui,
int(anggaran), anggaran,
nproposal, xproposal,
nbukti, xbukti,
pj, pj,
pj_lapangan, pj_lapangan,
kontraktor, kontraktor,
float(pjg_perbaikan),
float(lbr_perbaikan),
jenis_perbaikan,
sumber_dana, sumber_dana,
corcoran)) corcoran))
conn.commit() err = conn.commit()
data = "Sukses" data = err
info = "Data Telah Berhasil di Perbaharui" info = "Data Telah Berhasil di Perbaharui"
code = 0 code = 0
except: # except:
data = "Pastikan Semua Data Terisi Termasuk Proposal dan Bukti Selesai" # data = "Pastikan Semua Data Terisi Termasuk Proposal dan Bukti Selesai"
info = "Oops" # info = "Oops"
code = 1 # code = 1
respon = {"data":data,"info":info,"code":code} respon = {"data":data,"info":info,"code":code}
return Response(respon) return Response(respon)
# return 1 # return 1
...@@ -1347,3 +1383,4 @@ def sendmail(request): ...@@ -1347,3 +1383,4 @@ def sendmail(request):
context = data context = data
return Response(context) return Response(context)
...@@ -42,6 +42,7 @@ $("#upload_image").change(function() { ...@@ -42,6 +42,7 @@ $("#upload_image").change(function() {
}) })
}); });
// perbaikan jalan
function getdetailper(id) { function getdetailper(id) {
$(".map_detail_p_p").html(``) $(".map_detail_p_p").html(``)
// console.log(id) // console.log(id)
...@@ -73,6 +74,7 @@ function getdetailper(id) { ...@@ -73,6 +74,7 @@ function getdetailper(id) {
if (data.length === 0) { if (data.length === 0) {
$(".nama_detail_dash").text("Null"); $(".nama_detail_dash").text("Null");
$(".type_detail_dash").html("Null"); $(".type_detail_dash").html("Null");
$(".tanggal_perbaikan_detail_dash").html("Null") $(".tanggal_perbaikan_detail_dash").html("Null")
...@@ -82,6 +84,7 @@ function getdetailper(id) { ...@@ -82,6 +84,7 @@ function getdetailper(id) {
$(".kontraktor_detail_dash").html("Null") $(".kontraktor_detail_dash").html("Null")
$(".panjang_jalan_detail_dash").html("Null") $(".panjang_jalan_detail_dash").html("Null")
$(".lebar_jalan_detail_dash").html("Null") $(".lebar_jalan_detail_dash").html("Null")
$(".proposal_detail_dash").html(` $(".proposal_detail_dash").html(`
<a href="media/proposal/null" id="downloadproposal "> <a href="media/proposal/null" id="downloadproposal ">
<img src="{% static 'img/icon-1/proposal.svg' %} " alt=" " style="height: 65px;width: 65px; "> <img src="{% static 'img/icon-1/proposal.svg' %} " alt=" " style="height: 65px;width: 65px; ">
...@@ -105,17 +108,17 @@ function getdetailper(id) { ...@@ -105,17 +108,17 @@ function getdetailper(id) {
// $(".kontraktor_detail_dash").html(data[0]['kontraktor']) // $(".kontraktor_detail_dash").html(data[0]['kontraktor'])
$(".panjang_jalan_detail_dash").html(data[0]['panjang']) $(".panjang_jalan_detail_dash").html(data[0]['panjang'])
$(".lebar_jalan_detail_dash").html(data[0]['lbr_jln_reno']) $(".lebar_jalan_detail_dash").html(data[0]['lbr_jln_reno'])
// $(".proposal_detail_dash").html(` $(".proposal_detail_dash").html(`
// <a href="static/media/proposal/` + data[0]['proposal'] + `" target="_blank" "id="downloadproposal"> <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; "> <img src="static/img/icon-1/proposal.svg" alt=" " style="height: 65px;width: 65px; ">
// </a>`); </a>`);
// $(".bukti_detail_perbaikan_dash").html(` $(".bukti_detail_perbaikan_dash").html(`
// <a href="static/media/bukti_penyelesaian/` + data[0].bukti_selesai + `" target="_blank" id="view-bukti"> <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; <img src="static/img/icon-1/bukti.svg" alt=" " style="height: 70px;
// width: 50px;"> width: 50px;">
// </a>`); </a>`);
//hide ngaco //hide ngaco
// $("#bkt_ang").html(``) // $("#bkt_ang").html(``)
......
...@@ -2184,19 +2184,19 @@ var geo_jalan = L.geoJson(null, { ...@@ -2184,19 +2184,19 @@ var geo_jalan = L.geoJson(null, {
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group"> <div class="form-group">
<label>Nama Jalan :</label> <label>Nama Jalan : <label style="color:red;">*</label></label>
<input type="text" id="namajalan2" class="form-control" value=""> <input type="text" id="namajalan2" class="form-control" value="">
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Type Jalan :</label> <label>Type Jalan : <label style="color:red;">*</label></label>
<input type="text" id="typejalan" class="form-control" value=""> <input type="text" id="typejalan" class="form-control" value="">
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Kelurahan :</label> <label>Kelurahan : <label style="color:red;">*</label></label>
<input type="text" id="kelurahan" class="form-control" value=""> <input type="text" id="kelurahan" class="form-control" value="">
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Kecamatan :</label> <label>Kecamatan : <label style="color:red;">*</label></label>
<input type="text" id="kecamatan" class="form-control" value=""> <input type="text" id="kecamatan" class="form-control" value="">
</div> </div>
<div class="form-group"> <div class="form-group">
...@@ -2222,35 +2222,39 @@ var geo_jalan = L.geoJson(null, { ...@@ -2222,35 +2222,39 @@ var geo_jalan = L.geoJson(null, {
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group"> <div class="form-group">
<label>Penanggung Jawab Lapangan :</label> <label>Jenis Perbaikan : <label style="color:red;">*</label></label>
<input type="text" id="pjlapangan" class="form-control" value=""> <input type="text" id="jenisperbaikan" class="form-control" value="">
</div>
<div class="form-group">
<label>Kontraktor :</label>
<input type="text" id="kontraktor" class="form-control" value="">
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Panjang Jalan Keseluruhan :</label> <label>Panjang Jalan Keseluruhan : <label style="color:red;">*</label></label>
<input type="text" id="panjangjalanall" class="form-control" value=""> <input type="text" id="panjangjalanall" class="form-control" value="">
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Panjang Jalan Perbaikan :</label> <label>Panjang Jalan Perbaikan : <label style="color:red;">*</label></label>
<input type="text" id="panjangjalanperbaikan" class="form-control" value=""> <input type="text" id="panjangjalanperbaikan" class="form-control" value="">
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Sumber Dana :</label> <label>Lebar Jalan Perbaikan : <label style="color:red;">*</label></label>
<input type="text" id="sumber_dana" class="form-control" value=""> <input type="text" id="lebarjalanperbaikan" class="form-control" value="">
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Lebar Jalan Perbaikan :</label> <label>Penanggung Jawab Lapangan :</label>
<input type="text" id="lebarjalanperbaikan" class="form-control" value=""> <input type="text" id="pjlapangan" class="form-control" value="">
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Jenis Perbaikan :</label> <label>Kontraktor :</label>
<input type="text" id="jenisperbaikan" class="form-control" value=""> <input type="text" id="kontraktor" class="form-control" value="">
</div> </div>
<div class="form-group">
<label>Sumber Dana :</label>
<input type="text" id="sumber_dana" class="form-control" value="">
</div>
<div class="form-group"> <div class="form-group">
<label>Proposal (.pdf):</label> <label>Proposal (.pdf):</label>
<input type="file" id="proposal"> <input type="file" id="proposal">
...@@ -3168,14 +3172,14 @@ $(document).on("click", "#btn_perbaikan_jalan", function() { ...@@ -3168,14 +3172,14 @@ $(document).on("click", "#btn_perbaikan_jalan", function() {
$(document).on("click", "#save-perbaikan", function() { $(document).on("click", "#save-perbaikan", function() {
// $("#save-perbaikan").click(function() { // $("#save-perbaikan").click(function() {
console.log('blaaaaaaaaaaaaaaaaaa')
// var hasil = JSON.stringify(editableLayers.toGeoJSON()); // var hasil = JSON.stringify(editableLayers.toGeoJSON());
// var hasil = $() // var hasil = $()
var polijalbar = $("#coorjalbaru").val(); var polijalbar = $("#coorjalbaru").val(); //
var id_jalan = $("#id_jalan_perbaikan").val(); var id_jalan = $("#id_jalan_perbaikan").val(); //
var type_id = $("#type_id").val(); var type_id = $("#type_id").val(); //
var name = $("#namajalan2").val(); var name = $("#namajalan2").val(); //
var type = $("#typejalan").val(); var type = $("#typejalan").val(); //
var tgl_perbaikan = $("#tglmulaiperbaikan").val(); var tgl_perbaikan = $("#tglmulaiperbaikan").val();
var tgl_selesai = $("#tglselesaiperbaikan").val(); var tgl_selesai = $("#tglselesaiperbaikan").val();
var tgl_disetujui = $("#tgldisetujui").val(); var tgl_disetujui = $("#tgldisetujui").val();
...@@ -3185,13 +3189,14 @@ $(document).on("click", "#save-perbaikan", function() { ...@@ -3185,13 +3189,14 @@ $(document).on("click", "#save-perbaikan", function() {
var pj = $("#pihakpengesahan").val(); var pj = $("#pihakpengesahan").val();
var pj_lapangan = $("#pjlapangan").val(); var pj_lapangan = $("#pjlapangan").val();
var kontraktor = $("#kontraktor").val(); var kontraktor = $("#kontraktor").val();
var pjg_perbaikan = $("#panjangjalanperbaikan").val(); var pjg_perbaikan = $("#panjangjalanperbaikan").val(); //
var sumber_dana = $("#sumber_dana").val(); var sumber_dana = $("#sumber_dana").val();
var lbr_perbaikan = $("#lebarjalanperbaikan").val(); var lbr_perbaikan = $("#lebarjalanperbaikan").val(); //
var jenis_perbaikan = $("#jenisperbaikan").val(); var jenis_perbaikan = $("#jenisperbaikan").val(); //
// var luas = $("#luas").val(); // var luas = $("#luas").val();
var kelurahan = $("#kelurahan").val(); var kelurahan = $("#kelurahan").val(); //
var kecamatan = $("#kecamatan").val(); var kecamatan = $("#kecamatan").val(); //
var data_umum = [{ var data_umum = [{
'coord': polijalbar 'coord': polijalbar
...@@ -3241,7 +3246,9 @@ $(document).on("click", "#save-perbaikan", function() { ...@@ -3241,7 +3246,9 @@ $(document).on("click", "#save-perbaikan", function() {
var keyss = Object.keys(data_umum[i]); var keyss = Object.keys(data_umum[i]);
data.append(keyss[0], data_umum[i][keyss[0]]) data.append(keyss[0], data_umum[i][keyss[0]])
} }
console.log(pjg_perbaikan)
if((name != "") && (type != "") && (pjg_perbaikan != "") && (lbr_perbaikan != "") && (jenis_perbaikan != "") && (kelurahan != "") && (kecamatan != "")){
// console.log('barumasuk')
$.ajax({ $.ajax({
url: "save-perbaikan", url: "save-perbaikan",
data: data, data: data,
...@@ -3276,6 +3283,16 @@ $(document).on("click", "#save-perbaikan", function() { ...@@ -3276,6 +3283,16 @@ $(document).on("click", "#save-perbaikan", function() {
} }
} }
}) })
} else {
swal({
title: "OOPS",
text: "Pastikan Semua Data Bertanda * Terisi Termasuk Koordinat Maps",
type: "warning",
icon: "error",
confirmButtonColor: "#00BCD4"
})
}
}); });
// $('.datatable-show-all').DataTable({ // $('.datatable-show-all').DataTable({
...@@ -5451,6 +5468,10 @@ $(document).on("click", "#btnsavepoint", function(e) { ...@@ -5451,6 +5468,10 @@ $(document).on("click", "#btnsavepoint", function(e) {
data.append("alamat_create_point", $("#alamat_create_point").val()) data.append("alamat_create_point", $("#alamat_create_point").val())
data.append("luas_tanah_point", $("#luas_tanah_point").val()) data.append("luas_tanah_point", $("#luas_tanah_point").val())
data.append("pemilik_point", $("#pemilik_point").val()) data.append("pemilik_point", $("#pemilik_point").val())
// console.log(data)
var gambar = $("input[id^='gambar_pitik']")[0].files[0];
console.log(gambar)
$.ajax({ $.ajax({
url: "api/create-point", url: "api/create-point",
......
...@@ -269,15 +269,214 @@ function datatatata() { ...@@ -269,15 +269,214 @@ function datatatata() {
// //
// }) // })
var nama_delete_perb_det = null;
var tipe_delete_perb_det = null;
var propos = ``;
var doku = ``;
$("#perbaikan_manage").on("click", function() {
$.ajax({
url: "api/dataperbaikan",
dataType: 'json',
type: 'get',
success: function(data) {
// var today = new Date().toISOString().slice(0, 10);
var dt = new Date();
var today = dt.getFullYear() + "-" + ((dt.getMonth()+1).toLocaleString('en-US', {minimumIntegerDigits: 2, useGrouping:false})) + "-" + dt.getDate();
// var datenow = today.getDate()
console.log(today)
var status = ``;
var propos = ``;
var doku = ``;
var data_per = []
var num = 0
for (i in data) {
num += 1;
// console.log(data[i].id)
var tgl_perbaikan = data[i].tgl_perbaikan;
var tgl_selesai = data[i].tgl_selesai;
if((data[i].tgl_perbaikan == '0001-01-01') || (data[i].tgl_selesai == '0001-01-01') || (data[i].tgl_disetujui == '0001-01-01')){
status = `<span style="background-color:#b81a1a; border-radius: 2px;">&nbsp; Dalam Perencanaan &nbsp;</span>`;
if(data[i].tgl_perbaikan == '0001-01-01'){
tgl_perbaikan = `-`;
}
if(data[i].tgl_selesai == '0001-01-01'){
tgl_selesai = `-`;
}
// if(data[i].tgl_disetujui != '0001-01-01'){}
} else {
if (today < data[i].tgl_perbaikan){
status = `<span style="background-color:#b86e1a; border-radius: 2px;">&nbsp; Direncanakan &nbsp;</span>`;
}
else if((today >= data[i].tgl_perbaikan)&&(today <= data[i].tgl_selesai)){
status = `<span style="background-color:#b0b81a; border-radius: 2px;">&nbsp; Sedang Berjalan &nbsp;</span>`;
}
else if(today > data[i].tgl_selesai){
status = `<span style="background-color:#35bd6b; border-radius: 2px;">&nbsp; Selesai &nbsp;</span>`;
}
}
console.log(data[i].proposal)
if (data[i].proposal == 'None'){
propos = `<span style="background-color:#b81a1a; border-radius: 2px;">&nbsp; Belum ada Proposal &nbsp;</span>`;
} else {
propos = ``;
}
if (data[i].bukti_selesai == 'None'){
doku = `<span style="background-color:#b81a1a; border-radius: 2px;">&nbsp; Direncanakan &nbsp;</span>`;
} else {
doku = ``;
}
var data_i = `<li class="media panel panel-body stack-media-on-mobile" id="cunli" style="background: transparent;border: none;color: white;">
<div>
` + num + `
</div>
<div>
` + data[i].name_perbaikan + `
</div>
<div>
` + data[i].name + `
</div>
<div>
` + data[i].desa + `, ` + data[i].kecamatan + `
</div>
<div>
`+ status +`
</div>
<div>
` + tgl_perbaikan + `
</div>
<div>
` + tgl_selesai + `
</div>
<div>
<a class="btn mdlFire " onclick="loaddetailid(`+data[i].id_object+`,`+data[i].id+`) " data-toggle="modal" data-target="#modal_detail_perbaikan" style="background-color: #5A9AFB;color: white;border-radius: 5px;">
<i class="icon-search4 text-muted text-size-base " style="color: white;font-size: 10px; "></i> &nbsp;&nbsp; Detail
</a>
</div>
</li>`;
data_per.push(data_i)
}
$("#dataperb").html(data_per)
var x = window.matchMedia("(min-width: 700px)")
if (x.matches) { // If media query matches
$(".search_list").css('display', 'none')
$.fn.dataList = function(options) {
this.each(function() {
var $table = $(this);
if ($table.is('ul')) {
var $ul = $table;
$table = $ul.wrap('<table><tbody/></table').closest('table');
$ul.find('li').wrap('<tr></tr>').contents().unwrap();
$ul.find('div').wrap('<td><td/>').contents().unwrap();
$ul.contents().unwrap()
$table.prepend(`<thead><tr><th>No.</th>
<th>Sarana Perbaikan</th>
<th>Nama</th>
<th>Alamat</th>
<th>Status</th>
<th>Tanggal Mulai</th>
<th>Tanggal Selesai</th>
<th>Keterangan</th>
</tr></thead>`);
}
$table.dataTable(options);
});
}
$('.datatab').dataList({
"pageLength": 15,
autoWidth: false,
columnDefs: [{
orderable: false,
width: '20px',
targets: [0],
}, ],
dom: '<"float-left "B>frtip',
language: {
search: ' _INPUT_',
searchPlaceholder: 'Data Perbaikan...',
lengthMenu: '<span>Show:</span><hr> _MENU_',
paginate: {
'first': 'First',
'last': 'Last',
'next': '&rarr;',
'previous': '&larr;'
}
},
});
$('.datatab').DataTable({
autoWidth: false,
columnDefs: [{
orderable: false,
width: '20px',
targets: [0],
}, {
orderable: false,
width: '20px',
targets: [6],
}, {
orderable: false,
width: '20px',
targets: [7],
}, ],
dom: '<"float-left "B>frtip',
language: {
search: ' _INPUT_',
searchPlaceholder: 'Data Perbaikan...',
lengthMenu: '<span>Show:</span><hr> _MENU_',
paginate: {
'first': 'First',
'last': 'Last',
'next': '&rarr;',
'previous': '&larr;'
}
},
drawCallback: function() {
$(this).find('tbody tr').slice(-3).find('.dropdown, .btn-group').addClass('dropup');
},
preDrawCallback: function() {
$(this).find('tbody tr').slice(-3).find('.dropdown, .btn-group').removeClass('dropup');
}
});
} else {
$(".search_list").css('display', 'block')
$("#download_perbaikan").css('display', 'none')
// document.querySelector("#perbaikan-dashboard\\ > div > div.container-detached > div > ul > li > div:nth-child(1)").style.display = 'none';
//$('.datatab').dataTable({
// "pageLength": 15
//});
}
}
})
})
function loaddetailid(ido,id) { function loaddetailid(ido,id) {
console.log('a')
console.log(ido,id)
$(".map_detail_p").html(``) $(".map_detail_p").html(``)
var isObject = {}; var isObject = {};
isObject.ido = ido; isObject.ido = ido;
isObject.id = id; isObject.id = id;
$("#iduser ").val(ido) $("#iduser ").val(ido)
// console.log(ido,id)
$.ajax({ $.ajax({
url: "loadDetail", url: "loadDetail",
data: isObject, data: isObject,
...@@ -304,6 +503,9 @@ function loaddetailid(ido,id) { ...@@ -304,6 +503,9 @@ function loaddetailid(ido,id) {
map_detail_perbaikan.invalidateSize(); map_detail_perbaikan.invalidateSize();
}, 500); }, 500);
nama_delete_perb_det = data[0]['name'];
tipe_delete_perb_det = data[0]['type'];
if (data.length === 0) { if (data.length === 0) {
$(".nama_detail").text("Null"); $(".nama_detail").text("Null");
...@@ -315,41 +517,134 @@ function loaddetailid(ido,id) { ...@@ -315,41 +517,134 @@ function loaddetailid(ido,id) {
// $(".kontraktor_detail ").html("Null") // $(".kontraktor_detail ").html("Null")
$(".panjang_jalan_detail ").html("Null") $(".panjang_jalan_detail ").html("Null")
$(".lebar_jalan_detail ").html("Null") $(".lebar_jalan_detail ").html("Null")
//$(".proposal_detail ").html(` $(".proposal_detail ").html(`
// <a href="static/media/proposal/null" id="downloadproposal"> <a href="static/media/proposal/null" id="downloadproposal">
// <img src="{% static 'img/icon-1/proposal.svg' %} " alt=" " style="height: 80px;width: 80px; "> <img src="static/img/icon-1/proposal.svg" alt=" " style="height: 80px;width: 80px; ">
// </a>`); </a>`);
//
//
//$(".bukti_detail_perbaikan").html(` $(".bukti_detail_perbaikan").html(`
// <a href="static/media/bukti_penyelesaian/null" onclick="viewBukti() " id="view-bukti "> <a href="static/media/bukti_penyelesaian/null" onclick="viewBukti() " id="view-bukti ">
// <img src="{% static 'img/icon-1/bukti.svg' %} " alt=" " style="height: 70px; <img src="static/img/icon-1/bukti.svg" alt=" " style="height: 70px;
// width: 50px;"> width: 50px;">
// </a>`); </a>`);
$(".tombol-edit-detail-jln").html(`
<a href="#" tooltip="Edit" id="btn_edit_det_perb" data-toggle="modal" data-target="#modal_det_perb_edit" class="btn" style="border-bottom-left-radius: 8px;border-top-right-radius: 8px;width: 100%;height: 100%;bottom: 0px;color: white;">
<i class="icon-pencil5"></i> EDIT
</a>`);
$(".tombol-delete-detail-jln").html(`
<a href="#" id="btn_delete_det_perb" data-toggle="modal" data-target="#modal_det_perb_delete" class="btn" style="border-bottom-left-radius: 8px;border-top-right-radius: 8px;width: 100%;height: 100%;bottom: 0px;color: white;">
<i class="icon-eraser2"></i> DELETE
</a>`);
} else { } else {
// console.log(data[0]['jenis']) // console.log(data[0]['jenis'])
if (data[0]['jenis'] == 'jalan') { if (data[0]['jenis'] == 'jalan') {
var proposal = ``;
if (data[0]['proposal'] == 'None'){
proposal = `<span style="background-color:#b81a1a; border-radius: 2px; ">&nbsp; Belum Diupload &nbsp;</span>`;
} else {
proposal = `
<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>`;
}
var buktilah = ``;
if (data[0]['bukti_selesai'] == 'None'){
buktilah = `<span style="background-color:#b81a1a; border-radius: 2px; ">&nbsp; Belum Diupload &nbsp;</span>`;
} else {
buktilah = `
<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>`;
}
var lengkapidong = ``;
var lengkapidonghapus = ``;
if ((data[0]['anggaran'] == 0) || (data[0]['pj'] == "") || (data[0]['pj_lapangan'] == "") || (data[0]['kontraktor'] == "") || (data[0]['sumber_dana'] == "") ||
(data[0]['tgl_disetujui'] == '0001-01-01') || (data[0]['tgl_selesai'] == '0001-01-01') || (data[0]['tgl_perbaikan'] == '0001-01-01') || (data[0]['proposal'] == 'None') || (data[0]['bukti_selesai'] == 'None')){
lengkapidong = `
<div class="text-center" style="background-color: #5A9AFB;height: 40px;bottom: 2px;right: 5px;border: 1pt solid rosybrown;border-radius: 8px;">
<a href="#" title="Lengkapi Data" id="btn_edit_det_perb" onclick="edit_perb_det_f(`+id+`,`+ido+`)" data-toggle="modal" data-target="#modal_det_perb_edit" class="btn" style="border-bottom-left-radius: 8px;border-top-right-radius: 8px;width: 100%;height: 100%;bottom: 0px;color: white;">
Lengkapi
</a>
</div>
`;
lengkapidonghapus = `
<div class="text-center" data-toggle="modal" data-target="#modal_bangunan_delete" style="background-color: indianred;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
<a href="#" title="Hapus Data" id="btn_delete_det_perb" onclick="delete_perb_det_f(`+id+`,`+ido+`)" class="btn" style="border-bottom-left-radius: 8px;border-top-right-radius: 8px;width: 100%;height: 100%;bottom: 0px;color: white;">
<i class="icon-eraser2"></i> Hapus
</a>
</div>
`;
}
var dt = new Date();
var today = dt.getFullYear() + "-" + ((dt.getMonth()+1).toLocaleString('en-US', {minimumIntegerDigits: 2, useGrouping:false})) + "-" + dt.getDate();
if((data[0]['tgl_perbaikan'] == '0001-01-01') || (data[0]['tgl_selesai'] == '0001-01-01') || (data[0]['tgl_disetujui'] == '0001-01-01')){
// status = `<span style="background-color:#b81a1a; border-radius: 2px;">&nbsp; Dalam Perencanaan &nbsp;</span>`;
if(data[0]['tgl_perbaikan'] == '0001-01-01'){
lengkapidonghapus = `
<div class="text-center" data-toggle="modal" data-target="#modal_bangunan_delete" style="background-color: indianred;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
<a href="#" title="Hapus Data" id="btn_delete_det_perb" onclick="delete_perb_det_f(`+id+`,`+ido+`)" class="btn" style="border-bottom-left-radius: 8px;border-top-right-radius: 8px;width: 100%;height: 100%;bottom: 0px;color: white;">
<i class="icon-eraser2"></i> Hapus
</a>
</div>
`;
}
if(data[0]['tgl_selesai'] == '0001-01-01'){
lengkapidonghapus = `
<div class="text-center" data-toggle="modal" data-target="#modal_bangunan_delete" style="background-color: indianred;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
<a href="#" title="Hapus Data" id="btn_delete_det_perb" onclick="delete_perb_det_f(`+id+`,`+ido+`)" class="btn" style="border-bottom-left-radius: 8px;border-top-right-radius: 8px;width: 100%;height: 100%;bottom: 0px;color: white;">
<i class="icon-eraser2"></i> Hapus
</a>
</div>
`;
}
// if(data[i].tgl_disetujui != '0001-01-01'){}
} else {
if (today < data[0]['tgl_perbaikan']){
lengkapidonghapus = `
<div class="text-center" data-toggle="modal" data-target="#modal_bangunan_delete" style="background-color: indianred;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
<a href="#" title="Hapus Data" id="btn_delete_det_perb" onclick="delete_perb_det_f(`+id+`,`+ido+`)" class="btn" style="border-bottom-left-radius: 8px;border-top-right-radius: 8px;width: 100%;height: 100%;bottom: 0px;color: white;">
<i class="icon-eraser2"></i> Hapus
</a>
</div>`;
}
else if((today >= data[0]['tgl_perbaikan'])&&(today <= data[0]['tgl_selesai'])){
lengkapidonghapus = ``;
}
else if(today > data[0]['tgl_selesai']){
lengkapidonghapus = ``;
}
}
// lengkapidonghapus = `
// <div class="text-center" data-toggle="modal" data-target="#modal_bangunan_delete" style="background-color: indianred;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
// <a href="#" title="Hapus Data" id="btn_delete_det_perb" onclick="delete_perb_det_f(`+id+`,`+ido+`)" class="btn" style="border-bottom-left-radius: 8px;border-top-right-radius: 8px;width: 100%;height: 100%;bottom: 0px;color: white;">
// <i class="icon-eraser2"></i> Hapus
// </a>
// </div>
// `;
$(".nama_detail").html(data[0]['name']); $(".nama_detail").html(data[0]['name']);
$(".type_detail ").html(data[0]['type']) $(".alamat_detail").html(data[0]['desa']+`, `+data[0]['kecamatan']);
$(".tanggal_perbaikan_detail ").text(data[0]['tgl_perbaikan']) $(".type_detail ").html(data[0]['type']);
//$(".anggaran_detail ").html(data[0]['anggaran']) $(".tanggal_perbaikan_detail ").text(data[0]['tgl_perbaikan']);
$(".tanggal_selesai_detail ").html(data[0]['tgl_selesai'])
//$(".penanggung_jawab_detail ").html(data[0]['pj']) //$(".penanggung_jawab_detail ").html(data[0]['pj'])
//$(".penanggung_jawab_lapangan_detail ").html(data[0]['pj_lapangan']) //$(".penanggung_jawab_lapangan_detail ").html(data[0]['pj_lapangan'])
//$(".kontraktor_detail ").html(data[0]['kontraktor']) //$(".kontraktor_detail ").html(data[0]['kontraktor'])
$(".panjang_jalan_detail ").html(data[0]['panjang']) $(".panjang_jalan_detail ").html(data[0]['panjang']);
$(".lebar_jalan_detail ").html(data[0]['lbr_jln_reno']) $(".lebar_jalan_detail ").html(data[0]['lbr_jln_reno']);
//$(".proposal_detail ").html(` $(".proposal_detail ").html(proposal);
// <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").html(buktilah);
//
// $(".tombol-edit-detail-jln").html(lengkapidong);
//$(".bukti_detail_perbaikan").html(` $(".tombol-delete-detail-jln").html(lengkapidonghapus);
// <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>`);
$('.isi_detail_cek_jalan').show() $('.isi_detail_cek_jalan').show()
$('.map_detail_p_jalan').show() $('.map_detail_p_jalan').show()
...@@ -752,7 +1047,7 @@ $(".search_list").on('input', function() { ...@@ -752,7 +1047,7 @@ $(".search_list").on('input', function() {
` + tgl_selesai + ` ` + tgl_selesai + `
</div> </div>
<div> <div>
<a class="btn mdlFire " onclick="loaddetailid(`+id_object+`,`+idbenar+`)" data-toggle="modal" data-target="#modal_detail_perbaikan" style="background-color: #5A9AFB;color: white;border-radius: 5px;height: 25px; "> <a class="btn mdlFire " onclick="loaddetailid(`+id_object+`,`+idbenar+`) " data-toggle="modal" data-target="#modal_detail_perbaikan" style="background-color: #5A9AFB;color: white;border-radius: 5px;height: 25px; ">
<span> <span>
<i class="icon-search4 text-muted text-size-base " style="color: white;font-size: 10px; "></i> <i class="icon-search4 text-muted text-size-base " style="color: white;font-size: 10px; "></i>
&nbsp;&nbsp; &nbsp;&nbsp;
...@@ -771,145 +1066,212 @@ $(".search_list").on('input', function() { ...@@ -771,145 +1066,212 @@ $(".search_list").on('input', function() {
}); });
$("#perbaikan_manage").on("click", function() { function delete_perb_det_f(id, id_obj ) {
// var idparam = param;
// console.log(idparam, nama_delete_perb_det, tipe_delete_perb_det)
// $('#nama_perb_det_delete').val(nama_delete_perb_det)
// $('#type_perb_det_delete').val(tipe_delete_perb_det)
swal({
title: "Perhatian",
text: "Setelah Terhapus Data tidak dapat dikembalikan",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete",
cancelButtonText: "No, cancel",
closeOnConfirm: false,
closeOnCancel: true
},
function (isConfirm) {
if (isConfirm) {
var data = new FormData();
data.append('id_perb', id)
data.append('id_perb_object', id_obj)
$.ajax({ $.ajax({
url: "api/dataperbaikan", url: "api/deletedataperb",
data: data,
dataType: 'json', dataType: 'json',
type: 'get', type: 'POST',
processData: false,
contentType: false,
success: function(data) { success: function(data) {
loaderPage(false);
let response = data;
if (response.code == 0) {
swal({
title: response.info,
text: response.data,
type: "success",
icon: "success",
confirmButtonColor: "#00BCD4"
}, function() {
location.reload()
})
} else {
swal({
title: response.info,
text: response.data,
type: "warning",
icon: "error",
confirmButtonColor: "#00BCD4"
})
}
}
})
// console.log(data) } else {
var data_per = [] // swal("Cancelled", "Your imaginary file is safe :)", "error");
var num = 0
for (i in data) {
num += 1;
var data_i = `<li class="media panel panel-body stack-media-on-mobile" id="cunli" style="background: transparent;border: none;color: white;">
<div>
` + num + `
</div>
<div>
` + data[i].name_perbaikan + `
</div>
<div>
` + data[i].name + `
</div>
<div>
` + data[i].desa + `, ` + data[i].kecamatan + `
</div>
<div>
` + data[i].type + `
</div>
<div>
` + data[i].tgl_perbaikan + `
</div>
<div>
` + data[i].tgl_selesai + `
</div>
<div>
<a class="btn mdlFire " onclick="loaddetailid(`+data[i].id_object+`,`+data[i].id+`)" data-toggle="modal" data-target="#modal_detail_perbaikan" style="background-color: #5A9AFB;color: white;border-radius: 5px;">
<i class="icon-search4 text-muted text-size-base " style="color: white;font-size: 10px; "></i> &nbsp;&nbsp; Detail
</a>
</div>
</li>`;
data_per.push(data_i)
} }
$("#dataperb").html(data_per) }
);
var x = window.matchMedia("(min-width: 700px)") }
if (x.matches) { // If media query matches
$(".search_list").css('display', 'none')
$.fn.dataList = function(options) { function edit_perb_det_f(id, id_obj) {
this.each(function() { var isObject = {};
var $table = $(this); isObject.ido = id_obj;
if ($table.is('ul')) { isObject.id = id;
var $ul = $table;
$table = $ul.wrap('<table><tbody/></table').closest('table'); $.ajax({
$ul.find('li').wrap('<tr></tr>').contents().unwrap(); url: "loadDetail",
$ul.find('div').wrap('<td><td/>').contents().unwrap(); data: isObject,
$ul.contents().unwrap() dataType: 'json',
$table.prepend(`<thead><tr><th>No.</th> type: 'post',
<th>Sarana Perbaikan</th> success: function(data) {
<th>Nama</th> console.log(data[0])
<th>Alamat</th> var namobj = data[0]['name']
<th>Type</th> $("#anggaran_perb_det_edit").val(data[0]['anggaran']);
<th>Tanggal Mulai</th> $("#sudan_perb_det_edit").val(data[0]['sumber_dana']);
<th>Tanggal Selesai</th> $("#pihak_perb_det_edit").val(data[0]['pj']);
<th>Keterangan</th> $("#pjlap_perb_det_edit").val(data[0]['pj_lapangan']);
</tr></thead>`); $("#kontraktor_perb_det_edit").val(data[0]['kontraktor']);
if (data[0]['tgl_disetujui'] != '0001-01-01'){
$('#tgldisetujui_perb_det_edit').val(data[0]['tgl_disetujui'])
} }
$table.dataTable(options); if (data[0]['tgl_perbaikan'] != '0001-01-01'){
}); $('#tglmulaiperbaikan_perb_det_edit').val(data[0]['tgl_perbaikan'])
} }
$('.datatab').dataList({ if (data[0]['tgl_selesai'] != '0001-01-01'){
"pageLength": 15, $('#tglselesaiperbaikan_perb_det_edit').val(data[0]['tgl_selesai'])
autoWidth: false,
columnDefs: [{
orderable: false,
width: '20px',
targets: [0],
}, ],
dom: '<"float-left "B>frtip',
language: {
search: ' _INPUT_',
searchPlaceholder: 'Data Perbaikan...',
lengthMenu: '<span>Show:</span><hr> _MENU_',
paginate: {
'first': 'First',
'last': 'Last',
'next': '&rarr;',
'previous': '&larr;'
} }
},
});
$('.datatab').DataTable({
autoWidth: false,
columnDefs: [{
orderable: false,
width: '20px',
targets: [0],
}, { $('#propos_val_det_perb_edit').val(data[0]['proposal']);
orderable: false, $('#buksel_val_det_perb_edit').val(data[0]['bukti_selesai']);
width: '20px',
targets: [6],
}, { var propos = 0;
orderable: false, var buksel = 0;
width: '20px', if (data[0]['proposal'] != 'None'){
targets: [7], $('#proposal_perb').append(`<span style="background-color:#35bd6b; border-radius: 2px;">&nbsp; Sudah Diupload &nbsp;</span>`)
// $('proposal_perb_det_edit').attr('disabled');
// proposal = `<span style="background-color:#b81a1a; border-radius: 2px;">&nbsp; Belum Diupload &nbsp;</span>`;
}, ], // $('#select_file').html(filename);
dom: '<"float-left "B>frtip', // propos = 1;
language: {
search: ' _INPUT_',
searchPlaceholder: 'Data Perbaikan...',
lengthMenu: '<span>Show:</span><hr> _MENU_',
paginate: {
'first': 'First',
'last': 'Last',
'next': '&rarr;',
'previous': '&larr;'
} }
},
drawCallback: function() { if (data[0]['bukti_selesai'] != 'None'){
$(this).find('tbody tr').slice(-3).find('.dropdown, .btn-group').addClass('dropup'); $('#buktiselesai_perb').append(`<span style="background-color:#35bd6b; border-radius: 2px;">&nbsp; Sudah Diupload &nbsp;</span>`)
}, // $('buktiselesai_perb_det_edit').attr('disabled');
preDrawCallback: function() { // proposal = `<span style="background-color:#b81a1a; border-radius: 2px;">&nbsp; Belum Diupload &nbsp;</span>`;
$(this).find('tbody tr').slice(-3).find('.dropdown, .btn-group').removeClass('dropup');
// buksel = 1;
} }
$('#anggaran_perb_det_edit').on('input', function() {
$('#anggaran_perb_det_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, ",");
});
}));
}); });
$("#update_perb").click(function() {
var anggaran = $("#anggaran_perb_det_edit").val();
var sumber_dana = $("#sudan_perb_det_edit").val();
var pihak_sah = $("#pihak_perb_det_edit").val();
var pj_lap = $("#pjlap_perb_det_edit").val();
var kontraktor = $("#kontraktor_perb_det_edit").val();
var tglset = $('#tgldisetujui_perb_det_edit').val();
var tglper = $('#tglmulaiperbaikan_perb_det_edit').val()
var tglsel = $('#tglselesaiperbaikan_perb_det_edit').val();
var propo = $('#propos_val_det_perb_edit').val();
var bukse = $('#buksel_val_det_perb_edit').val();
if ((anggaran != "0" || anggaran != "") && (sumber_dana != "") && (pihak_sah != "") &&
(pj_lap != "") && (kontraktor != "") &&
(tglset!= '') && (tglsel != '') &&
(tglper != '') ){
console.log(anggaran.replace(/,/g,''))
var idperb = id;
var idobj = id_obj;
var data = new FormData();
data.append("file_proposal", $("input[id^='proposal_perb_det_edit']")[0].files[0]);
data.append("file_bukti", $("input[id^='buktiselesai_perb_det_edit']")[0].files[0]);
data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
data.append('id_perb', idperb)
data.append('id_obj', idobj)
data.append('namobj', namobj)
data.append('anggaran', anggaran.replace(/,/g, ""))
data.append('sumber_dana', sumber_dana)
data.append('pihak_sah', pihak_sah)
data.append('pj_lap', pj_lap)
data.append('kontraktor', kontraktor)
data.append('tgl_disetujui', tglset)
data.append('tgl_perbaikan', tglper)
data.append('tgl_selesai', tglsel)
data.append('proposal', propo)
data.append('bukti_selesai', bukse)
$.ajax({
url: "api/editperb",
data: data,
dataType: 'json',
type: 'POST',
processData: false,
contentType: false,
success: function(data) {
let response = data
if (response.status == 0) {
swal({
title: response.info,
text: response.data,
type: "success",
icon: "success",
confirmButtonColor: "#00BCD4"
}, function() {
location.reload();
})
} else { } else {
$(".search_list").css('display', 'block') swal({
$("#download_perbaikan").css('display', 'none') title: 'Error',
// document.querySelector("#perbaikan-dashboard\\ > div > div.container-detached > div > ul > li > div:nth-child(1)").style.display = 'none'; text: 'Pastikan Semua Data Terisi',
//$('.datatab').dataTable({ type: "warning",
// "pageLength": 15 icon: "error",
//}); confirmButtonColor: "#00BCD4"
})
} }
} }
}) })
})
\ No newline at end of file
} else {
swal({
title: "Perhatian",
text: "Semua data harus diisi",
type: "warning",
icon: "error",
confirmButtonColor: "#00BCD4"
})
}
});
}
});
}
\ No newline at end of file
...@@ -1655,7 +1655,7 @@ ...@@ -1655,7 +1655,7 @@
</div> </div>
<div style="margin-top: 20px; "> <div style="margin-top: 20px; ">
<!-- <div class="row"> <div class="row">
<div class="col-md-6 " id="bkt_prop"> <div class="col-md-6 " id="bkt_prop">
<div> <div>
<span>Proposal</span> <span>Proposal</span>
...@@ -1676,7 +1676,7 @@ ...@@ -1676,7 +1676,7 @@
</div> </div>
</div> </div>
</div> --> </div>
<div> <div>
<span>Ruas yang diperbaiki</span> <span>Ruas yang diperbaiki</span>
<!-- <div class="row"> <!-- <div class="row">
......
...@@ -593,6 +593,17 @@ background: none;border-color: transparent;"> ...@@ -593,6 +593,17 @@ background: none;border-color: transparent;">
</div> </div>
</div> </div>
<div class="isi_detail_cek ">
<div>
<div>
<span>Alamat</span>
</div>
<div>
<span class="alamat_detail">NAMA JALAN</span>
</div>
</div>
</div>
<div class="isi_detail_cek "> <div class="isi_detail_cek ">
<div> <div>
<div> <div>
...@@ -617,19 +628,19 @@ background: none;border-color: transparent;"> ...@@ -617,19 +628,19 @@ background: none;border-color: transparent;">
</div> </div>
</div> </div>
<!-- <div class="isi_detail_cek "> <div class="isi_detail_cek ">
<div> <div>
<div> <div>
<span>Anggaran</span> <span>Tanggal Selesai</span>
</div> </div>
<div> <div>
<span class="anggaran_detail">NAMA JALAN</span> <span class="tanggal_selesai_detail">NAMA JALAN</span>
</div> </div>
</div> </div>
</div> </div>
<div class="isi_detail_cek "> <!-- <div class="isi_detail_cek ">
<div> <div>
<div> <div>
<span>Penanggung jawab</span> <span>Penanggung jawab</span>
...@@ -690,14 +701,14 @@ background: none;border-color: transparent;"> ...@@ -690,14 +701,14 @@ background: none;border-color: transparent;">
</div> </div>
<div style="margin-top: 20px; "> <div style="margin-top: 20px; ">
<!-- <div class="row"> <div class="row">
<div class="col-md-6 "> <div class="col-md-6 ">
<div> <div>
<span>Proposal</span> <span>Proposal</span>
</div> </div>
<div class="proposal_detail "> <div class="proposal_detail " style="margin-top:5px">
<img src="{% static 'img/icon-1/proposal.svg' %} " alt=" " style="height: 65px;width: 65px; "> <img src="{% static '../../img/icon-1/proposal.svg' %}" alt=" " style="height: 65px;width: 65px; ">
</div> </div>
...@@ -706,12 +717,12 @@ background: none;border-color: transparent;"> ...@@ -706,12 +717,12 @@ background: none;border-color: transparent;">
<div> <div>
<span>Bukti penyelesaian</span> <span>Bukti penyelesaian</span>
</div> </div>
<div class="bukti_detail_perbaikan"> <div class="bukti_detail_perbaikan" style="margin-top:5px">
<img src="{% static 'img/icon-1/bukti.svg' %} " alt=" " style="height: 65px;width: 65px; "> <img src="{% static 'img/icon-1/bukti.svg' %}" alt=" " style="height: 65px;width: 65px; ">
</div> </div>
</div> </div>
</div> --> </div>
<div class="map_detail_p_jalan"> <div class="map_detail_p_jalan">
<span>Ruas yang diperbaiki</span> <span>Ruas yang diperbaiki</span>
<div class="map_detail_p"> <div class="map_detail_p">
...@@ -723,12 +734,119 @@ background: none;border-color: transparent;"> ...@@ -723,12 +734,119 @@ background: none;border-color: transparent;">
</div> </div>
</div> </div>
<div class="btn_btn_detail_jalan" style="margin-top: 20px; ">
<div class="tombol-edit-detail-jln col-md-4">
<div class="text-center" style="background-color: #5A9AFB;height: 40px;bottom: 2px;right: 5px;border: 1pt solid rosybrown;border-radius: 8px;">
</div>
</div>
<div class="tombol-delete-detail-jln col-md-4" >
<div class="text-center" data-toggle="modal" data-target="#modal_bangunan_delete" style="background-color: indianred;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div> </div>
<div id="modal_det_perb_edit" class="modal fade">
<div class="modal-dialog md" style="margin-top: 100px; width: 50%;">
<div class="modal-content" style="border-radius: 10px;">
<div class="modal-header bg-info" style="background-color: #1a222f !important;border-top-right-radius: 10px;border-top-left-radius: 10px;">
<button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
<h6 class="modal-title modstit">Lengkapi Perbaikan</h6>
</div> </div>
<div class="modal-body" style="max-height: 550px;overflow-y: auto;">
<input type="hidden" id="id_det_perb_edit">
<div class="row">
<div >
<label class="col-lg-3 control-label lbl-top">Anggaran</label>
<div class="col-lg-9" style="margin-bottom: 10px;">
<input id="anggaran_perb_det_edit" type="text" class="form-control" value="" required>
</div> </div>
</div> </div>
<div >
<label class="col-lg-3 control-label lbl-top">Sumber Dana</label>
<div class="col-lg-9" style="margin-bottom: 10px;">
<input id="sudan_perb_det_edit" type="text" class="form-control" value="" required>
</div> </div>
</div>
<div >
<label class="col-lg-3 control-label lbl-top">Pihak yang Mengesahkan</label>
<div class="col-lg-9" style="margin-bottom: 10px;">
<input id="pihak_perb_det_edit" type="text" class="form-control" value="" required>
</div>
</div>
<div >
<label class="col-lg-3 control-label lbl-top">PJ Lapangan</label>
<div class="col-lg-9" style="margin-bottom: 10px;">
<input id="pjlap_perb_det_edit" type="text" class="form-control" value="" required>
</div>
</div>
<div >
<label class="col-lg-3 control-label lbl-top">Kontraktor</label>
<div class="col-lg-9" style="margin-bottom: 10px;">
<input id="kontraktor_perb_det_edit" type="text" class="form-control" value="" required>
</div>
</div>
<div >
<label class="col-lg-3 control-label lbl-top">Tanggal Disetujui</label>
<div class="col-lg-9" style="margin-bottom: 10px;">
<input type="date" id="tgldisetujui_perb_det_edit" class="form-control" value="" required>
</div>
</div>
<div >
<label class="col-lg-3 control-label lbl-top">Tanggal Mulai Perbaikan</label>
<div class="col-lg-9" style="margin-bottom: 10px;">
<input type="date" id="tglmulaiperbaikan_perb_det_edit" class="form-control" value="" required>
</div>
</div>
<div >
<label class="col-lg-3 control-label lbl-top">Tanggal Selesai Perbaikan</label>
<div class="col-lg-9" style="margin-bottom: 10px;">
<input type="date" id="tglselesaiperbaikan_perb_det_edit" class="form-control" value="" required>
</div>
</div>
<div >
<label>Proposal (.pdf):</label>
<div id="proposal_perb">
<input type="file" id="proposal_perb_det_edit">
<input type="hidden" id="propos_val_det_perb_edit">
</div>
</div>
<div >
<label>Bukti Selesai Perbaikan (.png/.jpg/.jpeg/):</label>
<div id="buktiselesai_perb">
<input type="file" id="buktiselesai_perb_det_edit">
<input type="hidden" id="buksel_val_det_perb_edit">
</div>
</div>
</div>
</div>
<hr>
<div class="modal-footer">
<!-- <button type="button" class="btn btn-link" data-dismiss="modal" onclick="destroyfade()">Close</button> -->
<button type="button" class="btn btn-info" id="update_perb">Update</button>
</div>
</div>
</div>
</div>
</div> </div>
<div id="panel-sm-kosong " class="sidebar-2 " style="display:none;background: #1B1F2D;position: absolute;z-index: 1;left: 0%;transition: all 0.5s ease; "> <div id="panel-sm-kosong " class="sidebar-2 " style="display:none;background: #1B1F2D;position: absolute;z-index: 1;left: 0%;transition: all 0.5s ease; ">
......
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