Merge branch 'issue593_bug_addAddress' into 'master'

address: fix bug when editing address: update localisation and...

See merge request Chill-Projet/chill-bundles!419
This commit is contained in:
Julien Fastré 2022-04-28 16:05:01 +00:00
commit 7a96671f35
5 changed files with 28 additions and 13 deletions

View File

@ -11,9 +11,11 @@ and this project adheres to
## Unreleased
<!-- write down unreleased development here -->
* [address] fix bug when editing address: update location and addressreferenceId + better update of the map in edition (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/593)
* [main] avoid address reference search on undefined post code (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/561)
* [person] prevent duplicate relationship in filiation/household graph (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/560)
* [Documents] Validate storedObject and allow for null data (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/565)
* [parcours]: Comments can be unpinned + edit/delete for all users that are allowed to edit parcours (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/566)
## Test releases
@ -36,7 +38,6 @@ and this project adheres to
* [Course comment] add validationConstraint NotNull and NotBlank on comment content, to avoid sql error
* [Notifications] delay the sending of notificaiton to kernel.terminate
* [Notifications / Period user change] fix the sending of notification when user changes
* [parcours]: Comments can be unpinned + edit/delete for all users that are allowed to edit parcours (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/566)
* [Activity form] invert 'incoming' and 'receiving' in Activity form
* [Activity form] keep the same order for 'attendee' field in new and edit form
* [list with period] use "sameas" test operator to introduce requestor in list

View File

@ -628,6 +628,10 @@ export default {
newAddress = Object.assign(newAddress, {
'addressReference': this.entity.selected.address.addressReference
});
} else {
newAddress = Object.assign(newAddress, {
'addressReference': null
});
}
if (this.validFrom) {

View File

@ -8,12 +8,15 @@ import L from 'leaflet';
import markerIconPng from 'leaflet/dist/images/marker-icon.png'
import 'leaflet/dist/leaflet.css';
let map;
let marker;
export default {
name: 'AddressMap',
props: ['entity'],
data() {
return {
map: null,
marker: null
}
},
computed: {
center() {
return this.entity.selected.addressMap.center;
@ -21,30 +24,33 @@ export default {
},
methods:{
init() {
map = L.map('address_map').setView([46.67059, -1.42683], 12);
this.map = L.map('address_map').setView([46.67059, -1.42683], 12);
map.scrollWheelZoom.disable();
this.map.scrollWheelZoom.disable();
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
}).addTo(this.map);
const markerIcon = L.icon({
iconUrl: markerIconPng,
iconAnchor: [12, 41],
});
marker = L.marker([48.8589, 2.3469], {icon: markerIcon}).addTo(map);
this.marker = L.marker([48.8589, 2.3469], {icon: markerIcon});
this.marker.addTo(this.map);
},
update() {
//console.log('update map with : ', this.address.addressMap.center)
marker.setLatLng(this.entity.addressMap.center);
map.setView(this.entity.addressMap.center, 15);
//console.log('update map with : ', this.entity.addressMap.center)
if (this.marker && this.entity.addressMap.center) {
this.marker.setLatLng(this.entity.addressMap.center);
this.map.setView(this.entity.addressMap.center, 15);
}
}
},
mounted(){
this.init()
this.init();
this.update();
}
}
</script>

View File

@ -106,6 +106,9 @@ export default {
this.$emit('getReferenceAddresses', this.value);
if (this.value.center) {
this.updateMapCenter(this.value.center);
if (this.value.center.coordinates) {
this.entity.selected.postcode.coordinates = this.value.center.coordinates;
}
}
}
},

View File

@ -71,6 +71,7 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw
'id' => $address->getPostCode()->getId(),
'name' => $address->getPostCode()->getName(),
'code' => $address->getPostCode()->getCode(),
'center' => $address->getPostcode()->getCenter(),
],
'country' => [
'id' => $address->getPostCode()->getCountry()->getId(),