Merge pull request #8017 from cillian/hide-variants-with-no-stock

When creating backoffice orders hide variants with no stock by default
This commit is contained in:
Filipe
2021-12-23 21:34:06 +00:00
committed by GitHub
6 changed files with 141 additions and 4 deletions

View File

@@ -19,6 +19,7 @@ angular.module("admin.utils").directive "variantAutocomplete", ($timeout) ->
distributor_id: scope.distributor_id
order_cycle_id: scope.order_cycle_id
eligible_for_subscriptions: scope.eligible_for_subscriptions
include_out_of_stock: scope.include_out_of_stock
results: (data, page) ->
window.variants = data # this is how spree auto complete JS code picks up variants
results: data
@@ -27,3 +28,5 @@ angular.module("admin.utils").directive "variantAutocomplete", ($timeout) ->
formatSelection: (variant) ->
element.parent().children(".options_placeholder").html variant.options_text
variant.name
element.on "select2-opening", ->
scope.include_out_of_stock = if $('#include_out_of_stock').is(':checked') then "1" else ""