Individual StandingOrder orders can be cancelled from Standing Order index

This commit is contained in:
Rob Harrington
2016-12-02 10:28:26 +11:00
parent 27b22acd37
commit 7644f08d5c
10 changed files with 151 additions and 28 deletions

View File

@@ -1,3 +1,7 @@
angular.module("admin.standingOrders").controller "OrdersPanelController", ($scope, OrderCycles) ->
$scope.standingOrder = $scope.object
$scope.orderCyclesByID = OrderCycles.byID
$scope.cancelOrder = (order) ->
if confirm(t('are_you_sure'))
$scope.standingOrder.cancelOrder(order)

View File

@@ -32,3 +32,11 @@ angular.module("admin.standingOrders").factory 'StandingOrderPrototype', ($http,
, (response) =>
StatusMessage.display 'failure', 'Oh no! I was unable to save your changes.'
angular.extend(@errors, response.data.errors)
cancelOrder: (order) ->
if order.id?
$http.put("/admin/standing_order_orders/#{order.id}/cancel").then (response) =>
angular.extend(order,response.data)
, (response) ->
InfoDialog.open 'error', response.data.errors[0]