mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-02 02:11:33 +00:00
Adding UI to require action from user when pausing/cancelling standing order with open orders
This commit is contained in:
@@ -30,14 +30,24 @@ angular.module("admin.standingOrders").factory 'StandingOrderPrototype', ($http,
|
||||
cancel: ->
|
||||
ConfirmDialog.open('error', t('admin.standing_orders.confirm_cancel_msg'), {cancel: t('back'), confirm: t('yes_i_am_sure')})
|
||||
.then =>
|
||||
@$cancel().then angular.noop, ->
|
||||
InfoDialog.open 'error', t('admin.standing_orders.cancel_failure_msg')
|
||||
@$cancel().then angular.noop, (response) =>
|
||||
if response.data?.errors?.open_orders?
|
||||
options = {cancel: t('admin.standing_orders.no_keep_them'), confirm: t('admin.standing_orders.yes_cancel_them')}
|
||||
ConfirmDialog.open('error', response.data.errors.open_orders, options)
|
||||
.then (=> @$cancel(open_orders: 'cancel')), (=> @$cancel(open_orders: 'keep'))
|
||||
else
|
||||
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')
|
||||
@$pause().then angular.noop, (response) =>
|
||||
if response.data?.errors?.open_orders?
|
||||
options = {cancel: t('admin.standing_orders.no_keep_them'), confirm: t('admin.standing_orders.yes_cancel_them')}
|
||||
ConfirmDialog.open('error', response.data.errors.open_orders, options)
|
||||
.then (=> @$pause(open_orders: 'cancel')), (=> @$pause(open_orders: 'keep'))
|
||||
else
|
||||
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')})
|
||||
|
||||
@@ -12,11 +12,13 @@ angular.module("admin.standingOrders").factory 'StandingOrderResource', ($resour
|
||||
params:
|
||||
id: '@id'
|
||||
action: 'cancel'
|
||||
open_orders: '@open_orders'
|
||||
'pause':
|
||||
method: 'PUT'
|
||||
params:
|
||||
id: '@id'
|
||||
action: 'pause'
|
||||
open_orders: '@open_orders'
|
||||
'unpause':
|
||||
method: 'PUT'
|
||||
params:
|
||||
|
||||
@@ -859,6 +859,8 @@ en:
|
||||
confirm_unpause_msg: Are you sure you want to unpause this standing order?
|
||||
unpause_failure_msg: 'Sorry, unpausing failed!'
|
||||
confirm_cancel_open_orders_msg: "Some orders for this standing order are currently open. The customer has already been notified that the order will be placed. Would you like to cancel these order(s) or keep them?"
|
||||
yes_cancel_them: Cancel them
|
||||
no_keep_them: Keep them
|
||||
order_update_issues_msg: Some orders could not be automatically updated, this is most likely because they have been manually edited. Please review the issues listed below and make any adjustments to individual orders if required.
|
||||
no_results:
|
||||
no_standing_orders: No standing orders yet...
|
||||
|
||||
Reference in New Issue
Block a user