AddAddress: openPanesInModal, uniq option to enable/disable all step123 in Modal

This commit is contained in:
Mathieu Jaumotte 2021-09-17 10:50:57 +02:00
parent 782f0bc332
commit 6a60758c0d
10 changed files with 19 additions and 48 deletions

View File

@ -9,8 +9,8 @@
</button> </button>
<!-- step 1 --> <!-- step 1 -->
<teleport to="body" v-if="step1WithModal">
<modal v-if="flag.showPane" <modal v-if="flag.showPane"
<teleport to="body" v-if="InModal">
modalDialogClass="modal-dialog-scrollable modal-xl" modalDialogClass="modal-dialog-scrollable modal-xl"
@close="flag.showPane = false"> @close="flag.showPane = false">
@ -62,7 +62,7 @@
</div> </div>
<!-- step 2 --> <!-- step 2 -->
<teleport to="body" v-if="step2WithModal"> <teleport to="body" v-if="InModal">
<modal v-if="flag.editPane" <modal v-if="flag.editPane"
modalDialogClass="modal-dialog-scrollable modal-xl" modalDialogClass="modal-dialog-scrollable modal-xl"
@close="flag.editPane = false"> @close="flag.editPane = false">
@ -147,10 +147,7 @@ export default {
displayText: true displayText: true
}, },
title: { create: 'add_an_address_title', edit: 'edit_address' }, title: { create: 'add_an_address_title', edit: 'edit_address' },
bindModal: { openPanesInModal: true,
step1: true,
step2: true,
},
useDate: { useDate: {
validFrom: false, validFrom: false,
validTo: false validTo: false
@ -192,19 +189,9 @@ export default {
} }
}, },
computed: { computed: {
step1WithModal() { InModal() {
return (typeof this.options.bindModal !== 'undefined' && typeof this.options.bindModal.step1 !== 'undefined') ? return (typeof this.options.openPanesInModal !== 'undefined') ?
this.options.bindModal.step1 : this.default.bindModal.step1; this.options.openPanesInModal : this.default.openPanesInModal;
},
step2WithModal() {
let step2 = (typeof this.options.bindModal !== 'undefined' && typeof this.options.bindModal.step2 !== 'undefined') ?
this.options.bindModal.step2 : this.default.bindModal.step2;
if (step2 === false && this.step1WithModal === true) {
console.log("step2 must open in a Modal");
return true;
}
return step2;
}, },
getTextTitle() { getTextTitle() {
if ( typeof this.options.title !== 'undefined' if ( typeof this.options.title !== 'undefined'

View File

@ -38,12 +38,9 @@ containers.forEach((container) => {
create: container.dataset.modalTitle || null, create: container.dataset.modalTitle || null,
edit: container.dataset.modalTitle || null edit: container.dataset.modalTitle || null
}, },
/// Display each step in page or Modal
bindModal: {
step1: container.dataset.bindModalStep1 !== 'false', //boolean, default: true
step2: container.dataset.bindModalStep2 !== 'false' //boolean, default: true
},
// Use Date fields // Use Date fields
/// Display panes in Modal for step123
openPanesInModal: container.dataset.openPanesInModal !== 'false', //boolean, default: true
useDate: { useDate: {
validFrom: container.dataset.useValidFrom === 'true', //boolean, default: false validFrom: container.dataset.useValidFrom === 'true', //boolean, default: false
validTo: container.dataset.useValidTo === 'true' //boolean, default: false validTo: container.dataset.useValidTo === 'true' //boolean, default: false

View File

@ -14,9 +14,8 @@
* buttonText twig translated chain * buttonText twig translated chain
* buttonSize bootstrap class like 'btn-sm' * buttonSize bootstrap class like 'btn-sm'
* buttonDisplayText bool * buttonDisplayText bool
* bindModalStep1 bool
* bindModalStep2 bool
* openPanesInModal bool (default: true)
#} #}
<div class="address-container" <div class="address-container"
@ -51,13 +50,10 @@
data-button-display-text="false" data-button-display-text="false"
{% endif %} {% endif %}
{% if bindModalStep1 is defined and bindModalStep1 != 1 %} {% if openPanesInModal is defined and openPanesInModal != 1 %}
data-bind-modal-step1="false" data-open-panes-in-modal="false"
{% endif %} {% endif %}
{% if bindModalStep2 is defined and bindModalStep2 != 1 %}
data-bind-modal-step2="false"
{% endif %}
{% if useValidFrom is defined and useValidFrom == 1 %} {% if useValidFrom is defined and useValidFrom == 1 %}
data-use-valid-from="true" data-use-valid-from="true"

View File

@ -89,9 +89,7 @@ export default {
edit: 'courselocation.edit_temporary_address' edit: 'courselocation.edit_temporary_address'
}, },
/// Display each step in page or Modal /// Display each step in page or Modal
bindModal: { openPanesInModal: true,
//step1: false, step2: false
},
// Use Date fields // Use Date fields
useDate: { useDate: {
validFrom: true validFrom: true

View File

@ -30,8 +30,7 @@
{% 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 },
backUrl: path('chill_person_address_list', { 'person_id': person.id }), backUrl: path('chill_person_address_list', { 'person_id': person.id }),
bindModalStep1: false, openPanesInModal: false,
bindModalStep2: false,
} %} } %}
{% endblock %} {% endblock %}

View File

@ -74,8 +74,7 @@
backUrl: path('chill_person_address_list', { 'person_id': person.id }), backUrl: path('chill_person_address_list', { 'person_id': person.id }),
mode: 'edit', mode: 'edit',
addressId: address.id, addressId: address.id,
bindModalStep1: false, openPanesInModal: false,
bindModalStep2: false,
} %} } %}
#} #}
@ -90,8 +89,7 @@
backUrl: path('chill_person_address_list', { 'person_id': person.id }), backUrl: path('chill_person_address_list', { 'person_id': person.id }),
mode: 'edit', mode: 'edit',
addressId: address.id, addressId: address.id,
bindModalStep1: false, openPanesInModal: false,
bindModalStep2: false,
} %} } %}
#} #}

View File

@ -30,8 +30,7 @@
{% 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 },
backUrl: path('chill_person_address_list', { 'person_id': person.id }), backUrl: path('chill_person_address_list', { 'person_id': person.id }),
bindModalStep1: false, openPanesInModal: false,
bindModalStep2: false,
useValidFrom: true, useValidFrom: true,
useValidTo: false useValidTo: false
} %} } %}

View File

@ -10,8 +10,7 @@
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with { {% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'household', id: household.id }, targetEntity: { name: 'household', id: household.id },
backUrl: path('chill_person_household_addresses', { 'household_id': household.id }), backUrl: path('chill_person_household_addresses', { 'household_id': household.id }),
bindModalStep1: false, openPanesInModal: false,
bindModalStep2: false,
} %} } %}
</div> </div>

View File

@ -10,8 +10,7 @@
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with { {% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'household', id: household.id }, targetEntity: { name: 'household', id: household.id },
backUrl: path('chill_person_household_addresses', { 'household_id': household.id }), backUrl: path('chill_person_household_addresses', { 'household_id': household.id }),
bindModalStep1: false, openPanesInModal: false,
bindModalStep2: false,
} %} } %}
</div> </div>

View File

@ -40,8 +40,7 @@
buttonDisplayText: false, buttonDisplayText: false,
} %} } %}
{# {#
bindModalStep1: false, openPanesInModal: false
bindModalStep2: true,
#} #}
</li> </li>
<li class="list-inline-item"> <li class="list-inline-item">