Commit 46d3747e authored by Muhamad's avatar Muhamad

USER PROFILE

parent 6298bfae
...@@ -73,4 +73,5 @@ urlpatterns = [ ...@@ -73,4 +73,5 @@ urlpatterns = [
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)
...@@ -3349,3 +3350,27 @@ def search_lanjut(request): ...@@ -3349,3 +3350,27 @@ def search_lanjut(request):
kills = data_jal kills = data_jal
return Response(kills) 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 = [ ...@@ -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
...@@ -504,6 +504,7 @@ class Dashboard(generic.TemplateView): ...@@ -504,6 +504,7 @@ class Dashboard(generic.TemplateView):
} }
res_all.append(data_all) res_all.append(data_all)
if request.user.is_authenticated:
current_user = request.user current_user = request.user
thisUser = current_user.id thisUser = current_user.id
...@@ -531,7 +532,7 @@ class Dashboard(generic.TemplateView): ...@@ -531,7 +532,7 @@ class Dashboard(generic.TemplateView):
user_data.append(datas) user_data.append(datas)
with conn.cursor() as userlist_: with conn.cursor() as userlist_:
if request.user.is_superuser: if request.user.is_superuser or request.user.is_staff:
# print("is superuser") # print("is superuser")
sql = """ sql = """
SELECT SELECT
...@@ -556,7 +557,6 @@ class Dashboard(generic.TemplateView): ...@@ -556,7 +557,6 @@ class Dashboard(generic.TemplateView):
ORDER BY ORDER BY
au.username ASC""" au.username ASC"""
else: else:
if request.user.is_staff:
sql = """ sql = """
SELECT SELECT
au.id, au.id,
...@@ -579,8 +579,6 @@ class Dashboard(generic.TemplateView): ...@@ -579,8 +579,6 @@ 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:
print('not staff')
userlist_.execute(sql) userlist_.execute(sql)
allUser = userlist_.fetchall() allUser = userlist_.fetchall()
...@@ -598,6 +596,12 @@ class Dashboard(generic.TemplateView): ...@@ -598,6 +596,12 @@ class Dashboard(generic.TemplateView):
} }
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',
'kelurahan':kel_res, 'kelurahan':kel_res,
...@@ -1256,3 +1260,13 @@ def editkelurahan(request): ...@@ -1256,3 +1260,13 @@ def editkelurahan(request):
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) 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 { ...@@ -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