Commit d654dd180d5fa54f79b932f6a86c2ccf84daef24
Exists in
master
and in
1 other branch
Merge branch 'master' into 'develop'
Master See merge request !3
Showing
3 changed files
Show diff stats
.gitignore
1 | /node_modules | 1 | /node_modules |
2 | /dist | 2 | /dist |
3 | /tmp | 3 | /tmp |
4 | package-lock\.json | 4 | package-lock\.json |
5 | src/etc/develop\.js | 5 | src/etc/develop\.js |
6 | yarn.lock | ||
6 | 7 |
src/js/controller.js
1 | angular.module('focaModalLocalizar') | 1 | angular.module('focaModalLocalizar') |
2 | .controller('focaModalLocalizarController', | 2 | .controller('focaModalLocalizarController', |
3 | [ | 3 | [ |
4 | '$scope', | 4 | '$scope', |
5 | '$uibModalInstance', | 5 | '$uibModalInstance', |
6 | 'focaModalLocalizarService', | 6 | 'focaModalLocalizarService', |
7 | 'direccion', | 7 | 'direccion', |
8 | 'focaModalService', | 8 | 'focaModalService', |
9 | function($scope, $uibModalInstance, | 9 | function($scope, $uibModalInstance, |
10 | focaModalLocalizarService, direccion, focaModalService) { | 10 | focaModalLocalizarService, direccion, focaModalService) { |
11 | 11 | ||
12 | $scope.latitud = -32.89214159952345; | 12 | $scope.latitud = -32.89214159952345; |
13 | $scope.longitud = -68.84572999101856; | 13 | $scope.longitud = -68.84572999101856; |
14 | $scope.localizar = !!direccion; | ||
14 | 15 | ||
15 | if(direccion) { | 16 | if(direccion) { |
16 | focaModalLocalizarService | 17 | focaModalLocalizarService |
17 | .getLatLng({ | 18 | .getLatLng({ |
18 | street: direccion.numero + ' ' + direccion.calle, | 19 | street: direccion.numero + ' ' + direccion.calle, |
19 | country: 'Argentina', | 20 | country: 'Argentina', |
20 | city: direccion.provincia, | 21 | city: direccion.provincia, |
21 | county: direccion.localidad, | 22 | county: direccion.localidad, |
22 | format: 'json' | 23 | format: 'json' |
23 | }) | 24 | }) |
24 | .then(function(res) { | 25 | .then(function(res) { |
25 | if(res.data.length) { | 26 | if(res.data.length) { |
26 | $scope.latitud = res.data[0].lat; | 27 | $scope.latitud = res.data[0].lat; |
27 | $scope.longitud = res.data[0].lon; | 28 | $scope.longitud = res.data[0].lon; |
28 | $scope.$broadcast('moveMap', { | 29 | $scope.$broadcast('moveMap', { |
29 | latitud: $scope.latitud, | 30 | latitud: $scope.latitud, |
30 | longitud: $scope.longitud | 31 | longitud: $scope.longitud |
31 | }); | 32 | }); |
32 | }else { | 33 | }else { |
33 | focaModalService.alert('No se pudo localizar el domicilio'); | 34 | focaModalService.alert('No se pudo localizar el domicilio'); |
34 | } | 35 | } |
35 | }); | 36 | }); |
36 | } | 37 | } |
37 | 38 | ||
38 | $scope.cancel = function() { | 39 | $scope.cancel = function() { |
39 | $uibModalInstance.dismiss(); | 40 | $uibModalInstance.dismiss(); |
40 | }; | 41 | }; |
41 | 42 | ||
42 | $scope.aceptar = function() { | 43 | $scope.aceptar = function() { |
43 | $uibModalInstance.close({ | 44 | $uibModalInstance.close({ |
44 | latitud: $scope.latitud, | 45 | latitud: $scope.latitud, |
45 | longitud: $scope.longitud | 46 | longitud: $scope.longitud |
46 | }); | 47 | }); |
47 | }; | 48 | }; |
48 | } | 49 | } |
49 | ] | 50 | ] |
50 | ); | 51 | ); |
51 | 52 |
src/views/modal-localizar.html
1 | <div class="modal-header py-1"> | 1 | <div class="modal-header py-1"> |
2 | <div class="row"> | 2 | <div class="row"> |
3 | <div class="col 12"> | 3 | <div class="col 12"> |
4 | <h5>Búsqueda de domicilio</h5> | 4 | <h5>Búsqueda de domicilio</h5> |
5 | </div> | 5 | </div> |
6 | </div> | 6 | </div> |
7 | </div> | 7 | </div> |
8 | <div class="modal-body" id="modal-body"> | 8 | <div class="modal-body" id="modal-body"> |
9 | <form> | 9 | <form> |
10 | <div class="row"> | 10 | <div class="row"> |
11 | <div class="col-6"> | 11 | <div class="col-6"> |
12 | <label>Latitud</label> | 12 | <label>Latitud</label> |
13 | <input | 13 | <input |
14 | type="number" | 14 | type="number" |
15 | class="form-control" | 15 | class="form-control" |
16 | ng-model="latitud" | 16 | ng-model="latitud" |
17 | string-to-number> | 17 | string-to-number> |
18 | </div> | 18 | </div> |
19 | <div class="col-6"> | 19 | <div class="col-6"> |
20 | <label>Longitud</label> | 20 | <label>Longitud</label> |
21 | <input | 21 | <input |
22 | type="number" | 22 | type="number" |
23 | class="form-control" | 23 | class="form-control" |
24 | ng-model="longitud" | 24 | ng-model="longitud" |
25 | string-to-number> | 25 | string-to-number> |
26 | </div> | 26 | </div> |
27 | </div> | 27 | </div> |
28 | </form> | 28 | </form> |
29 | <osm-direccion | 29 | <osm-direccion |
30 | latitud="latitud" | 30 | latitud="latitud" |
31 | longitud="longitud" | 31 | longitud="longitud" |
32 | zoom="14" | 32 | zoom="14" |
33 | /> | 33 | /> |
34 | <small ng-show="localizar">Por favor, arrastre el puntero para mejorar la precisión de esta dirección</small> | ||
34 | </div> | 35 | </div> |
35 | <div class="modal-footer"> | 36 | <div class="modal-footer"> |
36 | <button | 37 | <button |
37 | class="btn btn-sm btn-secondary" | 38 | class="btn btn-sm btn-secondary" |
38 | type="button" | 39 | type="button" |
39 | ng-click="cancel()" | 40 | ng-click="cancel()" |
40 | >Cancelar</button> | 41 | >Cancelar</button> |
41 | <button | 42 | <button |
42 | class="btn btn-sm btn-primary" | 43 | class="btn btn-sm btn-primary" |
43 | type="button" | 44 | type="button" |
44 | ng-click="aceptar()" | 45 | ng-click="aceptar()" |
45 | >Aceptar</button> | 46 | >Aceptar</button> |
46 | </div> | 47 | </div> |
47 | 48 |