Code Monkey home page Code Monkey logo

nova-calendar's Introduction

Event calendar for Laravel Nova 4

An event calendar that displays Nova resources or other time-related data in your Nova 4 project on a monthly calendar view that adapts nicely to clear and dark mode.

The design of the calendar in both clear and dark mode

Installation

composer require wdelfuego/nova-calendar

For help implementing and using the calendar, take a look at the documentation.

Upgrade

Version 2.0 of this package was released on June 7th, 2023.

There's an Upgrade Guide for users of v1.x. You shouldn't need more than 15 minutes to upgrade.

License summary

Anyone can use and modify this package in any way they want, including commercially, as long as the commercial use is a) creating implemented calendar views and/or b) using the implemented calendar views. Basically the only condition is that you can't sublicense the package or embed it in a framework (unless you do so under the AGPLv3 license). Usage in Nova is not compatible with the AGPLv3 license. More details below.

Support & Documentation

For any problems or doubts you might run into, please open an issue. For feature requests, please upvote or open a feature request discussion. Developers who are interested in working together on this tool are highly welcomed.

What can it do?

This calendar tool for Nova 4 shows existing Nova resources and, if you want, dynamically generated events, but comes without database migrations or Eloquent models itself. This is considered a feature. Your project is expected to already contain certain Nova resources for Eloquent models with DateTime fields or some other source of time-related data that can be used to generate the calendar events displayed to the end user.

The following features are supported:

  • Automatically display Nova resources on a monthly calendar view
  • Mix multiple types of Nova resources on the same calendar
  • Display events that are not related to Nova resources
  • Use event filters to limit the amount of events shown on the calendar
  • Add badges to events and calendar days to indicate status or attract attention
  • Customize visual style and content of each individual event
  • Laravel policies are respected to exclude events from the calendar automatically
  • Allows end users to navigate through the calendar with hotkeys
  • Allows end users to navigate to the resources' Detail or Edit views by clicking events

What can it not do (yet)?

The following features are not (yet) supported:

  • Integration with external calendar services
  • Creating new events directly from the calendar view
  • Drag and drop to change event dates

Please create or upvote feature request discussions in the GitHub repo for the features you think would be most valuable to have.

Release log

v2.1

  • Adds a year/month picker dropdown to the top of the calendar view

v2.0

  • Adds support for multiple instances of the calendar, each with their own calendar data provider and configuration
  • Adds support for Event filters, allowing the end user to show different subsets of events within a calendar
  • The calendar now restores its previous view state on reloading
  • Minor UI and UX improvements
  • Package infrastructure has been prepared for multiple front-end views (weekly, daily, etc.)
  • Package can now be installed under PHP 7.4 (was previously 8.0+ only)

v1.8

  • Added support for Laravel 10, thanks @pcorrick!
  • Fixed issue where some multi-day events were not properly shown on the calendar in all cases, thanks @SamMakesCode!

v1.7

  • Holding Ctrl or Meta key while clicking an Event now opens the target URL in a new browser window, thanks @vesper8!
  • Event notes now support HTML content

v1.6

  • The URI of the calendar tool is now configurable, thanks @kitchetof!
  • Adds support for custom event generators to define your own mapping from Nova resource to calendar event(s)
  • For developers of this package: added first set of unit tests

v1.5

v1.4

  • Badges can now be added to calendar day cells

v1.3

  • Calendar events for Nova resources the user isn't authorized to see are now automatically hidden from the calendar
  • Calendar events for Nova resources can now be excluded from the calendar on an individual basis

v1.2

  • Adds support for customizing non-Nova events
  • Adds support for applying multiple custom styles to events

v1.1

  • Adds support for multi-day events
  • Improved visual design
  • Better support for mobile usage
  • Fixes bug where badges could overlap the event title
  • View now uses css grid instead of table
  • New dual licensing model (see the end of this file)

v1.0

  • Initial release with support for single-day events only

License

Copyright © 2022 • Willem Vervuurt, Studio Delfuego, wdelfuego

This entire copyright and license notice must be included with any copy, back-up, fork or otherwise modified version of this package.

You can use this package under one of the follwing two licenses:

  1. GNU AGPLv3 for GPLv3-or-newer compatible open source projects. Note that this license is not compatible with usage in Nova, so this package can't be used under this license until a version exists that can be included in Laravel/Vue3 projects without depending on Nova. You can find the full terms of this license in LICENSE-agpl-3.0.txt in this repository and can also find a copy on https://www.gnu.org/licenses/.

  2. A perpetual, non-revocable and 100% free (as in beer) do-what-you-want license that allows both non-commercial and commercial use, under the following 6 conditions:

  • You can use this package to implement and/or use as many calendars in as many applications on as many servers with as many users as you want and charge for that what you want, as long as you and/or your organization are either a) the developer(s) responsible for implementing the calendar(s), or b) the end user(s) of the implemented calendar(s), or c) both.

  • Sublicensing, relicensing, reselling or charging for the redistribution of this package (or a modified version of it) to other developers for them to implement calendar views with is not allowed under this license.

  • You are free to make any modifications you want and are not required to make your modifications public or announce them.

  • You are free to make and distribute modified versions of this package publicly as long as you distribute it for free, as a stand-alone package and under the same dual licensing model.

  • Embedding this package (or a modified version of it) in free or paid-for software libraries or frameworks that are available to developers not within your organization is expressly not allowed under this license. If the software library or framework is GPLv3-or-newer compatible, you are free to do so under the GNU AGPLv3 license.

  • The following 2 disclaimers apply:

    • THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    • YOU ASSUME ALL RISK ASSOCIATED WITH THE INSTALLATION AND USE OF THE SOFTWARE. LICENSE HOLDERS ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USE AND ASSUME ALL RISKS ASSOCIATED WITH ITS USE, INCLUDING BUT NOT LIMITED TO THE RISKS OF PROGRAM ERRORS, DAMAGE TO EQUIPMENT, LOSS OF DATA OR SOFTWARE PROGRAMS, OR UNAVAILABILITY OR INTERRUPTION OF OPERATIONS.

nova-calendar's People

Contributors

bb140856 avatar donovanhare avatar javoscript avatar kichetof avatar lednerb avatar muhammadsaeedparacha avatar pcorrick avatar sammakescode avatar vesper8 avatar wdelfuego avatar webard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nova-calendar's Issues

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

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

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.

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

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!

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

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!

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

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

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.

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?

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

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}

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.

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.

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.

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.

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.

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

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

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.

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!

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.

[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!

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.

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?

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.