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"
 | 
					                    v-model="location"
 | 
				
			||||||
                >
 | 
					                >
 | 
				
			||||||
                </VueMultiselect>
 | 
					                </VueMultiselect>
 | 
				
			||||||
                <new-location v-bind:locations="locations"></new-location>
 | 
					                <new-location v-bind:availableLocations="availableLocations"></new-location>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </teleport>
 | 
					    </teleport>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,15 +18,6 @@
 | 
				
			|||||||
                </template>
 | 
					                </template>
 | 
				
			||||||
                <template v-slot:body>
 | 
					                <template v-slot:body>
 | 
				
			||||||
                    <form>
 | 
					                    <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">
 | 
					                        <div class="form-floating mb-3">
 | 
				
			||||||
                            <select class="form-select form-select-lg" id="type" required v-model="selectType">
 | 
					                            <select class="form-select form-select-lg" id="type" required v-model="selectType">
 | 
				
			||||||
                                <option selected disabled value="">{{ $t('activity.choose_location_type') }}</option>
 | 
					                                <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 />
 | 
					                            <input class="form-control form-control-lg" id="email" v-model="inputEmail" placeholder />
 | 
				
			||||||
                            <label for="email">{{ $t('activity.location_fields.email') }}</label>
 | 
					                            <label for="email">{{ $t('activity.location_fields.email') }}</label>
 | 
				
			||||||
                        </div>
 | 
					                        </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>
 | 
					                    </form>
 | 
				
			||||||
                </template>
 | 
					                </template>
 | 
				
			||||||
                <template v-slot:footer>
 | 
					                <template v-slot:footer>
 | 
				
			||||||
@@ -89,7 +86,7 @@ export default {
 | 
				
			|||||||
        Modal,
 | 
					        Modal,
 | 
				
			||||||
        AddAddress,
 | 
					        AddAddress,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    props: ['locations'],
 | 
					    props: ['availableLocations'],
 | 
				
			||||||
    data() {
 | 
					    data() {
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            errors: [],
 | 
					            errors: [],
 | 
				
			||||||
@@ -245,8 +242,14 @@ export default {
 | 
				
			|||||||
                postLocation(body)
 | 
					                postLocation(body)
 | 
				
			||||||
                    .then(
 | 
					                    .then(
 | 
				
			||||||
                        location => new Promise(resolve => {
 | 
					                        location => new Promise(resolve => {
 | 
				
			||||||
                            this.locations.push(location);
 | 
					
 | 
				
			||||||
 | 
					                            this.$store.dispatch('addAvailableLocationGroup', {
 | 
				
			||||||
 | 
					                                locationGroup: 'Localisations nouvellement créées',
 | 
				
			||||||
 | 
					                                locations: [location]
 | 
				
			||||||
 | 
					                            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            this.$store.dispatch('updateLocation', location);
 | 
					                            this.$store.dispatch('updateLocation', location);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            resolve();
 | 
					                            resolve();
 | 
				
			||||||
                            this.modal.showModal = false;
 | 
					                            this.modal.showModal = false;
 | 
				
			||||||
                        })
 | 
					                        })
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -240,6 +240,9 @@ const store = createStore({
 | 
				
			|||||||
            });
 | 
					            });
 | 
				
			||||||
            commit("updateActionsSelected", payload);
 | 
					            commit("updateActionsSelected", payload);
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        addAvailableLocationGroup({ commit }, payload) {
 | 
				
			||||||
 | 
					            commit("addAvailableLocationGroup", payload);
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        addPersonsInvolved({ commit }, payload) {
 | 
					        addPersonsInvolved({ commit }, payload) {
 | 
				
			||||||
            //console.log('### action addPersonsInvolved', payload.result.type);
 | 
					            //console.log('### action addPersonsInvolved', payload.result.type);
 | 
				
			||||||
            switch (payload.result.type) {
 | 
					            switch (payload.result.type) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user