mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
clickable markers
This commit is contained in:
@@ -10,6 +10,18 @@ class MeetupTable extends Component
|
|||||||
{
|
{
|
||||||
public Country $country;
|
public Country $country;
|
||||||
|
|
||||||
|
public function filterByMarker($id)
|
||||||
|
{
|
||||||
|
return to_route('meetup.table.meetup', [
|
||||||
|
'country' => $this->country->code,
|
||||||
|
'table' => [
|
||||||
|
'filters' => [
|
||||||
|
'byid' => $id,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
// let markers = [{name: 'VAK', coords: [50.0091294, 9.0371812], status: 'closed', offsets: [0, 2]}];
|
// let markers = [{name: 'VAK', coords: [50.0091294, 9.0371812], status: 'closed', offsets: [0, 2]}];
|
||||||
@@ -23,6 +35,7 @@ class MeetupTable extends Component
|
|||||||
fn($query) => $query->where('countries.code', $this->country->code))
|
fn($query) => $query->where('countries.code', $this->country->code))
|
||||||
->get()
|
->get()
|
||||||
->map(fn($meetup) => [
|
->map(fn($meetup) => [
|
||||||
|
'id' => $meetup->id,
|
||||||
'name' => $meetup->name,
|
'name' => $meetup->name,
|
||||||
'coords' => [$meetup->city->latitude, $meetup->city->longitude],
|
'coords' => [$meetup->city->latitude, $meetup->city->longitude],
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use App\Models\Meetup;
|
|||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Rappasoft\LaravelLivewireTables\DataTableComponent;
|
use Rappasoft\LaravelLivewireTables\DataTableComponent;
|
||||||
use Rappasoft\LaravelLivewireTables\Views\Column;
|
use Rappasoft\LaravelLivewireTables\Views\Column;
|
||||||
|
use Rappasoft\LaravelLivewireTables\Views\Filters\TextFilter;
|
||||||
|
|
||||||
class MeetupTable extends DataTableComponent
|
class MeetupTable extends DataTableComponent
|
||||||
{
|
{
|
||||||
@@ -32,6 +33,17 @@ class MeetupTable extends DataTableComponent
|
|||||||
->setPerPage(10);
|
->setPerPage(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function filters(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
TextFilter::make('Meetup by ID', 'byid')
|
||||||
|
->hiddenFromMenus()
|
||||||
|
->filter(function (Builder $builder, string $value) {
|
||||||
|
$builder->whereIn('meetups.id', str($value)->explode(','));
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function columns(): array
|
public function columns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -25,6 +25,9 @@
|
|||||||
map: '{{ $country->code }}_merc',
|
map: '{{ $country->code }}_merc',
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
markers: markers.map(function(h){ return {name: h.name, latLng: h.coords} }),
|
markers: markers.map(function(h){ return {name: h.name, latLng: h.coords} }),
|
||||||
|
onMarkerClick: function(event, index) {
|
||||||
|
$wire.call('filterByMarker', markers[index].id)
|
||||||
|
},
|
||||||
markerStyle: {
|
markerStyle: {
|
||||||
initial: {
|
initial: {
|
||||||
image: '{{ asset('img/btc.png') }}',
|
image: '{{ asset('img/btc.png') }}',
|
||||||
|
|||||||
Reference in New Issue
Block a user