improve addAddress

This commit is contained in:
2021-09-18 17:47:49 +02:00
parent 2788170f03
commit a842229d5e
18 changed files with 136 additions and 70 deletions

View File

@@ -54,8 +54,8 @@ export default {
assignAddress() {
//console.log('assignAddress id', this.person.current_household_address);
let payload = {
entity: this.context.entity.name,
entityId: this.context.entity.id,
target: this.context.target.name,
targetId: this.context.target.id,
locationStatusTo: 'person',
personId: this.person.id
};

View File

@@ -94,7 +94,7 @@ export default {
useDate: {
validFrom: true
},
onlyButton: true
hideAddress: true
}
}
}
@@ -120,7 +120,7 @@ export default {
methods: {
initAddressContext() {
let context = {
entity: {
target: {
name: this.accompanyingCourse.type,
id: this.accompanyingCourse.id
},
@@ -136,8 +136,8 @@ export default {
removeAddress() {
//console.log('remove address');
let payload = {
entity: this.context.entity.name,
entityId: this.context.entity.id,
target: this.context.target.name,
targetId: this.context.target.id,
locationStatusTo: 'none'
};
this.$store.dispatch('updateLocation', payload);

View File

@@ -261,7 +261,7 @@ let initPromise = getAccompanyingCourse(id)
},
updateLocation({ commit }, payload) {
//console.log('## action: updateLocation', payload.locationStatusTo);
let body = { 'type': payload.entity, 'id': payload.entityId };
let body = { 'type': payload.target, 'id': payload.targetId };
let location = {};
if (payload.locationStatusTo === 'person') { // patch for person address (don't remove addressLocation)
location = { 'personLocation': { 'type': 'person', 'id': payload.personId }};
@@ -273,7 +273,7 @@ let initPromise = getAccompanyingCourse(id)
location = { 'personLocation': null };
}
Object.assign(body, location);
patchAccompanyingCourse(payload.entityId, body)
patchAccompanyingCourse(payload.targetId, body)
.then(accompanyingCourse => new Promise((resolve, reject) => {
commit('updateLocation', {
location: accompanyingCourse.location,