From 352420db6d31b55fb4887463e133e27080e64436 Mon Sep 17 00:00:00 2001 From: Benjamin Takats Date: Thu, 15 Dec 2022 19:08:07 +0100 Subject: [PATCH] clickDay --- app/Http/Livewire/Meetup/MeetupEventTable.php | 25 +++++++++++++------ .../meetup/meetup-event-table.blade.php | 15 ++++++----- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/app/Http/Livewire/Meetup/MeetupEventTable.php b/app/Http/Livewire/Meetup/MeetupEventTable.php index 0c5ca7b6..e55f9597 100644 --- a/app/Http/Livewire/Meetup/MeetupEventTable.php +++ b/app/Http/Livewire/Meetup/MeetupEventTable.php @@ -16,17 +16,26 @@ class MeetupEventTable extends Component public function render() { return view('livewire.meetup.meetup-event-table', [ - 'events' => MeetupEvent::query()->get()->map(fn($event) => [ - 'startDate' => $event->start, - 'endDate' => $event->start->endOfDay(), - 'location' => $event->location, - 'description' => $event->description, - ]), + 'events' => MeetupEvent::query() + ->get() + ->map(fn($event) => [ + 'id' => $event->id, + 'startDate' => $event->start, + 'endDate' => $event->start->endOfDay(), + 'location' => $event->location, + 'description' => $event->description, + ]), ]); } - public function popover($content) + public function popover($content, $ids) { - $this->notification()->success($content); + return to_route('meetup.table.meetupEvent', [ + 'country' => $this->country->code, 'table' => [ + 'filters' => [ + 'byid' => $ids, + ] + ] + ]); } } diff --git a/resources/views/livewire/meetup/meetup-event-table.blade.php b/resources/views/livewire/meetup/meetup-event-table.blade.php index 242ec85e..43cf58eb 100644 --- a/resources/views/livewire/meetup/meetup-event-table.blade.php +++ b/resources/views/livewire/meetup/meetup-event-table.blade.php @@ -38,11 +38,8 @@ init() { let events = {{ Js::from($events) }}; events = events.map(function(e){ - console.log(e.startDate); - console.log(e.endDate); - return {startDate: new Date(e.startDate), endDate: new Date(e.endDate), location: e.location, description: e.description} + return {id: e.id, startDate: new Date(e.startDate), endDate: new Date(e.endDate), location: e.location, description: e.description} }) - console.log(events); new Calendar(this.$refs.calendar, { style: 'background', @@ -51,16 +48,18 @@ clickDay: function(e) { if(e.events.length > 0) { var content = ''; + var ids = []; for(var i in e.events) { + ids.push(e.events[i].id); content += '
' - + '
' + e.events[i].location + '
' - + '
' + e.events[i].description + '
' - + '
'; + + '
' + e.events[i].location + '
' + + '
' + e.events[i].description + '
' + + ''; } console.log(content); - $wire.call('popover', content); + $wire.call('popover', content, ids.join(',')); } }, });