Changes in CreatedDocuments Edit
This commit is contained in:
@@ -6,7 +6,6 @@ import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
const dataStore = useDataStore()
|
||||
const profileStore = useProfileStore()
|
||||
const user = useSupabaseUser()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const supabase = useSupabaseClient()
|
||||
@@ -63,7 +62,6 @@ const itemInfo = ref({
|
||||
})
|
||||
|
||||
|
||||
|
||||
const letterheads = ref([])
|
||||
const createdDocuments = ref([])
|
||||
const projects = ref([])
|
||||
@@ -189,6 +187,7 @@ const setupPage = async () => {
|
||||
|
||||
}
|
||||
|
||||
setupPage()
|
||||
const openAdvanceInvoices = ref([])
|
||||
const checkForOpenAdvanceInvoices = async () => {
|
||||
const {data,error} = await supabase.from("createddocuments").select().eq("project", itemInfo.value.project).eq("advanceInvoiceResolved", false).eq("type","advanceInvoices")
|
||||
@@ -473,8 +472,8 @@ const documentTotal = computed(() => {
|
||||
|
||||
|
||||
return {
|
||||
totalNet: `${String(totalNet.toFixed(2)).replace(".",",")} €`,
|
||||
total19: `${String(total19.toFixed(2)).replace(".",",")} €`,
|
||||
totalNet: renderCurrency(totalNet),
|
||||
total19: renderCurrency(total19),
|
||||
totalGross: renderCurrency(totalGross),
|
||||
totalGrossAlreadyPaid: renderCurrency(totalGrossAlreadyPaid),
|
||||
totalSumToPay: renderCurrency(sumToPay)
|
||||
@@ -559,7 +558,7 @@ const getDocumentData = () => {
|
||||
|
||||
if(!['pagebreak','title','text'].includes(row.mode)) {
|
||||
if(row.mode === 'normal') row.text = products.value.find(i => i.id === row.product).name
|
||||
if(row.mode === 'service') row.text = dataStore.getServiceById(row.service).name
|
||||
if(row.mode === 'service') row.text = services.value.find(i => i.id === row.service).name
|
||||
|
||||
|
||||
return {
|
||||
@@ -636,13 +635,26 @@ const generateDocument = async () => {
|
||||
const ownTenant = profileStore.ownTenant
|
||||
const path = letterheads.value.find(i => i.id === itemInfo.value.letterhead).path
|
||||
|
||||
const {data,error} = await supabase.functions.invoke('create_pdf',{
|
||||
body: {
|
||||
invoiceData: getDocumentData(),
|
||||
backgroundPath: path,
|
||||
returnMode: "base64"
|
||||
}
|
||||
})
|
||||
|
||||
const {data,error} = await supabase.storage.from("files").download(path)
|
||||
|
||||
|
||||
//const {data,error} = await supabase.storage.from("files").download(path)
|
||||
|
||||
//console.log(data)
|
||||
//console.log(error)
|
||||
|
||||
uri.value = await useCreatePdf(getDocumentData(), await data.arrayBuffer())
|
||||
//console.log(JSON.stringify(getDocumentData()))
|
||||
|
||||
uri.value = `data:${data.mimeType};base64,${data.base64}`
|
||||
|
||||
//uri.value = await useCreatePdf(getDocumentData(), await data.arrayBuffer())
|
||||
//alert(uri.value)
|
||||
showDocument.value = true
|
||||
//console.log(uri.value)
|
||||
@@ -821,7 +833,23 @@ const closeDocument = async () => {
|
||||
//console.log(uri)
|
||||
}
|
||||
|
||||
setupPage()
|
||||
const setRowData = (row) => {
|
||||
if(row.service) {
|
||||
row.unit = services.value.find(i => i.id === row.service).unit
|
||||
row.price = services.value.find(i => i.id === row.service).sellingPriceComposed.total || services.value.find(i => i.id === row.service).sellingPrice
|
||||
row.description = services.value.find(i => i.id === row.service).description
|
||||
}
|
||||
|
||||
if(row.product) {
|
||||
row.unit = services.value.find(i => i.id === row.service).unit
|
||||
row.price = services.value.find(i => i.id === row.service).sellingPriceComposed.total || services.value.find(i => i.id === row.service).sellingPrice
|
||||
row.description = services.value.find(i => i.id === row.service).description
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -854,8 +882,6 @@ setupPage()
|
||||
<UDashboardPanelContent>
|
||||
<UTabs class="p-5" :items="tabItems" @change="onChangeTab" v-if="loaded">
|
||||
<template #item="{item}">
|
||||
|
||||
|
||||
<div v-if="item.label === 'Editor'">
|
||||
|
||||
<UAlert
|
||||
@@ -878,29 +904,6 @@ setupPage()
|
||||
|
||||
<InputGroup>
|
||||
<div class="w-1/3 mr-5">
|
||||
<UFormGroup
|
||||
v-if="itemInfo.linkedDocument"
|
||||
label="Verknüpftes Dokument:"
|
||||
>
|
||||
<InputGroup class="w-full">
|
||||
<USelectMenu
|
||||
class="flex-auto"
|
||||
:options="createdDocuments"
|
||||
v-model="itemInfo.linkedDocument"
|
||||
option-attribute="documentNumber"
|
||||
value-attribute="id"
|
||||
disabled
|
||||
/>
|
||||
<UButton
|
||||
variant="outline"
|
||||
color="rose"
|
||||
v-if="itemInfo.linkedDocument"
|
||||
icon="i-heroicons-x-mark"
|
||||
@click="itemInfo.linkedDocument = null"
|
||||
/>
|
||||
</InputGroup>
|
||||
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Dokumenttyp:"
|
||||
>
|
||||
@@ -910,7 +913,7 @@ setupPage()
|
||||
v-model="itemInfo.type"
|
||||
value-attribute="type"
|
||||
option-attribute="label"
|
||||
@change="setDocumentTypeConfig"
|
||||
@input="setDocumentTypeConfig"
|
||||
class="flex-auto"
|
||||
>
|
||||
<template #label>
|
||||
@@ -1005,7 +1008,7 @@ setupPage()
|
||||
searchable
|
||||
searchable-placeholder="Suche..."
|
||||
v-model="itemInfo.customer"
|
||||
@change="setCustomerData"
|
||||
@input="setCustomerData"
|
||||
class="flex-auto mr-2"
|
||||
>
|
||||
<UButton
|
||||
@@ -1013,14 +1016,10 @@ setupPage()
|
||||
variant="outline"
|
||||
class="w-full"
|
||||
>
|
||||
<!-- <span class="truncate text-left">{{dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).name : "Kein Kunde ausgewählt"}}</span>-->
|
||||
{{dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).name : "Kein Kunde ausgewählt"}}
|
||||
|
||||
<UIcon name="i-heroicons-chevron-right-20-solid" class="w-5 h-5 transition-transform text-gray-400 dark:text-gray-500" :class="['transform rotate-90']" />
|
||||
</UButton>
|
||||
<!-- <template #label>
|
||||
{{dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).name : "Kein Kunde ausgewählt"}}
|
||||
</template>-->
|
||||
</USelectMenu>
|
||||
<UButton
|
||||
variant="outline"
|
||||
@@ -1200,7 +1199,7 @@ setupPage()
|
||||
v-model="itemInfo.contactPerson"
|
||||
option-attribute="fullName"
|
||||
value-attribute="id"
|
||||
@change="setContactPersonData"
|
||||
@input="setContactPersonData"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
@@ -1231,7 +1230,7 @@ setupPage()
|
||||
:search-attributes="['name']"
|
||||
class="w-full"
|
||||
:disabled="!itemInfo.customer"
|
||||
@change="checkForOpenAdvanceInvoices"
|
||||
@input="checkForOpenAdvanceInvoices"
|
||||
>
|
||||
<template #label>
|
||||
{{dataStore.getProjectById(itemInfo.project) ? dataStore.getProjectById(itemInfo.project).name : "Kein Projekt ausgewählt"}}
|
||||
@@ -1401,366 +1400,360 @@ setupPage()
|
||||
<th v-if="itemInfo.type !== 'deliveryNotes'">Gesamt</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<draggable
|
||||
v-model="itemInfo.rows"
|
||||
handle=".handle"
|
||||
tag="tbody"
|
||||
itemKey="pos"
|
||||
@end="setPosNumbers"
|
||||
>
|
||||
<template #item="{element: row}">
|
||||
<tr>
|
||||
<td>
|
||||
<UIcon
|
||||
class="handle"
|
||||
name="i-mdi-menu"
|
||||
/>
|
||||
</td>
|
||||
<td
|
||||
v-if="row.mode === 'pagebreak'"
|
||||
colspan="9"
|
||||
>
|
||||
<UDivider/>
|
||||
</td>
|
||||
<td
|
||||
v-if="row.mode === 'text'"
|
||||
colspan="9"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.text"
|
||||
placeholder="Titel"
|
||||
maxlength="60"
|
||||
/>
|
||||
<UTextarea
|
||||
class="mt-2"
|
||||
v-model="row.description"
|
||||
placeholder="Text"
|
||||
/>
|
||||
</td>
|
||||
<td
|
||||
v-if="!['pagebreak','text'].includes(row.mode)"
|
||||
>{{row.pos}}</td>
|
||||
<td
|
||||
class="w-120"
|
||||
v-if="row.mode === 'free'"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.text"
|
||||
placeholder="Name"
|
||||
class="min-w-40"
|
||||
/>
|
||||
</td>
|
||||
<td
|
||||
class="w-120"
|
||||
v-else-if="row.mode === 'normal'"
|
||||
>
|
||||
<InputGroup class="w-full">
|
||||
<USelectMenu
|
||||
class="flex-auto"
|
||||
:options="products"
|
||||
:color="row.product ? 'primary' : 'rose'"
|
||||
option-attribute="name"
|
||||
value-attribute="id"
|
||||
searchable
|
||||
searchable-placeholder="Suche ..."
|
||||
:search-attributes="['name']"
|
||||
v-model="row.product"
|
||||
@change="row.unit = products.find(i => i.id === row.product).unit,
|
||||
<draggable
|
||||
v-model="itemInfo.rows"
|
||||
handle=".handle"
|
||||
tag="tbody"
|
||||
itemKey="pos"
|
||||
@end="setPosNumbers"
|
||||
>
|
||||
<template #item="{element: row}">
|
||||
<tr>
|
||||
<td>
|
||||
<UIcon
|
||||
class="handle"
|
||||
name="i-mdi-menu"
|
||||
/>
|
||||
</td>
|
||||
<td
|
||||
v-if="row.mode === 'pagebreak'"
|
||||
colspan="9"
|
||||
>
|
||||
<UDivider/>
|
||||
</td>
|
||||
<td
|
||||
v-if="row.mode === 'text'"
|
||||
colspan="9"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.text"
|
||||
placeholder="Titel"
|
||||
maxlength="60"
|
||||
/>
|
||||
<UTextarea
|
||||
class="mt-2"
|
||||
v-model="row.description"
|
||||
placeholder="Text"
|
||||
/>
|
||||
</td>
|
||||
<td
|
||||
v-if="!['pagebreak','text'].includes(row.mode)"
|
||||
>{{row.pos}}</td>
|
||||
<td
|
||||
class="w-120"
|
||||
v-if="row.mode === 'free'"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.text"
|
||||
placeholder="Name"
|
||||
class="min-w-40"
|
||||
/>
|
||||
</td>
|
||||
<td
|
||||
class="w-120"
|
||||
v-else-if="row.mode === 'normal'"
|
||||
>
|
||||
<InputGroup class="w-full">
|
||||
<USelectMenu
|
||||
class="flex-auto"
|
||||
:options="products"
|
||||
:color="row.product ? 'primary' : 'rose'"
|
||||
option-attribute="name"
|
||||
value-attribute="id"
|
||||
searchable
|
||||
searchable-placeholder="Suche ..."
|
||||
:search-attributes="['name']"
|
||||
v-model="row.product"
|
||||
@input="row.unit = products.find(i => i.id === row.product).unit,
|
||||
row.price = (products.find(i => i.id === row.product).sellingPrice || 0),
|
||||
row.description = products.find(i => i.id === row.product).description"
|
||||
>
|
||||
<template #label>
|
||||
<span class="truncate">{{row.product ? products.find(i => i.id === row.product).name : "Kein Produkt ausgewählt" }}</span>
|
||||
>
|
||||
<template #label>
|
||||
<span class="truncate">{{row.product ? products.find(i => i.id === row.product).name : "Kein Produkt ausgewählt" }}</span>
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UButton
|
||||
icon="i-heroicons-magnifying-glass"
|
||||
@click="showProductSelectionModal = true"
|
||||
/>
|
||||
<UModal v-model="showProductSelectionModal">
|
||||
<UCard>
|
||||
<template #header>
|
||||
Artikel Auswählen
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UButton
|
||||
icon="i-heroicons-magnifying-glass"
|
||||
@click="showProductSelectionModal = true"
|
||||
/>
|
||||
<UModal v-model="showProductSelectionModal">
|
||||
<UCard>
|
||||
<template #header>
|
||||
Artikel Auswählen
|
||||
</template>
|
||||
|
||||
<InputGroup class="w-full">
|
||||
<UFormGroup label="Artikelkategorie:">
|
||||
<USelectMenu
|
||||
v-if="productcategories.length > 0"
|
||||
:options="[{name: 'Nicht zugeordnet',id:'not set'},...productcategories]"
|
||||
value-attribute="id"
|
||||
option-attribute="name"
|
||||
v-model="selectedProductcategorie"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</InputGroup>
|
||||
<UTable
|
||||
:rows="selectedProductcategorie !== 'not set' ? products.filter(i => i.productcategories.includes(selectedProductcategorie)) : products.filter(i => i.productcategories.length === 0)"
|
||||
:columns="[
|
||||
<InputGroup class="w-full">
|
||||
<UFormGroup label="Artikelkategorie:">
|
||||
<USelectMenu
|
||||
v-if="productcategories.length > 0"
|
||||
:options="[{name: 'Nicht zugeordnet',id:'not set'},...productcategories]"
|
||||
value-attribute="id"
|
||||
option-attribute="name"
|
||||
v-model="selectedProductcategorie"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</InputGroup>
|
||||
<UTable
|
||||
:rows="selectedProductcategorie !== 'not set' ? products.filter(i => i.productcategories.includes(selectedProductcategorie)) : products.filter(i => i.productcategories.length === 0)"
|
||||
:columns="[
|
||||
{key: 'name',label:'Name'},
|
||||
{key: 'manufacturer',label:'Hersteller'},
|
||||
{key: 'articleNumber',label:'Artikelnummer'},
|
||||
]"
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Artikel anzuzeigen' }"
|
||||
@select=" (i) => {
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Artikel anzuzeigen' }"
|
||||
@select=" (i) => {
|
||||
row.product = i.id
|
||||
row.unit = products.find(i => i.id === row.product).unit,
|
||||
row.price = (products.find(i => i.id === row.product).sellingPrice || 0),
|
||||
row.description = products.find(i => i.id === row.product).description
|
||||
showProductSelectionModal = false}"
|
||||
>
|
||||
>
|
||||
|
||||
</UTable>
|
||||
</UCard>
|
||||
</UModal>
|
||||
</InputGroup>
|
||||
</UTable>
|
||||
</UCard>
|
||||
</UModal>
|
||||
</InputGroup>
|
||||
|
||||
</td>
|
||||
<td
|
||||
class="w-120"
|
||||
v-else-if="row.mode === 'service'"
|
||||
>
|
||||
<InputGroup class="w-full">
|
||||
<USelectMenu
|
||||
class="flex-auto"
|
||||
:options="services"
|
||||
:color="row.service ? 'primary' : 'rose'"
|
||||
option-attribute="name"
|
||||
value-attribute="id"
|
||||
searchable
|
||||
searchable-placeholder="Suche ..."
|
||||
:search-attributes="['name']"
|
||||
v-model="row.service"
|
||||
@change="row.unit = dataStore.getServiceById(row.service).unit,
|
||||
row.price = dataStore.getServiceById(row.service).sellingPrice || 0,
|
||||
row.description = dataStore.getServiceById(row.service).description"
|
||||
>
|
||||
<template #label>
|
||||
<span class="truncate">{{dataStore.getServiceById(row.service) ? dataStore.getServiceById(row.service).name : "Keine Leistung ausgewählt" }}</span>
|
||||
</td>
|
||||
<td
|
||||
class="w-120"
|
||||
v-else-if="row.mode === 'service'"
|
||||
>
|
||||
<InputGroup class="w-full">
|
||||
<USelectMenu
|
||||
class="flex-auto"
|
||||
:options="services"
|
||||
:color="row.service ? 'primary' : 'rose'"
|
||||
option-attribute="name"
|
||||
value-attribute="id"
|
||||
searchable
|
||||
searchable-placeholder="Suche ..."
|
||||
:search-attributes="['name']"
|
||||
v-model="row.service"
|
||||
@input="setRowData(row)"
|
||||
>
|
||||
<template #label>
|
||||
<span class="truncate">{{services.find(i => i.id === row.service) ? services.find(i => i.id === row.service).name : "Keine Leistung ausgewählt" }}</span>
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UButton
|
||||
icon="i-heroicons-magnifying-glass"
|
||||
@click="showServiceSelectionModal = true"
|
||||
/>
|
||||
<UModal v-model="showServiceSelectionModal">
|
||||
<UCard>
|
||||
<template #header>
|
||||
Leistung Auswählen
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UButton
|
||||
icon="i-heroicons-magnifying-glass"
|
||||
@click="showServiceSelectionModal = true"
|
||||
/>
|
||||
<UModal v-model="showServiceSelectionModal">
|
||||
<UCard>
|
||||
<template #header>
|
||||
Leistung Auswählen
|
||||
</template>
|
||||
|
||||
<InputGroup class="w-full">
|
||||
<UFormGroup label="Leistungskategorie:">
|
||||
<USelectMenu
|
||||
v-if="servicecategories.length > 0"
|
||||
:options="[{name: 'Nicht zugeordnet',id:'not set'},...servicecategories]"
|
||||
value-attribute="id"
|
||||
option-attribute="name"
|
||||
v-model="selectedServicecategorie"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</InputGroup>
|
||||
<UTable
|
||||
:rows="selectedServicecategorie !== 'not set' ? services.filter(i => i.servicecategories.includes(selectedServicecategorie)) : services.filter(i => i.servicecategories.length === 0)"
|
||||
:columns="[
|
||||
<InputGroup class="w-full">
|
||||
<UFormGroup label="Leistungskategorie:">
|
||||
<USelectMenu
|
||||
v-if="servicecategories.length > 0"
|
||||
:options="[{name: 'Nicht zugeordnet',id:'not set'},...servicecategories]"
|
||||
value-attribute="id"
|
||||
option-attribute="name"
|
||||
v-model="selectedServicecategorie"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</InputGroup>
|
||||
<UTable
|
||||
:rows="selectedServicecategorie !== 'not set' ? services.filter(i => i.servicecategories.includes(selectedServicecategorie)) : services.filter(i => i.servicecategories.length === 0)"
|
||||
:columns="[
|
||||
{key: 'name',label:'Name'},
|
||||
{key: 'serviceNumber',label:'Leistungsnummer'},
|
||||
{key: 'sellingPrice',label:'Verkaufspreis'},
|
||||
]"
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Leistungen anzuzeigen' }"
|
||||
@select=" (i) => {
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Leistungen anzuzeigen' }"
|
||||
@select=" (i) => {
|
||||
row.service = i.id
|
||||
row.unit = dataStore.getServiceById(row.service).unit,
|
||||
row.price = dataStore.getServiceById(row.service).sellingPrice || 0,
|
||||
row.description = dataStore.getServiceById(row.service).description
|
||||
setRowData(row)
|
||||
showServiceSelectionModal = false}"
|
||||
>
|
||||
|
||||
</UTable>
|
||||
</UCard>
|
||||
</UModal>
|
||||
</InputGroup>
|
||||
</td>
|
||||
<td
|
||||
class="w-20"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode)"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.quantity"
|
||||
type="number"
|
||||
:step="dataStore.units.find(i => i.id === row.unit) ? dataStore.units.find(i => i.id === row.unit).step : '1' "
|
||||
|
||||
/>
|
||||
</td>
|
||||
<td
|
||||
class="w-40"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode)"
|
||||
>
|
||||
<USelectMenu
|
||||
v-model="row.unit"
|
||||
:options="dataStore.units"
|
||||
option-attribute="name"
|
||||
value-attribute="id"
|
||||
>
|
||||
<template #label>
|
||||
{{dataStore.units.find(i => i.id === row.unit) ? dataStore.units.find(i => i.id === row.unit).name : "Keine Einheit gewählt"}}
|
||||
</template>
|
||||
</USelectMenu>
|
||||
</td>
|
||||
<td
|
||||
class="w-40"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode) && itemInfo.type !== 'deliveryNotes'"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.price"
|
||||
type="number"
|
||||
step="0.001"
|
||||
:color="getRowMargin(row) > 0 ? 'primary' : 'rose'"
|
||||
>
|
||||
<template #trailing>
|
||||
<span class="text-gray-500 dark:text-gray-400 text-xs">EUR</span>
|
||||
</template>
|
||||
</UInput>
|
||||
</td>
|
||||
<td
|
||||
class="w-40"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode)&& itemInfo.type !== 'deliveryNotes'"
|
||||
|
||||
>
|
||||
<USelectMenu
|
||||
:options="[19,7,0]"
|
||||
v-model="row.taxPercent"
|
||||
>
|
||||
<template #option="{option}">
|
||||
{{option}} %
|
||||
</template>
|
||||
<template #label>
|
||||
{{row.taxPercent}} %
|
||||
</template>
|
||||
</USelectMenu>
|
||||
|
||||
</td>
|
||||
<td
|
||||
class="w-40"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode)&& itemInfo.type !== 'deliveryNotes'"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.discountPercent"
|
||||
type="number"
|
||||
step="0.01"
|
||||
placeholder="0"
|
||||
>
|
||||
<template #trailing>
|
||||
<span class="text-gray-500 dark:text-gray-400 text-xs">%</span>
|
||||
</template>
|
||||
</UInput>
|
||||
</td>
|
||||
<td
|
||||
class="w-40"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode)"
|
||||
>
|
||||
<UButton
|
||||
icon="i-heroicons-document-text"
|
||||
@click="row.showEdit = true"
|
||||
/>
|
||||
<UButton
|
||||
icon="i-mdi-water-drop-outline"
|
||||
class="ml-3"
|
||||
v-if="row.agriculture"
|
||||
@click="row.showEditDiesel = true"
|
||||
/>
|
||||
<UModal v-model="row.showEdit">
|
||||
<UCard>
|
||||
<template #header>
|
||||
Beschreibung bearbeiten
|
||||
</template>
|
||||
<UTextarea
|
||||
v-model="row.description"
|
||||
|
||||
>
|
||||
|
||||
</UTextarea>
|
||||
<template #footer>
|
||||
<UButton
|
||||
@click="row.showEdit = false"
|
||||
>
|
||||
Speichern
|
||||
</UButton>
|
||||
</template>
|
||||
</UTable>
|
||||
</UCard>
|
||||
|
||||
|
||||
</UModal>
|
||||
<UModal v-model="row.showEditDiesel">
|
||||
<UCard>
|
||||
<template #header>
|
||||
Dieselverbrauch bearbeiten
|
||||
</template>
|
||||
<UFormGroup
|
||||
label="Menge:"
|
||||
</InputGroup>
|
||||
</td>
|
||||
<td
|
||||
class="w-20"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode)"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.quantity"
|
||||
type="number"
|
||||
:step="dataStore.units.find(i => i.id === row.unit) ? dataStore.units.find(i => i.id === row.unit).step : '1' "
|
||||
|
||||
/>
|
||||
</td>
|
||||
<td
|
||||
class="w-40"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode)"
|
||||
>
|
||||
<USelectMenu
|
||||
v-model="row.unit"
|
||||
:options="dataStore.units"
|
||||
option-attribute="name"
|
||||
value-attribute="id"
|
||||
>
|
||||
<template #label>
|
||||
{{dataStore.units.find(i => i.id === row.unit) ? dataStore.units.find(i => i.id === row.unit).name : "Keine Einheit gewählt"}}
|
||||
</template>
|
||||
</USelectMenu>
|
||||
</td>
|
||||
<td
|
||||
class="w-40"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode) && itemInfo.type !== 'deliveryNotes'"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.price"
|
||||
type="number"
|
||||
step="0.001"
|
||||
:color="getRowMargin(row) > 0 ? 'primary' : 'rose'"
|
||||
>
|
||||
<template #trailing>
|
||||
<span class="text-gray-500 dark:text-gray-400 text-xs">EUR</span>
|
||||
</template>
|
||||
</UInput>
|
||||
</td>
|
||||
<td
|
||||
class="w-40"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode)&& itemInfo.type !== 'deliveryNotes'"
|
||||
|
||||
>
|
||||
<USelectMenu
|
||||
:options="[19,7,0]"
|
||||
v-model="row.taxPercent"
|
||||
>
|
||||
<template #option="{option}">
|
||||
{{option}} %
|
||||
</template>
|
||||
<template #label>
|
||||
{{row.taxPercent}} %
|
||||
</template>
|
||||
</USelectMenu>
|
||||
|
||||
</td>
|
||||
<td
|
||||
class="w-40"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode)&& itemInfo.type !== 'deliveryNotes'"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.discountPercent"
|
||||
type="number"
|
||||
step="0.01"
|
||||
placeholder="0"
|
||||
>
|
||||
<template #trailing>
|
||||
<span class="text-gray-500 dark:text-gray-400 text-xs">%</span>
|
||||
</template>
|
||||
</UInput>
|
||||
</td>
|
||||
<td
|
||||
class="w-40"
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode)"
|
||||
>
|
||||
<UButton
|
||||
icon="i-heroicons-document-text"
|
||||
@click="row.showEdit = true"
|
||||
/>
|
||||
<UButton
|
||||
icon="i-mdi-water-drop-outline"
|
||||
class="ml-3"
|
||||
v-if="row.agriculture"
|
||||
@click="row.showEditDiesel = true"
|
||||
/>
|
||||
<UModal v-model="row.showEdit">
|
||||
<UCard>
|
||||
<template #header>
|
||||
Beschreibung bearbeiten
|
||||
</template>
|
||||
<UTextarea
|
||||
v-model="row.description"
|
||||
|
||||
>
|
||||
|
||||
</UTextarea>
|
||||
<template #footer>
|
||||
<UButton
|
||||
@click="row.showEdit = false"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.agriculture.dieselUsage"
|
||||
>
|
||||
<template #trailing>
|
||||
L
|
||||
</template>
|
||||
</UInput>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Preis:"
|
||||
Speichern
|
||||
</UButton>
|
||||
</template>
|
||||
</UCard>
|
||||
|
||||
|
||||
</UModal>
|
||||
<UModal v-model="row.showEditDiesel">
|
||||
<UCard>
|
||||
<template #header>
|
||||
Dieselverbrauch bearbeiten
|
||||
</template>
|
||||
<UFormGroup
|
||||
label="Menge:"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.agriculture.dieselUsage"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.agriculture.dieselPrice"
|
||||
type="number"
|
||||
steps="0.01"
|
||||
>
|
||||
<template #trailing>
|
||||
€/L
|
||||
</template>
|
||||
</UInput>
|
||||
</UFormGroup>
|
||||
<template #footer>
|
||||
<UButton
|
||||
@click="row.showEditDiesel = false,
|
||||
<template #trailing>
|
||||
L
|
||||
</template>
|
||||
</UInput>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Preis:"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.agriculture.dieselPrice"
|
||||
type="number"
|
||||
steps="0.01"
|
||||
>
|
||||
<template #trailing>
|
||||
€/L
|
||||
</template>
|
||||
</UInput>
|
||||
</UFormGroup>
|
||||
<template #footer>
|
||||
<UButton
|
||||
@click="row.showEditDiesel = false,
|
||||
processDieselPosition()"
|
||||
>
|
||||
Speichern
|
||||
</UButton>
|
||||
</template>
|
||||
</UCard>
|
||||
>
|
||||
Speichern
|
||||
</UButton>
|
||||
</template>
|
||||
</UCard>
|
||||
|
||||
|
||||
</UModal>
|
||||
</td>
|
||||
<td
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode) && itemInfo.type !== 'deliveryNotes'"
|
||||
>
|
||||
</UModal>
|
||||
</td>
|
||||
<td
|
||||
v-if="!['pagebreak','title','text'].includes(row.mode) && itemInfo.type !== 'deliveryNotes'"
|
||||
>
|
||||
|
||||
<p class="text-right font-bold whitespace-nowrap"><span v-if="row.discountPercent !== 0" class="line-through mr-2 text-rose-500">{{getRowAmountUndiscounted(row)}} €</span>{{getRowAmount(row)}} €</p>
|
||||
</td>
|
||||
<td
|
||||
v-if="row.mode === 'title'"
|
||||
colspan="8"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.text"
|
||||
placeholder="Titel"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<UButton
|
||||
variant="ghost"
|
||||
color="rose"
|
||||
icon="i-heroicons-x-mark-16-solid"
|
||||
@click="removePosition(row.id)"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</draggable>
|
||||
</tbody>
|
||||
<p class="text-right font-bold whitespace-nowrap"><span v-if="row.discountPercent !== 0" class="line-through mr-2 text-rose-500">{{getRowAmountUndiscounted(row)}} €</span>{{getRowAmount(row)}} €</p>
|
||||
</td>
|
||||
<td
|
||||
v-if="row.mode === 'title'"
|
||||
colspan="8"
|
||||
>
|
||||
<UInput
|
||||
v-model="row.text"
|
||||
placeholder="Titel"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<UButton
|
||||
variant="ghost"
|
||||
color="rose"
|
||||
icon="i-heroicons-x-mark-16-solid"
|
||||
@click="removePosition(row.id)"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</draggable>
|
||||
</table>
|
||||
<UAlert
|
||||
v-else
|
||||
@@ -1819,8 +1812,6 @@ setupPage()
|
||||
Noch nicht abgerechnete Abschlagsrechnungen
|
||||
</UDivider>
|
||||
|
||||
<!-- Abzurechnende Abschlagsrechnungen -->
|
||||
|
||||
<div
|
||||
v-for="advanceInvoice in openAdvanceInvoices"
|
||||
:key="advanceInvoice.id"
|
||||
|
||||
Reference in New Issue
Block a user