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