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