From d09fe6fdac712d40fdd465416d210a54a1a2f83e Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 12 Mar 2019 17:22:48 -0300 Subject: [PATCH] Conseguir url mobile --- index.html | 1 + package.json | 24 +++++++----------------- src/etc/develop.ejemplo.js | 5 +---- src/js/controller.js | 24 +++++++++++++++++++++++- src/js/service.js | 18 ++++++++++++++++++ 5 files changed, 50 insertions(+), 22 deletions(-) create mode 100644 src/js/service.js diff --git a/index.html b/index.html index 8cbba29..05458a4 100644 --- a/index.html +++ b/index.html @@ -65,6 +65,7 @@ + diff --git a/package.json b/package.json index a220092..00d382f 100644 --- a/package.json +++ b/package.json @@ -20,13 +20,13 @@ "author": "Foca Software", "license": "ISC", "dependencies": { - "angular": "^1.7.7", + "angular": "^1.7.8", "angular-chart.js": "1.1.1", - "angular-cookies": "^1.7.7", - "angular-i18n": "^1.7.7", + "angular-cookies": "^1.7.8", + "angular-i18n": "^1.7.8", "angular-ladda": "^0.4.3", - "angular-route": "^1.7.7", - "angular-sanitize": "^1.7.7", + "angular-route": "^1.7.8", + "angular-sanitize": "^1.7.8", "angular-ui-swiper": "^2.3.8", "bootstrap": "^4.3.1", "chart.js": "2.7.3", @@ -56,11 +56,8 @@ "foca-login": "git+http://git.focasoftware.com/npm/foca-login.git", "foca-logistica-pedido-ruta": "git+http://git.focasoftware.com/npm/foca-logistica-pedido-ruta.git", "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", - "foca-modal-banco": "git+http://git.focasoftware.com/npm/foca-modal-banco.git", "foca-modal-busqueda-productos": "git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git", "foca-modal-cheque": "git+http://git.focasoftware.com/npm/foca-modal-cheque.git", - "foca-modal-chofer": "git+http://git.focasoftware.com/npm/foca-modal-chofer.git", - "foca-modal-cobrador": "git+http://git.focasoftware.com/npm/foca-modal-cobrador.git", "foca-modal-cobranza": "git+http://git.focasoftware.com/npm/foca-modal-cobranza.git", "foca-modal-cotizacion": "git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git", "foca-modal-detalle-hoja-ruta": "git+http://git.focasoftware.com/npm/foca-modal-detalle-hoja-ruta.git", @@ -71,20 +68,13 @@ "foca-modal-factura-detalle": "git+http://git.focasoftware.com/npm/foca-modal-factura-detalle.git", "foca-modal-flete": "git+http://git.focasoftware.com/npm/foca-modal-flete.git", "foca-modal-lista-precio": "git+http://git.focasoftware.com/npm/foca-modal-lista-precio.git", - "foca-modal-localidad": "git+http://git.focasoftware.com/npm/foca-modal-localidad.git", "foca-modal-login": "git+http://git.focasoftware.com/npm/foca-modal-login.git", - "foca-modal-moneda": "git+http://git.focasoftware.com/npm/foca-modal-moneda.git", "foca-modal-nota-pedido": "git+http://git.focasoftware.com/npm/foca-modal-nota-pedido.git", "foca-modal-precio-condiciones": "git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git", - "foca-modal-proveedor": "git+http://git.focasoftware.com/npm/foca-modal-proveedor.git", - "foca-modal-provincia": "git+http://git.focasoftware.com/npm/foca-modal-provincia.git", "foca-modal-punto-descarga": "git+http://git.focasoftware.com/npm/foca-modal-punto-descarga.git", "foca-modal-remito": "git+http://git.focasoftware.com/npm/foca-modal-remito.git", "foca-modal-tarifa-flete": "git+http://git.focasoftware.com/npm/foca-modal-tarifa-flete.git", - "foca-modal-transportista": "git+http://git.focasoftware.com/npm/foca-modal-transportista.git", "foca-modal-unidad-medida": "git+http://git.focasoftware.com/npm/foca-modal-unidad-medida.git", - "foca-modal-vehiculo": "git+http://git.focasoftware.com/npm/foca-modal-vehiculo.git", - "foca-modal-vendedores": "git+http://git.focasoftware.com/npm/foca-modal-vendedores.git", "foca-nombre-empresa": "git+http://git.focasoftware.com/npm/foca-nombre-empresa.git", "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git", "foca-sqlite": "git+http://git.focasoftware.com/npm/foca-sqlite.git", @@ -92,7 +82,7 @@ "font-awesome": "^4.7.0", "gulp-angular-templatecache": "^2.2.1", "gulp-htmlmin": "^5.0.1", - "gulp-uglify": "^3.0.1", + "gulp-sequence": "^1.0.0", "gulp-uglify-es": "^1.0.4", "jquery": "^3.3.1", "ladda": "1.0.6", @@ -112,7 +102,7 @@ "gulp-rename": "^1.4.0", "gulp-replace": "^1.0.0", "gulp-sass": "^4.0.1", - "gulp-uglify": "^1.0.4", + "gulp-uglify": "^3.0.2", "gulp-watch": "^5.0.1", "jasmine-core": "^3.2.1", "jshint": "^2.10.1", diff --git a/src/etc/develop.ejemplo.js b/src/etc/develop.ejemplo.js index edabf57..0182c6a 100644 --- a/src/etc/develop.ejemplo.js +++ b/src/etc/develop.ejemplo.js @@ -1,5 +1,2 @@ angular.module('appWrapperDemo') - .constant('API_ENDPOINT', { - 'URL': '//127.0.0.1:9000' - }) - .constant("APP", ''); // Posibles valores '', 'distribuidor', 'transportista' + .constant('APP', '') diff --git a/src/js/controller.js b/src/js/controller.js index 0c72727..7e59c05 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -3,7 +3,29 @@ angular.module('appWrapperDemo') '$scope', '$rootScope', '$timeout', - function($scope, $rootScope, $timeout) { + 'focaSqliteService', + 'focaModalService', + 'API_ENDPOINT', + '$localStorage', + function($scope, $rootScope, $timeout, focaSqliteService, focaModalService, API_ENDPOINT, $localStorage) { + document.addEventListener('deviceready', function() { + focaSqliteService.openDataBase(); + }); + + if(!API_ENDPOINT.URL) { + API_ENDPOINT.getUrl().then(success, err); + } + + function success(res) { + + API_ENDPOINT.setUrl(res.data); + } + function err() { + + $timeout(function() { + focaModalService.alert('Terminal no configurada: \n' + $localStorage.terminalKey); + }, 1000); + } $scope.usarTeclado = false; $rootScope.$broadcast('usarTeclado', false); $scope.mostrarTeclado = false; diff --git a/src/js/service.js b/src/js/service.js new file mode 100644 index 0000000..54332de --- /dev/null +++ b/src/js/service.js @@ -0,0 +1,18 @@ +angular.module('appWrapperDemo') + .factory('API_ENDPOINT', [ + '$http', + '$localStorage', + 'ENDPOINT_BASE', + function($http, $localStorage, ENDPOINT_BASE) { + return { + URL: $localStorage.urlEndPoint, + ENDPOINT_BASE: ENDPOINT_BASE, + setUrl: function(url) { + this.URL = url; + $localStorage.urlEndPoint = url; + }, + getUrl: function() { + return $http.get(this.ENDPOINT_BASE + '/terminal/consultar'); + } + }; + }]); -- 1.9.1