maps-theme/content/contents/default.blade.php

36 lines
1.2 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>{{$content->title}} | {{config('settings.name')}}</title>
<style>
#map {
height: 400px;
width: 100%;
}
</style>
@stop
2023-05-15 19:30:18 +00:00
@section('content')
2023-05-15 19:57:14 +00:00
<a href="{{url('/')}}"> Back</a>
2023-05-15 19:30:18 +00:00
<h1>{{$content->title}}</h1>
2023-05-15 19:57:14 +00:00
<p>{{$content->description}}</p>
2023-05-15 19:30:18 +00:00
<img src="{{$content->image}}" alt="">
2023-05-15 19:57:14 +00:00
<div id="map"></div>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAKGJCCKvmWZl-L5bBF0uS5BWf0gN4ZkpI&callback=initMap&v=weekly" defer></script>
<script>
2023-05-15 19:30:18 +00:00
function initMap() {
2023-05-15 19:57:14 +00:00
let item = {!! json_encode($content) !!};
2023-05-15 19:30:18 +00:00
const map = new google.maps.Map(document.getElementById("map"), {
zoom: 5,
2023-05-15 19:57:14 +00:00
center: { lat: parseFloat(item.location.lat), lng: parseFloat(item.location.lng) }
2023-05-15 19:30:18 +00:00
});
2023-05-15 19:57:14 +00:00
let marker = new google.maps.Marker({
position: { lat: parseFloat(item.location.lat), lng: parseFloat(item.location.lng) },
map: map,
title: item.title,
optimized: false,
2023-05-15 19:30:18 +00:00
});
}
window.initMap = initMap;
</script>
2023-05-15 19:57:14 +00:00
@stop