Bulk Actions only apply to visible line items

This commit is contained in:
Rob H
2014-03-20 16:54:24 +11:00
parent 43863069e9
commit 048b8b43cc
2 changed files with 26 additions and 5 deletions

View File

@@ -202,18 +202,18 @@ orderManagementModule.controller "AdminOrderMgmtCtrl", [
$scope.deleteSelected = ->
existingState = $scope.confirmDelete
$scope.confirmDelete = false
$scope.deleteLineItem lineItem for lineItem in $scope.lineItems when lineItem.checked
$scope.deleteLineItem lineItem for lineItem in $scope.filteredLineItems when lineItem.checked
$scope.confirmDelete = existingState
$scope.allBoxesChecked = ->
checkedCount = $scope.lineItems.reduce (count,lineItem) ->
checkedCount = $scope.filteredLineItems.reduce (count,lineItem) ->
count + (if lineItem.checked then 1 else 0 )
, 0
checkedCount == $scope.lineItems.length
checkedCount == $scope.filteredLineItems.length
$scope.toggleAllCheckboxes = ->
changeTo = !$scope.allBoxesChecked()
lineItem.checked = changeTo for lineItem in $scope.lineItems
lineItem.checked = changeTo for lineItem in $scope.filteredLineItems
$scope.setSelectedUnitsVariant = (unitsVariant) ->
$scope.selectedUnitsVariant = unitsVariant