js-m.html 579 KB
Newer Older
Muhamad's avatar
Muhamad committed
1 2
{% for group in user.groups.all %} {% if group.name == 'Superadmin' %}
<style>
Muhamad's avatar
Muhamad committed
3
    .leaflet-popup {
4 5
        display: block;
    }
Muhamad's avatar
Muhamad committed
6
    
Muhamad's avatar
Muhamad committed
7 8 9 10 11 12 13 14 15 16 17
    #btn_edit_kelurahan {
        display: block;
    }
    
    #btn_edit_tuplah {
        display: block;
    }
    
    #btn_edit_bangunan {
        display: block;
    }
Muhamad's avatar
Muhamad committed
18
    
19 20 21
    #btn_delete_bangunan {
        display: block;
    }
Muhamad's avatar
Muhamad committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
    
    #btn_jalan {
        display: block;
    }
    
    #btn_edit_gl {
        display: block;
    }
    
    #btn_edit_rs {
        display: block;
    }
    
    #btn_edit_puskes {
        display: block;
    }
    
    #btn_edit_lk {
        display: block;
    }
    
    #btn_edit_cb {
        display: block;
    }
    
    #btn_edit_adm {
        display: block;
    }
Muhamad's avatar
Muhamad committed
50
    
51 52 53
    #btn_delete_adm {
        display: block;
    }
Muhamad's avatar
Muhamad committed
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
    
    #btn_edit_sp {
        display: block;
    }
    
    #btn_edit_spbu {
        display: block;
    }
    
    #btn_edit_st {
        display: block;
    }
    
    #btn_edit_tr {
        display: block;
    }
    
    #btn_edit_si {
        display: block;
    }
Muhamad's avatar
Muhamad committed
74
    
75 76 77
    #btn_detail_per_bang {
        display: block;
    }
Muhamad's avatar
Muhamad committed
78
    
79 80 81
    #btn_perbaikan_bangunan {
        display: block;
    }
Muhamad's avatar
Muhamad committed
82
    
83 84 85 86
    #btn_upload_tampak {
        display: block;
    }
    
Muhamad's avatar
Muhamad committed
87
    .leaflet-popup {
88 89
        display: block;
    }
Muhamad's avatar
Muhamad committed
90 91
</style>

Muhamad's avatar
b  
Muhamad committed
92
<script>
93
    //suk
94 95
    // var kantor_administrasi = "{{ kantor_administrasi }}".replace(/&#x27;/g, '"');
    // var result_kan_adm = JSON.parse("" + kantor_administrasi + "")
Muhamad's avatar
Muhamad committed
96

Muhamad's avatar
b  
Muhamad committed
97 98 99 100 101 102 103 104 105

    geo_po_adm = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            // console.log(feature.administrasi.f1)
            if (feature.administrasi.f2 == 'Kantor Polisi') {
                var smallIcon = new L.Icon({
                    iconSize: [25, 25],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
106
                    iconUrl: 'static/img/icon-1/Buildings-tes.svg'
Muhamad's avatar
Muhamad committed
107 108 109 110
                        // iconUrl: 'static/img/icon/police.svg',
                        // shadowUrl: 'static/img/icon/shadow.svg',
                        // shadowSize: [38, 38],
                        // shadowAnchor: [20, 32]
Muhamad's avatar
b  
Muhamad committed
111 112 113 114
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Muhamad's avatar
Muhamad committed
115

Manggar Mahardhika's avatar
Manggar Mahardhika committed
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
133 134
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
135 136
                    direction: 'top',
                    offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
137 138 139 140
                });
                return marker
            } else if (feature.administrasi.f2 == 'Instalasi TNI (AD/AL/AU)') {
                var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
141
                    iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
142 143
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
144
                    iconUrl: 'static/img/icon-1/Buildings-tes.svg'
Muhamad's avatar
Muhamad committed
145 146 147 148
                        // iconUrl: 'static/img/icon/tni.svg',
                        // shadowUrl: 'static/img/icon/shadow.svg',
                        // shadowSize: [38, 38],
                        // shadowAnchor: [23, 32]
Muhamad's avatar
b  
Muhamad committed
149 150 151 152 153

                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Muhamad's avatar
Muhamad committed
154

Manggar Mahardhika's avatar
Manggar Mahardhika committed
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
172 173
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
174 175
                    direction: 'top',
                    offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
176 177 178 179
                });
                return marker
            } else if (feature.administrasi.f2 == 'Bangunan/Kantor Pertahanan Keamanan Lainnya') {
                var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
180
                    iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
181 182
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
183
                    iconUrl: 'static/img/icon-1/Buildings-tes.svg'
Muhamad's avatar
Muhamad committed
184 185 186 187
                        // iconUrl: 'static/img/icon/tni.svg',
                        // shadowUrl: 'static/img/icon/shadow.svg',
                        // shadowSize: [38, 38],
                        // shadowAnchor: [23, 32]
Muhamad's avatar
b  
Muhamad committed
188 189 190 191
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Muhamad's avatar
Muhamad committed
192

Manggar Mahardhika's avatar
Manggar Mahardhika committed
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
210 211
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
212 213
                    direction: 'top',
                    offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
214 215 216 217
                });
                return marker
            } else if (feature.administrasi.f2 == 'Kantor Pemerintah Lainnya') {
                var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
218
                    iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
219 220
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
221
                    iconUrl: 'static/img/icon-1/Buildings-tes.svg'
Muhamad's avatar
Muhamad committed
222 223 224 225
                        // iconUrl: 'static/img/icon/kades.svg',
                        // shadowUrl: 'static/img/icon/shadow.svg',
                        // shadowSize: [38, 38],
                        // shadowAnchor: [23, 32]
Muhamad's avatar
b  
Muhamad committed
226 227 228 229
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Muhamad's avatar
Muhamad committed
230

Manggar Mahardhika's avatar
Manggar Mahardhika committed
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
248 249
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
250 251
                    direction: 'top',
                    offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
252 253 254 255
                });
                return marker
            } else if (feature.administrasi.f2 == 'Kantor Camat') {
                var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
256
                    iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
257 258
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
259
                    iconUrl: 'static/img/icon-1/Buildings-tes.svg'
Muhamad's avatar
Muhamad committed
260 261 262 263
                        // iconUrl: 'static/img/icon/lurah.svg',
                        // shadowUrl: 'static/img/icon/shadow.svg',
                        // shadowSize: [38, 38],
                        // shadowAnchor: [23, 32]
Muhamad's avatar
b  
Muhamad committed
264 265 266 267
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Muhamad's avatar
Muhamad committed
268

Manggar Mahardhika's avatar
Manggar Mahardhika committed
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
286 287
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
288 289
                    direction: 'top',
                    offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
290 291 292 293
                });
                return marker
            } else if (feature.administrasi.f2 == 'Kantor Kepala Desa') {
                var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
294
                    iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
295 296
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
297
                    iconUrl: 'static/img/icon-1/Buildings-tes.svg'
Muhamad's avatar
Muhamad committed
298 299 300 301
                        // iconUrl: 'static/img/icon/lurah.svg',
                        // shadowUrl: 'static/img/icon/shadow.svg',
                        // shadowSize: [38, 38],
                        // shadowAnchor: [23, 32]
Muhamad's avatar
b  
Muhamad committed
302 303 304 305
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Muhamad's avatar
Muhamad committed
306

Manggar Mahardhika's avatar
Manggar Mahardhika committed
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
324 325
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
326 327
                    direction: 'top',
                    offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
328 329 330 331
                });
                return marker
            } else if (feature.administrasi.f2 == 'Kantor DPRD') {
                var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
332
                    iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
333 334
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
335
                    iconUrl: 'static/img/icon-1/Buildings-tes.svg'
Muhamad's avatar
Muhamad committed
336 337 338 339
                        // iconUrl: 'static/img/icon/lurah.svg',
                        // shadowUrl: 'static/img/icon/shadow.svg',
                        // shadowSize: [38, 38],
                        // shadowAnchor: [23, 32]
Muhamad's avatar
b  
Muhamad committed
340 341 342 343
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Muhamad's avatar
Muhamad committed
344

Manggar Mahardhika's avatar
Manggar Mahardhika committed
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
362 363
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
364 365
                    direction: 'top',
                    offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
366 367 368 369
                });
                return marker
            } else if (feature.administrasi.f2 == 'Kantor Lurah') {
                var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
370
                    iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
371 372
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
373
                    iconUrl: 'static/img/icon-1/Buildings-tes.svg'
Muhamad's avatar
Muhamad committed
374 375 376 377
                        // iconUrl: 'static/img/icon/lurah.svg',
                        // shadowUrl: 'static/img/icon/shadow.svg',
                        // shadowSize: [38, 38],
                        // shadowAnchor: [23, 32]
Muhamad's avatar
b  
Muhamad committed
378 379 380 381
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Muhamad's avatar
Muhamad committed
382

Manggar Mahardhika's avatar
Manggar Mahardhika committed
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
400 401
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
402 403
                    direction: 'top',
                    offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
404 405 406 407
                });
                return marker
            } else if (feature.administrasi.f2 == 'Lembaga Pemasyarakatan') {
                var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
408
                    iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
409 410
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
411
                    iconUrl: 'static/img/icon-1/Buildings-tes.svg'
Muhamad's avatar
Muhamad committed
412 413 414 415
                        // iconUrl: 'static/img/icon/pemerintahan_lain.svg',
                        // shadowUrl: 'static/img/icon/shadow.svg',
                        // shadowSize: [38, 38],
                        // shadowAnchor: [23, 32]
Muhamad's avatar
b  
Muhamad committed
416 417 418 419
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Muhamad's avatar
Muhamad committed
420

Manggar Mahardhika's avatar
Manggar Mahardhika committed
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
438 439
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
440 441
                    direction: 'top',
                    offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
442 443 444 445
                });
                return marker
            } else if (feature.administrasi.f2 == 'Kantor Bupati') {
                var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
446
                    iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
447 448
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
449
                    iconUrl: 'static/img/icon-1/Buildings-tes.svg'
Muhamad's avatar
Muhamad committed
450 451 452 453
                        // iconUrl: 'static/img/icon/lurah.svg',
                        // shadowUrl: 'static/img/icon/shadow.svg',
                        // shadowSize: [38, 38],
                        // shadowAnchor: [23, 32]
Muhamad's avatar
b  
Muhamad committed
454 455 456 457
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Muhamad's avatar
Muhamad committed
458

Manggar Mahardhika's avatar
Manggar Mahardhika committed
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
476 477
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
478 479
                    direction: 'top',
                    offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
480 481
                });
                return marker
Muhamad's avatar
Muhamad committed
482
            } else if (feature.administrasi.f2 == 'none') {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
483
                var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
484
                    iconSize: [25, 25],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
485 486
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
487
                    iconUrl: 'static/img/icon-1/Buildings-tes.svg'
Muhamad's avatar
Muhamad committed
488 489 490 491
                        // iconUrl: 'static/img/icon/lurah.svg',
                        // shadowUrl: 'static/img/icon/shadow.svg',
                        // shadowSize: [38, 38],
                        // shadowAnchor: [23, 32]
Manggar Mahardhika's avatar
Manggar Mahardhika committed
492 493 494 495
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Muhamad's avatar
Muhamad committed
496

Manggar Mahardhika's avatar
Manggar Mahardhika committed
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
514 515
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
516 517
                    direction: 'top',
                    offset: [0, -25]
Manggar Mahardhika's avatar
Manggar Mahardhika committed
518 519 520
                });
                return marker
            }
Muhamad's avatar
Muhamad committed
521 522 523 524
        },
        onEachFeature: function(feature, layer) {
            layer.on({
                click: function(e) {
525 526
                    $("#modal_detail_non_kelurahan").modal('show');

Muhamad's avatar
Muhamad committed
527 528 529 530 531
                    var tay;
                    var geocodeService = L.esri.Geocoding.geocodeService();
                    var geocoderNominatim = new L.Control.Geocoder.Nominatim();
                    var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
                        tay = result.address.Address;
532
                        // aladije(result.address.Address)
Muhamad's avatar
Muhamad committed
533 534 535 536 537 538
                        if (feature.administrasi.f3 == 'alamat') {
                            if (tay != '') {
                                var alamak = tay;

                            } else {
                                alamak = ""
Manggar Mahardhika's avatar
Manggar Mahardhika committed
539 540
                            }

Muhamad's avatar
Muhamad committed
541 542 543 544 545 546 547 548 549 550
                        } else {
                            var alamak = feature.administrasi.f3;

                        }
                        if (feature.administrasi.f10 == 'Bpk') {
                            var raja = "";
                        } else {
                            var raja = feature.administrasi.f10;
                        }

Manggar Mahardhika's avatar
Manggar Mahardhika committed
551
                        if (feature.administrasi.f8 == 'None') {
552
                            var gmb = "static/img/image_null.png";
Manggar Mahardhika's avatar
Manggar Mahardhika committed
553
                        } else {
554
                            var gmb = "static/img/image/" + feature.administrasi.f8;
Manggar Mahardhika's avatar
Manggar Mahardhika committed
555 556
                        }

557 558 559 560 561 562 563
                        $(".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 + `
                                                        </span>
                                                    </div>
564
                                                    <div>
565 566 567 568 569 570 571 572
                                                        <span>
                                                            ` +
                            alamak + `, ` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `, ` + feature.administrasi.f12 + `
                                                        </span>
                                                    </div>

                                                    `)

Muhamad's avatar
Muhamad committed
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596
                        if (feature.administrasi.f16 != "None") {
                            var list_history = feature.administrasi.f16
                            console.log(list_history[0].split(",")[0])
                            var perbaikan_pt = `<div class='row'>
                                                            
                                                            <label class="col-md-8">` + list_history[0].split(",")[1] + `</label>
                                                            
                                
                                                            <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>
                                                        <a class="col-md-6" class="btn" id="btn_perbaikan_jalan"><i>Input Perbaikan</i></a>`

                        } else {
                            var perbaikan_pt = `<div class='row'>
                                                            <div class="col-md-6">
                                                                <label class="col-md-6">Null</label>
                                                            </div>
                                                            
                                                        </div>
                                                        <a class="col-md-6" class="btn" id="btn_perbaikan_jalan"><i>Input Perbaikan</i></a>
                                                        `
                        }

597 598 599 600 601 602 603 604 605
                        $(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
                                                    <input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
                                                    <div>
                                                        <div>
                                                            <span>Jenis Bangunan</span>
                                                        </div>
                                                        <div>
                                                            <span>
                                                                ` + feature.administrasi.f2 + `
606
                                                            </span>
607
                                                        </div>
608
                                                    </div>
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624
                                                    <div>
                                                        <div>
                                                            <span>Luas</span>
                                                        </div>
                                                        <div>
                                                            <span style="font-family: 'Roboto';">` + feature.administrasi.f5 + ` m</span>
                                                        </div>
                                                    </div>

                                                    <div>
                                                        <div>
                                                            <span>Pimpinan</span>
                                                        </div>
                                                        <div>
                                                            <span>` + raja + `</span>
                                                        </div>
Muhamad's avatar
Muhamad committed
625
                                                    </div>
626
                                                    
Muhamad's avatar
Muhamad committed
627 628 629
                                                    
                                                    
                                                    `);
630 631 632 633 634 635 636 637

                        $(".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_adm" 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>
                                                        <div class="tombol-delete-keterangan text-center" style="background-color: indianred;position: absolute;width: 40px;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
                                                            <a href="#" id="btn_delete_adm" data-toggle="modal" data-target="#modald_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="Delete"><i class="icon-eraser2"></i></a>
                                                        </div>
                                                        `)
Muhamad's avatar
Muhamad committed
638 639 640 641 642 643 644
                        if (list_perm.indexOf('delete_kantor_administrasi') >= 0 === false) {
                            $(".tombol-delete-keterangan").remove();
                        }

                        if (list_perm.indexOf('change_kantor_administrasi') >= 0 === false) {
                            $(".tombol-edit-keterangan").remove();
                        }
645

Muhamad's avatar
Muhamad committed
646
                        content_delete_adm = `
647 648
                            <div class="modal-dialog md">
                                        <div class="modal-content">
649
                                            <div class="modal-header bg-info">
650 651 652
                                                    <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                                    <h6 class="modal-title">Delete Point</h6>
                                            </div>
Muhamad's avatar
Muhamad committed
653
                                            <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
Muhamad's avatar
Muhamad committed
654
                                                <div id="map-for-delete" style="width: 400px;height: 300px;position: relative;margin: 10px;"></div>
655
                                                <input style="display:none;" id="id_adm_del" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
Muhamad's avatar
Muhamad committed
656 657
                                                <input style="display:none;" id="nama_table" type="text" class="form-control" value="geo_kantor_administrasi" required>
                                                
658 659 660 661
                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                        <div class="col-lg-9">
662
                                                            <input id="namobj_adm_del" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required>    
663 664 665 666 667 668 669 670 671
                                                        </div>
                                                        
                                                    </div>
                                                </div>

                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                        <div class="col-lg-8">
672
                                                            <select id="remark_adm_del" style="margin-top: 15px;">
673 674 675 676 677 678 679 680 681
                                                                <option>` + feature.administrasi.f2 + `</option>
                                                            </select>
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>
                                            <hr>
                                            <div class="modal-footer">
Muhamad's avatar
Muhamad committed
682
                                                
Muhamad's avatar
Muhamad committed
683
                                                <button type="button" class="btn btn-info" id="deletepointot">Hapus</button>
684 685 686
                                            </div>
                                        </div>
                                    </div>`;
Muhamad's avatar
Muhamad committed
687
                        content_edit_adm = `
688
                            <div class="modal-dialog md">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
689
                                        <div class="modal-content">
690
                                            <div class="modal-header bg-info">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
691 692 693 694 695 696 697 698 699
                                                    <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                                    <h6 class="modal-title">Edit Point</h6>
                                            </div>
                                                
                                                <div class="tab-pane has-padding" id="panel-tab2">
                                                    <div class="tab-pane" id="bottom-justified-data">

                                                        <div class="tabbable">
                                                            <ul class="nav nav-tabs nav-tabs-bottom nav-justified">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
700 701
                                                                <li onclick="changetabs(this)" class="active"><a href="#left-tab1-feas-upli" data-toggle="tab">Koordinat</a></li>
                                                                <li onclick="changetabs(this)" ><a href="#right-tab2-feas-upli" data-toggle="tab">Informasi Umum</a></li>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
702 703 704 705
                                                            </ul>

                                                            <div class="tab-content">

Manggar Mahardhika's avatar
Manggar Mahardhika committed
706
                                                                <div class="tab-pane active" id="left-tab1-feas-upli">
Muhamad's avatar
Muhamad committed
707
                                                                        <div id="map-for-edit" style="height: 300px;position: relative;margin: 10px;"></div>
708 709 710
                                                                        <div class="form-group">
                                                                            <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
                                                                            <div class="col-lg-9" style="margin-top:10px">
711
                                                                                <input type="file" id="fileadm" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
712
                                                                                <input style="display:none;" id="gambar_adm_edit" type="text" class="form-control" value="` + feature.administrasi.f8 + `"required>
713 714 715 716
                                                                            </div>
                                                                        </div>
                                                                </div>

Manggar Mahardhika's avatar
Manggar Mahardhika committed
717
                                                                <div class="tab-pane" id="right-tab2-feas-upli">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
718

Muhamad's avatar
Muhamad committed
719
                                                                    <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
720 721

                                                                                <div class="form-group">
722 723
                                                                                        <input style="display:none;" id="id_adm_edit" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                                                        <input style="display:none;" id="coordinateZoneedit_adm_edit" type="text" class="form-control" value=""required>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
724 725 726 727 728 729
                                                                                </div>

                                                                            <div class="row" style="margin-top: 15px;">
                                                                                <div class="form-group">
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                                                    <div class="col-lg-9">
730
                                                                                        <input id="namobj_adm_edit" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required>    
Manggar Mahardhika's avatar
Manggar Mahardhika committed
731 732 733 734 735 736 737 738 739
                                                                                    </div>
                                                                                    
                                                                                </div>
                                                                            </div>

                                                                            <div class="row" style="margin-top: 15px;">
                                                                                <div class="form-group">
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                                                    <div class="col-lg-8">
740
                                                                                        <select id="remark_adm_edit" style="margin-top: 15px;">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
741 742 743 744 745 746 747 748 749 750
                                                                                            <option>` + feature.administrasi.f2 + `</option>
                                                                                        </select>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                        
                                                                            <div class="row" style="margin-top: 15px;">
                                                                                <div class="form-group">
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Alamat</label>
                                                                                    <div class="col-lg-4">
751
                                                                                        <input id="alamat_adm_edit" type="text" class="form-control" value="` + alamak + `"required>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
752
                                                                                    </div>
Muhamad's avatar
Muhamad committed
753
                                                                                    <div class="col-lg-4" style="margin-top: 15px;">` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `</div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
754 755 756 757 758 759
                                                                                </div>
                                                                            </div>

                                                                            <div class="row" style="margin-top: 15px;">
                                                                                
                                                                                <div class="form-group">
760
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Luas</label>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
761
                                                                                    <div class="col-lg-6">
762
                                                                                        <input id="luas_tanah_adm_edit" type="text" class="form-control" value="` + feature.administrasi.f5 + `"required>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777
                                                                                    </div>
                                                                                    <div class="col-lg-3">
                                                                                        <select id="satuan_luas_tanah" style="margin-top: 15px;">
                                                                                            <option>m2</option>
                                                                                            <option>Km2</option>
                                                                                            <option>Hektar</option>
                                                                                        </select>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                        
                                                                            <div class="row" style="margin-top: 15px;">
                                                                                <div class="form-group">
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Pimpinan</label>
                                                                                    <div class="col-lg-9">
778
                                                                                        <input id="perangkat_adm_edit" type="text" class="form-control" value="` + raja + `"required>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
779 780 781 782 783 784 785 786 787 788 789
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                    
                                                                    </div>
                                                                </div>

                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
790

Manggar Mahardhika's avatar
Manggar Mahardhika committed
791 792 793
                                                <hr>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-info" id="saveeditadm">Save changes</button>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
794
                                                </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
795
                                        </div>
796
                                    </div>`;
797

Muhamad's avatar
Muhamad committed
798 799
                        $("#modald_adm").html(content_delete_adm)
                        $("#modal_adm").html(content_edit_adm)
Muhamad's avatar
Muhamad committed
800
                    })
Muhamad's avatar
Muhamad committed
801

Muhamad's avatar
Muhamad committed
802 803 804
                    hidelegend();
                }
            })
Muhamad's avatar
b  
Muhamad committed
805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826
        }
    });

    var markeradm = L.markerClusterGroup({
        iconCreateFunction: function(cluster) {
            var childCount = cluster.getChildCount();

            return new L.DivIcon({
                html: '<div><span>' + childCount + '</span></div>',
                className: 'marker-cluster-adm',
                iconSize: new L.Point(40, 40)
            });
        },
        //Disable all of the defaults:
        spiderfyOnMaxZoom: false,
        showCoverageOnHover: false
    });

    function geo_json_po_adm(data) {
        geo_po_adm.addData(data)
    }

827
    // geo_json_po_adm(result_kan_adm);
Muhamad's avatar
b  
Muhamad committed
828 829

    function k_adm() {
830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884
        // var checkBox = document.getElementById("knt_adm");
        // if (checkBox.checked == true) {
        //     newe(markeradm, geo_po_adm, checkBox)
        // } else {
            // markeradm.remove()
            // geo_po_adm.remove()
        //         // valket()
        // }
        // var lastZoom;
        // map.on('zoomend', function() {
        //     var zoom = map.getZoom();
        //     // console.log(zoom)
        //     if (zoom < 14 && (!lastZoom || lastZoom >= 14)) {
        //         if (checkBox.checked == true) {
        //             $.ajax({
        //                 url: "{% url 'api:kantor_administrasi'%}",
        //                 dataType: 'json',
        //                 type: 'GET',
        //                 success: function(response) {
        //                     // loaderPage(false);
        //                     // map.setView([-4.125826277307029, 104.1881561279297], 13);
        //                     // var len = response['kecamatan'].length;
        //                     // console.log(response)
        //                     var data_de = []
        //                     for (var i = 0; i < response['kantor_administrasi'].length; i++) {
        //                         geoj = response['kantor_administrasi'][i];
        //                         data_de.push(geoj);
        //                     }
        //                     // console.log(data_de)
        //                     geo_json_po_adm(data_de);
        //                 }
        //             });
        //             markeradm.addLayer(geo_po_adm);
        //             map.addLayer(markeradm);
        //             map.removeLayer(markeradm);
        //             map.addLayer(markeradm);
        //             map.removeLayer(geo_po_adm);

        //             // $("#legendapo").css('display', 'block');
        //         } else {

        //             // $("#legendapo").css('display', 'none');
        //             map.removeLayer(markeradm);
        //         }
        //     } else if (zoom >= 14 && (!lastZoom || lastZoom < 14)) {
        //         if (checkBox.checked == true) {
        //             map.removeLayer(markeradm);
        //             map.addLayer(geo_po_adm);
        //         } else {
        //             map.removeLayer(geo_po_adm);
        //         }

        //     }
        //     lastZoom = zoom;
        // })
Muhamad's avatar
b  
Muhamad committed
885 886
        var checkBox = document.getElementById("knt_adm");
        if (checkBox.checked == true) {
887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906
            // loaderPage(true);
            $.ajax({
                url: "{% url 'api:kantor_administrasi'%}",
                dataType: 'json',
                type: 'GET',
                success: function(response) {
                    // loaderPage(false);
                    // map.setView([-4.125826277307029, 104.1881561279297], 13);
                    // var len = response['kecamatan'].length;
                    // console.log(response)
                    var data_de = []
                    for (var i = 0; i < response['kantor_administrasi'].length; i++) {
                        geoj = response['kantor_administrasi'][i];
                        data_de.push(geoj);
                    }
                    // console.log(data_de)
                    geo_json_po_adm(data_de);
                    newe(markeradm, geo_po_adm, checkBox)
                }
            });
Muhamad's avatar
b  
Muhamad committed
907
        } else {
908 909
            markeradm.clearLayers()
            geo_po_adm.clearLayers()
Muhamad's avatar
b  
Muhamad committed
910 911 912 913 914
            markeradm.remove()
            geo_po_adm.remove()
        }
    }

Muhamad's avatar
Muhamad committed
915
    $(document).on("click", "#btn_edit_adm", function() {
Muhamad's avatar
Muhamad committed
916

Manggar Mahardhika's avatar
Manggar Mahardhika committed
917 918 919 920 921 922
        var map_edit = L.map('map-for-edit', {
            editable: true,
            zoomControl: false,
            drawControl: true
        }).setView([-2, 118], 5);

923
        mapss = L.tileLayer('https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
924 925 926 927
            maxZoom: 22,
            minZoom: 4,
        }).addTo(map_edit);

928
        var idka = $('#id_adm_edit').val();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
929 930 931 932 933 934 935 936 937
        loaderPage(false);
        $.ajax({
            url: "{% url 'api:editkantor' %}",
            data: {
                'id_point': idka
            },
            dataType: 'json',
            success: function(data) {
                loaderPage(false);
Muhamad's avatar
Muhamad committed
938 939 940
                setTimeout(function() {
                    map_edit.invalidateSize();
                }, 1000);
Muhamad's avatar
Muhamad committed
941
                // map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
Muhamad's avatar
Muhamad committed
942
                map_edit.setView([data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]], 19);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
943 944 945 946 947
                let dapoin = [data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]]
                var poinin = L.marker(dapoin).addTo(map_edit)
                poinin.enableEdit();
                $('#saveeditadm').click(function() {
                    var hasil = (JSON.stringify(poinin.toGeoJSON()))
948
                    $("#coordinateZoneedit_adm_edit").val(hasil);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
949 950 951 952
                })
            }
        })
    });
Muhamad's avatar
Muhamad committed
953

Manggar Mahardhika's avatar
Manggar Mahardhika committed
954
    $(document).on("click", "#saveeditadm", function() {
955 956
        var idka = $('#id_adm_edit').val();
        var poi = $('#coordinateZoneedit_adm_edit').val();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
957
        var data = new FormData();
958
        data.append("file", $("input[id^='fileadm']")[0].files[0]);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
959
        data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
Muhamad's avatar
Muhamad committed
960
        data.append('id', idka)
961 962 963 964 965
        data.append('namobj', $('#namobj_adm_edit').val())
        data.append('remark', $('#remark_adm_edit').val())
        data.append('luastanah', $('#luas_tanah_adm_edit').val())
        data.append('alamat', $('#alamat_adm_edit').val())
        data.append('perangkat', $('#perangkat_adm_edit').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
966
        data.append('point', poi),
Muhamad's avatar
Muhamad committed
967
            data.append('gambar', $('#gambar_adm_edit').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
968 969 970

        $.ajax({
            url: "{% url 'api:kantor' %}",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
971
            data: data,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
972 973
            dataType: 'json',
            type: 'POST',
Manggar Mahardhika's avatar
Manggar Mahardhika committed
974 975
            processData: false,
            contentType: false,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
976
            success: function(data) {
977 978 979 980 981 982 983 984 985
                let response = data
                if (response.status == 0) {
                    swal({
                        title: response.info,
                        text: response.data,
                        type: "success",
                        icon: "success",
                        confirmButtonColor: "#00BCD4"
                    }, function() {
Muhamad's avatar
Muhamad committed
986 987
                        $("#modal_adm").modal('hide');
                        $("#modal_detail_non_kelurahan").modal('hide')
Muhamad's avatar
Muhamad committed
988 989 990
                            // markeradm.remove()
                            // geo_po_adm.remove()
                            // valket()
Manggar Mahardhika's avatar
Manggar Mahardhika committed
991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005
                        location.reload();
                        // $.ajax({
                        //     url: "{% url 'api:reloadpoint' %}",
                        //     data: data,
                        //     dataType: 'json',
                        //     type: 'POST',
                        //     processData: false,
                        //     contentType: false,
                        //     success: function(data) {
                        //         let rel = data
                        //         geo_json_po_adm(data);
                        //         var checkBox = document.getElementById("knt_adm");
                        //         newe(markeradm, geo_po_adm, checkBox)
                        //     }
                        // })
1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031
                    })
                } else {
                    swal({
                        title: 'Error',
                        text: 'Hubungi Developer',
                        type: "warning",
                        icon: "error",
                        confirmButtonColor: "#00BCD4"
                    })
                }
            }
        })
    });

    $(document).on("click", "#btn_delete_adm", function() {
        var map_delete = L.map('map-for-delete', {
            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_delete);

1032
        var idka = $('#id_adm_del').val();
1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049
        loaderPage(false);
        $.ajax({
            url: "{% url 'api:editkantor' %}",
            data: {
                'id_point': idka
            },
            dataType: 'json',
            success: function(data) {
                loaderPage(false);
                setTimeout(function() {
                    map_delete.invalidateSize();
                }, 1000);
                console.log(data)
                    // map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
                map_delete.setView([data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]], 19);
                let dapoin = [data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]]
                var poinin = L.marker(dapoin).addTo(map_delete)
Muhamad's avatar
Muhamad committed
1050
                    // poinin.enableEdit();
1051 1052
                $('#saveeditadm').click(function() {
                    var hasil = (JSON.stringify(poinin.toGeoJSON()))
1053
                    $("#coordinateZoneedit_adm_del").val(hasil);
1054 1055 1056 1057 1058
                })
            }
        })
    });

Muhamad's avatar
Muhamad committed
1059
    $(document).on("click", "#deletepointot", function() {
1060 1061
        var idka = $('#id_adm_del').val();
        var poi = $('#coordinateZoneedit_adm_del').val();
Muhamad's avatar
Muhamad committed
1062
        var db = $('#nama_table').val();
1063 1064
        var data = new FormData();
        data.append('id', idka)
Muhamad's avatar
Muhamad committed
1065
        data.append('db', db)
1066 1067

        $.ajax({
Muhamad's avatar
Muhamad committed
1068
            url: "{% url 'api:dpoint' %}",
1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083
            data: data,
            dataType: 'json',
            type: 'POST',
            processData: false,
            contentType: false,
            success: function(data) {
                let response = data
                if (response.status == 0) {
                    swal({
                        title: response.info,
                        text: response.data,
                        type: "success",
                        icon: "success",
                        confirmButtonColor: "#00BCD4"
                    }, function() {
Muhamad's avatar
Muhamad committed
1084 1085
                        $("#modald_adm").modal('hide');
                        $("#modal_detail_non_kelurahan").modal('hide')
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1086
                        location.reload();
1087 1088 1089
                    })
                } else {
                    swal({
Muhamad's avatar
Muhamad committed
1090 1091
                        title: 'Oops',
                        text: response.data,
1092 1093 1094 1095 1096
                        type: "warning",
                        icon: "error",
                        confirmButtonColor: "#00BCD4"
                    })
                }
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1097 1098 1099 1100
            }
        })
    });

1101 1102
    // var layanan_kesehatan = "{{ layanan_kesehatan }}".replace(/&#x27;/g, '"');
    // var result_lay_kes = JSON.parse("" + layanan_kesehatan + "")
Muhamad's avatar
b  
Muhamad committed
1103 1104 1105 1106

    var geo_po_kes = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1107
                iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
1108 1109
                iconAnchor: [13, 27],
                popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1110
                iconUrl: 'static/img/icon-1/Heartbeat-tes.svg'
Muhamad's avatar
Muhamad committed
1111 1112 1113 1114
                    // iconUrl: 'static/img/icon/rs.svg',
                    // shadowUrl: 'static/img/icon/shadow.svg',
                    // shadowSize: [35, 35],
                    // shadowAnchor: [22, 31]
Muhamad's avatar
b  
Muhamad committed
1115 1116 1117 1118
            });
            var marker = L.marker(latlng, {
                icon: smallIcon
            });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135
            conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
            marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
1136 1137
                permanent: false,
                className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1138 1139
                direction: 'top',
                offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
1140 1141
            });
            return marker
Muhamad's avatar
Muhamad committed
1142 1143 1144 1145
        },
        onEachFeature: function(feature, layer) {
            layer.on({
                click: function(e) {
1146
                    $("#modal_detail_non_kelurahan").modal('show');
Muhamad's avatar
Muhamad committed
1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158
                    var tay;
                    var geocodeService = L.esri.Geocoding.geocodeService();
                    var geocoderNominatim = new L.Control.Geocoder.Nominatim();
                    var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
                        tay = result.address.Address;
                        // aladije(result.address.Address)
                        if (feature.administrasi.f3 == 'alamat') {
                            if (tay != '') {
                                var alamak = tay;

                            } else {
                                alamak = ""
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1159
                            }
Muhamad's avatar
Muhamad committed
1160 1161 1162 1163 1164 1165

                        } else {
                            var alamak = feature.administrasi.f3;

                        }
                        if (feature.administrasi.f10 == 'bpk') {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1166
                            var raja = "";
Muhamad's avatar
Muhamad committed
1167 1168 1169
                        } else {
                            var raja = feature.administrasi.f10;
                        }
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1170 1171

                        if (feature.administrasi.f8 == 'None') {
1172
                            var gmb = "static/img/image_null.png";
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1173
                        } else {
1174
                            var gmb = "static/img/image/" + feature.administrasi.f8;
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1175
                        }
1176 1177 1178 1179 1180

                        $(".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;">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1181 1182
                                                            ` + feature.administrasi.f1 + `
                                                        </span>
1183 1184 1185 1186
                                                    </div>
                                                    <div>
                                                        <span>
                                                            ` +
Muhamad's avatar
Muhamad committed
1187
                            alamak + `, ` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `, ` + feature.administrasi.f12 + `
1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225
                                                        </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="">
                                                    <div>
                                                        <div>
                                                            <span>Jenis Bangunan</span>
                                                        </div>
                                                        <div>
                                                            <span>
                                                                ` + feature.administrasi.f2 + `
                                                            </span>
                                                        </div>
                                                    </div>
                                                    <div>
                                                        <div>
                                                            <span>Luas</span>
                                                        </div>
                                                        <div>
                                                            <span style="font-family: 'Roboto';">` + feature.administrasi.f5 + ` m</span>
                                                        </div>
                                                    </div>

                                                    <div>
                                                        <div>
                                                            <span>Pimpinan</span>
                                                        </div>
                                                        <div>
                                                            <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_lk" 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>
Muhamad's avatar
Muhamad committed
1226 1227 1228
                                                        <div class="tombol-delete-keterangan text-center" style="background-color: indianred;position: absolute;width: 40px;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
                                                            <a href="#" id="btn_delete_adm" data-toggle="modal" data-target="#modald_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="Delete"><i class="icon-eraser2"></i></a>
                                                        </div>
1229
                                                        `)
Muhamad's avatar
Muhamad committed
1230 1231 1232 1233 1234 1235 1236 1237
                        if (list_perm.indexOf('delete_layanan_kesehatan') >= 0 === false) {
                            $(".tombol-delete-keterangan").remove();
                        }

                        if (list_perm.indexOf('change_layanan_kesehatan') >= 0 === false) {
                            $(".tombol-edit-keterangan").remove();
                        }

1238 1239


1240 1241 1242
                        content_edit_lk = `
                        <div class="modal-dialog md">
                            <div class="modal-content">
1243
                                <div class="modal-header bg-info" >
1244 1245 1246 1247 1248 1249 1250 1251 1252
                                        <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                        <h6 class="modal-title">Edit Point</h6>
                                </div>
                                    
                                    <div class="tab-pane has-padding" id="panel-tab2">
                                        <div class="tab-pane" id="bottom-justified-data">

                                            <div class="tabbable">
                                                <ul class="nav nav-tabs nav-tabs-bottom nav-justified">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1253 1254
                                                    <li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
                                                    <li onclick="changetabs(this)"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
1255 1256 1257 1258 1259
                                                    
                                                </ul>

                                                <div class="tab-content">

Manggar Mahardhika's avatar
Manggar Mahardhika committed
1260
                                                    <div class="tab-pane" id="left-tab1-feas-upli">
1261

Muhamad's avatar
Muhamad committed
1262
                                                        <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328

                                                                    <div class="form-group">
                                                                            <input style="display:none;" id="id_lk_edit" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                                            <input style="display:none;" id="coordinateZoneedit_lk_edit" type="text" class="form-control" value=""required>
                                                                    </div>

                                                                <div class="row" style="margin-top: 15px;">
                                                                    <div class="form-group">
                                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                                        <div class="col-lg-9">
                                                                            <input id="namobj_lk_edit" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required>    
                                                                        </div>
                                                                        
                                                                    </div>
                                                                </div>

                                                                <div class="row" style="margin-top: 15px;">
                                                                    <div class="form-group">
                                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                                        <div class="col-lg-8">
                                                                            <select id="remark_lk_edit" style="margin-top: 15px;">
                                                                                <option>` + feature.administrasi.f2 + `</option>
                                                                            </select>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                            
                                                                <div class="row" style="margin-top: 15px;">
                                                                    <div class="form-group">
                                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Alamat</label>
                                                                        <div class="col-lg-4">
                                                                            <input id="alamat_lk_edit" type="text" class="form-control" value="` + alamak + `"required>
                                                                        </div>
                                                                        <div class="col-lg-4" style="margin-top: 15px;">` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `</div>
                                                                    </div>
                                                                </div>

                                                                <div class="row" style="margin-top: 15px;">
                                                                    
                                                                    <div class="form-group">
                                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Luas</label>
                                                                        <div class="col-lg-6">
                                                                            <input id="luas_tanah_lk_edit" type="text" class="form-control" value="` + feature.administrasi.f5 + `"required>
                                                                        </div>
                                                                        <div class="col-lg-3">
                                                                            <select id="satuan_luas_tanah" style="margin-top: 15px;">
                                                                                <option>m2</option>
                                                                                <option>Km2</option>
                                                                                <option>Hektar</option>
                                                                            </select>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                            
                                                                <div class="row" style="margin-top: 15px;">
                                                                    <div class="form-group">
                                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Pimpinan</label>
                                                                        <div class="col-lg-9">
                                                                            <input id="perangkat_lk_edit" type="text" class="form-control" value="` + raja + `"required>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                        
                                                        </div>
                                                    </div>

Manggar Mahardhika's avatar
Manggar Mahardhika committed
1329
                                                    <div class="tab-pane active" id="right-tab2-feas-upli">
1330
                                                        <div class="form-group">
Muhamad's avatar
Muhamad committed
1331
                                                            <div id="map-for-edit" style="height: 300px;position: relative;margin: 10px;"></div>
1332 1333 1334
                                                            <div class="form-group">
                                                                <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
                                                                <div class="col-lg-9" style="margin-top:10px">
1335
                                                                    <input type="file" id="filelk" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348
                                                                    <input style="display:none;" id="gambar_lk_edit" type="text" class="form-control" value="` + feature.administrasi.f8 + `"required>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>

                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <hr>
                                    <div class="modal-footer">
Muhamad's avatar
Muhamad committed
1349

1350 1351 1352 1353
                                        <button type="button" class="btn btn-info" id="saveeditlk">Save changes</button>
                                    </div>
                            </div>
                        </div>`;
Muhamad's avatar
Muhamad committed
1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392

                        content_delete_adm = `
                            <div class="modal-dialog md">
                                        <div class="modal-content">
                                            <div class="modal-header bg-info">
                                                    <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                                    <h6 class="modal-title">Delete Point</h6>
                                            </div>
                                            <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
                                                <input style="display:none;" id="id_adm_del" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                <input style="display:none;" id="nama_table" type="text" class="form-control" value="geo_layanan_kesehatan" required>
                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                        <div class="col-lg-9">
                                                            <input id="namobj_adm_del" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required disabled>    
                                                        </div>
                                                        
                                                    </div>
                                                </div>

                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                        <div class="col-lg-8">
                                                            <input id="remark_adm_del" type="text" class="form-control" value="` + feature.administrasi.f2 + `"required disabled>
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>
                                            <hr>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-info" id="deletepointot">Hapus</button>
                                            </div>
                                        </div>
                                    </div>`;

                        $("#modald_adm").html(content_delete_adm)
1393
                        $("#modal_adm").html(content_edit_lk)
1394
                        panel_samp();
Muhamad's avatar
Muhamad committed
1395 1396 1397 1398
                    })
                    hidelegend();
                }
            })
