mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 05:44:24 +00:00
handle creation of address
This commit is contained in:
parent
07030922e8
commit
bbcf9cc4ca
@ -169,7 +169,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
* orphanRemoval=true
|
* orphanRemoval=true
|
||||||
* )
|
* )
|
||||||
* @Serializer\Groups({"read"})
|
* @Serializer\Groups({"read"})
|
||||||
* @internal /!\ the serialization for read / write evaluations is handled in `AccompanyingPeriodWorkDenormalizer`
|
* @internal /!\ the serialization for write evaluations is handled in `AccompanyingPeriodWorkDenormalizer`
|
||||||
*/
|
*/
|
||||||
private Collection $accompanyingPeriodWorkEvaluations;
|
private Collection $accompanyingPeriodWorkEvaluations;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
:key="addAddress.key"
|
:key="addAddress.key"
|
||||||
:options="addAddress.options"
|
:options="addAddress.options"
|
||||||
:result="addAddress.result"
|
:result="addAddress.result"
|
||||||
@submitAddress="setHouseholdAddress"
|
@submitAddress="setHouseholdCreatedAddress"
|
||||||
ref="addAddress">
|
ref="addAddress">
|
||||||
</add-address>
|
</add-address>
|
||||||
</li>
|
</li>
|
||||||
@ -38,7 +38,7 @@
|
|||||||
<div v-if="isHouseholdNew && hasHouseholdAddress">
|
<div v-if="isHouseholdNew && hasHouseholdAddress">
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li >
|
<li >
|
||||||
<button class="btn" @click="removeHouseholdAddress">
|
<button class="btn btn-misc" @click="removeHouseholdAddress">
|
||||||
Supprimer cette adresse
|
Supprimer cette adresse
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
@ -171,7 +171,7 @@ export default {
|
|||||||
addAddress: {
|
addAddress: {
|
||||||
context: {
|
context: {
|
||||||
entity: {
|
entity: {
|
||||||
type: 'household',
|
type: 'household_create',
|
||||||
id: 0
|
id: 0
|
||||||
},
|
},
|
||||||
edit: false,
|
edit: false,
|
||||||
@ -256,8 +256,15 @@ export default {
|
|||||||
this.$store.dispatch('removeHousehold');
|
this.$store.dispatch('removeHousehold');
|
||||||
},
|
},
|
||||||
setHouseholdAddress(a) {
|
setHouseholdAddress(a) {
|
||||||
|
let payload = this.$refs.addAddress.submitNewAddress();
|
||||||
|
console.log('setHouseholdAddress', a);
|
||||||
this.$store.commit('setHouseholdAddress', a);
|
this.$store.commit('setHouseholdAddress', a);
|
||||||
},
|
},
|
||||||
|
setHouseholdCreatedAddress() {
|
||||||
|
let payload = this.$refs.addAddress.submitNewAddress();
|
||||||
|
console.log('setHouseholdAddress', payload);
|
||||||
|
this.$store.dispatch('setHouseholdNewAddress', payload);
|
||||||
|
},
|
||||||
removeHouseholdAddress() {
|
removeHouseholdAddress() {
|
||||||
this.$store.commit('removeHouseholdAddress');
|
this.$store.commit('removeHouseholdAddress');
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ const store = createStore({
|
|||||||
state.addressesSuggestion.push(addresses[i]);
|
state.addressesSuggestion.push(addresses[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
addConcerned({ commit, dispatch }, person) {
|
addConcerned({ commit, dispatch }, person) {
|
||||||
@ -310,6 +310,19 @@ const store = createStore({
|
|||||||
commit('createHousehold');
|
commit('createHousehold');
|
||||||
dispatch('computeWarnings');
|
dispatch('computeWarnings');
|
||||||
},
|
},
|
||||||
|
setHouseholdNewAddress({ commit }, payload) {
|
||||||
|
let url = `/api/1.0/main/address/${payload.addressId}.json`;
|
||||||
|
window.fetch(url).then(r => {
|
||||||
|
if (r.ok) {
|
||||||
|
return r.json();
|
||||||
|
}
|
||||||
|
throw new Error("error while fetch address");
|
||||||
|
}).then(data => {
|
||||||
|
commit('setHouseholdAddress', data);
|
||||||
|
}).catch(e => {
|
||||||
|
console.error(e);
|
||||||
|
});
|
||||||
|
},
|
||||||
forceLeaveWithoutHousehold({ commit, dispatch }) {
|
forceLeaveWithoutHousehold({ commit, dispatch }) {
|
||||||
commit('forceLeaveWithoutHousehold');
|
commit('forceLeaveWithoutHousehold');
|
||||||
dispatch('computeWarnings');
|
dispatch('computeWarnings');
|
||||||
|
@ -104,7 +104,6 @@ export default {
|
|||||||
i18n,
|
i18n,
|
||||||
methods: {
|
methods: {
|
||||||
hasCurrentMembers() {
|
hasCurrentMembers() {
|
||||||
console.log(this.household);
|
|
||||||
return this.household.current_members_id.length > 0;
|
return this.household.current_members_id.length > 0;
|
||||||
},
|
},
|
||||||
currentMembers() {
|
currentMembers() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user