From 61b5bd89ea45172b120ee2f0ca8c2dd14ca45365 Mon Sep 17 00:00:00 2001 From: Remko Date: Tue, 12 Nov 2024 15:01:41 +0100 Subject: [PATCH] Added Contactmoment widget and form --- docker-compose.yml | 2 +- img/account-outline.svg | 1 + img/chat-outline.svg | 1 + img/office-building-outline.svg | 1 + lib/AppInfo/Application.php | 3 +- lib/Dashboard/ContactmomentenWidget.php | 69 ++++++++++++ src/contactmomentenWidget.js | 10 ++ src/entities/bericht/bericht.mock.ts | 1 + src/entities/bericht/bericht.ts | 3 + src/entities/bericht/bericht.types.ts | 1 + src/main.js | 2 +- src/modals/berichten/EditBericht.vue | 18 +++- src/views/berichten/BerichtenList.vue | 2 +- src/views/klanten/KlantenList.vue | 20 +++- src/views/widgets/ContactMomentenWidget.vue | 111 ++++++++++++++++++++ src/views/zaken/ZakenList.vue | 2 +- webpack.config.js | 4 + 17 files changed, 244 insertions(+), 7 deletions(-) create mode 100644 img/account-outline.svg create mode 100644 img/chat-outline.svg create mode 100644 img/office-building-outline.svg create mode 100644 lib/Dashboard/ContactmomentenWidget.php create mode 100644 src/contactmomentenWidget.js create mode 100644 src/views/widgets/ContactMomentenWidget.vue diff --git a/docker-compose.yml b/docker-compose.yml index ed29617..1bd4aa3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,7 +28,7 @@ services: nextcloud: user: root container_name: nextcloud -# entrypoint: occ app:enable openconnector +# entrypoint: occ app:enable zaakafhandelapp image: nextcloud restart: always ports: diff --git a/img/account-outline.svg b/img/account-outline.svg new file mode 100644 index 0000000..553e70b --- /dev/null +++ b/img/account-outline.svg @@ -0,0 +1 @@ +account-outline \ No newline at end of file diff --git a/img/chat-outline.svg b/img/chat-outline.svg new file mode 100644 index 0000000..74b52e1 --- /dev/null +++ b/img/chat-outline.svg @@ -0,0 +1 @@ +chat-outline \ No newline at end of file diff --git a/img/office-building-outline.svg b/img/office-building-outline.svg new file mode 100644 index 0000000..c729266 --- /dev/null +++ b/img/office-building-outline.svg @@ -0,0 +1 @@ +office-building-outline \ No newline at end of file diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index b8c9a43..d7857d7 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -9,6 +9,7 @@ use OCA\ZaakAfhandelApp\Dashboard\ZakenWidget; use OCA\ZaakAfhandelApp\Dashboard\TakenWidget; use OCA\ZaakAfhandelApp\Dashboard\OpenZakenWidget; +use OCA\ZaakAfhandelApp\Dashboard\ContactmomentenWidget; /** * Class Application @@ -34,7 +35,7 @@ public function register(IRegistrationContext $context): void $context->registerDashboardWidget(ZakenWidget::class); $context->registerDashboardWidget(TakenWidget::class); $context->registerDashboardWidget(OpenZakenWidget::class); - + $context->registerDashboardWidget(ContactmomentenWidget::class); } public function boot(IBootContext $context): void diff --git a/lib/Dashboard/ContactmomentenWidget.php b/lib/Dashboard/ContactmomentenWidget.php new file mode 100644 index 0000000..0db3049 --- /dev/null +++ b/lib/Dashboard/ContactmomentenWidget.php @@ -0,0 +1,69 @@ +l10n->t('Contact momenten'); + } + + /** + * @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 . '-contactmomentenWidget'); + Util::addStyle(Application::APP_ID, 'dashboardWidgets'); + } +} diff --git a/src/contactmomentenWidget.js b/src/contactmomentenWidget.js new file mode 100644 index 0000000..bb012ab --- /dev/null +++ b/src/contactmomentenWidget.js @@ -0,0 +1,10 @@ +import Vue from 'vue' +import ContactMomentenWidget from './views/widgets/ContactMomentenWidget.vue' + +OCA.Dashboard.register('zaakAfhandelApp_contactmomenten_widget', async (el, { widget }) => { + Vue.mixin({ methods: { t, n } }) + const View = Vue.extend(ContactMomentenWidget) + new View({ + propsData: { title: widget.title }, + }).$mount(el) +}) diff --git a/src/entities/bericht/bericht.mock.ts b/src/entities/bericht/bericht.mock.ts index 9b97f38..fda829b 100644 --- a/src/entities/bericht/bericht.mock.ts +++ b/src/entities/bericht/bericht.mock.ts @@ -4,6 +4,7 @@ import { TBericht } from './bericht.types' export const mockBerichtData = (): TBericht[] => [ { id: '15551d6f-44e3-43f3-a9d2-59e583c91eb0', + title: 'Bericht 1', batchID: '15551d6f-44e3-43f3-a9d2-59e583c91eb0', aanmaakDatum: '2024-01-01', berichtLeverancierID: '15551d6f-44e3-43f3-a9d2-59e583c91eb0', diff --git a/src/entities/bericht/bericht.ts b/src/entities/bericht/bericht.ts index 7215626..335cc55 100644 --- a/src/entities/bericht/bericht.ts +++ b/src/entities/bericht/bericht.ts @@ -4,6 +4,7 @@ import { TBericht, BerichtID } from './bericht.types' export class Bericht implements TBericht { public id: string + public title: string public batchID: string public aanmaakDatum: string public berichtLeverancierID: string @@ -22,6 +23,7 @@ export class Bericht implements TBericht { constructor(source: TBericht) { this.id = source.id || '' + this.title = source.title || '' this.batchID = source.batchID || '' this.aanmaakDatum = source.aanmaakDatum || '' this.berichtLeverancierID = source.berichtLeverancierID || '' @@ -42,6 +44,7 @@ export class Bericht implements TBericht { public validate(): SafeParseReturnType { const schema = z.object({ id: z.string(), + title: z.string(), batchID: z.string(), aanmaakDatum: z.string(), berichtLeverancierID: z.string(), diff --git a/src/entities/bericht/bericht.types.ts b/src/entities/bericht/bericht.types.ts index eaea94c..0a98bef 100644 --- a/src/entities/bericht/bericht.types.ts +++ b/src/entities/bericht/bericht.types.ts @@ -2,6 +2,7 @@ export type BerichtID = string; // create an alias for string called BerichtID t export type TBericht = { id: string; + title: string; batchID: string; aanmaakDatum: string; berichtLeverancierID: string; diff --git a/src/main.js b/src/main.js index bcc76d1..9982e10 100644 --- a/src/main.js +++ b/src/main.js @@ -11,4 +11,4 @@ new Vue( pinia, render: h => h(App), }, -).$mount('#content') \ No newline at end of file +).$mount('#content') diff --git a/src/modals/berichten/EditBericht.vue b/src/modals/berichten/EditBericht.vue index 104feff..68e8242 100644 --- a/src/modals/berichten/EditBericht.vue +++ b/src/modals/berichten/EditBericht.vue @@ -6,7 +6,7 @@ import { berichtStore, navigationStore, klantStore } from '../../store/store.js' + @closing="response = $event, closeModalFromButton()">