Muhamad's avatar
b  
Muhamad committed
1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420
        }
    });

    var markerkes = L.markerClusterGroup({
        iconCreateFunction: function(cluster) {
            var childCount = cluster.getChildCount();

            return new L.DivIcon({
                html: '<div><span>' + childCount + '</span></div>',
                className: 'marker-cluster-sakit',
                iconSize: new L.Point(40, 40)
            });
        },
        //Disable all of the defaults:
        spiderfyOnMaxZoom: false,
        showCoverageOnHover: false
    });

    function geo_json_po_kes(data) {
        geo_po_kes.addData(data)
    }

1421
    // geo_json_po_kes(result_lay_kes);
Muhamad's avatar
b  
Muhamad committed
1422 1423

    function l_kes() {
1424 1425 1426 1427 1428 1429 1430 1431
        // var checkBox = document.getElementById("lyn_kes");
        // if (checkBox.checked == true) {
        //     newe(markerkes, geo_po_kes, checkBox)
        // } else {
        //     markerkes.remove()
        //     geo_po_kes.remove()
        //         // valket()
        // }
Muhamad's avatar
b  
Muhamad committed
1432 1433
        var checkBox = document.getElementById("lyn_kes");
        if (checkBox.checked == true) {
1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453
            // loaderPage(true);
            $.ajax({
                url: "{% url 'api:layanan_kesehatan'%}",
                dataType: 'json',
                type: 'GET',
                success: function(response) {
                    // loaderPage(false);
                    // map.setView([-4.125826277307029, 104.1881561279297], 13);
                    // var len = response['kecamatan'].length;
                    // console.log(response)
                    var data_de = []
                    for (var i = 0; i < response['layanan_kesehatan'].length; i++) {
                        geoj = response['layanan_kesehatan'][i];
                        data_de.push(geoj);
                    }
                    // console.log(data_de)
                    geo_json_po_kes(data_de);
                    newe(markerkes, geo_po_kes, checkBox)
                }
            });
Muhamad's avatar
b  
Muhamad committed
1454
        } else {
1455 1456
            markerkes.clearLayers()
            geo_po_kes.clearLayers()
Muhamad's avatar
b  
Muhamad committed
1457 1458 1459 1460 1461
            markerkes.remove()
            geo_po_kes.remove()
        }
    }

Muhamad's avatar
Muhamad committed
1462
    $(document).on("click", "#btn_edit_lk", function() {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473
        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);

1474
        var idlk = $('#id_lk_edit').val();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1475 1476 1477 1478 1479 1480 1481 1482
        loaderPage(false);
        $.ajax({
            url: "{% url 'api:editlakes' %}",
            data: {
                'id_point': idlk
            },
            dataType: 'json',
            success: function(data) {
Muhamad's avatar
Muhamad committed
1483 1484 1485 1486
                setTimeout(function() {
                    map_edit.invalidateSize();
                }, 1000);

Manggar Mahardhika's avatar
Manggar Mahardhika committed
1487 1488
                loaderPage(false);
                console.log(data)
Muhamad's avatar
Muhamad committed
1489 1490
                    // map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
                map_edit.setView([data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]], 19);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1491 1492 1493 1494 1495
                let dapoin = [data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]]
                var poinin = L.marker(dapoin).addTo(map_edit)
                poinin.enableEdit();
                $('#saveeditlk').click(function() {
                    var hasil = (JSON.stringify(poinin.toGeoJSON()))
1496
                    $("#coordinateZoneedit_lk_edit").val(hasil);
Muhamad's avatar
Muhamad committed
1497

Manggar Mahardhika's avatar
Manggar Mahardhika committed
1498 1499 1500 1501 1502 1503
                })
            }
        })
    });

    $(document).on("click", "#saveeditlk", function() {
1504 1505
        var idka = $('#id_lk_edit').val();
        var poi = $('#coordinateZoneedit_lk_edit').val();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1506
        var data = new FormData();
1507
        data.append("file", $("input[id^='filelk']")[0].files[0]);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1508
        data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
Muhamad's avatar
Muhamad committed
1509
        data.append('id', idka)
1510 1511 1512 1513 1514
        data.append('namobj', $('#namobj_lk_edit').val())
        data.append('remark', $('#remark_lk_edit').val())
        data.append('luastanah', $('#luas_tanah_lk_edit').val())
        data.append('alamat', $('#alamat_lk_edit').val())
        data.append('perangkat', $('#perangkat_lk_edit').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1515
        data.append('point', poi),
Muhamad's avatar
Muhamad committed
1516
            data.append('gambar', $('#gambar_lk_edit').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1517 1518 1519

        $.ajax({
            url: "{% url 'api:layanankesehatan' %}",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1520
            data: data,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1521 1522
            dataType: 'json',
            type: 'POST',
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1523 1524
            processData: false,
            contentType: false,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1525
            success: function(data) {
1526 1527 1528 1529 1530 1531 1532 1533 1534
                let response = data
                if (response.status == 0) {
                    swal({
                        title: response.info,
                        text: response.data,
                        type: "success",
                        icon: "success",
                        confirmButtonColor: "#00BCD4"
                    }, function() {
Muhamad's avatar
Muhamad committed
1535 1536 1537
                        $("#modal_adm").modal('hide');
                        $("#modal_detail_non_kelurahan").modal('hide')

Manggar Mahardhika's avatar
Manggar Mahardhika committed
1538
                        location.reload();
1539 1540 1541 1542 1543 1544 1545 1546 1547 1548
                    })
                } else {
                    swal({
                        title: 'Error',
                        text: 'Hubungi Developer',
                        type: "warning",
                        icon: "error",
                        confirmButtonColor: "#00BCD4"
                    })
                }
Muhamad's avatar
Muhamad committed
1549
                // location.reload()
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1550 1551 1552 1553 1554
            }
        })

    });

1555 1556
    // var puskesmas = "{{ puskesmas }}".replace(/&#x27;/g, '"');
    // var result_puskes = JSON.parse("" + puskesmas + "")
Muhamad's avatar
b  
Muhamad committed
1557 1558 1559 1560

    var geo_po_puskes = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1561
                iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
1562 1563
                iconAnchor: [13, 27],
                popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1564
                iconUrl: 'static/img/icon-1/FirstAidKit-tes.svg'
Muhamad's avatar
Muhamad committed
1565 1566 1567 1568
                    // iconUrl: 'static/img/icon/rs.svg',
                    // shadowUrl: 'static/img/icon/shadow.svg',
                    // shadowSize: [35, 35],
                    // shadowAnchor: [22, 31]
Muhamad's avatar
b  
Muhamad committed
1569 1570 1571 1572
            });
            var marker = L.marker(latlng, {
                icon: smallIcon
            });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589
            conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
            marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
1590 1591
                permanent: false,
                className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1592 1593
                direction: 'top',
                offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
1594 1595
            });
            return marker
Muhamad's avatar
Muhamad committed
1596 1597 1598 1599
        },
        onEachFeature: function(feature, layer) {
            layer.on({
                click: function(e) {
1600
                    $("#modal_detail_non_kelurahan").modal('show');
Muhamad's avatar
Muhamad committed
1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612
                    var tay;
                    var geocodeService = L.esri.Geocoding.geocodeService();
                    var geocoderNominatim = new L.Control.Geocoder.Nominatim();
                    var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
                        tay = result.address.Address;
                        // aladije(result.address.Address)
                        if (feature.administrasi.f3 == 'alamat') {
                            if (tay != '') {
                                var alamak = tay;

                            } else {
                                alamak = ""
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1613
                            }
Muhamad's avatar
Muhamad committed
1614 1615 1616 1617 1618 1619

                        } else {
                            var alamak = feature.administrasi.f3;

                        }
                        if (feature.administrasi.f10 == 'bpk') {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1620
                            var raja = "";
Muhamad's avatar
Muhamad committed
1621 1622 1623
                        } else {
                            var raja = feature.administrasi.f10;
                        }
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1624 1625

                        if (feature.administrasi.f8 == 'None') {
1626
                            var gmb = "static/img/image_null.png";
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1627
                        } else {
1628
                            var gmb = "static/img/image/" + feature.administrasi.f8;
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1629 1630
                        }

1631 1632 1633 1634
                        $(".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;">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1635 1636
                                                            ` + feature.administrasi.f1 + `
                                                        </span>
1637 1638 1639 1640
                                                    </div>
                                                    <div>
                                                        <span>
                                                            ` +
Muhamad's avatar
Muhamad committed
1641
                            alamak + `, ` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `, ` + feature.administrasi.f12 + `
1642 1643
                                                        </span>
                                                    </div>
1644

1645
                                                    `)
1646

1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679
                        $(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
                                                    <input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
                                                    <div>
                                                        <div>
                                                            <span>Jenis Bangunan</span>
                                                        </div>
                                                        <div>
                                                            <span>
                                                                ` + feature.administrasi.f2 + `
                                                            </span>
                                                        </div>
                                                    </div>
                                                    <div>
                                                        <div>
                                                            <span>Luas</span>
                                                        </div>
                                                        <div>
                                                            <span style="font-family: 'Roboto';">` + feature.administrasi.f5 + ` m</span>
                                                        </div>
                                                    </div>

                                                    <div>
                                                        <div>
                                                            <span>Pimpinan</span>
                                                        </div>
                                                        <div>
                                                            <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_puskes" 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>
Muhamad's avatar
Muhamad committed
1680 1681 1682
                                                        <div class="tombol-delete-keterangan text-center" style="background-color: indianred;position: absolute;width: 40px;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
                                                            <a href="#" id="btn_delete_adm" data-toggle="modal" data-target="#modald_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="Delete"><i class="icon-eraser2"></i></a>
                                                        </div>
1683
                                                        `)
Muhamad's avatar
Muhamad committed
1684 1685 1686 1687 1688 1689 1690
                        if (list_perm.indexOf('delete_puskesmas') >= 0 === false) {
                            $(".tombol-delete-keterangan").remove();
                        }

                        if (list_perm.indexOf('change_puskesmas') >= 0 === false) {
                            $(".tombol-edit-keterangan").remove();
                        }
1691 1692 1693
                        content_edit_puskes = `
                        <div class="modal-dialog md">
                            <div class="modal-content">
1694
                                <div class="modal-header bg-info" >
1695 1696 1697 1698 1699 1700 1701 1702 1703
                                        <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                        <h6 class="modal-title">Edit Point</h6>
                                </div>
                                    
                                    <div class="tab-pane has-padding" id="panel-tab2">
                                        <div class="tab-pane" id="bottom-justified-data">

                                            <div class="tabbable">
                                                <ul class="nav nav-tabs nav-tabs-bottom nav-justified">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1704 1705
                                                    <li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
                                                    <li onclick="changetabs(this)"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
1706 1707 1708 1709
                                                </ul>

                                                <div class="tab-content">

Manggar Mahardhika's avatar
Manggar Mahardhika committed
1710
                                                    <div class="tab-pane" id="left-tab1-feas-upli">
1711

Muhamad's avatar
Muhamad committed
1712
                                                        <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
1713 1714 1715 1716

                                                                    <div class="form-group">
                                                                            <input style="display:none;" id="id_puskes_edit" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                                            <input style="display:none;" id="coordinateZoneedit_puskes_edit" type="text" class="form-control" value=""required>
Muhamad's avatar
Muhamad committed
1717
                                                                            
1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779
                                                                    </div>

                                                                <div class="row" style="margin-top: 15px;">
                                                                    <div class="form-group">
                                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                                        <div class="col-lg-9">
                                                                            <input id="namobj_puskes_edit" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required>    
                                                                        </div>
                                                                        
                                                                    </div>
                                                                </div>

                                                                <div class="row" style="margin-top: 15px;">
                                                                    <div class="form-group">
                                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                                        <div class="col-lg-8">
                                                                            <select id="remark_puskes_edit" style="margin-top: 15px;">
                                                                                <option>` + feature.administrasi.f2 + `</option>
                                                                            </select>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                            
                                                                <div class="row" style="margin-top: 15px;">
                                                                    <div class="form-group">
                                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Alamat</label>
                                                                        <div class="col-lg-4">
                                                                            <input id="alamat_puskes_edit" type="text" class="form-control" value="` + alamak + `"required>
                                                                        </div>
                                                                        <div class="col-lg-4" style="margin-top: 15px;">` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `</div>
                                                                    </div>
                                                                </div>

                                                                <div class="row" style="margin-top: 15px;">
                                                                    
                                                                    <div class="form-group">
                                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Luas</label>
                                                                        <div class="col-lg-6">
                                                                            <input id="luas_tanah_puskes_edit" type="text" class="form-control" value="` + feature.administrasi.f5 + `"required>
                                                                        </div>
                                                                        <div class="col-lg-3">
                                                                            <select id="satuan_luas_tanah" style="margin-top: 15px;">
                                                                                <option>m2</option>
                                                                                <option>Km2</option>
                                                                                <option>Hektar</option>
                                                                            </select>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                            
                                                                <div class="row" style="margin-top: 15px;">
                                                                    <div class="form-group">
                                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Pimpinan</label>
                                                                        <div class="col-lg-9">
                                                                            <input id="perangkat_puskes_edit" type="text" class="form-control" value="` + raja + `"required>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                        
                                                        </div>
                                                    </div>

Manggar Mahardhika's avatar
Manggar Mahardhika committed
1780
                                                    <div class="tab-pane active" id="right-tab2-feas-upli">
1781
                                                        <div class="form-group">
Muhamad's avatar
Muhamad committed
1782
                                                            <div id="map-for-edit" style="height: 300px;position: relative;margin: 10px;"></div>
1783 1784 1785
                                                            <div class="form-group">
                                                                <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
                                                                <div class="col-lg-9" style="margin-top:10px">
1786
                                                                    <input type="file" id="filepus" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803
                                                                    <input style="display:none;" id="gambar_puskes_edit" type="text" class="form-control" value="` + feature.administrasi.f8 + `"required>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>

                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <hr>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-info" id="saveeditpuskes">Save changes</button>
                                    </div>
                            </div>
                        </div>`;
Muhamad's avatar
Muhamad committed
1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842

                        content_delete_point = `
                            <div class="modal-dialog md">
                                        <div class="modal-content">
                                            <div class="modal-header bg-info">
                                                    <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                                    <h6 class="modal-title">Delete Point</h6>
                                            </div>
                                            <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
                                                <input style="display:none;" id="id_adm_del" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                <input style="display:none;" id="nama_table" type="text" class="form-control" value="geo_puskesmas" required>
                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                        <div class="col-lg-9">
                                                            <input id="namobj_adm_del" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required disabled>    
                                                        </div>
                                                        
                                                    </div>
                                                </div>

                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                        <div class="col-lg-8">
                                                            <input id="remark_adm_del" type="text" class="form-control" value="` + feature.administrasi.f2 + `"required disabled>
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>
                                            <hr>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-info" id="deletepointot">Hapus</button>
                                            </div>
                                        </div>
                                    </div>`;

                        $("#modald_adm").html(content_delete_point)
1843
                        $("#modal_adm").html(content_edit_puskes)
1844
                        panel_samp();
Muhamad's avatar
Muhamad committed
1845 1846 1847 1848
                    })
                    hidelegend();
                }
            })
Muhamad's avatar
b  
Muhamad committed
1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870
        }
    });

    var markerpuskes = L.markerClusterGroup({
        iconCreateFunction: function(cluster) {
            var childCount = cluster.getChildCount();

            return new L.DivIcon({
                html: '<div><span>' + childCount + '</span></div>',
                className: 'marker-cluster-sakit',
                iconSize: new L.Point(40, 40)
            });
        },
        //Disable all of the defaults:
        spiderfyOnMaxZoom: false,
        showCoverageOnHover: false
    });

    function geo_json_po_puskes(data) {
        geo_po_puskes.addData(data)
    }

1871
    // geo_json_po_puskes(result_puskes);
Muhamad's avatar
b  
Muhamad committed
1872 1873

    function pks() {
1874 1875 1876 1877 1878 1879 1880 1881
        // var checkBox = document.getElementById("pus");
        // if (checkBox.checked == true) {
        //     newe(markerpuskes, geo_po_puskes, checkBox)
        // } else {
        //     markerpuskes.remove()
        //     geo_po_puskes.remove()
        //         // valket()
        // }
Muhamad's avatar
b  
Muhamad committed
1882 1883
        var checkBox = document.getElementById("pus");
        if (checkBox.checked == true) {
1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903
            // loaderPage(true);
            $.ajax({
                url: "{% url 'api:apiviewpuskesmas'%}",
                dataType: 'json',
                type: 'GET',
                success: function(response) {
                    // loaderPage(false);
                    // map.setView([-4.125826277307029, 104.1881561279297], 13);
                    // var len = response['kecamatan'].length;
                    // console.log(response)
                    var data_de = []
                    for (var i = 0; i < response['apiviewpuskesmas'].length; i++) {
                        geoj = response['apiviewpuskesmas'][i];
                        data_de.push(geoj);
                    }
                    // console.log(data_de)
                    geo_json_po_puskes(data_de);
                    newe(markerpuskes, geo_po_puskes, checkBox)
                }
            });
Muhamad's avatar
b  
Muhamad committed
1904
        } else {
1905 1906
            markerpuskes.clearLayers()
            geo_po_puskes.clearLayers()
Muhamad's avatar
b  
Muhamad committed
1907 1908 1909 1910 1911
            markerpuskes.remove()
            geo_po_puskes.remove()
        }
    }

Muhamad's avatar
Muhamad committed
1912
    $(document).on("click", "#btn_edit_puskes", function() {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923
        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);

1924
        var idpuskes = $('#id_puskes_edit').val();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1925 1926 1927 1928 1929 1930 1931 1932
        loaderPage(false);
        $.ajax({
            url: "{% url 'api:editpks' %}",
            data: {
                'id_point': idpuskes
            },
            dataType: 'json',
            success: function(data) {
Muhamad's avatar
Muhamad committed
1933 1934 1935 1936
                setTimeout(function() {
                    map_edit.invalidateSize();
                }, 1000);

Manggar Mahardhika's avatar
Manggar Mahardhika committed
1937 1938
                loaderPage(false);
                console.log(data)
Muhamad's avatar
Muhamad committed
1939 1940
                    // map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
                map_edit.setView([data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]], 19);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1941 1942 1943 1944 1945
                let dapoin = [data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]]
                var poinin = L.marker(dapoin).addTo(map_edit)
                poinin.enableEdit();
                $('#saveeditpuskes').click(function() {
                    var hasil = (JSON.stringify(poinin.toGeoJSON()))
1946
                    $("#coordinateZoneedit_puskes_edit").val(hasil);
Muhamad's avatar
Muhamad committed
1947

Manggar Mahardhika's avatar
Manggar Mahardhika committed
1948 1949 1950 1951 1952 1953
                })
            }
        })
    });

    $(document).on("click", "#saveeditpuskes", function() {
1954 1955
        var idka = $('#id_puskes_edit').val();
        var poi = $('#coordinateZoneedit_puskes_edit').val();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1956
        var data = new FormData();
1957
        data.append("file", $("input[id^='filepus']")[0].files[0]);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1958
        data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
Muhamad's avatar
Muhamad committed
1959
        data.append('idpus', idka)
1960 1961 1962 1963 1964
        data.append('namobj', $('#namobj_puskes_edit').val())
        data.append('remark', $('#remark_puskes_edit').val())
        data.append('luastanah', $('#luas_tanah_puskes_edit').val())
        data.append('alamat', $('#alamat_puskes_edit').val())
        data.append('perangkat', $('#perangkat_puskes_edit').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1965
        data.append('point', poi),
1966
            data.append('gambar', $('#gambar_puskes_edit').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1967 1968 1969

        $.ajax({
            url: "{% url 'api:puskesmas' %}",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1970
            data: data,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1971 1972
            dataType: 'json',
            type: 'POST',
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1973 1974
            processData: false,
            contentType: false,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1975
            success: function(data) {
1976 1977 1978 1979 1980 1981 1982 1983 1984
                let response = data
                if (response.status == 0) {
                    swal({
                        title: response.info,
                        text: response.data,
                        type: "success",
                        icon: "success",
                        confirmButtonColor: "#00BCD4"
                    }, function() {
Muhamad's avatar
Muhamad committed
1985 1986
                        $("#modal_adm").modal("hide");
                        $("#modal_detail_non_kelurahan").modal('hide')
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1987
                        location.reload();
1988 1989 1990 1991 1992 1993 1994 1995 1996 1997
                    })
                } else {
                    swal({
                        title: 'Error',
                        text: 'Hubungi Developer',
                        type: "warning",
                        icon: "error",
                        confirmButtonColor: "#00BCD4"
                    })
                }
Muhamad's avatar
Muhamad committed
1998
                //location.reload()
Manggar Mahardhika's avatar
Manggar Mahardhika committed
1999 2000 2001 2002 2003
            }
        })

    });

2004 2005
    // var rumah_sakit = "{{ rumah_sakit }}".replace(/&#x27;/g, '"');
    // var result_rumah_sakit = JSON.parse("" + rumah_sakit + "")
Muhamad's avatar
b  
Muhamad committed
2006 2007 2008 2009 2010 2011 2012

    var geo_po_rumah_sakit = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            var smallIcon = new L.Icon({
                iconSize: [25, 25],
                iconAnchor: [13, 27],
                popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2013
                iconUrl: 'static/img/icon-1/FirstAid-tes.svg'
Muhamad's avatar
Muhamad committed
2014 2015 2016 2017
                    // iconUrl: 'static/img/icon/rs.svg',
                    // shadowUrl: 'static/img/icon/shadow.svg',
                    // shadowSize: [35, 35],
                    // shadowAnchor: [19, 31]
Muhamad's avatar
b  
Muhamad committed
2018 2019 2020 2021
            });
            var marker = L.marker(latlng, {
                icon: smallIcon
            });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038
            conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
            marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
2039 2040
                permanent: false,
                className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2041 2042
                direction: 'top',
                offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
2043 2044
            });
            return marker
