mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
addAddress: improve boolean variables
This commit is contained in:
parent
a5ceb551eb
commit
da32afeb3f
@ -187,6 +187,9 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
step1WithModal() {
|
step1WithModal() {
|
||||||
|
console.log('options displayText', this.options.button.displayText);
|
||||||
|
console.log('options bindModal.step1', this.options.bindModal.step1);
|
||||||
|
console.log('options bindModal.step2', this.options.bindModal.step2);
|
||||||
return (this.options.bindModal !== null && typeof this.options.bindModal.step1 !== 'undefined') ?
|
return (this.options.bindModal !== null && typeof this.options.bindModal.step1 !== 'undefined') ?
|
||||||
this.options.bindModal.step1 : this.default.bindModal.step1;
|
this.options.bindModal.step1 : this.default.bindModal.step1;
|
||||||
},
|
},
|
||||||
|
@ -7,25 +7,25 @@ const i18n = _createI18n( addressMessages );
|
|||||||
|
|
||||||
let containers = document.querySelectorAll('.address-container');
|
let containers = document.querySelectorAll('.address-container');
|
||||||
containers.forEach((container) => {
|
containers.forEach((container) => {
|
||||||
|
|
||||||
const app = createApp({
|
const app = createApp({
|
||||||
template: `<app v-bind:addAddress="this.addAddress" ></app>`,
|
template: `<app v-bind:addAddress="this.addAddress" ></app>`,
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
addAddress: {
|
addAddress: {
|
||||||
context: {
|
context: {
|
||||||
edit: container.dataset.mode === 'edit',
|
|
||||||
entity: {
|
entity: {
|
||||||
type: container.dataset.targetEntityName,
|
type: container.dataset.targetEntityName,
|
||||||
id: container.dataset.targetEntityId
|
id: container.dataset.targetEntityId
|
||||||
},
|
},
|
||||||
addressId: container.dataset.addressId | null,
|
edit: container.dataset.mode === 'edit', //boolean
|
||||||
backUrl: container.dataset.backUrl,
|
addressId: container.dataset.addressId || null,
|
||||||
|
backUrl: container.dataset.backUrl || null,
|
||||||
valid: {
|
valid: {
|
||||||
from: new Date()
|
from: new Date()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
|
|
||||||
/// Options override default.
|
/// Options override default.
|
||||||
/// null value take default component value defined in AddAddress data()
|
/// null value take default component value defined in AddAddress data()
|
||||||
button: {
|
button: {
|
||||||
@ -34,19 +34,17 @@ containers.forEach((container) => {
|
|||||||
edit: container.dataset.buttonText || null
|
edit: container.dataset.buttonText || null
|
||||||
},
|
},
|
||||||
size: container.dataset.buttonSize || null,
|
size: container.dataset.buttonSize || null,
|
||||||
displayText: container.dataset.buttonDisplayText //boolean, default: true
|
displayText: container.dataset.buttonDisplayText !== 'false' //boolean, default: true
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Modal title text if create or edit address (trans chain, see i18n)
|
/// Modal title text if create or edit address (trans chain, see i18n)
|
||||||
title: {
|
title: {
|
||||||
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
|
/// Display each step in page or Modal
|
||||||
bindModal: {
|
bindModal: {
|
||||||
step1: container.dataset.bindModalStep1, //boolean, default: true
|
step1: container.dataset.bindModalStep1 !== 'false', //boolean, default: true
|
||||||
step2: container.dataset.bindModalStep2 //boolean, default: true
|
step2: container.dataset.bindModalStep2 !== 'false' //boolean, default: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,16 +47,16 @@
|
|||||||
data-button-size="{{ buttonSize|e('html_attr') }}"
|
data-button-size="{{ buttonSize|e('html_attr') }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if buttonDisplayText is defined and buttonDisplayText == false %}
|
{% if buttonDisplayText is defined and buttonDisplayText != 1 %}
|
||||||
data-button-display-text=false
|
data-button-display-text="false"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if bindModalStep1 is defined and bindModalStep1 == false %}
|
{% if bindModalStep1 is defined and bindModalStep1 != 1 %}
|
||||||
data-bind-modal-step1=false
|
data-bind-modal-step1="false"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if bindModalStep2 is defined and bindModalStep2 == false %}
|
{% if bindModalStep2 is defined and bindModalStep2 != 1 %}
|
||||||
data-bind-modal-step2=false
|
data-bind-modal-step2="false"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
></div>
|
></div>
|
||||||
|
|
||||||
|
@ -37,8 +37,12 @@
|
|||||||
buttonSize: 'btn-sm',
|
buttonSize: 'btn-sm',
|
||||||
buttonText: 'Move household',
|
buttonText: 'Move household',
|
||||||
modalTitle: 'Move household',
|
modalTitle: 'Move household',
|
||||||
buttonDisplayText: false
|
buttonDisplayText: false,
|
||||||
} %}
|
} %}
|
||||||
|
{#
|
||||||
|
bindModalStep1: false,
|
||||||
|
bindModalStep2: true,
|
||||||
|
#}
|
||||||
</li>
|
</li>
|
||||||
<li class="list-inline-item">
|
<li class="list-inline-item">
|
||||||
<a class="btn btn-secondary btn-sm" title="{{ "Addresses history"|trans }}"
|
<a class="btn btn-secondary btn-sm" title="{{ "Addresses history"|trans }}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user