Commit fbe64cc5fb46312ede79ed072ead516b29f0e2f6

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

Master(efernandez)

See merge request !3
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 function($scope, $uibModalInstance, sugerido) {
8 if(sugerido && sugerido < 0) { 8 if(sugerido && sugerido < 0) {
9 $scope.efectivo = Math.abs(sugerido); 9 $scope.efectivo = Math.abs(sugerido);
10 } 10 }
11 $scope.aceptar = function(key) { 11 $scope.aceptar = function(key) {
12 if(key === 13 && $scope.efectivo) { 12 if(key === 13 && parseFloat($scope.efectivo)) {
13 var efectivo = parseFloat($scope.efectivo); 13 var efectivo = parseFloat($scope.efectivo);
14 $uibModalInstance.close(efectivo); 14 $uibModalInstance.close(efectivo);
15 } 15 }
16 }; 16 };
17 17
18 $scope.cancel = function() { 18 $scope.cancel = function() {
19 $uibModalInstance.dismiss('cancel'); 19 $uibModalInstance.dismiss('cancel');
20 }; 20 };
21 } 21 }
22 ] 22 ]
23 ); 23 );
24 24
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 ng-model="efectivo" 13 ng-model="efectivo"
14 foca-focus="true" 14 foca-focus="true"
15 class="form-control form-control-sm" 15 class="form-control form-control-sm"
16 placeholder="Ingrese monto" 16 placeholder="Ingrese monto"
17 ng-keypress="aceptar($event.keyCode)" 17 ng-keypress="aceptar($event.keyCode)"
18 > 18 >
19 </div> 19 </div>
20 <br>
21 <div class="alert alert-warning">
22 Si ya ha ingresado efectivo, el monto que ingrese se sumará o restará al ya ingresado.
23 </div>
20 </form> 24 </form>
21 </div> 25 </div>
22 <div class="modal-footer"> 26 <div class="modal-footer">
23 <button 27 <button
24 class="btn btn-primary" 28 class="btn btn-primary"
25 type="button" 29 type="button"
26 ng-click="aceptar(13)" 30 ng-click="aceptar(13)"
27 ng-disabled="!formEfectivo.$valid" 31 ng-disabled="!formEfectivo.$valid"
28 >Aceptar</button> 32 >Aceptar</button>
29 <button class="btn btn-secondary" type="button" ng-click="cancel()">Cancelar</button> 33 <button class="btn btn-secondary" type="button" ng-click="cancel()">Cancelar</button>
30 </div> 34 </div>
31 35