Select field create new option in modal but using url of existing resource/create - Action in modal

Hello.
I have a select field where user can select from all the created record_types. I have added a button to create a new one (a new record_type) without leaving the form. The problem is that I do not want to use the ->form( because the record_type resource has more that 30 fields.

How can I make this code to execute as it does but in a MODAL?

 Select::make('record_type_id')
                                    ->label(__('record_type'))
                                    ->options(RecordType::all()->pluck('description', 'id'))
                                    ->hintAction(
                                        Action::make('record_type_create')
                                            ->url('/record-types/create')
                                            ->icon('heroicon-m-plus')
                                            ->modalContent()
                                            ->requiresConfirmation()
                                    )


It opens the record_type create form, but it is not MODAL. Even if I use ->url('/record-types/create' , true) it opens in a new tab, but it still is NOT A MODAL.

Any idea of how to make it work as a modal??

The idea is, of course, that when creating dossiers, to create a new record_type which is not yet created and therefore not in the select list, be able to create that as modal and REFRESH the list afterwards.

Tks.
image.png
Was this page helpful?