From b7592ec85b8fc04678b39263e744308d00da883a Mon Sep 17 00:00:00 2001 From: Remko Date: Wed, 13 Nov 2024 14:32:21 +0100 Subject: [PATCH 1/3] cleanup --- src/modals/klanten/EditKlant.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modals/klanten/EditKlant.vue b/src/modals/klanten/EditKlant.vue index e7c2cdd..8368e47 100644 --- a/src/modals/klanten/EditKlant.vue +++ b/src/modals/klanten/EditKlant.vue @@ -190,7 +190,7 @@ export default { updated() { if (navigationStore.modal === 'editKlant' && !this.hasUpdated) { - const klantType = this.typeOptions.options.find((option) => option.value === klantStore.klantItem.type) + const klantType = this.typeOptions.options.find((option) => option.value === klantStore.klantItem?.type) if (klantStore.klantItem?.id) { this.klantItem = { From 1e9dcc6d2dd72cd29b7ef763e2f67e8266aa6ddc Mon Sep 17 00:00:00 2001 From: Remko Date: Wed, 13 Nov 2024 14:59:07 +0100 Subject: [PATCH 2/3] Updated search bar --- src/sidebars/search/SearchSideBar.vue | 214 +++++++++++++++++++++++--- 1 file changed, 193 insertions(+), 21 deletions(-) diff --git a/src/sidebars/search/SearchSideBar.vue b/src/sidebars/search/SearchSideBar.vue index 498fd70..b6c8003 100644 --- a/src/sidebars/search/SearchSideBar.vue +++ b/src/sidebars/search/SearchSideBar.vue @@ -1,21 +1,70 @@ @@ -124,7 +222,9 @@ import { NcCheckboxRadioSwitch, NcListItem, NcActionButton, + NcLoadingIcon, } from '@nextcloud/vue' +import _ from 'lodash' import Magnify from 'vue-material-design-icons/Magnify.vue' import AccountGroupOutline from 'vue-material-design-icons/AccountGroupOutline.vue' import OfficeBuildingOutline from 'vue-material-design-icons/OfficeBuildingOutline.vue' @@ -142,6 +242,7 @@ export default { NcCheckboxRadioSwitch, NcListItem, NcActionButton, + NcLoadingIcon, // Icons Magnify, AccountGroupOutline, @@ -150,16 +251,31 @@ export default { data() { return { starred: false, + loading: false, + personenLoading: false, + organisatiesLoading: false, klantenSearch: '', + personenSearch: '', + organisatiesSearch: '', klantenSearchType: 'voornaam', klantenList: [], debouncedFetchKlanten: null, // this is a function + activeTab: 'search-tab', } }, watch: { klantenSearch() { this.debouncedFetchKlanten() }, + personenSearch() { + this.debouncedFetchKlanten() + }, + organisatiesSearch() { + this.debouncedFetchKlanten() + }, + activeTab() { + this.fetchKlanten() + }, }, mounted() { this.fetchKlanten() @@ -176,9 +292,48 @@ export default { timer = setTimeout(() => { func.apply(this, args) }, timeout) } }, + getName(klant) { + if (klant.type === 'persoon') { + return klant?.voornaam ?? 'onbekend' + } + if (klant.type === 'organisatie') { + return klant?.bedrijfsnaam ?? 'onbekend' + } + return 'onbekend' + }, + getSubname(klant) { + if (klant.type === 'persoon') { + return klant?.voorvoegsel ? `${klant.voorvoegsel} ${klant.achternaam}` : klant?.achternaam ? `${klant.achternaam}` : 'onbekend' + } + if (klant.type === 'organisatie') { + return klant?.websiteUrl ?? 'onbekend' + } + return 'onbekend' + }, fetchKlanten() { + this.loading = true + let activeFilter = null + let searchParam = null + + switch (this.activeTab) { + case 'personen-tab': + activeFilter = 'persoon' + searchParam = this.personenSearch + this.personenLoading = true + break + case 'organisaties-tab': + activeFilter = 'organisatie' + searchParam = this.organisatiesSearch + this.organisatiesLoading = true + break + default: + searchParam = this.klantenSearch + break + } + const searchParams = new URLSearchParams({ - ...(this.klantenSearch && { [this.klantenSearchType]: this.klantenSearch }), + ...(searchParam && { [this.klantenSearchType]: searchParam }), + ...(activeFilter && { type: activeFilter }), }).toString() fetch(`/index.php/apps/zaakafhandelapp/api/klanten?${searchParams}`) @@ -186,6 +341,23 @@ export default { .then(data => { this.klantenList = data?.results || [] }) + .finally(() => { + switch (this.activeTab) { + case 'personen-tab': + this.personenLoading = false + this.loading = false + + break + case 'organisaties-tab': + this.organisatiesLoading = false + this.loading = false + + break + default: + this.loading = false + break + } + }) }, }, } From 52f48dc22e7cc980a758ca3e94ffb9c041dc5d13 Mon Sep 17 00:00:00 2001 From: Remko Date: Wed, 13 Nov 2024 16:18:54 +0100 Subject: [PATCH 3/3] Added taken modal on widget --- src/modals/berichten/EditBericht.vue | 1 - src/modals/taken/EditTaak.vue | 65 +++++++++++++++++--- src/sidebars/search/SearchSideBar.vue | 2 +- src/store/modules/taak.js | 6 +- src/views/klanten/KlantenList.vue | 2 +- src/views/taken/TaakDetails.vue | 66 +++++++++++++++++++-- src/views/widgets/ContactMomentenWidget.vue | 3 +- src/views/widgets/PersonenWidget.vue | 4 +- src/views/widgets/TakenWidget.vue | 20 +++++-- 9 files changed, 144 insertions(+), 25 deletions(-) diff --git a/src/modals/berichten/EditBericht.vue b/src/modals/berichten/EditBericht.vue index 5233077..5c44d87 100644 --- a/src/modals/berichten/EditBericht.vue +++ b/src/modals/berichten/EditBericht.vue @@ -197,7 +197,6 @@ export default { setTimeout(() => { this.closeModal() }, 300) - }, closeModal() { navigationStore.setModal(false) diff --git a/src/modals/taken/EditTaak.vue b/src/modals/taken/EditTaak.vue index 3c6990d..06b9a75 100644 --- a/src/modals/taken/EditTaak.vue +++ b/src/modals/taken/EditTaak.vue @@ -6,7 +6,7 @@ import { taakStore, navigationStore, klantStore } from '../../store/store.js' + @closing="closeModalFromButton()">

Taak succesvol aangepast

@@ -18,6 +18,7 @@ import { taakStore, navigationStore, klantStore } from '../../store/store.js' @@ -45,10 +46,12 @@ import { taakStore, navigationStore, klantStore } from '../../store/store.js' :value.sync="taakItem.toelichting" label="Toelichting" /> - +