Commit b38b6e0b937491af15e43a394b5f4bf522c6ac5e
1 parent
627479f5e2
Exists in
master
and in
1 other branch
Arreglo espacios IF
Showing
2 changed files
with
7 additions
and
43 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -22,7 +22,7 @@ angular.module('focaAbmVehiculo') |
22 | 22 | |
23 | 23 | if ($localStorage.vehiculo) { |
24 | 24 | var vehiculo = JSON.parse($localStorage.vehiculo); |
25 | - if (!vehiculo.idVehiculo) { vehiculo.idVehiculo = 0; } | |
25 | + if (!vehiculo.idVehiculo) vehiculo.idVehiculo = 0; | |
26 | 26 | $location.path('/vehiculo/' + vehiculo.idVehiculo + '/' + vehiculo.idTransportista); |
27 | 27 | } |
28 | 28 | |
... | ... | @@ -36,7 +36,7 @@ angular.module('focaAbmVehiculo') |
36 | 36 | focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' + |
37 | 37 | vehiculo.id + ' ' + vehiculo.tractor + ' ?').then( |
38 | 38 | function(data) { |
39 | - if(data) { | |
39 | + if (data) { | |
40 | 40 | focaAbmVehiculoService.deleteVehiculo(vehiculo.id); |
41 | 41 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); |
42 | 42 | } |
... | ... | @@ -283,9 +283,9 @@ angular.module('focaAbmVehiculo') |
283 | 283 | vehiculo.id !== $scope.vehiculo.id; |
284 | 284 | }); |
285 | 285 | |
286 | - if(existe.length) { | |
286 | + if (existe.length) { | |
287 | 287 | reject(existe); |
288 | - }else { | |
288 | + } else { | |
289 | 289 | resolve(); |
290 | 290 | } |
291 | 291 | }); |
... | ... | @@ -295,7 +295,7 @@ angular.module('focaAbmVehiculo') |
295 | 295 | function validaTotalCargas() { |
296 | 296 | var total = 0; |
297 | 297 | $scope.cisternas.forEach(function(cisterna) { |
298 | - if(!cisterna.desactivado) { | |
298 | + if (!cisterna.desactivado) { | |
299 | 299 | total += parseInt(cisterna.capacidad); |
300 | 300 | } |
301 | 301 | }); |
src/js/controllerCisterna.js
... | ... | @@ -29,15 +29,6 @@ angular.module('focaAbmVehiculo') |
29 | 29 | focaBotoneraLateralService.addCustomButton('Cancelar', $scope.cancelar); |
30 | 30 | }); |
31 | 31 | |
32 | - // $timeout(function() {getLSCisterna();}); | |
33 | - | |
34 | - // if ($localStorage.cisterna) { | |
35 | - // var cisterna = JSON.parse($localStorage.cisterna); | |
36 | - // console.log('Cisterna datos: ' ,cisterna); | |
37 | - // if (!cisterna.codigo) { cisterna.idcisterna = 0; } | |
38 | - // $location.path('/vehiculo/' + vehiculo.idVehiculo + '/cisterna/'); | |
39 | - // } | |
40 | - | |
41 | 32 | if ($routeParams.idx != -1) { |
42 | 33 | |
43 | 34 | $scope.cisterna = [$routeParams.idx]; |
... | ... | @@ -123,33 +114,6 @@ angular.module('focaAbmVehiculo') |
123 | 114 | }); |
124 | 115 | }; |
125 | 116 | |
126 | - /*$scope.$watch('cisterna', function(newValue) { | |
127 | - focaBotoneraLateralService.setPausarData({ | |
128 | - label:'cisterna', | |
129 | - val: { | |
130 | - codigo: newValue.codigo, | |
131 | - capacidad: newValue.capacidad, | |
132 | - unidadMedida: newValue.NOM | |
133 | - } | |
134 | - }); | |
135 | - }, true);*/ | |
136 | - | |
137 | - /*function getLSCisterna() { | |
138 | - var cisterna = JSON.parse($localStorage.cisterna|| null); | |
139 | - if (cisterna) { | |
140 | - setearcisterna(cisterna); | |
141 | - delete $localStorage.cisterna; | |
142 | - } | |
143 | - } | |
144 | - | |
145 | - function setearcisterna(cisterna) { | |
146 | - $scope.cisterna = cisterna; | |
147 | - $scope.$broadcast('addCabecera', { | |
148 | - label: 'cisterna:', | |
149 | - valor: $filter('rellenarDigitos')(cisterna.codigo) + ' - ' | |
150 | - }); | |
151 | - }*/ | |
152 | - | |
153 | 117 | function validaCodigo() { |
154 | 118 | return new Promise(function(resolve, reject) { |
155 | 119 | focaAbmVehiculoService |
... | ... | @@ -159,12 +123,12 @@ angular.module('focaAbmVehiculo') |
159 | 123 | var totalCargado = 0; |
160 | 124 | cisternas.forEach(function(cisterna, idx) { |
161 | 125 | //SI EL CODIGO YA EXISTE |
162 | - if(cisterna.codigo === $scope.cisterna.codigo && | |
126 | + if (cisterna.codigo === $scope.cisterna.codigo && | |
163 | 127 | idx != $routeParams.idx && |
164 | 128 | !cisterna.desactivado) { |
165 | 129 | reject('Código de cisterna existente'); |
166 | 130 | } |
167 | - if(idx != $routeParams.idx && | |
131 | + if (idx != $routeParams.idx && | |
168 | 132 | !cisterna.desactivado) { |
169 | 133 | totalCargado += cisterna.capacidad; |
170 | 134 | } |