Skip to content

Additional data from modal form #10

@qcol

Description

@qcol

Hi!

Thanks for this great add-on.

I wonder if it is possible to use additional data from the modal form (https://filamentphp.com/docs/3.x/actions/modals#modal-forms)
to pass data to content?

I try as below but there is no data in $data

            Html2MediaAction::make('print')->label('Drukuj')->icon('heroicon-o-printer')
                ->content(
                    function ($record, $data) {
                        return view('employee', [
                            'record' => $record,
                            'template_id' => $data['template_id'] ?? null,
                            'date_from' => $data['date_from'] ?? null,
                            'date_to' => $data['date_to'] ?? null
                        ]);
                    }

                )
                ->form([
                    Select::make('template_id')->selectablePlaceholder(false)
                        ->label('Szablon') 
                        ->live()
                        ->options(
                            function () {
                                return Template::where('type', "Pracownik")->get()->pluck('name', 'id');
                            }
                        )                    
                    ,
                    \Filament\Forms\Components\Fieldset::make('Okres')->schema([
                        \Filament\Forms\Components\DatePicker::make('date_from')->default(now())
                            ->label('Data od'),

                        \Filament\Forms\Components\DatePicker::make('date_to')->default(now())
                            ->label('Data do')

                    ])->hidden(fn(Get $get) => $get('template_id') != 2),
                ]),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions