mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Order cycle interface may update or update and close
This commit is contained in:
@@ -74,9 +74,8 @@ angular.module('admin.orderCycles')
|
||||
$scope.removeDistributionOfVariant = (variant_id) ->
|
||||
OrderCycle.removeDistributionOfVariant(variant_id)
|
||||
|
||||
$scope.submit = (event) ->
|
||||
event.preventDefault()
|
||||
OrderCycle.create()
|
||||
$scope.submit = (destination) ->
|
||||
OrderCycle.create(destination)
|
||||
])
|
||||
|
||||
.controller('AdminEditOrderCycleCtrl', ['$scope', '$filter', '$location', 'OrderCycle', 'Enterprise', 'EnterpriseFee', ($scope, $filter, $location, OrderCycle, Enterprise, EnterpriseFee) ->
|
||||
@@ -155,9 +154,8 @@ angular.module('admin.orderCycles')
|
||||
$scope.removeDistributionOfVariant = (variant_id) ->
|
||||
OrderCycle.removeDistributionOfVariant(variant_id)
|
||||
|
||||
$scope.submit = (event) ->
|
||||
event.preventDefault()
|
||||
OrderCycle.update()
|
||||
$scope.submit = (destination) ->
|
||||
OrderCycle.update(destination)
|
||||
])
|
||||
|
||||
.config(['$httpProvider', ($httpProvider) ->
|
||||
|
||||
@@ -39,7 +39,6 @@ angular.module('admin.orderCycles').controller "AdminSimpleCreateOrderCycleCtrl"
|
||||
$scope.enterpriseFeesForEnterprise = (enterprise_id) ->
|
||||
EnterpriseFee.forEnterprise(parseInt(enterprise_id))
|
||||
|
||||
$scope.submit = (event) ->
|
||||
event.preventDefault()
|
||||
$scope.submit = (destination) ->
|
||||
OrderCycle.mirrorIncomingToOutgoingProducts()
|
||||
OrderCycle.create()
|
||||
OrderCycle.create(destination)
|
||||
|
||||
@@ -32,7 +32,6 @@ angular.module('admin.orderCycles').controller "AdminSimpleEditOrderCycleCtrl",
|
||||
$event.preventDefault()
|
||||
OrderCycle.removeCoordinatorFee(index)
|
||||
|
||||
$scope.submit = (event) ->
|
||||
event.preventDefault()
|
||||
$scope.submit = (destination) ->
|
||||
OrderCycle.mirrorIncomingToOutgoingProducts()
|
||||
OrderCycle.update()
|
||||
OrderCycle.update(destination)
|
||||
|
||||
@@ -123,19 +123,19 @@ angular.module('admin.orderCycles').factory('OrderCycle', ($resource, $window) -
|
||||
|
||||
this.order_cycle
|
||||
|
||||
create: ->
|
||||
create: (destination) ->
|
||||
oc = new OrderCycle({order_cycle: this.dataForSubmit()})
|
||||
oc.$create (data) ->
|
||||
if data['success']
|
||||
$window.location = '/admin/order_cycles'
|
||||
$window.location = destination
|
||||
else
|
||||
console.log('Failed to create order cycle')
|
||||
|
||||
update: ->
|
||||
update: (destination) ->
|
||||
oc = new OrderCycle({order_cycle: this.dataForSubmit()})
|
||||
oc.$update {order_cycle_id: this.order_cycle.id}, (data) ->
|
||||
if data['success']
|
||||
$window.location = '/admin/order_cycles'
|
||||
$window.location = destination
|
||||
else
|
||||
console.log('Failed to update order cycle')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user