Merge branch 'beta'
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
<script setup>
|
||||
const { isHelpSlideoverOpen } = useDashboard()
|
||||
const { metaSymbol } = useShortcuts()
|
||||
|
||||
@@ -101,42 +101,32 @@ const filteredCategories = computed(() => {
|
||||
})
|
||||
|
||||
const contactRequestData = ref({
|
||||
source: "helpSlideover",
|
||||
tenant: profileStore.currentTenant,
|
||||
message: "",
|
||||
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 {data,error} = await supabase.from("contactRequests").insert(contactRequestData.value)
|
||||
const loadingContactRequest = ref(false)
|
||||
|
||||
if(error) {
|
||||
toast.add({title: "Anfrage konnte nicht erstellt werden",color:"rose"})
|
||||
} else {
|
||||
const addContactRequest = async () => {
|
||||
console.log("ADD")
|
||||
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"})
|
||||
resetContactRequest()
|
||||
} else {
|
||||
toast.add({title: "Anfrage konnte nicht erstellt werden",color:"rose"})
|
||||
}
|
||||
loadingContactRequest.value = false
|
||||
}
|
||||
|
||||
const resetContactRequest = () => {
|
||||
contactRequestData.value = {
|
||||
source: "helpSlideover",
|
||||
tenant: profileStore.currentTenant,
|
||||
message: "",
|
||||
title: "",
|
||||
contactName: profileStore.activeProfile.fullName,
|
||||
contactTel: profileStore.activeProfile.phoneMobile || profileStore.activeProfile.phoneHome,
|
||||
contactMail: profileStore.activeProfile.email,
|
||||
contactType: "Hilfe"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -178,21 +168,21 @@ const resetContactRequest = () => {
|
||||
<div v-else class="flex flex-col gap-y-3">
|
||||
<UButton v-for="(link, index) in links" :key="index" color="white" v-bind="link" />
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<div class="mt-5" v-if="!loadingContactRequest">
|
||||
<h1 class="font-semibold">Kontaktanfrage:</h1>
|
||||
<UForm
|
||||
class="p-3"
|
||||
@submit="addContactRequest"
|
||||
@reset="resetContactRequest"
|
||||
>
|
||||
<UFormGroup
|
||||
<!-- <UFormGroup
|
||||
label="Art:"
|
||||
>
|
||||
<USelectMenu
|
||||
:options="['Hilfe','Software Problem / Bug','Funktionsanfrage','Kontakt','Sonstiges']"
|
||||
v-model="contactRequestData.contactType"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</UFormGroup>-->
|
||||
<UFormGroup
|
||||
label="Titel:"
|
||||
>
|
||||
@@ -225,5 +215,6 @@ const resetContactRequest = () => {
|
||||
|
||||
</UForm>
|
||||
</div>
|
||||
<UProgress class="mt-5" animation="carousel" v-else/>
|
||||
</UDashboardSlideover>
|
||||
</template>
|
||||
@@ -1,7 +1,7 @@
|
||||
import axios from "axios";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
const baseURL = "https://functions.fedeo.io"
|
||||
const baseURL = "http://localhost:3333" /*"https://functions.fedeo.io"*/
|
||||
|
||||
export const useFunctions = () => {
|
||||
const supabase = useSupabaseClient()
|
||||
@@ -38,5 +38,76 @@ export const useFunctions = () => {
|
||||
})).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}
|
||||
}
|
||||
@@ -27,6 +27,8 @@ const openDocuments = ref([])
|
||||
const allocatedDocuments = ref([])
|
||||
const openIncomingInvoices = ref([])
|
||||
|
||||
const accounts = ref([])
|
||||
|
||||
const setup = async () => {
|
||||
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))
|
||||
@@ -35,6 +37,8 @@ const setup = async () => {
|
||||
|
||||
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 = openDocuments.value.map(i => {
|
||||
|
||||
@@ -99,6 +103,8 @@ const calculateOpenSum = computed(() => {
|
||||
startingAmount = startingAmount - item.amount
|
||||
} else if(item.ii_id) {
|
||||
startingAmount = Number(startingAmount) + item.amount
|
||||
}else if(item.account) {
|
||||
startingAmount = Number(startingAmount) - item.amount
|
||||
}
|
||||
})
|
||||
|
||||
@@ -298,7 +304,7 @@ setup()
|
||||
</tr>
|
||||
<tr class="flex-row flex justify-between">
|
||||
<td colspan="2">
|
||||
<span class="font-semibold">Verknüpfte Dokumente:</span>
|
||||
<span class="font-semibold">Buchungen:</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
@@ -315,6 +321,9 @@ setup()
|
||||
<span v-else-if="item.ii_id">
|
||||
{{dataStore.getVendorById(dataStore.getIncomingInvoiceById(item.ii_id).vendor).name}} - {{dataStore.getIncomingInvoiceById(item.ii_id).reference}}
|
||||
</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>
|
||||
<UButton
|
||||
@@ -409,6 +418,13 @@ setup()
|
||||
<UKbd value="/" />
|
||||
</template>
|
||||
</UInput>
|
||||
|
||||
<UButton
|
||||
@click="saveAllocation({bs_id: itemInfo.id, amount: Number(itemInfo.amount), account: 20 })"
|
||||
>
|
||||
Als DP markieren
|
||||
</UButton>
|
||||
|
||||
<UCard
|
||||
class="mt-5"
|
||||
:ui="{ring: itemInfo.statementallocations.find(i => i.cd_id === document.id) ? 'ring-primary-500' : 'ring-gray-200 dark:ring-gray-800'}"
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
const dataStore = useDataStore()
|
||||
const profileStore = useProfileStore()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const url = useRequestURL()
|
||||
const supabase = useSupabaseClient()
|
||||
const toast = useToast()
|
||||
|
||||
@@ -11,44 +13,33 @@ const bankData = ref({})
|
||||
const showAlert = ref(false)
|
||||
const reqData = ref({})
|
||||
|
||||
const bankaccounts = ref([])
|
||||
|
||||
const setupPage = async () => {
|
||||
if(route.query.ref) {
|
||||
const {data,error} = await supabase.functions.invoke(`bankstatement_gateway`,{
|
||||
body: {
|
||||
reqId: route.query.ref,
|
||||
method: "listRequisitions"
|
||||
}
|
||||
})
|
||||
|
||||
if(data) {
|
||||
reqData.value = data
|
||||
}
|
||||
reqData.value = await useFunctions().useBankingListRequisitions(route.query.ref)
|
||||
}
|
||||
|
||||
bankaccounts.value = await useSupabaseSelect("bankaccounts")
|
||||
}
|
||||
|
||||
const checkBIC = async () => {
|
||||
const {data,error} = await supabase.functions.invoke(`bankstatement_gateway`,{
|
||||
body: {
|
||||
bic: bicBankToAdd.value,
|
||||
method: "checkInstitutions"
|
||||
}
|
||||
})
|
||||
|
||||
bankData.value = data
|
||||
bankData.value = await useFunctions().useBankingCheckInstitutions(bicBankToAdd.value)
|
||||
showAlert.value = true
|
||||
}
|
||||
|
||||
const generateLink = async () => {
|
||||
const generateLink = async (bankId) => {
|
||||
try {
|
||||
const {data,error} = await supabase.functions.invoke(`bankstatement_gateway`,{
|
||||
/*const {data,error} = await supabase.functions.invoke(`bankstatement_gateway`,{
|
||||
body: {
|
||||
method: "generateLink",
|
||||
institutionId: bankData.value.id,
|
||||
tenant: profileStore.currentTenant
|
||||
}
|
||||
})
|
||||
})*/
|
||||
const link = await useFunctions().useBankingGenerateLink(bankId || bankData.value.id)
|
||||
|
||||
await navigateTo(data.link, {
|
||||
await navigateTo(link, {
|
||||
open: {
|
||||
target: "_blank"
|
||||
}
|
||||
@@ -76,12 +67,13 @@ const addAccount = 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) {
|
||||
console.log(error)
|
||||
toast.add({title: "Es gab einen Fehler bei aktualisieren des Accounts", color:"rose"})
|
||||
} else if(data) {
|
||||
toast.add({title: "Account erfolgreich aktualisiert"})
|
||||
setupPage()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,11 +165,11 @@ setupPage()
|
||||
</div>-->
|
||||
|
||||
<UTable
|
||||
:rows="dataStore.bankAccounts"
|
||||
:rows="bankaccounts"
|
||||
:columns="[
|
||||
{
|
||||
key: 'name',
|
||||
label: 'Name'
|
||||
key: 'expired',
|
||||
label: 'Aktiv'
|
||||
},{
|
||||
key: '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}">
|
||||
{{row.balance ? row.balance.toFixed(2).replace(".",",") + ' €' : '-'}}
|
||||
</template>
|
||||
<template #iban-data="{row}">
|
||||
{{row.iban.match(/.{1,5}/g).join(" ")}}
|
||||
</template>
|
||||
</UTable>
|
||||
|
||||
</template>
|
||||
|
||||
@@ -31,7 +31,7 @@ const setupPage = async () => {
|
||||
console.log(item.value)
|
||||
} else if(mode.value === "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
|
||||
|
||||
@@ -23,6 +23,11 @@ const setupPage = () => {
|
||||
//setStartEnd()
|
||||
}
|
||||
oldItemInfo.value = itemInfo.value
|
||||
|
||||
if(route.query) {
|
||||
if(route.query.profile) itemInfo.value.profile = route.query.profile
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*const setStartEnd = () => {
|
||||
|
||||
@@ -12,16 +12,27 @@ const dataStore = useDataStore()
|
||||
const profileStore = useProfileStore()
|
||||
const supabase = useSupabaseClient()
|
||||
const router = useRouter()
|
||||
|
||||
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const filterUser = ref(profileStore.activeProfile.id || "")
|
||||
|
||||
const workingtimes = ref([])
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
const changeFilterUser = async () => {
|
||||
await router.push(`/workingtimes/?profile=${filterUser.value}`)
|
||||
await setupPage()
|
||||
}
|
||||
|
||||
setupPage()
|
||||
@@ -147,9 +158,9 @@ const setEndDate = (row) => {
|
||||
<UDashboardNavbar title="Anwesenheiten">
|
||||
<template #right>
|
||||
<UButton
|
||||
@click="router.push(`/workingtimes/edit`)"
|
||||
@click="router.push(`/workingtimes/edit?profile=${filterUser}`)"
|
||||
>
|
||||
Erstellen
|
||||
+ Anwesenheit
|
||||
</UButton>
|
||||
</template>
|
||||
</UDashboardNavbar>
|
||||
@@ -161,7 +172,7 @@ const setEndDate = (row) => {
|
||||
option-attribute="fullName"
|
||||
value-attribute="id"
|
||||
v-model="filterUser"
|
||||
@change="setupPage"
|
||||
@change="changeFilterUser"
|
||||
>
|
||||
<template #label>
|
||||
{{profileStore.getProfileById(filterUser) ? profileStore.getProfileById(filterUser).fullName : "Kein Benutzer ausgewählt"}}
|
||||
|
||||
@@ -506,6 +506,8 @@ export const useDataStore = defineStore('data', () => {
|
||||
label: "Abwesenheitsanträge",
|
||||
labelSingle: "Abwesenheitsantrag",
|
||||
isStandardEntity: true,
|
||||
supabaseSortColumn:"startDate",
|
||||
supabaseSortAscending: false,
|
||||
supabaseSelectWithInformation: "*",
|
||||
historyItemHolder: "absencerequest",
|
||||
redirect:true,
|
||||
|
||||
Reference in New Issue
Block a user