Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly

This commit is contained in:
2021-09-22 20:32:28 +02:00
8 changed files with 56 additions and 53 deletions

View File

@@ -40,8 +40,7 @@
:context="context"
:key="addAddress.type"
:options="addAddress.options"
:result="addAddress.result"
:addressChanged="submitTemporaryAddress"
:addressChangedCallback="submitTemporaryAddress"
ref="addAddress">
</add-address>
</li>
@@ -133,30 +132,30 @@ export default {
this.$store.commit('setAddressContext', context);
},
removeAddress() {
//console.log('remove address');
let payload = {
target: this.context.target.name,
targetId: this.context.target.id,
locationStatusTo: 'none'
};
//console.log('remove address');
this.$store.dispatch('updateLocation', payload);
},
displayErrors() {
return this.$refs.addAddress.errorMsg;
},
submitTemporaryAddress(payload) {
//console.log('@@@ click on Submit Temporary Address Button');
//console.log('@@@ click on Submit Temporary Address Button', payload);
payload['locationStatusTo'] = 'address'; // <== temporary, not none, not person
this.$store.dispatch('updateLocation', payload);
this.$store.commit('setEditContextTrue');
this.$store.commit('setEditContextTrue', payload);
}
},
mounted() {
created() {
this.initAddressContext();
//console.log('ac.locationStatus', this.accompanyingCourse.locationStatus);
//console.log('ac.location (temporary location)', this.accompanyingCourse.location);
//console.log('ac.personLocation', this.accompanyingCourse.personLocation);
console.log('ac.locationStatus', this.accompanyingCourse.locationStatus);
console.log('ac.location (temporary location)', this.accompanyingCourse.location);
console.log('ac.personLocation', this.accompanyingCourse.personLocation);
}
}
</script>

View File

@@ -129,14 +129,19 @@ let initPromise = getAccompanyingCourse(id)
state.addressContext = context;
},
updateLocation(state, r) {
//console.log('### mutation: set location attributes', r);
state.accompanyingCourse.location = r.location;
//console.log('### mutation: set location attributes', r);
state.accompanyingCourse.locationStatus = r.locationStatus;
if (r.locationStatus !== 'person') {
state.addressContext.addressId = r.location.address_id;
//console.log('mutation: update context addressId', state.addressContext.addressId);
}
state.accompanyingCourse.location = r.location;
state.accompanyingCourse.personLocation = r.personLocation;
},
setEditContextTrue(state) {
//console.log('### mutation: set edit context = true');
setEditContextTrue(state, payload) {
//console.log('### mutation: set edit context true with addressId', payload.addressId);
state.addressContext.edit = true;
state.addressContext.addressId = payload.addressId;
}
},
actions: {
@@ -260,7 +265,7 @@ let initPromise = getAccompanyingCourse(id)
})).catch((error) => { commit('catchError', error) });
},
updateLocation({ commit }, payload) {
//console.log('## action: updateLocation', payload.locationStatusTo);
//console.log('## action: updateLocation', payload.locationStatusTo);
let body = { 'type': payload.target, 'id': payload.targetId };
let location = {};
if (payload.locationStatusTo === 'person') { // patch for person address (don't remove addressLocation)

View File

@@ -75,7 +75,7 @@
:key="addAddress.key"
:options="addAddress.options"
:result="addAddress.result"
@submitAddress="setHouseholdCreatedAddress"
@addressChangedCallback="setHouseholdCreatedAddress"
ref="addAddress">
</add-address>
</li>
@@ -282,8 +282,7 @@ export default {
console.log('setHouseholdAddress', a);
this.$store.commit('setHouseholdAddress', a);
},
setHouseholdCreatedAddress() {
let payload = this.$refs.addAddress.submitNewAddress();
setHouseholdCreatedAddress(payload) {
console.log('setHouseholdAddress', payload);
this.$store.dispatch('setHouseholdNewAddress', payload);
},