Skip to content

Commit

Permalink
Add location field to favorites form
Browse files Browse the repository at this point in the history
Signed-off-by: Alaskan Puffin <alaskanpuffin@protonmail.com>
  • Loading branch information
alaskanpuffin committed Jun 30, 2023
1 parent 7c44a4e commit 2b1a287
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/components/FavoriteEditionForm.vue
Expand Up @@ -43,6 +43,12 @@
:placeholder="commentPH"
:readonly="!favorite.isUpdateable"
rows="1" />
<span class="icon icon-address" />
<input
v-model="location"
type="text"
:placeholder="locationPH"
:readonly="!favorite.isUpdateable">
</div>
<div class="buttons">
<NcButton
Expand Down Expand Up @@ -92,9 +98,12 @@ export default {
name: this.favorite.name,
category: this.favorite.category,
comment: this.favorite.comment,
lat: this.favorite.lat,
lng: this.favorite.lng,
namePH: t('maps', 'Favorite name'),
categoryPH: t('maps', 'Category'),
commentPH: t('maps', 'Comment'),
locationPH: t('maps', 'Location'),
newCategoryOption: null,
selectedCategory: {
label: this.favorite.category,
Expand All @@ -117,6 +126,16 @@ export default {
? [this.newCategoryOption, ...categoryOptions]
: categoryOptions
},
location: {
get() {
return `${this.lat},${this.lng}`
},
set(value) {
const [lat, lng] = value.split(',')
this.lat = lat
this.lng = lng
},
},
},
watch: {
Expand All @@ -139,6 +158,8 @@ export default {
multiselectKey: this.favorite.category,
}
this.comment = this.favorite.comment
this.lat = this.favorite.lat
this.lng = this.favorite.lng
},
onSearchChange(query) {
if (query === '' || Object.keys(this.categories).includes(query)) {
Expand All @@ -160,6 +181,8 @@ export default {
name: this.name,
category: this.category,
comment: this.comment,
lat: this.lat,
lng: this.lng,
}
this.$emit('edit', editedFav)
},
Expand Down

0 comments on commit 2b1a287

Please sign in to comment.