mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
slot buttons up from actionButtons to addAddress
This commit is contained in:
parent
4855ec2065
commit
2788170f03
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import AddAddress from './components/AddAddress.vue';
|
import AddAddress from './components/AddAddress.vue';
|
||||||
import { patchAddress } from "./api";
|
|
||||||
import { postAddressToHousehold, postAddressToPerson } from "ChillPersonAssets/vuejs/_api/AddAddress";
|
import { postAddressToHousehold, postAddressToPerson } from "ChillPersonAssets/vuejs/_api/AddAddress";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -30,7 +29,6 @@ export default {
|
|||||||
return (this.context.edit) ? 'address_' + this.context.addressId
|
return (this.context.edit) ? 'address_' + this.context.addressId
|
||||||
: this.context.entity.name + '_' + this.context.entity.id ;
|
: this.context.entity.name + '_' + this.context.entity.id ;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
//console.log('AddAddress: data context', this.context);
|
//console.log('AddAddress: data context', this.context);
|
||||||
|
@ -2,43 +2,30 @@
|
|||||||
<ul class="record_actions"
|
<ul class="record_actions"
|
||||||
:class="{ 'sticky-form-buttons': isStickyForm }">
|
:class="{ 'sticky-form-buttons': isStickyForm }">
|
||||||
|
|
||||||
<!--
|
|
||||||
<li v-if="isStickyForm" class="cancel">
|
<li v-if="isStickyForm" class="cancel">
|
||||||
<a class="btn btn-cancel" @click="resetPane">
|
<slot name="before"></slot>
|
||||||
{{ $t('back_to_the_list') }}
|
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
-->
|
|
||||||
|
|
||||||
<slot name="action"></slot>
|
<slot name="action"></slot>
|
||||||
|
|
||||||
<!--
|
|
||||||
<li v-if="isStickyForm">
|
<li v-if="isStickyForm">
|
||||||
<a class="btn btn-save">
|
<slot name="after"></slot>
|
||||||
{{ $t('action.save')}}
|
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
-->
|
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "ActionButtons",
|
name: "ActionButtons",
|
||||||
props: [ 'options', 'default' ],
|
props: ['options', 'defaultz'],
|
||||||
computed: {
|
computed: {
|
||||||
isStickyForm() {
|
isStickyForm() {
|
||||||
return (typeof this.options.stickyActions !== 'undefined') ?
|
return (typeof this.options.stickyActions !== 'undefined') ?
|
||||||
this.options.stickyActions : this.default.stickyActions;
|
this.options.stickyActions : this.defaultz.stickyActions;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
resetPane() {
|
|
||||||
this.flag.suggestPane = false;
|
|
||||||
this.flag.editPane = false;
|
|
||||||
this.flag.datePane = false;
|
|
||||||
this.flag.showPane = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<show-pane v-if="flag.showPane"
|
<show-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:defaultz="this.defaultz"
|
||||||
v-bind:entity="this.entity"
|
v-bind:entity="this.entity"
|
||||||
v-bind:flag="this.flag"
|
v-bind:flag="this.flag"
|
||||||
@openEditPane="openEditPane"
|
@openEditPane="openEditPane"
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<suggest-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:defaultz="this.defaultz"
|
||||||
v-bind:entity="this.entity"
|
v-bind:entity="this.entity"
|
||||||
v-bind:flag="this.flag"
|
v-bind:flag="this.flag"
|
||||||
ref="suggestAddress">
|
ref="suggestAddress">
|
||||||
@ -39,14 +39,9 @@
|
|||||||
|
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<button @click="openEditPane"
|
<button @click="openEditPane"
|
||||||
class="btn btn-update">
|
class="btn btn-create">
|
||||||
{{ $t('action.edit')}}
|
{{ $t('create_a_new_address')}}
|
||||||
</button>
|
</button>
|
||||||
<!--
|
|
||||||
<button class="btn btn-save">
|
|
||||||
{{ $t('action.save')}}
|
|
||||||
</button>
|
|
||||||
-->
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</modal>
|
</modal>
|
||||||
@ -55,12 +50,26 @@
|
|||||||
<suggest-pane v-if="flag.suggestPane"
|
<suggest-pane v-if="flag.suggestPane"
|
||||||
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:defaultz="this.defaultz"
|
||||||
v-bind:entity="this.entity"
|
v-bind:entity="this.entity"
|
||||||
v-bind:flag="this.flag"
|
v-bind:flag="this.flag"
|
||||||
v-bind:insideModal="false"
|
v-bind:insideModal="false"
|
||||||
@openEditPane="openEditPane"
|
|
||||||
ref="suggestAddress">
|
ref="suggestAddress">
|
||||||
|
|
||||||
|
<template v-slot:before v-if="!bypassFirstStep">
|
||||||
|
<a class="btn btn-cancel" @click="resetPane">
|
||||||
|
{{ $t('action.cancel') }}
|
||||||
|
</a>
|
||||||
|
</template>
|
||||||
|
<template v-slot:action>
|
||||||
|
<li>
|
||||||
|
<button @click="openEditPane"
|
||||||
|
class="btn btn-create">
|
||||||
|
{{ $t('create_a_new_address')}}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
|
||||||
</suggest-pane>
|
</suggest-pane>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -83,7 +92,7 @@
|
|||||||
<edit-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:defaultz="this.defaultz"
|
||||||
v-bind:entity="this.entity"
|
v-bind:entity="this.entity"
|
||||||
v-bind:flag="this.flag"
|
v-bind:flag="this.flag"
|
||||||
@getCities="getCities"
|
@getCities="getCities"
|
||||||
@ -92,12 +101,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<button class="btn btn-cancel change-icon" @click="flag.showPane = true; flag.editPane = false;">
|
<button class="btn btn-cancel change-icon" @click="resetPane">
|
||||||
{{ $t('action.cancel') }}
|
{{ $t('action.cancel') }}
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-update"
|
<button class="btn btn-save" @click="closeEditPane">
|
||||||
@click="closeEditPane">
|
{{ $t('action.save')}}
|
||||||
{{ $t('action.valid')}}
|
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -107,13 +115,26 @@
|
|||||||
<edit-pane v-if="flag.editPane"
|
<edit-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:defaultz="this.defaultz"
|
||||||
v-bind:entity="this.entity"
|
v-bind:entity="this.entity"
|
||||||
v-bind:flag="this.flag"
|
v-bind:flag="this.flag"
|
||||||
v-bind:insideModal="false"
|
v-bind:insideModal="false"
|
||||||
@closeEditPane="closeEditPane"
|
|
||||||
@getCities="getCities"
|
@getCities="getCities"
|
||||||
@getReferenceAddresses="getReferenceAddresses">
|
@getReferenceAddresses="getReferenceAddresses">
|
||||||
|
|
||||||
|
<template v-slot:before>
|
||||||
|
<a class="btn btn-cancel" @click="resetPane">
|
||||||
|
{{ $t('action.cancel') }}
|
||||||
|
</a>
|
||||||
|
</template>
|
||||||
|
<template v-slot:action>
|
||||||
|
<li>
|
||||||
|
<button class="btn btn-save" @click="closeEditPane">
|
||||||
|
{{ $t('action.save')}}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
|
||||||
</edit-pane>
|
</edit-pane>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -136,7 +157,7 @@
|
|||||||
<date-pane
|
<date-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:defaultz="this.defaultz"
|
||||||
v-bind:entity="this.entity"
|
v-bind:entity="this.entity"
|
||||||
v-bind:flag="this.flag"
|
v-bind:flag="this.flag"
|
||||||
ref="dateAddress">
|
ref="dateAddress">
|
||||||
@ -144,13 +165,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<button @click="openEditPane"
|
<button class="btn btn-update" @click="openEditPane">
|
||||||
class="btn btn-update">
|
|
||||||
{{ $t('action.edit')}}
|
{{ $t('action.edit')}}
|
||||||
</button>
|
</button>
|
||||||
|
<!--
|
||||||
<button class="btn btn-save">
|
<button class="btn btn-save">
|
||||||
{{ $t('action.save')}}
|
{{ $t('action.save')}}
|
||||||
</button>
|
</button>
|
||||||
|
-->
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</modal>
|
</modal>
|
||||||
@ -159,12 +181,20 @@
|
|||||||
<date-pane v-if="flag.datePane"
|
<date-pane v-if="flag.datePane"
|
||||||
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:defaultz="this.defaultz"
|
||||||
v-bind:entity="this.entity"
|
v-bind:entity="this.entity"
|
||||||
v-bind:flag="this.flag"
|
v-bind:flag="this.flag"
|
||||||
v-bind:insideModal="false"
|
v-bind:insideModal="false"
|
||||||
@openEditPane="openEditPane"
|
|
||||||
ref="dateAddress">
|
ref="dateAddress">
|
||||||
|
|
||||||
|
<template v-slot:action>
|
||||||
|
<li>
|
||||||
|
<button class="btn btn-update" @click="openEditPane">
|
||||||
|
{{ $t('action.edit')}}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
|
||||||
</date-pane>
|
</date-pane>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -199,7 +229,7 @@ export default {
|
|||||||
loading: false,
|
loading: false,
|
||||||
success: false
|
success: false
|
||||||
},
|
},
|
||||||
default: {
|
defaultz: {
|
||||||
button: {
|
button: {
|
||||||
text: { create: 'add_an_address_title', edit: 'edit_address' },
|
text: { create: 'add_an_address_title', edit: 'edit_address' },
|
||||||
type: { create: 'btn-create', edit: 'btn-update'},
|
type: { create: 'btn-create', edit: 'btn-update'},
|
||||||
@ -211,7 +241,9 @@ export default {
|
|||||||
useDate: {
|
useDate: {
|
||||||
validFrom: false,
|
validFrom: false,
|
||||||
validTo: false
|
validTo: false
|
||||||
}
|
},
|
||||||
|
forceRedirect: false,
|
||||||
|
onlyButton: false
|
||||||
},
|
},
|
||||||
entity: {
|
entity: {
|
||||||
address: {}, // <== loaded and returned
|
address: {}, // <== loaded and returned
|
||||||
@ -251,15 +283,15 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
inModal() {
|
inModal() {
|
||||||
return (typeof this.options.openPanesInModal !== 'undefined') ?
|
return (typeof this.options.openPanesInModal !== 'undefined') ?
|
||||||
this.options.openPanesInModal : this.default.openPanesInModal;
|
this.options.openPanesInModal : this.defaultz.openPanesInModal;
|
||||||
},
|
},
|
||||||
useDatePane() {
|
useDatePane() {
|
||||||
let vFrom = (typeof this.options.useDate !== 'undefined'
|
let vFrom = (typeof this.options.useDate !== 'undefined'
|
||||||
&& typeof this.options.useDate.validFrom !== 'undefined') ?
|
&& typeof this.options.useDate.validFrom !== 'undefined') ?
|
||||||
this.options.useDate.validFrom : this.default.useDate.validFrom ;
|
this.options.useDate.validFrom : this.defaultz.useDate.validFrom ;
|
||||||
let vTo = (typeof this.options.useDate !== 'undefined'
|
let vTo = (typeof this.options.useDate !== 'undefined'
|
||||||
&& typeof this.options.useDate.validTo !== 'undefined') ?
|
&& typeof this.options.useDate.validTo !== 'undefined') ?
|
||||||
this.options.useDate.validTo : this.default.useDate.validTo ;
|
this.options.useDate.validTo : this.defaultz.useDate.validTo ;
|
||||||
return (vFrom || vTo) ? true : false;
|
return (vFrom || vTo) ? true : false;
|
||||||
},
|
},
|
||||||
hasSuggestions() {
|
hasSuggestions() {
|
||||||
@ -267,6 +299,10 @@ export default {
|
|||||||
//return addressSuggestions.length > 0
|
//return addressSuggestions.length > 0
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
displaySuggestions() {
|
||||||
|
console.log('displaySuggestions');
|
||||||
|
return !this.context.edit && this.hasSuggestions;
|
||||||
|
},
|
||||||
getTextTitle() {
|
getTextTitle() {
|
||||||
if ( typeof this.options.title !== 'undefined'
|
if ( typeof this.options.title !== 'undefined'
|
||||||
&& ( this.options.title.edit !== null
|
&& ( this.options.title.edit !== null
|
||||||
@ -274,11 +310,12 @@ export default {
|
|||||||
)) {
|
)) {
|
||||||
return (this.context.edit) ? this.options.title.edit : this.options.title.create;
|
return (this.context.edit) ? this.options.title.edit : this.options.title.create;
|
||||||
}
|
}
|
||||||
return (this.context.edit) ? this.default.title.edit : this.default.title.create;
|
return (this.context.edit) ? this.defaultz.title.edit : this.defaultz.title.create;
|
||||||
},
|
},
|
||||||
bypassFirstStep() {
|
bypassFirstStep() {
|
||||||
// exception: passing step0 if new address and pane are not in modal
|
// exception: passing step0 if new address and pane are not in modal
|
||||||
return !this.context.edit && !this.inModal && this.flag.editPane === false
|
console.log('bypassFirstStep');
|
||||||
|
return !this.context.edit && !this.inModal;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -290,7 +327,7 @@ export default {
|
|||||||
//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('useDatePane', this.useDatePane);
|
||||||
|
|
||||||
//console.log('Mounted now !');
|
console.log('Mounted now !');
|
||||||
this.openShowPane();
|
this.openShowPane();
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -304,7 +341,7 @@ export default {
|
|||||||
console.log('getInitialAddress');
|
console.log('getInitialAddress');
|
||||||
this.getInitialAddress(this.context.addressId);
|
this.getInitialAddress(this.context.addressId);
|
||||||
}
|
}
|
||||||
if (this.bypassFirstStep) {
|
if (this.flag.editPane === false && this.bypassFirstStep) {
|
||||||
this.closeShowPane();
|
this.closeShowPane();
|
||||||
this.openEditPane();
|
this.openEditPane();
|
||||||
} else {
|
} else {
|
||||||
@ -328,28 +365,27 @@ export default {
|
|||||||
console.log('step1: close the Suggestion Panel');
|
console.log('step1: close the Suggestion Panel');
|
||||||
},
|
},
|
||||||
openEditPane() {
|
openEditPane() {
|
||||||
/*
|
if (this.flag.suggestPane === false && this.displaySuggestions) {
|
||||||
if (!this.context.edit && this.hasSuggestions) {
|
|
||||||
this.openSuggestPane();
|
this.openSuggestPane();
|
||||||
} else {
|
} else {
|
||||||
|
if (this.flag.suggestPane === true) {
|
||||||
|
this.closeSuggestPane();
|
||||||
|
}
|
||||||
|
this.initForm();
|
||||||
|
this.getCountries();
|
||||||
|
this.flag.editPane = true;
|
||||||
|
console.log('step2: open the Edit panel');
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
this.initForm();
|
|
||||||
this.getCountries();
|
|
||||||
this.flag.editPane = true;
|
|
||||||
console.log('step2: open the Edit panel');
|
|
||||||
},
|
},
|
||||||
closeEditPane() {
|
closeEditPane() {
|
||||||
this.applyChanges();
|
this.applyChanges();
|
||||||
this.flag.editPane = false;
|
this.flag.editPane = false;
|
||||||
console.log('step2: close the Edit Panel');
|
console.log('step2: close the Edit Panel');
|
||||||
/*
|
|
||||||
if (!this.context.edit && this.useDatePane) {
|
if (!this.context.edit && this.useDatePane) {
|
||||||
this.openDatePane();
|
this.openDatePane();
|
||||||
} else {
|
} else {
|
||||||
|
this.openShowPane()
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
this.openShowPane()
|
|
||||||
},
|
},
|
||||||
openDatePane() {
|
openDatePane() {
|
||||||
this.flag.datePane = true;
|
this.flag.datePane = true;
|
||||||
@ -363,7 +399,7 @@ export default {
|
|||||||
this.flag.suggestPane = false;
|
this.flag.suggestPane = false;
|
||||||
this.flag.editPane = false;
|
this.flag.editPane = false;
|
||||||
this.flag.datePane = false;
|
this.flag.datePane = false;
|
||||||
this.flag.showPane = true;
|
this.openShowPane();
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -494,16 +530,13 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('apply changes');
|
||||||
if (this.context.edit) {
|
if (this.context.edit) {
|
||||||
this.updateAddress({
|
this.updateAddress({
|
||||||
addressId: this.context.addressId,
|
addressId: this.context.addressId,
|
||||||
newAddress: newAddress
|
newAddress: newAddress
|
||||||
})
|
})
|
||||||
.then(payload => {
|
.then(payload => this.closePaneAndCallbackSubmit(payload));
|
||||||
console.log('payload', payload);
|
|
||||||
this.closePaneAndCallbackSubmit(payload);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.addNewAddress(newAddress)
|
this.addNewAddress(newAddress)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<template>
|
<template>step3
|
||||||
|
|
||||||
<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>
|
||||||
@ -40,23 +40,16 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<action-buttons v-if="insideModal === false"
|
<action-buttons v-if="insideModal === false"
|
||||||
:flag="this.flag"
|
|
||||||
:options="this.options"
|
:options="this.options"
|
||||||
:default="this.default">
|
:defaultz="this.defaultz">
|
||||||
|
<template v-slot:before>
|
||||||
|
<slot name="before"></slot>
|
||||||
|
</template>
|
||||||
<template v-slot:action>
|
<template v-slot:action>
|
||||||
<li>
|
<slot name="action"></slot>
|
||||||
<a @click.prevent="$emit('openEditPane')"
|
</template>
|
||||||
class="btn btn-update">
|
<template v-slot:after>
|
||||||
{{ $t('action.edit')}}
|
<slot name="after"></slot>
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<!--
|
|
||||||
<li>
|
|
||||||
<a class="btn btn-save">
|
|
||||||
{{ $t('action.save')}}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
-->
|
|
||||||
</template>
|
</template>
|
||||||
</action-buttons>
|
</action-buttons>
|
||||||
|
|
||||||
@ -76,13 +69,12 @@ export default {
|
|||||||
props: [
|
props: [
|
||||||
'context',
|
'context',
|
||||||
'options',
|
'options',
|
||||||
'default',
|
'defaultz',
|
||||||
'flag',
|
'flag',
|
||||||
'entity',
|
'entity',
|
||||||
'errorMsg',
|
'errorMsg',
|
||||||
'insideModal'
|
'insideModal'
|
||||||
],
|
],
|
||||||
emits: ['openEditPane'],
|
|
||||||
computed: {
|
computed: {
|
||||||
address() {
|
address() {
|
||||||
return this.entity.address;
|
return this.entity.address;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<template>
|
<template>step2
|
||||||
<div class="address-form">
|
<div class="address-form">
|
||||||
|
|
||||||
<!-- Not display in modal -->
|
<!-- Not display in modal -->
|
||||||
@ -55,20 +55,16 @@
|
|||||||
</address-more>
|
</address-more>
|
||||||
|
|
||||||
<action-buttons v-if="insideModal === false"
|
<action-buttons v-if="insideModal === false"
|
||||||
:flag="this.flag"
|
|
||||||
:options="this.options"
|
:options="this.options"
|
||||||
:default="this.default">
|
:defaultz="this.defaultz">
|
||||||
|
<template v-slot:before>
|
||||||
|
<slot name="before"></slot>
|
||||||
|
</template>
|
||||||
<template v-slot:action>
|
<template v-slot:action>
|
||||||
<li>
|
<slot name="action"></slot>
|
||||||
<a class="btn btn-cancel change-icon" @click="flag.showPane = true; flag.editPane = false;">
|
</template>
|
||||||
{{ $t('action.cancel') }}
|
<template v-slot:after>
|
||||||
</a>
|
<slot name="after"></slot>
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a class="btn btn-save" @click.prevent="$emit('closeEditPane')">
|
|
||||||
{{ $t('action.save')}}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</template>
|
</template>
|
||||||
</action-buttons>
|
</action-buttons>
|
||||||
|
|
||||||
@ -96,13 +92,13 @@ export default {
|
|||||||
props: [
|
props: [
|
||||||
'context',
|
'context',
|
||||||
'options',
|
'options',
|
||||||
'default',
|
'defaultz',
|
||||||
'flag',
|
'flag',
|
||||||
'entity',
|
'entity',
|
||||||
'errorMsg',
|
'errorMsg',
|
||||||
'insideModal'
|
'insideModal'
|
||||||
],
|
],
|
||||||
emits: ['closeEditPane', 'getCities', 'getReferenceAddresses'],
|
emits: ['getCities', 'getReferenceAddresses'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
value: false
|
value: false
|
||||||
|
@ -11,9 +11,11 @@
|
|||||||
{{ $t(getSuccessText) }}
|
{{ $t(getSuccessText) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<address-render-box :address="address"></address-render-box>
|
<address-render-box v-if="!onlyButton" :address="address"></address-render-box>
|
||||||
|
|
||||||
<action-buttons :flag="this.flag" :options="this.options" :default="this.default">
|
<action-buttons
|
||||||
|
:options="this.options"
|
||||||
|
:defaultz="this.defaultz">
|
||||||
<template v-slot:action>
|
<template v-slot:action>
|
||||||
<li>
|
<li>
|
||||||
<button @click.prevent="$emit('openEditPane')"
|
<button @click.prevent="$emit('openEditPane')"
|
||||||
@ -40,7 +42,7 @@ export default {
|
|||||||
props: [
|
props: [
|
||||||
'context',
|
'context',
|
||||||
'options',
|
'options',
|
||||||
'default',
|
'defaultz',
|
||||||
'flag',
|
'flag',
|
||||||
'entity',
|
'entity',
|
||||||
'errorMsg'
|
'errorMsg'
|
||||||
@ -52,10 +54,10 @@ export default {
|
|||||||
},
|
},
|
||||||
displayTextButton() {
|
displayTextButton() {
|
||||||
return (typeof this.options.button !== 'undefined' && typeof this.options.button.displayText !== 'undefined') ?
|
return (typeof this.options.button !== 'undefined' && typeof this.options.button.displayText !== 'undefined') ?
|
||||||
this.options.button.displayText : this.default.button.displayText;
|
this.options.button.displayText : this.defaultz.button.displayText;
|
||||||
},
|
},
|
||||||
getClassButton() {
|
getClassButton() {
|
||||||
let type = (this.context.edit) ? this.default.button.type.edit : this.default.button.type.create;
|
let type = (this.context.edit) ? this.defaultz.button.type.edit : this.defaultz.button.type.create;
|
||||||
let size = (typeof this.options.button !== 'undefined' && this.options.button.size !== null) ?
|
let size = (typeof this.options.button !== 'undefined' && this.options.button.size !== null) ?
|
||||||
`${this.options.button.size} ` : '';
|
`${this.options.button.size} ` : '';
|
||||||
return `${size}${type}`;
|
return `${size}${type}`;
|
||||||
@ -67,7 +69,7 @@ export default {
|
|||||||
)) {
|
)) {
|
||||||
return (this.context.edit) ? this.options.button.text.edit : this.options.button.text.create;
|
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;
|
return (this.context.edit) ? this.defaultz.button.text.edit : this.defaultz.button.text.create;
|
||||||
},
|
},
|
||||||
getSuccessText() {
|
getSuccessText() {
|
||||||
switch (this.context.entity.name) {
|
switch (this.context.entity.name) {
|
||||||
@ -80,6 +82,10 @@ export default {
|
|||||||
default:
|
default:
|
||||||
return (this.context.edit) ? 'address_edit_success' : 'address_new_success';
|
return (this.context.edit) ? 'address_edit_success' : 'address_new_success';
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
onlyButton() {
|
||||||
|
return (typeof this.options.onlyButton !== 'undefined') ?
|
||||||
|
this.options.onlyButton : this.defaultz.onlyButton;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,33 +1,30 @@
|
|||||||
<template>
|
<template>step1
|
||||||
|
|
||||||
<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>
|
||||||
|
|
||||||
<div v-if="errorMsg && errorMsg.length > 0" class="alert alert-danger">
|
<div v-if="errorMsg && errorMsg.length > 0" class="alert alert-danger">{{ errorMsg }}</div>
|
||||||
{{ errorMsg }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="flag.success" class="alert alert-success">
|
<div v-if="flag.success" class="alert alert-success">{{ $t(getSuccessText) }}</div>
|
||||||
{{ $t(getSuccessText) }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
suggestions
|
<h3>{{ $t('address_suggestions') }}</h3>
|
||||||
|
|
||||||
<action-buttons v-if="insideModal === false"
|
<action-buttons v-if="insideModal === false"
|
||||||
:flag="this.flag"
|
|
||||||
:options="this.options"
|
:options="this.options"
|
||||||
:default="this.default">
|
:defaultz="this.defaultz">
|
||||||
|
<template v-slot:before>
|
||||||
|
<slot name="before"></slot>
|
||||||
|
</template>
|
||||||
<template v-slot:action>
|
<template v-slot:action>
|
||||||
<li>
|
<slot name="action"></slot>
|
||||||
<a @click.prevent="$emit('openEditPane')"
|
</template>
|
||||||
class="btn btn-update">
|
<template v-slot:after>
|
||||||
{{ $t('action.edit')}}
|
<slot name="after"></slot>
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</template>
|
</template>
|
||||||
</action-buttons>
|
</action-buttons>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -43,21 +40,13 @@ export default {
|
|||||||
props: [
|
props: [
|
||||||
'context',
|
'context',
|
||||||
'options',
|
'options',
|
||||||
'default',
|
'defaultz',
|
||||||
'flag',
|
'flag',
|
||||||
'entity',
|
'entity',
|
||||||
'errorMsg',
|
'errorMsg',
|
||||||
'insideModal'
|
'insideModal'
|
||||||
],
|
],
|
||||||
emits: ['openEditPane'],
|
computed: {},
|
||||||
computed: {
|
methods: {}
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
@ -33,6 +33,7 @@ const addressMessages = {
|
|||||||
validTo: "L'adresse est valable jusqu'au",
|
validTo: "L'adresse est valable jusqu'au",
|
||||||
back_to_the_list: 'Retour à la liste',
|
back_to_the_list: 'Retour à la liste',
|
||||||
loading: 'chargement en cours...',
|
loading: 'chargement en cours...',
|
||||||
|
address_suggestions: "Suggestion d'adresses",
|
||||||
address_new_success: 'La nouvelle adresse est enregistrée',
|
address_new_success: 'La nouvelle adresse est enregistrée',
|
||||||
address_edit_success: 'L\'adresse a été mise à jour',
|
address_edit_success: 'L\'adresse a été mise à jour',
|
||||||
|
|
||||||
|
@ -48,7 +48,9 @@ containers.forEach((container) => {
|
|||||||
validTo: container.dataset.useValidTo === 'true' //boolean, default: false
|
validTo: container.dataset.useValidTo === 'true' //boolean, default: false
|
||||||
},
|
},
|
||||||
/// Force redirection after last step (cfr. backUrl)
|
/// Force redirection after last step (cfr. backUrl)
|
||||||
forceRedirect: container.dataset.forceRedirect === 'true' //boolean, default: false
|
forceRedirect: container.dataset.forceRedirect === 'true', //boolean, default: false
|
||||||
|
/// Don't display show renderbox Address
|
||||||
|
onlyButton: container.dataset.onlyButton === 'true' //boolean, default: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,8 @@ export default {
|
|||||||
// Use Date fields
|
// Use Date fields
|
||||||
useDate: {
|
useDate: {
|
||||||
validFrom: true
|
validFrom: true
|
||||||
}
|
},
|
||||||
|
onlyButton: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,11 @@
|
|||||||
{% 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 }),
|
||||||
openPanesInModal: false,
|
|
||||||
stickyActions: true
|
|
||||||
} %}
|
} %}
|
||||||
|
{#
|
||||||
|
stickyActions: true
|
||||||
|
openPanesInModal: false,
|
||||||
|
#}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
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 }),
|
||||||
openPanesInModal: false,
|
openPanesInModal: false,
|
||||||
|
stickyActions: true
|
||||||
} %}
|
} %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -17,8 +17,10 @@
|
|||||||
{# include vue_address component #}
|
{# include vue_address component #}
|
||||||
{% 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_addresses', { 'household_id': household.id }),
|
||||||
|
forceRedirect: true,
|
||||||
mode: 'new',
|
mode: 'new',
|
||||||
|
useValidFrom: true,
|
||||||
buttonSize: 'btn-lg',
|
buttonSize: 'btn-lg',
|
||||||
buttonText: 'Move household',
|
buttonText: 'Move household',
|
||||||
modalTitle: 'Move household',
|
modalTitle: 'Move household',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user