mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
StandingLineItems can be removed when creating a StandingOrder
This commit is contained in:
@@ -21,8 +21,13 @@ angular.module("admin.standingOrders").controller "StandingOrderController", ($s
|
||||
$scope.stepTitleFor = (step) -> t("admin.standing_orders.steps.#{step}")
|
||||
|
||||
$scope.addStandingLineItem = ->
|
||||
$scope.standing_order_form.$setDirty()
|
||||
StandingOrder.buildItem($scope.newItem)
|
||||
|
||||
$scope.removeStandingLineItem = (item) ->
|
||||
$scope.standing_order_form.$setDirty()
|
||||
StandingOrder.removeItem(item)
|
||||
|
||||
$scope.estimatedSubtotal = ->
|
||||
$scope.standingOrder.standing_line_items.reduce (subtotal, item) ->
|
||||
subtotal += item.price_estimate * item.quantity
|
||||
|
||||
@@ -16,6 +16,10 @@ angular.module("admin.standingOrders").factory "StandingOrder", ($injector, $htt
|
||||
, (response) =>
|
||||
InfoDialog.open 'error', response.data.errors[0]
|
||||
|
||||
removeItem: (item) ->
|
||||
index = @standingOrder.standing_line_items.indexOf(item)
|
||||
@standingOrder.standing_line_items.splice(index,1)
|
||||
|
||||
create: ->
|
||||
StatusMessage.display 'progress', 'Saving...'
|
||||
delete @errors[k] for k, v of @errors
|
||||
|
||||
Reference in New Issue
Block a user