Disabled TIckets
This commit is contained in:
@@ -1,42 +1,30 @@
|
||||
<script setup>
|
||||
|
||||
import {useFunctions} from "~/composables/useFunctions.js";
|
||||
|
||||
const supabase = useSupabaseClient()
|
||||
const profileStore = useProfileStore()
|
||||
const router = useRouter()
|
||||
|
||||
const itemInfo = ref({})
|
||||
|
||||
const auth = useAuthStore()
|
||||
|
||||
|
||||
const createTicket = async () => {
|
||||
|
||||
const {data:ticketData,error:ticketError} = await supabase.from("tickets").insert({
|
||||
const ticketRes = await useEntities("tickets").create({
|
||||
title: itemInfo.value.title,
|
||||
created_by: profileStore.activeProfile.id,
|
||||
tenant: profileStore.currentTenant
|
||||
}).select().single()
|
||||
})
|
||||
|
||||
console.log(ticketRes)
|
||||
|
||||
const ticketMsgRes = await useEntities("ticketmessages").create({
|
||||
ticket: ticketRes.id,
|
||||
created_by: auth.user.user_id,
|
||||
content: itemInfo.value.content,
|
||||
internal: false
|
||||
})
|
||||
|
||||
await router.push(`/support/${ticketRes.id}`)
|
||||
|
||||
|
||||
if(ticketError) {
|
||||
console.error(ticketError)
|
||||
} else {
|
||||
console.log(ticketData)
|
||||
const {data:messageData,error:messageError} = await supabase.from("ticketmessages").insert({
|
||||
ticket: ticketData.id,
|
||||
profile: profileStore.activeProfile.id,
|
||||
content: itemInfo.value.content,
|
||||
internal: false
|
||||
})
|
||||
|
||||
if(messageError) {
|
||||
console.log(messageError)
|
||||
} else {
|
||||
console.log(ticketData)
|
||||
//useFunctions().useSendTelegramNotification(`Ticket von ${profileStore.activeProfile.fullName} erstellt : ${itemInfo.value.content}`)
|
||||
router.push(`/support/${ticketData.id}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user