mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-12 03:50:22 +00:00
Using same serializer for standing order index and edit pages
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
angular.module("admin.standingOrders").controller "ProductsPanelController", ($scope) ->
|
||||
$scope.standingOrder = $scope.object
|
||||
$scope.distributor_id = $scope.standingOrder.shop.id
|
||||
$scope.distributor_id = $scope.standingOrder.shop_id
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
angular.module("admin.standingOrders").controller "StandingOrdersController", ($scope, StandingOrders, Columns, shops) ->
|
||||
angular.module("admin.standingOrders").controller "StandingOrdersController", ($scope, StandingOrders, Columns, shops, ShippingMethods, PaymentMethods) ->
|
||||
$scope.columns = Columns.columns
|
||||
$scope.shops = shops
|
||||
$scope.shop_id = if shops.length == 1 then shops[0].id else null
|
||||
$scope.shippingMethodsByID = ShippingMethods.byID
|
||||
$scope.paymentMethodsByID = PaymentMethods.byID
|
||||
|
||||
$scope.$watch "shop_id", ->
|
||||
if $scope.shop_id?
|
||||
# CurrentShop.shop = $filter('filter')($scope.shops, {id: $scope.shop_id})[0]
|
||||
$scope.standingOrders = StandingOrders.index("q[shop_id_eq]": $scope.shop_id, ams_prefix: 'index')
|
||||
$scope.standingOrders = StandingOrders.index("q[shop_id_eq]": $scope.shop_id)
|
||||
|
||||
$scope.itemCount = (standingOrder) ->
|
||||
standingOrder.standing_line_items.reduce (sum, sli) ->
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
angular.module("admin.standingOrders").factory 'StandingOrderPrototype', ($http, InfoDialog, StatusMessage) ->
|
||||
errors: {}
|
||||
|
||||
buildItem: (item, ams_prefix) ->
|
||||
buildItem: (item) ->
|
||||
return false unless item.variant_id > 0
|
||||
return false unless item.quantity > 0
|
||||
data = angular.extend({}, item, { shop_id: @shop_id, schedule_id: @schedule_id })
|
||||
|
||||
Reference in New Issue
Block a user