F
Filamentβ€’10mo ago
Jon Mason

Display list of pages in sidebar when item is clicked on dashboard

I have a dashboard widget displaying a list of clients. When a user clicks on a client, I want to display a list of pages in the sidebar that are specifically related to clients and I don't want them displayed when a client hasn't been selected. I also have a drop down menu in the top bar where a user can select a client. How would I go about accomplishing this? I guess it would essentially be pages in the sidebar that are conditionally hidden if there's no selected client?
No description
11 Replies
Jon Mason
Jon Masonβ€’10mo ago
in my current (non-filament) app, it looks like this in the sidebar, so they're grouped by the client name, again, only showing up when a client is selected.
No description
toeknee
toekneeβ€’10mo ago
Just clone the tenant selectors functionality and display it as widget with cards?
Jon Mason
Jon Masonβ€’10mo ago
not sure I'm following...if I'm understanding you correctly, and following the example of the tenant menu that's a dropdown, I'd much prefer to have them just be grouped in the sidebar vs in a menu for ease of navigation. The end user will be clicking around in these various pages quite a bit.
toeknee
toekneeβ€’10mo ago
Ok I think I mis understood, are the clients not the tenants?
Jon Mason
Jon Masonβ€’10mo ago
no sorry, I have teams of people who work on clients. So a team might have 20 clients. My teams are the tenants, and within the teams there are clients.. teams work on different sets of clients. i've got it to where when I select a team (tenant) then it will display only that team's clients, but now I want to display only information for the specific client the end user is working on.
toeknee
toekneeβ€’10mo ago
Got you, ok so adjust your policies πŸ™‚ using the canView, you will need to build a method in to determine the selected client. But then you can check if this client can access X
Jon Mason
Jon Masonβ€’10mo ago
but how do I conditionally display pages in the sidebar? it's not really a permissions thing as much as it is like, if a variable has a value, then display the pages, otherwise hide them.
toeknee
toekneeβ€’10mo ago
That's policies
Jon Mason
Jon Masonβ€’10mo ago
ok
toeknee
toekneeβ€’10mo ago
Policies are permissions but they can be conditions so for example in the canView for say 'Emails' you can do php functions to check if the current client being accessed has 'Emails'
Jon Mason
Jon Masonβ€’10mo ago
ok that makes sense. Let me think through that a little bit..