Commit d3007d3ea6578abf30a2be7226484adc9a3e56c8
1 parent
a5d9bb2a23
Exists in
master
Al cancelar debe ir a precio-condicion.
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaAbmPlazoPago') | 1 | angular.module('focaAbmPlazoPago') |
2 | .controller('focaAbmPlazosPagoController', [ | 2 | .controller('focaAbmPlazosPagoController', [ |
3 | '$scope', 'focaAbmPlazoPagoService', '$location', '$uibModal', | 3 | '$scope', 'focaAbmPlazoPagoService', '$location', '$uibModal', |
4 | function($scope, focaAbmPlazoPagoService, $location, $uibModal) { | 4 | function($scope, focaAbmPlazoPagoService, $location, $uibModal) { |
5 | focaAbmPlazoPagoService.obtenerPlazosPago().then(function(datos) { | 5 | focaAbmPlazoPagoService.obtenerPlazosPago().then(function(datos) { |
6 | $scope.plazosPago = datos.data; | 6 | $scope.plazosPago = datos.data; |
7 | }); | 7 | }); |
8 | $scope.editar = function(id) { | 8 | $scope.editar = function(id) { |
9 | $location.path('/plazo-pago/' + id); | 9 | $location.path('/plazo-pago/' + id); |
10 | }; | 10 | }; |
11 | $scope.solicitarConfirmacion = function(plazoPago) { | 11 | $scope.solicitarConfirmacion = function(plazoPago) { |
12 | $uibModal.open({ | 12 | $uibModal.open({ |
13 | templateUrl: 'foca-abm-plazos-pago-modal-confirmar.html', | 13 | templateUrl: 'foca-abm-plazos-pago-modal-confirmar.html', |
14 | controller: 'focaAbmPlazosPagoModalConfirmarController', | 14 | controller: 'focaAbmPlazosPagoModalConfirmarController', |
15 | animation: false, | 15 | animation: false, |
16 | backdrop: false, | 16 | backdrop: false, |
17 | resolve: {plazoPago: function(){return plazoPago;}} | 17 | resolve: {plazoPago: function(){return plazoPago;}} |
18 | }) | 18 | }) |
19 | .result.then(function(plazoPago){ | 19 | .result.then(function(plazoPago){ |
20 | focaAbmPlazoPagoService.borrarPlazoPago(plazoPago.id); | 20 | focaAbmPlazoPagoService.borrarPlazoPago(plazoPago.id); |
21 | $scope.plazosPago.splice( | 21 | $scope.plazosPago.splice( |
22 | $scope.plazosPago.indexOf(plazoPago), 1 | 22 | $scope.plazosPago.indexOf(plazoPago), 1 |
23 | ); | 23 | ); |
24 | }); | 24 | }); |
25 | }; | 25 | }; |
26 | } | 26 | } |
27 | ]) | 27 | ]) |
28 | .controller('focaAbmPlazoPagoController', [ | 28 | .controller('focaAbmPlazoPagoController', [ |
29 | '$scope', 'focaAbmPlazoPagoService', | 29 | '$scope', 'focaAbmPlazoPagoService', |
30 | '$routeParams', '$location', | 30 | '$routeParams', '$location', |
31 | function( | 31 | function( |
32 | $scope, focaAbmPlazoPagoService, | 32 | $scope, focaAbmPlazoPagoService, |
33 | $routeParams, $location | 33 | $routeParams, $location |
34 | ) { | 34 | ) { |
35 | focaAbmPlazoPagoService.obtenerPlazoPago($routeParams.id) | 35 | focaAbmPlazoPagoService.obtenerPlazoPago($routeParams.id) |
36 | .then(function(datos) { | 36 | .then(function(datos) { |
37 | $scope.plazoPago = { | 37 | $scope.plazoPago = { |
38 | id: 0, | 38 | id: 0, |
39 | idPreciosCondiciones: $routeParams.idPreciosCondiciones, | 39 | idPreciosCondiciones: $routeParams.idPreciosCondiciones, |
40 | item: '', | 40 | item: '', |
41 | dias: '' | 41 | dias: '' |
42 | }; | 42 | }; |
43 | if(datos.data.id) { | 43 | if(datos.data.id) { |
44 | $scope.plazoPago = datos.data; | 44 | $scope.plazoPago = datos.data; |
45 | } | 45 | } |
46 | }); | 46 | }); |
47 | $scope.cancelar = function() { | 47 | $scope.cancelar = function() { |
48 | $location.path('/plazo-pago'); | 48 | $location.path('/precio-condicion/' + $routeParams.idPreciosCondiciones); |
49 | }; | 49 | }; |
50 | $scope.guardar = function(plazoPago) { | 50 | $scope.guardar = function(plazoPago) { |
51 | focaAbmPlazoPagoService.guardarPlazoPago(plazoPago) | 51 | focaAbmPlazoPagoService.guardarPlazoPago(plazoPago) |
52 | .then(function() { | 52 | .then(function() { |
53 | $location.path('/precio-condicion/' + $routeParams.idPreciosCondiciones); | 53 | $location.path('/precio-condicion/' + $routeParams.idPreciosCondiciones); |
54 | }); | 54 | }); |
55 | }; | 55 | }; |
56 | } | 56 | } |
57 | ]) | 57 | ]) |
58 | .controller('focaAbmPlazosPagoModalConfirmarController', [ | 58 | .controller('focaAbmPlazosPagoModalConfirmarController', [ |
59 | '$uibModalInstance', '$scope', 'plazoPago', | 59 | '$uibModalInstance', '$scope', 'plazoPago', |
60 | function($uibModalInstance, $scope, plazoPago) { | 60 | function($uibModalInstance, $scope, plazoPago) { |
61 | $scope.plazoPago = plazoPago; | 61 | $scope.plazoPago = plazoPago; |
62 | $scope.cancelar = function() { | 62 | $scope.cancelar = function() { |
63 | $uibModalInstance.dismiss(); | 63 | $uibModalInstance.dismiss(); |
64 | }; | 64 | }; |
65 | $scope.borrar = function() { | 65 | $scope.borrar = function() { |
66 | $uibModalInstance.close(plazoPago); | 66 | $uibModalInstance.close(plazoPago); |
67 | }; | 67 | }; |
68 | } | 68 | } |
69 | ]); | 69 | ]); |
70 | 70 |