All methods on StandingOrder service are instance methods, StandingOrders service loads instances of StandingOrder

This commit is contained in:
Rob Harrington
2016-11-24 15:46:34 +11:00
parent 6f4c9070f6
commit 05bc2bd293
3 changed files with 16 additions and 18 deletions

View File

@@ -1,19 +1,19 @@
angular.module("admin.standingOrders").controller "StandingOrderController", ($scope, StandingOrder, customers, schedules, paymentMethods, shippingMethods) ->
$scope.standingOrder = StandingOrder.standingOrder
$scope.standingOrder = new StandingOrder()
$scope.customers = customers
$scope.schedules = schedules
$scope.paymentMethods = paymentMethods
$scope.shippingMethods = shippingMethods
$scope.errors = StandingOrder.errors
$scope.errors = $scope.standingOrder.errors
$scope.distributor_id = $scope.standingOrder.shop_id # variant selector requires distributor_id
$scope.view = if $scope.standingOrder.id? then 'review' else 'details'
$scope.save = ->
$scope.standing_order_form.$setPristine()
if $scope.standingOrder.id?
StandingOrder.update()
$scope.standingOrder.update()
else
StandingOrder.create()
$scope.standingOrder.create()
$scope.setView = (view) -> $scope.view = view