mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-24 01:13:21 +00:00
When creating backoffice orders hide variants with no stock by default
But let people include out of stock variants by checking a checkbox if they want. Note, we only apply the variants in stock scope if a distributor is present. I think this is because this search method is also used when setting up subscriptions so I don't think we want to change the behaviour there. Co-authored-by: Maikel Linke <maikel@email.org.au>
This commit is contained in:
@@ -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 ""
|
||||
|
||||
Reference in New Issue
Block a user