From 522f02466c62aa544dcb8362fbf70eb50f08f583 Mon Sep 17 00:00:00 2001 From: arne Date: Tue, 16 May 2023 05:43:55 +0200 Subject: [PATCH 01/11] feat: fixed routing and parsing --- web/src/router/index.ts | 2 +- web/src/views/building/BuildingScreen.vue | 15 ++-- web/src/views/contact/ContactSyndicus.vue | 105 +++++++++++++--------- web/src/views/contact/TemplateBuilder.vue | 19 ++++ 4 files changed, 89 insertions(+), 52 deletions(-) diff --git a/web/src/router/index.ts b/web/src/router/index.ts index b121e688c..07f797347 100644 --- a/web/src/router/index.ts +++ b/web/src/router/index.ts @@ -184,7 +184,7 @@ const routes: any[] = [ }, }, { - path: "/contact", + path: "/contact/:id", name: "contact_syndicus", component: ContactSyndicus, meta: { diff --git a/web/src/views/building/BuildingScreen.vue b/web/src/views/building/BuildingScreen.vue index da306cedc..c4bd13b9e 100644 --- a/web/src/views/building/BuildingScreen.vue +++ b/web/src/views/building/BuildingScreen.vue @@ -83,7 +83,14 @@ @@ -207,12 +214,6 @@ function call(number: string | undefined) { } } -function mail(address: string | undefined) { - if (address) { - location.href = "mailto:" + address; - } -} - function tomaps() { window.open( `https://maps.google.com/maps?q=${building.value?.address.number}+${building.value?.address.street},+${building.value?.address.city},+${building.value?.address.zip_code}`, diff --git a/web/src/views/contact/ContactSyndicus.vue b/web/src/views/contact/ContactSyndicus.vue index bd1adf3c3..deb4963f0 100644 --- a/web/src/views/contact/ContactSyndicus.vue +++ b/web/src/views/contact/ContactSyndicus.vue @@ -41,16 +41,17 @@ - + @@ -63,9 +64,9 @@ class="flex-grow-1 flex-shrink-0 py-0 my-0" > @@ -87,11 +88,7 @@ style="min-width: 100px; max-width: 100%" class="flex-grow-1 flex-shrink-0 py-0 my-0" > - Versturen @@ -106,47 +104,66 @@ diff --git a/web/src/views/contact/TemplateBuilder.vue b/web/src/views/contact/TemplateBuilder.vue index b059d0a0a..bc15ccf4f 100644 --- a/web/src/views/contact/TemplateBuilder.vue +++ b/web/src/views/contact/TemplateBuilder.vue @@ -24,6 +24,7 @@ style="min-width: 100px; max-width: 100%" class="flex-grow-1 flex-shrink-0 py-0 my-0 mx-3" > @@ -64,6 +65,7 @@ prepend-icon="mdi-content-save" variant="tonal" class="mb-6 ml-6" + @click="saveTemplate()" >Opslaan (""); const subject = ref(""); const body = ref(""); @@ -111,6 +116,20 @@ const variables: { name: string; description: string }[] = [ { name: "$(gebouw_adres)", description: "Adres van het gebouw" }, { name: "$(ivago_id)", description: "Ivago ID van het gebouw" }, ]; + +function saveTemplate() { + tryOrAlertAsync(async () => { + await new MailTemplateQuery().createOne({ + name: templateName.value, + mail_subject: subject.value, + content: body.value, + }); + + templateName.value = ""; + subject.value = ""; + body.value = ""; + }); +}