Code Monkey home page Code Monkey logo

nova-calendar's Issues

Style problems

Hello! I installed nova-calendar on a new project and immediately noticed some display issues:

  • The date picker arrow is not visible. However, it works: it's clickable and you can choose the month and year;
  • The selected filters are barely visible in both light and dark mode.

I tried it on Chrome, Safari, and Firefox with the same results. I am using version 2.1.4. In another project, where I have version 2.1.2, it works normally and the display is fine.

Registrazione.schermo.2024-01-25.alle.10.41.32.mov

Day borders are too dark in light mode

Under some conditions, the default layout of the calendar has borders that are too dark.

I haven’t been able to reproduce this yet.

If you encounter this issue, please indicate your os and browser and if you can, inspect the html elements and let me know which css class causes the borders to turn out so dark.

Cannot change url by method `withUrl()`, when events are created by generator

Hello,

In my app I have calendar_events table with all calendar events morphed to many other models.

My generator look like this:

class CrmCalendarEventGenerator extends CustomEventGenerator
{
    protected function modelQuery(EloquentBuilder $queryBuilder, Carbon $startOfCalendar, Carbon $endOfCalendar): EloquentBuilder
    {
        return $queryBuilder->with(['eventable'])->where('start', '>=', $startOfCalendar)
            ->where(function ($q) use ($endOfCalendar) {
                $q->where('end', '<=', $endOfCalendar)
                    ->orWhereNull('end');
            })->where('type', 'recall');
    }

    /**
     * @return array<Event>
     */
    protected function resourceToEvents(NovaResource $resource, Carbon $startOfCalendar, Carbon $endOfCalendar): array
    {
        $model = $resource->model();
        assert($model instanceof CalendarEvent);
        assert($model->eventable instanceof HasCalendarEvents);
        $event = new Event($model->eventable->getCalendarTitle(), $model->start);

        $event->notes($model->description);
        $event->addStyle($model->style ?? 'default');

        // TODO: not working
        $event->withUrl('/resources/' . Str::plural($model->eventable_type) . '/' . $model->eventable_id);

        return [$event];

    }
}

And like you see, there is no option to change url by method withUrl(), when events are created by generator. Calendar Event always redirects to CalendarEvent model, instead of my customized URL.

Vue warning DropdownTrigger

Hi, I have those warnings
[Vue warn]: Failed to resolve component: DropdownTrigger
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
I have being playing with component long time, just notice them right now.
I am with nova 4.32.11 it it matters.
Please help

Allow (some) customization of calendar day cells

The CSS applied to events is already very customizable.
It would be nice to have something similar for the calendar day cells (td elements in the table).
Could possibly even use the same style definitions already supplied by the calendar data provider.

Customizing Event properties in custom event generator

Thank you for creating and sharing this package;
I am trying to implement reoccurring events (currently simply Users birthday, later reoccurring tasks). I got the query working well but my issue is the event creation process, as I need to modify the original year, to the one currently being displayed (which can be for current month either last year or current year even).

Would it be possible to gain access to the $startOfCalendar and $endOfCalendar within the resourceToEvents function or am I missing something?

Or maybe even as callable function or property of the EventGenerator class?

Supply the CalendarDataProvider to the CalendarController per instance instead of through global dependency injection

Right now, the CalendarController expects a CalendarDataProviderInterface which is supplied through dependency injection.

For that to work, users of this package need to manually bind their own calendar data provider to the CalendarDataProviderInterface class in the boot() method of their NovaServiceProvider:

use App\Providers\CalendarDataProvider;

public function register()
{
    $this->app->bind(CalendarDataProviderInterface::class, function($app) {
        return new CalendarDataProvider();
    });
}

It would be nice if instead, the calendar data provider could be supplied through the tool's constructor within the tools() method, like this:

use App\Providers\CalendarDataProvider;

public function tools()
{
    return [
        new NovaCalendar(new CalendarDataProvider),
    ];
}

That would open the door to having multiple instances of the calendar Tool, each with their own data provider. It would have the added benefit of making the installation of the package slightly simpler.

Any questions or doubts?

Add a comment to this issue and we'll talk about it.

Add unit tests

The following files need unit tests:

  • src/DataProvider/MonthCalendar.php
  • src/Http/Controllers/CalendarController.php
  • src/Event.php
  • src/CalendarDay.php

