mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-11-04 03:08:25 +00:00 
			
		
		
		
	location: fix error when creating a new location: a new location could not be added to the availableLocations due to refactoring
This commit is contained in:
		@@ -24,7 +24,7 @@
 | 
			
		||||
                    v-model="location"
 | 
			
		||||
                >
 | 
			
		||||
                </VueMultiselect>
 | 
			
		||||
                <new-location v-bind:locations="locations"></new-location>
 | 
			
		||||
                <new-location v-bind:availableLocations="availableLocations"></new-location>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </teleport>
 | 
			
		||||
 
 | 
			
		||||
@@ -18,15 +18,6 @@
 | 
			
		||||
                </template>
 | 
			
		||||
                <template v-slot:body>
 | 
			
		||||
                    <form>
 | 
			
		||||
                        <div class="form-floating mb-3">
 | 
			
		||||
                            <p v-if="errors.length">
 | 
			
		||||
                                <b>{{ $t('activity.errors') }}</b>
 | 
			
		||||
                                <ul>
 | 
			
		||||
                                    <li v-for="error in errors" :key="error">{{ error }}</li>
 | 
			
		||||
                                </ul>
 | 
			
		||||
                            </p>
 | 
			
		||||
                        </div>
 | 
			
		||||
 | 
			
		||||
                        <div class="form-floating mb-3">
 | 
			
		||||
                            <select class="form-select form-select-lg" id="type" required v-model="selectType">
 | 
			
		||||
                                <option selected disabled value="">{{ $t('activity.choose_location_type') }}</option>
 | 
			
		||||
@@ -62,6 +53,12 @@
 | 
			
		||||
                            <input class="form-control form-control-lg" id="email" v-model="inputEmail" placeholder />
 | 
			
		||||
                            <label for="email">{{ $t('activity.location_fields.email') }}</label>
 | 
			
		||||
                        </div>
 | 
			
		||||
 | 
			
		||||
                        <div class="alert alert-warning" v-if="errors.length">
 | 
			
		||||
                            <ul>
 | 
			
		||||
                                <li v-for="(e, i) in errors" :key="i">{{ e }}</li>
 | 
			
		||||
                            </ul>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </form>
 | 
			
		||||
                </template>
 | 
			
		||||
                <template v-slot:footer>
 | 
			
		||||
@@ -89,7 +86,7 @@ export default {
 | 
			
		||||
        Modal,
 | 
			
		||||
        AddAddress,
 | 
			
		||||
    },
 | 
			
		||||
    props: ['locations'],
 | 
			
		||||
    props: ['availableLocations'],
 | 
			
		||||
    data() {
 | 
			
		||||
        return {
 | 
			
		||||
            errors: [],
 | 
			
		||||
@@ -245,8 +242,14 @@ export default {
 | 
			
		||||
                postLocation(body)
 | 
			
		||||
                    .then(
 | 
			
		||||
                        location => new Promise(resolve => {
 | 
			
		||||
                            this.locations.push(location);
 | 
			
		||||
 | 
			
		||||
                            this.$store.dispatch('addAvailableLocationGroup', {
 | 
			
		||||
                                locationGroup: 'Localisations nouvellement créées',
 | 
			
		||||
                                locations: [location]
 | 
			
		||||
                            });
 | 
			
		||||
 | 
			
		||||
                            this.$store.dispatch('updateLocation', location);
 | 
			
		||||
 | 
			
		||||
                            resolve();
 | 
			
		||||
                            this.modal.showModal = false;
 | 
			
		||||
                        })
 | 
			
		||||
 
 | 
			
		||||
@@ -240,6 +240,9 @@ const store = createStore({
 | 
			
		||||
            });
 | 
			
		||||
            commit("updateActionsSelected", payload);
 | 
			
		||||
        },
 | 
			
		||||
        addAvailableLocationGroup({ commit }, payload) {
 | 
			
		||||
            commit("addAvailableLocationGroup", payload);
 | 
			
		||||
        },
 | 
			
		||||
        addPersonsInvolved({ commit }, payload) {
 | 
			
		||||
            //console.log('### action addPersonsInvolved', payload.result.type);
 | 
			
		||||
            switch (payload.result.type) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user