tp: adapt _insert_vue_address include parameters

This commit is contained in:
2021-09-15 18:21:18 +02:00
parent 546a2e4fa1
commit 9725970c56
6 changed files with 16 additions and 93 deletions

View File

@@ -1,77 +0,0 @@
{#
This Twig template include load vue_address component.
It push all variables from context in Address/App.vue.
OPTIONS
* mode string ['edit*'|'new'|'create']
* address_id integer
* backUrl twig route: path('route', {parameters})
* modalTitle twig translated chain
* buttonText twig translated chain
* buttonSize bootstrap class like 'btn-sm'
* buttonDisplayText bool
* binModalStep1 bool
* binModalStep2 bool
#}
<div id="address"></div>
<script type="text/javascript">
window.vueRootComponent = 'app';
window.entityType = 'thirdParty';
window.entityId = {{ thirdParty.id|e('js') }};
{% if 'edit' in app.request.get('_route') %}
window.addressId = {{ app.request.get('address_id')|e('js') }};
window.mode = 'edit';
{% elseif mode is defined and mode == 'edit' %}
window.addressId = {{ address_id|e('js') }};
window.mode = 'edit';
{% endif %}
{% if backUrl is not defined %}
window.backUrl = '{{ path('chill_3party_3party_show', { 'thirdparty_id': thirdParty.id })|e('js') }}';
{% else %}
window.backUrl = '{{ backUrl|e('js') }}';
{% endif %}
{% if modalTitle is defined %}
window.modalTitle = '{{ modalTitle|trans|e('js') }}';
{% endif %}
{% if buttonText is defined %}
window.buttonText = '{{ buttonText|trans|e('js') }}';
{% endif %}
{% if buttonSize is defined %}
window.buttonSize = '{{ buttonSize|e('js') }}';
{% endif %}
{% if buttonDisplayText is defined and buttonDisplayText == false %}
window.buttonDisplayText = false;
{% endif %}
{% if binModalStep1 is defined and binModalStep1 == false %}
window.binModalStep1 = false;
{% endif %}
{% if binModalStep2 is defined and binModalStep2 == false %}
window.binModalStep2 = false;
{% endif %}
</script>
{{ encore_entry_script_tags('vue_address') }}
{{ encore_entry_link_tags('vue_address') }}
{# TODO
* un seul fichier include twig qui fais la liaison avec vue_address
* dans main
* enlever les références à household, person, thirdparty
* addAddress
* option buttonText est buggée
* gestion du step1
*
#}

View File

@@ -40,23 +40,25 @@
{% if thirdParty.address %}
edit address
{# include vue_address component #}
{% include '@ChillThirdParty/Address/_insert_vue_address.html.twig' with {
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'thirdparty', id: thirdParty.id },
backUrl: path('chill_3party_3party_new')
mode: 'edit',
address_id: thirdParty.address.id,
addressId: thirdParty.address.id,
buttonSize: 'btn-sm',
binModalStep1: false,
backUrl: path('chill_3party_3party_new')
} %}
{% else %}
create address
{# include vue_address component #}
{% include '@ChillThirdParty/Address/_insert_vue_address.html.twig' with {
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'thirdparty', id: thirdParty.id },
backUrl: path('chill_3party_3party_new')
mode: 'create',
buttonSize: 'btn-sm',
buttonText: 'Create a new address',
modalTitle: 'Create a new address',
binModalStep1: false,
backUrl: path('chill_3party_3party_new')
} %}
{% endif %}
</div>

View File

@@ -57,16 +57,20 @@
{% if thirdParty.address %}
edit address
{# include vue_address component #}
{% include '@ChillThirdParty/Address/_insert_vue_address.html.twig' with {
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'thirdparty', id: thirdParty.id },
backUrl: path('chill_3party_3party_update', { thirdparty_id: thirdParty_id }),
mode: 'edit',
address_id: thirdParty.address.id,
addressId: thirdParty.address.id,
buttonSize: 'btn-sm',
binModalStep1: false
} %}
{% else %}
create address
{# include vue_address component #}
{% include '@ChillThirdParty/Address/_insert_vue_address.html.twig' with {
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'thirdparty', id: thirdParty.id },
backUrl: path('chill_3party_3party_update', { thirdparty_id: thirdParty_id }),
mode: 'create',
buttonSize: 'btn-sm',
binModalStep1: false