Muhamad's avatar
Muhamad committed
2045 2046 2047 2048
        },
        onEachFeature: function(feature, layer) {
            layer.on({
                click: function(e) {
2049
                    $("#modal_detail_non_kelurahan").modal('show');
Muhamad's avatar
Muhamad committed
2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061
                    var tay;
                    var geocodeService = L.esri.Geocoding.geocodeService();
                    var geocoderNominatim = new L.Control.Geocoder.Nominatim();
                    var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
                        tay = result.address.Address;
                        // aladije(result.address.Address)
                        if (feature.administrasi.f3 == 'alamat') {
                            if (tay != '') {
                                var alamak = tay;

                            } else {
                                alamak = ""
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2062
                            }
Muhamad's avatar
Muhamad committed
2063 2064 2065 2066 2067 2068

                        } else {
                            var alamak = feature.administrasi.f3;

                        }
                        if (feature.administrasi.f10 == 'bpk') {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2069
                            var raja = "";
Muhamad's avatar
Muhamad committed
2070 2071 2072
                        } else {
                            var raja = feature.administrasi.f10;
                        }
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2073 2074

                        if (feature.administrasi.f8 == 'None') {
2075
                            var gmb = "static/img/image_null.png";
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2076
                        } else {
2077
                            var gmb = "static/img/image/" + feature.administrasi.f8;
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2078 2079
                        }

2080 2081 2082 2083
                        $(".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;">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2084 2085
                                                            ` + feature.administrasi.f1 + `
                                                        </span>
2086 2087 2088 2089
                                                    </div>
                                                    <div>
                                                        <span>
                                                            ` +
Muhamad's avatar
Muhamad committed
2090
                            alamak + `, ` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `, ` + feature.administrasi.f12 + `
2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128
                                                        </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="">
                                                    <div>
                                                        <div>
                                                            <span>Jenis Bangunan</span>
                                                        </div>
                                                        <div>
                                                            <span>
                                                                ` + feature.administrasi.f2 + `
                                                            </span>
                                                        </div>
                                                    </div>
                                                    <div>
                                                        <div>
                                                            <span>Luas</span>
                                                        </div>
                                                        <div>
                                                            <span style="font-family: 'Roboto';">` + feature.administrasi.f5 + ` m</span>
                                                        </div>
                                                    </div>

                                                    <div>
                                                        <div>
                                                            <span>Pimpinan</span>
                                                        </div>
                                                        <div>
                                                            <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_rs" 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>
Muhamad's avatar
Muhamad committed
2129 2130 2131
                                                        <div class="tombol-delete-keterangan text-center" style="background-color: indianred;position: absolute;width: 40px;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
                                                            <a href="#" id="btn_delete_adm" data-toggle="modal" data-target="#modald_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="Delete"><i class="icon-eraser2"></i></a>
                                                        </div>
2132
                                                        `)
Muhamad's avatar
Muhamad committed
2133 2134 2135 2136 2137 2138 2139
                        if (list_perm.indexOf('delete_rumah_sakit') >= 0 === false) {
                            $(".tombol-delete-keterangan").remove();
                        }

                        if (list_perm.indexOf('change_rumah_sakit') >= 0 === false) {
                            $(".tombol-edit-keterangan").remove();
                        }
2140

Muhamad's avatar
Muhamad committed
2141
                        content_edit_rs = `
2142 2143
                            <div class="modal-dialog md">
                                <div class="modal-content">
2144
                                    <div class="modal-header bg-info" >
2145 2146 2147 2148 2149 2150 2151 2152 2153
                                            <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                            <h6 class="modal-title">Edit Point</h6>
                                    </div>
                                        
                                        <div class="tab-pane has-padding" id="panel-tab2">
                                            <div class="tab-pane" id="bottom-justified-data">

                                                <div class="tabbable">
                                                    <ul class="nav nav-tabs nav-tabs-bottom nav-justified">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2154 2155
                                                        <li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
                                                        <li onclick="changetabs(this)"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
2156 2157 2158 2159
                                                    </ul>

                                                    <div class="tab-content">

Manggar Mahardhika's avatar
Manggar Mahardhika committed
2160
                                                        <div class="tab-pane" id="left-tab1-feas-upli">
2161

Muhamad's avatar
Muhamad committed
2162
                                                            <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
2163 2164 2165 2166

                                                                        <div class="form-group">
                                                                                <input style="display:none;" id="id_rs_edit" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                                                <input style="display:none;" id="coordinateZoneedit_rs_edit" type="text" class="form-control" value=""required>
Muhamad's avatar
Muhamad committed
2167
                                                                                
2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229
                                                                        </div>

                                                                    <div class="row" style="margin-top: 15px;">
                                                                        <div class="form-group">
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                                            <div class="col-lg-9">
                                                                                <input id="namobj_rs_edit" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required>    
                                                                            </div>
                                                                            
                                                                        </div>
                                                                    </div>

                                                                    <div class="row" style="margin-top: 15px;">
                                                                        <div class="form-group">
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                                            <div class="col-lg-8">
                                                                                <select id="remark_rs_edit" style="margin-top: 15px;">
                                                                                    <option>` + feature.administrasi.f2 + `</option>
                                                                                </select>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                
                                                                    <div class="row" style="margin-top: 15px;">
                                                                        <div class="form-group">
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Alamat</label>
                                                                            <div class="col-lg-4">
                                                                                <input id="alamat_rs_edit" type="text" class="form-control" value="` + alamak + `"required>
                                                                            </div>
                                                                            <div class="col-lg-4" style="margin-top: 15px;">` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `</div>
                                                                        </div>
                                                                    </div>

                                                                    <div class="row" style="margin-top: 15px;">
                                                                        
                                                                        <div class="form-group">
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Luas</label>
                                                                            <div class="col-lg-6">
                                                                                <input id="luas_tanah_rs_edit" type="text" class="form-control" value="` + feature.administrasi.f5 + `"required>
                                                                            </div>
                                                                            <div class="col-lg-3">
                                                                                <select id="satuan_luas_tanah" style="margin-top: 15px;">
                                                                                    <option>m2</option>
                                                                                    <option>Km2</option>
                                                                                    <option>Hektar</option>
                                                                                </select>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                
                                                                    <div class="row" style="margin-top: 15px;">
                                                                        <div class="form-group">
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Pimpinan</label>
                                                                            <div class="col-lg-9">
                                                                                <input id="perangkat_rs_edit" type="text" class="form-control" value="` + raja + `"required>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                            
                                                            </div>
                                                        </div>

Manggar Mahardhika's avatar
Manggar Mahardhika committed
2230
                                                        <div class="tab-pane active" id="right-tab2-feas-upli">
2231
                                                            <div class="form-group">
Muhamad's avatar
Muhamad committed
2232
                                                                <div id="map-for-edit" style="height: 300px;position: relative;margin: 10px;"></div>
2233 2234 2235
                                                                <div class="form-group">
                                                                    <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
                                                                    <div class="col-lg-9" style="margin-top:10px">
2236
                                                                        <input type="file" id="filers" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253
                                                                        <input style="display:none;" id="gambar_rs_edit" type="text" class="form-control" value="` + feature.administrasi.f8 + `"required>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>

                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <hr>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-info" id="saveeditrs">Save changes</button>
                                        </div>
                                </div>
                            </div>`;
2254

Muhamad's avatar
Muhamad committed
2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293
                        content_delete_point = `
                            <div class="modal-dialog md">
                                        <div class="modal-content">
                                            <div class="modal-header bg-info">
                                                    <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                                    <h6 class="modal-title">Delete Point</h6>
                                            </div>
                                            <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
                                                <input style="display:none;" id="id_adm_del" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                <input style="display:none;" id="nama_table" type="text" class="form-control" value="geo_rumah_sakit" required>
                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                        <div class="col-lg-9">
                                                            <input id="namobj_adm_del" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required disabled>    
                                                        </div>
                                                        
                                                    </div>
                                                </div>

                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                        <div class="col-lg-8">
                                                            <input id="remark_adm_del" type="text" class="form-control" value="` + feature.administrasi.f2 + `"required disabled>
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>
                                            <hr>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-info" id="deletepointot">Hapus</button>
                                            </div>
                                        </div>
                                    </div>`;

                        $("#modald_adm").html(content_delete_point)

2294
                        $("#modal_adm").html(content_edit_rs)
2295
                        panel_samp();
Muhamad's avatar
Muhamad committed
2296 2297 2298 2299
                    })
                    hidelegend();
                }
            })
Muhamad's avatar
b  
Muhamad committed
2300 2301 2302 2303 2304 2305 2306
        }
    });

    function geo_json_po_rumah_sakit(data) {
        geo_po_rumah_sakit.addData(data)
    }

2307
    // geo_json_po_rumah_sakit(result_rumah_sakit);
Muhamad's avatar
b  
Muhamad committed
2308 2309

    function rs() {
2310 2311 2312 2313 2314 2315 2316
        // var checkBox = document.getElementById("rusak");
        // if (checkBox.checked == true) {
        //     geo_po_rumah_sakit.addTo(map)
        // } else {
        //     geo_po_rumah_sakit.remove()
        //         // valket()
        // }
Muhamad's avatar
b  
Muhamad committed
2317 2318
        var checkBox = document.getElementById("rusak");
        if (checkBox.checked == true) {
2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338
            // loaderPage(true);
            $.ajax({
                url: "{% url 'api:rumah_sakit'%}",
                dataType: 'json',
                type: 'GET',
                success: function(response) {
                    // loaderPage(false);
                    // map.setView([-4.125826277307029, 104.1881561279297], 13);
                    // var len = response['kecamatan'].length;
                    // console.log(response)
                    var data_de = []
                    for (var i = 0; i < response['rumah_sakit'].length; i++) {
                        geoj = response['rumah_sakit'][i];
                        data_de.push(geoj);
                    }
                    // console.log(data_de)
                    geo_json_po_rumah_sakit(data_de);
                    geo_po_rumah_sakit.addTo(map)
                }
            });
Muhamad's avatar
b  
Muhamad committed
2339
        } else {
2340
            geo_po_rumah_sakit.clearLayers()
Muhamad's avatar
b  
Muhamad committed
2341 2342 2343 2344
            geo_po_rumah_sakit.remove()
        }
    }

Muhamad's avatar
Muhamad committed
2345
    $(document).on("click", "#btn_edit_rs", function() {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356
        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);

2357
        var idrs = $('#id_rs_edit').val();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2358 2359 2360 2361 2362 2363 2364 2365
        loaderPage(false);
        $.ajax({
            url: "{% url 'api:editrs' %}",
            data: {
                'id_point': idrs
            },
            dataType: 'json',
            success: function(data) {
Muhamad's avatar
Muhamad committed
2366 2367 2368 2369
                setTimeout(function() {
                    map_edit.invalidateSize();
                }, 1000);

Manggar Mahardhika's avatar
Manggar Mahardhika committed
2370 2371
                loaderPage(false);
                console.log(data)
Muhamad's avatar
Muhamad committed
2372 2373
                    // map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
                map_edit.setView([data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]], 19);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2374 2375 2376 2377 2378
                let dapoin = [data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]]
                var poinin = L.marker(dapoin).addTo(map_edit)
                poinin.enableEdit();
                $('#saveeditrs').click(function() {
                    var hasil = (JSON.stringify(poinin.toGeoJSON()))
2379
                    $("#coordinateZoneedit_rs_edit").val(hasil);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2380 2381 2382 2383 2384 2385
                })
            }
        })
    });

    $(document).on("click", "#saveeditrs", function() {
2386 2387
        var idrs = $('#id_rs_edit').val();
        var poi = $('#coordinateZoneedit_rs_edit').val();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2388
        var data = new FormData();
2389
        data.append("file", $("input[id^='filers']")[0].files[0]);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2390
        data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
Muhamad's avatar
Muhamad committed
2391
        data.append('idrs', idrs)
2392 2393 2394 2395 2396
        data.append('namobj', $('#namobj_rs_edit').val())
        data.append('remark', $('#remark_rs_edit').val())
        data.append('luastanah', $('#luas_tanah_rs_edit').val())
        data.append('alamat', $('#alamat_rs_edit').val())
        data.append('perangkat', $('#perangkat_rs_edit').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2397
        data.append('point', poi),
2398
            data.append('gambar', $('#gambar_rs_edit').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2399 2400 2401

        $.ajax({
            url: "{% url 'api:rumahsakit' %}",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2402
            data: data,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2403 2404
            dataType: 'json',
            type: 'POST',
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2405 2406
            processData: false,
            contentType: false,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2407
            success: function(data) {
2408 2409 2410 2411 2412 2413 2414 2415 2416
                let response = data
                if (response.status == 0) {
                    swal({
                        title: response.info,
                        text: response.data,
                        type: "success",
                        icon: "success",
                        confirmButtonColor: "#00BCD4"
                    }, function() {
Muhamad's avatar
Muhamad committed
2417 2418
                        $("#modal_adm").modal('hide');
                        $("#modal_detail_non_kelurahan").modal('hide')
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2419
                        location.reload();
2420 2421 2422 2423 2424 2425 2426 2427 2428 2429
                    })
                } else {
                    swal({
                        title: 'Error',
                        text: 'Hubungi Developer',
                        type: "warning",
                        icon: "error",
                        confirmButtonColor: "#00BCD4"
                    })
                }
Muhamad's avatar
Muhamad committed
2430
                //location.reload()
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2431 2432 2433 2434 2435
            }
        })

    });

2436 2437
    // var sarana_ibadah = "{{ sarana_ibadah }}".replace(/&#x27;/g, '"');
    // var result_sarana_ibadah = JSON.parse("" + sarana_ibadah + "")
Muhamad's avatar
b  
Muhamad committed
2438 2439 2440 2441 2442 2443 2444 2445 2446

    var geo_po_sarana_ibadah = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            if (feature.administrasi.f2 == 'Masjid') {
                var smallIcon = new L.Icon({
                    iconSize: [25, 25],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/masjid.svg',
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2447 2448 2449
                    // shadowUrl: 'static/img/icon/shadow.svg',
                    // shadowSize: [35, 35],
                    // shadowAnchor: [19, 30]
Muhamad's avatar
b  
Muhamad committed
2450 2451 2452 2453
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
2471 2472
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2473 2474
                    direction: 'top',
                    offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
2475 2476 2477 2478
                });
                return marker
            } else if (feature.administrasi.f2 == 'Gereja') {
                var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2479
                    iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
2480 2481 2482
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/gereja.svg',
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2483 2484 2485
                    // shadowUrl: 'static/img/icon/shadow.svg',
                    // shadowSize: [35, 35],
                    // shadowAnchor: [22, 31]
Muhamad's avatar
b  
Muhamad committed
2486 2487 2488 2489 2490

                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
2508 2509
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2510 2511
                    direction: 'top',
                    offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
2512 2513 2514 2515
                });
                return marker
            } else if (feature.administrasi.f2 == 'Peribadatan/Sosial Lainnya') {
                var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2516
                    iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
2517 2518 2519
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/pesantren.svg',
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2520 2521 2522
                    // shadowUrl: 'static/img/icon/shadow.svg',
                    // shadowSize: [35, 35],
                    // shadowAnchor: [22, 31]
Muhamad's avatar
b  
Muhamad committed
2523 2524 2525 2526
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
2544 2545
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2546 2547
                    direction: 'top',
                    offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
2548 2549 2550 2551
                });
                return marker
            } else if (feature.administrasi.f2 == 'Pura') {
                var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2552
                    iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
2553 2554 2555
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/pura.svg',
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2556 2557 2558
                    // shadowUrl: 'static/img/icon/shadow.svg',
                    // shadowSize: [35, 35],
                    // shadowAnchor: [22, 31]
Muhamad's avatar
b  
Muhamad committed
2559 2560 2561 2562
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
2580 2581
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2582 2583
                    direction: 'top',
                    offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
2584 2585 2586
                });
                return marker
            }
Muhamad's avatar
Muhamad committed
2587 2588 2589 2590
        },
        onEachFeature: function(feature, layer) {
            layer.on({
                click: function(e) {
2591
                    $("#modal_detail_non_kelurahan").modal('show');
Muhamad's avatar
Muhamad committed
2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603
                    var tay;
                    var geocodeService = L.esri.Geocoding.geocodeService();
                    var geocoderNominatim = new L.Control.Geocoder.Nominatim();
                    var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
                        tay = result.address.Address;
                        // aladije(result.address.Address)
                        if (feature.administrasi.f3 == 'alamat') {
                            if (tay != '') {
                                var alamak = tay;

                            } else {
                                alamak = ""
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2604
                            }
Muhamad's avatar
Muhamad committed
2605 2606 2607 2608 2609 2610

                        } else {
                            var alamak = feature.administrasi.f3;

                        }
                        if (feature.administrasi.f10 == 'bpk') {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2611
                            var raja = "";
Muhamad's avatar
Muhamad committed
2612 2613 2614
                        } else {
                            var raja = feature.administrasi.f10;
                        }
2615 2616 2617
                        content_edit_ibdh = `
                            <div class="modal-dialog md">
                                <div class="modal-content">
2618
                                    <div class="modal-header bg-info" >
2619 2620 2621 2622 2623 2624
                                            <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                            <h6 class="modal-title">Edit Point</h6>
                                    </div>
                                        
                                        <div class="tab-pane has-padding" id="panel-tab2">
                                            <div class="tab-pane" id="bottom-justified-data">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2625

2626 2627
                                                <div class="tabbable">
                                                    <ul class="nav nav-tabs nav-tabs-bottom nav-justified">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2628 2629
                                                        <li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
                                                        <li onclick="changetabs(this)"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
2630
                                                    </ul>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2631

2632
                                                    <div class="tab-content">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2633

Manggar Mahardhika's avatar
Manggar Mahardhika committed
2634
                                                        <div class="tab-pane" id="left-tab1-feas-upli">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2635

Muhamad's avatar
Muhamad committed
2636
                                                            <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2637

2638 2639 2640 2641
                                                                        <div class="form-group">
                                                                                <input style="display:none;" id="id_si_edit" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                                                <input style="display:none;" id="coordinateZoneedit_si_edit" type="text" class="form-control" value=""required>
                                                                        </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2642

2643 2644 2645 2646 2647
                                                                    <div class="row" style="margin-top: 15px;">
                                                                        <div class="form-group">
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                                            <div class="col-lg-9">
                                                                                <input id="namobj_si_edit" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required>    
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2648
                                                                            </div>
2649 2650 2651
                                                                            
                                                                        </div>
                                                                    </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2652

2653 2654 2655 2656 2657 2658 2659
                                                                    <div class="row" style="margin-top: 15px;">
                                                                        <div class="form-group">
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                                            <div class="col-lg-8">
                                                                                <select id="remark_si_edit" style="margin-top: 15px;">
                                                                                    <option>` + feature.administrasi.f2 + `</option>
                                                                                </select>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2660
                                                                            </div>
2661 2662 2663 2664 2665 2666 2667 2668
                                                                        </div>
                                                                    </div>
                                                
                                                                    <div class="row" style="margin-top: 15px;">
                                                                        <div class="form-group">
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Alamat</label>
                                                                            <div class="col-lg-4">
                                                                                <input id="alamat_si_edit" type="text" class="form-control" value="` + alamak + `"required>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2669
                                                                            </div>
2670 2671 2672
                                                                            <div class="col-lg-4" style="margin-top: 15px;">` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `</div>
                                                                        </div>
                                                                    </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2673

2674 2675 2676 2677 2678 2679
                                                                    <div class="row" style="margin-top: 15px;">
                                                                        
                                                                        <div class="form-group">
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Luas</label>
                                                                            <div class="col-lg-6">
                                                                                <input id="luas_tanah_si_edit" type="text" class="form-control" value="` + feature.administrasi.f5 + `"required>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2680
                                                                            </div>
2681 2682 2683 2684 2685 2686
                                                                            <div class="col-lg-3">
                                                                                <select id="satuan_luas_tanah" style="margin-top: 15px;">
                                                                                    <option>m2</option>
                                                                                    <option>Km2</option>
                                                                                    <option>Hektar</option>
                                                                                </select>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2687
                                                                            </div>
2688
                                                                        </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2689
                                                                    </div>
2690 2691
                                                
                                                                    <div class="row" style="margin-top: 15px; display:none;">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2692
                                                                        <div class="form-group">
2693 2694 2695
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Pimpinan</label>
                                                                            <div class="col-lg-9">
                                                                                <input id="perangkat_si_edit" type="text" class="form-control" value="` + raja + `"required>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2696 2697
                                                                            </div>
                                                                        </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2698
                                                                    </div>
2699 2700 2701
                                                            
                                                            </div>
                                                        </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2702

Manggar Mahardhika's avatar
Manggar Mahardhika committed
2703
                                                        <div class="tab-pane active" id="right-tab2-feas-upli">
2704
                                                            <div class="form-group">
Muhamad's avatar
Muhamad committed
2705
                                                                <div id="map-for-edit" style="height: 300px;position: relative;margin: 10px;"></div>
2706 2707 2708
                                                                <div class="form-group">
                                                                    <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
                                                                    <div class="col-lg-9" style="margin-top:10px">
2709
                                                                        <input type="file" id="filesi" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
2710 2711
                                                                        <input style="display:none;" id="gambar_si_edit" type="text" class="form-control" value="` + feature.administrasi.f8 + `"required>
                                                                    </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2712 2713 2714
                                                                </div>
                                                            </div>
                                                        </div>
2715

Manggar Mahardhika's avatar
Manggar Mahardhika committed
2716 2717
                                                    </div>
                                                </div>
2718 2719
                                            </div>
                                        </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2720

2721 2722 2723
                                        <hr>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-info" id="saveeditsi">Save changes</button>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2724 2725
                                        </div>
                                </div>
2726
                            </div>`
2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744


                        if (feature.administrasi.f8 == 'None') {
                            var gmb = "static/img/image_null.png";
                        } 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 + `
                                                            </span>
                                                        </div>
                                                        <div>
                                                            <span>
                                                                ` +
Muhamad's avatar
Muhamad committed
2745
                            alamak + `, ` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `, ` + feature.administrasi.f12 + `
2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783
                                                            </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="">
                                                        <div>
                                                            <div>
                                                                <span>Jenis Bangunan</span>
                                                            </div>
                                                            <div>
                                                                <span>
                                                                    ` + feature.administrasi.f2 + `
                                                                </span>
                                                            </div>
                                                        </div>
                                                        <div>
                                                            <div>
                                                                <span>Luas</span>
                                                            </div>
                                                            <div>
                                                                <span style="font-family: 'Roboto';">` + feature.administrasi.f5 + ` m</span>
                                                            </div>
                                                        </div>
    
                                                        <div>
                                                            <div>
                                                                <span>Pimpinan</span>
                                                            </div>
                                                            <div>
                                                                <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_si" 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>
Muhamad's avatar
Muhamad committed
2784 2785 2786
                                                            <div class="tombol-delete-keterangan text-center" style="background-color: indianred;position: absolute;width: 40px;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
                                                                <a href="#" id="btn_delete_adm" data-toggle="modal" data-target="#modald_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="Delete"><i class="icon-eraser2"></i></a>
                                                            </div>
2787
                                                            `)
Muhamad's avatar
Muhamad committed
2788 2789 2790 2791 2792 2793 2794
                        if (list_perm.indexOf('delete_sarana_ibadah') >= 0 === false) {
                            $(".tombol-delete-keterangan").remove();
                        }

                        if (list_perm.indexOf('change_sarana_ibadah') >= 0 === false) {
                            $(".tombol-edit-keterangan").remove();
                        }
Muhamad's avatar
Muhamad committed
2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833

                        content_delete_point = `
                            <div class="modal-dialog md">
                                        <div class="modal-content">
                                            <div class="modal-header bg-info">
                                                    <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                                    <h6 class="modal-title">Delete Point</h6>
                                            </div>
                                            <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
                                                <input style="display:none;" id="id_adm_del" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                <input style="display:none;" id="nama_table" type="text" class="form-control" value="geo_sarana_ibadah" required>
                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                        <div class="col-lg-9">
                                                            <input id="namobj_adm_del" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required disabled>    
                                                        </div>
                                                        
                                                    </div>
                                                </div>

                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                        <div class="col-lg-8">
                                                            <input id="remark_adm_del" type="text" class="form-control" value="` + feature.administrasi.f2 + `"required disabled>
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>
                                            <hr>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-info" id="deletepointot">Hapus</button>
                                            </div>
                                        </div>
                                    </div>`;

                        $("#modald_adm").html(content_delete_point)
2834
                        $("#modal_adm").html(content_edit_ibdh)
2835
                        panel_samp();
Muhamad's avatar
Muhamad committed
2836 2837 2838 2839
                    })
                    hidelegend();
                }
            })
Muhamad's avatar
b  
Muhamad committed
2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861
        }
    });

    var markeribdh = L.markerClusterGroup({
        iconCreateFunction: function(cluster) {
            var childCount = cluster.getChildCount();

            return new L.DivIcon({
                html: '<div><span>' + childCount + '</span></div>',
                className: 'marker-cluster-ibdh',
                iconSize: new L.Point(40, 40)
            });
        },
        //Disable all of the defaults:
        spiderfyOnMaxZoom: false,
        showCoverageOnHover: false
    });

    function geo_json_po_sarana_ibadah(data) {
        geo_po_sarana_ibadah.addData(data)
    }

2862
    // geo_json_po_sarana_ibadah(result_sarana_ibadah);
Muhamad's avatar
b  
Muhamad committed
2863 2864

    function fiksi() {
2865 2866 2867 2868 2869 2870 2871 2872
        // var checkBox = document.getElementById("ibdh");
        // if (checkBox.checked == true) {
        //     newe(markeribdh, geo_po_sarana_ibadah, checkBox)
        // } else {
        //     markeribdh.remove()
        //     geo_po_sarana_ibadah.remove()
        //         // valket()
        // }
Muhamad's avatar
b  
Muhamad committed
2873 2874
        var checkBox = document.getElementById("ibdh");
        if (checkBox.checked == true) {
2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894
            // loaderPage(true);
            $.ajax({
                url: "{% url 'api:sarana_ibadah'%}",
                dataType: 'json',
                type: 'GET',
                success: function(response) {
                    // loaderPage(false);
                    // map.setView([-4.125826277307029, 104.1881561279297], 13);
                    // var len = response['kecamatan'].length;
                    // console.log(response)
                    var data_de = []
                    for (var i = 0; i < response['sarana_ibadah'].length; i++) {
                        geoj = response['sarana_ibadah'][i];
                        data_de.push(geoj);
                    }
                    // console.log(data_de)
                    geo_json_po_sarana_ibadah(data_de);
                    newe(markeribdh, geo_po_sarana_ibadah, checkBox)
                }
            });
Muhamad's avatar
b  
Muhamad committed
2895
        } else {
2896 2897
            markeribdh.clearLayers()
            geo_po_sarana_ibadah.clearLayers()
Muhamad's avatar
b  
Muhamad committed
2898 2899 2900 2901 2902
            markeribdh.remove()
            geo_po_sarana_ibadah.remove()
        }
    }

Muhamad's avatar
Muhamad committed
2903
    $(document).on("click", "#btn_edit_si", function() {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914
        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);

2915
        var idsi = $('#id_si_edit').val();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2916 2917 2918 2919 2920 2921 2922 2923
        loaderPage(false);
        $.ajax({
            url: "{% url 'api:editsi' %}",
            data: {
                'id_point': idsi
            },
            dataType: 'json',
            success: function(data) {
Muhamad's avatar
Muhamad committed
2924 2925 2926 2927
                setTimeout(function() {
                    map_edit.invalidateSize();
                }, 1000);

Manggar Mahardhika's avatar
Manggar Mahardhika committed
2928 2929
                loaderPage(false);
                console.log(data)
Muhamad's avatar
Muhamad committed
2930 2931
                    // map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
                map_edit.setView([data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]], 19);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2932 2933 2934 2935 2936
                let dapoin = [data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]]
                var poinin = L.marker(dapoin).addTo(map_edit)
                poinin.enableEdit();
                $('#saveeditsi').click(function() {
                    var hasil = (JSON.stringify(poinin.toGeoJSON()))
2937
                    $("#coordinateZoneedit_si_edit").val(hasil);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2938 2939 2940 2941 2942 2943
                })
            }
        })
    });

    $(document).on("click", "#saveeditsi", function() {
2944 2945
        var idsi = $('#id_si_edit').val();
        var poi = $('#coordinateZoneedit_si_edit').val();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2946
        var data = new FormData();
2947
        data.append("file", $("input[id^='filesi']")[0].files[0]);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2948
        data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
Muhamad's avatar
Muhamad committed
2949
        data.append('idsi', idsi)
2950 2951 2952 2953 2954
        data.append('namobj', $('#namobj_si_edit').val())
        data.append('remark', $('#remark_si_edit').val())
        data.append('luastanah', $('#luas_tanah_si_edit').val())
        data.append('alamat', $('#alamat_si_edit').val())
        data.append('perangkat', $('#perangkat_si_edit').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2955
        data.append('point', poi),
2956
            data.append('gambar', $('#gambar_si_edit').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2957 2958
        $.ajax({
            url: "{% url 'api:ibadah' %}",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2959
            data: data,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2960 2961
            dataType: 'json',
            type: 'POST',
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2962 2963
            processData: false,
            contentType: false,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2964
            success: function(data) {
2965 2966 2967 2968 2969 2970 2971 2972 2973
                let response = data
                if (response.status == 0) {
                    swal({
                        title: response.info,
                        text: response.data,
                        type: "success",
                        icon: "success",
                        confirmButtonColor: "#00BCD4"
                    }, function() {
Muhamad's avatar
Muhamad committed
2974 2975
                        $("#modal_adm").modal('hide');
                        $("#modal_detail_non_kelurahan").modal('hide')
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2976
                        location.reload();
2977 2978 2979 2980 2981 2982 2983 2984 2985 2986
                    })
                } else {
                    swal({
                        title: 'Error',
                        text: 'Hubungi Developer',
                        type: "warning",
                        icon: "error",
                        confirmButtonColor: "#00BCD4"
                    })
                }
Muhamad's avatar
Muhamad committed
2987
                //location.reload()
Manggar Mahardhika's avatar
Manggar Mahardhika committed
2988 2989 2990 2991 2992
            }
        })

    });

2993 2994
    // var sarana_pendidikan = "{{ sarana_pendidikan }}".replace(/&#x27;/g, '"');
    // var result_sarana_pendidikan = JSON.parse("" + sarana_pendidikan + "")
Muhamad's avatar
b  
Muhamad committed
2995 2996 2997 2998 2999

    var geo_po_sarana_pendidikan = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            if (feature.administrasi.f2 == 'Pendidikan Tinggi') {
                var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3000
                    iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
3001 3002
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3003
                    iconUrl: '/static/img/icon-1/GraduationCap-tes.svg'
Muhamad's avatar
Muhamad committed
3004 3005 3006 3007
                        // iconUrl: 'static/img/icon/kampus.svg',
                        // shadowUrl: 'static/img/icon/shadow.svg',
                        // shadowSize: [35, 35],
                        // shadowAnchor: [19, 30]
Muhamad's avatar
b  
Muhamad committed
3008 3009 3010 3011
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
3029 3030
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3031 3032
                    direction: 'top',
                    offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
3033 3034 3035 3036
                });
                return marker
            } else if (feature.administrasi.f2 == 'Perpustakaan') {
                var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3037
                    iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
3038 3039
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3040
                    iconUrl: '/static/img/icon-1/GraduationCap-tes.svg'
Muhamad's avatar
Muhamad committed
3041 3042 3043 3044
                        // iconUrl: 'static/img/icon/perpus.svg',
                        // shadowUrl: 'static/img/icon/shadow.svg',
                        // shadowSize: [35, 35],
                        // shadowAnchor: [22, 31]
Muhamad's avatar
b  
Muhamad committed
3045 3046 3047 3048 3049

                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
3067 3068
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3069 3070
                    direction: 'top',
                    offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
3071 3072 3073 3074
                });
                return marker
            } else {
                var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3075
                    iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
3076 3077
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3078
                    iconUrl: '/static/img/icon-1/GraduationCap-tes.svg'
Muhamad's avatar
Muhamad committed
3079 3080 3081 3082
                        // iconUrl: 'static/img/icon/sekolah.svg',
                        // shadowUrl: 'static/img/icon/shadow.svg',
                        // shadowSize: [35, 35],
                        // shadowAnchor: [22, 31]
Muhamad's avatar
b  
Muhamad committed
3083 3084 3085 3086
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101
                // conte = `
                //         <div id="bottom-justified-data" style="text-align: center;">
                //             <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                //             letter-spacing: 0">
                //                 <p>
                //                     ` + feature.administrasi.f1 + `
                //                 </p>
                //             </div>
                //         </div>
                //     `;
                // marker.bindPopup(conte,{
                //     closeOnClick: false,
                //     maxWidth: 100,
                //     permanent: true
                // });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118
                conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
                marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
3119 3120
                    permanent: false,
                    className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3121 3122
                    direction: 'top',
                    offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
3123 3124 3125
                });
                return marker
            }
Muhamad's avatar
Muhamad committed
3126 3127
        },
        onEachFeature: function(feature, layer) {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3128

Muhamad's avatar
Muhamad committed
3129 3130
            layer.on({
                click: function(e) {
3131
                    $("#modal_detail_non_kelurahan").modal('show');
Muhamad's avatar
Muhamad committed
3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142
                    var tay;
                    var geocodeService = L.esri.Geocoding.geocodeService();
                    var geocoderNominatim = new L.Control.Geocoder.Nominatim();
                    var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
                        tay = result.address.Address;
                        if (feature.administrasi.f3 == 'alamat') {
                            if (tay != '') {
                                var alamak = tay;

                            } else {
                                alamak = ""
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3143
                            }
Muhamad's avatar
Muhamad committed
3144 3145 3146 3147 3148 3149

                        } else {
                            var alamak = feature.administrasi.f3;

                        }
                        if (feature.administrasi.f10 == 'bpk') {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3150
                            var raja = "";
Muhamad's avatar
Muhamad committed
3151 3152 3153
                        } else {
                            var raja = feature.administrasi.f10;
                        }
3154 3155 3156
                        content_edit_sp = `
                            <div class="modal-dialog md">
                                <div class="modal-content">
3157
                                    <div class="modal-header bg-info" >
3158 3159 3160 3161 3162 3163
                                            <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                            <h6 class="modal-title">Edit Point</h6>
                                    </div>
                                        
                                        <div class="tab-pane has-padding" id="panel-tab2">
                                            <div class="tab-pane" id="bottom-justified-data">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3164

3165 3166
                                                <div class="tabbable">
                                                    <ul class="nav nav-tabs nav-tabs-bottom nav-justified">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3167 3168
                                                        <li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
                                                        <li onclick="changetabs(this)"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
3169
                                                    </ul>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3170

3171
                                                    <div class="tab-content">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3172

Manggar Mahardhika's avatar
Manggar Mahardhika committed
3173
                                                        <div class="tab-pane" id="left-tab1-feas-upli">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3174

Muhamad's avatar
Muhamad committed
3175
                                                            <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3176

3177 3178 3179 3180
                                                                        <div class="form-group">
                                                                                <input style="display:none;" id="id_sp_edit" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                                                <input style="display:none;" id="coordinateZoneedit_sp_edit" type="text" class="form-control" value=""required>
                                                                        </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3181

3182 3183 3184 3185 3186
                                                                    <div class="row" style="margin-top: 15px;">
                                                                        <div class="form-group">
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                                            <div class="col-lg-9">
                                                                                <input id="namobj_sp_edit" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required>    
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3187
                                                                            </div>
3188 3189 3190
                                                                            
                                                                        </div>
                                                                    </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3191

3192 3193 3194 3195 3196 3197 3198
                                                                    <div class="row" style="margin-top: 15px;">
                                                                        <div class="form-group">
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                                            <div class="col-lg-8">
                                                                                <select id="remark_sp_edit" style="margin-top: 15px;">
                                                                                    <option>` + feature.administrasi.f2 + `</option>
                                                                                </select>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3199
                                                                            </div>
3200 3201 3202 3203 3204 3205 3206 3207
                                                                        </div>
                                                                    </div>
                                                
                                                                    <div class="row" style="margin-top: 15px;">
                                                                        <div class="form-group">
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Alamat</label>
                                                                            <div class="col-lg-4">
                                                                                <input id="alamat_sp_edit" type="text" class="form-control" value="` + alamak + `"required>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3208
                                                                            </div>
3209 3210 3211
                                                                            <div class="col-lg-4" style="margin-top: 15px;">` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `</div>
                                                                        </div>
                                                                    </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3212

3213 3214 3215 3216 3217 3218
                                                                    <div class="row" style="margin-top: 15px;">
                                                                        
                                                                        <div class="form-group">
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Luas Tanah</label>
                                                                            <div class="col-lg-6">
                                                                                <input id="luas_tanah_sp_edit" type="text" class="form-control" value="` + feature.administrasi.f5 + `"required>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3219
                                                                            </div>
3220 3221 3222 3223 3224 3225
                                                                            <div class="col-lg-3">
                                                                                <select id="satuan_luas_tanah" style="margin-top: 15px;">
                                                                                    <option>m2</option>
                                                                                    <option>Km2</option>
                                                                                    <option>Hektar</option>
                                                                                </select>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3226
                                                                            </div>
3227
                                                                        </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3228
                                                                    </div>
3229 3230
                                                
                                                                    <div class="row" style="margin-top: 15px;">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3231
                                                                        <div class="form-group">
3232 3233 3234
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Pimpinan</label>
                                                                            <div class="col-lg-9">
                                                                                <input id="perangkat_sp_edit" type="text" class="form-control" value="` + raja + `"required>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3235 3236
                                                                            </div>
                                                                        </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3237
                                                                    </div>
3238 3239 3240
                                                            
                                                            </div>
                                                        </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3241

Manggar Mahardhika's avatar
Manggar Mahardhika committed
3242
                                                        <div class="tab-pane active" id="right-tab2-feas-upli">
3243
                                                            <div class="form-group">
Muhamad's avatar
Muhamad committed
3244
                                                                <div id="map-for-edit" style="height: 300px;position: relative;margin: 10px;"></div>
3245 3246 3247
                                                                <div class="form-group">
                                                                    <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
                                                                    <div class="col-lg-9" style="margin-top:10px">
3248
                                                                        <input type="file" id="filesp" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
3249 3250 3251
                                                                        <input style="display:none;" id="gambar_sp_edit" type="text" class="form-control" value="` + feature.administrasi.f8 + `"required>
                                                                    </div>
                                                                </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3252 3253
                                                            </div>
                                                        </div>
3254

Manggar Mahardhika's avatar
Manggar Mahardhika committed
3255 3256
                                                    </div>
                                                </div>
3257 3258
                                            </div>
                                        </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3259

3260 3261 3262
                                        <hr>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-info" id="saveeditsp">Save changes</button>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3263 3264
                                        </div>
                                </div>
3265
                            </div>`
3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282

                        if (feature.administrasi.f8 == 'None') {
                            var gmb = "static/img/image_null.png";
                        } 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 + `
                                                            </span>
                                                        </div>
                                                        <div>
                                                            <span>
                                                                ` +
Muhamad's avatar
Muhamad committed
3283
                            alamak + `, ` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `, ` + feature.administrasi.f12 + `
3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321
                                                            </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="">
                                                        <div>
                                                            <div>
                                                                <span>Jenis Bangunan</span>
                                                            </div>
                                                            <div>
                                                                <span>
                                                                    ` + feature.administrasi.f2 + `
                                                                </span>
                                                            </div>
                                                        </div>
                                                        <div>
                                                            <div>
                                                                <span>Luas</span>
                                                            </div>
                                                            <div>
                                                                <span style="font-family: 'Roboto';">` + feature.administrasi.f5 + ` m</span>
                                                            </div>
                                                        </div>
    
                                                        <div>
                                                            <div>
                                                                <span>Pimpinan</span>
                                                            </div>
                                                            <div>
                                                                <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_sp" 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>
Muhamad's avatar
Muhamad committed
3322 3323 3324
                                                            <div class="tombol-delete-keterangan text-center" style="background-color: indianred;position: absolute;width: 40px;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
                                                                <a href="#" id="btn_delete_adm" data-toggle="modal" data-target="#modald_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="Delete"><i class="icon-eraser2"></i></a>
                                                            </div>
3325
                                                            `)
Muhamad's avatar
Muhamad committed
3326 3327 3328 3329 3330 3331 3332
                        if (list_perm.indexOf('delete_sarana_pendidikan') >= 0 === false) {
                            $(".tombol-delete-keterangan").remove();
                        }

                        if (list_perm.indexOf('change_sarana_pendidikan') >= 0 === false) {
                            $(".tombol-edit-keterangan").remove();
                        }
Muhamad's avatar
Muhamad committed
3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370
                        content_delete_point = `
                            <div class="modal-dialog md">
                                        <div class="modal-content">
                                            <div class="modal-header bg-info">
                                                    <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                                    <h6 class="modal-title">Delete Point</h6>
                                            </div>
                                            <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
                                                <input style="display:none;" id="id_adm_del" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                <input style="display:none;" id="nama_table" type="text" class="form-control" value="geo_sarana_pendidikan"required>
                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                        <div class="col-lg-9">
                                                            <input id="namobj_adm_del" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required disabled>    
                                                        </div>
                                                        
                                                    </div>
                                                </div>

                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                        <div class="col-lg-8">
                                                            <input id="remark_adm_del" type="text" class="form-control" value="` + feature.administrasi.f2 + `"required disabled>
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>
                                            <hr>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-info" id="deletepointot">Hapus</button>
                                            </div>
                                        </div>
                                    </div>`;

                        $("#modald_adm").html(content_delete_point)
3371

3372
                        $("#modal_adm").html(content_edit_sp)
3373
                        panel_samp();
Muhamad's avatar
Muhamad committed
3374 3375 3376 3377
                    })
                    hidelegend();
                }
            })
Muhamad's avatar
b  
Muhamad committed
3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399
        }
    });

    var markerpend = L.markerClusterGroup({
        iconCreateFunction: function(cluster) {
            var childCount = cluster.getChildCount();

            return new L.DivIcon({
                html: '<div><span>' + childCount + '</span></div>',
                className: 'marker-cluster-pend',
                iconSize: new L.Point(40, 40)
            });
        },
        //Disable all of the defaults:
        spiderfyOnMaxZoom: false,
        showCoverageOnHover: false
    });

    function geo_json_po_sarana_pendidikan(data) {
        geo_po_sarana_pendidikan.addData(data)
    }

3400
    // geo_json_po_sarana_pendidikan(result_sarana_pendidikan);
Muhamad's avatar
b  
Muhamad committed
3401 3402

    function didik() {
3403 3404 3405 3406 3407 3408 3409 3410
        // var checkBox = document.getElementById("dididik");
        // if (checkBox.checked == true) {
        //     newe(markerpend, geo_po_sarana_pendidikan, checkBox)
        // } else {
        //     markerpend.remove()
        //     geo_po_sarana_pendidikan.remove()
        //         // valket()
        // }
Muhamad's avatar
b  
Muhamad committed
3411 3412
        var checkBox = document.getElementById("dididik");
        if (checkBox.checked == true) {
3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432
            // loaderPage(true);
            $.ajax({
                url: "{% url 'api:sarana_pendidikan'%}",
                dataType: 'json',
                type: 'GET',
                success: function(response) {
                    // loaderPage(false);
                    // map.setView([-4.125826277307029, 104.1881561279297], 13);
                    // var len = response['kecamatan'].length;
                    // console.log(response)
                    var data_de = []
                    for (var i = 0; i < response['sarana_pendidikan'].length; i++) {
                        geoj = response['sarana_pendidikan'][i];
                        data_de.push(geoj);
                    }
                    // console.log(data_de)
                    geo_json_po_sarana_pendidikan(data_de);
                    newe(markerpend, geo_po_sarana_pendidikan, checkBox)
                }
            });
Muhamad's avatar
b  
Muhamad committed
3433
        } else {
3434 3435
            markerpend.clearLayers()
            geo_po_sarana_pendidikan.clearLayers()
Muhamad's avatar
b  
Muhamad committed
3436 3437 3438 3439 3440
            markerpend.remove()
            geo_po_sarana_pendidikan.remove()
        }
    }

Muhamad's avatar
Muhamad committed
3441
    $(document).on("click", "#btn_edit_sp", function() {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452
        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);

3453
        var idsp = $('#id_sp_edit').val();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3454 3455 3456 3457 3458 3459 3460 3461
        loaderPage(false);
        $.ajax({
            url: "{% url 'api:editsp' %}",
            data: {
                'id_point': idsp
            },
            dataType: 'json',
            success: function(data) {
Muhamad's avatar
Muhamad committed
3462 3463 3464 3465
                setTimeout(function() {
                    map_edit.invalidateSize();
                }, 1000);

Manggar Mahardhika's avatar
Manggar Mahardhika committed
3466 3467
                loaderPage(false);
                console.log(data)
Muhamad's avatar
Muhamad committed
3468 3469
                    // map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
                map_edit.setView([data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]], 19);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3470 3471 3472 3473 3474
                let dapoin = [data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]]
                var poinin = L.marker(dapoin).addTo(map_edit)
                poinin.enableEdit();
                $('#saveeditsp').click(function() {
                    var hasil = (JSON.stringify(poinin.toGeoJSON()))
3475
                    $("#coordinateZoneedit_sp_edit").val(hasil);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3476 3477 3478 3479 3480 3481
                })
            }
        })
    });

    $(document).on("click", "#saveeditsp", function() {
3482 3483
        var idsp = $('#id_sp_edit').val();
        var poi = $('#coordinateZoneedit_sp_edit').val();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3484
        var data = new FormData();
3485
        data.append("file", $("input[id^='filesp']")[0].files[0]);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3486
        data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
Muhamad's avatar
Muhamad committed
3487
        data.append('idsp', idsp)
3488 3489 3490 3491 3492
        data.append('namobj', $('#namobj_sp_edit').val())
        data.append('remark', $('#remark_sp_edit').val())
        data.append('luastanah', $('#luas_tanah_sp_edit').val())
        data.append('alamat', $('#alamat_sp_edit').val())
        data.append('perangkat', $('#perangkat_sp_edit').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3493
        data.append('point', poi),
Muhamad's avatar
Muhamad committed
3494
            data.append('gambar', $('#gambar_sp_edit').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3495 3496 3497

        $.ajax({
            url: "{% url 'api:sekolah' %}",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3498
            data: data,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3499 3500
            dataType: 'json',
            type: 'POST',
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3501 3502
            processData: false,
            contentType: false,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3503
            success: function(data) {
3504 3505 3506 3507 3508 3509 3510 3511 3512
                let response = data
                if (response.status == 0) {
                    swal({
                        title: response.info,
                        text: response.data,
                        type: "success",
                        icon: "success",
                        confirmButtonColor: "#00BCD4"
                    }, function() {
Muhamad's avatar
Muhamad committed
3513 3514
                        $("#modal_adm").modal('hide');
                        $("#modal_detail_non_kelurahan").modal('hide')
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3515
                        location.reload();
3516 3517 3518 3519 3520 3521 3522 3523 3524 3525
                    })
                } else {
                    swal({
                        title: 'Error',
                        text: 'Hubungi Developer',
                        type: "warning",
                        icon: "error",
                        confirmButtonColor: "#00BCD4"
                    })
                }
Muhamad's avatar
Muhamad committed
3526
                //location.reload()
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3527 3528 3529 3530
            }
        })
    });

3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598
    // var spbu = "{{ spbu }}".replace(/&#x27;/g, '"');
    // var result_spbu = JSON.parse("" + spbu + "")

    // var geo_po_spbu = L.geoJson(null, {
    //     pointToLayer: function(feature, latlng) {
    //         var smallIcon = new L.Icon({
    //             iconSize: [25, 25],
    //             iconAnchor: [13, 27],
    //             popupAnchor: [1, -24],
    //             iconUrl: 'static/img/icon/pom.svg',
    //             shadowUrl: 'static/img/icon/shadow.svg',
    //             shadowSize: [35, 35],
    //             shadowAnchor: [19, 30]
    //         });
    //         var marker = L.marker(latlng, {
    //             icon: smallIcon
    //         });
    //         conten = `
    //                     <div id="bottom-justified-data" style="text-align: center;">
    //                         <div >
    //                             <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
    //                         </div>

    //                         <div >
    //                             <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
    //                             letter-spacing: 0">
    //                                 <p >
    //                                     ` + feature.administrasi.f1 + `
    //                                 </p>
    //                             </div>
    //                         </div>
    //                     </div>
    //                 `;
    //         marker.bindTooltip(conten, {
    //             permanent: false,
    //             className: "my-label",
    //             direction: 'top',
    //             offset: [0, -25]
    //         });
    //         return marker
    //     },
    //     onEachFeature: function(feature, layer) {
    //         layer.on({
    //             click: function(e) {
    //                 var tay;
    //                 var geocodeService = L.esri.Geocoding.geocodeService();
    //                 var geocoderNominatim = new L.Control.Geocoder.Nominatim();
    //                 var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
    //                     tay = result.address.Address;
    //                     // aladije(result.address.Address)
    //                     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 = "";
    //                     } else {
    //                         var raja = feature.administrasi.f10;
    //                     }
    //                     content_edit_spbu = `
Muhamad's avatar
Muhamad committed
3599

3600 3601 3602 3603 3604 3605
    //                                 <div class="modal-dialog md">
    //                                     <div class="modal-content">
    //                                         <div class="modal-header bg-info" >
    //                                                 <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
    //                                                 <h6 class="modal-title">Edit Point</h6>
    //                                         </div>
Muhamad's avatar
Muhamad committed
3606

3607 3608
    //                                             <div class="tab-pane has-padding" id="panel-tab2">
    //                                                 <div class="tab-pane" id="bottom-justified-data">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3609

3610 3611 3612 3613 3614
    //                                                     <div class="tabbable">
    //                                                         <ul class="nav nav-tabs nav-tabs-bottom nav-justified">
    //                                                             <li onclick="changetabs(this) class="active""><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
    //                                                             <li onclick="changetabs(this)"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
    //                                                         </ul>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3615

3616
    //                                                         <div class="tab-content">
Muhamad's avatar
Muhamad committed
3617

3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645
    //                                                             <div class="tab-pane active" id="right-tab2-feas-upli">
    //                                                                 <div class="form-group">
    //                                                                     <div id="map-for-edit" style="height: 300px;position: relative;margin: 10px;"></div>
    //                                                                     <div class="form-group">
    //                                                                         <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
    //                                                                         <div class="col-lg-9" style="margin-top:10px">
    //                                                                             <input type="file" id="filespbu" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
    //                                                                             <input style="display:none;" id="gambarspbu" type="text" class="form-control" value="` + feature.administrasi.f8 + `"required>
    //                                                                         </div>
    //                                                                     </div>
    //                                                                 </div>
    //                                                             </div>

    //                                                             <div class="tab-pane" id="left-tab1-feas-upli">

    //                                                                 <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">

    //                                                                             <div class="form-group">
    //                                                                                     <input style="display:none;" id="idspbu" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
    //                                                                                     <input style="display:none;" id="coordinateZoneeditspbu" type="text" class="form-control" value=""required>
    //                                                                             </div>

    //                                                                         <div class="row" style="margin-top: 15px;">
    //                                                                             <div class="form-group">
    //                                                                                 <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
    //                                                                                 <div class="col-lg-9">
    //                                                                                     <input id="namobj" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required>    
    //                                                                                 </div>
Muhamad's avatar
Muhamad committed
3646

3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659
    //                                                                             </div>
    //                                                                         </div>

    //                                                                         <div class="row" style="margin-top: 15px;">
    //                                                                             <div class="form-group">
    //                                                                                 <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
    //                                                                                 <div class="col-lg-8">
    //                                                                                     <select id="remark" style="margin-top: 15px;">
    //                                                                                         <option>` + feature.administrasi.f2 + `</option>
    //                                                                                     </select>
    //                                                                                 </div>
    //                                                                             </div>
    //                                                                         </div>
Muhamad's avatar
Muhamad committed
3660

3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671
    //                                                                         <div class="row" style="margin-top: 15px;">
    //                                                                             <div class="form-group">
    //                                                                                 <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Alamat</label>
    //                                                                                 <div class="col-lg-4">
    //                                                                                     <input id="alamat" type="text" class="form-control" value="` + alamak + `"required>
    //                                                                                 </div>
    //                                                                                 <div class="col-lg-4" style="margin-top: 15px;">` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `</div>
    //                                                                             </div>
    //                                                                         </div>

    //                                                                         <div class="row" style="margin-top: 15px;">
Muhamad's avatar
Muhamad committed
3672

3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686
    //                                                                             <div class="form-group">
    //                                                                                 <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Luas Tanah</label>
    //                                                                                 <div class="col-lg-6">
    //                                                                                     <input id="luas_tanah" type="text" class="form-control" value="` + feature.administrasi.f5 + `"required>
    //                                                                                 </div>
    //                                                                                 <div class="col-lg-3">
    //                                                                                     <select id="satuan_luas_tanah" style="margin-top: 15px;">
    //                                                                                         <option>m2</option>
    //                                                                                         <option>Km2</option>
    //                                                                                         <option>Hektar</option>
    //                                                                                     </select>
    //                                                                                 </div>
    //                                                                             </div>
    //                                                                         </div>
Muhamad's avatar
Muhamad committed
3687

3688 3689 3690 3691 3692 3693 3694 3695
    //                                                                         <div class="row" style="margin-top: 15px;">
    //                                                                             <div class="form-group">
    //                                                                                 <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Pemilik</label>
    //                                                                                 <div class="col-lg-9">
    //                                                                                     <input id="perangkat" type="text" class="form-control" value="` + raja + `"required>
    //                                                                                 </div>
    //                                                                             </div>
    //                                                                         </div>
Muhamad's avatar
Muhamad committed
3696

3697 3698
    //                                                                 </div>
    //                                                             </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3699

3700 3701 3702 3703
    //                                                         </div>
    //                                                     </div>
    //                                                 </div>
    //                                             </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3704

3705 3706
    //                                             <hr>
    //                                             <div class="modal-footer">
Muhamad's avatar
Muhamad committed
3707

3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905
    //                                                 <button type="button" class="btn btn-info" id="saveeditspbu">Save changes</button>
    //                                             </div>
    //                                     </div>
    //                                 </div>`
    //                     content_spbu = `
    //                     <form id="fspbu">
    //                         <table class="table table-hover tasks-list">
    //                             <thead style="text-align: center;">
    //                                 <tr>
    //                                     <th style="padding: 0 0 0 0px;">
    //                                         <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 100%;max-height: 237px;height:237"> 
    //                                     </th>
    //                                 </tr>
    //                             </thead>
    //                             <tbody>
    //                                 <div class= "container">
    //                                     <tr style="height: 100px;">
    //                                         <th>
    //                                             <div>
    //                                                 <h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
    //                                                 letter-spacing: 0;
    //                                                 font-weight: 400;">
    //                                                     <span style="font-size: x-large;">
    //                                                         ` + feature.administrasi.f1 + `
    //                                                     </span>
    //                                                 </h1>
    //                                             </div>
    //                                         </th>
    //                                     </tr>
    //                                 </div>
    //                                 <div class= "container">
    //                                     <tr style="height: 30px;">
    //                                         <th>
    //                                             <span>
    //                                                 ` + feature.administrasi.f2 + `
    //                                             </span>
    //                                         </th>
    //                                     </tr>
    //                                 </div>
    //                                 <div class= "container">
    //                                     <tr style="height: 40px;">
    //                                         <th>
    //                                             <span>
    //                                                 ` +
    //                         alamak + `, ` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `, ` + feature.administrasi.f12 + `
    //                                             </span>
    //                                         </th>
    //                                     </tr>
    //                                 </div>
    //                                 <div class= "container">
    //                                     <tr style="height: 40px;">
    //                                         <th>
    //                                             <p>
    //                                                 <span>Luas Tanah : ` + feature.administrasi.f5 + ` </span><span style="font-weight: 700;">&#13217;</span>
    //                                             </p>
    //                                         </th>
    //                                     </tr>
    //                                 </div>
    //                                 <div class= "container">
    //                                     <tr style="height: 40px;">
    //                                         <th>
    //                                             <p>
    //                                                 <span>Pemilik : </span>
    //                                             </p>
    //                                             <p>
    //                                                 <span>` + raja + `</span>
    //                                             </p>
    //                                         </th>
    //                                     </tr>
    //                                 </div>
    //                                 <div class= "container">
    //                                     <tr style="height: 40px;">
    //                                         <th>
    //                                             <p class="text-center" style="margin-top: 25px;">
    //                                                 <a href="#" id='btn_edit_spbu' class="btn btn-primary" data-toggle="modal" data-target="#modal_adm" data-backdrop="static" data-keyboard="false"><i>Edit Informasi Point</i></a>
    //                                             </p>
    //                                         </th>
    //                                     </tr>
    //                                 </div>
    //                             </tbody>
    //                         </table>
    //                     </form>`;
    //                     $("#isi_panel").html(content_spbu)
    //                     $("#modal_adm").html(content_edit_spbu)
    //                     panel_samp();
    //                 })
    //                 hidelegend();
    //             }
    //         })
    //     }
    // });

    // function geo_json_po_spbu(data) {
    //     geo_po_spbu.addData(data)
    // }

    // geo_json_po_spbu(result_spbu);

    // function pom_mini() {
    //     var checkBox = document.getElementById("pom_bengsin");
    //     if (checkBox.checked == true) {
    //         geo_po_spbu.addTo(map)
    //     } else {
    //         geo_po_spbu.remove()
    //         valket()
    //     }
    // }

    // $(document).on("click", "#btn_edit_spbu", 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 idspbu = $('#idspbu').val();
    //     loaderPage(false);
    //     $.ajax({
    //         url: "{% url 'api:editpom' %}",
    //         data: {
    //             'id_point': idspbu
    //         },
    //         dataType: 'json',
    //         success: function(data) {
    //             setTimeout(function() {
    //                 map_edit.invalidateSize();
    //             }, 1000);

    //             loaderPage(false);
    //             console.log(data)
    //                 // map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
    //             map_edit.setView([data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]], 19);
    //             let dapoin = [data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]]
    //             var poinin = L.marker(dapoin).addTo(map_edit)
    //             poinin.enableEdit();
    //             $('#saveeditspbu').click(function() {
    //                 var hasil = (JSON.stringify(poinin.toGeoJSON()))
    //                 $("#coordinateZoneeditspbu").val(hasil);
    //             })
    //         }
    //     })
    // });

    // $(document).on("click", "#saveeditspbu", function() {
    //     var idspbu = $('#idspbu').val();
    //     var poi = $('#coordinateZoneeditspbu').val();
    //     console.log(poi)
    //     var data = new FormData();
    //     data.append("file", $("input[id^='filespbu']")[0].files[0]);
    //     data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
    //     data.append('idspbu', idspbu)
    //     data.append('namobj', $('#namobj').val())
    //     data.append('remark', $('#remark').val())
    //     data.append('luastanah', $('#luas_tanah').val())
    //     data.append('alamat', $('#alamat').val())
    //     data.append('perangkat', $('#perangkat').val())
    //     data.append('point', poi),
    //         data.append('gambar', $('#gambarspbu').val())
    //     $.ajax({
    //         url: "{% url 'api:spbu' %}",
    //         data: data,
    //         dataType: 'json',
    //         type: 'POST',
    //         processData: false,
    //         contentType: false,
    //         success: function(data) {
    //             let response = data
    //             if (response.status == 0) {
    //                 swal({
    //                     title: response.info,
    //                     text: response.data,
    //                     type: "success",
    //                     icon: "success",
    //                     confirmButtonColor: "#00BCD4"
    //                 }, function() {
    //                     $("#modal_adm").modal('hide');
    //                     $("#modal_detail_non_kelurahan").modal('hide')
    //                     location.reload();
    //                 })
    //             } else {
    //                 swal({
    //                     title: 'Error',
    //                     text: 'Hubungi Developer',
    //                     type: "warning",
    //                     icon: "error",
    //                     confirmButtonColor: "#00BCD4"
    //                 })
    //             }
    //             //location.reload()
    //         }
    //     })

    // });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3906

3907 3908
    // var stasiun = "{{ stasiun }}".replace(/&#x27;/g, '"');
    // var result_stasiun = JSON.parse("" + stasiun + "")
Muhamad's avatar
b  
Muhamad committed
3909 3910 3911 3912

    var geo_po_stasiun = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3913
                iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
3914 3915
                iconAnchor: [13, 27],
                popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3916
                iconUrl: 'static/img/icon-1/Train-tes.svg'
Muhamad's avatar
Muhamad committed
3917 3918 3919 3920
                    // iconUrl: 'static/img/icon/kereta.svg',
                    // shadowUrl: 'static/img/icon/shadow.svg',
                    // shadowSize: [35, 35],
                    // shadowAnchor: [22, 31]
Muhamad's avatar
b  
Muhamad committed
3921 3922 3923 3924
            });
            var marker = L.marker(latlng, {
                icon: smallIcon
            });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941
            conten = `
                        <div id="bottom-justified-data" style="text-align: center;">
                            <div >
                                <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                            </div>

                            <div >
                                <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                                letter-spacing: 0">
                                    <p>
                                        ` + feature.administrasi.f1 + `
                                    </p>
                                </div>
                            </div>
                        </div>
                    `;
            marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