I'm marking this 'good first issue' because it's a small task that will help a lot in getting to understand the internals of this package, and new contributors can do parts of it.

Getting started

  1. Make a clone of this repo and clone that to your own computer
  2. Add the unit tests locally, then commit and push the changes to your repo on GitHub
  3. Send a pull request

Any questions or doubts?

Add a comment to this issue and we'll talk about it

Events from fields containing Array

I have a json field that contains an array, each array item has a date that I want to show on the calendar.

I'm creating the functionality and will send a PR.

Calendar menu link giving 404

I am using the latest nova version and just installed nova-calendar. I have removed the nova prefix from my url through the config file of nova and its just '/' . When i add the calendar in the menu the modal shows 404 no page found. Any help with this is much appreciated

Event filtering

Hi, first of all, this package is amazing. Thanks for sharing it, and sorry about the title. I couln't define one with short words.

The only feature that I miss is the ability to filters events from an specific calendar. I will try to explain:

The idea is to keep just one instance of the Tool in nova.
Imagine that whe have 2 calendars in DB, and for each calendar, we have multiple events:

Calendar 1: Family
---- Event 1
---- Event 2
---- Event 3

Calendar 2: Job
---- Event 10
---- Event 11
---- Event 12
---- Event 13

The Idea is be able to display teh events of just one of this calendars per time, and be able to change the calendar that is been displayed.

Week View Update?

Did you roll back todays changes, I got this notice

added week view to Nova Calendar
views can be enabled in nova-calendar.php config file, selector buttons are located in top right area
direct links from month view to selected week enabled
README updated

Ability to use url parameters for optionally filtering down

I'm using 2.x and I have a calendar that shows aggregated data through nonNovaEvents

it all works great, but I would like to be able to optionally open this calendar with a url parameter in order to only display events related to id passed in the url

So.. default calendar: /nova/calendar/lessons-summary

But sometimes via clicking on a Nova resource I want to open /nova/calendar/lessons-summary?bookingId=1

And then in my calendar I have

        $query = Booking::with([
            'bookingLessons.bookingLessonDetails',
        ])
        ->whereBetween('starts_at', [
            $this->startOfCalendar(),
            $this->endOfCalendar()
        ])
        ->orderBy('starts_at', 'asc');

        $bookings = $query->get();

Now I would have liked to simply add a

        if(request()->has('bookingId')) {
            $query->where('id', request('bookingId'));
        }

But unfortunately while I'm inside the calendar I can't seem to gain access to the url parameters via the request object. I tried both request()->all() and request()->route() and neither seem to expose my url parameter.

I'm not entirely sure why that is, I'm guessing it's because the calendar provider is not so much a controller but powers the api.

I was wondering if you have any insight on how I may be able to achieve the desired result? Many thanks!

When searching, events are still clickable

From version 2 of the package there is a problem using the global search: the events are still visible and clickable. They are not covered by that dark fade that the rest of the page has.

Version 1 - all fine
v1

Version 2 - clickable event
v2

Weird UI between 2 months

The UI is weird when between 2 months. please see image below. this event on June and July
image

And you will not able to see it in the next month (July)
image

[Bug] Method Laravel\Nova\Http\Requests\NovaRequest::schemeAndHttpHost does not exist

I'm getting this error when trying to use 2.1

My Laravel Nova is frozen at 4.22.2 because that's when my 1 year of free updates has expired.

I wonder if the schemeAndHttpHost method was only added afterwards?

I don't understand why else I would be getting this error. My calendar does not load at all as a result.

Would it be possible to make your package compatible with Laravel Nova 4.0 and not depend on a new method that many people won't have access to unless they have an active subscription? If that is even the problem.. if you have any other ideas I'd love to hear them.

Many thanks for your continued development!

Version 2.0

Thanks a lot for your input! I'll be exploring something analogous to this, hope to launch the feature with version 2.0 in January or February.

Originally posted by @wdelfuego in #43 (comment)

Regarding that, I was wondering if you could tell which features might be included and if you still plan on releasing it in Jan/Feb?
Anyway, thank you for that amazing package, made my life a lot easier already.

str_contains(): Argument #1 ($haystack) must be of type string, Closure given

