Commit d09fe6fdac712d40fdd465416d210a54a1a2f83e

Authored by Eric
1 parent b8637e698d
Exists in master

Conseguir url mobile

... ... @@ -65,6 +65,7 @@
65 65 <script src="./node_modules/foca-sqlite/dist/foca-sqlite.min.js"></script>
66 66 <script src="./src/js/app.js"></script>
67 67 <script src="./src/js/controller.js"></script>
  68 + <script src="./src/js/service.js"></script>
68 69 <script src="./src/etc/develop.js"></script>
69 70 </head>
70 71 <body>
... ... @@ -20,13 +20,13 @@
20 20 "author": "Foca Software",
21 21 "license": "ISC",
22 22 "dependencies": {
23   - "angular": "^1.7.7",
  23 + "angular": "^1.7.8",
24 24 "angular-chart.js": "1.1.1",
25   - "angular-cookies": "^1.7.7",
26   - "angular-i18n": "^1.7.7",
  25 + "angular-cookies": "^1.7.8",
  26 + "angular-i18n": "^1.7.8",
27 27 "angular-ladda": "^0.4.3",
28   - "angular-route": "^1.7.7",
29   - "angular-sanitize": "^1.7.7",
  28 + "angular-route": "^1.7.8",
  29 + "angular-sanitize": "^1.7.8",
30 30 "angular-ui-swiper": "^2.3.8",
31 31 "bootstrap": "^4.3.1",
32 32 "chart.js": "2.7.3",
... ... @@ -56,11 +56,8 @@
56 56 "foca-login": "git+http://git.focasoftware.com/npm/foca-login.git",
57 57 "foca-logistica-pedido-ruta": "git+http://git.focasoftware.com/npm/foca-logistica-pedido-ruta.git",
58 58 "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git",
59   - "foca-modal-banco": "git+http://git.focasoftware.com/npm/foca-modal-banco.git",
60 59 "foca-modal-busqueda-productos": "git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git",
61 60 "foca-modal-cheque": "git+http://git.focasoftware.com/npm/foca-modal-cheque.git",
62   - "foca-modal-chofer": "git+http://git.focasoftware.com/npm/foca-modal-chofer.git",
63   - "foca-modal-cobrador": "git+http://git.focasoftware.com/npm/foca-modal-cobrador.git",
64 61 "foca-modal-cobranza": "git+http://git.focasoftware.com/npm/foca-modal-cobranza.git",
65 62 "foca-modal-cotizacion": "git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git",
66 63 "foca-modal-detalle-hoja-ruta": "git+http://git.focasoftware.com/npm/foca-modal-detalle-hoja-ruta.git",
... ... @@ -71,20 +68,13 @@
71 68 "foca-modal-factura-detalle": "git+http://git.focasoftware.com/npm/foca-modal-factura-detalle.git",
72 69 "foca-modal-flete": "git+http://git.focasoftware.com/npm/foca-modal-flete.git",
73 70 "foca-modal-lista-precio": "git+http://git.focasoftware.com/npm/foca-modal-lista-precio.git",
74   - "foca-modal-localidad": "git+http://git.focasoftware.com/npm/foca-modal-localidad.git",
75 71 "foca-modal-login": "git+http://git.focasoftware.com/npm/foca-modal-login.git",
76   - "foca-modal-moneda": "git+http://git.focasoftware.com/npm/foca-modal-moneda.git",
77 72 "foca-modal-nota-pedido": "git+http://git.focasoftware.com/npm/foca-modal-nota-pedido.git",
78 73 "foca-modal-precio-condiciones": "git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git",
79   - "foca-modal-proveedor": "git+http://git.focasoftware.com/npm/foca-modal-proveedor.git",
80   - "foca-modal-provincia": "git+http://git.focasoftware.com/npm/foca-modal-provincia.git",
81 74 "foca-modal-punto-descarga": "git+http://git.focasoftware.com/npm/foca-modal-punto-descarga.git",
82 75 "foca-modal-remito": "git+http://git.focasoftware.com/npm/foca-modal-remito.git",
83 76 "foca-modal-tarifa-flete": "git+http://git.focasoftware.com/npm/foca-modal-tarifa-flete.git",
84   - "foca-modal-transportista": "git+http://git.focasoftware.com/npm/foca-modal-transportista.git",
85 77 "foca-modal-unidad-medida": "git+http://git.focasoftware.com/npm/foca-modal-unidad-medida.git",
86   - "foca-modal-vehiculo": "git+http://git.focasoftware.com/npm/foca-modal-vehiculo.git",
87   - "foca-modal-vendedores": "git+http://git.focasoftware.com/npm/foca-modal-vendedores.git",
88 78 "foca-nombre-empresa": "git+http://git.focasoftware.com/npm/foca-nombre-empresa.git",
89 79 "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git",
90 80 "foca-sqlite": "git+http://git.focasoftware.com/npm/foca-sqlite.git",
... ... @@ -92,7 +82,7 @@
92 82 "font-awesome": "^4.7.0",
93 83 "gulp-angular-templatecache": "^2.2.1",
94 84 "gulp-htmlmin": "^5.0.1",
95   - "gulp-uglify": "^3.0.1",
  85 + "gulp-sequence": "^1.0.0",
96 86 "gulp-uglify-es": "^1.0.4",
97 87 "jquery": "^3.3.1",
98 88 "ladda": "1.0.6",
... ... @@ -112,7 +102,7 @@
112 102 "gulp-rename": "^1.4.0",
113 103 "gulp-replace": "^1.0.0",
114 104 "gulp-sass": "^4.0.1",
115   - "gulp-uglify": "^1.0.4",
  105 + "gulp-uglify": "^3.0.2",
116 106 "gulp-watch": "^5.0.1",
117 107 "jasmine-core": "^3.2.1",
118 108 "jshint": "^2.10.1",
src/etc/develop.ejemplo.js
1 1 angular.module('appWrapperDemo')
2   - .constant('API_ENDPOINT', {
3   - 'URL': '//127.0.0.1:9000'
4   - })
5   - .constant("APP", ''); // Posibles valores '', 'distribuidor', 'transportista'
  2 + .constant('APP', '')
src/js/controller.js
... ... @@ -3,7 +3,29 @@ angular.module(&#39;appWrapperDemo&#39;)
3 3 '$scope',
4 4 '$rootScope',
5 5 '$timeout',
6   - function($scope, $rootScope, $timeout) {
  6 + 'focaSqliteService',
  7 + 'focaModalService',
  8 + 'API_ENDPOINT',
  9 + '$localStorage',
  10 + function($scope, $rootScope, $timeout, focaSqliteService, focaModalService, API_ENDPOINT, $localStorage) {
  11 + document.addEventListener('deviceready', function() {
  12 + focaSqliteService.openDataBase();
  13 + });
  14 +
  15 + if(!API_ENDPOINT.URL) {
  16 + API_ENDPOINT.getUrl().then(success, err);
  17 + }
  18 +
  19 + function success(res) {
  20 +
  21 + API_ENDPOINT.setUrl(res.data);
  22 + }
  23 + function err() {
  24 +
  25 + $timeout(function() {
  26 + focaModalService.alert('Terminal no configurada: \n' + $localStorage.terminalKey);
  27 + }, 1000);
  28 + }
7 29 $scope.usarTeclado = false;
8 30 $rootScope.$broadcast('usarTeclado', false);
9 31 $scope.mostrarTeclado = false;
... ... @@ -0,0 +1,18 @@
  1 +angular.module('appWrapperDemo')
  2 + .factory('API_ENDPOINT', [
  3 + '$http',
  4 + '$localStorage',
  5 + 'ENDPOINT_BASE',
  6 + function($http, $localStorage, ENDPOINT_BASE) {
  7 + return {
  8 + URL: $localStorage.urlEndPoint,
  9 + ENDPOINT_BASE: ENDPOINT_BASE,
  10 + setUrl: function(url) {
  11 + this.URL = url;
  12 + $localStorage.urlEndPoint = url;
  13 + },
  14 + getUrl: function() {
  15 + return $http.get(this.ENDPOINT_BASE + '/terminal/consultar');
  16 + }
  17 + };
  18 + }]);