3942 3943
                permanent: false,
                className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3944 3945
                direction: 'top',
                offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
3946 3947
            });
            return marker
Muhamad's avatar
Muhamad committed
3948 3949 3950 3951
        },
        onEachFeature: function(feature, layer) {
            layer.on({
                click: function(e) {
3952
                    $("#modal_detail_non_kelurahan").modal('show');
Muhamad's avatar
Muhamad committed
3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964
                    var tay;
                    var geocodeService = L.esri.Geocoding.geocodeService();
                    var geocoderNominatim = new L.Control.Geocoder.Nominatim();
                    var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
                        tay = result.address.Address;
                        // aladije(result.address.Address)
                        if (feature.administrasi.f3 == 'alamat') {
                            if (tay != '') {
                                var alamak = tay;

                            } else {
                                alamak = ""
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3965
                            }
Muhamad's avatar
Muhamad committed
3966 3967 3968 3969 3970 3971

                        } else {
                            var alamak = feature.administrasi.f3;

                        }
                        if (feature.administrasi.f10 == 'bpk') {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3972
                            var raja = "";
Muhamad's avatar
Muhamad committed
3973 3974 3975
                        } else {
                            var raja = feature.administrasi.f10;
                        }
3976 3977 3978
                        content_edit_stasiun = `
                            <div class="modal-dialog md">
                                <div class="modal-content">
3979
                                    <div class="modal-header bg-info" >
3980 3981 3982 3983 3984 3985
                                            <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                            <h6 class="modal-title">Edit Point</h6>
                                    </div>
                                        
                                        <div class="tab-pane has-padding" id="panel-tab2">
                                            <div class="tab-pane" id="bottom-justified-data">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3986

3987 3988 3989 3990 3991 3992
                                                <div class="tabbable">
                                                    <ul class="nav nav-tabs nav-tabs-bottom nav-justified">
                                                        <li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
                                                        <li onclick="changetabs(this)"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
                                                        
                                                    </ul>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3993

3994
                                                    <div class="tab-content">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
3995

3996 3997
                                                        <div class="tab-pane active" id="right-tab2-feas-upli">
                                                            <div class="form-group">
Muhamad's avatar
Muhamad committed
3998
                                                                <div id="map-for-edit" style="height: 300px;position: relative;margin: 10px;"></div>
3999 4000 4001 4002 4003 4004 4005 4006 4007
                                                                <div class="form-group">
                                                                    <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
                                                                    <div class="col-lg-9" style="margin-top:10px">
                                                                        <input type="file" id="file" 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.f8 + `"required>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4008

4009
                                                        <div class="tab-pane" id="left-tab1-feas-upli">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4010

Muhamad's avatar
Muhamad committed
4011
                                                            <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4012

4013 4014 4015 4016
                                                                        <div class="form-group">
                                                                                <input style="display:none;" id="idst" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                                                <input style="display:none;" id="coordinateZoneeditst" type="text" class="form-control" value=""required>
                                                                        </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4017

4018 4019 4020 4021 4022
                                                                    <div class="row" style="margin-top: 15px;">
                                                                        <div class="form-group">
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                                            <div class="col-lg-9">
                                                                                <input id="namobj" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required>    
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4023
                                                                            </div>
4024 4025 4026
                                                                            
                                                                        </div>
                                                                    </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4027

4028 4029 4030 4031 4032 4033 4034
                                                                    <div class="row" style="margin-top: 15px;">
                                                                        <div class="form-group">
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                                            <div class="col-lg-8">
                                                                                <select id="remark" style="margin-top: 15px;">
                                                                                    <option>` + feature.administrasi.f2 + `</option>
                                                                                </select>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4035
                                                                            </div>
4036
                                                                        </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4037
                                                                    </div>
4038 4039
                                                
                                                                    <div class="row" style="margin-top: 15px;">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4040
                                                                        <div class="form-group">
4041 4042 4043
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Alamat</label>
                                                                            <div class="col-lg-4">
                                                                                <input id="alamat" type="text" class="form-control" value="` + alamak + `"required>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4044
                                                                            </div>
4045
                                                                            <div class="col-lg-4" style="margin-top: 15px;">` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `</div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4046
                                                                        </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4047
                                                                    </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4048

4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077
                                                                    <div class="row" style="margin-top: 15px;">
                                                                        <div class="form-group">
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Luas Tanah</label>
                                                                            <div class="col-lg-6">
                                                                                <input id="luas_tanah" type="text" class="form-control" value="` + feature.administrasi.f5 + `"required>
                                                                            </div>
                                                                            <div class="col-lg-3">
                                                                                <select id="satuan_luas_tanah" style="margin-top: 15px;">
                                                                                    <option>m2</option>
                                                                                    <option>Km2</option>
                                                                                    <option>Hektar</option>
                                                                                </select>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                
                                                                    <div class="row" style="margin-top: 15px;">
                                                                        <div class="form-group">
                                                                            <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Pemimpin</label>
                                                                            <div class="col-lg-9">
                                                                                <input id="perangkat" type="text" class="form-control" value="` + raja + `"required>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                            
                                                            </div>
                                                        </div>

                                                    </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4078
                                                </div>
4079
                                            </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4080
                                        </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4081

4082 4083 4084 4085 4086 4087
                                        <hr>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-info" id="saveeditst">Save changes</button>
                                        </div>
                                </div>
                            </div>`
4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103
                        if (feature.administrasi.f8 == 'None') {
                            var gmb = "static/img/image_null.png";
                        } 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 + `
                                                            </span>
                                                        </div>
                                                        <div>
                                                            <span>
                                                                ` +
Muhamad's avatar
Muhamad committed
4104
                            alamak + `, ` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `, ` + feature.administrasi.f12 + `
4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142
                                                            </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="">
                                                        <div>
                                                            <div>
                                                                <span>Jenis Bangunan</span>
                                                            </div>
                                                            <div>
                                                                <span>
                                                                    ` + feature.administrasi.f2 + `
                                                                </span>
                                                            </div>
                                                        </div>
                                                        <div>
                                                            <div>
                                                                <span>Luas</span>
                                                            </div>
                                                            <div>
                                                                <span style="font-family: 'Roboto';">` + feature.administrasi.f5 + ` m</span>
                                                            </div>
                                                        </div>
    
                                                        <div>
                                                            <div>
                                                                <span>Pimpinan</span>
                                                            </div>
                                                            <div>
                                                                <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_st" 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>
Muhamad's avatar
Muhamad committed
4143 4144 4145
                                                            <div class="tombol-delete-keterangan text-center" style="background-color: indianred;position: absolute;width: 40px;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
                                                                <a href="#" id="btn_delete_adm" data-toggle="modal" data-target="#modald_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="Delete"><i class="icon-eraser2"></i></a>
                                                            </div>
4146
                                                            `)
Muhamad's avatar
Muhamad committed
4147 4148 4149
                        if (list_perm.indexOf('delete_statiun') >= 0 === false) {
                            $(".tombol-delete-keterangan").remove();
                        }
Muhamad's avatar
Muhamad committed
4150

Muhamad's avatar
Muhamad committed
4151 4152 4153
                        if (list_perm.indexOf('change_stasiun') >= 0 === false) {
                            $(".tombol-edit-keterangan").remove();
                        }
Muhamad's avatar
Muhamad committed
4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191
                        content_delete_point = `
                            <div class="modal-dialog md">
                                        <div class="modal-content">
                                            <div class="modal-header bg-info">
                                                    <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                                    <h6 class="modal-title">Delete Point</h6>
                                            </div>
                                            <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
                                                <input style="display:none;" id="id_adm_del" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                <input style="display:none;" id="nama_table" type="text" class="form-control" value="geo_stasiun" required>
                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                        <div class="col-lg-9">
                                                            <input id="namobj_adm_del" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required disabled>    
                                                        </div>
                                                        
                                                    </div>
                                                </div>

                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                        <div class="col-lg-8">
                                                            <input id="remark_adm_del" type="text" class="form-control" value="` + feature.administrasi.f2 + `"required disabled>
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>
                                            <hr>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-info" id="deletepointot">Hapus</button>
                                            </div>
                                        </div>
                                    </div>`;

                        $("#modald_adm").html(content_delete_point)
4192 4193
                        $("#modal_adm").html(content_edit_stasiun)
                        panel_samp();
Muhamad's avatar
Muhamad committed
4194 4195 4196 4197
                    })
                    hidelegend();
                }
            })
Muhamad's avatar
b  
Muhamad committed
4198 4199 4200 4201 4202 4203 4204
        }
    });

    function geo_json_po_stasiun(data) {
        geo_po_stasiun.addData(data)
    }

4205
    // geo_json_po_stasiun(result_stasiun);
Muhamad's avatar
b  
Muhamad committed
4206 4207

    function sthall() {
4208 4209 4210 4211 4212 4213 4214
        // var checkBox = document.getElementById("tasiun");
        // if (checkBox.checked == true) {
        //     geo_po_stasiun.addTo(map)
        // } else {
        //     geo_po_stasiun.remove()
        //         // valket()
        // }
Muhamad's avatar
b  
Muhamad committed
4215 4216
        var checkBox = document.getElementById("tasiun");
        if (checkBox.checked == true) {
4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236
            // loaderPage(true);
            $.ajax({
                url: "{% url 'api:apiviewstasiun'%}",
                dataType: 'json',
                type: 'GET',
                success: function(response) {
                    // loaderPage(false);
                    // map.setView([-4.125826277307029, 104.1881561279297], 13);
                    // var len = response['kecamatan'].length;
                    // console.log(response)
                    var data_de = []
                    for (var i = 0; i < response['apiviewstasiun'].length; i++) {
                        geoj = response['apiviewstasiun'][i];
                        data_de.push(geoj);
                    }
                    // console.log(data_de)
                    geo_json_po_stasiun(data_de);
                    geo_po_stasiun.addTo(map)
                }
            });
Muhamad's avatar
b  
Muhamad committed
4237
        } else {
4238
            geo_po_stasiun.clearLayers()
Muhamad's avatar
b  
Muhamad committed
4239 4240 4241 4242
            geo_po_stasiun.remove()
        }
    }

Muhamad's avatar
Muhamad committed
4243
    $(document).on("click", "#btn_edit_st", function() {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263
        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 idst = $('#idst').val();
        loaderPage(false);
        $.ajax({
            url: "{% url 'api:editst' %}",
            data: {
                'id_point': idst
            },
            dataType: 'json',
            success: function(data) {
Muhamad's avatar
Muhamad committed
4264 4265 4266 4267
                setTimeout(function() {
                    map_edit.invalidateSize();
                }, 1000);

Manggar Mahardhika's avatar
Manggar Mahardhika committed
4268 4269
                loaderPage(false);
                console.log(data)
Muhamad's avatar
Muhamad committed
4270 4271
                    // map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
                map_edit.setView([data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]], 19);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286
                let dapoin = [data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]]
                var poinin = L.marker(dapoin).addTo(map_edit)
                poinin.enableEdit();
                $('#saveeditst').click(function() {
                    var hasil = (JSON.stringify(poinin.toGeoJSON()))
                    $("#coordinateZoneeditst").val(hasil);
                })
            }
        })
    });

    $(document).on("click", "#saveeditst", function() {
        var idst = $('#idst').val();
        var poi = $('#coordinateZoneeditst').val();
        console.log(poi)
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4287 4288 4289
        var data = new FormData();
        data.append("file", $("input[id^='file']")[0].files[0]);
        data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
Muhamad's avatar
Muhamad committed
4290
        data.append('idst', idst)
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4291 4292 4293 4294 4295
        data.append('namobj', $('#namobj').val())
        data.append('remark', $('#remark').val())
        data.append('luastanah', $('#luas_tanah').val())
        data.append('alamat', $('#alamat').val())
        data.append('perangkat', $('#perangkat').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4296
        data.append('point', poi),
Muhamad's avatar
Muhamad committed
4297
            data.append('gambar', $('#gambar').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4298 4299
        $.ajax({
            url: "{% url 'api:stasiun' %}",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4300
            data: data,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4301 4302
            dataType: 'json',
            type: 'POST',
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4303 4304
            processData: false,
            contentType: false,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4305
            success: function(data) {
4306 4307 4308 4309 4310 4311 4312 4313 4314
                let response = data
                if (response.status == 0) {
                    swal({
                        title: response.info,
                        text: response.data,
                        type: "success",
                        icon: "success",
                        confirmButtonColor: "#00BCD4"
                    }, function() {
Muhamad's avatar
Muhamad committed
4315 4316
                        $("#modal_adm").modal('hide');
                        $("#modal_detail_non_kelurahan").modal('hide')
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4317
                        location.reload();
4318 4319 4320 4321 4322 4323 4324 4325 4326 4327
                    })
                } else {
                    swal({
                        title: 'Error',
                        text: 'Hubungi Developer',
                        type: "warning",
                        icon: "error",
                        confirmButtonColor: "#00BCD4"
                    })
                }
Muhamad's avatar
Muhamad committed
4328
                //location.reload()
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4329 4330 4331 4332 4333
            }
        })

    });

4334 4335
    // var terminal = "{{ terminal }}".replace(/&#x27;/g, '"');
    // var result_terminal = JSON.parse("" + terminal + "")
Muhamad's avatar
b  
Muhamad committed
4336 4337 4338 4339

    var geo_po_terminal = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4340
                iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
4341 4342
                iconAnchor: [13, 27],
                popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4343
                iconUrl: 'static/img/icon-1/Bus-tes.svg'
Muhamad's avatar
Muhamad committed
4344 4345 4346 4347
                    // iconUrl: 'static/img/icon/bus.svg',
                    // shadowUrl: 'static/img/icon/shadow.svg',
                    // shadowSize: [35, 35],
                    // shadowAnchor: [22, 31]
Muhamad's avatar
b  
Muhamad committed
4348 4349 4350 4351
            });
            var marker = L.marker(latlng, {
                icon: smallIcon
            });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368
            conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
            marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
4369 4370
                permanent: false,
                className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4371 4372
                direction: 'top',
                offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
4373 4374
            });
            return marker
Muhamad's avatar
Muhamad committed
4375 4376 4377 4378 4379
        },
        onEachFeature: function(feature, layer) {
            layer.on({
                click: function(e) {
                    var tay;
4380
                    $("#modal_detail_non_kelurahan").modal('show');
Muhamad's avatar
Muhamad committed
4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391
                    var geocodeService = L.esri.Geocoding.geocodeService();
                    var geocoderNominatim = new L.Control.Geocoder.Nominatim();
                    var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
                        tay = result.address.Address;
                        // aladije(result.address.Address)
                        if (feature.administrasi.f3 == 'alamat') {
                            if (tay != '') {
                                var alamak = tay;

                            } else {
                                alamak = ""
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4392
                            }
Muhamad's avatar
Muhamad committed
4393 4394 4395 4396 4397 4398

                        } else {
                            var alamak = feature.administrasi.f3;

                        }
                        if (feature.administrasi.f10 == 'bpk') {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4399
                            var raja = "";
Muhamad's avatar
Muhamad committed
4400 4401 4402
                        } else {
                            var raja = feature.administrasi.f10;
                        }
4403
                        content_edit_terminal = `
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4404 4405
                                    <div class="modal-dialog md">
                                        <div class="modal-content">
4406
                                            <div class="modal-header bg-info" >
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4407 4408 4409 4410 4411 4412 4413 4414 4415
                                                    <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                                    <h6 class="modal-title">Edit Point</h6>
                                            </div>
                                                
                                                <div class="tab-pane has-padding" id="panel-tab2">
                                                    <div class="tab-pane" id="bottom-justified-data">

                                                        <div class="tabbable">
                                                            <ul class="nav nav-tabs nav-tabs-bottom nav-justified">
4416 4417 4418
                                                                <li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
                                                                <li onclick="changetabs(this)"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
                                                                
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4419 4420 4421 4422
                                                            </ul>

                                                            <div class="tab-content">

4423 4424
                                                                <div class="tab-pane active" id="right-tab2-feas-upli">
                                                                    <div class="form-group">
Muhamad's avatar
Muhamad committed
4425
                                                                        <div id="map-for-edit" style="height: 300px;position: relative;margin: 10px;"></div>
4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436
                                                                        <div class="form-group">
                                                                            <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
                                                                            <div class="col-lg-9" style="margin-top:10px">
                                                                                <input type="file" id="file" 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.f8 + `"required>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>

                                                                <div class="tab-pane" id="left-tab1-feas-upli">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4437

Muhamad's avatar
Muhamad committed
4438
                                                                    <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471

                                                                                <div class="form-group">
                                                                                        <input style="display:none;" id="idtr" type="text" class="form-control" value="` + feature.administrasi.f16 + `"required>
                                                                                        <input style="display:none;" id="coordinateZoneedittr" type="text" class="form-control" value=""required>
                                                                                </div>

                                                                            <div class="row" style="margin-top: 15px;">
                                                                                <div class="form-group">
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                                                    <div class="col-lg-9">
                                                                                        <input id="namobj" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required>    
                                                                                    </div>
                                                                                    
                                                                                </div>
                                                                            </div>

                                                                            <div class="row" style="margin-top: 15px;">
                                                                                <div class="form-group">
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                                                    <div class="col-lg-8">
                                                                                        <select id="remark" style="margin-top: 15px;">
                                                                                            <option>` + feature.administrasi.f2 + `</option>
                                                                                        </select>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                        
                                                                            <div class="row" style="margin-top: 15px;">
                                                                                <div class="form-group">
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Alamat</label>
                                                                                    <div class="col-lg-4">
                                                                                        <input id="alamat" type="text" class="form-control" value="` + alamak + `"required>
                                                                                    </div>
Muhamad's avatar
Muhamad committed
4472
                                                                                    <div class="col-lg-4" style="margin-top: 15px;">` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `</div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498
                                                                                </div>
                                                                            </div>

                                                                            <div class="row" style="margin-top: 15px;">
                                                                                <div class="form-group">
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Luas</label>
                                                                                    <div class="col-lg-6">
                                                                                        <input id="luas_bangunan" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                                                    </div>
                                                                                    <div class="col-lg-3">
                                                                                        <select id="satuan_luas_bangunan" style="margin-top: 15px;">
                                                                                            <option>m2</option>
                                                                                        </select>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                        
                                                                            
                                                                    
                                                                    </div>
                                                                </div>

                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4499

Manggar Mahardhika's avatar
Manggar Mahardhika committed
4500 4501
                                                <hr>
                                                <div class="modal-footer">
Muhamad's avatar
Muhamad committed
4502
                                                    
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4503 4504 4505
                                                    <button type="button" class="btn btn-info" id="saveedittr">Save changes</button>
                                                </div>
                                        </div>
4506
                                    </div>`
4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522
                        if (feature.administrasi.f8 == 'None') {
                            var gmb = "static/img/image_null.png";
                        } 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 + `
                                                                    </span>
                                                                </div>
                                                                <div>
                                                                    <span>
                                                                        ` +
Muhamad's avatar
Muhamad committed
4523
                            alamak + `, ` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `, ` + feature.administrasi.f12 + `
4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561
                                                                    </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="">
                                                                <div>
                                                                    <div>
                                                                        <span>Jenis Bangunan</span>
                                                                    </div>
                                                                    <div>
                                                                        <span>
                                                                            ` + feature.administrasi.f2 + `
                                                                        </span>
                                                                    </div>
                                                                </div>
                                                                <div>
                                                                    <div>
                                                                        <span>Luas</span>
                                                                    </div>
                                                                    <div>
                                                                        <span style="font-family: 'Roboto';">` + feature.administrasi.f5 + ` m</span>
                                                                    </div>
                                                                </div>
            
                                                                <div>
                                                                    <div>
                                                                        <span>Pimpinan</span>
                                                                    </div>
                                                                    <div>
                                                                        <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_tr" 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;"><i class="icon-pencil5"></i></a>
                                                                    </div>
Muhamad's avatar
Muhamad committed
4562 4563 4564
                                                                    <div class="tombol-delete-keterangan text-center" style="background-color: indianred;position: absolute;width: 40px;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
                                                                        <a href="#" id="btn_delete_adm" data-toggle="modal" data-target="#modald_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="Delete"><i class="icon-eraser2"></i></a>
                                                                    </div>
4565 4566
                                                                    `)

Muhamad's avatar
Muhamad committed
4567 4568 4569 4570 4571 4572 4573 4574
                        if (list_perm.indexOf('delete_terminal_bus') >= 0 === false) {
                            $(".tombol-delete-keterangan").remove();
                        }

                        if (list_perm.indexOf('change_terminal_bus') >= 0 === false) {
                            $(".tombol-edit-keterangan").remove();
                        }

Muhamad's avatar
Muhamad committed
4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613
                        content_delete_point = `
                            <div class="modal-dialog md">
                                        <div class="modal-content">
                                            <div class="modal-header bg-info">
                                                    <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                                    <h6 class="modal-title">Delete Point</h6>
                                            </div>
                                            <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
                                                <input style="display:none;" id="id_adm_del" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                <input style="display:none;" id="nama_table" type="text" class="form-control" value="geo_terminal" required>
                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                        <div class="col-lg-9">
                                                            <input id="namobj_adm_del" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required disabled>    
                                                        </div>
                                                        
                                                    </div>
                                                </div>

                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                        <div class="col-lg-8">
                                                            <input id="remark_adm_del" type="text" class="form-control" value="` + feature.administrasi.f2 + `"required disabled>
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>
                                            <hr>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-info" id="deletepointot">Hapus</button>
                                            </div>
                                        </div>
                                    </div>`;

                        $("#modald_adm").html(content_delete_point)

4614 4615
                        $("#modal_adm").html(content_edit_terminal)
                        panel_samp();
Muhamad's avatar
Muhamad committed
4616 4617 4618 4619
                    })
                    hidelegend();
                }
            })
Muhamad's avatar
b  
Muhamad committed
4620 4621 4622 4623 4624 4625 4626
        }
    });

    function geo_json_po_terminal(data) {
        geo_po_terminal.addData(data)
    }

4627
    // geo_json_po_terminal(result_terminal);
Muhamad's avatar
b  
Muhamad committed
4628 4629

    function temanggung() {
4630 4631 4632 4633 4634 4635 4636
        // var checkBox = document.getElementById("caheum");
        // if (checkBox.checked == true) {
        //     geo_po_terminal.addTo(map)
        // } else {
        //     geo_po_terminal.remove()
        //         // valket()
        // }
Muhamad's avatar
b  
Muhamad committed
4637 4638
        var checkBox = document.getElementById("caheum");
        if (checkBox.checked == true) {
4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658
            // loaderPage(true);
            $.ajax({
                url: "{% url 'api:apiviewterminal'%}",
                dataType: 'json',
                type: 'GET',
                success: function(response) {
                    // loaderPage(false);
                    // map.setView([-4.125826277307029, 104.1881561279297], 13);
                    // var len = response['kecamatan'].length;
                    // console.log(response)
                    var data_de = []
                    for (var i = 0; i < response['apiviewterminal'].length; i++) {
                        geoj = response['apiviewterminal'][i];
                        data_de.push(geoj);
                    }
                    // console.log(data_de)
                    geo_json_po_terminal(data_de);
                    geo_po_terminal.addTo(map)
                }
            });
Muhamad's avatar
b  
Muhamad committed
4659
        } else {
4660
            geo_po_terminal.clearLayers()
Muhamad's avatar
b  
Muhamad committed
4661 4662 4663 4664
            geo_po_terminal.remove()
        }
    }

Muhamad's avatar
Muhamad committed
4665
    $(document).on("click", "#btn_edit_tr", function() {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685
        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 idtr = $('#idtr').val();
        loaderPage(false);
        $.ajax({
            url: "{% url 'api:edittr' %}",
            data: {
                'id_point': idtr
            },
            dataType: 'json',
            success: function(data) {
Muhamad's avatar
Muhamad committed
4686 4687 4688 4689
                setTimeout(function() {
                    map_edit.invalidateSize();
                }, 1000);

Manggar Mahardhika's avatar
Manggar Mahardhika committed
4690 4691
                loaderPage(false);
                console.log(data)
Muhamad's avatar
Muhamad committed
4692 4693
                    // map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
                map_edit.setView([data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]], 19);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707
                let dapoin = [data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]]
                var poinin = L.marker(dapoin).addTo(map_edit)
                poinin.enableEdit();
                $('#saveedittr').click(function() {
                    var hasil = (JSON.stringify(poinin.toGeoJSON()))
                    $("#coordinateZoneedittr").val(hasil);
                })
            }
        })
    });

    $(document).on("click", "#saveedittr", function() {
        var idtr = $('#idtr').val();
        var poi = $('#coordinateZoneedittr').val();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4708 4709 4710
        var data = new FormData();
        data.append("file", $("input[id^='file']")[0].files[0]);
        data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
Muhamad's avatar
Muhamad committed
4711
        data.append('idtr', idtr)
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4712 4713 4714 4715 4716
        data.append('namobj', $('#namobj').val())
        data.append('remark', $('#remark').val())
        data.append('luas', $('#luas_bangunan').val())
        data.append('alamat', $('#alamat').val())
        data.append('perangkat', $('#perangkat').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4717
        data.append('point', poi),
Muhamad's avatar
Muhamad committed
4718
            data.append('gambar', $('#gambar').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4719 4720 4721

        $.ajax({
            url: "{% url 'api:terminal' %}",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4722
            data: data,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4723 4724
            dataType: 'json',
            type: 'POST',
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4725 4726
            processData: false,
            contentType: false,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4727
            success: function(data) {
4728 4729 4730 4731 4732 4733 4734 4735 4736
                let response = data
                if (response.status == 0) {
                    swal({
                        title: response.info,
                        text: response.data,
                        type: "success",
                        icon: "success",
                        confirmButtonColor: "#00BCD4"
                    }, function() {
Muhamad's avatar
Muhamad committed
4737 4738
                        $("#modal_adm").modal('hide');
                        $("#modal_detail_non_kelurahan").modal('hide')
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4739
                        location.reload();
4740 4741 4742 4743 4744 4745 4746 4747 4748 4749
                    })
                } else {
                    swal({
                        title: 'Error',
                        text: 'Hubungi Developer',
                        type: "warning",
                        icon: "error",
                        confirmButtonColor: "#00BCD4"
                    })
                }
Muhamad's avatar
Muhamad committed
4750
                //location.reload()
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4751 4752 4753 4754 4755
            }
        })

    });

4756 4757
    // var cagar_budaya = "{{ cagar_budaya }}".replace(/&#x27;/g, '"');
    // var result_cagar_budaya = JSON.parse("" + cagar_budaya + "")
Muhamad's avatar
b  
Muhamad committed
4758 4759 4760 4761

    var geo_po_cagar_budaya = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4762
                iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
4763 4764
                iconAnchor: [13, 27],
                popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4765
                iconUrl: 'static/img/icon-1/Factory-tes.svg'
Muhamad's avatar
Muhamad committed
4766 4767 4768 4769
                    // iconUrl: 'static/img/icon/loc.svg',
                    // shadowUrl: 'static/img/icon/shadow.svg',
                    // shadowSize: [35, 35],
                    // shadowAnchor: [22, 31]
Muhamad's avatar
b  
Muhamad committed
4770 4771 4772 4773
            });
            var marker = L.marker(latlng, {
                icon: smallIcon
            });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790
            conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f4 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
            marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
4791 4792
                permanent: false,
                className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4793 4794
                direction: 'top',
                offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
4795 4796
            });
            return marker
