Cahnged Ticket Creation
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<script setup lang="ts">
|
<script setup>
|
||||||
const { isHelpSlideoverOpen } = useDashboard()
|
const { isHelpSlideoverOpen } = useDashboard()
|
||||||
const { metaSymbol } = useShortcuts()
|
const { metaSymbol } = useShortcuts()
|
||||||
|
|
||||||
@@ -101,42 +101,33 @@ const filteredCategories = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const contactRequestData = ref({
|
const contactRequestData = ref({
|
||||||
source: "helpSlideover",
|
|
||||||
tenant: profileStore.currentTenant,
|
|
||||||
message: "",
|
message: "",
|
||||||
title: "",
|
title: "",
|
||||||
contactName: profileStore.activeProfile.fullName,
|
|
||||||
contactTel: profileStore.activeProfile.phoneMobile || profileStore.activeProfile.phoneHome,
|
|
||||||
contactMail: profileStore.activeProfile.email,
|
|
||||||
contactType: "Hilfe",
|
|
||||||
currentPath: router.currentRoute
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const addContactRequest = async () => {
|
const addContactRequest = async () => {
|
||||||
const {data,error} = await supabase.from("contactRequests").insert(contactRequestData.value)
|
console.log("ADD")
|
||||||
|
const retVal = await useFunctions().useCreateTicket({
|
||||||
|
subject: contactRequestData.value.title,
|
||||||
|
message: contactRequestData.value.message,
|
||||||
|
url: router.currentRoute.value.fullPath,
|
||||||
|
source: "helpSlideover",
|
||||||
|
})
|
||||||
|
|
||||||
if(error) {
|
if(retVal) {
|
||||||
toast.add({title: "Anfrage konnte nicht erstellt werden",color:"rose"})
|
|
||||||
} else {
|
|
||||||
toast.add({title: "Anfrage erfolgreich erstellt"})
|
toast.add({title: "Anfrage erfolgreich erstellt"})
|
||||||
resetContactRequest()
|
resetContactRequest()
|
||||||
|
} else {
|
||||||
|
toast.add({title: "Anfrage konnte nicht erstellt werden",color:"rose"})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const resetContactRequest = () => {
|
const resetContactRequest = () => {
|
||||||
contactRequestData.value = {
|
contactRequestData.value = {
|
||||||
source: "helpSlideover",
|
|
||||||
tenant: profileStore.currentTenant,
|
|
||||||
message: "",
|
message: "",
|
||||||
title: "",
|
title: "",
|
||||||
contactName: profileStore.activeProfile.fullName,
|
|
||||||
contactTel: profileStore.activeProfile.phoneMobile || profileStore.activeProfile.phoneHome,
|
|
||||||
contactMail: profileStore.activeProfile.email,
|
|
||||||
contactType: "Hilfe"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -185,14 +176,14 @@ const resetContactRequest = () => {
|
|||||||
@submit="addContactRequest"
|
@submit="addContactRequest"
|
||||||
@reset="resetContactRequest"
|
@reset="resetContactRequest"
|
||||||
>
|
>
|
||||||
<UFormGroup
|
<!-- <UFormGroup
|
||||||
label="Art:"
|
label="Art:"
|
||||||
>
|
>
|
||||||
<USelectMenu
|
<USelectMenu
|
||||||
:options="['Hilfe','Software Problem / Bug','Funktionsanfrage','Kontakt','Sonstiges']"
|
:options="['Hilfe','Software Problem / Bug','Funktionsanfrage','Kontakt','Sonstiges']"
|
||||||
v-model="contactRequestData.contactType"
|
v-model="contactRequestData.contactType"
|
||||||
/>
|
/>
|
||||||
</UFormGroup>
|
</UFormGroup>-->
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Titel:"
|
label="Titel:"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -38,5 +38,26 @@ export const useFunctions = () => {
|
|||||||
})).data.usedNumber
|
})).data.usedNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
return {getWorkingTimesEvaluationData, useNextNumber}
|
const useCreateTicket = async (subject,message,url,source) => {
|
||||||
|
const {data:{session:{access_token}}} = await supabase.auth.getSession()
|
||||||
|
|
||||||
|
const {data} = await axios({
|
||||||
|
method: "POST",
|
||||||
|
url: `${baseURL}/functions/createticket`,
|
||||||
|
data: {
|
||||||
|
subject,
|
||||||
|
message,
|
||||||
|
source,
|
||||||
|
url
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${access_token}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return !!data.ticket_created;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return {getWorkingTimesEvaluationData, useNextNumber, useCreateTicket}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user