Commit bff8dac831ffbd403d71998113ba4f80e83cc662
1 parent
a54b9add51
Exists in
master
espacios alrededor de +
Showing
1 changed file
with
2 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', 'focaModalService', | 3 | '$scope', 'focaAbmPreciosCondicionesService', '$location', 'focaModalService', |
| 4 | function($scope, focaAbmPreciosCondicionesService, $location, focaModalService) { | 4 | function($scope, focaAbmPreciosCondicionesService, $location, focaModalService) { |
| 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 | focaModalService.confirm('¿Está seguro que desea borrar el precio condición' + | 12 | focaModalService.confirm('¿Está seguro que desea borrar el precio condición' + |
| 13 | precioCondicion.codigo + ' ' + precioCondicion.nombre + ' ?').then( | 13 | precioCondicion.codigo + ' ' + precioCondicion.nombre + ' ?').then( |
| 14 | function(data) { | 14 | function(data) { |
| 15 | if (data) { | 15 | if (data) { |
| 16 | focaAbmPreciosCondicionesService | 16 | focaAbmPreciosCondicionesService |
| 17 | .borrarPrecioCondicion(precioCondicion.id); | 17 | .borrarPrecioCondicion(precioCondicion.id); |
| 18 | $scope.preciosCondiciones.splice( | 18 | $scope.preciosCondiciones.splice( |
| 19 | $scope.preciosCondiciones.indexOf(precioCondicion), 1 | 19 | $scope.preciosCondiciones.indexOf(precioCondicion), 1 |
| 20 | ); | 20 | ); |
| 21 | } | 21 | } |
| 22 | } | 22 | } |
| 23 | ); | 23 | ); |
| 24 | }; | 24 | }; |
| 25 | } | 25 | } |
| 26 | ]) | 26 | ]) |
| 27 | .controller('focaAbmPrecioCondicionController', [ | 27 | .controller('focaAbmPrecioCondicionController', [ |
| 28 | '$scope', 'focaAbmPreciosCondicionesService', | 28 | '$scope', 'focaAbmPreciosCondicionesService', |
| 29 | '$routeParams', '$location', 'focaModalService', | 29 | '$routeParams', '$location', 'focaModalService', |
| 30 | function( | 30 | function( |
| 31 | $scope, focaAbmPreciosCondicionesService, | 31 | $scope, focaAbmPreciosCondicionesService, |
| 32 | $routeParams, $location, focaModalService | 32 | $routeParams, $location, focaModalService |
| 33 | ) { | 33 | ) { |
| 34 | $scope.mostrarPlazos = $routeParams.id > 0; | 34 | $scope.mostrarPlazos = $routeParams.id > 0; |
| 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 | focaModalService.confirm('¿Está seguro que desea borrar el plazo de pago '+ | 69 | focaModalService.confirm('¿Está seguro que desea borrar el plazo de pago ' + |
| 70 | plazoPago.item+' '+plazoPago.dias + ' ?').then( | 70 | plazoPago.item + ' ' + plazoPago.dias + ' ?').then( |
| 71 | function(confirm) { | 71 | function(confirm) { |
| 72 | if (confirm) { | 72 | if (confirm) { |
| 73 | focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id); | 73 | focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id); |
| 74 | $scope.precioCondicion.plazos.splice( | 74 | $scope.precioCondicion.plazos.splice( |
| 75 | $scope.precioCondicion.plazos.indexOf(plazoPago), 1 | 75 | $scope.precioCondicion.plazos.indexOf(plazoPago), 1 |
| 76 | ); | 76 | ); |
| 77 | } | 77 | } |
| 78 | } | 78 | } |
| 79 | ); | 79 | ); |
| 80 | }; | 80 | }; |
| 81 | } | 81 | } |
| 82 | ]); | 82 | ]); |
| 83 | 83 |