Commit deae2ef1761c6fe06b49bc4b67e442c69c6ff84e
1 parent
159d0f5410
Exists in
master
No valido url's
Showing
1 changed file
with
6 additions
and
6 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaGestionTerminal') | 1 | angular.module('focaGestionTerminal') |
2 | .controller('gestionTerminalController', | 2 | .controller('gestionTerminalController', |
3 | [ | 3 | [ |
4 | '$scope', | 4 | '$scope', |
5 | 'gestionTerminalService', | 5 | 'gestionTerminalService', |
6 | 'netTesting', | 6 | 'netTesting', |
7 | function($scope, gestionTerminalesService, netTesting) { | 7 | function($scope, gestionTerminalesService, netTesting) { |
8 | $scope.empresa = {}; | 8 | $scope.empresa = {}; |
9 | $scope.empresas = []; | 9 | $scope.empresas = []; |
10 | 10 | ||
11 | gestionTerminalesService.getEmpresas().then(function(res) { | 11 | gestionTerminalesService.getEmpresas().then(function(res) { |
12 | 12 | ||
13 | $scope.empresas = res.data; | 13 | $scope.empresas = res.data; |
14 | }); | 14 | }); |
15 | 15 | ||
16 | $scope.guardar = function() { | 16 | $scope.guardar = function() { |
17 | 17 | ||
18 | netTesting.ping($scope.empresa.url, function() { | 18 | // netTesting.ping($scope.empresa.url, function() { |
19 | 19 | ||
20 | if (arguments[1] === 'disconnected') { | 20 | // if (arguments[1] === 'disconnected') { |
21 | $scope.mensaje = "La url indicada no tiene conección"; | 21 | // $scope.mensaje = "La url indicada no tiene conección"; |
22 | return; | 22 | // return; |
23 | } | 23 | // } |
24 | 24 | ||
25 | gestionTerminalesService.insertEmpresa( | 25 | gestionTerminalesService.insertEmpresa( |
26 | { empresa: $scope.empresa}).then(function() { | 26 | { empresa: $scope.empresa}).then(function() { |
27 | 27 | ||
28 | $scope.mensaje = "Empresa guardada con éxito"; | 28 | $scope.mensaje = "Empresa guardada con éxito"; |
29 | $scope.empresas.push($scope.terminal); | 29 | $scope.empresas.push($scope.terminal); |
30 | $scope.empresa = {}; | 30 | $scope.empresa = {}; |
31 | $scope.empresaGuardada = true; | 31 | $scope.empresaGuardada = true; |
32 | 32 | ||
33 | }).catch(function() { | 33 | }).catch(function() { |
34 | 34 | ||
35 | $scope.mensaje = "Hubo un error al guardar la empresa"; | 35 | $scope.mensaje = "Hubo un error al guardar la empresa"; |
36 | }); | 36 | }); |
37 | 37 | ||
38 | }); | 38 | // }); |
39 | }; | 39 | }; |
40 | 40 | ||
41 | $scope.eliminarEmpresa = function() { | 41 | $scope.eliminarEmpresa = function() { |
42 | if (confirm('¿Esta seguro que desa eliminar la empresa?')) { | 42 | if (confirm('¿Esta seguro que desa eliminar la empresa?')) { |
43 | alert('En desarrollo'); | 43 | alert('En desarrollo'); |
44 | return; | 44 | return; |
45 | } | 45 | } |
46 | }; | 46 | }; |
47 | 47 | ||
48 | }]); | 48 | }]); |
49 | 49 |