savannabits / filament-flatpickr

Extend your Filament Date-Picking with Flatpickr
MIT License
43 stars 31 forks source link

Not working in action modal #6

Closed martin-ro closed 11 months ago

martin-ro commented 1 year ago

When using the field in an action modal I get

Alpine Expression Error: mode is not defined

Expression: "mode ==='dark'"

<template x-if="mode ==='dark'">
martin-ro commented 1 year ago

I should add that this is with a table action outside of admin panel

coolsam726 commented 1 year ago

Hi Martin, Kindly share your component's code to help me reproduce the issue. Thanks.

On Fri, Aug 26, 2022, 8:40 AM Martin Ro @.***> wrote:

I should add that this is with a table action outside of admin panel

— Reply to this email directly, view it on GitHub https://github.com/savannabits/filament-flatpickr/issues/6#issuecomment-1228076495, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKZWMNENTAEJKXWN374VZTV3BKEBANCNFSM57VNPM7Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

martin-ro commented 1 year ago

Hi,

it's just a livewire component implementing Tables\Contracts\HasTable and in getTableActions

Tables\Actions\Action::make('book')
                ->label(__('Book Lesson'))
                ->mountUsing(fn (Forms\ComponentContainer $form, Teacher $record) => $form->fill([
                    'teacher_id' => $record->user->userable_id,
                ]))
                ->form([
                    Group::make()->schema([
                        Flatpickr::make('date),
                    ])->columns(2),
                ])
martin-ro commented 1 year ago

If you want to reproduce, just create a Livewire component and setup a table like here

and in the tables getTableActions create a modal action with the Flatpickr field. I hope you know what I mean? I can't really post the whole component :)

martin-ro commented 1 year ago

Ok, digging around a bit, all the assets are registered FlatpickrServiceProvider which means they are only loaded within Filament but not in a standalone form or table component.

coolsam726 commented 1 year ago

Ok, digging around a bit, all the assets are registered FlatpickrServiceProvider which means they are only loaded within Filament but not in a standalone form or table component.

This is actually the case. Might you be able to do a PR to support standalone usage?

R00118189 commented 1 year ago

Any update?

coolsam726 commented 1 year ago

I will be re-writing most parts of the component tomorrow, hopefully it will fix this issue.

On Sun, Jan 1, 2023, 10:30 PM Bart @.***> wrote:

Any update?

— Reply to this email directly, view it on GitHub https://github.com/savannabits/filament-flatpickr/issues/6#issuecomment-1368515752, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKZWMK67TCYDJ66FB7K26TWQHLL7ANCNFSM57VNPM7Q . You are receiving this because you commented.Message ID: @.***>

R00118189 commented 1 year ago

@coolsam726 I wonder if you had a chance to update this package to work with standalone forms

dkstudio86 commented 1 year ago

@coolsam726 I wonder if you had a chance to update this package to work with standalone forms

+1

Haggai-Mac commented 1 year ago

@coolsam726 I wonder if you had a chance to update this package to work with standalone forms

+1

coolsam726 commented 11 months ago

Fixed in this PR #27