Commit a1930b1817ac3f50392986c10d03fa56a236eace
1 parent
db44eb9833
Exists in
master
Corregido errores de sintaxis.
Showing
1 changed file
with
17 additions
and
21 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -20,8 +20,8 @@ angular.module('focaModalDescarga') |
| 20 | 20 | $scope.remito = remito; |
| 21 | 21 | $scope.nroRecibo = 0; |
| 22 | 22 | $scope.cisternas = remito.cisternas; |
| 23 | - $scope.nroSucursal; | |
| 24 | - $scope.nroRemito; | |
| 23 | + $scope.nroSucursal = 0; | |
| 24 | + $scope.nroRemito = 0; | |
| 25 | 25 | $scope.articulos = []; |
| 26 | 26 | $scope.hasErrorSucursalRemito = false; |
| 27 | 27 | //#endregion |
| ... | ... | @@ -38,13 +38,13 @@ angular.module('focaModalDescarga') |
| 38 | 38 | console.info(err); |
| 39 | 39 | } |
| 40 | 40 | ); |
| 41 | - }; | |
| 41 | + } | |
| 42 | 42 | |
| 43 | 43 | init(); |
| 44 | 44 | |
| 45 | 45 | $scope.crearRemito = function () { |
| 46 | 46 | if (!$scope.remito.cliente) { |
| 47 | - focaModalService.alert("No has seleccionado cliente"); | |
| 47 | + focaModalService.alert('No has seleccionado cliente'); | |
| 48 | 48 | return; |
| 49 | 49 | } |
| 50 | 50 | if (validarDescarga()) { |
| ... | ... | @@ -101,23 +101,26 @@ angular.module('focaModalDescarga') |
| 101 | 101 | //#endregion |
| 102 | 102 | focaModalDescargasService.crearRemito({ remito: remito, notaPedido: { id: 0 } }) |
| 103 | 103 | .then(function (res) { |
| 104 | - remitoId = res.data.id | |
| 104 | + var remitoId = res.data.id; | |
| 105 | 105 | descargar(remitoId); |
| 106 | 106 | focaModalDescargasService. |
| 107 | - addArticulos($scope.remito.articulosRemito, $scope.articulos, remitoId, 1); | |
| 108 | - focaModalService.alert("Descarga realizada") | |
| 107 | + addArticulos($scope.remito.articulosRemito, | |
| 108 | + $scope.articulos, remitoId, 1); | |
| 109 | + focaModalService.alert('Descarga realizada') | |
| 109 | 110 | .then(function () { |
| 110 | 111 | $uibModalInstance.dismiss(); |
| 111 | 112 | }) |
| 113 | + .catch(function (e) { console.info(e); }); | |
| 112 | 114 | }) |
| 113 | - .catch(function (e) { console.log(e); }) | |
| 115 | + .catch(function (e) { console.log(e); }); | |
| 114 | 116 | |
| 115 | 117 | }; |
| 116 | 118 | $scope.getTotal = function () { |
| 117 | 119 | var total = 0; |
| 118 | 120 | $scope.cisternas.forEach(function (cisterna) { |
| 119 | 121 | |
| 120 | - total += cisterna.cisternaCarga.articulo.PreVen * cisterna.cisternaCarga.descargar; | |
| 122 | + total += cisterna.cisternaCarga.articulo.PreVen * | |
| 123 | + cisterna.cisternaCarga.descargar; | |
| 121 | 124 | cisterna.cisternaCarga.articulo.cantidad = cisterna.cisternaCarga.descargar; |
| 122 | 125 | $scope.articulos.push(cisterna.cisternaCarga.articulo); |
| 123 | 126 | }); |
| ... | ... | @@ -173,8 +176,8 @@ angular.module('focaModalDescarga') |
| 173 | 176 | res.data[0].id, |
| 174 | 177 | ''); |
| 175 | 178 | $scope.aDescargar = []; |
| 176 | - }; | |
| 177 | - }; | |
| 179 | + } | |
| 180 | + } | |
| 178 | 181 | function getImporte(propiedad) { |
| 179 | 182 | var importe = 0; |
| 180 | 183 | $scope.remito.articulosRemito.forEach(function (articulo) { |
| ... | ... | @@ -184,7 +187,7 @@ angular.module('focaModalDescarga') |
| 184 | 187 | return; |
| 185 | 188 | }); |
| 186 | 189 | return importe; |
| 187 | - }; | |
| 190 | + } | |
| 188 | 191 | function validarDescarga() { |
| 189 | 192 | |
| 190 | 193 | if ($scope.nroRemito > 99999999) { |
| ... | ... | @@ -201,12 +204,12 @@ angular.module('focaModalDescarga') |
| 201 | 204 | if (parseInt($scope.cisternas[i].cisternaCarga.descargar) > |
| 202 | 205 | $scope.cisternas[i].cisternaCarga.cantidad || |
| 203 | 206 | parseInt($scope.cisternas[i].cisternaCarga.descargar) < 0) { |
| 204 | - focaModalService.alert("Cantidad de descarga ingresada erronea"); | |
| 207 | + focaModalService.alert('Cantidad de descarga ingresada erronea'); | |
| 205 | 208 | return true; |
| 206 | 209 | } |
| 207 | 210 | } |
| 208 | 211 | return false; |
| 209 | - }; | |
| 212 | + } | |
| 210 | 213 | $scope.seleccionarCliente = function () { |
| 211 | 214 | var modalInstance = $uibModal.open( |
| 212 | 215 | { |
| ... | ... | @@ -245,12 +248,5 @@ angular.module('focaModalDescarga') |
| 245 | 248 | $scope.cancelar = function () { |
| 246 | 249 | $uibModalInstance.dismiss(); |
| 247 | 250 | }; |
| 248 | - function rellenar(relleno, longitud) { | |
| 249 | - relleno = '' + relleno; | |
| 250 | - while (relleno.length < longitud) { | |
| 251 | - relleno = '0' + relleno; | |
| 252 | - } | |
| 253 | - return relleno; | |
| 254 | - }; | |
| 255 | 251 | } |
| 256 | 252 | ]); |