Muhamad's avatar
Muhamad committed
4797 4798 4799 4800
        },
        onEachFeature: function(feature, layer) {
            layer.on({
                click: function(e) {
4801
                    $("#modal_detail_non_kelurahan").modal('show');
Muhamad's avatar
Muhamad committed
4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813
                    var tay;
                    var geocodeService = L.esri.Geocoding.geocodeService();
                    var geocoderNominatim = new L.Control.Geocoder.Nominatim();
                    var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
                        tay = result.address.Address;
                        // aladije(result.address.Address)
                        if (feature.administrasi.f3 == 'alamat') {
                            if (tay != '') {
                                var alamak = tay;

                            } else {
                                alamak = ""
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4814
                            }
Muhamad's avatar
Muhamad committed
4815 4816 4817 4818 4819 4820

                        } else {
                            var alamak = feature.administrasi.f3;

                        }
                        if (feature.administrasi.f5 == 'bpk') {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4821
                            var raja = "";
Muhamad's avatar
Muhamad committed
4822 4823 4824
                        } else {
                            var raja = feature.administrasi.f5;
                        }
4825
                        content_edit_cabud = `
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4826 4827
                                    <div class="modal-dialog md">
                                        <div class="modal-content">
4828
                                            <div class="modal-header bg-info" >
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4829 4830 4831 4832 4833 4834 4835 4836 4837
                                                    <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                                    <h6 class="modal-title">Edit Point</h6>
                                            </div>
                                                
                                                <div class="tab-pane has-padding" id="panel-tab2">
                                                    <div class="tab-pane" id="bottom-justified-data">

                                                        <div class="tabbable">
                                                            <ul class="nav nav-tabs nav-tabs-bottom nav-justified">
4838 4839 4840
                                                                <li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
                                                                <li onclick="changetabs(this)"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
                                                                
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4841 4842 4843 4844
                                                            </ul>

                                                            <div class="tab-content">

4845 4846
                                                                <div class="tab-pane active" id="right-tab2-feas-upli">
                                                                    <div class="form-group">
Muhamad's avatar
Muhamad committed
4847
                                                                        <div id="map-for-edit" style="height: 300px;position: relative;margin: 10px;"></div>
4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858
                                                                        <div class="form-group">
                                                                            <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
                                                                            <div class="col-lg-9" style="margin-top:10px">
                                                                                <input type="file" id="file" 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.f4 + `"required>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>

                                                                <div class="tab-pane" id="left-tab1-feas-upli">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4859

Muhamad's avatar
Muhamad committed
4860
                                                                    <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893

                                                                                <div class="form-group">
                                                                                        <input style="display:none;" id="idcb" type="text" class="form-control" value="` + feature.administrasi.f11 + `"required>
                                                                                        <input style="display:none;" id="coordinateZoneeditcb" type="text" class="form-control" value=""required>
                                                                                </div>

                                                                            <div class="row" style="margin-top: 15px;">
                                                                                <div class="form-group">
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                                                    <div class="col-lg-9">
                                                                                        <input id="namobj" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required>    
                                                                                    </div>
                                                                                    
                                                                                </div>
                                                                            </div>

                                                                            <div class="row" style="margin-top: 15px;">
                                                                                <div class="form-group">
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                                                    <div class="col-lg-8">
                                                                                        <select id="remark" style="margin-top: 15px;">
                                                                                            <option>` + feature.administrasi.f2 + `</option>
                                                                                        </select>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                        
                                                                            <div class="row" style="margin-top: 15px;">
                                                                                <div class="form-group">
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Alamat</label>
                                                                                    <div class="col-lg-4">
                                                                                        <input id="alamat" type="text" class="form-control" value="` + alamak + `"required>
                                                                                    </div>
Muhamad's avatar
Muhamad committed
4894
                                                                                    <div class="col-lg-4" style="margin-top: 15px;">` + feature.administrasi.f9 + `, ` + feature.administrasi.f8 + `</div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919
                                                                                </div>
                                                                            </div>

                                                                            <div class="row" style="margin-top: 15px;">
                                                                                <div class="form-group">
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Luas</label>
                                                                                    <div class="col-lg-6">
                                                                                        <input id="luas_bangunan" type="text" class="form-control" value="` + feature.administrasi.f10 + `"required>
                                                                                    </div>
                                                                                    <div class="col-lg-3">
                                                                                        <select id="satuan_luas_bangunan" style="margin-top: 15px;">
                                                                                            <option>m2</option>
                                                                                        </select>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                        
                                                                            
                                                                    
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
4920

Manggar Mahardhika's avatar
Manggar Mahardhika committed
4921 4922
                                                <hr>
                                                <div class="modal-footer">
Muhamad's avatar
Muhamad committed
4923

Manggar Mahardhika's avatar
Manggar Mahardhika committed
4924 4925 4926
                                                    <button type="button" class="btn btn-info" id="saveeditcb">Save changes</button>
                                                </div>
                                        </div>
4927
                                    </div>`
4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944

                        if (feature.administrasi.f4 == 'None') {
                            var gmb = "static/img/image_null.png";
                        } else {
                            var gmb = "static/img/image/" + feature.administrasi.f4;
                        }

                        $(".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 + `
                                                                    </span>
                                                                </div>
                                                                <div>
                                                                    <span>
                                                                        ` +
Muhamad's avatar
Muhamad committed
4945
                            alamak + ` ` + feature.administrasi.f9 + `, ` + feature.administrasi.f8 + `, ` + feature.administrasi.f7 + `
4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983
                                                                    </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="">
                                                                <div>
                                                                    <div>
                                                                        <span>Jenis Bangunan</span>
                                                                    </div>
                                                                    <div>
                                                                        <span>
                                                                            ` + feature.administrasi.f2 + `
                                                                        </span>
                                                                    </div>
                                                                </div>
                                                                <div>
                                                                    <div>
                                                                        <span>Luas</span>
                                                                    </div>
                                                                    <div>
                                                                        <span style="font-family: 'Roboto';">` + feature.administrasi.f10 + ` m</span>
                                                                    </div>
                                                                </div>
            
                                                                <div>
                                                                    <div>
                                                                        <span>Pimpinan</span>
                                                                    </div>
                                                                    <div>
                                                                        <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_cb" 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;"><i class="icon-pencil5"></i></a>
                                                                    </div>
Muhamad's avatar
Muhamad committed
4984 4985 4986
                                                                    <div class="tombol-delete-keterangan text-center" style="background-color: indianred;position: absolute;width: 40px;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
                                                                        <a href="#" id="btn_delete_adm" data-toggle="modal" data-target="#modald_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="Delete"><i class="icon-eraser2"></i></a>
                                                                    </div>
4987 4988
                                                                    `)

Muhamad's avatar
Muhamad committed
4989 4990 4991 4992 4993 4994 4995 4996
                        if (list_perm.indexOf('delete_cagar_budaya') >= 0 === false) {
                            $(".tombol-delete-keterangan").remove();
                        }

                        if (list_perm.indexOf('change_cagar_budaya') >= 0 === false) {
                            $(".tombol-edit-keterangan").remove();
                        }

Muhamad's avatar
Muhamad committed
4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035
                        content_delete_point = `
                            <div class="modal-dialog md">
                                        <div class="modal-content">
                                            <div class="modal-header bg-info">
                                                    <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                                    <h6 class="modal-title">Delete Point</h6>
                                            </div>
                                            <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
                                                <input style="display:none;" id="id_adm_del" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                <input style="display:none;" id="nama_table" type="text" class="form-control" value="geo_cagar_budaya" required>
                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                        <div class="col-lg-9">
                                                            <input id="namobj_adm_del" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required disabled>    
                                                        </div>
                                                        
                                                    </div>
                                                </div>

                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                        <div class="col-lg-8">
                                                            <input id="remark_adm_del" type="text" class="form-control" value="` + feature.administrasi.f2 + `"required disabled>
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>
                                            <hr>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-info" id="deletepointot">Hapus</button>
                                            </div>
                                        </div>
                                    </div>`;

                        $("#modald_adm").html(content_delete_point)

5036

5037 5038
                        $("#modal_adm").html(content_edit_cabud)
                        panel_samp();
Muhamad's avatar
Muhamad committed
5039 5040 5041 5042
                    })
                    hidelegend();
                }
            })
Muhamad's avatar
b  
Muhamad committed
5043 5044 5045 5046 5047 5048 5049
        }
    });

    function geo_json_po_cagar_budaya(data) {
        geo_po_cagar_budaya.addData(data)
    }

5050
    // geo_json_po_cagar_budaya(result_cagar_budaya);
Muhamad's avatar
b  
Muhamad committed
5051 5052

    function cb100() {
5053 5054 5055 5056 5057 5058 5059
        // var checkBox = document.getElementById("cabud");
        // if (checkBox.checked == true) {
        //     geo_po_cagar_budaya.addTo(map)
        // } else {
        //     geo_po_cagar_budaya.remove()
        //         // valket()
        // }
Muhamad's avatar
b  
Muhamad committed
5060 5061
        var checkBox = document.getElementById("cabud");
        if (checkBox.checked == true) {
5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081
            // loaderPage(true);
            $.ajax({
                url: "{% url 'api:apiviewcagarbudaya'%}",
                dataType: 'json',
                type: 'GET',
                success: function(response) {
                    // loaderPage(false);
                    // map.setView([-4.125826277307029, 104.1881561279297], 13);
                    // var len = response['kecamatan'].length;
                    // console.log(response)
                    var data_de = []
                    for (var i = 0; i < response['apiviewcagarbudaya'].length; i++) {
                        geoj = response['apiviewcagarbudaya'][i];
                        data_de.push(geoj);
                    }
                    // console.log(data_de)
                    geo_json_po_cagar_budaya(data_de);
                    geo_po_cagar_budaya.addTo(map)
                }
            });
Muhamad's avatar
b  
Muhamad committed
5082
        } else {
5083
            geo_po_cagar_budaya.clearLayers()
Muhamad's avatar
b  
Muhamad committed
5084 5085 5086 5087
            geo_po_cagar_budaya.remove()
        }
    }

Muhamad's avatar
Muhamad committed
5088
    $(document).on("click", "#btn_edit_cb", function() {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109
        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 idcb = $('#idcb').val();
        loaderPage(false);
        $.ajax({
            url: "{% url 'api:editcb' %}",
            data: {
                'id_point': idcb
            },
            dataType: 'json',
            success: function(data) {
                loaderPage(false);
Muhamad's avatar
Muhamad committed
5110 5111 5112 5113
                setTimeout(function() {
                    map_edit.invalidateSize();
                }, 1000);

Manggar Mahardhika's avatar
Manggar Mahardhika committed
5114
                console.log(data)
Muhamad's avatar
Muhamad committed
5115 5116
                    // map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
                map_edit.setView([data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]], 19);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130
                let dapoin = [data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]]
                var poinin = L.marker(dapoin).addTo(map_edit)
                poinin.enableEdit();
                $('#saveeditcb').click(function() {
                    var hasil = (JSON.stringify(poinin.toGeoJSON()))
                    $("#coordinateZoneeditcb").val(hasil);
                })
            }
        })
    });

    $(document).on("click", "#saveeditcb", function() {
        var idcb = $('#idcb').val();
        var poi = $('#coordinateZoneeditcb').val();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5131 5132 5133
        var data = new FormData();
        data.append("file", $("input[id^='file']")[0].files[0]);
        data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
Muhamad's avatar
Muhamad committed
5134
        data.append('idcb', idcb)
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5135 5136 5137 5138 5139
        data.append('namobj', $('#namobj').val())
        data.append('remark', $('#remark').val())
        data.append('luas', $('#luas_bangunan').val())
        data.append('alamat', $('#alamat').val())
        data.append('perangkat', $('#perangkat').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5140
        data.append('point', poi),
Muhamad's avatar
Muhamad committed
5141
            data.append('gambar', $('#gambar').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5142 5143 5144

        $.ajax({
            url: "{% url 'api:cagarbudaya' %}",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5145
            data: data,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5146 5147
            dataType: 'json',
            type: 'POST',
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5148 5149
            processData: false,
            contentType: false,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5150
            success: function(data) {
5151 5152 5153 5154 5155 5156 5157 5158 5159
                let response = data
                if (response.status == 0) {
                    swal({
                        title: response.info,
                        text: response.data,
                        type: "success",
                        icon: "success",
                        confirmButtonColor: "#00BCD4"
                    }, function() {
Muhamad's avatar
Muhamad committed
5160 5161
                        $("#modal_adm").modal('hide');
                        $("#modal_detail_non_kelurahan").modal('hide')
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5162
                        location.reload();
5163 5164 5165 5166 5167 5168 5169 5170 5171 5172
                    })
                } else {
                    swal({
                        title: 'Error',
                        text: 'Hubungi Developer',
                        type: "warning",
                        icon: "error",
                        confirmButtonColor: "#00BCD4"
                    })
                }
Muhamad's avatar
Muhamad committed
5173
                //location.reload()
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5174 5175 5176 5177 5178
            }
        })

    });

5179 5180 5181
    // var gardu_listrik = "{{ gardu_listrik }}".replace(/&#x27;/g, '"');
    // var result_gardu_listrik = JSON.parse("" + gardu_listrik + "")
    // console.log(result_gardu_listrik)
Muhamad's avatar
b  
Muhamad committed
5182 5183 5184 5185

    var geo_po_gardu_listrik = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            var smallIcon = new L.Icon({
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5186
                iconSize: [25, 25],
Muhamad's avatar
b  
Muhamad committed
5187 5188
                iconAnchor: [13, 27],
                popupAnchor: [1, -24],
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5189 5190 5191 5192 5193
                iconUrl: 'static/img/icon-1/Lightning-tes.svg',
                // iconUrl: 'static/img/icon/listrik.svg',
                // shadowUrl: 'static/img/icon/shadow.svg',
                // shadowSize: [35, 35],
                // shadowAnchor: [22, 31]
Muhamad's avatar
b  
Muhamad committed
5194 5195 5196 5197
            });
            var marker = L.marker(latlng, {
                icon: smallIcon
            });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214
            conten = `
                    <div id="bottom-justified-data" style="text-align: center;">
                        <div >
                            <img src="static/img/image/` + feature.administrasi.f8 + `" alt="Image" style="width: 150px!important;height: 125px;">
                        </div>

                        <div >
                            <div style="font-family: Google Sans,Roboto,Arial,sans-serif;
                            letter-spacing: 0">
                                <p >
                                    ` + feature.administrasi.f1 + `
                                </p>
                            </div>
                        </div>
                    </div>
                `;
            marker.bindTooltip(conten, {
Muhamad's avatar
b  
Muhamad committed
5215 5216
                permanent: false,
                className: "my-label",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5217 5218
                direction: 'top',
                offset: [0, -25]
Muhamad's avatar
b  
Muhamad committed
5219 5220
            });
            return marker
Muhamad's avatar
Muhamad committed
5221 5222 5223 5224
        },
        onEachFeature: function(feature, layer) {
            layer.on({
                click: function(e) {
5225
                    $("#modal_detail_non_kelurahan").modal('show');
Muhamad's avatar
Muhamad committed
5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237
                    var tay;
                    var geocodeService = L.esri.Geocoding.geocodeService();
                    var geocoderNominatim = new L.Control.Geocoder.Nominatim();
                    var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
                        tay = result.address.Address;
                        // aladije(result.address.Address)
                        if (feature.administrasi.f3 == 'alamat') {
                            if (tay != '') {
                                var alamak = tay;

                            } else {
                                alamak = ""
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5238
                            }
Muhamad's avatar
Muhamad committed
5239 5240 5241 5242 5243

                        } else {
                            var alamak = feature.administrasi.f3;
                        }
                        if (feature.administrasi.f10 == 'bpk') {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5244
                            var raja = "";
Muhamad's avatar
Muhamad committed
5245 5246 5247
                        } else {
                            var raja = feature.administrasi.f10;
                        }
5248 5249
                        content_edit_gl = `
                            
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5250 5251
                                    <div class="modal-dialog md">
                                        <div class="modal-content">
5252
                                            <div class="modal-header bg-info" >
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5253 5254 5255 5256 5257 5258 5259 5260 5261
                                                    <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                                    <h6 class="modal-title">Edit Point</h6>
                                            </div>
                                                
                                                <div class="tab-pane has-padding" id="panel-tab2">
                                                    <div class="tab-pane" id="bottom-justified-data">

                                                        <div class="tabbable">
                                                            <ul class="nav nav-tabs nav-tabs-bottom nav-justified">
5262 5263 5264
                                                                <li onclick="changetabs(this)" class="active"><a href="#right-tab2-feas-upli" data-toggle="tab">Koordinat</a></li>
                                                                <li onclick="changetabs(this)"><a href="#left-tab1-feas-upli" data-toggle="tab">Informasi Umum</a></li>
                                                                
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5265 5266 5267 5268
                                                            </ul>

                                                            <div class="tab-content">

5269 5270
                                                                <div class="tab-pane active" id="right-tab2-feas-upli">
                                                                    <div class="form-group">
Muhamad's avatar
Muhamad committed
5271
                                                                        <div id="map-for-edit" style="height: 300px;position: relative;margin: 10px;"></div>
5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282
                                                                        <div class="form-group">
                                                                            <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
                                                                            <div class="col-lg-9" style="margin-top:10px">
                                                                                <input type="file" id="file" 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.f8 + `"required>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>

                                                                <div class="tab-pane" id="left-tab1-feas-upli">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5283

Muhamad's avatar
Muhamad committed
5284
                                                                    <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317

                                                                                <div class="form-group">
                                                                                        <input style="display:none;" id="idgl" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                                                        <input style="display:none;" id="coordinateZoneeditgl" type="text" class="form-control" value=""required>
                                                                                </div>

                                                                            <div class="row" style="margin-top: 15px;">
                                                                                <div class="form-group">
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                                                    <div class="col-lg-9">
                                                                                        <input id="namobj" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required>    
                                                                                    </div>
                                                                                    
                                                                                </div>
                                                                            </div>

                                                                            <div class="row" style="margin-top: 15px;">
                                                                                <div class="form-group">
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                                                    <div class="col-lg-8">
                                                                                        <select id="remark" style="margin-top: 15px;">
                                                                                            <option>` + feature.administrasi.f2 + `</option>
                                                                                        </select>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                        
                                                                            <div class="row" style="margin-top: 15px;">
                                                                                <div class="form-group">
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Alamat</label>
                                                                                    <div class="col-lg-4">
                                                                                        <input id="alamat" type="text" class="form-control" value="` + alamak + `"required>
                                                                                    </div>
Muhamad's avatar
Muhamad committed
5318
                                                                                    <div class="col-lg-4" style="margin-top: 15px;">` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `</div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5319 5320 5321 5322 5323 5324 5325 5326
                                                                                </div>
                                                                            </div>

                                                                            <div class="row" style="margin-top: 15px;">
                                                                                
                                                                                <div class="form-group">
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Luas Tanah</label>
                                                                                    <div class="col-lg-6">
Muhamad's avatar
Muhamad committed
5327
                                                                                        <input id="luas_tanah" type="text" class="form-control" value="` + feature.administrasi.f5 + `"required>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342
                                                                                    </div>
                                                                                    <div class="col-lg-3">
                                                                                        <select id="satuan_luas_tanah" style="margin-top: 15px;">
                                                                                            <option>m2</option>
                                                                                            <option>Km2</option>
                                                                                            <option>Hektar</option>
                                                                                        </select>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                        
                                                                            <div class="row" style="margin-top: 15px;">
                                                                                <div class="form-group">
                                                                                    <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Pemimpin</label>
                                                                                    <div class="col-lg-9">
Muhamad's avatar
Muhamad committed
5343
                                                                                        <input id="perangkat" type="text" class="form-control" value="` + raja + `"required>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                    
                                                                    </div>
                                                                </div>

                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5355

Manggar Mahardhika's avatar
Manggar Mahardhika committed
5356 5357 5358
                                                <hr>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-info" id="saveeditgl">Save changes</button>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5359
                                                </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5360
                                        </div>
5361
                                    </div>`
Muhamad's avatar
Muhamad committed
5362

5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417
                        if (feature.administrasi.f8 == 'None') {
                            var gmb = "static/img/image_null.png";
                        } 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 + `
                                                                    </span>
                                                                </div>
                                                                <div>
                                                                    <span>
                                                                        ` +
                            alamak + `, ` + feature.administrasi.f14 + `, ` + feature.administrasi.f13 + `, ` + feature.administrasi.f12 + `
                                                                    </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="">
                                                                <div>
                                                                    <div>
                                                                        <span>Jenis Bangunan</span>
                                                                    </div>
                                                                    <div>
                                                                        <span>
                                                                            ` + feature.administrasi.f2 + `
                                                                        </span>
                                                                    </div>
                                                                </div>
                                                                <div>
                                                                    <div>
                                                                        <span>Luas</span>
                                                                    </div>
                                                                    <div>
                                                                        <span style="font-family: 'Roboto';">` + feature.administrasi.f5 + ` m</span>
                                                                    </div>
                                                                </div>
            
                                                                <div>
                                                                    <div>
                                                                        <span>Pimpinan</span>
                                                                    </div>
                                                                    <div>
                                                                        <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_gl" 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;"><i class="icon-pencil5"></i></a>
                                                                    </div>
Muhamad's avatar
Muhamad committed
5418 5419 5420
                                                                    <div class="tombol-delete-keterangan text-center" style="background-color: indianred;position: absolute;width: 40px;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
                                                                        <a href="#" id="btn_delete_adm" data-toggle="modal" data-target="#modald_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="Delete"><i class="icon-eraser2"></i></a>
                                                                    </div>
5421
                                                                    `)
Muhamad's avatar
Muhamad committed
5422 5423 5424 5425 5426 5427 5428
                        if (list_perm.indexOf('delete_gardu_listrik') >= 0 === false) {
                            $(".tombol-delete-keterangan").remove();
                        }

                        if (list_perm.indexOf('change_gardu_listrik') >= 0 === false) {
                            $(".tombol-edit-keterangan").remove();
                        }
5429

Muhamad's avatar
Muhamad committed
5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468
                        content_delete_point = `
                            <div class="modal-dialog md">
                                        <div class="modal-content">
                                            <div class="modal-header bg-info">
                                                    <button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
                                                    <h6 class="modal-title">Delete Point</h6>
                                            </div>
                                            <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
                                                <input style="display:none;" id="id_adm_del" type="text" class="form-control" value="` + feature.administrasi.f15 + `"required>
                                                <input style="display:none;" id="nama_table" type="text" class="form-control" value="geo_gardu_listrik"required>
                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Nama Point</label>
                                                        <div class="col-lg-9">
                                                            <input id="namobj_adm_del" type="text" class="form-control" value="` + feature.administrasi.f1 + `"required disabled>    
                                                        </div>
                                                        
                                                    </div>
                                                </div>

                                                <div class="row" style="margin-top: 15px;">
                                                    <div class="form-group">
                                                        <label class="col-lg-3 control-label lbl-top" style="margin-top: 15px;">Tipe Point</label>
                                                        <div class="col-lg-8">
                                                            <input id="remark_adm_del" type="text" class="form-control" value="` + feature.administrasi.f2 + `"required disabled>
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>
                                            <hr>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-info" id="deletepointot">Hapus</button>
                                            </div>
                                        </div>
                                    </div>`;

                        $("#modald_adm").html(content_delete_point)

5469 5470 5471 5472 5473 5474
                        $("#modal_adm").html(content_edit_gl)
                        panel_samp();
                    })
                    hidelegend();
                }
            })
Muhamad's avatar
b  
Muhamad committed
5475 5476 5477 5478 5479 5480 5481
        }
    });

    function geo_json_po_gardu_listrik(data) {
        geo_po_gardu_listrik.addData(data)
    }

5482
    // geo_json_po_gardu_listrik(result_gardu_listrik);
Muhamad's avatar
b  
Muhamad committed
5483 5484

    function gl100() {
5485 5486 5487 5488 5489 5490 5491
        // var checkBox = document.getElementById("gardu");
        // if (checkBox.checked == true) {
        //     geo_po_gardu_listrik.addTo(map)
        // } else {
        //     geo_po_gardu_listrik.remove()
        //         // valket()
        // }
Muhamad's avatar
b  
Muhamad committed
5492 5493
        var checkBox = document.getElementById("gardu");
        if (checkBox.checked == true) {
5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513
            // loaderPage(true);
            $.ajax({
                url: "{% url 'api:apiviewgardulistrik'%}",
                dataType: 'json',
                type: 'GET',
                success: function(response) {
                    // loaderPage(false);
                    // map.setView([-4.125826277307029, 104.1881561279297], 13);
                    // var len = response['kecamatan'].length;
                    // console.log(response)
                    var data_de = []
                    for (var i = 0; i < response['apiviewgardulistrik'].length; i++) {
                        geoj = response['apiviewgardulistrik'][i];
                        data_de.push(geoj);
                    }
                    // console.log(data_de)
                    geo_json_po_gardu_listrik(data_de);
                    geo_po_gardu_listrik.addTo(map)
                }
            });
Muhamad's avatar
b  
Muhamad committed
5514
        } else {
5515
            geo_po_gardu_listrik.clearLayers()
Muhamad's avatar
b  
Muhamad committed
5516 5517 5518 5519
            geo_po_gardu_listrik.remove()
        }
    }

Muhamad's avatar
Muhamad committed
5520
    $(document).on("click", "#btn_edit_gl", function() {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540
        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 idgl = $('#idgl').val();
        loaderPage(false);
        $.ajax({
            url: "{% url 'api:editgl' %}",
            data: {
                'id_point': idgl
            },
            dataType: 'json',
            success: function(data) {
Muhamad's avatar
Muhamad committed
5541 5542 5543 5544
                setTimeout(function() {
                    map_edit.invalidateSize();
                }, 1000);

Manggar Mahardhika's avatar
Manggar Mahardhika committed
5545 5546
                loaderPage(false);
                console.log(data)
Muhamad's avatar
Muhamad committed
5547 5548
                    // map_edit.setView([data['geometry']['coordinates'][0][0][0][1], data['geometry']['coordinates'][0][0][0][0]], 19);
                map_edit.setView([data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]], 19);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562
                let dapoin = [data['geometry']['coordinates'][1], data['geometry']['coordinates'][0]]
                var poinin = L.marker(dapoin).addTo(map_edit)
                poinin.enableEdit();
                $('#saveeditgl').click(function() {
                    var hasil = (JSON.stringify(poinin.toGeoJSON()))
                    $("#coordinateZoneeditgl").val(hasil);
                })
            }
        })
    });

    $(document).on("click", "#saveeditgl", function() {
        var idgl = $('#idgl').val();
        var poi = $('#coordinateZoneeditgl').val();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5563 5564 5565
        var data = new FormData();
        data.append("file", $("input[id^='file']")[0].files[0]);
        data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
Muhamad's avatar
Muhamad committed
5566
        data.append('idgl', idgl)
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5567 5568 5569 5570 5571
        data.append('namobj', $('#namobj').val())
        data.append('remark', $('#remark').val())
        data.append('luastanah', $('#luas_tanah').val())
        data.append('alamat', $('#alamat').val())
        data.append('perangkat', $('#perangkat').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5572
        data.append('point', poi),
Muhamad's avatar
Muhamad committed
5573
            data.append('gambar', $('#gambar').val())
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5574 5575 5576

        $.ajax({
            url: "{% url 'api:gardu' %}",
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5577
            data: data,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5578 5579
            dataType: 'json',
            type: 'POST',
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5580 5581
            processData: false,
            contentType: false,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5582
            success: function(data) {
5583 5584 5585 5586 5587 5588 5589 5590 5591
                let response = data
                if (response.status == 0) {
                    swal({
                        title: response.info,
                        text: response.data,
                        type: "success",
                        icon: "success",
                        confirmButtonColor: "#00BCD4"
                    }, function() {
Muhamad's avatar
Muhamad committed
5592 5593
                        $("#modal_adm").modal('hide');
                        $("#modal_detail_non_kelurahan").modal('hide')
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5594
                        location.reload();
5595 5596 5597 5598 5599 5600 5601 5602 5603 5604
                    })
                } else {
                    swal({
                        title: 'Error',
                        text: 'Hubungi Developer',
                        type: "warning",
                        icon: "error",
                        confirmButtonColor: "#00BCD4"
                    })
                }
Muhamad's avatar
Muhamad committed
5605
                //location.reload()
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5606 5607 5608 5609 5610
            }
        })

    });

5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663
    // function gas_all() {
    //     var checkBox = document.getElementById("po_all");
    //     if (checkBox.checked == true) {
    //         document.getElementById("knt_adm").checked = true;
    //         document.getElementById("lyn_kes").checked = true;
    //         document.getElementById("pus").checked = true;
    //         document.getElementById("rusak").checked = true;
    //         document.getElementById("ibdh").checked = true;
    //         document.getElementById("dididik").checked = true;
    //         document.getElementById("pom_bengsin").checked = true;
    //         document.getElementById("tasiun").checked = true;
    //         document.getElementById("caheum").checked = true;
    //         document.getElementById("cabud").checked = true;
    //         document.getElementById("gardu").checked = true;
    //         k_adm()
    //         l_kes()
    //         pks()
    //         rs()
    //         fiksi()
    //         didik()
    //         pom_mini()
    //         sthall()
    //         temanggung()
    //         cb100()
    //         gl100()
    //         valket()

    //     } else if (checkBox.checked == false) {
    //         document.getElementById("knt_adm").checked = false;
    //         document.getElementById("lyn_kes").checked = false;
    //         document.getElementById("pus").checked = false;
    //         document.getElementById("rusak").checked = false;
    //         document.getElementById("ibdh").checked = false;
    //         document.getElementById("dididik").checked = false;
    //         document.getElementById("pom_bengsin").checked = false;
    //         document.getElementById("tasiun").checked = false;
    //         document.getElementById("caheum").checked = false;
    //         document.getElementById("cabud").checked = false;
    //         document.getElementById("gardu").checked = false;
    //         k_adm()
    //         l_kes()
    //         pks()
    //         rs()
    //         fiksi()
    //         didik()
    //         pom_mini()
    //         sthall()
    //         temanggung()
    //         cb100()
    //         gl100()
    //         valket()
    //     }
    // }
Muhamad's avatar
b  
Muhamad committed
5664

5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677
    // function gas_poin(){
    //     document.getElementById("po_all").checked == true;
    //     k_adm()
    //     l_kes()
    //     pks()
    //     rs()
    //     fiksi()
    //     didik()
    //     sthall()
    //     temanggung()
    //     cb100()
    //     gl100()
    // }
Muhamad's avatar
Muhamad committed
5678

5679 5680
    // gas_poin()

Muhamad's avatar
Muhamad committed
5681
    function showpanel(content) {
Muhamad's avatar
Muhamad committed
5682

Manggar Mahardhika's avatar
Manggar Mahardhika committed
5683
        $("#button_hide_panel").css("display", "block")
Muhamad's avatar
Muhamad committed
5684 5685
            // $("#thisFooter").css('left', '380px');
            // $("#thisFooter").css('width', '930px');
5686
            // 
Muhamad's avatar
Muhamad committed
5687

Manggar Mahardhika's avatar
Manggar Mahardhika committed
5688 5689
        $("#isi_panel").html(content);
    }
Muhamad's avatar
Muhamad committed
5690

Manggar Mahardhika's avatar
Manggar Mahardhika committed
5691 5692
    function showlegend() {
        $("#legendapo").css('display', 'block');
Muhamad's avatar
Muhamad committed
5693

Manggar Mahardhika's avatar
Manggar Mahardhika committed
5694
    }
Muhamad's avatar
Muhamad committed
5695

Manggar Mahardhika's avatar
Manggar Mahardhika committed
5696 5697 5698 5699 5700
    function hidelegend() {
        $("#legendapo").css('display', 'none');
        $("#button_unhide_point").css('display', 'block');
    }

Muhamad's avatar
Muhamad committed
5701
    function valket() {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714
        let checkBox1 = document.getElementById("po_all");
        let checkBox2 = document.getElementById("knt_adm");
        let checkBox3 = document.getElementById("lyn_kes");
        let checkBox4 = document.getElementById("pus");
        let checkBox5 = document.getElementById("rusak");
        let checkBox6 = document.getElementById("ibdh");
        let checkBox7 = document.getElementById("dididik");
        let checkBox8 = document.getElementById("pom_bengsin");
        let checkBox9 = document.getElementById("tasiun");
        let checkBox10 = document.getElementById("caheum");
        let checkBox11 = document.getElementById("cabud");
        let checkBox12 = document.getElementById("gardu");

Muhamad's avatar
Muhamad committed
5715
        if ((checkBox1.checked == true) || (checkBox2.checked == true) || (checkBox3.checked == true) || (checkBox4.checked == true) || (checkBox5.checked == true) || (checkBox6.checked == true) || (checkBox7.checked == true) || (checkBox8.checked == true) || (checkBox9.checked == true) || (checkBox10.checked == true) || (checkBox11.checked == true) || (checkBox12.checked == true)) {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5716
            showlegend()
Muhamad's avatar
Muhamad committed
5717

Muhamad's avatar
Muhamad committed
5718
        } else if ((checkBox1.checked == false) && (checkBox2.checked == false) && (checkBox3.checked == false) && (checkBox4.checked == false) && (checkBox5.checked == false) && (checkBox6.checked == false) && (checkBox7.checked == false) && (checkBox8.checked == false) && (checkBox9.checked == false) && (checkBox10.checked == false) && (checkBox11.checked == false) && (checkBox12.checked == false)) {
Muhamad's avatar
Muhamad committed
5719

Manggar Mahardhika's avatar
Manggar Mahardhika committed
5720
            hidelegend()
Muhamad's avatar
Muhamad committed
5721

Manggar Mahardhika's avatar
Manggar Mahardhika committed
5722
        }
Muhamad's avatar
Muhamad committed
5723
    }
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5724

Muhamad's avatar
b  
Muhamad committed
5725 5726 5727 5728 5729 5730 5731 5732
    function newe(marques, xnxx, xxx) {
        marques.addLayer(xnxx);
        map.addLayer(marques);
        // map.removeLayer(xnxx);
        // map.addLayer(markersknt);
        var lastZoom;
        map.on('zoomend', function() {
            var zoom = map.getZoom();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5733
            // console.log(zoom)
Muhamad's avatar
b  
Muhamad committed
5734 5735 5736 5737 5738
            if (zoom < 14 && (!lastZoom || lastZoom >= 14)) {
                if (xxx.checked == true) {
                    map.removeLayer(marques);
                    map.addLayer(marques);
                    map.removeLayer(xnxx);
Muhamad's avatar
Muhamad committed
5739

Manggar Mahardhika's avatar
Manggar Mahardhika committed
5740
                    $("#legendapo").css('display', 'block');
Muhamad's avatar
b  
Muhamad committed
5741
                } else {
Muhamad's avatar
Muhamad committed
5742

Muhamad's avatar
b  
Muhamad committed
5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757
                    $("#legendapo").css('display', 'none');
                    map.removeLayer(marques);
                }
            } else if (zoom >= 14 && (!lastZoom || lastZoom < 14)) {
                if (xxx.checked == true) {
                    map.removeLayer(marques);
                    map.addLayer(xnxx);
                } else {
                    map.removeLayer(xnxx);
                }

            }
            lastZoom = zoom;
        })
    }
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5758

Muhamad's avatar
Muhamad committed
5759
    function changetabs(params) {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5760
        // console.log(params)
Muhamad's avatar
Muhamad committed
5761

Manggar Mahardhika's avatar
Manggar Mahardhika committed
5762 5763
        var hrf = $(params).find("a").attr("href");

Manggar Mahardhika's avatar
Manggar Mahardhika committed
5764 5765 5766
        if (hrf == '#right-tab2-feas-upli') {
            $("#left-tab1-feas-upli").removeClass("show")
                // $("#right-tab2-feas-upli").attr("display", "block")
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5767

Muhamad's avatar
Muhamad committed
5768
        } else {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5769 5770
            $("#right-tab2-feas-upli").removeClass("show")
                // $("#left-tab1-feas-upli").attr("display", "block")
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5771
        }
Muhamad's avatar
Muhamad committed
5772

Manggar Mahardhika's avatar
Manggar Mahardhika committed
5773
    }
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5774

Muhamad's avatar
Muhamad committed
5775 5776
    function swiftAlert(itype, ititle, itext) {
        if (itype == 'success') {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5777
            swal({
Muhamad's avatar
Muhamad committed
5778 5779 5780 5781
                title: ititle,
                text: itext,
                confirmButtonColor: "#66BB6A",
                type: "success"
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5782
            });
Muhamad's avatar
Muhamad committed
5783
        } else if (itype == 'error') {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5784
            swal({
Muhamad's avatar
Muhamad committed
5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799
                title: ititle,
                text: itext,
                confirmButtonColor: "#EF5350",
                type: "error"
            });
        } else if (itype == 'warning') {
            swal({
                title: ititle,
                text: itext,
                confirmButtonColor: "#2196F3",
                type: "warning",
            });
        }
    }

Muhamad's avatar
Muhamad committed
5800
    //3d begin
Manggar Mahardhika's avatar
Manggar Mahardhika committed
5801 5802 5803 5804
    // Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJhOTc0NDkxMi02N2NkLTQwYjMtOTE1Yi1iMGNkZDU0Zjg3MGMiLCJpZCI6NDQ1ODgsImlhdCI6MTYxNDE0NjM5NH0.sRHzNNa7uV_huqGxERySWlL8J5UVx1VwU-pRwNd0GJk';

    // var map_cesium = new Cesium.Viewer('map-cesium');

5805 5806 5807 5808
    //function mapsganti() {
    //    $("#modalsearch3d").modal()
    //}

Muhamad's avatar
Muhamad committed
5809 5810
    function mapsganti() {
        var checkBox_3d = document.getElementById("mapschange");
5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822
        $('#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
        });
Muhamad's avatar
Muhamad committed
5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842
        if (checkBox_3d.checked == true) {
            $("#modalsearch3d").modal()
            $.ajax({
                url: "{% url 'api:search'%}",
                data: {
                    'namadesa': 'search'
                },
                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)
Muhamad's avatar
Muhamad committed
5843
                    }
Muhamad's avatar
Muhamad committed
5844
                    $("#search_desa").html(data_de);
Muhamad's avatar
Muhamad committed
5845
                    checkBox_3d.checked = false;
5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941
                    $("#search3D").click(function() {
                        map_cesium.entities.removeAll();
                        // $('head').append('<script src="/static/Cesium-185/Build/Cesium/Cesium.js"><\/script>');
                        $("#map").css('display', 'none');
                        $("#map-cesium").css('display', 'block');
                        $(".no3d").css('display', 'none');
                        $("#legendapo").css('display', 'none');
                        $(".rar").css('display', 'none');
                        $("#labelchange").html(`<img src="static/img/icon-1/Vector2d.svg" alt="" style="height: 35px;width: 35px;margin: 7px;filter: invert(48%) sepia(79%) saturate(2398%) hue-rotate(190deg) brightness(77%) contrast(170%);z-index:1;">`)
                        $(".tooltip-3d").html(`2D`)
                            // $(".tooltip-3d").css(`background-color`,'white!important');

                        var nama_desa = $("#search_desa").val();
                        $.ajax({
                            url: "{% url 'api:ressearch' %}",
                            data: {
                                'id_desa_search': nama_desa
                            },
                            dataType: 'json',
                            success: function(data) {
                                document.getElementById("mapschange").checked = true;
                                // $("#modalsearch3d").modal("toggle")
                                    // console.log(data['polygon_o'])
                                    // console.log(data['line_o'])
                                    // console.log(data['kantor_administrasi'])

                                map_cesium.camera.flyTo({
                                    destination: Cesium.Cartesian3.fromDegrees(data['lat'], data['lng'], 750)
                                });

                                for (var i = 0; i < data["polygon_o"].length; i++) {
                                    polygon_oo = data["polygon_o"][i][0].replace(/&#x27;/g, '');
                                    poll = JSON.parse("[" + polygon_oo + "]");

                                    maxheight = [];
                                    minheight = [];
                                    for (var x = 0; x < (poll.length / 2); x++) {
                                        max = data["tinggi_pol"][i];
                                        maxheight.push(max);
                                        min = 0;
                                        minheight.push(min);
                                    }
                                    var poly_osm = map_cesium.entities.add({
                                        wall: {
                                            positions: Cesium.Cartesian3.fromDegreesArray(
                                                poll
                                            ),
                                            maximumHeights: maxheight,
                                            minimumHeights: minheight,
                                            // height: 0,
                                            material: new Cesium.ImageMaterialProperty({
                                                image: "static/image/bangunan/3d/" + data["tampak_depan_pol"][i] + ""
                                            }),
                                            // closeTop: false,
                                            // maximumHeights : data["tinggi_pol"][i],
                                            // minimumHeights : 0,
                                            outline: true,
                                            outlineColor: Cesium.Color.GREEN,
                                        },
                                        name: data["info_polygon"][i]
                                    });
                                    // poly_osm.polygon.extrudedHeight = data["tinggi_pol"][i];

                                    var atap = map_cesium.entities.add({
                                        polygon: {
                                            hierarchy: Cesium.Cartesian3.fromDegreesArray(
                                                poll
                                            ),
                                            // material: materialatas,
                                            material: new Cesium.ImageMaterialProperty({
                                                image: "static/image/bangunan/3d/" + data["tampak_atas_pol"][i] + ""
                                            }),
                                            outline: true,
                                            height: data["tinggi_pol"][i],
                                            fill: true,
                                            outlineColor: Cesium.Color.GREEN,
                                        },
                                        name: data["info_polygon"][i]
                                    });
                                };

                                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,
                                        },
                                    });
                                }
5942

5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976
                                for (var i = 0; i < data["kantor_administrasi"].length; i++) {
                                    var kadm = data['kantor_administrasi']
                                    var lati = data['latadm'];
                                    var long = data['longadm'];
                                    var poin = data['infoadm'];
                                    var rema = data['remaadm'][i];

                                    var surfacePosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        0
                                    );
                                    var heightPosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        100
                                    );

                                    if (rema == 'Kantor Polisi') {
                                        var color = Cesium.Color.DARKCYAN;
                                        var gmbcok = "3d_police.svg"
                                    } else if (rema == 'Instalasi TNI (AD/AL/AU)') {
                                        var color = Cesium.Color.DARKRED;
                                        var gmbcok = "3d_army.svg"
                                    } else if (rema == 'Lembaga Pemasyarakatan') {
                                        var color = Cesium.Color.DARKCYAN;
                                        var gmbcok = "3d_jail.svg"
                                    } else if (rema == 'Kantor Pemerintah Lainnya') {
                                        var color = Cesium.Color.GAINSBORO;
                                        var gmbcok = "3d_kadm_lain.svg"
                                    } else {
                                        var color = Cesium.Color.GAINSBORO;
                                        var gmbcok = "3d_kadm.svg"
                                    }
5977

5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010
                                    var polyline = new Cesium.PolylineGraphics();
                                    polyline.material = new Cesium.ColorMaterialProperty(color);
                                    polyline.width = new Cesium.ConstantProperty(2);
                                    polyline.arcType = new Cesium.ConstantProperty(
                                        Cesium.ArcType.NONE
                                    );
                                    polyline.positions = new Cesium.ConstantProperty([
                                        surfacePosition,
                                        heightPosition,
                                    ]);

                                    map_cesium.entities.add({
                                        position: Cesium.Cartesian3.fromDegrees(long[i], lati[i], 100),
                                        billboard: {
                                            // icon: facilityUrl,
                                            image: `static/img/icon/` + gmbcok + ``,
                                            // image: `static/img/icon/3d_police.svg`,
                                            show: true, // default
                                            scale: 2.0, // default: 1.0
                                            width: 15, // default: undefined
                                            height: 15, // default: undefined
                                        },
                                        nameadm: data['infoadm'][i]
                                    });
                                    // console.log(nameadm)

                                    var entity = new Cesium.Entity({
                                        polyline: polyline,
                                        // name: data['infoadm'][i]
                                    });
                                    // console.log(name)
                                    map_cesium.entities.add(entity);
                                }
Muhamad's avatar
Muhamad committed
6011

6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036
                                for (var i = 0; i < data["layanan_kesehatan"].length; i++) {
                                    var lk = data['layanan_kesehatan']
                                    var lati = data['latlk'];
                                    var long = data['longlk'];
                                    var poin = data['infolk'];
                                    var rema = data['remalk'][i];

                                    var surfacePosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        0
                                    );
                                    var heightPosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        100
                                    );

                                    if (rema == 'Poliklinik/Polindes/Posyandu') {
                                        var color = Cesium.Color.INDIANRED;
                                        var gmbcok = "3d_lk.svg"
                                    } else {
                                        var color = Cesium.Color.INDIANRED;
                                        var gmbcok = "3d_lk.svg"
                                    }
6037

6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070
                                    var polyline = new Cesium.PolylineGraphics();
                                    polyline.material = new Cesium.ColorMaterialProperty(color);
                                    polyline.width = new Cesium.ConstantProperty(2);
                                    polyline.arcType = new Cesium.ConstantProperty(
                                        Cesium.ArcType.NONE
                                    );
                                    polyline.positions = new Cesium.ConstantProperty([
                                        surfacePosition,
                                        heightPosition,
                                    ]);

                                    map_cesium.entities.add({
                                        position: Cesium.Cartesian3.fromDegrees(long[i], lati[i], 100),
                                        billboard: {
                                            // icon: facilityUrl,
                                            image: `static/img/icon/` + gmbcok + ``,
                                            // image: `static/img/icon/3d_police.svg`,
                                            show: true, // default
                                            scale: 2.0, // default: 1.0
                                            width: 15, // default: undefined
                                            height: 15, // default: undefined
                                        },
                                        namelk: data['infolk'][i]
                                    });
                                    // console.log(nameadm)

                                    var entitylk = new Cesium.Entity({
                                        polyline: polyline,
                                        // name: data['infoadm'][i]
                                    });
                                    // console.log(name)
                                    map_cesium.entities.add(entitylk);
                                }
