Introduced OwnAccounts

Introduced CostCentres Rebuild
Added EntityModalButtons to IncomingInvoice Create
This commit is contained in:
2025-03-21 14:24:05 +01:00
parent bd1916bdaa
commit 76e207cd20
9 changed files with 385 additions and 79 deletions

View File

@@ -2,6 +2,7 @@
import InputGroup from "~/components/InputGroup.vue";
import dayjs from "dayjs";
import HistoryDisplay from "~/components/HistoryDisplay.vue";
import {useSupabaseSelect} from "~/composables/useSupabase.js";
definePageMeta({
middleware: "auth"
@@ -34,10 +35,14 @@ const itemInfo = ref({
]
})
const costcentres = ref([])
const setup = async () => {
let filetype = (await supabase.from("filetags").select().eq("tenant",profileStore.currentTenant).eq("incomingDocumentType","invoices").single()).data.id
console.log(filetype)
costcentres.value = await useSupabaseSelect("costcentres")
itemInfo.value = await useSupabaseSelectSingle("incominginvoices", route.params.id, "*, files(*)")
await loadFile(itemInfo.value.files[itemInfo.value.files.length-1].id)
@@ -322,20 +327,27 @@ const updateIncomingInvoice = async () => {
</UFormGroup>
<UFormGroup
label="Kostenstelle"
class=" mb-3"
class="w-full mb-3"
>
<InputGroup>
<InputGroup class="w-full">
<USelectMenu
:options="dataStore.getCostCentresComposed"
option-attribute="label"
:options="costcentres"
option-attribute="name"
value-attribute="id"
searchable
:search-attributes="['label']"
searchable-placeholder="Suche..."
v-model="item.costCentre"
class="flex-auto"
>
<template #label>
{{dataStore.getCostCentresComposed.find(account => account.id === item.costCentre) ? dataStore.getCostCentresComposed.find(account => account.id === item.costCentre).label : "Keine Kostenstelle ausgewählt" }}
{{costcentres.find(i => i.id === item.costCentre) ? costcentres.find(i => i.id === item.costCentre).name : "Keine Kostenstelle ausgewählt" }}
</template>
<template #option="{option}">
<span v-if="option.vehicle">Fahrzeug - {{option.name}}</span>
<span v-else-if="option.project">Projekt - {{option.name}}</span>
<span v-else-if="option.inventoryitem">Inventarartikel - {{option.name}}</span>
<span v-else>{{option.name}}</span>
</template>
</USelectMenu>