Using tenancy for laravel
PHP 8.1.1
Nova 4 latest

[stacktrace]
#0 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Str.php(242): str_contains(Object(Closure), '@')
#1 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Str.php(692): Illuminate\\Support\\Str::contains(Object(Closure), Array)
#2 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(307): Illuminate\\Support\\Str::parseCallback(Object(Closure))
#3 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(287): Illuminate\\Routing\\Route->parseControllerCallback()
#4 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(272): Illuminate\\Routing\\Route->getControllerClass()
#5 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\formfeed-uk\\nova-dependable-panel\\src\\Http\\Middleware\\InterceptValidationFailure.php(64): Illuminate\\Routing\\Route->getController()
#6 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\formfeed-uk\\nova-dependable-panel\\src\\Http\\Middleware\\InterceptValidationFailure.php(31): Formfeed\\DependablePanel\\Http\\Middleware\\InterceptValidationFailure->isDependentFieldRequest(Object(Illuminate\\Http\\Request))
#7 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Formfeed\\DependablePanel\\Http\\Middleware\\InterceptValidationFailure->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#8 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\formfeed-uk\\nova-dependable-panel\\src\\Http\\Middleware\\InterceptDependentFields.php(31): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#9 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Formfeed\\DependablePanel\\Http\\Middleware\\InterceptDependentFields->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#10 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\nova\\src\\Http\\Middleware\\BootTools.php(20): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#11 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Laravel\\Nova\\Http\\Middleware\\BootTools->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#12 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\nova\\src\\Http\\Middleware\\DispatchServingNovaEvent.php(24): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#13 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Laravel\\Nova\\Http\\Middleware\\DispatchServingNovaEvent->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#14 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\inertiajs\\inertia-laravel\\src\\Middleware.php(92): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#15 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Inertia\\Middleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#16 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Middleware\\SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#17 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#18 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#19 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#20 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\View\\Middleware\\ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#21 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#22 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#23 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest(Object(Illuminate\\Http\\Request), Object(Illuminate\\Session\\Store), Object(Closure))
#24 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#25 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\stancl\\tenancy\\src\\Middleware\\IdentificationMiddleware.php(36): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#26 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\stancl\\tenancy\\src\\Middleware\\InitializeTenancyBySubdomain.php(52): Stancl\\Tenancy\\Middleware\\IdentificationMiddleware->initializeTenancy(Object(Illuminate\\Http\\Request), Object(Closure), 'checkpoint')
#27 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\stancl\\tenancy\\src\\Middleware\\InitializeTenancyByDomainOrSubdomain.php(22): Stancl\\Tenancy\\Middleware\\InitializeTenancyBySubdomain->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#28 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Stancl\\Tenancy\\Middleware\\InitializeTenancyByDomainOrSubdomain->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#29 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#30 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#31 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#32 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#33 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#34 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(726): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#35 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(703): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#36 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(667): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#37 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(656): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#38 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(190): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#39 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#40 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\livewire\\livewire\\src\\DisableBrowserCache.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#41 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Livewire\\DisableBrowserCache->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#42 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\nova\\src\\Http\\Middleware\\ServeNova.php(23): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#43 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Laravel\\Nova\\Http\\Middleware\\ServeNova->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#44 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\barryvdh\\laravel-debugbar\\src\\Middleware\\InjectDebugbar.php(66): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#45 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#46 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#47 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#48 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#49 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#50 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#51 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#52 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#53 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#54 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance.php(86): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#55 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#56 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Middleware\\HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#57 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#58 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Middleware\\TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#59 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#60 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#61 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(165): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#62 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(134): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#63 C:\\Users\\Jeremiah\\Desktop\\projects\\valet\\app2\\public\\index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#64 C:\\Users\\Jeremiah\\AppData\\Roaming\\Composer\\vendor\\cretueusebiu\\valet-windows\\server.php(241): require('C:\\\\Users\\\\Jeremi...')
#65 {main}

Change artisan command and prefix

Hi @wdelfuego and thanks for this great package.

I'd like to request the following change:

To create the default calendar data provider there is the following artisan command provided by this package:

php artisan create:default-calendar-data-provider

The command should be refactored to the following usage:

php artisan nova-calendar:create-default-calendar-data-provider

