From dcdefec6de005a41f00196cfdad50bfb84570e75 Mon Sep 17 00:00:00 2001 From: sedum Date: Fri, 2 Sep 2022 08:32:13 +0200 Subject: [PATCH] add geolocalization --- components/WhereInput.vue | 62 +++++++++++++++++-- components/admin/Places.vue | 14 +++++ components/admin/Settings.vue | 8 +++ locales/en.json | 4 ++ pages/add/_edit.vue | 3 +- server/api/controller/event.js | 28 +++++---- server/api/controller/place.js | 17 ++++- server/api/controller/settings.js | 1 + server/api/index.js | 10 +-- server/api/models/place.js | 3 +- .../20220706090946-place-details.js | 25 ++++++++ store/index.js | 1 + 12 files changed, 150 insertions(+), 26 deletions(-) create mode 100644 server/migrations/20220706090946-place-details.js diff --git a/components/WhereInput.vue b/components/WhereInput.vue index 900d5f6f..aea64c3a 100644 --- a/components/WhereInput.vue +++ b/components/WhereInput.vue @@ -30,11 +30,30 @@ v-row :label="$t('common.address')" @change="changeAddress" :value="value.address") + v-combobox.mr-4(ref='detailsView' v-if='settings.allow_geolocalization' + :prepend-icon='mdiMapSearch' + :disabled='disableDetails' + @input.native='searchCoordinates' + :label="$t('common.coordinates')" + :value='value.detailsView' + persistent-hint hide-no-data clearable no-filter + :loading='loading' + @change='selectDetails' + @focus='searchCoordinates' + :items="detailsList" + :hint="$t('event.coordinates_description')") + template(v-slot:item="{ item, attrs, on }") + v-list-item(v-bind='attrs' v-on='on') + v-list-item-content(two-line v-if='item') + v-list-item-title(v-text='item.display_name') + v-list-item-subtitle(v-text='`${item.lat}`+`,`+`${item.lon}`') + v-text-field(ref='details' v-show='false' v-if='settings.allow_geolocalization') diff --git a/components/admin/Places.vue b/components/admin/Places.vue index 4e9b0d14..a68ca498 100644 --- a/components/admin/Places.vue +++ b/components/admin/Places.vue @@ -25,6 +25,13 @@ v-container v-model='place.address' :placeholder='$t("common.address")') + v-textarea(v-if="settings.allow_geolocalization" + row-height="15" + :disabled="true" + :label="$t('common.details')" + v-model='place.details' + :placeholder='$t("common.details")') + v-card-actions v-spacer v-btn(@click='dialog=false' color='warning') {{$t('common.cancel')}} @@ -47,6 +54,7 @@ v-container