|
|
|
@ -0,0 +1,61 @@ |
|
|
|
@extends('layouts.app') |
|
|
|
|
|
|
|
@section('content') |
|
|
|
<div class="container"> |
|
|
|
<div class="card"> |
|
|
|
<div class="card-header">{{ __('outlet.list') }}</div> |
|
|
|
|
|
|
|
<div class="card-body" id="mapid"></div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
@endsection |
|
|
|
|
|
|
|
@section('styles') |
|
|
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" |
|
|
|
integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ==" |
|
|
|
crossorigin=""/> |
|
|
|
|
|
|
|
<style> |
|
|
|
#mapid { min-height: 500px; }
|
|
|
|
</style> |
|
|
|
@endsection |
|
|
|
@push('scripts') |
|
|
|
<!-- Make sure you put this AFTER Leaflet's CSS --> |
|
|
|
<script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js" |
|
|
|
integrity="sha512-/Nsx9X4HebavoBvEBuyp3I7od5tA0UzAxs+j83KgC8PU0kgB4XiK4Lfe4y4cgBtaRJQEIFCW+oC506aPT2L1zw==" |
|
|
|
crossorigin=""></script> |
|
|
|
|
|
|
|
<script> |
|
|
|
var map = L.map('mapid').setView(['-3.333333', '114.583333'], 12); |
|
|
|
var baseUrl = "{{ url('/') }}"; |
|
|
|
|
|
|
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
|
|
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' |
|
|
|
}).addTo(map); |
|
|
|
|
|
|
|
axios.get('{{ route('api.outlets.geojson') }}') |
|
|
|
.then(function (response) { |
|
|
|
console.log(response.data); |
|
|
|
L.geoJSON(response.data, { |
|
|
|
pointToLayer: function(geoJsonPoint, latlng) { |
|
|
|
var myIcon = L.icon({ |
|
|
|
iconUrl: baseUrl + '/images/marker-icon-green.png', |
|
|
|
shadowUrl: baseUrl + '/images/marker-shadow.png', |
|
|
|
iconSize: [25, 41], |
|
|
|
iconAnchor: [12, 41], |
|
|
|
popupAnchor: [1, -34], |
|
|
|
shadowSize: [41, 41], |
|
|
|
className: 'marker-icon-green', |
|
|
|
}); |
|
|
|
return L.marker(latlng, { icon: myIcon }); |
|
|
|
} |
|
|
|
}) |
|
|
|
.bindPopup(function (layer) { |
|
|
|
return layer.feature.properties.map_popup_content; |
|
|
|
}).addTo(map); |
|
|
|
}) |
|
|
|
.catch(function (error) { |
|
|
|
console.log(error); |
|
|
|
}); |
|
|
|
</script> |
|
|
|
@endpush |