F
Filamentβ€’2y ago
John

Need advice on recursive multi checkbox edit page

I'd like to build something like in the screenshot. Every row is an organisation. But it's recursive. So after every organisation the child organisations are displayed. Not every role is available for every organisation "level". Hence the blank cells. Every checked checkbox results in a profile record, linking user, role and organisation. This form can have its own page, so I guess a custom Page is most appropriate? Can I use or hook into some Filament stuff to make my life easier?
10 Replies
Dan Harrin
Dan Harrinβ€’2y ago
maybe a repeater with a checkboxlist inside?
John
JohnOPβ€’2y ago
You mean without custom page or component? That would render quite different wouldn't it? And can that work with rows being recursive organisations, where only a checked checkbox results in an actual related record? I mean, all organisations should always be displayed, even if the user currently doesn't have any role within that organisation.
Dan Harrin
Dan Harrinβ€’2y ago
yeah, its a compromise sometimes recreating an exact interface isnt the best/most efficient use of your time if you can do something similar with the pre-built components but you can do whatever you want with custom components if you want
John
JohnOPβ€’2y ago
I'd really like that approach. If I can convince my colleague / client πŸ™‚ But is it possible data-wise? With all organisations being always displayed, even if the user currently doesn't have any role within that organisation?
Dan Harrin
Dan Harrinβ€’2y ago
why are you doing this on the user page if its unrelated?
John
JohnOPβ€’2y ago
It's not unrelated. An admin controls user rights. A user can have multiple profiles. A profile is represented by a checked checkbox, and connects a user to an organisation with a specific role. So even if a user doesn't have any roles within a particular organisation currently (row with only unchecked checkboxes), the admin should still be able to add them (check some boxes). So, I guess in order for this to work, it should be possible to insert a profile row for every newly checked checkbox. And delete profile records for every unchecked checkbox that was previously checked. Can this be achieved with a CheckboxList?
Dan Harrin
Dan Harrinβ€’2y ago
probably, but i really dont have time to explain it. its probably faster for you to work out how to write a custom livewire component to handle this table
John
JohnOPβ€’2y ago
Ok, I'll test drive some approaches and see where it takes me. ChatGPT suggests to use a custom form with nested repeaters... Thanks for your time, Dan.
Dan Harrin
Dan Harrinβ€’2y ago
i wouldnt use chatgpt, it doesnt know anything about modern filament
John
JohnOPβ€’2y ago
I don't give it as much credit as these forums of course πŸ˜‰ but it might give some inspiration.
Want results from more Discord servers?
Add your server