diff --git a/src/js/controller.js b/src/js/controller.js index cc99d23..003d059 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -14,6 +14,7 @@ angular.module('focaModalPuntoDescarga') $scope.articuloSeleccionado = 0; $scope.ivas = []; $scope.puntosSeleccionados = []; + $scope.editando = false; $scope.puntoDescarga = { id: 0, id_cliente: filters.idCliente, @@ -31,6 +32,14 @@ angular.module('focaModalPuntoDescarga') $scope.cancel = function() { if($scope.ingreso) { $scope.ingreso = false; + $scope.puntoDescarga = { + id: 0, + id_cliente: filters.idCliente, + id_da_config_0: filters.idDomicilio, + latitud: -32.89214159952345, + longitud: -68.84572999101856 + }; + $scope.editando = false; }else { $uibModalInstance.dismiss('cancel'); } @@ -57,6 +66,7 @@ angular.module('focaModalPuntoDescarga') latitud: -32.89214159952345, longitud: -68.84572999101856 }; + $scope.editando = false; }); }; @@ -64,6 +74,7 @@ angular.module('focaModalPuntoDescarga') focaModalPuntoDescargaService.getPuntoDescargaById(id).then(function(res) { $scope.puntoDescarga = res.data; $scope.ingreso = true; + $scope.editando = true; }); }; diff --git a/src/js/osm-directive.js b/src/js/osm-directive.js index c376535..67c1f58 100644 --- a/src/js/osm-directive.js +++ b/src/js/osm-directive.js @@ -20,7 +20,7 @@ angular.module('focaModalPuntoDescarga').directive('osmPuntoDescarga', function( $scope.map.removeLayer($scope.markers[i]); } $scope.markers.push( - L.marker([$scope.latitud, $scope.longitud], {draggable:'true'}) + L.marker([$scope.latitud, $scope.longitud], {draggable: $scope.draggable}) .addTo($scope.map) .on('dragend', function() { $scope.latitud = this.getLatLng().lat; @@ -33,7 +33,8 @@ angular.module('focaModalPuntoDescarga').directive('osmPuntoDescarga', function( scope: { latitud: '=', longitud: '=', - zoom: '=' + zoom: '=', + draggable: '<' } }; }); diff --git a/src/views/modal-punto-descarga.html b/src/views/modal-punto-descarga.html index c52cf2d..a4e9a1b 100644 --- a/src/views/modal-punto-descarga.html +++ b/src/views/modal-punto-descarga.html @@ -25,7 +25,7 @@