Changed Rendering of IncomingInvoice when not in editing

This commit is contained in:
2024-04-16 18:13:49 +02:00
parent ac9fadf922
commit 633d75b798
2 changed files with 49 additions and 19 deletions

View File

@@ -132,7 +132,7 @@ const setState = async (newState) => {
} else if(mode.value === 'edit') { } else if(mode.value === 'edit') {
await dataStore.updateItem('incominginvoices',{...itemInfo.value, state: newState}) await dataStore.updateItem('incominginvoices',{...itemInfo.value, state: newState})
} }
await router.push("/receipts") await router.push("/incomingInvoices")
} }
@@ -155,13 +155,18 @@ setupPage()
> >
Speichern Speichern
</UButton> </UButton>
<UButton <UTooltip
:disabled="itemInfo.state !== 'Entwurf'" text="Bearbeiten ist nur im Entwurfsstatus möglich"
@click="router.push(`/incominginvoices/edit/${itemInfo.id}`)"
v-if="mode !== 'edit'"
> >
Bearbeiten <UButton
</UButton> :disabled="itemInfo.state !== 'Entwurf'"
@click="router.push(`/incominginvoices/edit/${itemInfo.id}`)"
v-if="mode !== 'edit'"
>
Bearbeiten
</UButton>
</UTooltip>
<UButton <UButton
@click="setState('Entwurf')" @click="setState('Entwurf')"
v-if="itemInfo.state !== 'Entwurf'" v-if="itemInfo.state !== 'Entwurf'"
@@ -211,12 +216,23 @@ setupPage()
<div class="w-2/5 mx-5"> <div class="w-2/5 mx-5">
<div v-if="mode === 'show'"> <div v-if="mode === 'show'">
{{itemInfo}}
<div class="truncate mb-5">
<p>Status: {{itemInfo.state}}</p>
<p>Datum: {{dayjs(itemInfo.date).format('DD.MM.YYYY')}}</p>
<p>Fälligkeitsdatum: {{dayjs(itemInfo.dueDate).format('DD.MM.YYYY')}}</p>
<p>Lieferant: <nuxt-link :to="`/vendors/show/${itemInfo.vendor}`">{{dataStore.getVendorById(itemInfo.vendor).name}}</nuxt-link></p>
<p>Bezahlt: {{itemInfo.paid}}</p>
<p>Beschreibung: {{itemInfo.description}}</p>
<!-- TODO: Buchungszeilen darstellen -->
</div>
<HistoryDisplay <HistoryDisplay
type="incomingInvoice" type="incomingInvoice"
v-if="itemInfo" v-if="itemInfo"
:element-id="itemInfo.id" :element-id="itemInfo.id"
:render-headline="true"
/> />
</div> </div>

View File

@@ -1,4 +1,5 @@
<script setup> <script setup>
import dayjs from "dayjs"
definePageMeta({ definePageMeta({
middleware: "auth" middleware: "auth"
}) })
@@ -20,26 +21,26 @@ const router = useRouter()
const templateColumns = [ const templateColumns = [
{ {
key: 'title', key: 'state',
label: "Titel:", label: "Status:",
sortable: true sortable: true
}, },
{ {
key: "start", key: "date",
label: "Start", label: "Datum",
sortable: true sortable: true
}, },
{ {
key: "end", key: "vendor",
label: "Ende" label: "Lieferant"
}, },
{ {
key: "resources", key: "dueDate",
label: "Resourcen" label: "Fälligkeitsdatum"
}, },
{ {
key: "project", key: "paid",
label: "Projekt" label: "Bezahlt"
} }
] ]
const selectedColumns = ref(templateColumns) const selectedColumns = ref(templateColumns)
@@ -103,12 +104,25 @@ const filteredRows = computed(() => {
<UDashboardPanelContent> <UDashboardPanelContent>
<UTable <UTable
:rows="filteredRows" :rows="filteredRows"
:columns="columns"
class="w-full" class="w-full"
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }" :ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
@select="(i) => router.push(`/incomingInvoices/show/${i.id}`) " @select="(i) => router.push(`/incomingInvoices/show/${i.id}`) "
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Belege anzuzeigen' }" :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Belege anzuzeigen' }"
> >
<template #date-data="{row}">
{{dayjs(row.date).format("DD.MM.YYYY")}}
</template>
<template #vendor-data="{row}">
{{dataStore.getVendorById(row.vendor).name}}
</template>
<template #dueDate-data="{row}">
{{dayjs(row.dueDate).format("DD.MM.YYYY")}}
</template>
<template #paid-data="{row}">
<span v-if="row.paid" class="text-primary-500">Bezahlt</span>
<span v-else class="text-rose-600">Offen</span>
</template>
</UTable> </UTable>
</UDashboardPanelContent> </UDashboardPanelContent>