Commit 23cae4a3 authored by Manggar Mahardhika's avatar Manggar Mahardhika

Merge branch 'master' of http://git.khansia.co.id/Nahrowi/oku-gis

parents 12c741c6 e4f629e3
......@@ -98,6 +98,7 @@ urlpatterns = [
path('reloadpoint', views.reload_point, name='reloadpoint'),
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),
]
\ No newline at end of file
......@@ -4322,4 +4322,42 @@ def reload_point(request):
'kantor_administrasi':kantor_administrasi_result,
}
return (context)
\ No newline at end of file
@api_view(('GET',))
def data_perbaikan(request):
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,
gdl.desa,
gdc.kecamatan
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 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 ) )
""")
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],
'desa':j[7],
'kecamatan':j[8],
}
res_all.append(data_all)
return Response(res_all)
\ No newline at end of file
......@@ -467,49 +467,49 @@ class Dashboard(generic.TemplateView):
# for i in gardu_listrik_res:
# gardu_listrik_result.append(i[0])
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,
gdl.desa,
gdc.kecamatan
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 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 ) )
""")
res_perbaikan = data_per.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,
# gdl.desa,
# gdc.kecamatan
# 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 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 ) )
# """)
# 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],
# 'desa':j[7],
# 'kecamatan':j[8],
# }
# res_all.append(data_all)
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],
'desa':j[7],
'kecamatan':j[8],
}
res_all.append(data_all)
perm_group = []
if request.user.is_authenticated:
current_user = request.user
thisUser = current_user.id
for xx in request.user.get_group_permissions():
perm_group.append(xx.split(".")[1])
if thisUser == None:
user_data = {"filepath":'placeholder.jpg'}
else:
......@@ -620,7 +620,7 @@ class Dashboard(generic.TemplateView):
# 'cagar_budaya':cagar_budaya_result,
# 'gardu_listrik':gardu_listrik_result,
'global':all[0],
'res_all':res_all,
# 'res_all':res_all,
'thisUser' : user_data,
'perm_group' : perm_group
# 'user_res':user_res
......
......@@ -470,10 +470,17 @@ def load_group_edit(request):
}
resgroup.append(datas)
print(datas)
group = Group.objects.get(name=datas['name'])
group_perm = []
for group_p in group.permissions.all():
g = str(group_p).split("| Can ")[1].replace(" ","_")
group_perm.append(g)
data = {
"info" : "success",
"code" : 0,
"data" : datas,
"data" : datas,
"perm_group":group_perm
}
return Response(data)
......
asgiref==3.4.0
autopep8==1.5.7
click==8.0.1
colorama==0.4.4
dj-database-url==0.5.0
Django==3.2.4
django-utils-six==2.0
django-widget-tweaks==1.4.8
djangorestframework==3.12.4
Flask==2.0.1
gunicorn==20.1.0
importlib-metadata==4.8.1
itsdangerous==2.0.1
Jinja2==3.0.1
MarkupSafe==2.0.1
Pillow==8.3.1
psycopg2==2.9.1
pycodestyle==2.7.0
python-decouple==3.4
pytz==2021.1
six==1.16.0
sqlparse==0.4.1
toml==0.10.2
typing==3.7.4.3
typing-extensions==3.10.0.0
Unipath==1.1
Werkzeug==2.0.1
whitenoise==5.2.0
zipp==3.5.0
......@@ -816,6 +816,7 @@ function loadgroupbyid(id) {
isObject.id = id;
$("#idgroup").val(id)
$("input[name='chekbox'][name='chekbox']").attr('checked', false)
$.ajax({
url: "/loadgroup/",
......@@ -831,10 +832,10 @@ function loadgroupbyid(id) {
let response = data;
if (response.code == 0) {
for (i in list_perm) {
console.log()
$("input[name='chekbox'][value=" + list_perm[i] + "]").prop('checked', 'checked')
for (i in data.perm_group) {
$("input[name='chekbox'][value=" + data.perm_group[i] + "]").prop('checked', 'checked')
}
var grup = response.data;
$("#ingroup").val(grup.name);
......@@ -1763,9 +1764,5 @@ $(".send_pesan").click(function() {
document.querySelector("#map-create-all > div.leaflet-control-container > div.leaflet-bottom.leaflet-right > div").html(`Powered by <a href="https://khansia.co.id" target="_blank">Khansia</a> with <a href="https://leafletjs.com" target="_blank">Leaflet</a>`)
document.querySelector("#map-create-all > div.leaflet-control-container > div.leaflet-bottom.leaflet-right > div").css("right", "50px")
\ No newline at end of file
......@@ -1094,14 +1094,6 @@
<div class="tab-pane" id="grouproleuser">
<table class="table table-responsive datatable-show-all table-sm list_group" id="list_group" 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>
<div style="position: absolute;left: 292px;font-size: 10pt;background: #2196F3;border-radius: 10px;">
<a class="btn side-bar-but" id="add_group" style="z-index:9;color:white;">
<div>
......
......@@ -49,7 +49,7 @@ background: none;border-color: transparent;">
</ul>
<ul class="navigation navigation-main navigation-accordion" style="height: 100px;">
<li>
<a href="#" class="side-bar-but" data-toggle="modal" data-target="#modal_help" data-backdrop="static" data-keyboard="false">
<img src="{% static 'img/icon-1/Vectoriconwarning.svg' %}" alt="" style="height: 17.875003814697266px;width: 17.875003814697266px;margin-left: -8px;">
......@@ -61,7 +61,7 @@ background: none;border-color: transparent;">
<img src="{% static 'img/icon-1/Vectoriconlogout.svg' %}" alt="" style="height: 17.875003814697266px;width: 17.875003814697266px;margin-left: -8px;">
</a>
</li>
<!-- <li>
<a href="#" id="btn-hide-all" class="side-bar-but" style="position: absolute;margin-top: 1px; display: none;">
<i class="icon-arrow-left12"></i>
......@@ -514,10 +514,8 @@ background: none;border-color: transparent;">
</div>
<div>
<a class="btn mdlFire " onclick="loaddetailid( '{{all.id_object}}') " 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
<i class="icon-search4 text-muted text-size-base " style="color: white;font-size: 10px; "></i> &nbsp;&nbsp; Detail
</a>
</div>
</li>
......@@ -619,7 +617,7 @@ background: none;border-color: transparent;">
</div>
</div>
<div class="isi_detail_cek ">
<!-- <div class="isi_detail_cek ">
<div>
<div>
<span>Anggaran</span>
......@@ -665,7 +663,7 @@ background: none;border-color: transparent;">
</div>
</div>
</div>
</div> -->
<div class="isi_detail_cek ">
<div>
......@@ -692,7 +690,7 @@ background: none;border-color: transparent;">
</div>
<div style="margin-top: 20px; ">
<div class="row">
<!-- <div class="row">
<div class="col-md-6 ">
<div>
<span>Proposal</span>
......@@ -713,19 +711,9 @@ background: none;border-color: transparent;">
</div>
</div>
</div>
</div> -->
<div class="map_detail_p_jalan">
<span>Ruas yang diperbaiki</span>
<!-- <div class="row">
<div class="col-sm-6">
<a href="#" class="btn" id="download_map" style="position: absolute;z-index:999">download maps</a>
</div>
<div class="col-sm-6">
<a href="#" class="btn" id="preview_map" style="position: absolute;z-index:999">preview</a>
</div>
</div>
<div id="previewImage" style="display: none;"></div> -->
<div class="map_detail_p">
<div id="map_detail_perbaikan" style=" position: relative; height: 220px; width: 90%; border-radius: 5px; ">
</div>
......@@ -750,65 +738,6 @@ background: none;border-color: transparent;">
<script type="text/javascript " src="{% static 'js/plugins/forms/selects/select2.min.js' %} "></script>
<script>
$(document).ready(function() {
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>Type</th>
<th>Tanggal Mulai</th>
<th>Tanggal Selesai</th>
<th>Anggaran</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;'
}
},
});
} 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
//});
}
});
//tes
$("#sel-kec ").change(function() {
var id_kec = $(this).val()
......@@ -817,9 +746,9 @@ background: none;border-color: transparent;">
// $(".datatable-show-all.list_perb").dataTable().fnDestroy();
// $("#list_perbaikan").dataTable().fnDestroy();
$(".datatab").dataTable().fnDestroy()
// $("#dataperb").css('display', 'none')
// $(".datatab").css('display', 'none')
// $(".datatable-show-all.list_perb").html('kosong')
// $("#dataperb").css('display', 'none')
// $(".datatab").css('display', 'none')
// $(".datatable-show-all.list_perb").html('kosong')
$.ajax({
url: "api/filt_perbaikan_kecamatan",
......@@ -844,10 +773,10 @@ background: none;border-color: transparent;">
$('#sel-desa').html(`<option>Pilih Desa</option>` + data_all_desa);
}
var data_perbaikan = []
var number = 0;
for (var i = 0; i < data['res_perbaikan'].length; i++) {
number += 1;
......@@ -868,7 +797,6 @@ background: none;border-color: transparent;">
<td>` + type + `</td>
<td>` + tgl_perbaikan + `</td>
<td>` + tgl_selesai + `</td>
<td>` + anggaran + `</td>
<td class="text-center ">
<a class="btn mdlFire " onclick="loaddetailid( '` + id_object + `') " 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; ">
......@@ -880,7 +808,7 @@ background: none;border-color: transparent;">
</a>
</td>
</tr>`;
// var data_gab = `<li class="media panel panel-body stack-media-on-mobile" style="background: transparent;border: none;color: white;">
// <div>
// ` + number + `
......@@ -910,7 +838,7 @@ background: none;border-color: transparent;">
// &nbsp;&nbsp;
// Detail
// </span>
// </a>
// </div>
// </li>`;
......@@ -968,7 +896,6 @@ background: none;border-color: transparent;">
<td>` + type + `</td>
<td>` + tgl_perbaikan + `</td>
<td>` + tgl_selesai + `</td>
<td>` + anggaran + `</td>
<td class="text-center ">
<a class="btn mdlFire " onclick="loaddetailid( '` + id_object + `') " 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; ">
......@@ -980,7 +907,7 @@ background: none;border-color: transparent;">
</a>
</td>
</tr>`;
// var data_gab = `<li class="media panel panel-body stack-media-on-mobile" style="background: transparent;border: none;color: white;">
// <div>
// ` + number + `
......@@ -1010,7 +937,7 @@ background: none;border-color: transparent;">
// &nbsp;&nbsp;
// Detail
// </span>
// </a>
// </div>
// </li>`;
......@@ -1070,15 +997,15 @@ background: none;border-color: transparent;">
});
}
$("#perbaikan_manage").click(function() {
// $(".datatable-show-all.list_perb").dataTable().fnDestroy();
$(".datatab").dataTable().fnDestroy();
setTimeout(function() {
datatatata()
}, 100);
})
// $("#perbaikan_manage").click(function() {
// // $(".datatable-show-all.list_perb").dataTable().fnDestroy();
// $(".datatab").dataTable().fnDestroy();
// setTimeout(function() {
// datatatata()
// }, 100);
//
//
// })
function loaddetailid(id) {
$(".map_detail_p").html(``)
......@@ -1118,48 +1045,48 @@ background: none;border-color: transparent;">
$(".nama_detail").text("Null");
$(".type_detail ").html("Null");
$(".tanggal_perbaikan_detail ").html("Null")
$(".anggaran_detail ").html("Null")
$(".penanggung_jawab_detail ").html("Null")
$(".penanggung_jawab_lapangan_detail ").html("Null")
$(".kontraktor_detail ").html("Null")
// $(".anggaran_detail ").html("Null")
// $(".penanggung_jawab_detail ").html("Null")
// $(".penanggung_jawab_lapangan_detail ").html("Null")
// $(".kontraktor_detail ").html("Null")
$(".panjang_jalan_detail ").html("Null")
$(".lebar_jalan_detail ").html("Null")
$(".proposal_detail ").html(`
<a href="static/media/proposal/null" id="downloadproposal">
<img src="{% static 'img/icon-1/proposal.svg' %} " alt=" " style="height: 80px;width: 80px; ">
</a>`);
$(".bukti_detail_perbaikan").html(`
<a href="static/media/bukti_penyelesaian/null" onclick="viewBukti() " id="view-bukti ">
<img src="{% static 'img/icon-1/bukti.svg' %} " alt=" " style="height: 70px;
width: 50px;">
</a>`);
//$(".proposal_detail ").html(`
// <a href="static/media/proposal/null" id="downloadproposal">
// <img src="{% static 'img/icon-1/proposal.svg' %} " alt=" " style="height: 80px;width: 80px; ">
// </a>`);
//
//
//$(".bukti_detail_perbaikan").html(`
// <a href="static/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 {
console.log(data[0]['jenis'])
if (data[0]['jenis'] == 'jalan'){
if (data[0]['jenis'] == 'jalan') {
$(".nama_detail").html(data[0]['name']);
$(".type_detail ").html(data[0]['type'])
$(".tanggal_perbaikan_detail ").text(data[0]['tgl_perbaikan'])
$(".anggaran_detail ").html(data[0]['anggaran'])
$(".penanggung_jawab_detail ").html(data[0]['pj'])
$(".penanggung_jawab_lapangan_detail ").html(data[0]['pj_lapangan'])
$(".kontraktor_detail ").html(data[0]['kontraktor'])
//$(".anggaran_detail ").html(data[0]['anggaran'])
//$(".penanggung_jawab_detail ").html(data[0]['pj'])
//$(".penanggung_jawab_lapangan_detail ").html(data[0]['pj_lapangan'])
//$(".kontraktor_detail ").html(data[0]['kontraktor'])
$(".panjang_jalan_detail ").html(data[0]['panjang'])
$(".lebar_jalan_detail ").html(data[0]['lbr_jln_reno'])
$(".proposal_detail ").html(`
<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(`
<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>`);
//$(".proposal_detail ").html(`
// <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(`
// <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()
$('.map_detail_p_jalan').show()
......@@ -1177,29 +1104,29 @@ background: none;border-color: transparent;">
};
}
}).addTo(map_detail_perbaikan);
} else if (data[0]['jenis'] == 'bangunan'){
} else if (data[0]['jenis'] == 'bangunan') {
$(".nama_detail").html(data[0]['name']);
$(".type_detail ").html(data[0]['type'])
$(".tanggal_perbaikan_detail ").text(data[0]['tgl_perbaikan'])
$(".anggaran_detail ").html(data[0]['anggaran'])
$(".penanggung_jawab_detail ").html(data[0]['pj'])
$(".penanggung_jawab_lapangan_detail ").html(data[0]['pj_lapangan'])
$(".kontraktor_detail ").html(data[0]['kontraktor'])
$(".proposal_detail ").html(`
<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>`);
// $(".anggaran_detail ").html(data[0]['anggaran'])
// $(".penanggung_jawab_detail ").html(data[0]['pj'])
// $(".penanggung_jawab_lapangan_detail ").html(data[0]['pj_lapangan'])
// $(".kontraktor_detail ").html(data[0]['kontraktor'])
//$(".proposal_detail ").html(`
// <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>`);
$(".judul_panjang_jalan_detail ").html('Jenis Perbaikan')
$(".panjang_jalan_detail ").html(data[0]['jenis_perbaikan'])
$('.isi_detail_cek_jalan').hide()
$('.map_detail_p_jalan').hide()
$(".bukti_detail_perbaikan").html(`
<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>`);
//$(".bukti_detail_perbaikan").html(`
// <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>`);
}
}
}
......@@ -1510,7 +1437,7 @@ background: none;border-color: transparent;">
// cb100()
// gl100()
// }
// gas_poin()
function destroymodper() {
......@@ -1560,9 +1487,6 @@ background: none;border-color: transparent;">
<div>
` + tgl_selesai + `
</div>
<div>
` + anggaran + `
</div>
<div>
<a class="btn mdlFire " onclick="loaddetailid( '` + id_object + `') " data-toggle="modal" data-target="#modal_detail_perbaikan" style="background-color: #5A9AFB;color: white;border-radius: 5px;height: 25px; ">
<span>
......@@ -1582,4 +1506,148 @@ background: none;border-color: transparent;">
});
});
$("#perbaikan_manage").on("click", function() {
$.ajax({
url: "api/dataperbaikan",
dataType: 'json',
type: 'get',
success: function(data) {
console.log(data)
var data_per = []
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-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>Type</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
//});
}
}
})
})
</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