Commit 915a5e6d504c81d87f6d4aea919c950b7b4baa10
1 parent
580887952e
Exists in
master
linea al final del archivo
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
src/js/controllerCisterna.js
| 1 | angular.module('focaAbmVehiculo') | 1 | angular.module('focaAbmVehiculo') |
| 2 | .controller('focaAbmVehiculoCisternaController', [ | 2 | .controller('focaAbmVehiculoCisternaController', [ |
| 3 | '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', | 3 | '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', |
| 4 | 'focaModalService', | 4 | 'focaModalService', |
| 5 | function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, | 5 | function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, |
| 6 | focaModalService) { | 6 | focaModalService) { |
| 7 | $scope.editar = false; | 7 | $scope.editar = false; |
| 8 | $scope.cisterna = { | 8 | $scope.cisterna = { |
| 9 | cisternaCarga: { | 9 | cisternaCarga: { |
| 10 | articulo: {} | 10 | articulo: {} |
| 11 | } | 11 | } |
| 12 | }; | 12 | }; |
| 13 | 13 | ||
| 14 | focaAbmVehiculoService.getCisterna($routeParams.id).then(function(res) { | 14 | focaAbmVehiculoService.getCisterna($routeParams.id).then(function(res) { |
| 15 | if(res.data) { | 15 | if(res.data) { |
| 16 | $scope.cisterna = res.data; | 16 | $scope.cisterna = res.data; |
| 17 | $scope.editar = true; | 17 | $scope.editar = true; |
| 18 | }else { | 18 | }else { |
| 19 | $scope.editar = false; | 19 | $scope.editar = false; |
| 20 | } | 20 | } |
| 21 | }); | 21 | }); |
| 22 | $scope.cancelar = function() { | 22 | $scope.cancelar = function() { |
| 23 | $location.path('/vehiculo/' + $routeParams.idVehiculo); | 23 | $location.path('/vehiculo/' + $routeParams.idVehiculo); |
| 24 | console.log($routeParams.id); | 24 | console.log($routeParams.id); |
| 25 | }; | 25 | }; |
| 26 | $scope.guardar = function() { | 26 | $scope.guardar = function() { |
| 27 | if(!$scope.cisterna.unidadMedida) { | 27 | if(!$scope.cisterna.unidadMedida) { |
| 28 | focaModalService.alert('Ingrese unidad de medida'); | 28 | focaModalService.alert('Ingrese unidad de medida'); |
| 29 | return; | 29 | return; |
| 30 | } | 30 | } |
| 31 | if(!$scope.cisterna.cisternaCarga.articulo) { | 31 | if(!$scope.cisterna.cisternaCarga.articulo) { |
| 32 | focaModalService.alert('Ingrese producto'); | 32 | focaModalService.alert('Ingrese producto'); |
| 33 | return; | 33 | return; |
| 34 | } | 34 | } |
| 35 | $scope.cisterna.idVehiculo = $routeParams.idVehiculo; | 35 | $scope.cisterna.idVehiculo = $routeParams.idVehiculo; |
| 36 | delete $scope.cisterna.unidadMedida; | 36 | delete $scope.cisterna.unidadMedida; |
| 37 | delete $scope.cisterna.cisternaCarga.articulo; | 37 | delete $scope.cisterna.cisternaCarga.articulo; |
| 38 | focaAbmVehiculoService.guardarCisterna($scope.cisterna).then(function() { | 38 | focaAbmVehiculoService.guardarCisterna($scope.cisterna).then(function() { |
| 39 | $location.path('/vehiculo/' + $routeParams.idVehiculo); | 39 | $location.path('/vehiculo/' + $routeParams.idVehiculo); |
| 40 | }); | 40 | }); |
| 41 | }; | 41 | }; |
| 42 | 42 | ||
| 43 | // $scope.seleccionarArticulo = function() { | 43 | // $scope.seleccionarArticulo = function() { |
| 44 | // var modalInstance = $uibModal.open( | 44 | // var modalInstance = $uibModal.open( |
| 45 | // { | 45 | // { |
| 46 | // ariaLabelledBy: 'Busqueda de Productos', | 46 | // ariaLabelledBy: 'Busqueda de Productos', |
| 47 | // templateUrl: 'modal-busqueda-productos.html', | 47 | // templateUrl: 'modal-busqueda-productos.html', |
| 48 | // controller: 'modalBusquedaProductosCtrl', | 48 | // controller: 'modalBusquedaProductosCtrl', |
| 49 | // resolve: { | 49 | // resolve: { |
| 50 | // parametroProducto: { | 50 | // parametroProducto: { |
| 51 | // idLista: -1, | 51 | // idLista: -1, |
| 52 | // cotizacion: 1, | 52 | // cotizacion: 1, |
| 53 | // simbolo: '$' | 53 | // simbolo: '$' |
| 54 | // } | 54 | // } |
| 55 | // }, | 55 | // }, |
| 56 | // size: 'lg' | 56 | // size: 'lg' |
| 57 | // } | 57 | // } |
| 58 | // ); | 58 | // ); |
| 59 | // modalInstance.result.then( | 59 | // modalInstance.result.then( |
| 60 | // function(producto) { | 60 | // function(producto) { |
| 61 | // $scope.cisterna.cisternaCarga.idProducto = producto.id, | 61 | // $scope.cisterna.cisternaCarga.idProducto = producto.id, |
| 62 | // $scope.cisterna.cisternaCarga.articulo.DetArt = producto.descripcion; | 62 | // $scope.cisterna.cisternaCarga.articulo.DetArt = producto.descripcion; |
| 63 | // }, function() { | 63 | // }, function() { |
| 64 | // // funcion ejecutada cuando se cancela el modal | 64 | // // funcion ejecutada cuando se cancela el modal |
| 65 | // } | 65 | // } |
| 66 | // ); | 66 | // ); |
| 67 | // }; | 67 | // }; |
| 68 | 68 | ||
| 69 | $scope.seleccionarUnidadMedida = function() { | 69 | $scope.seleccionarUnidadMedida = function() { |
| 70 | var modalInstance = $uibModal.open( | 70 | var modalInstance = $uibModal.open( |
| 71 | { | 71 | { |
| 72 | ariaLabelledBy: 'Busqueda de Unidades de medida', | 72 | ariaLabelledBy: 'Busqueda de Unidades de medida', |
| 73 | templateUrl: 'modal-unidad-medida.html', | 73 | templateUrl: 'modal-unidad-medida.html', |
| 74 | controller: 'focaModalUnidadMedidaCtrl', | 74 | controller: 'focaModalUnidadMedidaCtrl', |
| 75 | size: 'lg' | 75 | size: 'lg' |
| 76 | } | 76 | } |
| 77 | ); | 77 | ); |
| 78 | modalInstance.result.then(function(unidaMedida) { | 78 | modalInstance.result.then(function(unidaMedida) { |
| 79 | $scope.cisterna.idUnidadMedida = unidaMedida.ID; | 79 | $scope.cisterna.idUnidadMedida = unidaMedida.ID; |
| 80 | $scope.cisterna.unidadMedida = unidaMedida; | 80 | $scope.cisterna.unidadMedida = unidaMedida; |
| 81 | }); | 81 | }); |
| 82 | } | 82 | } |
| 83 | } | 83 | } |
| 84 | ]); | ||
| 84 | ]); |