Commit 96733cdf875c93cc859678d56b4e47f553b70af1
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
Master See merge request !35
Showing
2 changed files
Show diff stats
src/js/controller.js
| ... | ... | @@ -154,7 +154,7 @@ angular.module('focaAbmVehiculo') |
| 154 | 154 | $location.path('/vehiculo'); |
| 155 | 155 | }; |
| 156 | 156 | $scope.editar = function(key) { |
| 157 | - if(key) { | |
| 157 | + if (key) { | |
| 158 | 158 | $location.path('/vehiculo/' + $routeParams.idVehiculo + |
| 159 | 159 | '/cisterna/' + key); |
| 160 | 160 | } else { |
| ... | ... | @@ -162,8 +162,24 @@ angular.module('focaAbmVehiculo') |
| 162 | 162 | } |
| 163 | 163 | }; |
| 164 | 164 | $scope.guardar = function(key) { |
| 165 | + | |
| 166 | + if (!$scope.vehiculo.codigo) { | |
| 167 | + focaModalService.alert('Ingrese unidad'); | |
| 168 | + return; | |
| 169 | + } else if (!$scope.vehiculo.tractor) { | |
| 170 | + focaModalService.alert('Ingrese dominio tractor'); | |
| 171 | + return; | |
| 172 | + } else if (!$scope.vehiculo.semi) { | |
| 173 | + focaModalService.alert('Ingrese dominio semi'); | |
| 174 | + return; | |
| 175 | + } else if (!$scope.vehiculo.capacidad) { | |
| 176 | + focaModalService.alert('Ingrse capacidad total'); | |
| 177 | + return; | |
| 178 | + } | |
| 179 | + | |
| 180 | + | |
| 165 | 181 | key = (typeof key === 'undefined') ? 13 : key; |
| 166 | - if(key === 13) { | |
| 182 | + if (key === 13) { | |
| 167 | 183 | //Valida si existe numero de unidad |
| 168 | 184 | if(!validaTotalCargas() && !$scope.nuevo) { |
| 169 | 185 | focaModalService.alert('La suma de las capacidades de las cisternas' + |
src/js/controllerCisterna.js
| ... | ... | @@ -7,7 +7,11 @@ angular.module('focaAbmVehiculo') |
| 7 | 7 | $scope.nuevo = ($routeParams.idx > -1) ? false : true; |
| 8 | 8 | $scope.editar = false; |
| 9 | 9 | $scope.now = new Date(); |
| 10 | - $scope.cisterna = {}; | |
| 10 | + $scope.cisterna = { | |
| 11 | + codigo: '', | |
| 12 | + capacidad: '', | |
| 13 | + unidadMedida: {} | |
| 14 | + }; | |
| 11 | 15 | |
| 12 | 16 | $scope.focused = $scope.nuevo ? 1 : 2; |
| 13 | 17 | $scope.next = function(key) { |
| ... | ... | @@ -24,7 +28,8 @@ angular.module('focaAbmVehiculo') |
| 24 | 28 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); |
| 25 | 29 | }); |
| 26 | 30 | |
| 27 | - if($routeParams.idx !== -1) { | |
| 31 | + if ($routeParams.idx != -1) { | |
| 32 | + | |
| 28 | 33 | $scope.cisterna = [$routeParams.idx]; |
| 29 | 34 | focaAbmVehiculoService |
| 30 | 35 | .getCisternas($routeParams.idVehiculo) |
| ... | ... | @@ -53,11 +58,19 @@ angular.module('focaAbmVehiculo') |
| 53 | 58 | $scope.cancelar = function() { |
| 54 | 59 | $location.path('/vehiculo/' + $routeParams.idVehiculo); |
| 55 | 60 | }; |
| 56 | - $scope.guardar = function() { | |
| 57 | - if(!$scope.cisterna.unidadMedida) { | |
| 61 | + $scope.guardar = function() { | |
| 62 | + | |
| 63 | + if (!$scope.cisterna.codigo) { | |
| 64 | + focaModalService.alert('Ingrese codigo de cisterna'); | |
| 65 | + return; | |
| 66 | + } else if (!$scope.cisterna.capacidad) { | |
| 67 | + focaModalService.alert('Ingrese capacidad'); | |
| 68 | + return; | |
| 69 | + } else if (!$scope.cisterna.idUnidadMedida) { | |
| 58 | 70 | focaModalService.alert('Ingrese unidad de medida'); |
| 59 | 71 | return; |
| 60 | 72 | } |
| 73 | + | |
| 61 | 74 | validaCodigo() |
| 62 | 75 | .then(function() { |
| 63 | 76 | $scope.cisterna.idVehiculo = parseInt($routeParams.idVehiculo); |