asantibanez / livewire-calendar

Laravel Livewire component to show Events in a good looking monthly calendar
MIT License
907 stars 232 forks source link

how to drag/drop events from predefined events outside calendar? #46

Open jordivela007 opened 1 year ago

jordivela007 commented 1 year ago

I want to drag/drop events from a list and put in the calendar in specific day. How can i do this? image

rashaHm commented 1 year ago

Hello, Did you find any solution ??

jordivela007 commented 1 year ago

I find a solution.

in the blade you can do this:

<div> <div id="calendar-container"> <div id="external-events" class="basis-20 box-border rounded-lg border-2 shadow-md cursor-pointer"> <div class="flex flex-row"> @if ($calendarevents->count() > 0) @foreach ($calendarevents as $calendarevent) <div class="basis-20 box-border rounded-lg border-2 shadow-md cursor-pointer" draggable="true" ondragstart="onLivewireCalendarEventDragStart(event, 'C{{ $calendarevent->id }}')" style="background-color:{{ $calendarevent->backgroundColor }};border-color:{{ $calendarevent->isBlocked ? '#000000' : $calendarevent->backgroundColor }};"> <p class="text-sm font-medium"> {{ $calendarevent->title }} </p> <p class="mt-2 text-xs>"> {{ $calendarevent->description }} </p> </div> @endforeach @else <strong>You need to create a User Calendar/strong> @endif </div> </div> <div id="calendar" class="basis-20 box-border rounded-lg border-2 shadow-md cursor-pointer"> <livewire:event-grid-component week-starts-at="1" before-calendar-view="livewire.events.before" /> </div> </div> </div>

jordivela007 commented 1 year ago

image