Skip to content
Snippets Groups Projects
Commit 7fce2380 authored by vagrant's avatar vagrant
Browse files

Update lat lng from adress

parent 920e2d33
No related branches found
No related tags found
No related merge requests found
Pipeline #35825 failed
......@@ -54,7 +54,7 @@
<div v-if="$v.address.codeInsee.$error" class="text-danger">Champ obligatoire</div>
</div>
<div class="form-group">
<PositionBlock :address="address" @addressError="addressError($event)" />
<PositionBlock :address="address" @addressError="addressError($event)" @updateAddressLoc="updateAddressLoc" />
<div v-if="$v.address.lat.$error || $v.address.lng.$error" class="text-danger">Localisation obligatoire</div>
</div>
</div>
......@@ -92,19 +92,15 @@ export default {
methods: {
checkValidation() {
this.$v.$touch()
if (this.$v.$invalid) {
return false
} else {
return true
}
return !this.$v.$invalid
},
addressError (message) {
console.log('test error')
this.$parent.toaster(this, message, 'bg-red')
},
updateAddressLoc (address) {
this.address.lat = address.lat
this.address.lng = address.lng
updateAddressLoc (address, lat, lng) {
console.log('updateAddressLoc', lat, lng)
this.address.lat = lat
this.address.lng = lng
},
}
}
......
......@@ -39,17 +39,16 @@ export default {
},
setMarker (lat, lng) {
this.marker = L.circleMarker([lat, lng], {draggable: true, radius: 7,fillColor:'red',fillOpacity:0.5,color: 'red'})
this.address.lat = lat
this.address.lng = lat
this.$emit('updateAddressLoc', this.address, lat, lng)
this.marker.on({
mousedown: () => this.map.on('mousemove', (e) => {
this.marker.setLatLng(e.latlng);
this.map.dragging.disable()
this.address.lat = e.latlng.lat
this.address.lng = e.latlng.lng
this.$emit('updateAddressLoc', this.address)
// this.address.lat = e.latlng.lat
this.$emit('updateAddressLoc', this.address, e.latlng.lat, e.latlng.lng)
}),
mouseup: () => {
this.map.dragging.enable()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment