From 0891acce1d89476c6ee1c9299bc79819fca07332 Mon Sep 17 00:00:00 2001 From: lesion Date: Mon, 9 Jan 2023 17:02:15 +0100 Subject: [PATCH] refactoring search, filtering, selection, fix #225 #227 #224 --- components/NavSearch.vue | 64 ++++++++++++---- components/WhereInput.vue | 7 +- locales/en.json | 1 + pages/add/_edit.vue | 3 +- pages/index.vue | 52 +++++++------ plugins/api.js | 11 ++- server/api/controller/event.js | 131 +++++++++++++++++++-------------- server/api/index.js | 3 +- store/index.js | 17 ++++- 9 files changed, 187 insertions(+), 102 deletions(-) diff --git a/components/NavSearch.vue b/components/NavSearch.vue index 05b9e292..9eaf2973 100644 --- a/components/NavSearch.vue +++ b/components/NavSearch.vue @@ -1,20 +1,51 @@ \ No newline at end of file + diff --git a/components/WhereInput.vue b/components/WhereInput.vue index 1b41a0ee..75eb3615 100644 --- a/components/WhereInput.vue +++ b/components/WhereInput.vue @@ -125,9 +125,14 @@ export default { return matches } }, + mounted () { + this.$nextTick( () => { + this.search() + }) + }, methods: { search: debounce(async function(ev) { - const search = ev.target.value.trim().toLowerCase() + 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 } const matches = this.places.find(p => search === p.name.toLocaleLowerCase()) diff --git a/locales/en.json b/locales/en.json index cc9756c5..ae87414a 100644 --- a/locales/en.json +++ b/locales/en.json @@ -147,6 +147,7 @@ "recurrent": "Recurring", "edit_recurrent": "Edit recurring event:", "show_recurrent": "recurring events", + "show_multidate": "multidate events", "show_past": "also prior events", "only_future": "only upcoming events", "recurrent_description": "Choose frequency and select days", diff --git a/pages/add/_edit.vue b/pages/add/_edit.vue index 5c58d976..8132de1a 100644 --- a/pages/add/_edit.vue +++ b/pages/add/_edit.vue @@ -179,7 +179,6 @@ export default { filteredTags() { if (!this.tagName) { return this.tags.slice(0, 10).map(t => t.tag) } const tagName = this.tagName.trim().toLowerCase() - console.log(tagName) return this.tags.filter(t => t.tag.toLowerCase().includes(tagName)).map(t => t.tag) } }, @@ -245,6 +244,8 @@ export default { if (this.date.dueHour) { [hour, minute] = this.date.dueHour.split(':') formData.append('end_datetime', dayjs(this.date.due).hour(Number(hour)).minute(Number(minute)).second(0).unix()) + } else if (!!this.date.multidate) { + formData.append('end_datetime', dayjs(this.date.due).hour(24).minute(0).second(0).unix()) } if (this.edit) { diff --git a/pages/index.vue b/pages/index.vue index b127c77a..33e1dac6 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1,6 +1,5 @@