Commit 62bc563c663876625f00396afd7b0fd76e119e35
1 parent
7f65da7e5b
Exists in
master
primer versión
Showing
9 changed files
with
230 additions
and
0 deletions
Show diff stats
.gitignore
index.html
| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | +<html ng-app="focaGestionTerminal"> | |
| 2 | + <head> | |
| 3 | + <meta charset="UTF-8"/> | |
| 4 | + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
| 5 | + <base href="./"> | |
| 6 | + | |
| 7 | + <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet" /> | |
| 8 | + <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" /> | |
| 9 | + <link href="src/css/general.css" rel="stylesheet" /> | |
| 10 | + | |
| 11 | + <script src="node_modules/jquery/dist/jquery.min.js"></script> | |
| 12 | + <script src="node_modules/angular/angular.min.js"></script> | |
| 13 | + <script src="node_modules/angular-route/angular-route.min.js"></script> | |
| 14 | + <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> | |
| 15 | + <script src="node_modules/angular-ping/dist/angular-ping.min.js"></script> | |
| 16 | + <script src="src/js/app.js"></script> | |
| 17 | + <script src="src/js/route.js"></script> | |
| 18 | + <script src="src/js/controller.js"></script> | |
| 19 | + <script src="src/js/service.js"></script> | |
| 20 | + </head> | |
| 21 | + | |
| 22 | + <body> | |
| 23 | + <div ng-view class="container"></div> | |
| 24 | + </body> | |
| 25 | +</html> | |
| 0 | 26 | \ No newline at end of file |
package.json
| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | +{ | |
| 2 | + "name": "foca-gestion-terminales", | |
| 3 | + "version": "0.0.1", | |
| 4 | + "description": "Gestión de terminales", | |
| 5 | + "main": "index.html", | |
| 6 | + "dependencies": { | |
| 7 | + "angular": "^1.7.7", | |
| 8 | + "angular-ping": "0.0.0", | |
| 9 | + "angular-route": "^1.7.7", | |
| 10 | + "bootstrap": "^4.3.1", | |
| 11 | + "font-awesome": "^4.7.0", | |
| 12 | + "jquery": "^3.3.1" | |
| 13 | + }, | |
| 14 | + "devDependencies": {}, | |
| 15 | + "scripts": { | |
| 16 | + "test": "echo \"Error: no test specified\" && exit 1" | |
| 17 | + }, | |
| 18 | + "repository": { | |
| 19 | + "type": "git", | |
| 20 | + "url": "http://git.focasoftware.com/npm/foca-gestion-terminales.git" | |
| 21 | + }, | |
| 22 | + "author": "Foca software", | |
| 23 | + "license": "ISC" | |
| 24 | +} |
src/css/general.css
src/js/app.js
src/js/controller.js
| ... | ... | @@ -0,0 +1,41 @@ |
| 1 | +angular.module('focaGestionTerminal') | |
| 2 | + .controller('gestionTerminalController', | |
| 3 | + [ | |
| 4 | + '$scope', | |
| 5 | + 'gestionTerminalService', | |
| 6 | + 'netTesting', | |
| 7 | + function($scope, gestionTerminalesService, netTesting) { | |
| 8 | + $scope.empresa = {}; | |
| 9 | + $scope.empresas = []; | |
| 10 | + | |
| 11 | + gestionTerminalesService.getEmpresas().then(function(res) { | |
| 12 | + | |
| 13 | + $scope.empresas = res.data; | |
| 14 | + }); | |
| 15 | + | |
| 16 | + $scope.guardar = function() { | |
| 17 | + | |
| 18 | + netTesting.ping($scope.empresa.url, function() { | |
| 19 | + | |
| 20 | + if(arguments[1] === 'disconnected') { | |
| 21 | + $scope.mensaje = "La url indicada no tiene conección"; | |
| 22 | + return; | |
| 23 | + } | |
| 24 | + | |
| 25 | + gestionTerminalesService.insertEmpresa( | |
| 26 | + { empresa: $scope.empresa}).then(function() { | |
| 27 | + | |
| 28 | + $scope.mensaje = "Empresa guardada con éxito"; | |
| 29 | + $scope.empresas.push($scope.terminal); | |
| 30 | + $scope.empresa = {}; | |
| 31 | + $scope.empresaGuardada = true; | |
| 32 | + | |
| 33 | + }).catch(function() { | |
| 34 | + | |
| 35 | + $scope.mensaje = "Hubo un error al guardar la empresa"; | |
| 36 | + }); | |
| 37 | + | |
| 38 | + }); | |
| 39 | + }; | |
| 40 | + | |
| 41 | + }]); |
src/js/route.js
src/js/service.js
| ... | ... | @@ -0,0 +1,54 @@ |
| 1 | +angular.module('focaGestionTerminal') | |
| 2 | + .factory('gestionTerminalService', ['endpoint', '$http', function(endpoint, $http) { | |
| 3 | + return { | |
| 4 | + getTerminalSet: function() { | |
| 5 | + return [ | |
| 6 | + { | |
| 7 | + terminalKey: 'fa651v65aa65d1', | |
| 8 | + urlDireccion: 'debonline.dyndns.com:9900' | |
| 9 | + }, | |
| 10 | + { | |
| 11 | + terminalKey: 'fa651v65aa65d1', | |
| 12 | + urlDireccion: 'debonline.dyndns.com:9900' | |
| 13 | + }, | |
| 14 | + { | |
| 15 | + terminalKey: 'fa651v65aa65d1', | |
| 16 | + urlDireccion: 'debonline.dyndns.com:9900' | |
| 17 | + }, | |
| 18 | + { | |
| 19 | + terminalKey: 'fa651v65aa65d1', | |
| 20 | + urlDireccion: 'debonline.dyndns.com:9900' | |
| 21 | + }, | |
| 22 | + { | |
| 23 | + terminalKey: 'fa651v65aa65d1', | |
| 24 | + urlDireccion: 'debonline.dyndns.com:9900' | |
| 25 | + }, | |
| 26 | + { | |
| 27 | + terminalKey: 'fa651v65aa65d1', | |
| 28 | + urlDireccion: 'debonline.dyndns.com:9900' | |
| 29 | + }, | |
| 30 | + { | |
| 31 | + terminalKey: 'fa651v65aa65d1', | |
| 32 | + urlDireccion: 'debonline.dyndns.com:9900' | |
| 33 | + }, | |
| 34 | + { | |
| 35 | + terminalKey: 'fa651v65aa65d1', | |
| 36 | + urlDireccion: 'debonline.dyndns.com:9900' | |
| 37 | + } | |
| 38 | + ] | |
| 39 | + }, | |
| 40 | + getTerminarRequest: function() { | |
| 41 | + return [ | |
| 42 | + { | |
| 43 | + terminalKey: 'cSB156B6SC51B' | |
| 44 | + } | |
| 45 | + ] | |
| 46 | + }, | |
| 47 | + getEmpresas: function() { | |
| 48 | + return $http.get(endpoint + '/empresa/listar'); | |
| 49 | + }, | |
| 50 | + insertEmpresa: function(empresa) { | |
| 51 | + return $http.post(endpoint + '/empresa/crear', empresa); | |
| 52 | + } | |
| 53 | + } | |
| 54 | + }]); |
src/views/main.html
| ... | ... | @@ -0,0 +1,69 @@ |
| 1 | +<html> | |
| 2 | + <h3>Sistema de gestión de terminales</h3> | |
| 3 | + | |
| 4 | + <h5>Ingreso de nueva empresa</h5> | |
| 5 | + | |
| 6 | + <label | |
| 7 | + class="bg-info text-white" | |
| 8 | + ng-show="mensaje" | |
| 9 | + ng-bind="mensaje"></label> | |
| 10 | + | |
| 11 | + <form name="formEmpresa"> | |
| 12 | + <div class="row"> | |
| 13 | + | |
| 14 | + <div class="col-3"> | |
| 15 | + <input | |
| 16 | + class="form-control" | |
| 17 | + placeholder="Nombre de empresa" | |
| 18 | + ng-model="empresa.nombre" | |
| 19 | + ng-required="true"/> | |
| 20 | + </div> | |
| 21 | + | |
| 22 | + <div class="col-4"> | |
| 23 | + <input | |
| 24 | + class="form-control" | |
| 25 | + placeholder="ID Empresa" | |
| 26 | + ng-model="empresa.idEmpresaCliente" | |
| 27 | + ng-required="true"/> | |
| 28 | + </div> | |
| 29 | + | |
| 30 | + <div class="col-4"> | |
| 31 | + <input | |
| 32 | + class="form-control" | |
| 33 | + placeholder="URL" | |
| 34 | + ng-model="empresa.url" | |
| 35 | + ng-required="true"/> | |
| 36 | + </div> | |
| 37 | + | |
| 38 | + <div class="col-1 text-center"> | |
| 39 | + <button | |
| 40 | + type="button" | |
| 41 | + class="btn btn-dark" | |
| 42 | + ladda="guardando" | |
| 43 | + ng-click="guardar()" | |
| 44 | + ng-disabled="!formEmpresa.$valid">Guardar</button> | |
| 45 | + </div> | |
| 46 | + </div> | |
| 47 | + </form> | |
| 48 | + | |
| 49 | + <h5>Empresas configuradas</h5> | |
| 50 | + <div class="row"> | |
| 51 | + <table class="table table-dark"> | |
| 52 | + <thead> | |
| 53 | + <tr> | |
| 54 | + <th>Nombre Empresa</th> | |
| 55 | + <th>ID Empresa</th> | |
| 56 | + <th>Url</th> | |
| 57 | + </tr> | |
| 58 | + </thead> | |
| 59 | + <tbody> | |
| 60 | + <tr ng-repeat="empresa in empresas"> | |
| 61 | + <td ng-bind="empresa.nombre"></td> | |
| 62 | + <td ng-bind="empresa.idEmpresaCliente"></td> | |
| 63 | + <td ng-bind="empresa.url"></td> | |
| 64 | + </tr> | |
| 65 | + </tbody> | |
| 66 | + </table> | |
| 67 | + </div> | |
| 68 | + | |
| 69 | +</html> |