Create factory to hold auxillary functions for subscriptions

NOTE: Moved estimatedSubtotal and estimatedTotal functions to the new factory from the subscription line items controller
This commit is contained in:
Rob Harrington
2018-02-19 17:44:17 +11:00
committed by Rob H
parent 2a731b2db5
commit 2e94654f91
4 changed files with 16 additions and 12 deletions

View File

@@ -22,12 +22,3 @@ angular.module("admin.subscriptions").controller "SubscriptionLineItemsControlle
sli.variant_id == $scope.newItem.variant_id
return matching[0] if matching.length > 0
null
$scope.estimatedSubtotal = ->
$scope.subscription.subscription_line_items.reduce (subtotal, item) ->
return subtotal if item._destroy
subtotal += item.price_estimate * item.quantity
, 0
$scope.estimatedTotal = ->
$scope.estimatedSubtotal()