Commit 89b5f90e006b7a54b5d851f7fe45482cf685f2fd
1 parent
af8b463fb4
Exists in
develop
Change
Codigo identado
Showing
1 changed file
with
43 additions
and
46 deletions
Show diff stats
src/js/controller.js
1 | 1 | angular.module('focaModalLocalizar') |
2 | - .controller('focaModalLocalizarController', | |
3 | - [ | |
4 | - '$scope', | |
5 | - '$uibModalInstance', | |
6 | - 'focaModalLocalizarService', | |
7 | - 'focaModalService', | |
8 | - 'parametros', | |
9 | - function($scope, $uibModalInstance, | |
10 | - focaModalLocalizarService, focaModalService, parametros) { | |
2 | + .controller('focaModalLocalizarController', | |
3 | + [ | |
4 | + '$scope', '$uibModalInstance', 'focaModalLocalizarService', | |
5 | + 'focaModalService', 'parametros', | |
6 | + function ($scope, $uibModalInstance, focaModalLocalizarService, | |
7 | + focaModalService, parametros) { | |
11 | 8 | |
12 | - $scope.latitud = parametros.latitud || -32.89214159952345; | |
13 | - $scope.longitud = parametros.longitud || -68.84572999101856; | |
14 | - $scope.localizar = !! parametros.direccion; | |
9 | + $scope.latitud = parametros.latitud || -32.89214159952345; | |
10 | + $scope.longitud = parametros.longitud || -68.84572999101856; | |
11 | + $scope.localizar = !!parametros.direccion; | |
15 | 12 | |
16 | - if (parametros.direccion) { | |
17 | - focaModalLocalizarService | |
18 | - .getLatLng({ | |
19 | - street: parametros.direccion.numero + ' ' + parametros.direccion.calle, | |
20 | - country: 'Argentina', | |
21 | - city: parametros.direccion.provincia, | |
22 | - county: parametros.direccion.localidad, | |
23 | - format: 'json' | |
24 | - }) | |
25 | - .then(function(res) { | |
26 | - if (res.data.length) { | |
27 | - $scope.latitud = res.data[0].lat; | |
28 | - $scope.longitud = res.data[0].lon; | |
29 | - $scope.$broadcast('moveMap', { | |
30 | - latitud: $scope.latitud, | |
31 | - longitud: $scope.longitud | |
32 | - }); | |
33 | - } else { | |
34 | - focaModalService.alert('No se pudo localizar el domicilio'); | |
35 | - } | |
36 | - }); | |
37 | - } | |
13 | + if (parametros.direccion) { | |
14 | + focaModalLocalizarService | |
15 | + .getLatLng({ | |
16 | + street: parametros.direccion.numero + ' ' + parametros.direccion.calle, | |
17 | + country: 'Argentina', | |
18 | + city: parametros.direccion.provincia, | |
19 | + county: parametros.direccion.localidad, | |
20 | + format: 'json' | |
21 | + }) | |
22 | + .then(function (res) { | |
23 | + if (res.data.length) { | |
24 | + $scope.latitud = res.data[0].lat; | |
25 | + $scope.longitud = res.data[0].lon; | |
26 | + $scope.$broadcast('moveMap', { | |
27 | + latitud: $scope.latitud, | |
28 | + longitud: $scope.longitud | |
29 | + }); | |
30 | + } else { | |
31 | + focaModalService.alert('No se pudo localizar el domicilio'); | |
32 | + } | |
33 | + }); | |
34 | + } | |
38 | 35 | |
39 | - $scope.cancel = function() { | |
40 | - $uibModalInstance.dismiss(); | |
41 | - }; | |
36 | + $scope.cancel = function () { | |
37 | + $uibModalInstance.dismiss(); | |
38 | + }; | |
42 | 39 | |
43 | - $scope.aceptar = function() { | |
44 | - $uibModalInstance.close({ | |
45 | - latitud: $scope.latitud, | |
46 | - longitud: $scope.longitud | |
47 | - }); | |
48 | - }; | |
49 | - } | |
50 | - ] | |
51 | - ); | |
40 | + $scope.aceptar = function () { | |
41 | + $uibModalInstance.close({ | |
42 | + latitud: $scope.latitud, | |
43 | + longitud: $scope.longitud | |
44 | + }); | |
45 | + }; | |
46 | + } | |
47 | + ] | |
48 | + ); |