Commit 19bec183 authored by Muhamad's avatar Muhamad

upgrade .js scripts_js_m scripts_js_o scripts_layout, dll

parent 12b4d15f
......@@ -7,7 +7,7 @@ from django.contrib.auth.decorators import login_required
app_name = 'api'
urlpatterns = [
path('search_auto', views.search_auto, name='search'),
path('search_auto', views.search_auto),
path('kantor_administrasi', views.kantor_administrasi, name='kantor_administrasi'),
path('layanan_kesehatan', views.layanan_kesehatan, name='layanan_kesehatan'),
......@@ -30,7 +30,7 @@ urlpatterns = [
path('edit', views.editpoly, name='edit'),
path('validatedit', views.validatedit, name='validatedit'),
path('hapus', views.hapus, name='hapus'),
path('hasilsearch', views.hasilsearch, name='ressearch'),
path('ressearch', views.hasilsearch, name='ressearch'),
path('editkependudukan/', views.editkependudukan, name='kependudukan'),
......@@ -83,13 +83,12 @@ urlpatterns = [
path('3d-maps', views.maps3d, name='3d-maps'),
path('deletejalan', views.deletejalan, name='hapus-jalan'),
path('hapus-jalan', 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'),
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('load_point_id', views.load_point_id),
......
......@@ -16,9 +16,9 @@ class Dashboard(generic.TemplateView):
# @method_decorator(login_required(login_url='/login/'))
def get(self, request):
# print(Group.objects.get(user=request.user))
# with conn.cursor() as all_:
# all_.execute("SELECT * from global_oku")
# all = all_.fetchall()
with conn.cursor() as all_:
all_.execute("SELECT * from global_oku")
all = all_.fetchall()
# with conn.cursor() as kel:
# kel.execute("SELECT json_build_object('type', 'Feature', 'administrasi', (kode_desa, desa, kecamatan, kab_kota, provinsi, jumlah_pen, jumlah_kk, luas_desa, gambar),'penduduk', (pria, wanita, belum_kawin, kawin, cerai_hidup, cerai_mati, wajib_ktp, islam, kristen, khatolik, hindu, budha, konghucu, kepercayaan_lain, u0, u5, u10, u15, u20, u25, u30, u35, u40, u45, u50, u55, u60, u65, u70, u75),'pekerjaan_pendidikan', (tidak_sekolah, belum_tamat, tamat_sd, sltp, slta, diploma_i, diploma_ii, diploma_iv, strata_ii, strata_iii, tidak_bekerja, aparatur_pemerintah, tenaga_pendidik, wiraswasta, pertanian, tenaga_kesehatan, pensiunan, pegawai, tentara, kepolisian, pedagang, petani, peternak, nelayan, karyawan, buruh, pembantu, tukang, pendeta, pastor, ustadz, dosen, guru, pilot, pengacara, notaris, arsitek, akuntan, konsultan, dokter, bidan, perawat, psikiater, sopir, lainnya), 'poi',(jml_puskesma, jml_sekolah, jml_sarib),'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_data_kelurahan")
......@@ -502,105 +502,105 @@ class Dashboard(generic.TemplateView):
# }
# res_all.append(data_all)
# perm_group = []
# if request.user.is_authenticated:
# current_user = request.user
# thisUser = current_user.id
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])
for xx in request.user.get_group_permissions():
perm_group.append(xx.split(".")[1])
# 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 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()
# 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 = []
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)
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,
# 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"""
# userlist_.execute(sql)
# allUser = userlist_.fetchall()
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,
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"""
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)
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"}]
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"}]
......@@ -619,11 +619,11 @@ class Dashboard(generic.TemplateView):
# 'terminal':terminal_result,
# 'cagar_budaya':cagar_budaya_result,
# 'gardu_listrik':gardu_listrik_result,
# 'global':all[0],
'global':all[0],
# 'res_all':res_all,
# 'thisUser' : user_data,
# 'perm_group' : perm_group
# 'user_res':user_res
'thisUser' : user_data,
'perm_group' : perm_group,
'user_res':user_res
}
return render (request, self.template_name, context)
......
......@@ -1340,7 +1340,7 @@ function l_kes() {
if (checkBox.checked == true) {
// loaderPage(true);
$.ajax({
url: "api/layanan_kesehatan'%}",
url: "api/layanan_kesehatan",
dataType: 'json',
type: 'GET',
success: function(response) {
......@@ -1790,7 +1790,7 @@ function pks() {
if (checkBox.checked == true) {
// loaderPage(true);
$.ajax({
url: "api/apiviewpuskesmas'%}",
url: "api/apiviewpuskesmas",
dataType: 'json',
type: 'GET',
success: function(response) {
......@@ -2225,7 +2225,7 @@ function rs() {
if (checkBox.checked == true) {
// loaderPage(true);
$.ajax({
url: "api/rumah_sakit'%}",
url: "api/rumah_sakit",
dataType: 'json',
type: 'GET',
success: function(response) {
......@@ -2781,7 +2781,7 @@ function fiksi() {
if (checkBox.checked == true) {
// loaderPage(true);
$.ajax({
url: "api/sarana_ibadah'%}",
url: "api/sarana_ibadah",
dataType: 'json',
type: 'GET',
success: function(response) {
......@@ -3319,7 +3319,7 @@ function didik() {
if (checkBox.checked == true) {
// loaderPage(true);
$.ajax({
url: "api/sarana_pendidikan'%}",
url: "api/sarana_pendidikan",
dataType: 'json',
type: 'GET',
success: function(response) {
......@@ -5710,15 +5710,24 @@ function swiftAlert(itype, ititle, itext) {
// var map_cesium = new Cesium.Viewer('map-cesium');
function mapsganti() {
// $.getScript('/static/Cesium-185/Build/Cesium/Cesium.js', function() {
// });
// $.getScript('/static/Cesium-185/Build/Cesium/Cesium.js');
var checkBox_3d = document.getElementById("mapschange");
$('#scrcesium').append('<script id="scrheadcesium" src="/static/Cesium-185/Build/Cesium/Cesium.js"><\/script>');
var map_cesium = new Cesium.Viewer('map-cesium', {
imageryProvider: new Cesium.BingMapsImageryProvider({
url: '//dev.virtualearth.net',
key: 'Anj9XBZaRShAMdbXJlZ16iqEVpjikY1eY_dzqGl451WYkSKV3l_FJaFgMbhwdbLz',
mapStyle: Cesium.BingMapsStyle.AERIAL
//url : '//services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer',
//url : Cesium.buildModuleUrl('/static/Cesium-185/Build/Cesium/Assets/Textures/NaturalEarthII')
}),
baseLayerPicker: false,
geocoder: false
});
if (checkBox_3d.checked == true) {
$("#modalsearch3d").modal()
$.ajax({
url: "api/search",
url: "api/search_auto",
data: {
'namadesa': 'search'
},
......
......@@ -857,6 +857,9 @@ function batasdesa() {
var checkBox = document.getElementById("batas_desa");
if (checkBox.checked == true) {
// loaderPage(true);
$('#scrapex').append(`<script id="idscrapexmin" type="text/javascript " src="static/js/apexcharts.min.js"><\/script>`);
$('#scrapex').append(`<script id="idscrapex" type="text/javascript " src="static/js/apexcharts.js"><\/script>`);
if (map.hasLayer(geo_batas_kel)) {
geo_batas_kel.clearLayers()
geo_batas_kel.remove()
......
......@@ -374,14 +374,16 @@
<!-- <script type="text/javascript" src="{% static 'js/pages/form_checkboxes_radios.js' %}"></script> -->
<!-- <script type="text/javascript " src="{% static 'js/apexcharts.min.js' %}"></script>
<script type="text/javascript " src="{% static 'js/apexcharts.js' %}"></script> -->
<script type="text/javascript " src="{% static 'js/plugins/tables/datatables/datatables.min.js' %} "></script>
<script type="text/javascript " src="{% static 'js/plugins/forms/selects/select2.min.js' %} "></script>
<!-- <script type="text/javascript" src="{% static 'js/plugins/media/cropper.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/pages/extension_image_cropper.js' %}"></script> -->
<!-- /theme JS files -->
<div id ='scrapex'></div>
<div id ='scrcesium'></div>
<div id='scrapex'></div>
<div id='scrcesium'></div>
<!-- <script type="text/javascript " src="{% static 'js/plugins/tables/datatables/datatables.min.js' %} "></script> -->
<script type="text/javascript " src="{% static 'js/plugins/forms/selects/select2.min.js' %} "></script>
......@@ -390,15 +392,23 @@
<script type="text/javascript" src="{% static 'js/maps.js' %}"></script>
<script src="{% static 'js/scripts.js' %}"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
{% include 'includes/permission.html' %} {% include 'includes/js-o.html' %} {% include 'includes/js-m.html' %}
{% include 'includes/permission.html' %}
<script type="text/javascript" src="{% static 'js/action.js' %}"></script>
<script src="{% static 'js/scripts_js_o.js' %}"></script>
<script src="{% static 'js/scripts_js_m.js' %}"></script>
<script src="{% static 'js/action.js' %}"></script>
<script src="{% static 'js/scripts_sidebar.js' %}"></script>
<script>
// start disabled inspect
// document.addEventListener('contextmenu', function(e) {
// e.preventDefault();
// });
// document.onkeydown = function(e) {
// if(event.keyCode == 123) {
// return false;
......@@ -416,11 +426,11 @@
// return false;
// }
// }
// end disabled inspect
var dar = null;
$('#search_spes li a').on('click', function() {
$('#input_search').val(null)
......@@ -436,12 +446,12 @@
$("#pilihcari").html('')
}
});
var res_in = null;
var res_id = null;
$('#input_search').on('input', function() {
var inp = $('#input_search').val()
$.ajax({
url: "{% url 'api:search_spes' %}",
data: {
......@@ -450,7 +460,7 @@
},
dataType: 'json',
success: function(data) {
var availableTags = []
for (let i = 0; i < data.result.length; i++) {
var tt = null;
......@@ -462,15 +472,15 @@
tt = data.result[i][1];
mm = [data.result[i][0], data.result[i][2]];
}
var source = {
label: tt,
id: mm
}
availableTags.push(source)
}
$("#input_search").autocomplete({
source: availableTags,
select: function(event, ui) {
......@@ -485,15 +495,15 @@
}
});
});
$(document).on("click", "#btn_search_spes", function() {
nama = null;
idm = null;
rem = null;
geo = null;
db = null;
if (dar == ' Point') {
nama = res_in;
idm = res_id[0];
......@@ -516,7 +526,7 @@
// map.setView([data[0]['geometry']['coordinates'][0][0][0][1], data[0]['geometry']['coordinates'][0][0][0][0]], 19);
// var result_point = JSON.parse("" + data + "")
// console.log(result_point)
var geo_point = L.geoJson(null, {
pointToLayer: function(feature, latlng) {
// var smallIcon = new L.Icon({
......@@ -568,14 +578,14 @@
if (feature.administrasi.f3 == 'alamat') {
if (tay != '') {
var alamak = tay;
} else {
alamak = ""
}
} else {
var alamak = feature.administrasi.f3;
}
if (feature.administrasi.f10 == 'bpk') {
var raja = "";
......@@ -699,9 +709,9 @@
} else {
var gmb = "static/img/image/" + feature.administrasi.f8;
}
$(".gambar_keterangan").html(`<img src="` + gmb + `" alt="" style="width:100%;height:240px;border-top-left-radius: 10px;border-bottom-left-radius: 10px;">`)
$(".nama_keterangan").html(`<div>
<span style="font-size: large;">
` + feature.administrasi.f1 + `
......@@ -715,7 +725,7 @@
</div>
`)
$(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
<input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
<div>
......@@ -745,7 +755,7 @@
<span>` + raja + `</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;">
<a href="#" id="btn_edit_point" 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>
</div>
......@@ -758,22 +768,22 @@
})
}
});
function geo_json_point(data) {
geo_point.addData(data)
}
geo_json_point(data[0])
geo_point.addTo(map);
map.setView([data[0][0]['geometry']['coordinates'][1], data[0][0]['geometry']['coordinates'][0]], 19);
$(document).on("click", "#btn_search_spes", function() {
geo_point.clearLayers()
geo_point.remove()
});
$('#search_spes li a').on('click', function() {
$('#input_search').val(null)
tes = $(this).text();
......@@ -783,7 +793,7 @@
geo_point.remove();
}
});
// $.ajax({
// url: "{% url 'api:search_lanjut' %}",
// data: {
......@@ -794,25 +804,25 @@
// dataType: 'json',
// success: function(data) {
// console.log(data)
// dapoin = [data[0][0]['geometry']['coordinates'][1], data[0][0]['geometry']['coordinates'][0]]
// // var poinin = L.marker(dapoin).addTo(map)
// geo_json_point(dapoin)
// }
// });
$(document).on("click", "#btn_edit_point", function() {
var map_edit = L.map('map-for-edit', {
editable: true,
zoomControl: false,
drawControl: true
}).setView([-2, 118], 5);
mapss = L.tileLayer('https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
maxZoom: 22,
minZoom: 4,
}).addTo(map_edit);
var idspo = idm
var dbspo = db
loaderPage(false);
......@@ -840,7 +850,7 @@
}
})
});
$(document).on("click", "#saveeditspo", function() {
var idspo = $('#idpo').val();
var poi = $('#coordinateZoneeditpo').val();
......@@ -891,17 +901,17 @@
//location.reload()
}
})
});
}
});
} else if (dar == ' Bangunan') {
nama = res_in;
idm = res_id[0];
geo = res_id[1];
$.ajax({
url: "{% url 'api:search_lanjut' %}",
data: {
......@@ -913,7 +923,7 @@
var geocodeService = L.esri.Geocoding.geocodeService();
var geocoderNominatim = new L.Control.Geocoder.Nominatim();
// map.setView([data[0]['geometry']['coordinates'][0][0][0][1], data[0]['geometry']['coordinates'][0][0][0][0]], 19);
var geo_bangunan = L.geoJson(null, {
style: function(feature) {
return {
......@@ -925,32 +935,32 @@
geo_bangunan.clearLayers();
geo_bangunan.remove();
},
onEachFeature: function(feature, layer) {
// gasin()
if (feature.properties) {
var lattitud, longitud;
if (feature.geometry.type == 'MultiPolygon') {
lattitud = feature.geometry.coordinates[0][0][0][1];
longitud = feature.geometry.coordinates[0][0][0][0];
} else {
lattitud = feature.geometry.coordinates[0][0][1];
longitud = feature.geometry.coordinates[0][0][0];
};
layer.on({
click: function(e) {
$("#modal_detail_non_kelurahan").modal('show');
var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
if (result.address.Address != '') {
var alamat = result.address.Address + `, `
} else {
var alamat = ''
};
if (feature.administrasi.f9 == 'None') {
var path_img = "static/img/image_null.jpg"
} else {
......@@ -978,8 +988,8 @@
// <option value="cagar_budaya">Cagar Budaya dan Tempat Wisata</option>
// <option value="gardu_listrik">Gardu Listrik</option>`
// }
content_edit = `
<div class="modal-dialog" style="width: max-content;height: max-content;">
<div class="modal-content">
......@@ -1275,7 +1285,7 @@
</div>`;
list_history_panel += data_history
};
history = `
<div>
<div style="margin-top: 150px;">
......@@ -1321,7 +1331,7 @@
} else {
history = ``
}
content = `
<table class="table tasks-list">
<thead style="text-align: center;">
......@@ -1421,7 +1431,7 @@
</div>
`)
$(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
<input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
<div class="col-md-6">
......@@ -1471,7 +1481,7 @@
</div>
` + history + `
`);
$(".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>
</div>
......@@ -1490,7 +1500,7 @@
panel_samp()
}
});
pool.push({
name: feature.properties.f2,
id: L.stamp(layer),
......@@ -1505,7 +1515,7 @@
weight: 1,
Color: "#067800",
fillColor: "#067800",
});
if (!L.Browser.ie && !L.Browser.opera) {
layer.bringToFront();
......@@ -1517,19 +1527,19 @@
});
}
});
function geo_json_bangunan(data) {
geo_bangunan.addData(data)
}
// map.on("movestart", function() {
// geo_bangunan.clearLayers();
// });
$(document).on("click", "#btn_search_spes", function() {
geo_bangunan.clearLayers()
geo_bangunan.remove()
});
$('#search_spes li a').on('click', function() {
$('#input_search').val(null)
tes = $(this).text();
......@@ -1539,7 +1549,7 @@
geo_bangunan.remove();
}
});
// geo_bangunan.clearLayers();
// geo_bangunan.remove();
$.ajax({
......@@ -1566,19 +1576,19 @@
}
});
map.setView([data['gen'][0][0]['geometry']['coordinates'][0][0][0][1], data['gen'][0][0]['geometry']['coordinates'][0][0][0][0]], 19);
geo_bangunan.addTo(map);
$(document).on("click", "#btn_edit_bangunan", function() {
$("#modal_bangunan_edit").css('display', 'block');
var tipe1 = $('#tipe111').val();
$('#tipe_point_b_e option[value=' + tipe1 + ']').attr('selected', 'selected');
$("#tipe_point_b_e").change(function() {
$('#tipe_point_2_b_e').empty();
$('#tipe_point_3_b_e').empty();
var tipe = $(this).val();
$.ajax({
url: "{% url 'api:change-tipe' %}",
data: {
......@@ -1586,11 +1596,11 @@
},
dataType: 'json',
success: function(data) {
var data_all_kab = []
for (var i = 0; i < data['result'].length; i++) {
var data_k = data['result'][i][0];
// if (feature.administrasi.f12 == data_k){
// var data_kab = `<option value="` + data_k + `" selected>` + data_k + `</option>`;
// } else{
......@@ -1603,19 +1613,19 @@
}
});
});
var tipe2 = $('#tipe222').val();
if (tipe2 == 'null') {
$('#tipe_point_2_b_e').html(`<option value="null" selected disabled>-- Pilih Tipe Point --</option>`);
} else {
$('#tipe_point_2_b_e').html(`<option value="` + tipe2 + `" selected>` + tipe2 + `</option>`);
}
$("#tipe_point_2_b_e").change(function() {
$('#tipe_point_3_b_e').empty();
var jenis = $(this).val();
var tipx = $("#tipe_point_b_e").val();
$.ajax({
url: "{% url 'api:change-jenis' %}",
data: {
......@@ -1635,27 +1645,27 @@
}
});
});
var tipe3 = $('#tipe333').val();
var tipe4 = $('#tipe444').val();
if (tipe3 == 'null') {
$('#tipe_point_3_b_e').html(`<option value="null" selected disabled>-- Pilih Point --</option>`);
} else {
$('#tipe_point_3_b_e').html(`<option value="` + tipe3 + `" selected>` + tipe4 + `</option>`);
}
var map_edit = new L.map('map-edit', {
editable: true,
zoomControl: false,
drawControl: true
}).setView([-2, 118], 5);
mapss = L.tileLayer('https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
maxZoom: 22,
minZoom: 4,
}).addTo(map_edit);
var polylyly = L.polygon([
[-4.1283969, 104.1674575],
[-4.128396, 104.1674947],
......@@ -1663,14 +1673,14 @@
[-4.1284674, 104.1674593],
[-4.1283969, 104.1674575]
]).addTo(map_edit)
if (map_edit.hasLayer(polylyly)) {
polylyly.remove()
}
var id_poly = $('#idbangunan').val();
loaderPage(true);
$.ajax({
url: "{% url 'api:edit' %}",
data: {
......@@ -1678,14 +1688,14 @@
},
dataType: 'json',
success: function(data) {
setTimeout(function() {
map_edit.invalidateSize();
}, 1000);
loaderPage(false);
map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
let lop_poly_edit = data['geometry']['coordinates'][0][0];
let list_poly_edit = [];
for (var i = 0; i < lop_poly_edit.length; i++) {
......@@ -1693,7 +1703,7 @@
polygigi = [lop_poly_edit[i][1], lop_poly_edit[i][0]]
list_poly_edit.push(polygigi);
};
polylyly = L.polygon(list_poly_edit).addTo(map_edit)
polylyly.enableEdit();
var hasil = (JSON.stringify(polylyly.toGeoJSON()))
......@@ -1705,17 +1715,17 @@
}
})
});
$(document).on("click", "#btnsavebangunan", function() {
var data = new FormData();
data.append("file", $("input[id^='imgbangunan']")[0].files[0]);
data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
data.append('name_b', $('#namebangunan').val())
data.append('polygon', $('#coordinatebangunan').val())
var polyg = $("#coordinatebangunan").val();
data.append('info_b', $('#infobangunan').val())
data.append('desa_b', $('#nmkelurahan').val())
data.append('kec_b', $('#nmkecamatan').val())
......@@ -1723,7 +1733,7 @@
data.append('pro_b', $('#nmprovinsi').val())
data.append('id_poly', $('#idbangunan').val())
data.append('gambar', $('#gambar').val())
data.append('tipedbbe', $('#tipe_point_b_e').val())
data.append('remarkbe', $('#tipe_point_2_b_e').val())
data.append('poinbe', $('#tipe_point_3_b_e').val())
......@@ -1731,12 +1741,12 @@
var poin_id = $('#tipe_point_3_b_e').val();
var napo = $("#tipe_point_3_b_e option:selected").text();
data.append('napo', $('#tipe_point_3_b_e option:selected').text())
data.append('luasbangunan_b', $('#luasbangunan').val())
data.append('luastanah_b', $('#luastanah').val())
data.append('tinggibangunan_b', $('#tinggibangunan').val())
data.append('pemilik_b', $('#pemilik').val())
$.ajax({
url: "{% url 'api:validatedit' %}",
data: data,
......@@ -1764,13 +1774,13 @@
icon: "error",
confirmButtonColor: "#00BCD4"
})
}
}
})
});
$(document).on("click", "#btn_delete_bangunan", function() {
$("#modal_bangunan_delete").css('display', 'block');
var map_delete = new L.map('map-delete', {
......@@ -1778,16 +1788,16 @@
zoomControl: false,
drawControl: true
}).setView([-2, 118], 5);
mapss = L.tileLayer('https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
maxZoom: 22,
minZoom: 4,
}).addTo(map_delete);
var id_polyhps = $('#idbangunanhps').val();
// console.log(id_polyhps)
loaderPage(true);
$.ajax({
url: "{% url 'api:edit' %}",
data: {
......@@ -1795,14 +1805,14 @@
},
dataType: 'json',
success: function(data) {
setTimeout(function() {
map_delete.invalidateSize();
}, 1000);
loaderPage(false);
map_delete.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
let lop_poly_edit = data['geometry']['coordinates'][0][0];
let list_poly_edit = [];
for (var i = 0; i < lop_poly_edit.length; i++) {
......@@ -1810,7 +1820,7 @@
polygigi = [lop_poly_edit[i][1], lop_poly_edit[i][0]]
list_poly_edit.push(polygigi);
};
var polyly = L.polygon(list_poly_edit).addTo(map_delete)
$('#btnsavedeletebangunan').click(function() {
var hasil = (JSON.stringify(polyly.toGeoJSON()))
......@@ -1819,12 +1829,12 @@
}
})
});
$(document).on("click", "#btnsavedeletebangunan", function() {
var data = new FormData();
data.append('id_poly', $('#idbangunan').val())
$.ajax({
url: "{% url 'api:hapus' %}",
data: data,
......@@ -1855,9 +1865,9 @@
}
}
})
});
$(document).on("click", "#btn_perbaikan_bangunan", function() {
// $("#input_perbaikan_bang-s").css("display", "block");
var map_bang = new L.map('map-insert-renov-bang-s', {
......@@ -1865,20 +1875,20 @@
zoomControl: false,
drawControl: true
}).setView([-2, 118], 5);
mapssx = L.tileLayer('https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
maxZoom: 22,
minZoom: 4,
}).addTo(map_bang);
// if (map_bang.hasLayer(polyxxx)) {
// polyxxx.remove()
// }
var id_polyx = $('#id_bang_perbaikan').val();
loaderPage(true);
$.ajax({
url: "{% url 'apps:input-perbaikan-bang' %}",
data: {
......@@ -1886,25 +1896,25 @@
},
dataType: 'json',
success: function(data) {
setTimeout(function() {
map_bang.invalidateSize();
}, 1000);
loaderPage(false);
$("#nama_bang").val(data[0]);
$("#type_bang").val(data[4]);
$("#id_bang_perbaikan").val(data[3]);
$("#type_id_bang").val("1");
$("#kelurahan_bang").val(data[5]);
$("#kecamatan_bang").val(data[6]);
var latlngs = data[2];
var lattitud, longitud;
map_bang.setView([data[2]['geometry']['coordinates'][0][0][0][1], data[2]['geometry']['coordinates'][0][0][0][0]], 19);
let lop_poly_edit = data[2]['geometry']['coordinates'][0][0];
let list_poly_edit = [];
for (var i = 0; i < lop_poly_edit.length; i++) {
......@@ -1912,7 +1922,7 @@
polygigi = [lop_poly_edit[i][1], lop_poly_edit[i][0]]
list_poly_edit.push(polygigi);
};
polylyly = L.polygon(list_poly_edit).addTo(map_bang)
polylyly.enableEdit();
var hasil = (JSON.stringify(polylyly.toGeoJSON()))
......@@ -1922,7 +1932,7 @@
}
})
});
$(document).on("click", "#save-perbaikan_bang", function(e) {
var polyginbang = $('#coorbangbaru').val();
var type_id = $("#type_id").val();
......@@ -1935,14 +1945,14 @@
var anggaran = $("#anggaran_bang").val();
var proposal = $("#proposal_bang").val();
var bukti_selesai = $("#buktiselesai_bang").val();
var pj = $("#pihakpengesahan_bang").val();
var pj_lapangan = $("#pjlapangan_bang").val();
var kontraktor = $("#kontraktor_bang").val();
var jenis_perbaikan = $("#jenisperbaikan_bang").val();
var kelurahan = $("#kelurahan_bang").val();
var kecamatan = $("#kecamatan_bang").val();
var data_umum = [{
'coordbang': polyginbang
}, {
......@@ -1974,7 +1984,7 @@
}, {
'kecamatanbang': kecamatan
}]
data = new FormData()
data.append("proposal_bang", $("input[id^='proposal_bang']")[0].files[0]);
data.append("bukti_selesai_bang", $("input[id^='buktiselesai_bang']")[0].files[0]);
......@@ -1982,7 +1992,7 @@
var keyss = Object.keys(data_umum[i]);
data.append(keyss[0], data_umum[i][keyss[0]])
}
$.ajax({
url: "{% url 'apps:save-perbaikan-bang' %}",
data: data,
......@@ -1992,7 +2002,7 @@
contentType: false,
success: function(data) {
let response = data;
if (response.code == 0) {
swal({
title: response.info,
......@@ -2011,12 +2021,12 @@
icon: "error",
confirmButtonColor: "#00BCD4"
})
}
}
})
});
function getdetailperbang(id) {
$.ajax({
url: "{% url 'apps:get-detail-perbaikan-bang' %}",
......@@ -2025,7 +2035,7 @@
},
dataType: 'json',
success: function(data) {
isi_modal_detail = []
for (var i = 0; i < data.length; i++) {
isi_modal_detail.push(`
......@@ -2043,7 +2053,7 @@
<td><a href="media/bukti_penyelesaian/` + data[i].bukti_selesai + `" onclick="viewBukti()" id="view-bukti" target="_blank">View</a></td>
</tr>`)
}
$("#isi_modal_detail").html(`
<table class="table table-responsive datatable-show-all table-sm" id="isi_detail" style="word-wrap:break-word;">
<thead>
......@@ -2065,13 +2075,13 @@
` + isi_modal_detail + `
</tbody>
</table>`)
}
});
};
}
});
} else if (dar == ' Jalan') {
nama = res_in;
idm = res_id[0];
......@@ -2085,11 +2095,11 @@
dataType: 'json',
success: function(data) {
var geo_jalan = L.geoJson(null, {
onEachFeature: function(feature, layer) {
if (feature.properties) {
layer.on({
click: function(e) {
$("#modal_detail_non_kelurahan").modal('show');
// var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
......@@ -2098,16 +2108,16 @@
} else {
var namajalan = feature.properties.f2
}
if (feature.properties.f6 == 'None') {
var path_img = "static/img/image_null.png"
} else {
var path_img = `"static/image/jalan/` + feature.properties.f6 + `"`
}
$(".gambar_keterangan").html(`<img src=` + path_img + ` alt="" style="width:100%;height:240px;border-top-left-radius: 10px;border-bottom-left-radius: 10px;">`)
$(".nama_keterangan").html(namajalan)
$(".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_jalan" 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>
......@@ -2115,7 +2125,7 @@
<a href="#" id="btn_hapus_jalan" 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>
`)
if (feature.properties.f7 != null) {
var list_history = feature.properties.f7
console.log(list_history[0].split(",")[0])
......@@ -2127,14 +2137,14 @@
<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>`
} else {
var perbaikan_jl = `<div class='row'>
<div class="col-md-6">
<label class="col-md-6">Null</label>
</div>
</div>`
}
$(".nama_keterangan").html(`
<div>
......@@ -2146,7 +2156,7 @@
<span></span>
</div>
`)
$(".isi_keterangan").html(`
<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
<input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
......@@ -2228,32 +2238,32 @@
// </p>`;
//}
//
$('#namajalanedit').val(namajalan);
// });
$('#idjalan').val(feature.properties.f1);
$('#panjangjalan').val(feature.properties.f3);
$('#lebarjalan').val(feature.properties.f4);
$('#tipejalan').val(feature.properties.f5);
$("#coordinatejalan").val(feature.geometry);
var najal = $('#namajalanedit').val();
console.log(najal)
var ijal = $('#idjalan').val();
console.log(ijal)
}
});
pool.push({
name: feature.properties.f2,
id: L.stamp(layer),
});
}
layer.on({
mouseover: function(e) {
var layer = e.target;
layer.setStyle({
......@@ -2262,8 +2272,8 @@
fillColor: "#fffc00",
fillOpacity: 2,
opacity: 2,
});
if (!L.Browser.ie && !L.Browser.opera) {
layer.bringToFront();
......@@ -2275,20 +2285,20 @@
});
var popupContent = feature.properties.f2;
layer.bindTooltip(popupContent);
}
});
function geo_json_jalan(data) {
geo_jalan.addData(data)
}
$(document).on("click", "#btn_search_spes", function() {
geo_jalan.clearLayers()
geo_jalan.remove()
});
$('#search_spes li a').on('click', function() {
$('#input_search').val(null)
tes = $(this).text();
......@@ -2298,7 +2308,7 @@
geo_jalan.remove();
}
});
$.ajax({
url: "{% url 'api:search_lanjut' %}",
data: {
......@@ -2307,7 +2317,7 @@
},
dataType: 'json',
success: function(data) {
let list_poly = [];
for (var i = 0; i < data['gen'].length; i++) {
geoj = data['gen'][i][0];
......@@ -2328,13 +2338,13 @@
});
// map.setView([data['gen'][0][0]['geometry']['coordinates'][0][0][0][1], data['gen'][0][0]['geometry']['coordinates'][0][0][0][0]], 19);
geo_jalan.addTo(map);
var map_edit_jalan = L.map('map-jalan', {
editable: true,
zoomControl: false,
drawControl: true
}).setView([-2, 118], 5);
mapss = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
maxZoom: 22,
minZoom: 4,
......@@ -2348,7 +2358,7 @@
opacity: 0.5,
smoothFactor: 1
});
$(document).on("click", "#btn_jalan", function() {
$("#modal-jalan").css('display', 'block');
if (map_edit_jalan.hasLayer(polygon_edit_jalan)) {
......@@ -2357,7 +2367,7 @@
var id_poly = $('#idjalan').val();
console.log(id_poly)
// var id_poly = idm
$.ajax({
url: "{% url 'api:edit-jalan' %}",
data: {
......@@ -2369,8 +2379,8 @@
setTimeout(function() {
map_edit_jalan.invalidateSize();
}, 1000);
if (data['jalan']['geometry']['type'] == "MultiLineString") {
var alat = data['jalan']['geometry']['coordinates'][0][0][1];
var alng = data['jalan']['geometry']['coordinates'][0][0][0];
......@@ -2381,15 +2391,15 @@
var lop_poly_edit = data['jalan']['geometry']['coordinates'];
};
map_edit_jalan.setView([alat, alng], 18);
let list_poly_edit = [];
for (var i = 0; i < lop_poly_edit.length; i++) {
geoj = lop_poly_edit[i][0];
polygigi = [lop_poly_edit[i][1], lop_poly_edit[i][0]]
list_poly_edit.push(polygigi);
};
polygon_edit_jalan = new L.Polyline(list_poly_edit, {
color: 'blue',
weight: 3,
......@@ -2405,12 +2415,12 @@
}
})
});
//tes
$(document).on("click", "#btn_hapus_jalan", function() {
$("#modal-hapus-jalan").css('display', 'block');
var id_poly = $('#idjalan').val();
$.ajax({
url: "{% url 'api:edit-jalan' %}",
data: {
......@@ -2424,7 +2434,7 @@
}
})
});
$('#btnhpsjalan').click(function() {
var id_poly = $('#idjlnhps').val();
$.ajax({
......@@ -2457,21 +2467,21 @@
}
});
});
$(document).on("click", "#btnsavejalan", function() {
var cek = $("#namajalanedit").val()
console.log(cek)
var data = new FormData();
data.append("file", $("input[id^='imgjalan']")[0].files[0]);
data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
data.append('idjalan', $("#idjalan").val())
data.append('namajalan', $("#namajalanedit").val())
data.append('panjangjalan', $("#panjangjalan").val())
data.append('lebarjalan', $("#lebarjalan").val())
data.append('tipejalan', $("#tipejalan").val())
data.append('cord', $("#coordinatejalan").val())
$.ajax({
url: "{% url 'api:edit-jalan-valid' %}",
data: data,
......@@ -2508,11 +2518,11 @@
});
}
});
/* ini ngaruh sama element yang punya class "switchery-" */
var primary = document.querySelectorAll("[class^=switchery-");
/* ------------------- */
for (var z = 0; z < primary.length; z++) {
var switchery = new Switchery(primary[z], {
color: '#5A9AFB',
......@@ -2521,7 +2531,7 @@
jackSecondaryColor: '#fff'
});
}
// $("#perbaikan_manage").click(function() {
// var x = window.matchMedia("(max-width: 700px)")
// if (x.matches) { // If media query matches
......@@ -2540,7 +2550,7 @@
// }, 500);
// }
// })
$('.leaflet-bottom.leaflet-right>.leaflet-control-attribution.leaflet-control').html(`Powered by <a href="https://khansia.co.id" target="_blank">Khansia</a> with <a href="https://leafletjs.com" target="_blank">Leaflet</a>`)
$('.leaflet-bottom.leaflet-right>.leaflet-control-attribution.leaflet-control').css("right", "50px")
</script>
......@@ -2549,147 +2559,12 @@
$(".tombol-edit").html('ilang')
</script>
{% endif %}
{% include 'includes/permission.html' %}
<script src="{% static 'js/scripts_js_o.js' %}"></script>
<script src="{% static 'js/scripts_js_m.js' %}"></script>
<script src="{% static 'js/action.js' %}"></script>
<script src="{% static 'js/scripts_layout.js' %}"></script>
<script src="{% static 'js/scripts_sidebar.js' %}"></script>
</body>
</html>{% include 'includes/js-m.html' %}
<script>
// start disabled inspect
// document.addEventListener('contextmenu', function(e) {
// e.preventDefault();
// });
// document.onkeydown = function(e) {
// if(event.keyCode == 123) {
// return false;
// }
// if(e.ctrlKey && e.shiftKey && e.keyCode == 'I'.charCodeAt(0)) {
// return false;
// }
// if(e.ctrlKey && e.shiftKey && e.keyCode == 'C'.charCodeAt(0)) {
// return false;
// }
// if(e.ctrlKey && e.shiftKey && e.keyCode == 'J'.charCodeAt(0)) {
// return false;
// }
// if(e.ctrlKey && e.keyCode == 'U'.charCodeAt(0)) {
// return false;
// }
// }
// end disabled inspect
</script>
<!-- <script>
$(function() {
// Switchery
// ------------------------------
// Initialize multiple switches
if (Array.prototype.forEach) {
var elems = Array.prototype.slice.call(document.querySelectorAll('.switchery'));
elems.forEach(function(html) {
var switchery = new Switchery(html);
});
}
else {
var elems = document.querySelectorAll('.switchery');
for (var i = 0; i < elems.length; i++) {
var switchery = new Switchery(elems[i]);
}
}
// Colored switches
var primary = document.querySelector('.switchery-primary');
var switchery = new Switchery(primary, { color: '#2196F3' });
var danger = document.querySelector('.switchery-danger');
var switchery = new Switchery(danger, { color: '#EF5350' });
var warning = document.querySelector('.switchery-warning');
var switchery = new Switchery(warning, { color: '#FF7043' });
var info = document.querySelector('.switchery-info');
var switchery = new Switchery(info, { color: '#00BCD4'});
// Checkboxes/radios (Uniform)
// ------------------------------
// Default initialization
$(".styled, .multiselect-container input").uniform({
radioClass: 'choice'
});
// File input
$(".file-styled").uniform({
wrapperClass: 'bg-blue',
fileButtonHtml: '<i class="icon-file-plus"></i>'
});
//
// Contextual colors
//
// Primary
$(".control-primary").uniform({
radioClass: 'choice',
wrapperClass: 'border-primary-600 text-primary-800'
});
// Danger
$(".control-danger").uniform({
radioClass: 'choice',
wrapperClass: 'border-danger-600 text-danger-800'
});
// Success
$(".control-success").uniform({
radioClass: 'choice',
wrapperClass: 'border-success-600 text-success-800'
});
// Warning
$(".control-warning").uniform({
radioClass: 'choice',
wrapperClass: 'border-warning-600 text-warning-800'
});
// Info
$(".control-info").uniform({
radioClass: 'choice',
wrapperClass: 'border-info-600 text-info-800'
});
// Custom color
$(".control-custom").uniform({
radioClass: 'choice',
wrapperClass: 'border-indigo-600 text-indigo-800'
});
// Bootstrap switch
// ------------------------------
$(".switch").bootstrapSwitch();
});
</script> -->
</html>
<style>
@media (max-width: 720px) {
#map>div.row>div.col-sm-4.input-group.content-group.head {
......
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