mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-19 04:49:15 +00:00
Rename supplier to enterprise
This commit is contained in:
@@ -3,7 +3,7 @@ angular.module("admin.productImport").controller "ImportFormCtrl", ($scope, $htt
|
||||
$scope.entries = {}
|
||||
$scope.update_counts = {}
|
||||
$scope.reset_counts = {}
|
||||
$scope.supplier_product_counts = ams_data.supplier_product_counts
|
||||
$scope.enterprise_product_counts = ams_data.enterprise_product_counts
|
||||
|
||||
$scope.updates = {}
|
||||
$scope.updated_total = 0
|
||||
@@ -19,7 +19,7 @@ angular.module("admin.productImport").controller "ImportFormCtrl", ($scope, $htt
|
||||
}
|
||||
|
||||
$scope.countResettable = () ->
|
||||
angular.forEach $scope.supplier_product_counts, (value, key) ->
|
||||
angular.forEach $scope.enterprise_product_counts, (value, key) ->
|
||||
$scope.reset_counts[key] = value
|
||||
if $scope.update_counts[key]
|
||||
$scope.reset_counts[key] -= $scope.update_counts[key]
|
||||
|
||||
@@ -17,7 +17,7 @@ angular.module("admin.productImport").controller "ImportOptionsFormCtrl", ($scop
|
||||
confirmed = confirm t('js.product_import.confirmation') if checked
|
||||
|
||||
if confirmed or !checked
|
||||
ProductImportService.updateResetAbsent($scope.supplierId, $scope.reset_counts[$scope.supplierId], checked)
|
||||
ProductImportService.updateResetAbsent($scope.enterpriseId, $scope.reset_counts[$scope.enterpriseId], checked)
|
||||
else
|
||||
$scope.settings['reset_all_absent'] = false
|
||||
|
||||
|
||||
@@ -18,15 +18,15 @@ angular.module("admin.productImport").filter 'entriesFilterValid', ->
|
||||
|
||||
filtered
|
||||
|
||||
angular.module("admin.productImport").filter 'entriesFilterSupplier', ->
|
||||
(entries, supplier) ->
|
||||
if supplier == 'all'
|
||||
angular.module("admin.productImport").filter 'entriesFilterEnterprise', ->
|
||||
(entries, enterprise) ->
|
||||
if enterprise == 'all'
|
||||
return entries
|
||||
|
||||
filtered = {}
|
||||
|
||||
angular.forEach entries, (entry, line_number) ->
|
||||
if supplier == entry.attributes['supplier']
|
||||
if enterprise == entry.attributes['enterprise']
|
||||
filtered[line_number] = entry
|
||||
|
||||
filtered
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
angular.module("admin.productImport").factory "ProductImportService", ($rootScope) ->
|
||||
new class ProductImportService
|
||||
suppliers: {}
|
||||
enterprises: {}
|
||||
resetTotal: 0
|
||||
settings: {}
|
||||
|
||||
updateResetAbsent: (supplierId, resetCount, resetAbsent) ->
|
||||
updateResetAbsent: (enterpriseId, resetCount, resetAbsent) ->
|
||||
if resetAbsent
|
||||
@suppliers[supplierId] = resetCount
|
||||
@enterprises[enterpriseId] = resetCount
|
||||
@resetTotal += resetCount
|
||||
else
|
||||
@suppliers[supplierId] = null
|
||||
@enterprises[enterpriseId] = null
|
||||
@resetTotal -= resetCount
|
||||
|
||||
$rootScope.resetTotal = @resetTotal
|
||||
|
||||
Reference in New Issue
Block a user