6071

6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096
                                for (var i = 0; i < data["puskesmas"].length; i++) {
                                    var pks = data['puskesmas']
                                    var lati = data['latpks'];
                                    var long = data['longpks'];
                                    var poin = data['infopks'];
                                    var rema = data['remapks'][i];

                                    var surfacePosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        0
                                    );
                                    var heightPosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        100
                                    );

                                    if (rema == 'Puskesmas/Puskesmas Pembantu') {
                                        var color = Cesium.Color.INDIANRED;
                                        var gmbcok = "3d_pks.svg"
                                    } else {
                                        var color = Cesium.Color.INDIANRED;
                                        var gmbcok = "3d_pks.svg"
                                    }
Muhamad's avatar
Muhamad committed
6097

6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130
                                    var polyline = new Cesium.PolylineGraphics();
                                    polyline.material = new Cesium.ColorMaterialProperty(color);
                                    polyline.width = new Cesium.ConstantProperty(2);
                                    polyline.arcType = new Cesium.ConstantProperty(
                                        Cesium.ArcType.NONE
                                    );
                                    polyline.positions = new Cesium.ConstantProperty([
                                        surfacePosition,
                                        heightPosition,
                                    ]);

                                    map_cesium.entities.add({
                                        position: Cesium.Cartesian3.fromDegrees(long[i], lati[i], 100),
                                        billboard: {
                                            // icon: facilityUrl,
                                            image: `static/img/icon/` + gmbcok + ``,
                                            // image: `static/img/icon/3d_police.svg`,
                                            show: true, // default
                                            scale: 2.0, // default: 1.0
                                            width: 15, // default: undefined
                                            height: 15, // default: undefined
                                        },
                                        namepks: data['infopks'][i]
                                    });
                                    // console.log(nameadm)

                                    var entitypks = new Cesium.Entity({
                                        polyline: polyline,
                                        // name: data['infoadm'][i]
                                    });
                                    // console.log(name)
                                    map_cesium.entities.add(entitypks);
                                }
6131

6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157
                                for (var i = 0; i < data["rumah_sakit"].length; i++) {
                                    var rs = data['rumah_sakit']
                                    var lati = data['latrs'];
                                    var long = data['longrs'];
                                    var poin = data['infors'];
                                    var rema = data['remars'][i];
                                    console.log(rema)

                                    var surfacePosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        0
                                    );
                                    var heightPosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        100
                                    );

                                    if (rema == 'Rumah Sakit Umum') {
                                        var color = Cesium.Color.INDIANRED;
                                        var gmbcok = "3d_rs.svg"
                                    } else {
                                        var color = Cesium.Color.INDIANRED;
                                        var gmbcok = "3d_rs.svg"
                                    }
6158

6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191
                                    var polyline = new Cesium.PolylineGraphics();
                                    polyline.material = new Cesium.ColorMaterialProperty(color);
                                    polyline.width = new Cesium.ConstantProperty(2);
                                    polyline.arcType = new Cesium.ConstantProperty(
                                        Cesium.ArcType.NONE
                                    );
                                    polyline.positions = new Cesium.ConstantProperty([
                                        surfacePosition,
                                        heightPosition,
                                    ]);

                                    map_cesium.entities.add({
                                        position: Cesium.Cartesian3.fromDegrees(long[i], lati[i], 100),
                                        billboard: {
                                            // icon: facilityUrl,
                                            image: `static/img/icon/` + gmbcok + ``,
                                            // image: `static/img/icon/3d_police.svg`,
                                            show: true, // default
                                            scale: 2.0, // default: 1.0
                                            width: 15, // default: undefined
                                            height: 15, // default: undefined
                                        },
                                        namers: data['infors'][i]
                                    });
                                    // console.log(nameadm)

                                    var entityrs = new Cesium.Entity({
                                        polyline: polyline,
                                        // name: data['infoadm'][i]
                                    });
                                    // console.log(name)
                                    map_cesium.entities.add(entityrs);
                                }
Muhamad's avatar
Muhamad committed
6192

6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226
                                for (var i = 0; i < data["sarana_ibadah"].length; i++) {
                                    var kadm = data['sarana_ibadah']
                                    var lati = data['latsi'];
                                    var long = data['longsi'];
                                    var poin = data['infosi'];
                                    var rema = data['remasi'][i];

                                    var surfacePosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        0
                                    );
                                    var heightPosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        100
                                    );

                                    if (rema == 'Masjid') {
                                        var color = Cesium.Color.DIMGREY;
                                        var gmbcok = "3d_masjid.svg"
                                    } else if (rema == 'Peribadatan/Sosial Lainnya') {
                                        var color = Cesium.Color.DIMGREY;
                                        var gmbcok = "3d_ibadah_lain.svg"
                                    } else if (rema == 'Gereja') {
                                        var color = Cesium.Color.DIMGREY;
                                        var gmbcok = "3d_gereja.svg"
                                    } else if (rema == 'Pura') {
                                        var color = Cesium.Color.DIMGREY;
                                        var gmbcok = "3d_pura.svg"
                                    } else {
                                        var color = Cesium.Color.DIMGREY;
                                        var gmbcok = "3d_ibadah_lain.svg"
                                    }
6227

6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260
                                    var polyline = new Cesium.PolylineGraphics();
                                    polyline.material = new Cesium.ColorMaterialProperty(color);
                                    polyline.width = new Cesium.ConstantProperty(2);
                                    polyline.arcType = new Cesium.ConstantProperty(
                                        Cesium.ArcType.NONE
                                    );
                                    polyline.positions = new Cesium.ConstantProperty([
                                        surfacePosition,
                                        heightPosition,
                                    ]);

                                    map_cesium.entities.add({
                                        position: Cesium.Cartesian3.fromDegrees(long[i], lati[i], 100),
                                        billboard: {
                                            // icon: facilityUrl,
                                            image: `static/img/icon/` + gmbcok + ``,
                                            // image: `static/img/icon/3d_police.svg`,
                                            show: true, // default
                                            scale: 2.0, // default: 1.0
                                            width: 15, // default: undefined
                                            height: 15, // default: undefined
                                        },
                                        namesi: data['infosi'][i]
                                    });
                                    // console.log(nameadm)

                                    var entitysi = new Cesium.Entity({
                                        polyline: polyline,
                                        // name: data['infoadm'][i]
                                    });
                                    // console.log(name)
                                    map_cesium.entities.add(entitysi);
                                }
6261

6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295
                                for (var i = 0; i < data["sarana_pendidikan"].length; i++) {
                                    var kadm = data['sarana_pendidikan']
                                    var lati = data['latsp'];
                                    var long = data['longsp'];
                                    var poin = data['infosp'];
                                    var rema = data['remasp'][i];

                                    var surfacePosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        0
                                    );
                                    var heightPosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        100
                                    );

                                    if (rema == 'Pendidikan Dasar') {
                                        var color = Cesium.Color.INDIANRED;
                                        var gmbcok = "3d_sd.svg"
                                    } else if (rema == 'Pendidikan Menengah Pertama') {
                                        var color = Cesium.Color.DARKCYAN;
                                        var gmbcok = "3d_smp.svg"
                                    } else if (rema == 'Pendidikan Menengah Umum') {
                                        var color = Cesium.Color.GAINSBORO;
                                        var gmbcok = "3d_sma.svg"
                                    } else if (rema == 'Pendidikan Tinggi') {
                                        var color = Cesium.Color.DIMGREY;
                                        var gmbcok = "3d_univ.svg"
                                    } else {
                                        var color = Cesium.Color.GOLDENROD;
                                        var gmbcok = "3d_sp_lain.svg"
                                    }
Muhamad's avatar
Muhamad committed
6296

6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329
                                    var polyline = new Cesium.PolylineGraphics();
                                    polyline.material = new Cesium.ColorMaterialProperty(color);
                                    polyline.width = new Cesium.ConstantProperty(2);
                                    polyline.arcType = new Cesium.ConstantProperty(
                                        Cesium.ArcType.NONE
                                    );
                                    polyline.positions = new Cesium.ConstantProperty([
                                        surfacePosition,
                                        heightPosition,
                                    ]);

                                    map_cesium.entities.add({
                                        position: Cesium.Cartesian3.fromDegrees(long[i], lati[i], 100),
                                        billboard: {
                                            // icon: facilityUrl,
                                            image: `static/img/icon/` + gmbcok + ``,
                                            // image: `static/img/icon/3d_police.svg`,
                                            show: true, // default
                                            scale: 2.0, // default: 1.0
                                            width: 15, // default: undefined
                                            height: 15, // default: undefined
                                        },
                                        namesp: data['infosp'][i]
                                    });
                                    // console.log(nameadm)

                                    var entitysp = new Cesium.Entity({
                                        polyline: polyline,
                                        // name: data['infoadm'][i]
                                    });
                                    // console.log(name)
                                    map_cesium.entities.add(entitysp);
                                }
6330

6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415
                                // for (var i = 0; i < data["spbu"].length; i++) {
                                //     var kadm = data['spbu']
                                //     var lati = data['latspbu'];
                                //     var long = data['longspbu'];
                                //     var poin = data['infospbu'];
                                //     var rema = data['remaspbu'][i];

                                //     var surfacePosition = Cesium.Cartesian3.fromDegrees(
                                //         long[i],
                                //         lati[i],
                                //         0
                                //     );
                                //     var heightPosition = Cesium.Cartesian3.fromDegrees(
                                //         long[i],
                                //         lati[i],
                                //         100
                                //     );

                                //     if (rema == 'Stasiun Pompa Bahan Bakar Umum') {
                                //         var color = Cesium.Color.FORESTGREEN;
                                //         var gmbcok = "3d_spbu.svg"
                                //     } else {
                                //         var color = Cesium.Color.FORESTGREEN;
                                //         var gmbcok = "3d_spbu.svg"
                                //     }

                                //     var polyline = new Cesium.PolylineGraphics();
                                //     polyline.material = new Cesium.ColorMaterialProperty(color);
                                //     polyline.width = new Cesium.ConstantProperty(2);
                                //     polyline.arcType = new Cesium.ConstantProperty(
                                //         Cesium.ArcType.NONE
                                //     );
                                //     polyline.positions = new Cesium.ConstantProperty([
                                //         surfacePosition,
                                //         heightPosition,
                                //     ]);

                                //     map_cesium.entities.add({
                                //         position: Cesium.Cartesian3.fromDegrees(long[i], lati[i], 100),
                                //         billboard: {
                                //             // icon: facilityUrl,
                                //             image: `static/img/icon/` + gmbcok + ``,
                                //             // image: `static/img/icon/3d_police.svg`,
                                //             show: true, // default
                                //             scale: 2.0, // default: 1.0
                                //             width: 15, // default: undefined
                                //             height: 15, // default: undefined
                                //         },
                                //         namespbu: data['infospbu'][i]
                                //     });
                                //     // console.log(nameadm)

                                //     var entityspbu = new Cesium.Entity({
                                //         polyline: polyline,
                                //         // name: data['infoadm'][i]
                                //     });
                                //     // console.log(name)
                                //     map_cesium.entities.add(entityspbu);
                                // }

                                for (var i = 0; i < data["stasiun"].length; i++) {
                                    var kadm = data['stasiun']
                                    var lati = data['latst'];
                                    var long = data['longst'];
                                    var poin = data['infost'];
                                    var rema = data['remast'][i];

                                    var surfacePosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        0
                                    );
                                    var heightPosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        100
                                    );

                                    if (rema == 'Stasiun Kereta Api') {
                                        var color = Cesium.Color.FORESTGREEN;
                                        var gmbcok = "3d_stasiun.svg"
                                    } else {
                                        var color = Cesium.Color.FORESTGREEN;
                                        var gmbcok = "3d_stasiun.svg"
                                    }
6416

6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449
                                    var polyline = new Cesium.PolylineGraphics();
                                    polyline.material = new Cesium.ColorMaterialProperty(color);
                                    polyline.width = new Cesium.ConstantProperty(2);
                                    polyline.arcType = new Cesium.ConstantProperty(
                                        Cesium.ArcType.NONE
                                    );
                                    polyline.positions = new Cesium.ConstantProperty([
                                        surfacePosition,
                                        heightPosition,
                                    ]);

                                    map_cesium.entities.add({
                                        position: Cesium.Cartesian3.fromDegrees(long[i], lati[i], 100),
                                        billboard: {
                                            // icon: facilityUrl,
                                            image: `static/img/icon/` + gmbcok + ``,
                                            // image: `static/img/icon/3d_police.svg`,
                                            show: true, // default
                                            scale: 2.0, // default: 1.0
                                            width: 15, // default: undefined
                                            height: 15, // default: undefined
                                        },
                                        namest: data['infost'][i]
                                    });
                                    // console.log(nameadm)

                                    var entityst = new Cesium.Entity({
                                        polyline: polyline,
                                        // name: data['infoadm'][i]
                                    });
                                    // console.log(name)
                                    map_cesium.entities.add(entityst);
                                }
Muhamad's avatar
Muhamad committed
6450

6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475
                                for (var i = 0; i < data["stasiun"].length; i++) {
                                    var kadm = data['stasiun']
                                    var lati = data['latst'];
                                    var long = data['longst'];
                                    var poin = data['infost'];
                                    var rema = data['remast'][i];

                                    var surfacePosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        0
                                    );
                                    var heightPosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        100
                                    );

                                    if (rema == 'Stasiun Kereta Api') {
                                        var color = Cesium.Color.FORESTGREEN;
                                        var gmbcok = "3d_stasiun.svg"
                                    } else {
                                        var color = Cesium.Color.FORESTGREEN;
                                        var gmbcok = "3d_stasiun.svg"
                                    }
6476

6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509
                                    var polyline = new Cesium.PolylineGraphics();
                                    polyline.material = new Cesium.ColorMaterialProperty(color);
                                    polyline.width = new Cesium.ConstantProperty(2);
                                    polyline.arcType = new Cesium.ConstantProperty(
                                        Cesium.ArcType.NONE
                                    );
                                    polyline.positions = new Cesium.ConstantProperty([
                                        surfacePosition,
                                        heightPosition,
                                    ]);

                                    map_cesium.entities.add({
                                        position: Cesium.Cartesian3.fromDegrees(long[i], lati[i], 100),
                                        billboard: {
                                            // icon: facilityUrl,
                                            image: `static/img/icon/` + gmbcok + ``,
                                            // image: `static/img/icon/3d_police.svg`,
                                            show: true, // default
                                            scale: 2.0, // default: 1.0
                                            width: 15, // default: undefined
                                            height: 15, // default: undefined
                                        },
                                        namest: data['infost'][i]
                                    });
                                    // console.log(nameadm)

                                    var entityst = new Cesium.Entity({
                                        polyline: polyline,
                                        // name: data['infoadm'][i]
                                    });
                                    // console.log(name)
                                    map_cesium.entities.add(entityst);
                                }
6510

6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535
                                for (var i = 0; i < data["terminal"].length; i++) {
                                    var kadm = data['terminal']
                                    var lati = data['lattr'];
                                    var long = data['longtr'];
                                    var poin = data['infotr'];
                                    var rema = data['rematr'][i];

                                    var surfacePosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        0
                                    );
                                    var heightPosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        100
                                    );

                                    if (rema == 'Terminal Bus/Angkutan Kendaraan Lainnya') {
                                        var color = Cesium.Color.FORESTGREEN;
                                        var gmbcok = "3d_terminal.svg"
                                    } else {
                                        var color = Cesium.Color.FORESTGREEN;
                                        var gmbcok = "3d_terminal.svg"
                                    }
Muhamad's avatar
Muhamad committed
6536

6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569
                                    var polyline = new Cesium.PolylineGraphics();
                                    polyline.material = new Cesium.ColorMaterialProperty(color);
                                    polyline.width = new Cesium.ConstantProperty(2);
                                    polyline.arcType = new Cesium.ConstantProperty(
                                        Cesium.ArcType.NONE
                                    );
                                    polyline.positions = new Cesium.ConstantProperty([
                                        surfacePosition,
                                        heightPosition,
                                    ]);

                                    map_cesium.entities.add({
                                        position: Cesium.Cartesian3.fromDegrees(long[i], lati[i], 100),
                                        billboard: {
                                            // icon: facilityUrl,
                                            image: `static/img/icon/` + gmbcok + ``,
                                            // image: `static/img/icon/3d_police.svg`,
                                            show: true, // default
                                            scale: 2.0, // default: 1.0
                                            width: 15, // default: undefined
                                            height: 15, // default: undefined
                                        },
                                        nametr: data['infotr'][i]
                                    });
                                    // console.log(nameadm)

                                    var entitytr = new Cesium.Entity({
                                        polyline: polyline,
                                        // name: data['infoadm'][i]
                                    });
                                    // console.log(name)
                                    map_cesium.entities.add(entitytr);
                                }
6570

6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624
                                for (var i = 0; i < data["cagar_budaya"].length; i++) {
                                    var kadm = data['cagar_budaya']
                                    var lati = data['latcb'];
                                    var long = data['longcb'];
                                    var poin = data['infocb'];
                                    var rema = data['remacb'][i];

                                    var surfacePosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        0
                                    );
                                    var heightPosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        100
                                    );

                                    var color = Cesium.Color.ORANGE;
                                    var gmbcok = "3d_cagar.svg"

                                    var polyline = new Cesium.PolylineGraphics();
                                    polyline.material = new Cesium.ColorMaterialProperty(color);
                                    polyline.width = new Cesium.ConstantProperty(2);
                                    polyline.arcType = new Cesium.ConstantProperty(
                                        Cesium.ArcType.NONE
                                    );
                                    polyline.positions = new Cesium.ConstantProperty([
                                        surfacePosition,
                                        heightPosition,
                                    ]);

                                    map_cesium.entities.add({
                                        position: Cesium.Cartesian3.fromDegrees(long[i], lati[i], 100),
                                        billboard: {
                                            // icon: facilityUrl,
                                            image: `static/img/icon/` + gmbcok + ``,
                                            // image: `static/img/icon/3d_police.svg`,
                                            show: true, // default
                                            scale: 2.0, // default: 1.0
                                            width: 15, // default: undefined
                                            height: 15, // default: undefined
                                        },
                                        namecb: data['infocb'][i]
                                    });
                                    // console.log(nameadm)

                                    var entitycb = new Cesium.Entity({
                                        polyline: polyline,
                                        // name: data['infoadm'][i]
                                    });
                                    // console.log(name)
                                    map_cesium.entities.add(entitycb);
                                }
6625

6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679
                                for (var i = 0; i < data["gardu_listrik"].length; i++) {
                                    var kadm = data['gardu_listrik']
                                    var lati = data['latgl'];
                                    var long = data['longgl'];
                                    var poin = data['infogl'];
                                    var rema = data['remagl'][i];

                                    var surfacePosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        0
                                    );
                                    var heightPosition = Cesium.Cartesian3.fromDegrees(
                                        long[i],
                                        lati[i],
                                        100
                                    );

                                    var color = Cesium.Color.YELLOW;
                                    var gmbcok = "3d_gardu.svg"

                                    var polyline = new Cesium.PolylineGraphics();
                                    polyline.material = new Cesium.ColorMaterialProperty(color);
                                    polyline.width = new Cesium.ConstantProperty(2);
                                    polyline.arcType = new Cesium.ConstantProperty(
                                        Cesium.ArcType.NONE
                                    );
                                    polyline.positions = new Cesium.ConstantProperty([
                                        surfacePosition,
                                        heightPosition,
                                    ]);

                                    map_cesium.entities.add({
                                        position: Cesium.Cartesian3.fromDegrees(long[i], lati[i], 100),
                                        billboard: {
                                            // icon: facilityUrl,
                                            image: `static/img/icon/` + gmbcok + ``,
                                            // image: `static/img/icon/3d_police.svg`,
                                            show: true, // default
                                            scale: 2.0, // default: 1.0
                                            width: 15, // default: undefined
                                            height: 15, // default: undefined
                                        },
                                        namegl: data['infogl'][i]
                                    });
                                    // console.log(nameadm)

                                    var entitygl = new Cesium.Entity({
                                        polyline: polyline,
                                        // name: data['infoadm'][i]
                                    });
                                    // console.log(name)
                                    map_cesium.entities.add(entitygl);
                                }
Muhamad's avatar
Muhamad committed
6680

