Merge branch 'beta'

This commit is contained in:
2025-02-02 19:35:27 +01:00
19 changed files with 754 additions and 306 deletions

View File

@@ -65,7 +65,7 @@ const uploadFiles = async () => {
/>
</UFormGroup>
<UFormGroup
label="Tags:"
label="Typ:"
class="mt-3"
>
<USelectMenu

View File

@@ -201,6 +201,7 @@ const resetContactRequest = () => {
<InputGroup class="mt-3">
<UButton
type="submit"
:disabled="!contactRequestData.title || !contactRequestData.message"
>
Senden
</UButton>
@@ -208,6 +209,7 @@ const resetContactRequest = () => {
type="reset"
color="rose"
variant="outline"
:disabled="!contactRequestData.title && !contactRequestData.message"
>
Zurücksetzen
</UButton>

View File

@@ -2,21 +2,21 @@
import dayjs from "dayjs"
const props = defineProps({
type: {
type: String
type: String,
required: true
},
elementId: {
type: String
type: String,
required: true
},
renderHeadline: {
type: Boolean
type: Boolean,
default: false
}
})
const { metaSymbol } = useShortcuts()
const profileStore = useProfileStore()
const user = useSupabaseUser()
const supabase = useSupabaseClient()
const toast = useToast()
const {type, elementId} = props
const showAddHistoryItemModal = ref(false)
const colorMode = useColorMode()
@@ -24,8 +24,8 @@ const items = ref([])
const setup = async () => {
if(type && elementId){
items.value = (await supabase.from("historyitems").select().eq(type,elementId).order("created_at",{ascending: true})).data || []
if(props.type && props.elementId){
items.value = (await supabase.from("historyitems").select().eq(props.type,props.elementId).order("created_at",{ascending: true})).data || []
} else {
items.value = (await supabase.from("historyitems").select().order("created_at",{ascending: true})).data || []
@@ -39,8 +39,8 @@ setup()
const addHistoryItemData = ref({
text: "",
config: {
type: type,
id: elementId
type: props.type,
id: props.elementId
}
})
@@ -48,7 +48,7 @@ const addHistoryItem = async () => {
console.log(addHistoryItemData.value)
addHistoryItemData.value.createdBy = profileStore.activeProfile.id
addHistoryItemData.value[type] = elementId
addHistoryItemData.value[props.type] = props.elementId
const {data,error} = await supabase
.from("historyitems")
@@ -71,7 +71,7 @@ const addHistoryItem = async () => {
profile: profiles.find(x => x.username === rawUsername).id,
initiatingProfile: profileStore.activeProfile.id,
title: "Sie wurden im Logbuch erwähnt",
link: `/${type}s/show/${elementId}`,
link: `/${props.type}s/show/${props.elementId}`,
message: addHistoryItemData.value.text
}
})
@@ -129,7 +129,7 @@ const renderText = (text) => {
</UCard>
</UModal>
<Toolbar
v-if="!renderHeadline && elementId && type"
v-if="!props.renderHeadline && props.elementId && props.type"
>
<UButton
@click="showAddHistoryItemModal = true"
@@ -137,7 +137,7 @@ const renderText = (text) => {
+ Eintrag
</UButton>
</Toolbar>
<div v-else-if="renderHeadline && elementId && type">
<div v-else-if="props.renderHeadline && props.elementId && props.type">
<div :class="`flex justify-between`">
<p class=""><span class="text-xl">Logbuch</span> <UBadge variant="outline">{{items.length}}</UBadge></p>
<UButton

View File

@@ -0,0 +1,14 @@
<script setup>
const props = defineProps({
row: {
type: Object,
required: true,
default: {}
}
})
</script>
<template>
<span v-if="props.row.phases && props.row.phases.length > 0">{{props.row.phases.find(i => i.active).label}}</span>
</template>

View File

@@ -6,18 +6,16 @@ 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").filter(i => !i.archived)
let documents = (await useSupabaseSelect("createddocuments","*, statementallocations(*), customer(id,name)")).filter(i => i.type === "invoices" ||i.type === "advanceInvoices"||i.type === "cancellationInvoices").filter(i => !i.archived)
let draftDocuments = documents.filter(i => i.state === "Entwurf")
let finalizedDocuments = documents.filter(i => i.state === "Gebucht")
console.log(finalizedDocuments)
finalizedDocuments = finalizedDocuments.filter(i => i.statementallocations.reduce((n,{amount}) => n + amount, 0).toFixed(2) !== getDocumentSum(i).toFixed(2))
finalizedDocuments.forEach(i => {
console.log(getDocumentSum(i))
unpaidInvoicesSum.value += getDocumentSum(i) - i.statementallocations.reduce((n,{amount}) => n + amount, 0)
})
unpaidInvoicesCount.value = finalizedDocuments.length

View File

@@ -0,0 +1,43 @@
<script setup>
const phasesCounter = ref({})
const setupPage = async () => {
const projects = await useSupabaseSelect("projects")
projects.forEach(project => {
if(project.phases && project.phases.length > 0){
let activePhase = project.phases.find(p => p.active)
if(phasesCounter.value[activePhase.label]) {
phasesCounter.value[activePhase.label] += 1
} else {
phasesCounter.value[activePhase.label] = 1
}
} else {
if(phasesCounter.value["Keine Phase"]) {
phasesCounter.value["Keine Phase"] += 1
} else {
phasesCounter.value["Keine Phase"] = 1
}
}
})
}
setupPage()
</script>
<template>
<table class="w-full">
<tr v-for="label in Object.keys(phasesCounter)">
<td>{{label}}</td>
<td>{{ phasesCounter[label] }} Stk</td>
</tr>
</table>
</template>
<style scoped>
</style>