Merge branch 'beta' into 'main'

Version 1.1.1

See merge request fedeo/software!4
This commit is contained in:
2025-01-23 10:40:39 +00:00
6 changed files with 60 additions and 30 deletions

View File

@@ -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:"
> >

View File

@@ -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}
} }

View File

@@ -31,7 +31,7 @@ const setupPage = async () => {
console.log(item.value) console.log(item.value)
} else if(mode.value === "list") { } else if(mode.value === "list") {
//Load Data for List //Load Data for List
items.value = await useSupabaseSelect(type, dataType.supabaseSelectWithInformation || "*", dataType.supabaseSortColumn) items.value = await useSupabaseSelect(type, dataType.supabaseSelectWithInformation || "*", dataType.supabaseSortColumn,dataType.supabaseSortAscending || false)
} }
loaded.value = true loaded.value = true

View File

@@ -23,6 +23,11 @@ const setupPage = () => {
//setStartEnd() //setStartEnd()
} }
oldItemInfo.value = itemInfo.value oldItemInfo.value = itemInfo.value
if(route.query) {
if(route.query.profile) itemInfo.value.profile = route.query.profile
}
} }
/*const setStartEnd = () => { /*const setStartEnd = () => {

View File

@@ -12,16 +12,27 @@ const dataStore = useDataStore()
const profileStore = useProfileStore() const profileStore = useProfileStore()
const supabase = useSupabaseClient() const supabase = useSupabaseClient()
const router = useRouter() const router = useRouter()
const route = useRoute()
const filterUser = ref(profileStore.activeProfile.id || "") const filterUser = ref(profileStore.activeProfile.id || "")
const workingtimes = ref([]) const workingtimes = ref([])
const setupPage = async () => { const setupPage = async () => {
if(route.query) {
if(route.query.profile) filterUser.value = route.query.profile
}
workingtimes.value = (await supabase.from("workingtimes").select().eq("profile",filterUser.value).order("startDate",{ascending: false})).data workingtimes.value = (await supabase.from("workingtimes").select().eq("profile",filterUser.value).order("startDate",{ascending: false})).data
}
const changeFilterUser = async () => {
await router.push(`/workingtimes/?profile=${filterUser.value}`)
await setupPage()
} }
setupPage() setupPage()
@@ -147,9 +158,9 @@ const setEndDate = (row) => {
<UDashboardNavbar title="Anwesenheiten"> <UDashboardNavbar title="Anwesenheiten">
<template #right> <template #right>
<UButton <UButton
@click="router.push(`/workingtimes/edit`)" @click="router.push(`/workingtimes/edit?profile=${filterUser}`)"
> >
Erstellen + Anwesenheit
</UButton> </UButton>
</template> </template>
</UDashboardNavbar> </UDashboardNavbar>
@@ -161,7 +172,7 @@ const setEndDate = (row) => {
option-attribute="fullName" option-attribute="fullName"
value-attribute="id" value-attribute="id"
v-model="filterUser" v-model="filterUser"
@change="setupPage" @change="changeFilterUser"
> >
<template #label> <template #label>
{{profileStore.getProfileById(filterUser) ? profileStore.getProfileById(filterUser).fullName : "Kein Benutzer ausgewählt"}} {{profileStore.getProfileById(filterUser) ? profileStore.getProfileById(filterUser).fullName : "Kein Benutzer ausgewählt"}}

View File

@@ -506,6 +506,8 @@ export const useDataStore = defineStore('data', () => {
label: "Abwesenheitsanträge", label: "Abwesenheitsanträge",
labelSingle: "Abwesenheitsantrag", labelSingle: "Abwesenheitsantrag",
isStandardEntity: true, isStandardEntity: true,
supabaseSortColumn:"startDate",
supabaseSortAscending: false,
supabaseSelectWithInformation: "*", supabaseSelectWithInformation: "*",
historyItemHolder: "absencerequest", historyItemHolder: "absencerequest",
redirect:true, redirect:true,