maps-theme/content/index.blade.php

74 lines
2.4 KiB
PHP
Raw Normal View History

2023-05-15 19:30:18 +00:00
@extends('template.'.config('settings.template').'.content.master')
2023-05-15 19:57:14 +00:00
@section('head')
<title>Home | {{config('settings.name')}}</title>
<style>
#map {
2023-05-16 11:42:14 +00:00
height: 80vh;
2023-05-15 19:57:14 +00:00
width: 100%;
}
</style>
@stop
2023-05-15 19:30:18 +00:00
@section('content')
2023-05-16 11:42:14 +00:00
<div class="container">
<div class="row">
<div class="col">
<h1>{{config('settings.name')}}</h1>
<p>{{config('settings.description')}}</p>
</div>
</div>
<div class="row">
<div class="col-4">
@foreach($contents as $content)
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-5">
<img src="{{$content->image}}" alt="">
</div>
<div class="col-7">
<h3 class="h5">{{$content->title}}</h3>
<a href="{{$content->path}}"> Ansehen </a>
</div>
</div>
</div>
</div>
@endforeach
</div>
<div class="col-8 g-0">
<div id="map"></div>
</div>
</div>
</div>
2023-05-15 19:30:18 +00:00
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAKGJCCKvmWZl-L5bBF0uS5BWf0gN4ZkpI&callback=initMap&v=weekly" defer></script>
<script>
2023-05-15 18:45:13 +00:00
function initMap() {
let items = {!! json_encode($contents) !!};
items = items.data;
2023-05-15 19:30:18 +00:00
2023-05-15 18:45:13 +00:00
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>
2023-05-15 19:30:18 +00:00
@stop