Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly

This commit is contained in:
Mathieu Jaumotte 2021-09-15 18:20:18 +02:00
commit 546a2e4fa1
8 changed files with 42 additions and 33 deletions

View File

@ -3,8 +3,12 @@
It push all variables from context in Address/App.vue. It push all variables from context in Address/App.vue.
OPTIONS OPTIONS
* mode string ['edit*'|'new'|'create'] * targetEntity {
* address_id integer name: string
id: integer
}
* mode string ['edit*'|'create']
* addressId integer
* backUrl twig route: path('route', {parameters}) * backUrl twig route: path('route', {parameters})
* modalTitle twig translated chain * modalTitle twig translated chain
* buttonText twig translated chain * buttonText twig translated chain
@ -19,29 +23,18 @@
<script type="text/javascript"> <script type="text/javascript">
window.vueRootComponent = 'app'; window.vueRootComponent = 'app';
{% if person is defined %} window.entityType = '{{ targetEntity.name|e('js') }}';
window.entityType = 'person'; window.entityId = '{{ targetEntity.id|e('js') }}';
window.entityId = {{ person.id|e('js') }};
{% elseif household is defined %}
window.entityType = 'household';
window.entityId = {{ household.id|e('js') }};
{% endif %}
{% if 'edit' in app.request.get('_route') %} {% if 'edit' in app.request.get('_route') %}
window.mode = 'edit';
window.addressId = {{ app.request.get('address_id')|e('js') }}; window.addressId = {{ app.request.get('address_id')|e('js') }};
window.mode = 'edit';
{% elseif mode is defined and mode == 'edit' %} {% elseif mode is defined and mode == 'edit' %}
window.addressId = {{ address_id|e('js') }};
window.mode = 'edit'; window.mode = 'edit';
window.addressId = {{ addressId|e('js') }};
{% endif %} {% endif %}
{% if backUrl is not defined %} {% if backUrl is defined %}
{% if person is defined %}
window.backUrl = '{{ path('chill_person_address_list', { 'person_id': person.id })|e('js') }}';
{% elseif household is defined %}
window.backUrl = '{{ path('chill_person_household_addresses', { 'household_id': household.id })|e('js') }}';
{% endif %}
{% else %}
window.backUrl = '{{ backUrl|e('js') }}'; window.backUrl = '{{ backUrl|e('js') }}';
{% endif %} {% endif %}
@ -49,7 +42,6 @@
window.modalTitle = '{{ modalTitle|trans|e('js') }}'; window.modalTitle = '{{ modalTitle|trans|e('js') }}';
{% endif %} {% endif %}
{% if buttonText is defined %} {% if buttonText is defined %}
window.buttonText = '{{ buttonText|trans|e('js') }}'; window.buttonText = '{{ buttonText|trans|e('js') }}';
{% endif %} {% endif %}

View File

@ -27,7 +27,9 @@
<h1>{{ block('title') }}</h1> <h1>{{ block('title') }}</h1>
{# include vue_address component #} {# include vue_address component #}
{% include '@ChillPerson/Address/_insert_vue_address.html.twig' with { {% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'person', id: person.id },
backUrl: path('chill_person_address_list', { 'person_id': person.id }),
binModalStep1: false, binModalStep1: false,
binModalStep2: false, binModalStep2: false,
} %} } %}

View File

@ -29,8 +29,10 @@
<li style="margin: auto;"> <li style="margin: auto;">
{# include vue_address component #} {# include vue_address component #}
{% include '@ChillPerson/Address/_insert_vue_address.html.twig' with { {% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
mode: 'new', targetEntity: { name: 'person', id: person.id },
backUrl: path('chill_person_address_list', { 'person_id': person.id }),
mode: 'create',
buttonSize: 'btn-lg', buttonSize: 'btn-lg',
buttonText: 'Add an address', buttonText: 'Add an address',
modalTitle: 'Add an address', modalTitle: 'Add an address',
@ -67,9 +69,11 @@
{# include vue_address component #} {# 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 '@ChillPerson/Address/_insert_vue_address.html.twig' with { {% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
address_id: address.id, targetEntity: { name: 'person', id: person.id },
backUrl: path('chill_person_address_list', { 'person_id': person.id }),
mode: 'edit', mode: 'edit',
addressId: address.id,
binModalStep1: false, binModalStep1: false,
binModalStep2: false, binModalStep2: false,
} %} } %}
@ -81,9 +85,11 @@
{# include vue_address component #} {# 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 '@ChillPerson/Address/_insert_vue_address.html.twig' with { {% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
address_id: address.id, targetEntity: { name: 'person', id: person.id },
backUrl: path('chill_person_address_list', { 'person_id': person.id }),
mode: 'edit', mode: 'edit',
addressId: address.id,
binModalStep1: false, binModalStep1: false,
binModalStep2: false, binModalStep2: false,
} %} } %}

View File

@ -27,7 +27,9 @@
<h1>{{ block('title') }}</h1> <h1>{{ block('title') }}</h1>
{# include vue_address component #} {# include vue_address component #}
{% include '@ChillPerson/Address/_insert_vue_address.html.twig' with { {% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'person', id: person.id },
backUrl: path('chill_person_address_list', { 'person_id': person.id }),
binModalStep1: false, binModalStep1: false,
binModalStep2: false, binModalStep2: false,
} %} } %}

View File

@ -7,7 +7,9 @@
<div> <div>
{# include vue_address component #} {# include vue_address component #}
{% include '@ChillPerson/Address/_insert_vue_address.html.twig' with { {% 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 })
binModalStep1: false, binModalStep1: false,
binModalStep2: false, binModalStep2: false,
} %} } %}

View File

@ -7,7 +7,9 @@
<div> <div>
{# include vue_address component #} {# include vue_address component #}
{% include '@ChillPerson/Address/_insert_vue_address.html.twig' with { {% 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 })
binModalStep1: false, binModalStep1: false,
binModalStep2: false, binModalStep2: false,
} %} } %}

View File

@ -15,9 +15,10 @@
<li style="margin: auto;"> <li style="margin: auto;">
{# include vue_address component #} {# include vue_address component #}
{% include '@ChillPerson/Address/_insert_vue_address.html.twig' with { {% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
mode: 'new', targetEntity: { name: 'household', id: household.id },
backUrl: chill_path_add_return_path('chill_person_household_address_move', { 'household_id': household.id }), backUrl: path('chill_person_household_address_move', { 'household_id': household.id }),
mode: 'create',
buttonSize: 'btn-lg', buttonSize: 'btn-lg',
buttonText: 'Move household', buttonText: 'Move household',
modalTitle: 'Move household', modalTitle: 'Move household',

View File

@ -30,7 +30,9 @@
<ul class="list-inline text-right mt-2"> <ul class="list-inline text-right mt-2">
<li class="list-inline-item"> <li class="list-inline-item">
{# include vue_address component #} {# include vue_address component #}
{% include '@ChillPerson/Address/_insert_vue_address.html.twig' with { {% 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 }),
mode: 'create', mode: 'create',
buttonSize: 'btn-sm', buttonSize: 'btn-sm',
buttonText: 'Move household', buttonText: 'Move household',