mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
twig pass arguments to vue_address with dataset attributes
This commit is contained in:
@@ -2,21 +2,13 @@
|
||||
<add-address
|
||||
v-bind:key="context.entity.type"
|
||||
v-bind:context="context"
|
||||
v-bind:options="addAddress.options"
|
||||
v-bind:result="addAddress.result"
|
||||
v-bind:options="options"
|
||||
v-bind:addressChanged="submitAddress"
|
||||
ref="addAddress">
|
||||
</add-address>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/*
|
||||
* Address component is a uniq component for many contexts.
|
||||
* Allow to create/attach/edit an address to
|
||||
* - a person (new or edit address),
|
||||
* - a household (move or edit address)
|
||||
*
|
||||
* */
|
||||
import AddAddress from './components/AddAddress.vue';
|
||||
import { patchAddress } from "./api";
|
||||
import { postAddressToHousehold, postAddressToPerson } from "ChillPersonAssets/vuejs/_api/AddAddress";
|
||||
@@ -26,49 +18,19 @@ export default {
|
||||
components: {
|
||||
AddAddress
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
context: {
|
||||
edit: window.mode === 'edit',
|
||||
entity: {
|
||||
type: window.entityType,
|
||||
id: window.entityId
|
||||
},
|
||||
addressId: window.addressId | null,
|
||||
backUrl: window.backUrl,
|
||||
valid: {
|
||||
from: new Date()
|
||||
},
|
||||
},
|
||||
addAddress: {
|
||||
options: {
|
||||
|
||||
/// Options override default.
|
||||
/// null value take default component value defined in AddAddress data()
|
||||
button: {
|
||||
text: {
|
||||
create: window.buttonText || null,
|
||||
edit: window.buttonText || null
|
||||
},
|
||||
size: window.buttonSize || null,
|
||||
displayText: window.buttonDisplayText //boolean, default: true
|
||||
},
|
||||
|
||||
/// Modal title text if create or edit address (trans chain, see i18n)
|
||||
title: {
|
||||
create: window.modalTitle || null,
|
||||
edit: window.modalTitle || null
|
||||
},
|
||||
|
||||
/// Display each step in page or Modal
|
||||
bindModal: {
|
||||
step1: window.binModalStep1, //boolean, default: true
|
||||
step2: window.binModalStep2 //boolean, default: true
|
||||
}
|
||||
}
|
||||
}
|
||||
props: ['addAddress'],
|
||||
computed: {
|
||||
context() {
|
||||
return this.addAddress.context;
|
||||
},
|
||||
options() {
|
||||
return this.addAddress.options;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log('AddAddress: data context', this.context);
|
||||
console.log('AddAddress: data options', this.options);
|
||||
},
|
||||
methods: {
|
||||
displayErrors() {
|
||||
return this.$refs.addAddress.errorMsg;
|
||||
|
Reference in New Issue
Block a user