Commit 457fa3d0c937a8fb7fbda819ab3c55083f7ff3cc
1 parent
8ce4d56442
Exists in
master
Removí console.logs
Showing
1 changed file
with
0 additions
and
2 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaAbmPreciosCondiciones') | 1 | angular.module('focaAbmPreciosCondiciones') |
2 | .controller('focaAbmPreciosCondicionesController', [ | 2 | .controller('focaAbmPreciosCondicionesController', [ |
3 | '$scope', 'focaAbmPreciosCondicionesService', '$location', '$uibModal', | 3 | '$scope', 'focaAbmPreciosCondicionesService', '$location', '$uibModal', |
4 | function($scope, focaAbmPreciosCondicionesService, $location, $uibModal) { | 4 | function($scope, focaAbmPreciosCondicionesService, $location, $uibModal) { |
5 | focaAbmPreciosCondicionesService.obtenerPreciosCondiciones().then(function(datos) { | 5 | focaAbmPreciosCondicionesService.obtenerPreciosCondiciones().then(function(datos) { |
6 | $scope.preciosCondiciones = datos.data; | 6 | $scope.preciosCondiciones = datos.data; |
7 | }); | 7 | }); |
8 | $scope.editar = function(id) { | 8 | $scope.editar = function(id) { |
9 | $location.path('/precio-condicion/' + id); | 9 | $location.path('/precio-condicion/' + id); |
10 | }; | 10 | }; |
11 | $scope.solicitarConfirmacion = function(precioCondicion) { | 11 | $scope.solicitarConfirmacion = function(precioCondicion) { |
12 | $uibModal.open({ | 12 | $uibModal.open({ |
13 | templateUrl: 'foca-abm-precios-condiciones-modal-confirmar.html', | 13 | templateUrl: 'foca-abm-precios-condiciones-modal-confirmar.html', |
14 | controller: 'focaAbmPreciosCondicionesModalConfirmarController', | 14 | controller: 'focaAbmPreciosCondicionesModalConfirmarController', |
15 | animation: false, | 15 | animation: false, |
16 | backdrop: false, | 16 | backdrop: false, |
17 | resolve: {precioCondicion: function(){return precioCondicion;}} | 17 | resolve: {precioCondicion: function(){return precioCondicion;}} |
18 | }) | 18 | }) |
19 | .result.then(function(precioCondicion){ | 19 | .result.then(function(precioCondicion){ |
20 | focaAbmPreciosCondicionesService.borrarPrecioCondicion(precioCondicion.id); | 20 | focaAbmPreciosCondicionesService.borrarPrecioCondicion(precioCondicion.id); |
21 | $scope.preciosCondiciones.splice( | 21 | $scope.preciosCondiciones.splice( |
22 | $scope.preciosCondiciones.indexOf(precioCondicion), 1 | 22 | $scope.preciosCondiciones.indexOf(precioCondicion), 1 |
23 | ); | 23 | ); |
24 | }); | 24 | }); |
25 | }; | 25 | }; |
26 | } | 26 | } |
27 | ]) | 27 | ]) |
28 | .controller('focaAbmPrecioCondicionController', [ | 28 | .controller('focaAbmPrecioCondicionController', [ |
29 | '$scope', 'focaAbmPreciosCondicionesService', | 29 | '$scope', 'focaAbmPreciosCondicionesService', |
30 | '$routeParams', '$location', '$uibModal', | 30 | '$routeParams', '$location', '$uibModal', |
31 | function( | 31 | function( |
32 | $scope, focaAbmPreciosCondicionesService, | 32 | $scope, focaAbmPreciosCondicionesService, |
33 | $routeParams, $location, $uibModal | 33 | $routeParams, $location, $uibModal |
34 | ) { | 34 | ) { |
35 | focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id) | 35 | focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id) |
36 | .then(function(datos) { | 36 | .then(function(datos) { |
37 | $scope.precioCondicion = { | 37 | $scope.precioCondicion = { |
38 | id: 0, | 38 | id: 0, |
39 | codigo: '', | 39 | codigo: '', |
40 | nombre: '', | 40 | nombre: '', |
41 | descripcion: '', | 41 | descripcion: '', |
42 | idListaPrecio: 0, | 42 | idListaPrecio: 0, |
43 | vigencia: new Date() | 43 | vigencia: new Date() |
44 | }; | 44 | }; |
45 | if(datos.data.id) { | 45 | if(datos.data.id) { |
46 | $scope.precioCondicion = datos.data; | 46 | $scope.precioCondicion = datos.data; |
47 | focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id) | 47 | focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id) |
48 | .then(function(datos){ | 48 | .then(function(datos){ |
49 | $scope.precioCondicion.plazos = datos.data; | 49 | $scope.precioCondicion.plazos = datos.data; |
50 | }); | 50 | }); |
51 | } | 51 | } |
52 | }); | 52 | }); |
53 | $scope.cancelar = function() { | 53 | $scope.cancelar = function() { |
54 | $location.path('/precio-condicion'); | 54 | $location.path('/precio-condicion'); |
55 | }; | 55 | }; |
56 | $scope.guardar = function(precioCondicion) { | 56 | $scope.guardar = function(precioCondicion) { |
57 | focaAbmPreciosCondicionesService.guardarPrecioCondicion(precioCondicion) | 57 | focaAbmPreciosCondicionesService.guardarPrecioCondicion(precioCondicion) |
58 | .then(function() { | 58 | .then(function() { |
59 | $location.path('/precio-condicion'); | 59 | $location.path('/precio-condicion'); |
60 | }); | 60 | }); |
61 | }; | 61 | }; |
62 | $scope.editarPlazoPago = function(id) { | 62 | $scope.editarPlazoPago = function(id) { |
63 | $location.path( | 63 | $location.path( |
64 | '/precio-condicion/' + $scope.precioCondicion.id + | 64 | '/precio-condicion/' + $scope.precioCondicion.id + |
65 | '/plazo-pago/' + id | 65 | '/plazo-pago/' + id |
66 | ); | 66 | ); |
67 | }; | 67 | }; |
68 | $scope.solicitarConfirmacionPlazoPago = function(plazoPago) { | 68 | $scope.solicitarConfirmacionPlazoPago = function(plazoPago) { |
69 | $uibModal.open({ | 69 | $uibModal.open({ |
70 | templateUrl: 'foca-abm-plazos-pago-modal-confirmar.html', | 70 | templateUrl: 'foca-abm-plazos-pago-modal-confirmar.html', |
71 | controller: 'focaAbmPlazosPagosModalConfirmarController', | 71 | controller: 'focaAbmPlazosPagosModalConfirmarController', |
72 | animation: false, | 72 | animation: false, |
73 | backdrop: false, | 73 | backdrop: false, |
74 | resolve: {plazoPago: function(){return plazoPago;}} | 74 | resolve: {plazoPago: function(){return plazoPago;}} |
75 | }) | 75 | }) |
76 | .result.then(function(plazoPago){ | 76 | .result.then(function(plazoPago){ |
77 | console.log(plazoPago); | ||
78 | console.log($scope.precioCondicion); | ||
79 | focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id); | 77 | focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id); |
80 | $scope.precioCondicion.plazos.splice( | 78 | $scope.precioCondicion.plazos.splice( |
81 | $scope.precioCondicion.plazos.indexOf(plazoPago), 1 | 79 | $scope.precioCondicion.plazos.indexOf(plazoPago), 1 |
82 | ); | 80 | ); |
83 | }); | 81 | }); |
84 | } | 82 | } |
85 | } | 83 | } |
86 | ]) | 84 | ]) |
87 | .controller('focaAbmPreciosCondicionesModalConfirmarController', [ | 85 | .controller('focaAbmPreciosCondicionesModalConfirmarController', [ |
88 | '$uibModalInstance', '$scope', 'precioCondicion', | 86 | '$uibModalInstance', '$scope', 'precioCondicion', |
89 | function($uibModalInstance, $scope, precioCondicion) { | 87 | function($uibModalInstance, $scope, precioCondicion) { |
90 | $scope.precioCondicion = precioCondicion; | 88 | $scope.precioCondicion = precioCondicion; |
91 | $scope.cancelar = function() { | 89 | $scope.cancelar = function() { |
92 | $uibModalInstance.dismiss(); | 90 | $uibModalInstance.dismiss(); |
93 | }; | 91 | }; |
94 | $scope.borrar = function() { | 92 | $scope.borrar = function() { |
95 | $uibModalInstance.close(precioCondicion); | 93 | $uibModalInstance.close(precioCondicion); |
96 | }; | 94 | }; |
97 | } | 95 | } |
98 | ]) | 96 | ]) |
99 | .controller('focaAbmPlazosPagosModalConfirmarController', [ | 97 | .controller('focaAbmPlazosPagosModalConfirmarController', [ |
100 | '$uibModalInstance', '$scope', 'plazoPago', | 98 | '$uibModalInstance', '$scope', 'plazoPago', |
101 | function($uibModalInstance, $scope, plazoPago) { | 99 | function($uibModalInstance, $scope, plazoPago) { |
102 | $scope.plazoPago = plazoPago; | 100 | $scope.plazoPago = plazoPago; |
103 | $scope.cancelar = function() { | 101 | $scope.cancelar = function() { |
104 | $uibModalInstance.dismiss(); | 102 | $uibModalInstance.dismiss(); |
105 | }; | 103 | }; |
106 | $scope.borrar = function() { | 104 | $scope.borrar = function() { |
107 | $uibModalInstance.close(plazoPago); | 105 | $uibModalInstance.close(plazoPago); |
108 | }; | 106 | }; |
109 | } | 107 | } |
110 | ]); | 108 | ]); |
111 | 109 |