mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-05 22:26:07 +00:00
Add methods to check for novel suppliers and distributors in an order cycle
This commit is contained in:
@@ -6,11 +6,20 @@ angular.module('admin.orderCycles').factory('OrderCycle', ($resource, $window, $
|
||||
'update': { method: 'PUT'}}
|
||||
|
||||
{
|
||||
order_cycle: {}
|
||||
order_cycle: {incoming_exchanges: [], outgoing_exchanges: []}
|
||||
showProducts: {incoming: false, outgoing: false}
|
||||
|
||||
loaded: false
|
||||
|
||||
exchangeIds: (direction) ->
|
||||
parseInt(exchange.enterprise_id) for exchange in @exchangesByDirection(direction)
|
||||
|
||||
novelSupplier: (enterprise) ->
|
||||
@exchangeIds('incoming').indexOf(enterprise.id) == -1
|
||||
|
||||
novelDistributor: (enterprise) ->
|
||||
@exchangeIds('outgoing').indexOf(enterprise.id) == -1
|
||||
|
||||
exchangeSelectedVariants: (exchange) ->
|
||||
numActiveVariants = 0
|
||||
numActiveVariants++ for id, active of exchange.variants when active
|
||||
|
||||
Reference in New Issue
Block a user