Merge branch 'beta'

This commit is contained in:
2025-01-23 16:04:31 +01:00
8 changed files with 161 additions and 60 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,32 @@ 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 loadingContactRequest = ref(false)
const {data,error} = await supabase.from("contactRequests").insert(contactRequestData.value)
if(error) { const addContactRequest = async () => {
toast.add({title: "Anfrage konnte nicht erstellt werden",color:"rose"}) console.log("ADD")
} else { loadingContactRequest.value = true
const retVal = await useFunctions().useCreateTicket(contactRequestData.value.title,contactRequestData.value.message,router.currentRoute.value.fullPath,"helpSlideover",)
if(retVal) {
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"})
} }
loadingContactRequest.value = false
} }
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>
@@ -178,21 +168,21 @@ const resetContactRequest = () => {
<div v-else class="flex flex-col gap-y-3"> <div v-else class="flex flex-col gap-y-3">
<UButton v-for="(link, index) in links" :key="index" color="white" v-bind="link" /> <UButton v-for="(link, index) in links" :key="index" color="white" v-bind="link" />
</div> </div>
<div class="mt-5"> <div class="mt-5" v-if="!loadingContactRequest">
<h1 class="font-semibold">Kontaktanfrage:</h1> <h1 class="font-semibold">Kontaktanfrage:</h1>
<UForm <UForm
class="p-3" class="p-3"
@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:"
> >
@@ -225,5 +215,6 @@ const resetContactRequest = () => {
</UForm> </UForm>
</div> </div>
<UProgress class="mt-5" animation="carousel" v-else/>
</UDashboardSlideover> </UDashboardSlideover>
</template> </template>

View File

@@ -1,7 +1,7 @@
import axios from "axios"; import axios from "axios";
import dayjs from "dayjs"; import dayjs from "dayjs";
const baseURL = "https://functions.fedeo.io" const baseURL = "http://localhost:3333" /*"https://functions.fedeo.io"*/
export const useFunctions = () => { export const useFunctions = () => {
const supabase = useSupabaseClient() const supabase = useSupabaseClient()
@@ -38,5 +38,76 @@ 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;
}
const useBankingGenerateLink = async (institutionId) => {
const {data:{session:{access_token}}} = await supabase.auth.getSession()
const {data} = await axios({
method: "POST",
url: `${baseURL}/functions/bankstatements/generatelink`,
data: {
institutionId
},
headers: {
Authorization: `Bearer ${access_token}`
}
})
console.log(data)
return data.link
}
const useBankingCheckInstitutions = async (bic) => {
const {data:{session:{access_token}}} = await supabase.auth.getSession()
const {data} = await axios({
method: "GET",
url: `${baseURL}/functions/bankstatements/checkinstitutions/${bic}`,
headers: {
Authorization: `Bearer ${access_token}`
}
})
return data
}
const useBankingListRequisitions = async (reqId) => {
const {data:{session:{access_token}}} = await supabase.auth.getSession()
const {data} = await axios({
method: "GET",
url: `${baseURL}/functions/bankstatements/listrequisitions/${reqId}`,
headers: {
Authorization: `Bearer ${access_token}`
}
})
return data
}
return {getWorkingTimesEvaluationData, useNextNumber, useCreateTicket, useBankingGenerateLink, useBankingCheckInstitutions, useBankingListRequisitions}
} }

View File

@@ -27,6 +27,8 @@ const openDocuments = ref([])
const allocatedDocuments = ref([]) const allocatedDocuments = ref([])
const openIncomingInvoices = ref([]) const openIncomingInvoices = ref([])
const accounts = ref([])
const setup = async () => { const setup = async () => {
if(route.params.id) { if(route.params.id) {
itemInfo.value = (await supabase.from("bankstatements").select("*, statementallocations(*)").eq("id",route.params.id).single()).data //dataStore.bankstatements.find(i => i.id === Number(route.params.id)) itemInfo.value = (await supabase.from("bankstatements").select("*, statementallocations(*)").eq("id",route.params.id).single()).data //dataStore.bankstatements.find(i => i.id === Number(route.params.id))
@@ -35,6 +37,8 @@ const setup = async () => {
const documents = (await useSupabaseSelect("createddocuments","*, statementallocations(*), customer(id,name)")).filter(i => i.type === "invoices" ||i.type === "advanceInvoices") const documents = (await useSupabaseSelect("createddocuments","*, statementallocations(*), customer(id,name)")).filter(i => i.type === "invoices" ||i.type === "advanceInvoices")
accounts.value = (await supabase.from("accounts").select()).data
openDocuments.value = documents.filter(i => i.statementallocations.reduce((n,{amount}) => n + amount, 0).toFixed(2) !== getDocumentSum(i).toFixed(2)) openDocuments.value = documents.filter(i => i.statementallocations.reduce((n,{amount}) => n + amount, 0).toFixed(2) !== getDocumentSum(i).toFixed(2))
openDocuments.value = openDocuments.value.map(i => { openDocuments.value = openDocuments.value.map(i => {
@@ -99,6 +103,8 @@ const calculateOpenSum = computed(() => {
startingAmount = startingAmount - item.amount startingAmount = startingAmount - item.amount
} else if(item.ii_id) { } else if(item.ii_id) {
startingAmount = Number(startingAmount) + item.amount startingAmount = Number(startingAmount) + item.amount
}else if(item.account) {
startingAmount = Number(startingAmount) - item.amount
} }
}) })
@@ -298,7 +304,7 @@ setup()
</tr> </tr>
<tr class="flex-row flex justify-between"> <tr class="flex-row flex justify-between">
<td colspan="2"> <td colspan="2">
<span class="font-semibold">Verknüpfte Dokumente:</span> <span class="font-semibold">Buchungen:</span>
</td> </td>
</tr> </tr>
<tr <tr
@@ -315,6 +321,9 @@ setup()
<span v-else-if="item.ii_id"> <span v-else-if="item.ii_id">
{{dataStore.getVendorById(dataStore.getIncomingInvoiceById(item.ii_id).vendor).name}} - {{dataStore.getIncomingInvoiceById(item.ii_id).reference}} {{dataStore.getVendorById(dataStore.getIncomingInvoiceById(item.ii_id).vendor).name}} - {{dataStore.getIncomingInvoiceById(item.ii_id).reference}}
</span> </span>
<span v-else-if="item.account">
Buchungskonto: {{accounts.find(i => i.id === item.account).number}} {{accounts.find(i => i.id === item.account).label}}
</span>
</td> </td>
<td> <td>
<UButton <UButton
@@ -409,6 +418,13 @@ setup()
<UKbd value="/" /> <UKbd value="/" />
</template> </template>
</UInput> </UInput>
<UButton
@click="saveAllocation({bs_id: itemInfo.id, amount: Number(itemInfo.amount), account: 20 })"
>
Als DP markieren
</UButton>
<UCard <UCard
class="mt-5" class="mt-5"
:ui="{ring: itemInfo.statementallocations.find(i => i.cd_id === document.id) ? 'ring-primary-500' : 'ring-gray-200 dark:ring-gray-800'}" :ui="{ring: itemInfo.statementallocations.find(i => i.cd_id === document.id) ? 'ring-primary-500' : 'ring-gray-200 dark:ring-gray-800'}"

View File

@@ -2,6 +2,8 @@
const dataStore = useDataStore() const dataStore = useDataStore()
const profileStore = useProfileStore() const profileStore = useProfileStore()
const route = useRoute() const route = useRoute()
const router = useRouter()
const url = useRequestURL()
const supabase = useSupabaseClient() const supabase = useSupabaseClient()
const toast = useToast() const toast = useToast()
@@ -11,44 +13,33 @@ const bankData = ref({})
const showAlert = ref(false) const showAlert = ref(false)
const reqData = ref({}) const reqData = ref({})
const bankaccounts = ref([])
const setupPage = async () => { const setupPage = async () => {
if(route.query.ref) { if(route.query.ref) {
const {data,error} = await supabase.functions.invoke(`bankstatement_gateway`,{ reqData.value = await useFunctions().useBankingListRequisitions(route.query.ref)
body: {
reqId: route.query.ref,
method: "listRequisitions"
} }
})
if(data) { bankaccounts.value = await useSupabaseSelect("bankaccounts")
reqData.value = data
}
}
} }
const checkBIC = async () => { const checkBIC = async () => {
const {data,error} = await supabase.functions.invoke(`bankstatement_gateway`,{ bankData.value = await useFunctions().useBankingCheckInstitutions(bicBankToAdd.value)
body: {
bic: bicBankToAdd.value,
method: "checkInstitutions"
}
})
bankData.value = data
showAlert.value = true showAlert.value = true
} }
const generateLink = async () => { const generateLink = async (bankId) => {
try { try {
const {data,error} = await supabase.functions.invoke(`bankstatement_gateway`,{ /*const {data,error} = await supabase.functions.invoke(`bankstatement_gateway`,{
body: { body: {
method: "generateLink", method: "generateLink",
institutionId: bankData.value.id, institutionId: bankData.value.id,
tenant: profileStore.currentTenant tenant: profileStore.currentTenant
} }
}) })*/
const link = await useFunctions().useBankingGenerateLink(bankId || bankData.value.id)
await navigateTo(data.link, { await navigateTo(link, {
open: { open: {
target: "_blank" target: "_blank"
} }
@@ -76,12 +67,13 @@ const addAccount = async (account) => {
} }
const updateAccount = async (account) => { const updateAccount = async (account) => {
const {data,error} = await supabase.from("bankaccounts").update({accountId: account.id}).eq("iban",account.iban).select() const {data,error} = await supabase.from("bankaccounts").update({accountId: account.id, expired: false}).eq("iban",account.iban).select()
if(error) { if(error) {
console.log(error) console.log(error)
toast.add({title: "Es gab einen Fehler bei aktualisieren des Accounts", color:"rose"}) toast.add({title: "Es gab einen Fehler bei aktualisieren des Accounts", color:"rose"})
} else if(data) { } else if(data) {
toast.add({title: "Account erfolgreich aktualisiert"}) toast.add({title: "Account erfolgreich aktualisiert"})
setupPage()
} }
} }
@@ -173,11 +165,11 @@ setupPage()
</div>--> </div>-->
<UTable <UTable
:rows="dataStore.bankAccounts" :rows="bankaccounts"
:columns="[ :columns="[
{ {
key: 'name', key: 'expired',
label: 'Name' label: 'Aktiv'
},{ },{
key: 'iban', key: 'iban',
label: 'IBAN' label: 'IBAN'
@@ -193,9 +185,22 @@ setupPage()
}, },
]" ]"
> >
<template #expired-data="{row}">
<span v-if="row.expired" class="text-rose-600">Ausgelaufen</span>
<span v-else class="text-primary">Aktiv</span>
<UButton
v-if="row.expired"
variant="outline"
class="ml-2"
@click="generateLink(row.bankId)"
>Aktualisieren</UButton>
</template>
<template #balance-data="{row}"> <template #balance-data="{row}">
{{row.balance ? row.balance.toFixed(2).replace(".",",") + ' €' : '-'}} {{row.balance ? row.balance.toFixed(2).replace(".",",") + ' €' : '-'}}
</template> </template>
<template #iban-data="{row}">
{{row.iban.match(/.{1,5}/g).join(" ")}}
</template>
</UTable> </UTable>
</template> </template>

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,