Commit 9e0d276b06a7be0267b73b454463b29c3ddcb35c
Exists in
master
Merge branch 'master' into 'master'
Master (pmarco) See merge request modulos-npm/foca-botonera-principal!7
Showing
4 changed files
Show diff stats
src/etc/develop.js.ejemplo
1 | angular.module('focaBotoneraPrincipal') | 1 | angular.module('focaBotoneraPrincipal') |
2 | .constant("API_ENDPOINT", { | 2 | .constant("API_ENDPOINT", { |
3 | 'URL': '//127.0.0.1:9000' | 3 | 'URL': '//127.0.0.1:9000' |
4 | }); | 4 | }) |
5 | .constant("APP", ''); // Posibles valores '', 'distribuidor', 'transportista' | ||
5 | 6 |
src/js/controller.js
1 | angular.module('focaBotoneraPrincipal') | 1 | angular.module('focaBotoneraPrincipal') |
2 | .controller('focaBotoneraPrincipalController', [ | 2 | .controller('focaBotoneraPrincipalController', [ |
3 | '$scope', '$location', '$cookies', 'botones', 'focaModalService', | 3 | '$scope', '$location', '$cookies', 'botones', 'focaModalService', 'APP', |
4 | function($scope, $location, $cookies, botones, focaModalService) { | 4 | function($scope, $location, $cookies, botones, focaModalService, APP) { |
5 | $scope.paginas = []; | 5 | $scope.paginas = []; |
6 | $scope.paginas.push(botones.data); | 6 | if(APP !== '') { |
7 | $scope.paginas.push(botones.data.slice(0, 3)); | ||
8 | $scope.paginas.push(botones.data.slice(3, 6)); | ||
9 | } else { | ||
10 | $scope.paginas.push(botones.data); | ||
11 | } | ||
7 | 12 | ||
8 | $scope.irA = function(accion) { | 13 | $scope.irA = function(accion) { |
9 | $location.path(accion); | 14 | $location.path(accion); |
10 | }; | 15 | }; |
11 | 16 | ||
12 | $scope.logout = function() { | 17 | $scope.logout = function() { |
13 | $location.path('/logout'); | 18 | $location.path('/logout'); |
14 | }; | 19 | }; |
15 | 20 | ||
16 | $scope.showTerminal = function() { | 21 | $scope.showTerminal = function() { |
17 | var key = $cookies.get('terminalKey'); | 22 | var key = $cookies.get('terminalKey'); |
18 | focaModalService.alert('SU TERMINAL ES: ' + key); | 23 | focaModalService.alert('SU TERMINAL ES: ' + key); |
19 | }; | 24 | }; |
20 | } | 25 | } |
21 | ]); | 26 | ]); |
22 | 27 |
src/js/route.js
1 | angular.module('focaBotoneraPrincipal') | 1 | angular.module('focaBotoneraPrincipal') |
2 | .config(['$routeProvider', function($routeProvider) { | 2 | .config(['$routeProvider', function($routeProvider) { |
3 | $routeProvider.when('/', { | 3 | $routeProvider.when('/', { |
4 | controller: 'focaBotoneraPrincipalController', | 4 | controller: 'focaBotoneraPrincipalController', |
5 | templateUrl: 'src/views/foca-botonera-principal.html', | 5 | templateUrl: 'src/views/foca-botonera-principal.html', |
6 | resolve: { | 6 | resolve: { |
7 | botones: ['focaBotoneraPrincipalService', function(focaBotoneraPrincipalService) { | 7 | botones: [ |
8 | return focaBotoneraPrincipalService.obtenerBotones(); | 8 | 'focaBotoneraPrincipalService', 'APP', |
9 | }] | 9 | function(focaBotoneraPrincipalService, APP) { |
10 | return focaBotoneraPrincipalService.obtenerBotones(APP); | ||
11 | } | ||
12 | ] | ||
10 | } | 13 | } |
11 | }); | 14 | }); |
12 | }]); | 15 | }]); |
13 | 16 |
src/js/service.js
1 | angular.module('focaBotoneraPrincipal') | 1 | angular.module('focaBotoneraPrincipal') |
2 | .service('focaBotoneraPrincipalService', [ | 2 | .service('focaBotoneraPrincipalService', [ |
3 | '$http', 'API_ENDPOINT', | 3 | '$http', 'API_ENDPOINT', |
4 | function($http, API_ENDPOINT) { | 4 | function($http, API_ENDPOINT) { |
5 | return { | 5 | return { |
6 | obtenerBotones: function() { | 6 | obtenerBotones: function(app) { |
7 | return $http.get(API_ENDPOINT.URL + '/boton'); | 7 | return $http.get(API_ENDPOINT.URL + '/boton' + '/' + app); |
8 | } | 8 | } |
9 | }; | 9 | }; |
10 | } | 10 | } |
11 | ]); | 11 | ]); |
12 | 12 |