mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Add error message for case when schedule cannot be deleted
This commit is contained in:
committed by
Maikel Linke
parent
f9dbf61afc
commit
a83bdf16c9
@@ -31,6 +31,13 @@ angular.module("admin.orderCycles").directive 'scheduleDialog', ($window, $compi
|
||||
if confirm(t('are_you_sure'))
|
||||
Schedules.remove(scope.schedule).$promise.then (data) ->
|
||||
scope.close()
|
||||
, (response) ->
|
||||
errors = response.data.errors
|
||||
if errors?
|
||||
scope.errors.push errors[0]
|
||||
else
|
||||
scope.errors.push "Could not delete schedule: #{scope.schedule.name}"
|
||||
|
||||
|
||||
scope.loadMore = ->
|
||||
scope.showMore().then ->
|
||||
|
||||
@@ -39,12 +39,6 @@ angular.module("admin.resources").factory "Schedules", ($q, $injector, RequestMo
|
||||
orderCycle.schedules.splice(i, 1) for s, i in orderCycle.schedules by -1 when s.id == schedule.id
|
||||
delete @byID[schedule.id]
|
||||
StatusMessage.display 'success', "#{t('admin.order_cycles.index.deleted_schedule')}: '#{schedule.name}'"
|
||||
, (response) =>
|
||||
errors = response.data.errors
|
||||
if errors?
|
||||
InfoDialog.open 'error', errors[0]
|
||||
else
|
||||
InfoDialog.open 'error', "Could not delete schedule: #{schedule.name}"
|
||||
|
||||
index: ->
|
||||
request = ScheduleResource.index (data) => @load(data)
|
||||
|
||||
Reference in New Issue
Block a user