mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly
This commit is contained in:
commit
0bb0b24c21
@ -1,22 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<add-address
|
<add-address
|
||||||
v-bind:key="context.entity.type"
|
v-bind:key="key"
|
||||||
v-bind:context="context"
|
v-bind:context="context"
|
||||||
v-bind:options="addAddress.options"
|
v-bind:options="options"
|
||||||
v-bind:result="addAddress.result"
|
v-bind:addressChanged="submitAddress"
|
||||||
@submitAddress="submitAddress"
|
|
||||||
ref="addAddress">
|
ref="addAddress">
|
||||||
</add-address>
|
</add-address>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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 AddAddress from './components/AddAddress.vue';
|
||||||
import { patchAddress } from "./api";
|
import { patchAddress } from "./api";
|
||||||
import { postAddressToHousehold, postAddressToPerson } from "ChillPersonAssets/vuejs/_api/AddAddress";
|
import { postAddressToHousehold, postAddressToPerson } from "ChillPersonAssets/vuejs/_api/AddAddress";
|
||||||
@ -26,60 +18,33 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
AddAddress
|
AddAddress
|
||||||
},
|
},
|
||||||
data() {
|
props: ['addAddress'],
|
||||||
return {
|
computed: {
|
||||||
context: {
|
context() {
|
||||||
edit: window.mode === 'edit',
|
return this.addAddress.context;
|
||||||
entity: {
|
},
|
||||||
type: window.entityType,
|
options() {
|
||||||
id: window.entityId
|
return this.addAddress.options;
|
||||||
},
|
},
|
||||||
addressId: window.addressId | null,
|
key() {
|
||||||
backUrl: window.backUrl,
|
return (this.context.edit) ? 'address_' + this.context.addressId
|
||||||
valid: {
|
: this.context.entity.name + '_' + this.context.entity.id ;
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
console.log('AddAddress: data context', this.context);
|
||||||
|
console.log('AddAddress: data options', this.options);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
displayErrors() {
|
displayErrors() {
|
||||||
return this.$refs.addAddress.errorMsg;
|
return this.$refs.addAddress.errorMsg;
|
||||||
},
|
},
|
||||||
submitAddress() {
|
submitAddress(payload) {
|
||||||
console.log('@@@ click on Submit Address Button');
|
console.log('@@@ click on Submit Address Button', payload);
|
||||||
let payload = this.$refs.addAddress.submitNewAddress(); // Cast child method
|
this.addDateToAddressAndPostAddressTo(payload); // !!
|
||||||
this.addDateToAddressAndPostAddressTo(payload);
|
|
||||||
},
|
},
|
||||||
addDateToAddressAndPostAddressTo(payload)
|
addDateToAddressAndPostAddressTo(payload) {
|
||||||
{
|
|
||||||
payload.body = {
|
payload.body = {
|
||||||
validFrom: {
|
validFrom: {
|
||||||
datetime: `${this.context.valid.from.toISOString().split('T')[0]}T00:00:00+0100`
|
datetime: `${this.context.valid.from.toISOString().split('T')[0]}T00:00:00+0100`
|
||||||
@ -100,11 +65,9 @@ export default {
|
|||||||
this.$refs.addAddress.flag.loading = false;
|
this.$refs.addAddress.flag.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
postAddressTo(payload) {
|
||||||
postAddressTo(payload)
|
|
||||||
{
|
|
||||||
console.log('postAddressTo', payload.entity);
|
console.log('postAddressTo', payload.entity);
|
||||||
if (!this.context.edit) {
|
if (!this.context.edit) { // !!
|
||||||
switch (payload.entity) {
|
switch (payload.entity) {
|
||||||
case 'household':
|
case 'household':
|
||||||
postAddressToHousehold(payload.entityId, payload.addressId)
|
postAddressToHousehold(payload.entityId, payload.addressId)
|
||||||
@ -141,7 +104,7 @@ export default {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// address is already linked, just finish !
|
// address is already linked, just finish !
|
||||||
window.location.assign(this.context.backUrl);
|
//window.location.assign(this.context.backUrl);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -57,9 +57,9 @@
|
|||||||
v-bind:entity="this.entity"
|
v-bind:entity="this.entity"
|
||||||
v-bind:valid="this.context.valid"
|
v-bind:valid="this.context.valid"
|
||||||
v-bind:flag="this.flag"
|
v-bind:flag="this.flag"
|
||||||
ref="showAddress"
|
v-bind:insideModal="false"
|
||||||
v-bind:insideModal="false" @openEditPane="openEditPane"
|
@openEditPane="openEditPane"
|
||||||
@submitAddress="$emit('submitAddress')">
|
ref="showAddress">
|
||||||
</show-address-pane>
|
</show-address-pane>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -110,7 +110,8 @@
|
|||||||
v-bind:default="this.default"
|
v-bind:default="this.default"
|
||||||
v-bind:entity="this.entity"
|
v-bind:entity="this.entity"
|
||||||
v-bind:flag="this.flag"
|
v-bind:flag="this.flag"
|
||||||
v-bind:insideModal="false" @closeEditPane="closeEditPane"
|
v-bind:insideModal="false"
|
||||||
|
@closeEditPane="closeEditPane"
|
||||||
@getCities="getCities"
|
@getCities="getCities"
|
||||||
@getReferenceAddresses="getReferenceAddresses">
|
@getReferenceAddresses="getReferenceAddresses">
|
||||||
</edit-address-pane>
|
</edit-address-pane>
|
||||||
@ -127,8 +128,7 @@ import EditAddressPane from './EditAddressPane.vue';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "AddAddress",
|
name: "AddAddress",
|
||||||
props: ['context', 'options', 'result'],
|
props: ['context', 'options', 'addressChanged'],
|
||||||
emits: ['submitAddress'],
|
|
||||||
components: {
|
components: {
|
||||||
Modal,
|
Modal,
|
||||||
ShowAddressPane,
|
ShowAddressPane,
|
||||||
@ -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;
|
||||||
},
|
},
|
||||||
@ -249,7 +252,7 @@ export default {
|
|||||||
this.getInitialAddress(this.context.addressId);
|
this.getInitialAddress(this.context.addressId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// when create new address, start first with editPane
|
// when create new address, start first with editPane !!
|
||||||
if ( this.context.edit === false
|
if ( this.context.edit === false
|
||||||
&& this.flag.editPane === false
|
&& this.flag.editPane === false
|
||||||
) {
|
) {
|
||||||
@ -407,10 +410,19 @@ export default {
|
|||||||
this.updateAddress({
|
this.updateAddress({
|
||||||
addressId: this.context.addressId,
|
addressId: this.context.addressId,
|
||||||
newAddress: newAddress
|
newAddress: newAddress
|
||||||
});
|
})
|
||||||
|
.then(payload => {
|
||||||
|
console.log('payload', payload);
|
||||||
|
this.addressChanged(payload);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.addNewAddress(newAddress);
|
this.addNewAddress(newAddress)
|
||||||
|
.then(payload => this.addressChanged(payload));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -425,28 +437,33 @@ export default {
|
|||||||
if ('newPostcode' in payload) {
|
if ('newPostcode' in payload) {
|
||||||
|
|
||||||
let postcodeBody = payload.newPostcode;
|
let postcodeBody = payload.newPostcode;
|
||||||
if (this.context.entity.type === 'person') {
|
if (this.context.entity.name === 'person') {
|
||||||
postcodeBody = Object.assign(postcodeBody, {'origin': 3});
|
postcodeBody = Object.assign(postcodeBody, {'origin': 3});
|
||||||
}
|
}
|
||||||
postPostalCode(postcodeBody)
|
return postPostalCode(postcodeBody)
|
||||||
.then(postalCode => {
|
.then(postalCode => {
|
||||||
payload.postcode = {'id': postalCode.id };
|
payload.postcode = {'id': postalCode.id };
|
||||||
this.postNewAddress(payload);
|
return this.postNewAddress(payload);
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.postNewAddress(payload);
|
return this.postNewAddress(payload);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
postNewAddress(payload) {
|
postNewAddress(payload) {
|
||||||
//console.log('postNewAddress', payload);
|
//console.log('postNewAddress', payload);
|
||||||
postAddress(payload)
|
return postAddress(payload)
|
||||||
.then(address => new Promise((resolve, reject) => {
|
.then(address => new Promise((resolve, reject) => {
|
||||||
this.entity.address = address;
|
this.entity.address = address;
|
||||||
this.flag.loading = false;
|
this.flag.loading = false;
|
||||||
this.flag.success = true;
|
this.flag.success = true;
|
||||||
resolve();
|
resolve({
|
||||||
|
entity: this.context.entity.name,
|
||||||
|
entityId: this.context.entity.id,
|
||||||
|
addressId: this.entity.address.address_id
|
||||||
|
}
|
||||||
|
);
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.errorMsg.push(error);
|
this.errorMsg.push(error);
|
||||||
@ -463,31 +480,37 @@ export default {
|
|||||||
this.flag.loading = true;
|
this.flag.loading = true;
|
||||||
|
|
||||||
// TODO change the condition because it writes new postal code in edit mode now: !writeNewPostalCode
|
// TODO change the condition because it writes new postal code in edit mode now: !writeNewPostalCode
|
||||||
if ('newPostcode' in payload.newAddress) {
|
|
||||||
|
|
||||||
|
if ('newPostcode' in payload.newAddress) {
|
||||||
let postcodeBody = payload.newAddress.newPostcode;
|
let postcodeBody = payload.newAddress.newPostcode;
|
||||||
postcodeBody = Object.assign(postcodeBody, {'origin': 3});
|
postcodeBody = Object.assign(postcodeBody, {'origin': 3});
|
||||||
|
|
||||||
postPostalCode(postcodeBody)
|
return postPostalCode(postcodeBody)
|
||||||
.then(postalCode => {
|
.then(postalCode => {
|
||||||
|
console.log('create new postcode', postalCode.id);
|
||||||
payload.newAddress.postcode = {'id': postalCode.id };
|
payload.newAddress.postcode = {'id': postalCode.id };
|
||||||
this.patchExistingAddress(payload);
|
return this.patchExistingAddress(payload);
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.patchExistingAddress(payload);
|
return this.patchExistingAddress(payload);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
patchExistingAddress(payload) {
|
patchExistingAddress(payload) {
|
||||||
console.log('patchExistingAddress', payload);
|
console.log('patchExistingAddress', payload);
|
||||||
patchAddress(payload.addressId, payload.newAddress)
|
return patchAddress(payload.addressId, payload.newAddress)
|
||||||
.then(address => new Promise((resolve, reject) => {
|
.then(address => new Promise((resolve, reject) => {
|
||||||
this.entity.address = address;
|
this.entity.address = address;
|
||||||
this.flag.loading = false;
|
this.flag.loading = false;
|
||||||
this.flag.success = true;
|
this.flag.success = true;
|
||||||
resolve();
|
return resolve({
|
||||||
}))
|
entity: this.context.entity.name,
|
||||||
|
entityId: this.context.entity.id,
|
||||||
|
addressId: this.entity.address.address_id
|
||||||
|
});
|
||||||
|
})
|
||||||
|
)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.errorMsg.push(error);
|
this.errorMsg.push(error);
|
||||||
this.flag.loading = false;
|
this.flag.loading = false;
|
||||||
@ -497,11 +520,10 @@ export default {
|
|||||||
/*
|
/*
|
||||||
* Method called by parent when submitting address
|
* Method called by parent when submitting address
|
||||||
* (get out step1 show pane, submit button)
|
* (get out step1 show pane, submit button)
|
||||||
*/
|
|
||||||
submitNewAddress()
|
submitNewAddress()
|
||||||
{
|
{
|
||||||
let payload = {
|
let payload = {
|
||||||
entity: this.context.entity.type,
|
entity: this.context.entity.name,
|
||||||
entityId: this.context.entity.id,
|
entityId: this.context.entity.id,
|
||||||
addressId: this.entity.address.address_id
|
addressId: this.entity.address.address_id
|
||||||
};
|
};
|
||||||
@ -513,6 +535,7 @@ export default {
|
|||||||
|
|
||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
<i v-if="flag.loading" class="fa fa-circle-o-notch fa-spin fa-2x fa-fw"></i>
|
<i v-if="flag.loading" class="fa fa-circle-o-notch fa-spin fa-2x fa-fw"></i>
|
||||||
<span class="sr-only">{{ $t('loading') }}</span>
|
<span class="sr-only">{{ $t('loading') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="errorMsg && errorMsg.length > 0" class="alert alert-danger">
|
<div v-if="errorMsg && errorMsg.length > 0" class="alert alert-danger">
|
||||||
{{ errorMsg }}
|
{{ errorMsg }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="flag.success" class="alert alert-success">
|
<div v-if="flag.success" class="alert alert-success">
|
||||||
{{ $t(getSuccessText) }}
|
{{ $t(getSuccessText) }}
|
||||||
</div>
|
</div>
|
||||||
@ -26,23 +28,24 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul v-if="insideModal == false"
|
<ul v-if="insideModal == false"
|
||||||
class="record_actions sticky-form-buttons">
|
class="record_actions">
|
||||||
|
<!--
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a class="btn btn-cancel" v-bind:href="context.backUrl">
|
<a class="btn btn-cancel" v-bind:href="context.backUrl">
|
||||||
{{ $t('back_to_the_list') }}</a>
|
{{ $t('back_to_the_list') }}</a>
|
||||||
</li>
|
</li>-->
|
||||||
<li>
|
<li>
|
||||||
<a @click.prevent="$emit('openEditPane')"
|
<a @click.prevent="$emit('openEditPane')"
|
||||||
class="btn btn-update">
|
class="btn btn-update">
|
||||||
{{ $t('action.edit')}}
|
{{ $t('action.edit')}}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<!--<li>
|
||||||
<a class="btn btn-save"
|
<a class="btn btn-save"
|
||||||
@click.prevent="$emit('submitAddress')">
|
@click.prevent="$emit('submitAddress')">
|
||||||
{{ $t('action.save')}}
|
{{ $t('action.save')}}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>-->
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -65,7 +68,7 @@ export default {
|
|||||||
'errorMsg',
|
'errorMsg',
|
||||||
'insideModal'
|
'insideModal'
|
||||||
],
|
],
|
||||||
emits: ['openEditPane', 'submitAddress'], //?
|
emits: ['openEditPane'], // 'submitAddress'
|
||||||
computed: {
|
computed: {
|
||||||
address() {
|
address() {
|
||||||
return this.entity.address;
|
return this.entity.address;
|
||||||
@ -79,10 +82,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
getValidFromDateText() {
|
getValidFromDateText() {
|
||||||
return (this.context.entity.type === 'household') ? 'move_date' : 'validFrom';
|
return (this.context.entity.name === 'household') ? 'move_date' : 'validFrom';
|
||||||
},
|
},
|
||||||
getSuccessText() {
|
getSuccessText() {
|
||||||
switch (this.context.entity.type) {
|
switch (this.context.entity.name) {
|
||||||
/*
|
/*
|
||||||
case 'household':
|
case 'household':
|
||||||
return (this.context.edit) ? 'household_address_edit_success' : 'household_address_move_success';
|
return (this.context.edit) ? 'household_address_edit_success' : 'household_address_move_success';
|
||||||
|
@ -1,13 +1,59 @@
|
|||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
import App from './App.vue';
|
|
||||||
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
|
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
|
||||||
import { addressMessages } from './i18n';
|
import { addressMessages } from './i18n';
|
||||||
|
import App from './App.vue';
|
||||||
|
|
||||||
const i18n = _createI18n( addressMessages );
|
const i18n = _createI18n( addressMessages );
|
||||||
|
|
||||||
const app = createApp({
|
let containers = document.querySelectorAll('.address-container');
|
||||||
template: `<app></app>`,
|
containers.forEach((container) => {
|
||||||
})
|
|
||||||
.use(i18n)
|
const app = createApp({
|
||||||
.component('app', App)
|
template: `<app v-bind:addAddress="this.addAddress" ></app>`,
|
||||||
.mount('#address');
|
data() {
|
||||||
|
return {
|
||||||
|
addAddress: {
|
||||||
|
context: {
|
||||||
|
entity: {
|
||||||
|
name: container.dataset.targetEntityName,
|
||||||
|
id: container.dataset.targetEntityId
|
||||||
|
},
|
||||||
|
edit: container.dataset.mode === 'edit', //boolean
|
||||||
|
addressId: container.dataset.addressId || null,
|
||||||
|
backUrl: container.dataset.backUrl || null,
|
||||||
|
valid: {
|
||||||
|
from: new Date()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
/// Options override default.
|
||||||
|
/// null value take default component value defined in AddAddress data()
|
||||||
|
button: {
|
||||||
|
text: {
|
||||||
|
create: container.dataset.buttonText || null,
|
||||||
|
edit: container.dataset.buttonText || null
|
||||||
|
},
|
||||||
|
size: container.dataset.buttonSize || null,
|
||||||
|
displayText: container.dataset.buttonDisplayText !== 'false' //boolean, default: true
|
||||||
|
},
|
||||||
|
/// Modal title text if create or edit address (trans chain, see i18n)
|
||||||
|
title: {
|
||||||
|
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(i18n)
|
||||||
|
.component('app', App)
|
||||||
|
.mount(container);
|
||||||
|
|
||||||
|
console.log('container dataset', container.dataset);
|
||||||
|
});
|
||||||
|
@ -14,54 +14,51 @@
|
|||||||
* buttonText twig translated chain
|
* buttonText twig translated chain
|
||||||
* buttonSize bootstrap class like 'btn-sm'
|
* buttonSize bootstrap class like 'btn-sm'
|
||||||
* buttonDisplayText bool
|
* buttonDisplayText bool
|
||||||
* binModalStep1 bool
|
* bindModalStep1 bool
|
||||||
* binModalStep2 bool
|
* bindModalStep2 bool
|
||||||
|
|
||||||
#}
|
#}
|
||||||
<div id="address"></div>
|
<div class="address-container"
|
||||||
|
|
||||||
<script type="text/javascript">
|
data-target-entity-name="{{ targetEntity.name|e('html_attr') }}"
|
||||||
window.vueRootComponent = 'app';
|
data-target-entity-id="{{ targetEntity.id|e('html_attr') }}"
|
||||||
|
|
||||||
window.entityType = '{{ targetEntity.name|e('js') }}';
|
|
||||||
window.entityId = '{{ targetEntity.id|e('js') }}';
|
|
||||||
|
|
||||||
{% if 'edit' in app.request.get('_route') %}
|
{% if 'edit' in app.request.get('_route') %}
|
||||||
window.mode = 'edit';
|
data-mode="edit"
|
||||||
window.addressId = {{ app.request.get('address_id')|e('js') }};
|
data-address-id="{{ app.request.get('address_id')|e('html_attr') }}"
|
||||||
{% elseif mode is defined and mode == 'edit' %}
|
{% elseif mode is defined and mode == 'edit' %}
|
||||||
window.mode = 'edit';
|
data-mode="edit"
|
||||||
window.addressId = {{ addressId|e('js') }};
|
data-address-id="{{ addressId|e('html_attr') }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if backUrl is defined %}
|
{% if backUrl is defined %}
|
||||||
window.backUrl = '{{ backUrl|e('js') }}';
|
data-back-url="{{ backUrl|e('html_attr') }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if modalTitle is defined %}
|
{% if modalTitle is defined %}
|
||||||
window.modalTitle = '{{ modalTitle|trans|e('js') }}';
|
data-modal-title="{{ modalTitle|trans|e('html_attr') }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if buttonText is defined %}
|
{% if buttonText is defined %}
|
||||||
window.buttonText = '{{ buttonText|trans|e('js') }}';
|
data-button-text="{{ buttonText|trans|e('html_attr') }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if buttonSize is defined %}
|
{% if buttonSize is defined %}
|
||||||
window.buttonSize = '{{ buttonSize|e('js') }}';
|
data-button-size="{{ buttonSize|e('html_attr') }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if buttonDisplayText is defined and buttonDisplayText == false %}
|
{% if buttonDisplayText is defined and buttonDisplayText != 1 %}
|
||||||
window.buttonDisplayText = false;
|
data-button-display-text="false"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if binModalStep1 is defined and binModalStep1 == false %}
|
{% if bindModalStep1 is defined and bindModalStep1 != 1 %}
|
||||||
window.binModalStep1 = false;
|
data-bind-modal-step1="false"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if binModalStep2 is defined and binModalStep2 == false %}
|
{% if bindModalStep2 is defined and bindModalStep2 != 1 %}
|
||||||
window.binModalStep2 = false;
|
data-bind-modal-step2="false"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</script>
|
></div>
|
||||||
|
|
||||||
{{ encore_entry_script_tags('vue_address') }}
|
{{ encore_entry_script_tags('vue_address') }}
|
||||||
{{ encore_entry_link_tags('vue_address') }}
|
{{ encore_entry_link_tags('vue_address') }}
|
||||||
|
@ -54,7 +54,7 @@ export default {
|
|||||||
assignAddress() {
|
assignAddress() {
|
||||||
//console.log('assignAddress id', this.person.current_household_address);
|
//console.log('assignAddress id', this.person.current_household_address);
|
||||||
let payload = {
|
let payload = {
|
||||||
entity: this.context.entity.type,
|
entity: this.context.entity.name,
|
||||||
entityId: this.context.entity.id,
|
entityId: this.context.entity.id,
|
||||||
locationStatusTo: 'person',
|
locationStatusTo: 'person',
|
||||||
personId: this.person.id
|
personId: this.person.id
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
:key="addAddress.type"
|
:key="addAddress.type"
|
||||||
:options="addAddress.options"
|
:options="addAddress.options"
|
||||||
:result="addAddress.result"
|
:result="addAddress.result"
|
||||||
@submitAddress="submitTemporaryAddress"
|
:addressChanged="submitTemporaryAddress"
|
||||||
ref="addAddress">
|
ref="addAddress">
|
||||||
</add-address>
|
</add-address>
|
||||||
</li>
|
</li>
|
||||||
@ -118,7 +118,7 @@ export default {
|
|||||||
initAddressContext() {
|
initAddressContext() {
|
||||||
let context = {
|
let context = {
|
||||||
entity: {
|
entity: {
|
||||||
type: this.accompanyingCourse.type,
|
name: this.accompanyingCourse.type,
|
||||||
id: this.accompanyingCourse.id
|
id: this.accompanyingCourse.id
|
||||||
},
|
},
|
||||||
edit: false,
|
edit: false,
|
||||||
@ -133,7 +133,7 @@ export default {
|
|||||||
removeAddress() {
|
removeAddress() {
|
||||||
//console.log('remove address');
|
//console.log('remove address');
|
||||||
let payload = {
|
let payload = {
|
||||||
entity: this.context.entity.type,
|
entity: this.context.entity.name,
|
||||||
entityId: this.context.entity.id,
|
entityId: this.context.entity.id,
|
||||||
locationStatusTo: 'none'
|
locationStatusTo: 'none'
|
||||||
};
|
};
|
||||||
@ -142,9 +142,8 @@ export default {
|
|||||||
displayErrors() {
|
displayErrors() {
|
||||||
return this.$refs.addAddress.errorMsg;
|
return this.$refs.addAddress.errorMsg;
|
||||||
},
|
},
|
||||||
submitTemporaryAddress() {
|
submitTemporaryAddress(payload) {
|
||||||
//console.log('@@@ click on Submit Temporary Address Button');
|
//console.log('@@@ click on Submit Temporary Address Button');
|
||||||
let payload = this.$refs.addAddress.submitNewAddress();
|
|
||||||
payload['locationStatusTo'] = 'address'; // <== temporary, not none, not person
|
payload['locationStatusTo'] = 'address'; // <== temporary, not none, not person
|
||||||
this.$store.dispatch('updateLocation', payload);
|
this.$store.dispatch('updateLocation', payload);
|
||||||
this.$store.commit('setEditContextTrue');
|
this.$store.commit('setEditContextTrue');
|
||||||
|
@ -30,8 +30,8 @@
|
|||||||
{% 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 }),
|
||||||
binModalStep1: false,
|
bindModalStep1: false,
|
||||||
binModalStep2: false,
|
bindModalStep2: false,
|
||||||
} %}
|
} %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -74,8 +74,8 @@
|
|||||||
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,
|
||||||
binModalStep1: false,
|
bindModalStep1: false,
|
||||||
binModalStep2: false,
|
bindModalStep2: false,
|
||||||
} %}
|
} %}
|
||||||
#}
|
#}
|
||||||
|
|
||||||
@ -90,8 +90,8 @@
|
|||||||
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,
|
||||||
binModalStep1: false,
|
bindModalStep1: false,
|
||||||
binModalStep2: false,
|
bindModalStep2: false,
|
||||||
} %}
|
} %}
|
||||||
#}
|
#}
|
||||||
|
|
||||||
|
@ -30,8 +30,8 @@
|
|||||||
{% 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 }),
|
||||||
binModalStep1: false,
|
bindModalStep1: false,
|
||||||
binModalStep2: false,
|
bindModalStep2: false,
|
||||||
} %}
|
} %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
{% 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 })
|
||||||
binModalStep1: false,
|
bindModalStep1: false,
|
||||||
binModalStep2: false,
|
bindModalStep2: false,
|
||||||
} %}
|
} %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
{% 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 })
|
||||||
binModalStep1: false,
|
bindModalStep1: false,
|
||||||
binModalStep2: false,
|
bindModalStep2: false,
|
||||||
} %}
|
} %}
|
||||||
</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 }}"
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
{% if thirdParty.address == null %}
|
{% if thirdParty.address == null %}
|
||||||
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
|
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ thirdParty.address|chill_entity_render_box({'with_valid_from': false }) }}
|
{{ thirdParty.address|chill_entity_render_box({'with_valid_from': false, 'extended_infos': true }) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
@ -103,7 +103,7 @@
|
|||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_3party_3party_index') }}">
|
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_3party_3party_index') }}">
|
||||||
{{ 'Cancel'|trans }}
|
{{ 'Back to the list'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user