mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Find enterprises participating in an order cycle
This commit is contained in:
@@ -21,6 +21,9 @@ angular.module('order_cycle', ['ngResource'])
|
||||
$scope.incomingExchangesVariants = ->
|
||||
OrderCycle.incomingExchangesVariants()
|
||||
|
||||
$scope.participatingEnterprises = ->
|
||||
$scope.enterprises[id] for id in OrderCycle.participatingEnterpriseIds()
|
||||
|
||||
$scope.toggleProducts = ($event, exchange) ->
|
||||
$event.preventDefault()
|
||||
OrderCycle.toggleProducts(exchange)
|
||||
@@ -79,6 +82,9 @@ angular.module('order_cycle', ['ngResource'])
|
||||
$scope.incomingExchangesVariants = ->
|
||||
OrderCycle.incomingExchangesVariants()
|
||||
|
||||
$scope.participatingEnterprises = ->
|
||||
$scope.enterprises[id] for id in OrderCycle.participatingEnterpriseIds()
|
||||
|
||||
$scope.toggleProducts = ($event, exchange) ->
|
||||
$event.preventDefault()
|
||||
OrderCycle.toggleProducts(exchange)
|
||||
@@ -178,6 +184,11 @@ angular.module('order_cycle', ['ngResource'])
|
||||
variant_ids.push(parseInt(id)) for id, active of exchange.variants when active
|
||||
variant_ids
|
||||
|
||||
participatingEnterpriseIds: ->
|
||||
suppliers = (exchange.enterprise_id for exchange in this.order_cycle.incoming_exchanges)
|
||||
distributors = (exchange.enterprise_id for exchange in this.order_cycle.outgoing_exchanges)
|
||||
jQuery.unique(suppliers.concat(distributors)).sort()
|
||||
|
||||
load: (order_cycle_id) ->
|
||||
service = this
|
||||
|
||||
|
||||
Reference in New Issue
Block a user