tp: adapt _insert_vue_address include parameters

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

View File

@ -4,7 +4,6 @@
{{ $t('courselocation.title') }} {{ $t('courselocation.title') }}
</h2> </h2>
<!-- {# include vue_address component #} -->
<div v-for="error in displayErrors" class="alert alert-danger my-2"> <div v-for="error in displayErrors" class="alert alert-danger my-2">
{{ error }} {{ error }}
</div> </div>

View File

@ -66,8 +66,8 @@
{% if address.validTo is not empty and address.validTo < previousRowFrom %} {% if address.validTo is not empty and address.validTo < previousRowFrom %}
<div class="{{ 'row' ~ row ~ ' ' }}col-a action"> <div class="{{ 'row' ~ row ~ ' ' }}col-a action">
{# include vue_address component #}
<a href="" class="btn btn-sm btn-create">{{ 'Insert an address'|trans }}</a></div> <a href="" class="btn btn-sm btn-create">{{ 'Insert an address'|trans }}</a></div>
{# include vue_address component #}
{# {#
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with { {% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'person', id: person.id }, targetEntity: { name: 'person', id: person.id },
@ -82,8 +82,8 @@
<div class="{{ 'row' ~ row ~ ' ' }}col-b"></div> <div class="{{ 'row' ~ row ~ ' ' }}col-b"></div>
<div class="{{ 'row' ~ row ~ ' ' }}col-c action"> <div class="{{ 'row' ~ row ~ ' ' }}col-c action">
{# include vue_address component #}
<a href="" class="btn btn-sm btn-create">{{ 'Insert an address'|trans }}</a></div> <a href="" class="btn btn-sm btn-create">{{ 'Insert an address'|trans }}</a></div>
{# include vue_address component #}
{# {#
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with { {% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'person', id: person.id }, targetEntity: { name: 'person', id: person.id },
@ -115,7 +115,6 @@
}) }} }) }}
<ul class="record_actions"> <ul class="record_actions">
{# include vue_address component #}
<li><a href="{{ path('chill_person_address_edit', { 'person_id': person.id, 'address_id' : address.id } ) }}" class="btn btn-edit"></a></li> <li><a href="{{ path('chill_person_address_edit', { 'person_id': person.id, 'address_id' : address.id } ) }}" class="btn btn-edit"></a></li>
</ul> </ul>
@ -166,7 +165,6 @@
</a> </a>
</li> </li>
<li> <li>
{# include vue_address component #}
<a class="btn btn-create" <a class="btn btn-create"
href="{{ path('chill_person_address_new', { 'person_id' : person.id } ) }}"> href="{{ path('chill_person_address_new', { 'person_id' : person.id } ) }}">
{{ 'Add an address'|trans }} {{ 'Add an address'|trans }}

View File

@ -42,7 +42,6 @@
<div class="{{ 'row' ~ row ~ ' ' }}col-b"></div> <div class="{{ 'row' ~ row ~ ' ' }}col-b"></div>
<div class="{{ 'row' ~ row ~ ' ' }}col-c action"> <div class="{{ 'row' ~ row ~ ' ' }}col-c action">
{# include vue_address component #}
<a href="" class="btn btn-sm btn-create">{{ 'Insert an address'|trans }}</a></div> <a href="" class="btn btn-sm btn-create">{{ 'Insert an address'|trans }}</a></div>
<div class="date"> <div class="date">
@ -65,7 +64,6 @@
<ul class="record_actions"> <ul class="record_actions">
<li> <li>
{# include vue_address component #}
<a href="{{ path('chill_person_household_address_edit', { 'household_id': household.id, 'address_id' : address.id } ) }}" <a href="{{ path('chill_person_household_address_edit', { 'household_id': household.id, 'address_id' : address.id } ) }}"
class="btn btn-edit"></a> class="btn btn-edit"></a>
@ -92,7 +90,6 @@
</li> </li>
<li> <li>
{# include vue_address component #}
<a class="btn btn-create" <a class="btn btn-create"
href="{{ chill_path_add_return_path('chill_person_household_address_move', { 'household_id': household.id }) }}"> href="{{ chill_path_add_return_path('chill_person_household_address_move', { 'household_id': household.id }) }}">
{{ 'Move household'|trans }} {{ 'Move household'|trans }}

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 %} {% if thirdParty.address %}
edit address edit address
{# include vue_address component #} {# 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', mode: 'edit',
address_id: thirdParty.address.id, addressId: thirdParty.address.id,
buttonSize: 'btn-sm', buttonSize: 'btn-sm',
binModalStep1: false, binModalStep1: false,
backUrl: path('chill_3party_3party_new')
} %} } %}
{% else %} {% else %}
create address create address
{# include vue_address component #} {# 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', mode: 'create',
buttonSize: 'btn-sm', buttonSize: 'btn-sm',
buttonText: 'Create a new address', buttonText: 'Create a new address',
modalTitle: 'Create a new address', modalTitle: 'Create a new address',
binModalStep1: false, binModalStep1: false,
backUrl: path('chill_3party_3party_new')
} %} } %}
{% endif %} {% endif %}
</div> </div>

View File

@ -57,16 +57,20 @@
{% if thirdParty.address %} {% if thirdParty.address %}
edit address edit address
{# include vue_address component #} {# 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', mode: 'edit',
address_id: thirdParty.address.id, addressId: thirdParty.address.id,
buttonSize: 'btn-sm', buttonSize: 'btn-sm',
binModalStep1: false binModalStep1: false
} %} } %}
{% else %} {% else %}
create address create address
{# include vue_address component #} {# 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', mode: 'create',
buttonSize: 'btn-sm', buttonSize: 'btn-sm',
binModalStep1: false binModalStep1: false