F
Filament7mo ago
Rome

Show relation manager of a relation manager in same view

I have a relation manager with companies (resource) and elements (relation manager) (image1). Each element, has sales relation manager on his resource. So, when I click on one element in the companies resource page it redirects to elementresource page with his sales relation manager (image2). Is there any way to get that 'sub relation' (sales) on the same company resource page? I mean, when I click one element, show his sales on the same page without redirecting to element resource page. Maybe with a custom view? I don't know where to start...
No description
No description
13 Replies
Dennis Koch
Dennis Koch7mo ago
Sounds like this is a HasManyThrough Relationship? Not sure if the relation manager supports this but you could try.
Rome
RomeOP7mo ago
Thanks for you response. What I need is when I click a row in the first image (or the button Test) load under the table the other relation manager. I mean, load the relation without changing the web page. I understand that I should create a custom view for that, right? But I don't know where to start... Or maybe instead custom view it would be viable to embed his relation manager on a modal? What do you think?
Dennis Koch
Dennis Koch7mo ago
I don’t think you can embed RMs in modals. You can add an action to your first RM that emits an event to the page that than toggles the right second RM
Rome
RomeOP7mo ago
Well, its not necessarily needed to embed RM, would be resource page + relation manager (after all its a link, right?). That's what you mean? And in the other hand, if I want to make a custom view that when a action is clicked just print relation (manually), is there any documentation? Thanks a lot!
Dennis Koch
Dennis Koch7mo ago
I don’t think I understand the first part. You can link to a subpage but you wanted a modal? And I don’t think that works. Have a look at the Livewire docs for the event part.
Rome
RomeOP7mo ago
I will try to explain better, its easy. In my app I have companys (this companys are gas stations). Each gas station has different elements (many to many). So I have a relation manager in the company resource with those elements (IMAGE1). Those elements, in turn, have product sales (another many to many). So on the elements resource page I have another relation manager (IMAGE2). Up to here everything is fine. To view each element product sales, I have to click on each element in the company resource page and it redirects to element resource page with their products in the relation manager. What I need is to avoid that extra step to view those products. So, when I click on an element in the company resource page, would like to load that products on the same page (IMAGE1) (maybe under the relation manager table or... in a modal?). How could I achieve this? Thanks a lot.
Dennis Koch
Dennis Koch7mo ago
I think I understood that part. But the answer stays the same.
Rome
RomeOP7mo ago
So I need to create a custom livewire view? I didnt understand you. Sorry but Im not too familiar with livewire, only with laravel...
Dennis Koch
Dennis Koch7mo ago
Pages are Livewire components. So you could extend your page. But you'd need to change the view file. Livewire knowledge definitely is required for customization. If you don't need the second RM but could live with a simple table you could open a modal. For that you'd need an Action on the first RM with ->modalContent() and you could put whatever info you need in there.
Rome
RomeOP7mo ago
Well. In the modal I would need to create new sales related to the element, edit current ones and also they had two custom actions buttons. So I think I would need to do all the logic manually without filament provided functions, right? So I think that's not a simple table. Maybe the first solution would be better, extending the page. Could you tell me which section of the livewire/filament documentation I should start looking at? Again, thanks a lot!!
Dennis Koch
Dennis Koch7mo ago
Maybe the first solution would be better, extending the page. Could you tell me which section of the livewire/filament documentation I should start looking at?
Best to just start at the beginning of the Livewire docs. It's not really related to Filament anymore.
Rome
RomeOP7mo ago
Ok thanks, I'll do that. Related to do it on a modal, do you see viable? Not just a table, just the table with actions, create, edit, relating the rows, etc...
Dennis Koch
Dennis Koch7mo ago
Nope
Want results from more Discord servers?
Add your server