This will ensure that you can add more commands in the future under the same namespace and will separate the CLI from default artisan commands to those that are supported by third parties.

If you agree with this change I will submit the needed changes as a PR in the next days.

How can I have two or more distinct calendars ?

I would like to have multiple calendars, completely distinct from each other, on different URIs.

I see how I can change the URI of a single calendar, but can't seem to figure out how to have two distinct calendars.

Some guidance would be much appreciated.

Many thanks!

Allow us to include html inside the event notes

I tried adding some simple html inside my notes so that I could style part of the note differently and the html itself got printed as a string. This may require letting us use the v-html directive which in some cases can be unsafe but as part of an internal admin tool I think it would be fine.

I have emojis as part of my notes and they are really tiny right now and I would like them to stand out more, but don't want to make all the text bigger.

And I'm also already using badges, but I need to use both badges and emojis inside the notes.

Let me know if that's that possible :)

Thanks!

Consider PHP8.0

This package will not install on my version of PHP, which is 8.0.24. I would suggest considering making it PHP 8.0 compatible. For now, all AWS PHP-managed instances are using 8.0.*, and so many of us that deploy to Amazon are locked into it. Otherwise, the package looks really promising.

Nova resources added with a start and end date are not shown on the calendar if the end date is null

Discussed in #34

Originally posted by pitchayakit August 26, 2022
For example, I have 2 rows for some resources like

  1. starts_at, end_at --> this row works properly
  2. starts_at, null --> if end_at is null, should be considered for a single day but I didn't see how to display it on calendar.

// SomeResource::class => ['starts_at', 'ends_at'],

Could you please suggest a solution?

Add docblocks

The following files need docblocks:

  • src/DataProvider/MonthCalendar.php
  • src/Http/Controllers/CalendarController.php
  • src/Event.php
  • src/CalendarDay.php

I'm marking this 'good first issue' because it's a small task that will help a lot in getting to understand the internals of this package, and new contributors can do parts of it.

Getting started

  1. Make a clone of this repo and clone that to your own computer
  2. Add the docblocks locally, then commit and push the changes to your repo on GitHub
  3. Send a pull request

Follow the DocBlock guidelines as described by Spatie; most importantly:

Don't use docblocks for methods that can be fully type hinted (unless you need a description).

Any questions or doubts?

Add a comment to this issue and we'll talk about it

Poor performance - eager loading breaks in Custom Event Generators

Problem

We've created a custom event generator to handle bookings for our customers.

class BookingEventGenerator extends CustomEventGenerator
{
    protected function modelQuery(EloquentBuilder $queryBuilder, Carbon $startOfCalendar, Carbon $endOfCalendar): EloquentBuilder
    {
        return $queryBuilder
            ->with([
                'electrician',
            ])
            ->where('from', '>=', $startOfCalendar)
            ->where('from', '<=', $endOfCalendar)
            ;
    }

    protected function resourceToEvents(NovaResource $resource): array
    {
        $out = [];
        
        $model = $resource->model();

        $event = new Event(
            'Booking #' . $model->id,
            $model->from,
            $model->to,
        );

        $event->notes('<b>Installer: </b>' . $model->electrician->first_name . ' ' . $model->electrician->last_name);

        $out[] = $event;

        return $out;
    }
}

We've eager loaded the electrician relationship in the query because we don't want to reload it every time we handle an event. BUT, the nova-calendar library uses ->cursor() on the relationship in ->generateEvents(). This will only keep one relationship in memory at a time meaning a separate query is run to get the relationship for every event.

How we solved it

We've got a fork of your project and for our purposes, swapping ->cursor() to ->get() works fine.

It'd be nice though, if nova-calendar could allow you to specify the method used in a custom event generator, or something similar.

recommendation: calendar backend library vkurko/calendar

Hello, as I have some custom needs I decided to work with a javascript calendar library instead of using this package for now, but I wanted to suggest the following library for future versions:

https://github.com/vkurko/calendar

  • really lightweight and performant
  • many views out of the box
  • developer is really active fixing issues
  • interactivity features if needed in the future

If I have the time, I would like to help to integrate it into v2, after the initial release, as I use it in my custom nova tool already.
I might post some pictures of my usecase including event and resource filtering. Might be interesting for #26

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.