mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Individual StandingOrder orders can be cancelled from Standing Order index
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user