maps-theme/content/index.blade.php

44 lines
1.5 KiB
PHP
Raw Normal View History

2023-05-15 18:45:13 +00:00
<html>
<head>
2023-05-15 19:19:21 +00:00
<title>{{config('settings.name')}}</title>
<link rel="apple-touch-icon" sizes="180x180" href="{{$favicon['180']}}">
<link rel="icon" type="image/png" sizes="32x32" href="{{$favicon['32']}}">
<link rel="icon" type="image/png" sizes="16x16" href="{{$favicon['16']}}">
2023-05-15 18:45:13 +00:00
<style>
#map {
height: 400px;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAKGJCCKvmWZl-L5bBF0uS5BWf0gN4ZkpI&callback=initMap&v=weekly" defer></script>
<script>
function initMap() {
let items = {!! json_encode($contents) !!};
items = items.data;
const map = new google.maps.Map(document.getElementById("map"), {
zoom: 5,
center: { lat: parseFloat(items[0].location.lat), lng: parseFloat(items[0].location.lng) }
});
items.forEach(function(item){
let marker = new google.maps.Marker({
position: { lat: parseFloat(item.location.lat), lng: parseFloat(item.location.lng) },
map: map,
title: item.title,
optimized: false,
});
marker.addListener('click', function() {
window.location.href = item.path;
});
});
}
window.initMap = initMap;
</script>
</body>
</html>