mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
Allow removing customer codes
This commit is contained in:
@@ -14,11 +14,13 @@ angular.module("admin.customers").controller "customersCtrl", ($scope, $q, Custo
|
||||
$scope.customers = data
|
||||
|
||||
$scope.checkForDuplicateCodes = ->
|
||||
customers = $scope.findByCode(this.customer.code)
|
||||
if (customers.length > 1)
|
||||
this.duplicate = true
|
||||
else
|
||||
this.duplicate = false
|
||||
delete this.customer.code unless this.customer.code
|
||||
this.duplicate = $scope.isDuplicateCode(this.customer.code)
|
||||
|
||||
$scope.isDuplicateCode = (code) ->
|
||||
return false unless code
|
||||
customers = $scope.findByCode(code)
|
||||
customers.length > 1
|
||||
|
||||
$scope.findByCode = (code) ->
|
||||
if $scope.customers
|
||||
|
||||
Reference in New Issue
Block a user