Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly

This commit is contained in:
Mathieu Jaumotte 2021-09-17 13:26:28 +02:00
commit 8204107ceb
18 changed files with 447 additions and 232 deletions

View File

@ -33,8 +33,8 @@ export default {
}, },
mounted() { mounted() {
console.log('AddAddress: data context', this.context); //console.log('AddAddress: data context', this.context);
console.log('AddAddress: data options', this.options); //console.log('AddAddress: data options', this.options);
}, },
methods: { methods: {
displayErrors() { displayErrors() {

View File

@ -0,0 +1,44 @@
<template>
<ul class="record_actions"
:class="{ 'sticky-form-buttons': isStickyForm }">
<!--
<li v-if="isStickyForm" class="cancel">
<a class="btn btn-cancel" @click="resetPane">
{{ $t('back_to_the_list') }}
</a>
</li>
-->
<slot name="action"></slot>
<!--
<li v-if="isStickyForm">
<a class="btn btn-save">
{{ $t('action.save')}}
</a>
</li>
-->
</ul>
</template>
<script>
export default {
name: "ActionButtons",
props: [ 'options', 'default' ],
computed: {
isStickyForm() {
return (typeof this.options.stickyActions !== 'undefined') ?
this.options.stickyActions : this.default.stickyActions;
},
},
methods: {
resetPane() {
this.flag.suggestPane = false;
this.flag.editPane = false;
this.flag.datePane = false;
this.flag.showPane = true;
}
}
}
</script>

View File

@ -1,18 +1,21 @@
<template> <template>
<!-- start with a button --> <!-- step0 -->
<button v-if="step1WithModal" <show-pane v-if="flag.showPane"
@click="openShowPane" v-bind:context="this.context"
class="btn" :class="getClassButton" v-bind:options="this.options"
type="button" name="button" :title="$t(getTextButton)"> v-bind:default="this.default"
<span v-if="displayTextButton">{{ $t(getTextButton) }}</span> v-bind:entity="this.entity"
</button> v-bind:flag="this.flag"
@openEditPane="openEditPane"
ref="showAddress">
</show-pane>
<!-- step 1 --> <!-- step 1 -->
<teleport to="body" v-if="step1WithModal"> <teleport to="body" v-if="inModal">
<modal v-if="flag.showPane" <modal v-if="flag.suggestPane"
modalDialogClass="modal-dialog-scrollable modal-xl" modalDialogClass="modal-dialog-scrollable modal-xl"
@close="flag.showPane = false"> @close="resetPane">
<template v-slot:header> <template v-slot:header>
<h2 class="modal-title">{{ $t(getTextTitle) }} <h2 class="modal-title">{{ $t(getTextTitle) }}
@ -24,14 +27,14 @@
</template> </template>
<template v-slot:body> <template v-slot:body>
<show-address-pane <suggest-pane
v-bind:context="this.context" v-bind:context="this.context"
v-bind:options="this.options" v-bind:options="this.options"
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"
ref="showAddress"> ref="suggestAddress">
</show-address-pane> </suggest-pane>
</template> </template>
<template v-slot:footer> <template v-slot:footer>
@ -39,17 +42,17 @@
class="btn btn-update"> class="btn btn-update">
{{ $t('action.edit')}} {{ $t('action.edit')}}
</button> </button>
<button class="btn btn-save" <!--
@click.prevent="$emit('submitAddress')"> <button class="btn btn-save">
{{ $t('action.save')}} {{ $t('action.save')}}
</button> </button>
-->
</template> </template>
</modal> </modal>
</teleport> </teleport>
<div class="mt-4" v-else> <div class="mt-4" v-else>
<suggest-pane v-if="flag.suggestPane"
<show-address-pane v-if="flag.showPane"
v-bind:context="this.context" v-bind:context="this.context"
v-bind:options="this.options" v-bind:options="this.options"
v-bind:default="this.default" v-bind:default="this.default"
@ -57,15 +60,15 @@
v-bind:flag="this.flag" v-bind:flag="this.flag"
v-bind:insideModal="false" v-bind:insideModal="false"
@openEditPane="openEditPane" @openEditPane="openEditPane"
ref="showAddress"> ref="suggestAddress">
</show-address-pane> </suggest-pane>
</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="resetPane">
<template v-slot:header> <template v-slot:header>
<h2 class="modal-title">{{ $t(getTextTitle) }} <h2 class="modal-title">{{ $t(getTextTitle) }}
@ -77,7 +80,7 @@
</template> </template>
<template v-slot:body> <template v-slot:body>
<edit-address-pane <edit-pane
v-bind:context="this.context" v-bind:context="this.context"
v-bind:options="this.options" v-bind:options="this.options"
v-bind:default="this.default" v-bind:default="this.default"
@ -85,7 +88,7 @@
v-bind:flag="this.flag" v-bind:flag="this.flag"
@getCities="getCities" @getCities="getCities"
@getReferenceAddresses="getReferenceAddresses"> @getReferenceAddresses="getReferenceAddresses">
</edit-address-pane> </edit-pane>
</template> </template>
<template v-slot:footer> <template v-slot:footer>
@ -101,8 +104,7 @@
</modal> </modal>
</teleport> </teleport>
<div class="mt-4" v-else> <div class="mt-4" v-else>
<edit-pane v-if="flag.editPane"
<edit-address-pane v-if="flag.editPane"
v-bind:context="this.context" v-bind:context="this.context"
v-bind:options="this.options" v-bind:options="this.options"
v-bind:default="this.default" v-bind:default="this.default"
@ -112,7 +114,58 @@
@closeEditPane="closeEditPane" @closeEditPane="closeEditPane"
@getCities="getCities" @getCities="getCities"
@getReferenceAddresses="getReferenceAddresses"> @getReferenceAddresses="getReferenceAddresses">
</edit-address-pane> </edit-pane>
</div>
<!-- step 3 -->
<teleport to="body" v-if="inModal">
<modal v-if="flag.datePane"
modalDialogClass="modal-dialog-scrollable modal-xl"
@close="resetPane">
<template v-slot:header>
<h2 class="modal-title">{{ $t(getTextTitle) }}
<span v-if="flag.loading" class="loading">
<i class="fa fa-circle-o-notch fa-spin fa-fw"></i>
<span class="sr-only">{{ $t('loading') }}</span>
</span>
</h2>
</template>
<template v-slot:body>
<date-pane
v-bind:context="this.context"
v-bind:options="this.options"
v-bind:default="this.default"
v-bind:entity="this.entity"
v-bind:flag="this.flag"
ref="dateAddress">
</date-pane>
</template>
<template v-slot:footer>
<button @click="openEditPane"
class="btn btn-update">
{{ $t('action.edit')}}
</button>
<button class="btn btn-save">
{{ $t('action.save')}}
</button>
</template>
</modal>
</teleport>
<div class="mt-4" v-else>
<date-pane v-if="flag.datePane"
v-bind:context="this.context"
v-bind:options="this.options"
v-bind:default="this.default"
v-bind:entity="this.entity"
v-bind:flag="this.flag"
v-bind:insideModal="false"
@openEditPane="openEditPane"
ref="dateAddress">
</date-pane>
</div> </div>
</template> </template>
@ -121,22 +174,28 @@
import Modal from 'ChillMainAssets/vuejs/_components/Modal'; import Modal from 'ChillMainAssets/vuejs/_components/Modal';
import { getAddress, fetchCountries, fetchCities, fetchReferenceAddresses, patchAddress, postAddress, postPostalCode } from '../api'; import { getAddress, fetchCountries, fetchCities, fetchReferenceAddresses, patchAddress, postAddress, postPostalCode } from '../api';
import { postAddressToPerson, postAddressToHousehold } from "ChillPersonAssets/vuejs/_api/AddAddress.js"; import { postAddressToPerson, postAddressToHousehold } from "ChillPersonAssets/vuejs/_api/AddAddress.js";
import ShowAddressPane from './ShowAddressPane.vue'; import ShowPane from './ShowPane.vue';
import EditAddressPane from './EditAddressPane.vue'; import SuggestPane from './SuggestPane.vue';
import EditPane from './EditPane.vue';
import DatePane from './DatePane.vue';
export default { export default {
name: "AddAddress", name: "AddAddress",
props: ['context', 'options', 'addressChangedCallback'], props: ['context', 'options', 'addressChangedCallback'],
components: { components: {
Modal, Modal,
ShowAddressPane, ShowPane,
EditAddressPane, SuggestPane,
EditPane,
DatePane
}, },
data() { data() {
return { return {
flag: { flag: {
showPane: false, showPane: true, // begin with showPane
suggestPane: false,
editPane: false, editPane: false,
datePane: false,
loading: false, loading: false,
success: false success: false
}, },
@ -147,10 +206,8 @@ 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, stickyActions: false,
step2: true,
},
useDate: { useDate: {
validFrom: false, validFrom: false,
validTo: false validTo: false
@ -192,19 +249,23 @@ 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() { useDatePane() {
let step2 = (typeof this.options.bindModal !== 'undefined' && typeof this.options.bindModal.step2 !== 'undefined') ? let vFrom = (typeof this.options.useDate !== 'undefined'
this.options.bindModal.step2 : this.default.bindModal.step2; && typeof this.options.useDate.validFrom !== 'undefined') ?
this.options.useDate.validFrom : this.default.useDate.validFrom ;
if (step2 === false && this.step1WithModal === true) { let vTo = (typeof this.options.useDate !== 'undefined'
console.log("step2 must open in a Modal"); && typeof this.options.useDate.validTo !== 'undefined') ?
return true; this.options.useDate.validTo : this.default.useDate.validTo ;
} return (vFrom || vTo) ? true : false;
return step2; },
hasSuggestions() {
// TODO
//return addressSuggestions.length > 0
return true;
}, },
getTextTitle() { getTextTitle() {
if ( typeof this.options.title !== 'undefined' if ( typeof this.options.title !== 'undefined'
@ -215,27 +276,9 @@ export default {
} }
return (this.context.edit) ? this.default.title.edit : this.default.title.create; return (this.context.edit) ? this.default.title.edit : this.default.title.create;
}, },
getTextButton() { bypassFirstStep() {
if ( typeof this.options.button.text !== 'undefined' // exception: passing step0 if new address and pane are not in modal
&& ( this.options.button.text.edit !== null return !this.context.edit && !this.inModal && this.flag.editPane === false
|| this.options.button.text.create !== null
)) {
return (this.context.edit) ? this.options.button.text.edit : this.options.button.text.create;
}
return (this.context.edit) ? this.default.button.text.edit : this.default.button.text.create;
},
getClassButton() {
let type = (this.context.edit) ? this.default.button.type.edit : this.default.button.type.create;
let size = (typeof this.options.button !== 'undefined' && this.options.button.size !== null) ?
`${this.options.button.size} ` : '';
return `${size}${type}`;
},
displayTextButton() {
return (typeof this.options.button !== 'undefined' && typeof this.options.button.displayText !== 'undefined') ?
this.options.button.displayText : this.default.button.displayText;
},
context() {
return this.context;
} }
}, },
mounted() { mounted() {
@ -243,13 +286,13 @@ export default {
//console.log('options displayText', this.options.button.displayText); //console.log('options displayText', this.options.button.displayText);
//console.log('options bindModal.step1', this.options.bindModal.step1); //console.log('options bindModal.step1', this.options.bindModal.step1);
//console.log('options bindModal.step2', this.options.bindModal.step2); //console.log('options bindModal.step2', this.options.bindModal.step2);
console.log('options useDate.validFrom', this.options.useDate.validFrom); //console.log('options useDate.validFrom', this.options.useDate.validFrom);
console.log('options useDate.validTo', this.options.useDate.validTo); //console.log('options useDate.validTo', this.options.useDate.validTo);
console.log('useDatePane', this.useDatePane);
//console.log('Mounted now !');
this.openShowPane();
if (!this.step1WithModal) {
//console.log('Mounted now !');
this.openShowPane();
}
}, },
methods: { methods: {
@ -257,35 +300,72 @@ export default {
* Opening and closing Panes when interacting with buttons * Opening and closing Panes when interacting with buttons
*/ */
openShowPane() { openShowPane() {
if (this.context.edit) { if (this.context.edit) {
console.log('getInitialAddress');
this.getInitialAddress(this.context.addressId); this.getInitialAddress(this.context.addressId);
} }
// when create new address, start first with editPane !! if (this.bypassFirstStep) {
if ( this.context.edit === false this.closeShowPane();
&& this.flag.editPane === false
) {
this.openEditPane(); this.openEditPane();
this.flag.editPane = true;
} else { } else {
this.flag.showPane = true; this.flag.showPane = true;
console.log('step1: open the Show Panel'); console.log('step0: open the Show Panel');
} }
}, },
closeShowPane() {
// Show pane can be closed only when openPanesInModal is false
if (!this.inModal) {
this.flag.showPane = false;
console.log('step0: close the Show Panel');
}
},
openSuggestPane() {
this.flag.suggestPane = true;
console.log('step1: open the Suggestion Panel');
},
closeSuggestPane() {
this.flag.suggestPane = false;
console.log('step1: close the Suggestion Panel');
},
openEditPane() { openEditPane() {
console.log('step2: open the Edit panel'); /*
if (!this.context.edit && this.hasSuggestions) {
this.openSuggestPane();
} else {
}
*/
this.initForm(); this.initForm();
this.getCountries(); this.getCountries();
this.flag.editPane = true;
console.log('step2: open the Edit panel');
}, },
closeEditPane() { closeEditPane() {
console.log('step2: close the Edit Panel');
this.applyChanges(); this.applyChanges();
this.flag.showPane = true;
this.flag.editPane = false; this.flag.editPane = false;
console.log('step2: close the Edit Panel');
/*
if (!this.context.edit && this.useDatePane) {
this.openDatePane();
} else {
}
*/
this.openShowPane()
},
openDatePane() {
this.flag.datePane = true;
console.log('step3: open the Date Panel');
},
closeDatePane() {
this.flag.datePane = false;
console.log('step3: close the Date Panel');
},
resetPane() {
this.flag.suggestPane = false;
this.flag.editPane = false;
this.flag.datePane = false;
this.flag.showPane = true;
}, },
/* /*

View File

@ -1,47 +0,0 @@
<template>
<div class="container">
<VueMultiselect
v-model="value"
@select="selectAddress"
name="field"
track-by="id"
label="value"
:custom-label="transName"
:multiple="false"
:placeholder="$t('select_address')"
:options="addresses">
</VueMultiselect>
</div>
</template>
<script>
import VueMultiselect from 'vue-multiselect';
export default {
name: 'SelectHouseholdAddress',
components: { VueMultiselect },
props: ['address'],
data() {
return {
value: null
}
},
computed: {
addresses() {
return this.address.loaded.addresses;
}
},
methods: {
transName(value) {
return `${value.text} ${value.postcode.name}`
},
selectAddress(value) {
this.address.selected.address = value;
}
}
};
</script>
<style src="vue-multiselect/dist/vue-multiselect.css"></style>

View File

@ -1,6 +1,6 @@
<template> <template>
<div v-if="insideModal == false" class="loading"> <div v-if="insideModal === false" class="loading">
<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>
@ -39,36 +39,39 @@
</div> </div>
</div> </div>
<ul v-if="insideModal == false" <action-buttons v-if="insideModal === false"
class="record_actions"> :flag="this.flag"
<!-- :options="this.options"
<li class="cancel"> :default="this.default">
<a class="btn btn-cancel" v-bind:href="context.backUrl"> <template v-slot:action>
{{ $t('back_to_the_list') }}</a> <li>
</li>--> <a @click.prevent="$emit('openEditPane')"
<li> class="btn btn-update">
<a @click.prevent="$emit('openEditPane')" {{ $t('action.edit')}}
class="btn btn-update"> </a>
{{ $t('action.edit')}} </li>
</a> <!--
</li> <li>
<!--<li> <a class="btn btn-save">
<a class="btn btn-save" {{ $t('action.save')}}
@click.prevent="$emit('submitAddress')"> </a>
{{ $t('action.save')}} </li>
</a> -->
</li>--> </template>
</ul> </action-buttons>
</template> </template>
<script> <script>
import { dateToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/chill/js/date.js'; import { dateToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/chill/js/date.js';
import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue'; import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue';
import ActionButtons from './ActionButtons.vue';
export default { export default {
name: 'ShowAddressPane', name: "DatePane",
components: { components: {
AddressRenderBox AddressRenderBox,
ActionButtons
}, },
props: [ props: [
'context', 'context',
@ -79,7 +82,7 @@ export default {
'errorMsg', 'errorMsg',
'insideModal' 'insideModal'
], ],
emits: ['openEditPane'], // 'submitAddress' emits: ['openEditPane'],
computed: { computed: {
address() { address() {
return this.entity.address; return this.entity.address;
@ -106,18 +109,6 @@ export default {
getValidToDateText() { getValidToDateText() {
return 'validTo'; return 'validTo';
}, },
getSuccessText() {
switch (this.context.entity.name) {
/*
case 'household':
return (this.context.edit) ? 'household_address_edit_success' : 'household_address_move_success';
case 'person':
return (this.context.edit) ? 'person_address_edit_success' : 'person_address_creation_success';
*/
default:
return (this.context.edit) ? 'address_edit_success' : 'address_new_success';
}
},
showDateFrom() { showDateFrom() {
return !this.context.edit && this.options.useDate.validFrom; return !this.context.edit && this.options.useDate.validFrom;
}, },
@ -125,5 +116,9 @@ export default {
return !this.context.edit && this.options.useDate.validTo; return !this.context.edit && this.options.useDate.validTo;
} }
} }
}; }
</script> </script>
<style scoped>
</style>

View File

@ -2,7 +2,7 @@
<div class="address-form"> <div class="address-form">
<!-- Not display in modal --> <!-- Not display in modal -->
<div v-if="insideModal == false" class="loading"> <div v-if="insideModal === false" class="loading">
<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">Loading...</span> <span class="sr-only">Loading...</span>
</div> </div>
@ -54,25 +54,23 @@
v-bind:entity="entity"> v-bind:entity="entity">
</address-more> </address-more>
<!-- Not display in modal --> <action-buttons v-if="insideModal === false"
<ul v-if="insideModal == false" :flag="this.flag"
class="record_actions sticky-form-buttons"> :options="this.options"
<li class="cancel"> :default="this.default">
<a class="btn btn-cancel" v-bind:href="context.backUrl"> <template v-slot:action>
{{ $t('back_to_the_list') }} <li>
</a> <a class="btn btn-cancel change-icon" @click="flag.showPane = true; flag.editPane = false;">
</li> {{ $t('action.cancel') }}
<li> </a>
<a class="btn btn-cancel change-icon" @click="flag.showPane = true; flag.editPane = false;"> </li>
{{ $t('action.cancel') }} <li>
</a> <a class="btn btn-save" @click.prevent="$emit('closeEditPane')">
</li> {{ $t('action.save')}}
<li> </a>
<a class="btn btn-update" @click.prevent="$emit('closeEditPane')"> </li>
{{ $t('action.valid_and_see')}} </template>
</a> </action-buttons>
</li>
</ul>
</div> </div>
</template> </template>
@ -82,16 +80,18 @@ import CountrySelection from './AddAddress/CountrySelection';
import CitySelection from './AddAddress/CitySelection'; import CitySelection from './AddAddress/CitySelection';
import AddressSelection from './AddAddress/AddressSelection'; import AddressSelection from './AddAddress/AddressSelection';
import AddressMap from './AddAddress/AddressMap'; import AddressMap from './AddAddress/AddressMap';
import AddressMore from './AddAddress/AddressMore' import AddressMore from './AddAddress/AddressMore';
import ActionButtons from './ActionButtons.vue';
export default { export default {
name: "EditAddressPane", name: "EditPane",
components: { components: {
CountrySelection, CountrySelection,
CitySelection, CitySelection,
AddressSelection, AddressSelection,
AddressMap, AddressMap,
AddressMore AddressMore,
ActionButtons
}, },
props: [ props: [
'context', 'context',

View File

@ -0,0 +1,86 @@
<template>
<div class="loading">
<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>
</div>
<div v-if="errorMsg && errorMsg.length > 0" class="alert alert-danger">
{{ errorMsg }}
</div>
<div v-if="flag.success" class="alert alert-success">
{{ $t(getSuccessText) }}
</div>
<address-render-box :address="address"></address-render-box>
<action-buttons :flag="this.flag" :options="this.options" :default="this.default">
<template v-slot:action>
<li>
<button @click.prevent="$emit('openEditPane')"
class="btn" :class="getClassButton"
type="button" name="button" :title="$t(getTextButton)">
<span v-if="displayTextButton">{{ $t(getTextButton) }}</span>
</button>
</li>
</template>
</action-buttons>
</template>
<script>
import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue';
import ActionButtons from './ActionButtons.vue';
export default {
name: 'ShowPane',
components: {
AddressRenderBox,
ActionButtons
},
props: [
'context',
'options',
'default',
'flag',
'entity',
'errorMsg'
],
emits: ['openEditPane'],
computed: {
address() {
return this.entity.address;
},
displayTextButton() {
return (typeof this.options.button !== 'undefined' && typeof this.options.button.displayText !== 'undefined') ?
this.options.button.displayText : this.default.button.displayText;
},
getClassButton() {
let type = (this.context.edit) ? this.default.button.type.edit : this.default.button.type.create;
let size = (typeof this.options.button !== 'undefined' && this.options.button.size !== null) ?
`${this.options.button.size} ` : '';
return `${size}${type}`;
},
getTextButton() {
if ( typeof this.options.button.text !== 'undefined'
&& ( this.options.button.text.edit !== null
|| this.options.button.text.create !== null
)) {
return (this.context.edit) ? this.options.button.text.edit : this.options.button.text.create;
}
return (this.context.edit) ? this.default.button.text.edit : this.default.button.text.create;
},
getSuccessText() {
switch (this.context.entity.name) {
/*
case 'household':
return (this.context.edit) ? 'household_address_edit_success' : 'household_address_move_success';
case 'person':
return (this.context.edit) ? 'person_address_edit_success' : 'person_address_creation_success';
*/
default:
return (this.context.edit) ? 'address_edit_success' : 'address_new_success';
}
}
}
};
</script>

View File

@ -0,0 +1,63 @@
<template>
<div v-if="insideModal === false" class="loading">
<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>
</div>
<div v-if="errorMsg && errorMsg.length > 0" class="alert alert-danger">
{{ errorMsg }}
</div>
<div v-if="flag.success" class="alert alert-success">
{{ $t(getSuccessText) }}
</div>
suggestions
<action-buttons v-if="insideModal === false"
:flag="this.flag"
:options="this.options"
:default="this.default">
<template v-slot:action>
<li>
<a @click.prevent="$emit('openEditPane')"
class="btn btn-update">
{{ $t('action.edit')}}
</a>
</li>
</template>
</action-buttons>
</template>
<script>
import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue';
import ActionButtons from './ActionButtons.vue';
export default {
name: "SuggestPane",
components: {
AddressRenderBox,
ActionButtons
},
props: [
'context',
'options',
'default',
'flag',
'entity',
'errorMsg',
'insideModal'
],
emits: ['openEditPane'],
computed: {
},
methods: {
}
}
</script>
<style scoped>
</style>

View File

@ -38,12 +38,11 @@ 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 /// Display panes in Modal for step123
bindModal: { openPanesInModal: container.dataset.openPanesInModal !== 'false', //boolean, default: true
step1: container.dataset.bindModalStep1 !== 'false', //boolean, default: true /// Display actions buttons of panes in a sticky-form-button navbar
step2: container.dataset.bindModalStep2 !== 'false' //boolean, default: true stickyActions: container.dataset.stickyActions === 'true', //boolean, default: false
}, /// Use Date fields
// Use Date fields
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
@ -57,5 +56,5 @@ containers.forEach((container) => {
.component('app', App) .component('app', App)
.mount(container); .mount(container);
console.log('container dataset', container.dataset); //console.log('container dataset', container.dataset);
}); });

View File

@ -7,16 +7,17 @@
name: string name: string
id: integer id: integer
} }
* mode string ['edit*'|'create'] * mode string ['edit*'|'new']
* addressId integer * addressId integer
* backUrl twig route: path('route', {parameters}) * backUrl twig route: path('route', {parameters})
* modalTitle twig translated chain * modalTitle twig translated chain
* buttonText twig translated chain * buttonText twig translated chain
* buttonSize bootstrap class like 'btn-sm' * buttonSize bootstrap class like 'btn-sm'
* buttonDisplayText bool * buttonDisplayText bool (default: true)
* bindModalStep1 bool * openPanesInModal bool (default: true)
* bindModalStep2 bool * stickyActions bool (default: false)
* useValidFrom bool (default: false)
* useValidTo bool (default: false)
#} #}
<div class="address-container" <div class="address-container"
@ -51,12 +52,12 @@
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 %} {% if stickyActions is defined and stickyActions == 1 %}
data-bind-modal-step2="false" data-sticky-actions="true"
{% endif %} {% endif %}
{% if useValidFrom is defined and useValidFrom == 1 %} {% if useValidFrom is defined and useValidFrom == 1 %}

View File

@ -88,9 +88,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

@ -32,7 +32,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 }),
mode: 'create', mode: 'new',
buttonSize: 'btn-lg', buttonSize: 'btn-lg',
buttonText: 'Add an address', buttonText: 'Add an address',
modalTitle: 'Add an address', modalTitle: 'Add an address',
@ -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,11 +30,12 @@
{% 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,
bindModalStep2: false,
useValidFrom: true, useValidFrom: true,
useValidTo: false openPanesInModal: false,
stickyActions: true,
} %} } %}
{#
#}
{% endblock %} {% endblock %}

View File

@ -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 }),
bindModalStep1: false, openPanesInModal: false,
bindModalStep2: false, stickyActions: true
} %} } %}
</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

@ -18,7 +18,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_address_move', { 'household_id': household.id }), backUrl: path('chill_person_household_address_move', { 'household_id': household.id }),
mode: 'create', mode: 'new',
buttonSize: 'btn-lg', buttonSize: 'btn-lg',
buttonText: 'Move household', buttonText: 'Move household',
modalTitle: 'Move household', modalTitle: 'Move household',

View File

@ -33,15 +33,14 @@
{% 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 }),
mode: 'create', mode: 'new',
buttonSize: 'btn-sm', buttonSize: 'btn-sm',
buttonText: 'Move household', buttonText: 'Move household',
modalTitle: 'Move household', modalTitle: 'Move household',
buttonDisplayText: false, buttonDisplayText: false,
} %} } %}
{# {#
bindModalStep1: false, openPanesInModal: false
bindModalStep2: true,
#} #}
</li> </li>
<li class="list-inline-item"> <li class="list-inline-item">