diff --git a/pages/incomingInvoices/show/[id].vue b/pages/incomingInvoices/show/[id].vue index 895fa18..fe40b86 100644 --- a/pages/incomingInvoices/show/[id].vue +++ b/pages/incomingInvoices/show/[id].vue @@ -10,24 +10,9 @@ const profileStore = useProfileStore() const supabase = useSupabaseClient() const route = useRoute() const router = useRouter() -const toast = useToast() -const availableDocuments = 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)).data.map(i => i.id) - availableDocuments.value = await useFiles().selectSomeDocuments(ids) - -} - -setup() - - -//let currentDocument = ref(null) //Working const mode = ref(route.params.mode || "show") -const useNetMode = ref(false) const itemInfo = ref({ vendor: 0, @@ -56,19 +41,16 @@ const itemInfo = ref({ const currentDocument = ref(null) +const loading = ref(true) + const setupPage = async () => { - if((mode.value === "show" || mode.value === "edit" ) && route.params.id){ - itemInfo.value = await useSupabaseSelectSingle("incominginvoices",route.params.id,"*, files(*)") + if((mode.value === "show") && route.params.id){ + itemInfo.value = await useSupabaseSelectSingle("incominginvoices",route.params.id,"*, files(*), vendor(*)") currentDocument.value = await useFiles().selectDocument(itemInfo.value.files[0].id) } - console.log(itemInfo.value) - + loading.value = false } - - - - const setState = async (newState) => { if(mode.value === 'show') { await dataStore.updateItem('incominginvoices',{...itemInfo.value, state: newState}) @@ -95,7 +77,7 @@ setupPage() - +
Status: {{itemInfo.state}}

Datum: {{dayjs(itemInfo.date).format('DD.MM.YYYY')}}

Fälligkeitsdatum: {{dayjs(itemInfo.dueDate).format('DD.MM.YYYY')}}

-

Lieferant: {{dataStore.getVendorById(itemInfo.vendor).name}}

+

Lieferant: {{itemInfo.vendor.name}}

Bezahlt: {{itemInfo.paid ? "Ja" : "Nein"}}

Beschreibung: {{itemInfo.description}}

@@ -130,6 +112,7 @@ setupPage()
+