mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-21 08:07:44 +00:00
cleaning AddAdress refactor
This commit is contained in:
parent
7aed8e83ea
commit
444159b52a
@ -1,63 +1,26 @@
|
||||
import 'es6-promise/auto';
|
||||
import { createStore } from 'vuex';
|
||||
|
||||
//import { getReferenceAddress } from '../api';
|
||||
//import { app } from '../index';
|
||||
|
||||
const debug = process.env.NODE_ENV !== 'production';
|
||||
|
||||
const store = createStore({
|
||||
strict: debug,
|
||||
state: {
|
||||
address: {},
|
||||
errorMsg: {}
|
||||
address: {}
|
||||
},
|
||||
getters: {
|
||||
/*
|
||||
getCountries: state => state.countries,
|
||||
getSelectedCountry: state => state.selectedCountry,
|
||||
getCities: state => state.selectedCountry.countryCode === undefined ?
|
||||
state.cities :
|
||||
state.cities.filter(c => c.country == state.selectedCountry.countryCode),
|
||||
getReferenceAddresses: state => state.referenceAddresses, //TODO filter as a function of city
|
||||
getMapCenter: state => state.addressMap.center,
|
||||
*/
|
||||
},
|
||||
mutations: {
|
||||
addAddress(state, address) {
|
||||
console.log('@M addAddress address', address);
|
||||
state.address = address;
|
||||
},
|
||||
/*
|
||||
setSelectedCountry(state, value) {
|
||||
state.selectedCountry = value;
|
||||
},
|
||||
setSelectedCity(state, value) {
|
||||
state.selectedCity = value;
|
||||
},
|
||||
setSelectedAddress(state, value) {
|
||||
state.selectedAddress = value;
|
||||
state.addressMap.center = value.point.coordinates.reverse();
|
||||
//app.$refs.addressMap.updateMap(); //TODO how to update the map view? -> action avec dispatch
|
||||
},
|
||||
setMapCenter(state, value) {
|
||||
state.addressMap.center = value;
|
||||
},
|
||||
setIsNoAddress(state, value) {
|
||||
state.form.isNoAddress = value;
|
||||
}
|
||||
*/
|
||||
},
|
||||
actions: {
|
||||
addAddress({ commit }, payload) {
|
||||
console.log('@A addAddress payload', payload);
|
||||
commit('addAddress', payload);
|
||||
},
|
||||
/*
|
||||
updateMapCenter({ commit }, payload) {
|
||||
commit('updateMapCenter', payload);
|
||||
},
|
||||
*/
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -47,21 +47,14 @@
|
||||
|
||||
<!--div class="address_form__fields__isNoAddress"></div>
|
||||
<div class="address_form__select">
|
||||
<div class="address_form__select__header">
|
||||
</div>
|
||||
<div class="address_form__select__left">
|
||||
</div>
|
||||
<div class="address_form__map">
|
||||
</div>
|
||||
<div class="address_form__select__header"></div>
|
||||
<div class="address_form__select__left"></div>
|
||||
<div class="address_form__map"></div>
|
||||
</div>
|
||||
|
||||
<div class="address_form__fields">
|
||||
<div class="address_form__fields__header">
|
||||
</div>
|
||||
<div class="address_form__fields__left">
|
||||
</div>
|
||||
<div class="address_form__fields__right">
|
||||
</div>
|
||||
<div class="address_form__fields__header"></div>
|
||||
<div class="address_form__fields__left"></div>
|
||||
<div class="address_form__fields__right"></div>
|
||||
</div-->
|
||||
|
||||
<address-more
|
||||
@ -196,9 +189,9 @@ export default {
|
||||
},
|
||||
updateMapCenter(point) {
|
||||
console.log('point', point);
|
||||
this.address.addressMap.center[0] = point.coordinates[1];
|
||||
this.address.addressMap.center[0] = point.coordinates[1]; // TODO use reverse()
|
||||
this.address.addressMap.center[1] = point.coordinates[0];
|
||||
this.$refs.addressMap.update();
|
||||
this.$refs.addressMap.update(); // cast child methods
|
||||
},
|
||||
resetAll() {
|
||||
console.log('reset all selected');
|
||||
|
Loading…
x
Reference in New Issue
Block a user