Input fields inside of browser item #1536
Replies: 1 comment
-
Hi @liamjcooper, sorry for the delay, just went through all discussions to make sure we haven't left something unanswered and I found this thinking I had replied but didn't, my bad! I'd suggest joining our Discord at https://discord.link/twill to make sure you're getting visibility, we provide constant support and share ideas there with 600+ members now! This is a great idea, and actually something we've pushed forward from similar needs, but we've taken it in a bit of a different direction. What you're trying to do can technically be done with a repeater field with a browser field in it, though the UX isn't as seamless as the inline field you're proposing. What we came up with was to allow repeater fields to behave essentially like browser fields, allowing selection of an existing repeated record and direct manipulation of it's full set of fields, or a partial set, which allow even more use cases with Eloquent relationships. The work and a video demo are available on this PR: #1550 (comment). |
Beta Was this translation helpful? Give feedback.
-
One requirement I've come across in Twill is adding custom input(s) beside or below each browser item a lot like how repeaters work, solely for pivot tables/attributes.
On a many-to-many relationship, it's possible that the child has some attributes that are required to be populated when being attached. One real world example is the idea of a 'price list' which is exactly what I'm dealing with. You have the following tables:
products
:id
title
price
price_lists
:id
title
price_list_product
(the pivot):price_list_id
product_id
price
position
I need to be able to fill out the price column on
price_list_product
such that in the behaviour of the application I can get a specific price for a product based on some conditions.In terms of developer experience, I propose a similar Blade syntax and directory structure to how repeaters are done at the moment e.g.
/resources/views/admin/browsers/price-list-product.php
where you define what fields get displayed. Then, for example, to use it:And ultimately we end up with a form like this:
Am I approaching this the right way or am I going in the wrong direction? Is there scope for this, and is it fairly straightforward?
Beta Was this translation helpful? Give feedback.
All reactions