Commit 22c46eab7c16c30b98f6f1960f484d86bbe04972

Authored by Marcelo Puebla
1 parent a2cc4b8c29
Exists in master

Arreglo al intentar editar la cantidad de un producto.

Showing 2 changed files with 7 additions and 7 deletions   Show diff stats
src/js/controller.js
... ... @@ -9,8 +9,7 @@ angular.module('focaCrearFactura').controller('facturaController', [
9 9 config();
10 10  
11 11 function config() {
12   - $scope.tmpCantidad = Number;
13   - $scope.tmpPrecio = Number;
  12 + $scope.tmpCantidad = '0';
14 13 $scope.botonera = crearFacturaService.getBotonera();
15 14 $scope.botoneraProductos = [];
16 15 $scope.isNumber = angular.isNumber;
... ... @@ -792,12 +791,13 @@ angular.module('focaCrearFactura').controller('facturaController', [
792 791  
793 792 $scope.editarArticulo = function (key, articulo, tmpCantidad) {
794 793 if (key === 13) {
795   - if (!articulo.cantidad && !tmpCantidad) {
  794 + if (!articulo.cantidad && tmpCantidad.length === 0) {
796 795 focaModalService.alert('Los valores deben ser al menos 1');
797 796 return;
798 797 } else if (tmpCantidad === '0') {
799 798 focaModalService.alert('Esta ingresando un producto con valor 0');
800   - } else if (articulo.cantidad < 0) {
  799 + return;
  800 + } else if (parseInt(tmpCantidad) < 0) {
801 801 focaModalService.alert('Los valores no pueden ser negativos');
802 802 return;
803 803 }
src/views/factura.html
... ... @@ -119,7 +119,7 @@
119 119 </button>
120 120 <button
121 121 class="btn btn-outline-light"
122   - ng-click="editarArticulo(13, articulo, tmpCantidad, tmpPrecio);"
  122 + ng-click="editarArticulo(13, articulo, tmpCantidad);"
123 123 ng-show="articulo.editCantidad || articulo.editPrecio"
124 124 >
125 125 <i class="fa fa-save"></i>
... ... @@ -208,13 +208,13 @@
208 208 ></i>
209 209 <input
210 210 ng-show="articulo.editCantidad"
211   - ng-model="articulo.CAN"
  211 + ng-model="tmpCantidad"
212 212 class="form-control"
213 213 foca-tipo-input
214 214 min="1"
215 215 step="0.001"
216 216 foca-focus="articulo.editCantidad"
217   - ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad, tmpPrecio)"
  217 + ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad)"
218 218 ng-focus="selectFocus($event)"
219 219 >
220 220 </div>