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

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

View File

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

View File

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

View File

@@ -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 = () => {

View File

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