Introduced OwnAccounts
Introduced CostCentres Rebuild Added EntityModalButtons to IncomingInvoice Create
This commit is contained in:
@@ -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"
|
||||
@@ -35,16 +36,24 @@ const itemInfo = ref({
|
||||
})
|
||||
|
||||
const availableDocuments = 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)
|
||||
let ids = (await supabase.from("files").select("id").eq("tenant",profileStore.currentTenant).eq("type", filetype).is("incominginvoice",null)).data.map(i => i.id)
|
||||
availableDocuments.value = await useFiles().selectSomeDocuments(ids)
|
||||
|
||||
|
||||
}
|
||||
|
||||
setup()
|
||||
|
||||
const loadCostCentres = async () => {
|
||||
costcentres.value = await useSupabaseSelect("costcentres")
|
||||
|
||||
}
|
||||
loadCostCentres()
|
||||
|
||||
const useNetMode = ref(false)
|
||||
|
||||
const loadedFile = ref(null)
|
||||
@@ -129,6 +138,11 @@ const createIncomingInvoice = async () => {
|
||||
|
||||
}
|
||||
|
||||
const setCostCentre = async (item,data) => {
|
||||
await loadCostCentres()
|
||||
item.costCentre = data.id
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@@ -145,10 +159,14 @@ const createIncomingInvoice = async () => {
|
||||
<UDashboardPanelContent>
|
||||
<div v-if="!loadedFile">
|
||||
<DocumentList
|
||||
v-if="availableDocuments.length > 0"
|
||||
:documents="availableDocuments"
|
||||
:return-document-id="true"
|
||||
@selectDocument="(documentId) => loadFile(documentId)"
|
||||
/>
|
||||
<div v-else class="w-full text-center">
|
||||
<span class="text-xl font-medium mt-10">Keine Dateien zum zuweisen verfügbar</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
@@ -219,11 +237,11 @@ const createIncomingInvoice = async () => {
|
||||
{{dataStore.vendors.find(vendor => vendor.id === itemInfo.vendor) ? dataStore.vendors.find(vendor => vendor.id === itemInfo.vendor).name : 'Lieferant auswählen'}}
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UButton
|
||||
@click="router.push('/standardEntity/vendors/create')"
|
||||
>
|
||||
+ Lieferant
|
||||
</UButton>
|
||||
<EntityModalButtons
|
||||
type="vendors"
|
||||
:id="itemInfo.vendor"
|
||||
@return-data="(data) => itemInfo.vendor = data.id"
|
||||
/>
|
||||
</InputGroup>
|
||||
|
||||
|
||||
@@ -345,6 +363,9 @@ const createIncomingInvoice = async () => {
|
||||
<template #label>
|
||||
{{dataStore.accounts.find(account => account.id === item.account) ? dataStore.accounts.find(account => account.id === item.account).label : "Keine Kategorie ausgewählt" }}
|
||||
</template>
|
||||
<template #option="{option}">
|
||||
{{option.number}} - {{option.label}}
|
||||
</template>
|
||||
|
||||
</USelectMenu>
|
||||
</UFormGroup>
|
||||
@@ -352,18 +373,25 @@ const createIncomingInvoice = async () => {
|
||||
label="Kostenstelle"
|
||||
class=" 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">{{option.number}} - Fahrzeug - {{option.name}}</span>
|
||||
<span v-else-if="option.project">{{option.number}} - Projekt - {{option.name}}</span>
|
||||
<span v-else-if="option.inventoryitem">{{option.number}} - Inventarartikel - {{option.name}}</span>
|
||||
<span v-else>{{option.number}} - {{option.name}}</span>
|
||||
</template>
|
||||
|
||||
</USelectMenu>
|
||||
@@ -374,6 +402,11 @@ const createIncomingInvoice = async () => {
|
||||
icon="i-heroicons-x-mark"
|
||||
@click="item.costCentre = null"
|
||||
/>
|
||||
<EntityModalButtons
|
||||
type="costcentres"
|
||||
:id="item.costCentre"
|
||||
@return-data="(data) => setCostCentre(item,data)"
|
||||
/>
|
||||
</InputGroup>
|
||||
|
||||
</UFormGroup>
|
||||
|
||||
Reference in New Issue
Block a user