PI reset absent products

This commit is contained in:
Matt-Yorkley
2017-03-05 21:16:07 +00:00
committed by Rob Harrington
parent 14fb40a996
commit 24fcc3dd34
8 changed files with 177 additions and 29 deletions

View File

@@ -0,0 +1,9 @@
angular.module("ofn.admin").controller "ImportOptionsFormCtrl", ($scope, $timeout, $rootScope, ProductImportService) ->
$scope.toggleResetAbsent = () ->
ProductImportService.updateResetAbsent($scope.supplierId, $scope.nonUpdated, $scope.resetAbsent)
$scope.resetCount = ProductImportService.resetCount
$rootScope.$watch 'resetCount', (newValue) ->
$scope.resetCount = newValue if newValue || newValue == 0

View File

@@ -0,0 +1,15 @@
angular.module("ofn.admin").factory "ProductImportService", ($rootScope, $timeout) ->
new class ProductImportService
suppliers: {}
resetCount: 0
updateResetAbsent: (supplierId, nonUpdated, resetAbsent) ->
if resetAbsent
@suppliers[supplierId] = nonUpdated
@resetCount += nonUpdated
else
@suppliers[supplierId] = null
@resetCount -= nonUpdated
$rootScope.resetCount = @resetCount