From 49538eae3a0dafdd966de1a3e9a677d11cb0f6db Mon Sep 17 00:00:00 2001 From: Luigi Date: Mon, 24 Jun 2019 17:41:17 -0300 Subject: [PATCH] Editar anterior --- src/js/controller.js | 26 ++++++++++++-------------- src/views/remito.html | 15 +++++++++------ 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/js/controller.js b/src/js/controller.js index 38c731c..54327d8 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -11,6 +11,8 @@ angular.module('focaCrearRemito').controller('remitoController', var cotizacionPArgentino = {}; function config() { + $scope.tmpCantidad = Number; + $scope.tmpPrecio = Number; $scope.botonera = crearRemitoService.getBotonera(); $scope.isNumber = angular.isNumber; $scope.datepickerAbierto = false; @@ -971,8 +973,9 @@ angular.module('focaCrearRemito').controller('remitoController', return result; }; - $scope.editarArticulo = function (key, articulo, bandera) { + $scope.editarArticulo = function (key, articulo, tmpCantidad, tmpPrecio) { if (key === 13) { +<<<<<<< HEAD var valorAEditar = bandera === 'precio' ? articulo.precio : articulo.cantidad; var tempValor = bandera === 'precio' ? articulo.tmpPrecio : articulo.tmpCantidad; @@ -980,29 +983,24 @@ angular.module('focaCrearRemito').controller('remitoController', return; } if (tempValor === '') { +======= + if (!articulo.cantidad || !articulo.precio || !tmpCantidad || !tmpPrecio) { +>>>>>>> parent of 60be8ea... Arreglo alerta al editar campos del producto focaModalService.alert('Los valores deben ser al menos 1'); return; - } else if (tempValor === '0') { + } else if (tmpCantidad === "0" || tmpPrecio === "0") { focaModalService.alert('Esta ingresando un producto con valor 0'); - } else if (valorAEditar < 0) { + } else if (articulo.cantidad < 0 || articulo.precio < 0) { focaModalService.alert('Los valores no pueden ser negativos'); return; } - articulo[bandera] = parseFloat(tempValor); + articulo.cantidad = tmpCantidad; + articulo.precio = tmpPrecio; $scope.getTotal(); - var propiedad = 'edit' + bandera.charAt(0).toUpperCase() + bandera.slice(1); - articulo[propiedad] = false; + articulo.editCantidad = articulo.editPrecio = false; } }; - $scope.setTempCantidadArticulo = function (articulo) { - articulo.tmpCantidad = articulo.cantidad; - }; - - $scope.setTempPrecioArticulo = function (articulo) { - articulo.tmpPrecio = articulo.precio; - }; - $scope.cancelarEditar = function (articulo) { $scope.tmpCantidad = articulo.cantidad; $scope.tmpPrecio = articulo.precio; diff --git a/src/views/remito.html b/src/views/remito.html index b0b3e65..32c66cc 100644 --- a/src/views/remito.html +++ b/src/views/remito.html @@ -69,13 +69,14 @@