From 13b96637bbaf0ecaf78beb5e9c46bd3fc1583718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 13 Oct 2021 22:58:54 +0200 Subject: [PATCH] Refactor address vue app and create a PickAddressType --- .../Resources/views/Form/fields.html.twig | 22 +++-- .../AddressToIdDataTransformer.php | 45 ++++++++++ .../Form/Type/PickAddressType.php | 52 +++++++++++ .../Resources/public/vuejs/Address/App.vue | 6 +- .../vuejs/Address/mod_input_address_index.js | 87 ++++++++++++++++++ .../ChillMainBundle/chill.webpack.config.js | 1 + .../ChillMainBundle/config/services/form.yaml | 9 ++ .../Entity/ThirdParty.php | 4 +- .../Form/ThirdPartyType.php | 9 +- .../vuejs/_components/OnTheFly/ThirdParty.vue | 49 +++++++--- .../views/ThirdParty/_form.html.twig | 11 ++- .../Resources/views/ThirdParty/new.html.twig | 8 ++ .../views/ThirdParty/update.html.twig | 89 ++----------------- 13 files changed, 282 insertions(+), 110 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php create mode 100644 src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php create mode 100644 src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/mod_input_address_index.js diff --git a/src/Bundle/ChillCustomFieldsBundle/Resources/views/Form/fields.html.twig b/src/Bundle/ChillCustomFieldsBundle/Resources/views/Form/fields.html.twig index a19f22e6f..e4e611b8d 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Resources/views/Form/fields.html.twig +++ b/src/Bundle/ChillCustomFieldsBundle/Resources/views/Form/fields.html.twig @@ -1,16 +1,16 @@ {# * Copyright (C) 2014, Champs Libres Cooperative SCRLFS, - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. - * + * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . #} @@ -33,7 +33,7 @@ {# CFChoice : render the different elements in a choice list #} {% block cf_choices_row %}

{{ 'Choices'|trans }}

- +
@@ -47,8 +47,8 @@ {% endfor %}
- - + + {# we use javascrit to add an additional element. All functions are personnalized with the id ( = form.vars.id) #}