mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-18 00:17:25 +00:00
Adding pause and unpause actions to standing orders
This commit is contained in:
@@ -41,6 +41,18 @@ angular.module("admin.standingOrders").factory 'StandingOrderPrototype', ($http,
|
||||
, ->
|
||||
InfoDialog.open 'error', t('admin.standing_orders.cancel_failure_msg')
|
||||
|
||||
pause: ->
|
||||
ConfirmDialog.open('error', t('admin.standing_orders.confirm_pause_msg'), {confirm: t('yes_i_am_sure')})
|
||||
.then =>
|
||||
@$pause().then angular.noop, ->
|
||||
InfoDialog.open 'error', t('admin.standing_orders.pause_failure_msg')
|
||||
|
||||
unpause: ->
|
||||
ConfirmDialog.open('error', t('admin.standing_orders.confirm_unpause_msg'), {confirm: t('yes_i_am_sure')})
|
||||
.then =>
|
||||
@$unpause().then angular.noop, ->
|
||||
InfoDialog.open 'error', t('admin.standing_orders.unpause_failure_msg')
|
||||
|
||||
cancelOrder: (order) ->
|
||||
if order.id?
|
||||
$http.put("/admin/standing_order_orders/#{order.id}/cancel").then (response) =>
|
||||
|
||||
@@ -12,6 +12,16 @@ angular.module("admin.standingOrders").factory 'StandingOrderResource', ($resour
|
||||
params:
|
||||
id: '@id'
|
||||
action: 'cancel'
|
||||
'pause':
|
||||
method: 'PUT'
|
||||
params:
|
||||
id: '@id'
|
||||
action: 'pause'
|
||||
'unpause':
|
||||
method: 'PUT'
|
||||
params:
|
||||
id: '@id'
|
||||
action: 'unpause'
|
||||
})
|
||||
|
||||
angular.extend(resource.prototype, StandingOrderPrototype)
|
||||
|
||||
Reference in New Issue
Block a user