mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-20 00:37:26 +00:00
PI reset absent products
This commit is contained in:
committed by
Rob Harrington
parent
14fb40a996
commit
24fcc3dd34
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user