mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
otf: post/patch thirdparty ok, with addAddress creation/edition
This commit is contained in:
@@ -25,6 +25,14 @@
|
||||
<label for="name">{{ $t('thirdparty.name') }}</label>
|
||||
</div>
|
||||
|
||||
<add-address
|
||||
key="thirdparty"
|
||||
:context="context"
|
||||
:options="addAddress.options"
|
||||
:address-changed-callback="submitAddress"
|
||||
ref="addAddress">
|
||||
</add-address>
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="email"><i class="fa fa-fw fa-envelope"></i></span>
|
||||
<input class="form-control form-control-lg"
|
||||
@@ -43,12 +51,6 @@
|
||||
aria-describedby="phonenumber" />
|
||||
</div>
|
||||
|
||||
<add-address
|
||||
:context="this.context"
|
||||
:options="this.addAddress.options"
|
||||
:address-changed-callback="submitAddress">
|
||||
</add-address>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -66,6 +68,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//context: {},
|
||||
thirdparty: {
|
||||
type: 'thirdparty'
|
||||
},
|
||||
@@ -73,17 +76,13 @@ export default {
|
||||
options: {
|
||||
openPanesInModal: true,
|
||||
onlyButton: false,
|
||||
/*
|
||||
button: {
|
||||
text: {
|
||||
create: 'courselocation.add_temporary_address',
|
||||
edit: 'courselocation.edit_temporary_address'
|
||||
}
|
||||
size: 'btn-sm'
|
||||
},
|
||||
title: {
|
||||
create: 'courselocation.add_temporary_address',
|
||||
edit: 'courselocation.edit_temporary_address'
|
||||
} */
|
||||
create: 'add_an_address_title',
|
||||
edit: 'edit_address'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,7 +97,14 @@ export default {
|
||||
edit: false,
|
||||
addressId: null
|
||||
};
|
||||
if ( typeof this.thirdparty.address !== 'undefined'
|
||||
&& this.thirdparty.address.address_id !== null
|
||||
) { // to complete
|
||||
context.addressId = this.thirdparty.address.address_id;
|
||||
context.edit = true;
|
||||
}
|
||||
console.log('context', context);
|
||||
//this.context = context;
|
||||
return context;
|
||||
},
|
||||
},
|
||||
@@ -107,11 +113,20 @@ export default {
|
||||
getThirdparty(this.id).then(thirdparty => new Promise((resolve, reject) => {
|
||||
this.thirdparty = thirdparty;
|
||||
console.log('get thirdparty', thirdparty);
|
||||
if (this.action !== 'show') {
|
||||
this.$refs.addAddress.getInitialAddress(thirdparty.address.address_id);
|
||||
}
|
||||
resolve();
|
||||
}));
|
||||
},
|
||||
submitAddress(payload) {
|
||||
console.log('submitAddress', payload);
|
||||
if (typeof payload.addressId !== 'undefined') {
|
||||
this.context.edit = true;
|
||||
this.context.addressId = payload.addressId;
|
||||
console.log('switch address to edit mode', this.context);
|
||||
this.thirdparty.address = payload.address;
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
Reference in New Issue
Block a user