Commit c971e4b21bc51596f7ffce944d3348bb2e76befb

Authored by Marcelo Puebla
Exists in master and in 1 other branch develop

Merge branch 'develop' of git.focasoftware.com:npm/foca-modal-localizar

... ... @@ -7,7 +7,7 @@
7 7 "gulp-pre-commit": "gulp pre-commit",
8 8 "compile": "gulp uglify",
9 9 "postinstall": "npm run compile && gulp clean-post-install",
10   - "install-dev": "npm install -D angular bootstrap font-awesome gulp gulp-angular-templatecache gulp-concat gulp-connect gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify gulp-clean jasmine-core jquery jshint pre-commit pump ui-bootstrap4 && npm i -D git+http://git.focasoftware.com/npm/foca-directivas.git"
  10 + "install-dev": "npm install -D angular bootstrap font-awesome gulp gulp-angular-templatecache gulp-concat gulp-connect gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify gulp-clean jasmine-core jquery jshint pre-commit pump ui-bootstrap4 && npm i -D git+ssh://git@debonline.dyndns.org:npm/foca-directivas.git"
11 11 },
12 12 "pre-commit": [
13 13 "gulp-pre-commit"
... ... @@ -33,12 +33,12 @@
33 33 "gulp-uglify": "^3.0.1",
34 34 "jquery": "^3.3.1",
35 35 "pump": "^3.0.0",
36   - "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git"
  36 + "foca-directivas": "git+ssh://git@debonline.dyndns.org:npm/foca-directivas.git"
37 37 },
38 38 "devDependencies": {
39 39 "angular": "^1.7.5",
40 40 "bootstrap": "^4.1.3",
41   - "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git",
  41 + "foca-directivas": "git+ssh://git@debonline.dyndns.org:npm/foca-directivas.git",
42 42 "font-awesome": "^4.7.0",
43 43 "gulp": "^3.9.1",
44 44 "gulp-angular-templatecache": "^2.2.3",
src/js/controller.js
... ... @@ -4,33 +4,33 @@ angular.module('focaModalLocalizar')
4 4 '$scope',
5 5 '$uibModalInstance',
6 6 'focaModalLocalizarService',
7   - 'direccion',
8 7 'focaModalService',
  8 + 'parametros',
9 9 function($scope, $uibModalInstance,
10   - focaModalLocalizarService, direccion, focaModalService) {
  10 + focaModalLocalizarService, focaModalService, parametros) {
11 11  
12   - $scope.latitud = -32.89214159952345;
13   - $scope.longitud = -68.84572999101856;
14   - $scope.localizar = !!direccion;
  12 + $scope.latitud = parametros.latitud || -32.89214159952345;
  13 + $scope.longitud = parametros.longitud || -68.84572999101856;
  14 + $scope.localizar = !! parametros.direccion;
15 15  
16   - if(direccion) {
  16 + if (parametros.direccion) {
17 17 focaModalLocalizarService
18 18 .getLatLng({
19   - street: direccion.numero + ' ' + direccion.calle,
  19 + street: parametros.direccion.numero + ' ' + parametros.direccion.calle,
20 20 country: 'Argentina',
21   - city: direccion.provincia,
22   - county: direccion.localidad,
  21 + city: parametros.direccion.provincia,
  22 + county: parametros.direccion.localidad,
23 23 format: 'json'
24 24 })
25 25 .then(function(res) {
26   - if(res.data.length) {
  26 + if (res.data.length) {
27 27 $scope.latitud = res.data[0].lat;
28 28 $scope.longitud = res.data[0].lon;
29 29 $scope.$broadcast('moveMap', {
30 30 latitud: $scope.latitud,
31 31 longitud: $scope.longitud
32 32 });
33   - }else {
  33 + } else {
34 34 focaModalService.alert('No se pudo localizar el domicilio');
35 35 }
36 36 });
src/js/osm-directive.js
... ... @@ -3,7 +3,6 @@ angular.module('focaModalLocalizar').directive('osmDireccion', function() {
3 3 restrict: 'E',
4 4 link: function(scope, el, attrs) {
5 5 var contenedor = document.createElement('div');
6   - contenedor.className = 'w-100 h-50 mt-3';
7 6 el.append(contenedor);
8 7 scope.map = L.map(contenedor).setView([-32.89214159952345, -68.84572999101856], attrs.zoom);
9 8 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map);