For users with enterprise with inventory and enterpises with variant
tag, allow access to the inventory page and display variant tag only for
the enterprises its enabled for.
Make enterprise removal use turbo, which provides the following
benefits:
* More responsive removal since there's no full page reload.
* A success flash message (previously nothing was displayed).
* No double alert prompt.
It also goes in the direction of removing mrujs in favor of turbo.
Inventory cannot be enabled if variant tag is also enabled
Re generated the rubocop todo to account for Product::Importer, it has
too many line but it's temporary. Once the inventory is removed it won't
be an issue anymore
* Keep save bar visible as long as there's a customer form displayed.
* Only display "You have unsaved changes" when there's any difference
from the original values. If form changes are reverted, hide that
note.
* Similarly, only let the button be enabled if there are any actual
changes to be saved.
With a product with mutiple variant, we can end in a scenario where a
user sees variant associated to producer it doesn't have permission for.
This prevents the user from updating any variant. This fix filter out
variant a user shoudn't be seeing
variant_tag feature check should happen per enterprise basis, but we
still want super admin to so see variant tag. To do so we check if the
user is amdin or if any of the current user enterprise has variant tag
enable.
The component now will try to load a list of existing tag if you give an
`autocomplete_url`. I tried to keep the tag input and the autocomplete
functionality decoupled but is wasn't really possible. Instead I opted
to sub class the Autocomplete stimulus controller, but it only gets
initialised if we pass an `autocomplete_url`.
It uses composition and inject the TagListInputComponent as a depency,
which should be more flexible that creating a sub class. This new
component could potentially be made more generic if needed
We only support one of filter by inventory variants or filter by variants
at any given time, based on enabled feature. If both features inventory
and variant tag are enabled, variant tag takes precedence.
We separate the default tag rules and the various tag rule groups by an
index of 1000. This is so the previous group does not overlap with the
current group. Rails will managed the non continusly numbered
tag_rule_attributes param just fine. It saves us from having to manage
the numbering of tag_rule_attributes in javascript
TagRuleController is now a subclass of Spree::Admin::BaseController
because Admin::ResourceController did not play well with turbo_stream.
And to be honest we did not need all the functionality provided by the
ResourceController