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?
11 Replies
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.
Just clone the tenant selectors functionality and display it as widget with cards?
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.
Ok I think I mis understood, are the clients not the tenants?
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.
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
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.
That's policies
ok
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'
ok that makes sense. Let me think through that a little bit..