controller.js 871 Bytes
angular.module('focaModalEfectivo')
    .controller('focaModalEfectivoController', 
        [
            '$scope',
            '$uibModalInstance',
            'sugerido',
            '$timeout',
            function($scope, $uibModalInstance, sugerido, $timeout) {

                $scope.efectivo = sugerido;

                $timeout(function() {
                    angular.element('#importe')[0].select();
                });

                $scope.aceptar = function(key) {
                    if(key === 13 && parseFloat($scope.efectivo)) {
                        var efectivo = parseFloat($scope.efectivo);
                        $uibModalInstance.close(efectivo);
                    }
                };

                $scope.cancel = function() {
                    $uibModalInstance.dismiss('cancel');
                };
            }
        ]
    );