Merge branch 'feat/whereinputadvanced_rebased' into 'master'
Place advanced options, online/also-online events See merge request les/gancio!26
This commit is contained in:
commit
9791ef8b0d
25 changed files with 1636 additions and 1305 deletions
72
components/MapEdit.vue
Normal file
72
components/MapEdit.vue
Normal file
|
@ -0,0 +1,72 @@
|
|||
<template lang="pug">
|
||||
client-only(placeholder='Loading...' )
|
||||
LMap(ref="mapEdit"
|
||||
id="leaflet-map"
|
||||
:zoom="zoom"
|
||||
:options="{attributionControl: false}"
|
||||
:center="center")
|
||||
LControlAttribution(position='bottomright' prefix="")
|
||||
LTileLayer(
|
||||
:url="url"
|
||||
:attribution="attribution")
|
||||
LMarker(
|
||||
:lat-lng="marker.coordinates")
|
||||
|
||||
</template>
|
||||
<script>
|
||||
|
||||
import "leaflet/dist/leaflet.css"
|
||||
import { LMap, LTileLayer, LMarker, LPopup, LControlAttribution } from 'vue2-leaflet'
|
||||
import { mapActions, mapState } from 'vuex'
|
||||
import { Icon } from 'leaflet'
|
||||
import { mdiWalk, mdiBike, mdiCar, mdiMapMarker } from '@mdi/js'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
LMap,
|
||||
LTileLayer,
|
||||
LMarker,
|
||||
LPopup,
|
||||
LControlAttribution
|
||||
},
|
||||
data ({ $store }) {
|
||||
return {
|
||||
mdiWalk, mdiBike, mdiCar, mdiMapMarker,
|
||||
url: $store.state.settings.tilelayer_provider || 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
attribution: $store.state.settings.tilelayer_provider_attribution || "<a target=\"_blank\" href=\"http://osm.org/copyright\">OpenStreetMap</a> contributors",
|
||||
zoom: 16,
|
||||
center: [this.place.latitude, this.place.longitude],
|
||||
marker: {
|
||||
address: this.place.address,
|
||||
coordinates: {lat: this.place.latitude, lon: this.place.longitude }
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
place: { type: Object, default: () => ({}) }
|
||||
},
|
||||
mounted() {
|
||||
delete Icon.Default.prototype._getIconUrl;
|
||||
Icon.Default.mergeOptions({
|
||||
iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'),
|
||||
iconUrl: require('leaflet/dist/images/marker-icon.png'),
|
||||
shadowUrl: require('leaflet/dist/images/marker-shadow.png'),
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
if (this.$refs.mapEdit && this.$refs.mapEdit.mapObject ) {
|
||||
this.$refs.mapEdit.mapObject.invalidateSize();
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#leaflet-map {
|
||||
height: 10rem;
|
||||
border-radius: .3rem;
|
||||
border: 1px solid #fff;
|
||||
z-index: 1;
|
||||
}
|
||||
</style>
|
|
@ -1,6 +1,7 @@
|
|||
<template lang="pug">
|
||||
v-row.mb-4
|
||||
v-col(cols=12 md=6)
|
||||
//- this is the name used by people
|
||||
v-combobox(ref='place'
|
||||
:rules="[$validators.required('common.where')]"
|
||||
:label="$t('common.where')"
|
||||
|
@ -18,112 +19,105 @@ v-row.mb-4
|
|||
v-list-item(v-bind='attrs' v-on='on')
|
||||
v-list-item-content(two-line v-if='item.create')
|
||||
v-list-item-title <v-icon color='primary' v-text='mdiPlus' :aria-label='$t("common.add")'></v-icon> {{$t('common.add')}} <strong>{{item.name}}</strong>
|
||||
v-list-item-content(two-line v-else-if='item.online')
|
||||
v-list-item-title <v-icon color='primary' v-text='mdiLaptopAccount' :aria-label='$t("common.online")'></v-icon> {{$t('common.online')}}
|
||||
v-list-item-content(two-line v-else)
|
||||
v-list-item-title(v-text='item.name')
|
||||
v-list-item-subtitle(v-text='item.address')
|
||||
|
||||
|
||||
v-col(cols=12 md=6)
|
||||
v-text-field(v-if="!settings.allow_geolocation"
|
||||
ref='address'
|
||||
v-row.mx-0.my-0.align-center.justify-center
|
||||
|
||||
v-text-field.mr-4(ref='address' v-if="value.name !== 'online'"
|
||||
v-model='value.address'
|
||||
:prepend-icon='mdiMap'
|
||||
:disabled='disableAddress'
|
||||
:rules="[ v => disableAddress ? true : $validators.required('common.address')(v)]"
|
||||
:label="$t('common.address')"
|
||||
:hint="$t('event.address_description')"
|
||||
persistent-hint
|
||||
@change="changeAddress"
|
||||
:value="value.address")
|
||||
v-combobox(ref='address' v-else
|
||||
:prepend-icon='mdiMapSearch'
|
||||
:disabled='disableAddress'
|
||||
@input.native='searchAddress'
|
||||
:label="$t('common.address')"
|
||||
:rules="[ v => disableAddress ? true : $validators.required('common.address')(v)]"
|
||||
:value='value.address'
|
||||
item-text='address'
|
||||
persistent-hint hide-no-data clearable no-filter
|
||||
:loading='loading'
|
||||
@change='selectAddress'
|
||||
@focus='searchAddress'
|
||||
:items="addressList"
|
||||
:hint="$t('event.address_description_osm')")
|
||||
template(v-slot:message="{message, key}")
|
||||
span(v-html='message' :key="key")
|
||||
template(v-slot:item="{ item, attrs, on }")
|
||||
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')
|
||||
v-list-item-title(v-text='item.name')
|
||||
v-list-item-subtitle(v-text='`${item.address}`')
|
||||
//- v-col(cols=12 md=3 v-if='settings.allow_geolocation')
|
||||
//- v-text-field(ref='latitude' :value='value.latitude'
|
||||
//- :prepend-icon='mdiLatitude'
|
||||
//- :disabled='disableDetails'
|
||||
//- :label="$t('common.latitude')" )
|
||||
//- v-col(cols=12 md=3 v-if='settings.allow_geolocation')
|
||||
//- v-text-field(ref='longitude' :value='value.longitude'
|
||||
//- :prepend-icon='mdiLongitude'
|
||||
//- :disabled='disableDetails'
|
||||
//- :label="$t('common.longitude')")
|
||||
persistent-hint)
|
||||
template(v-slot:append v-if="showAdvancedDialogButton")
|
||||
v-icon(v-text='mdiCog'
|
||||
@click="whereInputAdvancedDialog = true")
|
||||
|
||||
v-combobox.mr-4(v-model="onlineLocations" v-else
|
||||
:prepend-icon='mdiLink'
|
||||
:hint="$t('event.online_locations_help')"
|
||||
:label="$t('event.online_locations')"
|
||||
clearable chips small-chips multiple deletable-chips hide-no-data hide-selected persistent-hint
|
||||
:delimiters="[',', ';', '; ']"
|
||||
:items="onlineLocations"
|
||||
@change='selectLocations')
|
||||
template(v-slot:selection="{ item, index, on, attrs, selected, parent }")
|
||||
v-chip(v-bind="attrs" :outlined='index !== 0'
|
||||
close :close-icon='mdiCloseCircle' @click:close='parent.selectItem(item)'
|
||||
:input-value="selected" label small) {{ item }}
|
||||
//- template(v-slot:append)
|
||||
//- v-icon(v-text='mdiCog' :disabled='!value.name' @click="whereInputAdvancedDialog = true")
|
||||
|
||||
v-dialog(v-model='whereInputAdvancedDialog' destroy-on-close max-width='700px' :fullscreen='$vuetify.breakpoint.xsOnly' dense)
|
||||
WhereInputAdvanced(ref='whereAdvanced' :place.sync='value' :event='event'
|
||||
@close='whereInputAdvancedDialog = false && this.$refs.address.blur()'
|
||||
:onlineLocations.sync="onlineLocations"
|
||||
@update:onlineLocations="selectLocations")
|
||||
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import { mdiMap, mdiMapMarker, mdiPlus, mdiMapSearch, mdiLatitude, mdiLongitude, mdiRoadVariant, mdiHome, mdiCityVariant } from '@mdi/js'
|
||||
import { mdiMap, mdiMapMarker, mdiPlus, mdiCog, mdiLink, mdiCloseCircle, mdiLaptopAccount } from '@mdi/js'
|
||||
import { mapState } from 'vuex'
|
||||
import debounce from 'lodash/debounce'
|
||||
import get from 'lodash/get'
|
||||
import WhereInputAdvanced from './WhereInputAdvanced.vue'
|
||||
|
||||
export default {
|
||||
name: 'WhereInput',
|
||||
props: {
|
||||
value: { type: Object, default: () => ({}) }
|
||||
value: { type: Object, default: () => ({}) },
|
||||
event: { type: Object, default: () => null },
|
||||
},
|
||||
components: { WhereInputAdvanced },
|
||||
data ( {$store} ) {
|
||||
return {
|
||||
mdiMap, mdiMapMarker, mdiPlus, mdiMapSearch, mdiLatitude, mdiLongitude, mdiRoadVariant, mdiHome, mdiCityVariant,
|
||||
mdiMap, mdiMapMarker, mdiPlus, mdiCog, mdiLink, mdiCloseCircle, mdiLaptopAccount,
|
||||
places: [],
|
||||
place: { },
|
||||
placeName: '',
|
||||
places: [],
|
||||
disableAddress: true,
|
||||
addressList: [],
|
||||
loading: false,
|
||||
nominatim_osm_type: {
|
||||
way: mdiRoadVariant,
|
||||
house: mdiHome,
|
||||
node: mdiMapMarker,
|
||||
relation: mdiCityVariant,
|
||||
},
|
||||
nominatim_class: ['amenity', 'shop', 'tourism', 'leisure', 'building'],
|
||||
photon_osm_key: ['amenity', 'shop', 'tourism', 'leisure', 'building'],
|
||||
photon_osm_type: {
|
||||
'W': mdiRoadVariant,
|
||||
'N': mdiMapMarker,
|
||||
'R': mdiCityVariant,
|
||||
},
|
||||
geocoding_provider_type: $store.state.settings.geocoding_provider_type || 'Nominatim'
|
||||
whereInputAdvancedDialog: false,
|
||||
onlineLocations: this.event.online_locations || [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['settings']),
|
||||
filteredPlaces () {
|
||||
if (!this.placeName) { return this.places }
|
||||
const placeName = this.placeName.trim().toLowerCase()
|
||||
let nameMatch = false
|
||||
const matches = this.places.filter(p => {
|
||||
const tmpName = p.name.toLowerCase()
|
||||
const tmpAddress = p.address.toLowerCase()
|
||||
if (tmpName.includes(placeName)) {
|
||||
if (tmpName === placeName) { nameMatch = true }
|
||||
return true
|
||||
}
|
||||
return tmpAddress.includes(placeName)
|
||||
})
|
||||
if (!nameMatch) {
|
||||
matches.unshift({ create: true, name: this.placeName })
|
||||
showAdvancedDialogButton () {
|
||||
|
||||
if (!(this.settings.allow_geolocation || this.settings.allow_online_event)) {
|
||||
return false
|
||||
}
|
||||
return matches
|
||||
|
||||
|
||||
if (!this.place.isNew && !this.settings.allow_online_event) return false
|
||||
return true
|
||||
}
|
||||
// filteredPlaces () {
|
||||
// if (!this.placeName) { return this.places }
|
||||
// const placeName = this.placeName.trim().toLowerCase()
|
||||
// let nameMatch = false
|
||||
// const matches = this.places.filter(p => {
|
||||
// const tmpName = p.name.toLowerCase()
|
||||
// const tmpAddress = p.address.toLowerCase()
|
||||
// if (tmpName.includes(placeName)) {
|
||||
// if (tmpName === placeName) { nameMatch = true }
|
||||
// return true
|
||||
// }
|
||||
// return tmpAddress.includes(placeName)
|
||||
// })
|
||||
// if (!nameMatch) {
|
||||
// matches.unshift({ create: true, name: this.placeName })
|
||||
// }
|
||||
// return matches
|
||||
// }
|
||||
},
|
||||
mounted () {
|
||||
this.$nextTick( () => {
|
||||
|
@ -133,29 +127,32 @@ export default {
|
|||
methods: {
|
||||
search: debounce(async function(ev) {
|
||||
const search = ev ? ev.target.value.trim().toLowerCase() : ''
|
||||
this.places = await this.$axios.$get(`place?search=${search}`)
|
||||
if (!search && this.places.length) { return this.places }
|
||||
this.places = await this.$axios.$get('place', { params: { search } })
|
||||
|
||||
// Filter out the place with name 'online' if not allowed
|
||||
if (this.places.length) {
|
||||
this.places = this.places.filter(p => p.name !== 'online')
|
||||
}
|
||||
if (this.settings.allow_online_event) {
|
||||
this.places.push({ online: true, name: 'online' })
|
||||
}
|
||||
|
||||
if (!search && this.places.length) {
|
||||
return this.places
|
||||
}
|
||||
const matches = this.places.find(p => search === p.name.toLocaleLowerCase())
|
||||
if (!matches && search) {
|
||||
this.places.unshift({ create: true, name: ev.target.value.trim() })
|
||||
}
|
||||
}, 200),
|
||||
loadCoordinatesResultIcon(item) {
|
||||
if (this.geocoding_provider_type == "Nominatim") {
|
||||
if ( this.nominatim_class.includes(item.class)) {
|
||||
return this.mdiHome
|
||||
}
|
||||
return this.nominatim_osm_type[item.type]
|
||||
} else if (this.geocoding_provider_type == "Photon") {
|
||||
if ( this.photon_osm_key.includes(item.class)) {
|
||||
return this.mdiHome
|
||||
}
|
||||
return this.photon_osm_type[item.type]
|
||||
}
|
||||
},
|
||||
selectPlace (p) {
|
||||
// force online events under place: online address: online
|
||||
// this.event_only_online = false
|
||||
this.place.isNew = false
|
||||
// this.whereAdvancedId++
|
||||
|
||||
if (!p) { return }
|
||||
if (typeof p === 'object' && !p.create) {
|
||||
if (typeof p === 'object' && !p.create && !p.online) {
|
||||
if (p.id === this.value.id) return
|
||||
this.place.name = p.name
|
||||
this.place.address = p.address
|
||||
|
@ -164,8 +161,12 @@ export default {
|
|||
this.place.longitude = p.longitude
|
||||
}
|
||||
this.place.id = p.id
|
||||
// if (this.settings.allow_event_only_online && this.place.name === 'online') {
|
||||
// this.event_only_online = true
|
||||
// }
|
||||
this.disableAddress = true
|
||||
} else { // this is a new place
|
||||
this.place.isNew = true
|
||||
this.place.name = (p.name || p).trim()
|
||||
const tmpPlace = this.place.name.toLocaleLowerCase()
|
||||
// search for a place with the same name
|
||||
|
@ -179,122 +180,55 @@ export default {
|
|||
delete this.place.id
|
||||
this.place.address = ''
|
||||
if (this.settings.allow_geolocation) {
|
||||
this.place.details = p.details
|
||||
this.place.latitude = p.latitude
|
||||
this.place.longitude = p.longitude
|
||||
}
|
||||
// If 'event only online' is not allowed: reset place and online_locations
|
||||
// if (this.place.name === 'online') {
|
||||
// if (!this.settings.allow_event_only_online) {
|
||||
// this.$nextTick(() => { this.$refs.place && this.$refs.place.setValue('') && this.$refs.place.focus() })
|
||||
// this.event.online_locations = []
|
||||
// return
|
||||
// } else {
|
||||
// this.event_online_only = true
|
||||
// }
|
||||
// }
|
||||
this.disableAddress = false
|
||||
this.$refs.place.blur()
|
||||
this.$refs.address.focus()
|
||||
this.$nextTick(() => { this.$refs.address && this.$refs.address.focus() })
|
||||
}
|
||||
}
|
||||
this.$emit('input', { ...this.place })
|
||||
},
|
||||
changeAddress (v) {
|
||||
this.place.address = v
|
||||
this.$emit('input', { ...this.place })
|
||||
this.disableDetails = false
|
||||
},
|
||||
selectAddress (v) {
|
||||
if (!v) { return }
|
||||
if (typeof v === 'object') {
|
||||
this.place.latitude = v.lat
|
||||
this.place.longitude = v.lon
|
||||
this.place.address = v.address
|
||||
// }
|
||||
} else {
|
||||
this.place.address = v
|
||||
this.place.latitude = this.place.longitude = null
|
||||
}
|
||||
this.$emit('input', { ...this.place })
|
||||
},
|
||||
searchAddress: debounce(async function(ev) {
|
||||
const pre_searchCoordinates = ev.target.value.trim().toLowerCase()
|
||||
// allow pasting coordinates lat/lon and lat,lon
|
||||
const searchCoordinates = pre_searchCoordinates.replace('/', ',')
|
||||
// const regex_coords_comma = "-?[1-9][0-9]*(\\.[0-9]+)?,\\s*-?[1-9][0-9]*(\\.[0-9]+)?";
|
||||
// const regex_coords_slash = "-?[1-9][0-9]*(\\.[0-9]+)?/\\s*-?[1-9][0-9]*(\\.[0-9]+)?";
|
||||
selectLocations () {
|
||||
this.event.online_locations = []
|
||||
|
||||
// const setCoords = (v) => {
|
||||
// const lat = v[0].trim()
|
||||
// const lon = v[1].trim()
|
||||
// // check coordinates are valid
|
||||
// if ((lat < 90 && lat > -90)
|
||||
// && (lon < 180 && lon > -180)) {
|
||||
// this.place.latitude = lat
|
||||
// this.place.longitude = lon
|
||||
// } else {
|
||||
// this.$root.$message("Non existent coordinates", { color: 'error' })
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (pre_searchCoordinates.match(regex_coords_comma)) {
|
||||
// let v = pre_searchCoordinates.split(",")
|
||||
// setCoords(v)
|
||||
// return
|
||||
// }
|
||||
// if (pre_searchCoordinates.match(regex_coords_slash)) {
|
||||
// let v = pre_searchCoordinates.split("/")
|
||||
// setCoords(v)
|
||||
// return
|
||||
// }
|
||||
|
||||
if (searchCoordinates.length) {
|
||||
this.loading = true
|
||||
const ret = await this.$axios.$get(`placeOSM/${this.geocoding_provider_type}/${searchCoordinates}`)
|
||||
if (this.geocoding_provider_type == "Nominatim") {
|
||||
if (ret && ret.length) {
|
||||
this.addressList = ret.map(v => {
|
||||
const name = get(v.namedetails, 'alt_name', get(v.namedetails, 'name'))
|
||||
const address = v.display_name ? v.display_name.replace(name, '').replace(/^, ?/, '') : ''
|
||||
return {
|
||||
class: v.class,
|
||||
type: v.osm_type,
|
||||
lat: v.lat,
|
||||
lon: v.lon,
|
||||
name,
|
||||
address
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.addressList = []
|
||||
}
|
||||
} else if (this.geocoding_provider_type == "Photon") {
|
||||
let photon_properties = ['housenumber', 'street', 'locality', 'district', 'city', 'county', 'state', 'postcode', 'country']
|
||||
|
||||
if (ret) {
|
||||
this.addressList = ret.features.map(v => {
|
||||
let pre_name = v.properties.name || v.properties.street || ''
|
||||
let pre_address = ''
|
||||
|
||||
photon_properties.forEach((item, i) => {
|
||||
let last = i == (photon_properties.length - 1)
|
||||
if (v.properties[item] && !last) {
|
||||
pre_address += v.properties[item]+', '
|
||||
} else if (v.properties[item]) {
|
||||
pre_address += v.properties[item]
|
||||
}
|
||||
});
|
||||
|
||||
let name = pre_name
|
||||
let address = pre_address
|
||||
return {
|
||||
class: v.properties.osm_key,
|
||||
type: v.properties.osm_type,
|
||||
lat: v.geometry.coordinates[1],
|
||||
lon: v.geometry.coordinates[0],
|
||||
name,
|
||||
address
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.addressList = []
|
||||
}
|
||||
if (this.onlineLocations) {
|
||||
// Insert up to 3 online location: the main one and 2 fallback
|
||||
if (this.onlineLocations.length > 3) {
|
||||
this.$nextTick(() => this.onlineLocations = this.onlineLocations.slice(0, 3))
|
||||
}
|
||||
this.loading = false
|
||||
// Remove duplicates
|
||||
this.$nextTick(() => this.onlineLocations = [...new Set(this.onlineLocations)])
|
||||
|
||||
this.onlineLocations.forEach((item, i) => {
|
||||
if (!item.startsWith('http')) { this.onlineLocations[i] = `https://${item}` }
|
||||
this.event.online_locations[i] = this.onlineLocations[i]
|
||||
})
|
||||
}
|
||||
}, 1000)
|
||||
},
|
||||
// changeEventOnlyOnline(v) {
|
||||
// this.event_only_online = v
|
||||
// // console.log(this.event_only_online)
|
||||
// if (this.event_only_online) { this.place.name = this.place.address = 'online' }
|
||||
// if (!this.event_only_online) { this.place.name = this.place.address = ''; this.onlineLocations = [] }
|
||||
// this.place.latitude = null
|
||||
// this.place.longitude = null
|
||||
|
||||
// // Update onlineLocations
|
||||
// this.event.online_locations && this.selectLocations()
|
||||
// this.$emit('input', { ...this.place })
|
||||
// },
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
145
components/WhereInputAdvanced.vue
Normal file
145
components/WhereInputAdvanced.vue
Normal file
|
@ -0,0 +1,145 @@
|
|||
<template lang="pug">
|
||||
v-card
|
||||
v-card-title {{ $t('event.where_advanced_options') }}
|
||||
v-card-subtitle {{ $t('event.where_advanced_options_description') }}
|
||||
|
||||
v-card-text(v-if='showGeocoded')
|
||||
v-combobox(ref='geocodedAddress'
|
||||
:prepend-icon='mdiMapSearch'
|
||||
@input.native='searchAddress'
|
||||
:label="$t('common.search_coordinates')"
|
||||
:value='place.geocodedAddress'
|
||||
item-text='address'
|
||||
persistent-hint hide-no-data clearable no-filter
|
||||
:loading='loading'
|
||||
@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")
|
||||
template(v-slot:item="{ item, attrs, on }")
|
||||
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')
|
||||
v-list-item-title(v-text='item.name')
|
||||
v-list-item-subtitle(v-text='`${item.address}`')
|
||||
|
||||
v-row.mt-4
|
||||
v-col.py-0(cols=12 sm=6)
|
||||
v-text-field(v-model="place.latitude"
|
||||
:prepend-icon='mdiLatitude'
|
||||
: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='disableGeocoded'
|
||||
:label="$t('common.longitude')"
|
||||
:rules="$validators.longitude")
|
||||
p.mt-4(v-if='place.isNew' v-html="$t('event.address_geocoded_disclaimer')")
|
||||
|
||||
MapEdit.mt-4(:place='place' v-if="(settings.allow_geolocation && place.name !== 'online' && place.latitude && place.longitude)" )
|
||||
|
||||
v-divider(v-if='settings.allow_online_event && showGeocoded')
|
||||
|
||||
v-card-text.mt-6(v-if='settings.allow_online_event')
|
||||
v-combobox(v-model="onlineLocations_update"
|
||||
:prepend-icon='mdiLink'
|
||||
:hint="$t('event.online_locations_help')"
|
||||
:label="$t('event.online_locations')"
|
||||
clearable chips small-chips multiple deletable-chips hide-no-data hide-selected persistent-hint
|
||||
:delimiters="[',', ';']"
|
||||
:items="onlineLocations_update")
|
||||
template(v-slot:selection="{ item, index, on, attrs, selected, parent }")
|
||||
v-chip(v-bind="attrs" :outlined='index !== 0'
|
||||
close :close-icon='mdiCloseCircle' @click:close='parent.selectItem(item)'
|
||||
:input-value="selected" label small) {{ item }}
|
||||
|
||||
|
||||
v-card-actions
|
||||
v-spacer
|
||||
v-btn(@click='close' outlined) Close
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import { mdiMap, mdiLatitude, mdiLongitude, mdiCog, mdiLink, mdiCloseCircle, mdiMapMarker,
|
||||
mdiMapSearch, mdiRoadVariant, mdiHome, mdiCityVariant } from '@mdi/js'
|
||||
import { mapState } from 'vuex'
|
||||
import debounce from 'lodash/debounce'
|
||||
import geolocation from '../server/helpers/geolocation/index'
|
||||
|
||||
export default {
|
||||
name: 'WhereInputAdvanced',
|
||||
props: {
|
||||
place: { type: Object, default: () => ({}) },
|
||||
event: { type: Object, default: () => null },
|
||||
onlineLocations: { type: Array, default: [] }
|
||||
},
|
||||
components: {
|
||||
[process.client && 'MapEdit']: () => import('@/components/MapEdit.vue')
|
||||
},
|
||||
data ({$store}) {
|
||||
return {
|
||||
mdiMap, mdiLatitude, mdiLongitude, mdiCog, mdiLink, mdiCloseCircle,
|
||||
mdiMapMarker, mdiMapSearch, mdiRoadVariant, mdiHome, mdiCityVariant,
|
||||
addressList: [],
|
||||
loading: false,
|
||||
iconsMapper: {
|
||||
mdiHome,
|
||||
mdiRoadVariant,
|
||||
mdiMapMarker,
|
||||
mdiCityVariant
|
||||
},
|
||||
currentGeocodingProvider: geolocation.getGeocodingProvider($store.state.settings.geocoding_provider_type),
|
||||
prevAddress: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['settings']),
|
||||
showGeocoded () {
|
||||
return this.settings.allow_geolocation && this.place.name !== 'online' && this.place.isNew
|
||||
},
|
||||
onlineLocations_update: {
|
||||
get () { return this.onlineLocations },
|
||||
set (value) {
|
||||
this.$emit('update:onlineLocations', value)
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
this.$emit('close')
|
||||
},
|
||||
loadCoordinatesResultIcon(item) {
|
||||
let icon = this.currentGeocodingProvider.loadResultIcon(item)
|
||||
return this.iconsMapper[icon]
|
||||
},
|
||||
searchAddress: debounce(async function(ev) {
|
||||
const pre_searchCoordinates = ev.target.value.trim().toLowerCase()
|
||||
const searchCoordinates = pre_searchCoordinates.replace('/', ',')
|
||||
if (searchCoordinates.length) {
|
||||
this.loading = true
|
||||
const ret = await this.$axios.$get(`placeOSM/${this.currentGeocodingProvider.commonName}/${searchCoordinates}`)
|
||||
this.addressList = this.currentGeocodingProvider.mapQueryResults(ret)
|
||||
this.loading = false
|
||||
}
|
||||
}, 1000),
|
||||
selectAddress (v) {
|
||||
if (!v) { return }
|
||||
if (typeof v === 'object') {
|
||||
this.place.latitude = v.lat
|
||||
this.place.longitude = v.lon
|
||||
if (this.place.address === '' || this.place.address === this.prevAddress ) {
|
||||
this.place.address = v.address
|
||||
}
|
||||
} else {
|
||||
this.place.latitude = this.place.longitude = null
|
||||
}
|
||||
this.prevAddress = v.address
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -60,7 +60,7 @@ v-card
|
|||
</template>
|
||||
<script>
|
||||
import { mapActions, mapState } from 'vuex'
|
||||
import { isoCountries } from '../../server/helpers/geolocation'
|
||||
import { isoCountries } from '../../server/helpers/geolocation/isoCountries'
|
||||
import { mdiChevronDown } from '@mdi/js'
|
||||
// import Map from '~/components/Map'
|
||||
import "leaflet/dist/leaflet.css"
|
||||
|
|
|
@ -11,32 +11,58 @@ v-container
|
|||
v-dialog(v-model='dialog' width='600' :fullscreen='$vuetify.breakpoint.xsOnly')
|
||||
v-card
|
||||
v-card-title {{ $t('admin.edit_place') }}
|
||||
v-card-text
|
||||
v-card-text.mb-4
|
||||
v-form(v-model='valid' ref='form' lazy-validation)
|
||||
v-text-field(
|
||||
:rules="[$validators.required('common.name')]"
|
||||
:label="$t('common.name')"
|
||||
v-model='place.name'
|
||||
:placeholder='$t("common.name")')
|
||||
|
||||
v-combobox(ref='address'
|
||||
|
||||
v-text-field(ref='address'
|
||||
:rules="[ v => $validators.required('common.address')(v)]"
|
||||
:label="$t('common.address')"
|
||||
v-model='place.address'
|
||||
persistent-hint)
|
||||
|
||||
v-combobox.mt-0.mb-4(ref='geocodedAddress' v-model='place.geocodedAddress'
|
||||
v-if="(settings.allow_geolocation && place.name !== 'online')"
|
||||
:disabled="!(settings.allow_geolocation && place.name !== 'online')"
|
||||
:prepend-icon='mdiMapSearch'
|
||||
@input.native='searchAddress'
|
||||
:label="$t('common.address')"
|
||||
:rules="[ v => $validators.required('common.address')(v)]"
|
||||
:value='place.address'
|
||||
:label="$t('common.search_coordinates')"
|
||||
:value='place.latitude && place.longitude && place.geocodedAddress'
|
||||
persistent-hint hide-no-data clearable no-filter
|
||||
:loading='loading'
|
||||
@change='selectAddress'
|
||||
@focus='searchAddress'
|
||||
:items="addressList"
|
||||
:hint="$t('event.address_description')")
|
||||
template(v-slot:item="{ item, attrs, on }")
|
||||
:hint="$t('event.address_description_osm')")
|
||||
template(v-slot:message="{message, key}")
|
||||
span(v-html='message' :key="key")
|
||||
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')
|
||||
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)
|
||||
v-text-field(v-model="place.latitude"
|
||||
:value="place.latitude"
|
||||
:prepend-icon='mdiLatitude'
|
||||
:disabled="(!settings.allow_geolocation || place.name === 'online')"
|
||||
:label="$t('common.latitude')"
|
||||
:rules="$validators.latitude")
|
||||
v-col.py-0(cols=12 md=6)
|
||||
v-text-field(v-model="place.longitude"
|
||||
:prepend-icon='mdiLongitude'
|
||||
:disabled="!settings.allow_geolocation || place.name === 'online'"
|
||||
:label="$t('common.longitude')"
|
||||
:rules="$validators.longitude")
|
||||
|
||||
MapEdit.mt-4(:place.sync='place' :key="dialog" v-if="settings.allow_geolocation && place.name !== 'online' && place.latitude && place.longitude")
|
||||
|
||||
v-card-actions
|
||||
v-spacer
|
||||
|
@ -53,7 +79,7 @@ v-container
|
|||
:footer-props='{ prevIcon: mdiChevronLeft, nextIcon: mdiChevronRight }'
|
||||
:search='search')
|
||||
template(v-slot:item.map='{ item }')
|
||||
span {{item.latitude && item.longitude && 'YEP' }}
|
||||
v-icon(v-if='item.latitude && item.longitude' v-text='mdiMapMarker')
|
||||
template(v-slot:item.actions='{ item }')
|
||||
v-btn(@click='editPlace(item)' color='primary' icon)
|
||||
v-icon(v-text='mdiPencil')
|
||||
|
@ -62,15 +88,20 @@ v-container
|
|||
|
||||
</template>
|
||||
<script>
|
||||
import { mdiPencil, mdiChevronLeft, mdiChevronRight, mdiMagnify, mdiEye, mdiMapSearch, mdiChevronDown } from '@mdi/js'
|
||||
import { mdiPencil, mdiChevronLeft, mdiChevronRight, mdiChevronDown, mdiMagnify, mdiEye, mdiMapMarker,
|
||||
mdiLatitude, mdiLongitude, mdiMapSearch, mdiRoadVariant, mdiHome, mdiCityVariant } from '@mdi/js'
|
||||
import { mapState } from 'vuex'
|
||||
import debounce from 'lodash/debounce'
|
||||
import get from 'lodash/get'
|
||||
import geolocation from '../../server/helpers/geolocation/index'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
[process.client && 'MapEdit']: () => import('@/components/MapEdit.vue')
|
||||
},
|
||||
data( {$store} ) {
|
||||
return {
|
||||
mdiPencil, mdiChevronRight, mdiChevronLeft, mdiMagnify, mdiEye, mdiMapSearch, mdiChevronDown,
|
||||
mdiPencil, mdiChevronRight, mdiChevronLeft, mdiChevronDown, mdiMagnify, mdiEye, mdiMapMarker,
|
||||
mdiLatitude, mdiLongitude, mdiMapSearch, mdiRoadVariant, mdiHome, mdiCityVariant,
|
||||
loading: false,
|
||||
dialog: false,
|
||||
valid: false,
|
||||
|
@ -85,11 +116,19 @@ export default {
|
|||
{ value: 'map', text: 'Map' },
|
||||
{ value: 'actions', text: this.$t('common.actions'), align: 'right' }
|
||||
],
|
||||
geocoding_provider_type: $store.state.settings.geocoding_provider_type || 'Nominatim'
|
||||
currentGeocodingProvider: geolocation.getGeocodingProvider($store.state.settings.geocoding_provider_type),
|
||||
prevAddress: '',
|
||||
iconsMapper: {
|
||||
'mdiHome': mdiHome,
|
||||
'mdiRoadVariant': mdiRoadVariant,
|
||||
'mdiMapMarker': mdiMapMarker,
|
||||
'mdiCityVariant': mdiCityVariant
|
||||
}
|
||||
}
|
||||
},
|
||||
async fetch() {
|
||||
this.places = await this.$axios.$get('/places')
|
||||
this.places.splice(this.places.findIndex((p) => p.name === 'online' ), 1)
|
||||
},
|
||||
computed: {
|
||||
...mapState(['settings']),
|
||||
|
@ -99,6 +138,8 @@ export default {
|
|||
this.place.name = item.name
|
||||
this.place.address = item.address
|
||||
if (this.settings.allow_geolocation) {
|
||||
this.prevAddress = ''
|
||||
this.place.geocodedAddress = ''
|
||||
this.place.latitude = item.latitude
|
||||
this.place.longitude = item.longitude
|
||||
}
|
||||
|
@ -114,105 +155,44 @@ export default {
|
|||
this.dialog = false
|
||||
},
|
||||
selectAddress (v) {
|
||||
let currentAddress = this.place.address
|
||||
this.place.geocodedAddress = ''
|
||||
this.dialog++
|
||||
|
||||
if (!v) { return }
|
||||
if (typeof v === 'object') {
|
||||
this.place.latitude = v.lat
|
||||
this.place.longitude = v.lon
|
||||
this.place.address = v.address
|
||||
// }
|
||||
this.place.latitude = v.lat
|
||||
this.place.longitude = v.lon
|
||||
this.place.geocodedAddress = v.address
|
||||
this.place.address = v.address
|
||||
} else {
|
||||
this.place.address = v
|
||||
this.place.latitude = this.place.longitude = null
|
||||
}
|
||||
if (currentAddress == '' || currentAddress == this.prevAddress) {
|
||||
this.place.address = this.place.geocodedAddress
|
||||
} else {
|
||||
this.place.address = currentAddress
|
||||
}
|
||||
this.place.selected = true
|
||||
this.prevAddress = this.place.geocodedAddress
|
||||
this.$emit('input', { ...this.place })
|
||||
},
|
||||
searchAddress: debounce(async function(ev) {
|
||||
const pre_searchCoordinates = ev.target.value.trim().toLowerCase()
|
||||
// allow pasting coordinates lat/lon and lat,lon
|
||||
const searchCoordinates = pre_searchCoordinates.replace('/', ',')
|
||||
// const regex_coords_comma = "-?[1-9][0-9]*(\\.[0-9]+)?,\\s*-?[1-9][0-9]*(\\.[0-9]+)?";
|
||||
// const regex_coords_slash = "-?[1-9][0-9]*(\\.[0-9]+)?/\\s*-?[1-9][0-9]*(\\.[0-9]+)?";
|
||||
|
||||
// const setCoords = (v) => {
|
||||
// const lat = v[0].trim()
|
||||
// const lon = v[1].trim()
|
||||
// // check coordinates are valid
|
||||
// if ((lat < 90 && lat > -90)
|
||||
// && (lon < 180 && lon > -180)) {
|
||||
// this.place.latitude = lat
|
||||
// this.place.longitude = lon
|
||||
// } else {
|
||||
// this.$root.$message("Non existent coordinates", { color: 'error' })
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (pre_searchCoordinates.match(regex_coords_comma)) {
|
||||
// let v = pre_searchCoordinates.split(",")
|
||||
// setCoords(v)
|
||||
// return
|
||||
// }
|
||||
// if (pre_searchCoordinates.match(regex_coords_slash)) {
|
||||
// let v = pre_searchCoordinates.split("/")
|
||||
// setCoords(v)
|
||||
// return
|
||||
// }
|
||||
|
||||
if (searchCoordinates.length) {
|
||||
this.loading = true
|
||||
const ret = await this.$axios.$get(`placeOSM/${this.geocoding_provider_type}/${searchCoordinates}`)
|
||||
if (this.geocoding_provider_type == "Nominatim") {
|
||||
if (ret && ret.length) {
|
||||
this.addressList = ret.map(v => {
|
||||
const name = get(v.namedetails, 'alt_name', get(v.namedetails, 'name'))
|
||||
const address = v.display_name ? v.display_name.replace(name, '').replace(/^, ?/, '') : ''
|
||||
return {
|
||||
class: v.class,
|
||||
type: v.osm_type,
|
||||
lat: v.lat,
|
||||
lon: v.lon,
|
||||
name,
|
||||
address
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.addressList = []
|
||||
}
|
||||
} else if (this.geocoding_provider_type == "Photon") {
|
||||
let photon_properties = ['housenumber', 'street', 'district', 'city', 'county', 'state', 'postcode', 'country']
|
||||
|
||||
if (ret) {
|
||||
this.addressList = ret.features.map(v => {
|
||||
let pre_name = v.properties.name || v.properties.street || ''
|
||||
let pre_address = ''
|
||||
|
||||
photon_properties.forEach((item, i) => {
|
||||
let last = i == (photon_properties.length - 1)
|
||||
if (v.properties[item] && !last) {
|
||||
pre_address += v.properties[item]+', '
|
||||
} else if (v.properties[item]) {
|
||||
pre_address += v.properties[item]
|
||||
}
|
||||
});
|
||||
|
||||
let name = pre_name
|
||||
let address = pre_address
|
||||
return {
|
||||
class: v.properties.osm_key,
|
||||
type: v.properties.osm_type,
|
||||
lat: v.geometry.coordinates[1],
|
||||
lon: v.geometry.coordinates[0],
|
||||
name,
|
||||
address
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.addressList = []
|
||||
}
|
||||
}
|
||||
const ret = await this.$axios.$get(`placeOSM/${this.currentGeocodingProvider.commonName}/${searchCoordinates}`)
|
||||
this.addressList = this.currentGeocodingProvider.mapQueryResults(ret)
|
||||
this.loading = false
|
||||
}
|
||||
}, 300)
|
||||
}, 1000),
|
||||
loadCoordinatesResultIcon(item) {
|
||||
let icon = this.currentGeocodingProvider.loadResultIcon(item)
|
||||
return this.iconsMapper[icon]
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -52,6 +52,10 @@ v-container
|
|||
inset
|
||||
:label="$t('admin.recurrent_event_visible')")
|
||||
|
||||
v-switch.mt-1(v-model='allow_online_event'
|
||||
inset
|
||||
:label="$t('admin.allow_online_event')")
|
||||
|
||||
v-switch.mt-1(v-model='allow_geolocation'
|
||||
inset
|
||||
:label="$t('admin.allow_geolocation')")
|
||||
|
@ -126,6 +130,10 @@ export default {
|
|||
get () { return this.settings.allow_geolocation },
|
||||
set (value) { this.setSetting({ key: 'allow_geolocation', value }) }
|
||||
},
|
||||
allow_online_event: {
|
||||
get () { return this.settings.allow_online_event },
|
||||
set (value) { this.setSetting({ key: 'allow_online_event', value }) }
|
||||
},
|
||||
filteredTimezones () {
|
||||
const current_timezone = DateTime.local().zoneName
|
||||
tzNames.unshift(current_timezone)
|
||||
|
|
|
@ -98,7 +98,11 @@
|
|||
"about": "About",
|
||||
"content": "Content",
|
||||
"admin_actions": "Admin actions",
|
||||
"recurring_event_actions": "Recurring event actions"
|
||||
"recurring_event_actions": "Recurring event actions",
|
||||
"latitude": "Latitude",
|
||||
"longitude": "Longitude",
|
||||
"search_coordinates": "Search coordinates",
|
||||
"online": "On-line"
|
||||
},
|
||||
"login": {
|
||||
"description": "By logging in you can publish new events.",
|
||||
|
@ -140,7 +144,7 @@
|
|||
"updated": "Event updated",
|
||||
"where_description": "Where's the event? If not present you can create it.",
|
||||
"address_description": "What is the address?",
|
||||
"address_description_osm": "What is the address? (<a href='http://osm.org/copyright'>OpenStreetMap</a> contributors)",
|
||||
"address_description_osm": "Search coordinates by typing the address. (<a href='http://osm.org/copyright'>OpenStreetMap</a> contributors)",
|
||||
"confirmed": "Event confirmed",
|
||||
"not_found": "Could not find event",
|
||||
"remove_confirmation": "Are you sure you want to remove this event?",
|
||||
|
@ -178,7 +182,13 @@
|
|||
"alt_text_description": "Description for people with visual impairments",
|
||||
"choose_focal_point": "Choose the focal point",
|
||||
"remove_media_confirmation": "Do you confirm the image removal?",
|
||||
"download_flyer": "Download flyer"
|
||||
"download_flyer": "Download flyer",
|
||||
"where_advanced_options": "Place - Advanced options",
|
||||
"where_advanced_options_description": "Define here additional place properties",
|
||||
"online_locations": "Online locations",
|
||||
"online_locations_help": "For instance an url to a videconference room and a fallback url (max. 3)",
|
||||
"online_locations_fallback_urls": "Fallback links",
|
||||
"address_geocoded_disclaimer": "If you cannot find the <strong>street address</strong> or the <strong>housenumber</strong> you are looking for in the geocoding results, you can manually insert them in the 'Address' field without loose the coordinates. Consider also that the <a target=\"_blank\" href=\"https://www.openstreetmap.org/\">OpenStreetMap</a> project is open to contributions. If you have Android, we recommend <a target=\"_blank\" href=\"https://f-droid.org/en/packages/de.westnordost.streetcomplete/\">StreetComplete</a> "
|
||||
},
|
||||
"admin": {
|
||||
"place_description": "If you have gotten the place or address wrong, you can change it.<br/>All current and past events associated with this place will change address.",
|
||||
|
@ -196,6 +206,8 @@
|
|||
"allow_anon_event": "Allow anonymous events (has to be confirmed)?",
|
||||
"allow_multidate_event": "Allow multi-day events",
|
||||
"allow_recurrent_event": "Allow recurring events",
|
||||
"allow_online_event": "Allow online events",
|
||||
"allow_online_event_hint": "Ask for urls ",
|
||||
"allow_geolocation": "Allow events geolocation",
|
||||
"recurrent_event_visible": "Show recurring events by default",
|
||||
"federation": "Federation / ActivityPub",
|
||||
|
@ -328,7 +340,9 @@
|
|||
},
|
||||
"validators": {
|
||||
"required": "{fieldName} is required",
|
||||
"email": "Insert a valid email"
|
||||
"email": "Insert a valid email",
|
||||
"latitude": "Insert a valid latitude (-90 < latitude < 90)",
|
||||
"longitude": "Insert a valid latitude (-180 < latitude < 180)"
|
||||
},
|
||||
"about": "\n <p><a href='https://gancio.org'>Gancio</a> is a shared agenda for local communities.</p>\n ",
|
||||
"oauth": {
|
||||
|
|
|
@ -30,7 +30,7 @@ v-container.container.pa-0.pa-md-3
|
|||
|
||||
//- Where
|
||||
v-col(cols=12)
|
||||
WhereInput(ref='where' v-model='event.place')
|
||||
WhereInput(ref='where' v-model='event.place' :event='event')
|
||||
|
||||
//- When
|
||||
DateInput(ref='when' v-model='date' :event='event')
|
||||
|
@ -141,6 +141,7 @@ export default {
|
|||
data.event.media = event.media || []
|
||||
data.event.parentId = event.parentId
|
||||
data.event.recurrent = event.recurrent
|
||||
data.event.online_locations = event.online_locations
|
||||
return data
|
||||
}
|
||||
return {}
|
||||
|
@ -233,9 +234,17 @@ export default {
|
|||
formData.append('place_id', this.event.place.id)
|
||||
}
|
||||
formData.append('place_name', this.event.place.name.trim())
|
||||
formData.append('place_address', this.event.place.address)
|
||||
if (this.event.place.latitude) { formData.append('place_latitude', this.event.place.latitude) }
|
||||
if (this.event.place.longitude) { formData.append('place_longitude', this.event.place.longitude) }
|
||||
formData.append('place_address', this.event.place.address || null)
|
||||
|
||||
if (this.settings.allow_geolocation) {
|
||||
formData.append('place_latitude', this.event.place.latitude || '')
|
||||
formData.append('place_longitude', this.event.place.longitude || '')
|
||||
}
|
||||
|
||||
if (this.event.online_locations) {
|
||||
this.event.online_locations.forEach(l => formData.append('online_locations[]', l))
|
||||
}
|
||||
|
||||
formData.append('description', this.event.description)
|
||||
formData.append('multidate', !!this.date.multidate)
|
||||
formData.append('start_datetime', this.$time.fromDateInput(this.date.from, this.date.fromHour))
|
||||
|
|
|
@ -17,23 +17,32 @@ v-container#event.pa-2.pa-sm-2(itemscope itemtype="https://schema.org/Event" v-t
|
|||
strong.p-name.text--primary(itemprop="name") {{event.title}}
|
||||
v-divider
|
||||
v-container.eventDetails
|
||||
time.dt-start(:datetime='$time.unixFormat(event.start_datetime, "yyyy-MM-dd HH:mm")' itemprop="startDate" :content="$time.unixFormat(event.start_datetime, \"yyyy-MM-dd'T'HH:mm\")")
|
||||
time.dt-start(:datetime='$time.unixFormat(event.start_datetime, "yyyy-MM-dd HH:mm")' itemprop="startDate" :content='$time.unixFormat(event.start_datetime, "yyyy-MM-dd\'T\'HH:mm")')
|
||||
v-icon(v-text='mdiCalendar' small)
|
||||
strong.ml-2.text-uppercase {{$time.when(event)}}
|
||||
.d-none.dt-end(v-if='event.end_datetime' itemprop="endDate" :content="$time.unixFormat(event.end_datetime,\"yyyy-MM-dd'T'HH:mm\")") {{$time.unixFormat(event.end_datetime,"yyyy-MM-dd'T'HH:mm")}}
|
||||
.d-none.dt-end(v-if='event.end_datetime' itemprop="endDate" :content='$time.unixFormat(event.end_datetime,"yyyy-MM-dd\'T\'HH:mm")') {{$time.unixFormat(event.end_datetime,"yyyy-MM-dd'T'HH:mm")}}
|
||||
div.font-weight-light.mb-3 {{$time.from(event.start_datetime)}}
|
||||
small(v-if='event.parentId') ({{$time.recurrentDetail(event)}})
|
||||
|
||||
.p-location.h-adr(itemprop="location" itemscope itemtype="https://schema.org/Place")
|
||||
v-icon(v-text='mdiMapMarker' small)
|
||||
nuxt-link.vcard.ml-2.p-name.text-decoration-none.text-uppercase(itemprop="name" :to='`/place/${encodeURIComponent(event.place.name)}`') {{event.place && event.place.name}}
|
||||
.font-weight-light.p-street-address(itemprop='address') {{event.place && event.place.address}}
|
||||
.font-weight-light.p-street-address(v-if='event.place.name !=="online"' itemprop='address') {{event.place && event.place.address}}
|
||||
|
||||
//- tags, hashtags
|
||||
v-container.pt-0(v-if='event.tags && event.tags.length')
|
||||
v-chip.p-category.ml-1.mt-1(v-for='tag in event.tags' small label color='primary'
|
||||
outlined :key='tag' :to='`/tag/${encodeURIComponent(tag)}`') {{tag}}
|
||||
|
||||
//- online events
|
||||
//- v-divider(v-if='hasOnlineLocations')
|
||||
v-list(nav dense v-if='hasOnlineLocations')
|
||||
v-list-item(v-for='(item, index) in event.online_locations' target='_blank' :href="`${item}`" :key="index")
|
||||
v-list-item-icon
|
||||
v-icon(v-text='mdiMonitorAccount')
|
||||
v-list-item-content.py-0
|
||||
v-list-item-title.text-caption(v-text='item')
|
||||
|
||||
v-divider
|
||||
//- info & actions
|
||||
v-list(dense nav color='transparent')
|
||||
|
@ -76,7 +85,7 @@ v-container#event.pa-2.pa-sm-2(itemscope itemtype="https://schema.org/Event" v-t
|
|||
v-list-item-content
|
||||
v-list-item-title(v-text="$t('event.download_flyer')")
|
||||
|
||||
v-divider
|
||||
v-divider(v-if='is_mine')
|
||||
|
||||
//- admin actions
|
||||
eventAdmin(v-if='is_mine' :event='event')
|
||||
|
@ -184,7 +193,7 @@ const { htmlToText } = require('html-to-text')
|
|||
|
||||
import { mdiArrowLeft, mdiArrowRight, mdiDotsVertical, mdiCodeTags, mdiClose, mdiMap,
|
||||
mdiEye, mdiEyeOff, mdiDelete, mdiRepeat, mdiLock, mdiFileDownloadOutline, mdiShareAll,
|
||||
mdiCalendarExport, mdiCalendar, mdiContentCopy, mdiMapMarker, mdiChevronUp, mdiBookmark } from '@mdi/js'
|
||||
mdiCalendarExport, mdiCalendar, mdiContentCopy, mdiMapMarker, mdiChevronUp, mdiMonitorAccount, mdiBookmark } from '@mdi/js'
|
||||
|
||||
export default {
|
||||
name: 'Event',
|
||||
|
@ -203,10 +212,10 @@ export default {
|
|||
error({ statusCode: 404, message: 'Event not found' })
|
||||
}
|
||||
},
|
||||
data () {
|
||||
data ({$store}) {
|
||||
return {
|
||||
mdiArrowLeft, mdiArrowRight, mdiDotsVertical, mdiCodeTags, mdiCalendarExport, mdiCalendar, mdiFileDownloadOutline,
|
||||
mdiMapMarker, mdiContentCopy, mdiClose, mdiDelete, mdiEye, mdiEyeOff, mdiRepeat, mdiLock, mdiMap, mdiChevronUp, mdiBookmark, mdiShareAll,
|
||||
mdiMapMarker, mdiContentCopy, mdiClose, mdiDelete, mdiEye, mdiEyeOff, mdiRepeat, mdiLock, mdiMap, mdiChevronUp, mdiMonitorAccount, mdiBookmark, mdiShareAll,
|
||||
currentAttachment: 0,
|
||||
event: {},
|
||||
diocane: '',
|
||||
|
@ -294,6 +303,12 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
...mapState(['settings']),
|
||||
hasOnlineLocations () {
|
||||
return this.event.online_locations && this.event.online_locations.length
|
||||
},
|
||||
showMap () {
|
||||
return this.settings.allow_geolocation && this.event.place.latitude && this.event.place.longitude
|
||||
},
|
||||
hasMedia () {
|
||||
return this.event.media && this.event.media.length
|
||||
},
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
<h1 class='d-block text-h4 font-weight-black text-center text-uppercase mt-10 mx-auto w-100 text-underline'>
|
||||
<u>{{ place.name }}</u>
|
||||
</h1>
|
||||
<span class="d-block text-subtitle text-center w-100 mb-14">{{ place.address }}</span>
|
||||
<span v-if='place.name!=="online"' class="d-block text-subtitle text-center w-100">{{ place.address }}</span>
|
||||
|
||||
<!-- Events -->
|
||||
<div id="events">
|
||||
<div id="events" class='mt-14'>
|
||||
<v-lazy class='event v-card' :value='idx<9' v-for='(event, idx) in events' :key='event.id' :min-height='hide_thumbs ? 105 : undefined' :options="{ threshold: .5, rootMargin: '500px' }" :class="{ 'theme--dark': is_dark }">
|
||||
<Event :event='event' :lazy='idx > 9' />
|
||||
</v-lazy>
|
||||
|
|
|
@ -12,6 +12,12 @@ export default ({ app }, inject) => {
|
|||
],
|
||||
password: [
|
||||
v => !!v || $t('validators.required', { fieldName: $t('common.password') })
|
||||
],
|
||||
latitude: [
|
||||
v => (v < 90 && v > -90) || $t('validators.latitude')
|
||||
],
|
||||
longitude: [
|
||||
v => (v < 180 && v > -180) || $t('validators.longitude')
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -31,14 +31,14 @@ const eventController = {
|
|||
|
||||
const place_name = body.place_name && body.place_name.trim()
|
||||
const place_address = body.place_address && body.place_address.trim()
|
||||
if (!place_address || !place_name) {
|
||||
if (!place_name || !place_address && place_name !== 'online') {
|
||||
throw new Error(`place_id or place_name and place_address are required`)
|
||||
}
|
||||
let place = await Place.findOne({ where: Sequelize.where(Sequelize.fn('LOWER', Sequelize.col('name')), Sequelize.Op.eq, place_name.toLocaleLowerCase()) })
|
||||
if (!place) {
|
||||
place = await Place.create({
|
||||
name: place_name,
|
||||
address: place_address,
|
||||
address: place_address || '',
|
||||
latitude: Number(body.place_latitude) || null,
|
||||
longitude: Number(body.place_longitude) || null
|
||||
})
|
||||
|
@ -335,6 +335,7 @@ const eventController = {
|
|||
multidate: body.multidate,
|
||||
start_datetime: body.start_datetime,
|
||||
end_datetime: body.end_datetime,
|
||||
online_locations: body.online_locations,
|
||||
recurrent,
|
||||
// publish this event only if authenticated
|
||||
is_visible: !!req.user
|
||||
|
@ -419,6 +420,7 @@ const eventController = {
|
|||
multidate: body.multidate,
|
||||
start_datetime: body.start_datetime || event.start_datetime,
|
||||
end_datetime: body.end_datetime || null,
|
||||
online_locations: body.online_locations,
|
||||
recurrent
|
||||
}
|
||||
|
||||
|
@ -675,7 +677,8 @@ const eventController = {
|
|||
media: e.media,
|
||||
is_visible: true,
|
||||
userId: e.userId,
|
||||
placeId: e.placeId
|
||||
placeId: e.placeId,
|
||||
...(e.online_locations && { online_locations: e.online_locations } )
|
||||
}
|
||||
|
||||
const recurrentDetails = e.recurrent
|
||||
|
|
|
@ -27,6 +27,7 @@ const defaultSettings = {
|
|||
allow_anon_event: true,
|
||||
allow_multidate_event: true,
|
||||
allow_recurrent_event: false,
|
||||
allow_online_event: true,
|
||||
recurrent_event_visible: false,
|
||||
allow_geolocation: false,
|
||||
geocoding_provider_type: 'Nominatim',
|
||||
|
|
|
@ -101,6 +101,7 @@ module.exports = () => {
|
|||
* @param {string} [query] - search for this string
|
||||
* @param {array} [tags] - List of tags
|
||||
* @param {array} [places] - List of places id
|
||||
* @param {array} [online_locations] - List of online locations
|
||||
* @param {integer} [max] - Limit events
|
||||
* @param {boolean} [show_recurrent] - Show also recurrent events (default: as choosen in admin settings)
|
||||
* @param {integer} [page] - Pagination
|
||||
|
@ -124,6 +125,7 @@ module.exports = () => {
|
|||
* @param {string} [place_address] - the address of the place
|
||||
* @param {float} [place_latitude] - the latitude of the place
|
||||
* @param {float} [place_longitude] - the longitude of the place
|
||||
* @param {array} online_locations - List of online locations
|
||||
* @param {integer} start_datetime - start timestamp
|
||||
* @param {integer} multidate - is a multidate event?
|
||||
* @param {array} tags - List of tags
|
||||
|
|
|
@ -31,7 +31,8 @@ module.exports = (sequelize, DataTypes) => {
|
|||
is_visible: DataTypes.BOOLEAN,
|
||||
recurrent: DataTypes.JSON,
|
||||
likes: { type: DataTypes.JSON, defaultValue: [] },
|
||||
boost: { type: DataTypes.JSON, defaultValue: [] }
|
||||
boost: { type: DataTypes.JSON, defaultValue: [] },
|
||||
online_locations: { type: DataTypes.JSON, defaultValue: [] }
|
||||
})
|
||||
|
||||
Event.prototype.toAP = function (settings, to = []) {
|
||||
|
|
|
@ -79,6 +79,7 @@ module.exports = {
|
|||
allow_anon_event: settings.allow_anon_event,
|
||||
allow_recurrent_event: settings.allow_recurrent_event,
|
||||
allow_multidate_event: settings.allow_multidate_event,
|
||||
allow_online_event: settings.allow_online_event,
|
||||
recurrent_event_visible: settings.recurrent_event_visible,
|
||||
enable_federation: settings.enable_federation,
|
||||
enable_resources: settings.enable_resources,
|
||||
|
@ -98,7 +99,7 @@ module.exports = {
|
|||
tilelayer_provider: settings.tilelayer_provider,
|
||||
tilelayer_provider_attribution: settings.tilelayer_provider_attribution,
|
||||
footerLinks: settings.footerLinks,
|
||||
about: settings.about
|
||||
about: settings.about,
|
||||
}
|
||||
next()
|
||||
},
|
||||
|
|
|
@ -1,987 +0,0 @@
|
|||
// Iso conversions
|
||||
|
||||
var isoCountries = [
|
||||
{
|
||||
"code": "af",
|
||||
"name": "Afghanistan"
|
||||
},
|
||||
{
|
||||
"code": "ax",
|
||||
"name": "Aland Islands"
|
||||
},
|
||||
{
|
||||
"code": "al",
|
||||
"name": "Albania"
|
||||
},
|
||||
{
|
||||
"code": "dz",
|
||||
"name": "Algeria"
|
||||
},
|
||||
{
|
||||
"code": "as",
|
||||
"name": "American Samoa"
|
||||
},
|
||||
{
|
||||
"code": "ad",
|
||||
"name": "Andorra"
|
||||
},
|
||||
{
|
||||
"code": "ao",
|
||||
"name": "Angola"
|
||||
},
|
||||
{
|
||||
"code": "ai",
|
||||
"name": "Anguilla"
|
||||
},
|
||||
{
|
||||
"code": "aq",
|
||||
"name": "Antarctica"
|
||||
},
|
||||
{
|
||||
"code": "ag",
|
||||
"name": "Antigua And Barbuda"
|
||||
},
|
||||
{
|
||||
"code": "ar",
|
||||
"name": "Argentina"
|
||||
},
|
||||
{
|
||||
"code": "am",
|
||||
"name": "Armenia"
|
||||
},
|
||||
{
|
||||
"code": "aw",
|
||||
"name": "Aruba"
|
||||
},
|
||||
{
|
||||
"code": "au",
|
||||
"name": "Australia"
|
||||
},
|
||||
{
|
||||
"code": "at",
|
||||
"name": "Austria"
|
||||
},
|
||||
{
|
||||
"code": "az",
|
||||
"name": "Azerbaijan"
|
||||
},
|
||||
{
|
||||
"code": "bs",
|
||||
"name": "Bahamas"
|
||||
},
|
||||
{
|
||||
"code": "bh",
|
||||
"name": "Bahrain"
|
||||
},
|
||||
{
|
||||
"code": "bd",
|
||||
"name": "Bangladesh"
|
||||
},
|
||||
{
|
||||
"code": "bb",
|
||||
"name": "Barbados"
|
||||
},
|
||||
{
|
||||
"code": "by",
|
||||
"name": "Belarus"
|
||||
},
|
||||
{
|
||||
"code": "be",
|
||||
"name": "Belgium"
|
||||
},
|
||||
{
|
||||
"code": "bz",
|
||||
"name": "Belize"
|
||||
},
|
||||
{
|
||||
"code": "bj",
|
||||
"name": "Benin"
|
||||
},
|
||||
{
|
||||
"code": "bm",
|
||||
"name": "Bermuda"
|
||||
},
|
||||
{
|
||||
"code": "bt",
|
||||
"name": "Bhutan"
|
||||
},
|
||||
{
|
||||
"code": "bo",
|
||||
"name": "Bolivia"
|
||||
},
|
||||
{
|
||||
"code": "ba",
|
||||
"name": "Bosnia And Herzegovina"
|
||||
},
|
||||
{
|
||||
"code": "bw",
|
||||
"name": "Botswana"
|
||||
},
|
||||
{
|
||||
"code": "bv",
|
||||
"name": "Bouvet Island"
|
||||
},
|
||||
{
|
||||
"code": "br",
|
||||
"name": "Brazil"
|
||||
},
|
||||
{
|
||||
"code": "io",
|
||||
"name": "British Indian Ocean Territory"
|
||||
},
|
||||
{
|
||||
"code": "bn",
|
||||
"name": "Brunei Darussalam"
|
||||
},
|
||||
{
|
||||
"code": "bg",
|
||||
"name": "Bulgaria"
|
||||
},
|
||||
{
|
||||
"code": "bf",
|
||||
"name": "Burkina Faso"
|
||||
},
|
||||
{
|
||||
"code": "bi",
|
||||
"name": "Burundi"
|
||||
},
|
||||
{
|
||||
"code": "kh",
|
||||
"name": "Cambodia"
|
||||
},
|
||||
{
|
||||
"code": "cm",
|
||||
"name": "Cameroon"
|
||||
},
|
||||
{
|
||||
"code": "ca",
|
||||
"name": "Canada"
|
||||
},
|
||||
{
|
||||
"code": "cv",
|
||||
"name": "Cape Verde"
|
||||
},
|
||||
{
|
||||
"code": "ky",
|
||||
"name": "Cayman Islands"
|
||||
},
|
||||
{
|
||||
"code": "cf",
|
||||
"name": "Central African Republic"
|
||||
},
|
||||
{
|
||||
"code": "td",
|
||||
"name": "Chad"
|
||||
},
|
||||
{
|
||||
"code": "cl",
|
||||
"name": "Chile"
|
||||
},
|
||||
{
|
||||
"code": "cn",
|
||||
"name": "China"
|
||||
},
|
||||
{
|
||||
"code": "cx",
|
||||
"name": "Christmas Island"
|
||||
},
|
||||
{
|
||||
"code": "cc",
|
||||
"name": "Cocos (Keeling) Islands"
|
||||
},
|
||||
{
|
||||
"code": "co",
|
||||
"name": "Colombia"
|
||||
},
|
||||
{
|
||||
"code": "km",
|
||||
"name": "Comoros"
|
||||
},
|
||||
{
|
||||
"code": "cg",
|
||||
"name": "Congo"
|
||||
},
|
||||
{
|
||||
"code": "cd",
|
||||
"name": "Congo, Democratic Republic"
|
||||
},
|
||||
{
|
||||
"code": "ck",
|
||||
"name": "Cook Islands"
|
||||
},
|
||||
{
|
||||
"code": "cr",
|
||||
"name": "Costa Rica"
|
||||
},
|
||||
{
|
||||
"code": "ci",
|
||||
"name": "Cote D'Ivoire"
|
||||
},
|
||||
{
|
||||
"code": "hr",
|
||||
"name": "Croatia"
|
||||
},
|
||||
{
|
||||
"code": "cu",
|
||||
"name": "Cuba"
|
||||
},
|
||||
{
|
||||
"code": "cy",
|
||||
"name": "Cyprus"
|
||||
},
|
||||
{
|
||||
"code": "cz",
|
||||
"name": "Czech Republic"
|
||||
},
|
||||
{
|
||||
"code": "dk",
|
||||
"name": "Denmark"
|
||||
},
|
||||
{
|
||||
"code": "dj",
|
||||
"name": "Djibouti"
|
||||
},
|
||||
{
|
||||
"code": "dm",
|
||||
"name": "Dominica"
|
||||
},
|
||||
{
|
||||
"code": "do",
|
||||
"name": "Dominican Republic"
|
||||
},
|
||||
{
|
||||
"code": "ec",
|
||||
"name": "Ecuador"
|
||||
},
|
||||
{
|
||||
"code": "eg",
|
||||
"name": "Egypt"
|
||||
},
|
||||
{
|
||||
"code": "sv",
|
||||
"name": "El Salvador"
|
||||
},
|
||||
{
|
||||
"code": "gq",
|
||||
"name": "Equatorial Guinea"
|
||||
},
|
||||
{
|
||||
"code": "er",
|
||||
"name": "Eritrea"
|
||||
},
|
||||
{
|
||||
"code": "ee",
|
||||
"name": "Estonia"
|
||||
},
|
||||
{
|
||||
"code": "et",
|
||||
"name": "Ethiopia"
|
||||
},
|
||||
{
|
||||
"code": "fk",
|
||||
"name": "Falkland Islands (Malvinas)"
|
||||
},
|
||||
{
|
||||
"code": "fo",
|
||||
"name": "Faroe Islands"
|
||||
},
|
||||
{
|
||||
"code": "fj",
|
||||
"name": "Fiji"
|
||||
},
|
||||
{
|
||||
"code": "fi",
|
||||
"name": "Finland"
|
||||
},
|
||||
{
|
||||
"code": "fr",
|
||||
"name": "France"
|
||||
},
|
||||
{
|
||||
"code": "gf",
|
||||
"name": "French Guiana"
|
||||
},
|
||||
{
|
||||
"code": "pf",
|
||||
"name": "French Polynesia"
|
||||
},
|
||||
{
|
||||
"code": "tf",
|
||||
"name": "French Southern Territories"
|
||||
},
|
||||
{
|
||||
"code": "ga",
|
||||
"name": "Gabon"
|
||||
},
|
||||
{
|
||||
"code": "gm",
|
||||
"name": "Gambia"
|
||||
},
|
||||
{
|
||||
"code": "ge",
|
||||
"name": "Georgia"
|
||||
},
|
||||
{
|
||||
"code": "de",
|
||||
"name": "Germany"
|
||||
},
|
||||
{
|
||||
"code": "gh",
|
||||
"name": "Ghana"
|
||||
},
|
||||
{
|
||||
"code": "gi",
|
||||
"name": "Gibraltar"
|
||||
},
|
||||
{
|
||||
"code": "gr",
|
||||
"name": "Greece"
|
||||
},
|
||||
{
|
||||
"code": "gl",
|
||||
"name": "Greenland"
|
||||
},
|
||||
{
|
||||
"code": "gd",
|
||||
"name": "Grenada"
|
||||
},
|
||||
{
|
||||
"code": "gp",
|
||||
"name": "Guadeloupe"
|
||||
},
|
||||
{
|
||||
"code": "gu",
|
||||
"name": "Guam"
|
||||
},
|
||||
{
|
||||
"code": "gt",
|
||||
"name": "Guatemala"
|
||||
},
|
||||
{
|
||||
"code": "gg",
|
||||
"name": "Guernsey"
|
||||
},
|
||||
{
|
||||
"code": "gn",
|
||||
"name": "Guinea"
|
||||
},
|
||||
{
|
||||
"code": "gw",
|
||||
"name": "Guinea-Bissau"
|
||||
},
|
||||
{
|
||||
"code": "gy",
|
||||
"name": "Guyana"
|
||||
},
|
||||
{
|
||||
"code": "ht",
|
||||
"name": "Haiti"
|
||||
},
|
||||
{
|
||||
"code": "hm",
|
||||
"name": "Heard Island & Mcdonald Islands"
|
||||
},
|
||||
{
|
||||
"code": "va",
|
||||
"name": "Holy See (Vatican City State)"
|
||||
},
|
||||
{
|
||||
"code": "hn",
|
||||
"name": "Honduras"
|
||||
},
|
||||
{
|
||||
"code": "hk",
|
||||
"name": "Hong Kong"
|
||||
},
|
||||
{
|
||||
"code": "hu",
|
||||
"name": "Hungary"
|
||||
},
|
||||
{
|
||||
"code": "is",
|
||||
"name": "Iceland"
|
||||
},
|
||||
{
|
||||
"code": "in",
|
||||
"name": "India"
|
||||
},
|
||||
{
|
||||
"code": "id",
|
||||
"name": "Indonesia"
|
||||
},
|
||||
{
|
||||
"code": "ir",
|
||||
"name": "Iran, Islamic Republic Of"
|
||||
},
|
||||
{
|
||||
"code": "iq",
|
||||
"name": "Iraq"
|
||||
},
|
||||
{
|
||||
"code": "ie",
|
||||
"name": "Ireland"
|
||||
},
|
||||
{
|
||||
"code": "im",
|
||||
"name": "Isle Of Man"
|
||||
},
|
||||
{
|
||||
"code": "il",
|
||||
"name": "Israel"
|
||||
},
|
||||
{
|
||||
"code": "it",
|
||||
"name": "Italy"
|
||||
},
|
||||
{
|
||||
"code": "jm",
|
||||
"name": "Jamaica"
|
||||
},
|
||||
{
|
||||
"code": "jp",
|
||||
"name": "Japan"
|
||||
},
|
||||
{
|
||||
"code": "je",
|
||||
"name": "Jersey"
|
||||
},
|
||||
{
|
||||
"code": "jo",
|
||||
"name": "Jordan"
|
||||
},
|
||||
{
|
||||
"code": "kz",
|
||||
"name": "Kazakhstan"
|
||||
},
|
||||
{
|
||||
"code": "ke",
|
||||
"name": "Kenya"
|
||||
},
|
||||
{
|
||||
"code": "ki",
|
||||
"name": "Kiribati"
|
||||
},
|
||||
{
|
||||
"code": "kr",
|
||||
"name": "Korea"
|
||||
},
|
||||
{
|
||||
"code": "kw",
|
||||
"name": "Kuwait"
|
||||
},
|
||||
{
|
||||
"code": "kg",
|
||||
"name": "Kyrgyzstan"
|
||||
},
|
||||
{
|
||||
"code": "la",
|
||||
"name": "Lao People's Democratic Republic"
|
||||
},
|
||||
{
|
||||
"code": "lv",
|
||||
"name": "Latvia"
|
||||
},
|
||||
{
|
||||
"code": "lb",
|
||||
"name": "Lebanon"
|
||||
},
|
||||
{
|
||||
"code": "ls",
|
||||
"name": "Lesotho"
|
||||
},
|
||||
{
|
||||
"code": "lr",
|
||||
"name": "Liberia"
|
||||
},
|
||||
{
|
||||
"code": "ly",
|
||||
"name": "Libyan Arab Jamahiriya"
|
||||
},
|
||||
{
|
||||
"code": "li",
|
||||
"name": "Liechtenstein"
|
||||
},
|
||||
{
|
||||
"code": "lt",
|
||||
"name": "Lithuania"
|
||||
},
|
||||
{
|
||||
"code": "lu",
|
||||
"name": "Luxembourg"
|
||||
},
|
||||
{
|
||||
"code": "mo",
|
||||
"name": "Macao"
|
||||
},
|
||||
{
|
||||
"code": "mk",
|
||||
"name": "Macedonia"
|
||||
},
|
||||
{
|
||||
"code": "mg",
|
||||
"name": "Madagascar"
|
||||
},
|
||||
{
|
||||
"code": "mw",
|
||||
"name": "Malawi"
|
||||
},
|
||||
{
|
||||
"code": "my",
|
||||
"name": "Malaysia"
|
||||
},
|
||||
{
|
||||
"code": "mv",
|
||||
"name": "Maldives"
|
||||
},
|
||||
{
|
||||
"code": "ml",
|
||||
"name": "Mali"
|
||||
},
|
||||
{
|
||||
"code": "mt",
|
||||
"name": "Malta"
|
||||
},
|
||||
{
|
||||
"code": "mh",
|
||||
"name": "Marshall Islands"
|
||||
},
|
||||
{
|
||||
"code": "mq",
|
||||
"name": "Martinique"
|
||||
},
|
||||
{
|
||||
"code": "mr",
|
||||
"name": "Mauritania"
|
||||
},
|
||||
{
|
||||
"code": "mu",
|
||||
"name": "Mauritius"
|
||||
},
|
||||
{
|
||||
"code": "yt",
|
||||
"name": "Mayotte"
|
||||
},
|
||||
{
|
||||
"code": "mx",
|
||||
"name": "Mexico"
|
||||
},
|
||||
{
|
||||
"code": "fm",
|
||||
"name": "Micronesia, Federated States Of"
|
||||
},
|
||||
{
|
||||
"code": "md",
|
||||
"name": "Moldova"
|
||||
},
|
||||
{
|
||||
"code": "mc",
|
||||
"name": "Monaco"
|
||||
},
|
||||
{
|
||||
"code": "mn",
|
||||
"name": "Mongolia"
|
||||
},
|
||||
{
|
||||
"code": "me",
|
||||
"name": "Montenegro"
|
||||
},
|
||||
{
|
||||
"code": "ms",
|
||||
"name": "Montserrat"
|
||||
},
|
||||
{
|
||||
"code": "ma",
|
||||
"name": "Morocco"
|
||||
},
|
||||
{
|
||||
"code": "mz",
|
||||
"name": "Mozambique"
|
||||
},
|
||||
{
|
||||
"code": "mm",
|
||||
"name": "Myanmar"
|
||||
},
|
||||
{
|
||||
"code": "na",
|
||||
"name": "Namibia"
|
||||
},
|
||||
{
|
||||
"code": "nr",
|
||||
"name": "Nauru"
|
||||
},
|
||||
{
|
||||
"code": "np",
|
||||
"name": "Nepal"
|
||||
},
|
||||
{
|
||||
"code": "nl",
|
||||
"name": "Netherlands"
|
||||
},
|
||||
{
|
||||
"code": "an",
|
||||
"name": "Netherlands Antilles"
|
||||
},
|
||||
{
|
||||
"code": "nc",
|
||||
"name": "New Caledonia"
|
||||
},
|
||||
{
|
||||
"code": "nz",
|
||||
"name": "New Zealand"
|
||||
},
|
||||
{
|
||||
"code": "ni",
|
||||
"name": "Nicaragua"
|
||||
},
|
||||
{
|
||||
"code": "ne",
|
||||
"name": "Niger"
|
||||
},
|
||||
{
|
||||
"code": "ng",
|
||||
"name": "Nigeria"
|
||||
},
|
||||
{
|
||||
"code": "nu",
|
||||
"name": "Niue"
|
||||
},
|
||||
{
|
||||
"code": "nf",
|
||||
"name": "Norfolk Island"
|
||||
},
|
||||
{
|
||||
"code": "mp",
|
||||
"name": "Northern Mariana Islands"
|
||||
},
|
||||
{
|
||||
"code": "no",
|
||||
"name": "Norway"
|
||||
},
|
||||
{
|
||||
"code": "om",
|
||||
"name": "Oman"
|
||||
},
|
||||
{
|
||||
"code": "pk",
|
||||
"name": "Pakistan"
|
||||
},
|
||||
{
|
||||
"code": "pw",
|
||||
"name": "Palau"
|
||||
},
|
||||
{
|
||||
"code": "ps",
|
||||
"name": "Palestinian Territory, Occupied"
|
||||
},
|
||||
{
|
||||
"code": "pa",
|
||||
"name": "Panama"
|
||||
},
|
||||
{
|
||||
"code": "pg",
|
||||
"name": "Papua New Guinea"
|
||||
},
|
||||
{
|
||||
"code": "py",
|
||||
"name": "Paraguay"
|
||||
},
|
||||
{
|
||||
"code": "pe",
|
||||
"name": "Peru"
|
||||
},
|
||||
{
|
||||
"code": "ph",
|
||||
"name": "Philippines"
|
||||
},
|
||||
{
|
||||
"code": "pn",
|
||||
"name": "Pitcairn"
|
||||
},
|
||||
{
|
||||
"code": "pl",
|
||||
"name": "Poland"
|
||||
},
|
||||
{
|
||||
"code": "pt",
|
||||
"name": "Portugal"
|
||||
},
|
||||
{
|
||||
"code": "pr",
|
||||
"name": "Puerto Rico"
|
||||
},
|
||||
{
|
||||
"code": "qa",
|
||||
"name": "Qatar"
|
||||
},
|
||||
{
|
||||
"code": "re",
|
||||
"name": "Reunion"
|
||||
},
|
||||
{
|
||||
"code": "ro",
|
||||
"name": "Romania"
|
||||
},
|
||||
{
|
||||
"code": "ru",
|
||||
"name": "Russian Federation"
|
||||
},
|
||||
{
|
||||
"code": "rw",
|
||||
"name": "Rwanda"
|
||||
},
|
||||
{
|
||||
"code": "bl",
|
||||
"name": "Saint Barthelemy"
|
||||
},
|
||||
{
|
||||
"code": "sh",
|
||||
"name": "Saint Helena"
|
||||
},
|
||||
{
|
||||
"code": "kn",
|
||||
"name": "Saint Kitts And Nevis"
|
||||
},
|
||||
{
|
||||
"code": "lc",
|
||||
"name": "Saint Lucia"
|
||||
},
|
||||
{
|
||||
"code": "mf",
|
||||
"name": "Saint Martin"
|
||||
},
|
||||
{
|
||||
"code": "pm",
|
||||
"name": "Saint Pierre And Miquelon"
|
||||
},
|
||||
{
|
||||
"code": "vc",
|
||||
"name": "Saint Vincent And Grenadines"
|
||||
},
|
||||
{
|
||||
"code": "ws",
|
||||
"name": "Samoa"
|
||||
},
|
||||
{
|
||||
"code": "sm",
|
||||
"name": "San Marino"
|
||||
},
|
||||
{
|
||||
"code": "st",
|
||||
"name": "Sao Tome And Principe"
|
||||
},
|
||||
{
|
||||
"code": "sa",
|
||||
"name": "Saudi Arabia"
|
||||
},
|
||||
{
|
||||
"code": "sn",
|
||||
"name": "Senegal"
|
||||
},
|
||||
{
|
||||
"code": "rs",
|
||||
"name": "Serbia"
|
||||
},
|
||||
{
|
||||
"code": "sc",
|
||||
"name": "Seychelles"
|
||||
},
|
||||
{
|
||||
"code": "sl",
|
||||
"name": "Sierra Leone"
|
||||
},
|
||||
{
|
||||
"code": "sg",
|
||||
"name": "Singapore"
|
||||
},
|
||||
{
|
||||
"code": "sk",
|
||||
"name": "Slovakia"
|
||||
},
|
||||
{
|
||||
"code": "si",
|
||||
"name": "Slovenia"
|
||||
},
|
||||
{
|
||||
"code": "sb",
|
||||
"name": "Solomon Islands"
|
||||
},
|
||||
{
|
||||
"code": "so",
|
||||
"name": "Somalia"
|
||||
},
|
||||
{
|
||||
"code": "za",
|
||||
"name": "South Africa"
|
||||
},
|
||||
{
|
||||
"code": "gs",
|
||||
"name": "South Georgia And Sandwich Isl."
|
||||
},
|
||||
{
|
||||
"code": "es",
|
||||
"name": "Spain"
|
||||
},
|
||||
{
|
||||
"code": "lk",
|
||||
"name": "Sri Lanka"
|
||||
},
|
||||
{
|
||||
"code": "sd",
|
||||
"name": "Sudan"
|
||||
},
|
||||
{
|
||||
"code": "sr",
|
||||
"name": "Suriname"
|
||||
},
|
||||
{
|
||||
"code": "sj",
|
||||
"name": "Svalbard And Jan Mayen"
|
||||
},
|
||||
{
|
||||
"code": "sz",
|
||||
"name": "Swaziland"
|
||||
},
|
||||
{
|
||||
"code": "se",
|
||||
"name": "Sweden"
|
||||
},
|
||||
{
|
||||
"code": "ch",
|
||||
"name": "Switzerland"
|
||||
},
|
||||
{
|
||||
"code": "sy",
|
||||
"name": "Syrian Arab Republic"
|
||||
},
|
||||
{
|
||||
"code": "tw",
|
||||
"name": "Taiwan"
|
||||
},
|
||||
{
|
||||
"code": "tj",
|
||||
"name": "Tajikistan"
|
||||
},
|
||||
{
|
||||
"code": "tz",
|
||||
"name": "Tanzania"
|
||||
},
|
||||
{
|
||||
"code": "th",
|
||||
"name": "Thailand"
|
||||
},
|
||||
{
|
||||
"code": "tl",
|
||||
"name": "Timor-Leste"
|
||||
},
|
||||
{
|
||||
"code": "tg",
|
||||
"name": "Togo"
|
||||
},
|
||||
{
|
||||
"code": "tk",
|
||||
"name": "Tokelau"
|
||||
},
|
||||
{
|
||||
"code": "to",
|
||||
"name": "Tonga"
|
||||
},
|
||||
{
|
||||
"code": "tt",
|
||||
"name": "Trinidad And Tobago"
|
||||
},
|
||||
{
|
||||
"code": "tn",
|
||||
"name": "Tunisia"
|
||||
},
|
||||
{
|
||||
"code": "tr",
|
||||
"name": "Turkey"
|
||||
},
|
||||
{
|
||||
"code": "tm",
|
||||
"name": "Turkmenistan"
|
||||
},
|
||||
{
|
||||
"code": "tc",
|
||||
"name": "Turks And Caicos Islands"
|
||||
},
|
||||
{
|
||||
"code": "tv",
|
||||
"name": "Tuvalu"
|
||||
},
|
||||
{
|
||||
"code": "ug",
|
||||
"name": "Uganda"
|
||||
},
|
||||
{
|
||||
"code": "ua",
|
||||
"name": "Ukraine"
|
||||
},
|
||||
{
|
||||
"code": "ae",
|
||||
"name": "United Arab Emirates"
|
||||
},
|
||||
{
|
||||
"code": "gb",
|
||||
"name": "United Kingdom"
|
||||
},
|
||||
{
|
||||
"code": "us",
|
||||
"name": "United States"
|
||||
},
|
||||
{
|
||||
"code": "um",
|
||||
"name": "United States Outlying Islands"
|
||||
},
|
||||
{
|
||||
"code": "uy",
|
||||
"name": "Uruguay"
|
||||
},
|
||||
{
|
||||
"code": "uz",
|
||||
"name": "Uzbekistan"
|
||||
},
|
||||
{
|
||||
"code": "vu",
|
||||
"name": "Vanuatu"
|
||||
},
|
||||
{
|
||||
"code": "ve",
|
||||
"name": "Venezuela"
|
||||
},
|
||||
{
|
||||
"code": "vn",
|
||||
"name": "Viet Nam"
|
||||
},
|
||||
{
|
||||
"code": "vg",
|
||||
"name": "Virgin Islands, British"
|
||||
},
|
||||
{
|
||||
"code": "vi",
|
||||
"name": "Virgin Islands, U.S."
|
||||
},
|
||||
{
|
||||
"code": "wf",
|
||||
"name": "Wallis And Futuna"
|
||||
},
|
||||
{
|
||||
"code": "eh",
|
||||
"name": "Western Sahara"
|
||||
},
|
||||
{
|
||||
"code": "ye",
|
||||
"name": "Yemen"
|
||||
},
|
||||
{
|
||||
"code": "zm",
|
||||
"name": "Zambia"
|
||||
},
|
||||
{
|
||||
"code": "zw",
|
||||
"name": "Zimbabwe"
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
module.exports = { isoCountries }
|
18
server/helpers/geolocation/index.js
Normal file
18
server/helpers/geolocation/index.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
const nominatim = require('../../../server/services/geocoding/nominatim')
|
||||
const photon = require('../../../server/services/geocoding/photon')
|
||||
|
||||
const geocodingProviders = [ nominatim, photon ]
|
||||
|
||||
const geolocation = {
|
||||
getGeocodingProvider(providerName) {
|
||||
let geocodingProvider
|
||||
geocodingProviders.forEach((item) => {
|
||||
if (item.commonName === providerName) {
|
||||
geocodingProvider = item
|
||||
}
|
||||
})
|
||||
return geocodingProvider
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = geolocation
|
987
server/helpers/geolocation/isoCountries.js
Normal file
987
server/helpers/geolocation/isoCountries.js
Normal file
|
@ -0,0 +1,987 @@
|
|||
// Iso conversions
|
||||
|
||||
var isoCountries = [
|
||||
{
|
||||
"code": "af",
|
||||
"name": "Afghanistan"
|
||||
},
|
||||
{
|
||||
"code": "ax",
|
||||
"name": "Aland Islands"
|
||||
},
|
||||
{
|
||||
"code": "al",
|
||||
"name": "Albania"
|
||||
},
|
||||
{
|
||||
"code": "dz",
|
||||
"name": "Algeria"
|
||||
},
|
||||
{
|
||||
"code": "as",
|
||||
"name": "American Samoa"
|
||||
},
|
||||
{
|
||||
"code": "ad",
|
||||
"name": "Andorra"
|
||||
},
|
||||
{
|
||||
"code": "ao",
|
||||
"name": "Angola"
|
||||
},
|
||||
{
|
||||
"code": "ai",
|
||||
"name": "Anguilla"
|
||||
},
|
||||
{
|
||||
"code": "aq",
|
||||
"name": "Antarctica"
|
||||
},
|
||||
{
|
||||
"code": "ag",
|
||||
"name": "Antigua And Barbuda"
|
||||
},
|
||||
{
|
||||
"code": "ar",
|
||||
"name": "Argentina"
|
||||
},
|
||||
{
|
||||
"code": "am",
|
||||
"name": "Armenia"
|
||||
},
|
||||
{
|
||||
"code": "aw",
|
||||
"name": "Aruba"
|
||||
},
|
||||
{
|
||||
"code": "au",
|
||||
"name": "Australia"
|
||||
},
|
||||
{
|
||||
"code": "at",
|
||||
"name": "Austria"
|
||||
},
|
||||
{
|
||||
"code": "az",
|
||||
"name": "Azerbaijan"
|
||||
},
|
||||
{
|
||||
"code": "bs",
|
||||
"name": "Bahamas"
|
||||
},
|
||||
{
|
||||
"code": "bh",
|
||||
"name": "Bahrain"
|
||||
},
|
||||
{
|
||||
"code": "bd",
|
||||
"name": "Bangladesh"
|
||||
},
|
||||
{
|
||||
"code": "bb",
|
||||
"name": "Barbados"
|
||||
},
|
||||
{
|
||||
"code": "by",
|
||||
"name": "Belarus"
|
||||
},
|
||||
{
|
||||
"code": "be",
|
||||
"name": "Belgium"
|
||||
},
|
||||
{
|
||||
"code": "bz",
|
||||
"name": "Belize"
|
||||
},
|
||||
{
|
||||
"code": "bj",
|
||||
"name": "Benin"
|
||||
},
|
||||
{
|
||||
"code": "bm",
|
||||
"name": "Bermuda"
|
||||
},
|
||||
{
|
||||
"code": "bt",
|
||||
"name": "Bhutan"
|
||||
},
|
||||
{
|
||||
"code": "bo",
|
||||
"name": "Bolivia"
|
||||
},
|
||||
{
|
||||
"code": "ba",
|
||||
"name": "Bosnia And Herzegovina"
|
||||
},
|
||||
{
|
||||
"code": "bw",
|
||||
"name": "Botswana"
|
||||
},
|
||||
{
|
||||
"code": "bv",
|
||||
"name": "Bouvet Island"
|
||||
},
|
||||
{
|
||||
"code": "br",
|
||||
"name": "Brazil"
|
||||
},
|
||||
{
|
||||
"code": "io",
|
||||
"name": "British Indian Ocean Territory"
|
||||
},
|
||||
{
|
||||
"code": "bn",
|
||||
"name": "Brunei Darussalam"
|
||||
},
|
||||
{
|
||||
"code": "bg",
|
||||
"name": "Bulgaria"
|
||||
},
|
||||
{
|
||||
"code": "bf",
|
||||
"name": "Burkina Faso"
|
||||
},
|
||||
{
|
||||
"code": "bi",
|
||||
"name": "Burundi"
|
||||
},
|
||||
{
|
||||
"code": "kh",
|
||||
"name": "Cambodia"
|
||||
},
|
||||
{
|
||||
"code": "cm",
|
||||
"name": "Cameroon"
|
||||
},
|
||||
{
|
||||
"code": "ca",
|
||||
"name": "Canada"
|
||||
},
|
||||
{
|
||||
"code": "cv",
|
||||
"name": "Cape Verde"
|
||||
},
|
||||
{
|
||||
"code": "ky",
|
||||
"name": "Cayman Islands"
|
||||
},
|
||||
{
|
||||
"code": "cf",
|
||||
"name": "Central African Republic"
|
||||
},
|
||||
{
|
||||
"code": "td",
|
||||
"name": "Chad"
|
||||
},
|
||||
{
|
||||
"code": "cl",
|
||||
"name": "Chile"
|
||||
},
|
||||
{
|
||||
"code": "cn",
|
||||
"name": "China"
|
||||
},
|
||||
{
|
||||
"code": "cx",
|
||||
"name": "Christmas Island"
|
||||
},
|
||||
{
|
||||
"code": "cc",
|
||||
"name": "Cocos (Keeling) Islands"
|
||||
},
|
||||
{
|
||||
"code": "co",
|
||||
"name": "Colombia"
|
||||
},
|
||||
{
|
||||
"code": "km",
|
||||
"name": "Comoros"
|
||||
},
|
||||
{
|
||||
"code": "cg",
|
||||
"name": "Congo"
|
||||
},
|
||||
{
|
||||
"code": "cd",
|
||||
"name": "Congo, Democratic Republic"
|
||||
},
|
||||
{
|
||||
"code": "ck",
|
||||
"name": "Cook Islands"
|
||||
},
|
||||
{
|
||||
"code": "cr",
|
||||
"name": "Costa Rica"
|
||||
},
|
||||
{
|
||||
"code": "ci",
|
||||
"name": "Cote D'Ivoire"
|
||||
},
|
||||
{
|
||||
"code": "hr",
|
||||
"name": "Croatia"
|
||||
},
|
||||
{
|
||||
"code": "cu",
|
||||
"name": "Cuba"
|
||||
},
|
||||
{
|
||||
"code": "cy",
|
||||
"name": "Cyprus"
|
||||
},
|
||||
{
|
||||
"code": "cz",
|
||||
"name": "Czech Republic"
|
||||
},
|
||||
{
|
||||
"code": "dk",
|
||||
"name": "Denmark"
|
||||
},
|
||||
{
|
||||
"code": "dj",
|
||||
"name": "Djibouti"
|
||||
},
|
||||
{
|
||||
"code": "dm",
|
||||
"name": "Dominica"
|
||||
},
|
||||
{
|
||||
"code": "do",
|
||||
"name": "Dominican Republic"
|
||||
},
|
||||
{
|
||||
"code": "ec",
|
||||
"name": "Ecuador"
|
||||
},
|
||||
{
|
||||
"code": "eg",
|
||||
"name": "Egypt"
|
||||
},
|
||||
{
|
||||
"code": "sv",
|
||||
"name": "El Salvador"
|
||||
},
|
||||
{
|
||||
"code": "gq",
|
||||
"name": "Equatorial Guinea"
|
||||
},
|
||||
{
|
||||
"code": "er",
|
||||
"name": "Eritrea"
|
||||
},
|
||||
{
|
||||
"code": "ee",
|
||||
"name": "Estonia"
|
||||
},
|
||||
{
|
||||
"code": "et",
|
||||
"name": "Ethiopia"
|
||||
},
|
||||
{
|
||||
"code": "fk",
|
||||
"name": "Falkland Islands (Malvinas)"
|
||||
},
|
||||
{
|
||||
"code": "fo",
|
||||
"name": "Faroe Islands"
|
||||
},
|
||||
{
|
||||
"code": "fj",
|
||||
"name": "Fiji"
|
||||
},
|
||||
{
|
||||
"code": "fi",
|
||||
"name": "Finland"
|
||||
},
|
||||
{
|
||||
"code": "fr",
|
||||
"name": "France"
|
||||
},
|
||||
{
|
||||
"code": "gf",
|
||||
"name": "French Guiana"
|
||||
},
|
||||
{
|
||||
"code": "pf",
|
||||
"name": "French Polynesia"
|
||||
},
|
||||
{
|
||||
"code": "tf",
|
||||
"name": "French Southern Territories"
|
||||
},
|
||||
{
|
||||
"code": "ga",
|
||||
"name": "Gabon"
|
||||
},
|
||||
{
|
||||
"code": "gm",
|
||||
"name": "Gambia"
|
||||
},
|
||||
{
|
||||
"code": "ge",
|
||||
"name": "Georgia"
|
||||
},
|
||||
{
|
||||
"code": "de",
|
||||
"name": "Germany"
|
||||
},
|
||||
{
|
||||
"code": "gh",
|
||||
"name": "Ghana"
|
||||
},
|
||||
{
|
||||
"code": "gi",
|
||||
"name": "Gibraltar"
|
||||
},
|
||||
{
|
||||
"code": "gr",
|
||||
"name": "Greece"
|
||||
},
|
||||
{
|
||||
"code": "gl",
|
||||
"name": "Greenland"
|
||||
},
|
||||
{
|
||||
"code": "gd",
|
||||
"name": "Grenada"
|
||||
},
|
||||
{
|
||||
"code": "gp",
|
||||
"name": "Guadeloupe"
|
||||
},
|
||||
{
|
||||
"code": "gu",
|
||||
"name": "Guam"
|
||||
},
|
||||
{
|
||||
"code": "gt",
|
||||
"name": "Guatemala"
|
||||
},
|
||||
{
|
||||
"code": "gg",
|
||||
"name": "Guernsey"
|
||||
},
|
||||
{
|
||||
"code": "gn",
|
||||
"name": "Guinea"
|
||||
},
|
||||
{
|
||||
"code": "gw",
|
||||
"name": "Guinea-Bissau"
|
||||
},
|
||||
{
|
||||
"code": "gy",
|
||||
"name": "Guyana"
|
||||
},
|
||||
{
|
||||
"code": "ht",
|
||||
"name": "Haiti"
|
||||
},
|
||||
{
|
||||
"code": "hm",
|
||||
"name": "Heard Island & Mcdonald Islands"
|
||||
},
|
||||
{
|
||||
"code": "va",
|
||||
"name": "Holy See (Vatican City State)"
|
||||
},
|
||||
{
|
||||
"code": "hn",
|
||||
"name": "Honduras"
|
||||
},
|
||||
{
|
||||
"code": "hk",
|
||||
"name": "Hong Kong"
|
||||
},
|
||||
{
|
||||
"code": "hu",
|
||||
"name": "Hungary"
|
||||
},
|
||||
{
|
||||
"code": "is",
|
||||
"name": "Iceland"
|
||||
},
|
||||
{
|
||||
"code": "in",
|
||||
"name": "India"
|
||||
},
|
||||
{
|
||||
"code": "id",
|
||||
"name": "Indonesia"
|
||||
},
|
||||
{
|
||||
"code": "ir",
|
||||
"name": "Iran, Islamic Republic Of"
|
||||
},
|
||||
{
|
||||
"code": "iq",
|
||||
"name": "Iraq"
|
||||
},
|
||||
{
|
||||
"code": "ie",
|
||||
"name": "Ireland"
|
||||
},
|
||||
{
|
||||
"code": "im",
|
||||
"name": "Isle Of Man"
|
||||
},
|
||||
{
|
||||
"code": "il",
|
||||
"name": "Israel"
|
||||
},
|
||||
{
|
||||
"code": "it",
|
||||
"name": "Italy"
|
||||
},
|
||||
{
|
||||
"code": "jm",
|
||||
"name": "Jamaica"
|
||||
},
|
||||
{
|
||||
"code": "jp",
|
||||
"name": "Japan"
|
||||
},
|
||||
{
|
||||
"code": "je",
|
||||
"name": "Jersey"
|
||||
},
|
||||
{
|
||||
"code": "jo",
|
||||
"name": "Jordan"
|
||||
},
|
||||
{
|
||||
"code": "kz",
|
||||
"name": "Kazakhstan"
|
||||
},
|
||||
{
|
||||
"code": "ke",
|
||||
"name": "Kenya"
|
||||
},
|
||||
{
|
||||
"code": "ki",
|
||||
"name": "Kiribati"
|
||||
},
|
||||
{
|
||||
"code": "kr",
|
||||
"name": "Korea"
|
||||
},
|
||||
{
|
||||
"code": "kw",
|
||||
"name": "Kuwait"
|
||||
},
|
||||
{
|
||||
"code": "kg",
|
||||
"name": "Kyrgyzstan"
|
||||
},
|
||||
{
|
||||
"code": "la",
|
||||
"name": "Lao People's Democratic Republic"
|
||||
},
|
||||
{
|
||||
"code": "lv",
|
||||
"name": "Latvia"
|
||||
},
|
||||
{
|
||||
"code": "lb",
|
||||
"name": "Lebanon"
|
||||
},
|
||||
{
|
||||
"code": "ls",
|
||||
"name": "Lesotho"
|
||||
},
|
||||
{
|
||||
"code": "lr",
|
||||
"name": "Liberia"
|
||||
},
|
||||
{
|
||||
"code": "ly",
|
||||
"name": "Libyan Arab Jamahiriya"
|
||||
},
|
||||
{
|
||||
"code": "li",
|
||||
"name": "Liechtenstein"
|
||||
},
|
||||
{
|
||||
"code": "lt",
|
||||
"name": "Lithuania"
|
||||
},
|
||||
{
|
||||
"code": "lu",
|
||||
"name": "Luxembourg"
|
||||
},
|
||||
{
|
||||
"code": "mo",
|
||||
"name": "Macao"
|
||||
},
|
||||
{
|
||||
"code": "mk",
|
||||
"name": "Macedonia"
|
||||
},
|
||||
{
|
||||
"code": "mg",
|
||||
"name": "Madagascar"
|
||||
},
|
||||
{
|
||||
"code": "mw",
|
||||
"name": "Malawi"
|
||||
},
|
||||
{
|
||||
"code": "my",
|
||||
"name": "Malaysia"
|
||||
},
|
||||
{
|
||||
"code": "mv",
|
||||
"name": "Maldives"
|
||||
},
|
||||
{
|
||||
"code": "ml",
|
||||
"name": "Mali"
|
||||
},
|
||||
{
|
||||
"code": "mt",
|
||||
"name": "Malta"
|
||||
},
|
||||
{
|
||||
"code": "mh",
|
||||
"name": "Marshall Islands"
|
||||
},
|
||||
{
|
||||
"code": "mq",
|
||||
"name": "Martinique"
|
||||
},
|
||||
{
|
||||
"code": "mr",
|
||||
"name": "Mauritania"
|
||||
},
|
||||
{
|
||||
"code": "mu",
|
||||
"name": "Mauritius"
|
||||
},
|
||||
{
|
||||
"code": "yt",
|
||||
"name": "Mayotte"
|
||||
},
|
||||
{
|
||||
"code": "mx",
|
||||
"name": "Mexico"
|
||||
},
|
||||
{
|
||||
"code": "fm",
|
||||
"name": "Micronesia, Federated States Of"
|
||||
},
|
||||
{
|
||||
"code": "md",
|
||||
"name": "Moldova"
|
||||
},
|
||||
{
|
||||
"code": "mc",
|
||||
"name": "Monaco"
|
||||
},
|
||||
{
|
||||
"code": "mn",
|
||||
"name": "Mongolia"
|
||||
},
|
||||
{
|
||||
"code": "me",
|
||||
"name": "Montenegro"
|
||||
},
|
||||
{
|
||||
"code": "ms",
|
||||
"name": "Montserrat"
|
||||
},
|
||||
{
|
||||
"code": "ma",
|
||||
"name": "Morocco"
|
||||
},
|
||||
{
|
||||
"code": "mz",
|
||||
"name": "Mozambique"
|
||||
},
|
||||
{
|
||||
"code": "mm",
|
||||
"name": "Myanmar"
|
||||
},
|
||||
{
|
||||
"code": "na",
|
||||
"name": "Namibia"
|
||||
},
|
||||
{
|
||||
"code": "nr",
|
||||
"name": "Nauru"
|
||||
},
|
||||
{
|
||||
"code": "np",
|
||||
"name": "Nepal"
|
||||
},
|
||||
{
|
||||
"code": "nl",
|
||||
"name": "Netherlands"
|
||||
},
|
||||
{
|
||||
"code": "an",
|
||||
"name": "Netherlands Antilles"
|
||||
},
|
||||
{
|
||||
"code": "nc",
|
||||
"name": "New Caledonia"
|
||||
},
|
||||
{
|
||||
"code": "nz",
|
||||
"name": "New Zealand"
|
||||
},
|
||||
{
|
||||
"code": "ni",
|
||||
"name": "Nicaragua"
|
||||
},
|
||||
{
|
||||
"code": "ne",
|
||||
"name": "Niger"
|
||||
},
|
||||
{
|
||||
"code": "ng",
|
||||
"name": "Nigeria"
|
||||
},
|
||||
{
|
||||
"code": "nu",
|
||||
"name": "Niue"
|
||||
},
|
||||
{
|
||||
"code": "nf",
|
||||
"name": "Norfolk Island"
|
||||
},
|
||||
{
|
||||
"code": "mp",
|
||||
"name": "Northern Mariana Islands"
|
||||
},
|
||||
{
|
||||
"code": "no",
|
||||
"name": "Norway"
|
||||
},
|
||||
{
|
||||
"code": "om",
|
||||
"name": "Oman"
|
||||
},
|
||||
{
|
||||
"code": "pk",
|
||||
"name": "Pakistan"
|
||||
},
|
||||
{
|
||||
"code": "pw",
|
||||
"name": "Palau"
|
||||
},
|
||||
{
|
||||
"code": "ps",
|
||||
"name": "Palestinian Territory, Occupied"
|
||||
},
|
||||
{
|
||||
"code": "pa",
|
||||
"name": "Panama"
|
||||
},
|
||||
{
|
||||
"code": "pg",
|
||||
"name": "Papua New Guinea"
|
||||
},
|
||||
{
|
||||
"code": "py",
|
||||
"name": "Paraguay"
|
||||
},
|
||||
{
|
||||
"code": "pe",
|
||||
"name": "Peru"
|
||||
},
|
||||
{
|
||||
"code": "ph",
|
||||
"name": "Philippines"
|
||||
},
|
||||
{
|
||||
"code": "pn",
|
||||
"name": "Pitcairn"
|
||||
},
|
||||
{
|
||||
"code": "pl",
|
||||
"name": "Poland"
|
||||
},
|
||||
{
|
||||
"code": "pt",
|
||||
"name": "Portugal"
|
||||
},
|
||||
{
|
||||
"code": "pr",
|
||||
"name": "Puerto Rico"
|
||||
},
|
||||
{
|
||||
"code": "qa",
|
||||
"name": "Qatar"
|
||||
},
|
||||
{
|
||||
"code": "re",
|
||||
"name": "Reunion"
|
||||
},
|
||||
{
|
||||
"code": "ro",
|
||||
"name": "Romania"
|
||||
},
|
||||
{
|
||||
"code": "ru",
|
||||
"name": "Russian Federation"
|
||||
},
|
||||
{
|
||||
"code": "rw",
|
||||
"name": "Rwanda"
|
||||
},
|
||||
{
|
||||
"code": "bl",
|
||||
"name": "Saint Barthelemy"
|
||||
},
|
||||
{
|
||||
"code": "sh",
|
||||
"name": "Saint Helena"
|
||||
},
|
||||
{
|
||||
"code": "kn",
|
||||
"name": "Saint Kitts And Nevis"
|
||||
},
|
||||
{
|
||||
"code": "lc",
|
||||
"name": "Saint Lucia"
|
||||
},
|
||||
{
|
||||
"code": "mf",
|
||||
"name": "Saint Martin"
|
||||
},
|
||||
{
|
||||
"code": "pm",
|
||||
"name": "Saint Pierre And Miquelon"
|
||||
},
|
||||
{
|
||||
"code": "vc",
|
||||
"name": "Saint Vincent And Grenadines"
|
||||
},
|
||||
{
|
||||
"code": "ws",
|
||||
"name": "Samoa"
|
||||
},
|
||||
{
|
||||
"code": "sm",
|
||||
"name": "San Marino"
|
||||
},
|
||||
{
|
||||
"code": "st",
|
||||
"name": "Sao Tome And Principe"
|
||||
},
|
||||
{
|
||||
"code": "sa",
|
||||
"name": "Saudi Arabia"
|
||||
},
|
||||
{
|
||||
"code": "sn",
|
||||
"name": "Senegal"
|
||||
},
|
||||
{
|
||||
"code": "rs",
|
||||
"name": "Serbia"
|
||||
},
|
||||
{
|
||||
"code": "sc",
|
||||
"name": "Seychelles"
|
||||
},
|
||||
{
|
||||
"code": "sl",
|
||||
"name": "Sierra Leone"
|
||||
},
|
||||
{
|
||||
"code": "sg",
|
||||
"name": "Singapore"
|
||||
},
|
||||
{
|
||||
"code": "sk",
|
||||
"name": "Slovakia"
|
||||
},
|
||||
{
|
||||
"code": "si",
|
||||
"name": "Slovenia"
|
||||
},
|
||||
{
|
||||
"code": "sb",
|
||||
"name": "Solomon Islands"
|
||||
},
|
||||
{
|
||||
"code": "so",
|
||||
"name": "Somalia"
|
||||
},
|
||||
{
|
||||
"code": "za",
|
||||
"name": "South Africa"
|
||||
},
|
||||
{
|
||||
"code": "gs",
|
||||
"name": "South Georgia And Sandwich Isl."
|
||||
},
|
||||
{
|
||||
"code": "es",
|
||||
"name": "Spain"
|
||||
},
|
||||
{
|
||||
"code": "lk",
|
||||
"name": "Sri Lanka"
|
||||
},
|
||||
{
|
||||
"code": "sd",
|
||||
"name": "Sudan"
|
||||
},
|
||||
{
|
||||
"code": "sr",
|
||||
"name": "Suriname"
|
||||
},
|
||||
{
|
||||
"code": "sj",
|
||||
"name": "Svalbard And Jan Mayen"
|
||||
},
|
||||
{
|
||||
"code": "sz",
|
||||
"name": "Swaziland"
|
||||
},
|
||||
{
|
||||
"code": "se",
|
||||
"name": "Sweden"
|
||||
},
|
||||
{
|
||||
"code": "ch",
|
||||
"name": "Switzerland"
|
||||
},
|
||||
{
|
||||
"code": "sy",
|
||||
"name": "Syrian Arab Republic"
|
||||
},
|
||||
{
|
||||
"code": "tw",
|
||||
"name": "Taiwan"
|
||||
},
|
||||
{
|
||||
"code": "tj",
|
||||
"name": "Tajikistan"
|
||||
},
|
||||
{
|
||||
"code": "tz",
|
||||
"name": "Tanzania"
|
||||
},
|
||||
{
|
||||
"code": "th",
|
||||
"name": "Thailand"
|
||||
},
|
||||
{
|
||||
"code": "tl",
|
||||
"name": "Timor-Leste"
|
||||
},
|
||||
{
|
||||
"code": "tg",
|
||||
"name": "Togo"
|
||||
},
|
||||
{
|
||||
"code": "tk",
|
||||
"name": "Tokelau"
|
||||
},
|
||||
{
|
||||
"code": "to",
|
||||
"name": "Tonga"
|
||||
},
|
||||
{
|
||||
"code": "tt",
|
||||
"name": "Trinidad And Tobago"
|
||||
},
|
||||
{
|
||||
"code": "tn",
|
||||
"name": "Tunisia"
|
||||
},
|
||||
{
|
||||
"code": "tr",
|
||||
"name": "Turkey"
|
||||
},
|
||||
{
|
||||
"code": "tm",
|
||||
"name": "Turkmenistan"
|
||||
},
|
||||
{
|
||||
"code": "tc",
|
||||
"name": "Turks And Caicos Islands"
|
||||
},
|
||||
{
|
||||
"code": "tv",
|
||||
"name": "Tuvalu"
|
||||
},
|
||||
{
|
||||
"code": "ug",
|
||||
"name": "Uganda"
|
||||
},
|
||||
{
|
||||
"code": "ua",
|
||||
"name": "Ukraine"
|
||||
},
|
||||
{
|
||||
"code": "ae",
|
||||
"name": "United Arab Emirates"
|
||||
},
|
||||
{
|
||||
"code": "gb",
|
||||
"name": "United Kingdom"
|
||||
},
|
||||
{
|
||||
"code": "us",
|
||||
"name": "United States"
|
||||
},
|
||||
{
|
||||
"code": "um",
|
||||
"name": "United States Outlying Islands"
|
||||
},
|
||||
{
|
||||
"code": "uy",
|
||||
"name": "Uruguay"
|
||||
},
|
||||
{
|
||||
"code": "uz",
|
||||
"name": "Uzbekistan"
|
||||
},
|
||||
{
|
||||
"code": "vu",
|
||||
"name": "Vanuatu"
|
||||
},
|
||||
{
|
||||
"code": "ve",
|
||||
"name": "Venezuela"
|
||||
},
|
||||
{
|
||||
"code": "vn",
|
||||
"name": "Viet Nam"
|
||||
},
|
||||
{
|
||||
"code": "vg",
|
||||
"name": "Virgin Islands, British"
|
||||
},
|
||||
{
|
||||
"code": "vi",
|
||||
"name": "Virgin Islands, U.S."
|
||||
},
|
||||
{
|
||||
"code": "wf",
|
||||
"name": "Wallis And Futuna"
|
||||
},
|
||||
{
|
||||
"code": "eh",
|
||||
"name": "Western Sahara"
|
||||
},
|
||||
{
|
||||
"code": "ye",
|
||||
"name": "Yemen"
|
||||
},
|
||||
{
|
||||
"code": "zm",
|
||||
"name": "Zambia"
|
||||
},
|
||||
{
|
||||
"code": "zw",
|
||||
"name": "Zimbabwe"
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
module.exports = { isoCountries }
|
29
server/migrations/20221215110244-online_locations.js
Normal file
29
server/migrations/20221215110244-online_locations.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
async up (queryInterface, Sequelize) {
|
||||
/**
|
||||
* Add altering commands here.
|
||||
*
|
||||
* Example:
|
||||
* await queryInterface.createTable('users', { id: Sequelize.INTEGER });
|
||||
*/
|
||||
return Promise.all(
|
||||
[
|
||||
await queryInterface.addColumn('events', 'online_locations', { type: Sequelize.JSON }),
|
||||
])
|
||||
},
|
||||
|
||||
async down (queryInterface, Sequelize) {
|
||||
/**
|
||||
* Add reverting commands here.
|
||||
*
|
||||
* Example:
|
||||
* await queryInterface.dropTable('users');
|
||||
*/
|
||||
return Promise.all(
|
||||
[
|
||||
await queryInterface.removeColumn('events', 'online_locations'),
|
||||
])
|
||||
}
|
||||
};
|
|
@ -1,5 +1,6 @@
|
|||
const cache = require('memory-cache')
|
||||
const providerCache = new cache.Cache()
|
||||
const get = require('lodash/get')
|
||||
|
||||
const nominatim = {
|
||||
commonName: 'Nominatim',
|
||||
|
@ -23,6 +24,47 @@ const nominatim = {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Icons to nominatim `osm_type` and `class` conversion
|
||||
*/
|
||||
searchIcons_nominatim_osm_type: {
|
||||
way: 'mdiRoadVariant',
|
||||
house: 'mdiHome',
|
||||
node: 'mdiMapMarker',
|
||||
relation: 'mdiCityVariant',
|
||||
},
|
||||
searchIcons_nominatim_class: ['place', 'amenity', 'shop', 'tourism', 'leisure', 'building'],
|
||||
|
||||
loadResultIcon (item) {
|
||||
if (this.searchIcons_nominatim_class.includes(item.class)) {
|
||||
return 'mdiHome'
|
||||
}
|
||||
return this.searchIcons_nominatim_osm_type[item.type]
|
||||
},
|
||||
|
||||
/**
|
||||
* Map results from provider
|
||||
*/
|
||||
filterNameFromAddress: ['place', 'amenity', 'shop', 'tourism', 'leisure', 'building'],
|
||||
|
||||
mapQueryResults (ret, addressList = []) {
|
||||
if (ret && ret.length) {
|
||||
addressList = ret.map(v => {
|
||||
const name = get(v.namedetails, 'alt_name', get(v.namedetails, 'name'))
|
||||
const address = this.filterNameFromAddress.includes(v.class) ? v.display_name.replace(name, '').replace(/^, ?/, '') : v.display_name.replace(/^, ?/, '')
|
||||
return {
|
||||
class: v.class,
|
||||
type: v.osm_type,
|
||||
lat: v.lat,
|
||||
lon: v.lon,
|
||||
name,
|
||||
address
|
||||
}
|
||||
})
|
||||
}
|
||||
return addressList
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = nominatim
|
|
@ -16,6 +16,58 @@ const photon = {
|
|||
q: details,
|
||||
limit: 3,
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Icons to nominatim `osm_type` and `class` conversion
|
||||
*/
|
||||
searchIcons_nominatim_osm_type: {
|
||||
'W': 'mdiRoadVariant',
|
||||
'N': 'mdiMapMarker',
|
||||
'R': 'mdiCityVariant',
|
||||
},
|
||||
searchIcons_nominatim_class: ['amenity', 'shop', 'tourism', 'leisure', 'building'],
|
||||
|
||||
loadResultIcon (item) {
|
||||
if (this.searchIcons_nominatim_class.includes(item.class)) {
|
||||
return 'mdiHome'
|
||||
}
|
||||
return this.searchIcons_nominatim_osm_type[item.type]
|
||||
},
|
||||
|
||||
/**
|
||||
* Map results from provider
|
||||
*/
|
||||
fullAddressMapping: ['housenumber', 'street', 'locality', 'district', 'city', 'county', 'state', 'postcode', 'country'],
|
||||
|
||||
mapQueryResults(ret, addressList = []) {
|
||||
if (ret) {
|
||||
addressList = ret.features.map(v => {
|
||||
let pre_name = v.properties.name || v.properties.street || ''
|
||||
let pre_address = ''
|
||||
|
||||
this.fullAddressMapping.forEach((item, i) => {
|
||||
let last = i == (this.fullAddressMapping.length - 1)
|
||||
if (v.properties[item] && !last) {
|
||||
pre_address += v.properties[item]+', '
|
||||
} else if (v.properties[item]) {
|
||||
pre_address += v.properties[item]
|
||||
}
|
||||
});
|
||||
|
||||
let name = pre_name
|
||||
let address = pre_address
|
||||
return {
|
||||
class: v.properties.osm_key,
|
||||
type: v.properties.osm_type,
|
||||
lat: v.geometry.coordinates[1],
|
||||
lon: v.geometry.coordinates[0],
|
||||
name,
|
||||
address
|
||||
}
|
||||
})
|
||||
}
|
||||
return addressList
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,8 +10,9 @@ export const state = () => ({
|
|||
allow_anon_event: true,
|
||||
allow_multidate_event: true,
|
||||
allow_recurrent_event: true,
|
||||
recurrent_event_visible: false,
|
||||
allow_online_event: true,
|
||||
allow_geolocation: false,
|
||||
recurrent_event_visible: false,
|
||||
geocoding_provider_type: '',
|
||||
geocoding_provider: '',
|
||||
geocoding_countrycodes: [],
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
</div>
|
||||
<span class="place"
|
||||
>@{event.place.name}
|
||||
<span class="subtitle"> {event.place.address}</span></span
|
||||
{#if event.place.name!=="online"}<span class="subtitle"> {event.place.address}</span>{/if}</span
|
||||
>
|
||||
{#if event.tags.length}
|
||||
<div class="tags">
|
||||
|
|
|
@ -12979,10 +12979,8 @@ watchpack@^1.7.4:
|
|||
resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.7.5.tgz#1267e6c55e0b9b5be44c2023aed5437a2c26c453"
|
||||
integrity sha512-9P3MWk6SrKjHsGkLT2KHXdQ/9SNkyoJbabxnKOoJepsvJjJG8uYTR3yTPxPQvNDI3w4Nz1xnE0TLHK4RIVe/MQ==
|
||||
dependencies:
|
||||
chokidar "^3.4.1"
|
||||
graceful-fs "^4.1.2"
|
||||
neo-async "^2.5.0"
|
||||
watchpack-chokidar2 "^2.0.1"
|
||||
optionalDependencies:
|
||||
chokidar "^3.4.1"
|
||||
watchpack-chokidar2 "^2.0.1"
|
||||
|
|
Loading…
Reference in a new issue