fixes in enable/disable geo fields in /add

This commit is contained in:
sedum 2023-02-22 16:37:58 +01:00
parent cff608c06f
commit d05d48104a
4 changed files with 13 additions and 12 deletions

View file

@ -64,7 +64,7 @@ export default {
<style>
#leaflet-map {
height: 8rem;
height: 10rem;
border-radius: .3rem;
border: 1px solid #fff;
z-index: 1;

View file

@ -37,6 +37,7 @@ v-card
@change='selectAddress'
@focus='searchAddress'
:items="addressList"
:disabled='disableGeocoded'
:hint="$t('event.address_description_osm')")
template(v-slot:message="{message, key}")
span(v-html='message' :key="key")
@ -51,16 +52,16 @@ v-card
v-col.py-0(cols=12 sm=6)
v-text-field(v-model="place.latitude"
:prepend-icon='mdiLatitude'
:disabled="!settings.allow_geolocation || place.name === 'online'"
:disabled='disableGeocoded'
:label="$t('common.latitude')"
:rules="$validators.latitude")
v-col.py-0(cols=12 sm=6)
v-text-field(v-model="place.longitude"
:prepend-icon='mdiLongitude'
:disabled="!settings.allow_geolocation || place.name === 'online'"
:disabled='disableGeocoded'
:label="$t('common.longitude')"
:rules="$validators.longitude")
p.mt-4(v-html="$t('event.address_geocoded_disclaimer')")
p.mt-4(v-if='place.isNew' v-html="$t('event.address_geocoded_disclaimer')")
MapEdit.mt-4(:place='place' :key='mapEdit' v-if="(settings.allow_geolocation && place.name !== 'online' && place.latitude && place.longitude)" )
@ -93,7 +94,8 @@ export default {
mdiMap, mdiLatitude, mdiLongitude, mdiCog, mdiLink, mdiCloseCircle,
mdiMapMarker, mdiMapSearch, mdiRoadVariant, mdiHome, mdiCityVariant,
showOnline: $store.state.settings.allow_event_also_online,
showGeocoded: $store.state.settings.allow_geolocation && this.place.isNew && this.place.name !== 'online',
showGeocoded: $store.state.settings.allow_geolocation && this.place.name !== 'online',
disableGeocoded: this.place.name === 'online' || !this.place.isNew,
event_only_online: this.place.name === 'online',
mapEdit: 1,
addressList: [],
@ -104,7 +106,6 @@ export default {
'mdiMapMarker': mdiMapMarker,
'mdiCityVariant': mdiCityVariant
},
geocoding_provider_type: $store.state.settings.geocoding_provider_type || 'Nominatim',
currentGeocodingProvider: geolocation.getGeocodingProvider($store.state.settings.geocoding_provider_type),
prevAddress: ''
}
@ -138,7 +139,7 @@ export default {
const searchCoordinates = pre_searchCoordinates.replace('/', ',')
if (searchCoordinates.length) {
this.loading = true
const ret = await this.$axios.$get(`placeOSM/${this.geocoding_provider_type}/${searchCoordinates}`)
const ret = await this.$axios.$get(`placeOSM/${this.currentGeocodingProvider.commonName}/${searchCoordinates}`)
this.addressList = this.currentGeocodingProvider.mapQueryResults(ret)
this.loading = false
}

View file

@ -43,9 +43,9 @@ v-container
template(v-slot:item="{ item, attrs, on, selected }")
v-list-item(v-bind='attrs' v-on='on')
v-icon.pr-4(v-text='loadCoordinatesResultIcon(item)')
v-list-item-content(two-line v-if='item' :input-value="selected" )
v-list-item-content(two-line v-if='item')
v-list-item-title(v-text='item.name')
v-list-item-subtitle(v-text='`${item.address}`')
v-list-item-subtitle(v-text='`${item.address}`') {{ selected }}
v-row.mt-4(v-if="(settings.allow_geolocation && place.name !== 'online')")
v-col.py-0(cols=12 md=6)
@ -174,7 +174,7 @@ export default {
} else {
this.place.address = currentAddress
}
this.place.selected = true
this.prevAddress = this.place.geocodedAddress
this.$emit('input', { ...this.place })
},

View file

@ -39,8 +39,8 @@ const eventController = {
place = await Place.create({
name: place_name,
address: place_address,
latitude: body.place_latitude,
longitude: body.place_longitude
latitude: Number(body.place_latitude) || null,
longitude: Number(body.place_longitude) || null
})
}
return place