We should load orders that are linked to line_items displayed

This should not be related to any pagination, search or whatever: actually we consolidate line_items with order additional info based on line_items.order.id.
This commit is contained in:
Jean-Baptiste Bellet
2023-02-03 11:40:07 +01:00
parent 06cbc120f5
commit d00e75de70

View File

@@ -53,18 +53,8 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
$scope.dereferenceLoadedData()
$scope.loadOrders = ->
[formattedStartDate, formattedEndDate] = $scope.formatDates($scope.startDate, $scope.endDate)
RequestMonitor.load $scope.orders = Orders.index(
"q[state_not_eq]": "canceled",
"q[shipment_state_not_eq]": "shipped",
"q[completed_at_not_null]": "true",
"q[distributor_id_eq]": $scope.distributorFilter,
"q[order_cycle_id_eq]": $scope.orderCycleFilter,
"q[completed_at_gteq]": if formattedStartDate then formattedStartDate else undefined,
"q[completed_at_lt]": if formattedEndDate then formattedEndDate else undefined,
"page": $scope.page,
"per_page": $scope.per_page
"q[id_in][]": $scope.line_items.map((line_item) -> line_item.order.id)
)
$scope.loadLineItems = ->