Commit 46d3747e authored by Muhamad's avatar Muhamad

USER PROFILE

parent 6298bfae
...@@ -72,5 +72,6 @@ urlpatterns = [ ...@@ -72,5 +72,6 @@ urlpatterns = [
path('user-data', views.user_data, name='user-data'), path('user-data', views.user_data, name='user-data'),
path('deletejalan', views.deletejalan, name='hapus-jalan'), path('deletejalan', views.deletejalan, name='hapus-jalan'),
path('search_spes', views.search_spes, name='search_spes'), path('search_spes', views.search_spes, name='search_spes'),
path('search_lanjut', views.search_lanjut, name='search_lanjut'), path('search_lanjut', views.search_lanjut, name='search_lanjut'),
path('load_point_id', views.load_point_id)
] ]
\ No newline at end of file
...@@ -2961,47 +2961,47 @@ def user_data(request): ...@@ -2961,47 +2961,47 @@ def user_data(request):
with conn.cursor() as po: with conn.cursor() as po:
po.execute(""" po.execute("""
SELECT id, namobj, alamat, luas_bangunan, perangkat SELECT id, namobj, alamat, luas_bangunan, perangkat ,'geo_kantor_administrasi'
FROM FROM
geo_kantor_administrasi geo_kantor_administrasi
UNION UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_layanan_kesehatan'
FROM FROM
geo_layanan_kesehatan geo_layanan_kesehatan
UNION UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_puskesmas'
FROM FROM
geo_puskesmas geo_puskesmas
UNION UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_rumah_sakit'
FROM FROM
geo_rumah_sakit geo_rumah_sakit
UNION UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_sarana_ibadah'
FROM FROM
geo_sarana_ibadah geo_sarana_ibadah
UNION UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_sarana_pendidikan'
FROM FROM
geo_sarana_pendidikan geo_sarana_pendidikan
UNION UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_spbu'
FROM FROM
geo_spbu geo_spbu
UNION UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_stasiun'
FROM FROM
geo_stasiun geo_stasiun
UNION UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_terminal_bus'
FROM FROM
geo_terminal_bus geo_terminal_bus
UNION UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_cagar_budaya'
FROM FROM
geo_cagar_budaya geo_cagar_budaya
UNION UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_gardu_listrik'
FROM FROM
geo_gardu_listrik geo_gardu_listrik
""") """)
...@@ -3015,7 +3015,8 @@ def user_data(request): ...@@ -3015,7 +3015,8 @@ def user_data(request):
"nama_tempat":p[1], "nama_tempat":p[1],
"alamat":p[2], "alamat":p[2],
"luas":p[3], "luas":p[3],
"pj":p[4] "pj":p[4],
"table":p[5]
} }
point.append(datap) point.append(datap)
...@@ -3348,4 +3349,28 @@ def search_lanjut(request): ...@@ -3348,4 +3349,28 @@ def search_lanjut(request):
data_jal = {'gen':s_jalan} data_jal = {'gen':s_jalan}
kills = data_jal kills = data_jal
return Response(kills) return Response(kills)
\ No newline at end of file
@api_view(('GET',))
def load_point_id(request):
id = request.GET.get('idx')
dtb = request.GET.get('db')
with conn.cursor() as poi:
poi.execute("""
SELECT json_build_object (
'type',
'Feature',
'properties',
(id, namobj, alamat, luas_bangunan, perangkat),
'geometry',
ST_AsGeoJSON ( geom :: geometry ) :: json
)
FROM
%s
WHERE
id = %s
"""%(dtb, id))
poin = poi.fetchall()
context = {'result':poin}
return Response(context)
\ No newline at end of file
...@@ -21,5 +21,6 @@ urlpatterns = [ ...@@ -21,5 +21,6 @@ urlpatterns = [
path('get-jalan-perbaikan', views.getjalanperbaikan, name='get-jalan-perbaikan'), path('get-jalan-perbaikan', views.getjalanperbaikan, name='get-jalan-perbaikan'),
path('get-detail-perbaikan', views.getdetailperbaikan, name='get-detail-perbaikan'), path('get-detail-perbaikan', views.getdetailperbaikan, name='get-detail-perbaikan'),
path('get-detail-perbaikan-bang', views.getdetailperbaikanbangunan, name='get-detail-perbaikan-bang'), path('get-detail-perbaikan-bang', views.getdetailperbaikanbangunan, name='get-detail-perbaikan-bang'),
path('loadPointbyId', views.loadPointbyId)
] ]
\ No newline at end of file
...@@ -503,61 +503,61 @@ class Dashboard(generic.TemplateView): ...@@ -503,61 +503,61 @@ class Dashboard(generic.TemplateView):
'tgl_selesai':j[6], 'tgl_selesai':j[6],
} }
res_all.append(data_all) res_all.append(data_all)
current_user = request.user
thisUser = current_user.id
if thisUser == None: if request.user.is_authenticated:
user_data = {"filepath":'placeholder.jpg'} current_user = request.user
else: 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 = [] if thisUser == None:
for row in us: user_data = {"filepath":'placeholder.jpg'}
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 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: else:
if request.user.is_staff: # print()
sql = """ 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 userlist_:
if request.user.is_superuser or request.user.is_staff:
# 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:
sql = """
SELECT SELECT
au.id, au.id,
au.username, au.username,
...@@ -579,24 +579,28 @@ class Dashboard(generic.TemplateView): ...@@ -579,24 +579,28 @@ class Dashboard(generic.TemplateView):
ag.id = aug.group_id AND ag.id = aug.group_id AND
ORDER BY ORDER BY
au.username ASC""" au.username ASC"""
else: userlist_.execute(sql)
print('not staff') allUser = userlist_.fetchall()
userlist_.execute(sql)
allUser = userlist_.fetchall() user_res = []
for rows in allUser:
user_res = [] datas = {
for rows in allUser: "id": rows[0],
datas = { "username": rows[1],
"id": rows[0], "name": rows[2] +" "+ rows[3],
"username": rows[1], "email": rows[6],
"name": rows[2] +" "+ rows[3], "isactive": rows[4],
"email": rows[6], "last": rows[5],
"isactive": rows[4], "group": rows[7],
"last": rows[5], "filepath": rows[10]
"group": rows[7], }
"filepath": rows[10] user_res.append(datas)
}
user_res.append(datas) else:
user_data = [{"id":"Not Login", "username":"Not Login", "firstname":"Not Login", "lastname":"Not Login","email":"Not Login","filepath":"Not Login"}]
user_res = [{"id":"Not Login", "username":"Not Login", "name":"Not Login", "isactive":"Not Login","email":"Not Login","last":"Not Login", "group":"Not Login", "filepath":"Not Login"}]
context = { context = {
'title':'Dashboard', 'title':'Dashboard',
...@@ -1255,4 +1259,14 @@ def editkelurahan(request): ...@@ -1255,4 +1259,14 @@ def editkelurahan(request):
kab = res_edit_poly[0][0]['administrasi'][3] kab = res_edit_poly[0][0]['administrasi'][3]
prov = res_edit_poly[0][0]['administrasi'][4] prov = res_edit_poly[0][0]['administrasi'][4]
context = {'desa':desa, 'kec':kec, 'kab':kab, 'prov':prov,'result_poly': res_edit_poly[0][0], 'avg_la':avg_la, 'avg_lo':avg_lo} context = {'desa':desa, 'kec':kec, 'kab':kab, 'prov':prov,'result_poly': res_edit_poly[0][0], 'avg_la':avg_la, 'avg_lo':avg_lo}
return Response(context)
@api_view(('GET',))
def loadPointbyId(request):
tab = request.GET.get("db")
id = request.GET.get("idx")
tipe = request.GET.get("type")
print(tab, id, tipe)
context = {'result':'result'}
return Response(context) return Response(context)
\ No newline at end of file
...@@ -759,6 +759,10 @@ li.active>a:after { ...@@ -759,6 +759,10 @@ li.active>a:after {
border-bottom-right-radius: 10px; border-bottom-right-radius: 10px;
} }
#maps_detail_p>div.leaflet-control-container>div.leaflet-top.leaflet-left>div>div {
display: none;
}
@media (max-width: 1025px) { @media (max-width: 1025px) {
.dock { .dock {
position: absolute; position: absolute;
......
This diff is collapsed.
This diff is collapsed.
...@@ -669,6 +669,7 @@ ...@@ -669,6 +669,7 @@
<script> <script>
$("#sel-kec ").change(function() { $("#sel-kec ").change(function() {
$("#list_perbaikan").removeClass("datatable-show-all")
var id_kec = $(this).val() var id_kec = $(this).val()
...@@ -679,6 +680,7 @@ ...@@ -679,6 +680,7 @@
}, },
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
$("#list_perbaikan").addClass("datatable-kecamatan")
var data_all_desa = [] var data_all_desa = []
for (var i = 0; i < data['res_kel'].length; i++) { for (var i = 0; i < data['res_kel'].length; i++) {
var id_k = data['res_kel'][i][0]; var id_k = data['res_kel'][i][0];
...@@ -729,6 +731,43 @@ ...@@ -729,6 +731,43 @@
}; };
$("#tbody_perbaikan").html(data_perbaikan) $("#tbody_perbaikan").html(data_perbaikan)
$('.datatable-kecamatan').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');
}
});
} }
}); });
...@@ -785,6 +824,7 @@ ...@@ -785,6 +824,7 @@
$("#tbody_perbaikan ").html(data_perbaikan) $("#tbody_perbaikan ").html(data_perbaikan)
} }
}); });
......
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</div> </div>
<div style="margin-bottom: 10px;"> <div style="margin-bottom: 10px;">
<a href="#" class="btn btn-default" style="background-color: #ffffff; <!-- <a href="#" class="btn btn-default" style="background-color: #ffffff;
border: 1px solid #dadce0; border: 1px solid #dadce0;
-webkit-border-radius: 100px; -webkit-border-radius: 100px;
border-radius: 100px; border-radius: 100px;
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
padding: 8px 16px; padding: 8px 16px;
text-align: center; text-align: center;
text-decoration: none; text-decoration: none;
text-overflow: ellipsis;" id="pengaturan_btn" data-toggle="modal" data-target="#user_profile" data-backdrop="static" data-keyboard="false">Pengaturan</a> text-overflow: ellipsis;" id="pengaturan_btn" data-toggle="modal" data-target="#user_profile" data-backdrop="static" data-keyboard="false">Pengaturan</a> -->
</div> </div>
</div> </div>
...@@ -270,7 +270,7 @@ ...@@ -270,7 +270,7 @@
<li> <li>
<div style="border-bottom: 0.5px solid #DCDCDC;margin-bottom:10px;"> <div style="border-bottom: 0.5px solid #DCDCDC;margin-bottom:10px;">
<div style="margin-bottom: 10px;"> <div style="margin-bottom: 10px;">
<a href="{% url 'usermanagement' %}" style=" background-color: #ffffff; <a href="#" style=" background-color: #ffffff;
color: #3c4043; color: #3c4043;
display: table; display: table;
font: 500 14px/16px Google Sans,Roboto,RobotoDraft,Helvetica,Arial,sans-serif; font: 500 14px/16px Google Sans,Roboto,RobotoDraft,Helvetica,Arial,sans-serif;
...@@ -279,7 +279,7 @@ ...@@ -279,7 +279,7 @@
padding: 14px 41px; padding: 14px 41px;
text-align: center; text-align: center;
text-decoration: none; text-decoration: none;
width: 100%;"><i class="icon-user"></i>&nbsp;&nbsp;Kelola User</a> width: 100%;" id="pengaturan_btn" data-toggle="modal" data-target="#user_profile" data-backdrop="static" data-keyboard="false"><i class="icon-user"></i>&nbsp;&nbsp;PENGATURAN</a>
</div> </div>
</div> </div>
</li> </li>
......
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