From d5dac011fec8bb3ace53fd2f594f12ede5b5589e Mon Sep 17 00:00:00 2001 From: efernandez Date: Fri, 22 Feb 2019 17:38:40 -0300 Subject: [PATCH] subir fotos mobile --- package.json | 12 +++++----- src/js/controller.js | 55 +++++++++++++++++++++++++++++++++++++++++-- src/views/modal-detalles.html | 40 +++++++++++++++++++++++++++---- 3 files changed, 95 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 3d2b32d..128c227 100644 --- a/package.json +++ b/package.json @@ -20,23 +20,23 @@ "author": "Foca Software", "license": "ISC", "devDependencies": { - "angular": "^1.7.5", - "bootstrap": "^4.1.3", + "angular": "^1.7.7", + "bootstrap": "^4.3.1", "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", "font-awesome": "^4.7.0", "gulp": "^3.9.1", - "gulp-angular-templatecache": "^2.2.5", + "gulp-angular-templatecache": "^2.2.6", "gulp-clean": "^0.4.0", "gulp-concat": "^2.6.1", - "gulp-connect": "^5.6.1", + "gulp-connect": "^5.7.0", "gulp-htmlmin": "^5.0.1", "gulp-jshint": "^2.1.0", "gulp-rename": "^1.4.0", "gulp-replace": "^1.0.0", "gulp-uglify": "^3.0.1", "jquery": "^3.3.1", - "jshint": "^2.9.6", + "jshint": "^2.10.1", "pump": "^3.0.0", - "ui-bootstrap4": "^3.0.5" + "ui-bootstrap4": "^3.0.6" } } diff --git a/src/js/controller.js b/src/js/controller.js index f40d52f..0a69683 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -4,15 +4,18 @@ angular.module('focaModalDetalles') '$scope', '$uibModalInstance', 'focaModalService', + 'APP', + '$timeout', 'sugerido', - function($scope, $uibModalInstance, focaModalService, sugerido) { + function($scope, $uibModalInstance, focaModalService, APP, $timeout, sugerido) { + $scope.mobile = APP === 'cobranza'; $scope.files = []; $scope.importe = Math.abs(sugerido); $scope.$watch('files', function() { validarExtSize(); }); - + $scope.eliminarImg = function(key) { $scope.files.splice(key, 1); }; @@ -20,7 +23,9 @@ angular.module('focaModalDetalles') $scope.cancel = function() { $uibModalInstance.dismiss('cancel'); }; + $scope.aceptar = function() { + console.log($scope.files); $uibModalInstance.close({ observacion: $scope.observaciones, monto: $scope.importe, @@ -28,6 +33,52 @@ angular.module('focaModalDetalles') }); }; + $scope.seleccionarFoto = function() { + var srcType = Camera.PictureSourceType.SAVEDPHOTOALBUM; + var options = setOptions(srcType); + navigator.camera.getPicture(cameraSuccess, cameraError, options); + }; + + $scope.tomarFoto = function() { + navigator.camera.getPicture(cameraSuccess, cameraError, + { + destinationType: Camera.DestinationType.DATA_URL, + quality: 100 + }); + }; + + function cameraSuccess(imageBase64) { + + var fecha = new Date(); + var size = (imageBase64.length * (3/4)); + + var imagen = { + name: 'imagen_' + fecha.getTime() + '.jpg', + size: size, + base64: imageBase64, + }; + $timeout(function() { + $scope.files.push(imagen); + }); + } + function cameraError(err) { + console.log(err); + } + function setOptions(srcType) { + var options = { + // Some common settings are 20, 50, and 100 + quality: 100, + destinationType: Camera.DestinationType.DATA_URL, + sourceType: srcType, + + encodingType: Camera.EncodingType.JPEG, + mediaType: Camera.MediaType.PICTURE, + allowEdit: true, + correctOrientation: true + } + return options; + } + function validarExtSize() { var totalSize = 0; var invalidExt = false; diff --git a/src/views/modal-detalles.html b/src/views/modal-detalles.html index 1c7886a..f33139b 100644 --- a/src/views/modal-detalles.html +++ b/src/views/modal-detalles.html @@ -20,7 +20,7 @@
-
+
$
@@ -35,8 +35,8 @@ foca-focus="focused == 6" ng-focus="focused = 6"/>
-
- + Solo .jpg y .png - Tamaño máximo 150mb
+
+ +
+
+ +
+
+ Solo .jpg y .png - Tamaño máximo 150mb +
-
+
+
+
+ + +
+