From ea0b2407df516285d7541c974054c8fbfe4f2090 Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 11 May 2021 13:50:11 +0200 Subject: [PATCH] address selection: add leaflet css + add fields for the address extra information (WIP)' --- .../Resources/public/vuejs/Address/index.js | 1 + .../public/vuejs/Address/store/index.js | 17 ++-- .../public/vuejs/_components/AddAddress.vue | 78 ++++++------------- .../public/vuejs/_components/AddressMap.vue | 5 +- .../Resources/views/Address/new.html.twig | 6 ++ 5 files changed, 44 insertions(+), 63 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js index e58cd4483..40003d71c 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js @@ -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 => { diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/store/index.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/store/index.js index 46c3fb14d..88d35becf 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/store/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/store/index.js @@ -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: { diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/AddAddress.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/AddAddress.vue index 60a7dae3f..5c11b0872 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/AddAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/AddAddress.vue @@ -12,35 +12,13 @@ - -