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

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

View File

@@ -38,12 +38,9 @@ containers.forEach((container) => {
create: 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
/// Display panes in Modal for step123
openPanesInModal: container.dataset.openPanesInModal !== 'false', //boolean, default: true
useDate: {
validFrom: container.dataset.useValidFrom === 'true', //boolean, default: false
validTo: container.dataset.useValidTo === 'true' //boolean, default: false

View File

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