Commit 1fcdd69e authored by Manggar Mahardhika's avatar Manggar Mahardhika

konflik js-m

parents 696fadf2 18486b82
...@@ -48,9 +48,9 @@ import random ...@@ -48,9 +48,9 @@ import random
@api_view(('GET',)) @api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer)) @renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def search_auto(request): def search_auto(request):
nama_desa = request.GET.get('namadesa')
with conn.cursor() as desa: with conn.cursor() as desa:
desa.execute(f"SELECT id, desa, kecamatan FROM geo_data_kelurahan WHERE desa ILIKE '{nama_desa}%' order by desa ASC limit 5") desa.execute(f"SELECT id, desa, kecamatan FROM geo_data_kelurahan order by desa ASC")
all = desa.fetchall() all = desa.fetchall()
data = {'nama_des':all} data = {'nama_des':all}
...@@ -737,22 +737,116 @@ def hapus(request): ...@@ -737,22 +737,116 @@ def hapus(request):
print(respon) print(respon)
return Response(respon) return Response(respon)
@api_view(('GET',)) @api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer)) @renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def hasilsearch(request): def hasilsearch(request):
if request.method == 'GET': if request.method == 'GET':
id_desa = request.GET.get("id_desa_search") nama_desa = request.GET.get("id_desa_search")
with conn.cursor() as kel: nama_desa = nama_desa.split(",")[0]
kel.execute("SELECT json_build_object('type', 'Feature', 'administrasi', (kode_desa, desa, kecamatan, kab_kota, provinsi, jumlah_pen, jumlah_kk, luas_desa),'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),'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_data_kelurahan where id = %s"% int(id_desa)) with conn.cursor() as bts:
kel_res_ = kel.fetchall() bts.execute("""
SELECT
st_asgeojson ( ST_ExteriorRing ( the_geom ) ) AS erings
FROM
( SELECT ( ST_Dump ( geom ) ).geom AS the_geom FROM geo_data_kelurahan WHERE desa = '%s' ) as foo
"""% nama_desa)
batas = bts.fetchall()
# batas_desa = json.loads(batas)
line_o = []
for i in batas:
o_pol1 = ''
o_poly = []
kel_res = [] for x in json.loads(i[0])['coordinates']:
for i in kel_res_: o_pol1 += (f'{x[0]},{x[1]}""')
kel_res.append(i[0])
data = {'result':kel_res} o_pol2 = o_pol1.replace('""1',',1')
return Response(data)
o_poly.append(o_pol2.replace('""',''))
line_o.append(o_poly)
with conn.cursor() as desa:
desa.execute("""
SELECT
ST_AsGeoJson ( ST_centroid ( geom ) )
FROM
geo_data_kelurahan
WHERE
desa = '%s'"""% nama_desa)
lat_lng = desa.fetchall()
with conn.cursor() as bang:
bang.execute("""SELECT
json_build_object (
'type',
'Feature',
'properties',
( buildings.ID, buildings.NAME, buildings.information ),
'administrasi',
(
buildings.address_1,
buildings.address_2,
buildings.address_3,
buildings.provinsi,
buildings.alamat,
buildings.luas_bangunan,
buildings.luas_tanah,
buildings.tinggi_bangunan,
buildings.gambar,
buildings.pemilik
),
'geometry',
ST_AsGeoJSON ( buildings.geom :: geometry ) :: json
)
FROM
geo_bangunan buildings
JOIN geo_data_kelurahan desa ON st_intersects ( ST_SetSRID(desa.geom, 0), buildings.geom )
WHERE
desa.desa = '%s'"""% nama_desa)
bangunan = bang.fetchall()
polygon_o = []
info_polygon = []
tinggi_pol = []
for i in bangunan:
o_pol1 = ''
o_poly = []
for x in i[0]['geometry']['coordinates'][0][0]:
o_pol1 += (f'{x[0]},{x[1]}""')
o_pol2 = o_pol1.replace('""1',',1')
o_poly.append(o_pol2.replace('""',''))
polygon_o.append(o_poly)
tinggi_pol.append(i[0]['administrasi']['f8'])
info_polygon.append(i[0]['properties']['f1'])
# for i in batas:
# o_batas = ''
# o_poly_batas = []
# for x in i[0]['geometry']['coordinates'][0][0]:
# o_batas += (f'{x[0]},{x[1]}""')
# o_pol2 = o_pol1.replace('""1',',1')
# o_poly.append(o_pol2.replace('""',''))
# polygon_o.append(o_poly)
# tinggi_pol.append(i[0]['administrasi']['f8'])
# info_polygon.append(i[0]['properties']['f1'])
lat = json.loads(lat_lng[0][0])['coordinates'][0]
lng = json.loads(lat_lng[0][0])['coordinates'][1]
respon={'polygon_o':polygon_o,'tinggi_pol':tinggi_pol, 'info_polygon': info_polygon, 'lat':lat, 'lng':lng, 'line_o':line_o}
return Response(respon)
import random import random
......
{% for group in user.groups.all %} {% if group.name == 'Superadmin' %} {% for group in user.groups.all %} {% if group.name == 'Superadmin' %}
<style> <style>
.leaflet-popup{ .leaflet-popup {
display: block; display: block;
} }
#btn_edit_kelurahan { #btn_edit_kelurahan {
display: block; display: block;
} }
...@@ -46,6 +47,7 @@ ...@@ -46,6 +47,7 @@
#btn_edit_adm { #btn_edit_adm {
display: block; display: block;
} }
#btn_delete_adm { #btn_delete_adm {
display: block; display: block;
} }
...@@ -70,7 +72,7 @@ ...@@ -70,7 +72,7 @@
display: block; display: block;
} }
.leaflet-popup{ .leaflet-popup {
display: block; display: block;
} }
</style> </style>
...@@ -275,8 +277,7 @@ ...@@ -275,8 +277,7 @@
offset: [0, 0] offset: [0, 0]
}); });
return marker return marker
} } else if (feature.administrasi.f2 == 'none') {
else if (feature.administrasi.f2 == 'none') {
var smallIcon = new L.Icon({ var smallIcon = new L.Icon({
iconSize: [20, 20], iconSize: [20, 20],
iconAnchor: [13, 27], iconAnchor: [13, 27],
...@@ -1657,7 +1658,7 @@ ...@@ -1657,7 +1658,7 @@
</div> </div>
</tbody> </tbody>
</table>`; </table>`;
content_edit_rs=` content_edit_rs = `
<div class="modal-dialog md"> <div class="modal-dialog md">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header bg-info" style="background-color: #40777c !important;"> <div class="modal-header bg-info" style="background-color: #40777c !important;">
...@@ -4604,46 +4605,88 @@ ...@@ -4604,46 +4605,88 @@
} }
} }
//3d begin //3d begin
function map3d() {
var checkBox_3d = document.getElementById("3d-maps");
if (checkBox_3d.checked == true) {
$("#map").css('display', 'none');
$("#map-cesium").css('display', 'block');
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJhOTc0NDkxMi02N2NkLTQwYjMtOTE1Yi1iMGNkZDU0Zjg3MGMiLCJpZCI6NDQ1ODgsImlhdCI6MTYxNDE0NjM5NH0.sRHzNNa7uV_huqGxERySWlL8J5UVx1VwU-pRwNd0GJk'; Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJhOTc0NDkxMi02N2NkLTQwYjMtOTE1Yi1iMGNkZDU0Zjg3MGMiLCJpZCI6NDQ1ODgsImlhdCI6MTYxNDE0NjM5NH0.sRHzNNa7uV_huqGxERySWlL8J5UVx1VwU-pRwNd0GJk';
var worldTerrain = new Cesium.ArcGISTiledElevationTerrainProvider({
url:
"https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer",
});
var map_cesium = new Cesium.Viewer('map-cesium'); var map_cesium = new Cesium.Viewer('map-cesium');
// var map_cesium = new Cesium.Viewer('map-cesium', { //
// terrainProvider: worldTerrain,
// });
map_cesium.camera.flyTo({ //
destination: Cesium.Cartesian3.fromDegrees(104.171696, -4.120217, 10000) //function mapsganti() {
}); // $("#modalsearch3d").modal()
//}
map_cesium.camera.moveEnd.addEventListener(function() {
var windowPosition = new Cesium.Cartesian2(map_cesium.container.clientWidth / 2, map_cesium.container.clientHeight / 2);
var pickRay = map_cesium.scene.camera.getPickRay(windowPosition);
var pickPosition = map_cesium.scene.globe.pick(pickRay, map_cesium.scene);
var pickPositionCartographic = map_cesium.scene.globe.ellipsoid.cartesianToCartographic(pickPosition);
var longitudee = pickPositionCartographic.longitude * (180 / Math.PI);
var lattitudee = pickPositionCartographic.latitude * (180 / Math.PI);
// map_cesium.terrainProvider = worldTerrain;
console.log(lattitudee)
console.log(longitudee)
function mapsganti() {
var checkBox_3d = document.getElementById("mapschange");
if (checkBox_3d.checked == true) {
$("#modalsearch3d").modal()
$.ajax({ $.ajax({
url: "{% url 'api:3d-maps' %}", url: "{% url 'api:search'%}",
data: { data: {
'latt': lattitudee, 'namadesa': 'search'
'loog': longitudee },
dataType: 'json',
success: function(response) {
var len = response['nama_des'].length;
var data_de = []
for (var i = 0; i < len; i++) {
var id = response['nama_des'][i][0];
var desa = response['nama_des'][i][1];
var kec = response['nama_des'][i][2];
var da = `<option value="` + desa + `,` + kec + `">` + desa + `,` + kec + `</option>`;
data_de.push(da)
}
$("#search_desa").html(data_de);
}
})
} else {
//location.reload();
$("#labelchange").html(`<h1 style="color: white;margin-top: 5px;margin-left: 8px;">
3D
</h1>`)
map_cesium.entities.removeAll();
//map_cesium.destroy();
setTimeout(function() {
map.invalidateSize();
}, 1000);
$("#map").css('display', 'block');
$(".no3d").css('display', 'block')
$("#map-cesium").css('display', 'none');
//$(".filter3d").removeClass("d3filter");
}
}
$("#search3D").click(function() {
$("#map").css('display', 'none');
$("#map-cesium").css('display', 'block');
$(".no3d").css('display', 'none')
$("#labelchange").html(`<h1 style="color: white;margin-top: 5px;margin-left: 8px;">
2D
</h1>`)
var nama_desa = $("#search_desa").val();
$.ajax({
url: "{% url 'api:ressearch' %}",
data: {
'id_desa_search': nama_desa
}, },
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
$("#modalsearch3d").modal("toggle")
console.log(data['polygon_o'])
console.log(data['line_o'])
map_cesium.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(data['lat'], data['lng'], 750)
});
for (var i = 0; i < data["polygon_o"].length; i++) { for (var i = 0; i < data["polygon_o"].length; i++) {
polygon_oo = data["polygon_o"][i][0].replace(/&#x27;/g, ''); polygon_oo = data["polygon_o"][i][0].replace(/&#x27;/g, '');
poll = JSON.parse("[" + polygon_oo + "]"); poll = JSON.parse("[" + polygon_oo + "]");
...@@ -4664,9 +4707,23 @@ ...@@ -4664,9 +4707,23 @@
// poly_osm.polygon.extrudedHeight = 10; // poly_osm.polygon.extrudedHeight = 10;
// console.log(data["tinggi_pol"]) // console.log(data["tinggi_pol"])
}; };
}
}); for (var i = 0; i < data["line_o"].length; i++) {
line_oo = data["line_o"][i][0].replace(/&#x27;/g, '');
lin = JSON.parse("[" + line_oo + "]");
var redLine = map_cesium.entities.add({
polyline: {
positions: Cesium.Cartesian3.fromDegreesArray(
lin
),
width: 5,
material: Cesium.Color.RED,
clampToGround: true,
},
}); });
}
map_cesium.selectedEntityChanged.addEventListener(function(selectedEntity) { map_cesium.selectedEntityChanged.addEventListener(function(selectedEntity) {
if (Cesium.defined(selectedEntity)) { if (Cesium.defined(selectedEntity)) {
if (Cesium.defined(selectedEntity.name)) { if (Cesium.defined(selectedEntity.name)) {
...@@ -4747,10 +4804,6 @@ ...@@ -4747,10 +4804,6 @@
</tbody> </tbody>
</table>`; </table>`;
$("#isi_panel").html(content) $("#isi_panel").html(content)
} }
}) })
console.log('Selected ' + selectedEntity.name); console.log('Selected ' + selectedEntity.name);
...@@ -4762,17 +4815,19 @@ ...@@ -4762,17 +4815,19 @@
} }
}); });
} else {
//map_cesium.entities.removeAll();
//map_cesium.destroy();
setTimeout(function() {
map.invalidateSize();
}, 1000);
$("#map").css('display', 'block');
$("#map-cesium").css('display', 'none');
} }
});
});
function load3dbang() {
$(".label-bangunan").css("display", "none");
} }
//3d end //3d end
var geocodeService = L.esri.Geocoding.geocodeService(); var geocodeService = L.esri.Geocoding.geocodeService();
var geocoderNominatim = new L.Control.Geocoder.Nominatim(); var geocoderNominatim = new L.Control.Geocoder.Nominatim();
...@@ -4871,7 +4926,7 @@ ...@@ -4871,7 +4926,7 @@
</div> </div>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunan" value="`+feature.geometry+`"> <input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunan" value="` + feature.geometry + `">
<table> <table>
<tr style="margin-top: 10px"> <tr style="margin-top: 10px">
<th> <th>
...@@ -4879,28 +4934,28 @@ ...@@ -4879,28 +4934,28 @@
</th> </th>
<td> <td>
<input type="file" id="imgbangunan" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif"> <input type="file" id="imgbangunan" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
<input style="display:none;" id="gambar" type="text" class="form-control" value="`+feature.administrasi.f9+`"required> <input style="display:none;" id="gambar" type="text" class="form-control" value="` + feature.administrasi.f9 + `"required>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<input type="text" name="idbangunan" id="idbangunan" class="form-control hidden" value="`+feature.properties.f1+`" disable> <input type="text" name="idbangunan" id="idbangunan" class="form-control hidden" value="` + feature.properties.f1 + `" disable>
<input style="display:none;" id="coordinateZoneeditbang" type="text" class="form-control" value=""required> <input style="display:none;" id="coordinateZoneeditbang" type="text" class="form-control" value=""required>
</td> </td>
</tr> </tr>
<tr> <tr>
<th>Nama Bangunan</th> <th>Nama Bangunan</th>
<td> <td>
<input type="text" name="namebangunan" id="namebangunan" class="form-control" value="`+feature.properties.f2+`"> <input type="text" name="namebangunan" id="namebangunan" class="form-control" value="` + feature.properties.f2 + `">
</td> </td>
</tr> </tr>
<tr> <tr>
<th>Jenis Bangunan</th> <th>Jenis Bangunan</th>
<td> <td>
<input type="text" class="hidden" name="tipe1" id="tipe111" value="`+feature.administrasi.f11+`"> <input type="text" class="hidden" name="tipe1" id="tipe111" value="` + feature.administrasi.f11 + `">
<input type="text" class="hidden" name="tipe1" id="tipe222" value="`+feature.administrasi.f12+`"> <input type="text" class="hidden" name="tipe1" id="tipe222" value="` + feature.administrasi.f12 + `">
<input type="text" class="hidden" name="tipe1" id="tipe333" value="`+feature.administrasi.f13+`"> <input type="text" class="hidden" name="tipe1" id="tipe333" value="` + feature.administrasi.f13 + `">
<input type="text" class="hidden" name="tipe1" id="tipe444" value="`+feature.administrasi.f14+`"> <input type="text" class="hidden" name="tipe1" id="tipe444" value="` + feature.administrasi.f14 + `">
<select style="border-bottom: 1px solid rgb(83, 83, 83) !important;width: 220px;" id="tipe_point_b_e" data-placeholder="select point.." class="select-size-md"> <select style="border-bottom: 1px solid rgb(83, 83, 83) !important;width: 220px;" id="tipe_point_b_e" data-placeholder="select point.." class="select-size-md">
<option value="null" selected disabled>-- Pilih Jenis Point --</option> <option value="null" selected disabled>-- Pilih Jenis Point --</option>
<option value="bangunan">Bangunan Biasa</option> <option value="bangunan">Bangunan Biasa</option>
...@@ -4934,31 +4989,31 @@ ...@@ -4934,31 +4989,31 @@
<tr> <tr>
<th>Informasi Bangunan</th> <th>Informasi Bangunan</th>
<td> <td>
<input type="text" name="infobangunan" id="infobangunan" class="form-control" value="`+feature.properties.f3+`"> <input type="text" name="infobangunan" id="infobangunan" class="form-control" value="` + feature.properties.f3 + `">
</td> </td>
</tr> </tr>
<tr> <tr>
<th>Kelurahan</th> <th>Kelurahan</th>
<td> <td>
<input type=" text " name="nmkelurahan " id="nmkelurahan" class="form-control " value="`+feature.administrasi.f1+`"> <input type=" text " name="nmkelurahan " id="nmkelurahan" class="form-control " value="` + feature.administrasi.f1 + `">
</td> </td>
</tr> </tr>
<tr> <tr>
<th>Kecamatan</th> <th>Kecamatan</th>
<td> <td>
<input type="text " name="nmkecamatan " id="nmkecamatan" class="form-control " value="`+feature.administrasi.f2+`"> <input type="text " name="nmkecamatan " id="nmkecamatan" class="form-control " value="` + feature.administrasi.f2 + `">
</td> </td>
</tr> </tr>
<tr> <tr>
<th>Kab/Kota</th> <th>Kab/Kota</th>
<td> <td>
<input type="text " name="nmkabkota " id="nmkabkota" class="form-control " value="`+feature.administrasi.f3+`"> <input type="text " name="nmkabkota " id="nmkabkota" class="form-control " value="` + feature.administrasi.f3 + `">
</td> </td>
</tr> </tr>
<tr> <tr>
<th>Provinsi</th> <th>Provinsi</th>
<td> <td>
<input type="text " name="nmprovinsi " id="nmprovinsi" class="form-control " value="`+feature.administrasi.f4+`"> <input type="text " name="nmprovinsi " id="nmprovinsi" class="form-control " value="` + feature.administrasi.f4 + `">
</td> </td>
</tr> </tr>
...@@ -4971,25 +5026,25 @@ ...@@ -4971,25 +5026,25 @@
<tr> <tr>
<th>Luas Bangunan</th> <th>Luas Bangunan</th>
<td> <td>
<input type="text " name="luasbangunan " id="luasbangunan" class="form-control " value="`+feature.administrasi.f6+`"> <input type="text " name="luasbangunan " id="luasbangunan" class="form-control " value="` + feature.administrasi.f6 + `">
</td> </td>
</tr> </tr>
<tr> <tr>
<th>Luas Tanah</th> <th>Luas Tanah</th>
<td> <td>
<input type="text " name="luastanah " id="luastanah" class="form-control " value="`+feature.administrasi.f7+`"> <input type="text " name="luastanah " id="luastanah" class="form-control " value="` + feature.administrasi.f7 + `">
</td> </td>
</tr> </tr>
<tr> <tr>
<th>Tinggi Bangunan</th> <th>Tinggi Bangunan</th>
<td> <td>
<input type="text " name="tinggibangunan " id="tinggibangunan" class="form-control " value="`+feature.administrasi.f8+`"> <input type="text " name="tinggibangunan " id="tinggibangunan" class="form-control " value="` + feature.administrasi.f8 + `">
</td> </td>
</tr> </tr>
<tr> <tr>
<th>Pemilik</th> <th>Pemilik</th>
<td> <td>
<input type="text " name="pemilik " id="pemilik" class="form-control " value="`+feature.administrasi.f10+`"> <input type="text " name="pemilik " id="pemilik" class="form-control " value="` + feature.administrasi.f10 + `">
</td> </td>
</tr> </tr>
</table> </table>
...@@ -5003,7 +5058,7 @@ ...@@ -5003,7 +5058,7 @@
</div> </div>
</div> </div>
</div>`; </div>`;
content_delete=` content_delete = `
<div class="modal-dialog" style="width: max-content;height: max-content;"> <div class="modal-dialog" style="width: max-content;height: max-content;">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header bg-info" style="background-color:#40777c;"> <div class="modal-header bg-info" style="background-color:#40777c;">
...@@ -5019,9 +5074,9 @@ ...@@ -5019,9 +5074,9 @@
<div class="form-group"> <div class="form-group">
<div class="col-lg-12" style="margin-top:10px;margin-bottom:10px;"> <div class="col-lg-12" style="margin-top:10px;margin-bottom:10px;">
<input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunanhps" value=""> <input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunanhps" value="">
<input type="text" name="idbangunan" id="idbangunanhps" class="form-control hidden" value="`+feature.properties.f1+`" disable> <input type="text" name="idbangunan" id="idbangunanhps" class="form-control hidden" value="` + feature.properties.f1 + `" disable>
<input type="text" name="namebangunan" id="namebangunanhps" class="form-control" value="`+feature.properties.f2+`"> <input type="text" name="namebangunan" id="namebangunanhps" class="form-control" value="` + feature.properties.f2 + `">
<input type="text" name="infobangunan" id="infobangunanhps" class="form-control" value="`+feature.properties.f3+`"> <input type="text" name="infobangunan" id="infobangunanhps" class="form-control" value="` + feature.properties.f3 + `">
</div> </div>
</div> </div>
</div> </div>
...@@ -5370,7 +5425,12 @@ ...@@ -5370,7 +5425,12 @@
loaderPage(true); loaderPage(true);
var tipe1 = $('#tipe111').val(); var tipe1 = $('#tipe111').val();
<<<<<<< HEAD
$('#tipe_point_b_e option[value='+tipe1+']').attr('selected','selected'); $('#tipe_point_b_e option[value='+tipe1+']').attr('selected','selected');
=======
$('#tipe_point_b_e option[value=' + tipe1 + ']').attr('selected', 'selected');
// $("#tipe_point_b_e option").val(tipe1).change();
>>>>>>> 18486b82a9845aa577f0dadfb192db38146dcdcf
$("#tipe_point_b_e").change(function() { $("#tipe_point_b_e").change(function() {
$('#tipe_point_2_b_e').empty(); $('#tipe_point_2_b_e').empty();
...@@ -5405,8 +5465,8 @@ ...@@ -5405,8 +5465,8 @@
var tipe2 = $('#tipe222').val(); var tipe2 = $('#tipe222').val();
if (tipe2 == 'null') { if (tipe2 == 'null') {
$('#tipe_point_2_b_e').html(`<option value="null" selected disabled>-- Pilih Tipe Point --</option>`); $('#tipe_point_2_b_e').html(`<option value="null" selected disabled>-- Pilih Tipe Point --</option>`);
} else{ } else {
$('#tipe_point_2_b_e').html(`<option value="`+tipe2+`" selected disabled>`+tipe2+`</option>`); $('#tipe_point_2_b_e').html(`<option value="` + tipe2 + `" selected disabled>` + tipe2 + `</option>`);
} }
$("#tipe_point_2_b_e").change(function() { $("#tipe_point_2_b_e").change(function() {
...@@ -5429,7 +5489,7 @@ ...@@ -5429,7 +5489,7 @@
var data_po = data['result'][i][1]; var data_po = data['result'][i][1];
console.log(data_id) console.log(data_id)
console.log(data_po) console.log(data_po)
var data_kab = `<option value="` +data_id + `">` + data_po + `</option>`; var data_kab = `<option value="` + data_id + `">` + data_po + `</option>`;
data_all_kab.push(data_kab) data_all_kab.push(data_kab)
}; };
$('#tipe_point_3_b_e').html(`<option value="null" selected disabled>-- Pilih Point --</option>` + data_all_kab); $('#tipe_point_3_b_e').html(`<option value="null" selected disabled>-- Pilih Point --</option>` + data_all_kab);
...@@ -5439,11 +5499,16 @@ ...@@ -5439,11 +5499,16 @@
var tipe3 = $('#tipe333').val(); var tipe3 = $('#tipe333').val();
var tipe4 = $('#tipe444').val(); var tipe4 = $('#tipe444').val();
<<<<<<< HEAD
=======
// $('#tipe_point_3_b_e option[value='+tipe3+']').attr('selected','selected');
>>>>>>> 18486b82a9845aa577f0dadfb192db38146dcdcf
if (tipe3 == 'null') { if (tipe3 == 'null') {
$('#tipe_point_3_b_e').html(`<option value="null" selected disabled>-- Pilih Point --</option>`); $('#tipe_point_3_b_e').html(`<option value="null" selected disabled>-- Pilih Point --</option>`);
} else{ } else {
$('#tipe_point_3_b_e').html(`<option value="`+tipe3+`" selected disabled>`+tipe4+`</option>`); $('#tipe_point_3_b_e').html(`<option value="` + tipe3 + `" selected disabled>` + tipe4 + `</option>`);
} }
$.ajax({ $.ajax({
...@@ -5482,6 +5547,11 @@ ...@@ -5482,6 +5547,11 @@
}); });
<<<<<<< HEAD
=======
>>>>>>> 18486b82a9845aa577f0dadfb192db38146dcdcf
$(document).on("click", "#btnsavebangunan", function() { $(document).on("click", "#btnsavebangunan", function() {
var data = new FormData(); var data = new FormData();
data.append("file", $("input[id^='imgbangunan']")[0].files[0]); data.append("file", $("input[id^='imgbangunan']")[0].files[0]);
...@@ -5651,6 +5721,7 @@ ...@@ -5651,6 +5721,7 @@
// }).addTo(map_bang); // }).addTo(map_bang);
$(document).on("click", "#btn_perbaikan_bangunan", function() { $(document).on("click", "#btn_perbaikan_bangunan", function() {
<<<<<<< HEAD
var map_bang = new L.map('map-insert-renov-bang', { var map_bang = new L.map('map-insert-renov-bang', {
editable: true, editable: true,
zoomControl: false, zoomControl: false,
...@@ -5662,12 +5733,19 @@ ...@@ -5662,12 +5733,19 @@
minZoom: 4, minZoom: 4,
}).addTo(map_bang); }).addTo(map_bang);
=======
// if (map_bang.hasLayer(polyxxx)) {
// polyxxx.remove()
// }
// var id_polyx = $('#idbangunan').val();
>>>>>>> 18486b82a9845aa577f0dadfb192db38146dcdcf
$("#input_perbaikan_bang").css("display", "block"); $("#input_perbaikan_bang").css("display", "block");
if (map_bang.hasLayer(polyxxx)) { if (map_bang.hasLayer(polyxxx)) {
polyxxx.remove() polyxxx.remove()
} }
var id_polyx = $('#idbangunan').val(); var id_polyx = $('#idbangunan').val();
<<<<<<< HEAD
$.ajax({ $.ajax({
url: "{% url 'apps:input-perbaikan-bang' %}", url: "{% url 'apps:input-perbaikan-bang' %}",
data: { data: {
...@@ -5802,5 +5880,37 @@ ...@@ -5802,5 +5880,37 @@
}) })
}); });
=======
// $.ajax({
// url: "{% url 'apps:input-perbaikan-bang' %}",
// data: {
// 'id_bangunan': id_polyx
// },
// dataType: 'json',
// success: function(data) {
// $("#nama_bang").val(data[0]);
// $("#type_bang").val(data[1]);
// $("#id_bang_perbaikan").val(data[3]);
// $("#type_id_bang").val("1")
// var latlngs = data[2];
// map_bang.setView([latlngs['geometry']['coordinates'][0][0][1], latlngs['geometry']['coordinates'][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++) {
// geoj = lop_poly_edit[i][0];
// 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()))
// }
// })
})
>>>>>>> 18486b82a9845aa577f0dadfb192db38146dcdcf
</script> </script>
{% include 'includes/insert.html' %} {% include 'includes/insert.html' %}
\ No newline at end of file
...@@ -1054,7 +1054,7 @@ ...@@ -1054,7 +1054,7 @@
var desa = response['nama_des'][i][1]; var desa = response['nama_des'][i][1];
var kec = response['nama_des'][i][2]; var kec = response['nama_des'][i][2];
var da = `<li value='` + id + `'>` + desa + `,` + kec + `</li>`; var da = `<li value='` + desa + `,` + kec + `'>` + desa + `,` + kec + `</li>`;
data_de.push(da) data_de.push(da)
} }
...@@ -1071,6 +1071,9 @@ ...@@ -1071,6 +1071,9 @@
}); });
//3d begin
function setsearch(element) { function setsearch(element) {
var value = $(element).text(); var value = $(element).text();
...@@ -1086,11 +1089,8 @@ ...@@ -1086,11 +1089,8 @@
}, },
dataType: 'json', dataType: 'json',
success: function(response) { success: function(response) {
var resultan = response['result'][0]
geo_json_search(resultan); console.log(response)
map.setView([resultan['geometry']['coordinates'][0][0][0][1], resultan['geometry']['coordinates'][0][0][0][0]], 14);
search_desa.addTo(map)
geo_batas.remove()
} }
}); });
} }
......
...@@ -699,9 +699,28 @@ ...@@ -699,9 +699,28 @@
</div> </div>
</div> </div>
</div> <div class="modal fade" id="modalsearch3d" tabindex="-1" role="dialog">
</div> <div class="modal-dialog modal-xs">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">3D Searching</h4>
</div>
<div class="modal-body">
<fieldset>
<select id="search_desa" placeholder="Pick a state..." style="width: 256px;height: 35px;">
</select>
<br>
</fieldset>
</div>
<div class="modal-footer">
<input class="btn btn-success btn-block" id="search3D" type="submit" value="Search">
</div>
</div>
</div>
</div>
<!--
<script> <script>
$("#tipe_point").change(function() { $("#tipe_point").change(function() {
var tipe = $(this).val(); var tipe = $(this).val();
...@@ -729,4 +748,4 @@ ...@@ -729,4 +748,4 @@
} }
}); });
}); });
</script> </script> -->
\ No newline at end of file \ No newline at end of file
...@@ -10,9 +10,11 @@ ...@@ -10,9 +10,11 @@
top: 7px;"> top: 7px;">
</i> </i>
<!-- <i class="icon-location4 fa-gradient"></i> --> <!-- <i class="icon-location4 fa-gradient"></i> -->
<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OKU-GIS</b> <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Teman-KU
</b> (Sistem Informasi Pembangunan OKU)
</a> </a>
<ul class="nav navbar-nav pull-right visible-xs-block"> <ul class="nav navbar-nav pull-right visible-xs-block">
<li><a data-toggle="collapse" data-target="#navbar-mobile"><i class="icon-tree5"></i></a></li> <li><a data-toggle="collapse" data-target="#navbar-mobile"><i class="icon-tree5"></i></a></li>
</ul> </ul>
......
{% load static %} {% load static %}
<ul class="dock" style="right: 0;position: absolute;"> <ul class="dock" style="right: 0;position: absolute;">
<li class="fixed-plugin" style="top: 100px;"> <li class="fixed-plugin" style="top: 50px;">
<div class="dropdown show-dropdown" style="top: 1px;">
<a href="#" type="checkbox">
<input type="checkbox" name="checkbox" onclick="mapsganti()" id="mapschange" style="position: absolute;opacity: 0;width: 48px;height: 30px;">
<div id="labelchange">
<h1 style="color: white;margin-top: 5px;margin-left: 8px;">
3D
</h1>
</div>
<!-- <i class="fa fa-map-o fa-2x" style="color: white;
margin: 10px 10px;
width: auto;"> </i> -->
</a>
</div>
</li>
<li class="fixed-plugin no3d" style="top: 110px;">
<div class="dropdown show-dropdown" style="top: 1px;"> <div class="dropdown show-dropdown" style="top: 1px;">
<a href="#" data-toggle="dropdown"> <a href="#" data-toggle="dropdown">
<i class="fa fa-map-o fa-2x" style="color: white; <i class="fa fa-map-o fa-2x" style="color: white;
...@@ -55,9 +73,9 @@ ...@@ -55,9 +73,9 @@
</ul> </ul>
</div> </div>
</li> </li>
<li class="fixed-plugin" style="top: 160px;"> <li class="fixed-plugin no3d" style="top: 170px;">
<div class="dropdown show-dropdown"> <div class="dropdown show-dropdown ">
<a href="#" data-toggle="dropdown"> <a href="#" data-toggle="dropdown">
<i class="fa fa-cog fa-2x" style="font-size: 36px; <i class="fa fa-cog fa-2x" style="font-size: 36px;
color: white; color: white;
...@@ -71,7 +89,6 @@ ...@@ -71,7 +89,6 @@
<div class="panel-body"> --> <div class="panel-body"> -->
<div class="row" style="margin: 0;padding: 0;"> <div class="row" style="margin: 0;padding: 0;">
<div class="col-md-6"> <div class="col-md-6">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" id="geo_tuplah" onclick="geotuplah()" style="margin-top:2px;"> <input type="checkbox" id="geo_tuplah" onclick="geotuplah()" style="margin-top:2px;">
...@@ -79,14 +96,13 @@ ...@@ -79,14 +96,13 @@
</label> </label>
</div> </div>
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" id="geo_building" style="margin-top:2px;"> <input type="checkbox" id="geo_building" style="margin-top:2px;">
Bangunan Bangunan
</label> </label>
</div> </div>
<ul class="nasted active"> <!-- <ul class="nasted active">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" id="2d-maps" style="margin-top:2px;"> <input type="checkbox" id="2d-maps" style="margin-top:2px;">
...@@ -99,13 +115,7 @@ ...@@ -99,13 +115,7 @@
Bangunan 3D Maps Bangunan 3D Maps
</label> </label>
</div> </div>
</ul> </ul> -->
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" id="geo_jalan" onclick="geojalan()" style="margin-top:2px;"> <input type="checkbox" id="geo_jalan" onclick="geojalan()" style="margin-top:2px;">
......
...@@ -465,7 +465,7 @@ ...@@ -465,7 +465,7 @@
} }
li.fixed-plugin .fa:hover { li.fixed-plugin .fa:hover {
transform: rotate(180deg); transform: rotate(360deg);
transition: all 0.3s linear; transition: all 0.3s linear;
} }
/*.move-btn .caret {*/ /*.move-btn .caret {*/
...@@ -683,10 +683,15 @@ ...@@ -683,10 +683,15 @@
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div id="map"> <div id="map">
</div> </div>
<div id="map-cesium" style="z-index: -999; height: 605px; display:none"></div> <div id="map-cesium" style="z-index: -999; height: 100vh; display:none">
<div class="label-bangunan" style="margin: 0px 0 0px 0px;padding-top: 55px;position: absolute;z-index: 1;right: 20px;">
<label style="background-color: white;">
&nbsp;&nbsp;left click + ctrl to rotate maps&nbsp;&nbsp;
</label>
</div>
<div class="page_loader_3d"></div>
</div>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -57,11 +57,11 @@ ...@@ -57,11 +57,11 @@
margin-right: 0px; margin-right: 0px;
} }
.modal-colors{ .modal-colors {
background-color: #1a222f; background-color: #1a222f;
} }
.lbl-top{ .lbl-top {
margin-top: 10px; margin-top: 10px;
} }
...@@ -111,12 +111,19 @@ ...@@ -111,12 +111,19 @@
<!-- Main navbar --> <!-- Main navbar -->
<div class="navbar navbar-inverse"> <div class="navbar navbar-inverse">
<div class="navbar-header"> <div class="navbar-header">
<a class="navbar-brand" href="{% url 'apps:dashboard' %}"> <a class="navbar-brand gradient-text " href="{% url 'apps:dashboard' %}">
<!-- <h3>NationalAddress</h3> --> <!-- <h3>NationalAddress</h3> -->
<i class=" icon-location4"></i> <i>
<b>&nbsp;&nbsp;OKU-GISs</b> <img src="{% static 'img/logo-ok.png' %}" alt="" style="position: absolute;
width: 26px;
top: 7px;">
</i>
<!-- <i class="icon-location4 fa-gradient"></i> -->
<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Teman-KU
</b> (Sistem Informasi Pembangunan OKU)
</a> </a>
<ul class="nav navbar-nav pull-right visible-xs-block"> <ul class="nav navbar-nav pull-right visible-xs-block">
<li><a data-toggle="collapse" data-target="#navbar-mobile"><i class="icon-tree5"></i></a></li> <li><a data-toggle="collapse" data-target="#navbar-mobile"><i class="icon-tree5"></i></a></li>
</ul> </ul>
...@@ -260,12 +267,10 @@ ...@@ -260,12 +267,10 @@
{% if user.isactive == True %} {% if user.isactive == True %}
<span class="label label-success"> <span class="label label-success">
Active Active
</span> </span> {% else %}
{% else %}
<span class="label label-danger"> <span class="label label-danger">
Inactive Inactive
</span> </span> {% endif %}
{% endif %}
</td> </td>
<td class="text-center"> <td class="text-center">
<ul class="icons-list"> <ul class="icons-list">
...@@ -275,7 +280,7 @@ ...@@ -275,7 +280,7 @@
</a> </a>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a onclick="switchuserstatus('{{user.id}}, {{user.isactive}}')" ><i class="icon-user-block"></i> Switch user status</a></li> <li><a onclick="switchuserstatus('{{user.id}}, {{user.isactive}}')"><i class="icon-user-block"></i> Switch user status</a></li>
<li><a onclick="loaduserbyid('{{user.id}}')"><i class="icon-users"></i> Edit user</a></li> <li><a onclick="loaduserbyid('{{user.id}}')"><i class="icon-users"></i> Edit user</a></li>
</ul> </ul>
</li> </li>
...@@ -320,7 +325,7 @@ ...@@ -320,7 +325,7 @@
<hr style="margin-top: 0px;"> <hr style="margin-top: 0px;">
<div class="panel-body"> <div class="panel-body">
<table class="table table-responsive datatable-groups table-sm" id="usergroup" > <table class="table table-responsive datatable-groups table-sm" id="usergroup">
<thead> <thead>
<tr> <tr>
<th>No.</th> <th>No.</th>
...@@ -341,7 +346,7 @@ ...@@ -341,7 +346,7 @@
</a> </a>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a onclick="deletegroup('{{group.id}}', '{{group.name}}')" ><i class="icon-user-block"></i> Delete group</a></li> <li><a onclick="deletegroup('{{group.id}}', '{{group.name}}')"><i class="icon-user-block"></i> Delete group</a></li>
<li><a onclick="showmodalgroup('{{group.id}}', '{{group.name}}')"><i class="icon-users"></i> Edit group</a></li> <li><a onclick="showmodalgroup('{{group.id}}', '{{group.name}}')"><i class="icon-users"></i> Edit group</a></li>
</ul> </ul>
</li> </li>
...@@ -378,36 +383,36 @@ ...@@ -378,36 +383,36 @@
<div class="row"> <div class="row">
<div class="form-group"> <div class="form-group">
<label class="col-lg-3 control-label lbl-top" >Username</label> <label class="col-lg-3 control-label lbl-top">Username</label>
<div class="col-lg-9"> <div class="col-lg-9">
<input id="inUsername" type="text" class="form-control" value=""required> <input id="inUsername" type="text" class="form-control" value="" required>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="form-group"> <div class="form-group">
<label class="col-lg-3 control-label lbl-top" >First Name</label> <label class="col-lg-3 control-label lbl-top">First Name</label>
<div class="col-lg-9"> <div class="col-lg-9">
<input id="inNameF" type="text" class="form-control" value=""required> <input id="inNameF" type="text" class="form-control" value="" required>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="form-group"> <div class="form-group">
<label class="col-lg-3 control-label lbl-top" >Last Name</label> <label class="col-lg-3 control-label lbl-top">Last Name</label>
<div class="col-lg-9"> <div class="col-lg-9">
<input id="inNameL" type="text" class="form-control" value=""required> <input id="inNameL" type="text" class="form-control" value="" required>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="form-group"> <div class="form-group">
<label class="col-lg-3 control-label lbl-top" >Email</label> <label class="col-lg-3 control-label lbl-top">Email</label>
<div class="col-lg-9"> <div class="col-lg-9">
<input id="inEmail" type="text" class="form-control" value=""required> <input id="inEmail" type="text" class="form-control" value="" required>
</div> </div>
</div> </div>
</div> </div>
...@@ -431,8 +436,8 @@ ...@@ -431,8 +436,8 @@
<div class="row"> <div class="row">
<div class="form-group" style="margin-top: 10px !important;"> <div class="form-group" style="margin-top: 10px !important;">
<label class="col-lg-3 control-label lbl-top" >Groups</label> <label class="col-lg-3 control-label lbl-top">Groups</label>
<div class="col-lg-9" > <div class="col-lg-9">
<select style="border-bottom: 1px solid rgb(83, 83, 83) !important;" id="select_group" data-placeholder="select group.." class="select-size-xs"> <select style="border-bottom: 1px solid rgb(83, 83, 83) !important;" id="select_group" data-placeholder="select group.." class="select-size-xs">
<option></option> <option></option>
</select> </select>
...@@ -463,9 +468,9 @@ ...@@ -463,9 +468,9 @@
<div class="row"> <div class="row">
<div class="form-group"> <div class="form-group">
<label class="col-lg-3 control-label lbl-top" >Nama Group</label> <label class="col-lg-3 control-label lbl-top">Nama Group</label>
<div class="col-lg-9"> <div class="col-lg-9">
<input id="inGroupName" type="text" class="form-control" value=""required> <input id="inGroupName" type="text" class="form-control" value="" required>
</div> </div>
</div> </div>
</div> </div>
...@@ -474,8 +479,8 @@ ...@@ -474,8 +479,8 @@
<div class="row" id="container_sparent"> <div class="row" id="container_sparent">
<div class="form-group" style="margin-top: 10px !important;"> <div class="form-group" style="margin-top: 10px !important;">
<label class="col-lg-3 control-label lbl-top" >Group Parent</label> <label class="col-lg-3 control-label lbl-top">Group Parent</label>
<div class="col-lg-9" > <div class="col-lg-9">
<select style="border-bottom: 1px solid rgb(83, 83, 83) !important;" id="select_group_parent" data-placeholder="select group.." class="select-size-xs"> <select style="border-bottom: 1px solid rgb(83, 83, 83) !important;" id="select_group_parent" data-placeholder="select group.." class="select-size-xs">
<option></option> <option></option>
</select> </select>
...@@ -614,28 +619,27 @@ ...@@ -614,28 +619,27 @@
const urlParams = new URLSearchParams(queryString); const urlParams = new URLSearchParams(queryString);
const page = urlParams.get('page') const page = urlParams.get('page')
if(page == "group"){ if (page == "group") {
$("#usergroup").css("display", "block"); $("#usergroup").css("display", "block");
$("#info-maps").css("display", "none"); $("#info-maps").css("display", "none");
}else{ } else {
$("#usergroup").css("display", "none"); $("#usergroup").css("display", "none");
$("#info-maps").css("display", "block"); $("#info-maps").css("display", "block");
} }
function destroyfade(){ function destroyfade() {
$(".modal-backdrop").css("display","none") $(".modal-backdrop").css("display", "none")
$(".modal-backdrop").removeClass('show'); $(".modal-backdrop").removeClass('show');
$("body").css('padding-right','0px !important') $("body").css('padding-right', '0px !important')
} }
$('.datatable-show-all').DataTable({ $('.datatable-show-all').DataTable({
autoWidth: false, autoWidth: false,
columnDefs: [ columnDefs: [{
{
orderable: false, orderable: false,
width: '20px', width: '20px',
targets: [ 0 ], targets: [0],
}, },
// { // {
...@@ -645,21 +649,19 @@ ...@@ -645,21 +649,19 @@
{ {
orderable: false, orderable: false,
width: '20px', width: '20px',
targets: [ 6 ], targets: [6],
}, }, {
{
orderable: false, orderable: false,
width: '20px', width: '20px',
targets: [ 7 ], targets: [7],
}, },
], ],
dom: '<"float-left"B>frtip', dom: '<"float-left"B>frtip',
buttons: [ buttons: [{
{
text: 'Tambah User', text: 'Tambah User',
action: function ( e, dt, node, config ) { action: function(e, dt, node, config) {
$("#modalAddButton").click() $("#modalAddButton").click()
$("#inUsername").attr("disabled", false); $("#inUsername").attr("disabled", false);
$("#inUsername").val(null); $("#inUsername").val(null);
...@@ -670,15 +672,19 @@ ...@@ -670,15 +672,19 @@
$(".modstit").html("Tambah User") $(".modstit").html("Tambah User")
loadGroups(null) loadGroups(null)
} }
} }],
],
language: { language: {
search: '<span>Filter:</span> _INPUT_', search: '<span>Filter:</span> _INPUT_',
searchPlaceholder: 'Type to filter...', searchPlaceholder: 'Type to filter...',
lengthMenu: '<span>Show:</span> _MENU_', lengthMenu: '<span>Show:</span> _MENU_',
paginate: { 'first': 'First', 'last': 'Last', 'next': '&rarr;', 'previous': '&larr;' } paginate: {
'first': 'First',
'last': 'Last',
'next': '&rarr;',
'previous': '&larr;'
}
}, },
drawCallback: function () { drawCallback: function() {
$(this).find('tbody tr').slice(-3).find('.dropdown, .btn-group').addClass('dropup'); $(this).find('tbody tr').slice(-3).find('.dropdown, .btn-group').addClass('dropup');
}, },
preDrawCallback: function() { preDrawCallback: function() {
...@@ -690,23 +696,19 @@ ...@@ -690,23 +696,19 @@
$('.datatable-groups').DataTable({ $('.datatable-groups').DataTable({
autoWidth: false, autoWidth: false,
columnDefs: [ columnDefs: [{
{
orderable: false, orderable: false,
width: '100px', width: '100px',
targets: [ 2 ] targets: [2]
}, }, {
{
orderable: false, orderable: false,
width: '100px', width: '100px',
targets: [ 0 ] targets: [0]
} }],
],
dom: '<"float-left"B>frtip', dom: '<"float-left"B>frtip',
buttons: [ buttons: [{
{
text: 'Tambah Group', text: 'Tambah Group',
action: function ( e, dt, node, config ) { action: function(e, dt, node, config) {
$("#modalAddButtong").click(); $("#modalAddButtong").click();
$("#idgroup").val(null); $("#idgroup").val(null);
$(".modstitg").html("Tambah Group") $(".modstitg").html("Tambah Group")
...@@ -714,15 +716,19 @@ ...@@ -714,15 +716,19 @@
$("#container_sparent").css("display", "block") $("#container_sparent").css("display", "block")
loadGroups(null) loadGroups(null)
} }
} }],
],
language: { language: {
search: '<span>Filter:</span> _INPUT_', search: '<span>Filter:</span> _INPUT_',
searchPlaceholder: 'Type to filter...', searchPlaceholder: 'Type to filter...',
lengthMenu: '<span>Show:</span> _MENU_', lengthMenu: '<span>Show:</span> _MENU_',
paginate: { 'first': 'First', 'last': 'Last', 'next': '&rarr;', 'previous': '&larr;' } paginate: {
'first': 'First',
'last': 'Last',
'next': '&rarr;',
'previous': '&larr;'
}
}, },
drawCallback: function () { drawCallback: function() {
$(this).find('tbody tr').slice(-3).find('.dropdown, .btn-group').addClass('dropup'); $(this).find('tbody tr').slice(-3).find('.dropdown, .btn-group').addClass('dropup');
}, },
preDrawCallback: function() { preDrawCallback: function() {
...@@ -731,21 +737,21 @@ ...@@ -731,21 +737,21 @@
}); });
$("#modalAddButton").click(function(){ $("#modalAddButton").click(function() {
$("body").css("padding-right","0px !important") $("body").css("padding-right", "0px !important")
}) })
$("#saveuser").on("click", function(){ $("#saveuser").on("click", function() {
addUser() addUser()
}) })
function addUser(){ function addUser() {
var isObject = {}; var isObject = {};
var ars = '' var ars = ''
var group = $("#select_group").val(); var group = $("#select_group").val();
var iduser = $("#iduser").val(); var iduser = $("#iduser").val();
console.log(group); console.log(group);
if(iduser){ if (iduser) {
isObject.id = iduser; isObject.id = iduser;
} }
...@@ -776,25 +782,25 @@ ...@@ -776,25 +782,25 @@
success: function(data) { success: function(data) {
let response = data; let response = data;
if(response.code == 0){ if (response.code == 0) {
$("#modal_theme_info").modal('toggle'); $("#modal_theme_info").modal('toggle');
destroyfade(); destroyfade();
swal({ swal({
title : response.info, title: response.info,
text : response.data, text: response.data,
type : "success", type: "success",
icon : "success", icon: "success",
confirmButtonColor: "#00BCD4" confirmButtonColor: "#00BCD4"
}).then((isok) => { }).then((isok) => {
location.reload(); location.reload();
}) })
}else{ } else {
swal({ swal({
title : response.info, title: response.info,
text : response.data, text: response.data,
type : "alert", type: "alert",
icon : "error", icon: "error",
confirmButtonColor: "#00BCD4" confirmButtonColor: "#00BCD4"
}) })
...@@ -803,11 +809,11 @@ ...@@ -803,11 +809,11 @@
}); });
} }
$("#select_group").on("click", function(e){ $("#select_group").on("click", function(e) {
e.preventDefault() e.preventDefault()
}) })
function loadGroups(isSelect){ function loadGroups(isSelect) {
var isObject = {} var isObject = {}
console.log(isSelect) console.log(isSelect)
isObject.func_name = "loadGroups"; isObject.func_name = "loadGroups";
...@@ -821,28 +827,28 @@ ...@@ -821,28 +827,28 @@
let response = data; let response = data;
console.log(response) console.log(response)
if(response.code == 0){ if (response.code == 0) {
var groups = response.data; var groups = response.data;
var html = `<option value="null" selected disabled>-- Pilih Group --</option>`; var html = `<option value="null" selected disabled>-- Pilih Group --</option>`;
for(i in groups){ for (i in groups) {
if(isSelect){ if (isSelect) {
if(isSelect.length>=1){ if (isSelect.length >= 1) {
for(j in isSelect){ for (j in isSelect) {
if(isSelect[j] == groups[i]){ if (isSelect[j] == groups[i]) {
html += `<option value="`+groups[i]+`" selected>`+groups[i]+`</option>`; html += `<option value="` + groups[i] + `" selected>` + groups[i] + `</option>`;
console.log(groups[i]) console.log(groups[i])
}else{ } else {
html += `<option value="`+groups[i]+`">`+groups[i]+`</option>`; html += `<option value="` + groups[i] + `">` + groups[i] + `</option>`;
} }
} }
}else{ } else {
html += `<option value="`+groups[i]+`">`+groups[i]+`</option>`; html += `<option value="` + groups[i] + `">` + groups[i] + `</option>`;
} }
}else{ } else {
html += `<option value="`+groups[i]+`">`+groups[i]+`</option>`; html += `<option value="` + groups[i] + `">` + groups[i] + `</option>`;
} }
} }
...@@ -850,7 +856,7 @@ ...@@ -850,7 +856,7 @@
$("#select_group").html(html); $("#select_group").html(html);
$("#select_group_parent").html(html); $("#select_group_parent").html(html);
console.log(html) console.log(html)
}else{ } else {
$("#select_group").html("group tidak tersedia"); $("#select_group").html("group tidak tersedia");
$("#select_group_parent").html("group tidak tersedia"); $("#select_group_parent").html("group tidak tersedia");
} }
...@@ -860,7 +866,7 @@ ...@@ -860,7 +866,7 @@
} }
function switchuserstatus(id, isactive){ function switchuserstatus(id, isactive) {
var isObject = {} var isObject = {}
var params = id.split(","); var params = id.split(",");
...@@ -868,16 +874,16 @@ ...@@ -868,16 +874,16 @@
isObject.stat = params[1].replace(" ", ""); isObject.stat = params[1].replace(" ", "");
console.log(params) console.log(params)
if(isObject.stat == "True"){ if (isObject.stat == "True") {
var title = "Nonaktifkan"; var title = "Nonaktifkan";
var text = "User tidak akan bisa login jika dinonaktifkan!"; var text = "User tidak akan bisa login jika dinonaktifkan!";
}else{ } else {
var title = "Aktifkan"; var title = "Aktifkan";
var text = "User dapat kembali login jika diaktifkan!"; var text = "User dapat kembali login jika diaktifkan!";
} }
swal({ swal({
title: title+" user?", title: title + " user?",
text: text, text: text,
type: "warning", type: "warning",
showCancelButton: true, showCancelButton: true,
...@@ -886,7 +892,7 @@ ...@@ -886,7 +892,7 @@
cancelButtonText: "Tidak!", cancelButtonText: "Tidak!",
closeOnConfirm: false, closeOnConfirm: false,
closeOnCancel: false closeOnCancel: false
}).then((isConfirm) =>{ }).then((isConfirm) => {
console.log(isConfirm) console.log(isConfirm)
if (isConfirm.value) { if (isConfirm.value) {
...@@ -899,22 +905,22 @@ ...@@ -899,22 +905,22 @@
let response = data; let response = data;
if(isObject.stat == "True"){ if (isObject.stat == "True") {
var inf = "dinonaktifkan" var inf = "dinonaktifkan"
}else{ } else {
var inf = "diaktifkan" var inf = "diaktifkan"
} }
if(response.code == 0){ if (response.code == 0) {
swal({ swal({
title : "sukses", title: "sukses",
text : "User berhasil "+inf, text: "User berhasil " + inf,
type : "success", type: "success",
icon : "success", icon: "success",
confirmButtonColor: "#00BCD4" confirmButtonColor: "#00BCD4"
}).then((isok) => { }).then((isok) => {
location.reload(); location.reload();
}) })
}else{ } else {
alert("no data in database") alert("no data in database")
} }
...@@ -927,7 +933,7 @@ ...@@ -927,7 +933,7 @@
} }
function loaduserbyid(id){ function loaduserbyid(id) {
var isObject = {}; var isObject = {};
$(".modstit").html("Update User") $(".modstit").html("Update User")
$("#inUsername").attr("disabled", true) $("#inUsername").attr("disabled", true)
...@@ -944,21 +950,21 @@ ...@@ -944,21 +950,21 @@
let response = data; let response = data;
if(response.code == 0){ if (response.code == 0) {
var user = response.data; var user = response.data;
console.log(user) console.log(user)
$("#inUsername").val(user.username); $("#inUsername").val(user.username);
$("#inNameF").val(user.firstname); $("#inNameF").val(user.firstname);
$("#inNameL").val(user.lastname); $("#inNameL").val(user.lastname);
$("#inEmail").val(user.email); $("#inEmail").val(user.email);
if(user.is_staff){ if (user.is_staff) {
$('input[name=isStaff][value=true]').attr('checked', true) $('input[name=isStaff][value=true]').attr('checked', true)
}else{ } else {
$('input[name=isStaff][value=false]').attr('checked', true) $('input[name=isStaff][value=false]').attr('checked', true)
} }
loadGroups(user.group) loadGroups(user.group)
$("#modalAddButton").click() $("#modalAddButton").click()
}else{ } else {
} }
...@@ -977,18 +983,18 @@ ...@@ -977,18 +983,18 @@
} }
}; };
$("#savegroup").on("click", function(){ $("#savegroup").on("click", function() {
addGroup(); addGroup();
}) })
function addGroup(){ function addGroup() {
var isObject = {} var isObject = {}
var idgroup = $("#idgroup").val(); var idgroup = $("#idgroup").val();
isObject.parent = $("#select_group_parent").val() isObject.parent = $("#select_group_parent").val()
isObject.name = $("#inGroupName").val(); isObject.name = $("#inGroupName").val();
if(idgroup){ if (idgroup) {
isObject.id = idgroup; isObject.id = idgroup;
} }
...@@ -1002,25 +1008,25 @@ ...@@ -1002,25 +1008,25 @@
success: function(data) { success: function(data) {
let response = data; let response = data;
if(response.code == 0){ if (response.code == 0) {
$("#modal_group").modal('toggle'); $("#modal_group").modal('toggle');
destroyfade(); destroyfade();
swal({ swal({
title : response.info, title: response.info,
text : response.data, text: response.data,
type : "success", type: "success",
icon : "success", icon: "success",
confirmButtonColor: "#00BCD4" confirmButtonColor: "#00BCD4"
}).then((isok) => { }).then((isok) => {
window.location.href = window.location.origin+"/usermanagement/?page=group" window.location.href = window.location.origin + "/usermanagement/?page=group"
}) })
}else{ } else {
swal({ swal({
title : response.info, title: response.info,
text : response.data, text: response.data,
type : "alert", type: "alert",
icon : "error", icon: "error",
confirmButtonColor: "#00BCD4" confirmButtonColor: "#00BCD4"
}) })
...@@ -1029,7 +1035,7 @@ ...@@ -1029,7 +1035,7 @@
}); });
} }
function showmodalgroup(id, name){ function showmodalgroup(id, name) {
console.log(id); console.log(id);
console.log(name); console.log(name);
...@@ -1048,12 +1054,12 @@ ...@@ -1048,12 +1054,12 @@
success: function(data) { success: function(data) {
let response = data; let response = data;
if(response.code == 0){ if (response.code == 0) {
var datas = response.data var datas = response.data
if(datas.length == 0){ if (datas.length == 0) {
$("#container_sparent").css("display", "none") $("#container_sparent").css("display", "none")
}else{ } else {
$("#container_sparent").css("display", "block") $("#container_sparent").css("display", "block")
} }
...@@ -1061,12 +1067,12 @@ ...@@ -1061,12 +1067,12 @@
$("#modalAddButtong").click(); $("#modalAddButtong").click();
}else{ } else {
swal({ swal({
title : response.info, title: response.info,
text : response.data, text: response.data,
type : "alert", type: "alert",
icon : "error", icon: "error",
confirmButtonColor: "#00BCD4" confirmButtonColor: "#00BCD4"
}) })
...@@ -1076,7 +1082,7 @@ ...@@ -1076,7 +1082,7 @@
} }
function deletegroup(id, group){ function deletegroup(id, group) {
var isObject = {} var isObject = {}
var params = id; var params = id;
...@@ -1084,7 +1090,7 @@ ...@@ -1084,7 +1090,7 @@
swal({ swal({
title: "Hapus group?", title: "Hapus group?",
text: "Group "+group+" akan dihapus", text: "Group " + group + " akan dihapus",
type: "warning", type: "warning",
showCancelButton: true, showCancelButton: true,
confirmButtonClass: "btn-danger", confirmButtonClass: "btn-danger",
...@@ -1092,7 +1098,7 @@ ...@@ -1092,7 +1098,7 @@
cancelButtonText: "Tidak!", cancelButtonText: "Tidak!",
closeOnConfirm: false, closeOnConfirm: false,
closeOnCancel: false closeOnCancel: false
}).then((isConfirm) =>{ }).then((isConfirm) => {
console.log(isConfirm) console.log(isConfirm)
if (isConfirm.value) { if (isConfirm.value) {
...@@ -1105,17 +1111,17 @@ ...@@ -1105,17 +1111,17 @@
let response = data; let response = data;
if(response.code == 0){ if (response.code == 0) {
swal({ swal({
title : "sukses", title: "sukses",
text : "Group berhasil dihapus", text: "Group berhasil dihapus",
type : "success", type: "success",
icon : "success", icon: "success",
confirmButtonColor: "#00BCD4" confirmButtonColor: "#00BCD4"
}).then((isok) => { }).then((isok) => {
location.reload(); location.reload();
}) })
}else{ } else {
alert("no data in database") alert("no data in database")
} }
......
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