From 9a2efd7ebd9b819d3c6487b5b0bb663345b0d8c4 Mon Sep 17 00:00:00 2001 From: Remko Date: Wed, 13 Nov 2024 13:58:06 +0100 Subject: [PATCH 1/3] Added personen and organisaties widgets --- lib/AppInfo/Application.php | 4 + lib/Dashboard/OrganisatiesWidget.php | 69 ++++++++++ lib/Dashboard/PersonenWidget.php | 69 ++++++++++ package-lock.json | 2 +- package.json | 3 +- src/entities/klanten/klanten.mock.ts | 1 + src/entities/klanten/klanten.ts | 4 +- src/entities/klanten/klanten.types.ts | 3 + src/modals/klanten/EditKlant.vue | 24 +++- src/organisatiesWidget.js | 10 ++ src/personenWidget.js | 10 ++ src/store/modules/klanten.js | 53 ++++++++ src/views/klanten/KlantenList.vue | 28 +++- src/views/widgets/ContactMomentenWidget.vue | 5 +- src/views/widgets/OpenZakenWidget.vue | 5 +- src/views/widgets/OrganisatiesWidget.vue | 135 +++++++++++++++++++ src/views/widgets/PersonenWidget.vue | 137 ++++++++++++++++++++ src/views/widgets/TakenWidget.vue | 5 +- src/views/widgets/ZakenWidget.vue | 12 +- webpack.config.js | 8 ++ 20 files changed, 570 insertions(+), 17 deletions(-) create mode 100644 lib/Dashboard/OrganisatiesWidget.php create mode 100644 lib/Dashboard/PersonenWidget.php create mode 100644 src/organisatiesWidget.js create mode 100644 src/personenWidget.js create mode 100644 src/views/widgets/OrganisatiesWidget.vue create mode 100644 src/views/widgets/PersonenWidget.vue diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index d7857d7..dfe6f4f 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -10,6 +10,8 @@ use OCA\ZaakAfhandelApp\Dashboard\TakenWidget; use OCA\ZaakAfhandelApp\Dashboard\OpenZakenWidget; use OCA\ZaakAfhandelApp\Dashboard\ContactmomentenWidget; +use OCA\ZaakAfhandelApp\Dashboard\PersonenWidget; +use OCA\ZaakAfhandelApp\Dashboard\OrganisatiesWidget; /** * Class Application @@ -36,6 +38,8 @@ public function register(IRegistrationContext $context): void $context->registerDashboardWidget(TakenWidget::class); $context->registerDashboardWidget(OpenZakenWidget::class); $context->registerDashboardWidget(ContactmomentenWidget::class); + $context->registerDashboardWidget(PersonenWidget::class); + $context->registerDashboardWidget(OrganisatiesWidget::class); } public function boot(IBootContext $context): void diff --git a/lib/Dashboard/OrganisatiesWidget.php b/lib/Dashboard/OrganisatiesWidget.php new file mode 100644 index 0000000..4ca9e72 --- /dev/null +++ b/lib/Dashboard/OrganisatiesWidget.php @@ -0,0 +1,69 @@ +l10n->t('Organisaties zoeken'); + } + + /** + * @inheritDoc + */ + public function getOrder(): int + { + return 10; + } + + /** + * @inheritDoc + */ + public function getIconClass(): string + { + return 'icon-zaken-widget'; + } + + /** + * @inheritDoc + */ + public function getUrl(): ?string + { + return null; + } + + /** + * @inheritDoc + */ + public function load(): void + { + Util::addScript(Application::APP_ID, Application::APP_ID . '-organisatiesWidget'); + Util::addStyle(Application::APP_ID, 'dashboardWidgets'); + } +} diff --git a/lib/Dashboard/PersonenWidget.php b/lib/Dashboard/PersonenWidget.php new file mode 100644 index 0000000..2b9ffcb --- /dev/null +++ b/lib/Dashboard/PersonenWidget.php @@ -0,0 +1,69 @@ +l10n->t('Personen zoeken'); + } + + /** + * @inheritDoc + */ + public function getOrder(): int + { + return 10; + } + + /** + * @inheritDoc + */ + public function getIconClass(): string + { + return 'icon-zaken-widget'; + } + + /** + * @inheritDoc + */ + public function getUrl(): ?string + { + return null; + } + + /** + * @inheritDoc + */ + public function load(): void + { + Util::addScript(Application::APP_ID, Application::APP_ID . '-personenWidget'); + Util::addStyle(Application::APP_ID, 'dashboardWidgets'); + } +} diff --git a/package-lock.json b/package-lock.json index b0938d8..6159537 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "@nextcloud/router": "^2.0.1", "@nextcloud/vue": "^8.12.0", "bootstrap-vue": "^2.23.1", + "lodash": "^4.17.21", "pinia": "^2.2.4", "vue": "^2.7.14", "vue-loading-overlay": "^3.4.3", @@ -15261,7 +15262,6 @@ "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true, "license": "MIT" }, "node_modules/lodash.debounce": { diff --git a/package.json b/package.json index ce027b2..88ee6e6 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "@nextcloud/router": "^2.0.1", "@nextcloud/vue": "^8.12.0", "bootstrap-vue": "^2.23.1", + "lodash": "^4.17.21", "pinia": "^2.2.4", "vue": "^2.7.14", "vue-loading-overlay": "^3.4.3", @@ -53,4 +54,4 @@ "typescript": "^5.5.4", "vue-jest": "^3.0.7" } -} \ No newline at end of file +} diff --git a/src/entities/klanten/klanten.mock.ts b/src/entities/klanten/klanten.mock.ts index f9fffe7..b48e1eb 100644 --- a/src/entities/klanten/klanten.mock.ts +++ b/src/entities/klanten/klanten.mock.ts @@ -4,6 +4,7 @@ import { TKlant } from './klanten.types' export const mockKlantData = (): TKlant[] => [ { id: '15551d6f-44e3-43f3-a9d2-59e583c91eb0', + type: 'persoon', voornaam: 'John', tussenvoegsel: 'de', achternaam: 'Doe', diff --git a/src/entities/klanten/klanten.ts b/src/entities/klanten/klanten.ts index cbc95ad..ef71d14 100644 --- a/src/entities/klanten/klanten.ts +++ b/src/entities/klanten/klanten.ts @@ -1,9 +1,10 @@ import { SafeParseReturnType, z } from 'zod' -import { TKlant } from './klanten.types' +import { TKlant, TKlantType } from './klanten.types' export class Klant implements TKlant { public id: string + public type: TKlantType public voornaam: string public tussenvoegsel: string public achternaam: string @@ -22,6 +23,7 @@ export class Klant implements TKlant { constructor(source: TKlant) { this.id = source.id || '' + this.type = source.type || 'persoon' this.voornaam = source.voornaam || '' this.tussenvoegsel = source.tussenvoegsel || '' this.achternaam = source.achternaam || '' diff --git a/src/entities/klanten/klanten.types.ts b/src/entities/klanten/klanten.types.ts index 68b00ce..5f21bac 100644 --- a/src/entities/klanten/klanten.types.ts +++ b/src/entities/klanten/klanten.types.ts @@ -1,5 +1,8 @@ +export type TKlantType = 'persoon' | 'organisatie' + export type TKlant = { id: string; + type: TKlantType; voornaam: string; tussenvoegsel: string; achternaam: string; diff --git a/src/modals/klanten/EditKlant.vue b/src/modals/klanten/EditKlant.vue index 8be256a..e7c2cdd 100644 --- a/src/modals/klanten/EditKlant.vue +++ b/src/modals/klanten/EditKlant.vue @@ -15,6 +15,13 @@ import { klantStore, navigationStore } from '../../store/store.js'
+ +