Commit 46d3747e authored by Muhamad's avatar Muhamad

USER PROFILE

parent 6298bfae
......@@ -72,5 +72,6 @@ urlpatterns = [
path('user-data', views.user_data, name='user-data'),
path('deletejalan', views.deletejalan, name='hapus-jalan'),
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):
with conn.cursor() as po:
po.execute("""
SELECT id, namobj, alamat, luas_bangunan, perangkat
SELECT id, namobj, alamat, luas_bangunan, perangkat ,'geo_kantor_administrasi'
FROM
geo_kantor_administrasi
UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat
SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_layanan_kesehatan'
FROM
geo_layanan_kesehatan
UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat
SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_puskesmas'
FROM
geo_puskesmas
UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat
SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_rumah_sakit'
FROM
geo_rumah_sakit
UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat
SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_sarana_ibadah'
FROM
geo_sarana_ibadah
UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat
SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_sarana_pendidikan'
FROM
geo_sarana_pendidikan
UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat
SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_spbu'
FROM
geo_spbu
UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat
SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_stasiun'
FROM
geo_stasiun
UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat
SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_terminal_bus'
FROM
geo_terminal_bus
UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat
SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_cagar_budaya'
FROM
geo_cagar_budaya
UNION
SELECT id, namobj, alamat, luas_bangunan, perangkat
SELECT id, namobj, alamat, luas_bangunan, perangkat, 'geo_gardu_listrik'
FROM
geo_gardu_listrik
""")
......@@ -3015,7 +3015,8 @@ def user_data(request):
"nama_tempat":p[1],
"alamat":p[2],
"luas":p[3],
"pj":p[4]
"pj":p[4],
"table":p[5]
}
point.append(datap)
......@@ -3348,4 +3349,28 @@ def search_lanjut(request):
data_jal = {'gen':s_jalan}
kills = data_jal
return Response(kills)
\ No newline at end of file
return Response(kills)
@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 = [
path('get-jalan-perbaikan', views.getjalanperbaikan, name='get-jalan-perbaikan'),
path('get-detail-perbaikan', views.getdetailperbaikan, name='get-detail-perbaikan'),
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):
'tgl_selesai':j[6],
}
res_all.append(data_all)
current_user = request.user
thisUser = current_user.id
if thisUser == None:
user_data = {"filepath":'placeholder.jpg'}
else:
# print()
sql = "select * from auth_user where id = "+str(thisUser)
with conn.cursor() as userprop:
userprop.execute(sql)
us = userprop.fetchall()
if request.user.is_authenticated:
current_user = request.user
thisUser = current_user.id
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:
# 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"""
if thisUser == None:
user_data = {"filepath":'placeholder.jpg'}
else:
if request.user.is_staff:
sql = """
# 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 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
au.id,
au.username,
......@@ -579,24 +579,28 @@ class Dashboard(generic.TemplateView):
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)
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)
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 = {
'title':'Dashboard',
......@@ -1255,4 +1259,14 @@ def editkelurahan(request):
kab = res_edit_poly[0][0]['administrasi'][3]
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}
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)
\ No newline at end of file
......@@ -759,6 +759,10 @@ li.active>a:after {
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) {
.dock {
position: absolute;
......
This diff is collapsed.
This diff is collapsed.
......@@ -669,6 +669,7 @@
<script>
$("#sel-kec ").change(function() {
$("#list_perbaikan").removeClass("datatable-show-all")
var id_kec = $(this).val()
......@@ -679,6 +680,7 @@
},
dataType: 'json',
success: function(data) {
$("#list_perbaikan").addClass("datatable-kecamatan")
var data_all_desa = []
for (var i = 0; i < data['res_kel'].length; i++) {
var id_k = data['res_kel'][i][0];
......@@ -729,6 +731,43 @@
};
$("#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 @@
$("#tbody_perbaikan ").html(data_perbaikan)
}
});
......
......@@ -246,7 +246,7 @@
</div>
<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;
-webkit-border-radius: 100px;
border-radius: 100px;
......@@ -260,7 +260,7 @@
padding: 8px 16px;
text-align: center;
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>
......@@ -270,7 +270,7 @@
<li>
<div style="border-bottom: 0.5px solid #DCDCDC;margin-bottom:10px;">
<div style="margin-bottom: 10px;">
<a href="{% url 'usermanagement' %}" style=" background-color: #ffffff;
<a href="#" style=" background-color: #ffffff;
color: #3c4043;
display: table;
font: 500 14px/16px Google Sans,Roboto,RobotoDraft,Helvetica,Arial,sans-serif;
......@@ -279,7 +279,7 @@
padding: 14px 41px;
text-align: center;
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>
</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