Remove coordinator fees

This commit is contained in:
Rohan Mitchell
2013-07-30 11:55:21 +10:00
parent 24b957dc57
commit d64bcf0e94
4 changed files with 41 additions and 2 deletions

View File

@@ -40,6 +40,10 @@ angular.module('order_cycle', ['ngResource'])
$event.preventDefault()
OrderCycle.addCoordinatorFee()
$scope.removeCoordinatorFee = ($event, index) ->
$event.preventDefault()
OrderCycle.removeCoordinatorFee(index)
$scope.submit = ->
OrderCycle.create()
])
@@ -86,6 +90,10 @@ angular.module('order_cycle', ['ngResource'])
$event.preventDefault()
OrderCycle.addCoordinatorFee()
$scope.removeCoordinatorFee = ($event, index) ->
$event.preventDefault()
OrderCycle.removeCoordinatorFee(index)
$scope.submit = ->
OrderCycle.update()
])
@@ -123,6 +131,9 @@ angular.module('order_cycle', ['ngResource'])
addCoordinatorFee: ->
this.order_cycle.coordinator_fees.push({})
removeCoordinatorFee: (index) ->
this.order_cycle.coordinator_fees.splice(index, 1)
productSuppliedToOrderCycle: (product) ->
product_variant_ids = (variant.id for variant in product.variants)
variant_ids = [product.master_id].concat(product_variant_ids)
@@ -192,14 +203,14 @@ angular.module('order_cycle', ['ngResource'])
data = this.translateCoordinatorFees(data)
data
removeInactiveExchanges: (order_cycle)->
removeInactiveExchanges: (order_cycle) ->
order_cycle.incoming_exchanges =
(exchange for exchange in order_cycle.incoming_exchanges when exchange.active)
order_cycle.outgoing_exchanges =
(exchange for exchange in order_cycle.outgoing_exchanges when exchange.active)
order_cycle
translateCoordinatorFees: (order_cycle)->
translateCoordinatorFees: (order_cycle) ->
order_cycle.coordinator_fee_ids = (fee.id for fee in order_cycle.coordinator_fees)
delete order_cycle.coordinator_fees
order_cycle