Commit 192d9c39 authored by Muhamad's avatar Muhamad

user setting

parent 3a79ac61
...@@ -63,6 +63,11 @@ urlpatterns = [ ...@@ -63,6 +63,11 @@ urlpatterns = [
path('edit-jalan-valid', views.editjalanvalid, name='edit-jalan-valid'), path('edit-jalan-valid', views.editjalanvalid, name='edit-jalan-valid'),
path('3d-maps', views.maps3d, name='3d-maps'), path('3d-maps', views.maps3d, name='3d-maps'),
path('deletejalan', views.deletejalan, name='hapus-jalan') path('deletejalan', views.deletejalan, name='hapus-jalan'),
path('filt_perbaikan_kecamatan', views.filt_perbaikan_kecamatan),
path('filt_perbaikan_desa', views.filt_perbaikan_desa),
path('user-data', views.user_data, name='user-data'),
] ]
\ No newline at end of file
...@@ -2770,3 +2770,213 @@ def createpoint(request): ...@@ -2770,3 +2770,213 @@ def createpoint(request):
respon={'data':data, 'info': info, 'status':status} respon={'data':data, 'info': info, 'status':status}
return Response(respon) return Response(respon)
@api_view(('GET',))
def filt_perbaikan_kecamatan(request):
id_kec = request.GET.get('id_kec')
with conn.cursor() as kel:
kel.execute("""SELECT ID,
desa
FROM
geo_data_kelurahan gd
WHERE
kecamatan = ( SELECT kecamatan FROM geo_data_kecamatan WHERE ID = %s )
"""% int(id_kec))
res_kel = kel.fetchall()
with conn.cursor() as data_per:
data_per.execute("""
SELECT
gl.NAME,
tp.id_object,
tp.NAME,
tp.TYPE,
tp.tgl_perbaikan,
tp.anggaran,
tp.tgl_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_kecamatan gdk on st_intersects(st_setsrid(gdk.geom, 4326), st_setsrid(tp.geom, 4326))
WHERE
rn = 1 and gdk.ID = %s
LIMIT 10
"""% int(id_kec))
res_perbaikan = data_per.fetchall()
res_all = []
for j in res_perbaikan:
data_all = {
'name_perbaikan':j[0],
'id_object':j[1],
'name':j[2],
'type':j[3],
'tgl_perbaikan':j[4],
'anggaran':j[5],
'tgl_selesai':j[6],
}
res_all.append(data_all)
respon = {'res_kel':res_kel,'res_perbaikan':res_all}
return Response(respon)
@api_view(('GET',))
def filt_perbaikan_desa(request):
id_desa = request.GET.get('id_desa')
with conn.cursor() as data_per:
data_per.execute("""
SELECT
gl.NAME,
tp.id_object,
tp.NAME,
tp.TYPE,
tp.tgl_perbaikan,
tp.anggaran,
tp.tgl_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 gdk on st_intersects(st_setsrid(gdk.geom, 4326), st_setsrid(tp.geom, 4326))
WHERE
rn = 1 and gdk.ID = %s
"""% int(id_desa))
res_perbaikan = data_per.fetchall()
res_all = []
for j in res_perbaikan:
data_all = {
'name_perbaikan':j[0],
'id_object':j[1],
'name':j[2],
'type':j[3],
'tgl_perbaikan':j[4],
'anggaran':j[5],
'tgl_selesai':j[6],
}
res_all.append(data_all)
respon = {'res_perbaikan':res_all}
return Response(respon)
@api_view(('GET',))
def user_data(request):
with conn.cursor() as userlist_:
if request.user.is_superuser:
# print("is superuser")
sql = """
SELECT
au.id,
au.username,
au.first_name,
au.last_name,
au.is_active,
au.last_login,
au.email,
ag.name,
au.is_staff,
au.is_superuser,
au.file_path
FROM
auth_user au,
auth_user_groups aug,
auth_group ag
WHERE
au.id = aug.user_id AND
ag.id = aug.group_id
ORDER BY
au.username ASC"""
else:
if request.user.is_staff:
sql = """
SELECT
au.id,
au.username,
au.first_name,
au.last_name,
au.is_active,
au.last_login,
au.email,
ag.name,
au.is_staff,
au.is_superuser,
au.file_path
FROM
auth_user au,
auth_user_groups aug,
auth_group ag
WHERE
au.id = aug.user_id AND
ag.id = aug.group_id AND
ag.id IN("""+ars+")"
else:
print('not staff')
userlist_.execute(sql)
allUser = userlist_.fetchall()
user_res = []
for rows in allUser:
datas = {
"id": rows[0],
"username": rows[1],
"name": rows[2] +" "+ rows[3],
"email": rows[6],
"isactive": rows[4],
"last": rows[5],
"group": rows[7],
"filepath": rows[10]
}
user_res.append(datas)
current_user = request.user
thisUser = current_user.id
# print()
sql = "select * from auth_user where id = "+str(thisUser)
with conn.cursor() as userprop:
userprop.execute(sql)
us = userprop.fetchall()
user_data = []
for row in us:
datas = {
"id": row[0],
"username": row[4],
"firstname": row[5],
"lastname": row[6],
"email" : row[7],
"filepath": row[11],
# "password": row[1]
}
user_data.append(datas)
with conn.cursor() as po:
po.execute("select id, namobj, alamat, luas_bangunan, perangkat from geo_kantor_administrasi")
poi = po.fetchall()
point = []
for p in poi:
datap = {
"id":p[0],
"nama_tempat":p[1],
"alamat":p[2],
"luas":p[3],
"pj":p[4]
}
point.append(datap)
respon = {
'data' : user_res,
'thisUser' : user_data,
'point':point
}
return Response(respon)
\ No newline at end of file
...@@ -63,7 +63,16 @@ class Dashboard(generic.TemplateView): ...@@ -63,7 +63,16 @@ class Dashboard(generic.TemplateView):
b.kabupaten, b.kabupaten,
c.kecamatan, c.kecamatan,
d.desa, d.desa,
a.id a.id,
(
SELECT ARRAY_AGG
( '' || ID || ',' || tgl_perbaikan || ',' || jenis_perbaikan || '' ORDER BY tgl_perbaikan DESC )
FROM
tbl_perbaikan
WHERE
id_object = A.ID
AND type_id = 1
)
), ),
'geometry', 'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json ST_AsGeoJSON ( A.geom :: geometry ) :: json
...@@ -78,6 +87,8 @@ class Dashboard(generic.TemplateView): ...@@ -78,6 +87,8 @@ class Dashboard(generic.TemplateView):
kantor_administrasi_result = [] kantor_administrasi_result = []
for i in kantor_administrasi_res: for i in kantor_administrasi_res:
if i[0]['administrasi']['f16'] == None:
i[0]['administrasi']['f16'] = "None"
kantor_administrasi_result.append(i[0]) kantor_administrasi_result.append(i[0])
with conn.cursor() as layanan_kesehatan: with conn.cursor() as layanan_kesehatan:
...@@ -519,6 +530,73 @@ class Dashboard(generic.TemplateView): ...@@ -519,6 +530,73 @@ class Dashboard(generic.TemplateView):
user_data.append(datas) user_data.append(datas)
with conn.cursor() as userlist_:
if request.user.is_superuser:
# print("is superuser")
sql = """
SELECT
au.id,
au.username,
au.first_name,
au.last_name,
au.is_active,
au.last_login,
au.email,
ag.name,
au.is_staff,
au.is_superuser,
au.file_path
FROM
auth_user au,
auth_user_groups aug,
auth_group ag
WHERE
au.id = aug.user_id AND
ag.id = aug.group_id
ORDER BY
au.username ASC"""
else:
if request.user.is_staff:
sql = """
SELECT
au.id,
au.username,
au.first_name,
au.last_name,
au.is_active,
au.last_login,
au.email,
ag.name,
au.is_staff,
au.is_superuser,
au.file_path
FROM
auth_user au,
auth_user_groups aug,
auth_group ag
WHERE
au.id = aug.user_id AND
ag.id = aug.group_id AND
ORDER BY
au.username ASC"""
else:
print('not staff')
userlist_.execute(sql)
allUser = userlist_.fetchall()
user_res = []
for rows in allUser:
datas = {
"id": rows[0],
"username": rows[1],
"name": rows[2] +" "+ rows[3],
"email": rows[6],
"isactive": rows[4],
"last": rows[5],
"group": rows[7],
"filepath": rows[10]
}
user_res.append(datas)
context = { context = {
'title':'Dashboard', 'title':'Dashboard',
...@@ -537,7 +615,8 @@ class Dashboard(generic.TemplateView): ...@@ -537,7 +615,8 @@ class Dashboard(generic.TemplateView):
'gardu_listrik':gardu_listrik_result, 'gardu_listrik':gardu_listrik_result,
'global':all[0], 'global':all[0],
'res_all':res_all, 'res_all':res_all,
'thisUser' : user_data 'thisUser' : user_data,
'user_res':user_res
} }
return render (request, self.template_name, context) return render (request, self.template_name, context)
......
...@@ -234,6 +234,29 @@ body>div.page-container>div>div.sidebar.sidebar-main>div>img { ...@@ -234,6 +234,29 @@ body>div.page-container>div>div.sidebar.sidebar-main>div>img {
font-family: 'gilroylight'; font-family: 'gilroylight';
} }
#map-edit>div.leaflet-control-container>div.leaflet-top.leaflet-left>div>div>div {
display: none;
}
#map-for-edit>div.leaflet-control-container>div.leaflet-top.leaflet-left>div>div>div {
display: none;
}
#map-for-delete>div.leaflet-control-container>div.leaflet-top.leaflet-left>div>div>div {
display: none;
}
/* #user_profile>div>div>div>div>div.col-md-3>div>div.text-left>div>.active {
border: 1pt solid #4C97DC;
color: #4C97DC;
} */
.tab-user.active {
border: 1pt solid #4C97DC;
color: #4C97DC;
}
@media (max-width: 1025px) { @media (max-width: 1025px) {
.dock { .dock {
position: absolute; position: absolute;
......
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="8" cy="8" r="8" fill="#D5A266"/>
<path d="M7.53125 10.8125C9.34343 10.8125 10.8125 9.34343 10.8125 7.53125C10.8125 5.71907 9.34343 4.25 7.53125 4.25C5.71907 4.25 4.25 5.71907 4.25 7.53125C4.25 9.34343 5.71907 10.8125 7.53125 10.8125Z" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M9.85107 9.85156L11.7495 11.75" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="8" cy="8" r="8" fill="url(#paint0_linear)"/>
<path d="M6.75 11.4375H4.875C4.79212 11.4375 4.71263 11.4045 4.65403 11.3459C4.59542 11.2873 4.5625 11.2078 4.5625 11.125V9.3794C4.5625 9.33836 4.57058 9.29772 4.58629 9.25981C4.60199 9.22189 4.62501 9.18744 4.65403 9.15842L9.34153 4.47092C9.40014 4.41232 9.47962 4.37939 9.5625 4.37939C9.64538 4.37939 9.72487 4.41232 9.78347 4.47092L11.529 6.21648C11.5876 6.27509 11.6206 6.35457 11.6206 6.43745C11.6206 6.52033 11.5876 6.59982 11.529 6.65842L6.75 11.4375Z" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M8.3125 5.5L10.5 7.6875" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11.4375 11.4375H6.75" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
<defs>
<linearGradient id="paint0_linear" x1="8" y1="-15" x2="28.9097" y2="18.3913" gradientUnits="userSpaceOnUse">
<stop stop-color="#4C97DC"/>
<stop offset="1" stop-color="#4969DA"/>
</linearGradient>
</defs>
</svg>
<svg width="29" height="29" viewBox="0 0 29 29" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="29" height="29" viewBox="0 0 29 29" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14.0755 25.1478C19.9057 25.1478 24.6319 20.4215 24.6319 14.5914C24.6319 8.7612 19.9057 4.03491 14.0755 4.03491C8.24533 4.03491 3.51904 8.7612 3.51904 14.5914C3.51904 20.4215 8.24533 25.1478 14.0755 25.1478Z" stroke="url(#paint0_linear)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> <path d="M14.0755 25.1478C19.9057 25.1478 24.6319 20.4215 24.6319 14.5914C24.6319 8.7612 19.9057 4.03491 14.0755 4.03491C8.24533 4.03491 3.51904 8.7612 3.51904 14.5914C3.51904 20.4215 8.24533 25.1478 14.0755 25.1478Z" stroke="#343539" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M14.0753 18.1103C16.5045 18.1103 18.4738 16.141 18.4738 13.7118C18.4738 11.2825 16.5045 9.31323 14.0753 9.31323C11.646 9.31323 9.67676 11.2825 9.67676 13.7118C9.67676 16.141 11.646 18.1103 14.0753 18.1103Z" stroke="url(#paint1_linear)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> <path d="M14.0753 18.1103C16.5045 18.1103 18.4738 16.141 18.4738 13.7118C18.4738 11.2825 16.5045 9.31323 14.0753 9.31323C11.646 9.31323 9.67676 11.2825 9.67676 13.7118C9.67676 16.141 11.646 18.1103 14.0753 18.1103Z" stroke="#343539" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M7.01562 22.4399C7.67827 21.1371 8.68852 20.043 9.93452 19.2789C11.1805 18.5147 12.6137 18.1102 14.0753 18.1102C15.537 18.1102 16.9702 18.5147 18.2162 19.2789C19.4622 20.043 20.4724 21.1371 21.1351 22.4399" stroke="url(#paint2_linear)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> <path d="M7.01562 22.4398C7.67827 21.137 8.68852 20.0429 9.93452 19.2787C11.1805 18.5146 12.6137 18.1101 14.0753 18.1101C15.537 18.1101 16.9702 18.5146 18.2162 19.2787C19.4622 20.0429 20.4724 21.1369 21.1351 22.4398" stroke="#343539" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<defs>
<linearGradient id="paint0_linear" x1="14.0755" y1="-15.7584" x2="41.667" y2="28.3032" gradientUnits="userSpaceOnUse">
<stop stop-color="#4C97DC"/>
<stop offset="1" stop-color="#4969DA"/>
</linearGradient>
<linearGradient id="paint1_linear" x1="14.0753" y1="1.066" x2="25.5717" y2="19.425" gradientUnits="userSpaceOnUse">
<stop stop-color="#4C97DC"/>
<stop offset="1" stop-color="#4969DA"/>
</linearGradient>
<linearGradient id="paint2_linear" x1="14.0753" y1="14.0511" x2="16.4049" y2="26.1829" gradientUnits="userSpaceOnUse">
<stop stop-color="#4C97DC"/>
<stop offset="1" stop-color="#4969DA"/>
</linearGradient>
</defs>
</svg> </svg>
...@@ -92,8 +92,9 @@ ...@@ -92,8 +92,9 @@
<script> <script>
var kantor_administrasi = "{{ kantor_administrasi }}".replace(/&#x27;/g, '"'); var kantor_administrasi = "{{ kantor_administrasi }}".replace(/&#x27;/g, '"');
console.log(kantor_administrasi)
var result_kan_adm = JSON.parse("" + kantor_administrasi + "") var result_kan_adm = JSON.parse("" + kantor_administrasi + "")
console.log(result_kan_adm)
geo_po_adm = L.geoJson(null, { geo_po_adm = L.geoJson(null, {
pointToLayer: function(feature, latlng) { pointToLayer: function(feature, latlng) {
...@@ -361,6 +362,30 @@ ...@@ -361,6 +362,30 @@
`) `)
if (feature.administrasi.f16 != "None") {
var list_history = feature.administrasi.f16
console.log(list_history[0].split(",")[0])
var perbaikan_pt = `<div class='row'>
<label class="col-md-8">` + list_history[0].split(",")[1] + `</label>
<a class="col-md-4" onclick="getdetailper(` + list_history[0].split(",")[0] + `)" data-toggle="modal" data-target="#modal_detail_perbaikan_dash"><i>Detail</i></a>
</div>
<a class="col-md-6" class="btn" id="btn_perbaikan_jalan"><i>Input Perbaikan</i></a>`
} else {
var perbaikan_pt = `<div class='row'>
<div class="col-md-6">
<label class="col-md-6">Null</label>
</div>
</div>
<a class="col-md-6" class="btn" id="btn_perbaikan_jalan"><i>Input Perbaikan</i></a>
`
}
$(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value=""> $(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
<input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value=""> <input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
<div> <div>
...@@ -389,7 +414,18 @@ ...@@ -389,7 +414,18 @@
<div> <div>
<span>` + raja + `</span> <span>` + raja + `</span>
</div> </div>
</div>`); </div>
<div>
<div>
<span>Perbaikan Terakhir</span>
</div>
<div>
<span>` + perbaikan_pt + `</span>
</div>
</div>
`);
$(".btn_action").html(`<div class="tombol-edit-keterangan text-center" style="background-color: #5A9AFB;position: absolute;width: 40px;height: 40px;bottom: 2px;right: 5px;border: 1pt solid rosybrown;border-radius: 8px;"> $(".btn_action").html(`<div class="tombol-edit-keterangan text-center" style="background-color: #5A9AFB;position: absolute;width: 40px;height: 40px;bottom: 2px;right: 5px;border: 1pt solid rosybrown;border-radius: 8px;">
<a href="#" id="btn_edit_adm" data-toggle="modal" data-target="#modal_adm" data-backdrop="static" data-keyboard="false" class="btn" style="border-bottom-left-radius: 8px;border-top-right-radius: 8px;width: 100%;height: 100%;bottom: 0px;color: white;" title="Edit"><i class="icon-pencil5"></i></a> <a href="#" id="btn_edit_adm" data-toggle="modal" data-target="#modal_adm" data-backdrop="static" data-keyboard="false" class="btn" style="border-bottom-left-radius: 8px;border-top-right-radius: 8px;width: 100%;height: 100%;bottom: 0px;color: white;" title="Edit"><i class="icon-pencil5"></i></a>
...@@ -6719,7 +6755,7 @@ ...@@ -6719,7 +6755,7 @@
</table> </table>
</div> </div>
<div class="form-group" style="margin-bottom:10px;"> <div class="form-group" style="margin-bottom:10px;">
<div id="map-delete" style="width: 300px;height: 250px;position: relative;margin-left: 10px;margin-right: 10px;margin-top: 10px;"></div> <!-- <div id="map-delete" style="width: 300px;height: 250px;position: relative;margin-left: 10px;margin-right: 10px;margin-top: 10px;"></div> -->
<div class="form-group"> <div class="form-group">
<div class="col-lg-12" style="margin-top:10px;margin-bottom:10px;"> <div class="col-lg-12" style="margin-top:10px;margin-bottom:10px;">
<input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunanhps" value=""> <input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunanhps" value="">
...@@ -6843,7 +6879,28 @@ ...@@ -6843,7 +6879,28 @@
</div>`; </div>`;
if (feature.properties.f4 != null) {
var list_history = feature.properties.f4
console.log(list_history[0].split(",")[0])
var perbaikan_bg = `<div class='row'>
<label class="col-md-8">` + list_history[0].split(",")[1] + `</label>
<a class="col-md-4" onclick="getdetailper(` + list_history[0].split(",")[0] + `)" data-toggle="modal" data-target="#input_perbaikan_bang"><i>Detail</i></a>
</div>
<a class="col-md-6" class="btn" id="btn_perbaikan_jalan"><i>Input Perbaikan</i></a>`
} else {
var perbaikan_bg = `<div class='row'>
<div class="col-md-6">
<label class="col-md-6">Null</label>
</div>
</div>
<a class="btn" id="btn_perbaikan_hist" data-toggle="modal" data-target="#input_perbaikan_bang"><i>Input Perbaikan</i></a>
`
}
$(".gambar_keterangan").html(`<img src="` + path_img + `" alt="" style="width:100%;height:240px;border-top-left-radius: 10px;border-bottom-left-radius: 10px;">`) $(".gambar_keterangan").html(`<img src="` + path_img + `" alt="" style="width:100%;height:240px;border-top-left-radius: 10px;border-bottom-left-radius: 10px;">`)
...@@ -6862,6 +6919,7 @@ ...@@ -6862,6 +6919,7 @@
$(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value=""> $(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
<input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value=""> <input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
<div class="col-md-6">
<div> <div>
<div> <div>
<span>Jenis Bangunan</span> <span>Jenis Bangunan</span>
...@@ -6888,7 +6946,8 @@ ...@@ -6888,7 +6946,8 @@
<span style="font-family: 'Roboto';">` + feature.administrasi.f7 + ` m</span> <span style="font-family: 'Roboto';">` + feature.administrasi.f7 + ` m</span>
</div> </div>
</div> </div>
</div>
<div class="col-md-6">
<div> <div>
<div> <div>
<span>Tinggi Bangunan</span> <span>Tinggi Bangunan</span>
...@@ -6905,13 +6964,25 @@ ...@@ -6905,13 +6964,25 @@
<div> <div>
<span style="font-family: 'Roboto';">` + feature.administrasi.f10 + ` m</span> <span style="font-family: 'Roboto';">` + feature.administrasi.f10 + ` m</span>
</div> </div>
</div>`); </div>
</div>
<div>
<div style="margin-top: 150px;">
<span>Perbaikan Terakhir</span>
</div>
<div>
<span>` + perbaikan_bg + `</span>
</div>
</div>
`);
$(".btn_action").html(`<div class="tombol-edit-keterangan text-center" style="background-color: #5A9AFB;position: absolute;width: 40px;height: 40px;bottom: 2px;right: 5px;border: 1pt solid rosybrown;border-radius: 8px;"> $(".btn_action").html(`<div class="tombol-edit-keterangan text-center" style="background-color: #5A9AFB;position: absolute;width: 40px;height: 40px;bottom: 2px;right: 5px;border: 1pt solid rosybrown;border-radius: 8px;">
<a href="#" id="btn_edit_bangunan" 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></a> <a href="#" id="btn_edit_bangunan" data-toggle="modal" data-target="#modal_bangunan_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></a>
</div> </div>
<div class="tombol-delete-keterangan text-center" style="background-color: indianred;position: absolute;width: 40px;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;"> <div class="tombol-delete-keterangan text-center" data-toggle="modal" data-target="#modal_bangunan_delete" style="background-color: indianred;position: absolute;width: 40px;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
<a href="#" id="btn_delete_bangunan" 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></a> <a href="#" id="btn_delete_bangunan" data-toggle="modal" data-target="#modal_bangunan_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></a>
</div> </div>
`) `)
......
...@@ -2055,10 +2055,10 @@ ...@@ -2055,10 +2055,10 @@
</div> </div>
`) `)
if (feature.properties.f7 != null) { if (feature.properties.f16 != null) {
var list_history = feature.properties.f7 var list_history = feature.properties.f16
console.log(list_history[0].split(",")[0]) console.log(list_history[0].split(",")[0])
var perbaikan_jl = `<div class='row'> var perbaikan_pt = `<div class='row'>
<label class="col-md-8">` + list_history[0].split(",")[1] + `</label> <label class="col-md-8">` + list_history[0].split(",")[1] + `</label>
...@@ -2069,16 +2069,14 @@ ...@@ -2069,16 +2069,14 @@
<a class="col-md-6" class="btn" id="btn_perbaikan_jalan"><i>Input Perbaikan</i></a>` <a class="col-md-6" class="btn" id="btn_perbaikan_jalan"><i>Input Perbaikan</i></a>`
} else { } else {
var perbaikan_jl = `<div class='row'> var perbaikan_pt = `<div class='row'>
<div class="col-md-6"> <div class="col-md-6">
<label class="col-md-6">Null</label> <label class="col-md-6">Null</label>
</div> </div>
</div>
<a class="col-md-6" class="btn" id="btn_perbaikan_jalan"><i>Input Perbaikan</i></a> <a class="col-md-6" class="btn" id="btn_perbaikan_jalan"><i>Input Perbaikan</i></a>
`
</div>`
} }
$(".isi_keterangan").html(` $(".isi_keterangan").html(`
...@@ -2845,103 +2843,6 @@ ...@@ -2845,103 +2843,6 @@
}); });
}; };
function getdetailper(id) {
$.ajax({
url: "{% url 'apps:get-detail-perbaikan' %}",
data: {
'id': id
},
dataType: 'json',
success: function(data) {
console.log(data)
var map_detail_perbaikan = L.map('map_detail_perbaikan_dash', {
editable: true,
zoomControl: false,
drawControl: true
}).setView([-4.125826277307029, 104.1881561279297], 10);
L.tileLayer('https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}&s=Gal&apistyle=s.t:0|s.e:l|p.v:off', {
maxZoom: 21,
minZoom: 4,
}).addTo(map_detail_perbaikan);
setTimeout(function() {
map_detail_perbaikan.invalidateSize();
}, 500);
if (data.length === 0) {
$(".nama_detail_dash").text("Null");
$(".type_detail_dash").html("Null");
$(".tanggal_perbaikan_detail_dash").html("Null")
$(".anggaran_detail_dash").html("Null")
$(".penanggung_jawab_detail_dash").html("Null")
$(".penanggung_jawab_lapangan_detail_dash").html("Null")
$(".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; ">
</a>`);
$(".bukti_detail_perbaikan_dash").html(`
<a href="media/bukti_penyelesaian/null" onclick="viewBukti() " id="view-bukti ">
<img src="{% static 'img/icon-1/bukti.svg' %} " alt=" " style="height: 70px;
width: 50px;">
</a>`);
} else {
$(".nama_detail_dash").html(data[0]['name']);
$(".type_detail_dash").html(data[0]['type'])
$(".tanggal_perbaikan_detail_dash").text(data[0]['tgl_perbaikan'])
$(".anggaran_detail_dash").html(data[0]['anggaran'])
$(".penanggung_jawab_detail_dash").html(data[0]['pj'])
$(".penanggung_jawab_lapangan_detail_dash").html(data[0]['pj_lapangan'])
$(".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="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="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>`);
map_detail_perbaikan.setView([data[0]['geometry']['coordinates'][0][0][1], data[0]['geometry']['coordinates'][0][0][0]], 18)
var myLines = [data[0]['geometry']];
var geo_jalan_perbaikan = L.geoJson(data[0]['geometry'], {
style: function(feature) {
return {
color: "#FAFA00",
weight: 10,
opacity: 2,
zIndex: 1001
};
}
}).addTo(map_detail_perbaikan);
}
}
});
};
var geo_jalan_input = L.geoJson(null, { var geo_jalan_input = L.geoJson(null, {
style: function(feature) { style: function(feature) {
return { return {
...@@ -3094,108 +2995,108 @@ ...@@ -3094,108 +2995,108 @@
}) })
}); });
$('.datatable-show-all').DataTable({ // $('.datatable-show-all').DataTable({
autoWidth: false, // autoWidth: false,
columnDefs: [{ // columnDefs: [{
orderable: false, // orderable: false,
width: '20px', // width: '20px',
targets: [0], // targets: [0],
//
}, // },
// // {
// // width: '100px',
// // targets: [ 4 ]
// // },
// { // {
// orderable: false,
// width: '20px',
// targets: [6],
//
// }, {
// orderable: false,
// width: '20px',
// targets: [7],
//
// },
// ],
// dom: '<"float-left"B>frtip',
// buttons: [{
// text: 'Tambah User',
// action: function(e, dt, node, config) {
// $("#modalAddButton").click()
// $("#inUsername").attr("disabled", false);
// $("#inUsername").val(null);
// $("#inNameF").val(null);
// $("#inNameL").val(null);
// $("#inEmail").val(null);
// $("#iduser").val(null);
// $(".modstit").html("Tambah User")
// loadGroups(null)
// }
// }],
// language: {
// search: '<span>Filter:</span> _INPUT_',
// searchPlaceholder: 'Type to filter...',
// lengthMenu: '<span>Show:</span> _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');
// }
//
// });
//
//
// $('.datatable-groups').DataTable({
// autoWidth: false,
// columnDefs: [{
// orderable: false,
// width: '100px',
// targets: [2]
// }, {
// orderable: false,
// width: '100px', // width: '100px',
// targets: [ 4 ] // targets: [0]
// }],
// dom: '<"float-left"B>frtip',
// buttons: [{
// text: 'Tambah Group',
// action: function(e, dt, node, config) {
// $("#modalAddButtong").click();
// $("#idgroup").val(null);
// $(".modstitg").html("Tambah Group")
// $("#inGroupName").val(null)
// $("#container_sparent").css("display", "block")
// loadGroups(null)
// }
// }],
// language: {
// search: '<span>Filter:</span> _INPUT_',
// searchPlaceholder: 'Type to filter...',
// lengthMenu: '<span>Show:</span> _MENU_',
// paginate: {
// 'first': 'First',
// 'last': 'Last',
// 'next': '&rarr;',
// 'previous': '&larr;'
// }
// }, // },
{ // drawCallback: function() {
orderable: false, // $(this).find('tbody tr').slice(-3).find('.dropdown, .btn-group').addClass('dropup');
width: '20px', // },
targets: [6], // preDrawCallback: function() {
// $(this).find('tbody tr').slice(-3).find('.dropdown, .btn-group').removeClass('dropup');
}, { // }
orderable: false, //
width: '20px', // });
targets: [7],
},
],
dom: '<"float-left"B>frtip',
buttons: [{
text: 'Tambah User',
action: function(e, dt, node, config) {
$("#modalAddButton").click()
$("#inUsername").attr("disabled", false);
$("#inUsername").val(null);
$("#inNameF").val(null);
$("#inNameL").val(null);
$("#inEmail").val(null);
$("#iduser").val(null);
$(".modstit").html("Tambah User")
loadGroups(null)
}
}],
language: {
search: '<span>Filter:</span> _INPUT_',
searchPlaceholder: 'Type to filter...',
lengthMenu: '<span>Show:</span> _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');
}
});
$('.datatable-groups').DataTable({
autoWidth: false,
columnDefs: [{
orderable: false,
width: '100px',
targets: [2]
}, {
orderable: false,
width: '100px',
targets: [0]
}],
dom: '<"float-left"B>frtip',
buttons: [{
text: 'Tambah Group',
action: function(e, dt, node, config) {
$("#modalAddButtong").click();
$("#idgroup").val(null);
$(".modstitg").html("Tambah Group")
$("#inGroupName").val(null)
$("#container_sparent").css("display", "block")
loadGroups(null)
}
}],
language: {
search: '<span>Filter:</span> _INPUT_',
searchPlaceholder: 'Type to filter...',
lengthMenu: '<span>Show:</span> _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');
}
});
$("#modalAddButton").click(function() { $("#modalAddButton").click(function() {
$("body").css("padding-right", "0px !important") $("body").css("padding-right", "0px !important")
......
...@@ -750,12 +750,11 @@ ...@@ -750,12 +750,11 @@
<div style="margin-bottom: 10px;"> <div style="margin-bottom: 10px;">
<a href="#personalinformation" data-toggle="tab" class="btn btn-default" style=" <a href="#personalinformation" data-toggle="tab" class="tab-user btn btn-default" style="
width: 90%; width: 90%;
background: #FFFFFF; background: #FFFFFF;
border: 1px solid #4A7ADB;
box-sizing: border-box; box-sizing: border-box;
border-radius: 5px;"> border-radius: 5px;" onclick="btnuserclick(event)">
<div class="row"> <div class="row">
<div class="col-sm-2"> <div class="col-sm-2">
<img src="{% static 'img/icon-1/personalinfo.svg' %}" alt=""> <img src="{% static 'img/icon-1/personalinfo.svg' %}" alt="">
...@@ -774,12 +773,11 @@ ...@@ -774,12 +773,11 @@
{% if user.is_superuser %} {% if user.is_superuser %}
<div style="margin-bottom: 10px;"> <div style="margin-bottom: 10px;">
<a href="#informationdatauser" data-toggle="tab" class="btn btn-default" style=" <a href="#informationdatauser" data-toggle="tab" class="tab-user btn btn-default" style="
width: 90%; width: 90%;
background: #FFFFFF; background: #FFFFFF;
border: 1px solid #4A7ADB;
box-sizing: border-box; box-sizing: border-box;
border-radius: 5px;"> border-radius: 5px;" onclick="btnuserclick(event)">
<div class="row"> <div class="row">
<div class="col-sm-2"> <div class="col-sm-2">
<img src="{% static 'img/icon-1/infodatauser.svg' %}" alt=""> <img src="{% static 'img/icon-1/infodatauser.svg' %}" alt="">
...@@ -797,12 +795,11 @@ ...@@ -797,12 +795,11 @@
</div> </div>
{% endif %} {% endif %}
<div style="margin-bottom: 10px;"> <div style="margin-bottom: 10px;">
<a href="#monitoringdatauser" data-toggle="tab" class="btn btn-default" style=" <a href="#monitoringdatauser" data-toggle="tab" class="tab-user btn btn-default" style="
width: 90%; width: 90%;
background: #FFFFFF; background: #FFFFFF;
border: 1px solid #4A7ADB;
box-sizing: border-box; box-sizing: border-box;
border-radius: 5px;"> border-radius: 5px;" onclick="btnuserclick(event)">
<div class="row"> <div class="row">
<div class="col-sm-2"> <div class="col-sm-2">
<img src="{% static 'img/icon-1/monitordatauser.svg' %}" alt=""> <img src="{% static 'img/icon-1/monitordatauser.svg' %}" alt="">
...@@ -819,12 +816,11 @@ ...@@ -819,12 +816,11 @@
</a> </a>
</div> </div>
<div style="margin-bottom: 10px;"> <div style="margin-bottom: 10px;">
<a href="#help" data-toggle="tab" class="btn btn-default" style=" <a href="#help" data-toggle="tab" class="tab-user btn btn-default" style="
width: 90%; width: 90%;
background: #FFFFFF; background: #FFFFFF;
border: 1px solid #4A7ADB;
box-sizing: border-box; box-sizing: border-box;
border-radius: 5px;"> border-radius: 5px;" onclick="btnuserclick(event)">
<div class="row"> <div class="row">
<div class="col-sm-2"> <div class="col-sm-2">
<img src="{% static 'img/icon-1/help.svg' %}" alt=""> <img src="{% static 'img/icon-1/help.svg' %}" alt="">
...@@ -977,12 +973,83 @@ ...@@ -977,12 +973,83 @@
</div> </div>
{% if user.is_superuser %} {% if user.is_superuser %}
<div class="tab-pane" id="informationdatauser"> <div class="tab-pane" id="informationdatauser">
informationdatauser <table class="table table-responsive datatable-show-all table-sm list_user" id="list_user" style="font-size : 8pt;padding:0px;border-top:0.5pt solid #EFEFEF;border-bottom:0.5pt solid #EFEFEF;margin-bottom: 10px;">
<div style="position: absolute;right: 30px;font-size: 10pt;">
<a class="btn side-bar-but" id="download_perbaikan" onclick="download_user_list('xlsx')" style="z-index:9;">
<div>
<i class="icon-download4"></i><span>&nbsp;&nbsp;&nbsp;Download</span>
</div>
</a>
</div>
<thead style="font-size: 12px;line-height: 14px;font-family: 'gilroysemibold';text-transform: capitalize;">
<tr>
<th>No.</th>
<th>Id user</th>
<th>Nama</th>
<th>Email</th>
<th>Last Login</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody id="tbody_user_list">
{% for all in user_res %}
<tr>
<td>{{forloop.counter}}</td>
<td>{{all.id}}</td>
<td>{{all.username}}</td>
<td>{{all.email}}</td>
<td>{{all.last}}</td>
<td>{{all.isactive}}</td>
<td class="text-center ">
<a class="btn mdlFire " onclick="loaddetailid( '{{all.id}}') " data-toggle="modal" data-target="#modal_detail_perbaikan " style="background-color: #5A9AFB;color: white;border-radius: 5px;width: 85px;height: 25px; ">
<div style="margin-top: -5px; ">
<i class="icon-search4 text-muted text-size-base " style="color: white;font-size: 10px; "></i>
<span>&nbsp;&nbsp;
Detail</span>
</div>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div> </div>
{% endif %} {% endif %}
<div class="tab-pane" id="monitoringdatauser"> <div class="tab-pane" id="monitoringdatauser">
monitoringdatauser <table class="table table-responsive datatable-show-all table-sm list_point" id="list_point" style="font-size : 8pt;padding:0px;border-top:0.5pt solid #EFEFEF;border-bottom:0.5pt solid #EFEFEF;margin-bottom: 10px;">
<div style="position: absolute;right: 30px;font-size: 10pt;">
<a class="btn side-bar-but" id="download_perbaikan" onclick="download_user_list('xlsx')" style="z-index:9;">
<div>
<i class="icon-download4"></i><span>&nbsp;&nbsp;&nbsp;Download</span>
</div>
</a>
</div>
<thead style="font-size: 12px;line-height: 14px;font-family: 'gilroysemibold';text-transform: capitalize;">
<tr>
<th>No.</th>
<th>Nama Tempat</th>
<th>Alamat</th>
<th>Luas Bangunan</th>
<th>Penanggung Jawab</th>
<th>Action</th>
</tr>
</thead>
<tbody id="tbody_list_point">
</tbody>
</table>
</div> </div>
<div class="tab-pane" id="help"> <div class="tab-pane" id="help">
help help
...@@ -1297,3 +1364,78 @@ ...@@ -1297,3 +1364,78 @@
<!-- /main charts --> <!-- /main charts -->
</div> </div>
<script>
function btnuserclick(evt) {
var i, tabcontent, tablinks;
tablinks = document.getElementsByClassName("tab-user");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
evt.currentTarget.className += " active";
//$(".tab-user").style.border = "#4C97DC";
}
// $('.datatable-show-all.list_user').DataTable({
// autoWidth: false,
// columnDefs: [{
// orderable: false,
// width: '20px',
// targets: [0],
//
// }, {
// orderable: false,
// width: '20px',
// targets: [5],
//
// }, {
// orderable: false,
// width: '20px',
// targets: [6],
//
// }, ],
// 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');
// }
// });
function download_user_list(type, fn, dl) {
var elt = document.getElementById('list_user');
var wb = XLSX.utils.table_to_book(elt, {
sheet: "sheet1"
});
return dl ?
XLSX.write(wb, {
bookType: type,
bookSST: true,
type: 'base64'
}) :
XLSX.writeFile(wb, fn || ('data_user.' + (type || 'xlsx')));
}
</script>
<style>
.tab-user.active {
border: 1pt solid #4C97DC!important;
color: #4C97DC!important;
}
.tab-user.active {}
</style>
\ No newline at end of file
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<i class="icon-pie-chart5"></i> <i class="icon-pie-chart5"></i>
</a> </a>
</li> </li>
<li style="margin-top: 400px;position: absolute;"> <li style="margin-top: 60vh;position: absolute;">
<a href="#" id="btn-hide-all" class="side-bar-but" style="position: absolute;margin-top: 20px;"> <a href="#" id="btn-hide-all" class="side-bar-but" style="position: absolute;margin-top: 20px;">
<i class="icon-arrow-right13"></i> <i class="icon-arrow-right13"></i>
</a> </a>
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</div> </div>
</div> </div>
<div id="panel-sm" class="sidebar-2" style="display:none;background: #1B1F2D;position: absolute;z-index: 9;width: 23%;height:100vh;left: 0%;transition: all 0.5s ease;"> <div id="panel-sm" class="sidebar-2" style="display:none;background: #1B1F2D;position: absolute;z-index: 9;width:330px;height:100vh;left: 0%;transition: all 0.5s ease;">
<div style="margin-left: 50px;background: #1B1F2D;"> <div style="margin-left: 50px;background: #1B1F2D;">
<div class="header" style="margin-top: 25px;background: #2F3445;"> <div class="header" style="margin-top: 25px;background: #2F3445;">
...@@ -426,7 +426,7 @@ ...@@ -426,7 +426,7 @@
<div class="panel panel-flat " id="perbaikan-dashboard " style="background: #181B27;position: absolute;z-index: 9;width: 77%;height:100vh;left: 23%;transition: all 0.5s ease;color: white; border: none; "> <div class="panel panel-flat " id="perbaikan-dashboard " style="background: #181B27;position: absolute;z-index: 9;width: 77%;height:100vh;left: 23%;transition: all 0.5s ease;color: white; border: none; ">
<div class="panel-body " style="padding:14px 0px;"> <div class="panel-body " style="padding:14px 0px;">
<table class="table table-responsive datatable-show-all table-sm bg-slate-610" id="list_perbaikan" style="font-size : 8pt;padding:0px;border-top:0.5pt solid #343434;border-bottom:0.5pt solid #343434;margin-bottom: 10px;"> <table class="table table-responsive datatable-show-all table-sm bg-slate-610 list_perb" id="list_perbaikan" style="font-size : 8pt;padding:0px;border-top:0.5pt solid #343434;border-bottom:0.5pt solid #343434;margin-bottom: 10px;">
<div style="position: absolute;right: 30px;font-size: 10pt;"> <div style="position: absolute;right: 30px;font-size: 10pt;">
<a class="btn side-bar-but" id="download_perbaikan" onclick="download_all('xlsx')" style="color: white;z-index:9;"> <a class="btn side-bar-but" id="download_perbaikan" onclick="download_all('xlsx')" style="color: white;z-index:9;">
<div> <div>
...@@ -668,6 +668,7 @@ ...@@ -668,6 +668,7 @@
<script> <script>
$("#sel-kec ").change(function() { $("#sel-kec ").change(function() {
var id_kec = $(this).val() var id_kec = $(this).val()
$.ajax({ $.ajax({
...@@ -726,8 +727,7 @@ ...@@ -726,8 +727,7 @@
data_perbaikan.push(data_gab) data_perbaikan.push(data_gab)
}; };
$("#tbody_perbaikan ").html(data_perbaikan) $("#tbody_perbaikan").html(data_perbaikan)
} }
}); });
......
...@@ -685,7 +685,7 @@ ...@@ -685,7 +685,7 @@
padding: 8px 16px; padding: 8px 16px;
text-align: center; text-align: center;
text-decoration: none; text-decoration: none;
text-overflow: ellipsis;" data-toggle="modal" data-target="#user_profile" data-backdrop="static" data-keyboard="false">Kelola Akun</a> text-overflow: ellipsis;" data-toggle="modal" data-target="#user_profile" id="kelolaakun_btn" data-backdrop="static" data-keyboard="false">Kelola Akun</a>
</div> </div>
</div> </div>
...@@ -843,3 +843,273 @@ ...@@ -843,3 +843,273 @@
}) })
}); });
</script> </script>
<script>
function getdetailper(id) {
$.ajax({
url: "{% url 'apps:get-detail-perbaikan' %}",
data: {
'id': id
},
dataType: 'json',
success: function(data) {
console.log(data)
var map_detail_perbaikan = L.map('map_detail_perbaikan_dash', {
editable: true,
zoomControl: false,
drawControl: true
}).setView([-4.125826277307029, 104.1881561279297], 10);
L.tileLayer('https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}&s=Gal&apistyle=s.t:0|s.e:l|p.v:off', {
maxZoom: 21,
minZoom: 4,
}).addTo(map_detail_perbaikan);
setTimeout(function() {
map_detail_perbaikan.invalidateSize();
}, 500);
if (data.length === 0) {
$(".nama_detail_dash").text("Null");
$(".type_detail_dash").html("Null");
$(".tanggal_perbaikan_detail_dash").html("Null")
$(".anggaran_detail_dash").html("Null")
$(".penanggung_jawab_detail_dash").html("Null")
$(".penanggung_jawab_lapangan_detail_dash").html("Null")
$(".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; ">
</a>`);
$(".bukti_detail_perbaikan_dash").html(`
<a href="media/bukti_penyelesaian/null" onclick="viewBukti() " id="view-bukti ">
<img src="{% static 'img/icon-1/bukti.svg' %} " alt=" " style="height: 70px;
width: 50px;">
</a>`);
} else {
$(".nama_detail_dash").html(data[0]['name']);
$(".type_detail_dash").html(data[0]['type'])
$(".tanggal_perbaikan_detail_dash").text(data[0]['tgl_perbaikan'])
$(".anggaran_detail_dash").html(data[0]['anggaran'])
$(".penanggung_jawab_detail_dash").html(data[0]['pj'])
$(".penanggung_jawab_lapangan_detail_dash").html(data[0]['pj_lapangan'])
$(".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="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="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>`);
map_detail_perbaikan.setView([data[0]['geometry']['coordinates'][0][0][1], data[0]['geometry']['coordinates'][0][0][0]], 18)
var myLines = [data[0]['geometry']];
var geo_jalan_perbaikan = L.geoJson(data[0]['geometry'], {
style: function(feature) {
return {
color: "#FAFA00",
weight: 10,
opacity: 2,
zIndex: 1001
};
}
}).addTo(map_detail_perbaikan);
}
}
});
};
$("#kelolaakun_btn").click(function() {
$.ajax({
url: "{% url 'api:user-data' %}",
dataType: 'json',
success: function(data) {
var data_user = []
var number = 1;
for (var i = 0; i < data['data'].length; i++) {
number += i;
var id = data['data'][i]['id'];
var name = data['data'][i]['name'];
var username = data['data'][i]['username'];
var group = data['data'][i]['group'];
var email = data['data'][i]['email'];
var last = data['data'][i]['last'];
var isactive = data['data'][i]['isactive'];
var data_gab = `<tr>
<td>` + number + `</td>
<td>` + id + `</td>
<td>` + username + `</td>
<td>` + email + `</td>
<td>` + last + `</td>
<td>` + isactive + `</td>
<td class="text-center ">
<a class="btn mdlFire " data-toggle="modal " data-target="#modal_detail_perbaikan " style="background-color: #5A9AFB;color: white;border-radius: 5px;width: 85px;height: 25px; ">
<div style="margin-top: -5px; ">
<i class="icon-search4 text-muted text-size-base " style="color: white;font-size: 10px; "></i>
<span>&nbsp;&nbsp;
Detail</span>
</div>
</a>
</td>
</tr>`;
data_user.push(data_gab)
};
$("#tbody_list_user").html(data_user)
var data_point = []
var number2 = 0;
for (var i = 0; i < data['point'].length; i++) {
number2 += 1;
var id = data['point'][i]['id'];
var nama_tempat = data['point'][i]['nama_tempat'];
var alamat = data['point'][i]['alamat'];
var luas = data['point'][i]['luas'];
var pj = data['point'][i]['pj']
var data_gab = `<tr>
<td>` + number2 + `</td>
<td>` + nama_tempat + `</td>
<td>` + alamat + `</td>
<td>` + luas + `</td>
<td>` + pj + `</td>
<td class="text-center " style="padding: 0px;">
<div class="row">
<div class="col-md-3" style="padding: 0px;">
<a class="btn mdlFire " data-toggle="modal " data-target="#modal_detail_perbaikan " >
<div>
<img src="static/img/icon-1/detailpoi.svg" alt="">
</div>
</a>
</div>
<div class="col-md-3" style="padding: 0px;">
<a class="btn mdlFire " data-toggle="modal " data-target="#modal_detail_perbaikan " >
<div>
<img src="static/img/icon-1/editpoi.svg" alt="">
</div>
</a>
</div>
</div>
</td>
</tr>`;
data_point.push(data_gab)
};
$("#tbody_list_point").html(data_point)
$('.datatable-show-all.list_user').DataTable({
autoWidth: false,
columnDefs: [{
orderable: false,
width: '20px',
targets: [0],
}, {
orderable: false,
width: '20px',
targets: [5],
}, {
orderable: false,
width: '20px',
targets: [6],
}, ],
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');
}
});
$('.datatable-show-all.list_point').DataTable({
autoWidth: false,
columnDefs: [{
orderable: false,
width: '20px',
targets: [0],
}, {
orderable: false,
width: '20px',
targets: [4],
}, {
orderable: false,
width: '20px',
targets: [5],
}, ],
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');
}
});
}
});
})
</script>
\ No newline at end of file
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