mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +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
|
||||
* )
|
||||
* @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;
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
:key="addAddress.key"
|
||||
:options="addAddress.options"
|
||||
:result="addAddress.result"
|
||||
@submitAddress="setHouseholdAddress"
|
||||
@submitAddress="setHouseholdCreatedAddress"
|
||||
ref="addAddress">
|
||||
</add-address>
|
||||
</li>
|
||||
@ -38,7 +38,7 @@
|
||||
<div v-if="isHouseholdNew && hasHouseholdAddress">
|
||||
<ul class="record_actions">
|
||||
<li >
|
||||
<button class="btn" @click="removeHouseholdAddress">
|
||||
<button class="btn btn-misc" @click="removeHouseholdAddress">
|
||||
Supprimer cette adresse
|
||||
</button>
|
||||
</li>
|
||||
@ -171,7 +171,7 @@ export default {
|
||||
addAddress: {
|
||||
context: {
|
||||
entity: {
|
||||
type: 'household',
|
||||
type: 'household_create',
|
||||
id: 0
|
||||
},
|
||||
edit: false,
|
||||
@ -256,8 +256,15 @@ export default {
|
||||
this.$store.dispatch('removeHousehold');
|
||||
},
|
||||
setHouseholdAddress(a) {
|
||||
let payload = this.$refs.addAddress.submitNewAddress();
|
||||
console.log('setHouseholdAddress', a);
|
||||
this.$store.commit('setHouseholdAddress', a);
|
||||
},
|
||||
setHouseholdCreatedAddress() {
|
||||
let payload = this.$refs.addAddress.submitNewAddress();
|
||||
console.log('setHouseholdAddress', payload);
|
||||
this.$store.dispatch('setHouseholdNewAddress', payload);
|
||||
},
|
||||
removeHouseholdAddress() {
|
||||
this.$store.commit('removeHouseholdAddress');
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ const store = createStore({
|
||||
state.addressesSuggestion.push(addresses[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
addConcerned({ commit, dispatch }, person) {
|
||||
@ -310,6 +310,19 @@ const store = createStore({
|
||||
commit('createHousehold');
|
||||
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 }) {
|
||||
commit('forceLeaveWithoutHousehold');
|
||||
dispatch('computeWarnings');
|
||||
|
@ -104,7 +104,6 @@ export default {
|
||||
i18n,
|
||||
methods: {
|
||||
hasCurrentMembers() {
|
||||
console.log(this.household);
|
||||
return this.household.current_members_id.length > 0;
|
||||
},
|
||||
currentMembers() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user