6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738
                                map_cesium.selectedEntityChanged.addEventListener(function(selectedEntity) {
                                    if (Cesium.defined(selectedEntity)) {
                                        if (Cesium.defined(selectedEntity.name)) {
                                            var id_poly = selectedEntity.name
                                            $.ajax({
                                                url: "{% url 'api:edit' %}",
                                                data: {
                                                    'id_poly': id_poly
                                                },
                                                dataType: 'json',
                                                success: function(data) {
                                                    $("#modal_detail_non_kelurahan").modal('show');
                                                    if (data['administrasi']['f9'] == 'None') {
                                                        var path_img = "static/img/image_null.jpg"
                                                    } else {
                                                        var path_img = `"static/image/bangunan/` + data['administrasi']['f9'] + `"`
                                                    }

                                                    content_tampak = `
                                                    <div class="modal-dialog" style="width: max-content;height: max-content;">
                                                        <div class="modal-content">
                                                            <div class="modal-header bg-info" style="background-color:#40777c;">
                                                                <table>
                                                                    <tr>
                                                                        <th><h6 class="modal-title">Upload Tampak Bangunan</h6></th>
                                                                        <td><button type="button" class="close" data-dismiss="modal">&times;</button></td>
                                                                    </tr>
                                                                </table>
                                                            </div>
                                                            <div class="form-group" style="margin-bottom:10px;">
                                                                <div id="map-tampak" style="width: 450px;height: 250px;position: relative;margin-left: 10px;margin-right: 10px;margin-top: 10px;"></div>
                                                                <div class="form-group">
                                                                    <div class="col-lg-12" style="margin-top:10px;margin-bottom:10px;">
                                                                        <p>
                                                                            <input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunantampak" value="">
                                                                        </p>
                                                                        <p>
                                                                            <input type="text" name="idbangunan" id="idbangunantampak" class="form-control hidden" value="` + data['properties']['f1'] + `" disabled>
                                                                        </p>
                                                                        <p>
                                                                            <input type="text" name="namebangunan" id="namebangunantampak" class="form-control" value="` + data['properties']['f2'] + `" disabled>
                                                                        </p>
                                                                        <p>
                                                                            <input type="text" name="infobangunan" id="infobangunantampak" class="form-control" value="` + data['administrasi']['f12'] + `" disabled>
                                                                        </p>
                                                                        <p>
                                                                            <span>Gambar Tampak Atas</span>
                                                                            <input type="file" id="imgbangunanatas" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
                                                                            <input style="display:none;" id="gambaratas" type="text" class="form-control" value="` + data['administrasi']['f14'] + `"required>
                                                                        </p>
                                                                        <p>
                                                                            <span>Gambar Tampak Depan</span>
                                                                            <input type="file" id="imgbangunandepan" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
                                                                            <input style="display:none;" id="gambardepan" type="text" class="form-control" value="` + data['administrasi']['f15'] + `"required>
                                                                        </p>
                                                                    </div>
                                                                </div>
                                                            </div>
6739

6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757
                                                            <div class="modal-footer">
                                                                <button type="button" id="btnsavetampakbangunan" class="btn btn-info">Save</button>
                                                            </div>
                                                        </div>
                                                    </div>`;
                                                    $(".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(`<div>
                                                                                    <span style="font-size: large;">
                                                                                        ` + data['properties']['f2'] + `
                                                                                    </span>
                                                                                </div>
                                                                                <div>
                                                                                    <span>
                                                                                        ` + data['administrasi']['f1'] + `, ` + data['administrasi']['f2'] + `, ` + data['administrasi']['f3'] + `, ` + data['administrasi']['f4'] + `
                                                                                    </span>
                                                                                </div>
                            
                                                                                `)
Muhamad's avatar
Muhamad committed
6758

6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786
                                                    $(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
                                                                                <input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
                                                                                <div>
                                                                                    <div>
                                                                                        <span>Jenis Bangunan</span>
                                                                                    </div>
                                                                                    <div>
                                                                                        <span>
                                                                                            ` + data['administrasi']['f12'] + `
                                                                                        </span>
                                                                                    </div>
                                                                                </div>
                                                                                <div>
                                                                                    <div>
                                                                                        <span>Luas Bangunan</span>
                                                                                    </div>
                                                                                    <div>
                                                                                        <span style="font-family: 'Roboto';">` + data['administrasi']['f6'] + ` m</span>
                                                                                    </div>
                                                                                </div>
                                                                                <div>
                                                                                    <div>
                                                                                        <span>Luas Tanah</span>
                                                                                    </div>
                                                                                    <div>
                                                                                        <span style="font-family: 'Roboto';">` + data['administrasi']['f7'] + ` m</span>
                                                                                    </div>
                                                                                </div>
6787

6788 6789 6790 6791 6792 6793 6794 6795
                                                                                <div>
                                                                                    <div>
                                                                                        <span>Tinggi Bangunan</span>
                                                                                    </div>
                                                                                    <div>
                                                                                        <span style="font-family: 'Roboto';">` + data['administrasi']['f8'] + ` m</span>
                                                                                    </div>
                                                                                </div>
Muhamad's avatar
Muhamad committed
6796

6797 6798 6799 6800 6801 6802 6803 6804
                                                                                <div>
                                                                                    <div>
                                                                                        <span>Pemilik</span>
                                                                                    </div>
                                                                                    <div>
                                                                                        <span style="font-family: 'Roboto';">` + data['administrasi']['f10'] + ` m</span>
                                                                                    </div>
                                                                                </div>`);
6805

6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926
                                                    $(".btn_action").html(`<div class="tombol-edit-keterangan text-center" style="background-color: #5A9AFB;position: absolute;width: 212px;height: 40px;bottom: 2px;right: 5px;border: 1pt solid rosybrown;border-radius: 8px;">
                                                        <a href="#" class="btn btn-primary" data-toggle="modal" data-target="#modal_tampak" id="btn_upload_tampak" data-backdrop="static" data-keyboard="false"><i>Upload Tampak Bangunan 3D</i></a>
                                                                            </div>
                                                                            `)
                                                    if (list_perm.indexOf('delete_bangunan') >= 0 === false) {
                                                        $(".tombol-delete-keterangan").remove();
                                                    }

                                                    if (list_perm.indexOf('change_bangunan') >= 0 === false) {
                                                        $(".tombol-edit-keterangan").remove();
                                                    }

                                                    content = `<table class="table table-hover tasks-list">
                                                        <thead style="text-align: center;">
                                                            <tr>
                                                                <th style="padding: 0 0 0 0px;">
                                                                    <img src=` + path_img + ` alt="Image" style="width: 100%;max-height: 237px;height:237"> 
                                                                </th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <div class= "container">
                                                                <tr style="height: 100px;">
                                                                    <th>
                                                                        <div>
                                                                            <h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
                                                                            letter-spacing: 0;
                                                                            font-weight: 400;">
                                                                                <span style="font-size: x-large;">
                                                                                    ` + data['properties']['f2'] + `
                                                                                </span>
                                                                            </h1>
                                                                        </div>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 30px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f12'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f1'] + `, ` + data['administrasi']['f2'] + `, ` + data['administrasi']['f3'] + `, ` + data['administrasi']['f4'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <p>
                                                                            <span>Luas Bangunan : ` + data['administrasi']['f6'] + `</span>
                                                                        </p>
                                                                        <p>
                                                                            <span>Luas Tanah : ` + data['administrasi']['f7'] + `</span>
                                                                        </p>
                                                                        <p>
                                                                            <span>Tinggi Bangunan : ` + data['administrasi']['f8'] + `</span>
                                                                        </p>
                                                                        <p>
                                                                            <span>Pemilik : ` + data['administrasi']['f10'] + `</span>
                                                                        </p>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <p class="text-center" style="margin-top: 25px;">
                                                                            <a href="#" class="btn btn-primary" data-toggle="modal" data-target="#modal_tampak" id="btn_upload_tampak" data-backdrop="static" data-keyboard="false"><i>Upload Tampak Bangunan 3D</i></a>
                                                                            
                                                                        </p>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                        </tbody>
                                                    </table>`;
                                                    $("#isi_panel").html(content);
                                                    $("#modal_tampak").html(content_tampak);
                                                    panel_samp();
                                                }
                                            })

                                        } else if (Cesium.defined(selectedEntity.nameadm)) {
                                            var id_3dadm = selectedEntity.nameadm
                                            $.ajax({
                                                url: "{% url 'api:editkantor' %}",
                                                data: {
                                                    'id_point': id_3dadm
                                                },
                                                dataType: 'json',
                                                success: function(data) {

                                                    if (data['administrasi']['f8'] == 'None') {
                                                        var path_img = "static/img/image_null.jpg"
                                                    } else {
                                                        var path_img = "static/img/image/" + data['administrasi']['f8'];
                                                    }

                                                    $("#modal_detail_non_kelurahan").modal('show');
                                                    $(".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(`
                                                        <div>
                                                            <span style="font-size: large;">
                                                                ` + data['administrasi']['f1'] + `
                                                            </span>
                                                        </div>
                                                        <div>
                                                            <span>
                                                                ` +
                                                        data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                            </span>
                                                        </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
6927

6928
                                                    `)
Muhamad's avatar
Muhamad committed
6929

6930 6931 6932 6933 6934
                                                    $(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
                                                            <input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
                                                            <div>
                                                                <div>
                                                                    <span>Jenis Bangunan</span>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
6935 6936 6937
                                                                </div>
                                                                <div>
                                                                    <span>
6938
                                                                        ` + data['administrasi']['f2'] + `
Manggar Mahardhika's avatar
Manggar Mahardhika committed
6939 6940
                                                                    </span>
                                                                </div>
6941 6942
                                                            </div>
                                                            <div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
6943
                                                                <div>
6944
                                                                    <span>Luas</span>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
6945 6946
                                                                </div>
                                                                <div>
6947
                                                                    <span style="font-family: 'Roboto';">` + data['administrasi']['f5'] + ` m</span>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
6948
                                                                </div>
6949 6950 6951
                                                            </div>

                                                            <div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
6952
                                                                <div>
6953
                                                                    <span>Pimpinan</span>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
6954 6955
                                                                </div>
                                                                <div>
6956
                                                                    <span>` + data['administrasi']['f10'] + `</span>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
6957
                                                                </div>
6958 6959
                                                            </div>           
                                                    `);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
6960

6961 6962
                                                    $(".btn_action").html(`
                                                    `)
Manggar Mahardhika's avatar
Manggar Mahardhika committed
6963

6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986
                                                    content = `<table class="table table-hover tasks-list">
                                                        <thead style="text-align: center;">
                                                            <tr>
                                                                <th style="padding: 0 0 0 0px;">
                                                                    <img src=` + path_img + ` alt="Image" style="width: 100%;max-height: 237px;height:237"> 
                                                                </th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <div class= "container">
                                                                <tr style="height: 100px;">
                                                                    <th>
                                                                        <div>
                                                                            <h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
                                                                            letter-spacing: 0;
                                                                            font-weight: 400;">
                                                                                <span style="font-size: x-large;">
                                                                                    ` + data['administrasi']['f1'] + `
                                                                                </span>
                                                                            </h1>
                                                                        </div>
                                                                    </th>
                                                                </tr>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
6987
                                                            </div>
6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054
                                                            <div class= "container">
                                                                <tr style="height: 30px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f2'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <p>
                                                                            <span>Luas : ` + data['administrasi']['f5'] + `</span>
                                                                        </p>
                                                                        <p>
                                                                            <span>Pimpinan : ` + data['administrasi']['f10'] + `</span>
                                                                        </p>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                        </tbody>
                                                    </table>`;
                                                    $("#isi_panel").html(content);
                                                    panel_samp();
                                                }
                                            })

                                        } else if (Cesium.defined(selectedEntity.namelk)) {
                                            var id_3dadm = selectedEntity.namelk
                                            $.ajax({
                                                url: "{% url 'api:editlakes' %}",
                                                data: {
                                                    'id_point': id_3dadm
                                                },
                                                dataType: 'json',
                                                success: function(data) {
                                                    if (data['administrasi']['f8'] == 'None') {
                                                        var path_img = "static/img/image_null.jpg"
                                                    } else {
                                                        var path_img = "static/img/image/" + data['administrasi']['f8'];
                                                    }

                                                    $("#modal_detail_non_kelurahan").modal('show');
                                                    $(".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(`
                                                        <div>
                                                            <span style="font-size: large;">
                                                                ` + data['administrasi']['f1'] + `
                                                            </span>
                                                        </div>
                                                        <div>
                                                            <span>
                                                                ` +
                                                        data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                            </span>
                                                        </div>
7055

7056
                                                    `)
7057

7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077
                                                    $(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
                                                            <input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
                                                            <div>
                                                                <div>
                                                                    <span>Jenis Bangunan</span>
                                                                </div>
                                                                <div>
                                                                    <span>
                                                                        ` + data['administrasi']['f2'] + `
                                                                    </span>
                                                                </div>
                                                            </div>
                                                            <div>
                                                                <div>
                                                                    <span>Luas</span>
                                                                </div>
                                                                <div>
                                                                    <span style="font-family: 'Roboto';">` + data['administrasi']['f5'] + ` m</span>
                                                                </div>
                                                            </div>
7078

7079 7080 7081 7082 7083 7084 7085 7086 7087
                                                            <div>
                                                                <div>
                                                                    <span>Pimpinan</span>
                                                                </div>
                                                                <div>
                                                                    <span>` + data['administrasi']['f10'] + `</span>
                                                                </div>
                                                            </div>           
                                                    `);
Muhamad's avatar
Muhamad committed
7088

7089 7090
                                                    $(".btn_action").html(`
                                                    `)
7091

7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171
                                                    content = `<table class="table table-hover tasks-list">
                                                        <thead style="text-align: center;">
                                                            <tr>
                                                                <th style="padding: 0 0 0 0px;">
                                                                    <img src=` + path_img + ` alt="Image" style="width: 100%;max-height: 237px;height:237"> 
                                                                </th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <div class= "container">
                                                                <tr style="height: 100px;">
                                                                    <th>
                                                                        <div>
                                                                            <h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
                                                                            letter-spacing: 0;
                                                                            font-weight: 400;">
                                                                                <span style="font-size: x-large;">
                                                                                    ` + data['administrasi']['f1'] + `
                                                                                </span>
                                                                            </h1>
                                                                        </div>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 30px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f2'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <p>
                                                                            <span>Luas : ` + data['administrasi']['f5'] + `</span>
                                                                        </p>
                                                                        <p>
                                                                            <span>Pimpinan : ` + data['administrasi']['f10'] + `</span>
                                                                        </p>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                        </tbody>
                                                    </table>`;
                                                    $("#isi_panel").html(content);
                                                    panel_samp();
                                                }
                                            })

                                        } else if (Cesium.defined(selectedEntity.namepks)) {
                                            var id_3dadm = selectedEntity.namepks
                                            $.ajax({
                                                url: "{% url 'api:editpks' %}",
                                                data: {
                                                    'id_point': id_3dadm
                                                },
                                                dataType: 'json',
                                                success: function(data) {
                                                    if (data['administrasi']['f8'] == 'None') {
                                                        var path_img = "static/img/image_null.jpg"
                                                    } else {
                                                        var path_img = "static/img/image/" + data['administrasi']['f8'];
                                                    }

                                                    $("#modal_detail_non_kelurahan").modal('show');
                                                    $(".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(`
7172
                                                        <div>
7173 7174 7175 7176 7177 7178 7179 7180 7181
                                                            <span style="font-size: large;">
                                                                ` + data['administrasi']['f1'] + `
                                                            </span>
                                                        </div>
                                                        <div>
                                                            <span>
                                                                ` +
                                                        data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                            </span>
7182
                                                        </div>
7183

7184
                                                    `)
7185

7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205
                                                    $(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
                                                            <input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
                                                            <div>
                                                                <div>
                                                                    <span>Jenis Bangunan</span>
                                                                </div>
                                                                <div>
                                                                    <span>
                                                                        ` + data['administrasi']['f2'] + `
                                                                    </span>
                                                                </div>
                                                            </div>
                                                            <div>
                                                                <div>
                                                                    <span>Luas</span>
                                                                </div>
                                                                <div>
                                                                    <span style="font-family: 'Roboto';">` + data['administrasi']['f5'] + ` m</span>
                                                                </div>
                                                            </div>
7206

7207 7208 7209 7210 7211 7212 7213 7214 7215
                                                            <div>
                                                                <div>
                                                                    <span>Pimpinan</span>
                                                                </div>
                                                                <div>
                                                                    <span>` + data['administrasi']['f10'] + `</span>
                                                                </div>
                                                            </div>           
                                                    `);
Muhamad's avatar
Muhamad committed
7216

7217 7218
                                                    $(".btn_action").html(`
                                                    `)
7219

7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299
                                                    content = `<table class="table table-hover tasks-list">
                                                        <thead style="text-align: center;">
                                                            <tr>
                                                                <th style="padding: 0 0 0 0px;">
                                                                    <img src=` + path_img + ` alt="Image" style="width: 100%;max-height: 237px;height:237"> 
                                                                </th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <div class= "container">
                                                                <tr style="height: 100px;">
                                                                    <th>
                                                                        <div>
                                                                            <h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
                                                                            letter-spacing: 0;
                                                                            font-weight: 400;">
                                                                                <span style="font-size: x-large;">
                                                                                    ` + data['administrasi']['f1'] + `
                                                                                </span>
                                                                            </h1>
                                                                        </div>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 30px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f2'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <p>
                                                                            <span>Luas : ` + data['administrasi']['f5'] + `</span>
                                                                        </p>
                                                                        <p>
                                                                            <span>Pimpinan : ` + data['administrasi']['f10'] + `</span>
                                                                        </p>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                        </tbody>
                                                    </table>`;
                                                    $("#isi_panel").html(content);
                                                    panel_samp();
                                                }
                                            })

                                        } else if (Cesium.defined(selectedEntity.namers)) {
                                            var id_3dadm = selectedEntity.namers
                                            $.ajax({
                                                url: "{% url 'api:editrs' %}",
                                                data: {
                                                    'id_point': id_3dadm
                                                },
                                                dataType: 'json',
                                                success: function(data) {
                                                    if (data['administrasi']['f8'] == 'None') {
                                                        var path_img = "static/img/image_null.jpg"
                                                    } else {
                                                        var path_img = "static/img/image/" + data['administrasi']['f8'];
                                                    }

                                                    $("#modal_detail_non_kelurahan").modal('show');
                                                    $(".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(`
7300
                                                        <div>
7301 7302 7303 7304 7305 7306 7307 7308 7309
                                                            <span style="font-size: large;">
                                                                ` + data['administrasi']['f1'] + `
                                                            </span>
                                                        </div>
                                                        <div>
                                                            <span>
                                                                ` +
                                                        data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                            </span>
7310
                                                        </div>
7311

7312
                                                    `)
7313

7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333
                                                    $(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
                                                            <input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
                                                            <div>
                                                                <div>
                                                                    <span>Jenis Bangunan</span>
                                                                </div>
                                                                <div>
                                                                    <span>
                                                                        ` + data['administrasi']['f2'] + `
                                                                    </span>
                                                                </div>
                                                            </div>
                                                            <div>
                                                                <div>
                                                                    <span>Luas</span>
                                                                </div>
                                                                <div>
                                                                    <span style="font-family: 'Roboto';">` + data['administrasi']['f5'] + ` m</span>
                                                                </div>
                                                            </div>
7334

7335 7336 7337 7338 7339 7340 7341 7342 7343
                                                            <div>
                                                                <div>
                                                                    <span>Pimpinan</span>
                                                                </div>
                                                                <div>
                                                                    <span>` + data['administrasi']['f10'] + `</span>
                                                                </div>
                                                            </div>           
                                                    `);
Muhamad's avatar
Muhamad committed
7344

7345 7346
                                                    $(".btn_action").html(`
                                                    `)
7347

7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427
                                                    content = `<table class="table table-hover tasks-list">
                                                        <thead style="text-align: center;">
                                                            <tr>
                                                                <th style="padding: 0 0 0 0px;">
                                                                    <img src=` + path_img + ` alt="Image" style="width: 100%;max-height: 237px;height:237"> 
                                                                </th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <div class= "container">
                                                                <tr style="height: 100px;">
                                                                    <th>
                                                                        <div>
                                                                            <h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
                                                                            letter-spacing: 0;
                                                                            font-weight: 400;">
                                                                                <span style="font-size: x-large;">
                                                                                    ` + data['administrasi']['f1'] + `
                                                                                </span>
                                                                            </h1>
                                                                        </div>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 30px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f2'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <p>
                                                                            <span>Luas : ` + data['administrasi']['f5'] + `</span>
                                                                        </p>
                                                                        <p>
                                                                            <span>Pimpinan : ` + data['administrasi']['f10'] + `</span>
                                                                        </p>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                        </tbody>
                                                    </table>`;
                                                    $("#isi_panel").html(content);
                                                    panel_samp();
                                                }
                                            })

                                        } else if (Cesium.defined(selectedEntity.namesi)) {
                                            var id_3dadm = selectedEntity.namesi
                                            $.ajax({
                                                url: "{% url 'api:editsi' %}",
                                                data: {
                                                    'id_point': id_3dadm
                                                },
                                                dataType: 'json',
                                                success: function(data) {
                                                    if (data['administrasi']['f8'] == 'None') {
                                                        var path_img = "static/img/image_null.jpg"
                                                    } else {
                                                        var path_img = "static/img/image/" + data['administrasi']['f8'];
                                                    }

                                                    $("#modal_detail_non_kelurahan").modal('show');
                                                    $(".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(`
7428
                                                        <div>
7429 7430 7431 7432 7433 7434 7435 7436 7437
                                                            <span style="font-size: large;">
                                                                ` + data['administrasi']['f1'] + `
                                                            </span>
                                                        </div>
                                                        <div>
                                                            <span>
                                                                ` +
                                                        data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                            </span>
7438
                                                        </div>
7439

7440
                                                    `)
7441

7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461
                                                    $(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
                                                            <input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
                                                            <div>
                                                                <div>
                                                                    <span>Jenis Bangunan</span>
                                                                </div>
                                                                <div>
                                                                    <span>
                                                                        ` + data['administrasi']['f2'] + `
                                                                    </span>
                                                                </div>
                                                            </div>
                                                            <div>
                                                                <div>
                                                                    <span>Luas</span>
                                                                </div>
                                                                <div>
                                                                    <span style="font-family: 'Roboto';">` + data['administrasi']['f5'] + ` m</span>
                                                                </div>
                                                            </div>
7462

7463 7464 7465 7466 7467 7468 7469 7470 7471
                                                            <div>
                                                                <div>
                                                                    <span>Pimpinan</span>
                                                                </div>
                                                                <div>
                                                                    <span>` + data['administrasi']['f10'] + `</span>
                                                                </div>
                                                            </div>           
                                                    `);
Muhamad's avatar
Muhamad committed
7472

7473 7474
                                                    $(".btn_action").html(`
                                                    `)
7475

7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555
                                                    content = `<table class="table table-hover tasks-list">
                                                        <thead style="text-align: center;">
                                                            <tr>
                                                                <th style="padding: 0 0 0 0px;">
                                                                    <img src=` + path_img + ` alt="Image" style="width: 100%;max-height: 237px;height:237"> 
                                                                </th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <div class= "container">
                                                                <tr style="height: 100px;">
                                                                    <th>
                                                                        <div>
                                                                            <h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
                                                                            letter-spacing: 0;
                                                                            font-weight: 400;">
                                                                                <span style="font-size: x-large;">
                                                                                    ` + data['administrasi']['f1'] + `
                                                                                </span>
                                                                            </h1>
                                                                        </div>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 30px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f2'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <p>
                                                                            <span>Luas : ` + data['administrasi']['f5'] + `</span>
                                                                        </p>
                                                                        <p>
                                                                            <span>Pimpinan : ` + data['administrasi']['f10'] + `</span>
                                                                        </p>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                        </tbody>
                                                    </table>`;
                                                    $("#isi_panel").html(content);
                                                    panel_samp();
                                                }
                                            })

                                        } else if (Cesium.defined(selectedEntity.namesp)) {
                                            var id_3dadm = selectedEntity.namesp
                                            $.ajax({
                                                url: "{% url 'api:editsp' %}",
                                                data: {
                                                    'id_point': id_3dadm
                                                },
                                                dataType: 'json',
                                                success: function(data) {
                                                    if (data['administrasi']['f8'] == 'None') {
                                                        var path_img = "static/img/image_null.jpg"
                                                    } else {
                                                        var path_img = "static/img/image/" + data['administrasi']['f8'];
                                                    }

                                                    $("#modal_detail_non_kelurahan").modal('show');
                                                    $(".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(`
7556
                                                        <div>
7557 7558 7559
                                                            <span style="font-size: large;">
                                                                ` + data['administrasi']['f1'] + `
                                                            </span>
7560 7561
                                                        </div>
                                                        <div>
7562 7563 7564 7565
                                                            <span>
                                                                ` +
                                                        data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                            </span>
7566
                                                        </div>
7567

7568
                                                    `)
7569

7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589
                                                    $(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
                                                            <input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
                                                            <div>
                                                                <div>
                                                                    <span>Jenis Bangunan</span>
                                                                </div>
                                                                <div>
                                                                    <span>
                                                                        ` + data['administrasi']['f2'] + `
                                                                    </span>
                                                                </div>
                                                            </div>
                                                            <div>
                                                                <div>
                                                                    <span>Luas</span>
                                                                </div>
                                                                <div>
                                                                    <span style="font-family: 'Roboto';">` + data['administrasi']['f5'] + ` m</span>
                                                                </div>
                                                            </div>
7590

7591 7592 7593 7594 7595 7596 7597 7598 7599
                                                            <div>
                                                                <div>
                                                                    <span>Pimpinan</span>
                                                                </div>
                                                                <div>
                                                                    <span>` + data['administrasi']['f10'] + `</span>
                                                                </div>
                                                            </div>           
                                                    `);
Muhamad's avatar
Muhamad committed
7600

7601 7602
                                                    $(".btn_action").html(`
                                                    `)
Muhamad's avatar
Muhamad committed
7603

7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758
                                                    content = `<table class="table table-hover tasks-list">
                                                        <thead style="text-align: center;">
                                                            <tr>
                                                                <th style="padding: 0 0 0 0px;">
                                                                    <img src=` + path_img + ` alt="Image" style="width: 100%;max-height: 237px;height:237"> 
                                                                </th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <div class= "container">
                                                                <tr style="height: 100px;">
                                                                    <th>
                                                                        <div>
                                                                            <h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
                                                                            letter-spacing: 0;
                                                                            font-weight: 400;">
                                                                                <span style="font-size: x-large;">
                                                                                    ` + data['administrasi']['f1'] + `
                                                                                </span>
                                                                            </h1>
                                                                        </div>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 30px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f2'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <p>
                                                                            <span>Luas : ` + data['administrasi']['f5'] + `</span>
                                                                        </p>
                                                                        <p>
                                                                            <span>Pimpinan : ` + data['administrasi']['f10'] + `</span>
                                                                        </p>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                        </tbody>
                                                    </table>`;
                                                    $("#isi_panel").html(content);
                                                    panel_samp();
                                                }
                                            })

                                            // } else if (Cesium.defined(selectedEntity.namespbu)) {
                                            //     var id_3dadm = selectedEntity.namespbu
                                            //     $.ajax({
                                            //         url: "{% url 'api:editpom' %}",
                                            //         data: {
                                            //             'id_point': id_3dadm
                                            //         },
                                            //         dataType: 'json',
                                            //         success: function(data) {
                                            //             if (data['administrasi']['f8'] == 'None') {
                                            //                 var path_img = "static/img/image_null.jpg"
                                            //             } else {
                                            //                 var path_img = `"static/img/image/` + data['administrasi']['f8'] + `"`
                                            //             }
                                            //             content = `<table class="table table-hover tasks-list">
                                            //                 <thead style="text-align: center;">
                                            //                     <tr>
                                            //                         <th style="padding: 0 0 0 0px;">
                                            //                             <img src=` + path_img + ` alt="Image" style="width: 100%;max-height: 237px;height:237"> 
                                            //                         </th>
                                            //                     </tr>
                                            //                 </thead>
                                            //                 <tbody>
                                            //                     <div class= "container">
                                            //                         <tr style="height: 100px;">
                                            //                             <th>
                                            //                                 <div>
                                            //                                     <h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
                                            //                                     letter-spacing: 0;
                                            //                                     font-weight: 400;">
                                            //                                         <span style="font-size: x-large;">
                                            //                                             ` + data['administrasi']['f1'] + `
                                            //                                         </span>
                                            //                                     </h1>
                                            //                                 </div>
                                            //                             </th>
                                            //                         </tr>
                                            //                     </div>
                                            //                     <div class= "container">
                                            //                         <tr style="height: 30px;">
                                            //                             <th>
                                            //                                 <span>
                                            //                                     ` + data['administrasi']['f2'] + `
                                            //                                 </span>
                                            //                             </th>
                                            //                         </tr>
                                            //                     </div>
                                            //                     <div class= "container">
                                            //                         <tr style="height: 40px;">
                                            //                             <th>
                                            //                                 <span>
                                            //                                     ` + data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                            //                                 </span>
                                            //                             </th>
                                            //                         </tr>
                                            //                     </div>
                                            //                     <div class= "container">
                                            //                         <tr style="height: 40px;">
                                            //                             <th>
                                            //                                 <p>
                                            //                                     <span>Luas : ` + data['administrasi']['f5'] + `</span>
                                            //                                 </p>
                                            //                                 <p>
                                            //                                     <span>Pimpinan : ` + data['administrasi']['f10'] + `</span>
                                            //                                 </p>
                                            //                             </th>
                                            //                         </tr>
                                            //                     </div>
                                            //                 </tbody>
                                            //             </table>`;
                                            //             $("#isi_panel").html(content);
                                            //             panel_samp();
                                            //         }
                                            //     })

                                        } else if (Cesium.defined(selectedEntity.namest)) {
                                            var id_3dadm = selectedEntity.namest
                                            $.ajax({
                                                url: "{% url 'api:editst' %}",
                                                data: {
                                                    'id_point': id_3dadm
                                                },
                                                dataType: 'json',
                                                success: function(data) {
                                                    if (data['administrasi']['f8'] == 'None') {
                                                        var path_img = "static/img/image_null.jpg"
                                                    } else {
                                                        var path_img = "static/img/image/" + data['administrasi']['f8'];
                                                    }

                                                    $("#modal_detail_non_kelurahan").modal('show');
                                                    $(".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(`
7759
                                                        <div>
7760 7761 7762 7763 7764 7765 7766 7767 7768
                                                            <span style="font-size: large;">
                                                                ` + data['administrasi']['f1'] + `
                                                            </span>
                                                        </div>
                                                        <div>
                                                            <span>
                                                                ` +
                                                        data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                            </span>
7769
                                                        </div>
7770

7771
                                                    `)
7772

7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792
                                                    $(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
                                                            <input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
                                                            <div>
                                                                <div>
                                                                    <span>Jenis Bangunan</span>
                                                                </div>
                                                                <div>
                                                                    <span>
                                                                        ` + data['administrasi']['f2'] + `
                                                                    </span>
                                                                </div>
                                                            </div>
                                                            <div>
                                                                <div>
                                                                    <span>Luas</span>
                                                                </div>
                                                                <div>
                                                                    <span style="font-family: 'Roboto';">` + data['administrasi']['f5'] + ` m</span>
                                                                </div>
                                                            </div>
7793

7794 7795 7796 7797 7798 7799 7800 7801 7802
                                                            <div>
                                                                <div>
                                                                    <span>Pimpinan</span>
                                                                </div>
                                                                <div>
                                                                    <span>` + data['administrasi']['f10'] + `</span>
                                                                </div>
                                                            </div>           
                                                    `);
Muhamad's avatar
Muhamad committed
7803

7804 7805
                                                    $(".btn_action").html(`
                                                    `)
7806

7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886
                                                    content = `<table class="table table-hover tasks-list">
                                                        <thead style="text-align: center;">
                                                            <tr>
                                                                <th style="padding: 0 0 0 0px;">
                                                                    <img src=` + path_img + ` alt="Image" style="width: 100%;max-height: 237px;height:237"> 
                                                                </th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <div class= "container">
                                                                <tr style="height: 100px;">
                                                                    <th>
                                                                        <div>
                                                                            <h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
                                                                            letter-spacing: 0;
                                                                            font-weight: 400;">
                                                                                <span style="font-size: x-large;">
                                                                                    ` + data['administrasi']['f1'] + `
                                                                                </span>
                                                                            </h1>
                                                                        </div>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 30px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f2'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <p>
                                                                            <span>Luas : ` + data['administrasi']['f5'] + `</span>
                                                                        </p>
                                                                        <p>
                                                                            <span>Pimpinan : ` + data['administrasi']['f10'] + `</span>
                                                                        </p>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                        </tbody>
                                                    </table>`;
                                                    $("#isi_panel").html(content);
                                                    panel_samp();
                                                }
                                            })

                                        } else if (Cesium.defined(selectedEntity.nametr)) {
                                            var id_3dadm = selectedEntity.nametr
                                            $.ajax({
                                                url: "{% url 'api:edittr' %}",
                                                data: {
                                                    'id_point': id_3dadm
                                                },
                                                dataType: 'json',
                                                success: function(data) {
                                                    if (data['administrasi']['f8'] == 'None') {
                                                        var path_img = "static/img/image_null.jpg"
                                                    } else {
                                                        var path_img = "static/img/image/" + data['administrasi']['f8'];
                                                    }

                                                    $("#modal_detail_non_kelurahan").modal('show');
                                                    $(".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(`
7887
                                                        <div>
7888 7889 7890 7891 7892 7893 7894 7895 7896
                                                            <span style="font-size: large;">
                                                                ` + data['administrasi']['f1'] + `
                                                            </span>
                                                        </div>
                                                        <div>
                                                            <span>
                                                                ` +
                                                        data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                            </span>
7897
                                                        </div>
7898

7899
                                                    `)
7900

7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920
                                                    $(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
                                                            <input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
                                                            <div>
                                                                <div>
                                                                    <span>Jenis Bangunan</span>
                                                                </div>
                                                                <div>
                                                                    <span>
                                                                        ` + data['administrasi']['f2'] + `
                                                                    </span>
                                                                </div>
                                                            </div>
                                                            <div>
                                                                <div>
                                                                    <span>Luas</span>
                                                                </div>
                                                                <div>
                                                                    <span style="font-family: 'Roboto';">` + data['administrasi']['f5'] + ` m</span>
                                                                </div>
                                                            </div>
7921

7922 7923 7924 7925 7926 7927 7928 7929 7930
                                                            <div>
                                                                <div>
                                                                    <span>Pimpinan</span>
                                                                </div>
                                                                <div>
                                                                    <span>` + data['administrasi']['f10'] + `</span>
                                                                </div>
                                                            </div>           
                                                    `);
Muhamad's avatar
Muhamad committed
7931

7932 7933
                                                    $(".btn_action").html(`
                                                    `)
7934

7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014
                                                    content = `<table class="table table-hover tasks-list">
                                                        <thead style="text-align: center;">
                                                            <tr>
                                                                <th style="padding: 0 0 0 0px;">
                                                                    <img src=` + path_img + ` alt="Image" style="width: 100%;max-height: 237px;height:237"> 
                                                                </th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <div class= "container">
                                                                <tr style="height: 100px;">
                                                                    <th>
                                                                        <div>
                                                                            <h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
                                                                            letter-spacing: 0;
                                                                            font-weight: 400;">
                                                                                <span style="font-size: x-large;">
                                                                                    ` + data['administrasi']['f1'] + `
                                                                                </span>
                                                                            </h1>
                                                                        </div>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 30px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f2'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <p>
                                                                            <span>Luas : ` + data['administrasi']['f5'] + `</span>
                                                                        </p>
                                                                        <p>
                                                                            <span>Pimpinan : ` + data['administrasi']['f10'] + `</span>
                                                                        </p>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                        </tbody>
                                                    </table>`;
                                                    $("#isi_panel").html(content);
                                                    panel_samp();
                                                }
                                            })

                                        } else if (Cesium.defined(selectedEntity.namecb)) {
                                            var id_3dadm = selectedEntity.namecb
                                            $.ajax({
                                                url: "{% url 'api:editcb' %}",
                                                data: {
                                                    'id_point': id_3dadm
                                                },
                                                dataType: 'json',
                                                success: function(data) {
                                                    if (data['administrasi']['f4'] == 'None') {
                                                        var path_img = "static/img/image_null.jpg"
                                                    } else {
                                                        var path_img = "static/img/image/" + data['administrasi']['f4'];
                                                    }

                                                    $("#modal_detail_non_kelurahan").modal('show');
                                                    $(".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(`
8015
                                                        <div>
8016 8017 8018 8019 8020 8021 8022 8023 8024
                                                            <span style="font-size: large;">
                                                                ` + data['administrasi']['f1'] + `
                                                            </span>
                                                        </div>
                                                        <div>
                                                            <span>
                                                                ` +
                                                        data['administrasi']['f3'] + `, ` + data['administrasi']['f9'] + `, ` + data['administrasi']['f8'] + `, ` + data['administrasi']['f7'] + `
                                                            </span>
8025
                                                        </div>
8026

8027
                                                    `)
8028

8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048
                                                    $(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
                                                            <input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
                                                            <div>
                                                                <div>
                                                                    <span>Jenis Bangunan</span>
                                                                </div>
                                                                <div>
                                                                    <span>
                                                                        ` + data['administrasi']['f2'] + `
                                                                    </span>
                                                                </div>
                                                            </div>
                                                            <div>
                                                                <div>
                                                                    <span>Luas</span>
                                                                </div>
                                                                <div>
                                                                    <span style="font-family: 'Roboto';">` + data['administrasi']['f10'] + ` m</span>
                                                                </div>
                                                            </div>
8049

8050 8051 8052 8053 8054 8055 8056 8057 8058
                                                            <div>
                                                                <div>
                                                                    <span>Pimpinan</span>
                                                                </div>
                                                                <div>
                                                                    <span>` + data['administrasi']['f5'] + `</span>
                                                                </div>
                                                            </div>           
                                                    `);
Muhamad's avatar
Muhamad committed
8059

8060 8061
                                                    $(".btn_action").html(`
                                                    `)
8062

8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142
                                                    content = `<table class="table table-hover tasks-list">
                                                        <thead style="text-align: center;">
                                                            <tr>
                                                                <th style="padding: 0 0 0 0px;">
                                                                    <img src=` + path_img + ` alt="Image" style="width: 100%;max-height: 237px;height:237"> 
                                                                </th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <div class= "container">
                                                                <tr style="height: 100px;">
                                                                    <th>
                                                                        <div>
                                                                            <h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
                                                                            letter-spacing: 0;
                                                                            font-weight: 400;">
                                                                                <span style="font-size: x-large;">
                                                                                    ` + data['administrasi']['f1'] + `
                                                                                </span>
                                                                            </h1>
                                                                        </div>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 30px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f2'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f3'] + `, ` + data['administrasi']['f9'] + `, ` + data['administrasi']['f8'] + `, ` + data['administrasi']['f7'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <p>
                                                                            <span>Luas : ` + data['administrasi']['f10'] + `</span>
                                                                        </p>
                                                                        <p>
                                                                            <span>Pimpinan : ` + data['administrasi']['f5'] + `</span>
                                                                        </p>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                        </tbody>
                                                    </table>`;
                                                    $("#isi_panel").html(content);
                                                    panel_samp();
                                                }
                                            })

                                        } else if (Cesium.defined(selectedEntity.namegl)) {
                                            var id_3dadm = selectedEntity.namegl
                                            $.ajax({
                                                url: "{% url 'api:editgl' %}",
                                                data: {
                                                    'id_point': id_3dadm
                                                },
                                                dataType: 'json',
                                                success: function(data) {
                                                    if (data['administrasi']['f8'] == 'None') {
                                                        var path_img = "static/img/image_null.jpg"
                                                    } else {
                                                        var path_img = "static/img/image/" + data['administrasi']['f8'];
                                                    }

                                                    $("#modal_detail_non_kelurahan").modal('show');
                                                    $(".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(`
Muhamad's avatar
Muhamad committed
8143
                                                        <div>
8144 8145 8146 8147 8148 8149 8150 8151 8152
                                                            <span style="font-size: large;">
                                                                ` + data['administrasi']['f1'] + `
                                                            </span>
                                                        </div>
                                                        <div>
                                                            <span>
                                                                ` +
                                                        data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                            </span>
Muhamad's avatar
Muhamad committed
8153
                                                        </div>
8154

8155
                                                    `)
8156

8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176
                                                    $(".isi_keterangan").html(`<input type="text" name="idjalan" id="idjalan" class="hidden" value="">
                                                            <input type="text" name="coordinatejalan" id="coordinatejalan" class="hidden" value="">
                                                            <div>
                                                                <div>
                                                                    <span>Jenis Bangunan</span>
                                                                </div>
                                                                <div>
                                                                    <span>
                                                                        ` + data['administrasi']['f2'] + `
                                                                    </span>
                                                                </div>
                                                            </div>
                                                            <div>
                                                                <div>
                                                                    <span>Luas</span>
                                                                </div>
                                                                <div>
                                                                    <span style="font-family: 'Roboto';">` + data['administrasi']['f5'] + ` m</span>
                                                                </div>
                                                            </div>
8177

8178 8179 8180 8181 8182 8183 8184 8185 8186
                                                            <div>
                                                                <div>
                                                                    <span>Pimpinan</span>
                                                                </div>
                                                                <div>
                                                                    <span>` + data['administrasi']['f10'] + `</span>
                                                                </div>
                                                            </div>           
                                                    `);
Muhamad's avatar
Muhamad committed
8187

8188 8189
                                                    $(".btn_action").html(`
                                                    `)
8190

8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258
                                                    content = `<table class="table table-hover tasks-list">
                                                        <thead style="text-align: center;">
                                                            <tr>
                                                                <th style="padding: 0 0 0 0px;">
                                                                    <img src=` + path_img + ` alt="Image" style="width: 100%;max-height: 237px;height:237"> 
                                                                </th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <div class= "container">
                                                                <tr style="height: 100px;">
                                                                    <th>
                                                                        <div>
                                                                            <h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
                                                                            letter-spacing: 0;
                                                                            font-weight: 400;">
                                                                                <span style="font-size: x-large;">
                                                                                    ` + data['administrasi']['f1'] + `
                                                                                </span>
                                                                            </h1>
                                                                        </div>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 30px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f2'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <span>
                                                                            ` + data['administrasi']['f3'] + `, ` + data['administrasi']['f14'] + `, ` + data['administrasi']['f13'] + `, ` + data['administrasi']['f12'] + `
                                                                        </span>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                            <div class= "container">
                                                                <tr style="height: 40px;">
                                                                    <th>
                                                                        <p>
                                                                            <span>Luas : ` + data['administrasi']['f5'] + `</span>
                                                                        </p>
                                                                        <p>
                                                                            <span>Pimpinan : ` + data['administrasi']['f10'] + `</span>
                                                                        </p>
                                                                    </th>
                                                                </tr>
                                                            </div>
                                                        </tbody>
                                                    </table>`;
                                                    $("#isi_panel").html(content);
                                                    panel_samp();
                                                }
                                            })

                                        } else {
                                            console.log('Unknown entity selected.');
                                        }
                                    } else {
                                        console.log('Deselected.');
                                    }
                                });
Muhamad's avatar
Muhamad committed
8259

8260 8261
                            }
                        });
Muhamad's avatar
Muhamad committed
8262

8263
                    });
Muhamad's avatar
Muhamad committed
8264

8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284
                }
            })
        } else {
            //location.reload();
            $("#labelchange").html(`<img src="static/img/icon-1/Vector3d.svg" alt="" style="height: 50px;
                    width: 50px;">`)
            map_cesium.entities.removeAll();
            map_cesium.destroy();
            // setTimeout(function() {
            //     map.invalidateSize();
            // }, 1000);
            $('#scrcesium').remove();
            $("#map").css('display', 'block');
            $(".no3d").css('display', 'block');
            $(".rar").css('display', 'block');
            $("#map-cesium").css('display', 'none');
            $(".tooltip-3d").html(`3D`)
                //$(".filter3d").removeClass("d3filter");
        }
    } 
Muhamad's avatar
Muhamad committed
8285 8286 8287 8288

    function load3dbang() {
        $(".label-bangunan").css("display", "none");
    }
8289 8290 8291

    $(document).on("click", "#btn_upload_tampak", function() {
        var map_tampak = new L.map('map-tampak', {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8292
            editable: false,
8293
            zoomControl: false,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8294
            drawControl: false
8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381
        }).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_tampak);
        var id_polytmpk = $('#idbangunantampak').val();
        // console.log(id_polyhps)
        loaderPage(true);

        $.ajax({
            url: "{% url 'api:edit' %}",
            data: {
                'id_poly': id_polytmpk
            },
            dataType: 'json',
            success: function(data) {

                setTimeout(function() {
                    map_tampak.invalidateSize();
                }, 1000);
                loaderPage(false);

                map_tampak.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++) {
                    geoj = lop_poly_edit[i][0];
                    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_tampak)
                $('#btnsavetampakbangunan').click(function() {
                    var hasil = (JSON.stringify(polyly.toGeoJSON()))
                    $("#coordinatebangunantampak").val(hasil);
                })
            }
        })
    });

    $(document).on("click", "#btnsavetampakbangunan", function() {

        var data = new FormData();
        data.append('id_poly', $('#idbangunantampak').val())
        data.append('name_b', $('#namebangunantampak').val())
        data.append('gambar_atas', $('#gambaratas').val())
        data.append('gambar_depan', $('#gambardepan').val())
        data.append("fileatas", $("input[id^='imgbangunanatas']")[0].files[0]);
        data.append("filedepan", $("input[id^='imgbangunandepan']")[0].files[0]);
        data.append("csrfmiddlewaretoken", "{{ csrf_token }}");

        $.ajax({
            url: "{% url 'api:tampak' %}",
            data: data,
            dataType: 'json',
            type: 'POST',
            processData: false,
            contentType: false,
            success: function(data) {
                let response = data
                if (response.code == 0) {
                    swal({
                        title: response.info,
                        text: response.data,
                        type: "success",
                        icon: "success",
                        confirmButtonColor: "#00BCD4"
                    }, function() {
                        $("#modal_tampak").css('display', 'none');
                        location.reload()
                    })
                } else {
                    swal({
                        title: 'Error',
                        text: 'Terjadi Kesalahan',
                        type: "warning",
                        icon: "error",
                        confirmButtonColor: "#00BCD4"
                    })
                }
            }
        })

    });

Muhamad's avatar
Muhamad committed
8382 8383
    //3d end

