mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-06 02:51:34 +00:00
Issues with updating orders are reported when saving standing orders
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
angular.module("admin.standingOrders").controller "OrderUpdateIssuesController", ($scope, OrderCycles) ->
|
||||
$scope.proxyOrders = $scope.options.proxyOrders
|
||||
|
||||
$scope.orderCycleName = (id) ->
|
||||
OrderCycles.byID[id].name
|
||||
|
||||
$scope.orderCycleCloses = (id) ->
|
||||
closes_at = moment(OrderCycles.byID[id].orders_close_at)
|
||||
text = if closes_at > moment() then t('closes') else t('closed')
|
||||
"#{text} #{closes_at.fromNow()}"
|
||||
@@ -29,6 +29,9 @@ angular.module("admin.standingOrders").factory 'StandingOrderPrototype', ($http,
|
||||
@$update().then (response) =>
|
||||
StatusMessage.display 'success', 'Saved'
|
||||
$injector.get('StandingOrders').afterUpdate(@id) if $injector.has('StandingOrders')
|
||||
orders_with_issues = @not_closed_proxy_orders.filter((po) -> po.update_issues.length > 0)
|
||||
if orders_with_issues.length > 0
|
||||
InfoDialog.open('error', null, 'admin/order_update_issues_dialog.html', { proxyOrders: orders_with_issues})
|
||||
, (response) =>
|
||||
StatusMessage.display 'failure', 'Oh no! I was unable to save your changes.'
|
||||
angular.extend(@errors, response.data.errors)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
angular.module("admin.utils").factory 'InfoDialog', ($rootScope, $compile, $injector, $templateCache, DialogDefaults) ->
|
||||
new class InfoDialog
|
||||
open: (type, message) ->
|
||||
open: (type, message, templateUrl='admin/info_dialog.html', options={}) ->
|
||||
scope = $rootScope.$new()
|
||||
scope.message = message
|
||||
scope.dialog_class = type
|
||||
template = $compile($templateCache.get('admin/info_dialog.html'))(scope)
|
||||
scope.options = options
|
||||
template = $compile($templateCache.get(templateUrl))(scope)
|
||||
template.dialog(DialogDefaults)
|
||||
template.dialog('open')
|
||||
scope.close = ->
|
||||
|
||||
Reference in New Issue
Block a user