OrderCycle can fetch the direction of an exchange (incoming/outgoing)

This commit is contained in:
Rohan Mitchell
2013-08-14 14:04:42 +10:00
parent a3970dde8a
commit e6fdcf581a
2 changed files with 32 additions and 0 deletions

View File

@@ -21,6 +21,9 @@ angular.module('order_cycle', ['ngResource'])
$scope.incomingExchangesVariants = ->
OrderCycle.incomingExchangesVariants()
$scope.exchangeDirection = (exchange) ->
OrderCycle.exchangeDirection(exchange)
$scope.participatingEnterprises = ->
$scope.enterprises[id] for id in OrderCycle.participatingEnterpriseIds()
@@ -82,6 +85,9 @@ angular.module('order_cycle', ['ngResource'])
$scope.incomingExchangesVariants = ->
OrderCycle.incomingExchangesVariants()
$scope.exchangeDirection = (exchange) ->
OrderCycle.exchangeDirection(exchange)
$scope.participatingEnterprises = ->
$scope.enterprises[id] for id in OrderCycle.participatingEnterpriseIds()
@@ -141,6 +147,9 @@ angular.module('order_cycle', ['ngResource'])
numActiveVariants++ for id, active of exchange.variants when active
numActiveVariants
exchangeDirection: (exchange) ->
if this.order_cycle.incoming_exchanges.indexOf(exchange) == -1 then 'outgoing' else 'incoming'
toggleProducts: (exchange) ->
exchange.showProducts = !exchange.showProducts