Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

menu geo spasial #496

Merged
merged 3 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Helpers/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ function generateMenuPresisi($tree, $parentId = null)
$result .= "<a class='item-menu dropdown-item' href='{$item->href}'>{$icon}{$item->text}</a>";
} else {
$href = $item->href;
if ($href != '/presisi' and $href != '/presisi/kesehatan') {
if ($href != '/presisi' and $href != '/presisi/kesehatan' and $href != '/presisi/geo-spasial') {
$href = str_contains($item->href, 'module') ? $item->href : '/'.$item->href;
}
$result .= "<a type='button' class='item-menu btn bg-white p-2 text-muted' href='{$href}'>{$icon}{$item->text}</a>";
Expand Down
21 changes: 21 additions & 0 deletions app/Http/Controllers/Web/PresisiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,4 +518,25 @@ public function bantuan($id = '')

return view('presisi.bantuan.index', compact('id', 'categoriesItems', 'statistik'));
}

/**
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function geoSpasial()
{
$totalDesa = 0;
$pendudukSummary = 0;
$configSummary = 0;
$keluargaSummary = 0;
$categoriesItems = [
['key' => 'kecamatan', 'text' => 'kecamatan', 'value' => $configSummary, 'icon' => 'web/img/kecamatan.jpg'],
['key' => 'desa', 'text' => 'desa/kelurahan', 'value' => $totalDesa, 'icon' => 'web/img/kelurahan.jpg'],
['key' => 'penduduk', 'text' => 'jumlah penduduk', 'value' => $pendudukSummary, 'icon' => 'web/img/penduduk.jpg'],
['key' => 'keluarga', 'text' => 'jumlah keluarga', 'value' => $keluargaSummary, 'icon' => 'web/img/bantuan.jpg'],
];
$listKecamatan = ['' => 'Pilih Kecamatan'];
$listDesa = ['' => 'Pilih Desa'];

return view('presisi.geo_spasial.index', compact('categoriesItems', 'listKecamatan', 'listDesa'));
}
}
1 change: 1 addition & 0 deletions catatan_rilis.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Di rilis ini, versi 2501.0.0 berisi penambahan filter wilayah pada estunting dan
5. [#477](https://github.com/OpenSID/OpenKab/issues/477) Penambahan pengaturan menu yang tampil bisa vertikal & horizontal.
6. [#475](https://github.com/OpenSID/OpenKab/issues/475) Penambahan fungsi multiple hapus pada halaman suplemen terdata.
7. [#489](https://github.com/OpenSID/OpenKab/issues/489) Penambahan fungsi pengaturan menu pada halaman admin.
8. [#491](https://github.com/OpenSID/OpenKab/issues/491) Penambahan halaman geo spasial.

#### Perbaikan BUG

Expand Down
27 changes: 27 additions & 0 deletions database/migrations/2025_01_09_015004_update-menu-geospasial.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Insert data baru tanpa tag <i> di kolom name
DB::table('menus')->where('name', 'Geo Spasial')->update(['url' => '/presisi/geo-spasial']);
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
};
189 changes: 189 additions & 0 deletions resources/views/presisi/geo_spasial/index.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
@extends('layouts.presisi.index')

@section('content_header')
@stop
@section('content')
@include('presisi.partials.head')

<div class="row m-1">
<div class="col-md-12">

<div class="card rounded-0 border-0 shadow-none">
@include('presisi.summary')
<div class="card-body">
@include('presisi.wilayah.filter')

@include('presisi.wilayah.peta')

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

@include('presisi.wilayah.data-wilayah')

@include('presisi.wilayah.data-desa')



</div>

@endsection

@push('styles')
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin=""/>
@endpush
@push('js')
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
<script nonce="{{ csp_nonce() }}" type="text/javascript">
document.addEventListener("DOMContentLoaded", function (event) {
"use strict";
const position = [{{ env('LATTITUDE_MAP', -8.459556) }}, {{ env('LONGITUDE_MAP', 115.046600) }}]
const map = L.map('map').setView( position, 13);
const tiles = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map)

@include('layouts.presisi.peta.filter')
@include('layouts.presisi.peta.index')
@include('layouts.presisi.peta.style')
@include('layouts.presisi.wilayah.data')


@include('layouts.presisi.peta.index')
@include('layouts.presisi.peta.style')


$.get('{{ url('api/v1/data-website') }}', {}, function(result){
let category = result.data.categoriesItems
let listDesa = result.data.listDesa
let listKecamatan = result.data.listKecamatan

for(let index in category) {
$(`.kategori-item .jumlah-${index}-elm`).text(category[index]['value'])
};
let _optionKecamatan = []
let _optionDesa = []
for(let item in listKecamatan){
_optionKecamatan.push(`<option>${item}</option>`)
}

for(let item in listDesa){
_optionDesa.push(`<optgroup label='${item}'>`)
for(let desa in listDesa[item]){
_optionDesa.push(`<option value='${desa}'>${listDesa[item][desa]}</option>`)
}
_optionDesa.push(`</optgroup>`)
_optionKecamatan.push(`<option>${item}</option>`)
}

$('select[name=search_kecamatan]').append(_optionKecamatan.join(''))
$('select[name=search_desa]').append(_optionDesa.join(''))
}, 'json')
const indexSearch = {'search' : {'luas_wilayah' : 1, 'luas_pertanian' : 1, 'luas_perkebunan' : 1, 'luas_hutan' : 1, 'luas_peternakan' : 1}}
$.get('{{ url('api/v1/data-summary') }}', indexSearch, function(result){
for(let i in result.data){
$(`#summary-${i}`).text(result.data[i])
}
}, 'json')


var summaryPenduduk = $('#summary-penduduk').DataTable({
processing: true,
serverSide: true,
autoWidth: false,
ordering: false,
searchPanes: {
viewTotal: false,
columns: [0]
},
ajax: {
url: `{{ url('api/v1/wilayah/penduduk') }}`,
method: 'get',
data: function(row) {
return {
"page[size]": row.length,
"page[number]": (row.start / row.length) + 1,
"filter[search]": row.search.value,
};
},
dataSrc: function(json) {
json.recordsTotal = json.meta.pagination.total
json.recordsFiltered = json.meta.pagination.total

return json.data
},
},
columnDefs: [{
targets: '_all',
className: 'text-nowrap',
},
{
targets: 0,
render: function(data, type, row, meta) {
var PageInfo = $('#summary-penduduk').DataTable().page.info();
return PageInfo.start + meta.row + 1;
}
},
{
targets: [0, 1, 2, 3],
orderable: false,
searchable: false,
},
],
columns: [{
data: null,
},
{
data: "attributes.nama_desa",
name: "nama_desa"
},
{
data: "attributes.nama_kecamatan",
name: "nama_kecamatan"
},
{
data: "attributes.penduduk_count",
name: "penduduk_count",
className: 'text-center'
},
],
})

$(function() {
var start = moment();
var end = moment();

function cb(start, end) {
$('#reportrange span').html(start.format('D MMMM, YYYY') + ' - ' + end.format('D MMMM, YYYY'));
}

$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
ranges: {
'Hari Ini': [moment(), moment()],
'Kemarin': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'7 Hari Terakhir': [moment().subtract(6, 'days'), moment()],
'30 Hari Terakhir': [moment().subtract(29, 'days'), moment()],
'Bulan Ini': [moment().startOf('month'), moment().endOf('month')],
'Bulan Lalu': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
},
locale: {
format: 'D MMMM, YYYY',
applyLabel: 'Terapkan',
cancelLabel: 'Batal',
customRangeLabel: 'Rentang Kustom',
daysOfWeek: ['Min', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
monthNames: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'],
firstDay: 1
}
}, cb);

cb(start, end);
});
});


</script>
@endpush
1 change: 1 addition & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,5 @@
Route::get('/kesehatan/{kuartal}/{tahun}/{id}/{kabupaten?}/{kecamatan?}/{desa?}', [PresisiController::class, 'kesehatan']);
Route::get('/bantuan', [PresisiController::class, 'bantuan'])->name('presisi.bantuan');
Route::get('/statistik-bantuan', [PresisiController::class, 'bantuan'])->name('presisi.bantuan');
Route::get('/geo-spasial', [PresisiController::class, 'geoSpasial'])->name('presisi.geo-spasial');
});