map for events

This commit is contained in:
Benjamin Takats
2022-12-15 19:47:21 +01:00
parent ca5b74d072
commit b9cb4f8999
5 changed files with 28 additions and 22 deletions

View File

@@ -25,26 +25,29 @@ class BitcoinEventTable extends Component
{
return view('livewire.bitcoin-event.bitcoin-event-table', [
'markers' => BitcoinEvent::query()
->with([
'venue.city.country',
])
->whereHas('venue.city.country',
fn($query) => $query->where('countries.code', $this->country->code))
->get()
->map(fn($event) => [
'id' => $event->id,
'name' => $event->name,
'coords' => [$event->venue->city->latitude, $event->venue->city->longitude],
]),
'events' => BitcoinEvent::query()
->get()
->map(fn($event) => [
'id' => $event->id,
'startDate' => $event->from,
'endDate' => $event->to,
'location' => $event->title,
'description' => $event->description,
]),
->with([
'venue.city.country',
])
->where(fn($query) => $query
->whereHas('venue.city.country',
fn($query) => $query->where('code', $this->country->code))
->orWhere('show_worldwide', true)
)
->get()
->map(fn($event) => [
'id' => $event->id,
'name' => $event->name,
'coords' => [$event->venue->city->latitude, $event->venue->city->longitude],
]),
'events' => BitcoinEvent::query()
->get()
->map(fn($event) => [
'id' => $event->id,
'startDate' => $event->from,
'endDate' => $event->to,
'location' => $event->title,
'description' => $event->description,
]),
]);
}

File diff suppressed because one or more lines are too long

View File

@@ -15,6 +15,7 @@
media="screen"/>
<script src="https://unpkg.com/jquery"></script>
<script src="{{ asset('vendor/jvector/jquery-jvectormap-2.0.5.min.js') }}"></script>
<script src="{{ asset('vendor/jvector/maps/europe-merc.js') }}"></script>
<script src="{{ asset('vendor/jvector/maps/de.js') }}"></script>
<script src="{{ asset('vendor/jvector/maps/at.js') }}"></script>
<script src="{{ asset('vendor/jvector/maps/ch.js') }}"></script>

View File

@@ -15,6 +15,7 @@
media="screen"/>
<script src="https://unpkg.com/jquery"></script>
<script src="{{ asset('vendor/jvector/jquery-jvectormap-2.0.5.min.js') }}"></script>
<script src="{{ asset('vendor/jvector/maps/europe-merc.js') }}"></script>
<script src="{{ asset('vendor/jvector/maps/de.js') }}"></script>
<script src="{{ asset('vendor/jvector/maps/at.js') }}"></script>
<script src="{{ asset('vendor/jvector/maps/ch.js') }}"></script>

View File

@@ -86,7 +86,7 @@
$('#map').vectorMap({
zoomButtons : false,
zoomOnScroll: true,
map: '{{ $country->code }}_merc',
map: 'europe_merc',
backgroundColor: 'transparent',
markers: markers.map(function(h){ return {name: h.name, latLng: h.coords} }),
onMarkerClick: function(event, index) {
@@ -110,7 +110,7 @@
}
}"
>
<div id="map" style="width: 100%; height: 400px"></div>
<div id="map" style="width: 100%; height: 800px"></div>
</div>
</div>
</div>