AttachAction in relationManager
I have a question about a situation I'm encoutring on my project. I have a PartnersRelationManager into my projectResource, I'm using create action if there are no partners to attach and then I show the attach btn. But what I really want, is to add a create btn in the attachAction, so I can create a new partner if I didn't find the exact partner to attach from the select list.
Any ideas??
Thank you
Any ideas??
Thank you
Solution
->headerActions([
Tables\Actions\AttachAction::make()
->preloadRecordSelect() // Preload the select field values
->recordSelect(fn (Select $select) => $select->placeholder(__('projProgRelations.choosePartner'))) // change the select placeholder text
->extraModalFooterActions([
Tables\Actions\CreateAction::make()
->form([
TextInput::make('organism')
->label(__('projProgRelations.organism'))
->maxLength(255)
->required(),
TextInput::make('name')
->label(__('projProgRelations.agentName')),
TextInput::make('gsm')
->label(__('projProgRelations.agentGsm'))
->tel()
->unique(ignoreRecord:true)
->maxLength(10),
TextInput::make('phone')
->label(__('projProgRelations.organismPhone'))
->tel()
->unique(ignoreRecord:true)
->maxLength(10),
TextInput::make('email')
->label(__('projProgRelations.agentEmail'))
->email()
->maxLength(255)
->unique(ignoreRecord:true),
])
])
])->headerActions([
Tables\Actions\AttachAction::make()
->preloadRecordSelect() // Preload the select field values
->recordSelect(fn (Select $select) => $select->placeholder(__('projProgRelations.choosePartner'))) // change the select placeholder text
->extraModalFooterActions([
Tables\Actions\CreateAction::make()
->form([
TextInput::make('organism')
->label(__('projProgRelations.organism'))
->maxLength(255)
->required(),
TextInput::make('name')
->label(__('projProgRelations.agentName')),
TextInput::make('gsm')
->label(__('projProgRelations.agentGsm'))
->tel()
->unique(ignoreRecord:true)
->maxLength(10),
TextInput::make('phone')
->label(__('projProgRelations.organismPhone'))
->tel()
->unique(ignoreRecord:true)
->maxLength(10),
TextInput::make('email')
->label(__('projProgRelations.agentEmail'))
->email()
->maxLength(255)
->unique(ignoreRecord:true),
])
])
])