5 angular.module('egItemReplaceBarcode',
6 ['ngRoute', 'ui.bootstrap', 'egCoreMod','egUiMod'])
8 .controller('ReplaceItemBarcodeCtrl',
10 function($scope , egCore) {
13 $scope.focusBarcode = true;
15 $scope.updateBarcode = function() {
16 $scope.copyNotFound = false;
17 $scope.duplicateBarcode = false;
18 $scope.updateOK = false;
20 egCore.pcrud.search('acp',
21 {deleted : 'f', barcode : $scope.barcode1})
22 .then(function(copy) {
25 $scope.focusBarcode = true;
26 $scope.copyNotFound = true;
30 egCore.pcrud.search('acp',
31 {deleted : 'f', barcode : $scope.barcode2})
32 .then(function(newBarcodeCopy) {
35 $scope.duplicateBarcode = true;
39 $scope.copyId = copy.id();
43 'open-ils.cat.update_copy_barcode',
44 egCore.auth.token(), $scope.copyId, $scope.barcode2
45 ).then(function(resp) {
46 var evt = egCore.evt.parse(resp);
48 console.log('toast 0 here 2', evt);
50 $scope.updateOK = true;
51 $scope.focusBarcode = true;