improve vue Address options (to be checked in all context)

This commit is contained in:
Mathieu Jaumotte 2021-08-12 15:39:18 +02:00
parent 840ffe42a6
commit 76a4b24aa1

View File

@ -205,25 +205,38 @@ export default {
return step2;
},
getTextTitle() {
if (this.options.title && (this.options.title.edit !== null || this.options.title.create !== null)) {
if ( typeof this.options.title !== 'undefined'
&& ( this.options.title.edit !== null
|| this.options.title.create !== null
)) {
return (this.context.edit) ? this.options.title.edit : this.options.title.create;
}
return (this.context.edit) ? this.$t(this.default.title.edit) : this.$t(this.default.title.create);
},
getTextButton() {
if (this.options.button && this.options.button.text && (this.options.button.text.edit !== null || this.options.button.text.create !== null)) {
if ( typeof this.options.button.text !== 'undefined'
&& ( this.options.button.text.edit !== null
|| this.options.button.text.create !== null
)) {
return (this.context.edit) ? this.options.button.text.edit : this.options.button.text.create;
}
return (this.context.edit) ? this.default.button.text.edit : this.default.button.text.create;
},
getClassButton() {
let size = (this.options.button && this.options.button.size !== null) ? this.options.button.size : '';
let type = (this.options.button && this.options.button.type !== null) ? this.options.button.type : this.default.button.type;
return size ? size + ' ' + type : type;
let type = this.default.button.type,
size = '';
if (typeof this.options.button !== 'undefined') {
type = typeof this.options.button.type !== 'undefined' ? this.options.button.type : type;
size = typeof this.options.button.size !== 'undefined' ? this.options.button.size : size;
}
return size ? `${size} ${type}` : type;
},
displayTextButton() {
return (this.options.button !== null && typeof this.options.button.display !== 'undefined') ?
return (typeof this.options.button !== 'undefined' && typeof this.options.button.display !== 'undefined') ?
this.options.button.display : this.default.button.display;
},
context() {
return this.context;
}
},
mounted() {
@ -462,6 +475,7 @@ export default {
// TODO change the condition because it writes new postal code in edit mode now: !writeNewPostalCode
this.flag.loading = true;
if ('newPostcode' in payload.newAddress) {
let postcodeBody = payload.newAddress.newPostcode;
postcodeBody = Object.assign(postcodeBody, {'origin': 3});