Commit 1bdae648a5110d6f262c8a92f4621960886da933
Exists in
master
Merge branch 'master' into 'master'
selecciona texto cuando abre modal See merge request !5
Showing
2 changed files
Show diff stats
src/js/controller.js
1 | angular.module('focaModalEfectivo') | 1 | angular.module('focaModalEfectivo') |
2 | .controller('focaModalEfectivoController', | 2 | .controller('focaModalEfectivoController', |
3 | [ | 3 | [ |
4 | '$scope', | 4 | '$scope', |
5 | '$uibModalInstance', | 5 | '$uibModalInstance', |
6 | 'sugerido', | 6 | 'sugerido', |
7 | function($scope, $uibModalInstance, sugerido) { | 7 | '$timeout', |
8 | function($scope, $uibModalInstance, sugerido, $timeout) { | ||
8 | if(sugerido && sugerido < 0) { | 9 | if(sugerido && sugerido < 0) { |
9 | $scope.efectivo = Math.abs(sugerido); | 10 | $scope.efectivo = Math.abs(sugerido); |
11 | $timeout(function() { | ||
12 | angular.element('#importe')[0].select(); | ||
13 | }); | ||
10 | } | 14 | } |
11 | $scope.aceptar = function(key) { | 15 | $scope.aceptar = function(key) { |
12 | if(key === 13 && parseFloat($scope.efectivo)) { | 16 | if(key === 13 && parseFloat($scope.efectivo)) { |
13 | var efectivo = parseFloat($scope.efectivo); | 17 | var efectivo = parseFloat($scope.efectivo); |
14 | $uibModalInstance.close(efectivo); | 18 | $uibModalInstance.close(efectivo); |
15 | } | 19 | } |
16 | }; | 20 | }; |
17 | 21 | ||
18 | $scope.cancel = function() { | 22 | $scope.cancel = function() { |
19 | $uibModalInstance.dismiss('cancel'); | 23 | $uibModalInstance.dismiss('cancel'); |
20 | }; | 24 | }; |
21 | } | 25 | } |
22 | ] | 26 | ] |
23 | ); | 27 | ); |
24 | 28 |
src/views/modal-efectivo.html
1 | <div class="modal-header"> | 1 | <div class="modal-header"> |
2 | <h3 class="modal-title">Ingrese Efectivo</h3> | 2 | <h3 class="modal-title">Ingrese Efectivo</h3> |
3 | </div> | 3 | </div> |
4 | <div class="modal-body" id="modal-body"> | 4 | <div class="modal-body" id="modal-body"> |
5 | <form name="formEfectivo"> | 5 | <form name="formEfectivo"> |
6 | <div class="input-group"> | 6 | <div class="input-group"> |
7 | <div class="input-group-prepend"> | 7 | <div class="input-group-prepend"> |
8 | <div class="input-group-text form-control form-control-sm">$</div> | 8 | <div class="input-group-text form-control form-control-sm">$</div> |
9 | </div> | 9 | </div> |
10 | <input | 10 | <input |
11 | teclado-virtual | 11 | teclado-virtual |
12 | foca-tipo-input | 12 | foca-tipo-input |
13 | id="importe" | ||
13 | ng-model="efectivo" | 14 | ng-model="efectivo" |
14 | foca-focus="true" | 15 | foca-focus="true" |
15 | class="form-control form-control-sm" | 16 | class="form-control form-control-sm" |
16 | placeholder="Ingrese monto" | 17 | placeholder="Ingrese monto" |
17 | ng-keypress="aceptar($event.keyCode)" | 18 | ng-keypress="aceptar($event.keyCode)" |
18 | > | 19 | > |
19 | </div> | 20 | </div> |
20 | </form> | 21 | </form> |
21 | </div> | 22 | </div> |
22 | <div class="modal-footer"> | 23 | <div class="modal-footer"> |
23 | <button | 24 | <button |
24 | class="btn btn-primary" | 25 | class="btn btn-primary" |
25 | type="button" | 26 | type="button" |
26 | ng-click="aceptar(13)" | 27 | ng-click="aceptar(13)" |
27 | ng-disabled="!formEfectivo.$valid" | 28 | ng-disabled="!formEfectivo.$valid" |
28 | >Aceptar</button> | 29 | >Aceptar</button> |
29 | <button class="btn btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | 30 | <button class="btn btn-secondary" type="button" ng-click="cancel()">Cancelar</button> |
30 | </div> | 31 | </div> |
31 | 32 |