Bericht succesvol aangepast

@@ -136,6 +136,12 @@ export default { Plus, Help, }, + props: { + dashboardWidget: { + type: Boolean, + required: false, + }, + }, data() { return { success: false, @@ -187,6 +193,12 @@ export default { } }, methods: { + closeModalFromButton() { + setTimeout(() => { + this.closeModal() + }, 300) + + }, closeModal() { navigationStore.setModal(false) this.success = false @@ -220,6 +232,10 @@ export default { this.success = true this.loading = false setTimeout(this.closeModal, 2000) + if (this.dashboardWidget === true) { + this.$emit('save-success') + } + } catch (error) { this.loading = false this.success = false diff --git a/src/views/berichten/BerichtenList.vue b/src/views/berichten/BerichtenList.vue index 71c1121..cee06a4 100644 --- a/src/views/berichten/BerichtenList.vue +++ b/src/views/berichten/BerichtenList.vue @@ -30,7 +30,7 @@ import { navigationStore, berichtStore } from '../../store/store.js' -
+
Bewerken - + @@ -126,6 +126,24 @@ export default { } return name }, + deleteKlant() { + fetch( + `/index.php/apps/zaakafhandelapp/api/klanten/${klantStore.klantItem.id}`, + { + method: 'DELETE', + }, + ) + .then((response) => { + response.json().then((data) => { + this.klantenList = data + }) + this.loading = false + }) + .catch((err) => { + console.error(err) + this.loading = false + }) + }, fetchData(newPage) { this.loading = true fetch( diff --git a/src/views/widgets/ContactMomentenWidget.vue b/src/views/widgets/ContactMomentenWidget.vue new file mode 100644 index 0000000..71ad00f --- /dev/null +++ b/src/views/widgets/ContactMomentenWidget.vue @@ -0,0 +1,111 @@ + + + + + + diff --git a/src/views/zaken/ZakenList.vue b/src/views/zaken/ZakenList.vue index faa6f6b..afc9a58 100644 --- a/src/views/zaken/ZakenList.vue +++ b/src/views/zaken/ZakenList.vue @@ -31,7 +31,7 @@ import { navigationStore, zaakStore } from '../../store/store.js'
-
+