37138-vm/templates/footer.php
Flatlogic Bot bb0884a9fc SIAKAD 1.0
2025-12-24 04:07:02 +00:00

60 lines
2.1 KiB
PHP

</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<!-- LeafletJS for Maps -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
<script src="assets/js/main.js"></script>
<script>
// Initialize map only if the map container exists
document.addEventListener('DOMContentLoaded', function() {
if (document.getElementById('map')) {
const latInput = document.getElementById('latitude');
const lonInput = document.getElementById('longitude');
// Default coordinates (e.g., center of Indonesia)
let lat = -2.5489;
let lon = 118.0149;
let zoom = 5;
// If existing coordinates are provided, use them
if (latInput.value && lonInput.value) {
lat = parseFloat(latInput.value);
lon = parseFloat(lonInput.value);
zoom = 15; // Zoom in if location is known
}
const map = L.map('map').setView([lat, lon], zoom);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
let marker = L.marker([lat, lon]).addTo(map);
// Update inputs on map click
map.on('click', function(e) {
const newLat = e.latlng.lat;
const newLon = e.latlng.lng;
latInput.value = newLat.toFixed(6);
lonInput.value = newLon.toFixed(6);
// Move marker to the new location
if (marker) {
marker.setLatLng(e.latlng);
} else {
marker = L.marker(e.latlng).addTo(map);
}
});
}
});
</script>
</body>
</html>