Commit 1e5433c8f2daaf08be252ba2db2e29c488db36ae
Exists in
master
Merge branch 'master' into 'develop'
Master(mpuebla) See merge request !14
Showing
2 changed files
Show diff stats
src/js/controller.js
... | ... | @@ -95,15 +95,17 @@ angular.module('focaModalPrecioCondicion') |
95 | 95 | //#endregion |
96 | 96 | |
97 | 97 | //#region Metodos para los plazos |
98 | - $scope.addPlazo = function () { | |
98 | + $scope.addPlazo = function (key) { | |
99 | + if (key != 13) return; | |
99 | 100 | if ($scope.plazos.length === 100) return; |
100 | 101 | for (var i = 1; i < $scope.plazos.length; i++) { |
101 | - if ($scope.plazos[0].dias == $scope.plazos[i].dias) { | |
102 | + if ($scope.plazos[0].dias == $scope.plazos[i].dias && $scope.plazos[i].activo == true) { | |
102 | 103 | focaModalService.alert("Ya existe un plazo con este valor"); |
103 | 104 | return; |
104 | 105 | } |
105 | 106 | } |
106 | 107 | $scope.plazos.unshift({ dias: 0, idCliente: idCliente, activo: true }); |
108 | + $scope.focused = 1; | |
107 | 109 | }; |
108 | 110 | $scope.deletePlazo = function (index) { |
109 | 111 | $scope.plazos[index].activo = false; |
src/views/modal-precio-condicion.html
... | ... | @@ -81,6 +81,8 @@ |
81 | 81 | ng-model="plazo.dias" |
82 | 82 | limite-numeros-max="3" |
83 | 83 | ng-keyup="validateMinMax(plazo, 0, 365)" |
84 | + ng-keypress="addPlazo($event.keyCode)" | |
85 | + foca-focus="focused == 1" | |
84 | 86 | select-on-click |
85 | 87 | teclado-virtual |
86 | 88 | foca-tipo-input |
... | ... | @@ -90,7 +92,7 @@ |
90 | 92 | <button |
91 | 93 | ng-show="i === 0" |
92 | 94 | class="btn btn-primary" |
93 | - ng-click="addPlazo()"> | |
95 | + ng-click="addPlazo(13)"> | |
94 | 96 | <span class="fa fa-save"></span> |
95 | 97 | </button> |
96 | 98 | <button |