diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue index 0aa16d5e3..55d8a93d1 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue @@ -325,9 +325,9 @@ export default { return (this.validFrom || this.validTo) ? true : false; }, hasSuggestions() { - console.log(this.context.suggestions); if (typeof(this.context.suggestions) !== 'undefined') { - return this.context.suggestions.length > 0; + console.log('hasSuggestions', this.context.suggestions); + return this.context.suggestions.length > 0; } return false; }, @@ -353,9 +353,9 @@ export default { }, mounted() { - console.log('validFrom', this.validFrom); - console.log('validTo', this.validTo); - console.log('useDatePane', this.useDatePane); + //console.log('validFrom', this.validFrom); + //console.log('validTo', this.validTo); + //console.log('useDatePane', this.useDatePane); console.log('Mounted now !'); if (this.context.edit) { diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/OnTheFly.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/OnTheFly.vue index 5f116e057..a87940ba3 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/OnTheFly.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/OnTheFly.vue @@ -160,10 +160,9 @@ export default { break; default: - if (typeof this.type === 'undefined') { + if (typeof this.type === 'undefined') { // action=create type = this.$refs.castNew.radioType; data = this.$refs.castNew.castDataByType(); - } else { throw 'error with object type'; } diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/OnTheFly/Create.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/OnTheFly/Create.vue index c5d949c4e..f8d221674 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/OnTheFly/Create.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/OnTheFly/Create.vue @@ -72,7 +72,10 @@ export default { case 'person': return this.$refs.castPerson.$data.person; case 'thirdparty': - return this.$refs.castThirdparty.$data.thirdparty; + let data = this.$refs.castThirdparty.$data.thirdparty; + data.name = data.text; + data.address = { id: data.address.address_id } + return data; default: throw Error('Invalid type of entity') } diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue index 850c77bb5..6d28db7c9 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue @@ -25,6 +25,14 @@ + + +
- - - @@ -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() {