Skip to content

[Bug]: getDateSelectContextMenuActions not working #140

@priteshqualitycode

Description

@priteshqualitycode

What happened?

package not working after I update from 2 to 3 version

my filament version now also 5

How to reproduce the bug

protected function getDateSelectContextMenuActions(): array
{
return [
$this->createReservationAction(),
$this->createMaintenanceBlockAction(),
];
}

public function createReservationAction(): CreateAction
{
return $this->createAction(Reservation::class)
->name('createReservation') // REQUIRED
->mountUsing(function (Schema $form) {
$form->fill([]);

            /** @var DateSelectInfo|null $dateSelect */
            $info       = $this->getCalendarContextInfo();
            $dateSelect = $info instanceof DateSelectInfo ? $info : null;
            $resource   = $dateSelect ? (array) ($dateSelect->resource ?? []) : [];

            Log::info('createReservationAction mountUsing', [
                'info_class' => $info ? get_class($info) : null,
                'resource'   => $resource,
                'start'      => $dateSelect?->start?->toDateString(),
                'end'        => $dateSelect?->end?->toDateString(),
            ]);
        });
}

public function createMaintenanceBlockAction(): CreateAction
{
    return $this->createAction(MaintenanceBlock::class)        ->name('createMaintenanceBlock') // REQUIRED
    ->mountUsing(function (?ContextualInfo $info) { 
        dd($info);
        // Both comparison checks are equal, but instanceof is better for IDE help
        if ($info->getContext() === Context::DateSelect) {
            // do something on date select
            dd($info);
        }
    });
}

null // app\Filament\Pages\Widgets\BookingCalendarWidget.php:78

local.ERROR: Call to a member function getContext() on null

I can't get start end date and resource data

also calendar always start from start date I need to resource calendar start from today

Package Version

3.0

PHP Version

8.3

Laravel Version

12.0

Which operating systems does with happen with?

No response

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions