saade / filament-fullcalendar

The Most Popular JavaScript Calendar as a Filament Widget
MIT License
291 stars 88 forks source link

Option 'config' in 'AdminPanelProvider' overrides the 'config' method of the widget. #173

Closed glauberdjs closed 7 months ago

glauberdjs commented 7 months ago

It is not possible to change the calendar settings in the widget, nor leave the config option empty in AdminPanelProvider to use the one from the widget.

Classes below:

teste teste (2)

Of course, I have other functions related to my project, but here's what's important for the issue. Note that the config arrays are different, however, the AdminPanelProvider is not altered, and I need to change it in real-time in the view according to specific attributes of each client.

saade commented 7 months ago

The config in the AdminPanelProvider is used to apply global configuration to all your calendars, the method inside the class is used to customise per-widget. I'm not following the issue?

glauberdjs commented 7 months ago

But here's the issue: the local config method didn't change the calendar in the local widget. It retained the settings from the AdminPanelProvider instead of inheriting those from the widget.

glauberdjs commented 7 months ago

Is this my blade, is everything correct?

codeimg-instagram-photo-thumbnail

glauberdjs commented 7 months ago

I just noticed that the FullCalendarWidget doesn't have the config method, I believe that might be the issue. This is right? base_project

saade commented 7 months ago

I just noticed that the FullCalendarWidget doesn't have the config method, I believe that might be the issue. This is right?

You're not on the latest version then.

glauberdjs commented 7 months ago

You're right, my fault. It was on version 3.0. Thank you for the support!

albertobenavides commented 7 months ago

Hello. I am trying to set the minTime or minSlotTime in my calendarwidget, but, nothing changes if the config is defined in the plugin. I am at v. 3.0.

This is my Admin config:

FilamentFullCalendarPlugin::make()
                    ->selectable()
                    // ->editable()
                    ->timezone('America/Monterrey')
                    ->locale('es')
                    ->plugins(['timeGrid', 'list'])
                    ->config([
                        'slotMinTime' => "06:00:00",
                        'slotMaxTime' => "23:00:00",
                        'initialView' => 'timeGridWeek',
                        'headerToolbar' => [
                            'left' => 'prev,next today',
                            'center' => 'title',
                            'right' => 'timeGridWeek,dayGridMonth,listWeek'
                        ],
                    ])

And my widget config:

public function config(): array
    {
        return [
            'slotMinTime' => "09:00:00",
            'slotMaxTime' => "18:00:00",
            'minTime' => "09:00:00",
            'maxTime' => "18:00:00",
        ];
    }
ana-lisboa commented 2 months ago

I just noticed that the FullCalendarWidget doesn't have the config method, I believe that might be the issue. This is right?

You're not on the latest version then.

Isn't this the latest version? https://github.com/saade/filament-fullcalendar/blob/3.x/src/Widgets/FullCalendarWidget.php I've just installed the plugin on a new project, and the FullCalendarWidget still does not have the config method.

(composer.json: "saade/filament-fullcalendar": "3.0",)

saade commented 2 months ago

Isn't this the latest version? https://github.com/saade/filament- (composer.json: "saade/filament-fullcalendar": "3.0",)

@ana-lisboa

The latest version is 3.2.2, your composer json is locked to 3.0. Change it to ^3.0 and run composer update