diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue index b1d75c4d5..5136f830a 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue @@ -32,7 +32,7 @@ export default { }, mounted() { console.log('AddAddress: data context', this.context); - //console.log('AddAddress: data options', this.options); + console.log('AddAddress: data options', this.options); }, methods: { displayErrors() { @@ -45,7 +45,7 @@ export default { if (this.context.edit) { // address is already linked, just finish ! - this.$refs.addAddress.lastPaneAction(); + this.$refs.addAddress.afterLastPaneAction({}); // New created address } else { @@ -93,7 +93,7 @@ export default { this.$refs.addAddress.flag.success = true; // finish - this.$refs.addAddress.lastPaneAction(); + this.$refs.addAddress.afterLastPaneAction({ addressId: address.address_id }); resolve(); })) @@ -111,7 +111,7 @@ export default { this.$refs.addAddress.flag.success = true; // finish - this.$refs.addAddress.lastPaneAction(); + this.$refs.addAddress.afterLastPaneAction({ addressId: address.address_id }); resolve(); })) 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 e64029604..656f4a742 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue @@ -384,7 +384,9 @@ export default { if (!this.context.edit && this.useDatePane) { this.openDatePane(); } else { - this.openShowPane() + if (!this.options.forceRedirect) { + this.openShowPane(); + } } }, openDatePane() { @@ -402,13 +404,18 @@ export default { this.flag.datePane = false; this.openShowPane(); }, - lastPaneAction() { + afterLastPaneAction(params) { + this.initForm(); + // redirect or reset pane if (this.options.forceRedirect === true) { console.log("redirect to backUrl"); window.location.assign(this.context.backUrl); } else { - console.log("don't redirect"); + console.log("don't redirect, adapt context"); this.resetPane(); + // change to edit context + this.context.edit = true; + this.context.addressId = params.addressId; } }, @@ -546,14 +553,14 @@ export default { if (!this.context.edit) { this.addNewAddress(newAddress) - .then(payload => this.closePaneAndCallbackSubmit(payload)); + .then(payload => this.addressChangedCallback(payload)); } else { this.updateAddress({ addressId: this.context.addressId, newAddress: newAddress }) - .then(payload => this.closePaneAndCallbackSubmit(payload)); + .then(payload => this.addressChangedCallback(payload)); } }, @@ -655,18 +662,15 @@ export default { /* * Method just add closing pane to the callback method * (get out step1 show pane, submit button) - */ closePaneAndCallbackSubmit(payload) { - - this.initForm(); - this.resetPane(); - + //this.initForm(); + //this.resetPane(); // because parent callback will cast afterLastPaneAction() console.log('will call parent callback method', payload); - // callback props method from parent this.addressChangedCallback(payload); } + */ } } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/address_move.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/address_move.html.twig index fc2a28250..50346672b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/address_move.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/address_move.html.twig @@ -10,6 +10,7 @@ {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { targetEntity: { name: 'household', id: household.id }, backUrl: path('chill_person_household_addresses', { 'household_id': household.id }), + forceRedirect: true, stickyActions: true, } %} {# diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/addresses.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/addresses.html.twig index 854be6359..717f31e77 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/addresses.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/addresses.html.twig @@ -18,12 +18,12 @@ {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { targetEntity: { name: 'household', id: household.id }, backUrl: path('chill_person_household_addresses', { 'household_id': household.id }), + forceRedirect: true, mode: 'new', useValidFrom: true, buttonSize: 'btn-lg', buttonText: 'Move household', modalTitle: 'Move household', - forceRedirect: true, } %} {# #}