Merge branch 'refs/heads/dev' into beta

This commit is contained in:
2025-04-17 14:10:14 +02:00
8 changed files with 85 additions and 46 deletions

View File

@@ -61,7 +61,7 @@ const router = useRouter()
const createddocuments = ref([])
const setup = async () => {
createddocuments.value = await useSupabaseSelect("createddocuments")
createddocuments.value = (await useSupabaseSelect("createddocuments")).filter(i => !i.archived)
}
setup()
@@ -188,9 +188,8 @@ const selectItem = (item) => {
</USelectMenu>
</template>
</Toolbar>
<UTable
:rows="props.item.createddocuments"
:rows="props.item.createddocuments.filter(i => !i.archived)"
:columns="columns"
class="w-full"
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"

View File

@@ -78,6 +78,7 @@ setupPage()
:inModal="true"
@return-data="(data) => emit('return-data',data)"
:createQuery="props.createQuery"
:mode="props.mode"
/>
<!-- <EntityList
v-else-if="loaded && props.mode === 'list'"

View File

@@ -0,0 +1,55 @@
<script setup>
import dayjs from "dayjs";
import {useSupabaseSelect} from "~/composables/useSupabase.js";
let unallocatedStatements = ref(0)
let bankaccounts = ref([])
const setupPage = async () => {
let bankstatements = (await useSupabaseSelect("bankstatements","*, statementallocations(*)","date",true)).filter(i => !i.archived)
unallocatedStatements.value = bankstatements.filter(i => Number(calculateOpenSum(i)) !== 0).length
bankaccounts.value = await useSupabaseSelect("bankaccounts")
}
setupPage()
const calculateOpenSum = (statement) => {
let startingAmount = 0
statement.statementallocations.forEach(item => {
startingAmount += item.amount
})
return (statement.amount - startingAmount).toFixed(2)
}
</script>
<template>
<table>
<tr>
<td colspan="2">Nicht zugewiesene Bankbuchungen:</td>
<td>
<span v-if="unallocatedStatements > 0" class="text-rose-600 font-bold">{{unallocatedStatements}}</span>
<span v-else class="text-primary-500 font-bold">0</span>
</td>
</tr>
<tr v-for="account in bankaccounts.filter(i => !i.expired)">
<td>{{ account.name }}:</td>
<td>
{{dayjs(account.synced_at).format("DD.MM.YY HH:mm")}}
</td>
<td>
<span v-if="account.balance < 0" class="text-rose-600 font-bold">{{useCurrency(account.balance)}}</span>
<span v-else-if="account.balance > 0" class="text-primary-500 font-bold">{{useCurrency(account.balance)}}</span>
<span v-else>{{useCurrency(account.balance)}}</span>
</td>
</tr>
</table>
</template>
<style scoped>
</style>

View File

@@ -4,7 +4,6 @@ let unpaidInvoicesSum = ref(0)
let unpaidInvoicesCount = ref(0)
let draftInvoicesSum = ref(0)
let draftInvoicesCount = ref(0)
let unallocatedStatements = ref(0)
const setupPage = async () => {
let documents = (await useSupabaseSelect("createddocuments","*, statementallocations(*), customer(id,name)")).filter(i => i.type === "invoices" ||i.type === "advanceInvoices"||i.type === "cancellationInvoices").filter(i => !i.archived)
@@ -25,33 +24,10 @@ const setupPage = async () => {
})
draftInvoicesCount.value = draftDocuments.length
let bankstatements = (await useSupabaseSelect("bankstatements","*, statementallocations(*)","date",true)).filter(i => !i.archived)
unallocatedStatements.value = bankstatements.filter(i => Number(calculateOpenSum(i)) !== 0).length
}
setupPage()
const calculateOpenSum = (statement) => {
/*let startingAmount = statement.amount || 0
statement.statementallocations.forEach(item => {
if(item.cd_id) {
startingAmount = startingAmount - item.amount
} else if(item.ii_id) {
startingAmount = Number(startingAmount) + item.amount
}
})
return startingAmount.toFixed(2)*/
let startingAmount = 0
statement.statementallocations.forEach(item => {
startingAmount += Math.abs(item.amount)
})
return (Math.abs(statement.amount) - startingAmount).toFixed(2)
}
</script>
<template>
@@ -72,13 +48,6 @@ const calculateOpenSum = (statement) => {
>{{draftInvoicesCount}} Stk / {{useCurrency(draftInvoicesSum)}}</td>
<td v-else class="text-primary-500 font-bold text-no-wrap">0 Stk / 0,00</td>
</tr>
<tr>
<td>Nicht zugewiesene Bankbuchungen:</td>
<td>
<span v-if="unallocatedStatements > 0" class="text-rose-600 font-bold">{{unallocatedStatements}}</span>
<span v-else class="text-primary-500 font-bold">0</span>
</td>
</tr>
</table>
</template>

View File

@@ -103,19 +103,23 @@ const calendarOptionsTimeline = ref({
views: {
resourceTimeline3Hours: {
type: 'resourceTimeline',
duration: {weeks: 1},
weekends: false,
slotDuration: {hours: 3},
slotMinTime: "06:00:00",
slotMaxTime: "21:00:00",
/*duration: {days:7},*/
buttonText: "Woche",
visibleRange: function(currentDate) {
// Generate a new date for manipulating in the next step
var startDate = new Date(currentDate);
var endDate = new Date(currentDate);
var startDate = new Date(currentDate.valueOf());
var endDate = new Date(currentDate.valueOf());
// Adjust the start & end dates, respectively
startDate.setDate(startDate.getDate() - startDate.getDay() +1); // One day in the past
endDate.setDate(startDate.getDate() + 5); // Two days into the future
console.log(startDate.getDay())
startDate.setDate(startDate.getDate() - 1); // One day in the past
endDate.setDate(endDate.getDate() + 2); // Two days into the future
return { start: startDate, end: endDate };
}
@@ -249,8 +253,8 @@ const setupPage = async () => {
let returnData = {
title: title,
borderColor: eventColor,
textColor: eventColor,
backgroundColor: "black",
textColor: "white",
backgroundColor: eventColor,
start: event.startDate,
end: event.endDate,
resourceIds: [],
@@ -292,10 +296,11 @@ const setupPage = async () => {
absencerequests.forEach(absencerequest => {
let returnData = {
title: `${absencerequest.reason}`,
backgroundColor: "black",
backgroundColor: "red",
borderColor: "red",
start: absencerequest.startDate,
end: absencerequest.endDate,
resourceIds: [absencerequest.profile.id],
resourceIds: [`P-${absencerequest.profile.id}`],
entrytype: "absencerequest",
allDay: true,
absencerequestId: absencerequest.id
@@ -304,8 +309,12 @@ const setupPage = async () => {
tempEvents.push(returnData)
})
console.log(tempEvents)
calendarOptionsTimeline.value.initialEvents = tempEvents
console.log(calendarOptionsTimeline.value)
loaded.value = true
}

View File

@@ -116,10 +116,10 @@
<span v-if="row.documentDate">{{row.documentDate ? dayjs(row.documentDate).format("DD.MM.YY") : ''}}</span>
</template>
<template #dueDate-data="{row}">
<span v-if="row.paymentDays && ['invoices','advanceInvoices'].includes(row.type)" :class="dayjs(row.documentDate).add(row.paymentDays,'day').diff(dayjs()) <= 0 && !isPaid(row) ? ['text-rose-500'] : '' ">{{row.documentDate ? dayjs(row.documentDate).add(row.paymentDays,'day').format("DD.MM.YY") : ''}}</span>
<span v-if="row.state === 'Gebucht' && row.paymentDays && ['invoices','advanceInvoices'].includes(row.type)" :class="dayjs(row.documentDate).add(row.paymentDays,'day').diff(dayjs()) <= 0 && !isPaid(row) ? ['text-rose-500'] : '' ">{{row.documentDate ? dayjs(row.documentDate).add(row.paymentDays,'day').format("DD.MM.YY") : ''}}</span>
</template>
<template #paid-data="{row}">
<div v-if="row.type === 'invoices' ||row.type === 'advanceInvoices'">
<div v-if="(row.type === 'invoices' ||row.type === 'advanceInvoices') && row.state === 'Gebucht'">
<span v-if="isPaid(row)" class="text-primary-500">Bezahlt</span>
<span v-else class="text-rose-600">Offen</span>
</div>

View File

@@ -27,6 +27,12 @@
>
<display-open-balances/>
</UDashboardCard>
<UDashboardCard
title="Bank"
v-if="profileStore.ownTenant.features.accounting"
>
<display-bankaccounts/>
</UDashboardCard>
<UDashboardCard
title="Projekte"
>

View File

@@ -116,7 +116,7 @@ export const useProfileStore = defineStore('profile', () => {
}
async function fetchOwnProfiles () {
let profiles = (await supabase.from("profiles").select().order("fullName")).data
let profiles = (await supabase.from("profiles").select().order("tenant")).data
let conns = (await supabase.from("profileconnections").select()).data.map(i => i.profile_id)
ownProfiles.value = profiles.filter(i => conns.includes(i.id))
}