address selection: add leaflet css + add fields for the address extra information (WIP)'

This commit is contained in:
nobohan
2021-05-11 13:50:11 +02:00
parent 2fe38945d2
commit ea0b2407df
5 changed files with 44 additions and 63 deletions

View File

@@ -3,6 +3,7 @@ import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'
import { addressMessages } from './js/i18n'
import { getDataPromise } from './store'
import App from './App.vue';
getDataPromise.then(store => {

View File

@@ -1,7 +1,6 @@
import 'es6-promise/auto';
import { createStore } from 'vuex';
import { getReferenceAddress } from '../api';
import { initMap, updateMap } from '../map';
const debug = process.env.NODE_ENV !== 'production';
@@ -11,7 +10,7 @@ const getDataPromise = getReferenceAddress()
const store = createStore({
strict: debug,
state: {
referenceAddresses: referenceAddresses.results,
referenceAddresses: referenceAddresses.results, //TODO-> move to data
countries: [
{id: 1, name: 'France', countryCode: 'FR'},
{id: 2, name: 'Belgium', countryCode: 'BE'}
@@ -25,9 +24,14 @@ const getDataPromise = getReferenceAddress()
selectedCity: null,
selectedAddress: null,
addressMap: {
//map: initMap(), //-> the map container is not initialised when store is created.
center : [48.8589, 2.3469],
zoom: 12
},
form: {
isNoAddress: false,
floor: null,
corridor: null,
steps: null
}
},
getters: {
@@ -48,11 +52,14 @@ const getDataPromise = getReferenceAddress()
setSelectedAddress(state, value) {
console.log(value)
state.selectedAddress = value;
state.addressMap.center = value.point.coordinates; //TODO is it OK to put this here?
//updateMap(state); //TODO where to listen to map center change?
state.addressMap.center = value.point.coordinates; //TODO is it OK to put this here? //call setMapCenter
updateMap(state); //TODO where to listen to map center change? -> action avec dispatch
},
setMapCenter(state, value) {
state.addressMap.center = value;
},
setIsNoAddress(state, value) {
state.form.isNoAddress = value;
}
},
actions: {