Commit c396f04d4b3dbaa3b7dfc8c2500393e07b78cfb5
Exists in
master
Merge branch 'master' into 'develop'
Master(mpuebla) See merge request !18
Showing
2 changed files
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; |
... | ... | @@ -532,7 +531,7 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
532 | 531 | ORD_TRA: 0, |
533 | 532 | IMP_DESP: 0, |
534 | 533 | PCD: 0, |
535 | - RTO: '' | |
534 | + RTO: '', | |
536 | 535 | }; |
537 | 536 | |
538 | 537 | $scope.factura.articulosFactura.push(articulo); |
... | ... | @@ -603,7 +602,7 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
603 | 602 | ORD_TRA: 0, |
604 | 603 | IMP_DESP: 0, |
605 | 604 | PCD: 0, |
606 | - RTO: '' | |
605 | + RTO: '', | |
607 | 606 | }; |
608 | 607 | |
609 | 608 | crearFacturaService.setearDespachoOcupado({ |
... | ... | @@ -660,10 +659,10 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
660 | 659 | resolve(); |
661 | 660 | } |
662 | 661 | }) |
663 | - .catch(reject);; | |
662 | + .catch(reject); | |
664 | 663 | } |
665 | 664 | |
666 | - openPrompt() | |
665 | + openPrompt(); | |
667 | 666 | }); |
668 | 667 | } |
669 | 668 | |
... | ... | @@ -783,19 +782,20 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
783 | 782 | } |
784 | 783 | |
785 | 784 | $scope.cambioEdit = function (articulo, propiedad) { |
786 | - if (propiedad === 'cantidad') { | |
785 | + if (propiedad === 'cantidad' && articulo.SUR !== 0) { | |
787 | 786 | articulo.editCantidad = true; |
788 | 787 | } |
789 | 788 | }; |
790 | 789 | |
791 | 790 | $scope.editarArticulo = function (key, articulo, tmpCantidad) { |
792 | 791 | if (key === 13) { |
793 | - if (!articulo.cantidad && !tmpCantidad) { | |
792 | + if (!articulo.cantidad && tmpCantidad.length === 0) { | |
794 | 793 | focaModalService.alert('Los valores deben ser al menos 1'); |
795 | 794 | return; |
796 | 795 | } else if (tmpCantidad === '0') { |
797 | 796 | focaModalService.alert('Esta ingresando un producto con valor 0'); |
798 | - } else if (articulo.cantidad < 0) { | |
797 | + return; | |
798 | + } else if (parseInt(tmpCantidad) < 0) { | |
799 | 799 | focaModalService.alert('Los valores no pueden ser negativos'); |
800 | 800 | return; |
801 | 801 | } |
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> |