Manggar Mahardhika's avatar
Manggar Mahardhika committed
8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411
    var geocodeService = L.esri.Geocoding.geocodeService();
    var geocoderNominatim = new L.Control.Geocoder.Nominatim();

    var geo_bangunan = L.geoJson(null, {
        style: function(feature) {
            return {
                color: "#ff0008",
                weight: 1,
                opacity: 2,
                zIndex: 1000
            };
        },

        onEachFeature: function(feature, layer) {
            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) {
8412
                        $("#modal_detail_non_kelurahan").modal('show');
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8413 8414
                        var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {

8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426
                            // tay = result.address.Address;
                            // if (feature.administrasi.f3 == 'None') {
                            //     if (tay != '') {
                            //         var alamak = tay;

                            //     } else {
                            //         alamak = ""
                            //     }

                            // } else {
                            //     var alamak = feature.administrasi.f3;
                            // }
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8427
                            console.log(feature.administrasi.f9)
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8428 8429 8430 8431 8432
                            if (feature.administrasi.f9 == 'None') {
                                var path_img = "static/img/image_null.jpg"
                            } else {
                                var path_img = `"static/image/bangunan/` + feature.administrasi.f9 + `"`
                            }
8433
                            // var list_history = feature.properties.f4
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8434 8435
                            // for (var i = 0; i < list_history.length; i++) {
                            //     var dt_history = list_history[i].split(",");
8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455
                            //     console.log(dt_history[0])
                            //     console.log(dt_history[1])
                            //     console.log(dt_history[2])
                            // }
                            // if (feature.administrasi.f11 != 'None'){
                            //     var cbb = `<option value="null" disabled>-- Pilih Jenis Point --</option>
                            //                     <option value="bangunan" `if(feature.administrasi.f11 != 'bangunan'){`selected`};` >Bangunan Biasa</option>
                            //                     <option value="kantor_administrasi">Kantor Administrasi</option>
                            //                     <option value="layanan_kesehatan">Layanan Kesehatan</option>
                            //                     <option value="puskesmas">Puskesmas</option>
                            //                     <option value="rumah_sakit">Rumah Sakit</option>
                            //                     <option value="sarana_ibadah">Sarana Ibadah</option>
                            //                     <option value="sarana_pendidikan">Sarana Pendidikan</option>
                            //                     <option value="spbu">SPBU</option>
                            //                     <option value="stasiun">Stasiun</option>
                            //                     <option value="terminal_bus">Terminal Bus</option>
                            //                     <option value="cagar_budaya">Cagar Budaya dan Tempat Wisata</option>
                            //                     <option value="gardu_listrik">Gardu Listrik</option>`
                            // }
                            var history
Muhamad's avatar
Muhamad committed
8456 8457 8458
                            if (feature.administrasi.f11 == 'kantor_administrasi' || feature.administrasi.f11 == 'layanan_kesehatan' || feature.administrasi.f11 == 'puskesmas' ||
                                feature.administrasi.f11 == 'rumah_sakit' || feature.administrasi.f11 == 'sarana_pendidikan' || feature.administrasi.f11 == 'stasiun' ||
                                feature.administrasi.f11 == 'terminal_bus' || feature.administrasi.f11 == 'cagar_budaya' || feature.administrasi.f11 == 'gardu_listrik') {
8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470
                                if (feature.properties.f4 != null) {
                                    var list_history = feature.properties.f4
                                    var list_history_panel = ``
                                    for (var i = 0; i < list_history.length; i++) {
                                        var dt_history = list_history[i].split(",");
                                        var data_history = `<div class="form-group" style="margin-bottom:0px;">
                                                                <div class="row">
                                                                    <label class="col-md-6">` + dt_history[1] + `</label>
                                                                    <label class="col-md-6">` + dt_history[2] + `</label>
                                                                </div>
                                                            </div>`;
                                        list_history_panel += data_history
8471
                                    };
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8472

8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499
                                    history = `
                                    <div>
                                        <div style="margin-top: 150px;">
                                            <span>Perbaikan Terakhir</span>
                                            <span>
                                                <a id='btn_detail_per_bang' onclick="getdetailperbang(` + feature.properties.f1 + `)" data-toggle="modal" data-target="#modal_detail" style = "text-align:right; margin-right:26px;"><i>Detail</i></a>
                                            </span>
                                        </div>
                                        <div>
                                            <span>
                                                <tr style="height: 40px;">
                                                    <th id="history_panel">
                                                        <div class="form-group" style="margin-bottom:0px;">
                                                            <div class="row">
                                                                <label class="col-md-6">` + list_history[0].split(",")[1] + `</label>
                                                                <label class="col-md-6">` + list_history[0].split(",")[2] + `</label>
                                                            </div>
                                                        </div>
                                                        <p class="text-center" style="margin-top: 5px;">
                                                            <a class="btn" id="btn_perbaikan_bangunan" data-toggle="modal" data-target="#input_perbaikan_bang"><i>Input Perbaikan</i></a>
                                                        </p>
                                                    </th>
                                                </tr>
                                            </span>
                                        </div>
                                    </div>
                                        `;
8500 8501
                                } else {
                                    history = `
8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519
                                    <div>
                                        <div style="margin-top: 150px;">
                                            <span>Perbaikan Terakhir</span>
                                        </div>
                                        <div>
                                            <span>
                                                <tr style="height: 40px;">
                                                    <th id="history_panel">
                                                        <p class="text-center" style="margin-top: 10px;"><i>Belum Ada History</i></p>
                                                        <p class="text-center" style="margin-top: 10px;">
                                                            <a class="btn" id="btn_perbaikan_bangunan" data-toggle="modal" data-target="#input_perbaikan_bang"><i>Input Perbaikan</i></a>
                                                        </p>
                                                    </th>
                                                </tr>
                                            </span>
                                        </div>
                                    </div>
                                    `;
8520
                                }
8521 8522 8523
                            } else {
                                history = ``
                            }
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8524

8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544
                            // if (feature.properties.f4 != null) {
                            //     var list_history = feature.properties.f4
                            //     console.log(list_history[0].split(",")[0])
                            //     var perbaikan_bg = `
                            //     <div class='row'>
                            //         <label class="col-md-8">` + list_history[0].split(",")[1] + `</label>
                            //         <a class="col-md-4" onclick="getdetailper(` + list_history[0].split(",")[0] + `)" data-toggle="modal" data-target="#input_perbaikan_bang"><i>Detail</i></a>
                            //     </div>
                            //     <a class="btn" id="btn_perbaikan_bangunan" data-toggle="modal" data-target="#input_perbaikan_bang"><i>Input Perbaikan</i></a>`

                            // } else {
                            //     var perbaikan_bg = `<div class='row'>
                            //         <div class="col-md-6">
                            //             <label class="col-md-6">-</label>
                            //         </div>
                            //     </div>
                            //     <a class="btn" id="btn_perbaikan_bangunan" data-toggle="modal" data-target="#input_perbaikan_bang"><i>Input Perbaikan</i></a>
                            //     `
                            // }

Manggar Mahardhika's avatar
Manggar Mahardhika committed
8545 8546 8547 8548 8549 8550 8551
                            content_edit = `
                            <div class="modal-dialog" style="width: max-content;height: max-content;">
                                <div class="modal-content">
                                    <div class="modal-header bg-info" style="background-color:#40777c;">
                                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                                        <h6 class="modal-title">Edit Polygon Bangunan dan Informasinya</h6>
                                    </div>
Muhamad's avatar
Muhamad committed
8552
                                    <div class="modal-body" style="overflow-x: hidden;max-height: 300px;overflow-y: scroll;padding-left: 15px;">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8553 8554 8555 8556 8557 8558
                                        <div class="row">
                                            <div class="col-md-5">
                                                <div id="map-edit" style="width:400px;height: 350px;">
                                                </div>
                                            </div>
                                            <div class="col-md-4">
Muhamad's avatar
Muhamad committed
8559
                                                <input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunan" value="` + feature.geometry + `">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8560
                                                <table>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8561
                                                    <tr style="margin-top: 10px">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8562 8563 8564 8565 8566
                                                        <th>
                                                            Image
                                                        </th>
                                                        <td>
                                                            <input type="file" id="imgbangunan" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
Muhamad's avatar
Muhamad committed
8567
                                                            <input style="display:none;" id="gambar" type="text" class="form-control" value="` + feature.administrasi.f9 + `"required>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8568 8569 8570 8571
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
Muhamad's avatar
Muhamad committed
8572
                                                            <input type="text" name="idbangunan" id="idbangunan" class="form-control hidden" value="` + feature.properties.f1 + `" disable>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8573 8574 8575 8576 8577 8578
                                                            <input style="display:none;" id="coordinateZoneeditbang" type="text" class="form-control" value=""required>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th>Nama Bangunan</th>
                                                        <td>
Muhamad's avatar
Muhamad committed
8579
                                                            <input type="text" name="namebangunan" id="namebangunan" class="form-control" value="` + feature.properties.f2 + `">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8580 8581
                                                        </td>
                                                    </tr>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8582 8583 8584
                                                    <tr>
                                                        <th>Jenis Bangunan</th>
                                                        <td>
Muhamad's avatar
Muhamad committed
8585 8586 8587 8588
                                                            <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="tipe333" value="` + feature.administrasi.f13 + `">
                                                            <input type="text" class="hidden" name="tipe1" id="tipe444" value="` + feature.administrasi.f14 + `">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617
                                                            <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="bangunan">Bangunan Biasa</option>
                                                                <option value="kantor_administrasi">Kantor Administrasi</option>
                                                                <option value="layanan_kesehatan">Layanan Kesehatan</option>
                                                                <option value="puskesmas">Puskesmas</option>
                                                                <option value="rumah_sakit">Rumah Sakit</option>
                                                                <option value="sarana_ibadah">Sarana Ibadah</option>
                                                                <option value="sarana_pendidikan">Sarana Pendidikan</option>
                                                                <option value="stasiun">Stasiun</option>
                                                                <option value="terminal_bus">Terminal Bus</option>
                                                                <option value="cagar_budaya">Cagar Budaya dan Tempat Wisata</option>
                                                                <option value="gardu_listrik">Gardu Listrik</option>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th>Tipe Bangunan</th>
                                                        <td>
                                                            <select style="border-bottom: 1px solid rgb(83, 83, 83) !important;width: 220px;" id="tipe_point_2_b_e" data-placeholder="select point.." class="select-size-md">
                                                            <option value="null" selected disabled>-- Pilih Tipe Point --</option>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th>Point Bangunan</th>
                                                        <td>
                                                            <select style="border-bottom: 1px solid rgb(83, 83, 83) !important;width: 220px;" id="tipe_point_3_b_e" data-placeholder="select point.." class="select-size-md">
                                                            <option value="null" selected disabled>-- Pilih Point --</option>
                                                        </td>
                                                    </tr>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8618 8619 8620
                                                    <tr>
                                                        <th>Informasi Bangunan</th>
                                                        <td>
Muhamad's avatar
Muhamad committed
8621
                                                            <input type="text" name="infobangunan" id="infobangunan" class="form-control" value="` + feature.properties.f3 + `">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8622 8623 8624 8625 8626
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th>Kelurahan</th>
                                                        <td>
Muhamad's avatar
Muhamad committed
8627
                                                            <input type=" text " name="nmkelurahan " id="nmkelurahan" class="form-control " value="` + feature.administrasi.f1 + `">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8628 8629 8630 8631 8632
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th>Kecamatan</th>
                                                        <td>
Muhamad's avatar
Muhamad committed
8633
                                                            <input type="text " name="nmkecamatan " id="nmkecamatan" class="form-control " value="` + feature.administrasi.f2 + `">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8634 8635 8636 8637 8638
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th>Kab/Kota</th>
                                                        <td>
Muhamad's avatar
Muhamad committed
8639
                                                            <input type="text " name="nmkabkota " id="nmkabkota" class="form-control " value="` + feature.administrasi.f3 + `">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8640 8641 8642 8643 8644
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th>Provinsi</th>
                                                        <td>
Muhamad's avatar
Muhamad committed
8645
                                                            <input type="text " name="nmprovinsi " id="nmprovinsi" class="form-control " value="` + feature.administrasi.f4 + `">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657
                                                        </td>
                                                    </tr>

                                                </table>
                                            </div>

                                            <div class="col-md-3 ">

                                                <table>
                                                    <tr>
                                                        <th>Luas Bangunan</th>
                                                        <td>
Muhamad's avatar
Muhamad committed
8658
                                                            <input type="text " name="luasbangunan " id="luasbangunan" class="form-control " value="` + feature.administrasi.f6 + `">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8659 8660 8661 8662 8663
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th>Luas Tanah</th>
                                                        <td>
Muhamad's avatar
Muhamad committed
8664
                                                            <input type="text " name="luastanah " id="luastanah" class="form-control " value="` + feature.administrasi.f7 + `">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8665 8666 8667 8668 8669
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th>Tinggi Bangunan</th>
                                                        <td>
Muhamad's avatar
Muhamad committed
8670
                                                            <input type="text " name="tinggibangunan " id="tinggibangunan" class="form-control " value="` + feature.administrasi.f8 + `">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8671 8672 8673 8674 8675
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th>Pemilik</th>
                                                        <td>
Muhamad's avatar
Muhamad committed
8676
                                                            <input type="text " name="pemilik " id="pemilik" class="form-control " value="` + feature.administrasi.f10 + `">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="modal-footer ">
                                        <button type="button " id="btnsavebangunan" class="btn btn-info ">Save changes</button>
                                    </div>
                                </div>
                            </div>`;
Muhamad's avatar
Muhamad committed
8689
                            content_delete = `
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703
                            <div class="modal-dialog" style="width: max-content;height: max-content;">
                                <div class="modal-content">
                                    <div class="modal-header bg-info" style="background-color:#40777c;">
                                        <table>
                                            <tr>
                                                <th><h6 class="modal-title">Delete Bangunan dan Informasinya</h6></th>
                                                <td><button type="button" class="close" data-dismiss="modal">&times;</button></td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div class="form-group" style="margin-bottom:10px;">
                                        <div class="form-group">
                                            <div class="col-lg-12" style="margin-top:10px;margin-bottom:10px;">
                                                <input type="text" class="hidden" name="coordinatebangunan" id="coordinatebangunanhps" value="">
Muhamad's avatar
Muhamad committed
8704 8705 8706
                                                <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="infobangunan" id="infobangunanhps" class="form-control" value="` + feature.properties.f3 + `">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8707 8708 8709 8710 8711 8712 8713 8714 8715
                                            </div>
                                        </div>
                                    </div>

                                    <div class="modal-footer">
                                        <button type="button" id="btnsavedeletebangunan" class="btn btn-info">Hapus</button>
                                    </div>
                                </div>
                            </div>`;
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8716
                            content_inp_his_bang = `
8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738
                                            <div class="modal-dialog" style="height: max-content;">
                                                <div class="modal-content">
                                                    <div class="modal-header bg-info" style="background-color:#40777c;">
                                                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                                                        <h6 class="modal-title">Renovasi Bangunan</h6>
                                                    </div>
                                                    <div class="modal-body" style="max-height: 450px;overflow-y: auto;">
                                                        <div class="tab-pane has-padding" id="panel-tab2">
                                                            <div class="tab-pane" id="bottom-justified-data">

                                                                <div class="tabbable">
                                                                    <ul class="nav nav-tabs nav-tabs-bottom nav-justified">
                                                                        <li onclick="changetabs(this)" class="active"><a href="#left-tab1-feas-upl" data-toggle="tab">Koordinat</a></li>
                                                                        <li onclick="changetabs(this)"><a href="#right-tab2-feas-upl" data-toggle="tab">Informasi Umum</a></li>
                                                                    </ul>

                                                                    <div class="tab-content">
                                                                        <div class="tab-pane active" id="left-tab1-feas-upl">
                                                                            <input type="text" class="hidden" id="poly_create_input_bang">
                                                                            <input type="text" class="hidden" id="id_bang_perbaikan" value="` + feature.properties.f1 + `" disable>
                                                                            <input type="text" class="hidden" id="type_id_bang">
                                                                            <div id="map-insert-renov-bang" style="height: 375px;width: 100%">
8739
                                                                            </div>
8740 8741
                                                                        </div>
                                                                        <div class="tab-pane" id="right-tab2-feas-upl">
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8742

8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807
                                                                            <div class="row">
                                                                                <div class="col-md-6">
                                                                                    <div class="form-group">
                                                                                        <label>Nama :</label>
                                                                                        <input type="text" id="nama_bang" class="form-control" value="">
                                                                                    </div>
                                                                                    <div class="form-group">
                                                                                        <label>Jenis :</label>
                                                                                        <input type="text" id="type_bang" class="form-control" value="">
                                                                                    </div>
                                                                                    <div class="form-group">
                                                                                        <label>Kelurahan :</label>
                                                                                        <input type="text" id="kelurahan_bang" class="form-control" value="">
                                                                                    </div>
                                                                                    <div class="form-group">
                                                                                        <label>Kecamatan :</label>
                                                                                        <input type="text" id="kecamatan_bang" class="form-control" value="">
                                                                                    </div>
                                                                                    <div class="form-group">
                                                                                        <label>Tanggal Disetujui :</label>
                                                                                        <input type="date" id="tgldisetujui_bang" class="form-control" value="">
                                                                                    </div>
                                                                                    <div class="form-group">
                                                                                        <label>Tanggal Mulai Perbaikan :</label>
                                                                                        <input type="date" id="tglmulaiperbaikan_bang" class="form-control" value="">
                                                                                    </div>
                                                                                    <div class="form-group">
                                                                                        <label>Tanggal Selesai Perbaikan :</label>
                                                                                        <input type="date" id="tglselesaiperbaikan_bang" class="form-control" value="">
                                                                                    </div>
                                                
                                                                                </div>
                                                                                <div class="col-md-6">
                                                                                    <div class="form-group">
                                                                                        <label>Anggaran :</label>
                                                                                        <input type="text" id="anggaran_bang" class="form-control" value="">
                                                                                    </div>
                                                                                    <div class="form-group">
                                                                                        <label>Pihak yang Mengesahkan :</label>
                                                                                        <input type="text" id="pihakpengesahan_bang" class="form-control" value="">
                                                                                    </div>
                                                                                    <div class="form-group">
                                                                                        <label>Penanggung Jawab Lapangan :</label>
                                                                                        <input type="text" id="pjlapangan_bang" class="form-control" value="">
                                                                                    </div>
                                                                                    <div class="form-group">
                                                                                        <label>Jenis Perbaikan :</label>
                                                                                        <input type="text" id="jenisperbaikan_bang" class="form-control" value="">
                                                                                    </div>
                                                                                    <div class="form-group">
                                                                                        <label>Kontraktor/Vendor :</label>
                                                                                        <input type="text" id="kontraktor_bang" class="form-control" value="">
                                                                                    </div>
                                                                                    <div class="form-group">
                                                                                        <label>Proposal (.pdf):</label>
                                                                                        <input type="file" id="proposal_bang">
                                                                                    </div>
                                                                                    <div class="form-group">
                                                                                        <label>Bukti Selesai Perbaikan (.png/.jpg/.jpeg/):</label>
                                                                                        <input type="file" id="buktiselesai_bang">
                                                                                    </div>
                                                
                                                                                </div>
                                                                            </div>
                                                                        </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8808 8809 8810 8811 8812
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
8813 8814 8815 8816
                                                    <div class="modal-footer">
                                                        <input type="text" id="coorbangbaru" class="hidden"  value="">
                                                        <button type="button" class="btn btn-info" id="save-perbaikan_bang" style="float: right; margin-top: 5px; margin-right: 10px;">SAVE</button>
                                                    </div>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8817
                                                </div>
8818
                                            </div>`;
8819

8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861
                            content = `
                                    <table class="table tasks-list">
                                        <thead style="text-align: center;">
                                            <tr>
                                                <th style="padding: 0 0 0 0px;">
                                                    <img src=` + path_img + ` alt="Image" style="width: 100%;max-height: 368px;height:368"> 
                                                </th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <div class= "container">
                                                <tr style="height: 100px;">
                                                    <th>
                                                        <div>
                                                            <h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
                                                            letter-spacing: 0;
                                                            font-weight: 400;">
                                                                <span style="font-size: x-large;">
                                                                    ` + feature.properties.f2 + `
                                                                </span>
                                                            </h1>
                                                        </div>
                                                    </th>
                                                </tr>
                                            </div>
                                            <div class= "container">
                                                <tr style="height: 30px;">
                                                    <th>
                                                        <span>
                                                            ` + feature.administrasi.f12 + `
                                                        </span>
                                                    </th>
                                                </tr>
                                            </div>
                                            <div class= "container">
                                                <tr style="height: 40px;">
                                                    <th>
                                                        <p style="text-align:center;">
                                                            <img src="static/img/icon/samping_location.svg" alt="Image" style="height: 30px; width: 30px;">
                                                        </p>
                                                        <p>
                                                            <span>
8862
                                                                ` + feature.administrasi.f1 + `, ` + feature.administrasi.f2 + `, ` + feature.administrasi.f3 + `, ` + feature.administrasi.f4 + `
8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904
                                                            </span>
                                                        </p>
                                                    </th>
                                                </tr>
                                            </div>
                                            <div class= "container">
                                                <tr style="height: 40px;">
                                                    <th>
                                                        <p style="text-align:center;">
                                                            <img src="static/img/icon/samping_informasi.svg" alt="Image" style="height: 30px; width: 30px;">
                                                        </p>
                                                        <p>
                                                            <span>Luas Bangunan : ` + feature.administrasi.f6 + `</span>
                                                        </p>
                                                        <p>
                                                            <span>Luas Tanah : ` + feature.administrasi.f7 + `</span>
                                                        </p>
                                                        <p>
                                                            <span>Tinggi Bangunan : ` + feature.administrasi.f8 + `</span>
                                                        </p>
                                                        <p>
                                                            <span>Pemilik : ` + feature.administrasi.f10 + `</span>
                                                        </p>
                                                    </th>
                                                </tr>
                                            </div>
                                            <div class= "container">
                                                <tr style="height: 40px;">
                                                    <th>
                                                        <p class="text-center" style="margin-top: 5px;">
                                                            <a href="#" class="btn btn-primary" data-toggle="modal" data-target="#modal_bangunan_edit" id="btn_edit_bangunan" data-backdrop="static" data-keyboard="false" style="border-radius: 200px; margin-bottom: 5px;"><i class="fa fa-edit" style="color:#ffffff"> </i><i style="margin-left: 5px;">Edit Informasi Bangunan</i></a>
                                                            <a href="#" id='btn_delete_bangunan' class='btn 
                                                                btn-primary btn_edit_bangunan' data-toggle="modal" data-target="#modal_bangunan_delete" data-backdrop="static" data-keyboard="false" style="border-radius: 200px; margin-bottom: 5px;"><i class="fa fa-trash" style="color:#ffffff"> </i><i style="margin-left: 5px;">Delete Bangunan</i></a>
                                                        </p>
                                                    </th>
                                                </tr>
                                            </div>
                                            <div class="container">
                                                ` + history + `
                                            </div>
                                        </tbody>
                                    </table>`;
8905

Manggar Mahardhika's avatar
Manggar Mahardhika committed
8906
                            $(".gambar_keterangan").html(`<img src=` + path_img + ` alt="" style="width:100%;height:240px;border-top-left-radius: 10px;border-bottom-left-radius: 10px;">`)
8907 8908 8909 8910 8911 8912 8913 8914

                            $(".nama_keterangan").html(`<div>
                                                            <span style="font-size: large;">
                                                                ` + feature.properties.f2 + `
                                                            </span>
                                                        </div>
                                                        <div>
                                                            <span>
8915
                                                                ` + feature.administrasi.f1 + `, ` + feature.administrasi.f2 + `, ` + feature.administrasi.f3 + `, ` + feature.administrasi.f4 + `
8916 8917 8918 8919 8920 8921 8922
                                                            </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="">
Muhamad's avatar
Muhamad committed
8923
                                                    <div class="col-md-6">
8924 8925
                                                        <div>
                                                            <div>
8926
                                                                <span style="font-family: 'gilroylight';">Jenis Bangunan</span>
8927 8928
                                                            </div>
                                                            <div>
8929
                                                                <span style="font-family: 'gilroysemibold';">` + feature.administrasi.f12 + `</span>
8930 8931 8932
                                                            </div>
                                                        </div>
                                                        <div>
8933 8934
                                                            <div style="margin-top:5px;">
                                                                <span style="font-family: 'gilroylight';">Luas Bangunan</span>
8935 8936
                                                            </div>
                                                            <div>
8937
                                                                <span style="font-family: 'gilroysemibold';">` + feature.administrasi.f6 + ` m</span>
8938 8939 8940 8941
                                                            </div>
                                                        </div>
                                                        <div>
                                                            <div>
8942
                                                                <span style="font-family: 'gilroylight';">Luas Tanah</span>
8943 8944
                                                            </div>
                                                            <div>
8945
                                                                <span style="font-family: 'gilroysemibold';">` + feature.administrasi.f7 + ` m</span>
8946 8947
                                                            </div>
                                                        </div>
Muhamad's avatar
Muhamad committed
8948 8949
                                                    </div>
                                                    <div class="col-md-6">
8950 8951
                                                        <div>
                                                            <div>
8952
                                                                <span style="font-family: 'gilroylight';">Tinggi Bangunan</span>
8953 8954
                                                            </div>
                                                            <div>
8955
                                                                <span style="font-family: 'gilroysemibold';">` + feature.administrasi.f8 + ` m</span>
8956 8957 8958 8959
                                                            </div>
                                                        </div>

                                                        <div>
8960 8961
                                                            <div style="margin-top:5px;">
                                                                <span style="font-family: 'gilroylight';">Pemilik</span>
8962 8963
                                                            </div>
                                                            <div>
8964
                                                                <span style="font-family: 'gilroysemibold';">` + feature.administrasi.f10 + ` m</span>
8965
                                                            </div>
Muhamad's avatar
Muhamad committed
8966 8967
                                                        </div>
                                                    </div>
8968
                                                        ` + history + `
Muhamad's avatar
Muhamad committed
8969
                                                    `);
8970 8971

                            $(".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;">
8972 8973 8974 8975 8976 8977
                                            <a href="#" id="btn_edit_bangunan" data-toggle="modal" data-target="#modal_bangunan_edit" 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>
                                            <div class="tombol-delete-keterangan text-center" data-toggle="modal" data-target="#modal_bangunan_delete" style="background-color: indianred;position: absolute;width: 40px;height: 40px;bottom: 2px;right: 50px;border: 1pt solid rosybrown;border-radius: 10px;">
                                                <a href="#" id="btn_delete_bangunan" data-toggle="modal" data-target="#modal_bangunan_delete" 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>
                                            `)
Muhamad's avatar
Muhamad committed
8978 8979 8980
                            if (list_perm.indexOf('delete_bangunan') >= 0 === false) {
                                $(".tombol-delete-keterangan").remove();
                            }
Muhamad's avatar
Muhamad committed
8981

Muhamad's avatar
Muhamad committed
8982 8983 8984
                            if (list_perm.indexOf('change_bangunan') >= 0 === false) {
                                $(".tombol-edit-keterangan").remove();
                            }
Muhamad's avatar
Muhamad committed
8985

8986
                            $("#isi_panel").html(content);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8987 8988
                            $("#modal_bangunan_edit").html(content_edit);
                            $("#modal_bangunan_delete").html(content_delete);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8989
                            $("#input_perbaikan_bang").html(content_inp_his_bang);
8990
                            panel_samp();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8991
                        });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
8992 8993 8994 8995
                        // $("#tipe_point_b_e").val('feature.administrasi.f11').change();
                        // $('#tipe_point_b_e').val(feature.properties.f11).attr('selected','selected');
                        // $('#tipe_point_b_e option[value=bangunan]').attr('selected','selected');

Manggar Mahardhika's avatar
Manggar Mahardhika committed
8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065
                        // $('#idbangunan').val(feature.properties.f1);
                        // $('#namebangunan').val(feature.properties.f2);
                        // $('#infobangunan').val(feature.properties.f3);

                        // $('#nmkelurahan').val(feature.administrasi.f1);
                        // $('#nmkecamatan').val(feature.administrasi.f2);
                        // $('#nmkabkota').val(feature.administrasi.f3);
                        // $('#nmprovinsi').val(feature.administrasi.f4);

                        // $('#luasbangunan').val(feature.administrasi.f6);
                        // $('#luastanah').val(feature.administrasi.f7);
                        // $('#tinggibangunan').val(feature.administrasi.f8);
                        // $('#pemilik').val(feature.administrasi.f10);
                        // $('#gambar').val(feature.administrasi.f9);

                        // $("#coordinatebangunan").val(feature.geometry);
                        $("#panel-samping").css("display", "block");
                        $("#button_hide_panel").css("display", "block");

                        // $('#idbangunanhps').val(feature.properties.f1);
                        // $('#namebangunanhps').val(feature.properties.f2);
                        // $('#infobangunanhps').val(feature.properties.f3);

                        panel_samp()
                    }
                });

                pool.push({
                    name: feature.properties.f2,
                    id: L.stamp(layer),
                    lat: lattitud,
                    lng: longitud
                });
            }
            layer.on({
                mouseover: function(e) {
                    var layer = e.target;
                    layer.setStyle({
                        weight: 1,
                        Color: "#067800",
                        fillColor: "#067800",

                    });
                    if (!L.Browser.ie && !L.Browser.opera) {
                        layer.bringToFront();
                    }
                },
                mouseout: function(e) {
                    geo_bangunan.resetStyle(e.target);
                }
            });
        }
    });

    function geo_json_bangunan(data) {
        geo_bangunan.addData(data)
    }

    map.on("movestart", function() {
        geo_bangunan.clearLayers();
    });

    map.on("moveend", function() {
        var wetan = map.getBounds().getEast();
        var kulon = map.getBounds().getWest();
        var lor = map.getBounds().getNorth()
        var kidul = map.getBounds().getSouth();
        var center = map.getBounds().getCenter();
        var zoom = map.getZoom();

9066 9067
        var checkBox_building = document.getElementById("geo_building");

9068
        if (checkBox_building.checked == true) {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084

            if (zoom > 17) {
                if (map.hasLayer(geo_bangunan)) {
                    geo_bangunan.clearLayers()
                    geo_bangunan.remove()
                }
                $.ajax({
                    url: "{% url 'api:building' %}",
                    data: {
                        'wetan': wetan,
                        'kulon': kulon,
                        'lor': lor,
                        'kidul': kidul
                    },
                    dataType: 'json',
                    success: function(data) {
9085
                        console.log(data)
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9086 9087 9088 9089 9090
                        let list_poly = [];
                        for (var i = 0; i < data['gen'].length; i++) {
                            geoj = data['gen'][i][0];
                            list_poly.push(geoj);
                        };
9091
                        console.log(list_poly)
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104
                        geo_json_bangunan(list_poly);
                    }
                });
            }

            geo_bangunan.addTo(map)
        } else {
            geo_bangunan.clearLayers();
            geo_bangunan.remove()
        }
    });

    $(document).on("click", "#btn_edit_bangunan", function() {
Muhamad's avatar
Muhamad committed
9105
        $("#modal_detail_non_kelurahan").modal("hide")
Muhamad's avatar
Muhamad committed
9106

Manggar Mahardhika's avatar
Manggar Mahardhika committed
9107
        var tipe1 = $('#tipe111').val();
Muhamad's avatar
Muhamad committed
9108
        $('#tipe_point_b_e option[value=' + tipe1 + ']').attr('selected', 'selected');
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9109 9110

        $("#tipe_point_b_e").change(function() {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9111 9112
            $('#tipe_point_2_b_e').empty();
            $('#tipe_point_3_b_e').empty();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124
            var tipe = $(this).val();

            $.ajax({
                url: "{% url 'api:change-tipe' %}",
                data: {
                    'tipe': tipe
                },
                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];
Muhamad's avatar
Muhamad committed
9125

Manggar Mahardhika's avatar
Manggar Mahardhika committed
9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141
                        // if (feature.administrasi.f12 == data_k){
                        //     var data_kab = `<option value="` + data_k + `" selected>` + data_k + `</option>`;
                        // } else{
                        //     var data_kab = `<option value="` + data_k + `">` + data_k + `</option>`;
                        // }
                        var data_kab = `<option value="` + data_k + `">` + data_k + `</option>`;
                        data_all_kab.push(data_kab)
                    };
                    $('#tipe_point_2_b_e').html(`<option value="null" selected disabled>-- Pilih Tipe Point --</option>` + data_all_kab);
                }
            });
        });

        var tipe2 = $('#tipe222').val();
        if (tipe2 == 'null') {
            $('#tipe_point_2_b_e').html(`<option value="null" selected disabled>-- Pilih Tipe Point --</option>`);
Muhamad's avatar
Muhamad committed
9142 9143
        } else {
            $('#tipe_point_2_b_e').html(`<option value="` + tipe2 + `" selected>` + tipe2 + `</option>`);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9144 9145 9146
        }

        $("#tipe_point_2_b_e").change(function() {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9147
            $('#tipe_point_3_b_e').empty();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162
            var jenis = $(this).val();
            var tipx = $("#tipe_point_b_e").val();

            $.ajax({
                url: "{% url 'api:change-jenis' %}",
                data: {
                    'tipe': tipx,
                    'jenis': jenis
                },
                dataType: 'json',
                success: function(data) {
                    var data_all_kab = []
                    for (var i = 0; i < data['result'].length; i++) {
                        var data_id = data['result'][i][0];
                        var data_po = data['result'][i][1];
9163
                        var data_kab = `<option value="` + data_id + `">` + data_po + `</option>`;
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9164 9165
                        console.log(data_id)
                        console.log(data_po)
Muhamad's avatar
Muhamad committed
9166
                        var data_kab = `<option value="` + data_id + `">` + data_po + `</option>`;
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9167 9168 9169 9170 9171 9172 9173 9174 9175
                        data_all_kab.push(data_kab)
                    };
                    $('#tipe_point_3_b_e').html(`<option value="null" selected disabled>-- Pilih Point --</option>` + data_all_kab);
                }
            });
        });

        var tipe3 = $('#tipe333').val();
        var tipe4 = $('#tipe444').val();
Muhamad's avatar
Muhamad committed
9176

Manggar Mahardhika's avatar
Manggar Mahardhika committed
9177 9178
        if (tipe3 == 'null') {
            $('#tipe_point_3_b_e').html(`<option value="null" selected disabled>-- Pilih Point --</option>`);
Muhamad's avatar
Muhamad committed
9179 9180
        } else {
            $('#tipe_point_3_b_e').html(`<option value="` + tipe3 + `" selected>` + tipe4 + `</option>`);
9181
        }
Muhamad's avatar
Muhamad committed
9182

9183
        var map_edit = new L.map('map-edit', {
9184 9185 9186
            editable: true,
            zoomControl: false,
            drawControl: true
9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203
        }).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],
            [-4.1284664, 104.1674964],
            [-4.1284674, 104.1674593],
            [-4.1283969, 104.1674575]
        ]).addTo(map_edit)

        if (map_edit.hasLayer(polylyly)) {
            polylyly.remove()
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9204 9205
        }

9206 9207 9208
        var id_poly = $('#idbangunan').val();
        loaderPage(true);

Manggar Mahardhika's avatar
Manggar Mahardhika committed
9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221
        $.ajax({
            url: "{% url 'api:edit' %}",
            data: {
                'id_poly': id_poly
            },
            dataType: 'json',
            success: function(data) {

                setTimeout(function() {
                    map_edit.invalidateSize();
                }, 1000);
                loaderPage(false);

Manggar Mahardhika's avatar
Manggar Mahardhika committed
9222 9223 9224
                $("#modal_bangunan_edit").modal("show")
                $(".modal_detail_non_kelurahan").modal("hide")

Manggar Mahardhika's avatar
Manggar Mahardhika committed
9225 9226 9227 9228 9229 9230 9231 9232 9233 9234
                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++) {
                    geoj = lop_poly_edit[i][0];
                    polygigi = [lop_poly_edit[i][1], lop_poly_edit[i][0]]
                    list_poly_edit.push(polygigi);
                };

9235 9236 9237
                polylyly = L.polygon(list_poly_edit).addTo(map_edit)
                polylyly.enableEdit();
                var hasil = (JSON.stringify(polylyly.toGeoJSON()))
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9238
                $('#btnsavebangunan').click(function() {
9239
                    var hasil = (JSON.stringify(polylyly.toGeoJSON()))
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9240
                    $("#coordinatebangunan").val(hasil);
9241
                    // map_edit.remove()
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252
                })
            }
        })
    });

    $(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())
9253 9254 9255 9256

        var polyg = $("#coordinatebangunan").val();
        console.log(polyg)

Manggar Mahardhika's avatar
Manggar Mahardhika committed
9257 9258 9259 9260 9261 9262 9263 9264
        data.append('info_b', $('#infobangunan').val())
        data.append('desa_b', $('#nmkelurahan').val())
        data.append('kec_b', $('#nmkecamatan').val())
        data.append('kab_b', $('#nmkabkota').val())
        data.append('pro_b', $('#nmprovinsi').val())
        data.append('id_poly', $('#idbangunan').val())
        data.append('gambar', $('#gambar').val())

9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275
        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())
        var remark = $('#tipe_point_2_b_e').val();
        var poin_id = $('#tipe_point_3_b_e').val();
        var napo = $("#tipe_point_3_b_e option:selected").text();
        console.log(remark)
        console.log(poin_id)
        console.log(napo)
        data.append('napo', $('#tipe_point_3_b_e option:selected').text())

Manggar Mahardhika's avatar
Manggar Mahardhika committed
9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297
        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,
            dataType: 'json',
            type: 'POST',
            processData: false,
            contentType: false,
            success: function(data) {
                let response = data
                if (response.code == 0) {
                    swal({
                        title: response.info,
                        text: response.data,
                        type: "success",
                        icon: "success",
                        confirmButtonColor: "#00BCD4"
                    }, function() {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9298 9299
                        // $("#modal_bangunan_edit").css('display', 'none');
                        $("#modal_bangunan_edit").modal("hide")
Muhamad's avatar
Muhamad committed
9300
                            // $(".modal_detail_non_kelurahan").modal("hide")
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338
                    })
                } else {
                    swal({
                        title: response.info,
                        text: response.data,
                        type: "warning",
                        icon: "error",
                        confirmButtonColor: "#00BCD4"
                    })

                }
            }
        })

    });

    $(document).on("click", "#btn_delete_bangunan", function() {
        var map_delete = new L.map('map-delete', {
            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_delete);
        var id_polyhps = $('#idbangunanhps').val();
        // console.log(id_polyhps)
        loaderPage(true);

        $.ajax({
            url: "{% url 'api:edit' %}",
            data: {
                'id_poly': id_polyhps
            },
            dataType: 'json',
            success: function(data) {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9339 9340
                $("#modal_bangunan_delete").modal("show")
                $(".modal_detail_non_kelurahan").modal("hide")
Muhamad's avatar
Muhamad committed
9341
                loaderPage(false)
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367
            }
        })
    });

    $(document).on("click", "#btnsavedeletebangunan", function() {

        var data = new FormData();
        data.append('id_poly', $('#idbangunan').val())

        $.ajax({
            url: "{% url 'api:hapus' %}",
            data: data,
            dataType: 'json',
            type: 'POST',
            processData: false,
            contentType: false,
            success: function(data) {
                let response = data
                if (response.code == 0) {
                    swal({
                        title: response.info,
                        text: response.data,
                        type: "success",
                        icon: "success",
                        confirmButtonColor: "#00BCD4"
                    }, function() {
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9368
                        $("#modal_bangunan_delete").modal("hide")
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383
                    })
                } else {
                    swal({
                        title: 'Error',
                        text: 'Hubungi Mereka',
                        type: "warning",
                        icon: "error",
                        confirmButtonColor: "#00BCD4"
                    })
                }
            }
        })

    });

Manggar Mahardhika's avatar
Manggar Mahardhika committed
9384
    $(document).on("click", "#btn_perbaikan_bangunan", function() {
9385
        // $("#input_perbaikan_bang-s").css("display", "block");
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9386
        var map_bang = new L.map('map-insert-renov-bang', {
9387
            editable: false,
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9388
            zoomControl: false,
9389
            drawControl: false
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9390 9391 9392 9393 9394 9395 9396
        }).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);

9397 9398 9399 9400 9401 9402 9403
        // if (map_bang.hasLayer(polyxxx)) {
        //     polyxxx.remove()
        // }

        var id_polyx = $('#id_bang_perbaikan').val();

        loaderPage(true);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9404

Manggar Mahardhika's avatar
Manggar Mahardhika committed
9405 9406 9407 9408 9409 9410 9411
        $.ajax({
            url: "{% url 'apps:input-perbaikan-bang' %}",
            data: {
                'id_bangunan': id_polyx
            },
            dataType: 'json',
            success: function(data) {
9412 9413 9414 9415 9416 9417

                setTimeout(function() {
                    map_bang.invalidateSize();
                }, 1000);
                loaderPage(false);

Manggar Mahardhika's avatar
Manggar Mahardhika committed
9418 9419 9420 9421 9422 9423 9424 9425
                $("#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];
9426

Manggar Mahardhika's avatar
Manggar Mahardhika committed
9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437
                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++) {
                    geoj = lop_poly_edit[i][0];
                    polygigi = [lop_poly_edit[i][1], lop_poly_edit[i][0]]
                    list_poly_edit.push(polygigi);
                };
Muhamad's avatar
Muhamad committed
9438

Manggar Mahardhika's avatar
Manggar Mahardhika committed
9439
                polylyly = L.polygon(list_poly_edit).addTo(map_bang)
Muhamad's avatar
Muhamad committed
9440
                    // polylyly.enableEdit();
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9441
                var hasil = (JSON.stringify(polylyly.toGeoJSON()))
Muhamad's avatar
Muhamad committed
9442 9443
                    // console.log(polylyly)
                    // console.log(hasil)
9444 9445

                // $("#coorbangbaru").val(hasil);
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9446 9447
                $('#save-perbaikan_bang').click(function() {
                    $("#coorbangbaru").val(hasil);
9448 9449
                    console.log(hasil);
                    // console.log("tes");
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9450 9451 9452
                })
            }
        })
9453
    });
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9454

Manggar Mahardhika's avatar
Manggar Mahardhika committed
9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466
    $(document).on("click", "#save-perbaikan_bang", function(e) {
        var polyginbang = $('#coorbangbaru').val();
        var type_id = $("#type_id").val();
        var idbang = $('#id_bang_perbaikan').val();
        var namabang = $('#nama_bang').val();
        var type = $("#type_bang").val();
        var tgl_perbaikan = $("#tglmulaiperbaikan_bang").val();
        var tgl_selesai = $("#tglselesaiperbaikan_bang").val();
        var tgl_disetujui = $("#tgldisetujui_bang").val();
        var anggaran = $("#anggaran_bang").val();
        var proposal = $("#proposal_bang").val();
        var bukti_selesai = $("#buktiselesai_bang").val();
9467

Manggar Mahardhika's avatar
Manggar Mahardhika committed
9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514
        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
        }, {
            'object_idbang': idbang
        }, {
            'type_idbang': type_id
        }, {
            'namebang': namabang
        }, {
            'typebang': type
        }, {
            'tgl_selesaibang': tgl_selesai
        }, {
            'tgl_perbaikanbang': tgl_perbaikan
        }, {
            'tgl_disetujuibang': tgl_disetujui
        }, {
            'anggaranbang': anggaran
        }, {
            'pjbang': pj
        }, {
            'pj_lapanganbang': pj_lapangan
        }, {
            'jenis_perbaikanbang': jenis_perbaikan
        }, {
            'kontraktorbang': kontraktor
        }, {
            'kelurahanbang': kelurahan
        }, {
            '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]);
        for (var i = 0; i < data_umum.length; i++) {
            var keyss = Object.keys(data_umum[i]);
            data.append(keyss[0], data_umum[i][keyss[0]])
        }

9515 9516 9517
        // console.log(data)
        // console.log(data_umum)

Manggar Mahardhika's avatar
Manggar Mahardhika committed
9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551
        $.ajax({
            url: "{% url 'apps:save-perbaikan-bang' %}",
            data: data,
            dataType: 'json',
            type: 'POST',
            processData: false,
            contentType: false,
            success: function(data) {
                let response = data;

                if (response.code == 0) {
                    swal({
                        title: response.info,
                        text: response.data,
                        type: "success",
                        icon: "success",
                        confirmButtonColor: "#00BCD4"
                    }, function() {
                        $("#input_perbaikan_bang").css("display", "none");
                    })
                } else {
                    swal({
                        title: response.info,
                        text: response.data,
                        type: "warning",
                        icon: "error",
                        confirmButtonColor: "#00BCD4"
                    })

                }
            }
        })
    });

9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573
    function getdetailperbang(id) {
        $.ajax({
            url: "{% url 'apps:get-detail-perbaikan-bang' %}",
            data: {
                'id': id
            },
            dataType: 'json',
            success: function(data) {

                isi_modal_detail = []
                for (var i = 0; i < data.length; i++) {
                    isi_modal_detail.push(`
                    <tr>
                        <td>` + i + `</td>
                        <td>` + data[i].name + `</td>
                        <td>` + data[i].type + `</td>
                        <td>` + data[i].tgl_perbaikan + `</td>
                        <td>` + data[i].anggaran + `</td>
                        <td>` + data[i].pj + `</td>
                        <td>` + data[i].pj_lapangan + `</td>
                        <td>` + data[i].kontraktor + `</td>
                        <td>` + data[i].jenis_perbaikan + `</td>
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9574 9575
                        <td><a href="static/media/proposal/` + data[i].proposal + `" id="downloadproposal" target="_blank">View</a></td>
                        <td><a href="static/media/bukti_penyelesaian/` + data[i].bukti_selesai + `" onclick="viewBukti()" id="view-bukti" target="_blank">View</a></td>
9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603
                    </tr>`)
                }

                $("#isi_modal_detail").html(`                
                <table class="table table-responsive datatable-show-all table-sm" id="isi_detail" style="word-wrap:break-word;">
                    <thead>
                        <tr>
                            <th>No.</th>
                            <th>Nama</th>
                            <th>Type</th>
                            <th>Tanggal Perbaikan</th>
                            <th>Anggaran</th>
                            <th>Penanggung Jawab</th>
                            <th>Penanggung Jawab Lapangan</th>
                            <th>Kontraktor</th>
                            <th>Jenis Perbaikan</th>
                            <th>Proposal</th>
                            <th>Bukti Penyelesaian</th>
                        </tr>
                    </thead>
                    <tbody>
                        ` + isi_modal_detail + `
                    </tbody>
                </table>`)

            }
        });
    };
Manggar Mahardhika's avatar
Manggar Mahardhika committed
9604 9605
</script>
{% endif %}{% endfor %}