Compare commits

...

4 Commits

Author SHA1 Message Date
arifal
080582f7ab add new menu peta in dashboard 2025-02-21 11:12:35 +07:00
arifal
91475aeead Merge branch 'dev' into feat/load-map-from-kmz 2025-02-21 10:43:06 +07:00
arifal
5d50d6d6cc fix height card 2025-02-19 15:34:28 +07:00
arifal
39717d184c partial update create google map from kmz file 2025-02-19 14:31:12 +07:00
4 changed files with 68 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class GoogleApisController extends Controller
{
public function index(){
return view('maps.google-api');
}
}

View File

@@ -116,6 +116,13 @@ class UsersRoleMenuSeeder extends Seeder
"parent_id" => $dashboard->id,
"sort_order" => 3,
],
[
"name" => "PETA",
"url" => "dashboard.maps",
"icon" => null,
"parent_id" => $dashboard->id,
"sort_order" => 4,
],
[
"name" => "Users",
"url" => "users.index",
@@ -229,6 +236,7 @@ class UsersRoleMenuSeeder extends Seeder
$lack_of_potentials = Menu::where('name', 'Dashboard Potensi')->first();
$spatial_plannings = Menu::where('name', 'Tata Ruang')->first();
$pdam = Menu::where('name', 'PDAM')->first();
$peta = Menu::where('name', 'PETA')->first();
// Superadmin gets all menus
$superadmin->menus()->sync([
@@ -256,6 +264,7 @@ class UsersRoleMenuSeeder extends Seeder
$lack_of_potentials->id => ["allow_show" => true, "allow_create" => true, "allow_update" => true, "allow_destroy" => true],
$spatial_plannings->id => ["allow_show" => true, "allow_create" => true, "allow_update" => true, "allow_destroy" => true],
$pdam->id => ["allow_show" => true, "allow_create" => true, "allow_update" => true, "allow_destroy" => true],
$peta->id => ["allow_show" => true, "allow_create" => true, "allow_update" => true, "allow_destroy" => true],
]);
// Admin gets limited menus

View File

@@ -0,0 +1,45 @@
@extends('layouts.vertical', ['subtitle' => 'Google Maps'])
@section('css')
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
@endsection
@section('content')
@include('layouts.partials/page-title', ['title' => 'Maps', 'subtitle' => 'Google Maps'])
<div id="map" style="width: 100%; height: 90vh;"></div>
@endsection
@section('scripts')
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="https://unpkg.com/togeojson@0.16.0"></script>
<script src="https://unpkg.com/leaflet-omnivore@0.3.4/leaflet-omnivore.min.js"></script>
<script src="https://unpkg.com/leaflet-kml/L.KML.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
var map = L.map('map').setView([-6.9175, 107.6191], 10); // Jakarta
// Tambahkan peta dasar dari OpenStreetMap
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; OpenStreetMap contributors'
}).addTo(map);
// Muat file KMZ
omnivore.kml("{{ asset('storage/maps/rencanapolaruang_rtrw_2024_2044__rencana_pola_ruang.kml') }}")
.on('ready', function () {
try {
var bounds = this.getBounds();
if (bounds.isValid()) {
map.fitBounds(bounds);
} else {
console.warn("Bounds tidak valid, gunakan fallback.");
map.setView([-6.9175, 107.6191], 10); // Default ke Jakarta
}
} catch (error) {
console.error("Error setting bounds:", error);
map.setView([-6.1751, 106.8650], 10);
}
})
.addTo(map);
});
</script>
@endsection

View File

@@ -5,6 +5,7 @@ use App\Http\Controllers\CustomersController;
use App\Http\Controllers\Dashboards\LackOfPotentialController;
use App\Http\Controllers\DataSettingController;
use App\Http\Controllers\Dashboards\BigDataController;
use App\Http\Controllers\GoogleApisController;
use App\Http\Controllers\Home\HomeController;
use App\Http\Controllers\Master\UsersController;
use App\Http\Controllers\MenusController;
@@ -32,6 +33,7 @@ Route::group(['middleware' => 'auth'], function(){
Route::get('/bigdata', [BigDataController::class, 'index'])->name('dashboard.home');
Route::get('/dashboard-pbg', [BigDataController::class, 'pbg'])->name('dashboard.pbg');
Route::get('/lack-of-potential', [LackOfPotentialController::class, 'lack_of_potential'])->name('dashboard.lack_of_potential');
Route::get('/maps', [GoogleApisController::class, 'index'])->name('dashboard.maps');
});
// settings